Posts

javascript - When page is opened with window.open, how can the opened page allow the opener to access its contents? -

is possible page opened window.open allow examined cross-origin opener? (this use in internal applications, security not significant concern.) , if so, how? i've tried replacing of cors , same-origin policies can find , still access denied on properties child window. in particular trying use internet explorer 11 headers these of headers i've tried far access-control-allow-origin: http://web1.corp.local access-control-allow-credentials: true access-control-expose-headers: cache-control,content-language,content-type,expires,last-modified,pragma access-control-expose-methods: get,post,option,put,delete,head x-content-security-policy: default-src *;script-src * content-security-policy: default-src *;script-src * x-xss-protection: 0 x-permitted-cross-domain-policies: what i'm trying do... i want web1.corp.local execute javascript on page on web2.corp.local . control both domains; way web2 tell browser okay web1 read , execute things on web2 . request on ...

PHP Smarty Tags isset referer Session -

i can't figure out missing. plan: if customer come homepage products, shall save link , customer shall able point. if customer opens link directly, shall see link mainpage. {php} $go_back = htmlspecialchars($_server['http_referer']); {/php} {if $go_back|strpos:"https://kundencenter.example.org" === false} $_session['refererurl'] = $go_back; {elseif isset($smarty.session.refererurl)} <li id='primary_navbar-account'><a href='".$_session[refererurl]."'><i class='fa fa-home'></i> homepage</a></li> {else} <li id='primary_navbar-account'><a href='https://example.org'><i class='fa fa-home'></i> homepage</a></li> {/if}

unit testing - Running tests in single Python file with nose -

i'm using nose 1.3.7 anaconda 4.1.1 (python 3.5.2). want run unit tests in single file, e.g. foo.py . according documentation should able run: nosetests foo.py but when this, nose runs tests in files in directory! and if nose --help , usage documentation doesn't indicate there parameter. shows [options]. so can run tests in single file using nose? i have standalone python 3.4 version , nosetests foo.py runs tests in foo.py , nosetests spam.py runs test in spam.py . a plain nosetests command without option specified, runs tests in files names starting word test_ in directory. here's quoting test discovery documentation specifies rules test discovery.the last line of documentation clarifies cause anomaly. be aware plugins , command line options can change of rules. i suspect (and may wrong) has how anaconda configures nose install.

php - Redirect (headers already sent); I know they're sent, but how do I re-organize this to make sense? -

i have index calls "header.php" prior loading actual pages so: include 'includes/header.php'; if(isset($_get['page'])) { include'includes/pages/page.php'; } and then, in page, want user able "add new page" (from index.php?add_page=1) , redirect them "edit page created" (from index.php?edit_page=). if(isset($_post['add_page']) && $_post['add_page'] == 1) { if(!$add_user['error']) { //header("location: ".$page_url); //echo "<script type='text/javascript'>document.location.href='{$page_url}';</script>"; } } the 'header("location:")' fails because headers have been sent (which makes sense me); but, how possible me redirect in post , skip header since it's redirecting edit page without having code directly in header.php? quick answer: use javascript instead header(locati...

python - Can I use a trigger to add combinations of foreign keys? -

i'm in situation want multiples inserts on table trigger after insert. here python code understand objective first: d = dict() d["table1"] = ["1", "2"] d["table2"] = ["a","b"] itertools import product d["table12"] = [ (t1,t2,-1) t1, t2 in product(d["table1"], d["table2"])] here result: table12 product of values of d. {'table1': ['1', '2'], 'table2': ['a', 'b'], 'table12': [('1', 'a', -1), ('1', 'b', -1), ('2', 'a', -1), ('2', 'b', -1)]} using database i'm trying have same behavior trigger, , complete association combinations of primary keys. table1: pk name1 varchar table 2: pk name2 varchar table 12: pk (name1, name2) val integer fk (t1_name) reference table1 (name1) fk (t2_name) reference table2 (name2) create trigger table1_insert aft...

yii2 - PHP: Trying to get property of non-object, from BatchError object of Bing Ads API -

i error when try view error messages api. documentation says returns array of batcherror objects in partialerror field. when try access index property of batcherror, gives me error. wrong? https://msdn.microsoft.com/en-us/library/bing-ads-campaign-management-addadgroups.aspx#anchor_1 php notice – yii\base\errorexception trying property of non-object 1. in /cygdrive/c/users/chloe/workspace/bestsales/models/bingads.php @ line 384 $response = $campaignproxy->getservice()->addadgroups($request); } catch (\soapfault $e) { $this->handleexception($e); return null; } $adgroupsids = $response->adgroupids; $partialerrors = $response->partialerrors; foreach ($partialerrors $batcherror) { yii::error($batcherror); $adgroup = $adgroups[$batcherror->index]; # <<<< logs: 2016-09-11 22:15:59 [::1][1][v5adqit0fiae7bon3i1lks49m3][error][application] [ unserialize('o:8:"stdclass":8:{s:4:"c...

php - Laravel eloquent relationship user id issue -

i have many tables simplicity going show 2 affected ones. consist of: users announces one user can have many announces , 1 announce belongs 1 user. seems many 1 relationship (or think). schema creation database: schema::create('x_user', function($table) { $table->increments('id'); $table->string('name'); $table->string('email')->unique(); $table->string('password', 60); $table->remembertoken(); $table->timestamps(); }); schema::create('x_announce', function (blueprint $table) { $table->increments('id'); $table->integer('created_by')->unsigned(); $table->foreign('created_by')->references('id')->on('x_user')->ondelete('cascade'); $table->timestamps(); }); now models quite simple have on user model: public function announce...