Posts

Showing posts from May, 2015

Change each symbol excluding variables in bash using sed & regex -

i need change string like example \%^ $variable ${array[$element]} into string like \e\x\a\m\p\l\e\ \\\%\^\ $variable\ ${array[$element]} so, need escape each symbol except variables in 2 cases. also, , tricky, need escape them twice, result achieved using command: string='example \%^ $variable ${array[$element]}' echo `echo $string | sed 'magic' also, have achieved escaping characters: echo $(echo $string | sed -r -e 's/(.)/\\\\\1/g') so, question how not escape $variables? i pretty @ regex, working example suffice. explanations welcome. also, i'll post answer here if i'd find faster of you. think it's interesting puzzle solve :) if can use perl can done this: s='example \%^ $variable"abc" ${array[$element]} ${var}this' perl -pe 's/\$(?:{.*?}|\w+)(*skip)(*f)|(.)/\\$1/g' <<< "$s" output: \e\x\a\m\p\l\e\ \\\%\^\ $variable\"\a\b\c\"\ ${array[$element]}\ ${var

How to split char pointer with multiple delimiters & return array of char pointers in c++? -

in duplicate of question split char* char * array advised use string rather char*. need work lpwstr. since it's typedef of char*, prefer use char*. tried following code, gives wrong output: char**splitbymultipledelimiters(char*ori,char deli[],int lengthofdelimiterarray) { char*copy = ori; char** strarray = new char*[10]; int j = 0; int offset = 0; char*word = (char*)malloc(50); int length; int split = 0; for(int = 0; < (int)strlen(ori); i++) { for(int k = 0; (k < lengthofdelimiterarray) && (split == 0);k++) { if(ori[i] == deli[k]) { split = 1; } } if(split == 1)//ori[i] == deli[0] { length = - offset; strncpy(word,copy,length); word[length] = '\0'; strarray[j] = word; copy = ori + + 1; //cout << "copy: " << copy << endl;

jms - How to remove message payload on Mule? -

i want send message queue using jms component. however, don't want send payload message, simple string server date time, using mel expression #[server.datetime]. how can accomplish that? if put jms component inside async component, clone of original payload. point can want.

ubuntu - Only one of my ports is working as defined in my Nginx config -

my server working website defined on port 8000 (my.ip.ad.dress:8000) , not site defined on port 8888. nginx config follows: server { listen 8000 default_server; listen [::]:8000 default_server ipv6only=on; root /var/www/my-follow-up/public; index index.php index.html index.htm; server_name http://64.46.53.164/; location / { try_files $uri $uri/ /index.php?$query_string; } location ~ \.php$ { try_files $uri /index.php =404; fastcgi_split_path_info ^(.+\.php)(/.+)$; fastcgi_pass unix:/var/run/php5-fpm.sock; fastcgi_index index.php; fastcgi_param script_filename $document_root$fastcgi_script_name; include fastcgi_params; } } server { listen 8888; listen [::]:8888 default_server ipv6only=on; root /var/www/my-follow-up-external/public; index index.php index.html index.htm; server_name http://64.46.53.164/; location / { try_files $uri $uri/ /index.php?$query_string; } location ~ \.php$ { try_files $uri /index.

php - Does register_shutdown_function() get called before or after the response is echoed? -

i writing phalcon php application. in it, register shutdown function in constructor of class: public function __construct() { register_shutdown_function([$this, 'shutdownhandler']); } public function shutdownhandler() { $this->deliverqueue(); } whenever conditions run hold, waiting time response higher. i made small test: when comment out deliverqueue , response comes in 1 second. when replace line sleep(1), response comes after 5-6(!!!) seconds. when replace sleep(10), 500 error. per documentation, expect shutdown function activate after script execution finishes, therefore after response gets echoed back. is documentation incorrect? why happening? yes register_shutdown_function execute after script finishes or if attempt of exit or if error occurs register_shutdown_function run

blogger - gdata autentication trouble python -

i ran awhile python script post articles on blogspot blog. ran smoothly until started auth error requesterror: {'status': 401, 'body': 'user not have permission create new post', 'reason': 'unauthorized'} i can't understand how fix reading gdata documentation. could please suggest me how do? thank you here part of code doesn't work anymore: from gdata import service import gdata import atom blogger_service = service.gdataservice('xxxxxx','xxxxxx') blogger_service.service = 'blogger' blogger_service.account_type = 'google' blogger_service.server = 'www.blogger.com' blogger_service.programmaticlogin() def createpublicpost(blogger_service, blog_id, title, content,tags): entry = gdata.gdataentry() entry.title = atom.title('xhtml', title) entry.content = atom.content(content_type='html', text=content) tag in tags : category = atom.category(term=tag

javascript - What would be a good approach for providing d3 capability in a dust-helper? -

right i've been considering writing dust-helper renders barcharts dust files server-side using custom dust-helper , d3 module node. wondering if there better way construct sort of context object pass dust renderer: { padding: { top: integer, right: integer, bottom: integer, left: integer }, width: integer, height: integer, data: [datum, ...], x: { scale: { type: string, // 'linear', 'time', 'ordinal' range: 'extent', // optionally [lower, upper] tick: { // if applicable format: string, // d3 number format linear scale // d3 time format time scale args: integer | [interval, integer] } }, value: string, // datum[value] used x-axis }, y: { ... } } and on, have d3 use scheme render customized components , return svg markup string. seems verbose option me, lot of requirement add more , more attributes bloat context until becomes messy

theforeman - foreman dashboard is not opening -

i trying setup foreman , puppet master on same rhel7 server. have performed following steps: install puppet server [version: 3.8.2] install foreman including smart proxy [] after installation got message similar this: success! * foreman running @ https://server.example.com default credentials 'admin:password' * foreman proxy running @ https://server.example.com:8443 * puppetmaster running @ port 8140 full log @ /var/log/foreman-installer/foreman-installer.log but when hit of below url: https://server.example.com --- foreman https://server.example.com:8140 --- puppet master i not able open foreman dashboard. did not see errors in apache , other foreman logs well. any appreciated!!! i assuming "obfuscated" output, , doesn't "server.example.com" ? if have not, need start on proper dns entry / hostname configured on machine. as temporary test, run ip addr list can try going https://10.0.0.123/ (or whatev

python - How to fix this strange UnboundLocalError and implement a well working patching function? -

i determined write patch decorator monkey patch. thought easy code rises unboundlocalerror while running. source code here: def patch(source, target): def _(func): def __(): print source # `source` accessible expected _target = target # error here target = source func() target = _target return __ return _ import os @patch(patch, os) def f(): pass f() full traceback: traceback (most recent call last): file "test.py", line 18, in <module> f() file "test.py", line 4, in __ _target = target unboundlocalerror: local variable 'target' referenced before assignment the variable target should accessible variable source , have not idea why rise error. i hope want: def patch(source, target): t = target def _(func): def __(): print source _target = t target = source

android - How to handle the flow when a Network Exception is thrown -

i built app , need handle network exceptions in many places. want know way it. in activity have like: oncreate { ... fetchdata(); // needs internet processdata(); showdata(); } in fetchdata() method, might not fetch because there's no connectivity or poor signal. in case, show alertdialog , tell user there network issue, , when clicks ok try fetch again. the problem thread run fetchdata() , build , show dialog , keep running processdata() , on. method fetchdata() called 2 different places in app, ideal stop thread until tries again , load data. logic can use here? i know might simple question, i'm stuck on , don't know patterns apply. should propagate error , handle in calls fetchdata() , or there way stop thread until data loaded? edit: fetchdata() is working , runs background thread downloads data, , wait finish return response or null. far, if there's error null , logs me network error. want know how handle , keep flow ju

java - How to use named parameters in a native spring-data @Query? -

i'm trying set db query using spring-data-jpa , native query postgres database. following not work. why? @query(value = "select reltuples::bigint estimate pg_class oid = 'public.my_table'::regclass", nativequery = true) public int count(); result: java.lang.illegalargumentexception: org.hibernate.queryexception: not named parameters have been set: [:bigint, :regclass;] found it: :: have escaped \\:\\:

html - How to centralise images with an absolute position? -

this question has answer here: how make image center (vertically & horizontally) inside bigger div 36 answers i have 3 images in <div> . want images overlay each other (for slideshow using opacity) , remain central on website. to make images overlay set position absolute ( position: absolute; ). however, conflicts method of centralising images. make images central, give images following properties: margin: 0 auto; display: block; doesn't work when images' positions set absolute. other methods can use make images overlay and/or centralise images. <div> <img id="slideshow1" src="images\image1.jpg" width="512" height="512"> <img id="slideshow2" src="images\image2.png" width="512" height="512"> <img id="slideshow3" src="images\imag

android: gradle: how to copy a file? Issue to set a file readable, or to read it -

i blocked file reading in gradle. i try set files readable way in gradle: task readaccess(type: exec, description: 'set google-services.json readable.') { //--> check can read? --> can't read if (new file('src/google-services.json').canread()){ println 'readaccess > can read' } else { println 'readaccess > cant read' } //--> set readable. --> can't set readable if (new file('src/google-services.json').setreadable(true,false)) { println 'readaccess > access read modified' } else { println 'readaccess > access read not modified' } //--> check can read? --> can't read if (new file('src/google-services.json').canread()){ println 'readaccess > can read' } else { println 'readaccess > cant read' } } tasks.withtype(javacompile) { compiletask -> compiletask

c# - MSDN OneNote Api: Navigate to never before opened page without opening a OneNote Application Window -

my goal able use c# programmatically open .one section file , of section's page ids. in simple case (one have created , used section), can done following code: using microsoft.office.interop.onenote; class program { public static void processonenotefile() { application onenoteapp = new application(); string filepath = @"c:\users\admin\documents\onenote notebooks\my notebook\testsection.one"; string sectionid; onenoteapp.openhierarchy(filepath, null, out sectionid); string hierarchy; onenoteapp.gethierarchy(sectionid, hierarchyscope.hspages, out hierarchy); file.writealltext(@"c:\hierarchy.txt", hierarchy); } } from here can parse xml find pageids , go. the problem, however, want files getting else , have never opened before. when run same code on files, cannot find pageids in hierarchy, , therefore, cannot process pages. fix seems work use navigateto method open section file in onenot

angularjs - How to get the parent and child ids from location -

in url have id's this: http://localhost:3000/#/projectsummary/2/3?id from need both 2 (parent id) , 3 (child id) using $location.search how both seperately. because need request 2 seperate query here. at present using : console.log( $location.search('id') ); it giving me : {$$protocol: "http", $$host: "localhost", $$port: 3000, $$path: "/projectsummary/2/3", $$search: object…}$$absurl: "http://localhost:3000/#/projectsummary/2/3?id"$$compose: ()$$hash: ""$$host: "localhost"$$parse: (d)$$parselinkurl: (a,c)$$path: "/projectsummary/2/3"$$port: 3000$$protocol: "http"$$replace: false$$search: object$$state: null$$url: "/projectsummary/2/3?id" from how can both id's 2 , 3 ? angular $location.search() output id now have id separate, lets other values... $location.path() output /#/projectsummary/2/3 now can this: $location.path().replace("

sql - Database design ideas for "master and slave" nodes -

we in design phase of product. idea have master (calling it) contains user information including user/registration/role/licence etc. , have slave database (calling it) contains main application related data. some columns master database used in slave database. e.g. userid used everywhere in slave database. there multiple versions of salve in different tiers (depending on customers subscription). e.g. customer have dedicated slave databases application. also data/tables/columns slave used in master. how manage scenario can have maximum referential integrity (i know not possible time) without using linked servers. (we dont want use linked servers because improper design can abused , can effect performance result). or bad idea. have single database design (no master/slave) different nodes. , customer's data in different nodes depending on subscription? problem see registration/user tables fragmented in different database nodes. e.g. usera in database01 , on. any idea?

Decomposition and reconstruction step in Tabu search -

i'm looking step step coding decomposition , reconstruction step in tabu search heuristic in java don't understand bolded words. what , how can explain in java coding after partitioning initial solution subsets of routes or subproblem. each subset of route processed tabu search. best routes found every subproblem merged form next solution decomposition , reconstruction step. after loop of d&r final route recorded. the decomposition based on polar angle associated center of gravity of each route . using these polar angles , domain partitioned sectors approximately contain same number of routes. note decomposition changes 1 d&r next choosing different starting angle creating sectors, allowing cross exchange heuristic exploit new pairs of routes. thank in advance

stackexchange.redis - How to use redis sentinel to get configuration of current master? -

i have configured redis servers 1 master , 2 salves , 1 sentinel monitor master. per documentation if master down sentinel promote of slave master. question how configuration of replaced master using c# code via sentinel??? thank in advance....

html - Jquery slide left right with button -

i creating simple jquery slide. when user clicks on button 1 div box show form right , 1 hide form left. here code in when click on button div's moves right left none of them hide form left. <!doctype html> <html> <head> <title></title> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css"> <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script> <style> .row{ max-height: 40px; overflow: hidden; background-color: pink; } .col-md-4{ border: 10px solid #eee; } </style> </head> <body> <div class="container"> <div class="row"> <div class="col-md-4">gh</div> <div class="col-md-4">gh</div> <div class="col-md-4">gh</div> <div cl

c# - Wcf - Get Request and Response with System.Diagnostics -

. hello i have wcf , have record request , associated response. today seem request , response, have no id associate. using following configuration in .config: <system.diagnostics> <sources> <source name="system.servicemodel.messagelogging"> <listeners> <add name="xml" /> </listeners> </source> </sources> <sharedlisteners> <add name="xml" type="ctx_host.webtracelistener, ctx_host" /> </sharedlisteners> </system.diagnostics> <system.servicemodel> <diagnostics> <messagelogging logentiremessage="true" logmalformedmessages="false" logmessagesatservicelevel="true" logmessagesattransportlevel="true" maxmessagestolog="300000" maxsizeofmessagetolog="200000"/> &

jquery - Circular CSS shape with drop shadow and border-bottom -

Image
update found out elliptical border radius. achieved same result looking for, border thickens ellipsis if know's better approach i'm still looking. here's jsfiddle - result looks code used in fiddle border-bottom: 3px solid green; -moz-border-radius-bottomleft: 70% 40px; -webkit-border-bottom-left-radius: 70% 40px; -webkit-box-shadow: 0 3px 7px 0 rgba(0,0,0,0.91) ; box-shadow: 0 3px 7px 0 rgba(0,0,0,0.91) ; original post i wondering if possible create shape similar 1 below the shape overlaping image. know create recntagular div border-bottom-left-radius give border-bottom: 3px solid green , drop-shadow , border radius doesn't achieve same "angle" 1 in image above.. i thought use svg, can't have drop shadow.. if there way create shape drop shadow open suggestions. thank you border-radius you add same style border-radius right, taking other 30% have left over. body { background: lightblue; } #box { width: 500px

javascript - Using Node package in NativeScript app -

i learning nativescript. example, include guid generator package in nativescript app. question is, how? @ directory structure generated command-line tool , see following relevant pieces: node_modules app tns_modules package.json package.json do add node-uuid ./package.json or ./app/package.json? how reference in app then? example, if want use uuid app.js file, like? i'm little confused because of package structure of nativescript , how things loaded @ runtime. thanks run npm install root of {n} app. npm install --save node-uuid the dependency added outer package.json. and in app.js file, use usual. var uuid = require('node-uuid'); when run tns run <platform> or tns build <platform> , modules inside node_modules/ copied folder under platforms/ , take android example, @ platforms/android/assets/app/tns_modules/node-uuid . building process completed under platforms/ directory.

reactjs - Should I update lists in place with React? -

to delete item list, created new list not contain deleted item, , replaced old list new. "right" way or should edit list in place? suspect may inefficient js. destroy: function(chosenitem) { var newitems = this.state.items.filter(function(item) { return chosenitem.id != item.id; }); this.setstate({items:newitems}); } a couple of things: if such items have sort of persistence mechanism attached, consider using action architecture [see flux , reflux ...], not set state of component directly, delegate deletion separate entity, later on notify component of update; creators of react evangelise immutable objects in order work w/ react, choice fine.

Override bundle class silex authentification php -

here began silex , not understand how override class. i use plugin manage authentication. works, change checkpreauth () method verify account user before authentication without change yhe bundle code. made steps below: i created class userdao call plugin extends native class. but doesn't work because make simple die('foo !') in new method in userdao apparently method not taken account because die('foo !') doesn't appear :-( there me :-) class userdao: use microcms\domain\user; use microcms\pdo\pdocontroller pdocontroller; use pdo; class userdao extends baseuserchecker implements userproviderinterface { public function __construct() { } /** * {@inheritdoc} */ public function checkpreauth(userinterface $user){ die('je rentre dans cette fonction !'); } public function checkpostauth(userinterface $user){ } } thanks in advance

javascript - Isomorphic React with React Router with KOA -

i create app in koa render react components when user hits address bar, , after react-router client side navigate through links inside rendered react component. possible? want initial load seo friendly. cant provide code yet eager listen of suggestions , answers. this wanted flow: user hits ther server (ex: localhost:3123/) --> koa render react component shown (this component has react router links on it) --> user navigate through links (this time dont want hit server again, want react router on side trigger routing. it doesnt matter if source code when routing through client side not change, want have source code of initial react component when user first hits server. possible? i have not done serverside rendering, since have developed mobile apps of time, has assets available on clientside. maybe @ demo head around this: https://github.com/rackt/react-router-mega-demo

php - WooCommerce: Enforce minimum length phone number field -

i have installed woocommerce in wordpress based website. problem when customer checks out or creates id, there field user can insert phone number. field accepts 9 numbers, want apply minimum length function on field user prompted error message. i have tried adding these lines in function.php: add_filter( 'woocommerce_checkout_fields' , 'custom_override_checkout_fields' ); function custom_override_checkout_fields( $fields ) { $fields['billing']['billing_phone']['minlength'] = 10; return $fields; } but not working , strange thing when use ['maxlength'] = 10; it works. by default woocommerce checkout fields support following attributes fields $defaults = array( 'type' => 'text', 'label' => '', 'description' => '', 'placeholder' => '', 'maxlength'

angularjs - Multer 1.0.3 Mean Stack file upload -

i trying upload multipart/form-data simple mean stack application. when putting in 1 file , running it works fine. server.js var express = require('express'); var multer = require('multer'); var storage = multer.diskstorage({ destination: function (req, file, cb) { cb(null, 'uploads/'); }, filename: function (req, file, cb) { switch(file.mimetype) { case 'image/jpg' : case 'image/jpeg': case 'image/gif': var extension = file.mimetype.split("/"); extension = extension[extension.length-1]; break case 'video/quicktime': var extension = 'mov'; break case 'video/mp4': var extension = 

c# - Permissions on database varying with run -

this question not duplicate, when use accepted answer of possible duplicate causes problem. i have windows web forms app in asp.net , using sql server . i'm using stored procedures , dynamic data binding. problem is, connect, throw message, next time try connect. http error 403.14 - forbidden web server configured not list contents of directory. i've followed suggestions on page. i have change connection string connect again. can use connection string exists, need stuff around. i'm wondering when stop running program, if i'm not cleaning resources, perhaps causing this? const string constring = "data source=localhost;initial catalog=cart1;integrated security=true"; public static void selectproductsfromcat(gridview gv, int id) { // sqlconnection. sqlconnection con = new sqlconnection(constring); // create new command , parameterise. sqlcommand cmd = new sqlcommand(); cmd.commandtype = commandtype.sto

delphi - How to use .Locate when column name is a keyword -

using xe5 , ado, how can use tadoquery.locate when column name key word? for example, have table has column named desc , keyword. the code below generates runtime error (exception class eoleexception message arguments of wrong type, out of acceptable range, or in conflict 1 another ): adoqueryqp1.locate('desc', 'findme', []) i've tried [] , double quotes around desc . with [desc] or "desc" (single or double quotes), exception class edatabaseerror message adoqueryqp1: field '[desc]' not found . related question else in 2012: selecting column name reserved sql keyword see if following workaround acceptable you: set adoconnection's provider property 'sqloledb' , and set adoquery's cursorlocation property cluseserver .

matlab - Phase shift in a signal -

Image
this how writing code fc = 10; td = 5000; fs = 3*fc; ts = 1/fs; t = 0:ts:1-ts; = cos(2*pi*fc*t); figure, plot(a); y = fftshift(fft(a)); nfft = length(y); p = 0:fs/nfft:1-fs/nfft; p1 = y.*exp(-1i*2*pi*p*td); p2 = ifft(ifftshift(p1)); figure, plot(abs(p2)); this result achieve. signal phase shift same signal without phaseshift. you can add delay in ft domain multiplying exp(-1i*2*pi*p*td) , it's right. but fft not centered default (use fftshift that), dc @ index 1. p not right, try p = 0:fs/nfft:1-fs/nfft; instead. edit: seems not clear. if use p = 0:fs/nfft:1-fs/nfft; , don't use fftshift . if want use fftshift , p must -1/2+fs/nfft:fs/nfft:1/2 .

twitter bootstrap - Scope of css .form-group-sm -

why .form-group-sm reduces .form-control not .control-label except when inside .form-horizontal ? forces custom css or use of <small> tag <label> tag. design or missing? from bootstrap.css: .form-group-sm .form-control { ... } .form-horizontal .form-group-sm .control-form { ... } sample code: <form class="form-horizontal"> <div class="form-group form-group-sm"> <label class="col-sm-2 control-label" for="formgroupinputsmall">small label</label> <div class="col-sm-10"> <input class="form-control" type="text" id="formgroupinputsmall" placeholder="small input"> </div> </div> </form>

c# - How convert a row in csv to array of double? -

i have following data: 1,1,1,1,1,1 i want read line , covert array of ints or other type. is there 1 line solution that? var arr = "1,1,1,1,1,1".split(',').select(s => int.parse(s)).toarray(); in case text includes spaces var arr = regex.matches("1,1,1,1,1,1", @"\d+") .cast<match>() .select(m => m.value) .toarray();

r - Rscript not producing jpg output in cluster computing -

i have rscript called ihs.two.hist.r . have .sh script called ihs.2.hist.sh when run rscript in directory, jpeg output. when call rscript in .sh script, not jpeg output. check error logs , it's empty. check .log , it's empty. should getting null device 1 in .log. my rscript ###############cut columns don't need ### #cut -f1,2,3,4 /group/stranger-lab/ebeiter/test/snpsnap_mdd_5_100/matched_snps_annotated.txt > /group/stranger-lab/ebeiter/test/snpsnap_mdd_5_100/cut.matched_snps_annotated.txt #cut -f1,2 /group/stranger-lab/ebeiter/test/snpsnap_mdd_5_100/input_snps_insufficient_matches.txt > /group/stranger-lab/ebeiter/test/snpsnap_mdd_5_100/cut.input_snps_insufficient_matches.txt ### ###############only needed columns remain #read in data #module load r #r ###############read in data load("/group/stranger-lab/ebeiter/ihs_fst.rda") ### data <- read.table("/group/stranger-lab/ebeiter/snpsnap_top1_adhd_3_5k/matched_snps.txt", header=true, st

windows - PortQry Runtime Error -

operating system: windows 7 application: portqry/portqry ui error: portqry runtime error #3 'hp' variable undefined. i've searched google couple days , can't find why portqry giving me error. when press ignore seems work fine port 53 timing out when running portqry (separate issue). anyhow know how solve runtime error? this issue had me going couple days 1 thing never thought off disable firewall. not 1 of top choices when comes security move ok when it's on intranet; no connection internet. solved port 53 timeout error & runtime error.

Magento 1.9.2.1 Paypal Express Checkout -

Image
i have been working move production site 1.9.2.1, upgraded staging site , went seamlessly. granted not huge fan of new email template , having use cron job send emails (which problem solved). after upgrading staging 1.9.2.1, went system -> configuration -> sales -> payment methods , popup window appears (shown below). after receiving error, tried re-enable paypal payments pro (express checkout) enabled. try save configuration , when page reloads popup appears again. i tried re-enter api settings no luck. note: before went system -> configuration -> sales -> payment methods paypal express checkout button showing usual. after travelling payment methods, button not showing anymore. unfortunately, did not have chance test see if functioned before went payment methods. has else had issue when upgrading 1.8.1 (or version) 1.9.2.1? if kindly respond fix, or point me in right direction? if need more information, happy assist. any appreciated. thanks!

jquery - Check if elements has\belongs to the same parent -

i have question. example have html: <div id="imagediv> <a id="testa"> <img alt="" src "" id="img1"> <img alt="" src "" id="img2"> <img alt="" src "" id="img3"> <img alt="" src "" id="img4"> <img alt="" src "" id="img5"> </a> <img alt="" src "" id="img6"> </div> how can check, lowest level and, if possible ,with simple jquery selector or extension, images id`s 1 5 has same parent, not image 6th id. in words: how check if images id`s 1 5 siblings()? thanks lot see http://jsfiddle.net/t324lwoy/1/ function aresiblings(e1, e2){ return $(e1).parent().children().is($(e2)); }; console.log(aresiblings("#img1", "#img3")); console.log(aresiblings("#img2", "#img

winforms - Adding Event Handler in VB.NET Custom Control -

i have scenario in have implement usercontrol , on clicking button "process" background worker works. i want trigger function/method of parent form going add usercontrol upon "runworkercompleted" event. private sub btngo_click(byval sender system.object, byval e system.eventargs) handles btngo.click try bgwfetchgiftcard.runworkerasync() catch ex exception writelog(ex) end try end sub private sub bgwfetchcard_dowork(byval sender system.object, byval e system.componentmodel.doworkeventargs) handles bgwfetchcard.dowork try ds = new dataset() 'call api service denomination ds = apicall() catch ex exception writelog(ex) end try end sub private sub bgwfetchcard_runworkercompleted(byval sender system.object, byval e system.componentmodel.runworkercompletedeventargs) handles bgwfetchcard.runworkercompleted if ds isnot nothing result = true 'at point w

Laravel sharing values from a form in views -

i have project in laravel, want 2 values, resulted after post method form, become global variables in views special prefix. my code in controller: public function to_dashboard(userlocationrequest $request) { $my_company_id = $request->my_company_id; $my_branch_id = $request->my_branch_id; view::share('my_company_id', $my_company_id); view::share('my_branch_id', $my_branch_id); return redirect('employee/dashboard'); } after code have errors: 'undefined variable: my_company_id' 'undefined variable: my_branch_id' how can that, propagate these 2 values in views? or how send these values route.php , become global variables view::share after submitting form? the way using session in laravel 5 . you put values in session key session::put('key', 'value'); like: session::put('my_company_id', $my_company_id); session::put('my_branch_id', $my_branch_id); then can fet

excel - Need to save xls workbook As xlsb with VBA -

i use macro create daily report. macro saves xls report xls historically. due large file size want save report xlsb. 2 problems. macro script using run cannot open xlsb file later. message received "excel cannot open file'rdn activity report.xlsb' because file format or file extension not valid. verify file has not been corrupted , file extension matches format of file. txtfilename = format(date - 1, "yyyymmdd") activeworkbook.saveas filename:= _ "\\clt-stor01a\ca_services\rdn reports\foruploadprev\rdn activity report." & txtfilename & ".xlsb", _ fileformat:=xlnormal, password:="", writerespassword:="", _ readonlyrecommended:=false, createbackup:=false txtfilename = format(date - 1, "yyyymmdd") note: need script can open file when file name has date in file name , date of file yesterday's date such " rdn activity report.20150726 " use saveas parameter f

asynchronous - Python: Feed and parse stream of data to and from external program with additional input and output files -

the problem: have poorly designed fortran program (i cannot change it, i'm stuck it) takes text input stdin , other input files, , writes text output results stdout , other output files. size of input , out quite large, , avoid writing hard drive (slow operation). have written function iterates on lines of several input files, , have parsers multiple output. don't know if program first read input , starts output, or starts outputting while reading input. the goal: have function feeds external program wants, , parses output comes program, without writing data text files on hard drive. research: naive way using files is: from subprocess import pipe, popen def execute_simple(cmd, stdin_iter, stdout_parser, input_files, output_files): filename, file_iter in input_files.iteritems(): open(filename ,'w') f: line in file_iter: f.write(line + '\n') p_sub = popen( shlex.split(cmd), stdin = pipe,

mongodb - Check if what collection is updated in the database -

i trying edit work created using mean stack. comparing database local , database server. how can know collection being updated everytime doing in server? everytime trying check webservice, server returns value, while local returns 0. p.s. copy of project in local same copy of project in server add logging backend layer. update , create methods in restful service. looking @ logs can tell called. you can have lastupdated datetime field each collection , query collections later see 1 got updated when.

php - Installing Yii2 User Management Module -

i'm trying install user-management module yii2 application (for reference, that's module: https://github.com/webvimark/user-management ). let's have no idea composer installed , managed make work installation. i'm running local server application on shared-hosting don't have access ssh terminal. i made changes specified in readme file , ran composer require --prefer-dist webvimark/module-user-management "*" . did magic , saw, generated bunch of directories in vendor folder of application. uploaded them server when try load home page, error: class webvimark\modules\usermanagement\components\userconfig not exist the file here: application_home\public_html\basic\vendor\webvimark\module-user-management\components but seems application unable find it. have no modules directory (as used in previous versions of yii) , config , other files updated specified in readme file. ideas went wrong? edit: in case, adding config/web.php: <?p

symfony - Override TranslationsCacheWarmer service -

i have application contains lot of translation resources lot of different languages. warmup process takes long time because of this. i support translation of site in few languages, i'd avoid generating catalogues languages don't support. what did: i overrode translationscachewarmer use own translator. custom translator decorates default translator overrides warmup method warmup files part of locales support. the problem default warmer still runs generating files locales. this code contains custom translator: https://gist.github.com/marcosdsanchez/e8e2cd19031a2fbcd894 and here's how i'm defining services: <service id="web.translation.public_languages_translator" class="x\translation\publiclanguagestranslator" public="false"> <argument type="service" id="translator.default" /> <argument type="collection">%chess.translation.public_languages%</argument> </service

javascript - How can I generate a list of modified hyperlinks based on user input -

i'm trying modify list of urls using either html or javascript. collected list of sites embed youtube video. this: http://music-dump.com/id/00000 http://youtube-id.com/download/00000 etc. i want generate list of new hyperlinks "00000" replaced userinput. list should generate button click or on-the-fly user typing. far found this: <script type="text/javascript"> function changetext2(){ var userinput = document.getelementbyid('userinput').value; var lnk = document.getelementbyid('lnk'); lnk.href = "http://music-dump.com/id/" + userinput; lnk.innerhtml = lnk.href; } </script> type youtube code , click open! <a href="" id=lnk>link</a> <br> <input type='text' id='userinput' value='' /> <input type='submit' onclick='changetext2()' value='open'/> but generate 1 link. want huge list. possibl

github - Jenkins git commit for specific branch triggers build jobs for other branches too -

we have internal enterprise github repo, , have multiple feature branches. facing issue triggering build on specific branch. have configured jobs each of feature branches. there 1 jenkins job 1 feature branch. first time commit code, triggers builds jobs other branches. steps reproduce problem: 1.we have internal github enterprise. repo, have setup webhook github below settings -> webhooks & services -> services select jenkins (github plugin) jenkins hook url: http://************/jenkins/github-webhook/ 2.for 3 branches in github repo : branch1, branch2, branch3, created 3 jobs in jenkins:job1, job2, job3 scm configured below source code management: repo url: git@********/********.git branches build: refs/heads/branch_name build trigger: build when change pushed github 3.on committing code branch : branch1. triggers 3 jobs in jenkins: job1, job2, job3. note:this first time jobs triggered. 4.on committing code second time branch: branch1. triggers j

Defining different abstract layout for different tabs in ionic -

can have 2 states abstract:true i.e base layout different tabs? forexample, tab-1, tab-2 , tab-3, need have tabs.html abstract:true in state provider , tab-4, need have menu.html abstract:true in state provder subsequent states inherit it. something this: .config(function($stateprovider, $urlrouterprovider) { // ionic uses angularui router uses concept of states // learn more here: https://github.com/angular-ui/ui-router // set various states app can in. // each state's controller can found in controllers.js $stateprovider // setup abstract state tabs directive .state('tab', { url: '/tab', abstract: true, templateurl: 'templates/tabs.html' }) // each tab has own nav history stack: .state('tab.dash', { url: '/dash', views: { 'tab-dash': { templateurl: 'templates/tab-dash.html',

php - Laravel 5.0 extending the 'Logout' functionality -

i set sessions save database , added user_id field sessions table may display names of logged in users. in order laravel save id of user when log in(given laravel doesn't user_id column regularly), had add bit of code authenticate.php file handle that. now, attempting set user_id field null when user logs out because presently, since user_id field still contains user's id after log out, still displays them logged in though no longer logged in. looking extend auth/logout functionality without touching vendor files include function set user_id null on logout. where might add function exactly? in authcontroller.php file? in routes.php adding in own declaration of auth/logout route? if have questions me or need me better explain anything, let me know. thanks. you can put following function in authcontroller.php override default function authenticatesandregistersusers trait. , can change per need. /** * log user out of application. * *

ruby on rails - The Asset pipeline doesn't use the fingerprinted routes for the images after precompile -

i'm loading background image bg.jpg image in scss file, style.css.scss background: url(/assets/bg.jpg) no-repeat center center; after precompilation, sprockets places copy of image in /public/assets directory fingerprinted name bg-28779d74f8a6fc51d1b46376428bed54.jpg . , can access image browser @ /assets/bg-28779d74f8a6fc51d1b46376428bed54.jpg link. but when reaload page in browser, background image not displayed , when check css in dev tools particular element see: background: url(/assets/bg.jpg) no-repeat center center; shouldn't background: url(/assets/bg-28779d74f8a6fc51d1b46376428bed54.jpg ) no-repeat center center; le: i precompile assets rake assets:precompile having rails_env set production. thought idea mention since noticed many other people had problems because of this. sass-rails helpers "image-url", "asset-url" not working in rails 3.2.1 the correct answer in comments, here is: image urls in stylesheets (that