Como utilizar lib do github no meu projeto Android Studio?

M

Marcelo Portela

estou precisando utilizar uma lib para dar zoom na imageview do Android Studio, após algumas pesquisas, encontrei uma lib no github que pode me ajudar, porém não consegui usá-la no meu projeto, alguém me explica como utilizar o github no meu projeto? Sou novo na área e estou conhecendo agora o github. Eu importei o projeto baixado porém ele abre como um novo projeto independente, aí não consegui usar nada.
 

Unreplied Threads

Design a circuit mechanism that will amplify the input current ltspice

  • quadespy
  • Physics
  • Replies: 0
I want to design a circuit mechanism that will amplify the input current by 6 times. The circuit must contain at least 3 MOSFETs, 1 independent source, 1 resistor. I tried but couldn't do it on ltspice. Can someone show me the circuit on ltspice ? thanks.

Voltage regulator with polarity depending on input

  • Ax34
  • Physics
  • Replies: 0
I'm pretty new to electronics, I have some very basic notions, and I need help with a little project I'm working on, basically I have an input that can vary between 4 and 13 volts and I need to keep a voltage that is fixed at around 1.4 volts, the catch is that the polarity of the input voltage can be inverted, and the output voltage should reflect the polarity of the input.

In other words I need to have the same polarity on the output but with a fixed voltage.

I found out on Wikipedia that a very simple voltage regulator can be constructed with a transistor, a resistor and a zener diode, but it only works with a fixed polarity, so I tried (with my very limited knowledge) to draw a schematic that would do what I need but I'm not sure at all that it can work, so I'm asking help to anyone with more experience than me.

On the left there's the input, and on the right is the output.

Thanks in advance to anyone.

circuit I'm working on

Connect 3-port and 1-port devices defined by S-matrices

  • akj
  • Physics
  • Replies: 0
There are two linear networks. The first is defined by 3-port S-matrix:

\$\mathrm{S}_\mathrm{A} = \left[ \begin{array}{lll} s_{11} & s_{12} & s_{13} \\ s_{21} & s_{22} & s_{23} \\ s_{31} & s_{32} & s_{33} \end{array} \right]\$

The second device is defined by reflection coefficient \$\mathrm{S}_\mathrm{B} = s_{11,B}\$

How to calculate the resulting matrix

\$ \mathrm{S}_\mathrm{C} = \left[ \begin{array}{ll} s_{11,\mathrm{C}} & s_{12,\mathrm{C}} \\ s_{21,\mathrm{C}} & s_{22,\mathrm{C}} \end{array} \right] \$

for circuit, in which 1-port device connected to the third port of 3-port device

Помогите решить проблему с discord.py (фото с ошибкой указано снизу) , пробивал переустанавливать и не помогло

  • Евгений
  • Technology
  • Replies: 0
(я уже поменял токен бота)
, в самом коде ошибок бить не должно , скорее всего ошибка с библиотекой discord.py . Переустанавливать пайтон и библиотеку я уже питался , не помогло.

Здраствуйте помогите мне с построничной пагинацией без перезагрузки

Всем доброго дня или вечера! Хотел бы обратится с помощью к вам дорогие разработчики ! у меня есть сайт с пагинацией на php и mysql все работает. но у меня есть проблема мне нужна пагинация без перезагрузки. как можно сюда впилить ajax обработчик в эту пагинацию пожалуйста не могли бы помочь не хватает логики

Code:
вот куски кода 

    class DBPaginator
{
    public  $page    = 1;   /* Текущая страница */
    public  $amt     = 0;   /* Кол-во страниц */
    public  $limit   = 5;  /* Кол-во элементов на странице */
    public  $total   = 0;   /* Общее кол-во элементов */
    public  $display = '';  /* HTML-код навигации */
 
    private $url     = '';       
    private $carrier = 'page';
 
    /**
     * Конструктор.
     */
    public function __construct($url, $limit = 0)
    {
        $this->url = $url;      
        
        if (!empty($limit)) {
            $this->limit = $limit;
        }       
 
        $page = intval(@$_GET['page']);
        if (!empty($page)) {
            $this->page = $page;
        }
 
        $query = parse_url($this->url, PHP_URL_QUERY);
        if (empty($query)) {
            $this->carrier = '?' . $this->carrier . '=';
        } else {
            $this->carrier = '&' . $this->carrier . '=';
        }
    }
 
