$("#map").live("click", function(ob) {
ob.stopPropagation();
$("body").addClass("on-toggle");
});
$("body").live("click", function() {
$(this).removeClass("on-toggle");
});
$("#map").on("click", function(ob) {
ob.stopPropagation();
$("body").addClass("on-toggle");
});
$("body").on("click", function() {
$(this).removeClass("on-toggle");
});
$(document).ready(function () {
$('.Add').click(function(event){
_wrapper = $(this).closest('.wrapper');
sendPost('/add?id=' + $(this).attr('docId'), function(){
console.log(window.myAdd);
_wrapper.find('.Add').hide();
_wrapper.find('.Del').show();
});
});
$('.Del').click(function(event){
_wrapper = $(this).closest('.wrapper');
sendPost('/del?id=' + $(this).attr('docId'), function(){
_wrapper.find('.Add').show();
_wrapper.find('.Del').hide();
});
});
function sendPost(url, action){
$.post(url, function (data) {
if (data.result == true) {
action();
}
});
}
});
from threading import Thread
import httplib, sys
from queue import Queue
urls = ['url1', 'url2',.....]
concurrent = 200
def doWork():
while True:
url = q.get()
status, url = getStatus(url)
doSomethingWithResult(status, url)
q.task_done()
def getStatus(url):
try:
proxyRand = getRandProxy()
conn = httplib.HTTPConnection(proxyRand["ip"], proxyRand["port"])
conn.request("GET", url, headers={})
res = conn.getresponse()
return res.status, url
except Exception as e:
return e, url
def getRandProxy():
return {
"ip" : "127.0.0.1",
"port" : 80
}
def doSomethingWithResult(status, url):
print(status, url)
q = Queue(concurrent * 2)
for i in range(concurrent):
t = Thread(target=doWork)
t.daemon = True
t.start()
try:
for url in urls:
q.put(url.strip())
q.join()
except KeyboardInterrupt:
sys.exit(1)
RewriteEngine on
RewriteCond %{HTTP_HOST} ^www\.(.*) [NC]
RewriteRule ^(.*)$ http://%1/$1 [R=301,L]
RewriteCond %{REQUEST_URI} ^/(admin)
RewriteRule ^.*$ admin.php [L]
# если директория или файл существуют, использовать их напрямую
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# иначе отправлять запрос на файл index.php
RewriteRule . index.php
<?php
// change the following paths if necessary
$yii=dirname(__FILE__).'/framework/yii.php';
$config=dirname(__FILE__).'/protected/config/admin.php';
//defined('YII_DEBUG') or define('YII_DEBUG',true);
//defined('YII_TRACE_LEVEL') or define('YII_TRACE_LEVEL',3);
require_once($yii);
Yii::createWebApplication($config)->run();
<?php
$temp = array(
array('id' => 5273, 'parent' => 0, 'name' => 'John Doe'),
array('id' => 6032, 'parent' => 5273, 'name' => 'Sally Smith'),
array('id' => 6034, 'parent' => 6032, 'name' => 'Mike Jones'),
array('id' => 6035, 'parent' => 6034, 'name' => 'Jason Williams'),
array('id' => 6036, 'parent' => 5273, 'name' => 'Sara Johnson'),
array('id' => 6037, 'parent' => 5273, 'name' => 'Dave Wilson'),
array('id' => 6038, 'parent' => 6037, 'name' => 'Amy Martin')
);
function getBreadcrumbsArray($temp)
{
foreach ($temp as $item) {
$temp_i[$item['id']] = array(
'parent' => $item['parent'],
'name' => $item['name'],
);
}
foreach ($temp as $item) {
$breadcrumbs[] = array(
'id' => $item['id'],
'name' => implode(' -> ', getBreadcrumbs($temp_i, $item['id']))
);
}
return $breadcrumbs;
}
function getBreadcrumbs($data_array, $id, $breadcrumbs = array())
{
$breadcrumbs[] = $data_array[$id]['name'];
if( $data_array[$id]['parent'] == 0 )
{
return array_reverse($breadcrumbs);
}
else
{
return getBreadcrumbs($data_array, $data_array[$id]['parent'], $breadcrumbs);
}
}
$breadcrumbs = getBreadcrumbsArray($temp);
print_r($breadcrumbs);
?>
class Polls extends \yii\base\Widget {
public $message;
...
}
<?php
use app\components\Polls;
?>
<?= Polls::widget(['message' => ' Yii2.0']) ?>