    /**
     * Формирование HTML-кода навигации в переменную display.
     */
    public function getItems($sql)
    {
        // Подключение к БД
        $dbh = new PDO('mysql:dbname=CYBER_PC_CRAFTERS;host=localhost', 'root', '');
 
        // Получение записей для текущей страницы
        $start = ($this->page != 1) ? $this->page * $this->limit - $this->limit : 0;
        if (strstr($sql, 'SQL_CALC_FOUND_ROWS') === false) {
            $sql = str_replace('SELECT ', 'SELECT SQL_CALC_FOUND_ROWS ', $sql) . ' LIMIT ' . $start . ', ' . $this->limit;
        } else {
            $sql = $sql . ' LIMIT ' . $start . ', ' . $this->limit;
        }       
        
        $sth = $dbh->prepare($sql);
        $sth->execute();        
        $array = $sth->fetchAll(PDO::FETCH_ASSOC);
        
        // Узнаем сколько всего записей в БД 
        $sth = $dbh->prepare("SELECT FOUND_ROWS()");
        $sth->execute();
        $this->total = $sth->fetch(PDO::FETCH_COLUMN);
        
        $this->amt = ceil($this->total / $this->limit); 
        if ($this->page > $this->amt) {
            $this->page = $this->amt;
        }
 
        if ($this->amt > 1) {
            $adj = 2;   
            $this->display = '<nav class="pagination-row"><ul class="pagination justify-content-center">';
 
            /* Назад */
            if ($this->page == 1) {
                $this->addSpan('«', 'prev disabled');
            } elseif ($this->page == 2) {
                $this->addLink('«', '', 'prev');
            } else {
                $this->addLink('«', $this->carrier . ($this->page - 1), 'prev');
            }
 
            if ($this->amt < 7 + ($adj * 2)) {
                for ($i = 1; $i <= $this->amt; $i++){
                    $this->addLink($i, $this->carrier . $i);            
                }
            } elseif ($this->amt > 5 + ($adj * 2)) {
                $lpm = $this->amt - 1;
                if ($this->page < 1 + ($adj * 2)){
                    for ($i = 1; $i < 4 + ($adj * 2); $i++){
                        $this->addLink($i, $this->carrier . $i);
                    }
                    $this->addSpan('...', 'separator'); 
                    $this->addLink($lpm, $this->carrier . $lpm);
                    $this->addLink($this->amt, $this->carrier . $this->amt);    
                } elseif ($this->amt - ($adj * 2) > $this->page && $this->page > ($adj * 2)) {
                    $this->addLink(1);
                    $this->addLink(2, $this->carrier . '2');
                    $this->addSpan('...', 'separator'); 
                    for ($i = $this->page - $adj; $i <= $this->page + $adj; $i++) {
                        $this->addLink($i, $this->carrier . $i);
                    }
                    $this->addSpan('...', 'separator'); 
                    $this->addLink($lpm, $this->carrier . $lpm);
                    $this->addLink($this->amt, $this->carrier . $this->amt);    
                } else {
                    $this->addLink(1, '');
                    $this->addLink(2, $this->carrier . '2');
                    $this->addSpan('...', 'separator'); 
                    for ($i = $this->amt - (2 + ($adj * 2)); $i <= $this->amt; $i++) {
                        $this->addLink($i, $this->carrier . $i);
                    }
                }
            }
 
            /* Далее */
            if ($this->page == $this->amt) {
                $this->addSpan('»', 'next disabled');               
            } else {            
                $this->addLink('»', $this->carrier . ($this->page + 1));
            }
 
            $this->display .= '</ul></nav>';
        }
 
        return $array;  
    }
 
    private function addSpan($text, $class = '')
    {
        $class = 'page-item ' . $class;
        $this->display .= '<li class="' . trim($class) . '"><span class="page-link">' . $text . '</span></li>';     
    }   
 
    private function addLink($text, $url = '', $class = '')
    {
        if ($text == 1) {
            $url = '';
        }
 
        $class = 'page-item ' . $class . ' ';
        if ($text == $this->page) {
            $class .= 'active';
        }
        $this->display .= '<li class="' . trim($class) . '"><a class="page-link" href="' . $this->url . $url . '">' . $text . '</a></li>';
    }   
}

    <?php
// Текущий URL и 6 шт. на странице
$peger = new DBPaginator('', 2); 
$review = $peger->getItems("SELECT * FROM review");
 
/* Инфо о текущей странице */
echo '<p>Страница ' . $peger->page . ' из ' . $peger->amt . '</p>'; 
 
/* Вывод текста только на первой странице */
if ($peger->page == 1) {
    echo '<p>Описание на первой странице</p>';
}

?>

все работает на сайте выводятся товары и пагинация работает но я не могу понять как сюда ajax впихнуть и чтоб он делал фоновые запросы на сервер и выдавал их мне

Selenium Python ERR_CONNECTION_RESET

  • BOom GRIEFTM
  • Technology
  • Replies: 0
Всем добрый день! пишу небольшой selenium скрипт на python с использованием своего прокси (покупал на proxy6) прокси рабочий, при проверке на httpbin.org/ip ip адрес успешно изменяется. Хочу использовать прокси на сайте https://prenotami.esteri.it/, но сайт с использованием этого прокси не открывается и выдаёт ошибку ERR_CONNECTION_RESET.

Помогите пожалуйста, в чём может быть причина. Перепробовал уже все возможные варианты и все библиотеки для прокси что есть в интернете. Так же перепробовал три прокси разных стран (белорусия, сша, узбекистан) толку нету никакого, сайт так же не грузится, хотя другие сайты для проверки ip загружаются успешно и ip изменяется.

Вот мой код

Code:
import zipfile
import time
from selenium import webdriver
from selenium.webdriver.chrome.service import Service
from selenium.webdriver.chrome.options import Options

PROXY_HOST = 'host'  # rotating proxy or host
PROXY_PORT = 8000 # port
PROXY_USER = 'user' # username
PROXY_PASS = 'pass' # password

manifest_json = """
{
    "version": "1.0.0",
    "manifest_version": 2,
    "name": "Chrome Proxy",
    "permissions": [
        "proxy",
        "tabs",
        "unlimitedStorage",
        "storage",
        "<all_urls>",
        "webRequest",
        "webRequestBlocking"
    ],
    "background": {
        "scripts": ["background.js"]
    },
    "minimum_chrome_version":"22.0.0"
}
"""

background_js = """
var config = {
        mode: "fixed_servers",
        rules: {
        singleProxy: {
            scheme: "http",
            host: "%s",
            port: parseInt(%s)
        },
        bypassList: ["localhost"]
        }
    };
chrome.proxy.settings.set({value: config, scope: "regular"}, function() {});
function callbackFn(details) {
    return {
        authCredentials: {
            username: "%s",
            password: "%s"
        }
    };
}
chrome.webRequest.onAuthRequired.addListener(
            callbackFn,
            {urls: ["<all_urls>"]},
            ['blocking']
);
""" % (PROXY_HOST, PROXY_PORT, PROXY_USER, PROXY_PASS)

def get_chromedriver(use_proxy=False, user_agent=None):
    chrome_options = Options()
    chrome_options.binary_location = r"C:\Program Files\Google\Chrome\Application\chrome.exe"
    if use_proxy:
        pluginfile = 'proxy_auth_plugin.zip'

        with zipfile.ZipFile(pluginfile, 'w') as zp:
            zp.writestr("manifest.json", manifest_json)
            zp.writestr("background.js", background_js)
        chrome_options.add_extension(pluginfile)
    if user_agent:
        chrome_options.add_argument('--user-agent=%s' % user_agent)
    driver = webdriver.Chrome(
        service=Service(executable_path=r'path to driver'),
        options=chrome_options)
    return driver

def main():
    driver = get_chromedriver(use_proxy=True)
    #driver.get('https://www.google.com/search?q=my+ip+address')
    driver.get('http://httpbin.org/ip')
    time.sleep(500)
main()```

Question on complemented subspaces of a product space

Assume that we have closed subspaces $Y_1$ and $Y_2$ of Banach spaces $X_1$ and $X_2$, respectively. If the product $Y_1\times Y_2$ is complemented in $X_1\times X_2$, does it follow that $Y_i$ is complemented in $X_i$ for $i=1, 2$.
Top