Posts

Showing posts from September, 2013

linux - Install glibc 11 on ubuntu precise(12.04) -

i have app compiled locally ldd version (ubuntu eglibc 2.15-0ubuntu10.4) 2.15 need run in server ldd version 2.12 . because built in qt framework , not have root access install framework or upgrade libc.so.6 , need install older glibc on machine compile in post . after downloading glibc-2.11.2.tar.gz here try install command ./configure --prefix=/usr/oldlibc displays following error : /bogdan/downloads/safe/csu/crti.o /tmp/cchnbwla.s: assembler messages: /tmp/cchnbwla.s: error: open cfi @ end of file; missing .cfi_endproc directive /tmp/cchnbwla.s: error: open cfi @ end of file; missing .cfi_endproc directive make[2]: *** [/home/bogdan/downloads/safe/csu/crti.o] error 1 make[2]: leaving directory `/home/bogdan/downloads/glibc-2.11/csu' make[1]: *** [csu/subdir_lib] error 2 make[1]: leaving directory `/home/bogdan/downloads/glibc-2.11' make: *** [all] error 2 what can install libc.so.6 ? i have app compiled locally ldd version you wrong in stating ldd

javascript - Jquery mobile popup from php with if then -

i searched net on this: i want show jquery mobile styled popup when variable equals 0. i tryed various solutions javascript no succes. <div data-role="page" id="indexpage"> <div data-role="popup" data-history="false" id="popupbasic"><br> nothing show <br><br> </div> </div> if ($aantal_opnames === 0 ){ // show popup here } how can invoke ?

testing - Rails model method rspec test -

i have following test: it 'should return array of other cars @ garage (excluding itself)' g1 = factorygirl.create(:garage) c1 = factorygirl.create(:car) c1.garage = g1 c2 = factorygirl.create(:car) c2.name = "ford 1" c2.garage = g1 c3 = factorygirl.create(:car) c3.name = "vw 1" c3.garage = g1 expect(c1.other_cars_at_garage).to eq([c2, c3]) end which should test method on model: def other_cars_at_garage garage.cars.where.not(id: self.id) end when run test, fails returns: #<activerecord::associationrelation []> how should test pass? how check ar::associationrelation? you not saving association between c1/c2/c3 , g1 c1 = factorygirl.create(:car) c1.garage = g1 c1.save #this saves g1 in c1's garage c2 = factorygirl.create(:car) c2.name = "ford 1" c2.garage = g1 c2.save c3 = factorygirl.create(:car) c3.name = "vw 1" c3.garage = g1 c3.save in addition, it's best use expect(c1.othe

R! posIXCT in sqldf -

first time question, if missed apologize: i imported excel file r! using xlconnect, str() function follow: data.frame': 931 obs. of 5 variables: $ media : chr "eem" "eem" "eem" "eem" ... $ month : posixct, format: "2014-08-01" "2014-08-01" "2014-08-01" "2014-08-01" ... $ request_row : num 8 25 26 37 38 44 53 62 69 83 ... $ total_click : num 12 9 9 8 8 8 7 7 7 7 ... $ match_type : chr "s" "s" "s" "s" ... when use following sqldf no rows selected, anyway wrong: sqldf(" select media, sum(total_click) , avg(request_row), min(request_row) , max(request_row), count(distinct(media)) all_data request_row < 100 , month='2014-09-01' group 1,2 order 2,6 desc ") <0 rows> (or 0-length row.names) thanks help vj its not clear intended code shown has these problems: month

save - Android- saving data that updates before restarting the application -

in android application i'm working on, have 1 activity user inputs data saved using sharedpreferences, , used calculations on main activity. issue i'm having after saving data, changes not take effect until after application restarted. there way can make variables associated these sharedpreferences updated before restarting? here save data in separate activity. savebn.setonclicklistener(new view.onclicklistener() { @override public void onclick(view v) { weightstring = weighttext.gettext().tostring(); agestring = agetext.gettext().tostring(); getsharedpreferences("preference", mode_private).edit() .putstring("savedweight", weightstring).commit(); getsharedpreferences("preference", mode_private).edit() .putstring("savedage", agestring).commit(); //intent = new intent("com.williammiller.capstonelapv2.mainactivity")

c++ - Nothing happens when program runs (and no Window is created) -

as of recent, very frustrated sdl2. out of options here, looking knowledgeable. i'm trying darn thing working on windows 8.1. had no problems using first sdl on windows 7 went breeze. however, sdl2 not same case. i'm following tutorials on " http://lazyfoo.net/tutorials/sdl/01_hello_sdl/windows/codeblocks/index.php " using updated codeblocks + mingw32 release. i've tried on orwell dev c++ + mingw32. however, very odd happening, i've never before seen in programming. compiler not giving me errors. however, when program runs, nothing happens. window should created , delayed few seconds. i've tried part 2 tutorial show image, , again, nothing happens. i've made sure neither program blocked windows firewall , ran program , .exe administrator. the compiler gives no errors. sdl2.dll in folder of .exe. i've downloaded sdl2.0.3 link on website , downloaded , applied fix 1 wonky .h file gives compiler errors in sdl2.0.3 not sdl2.0.0 downloaded @

javascript - validate HTML form input - prevent tab if invalid -

my html form includes series of 5 related <input type="text" /> tags, of need single-digit or two-digit numbers. i've created javascript function test user-input against regular expression using if-else statement. function works desired when input valid; however, have focus remain on input-field if input invalid, , far haven't been able make happen. i've tried using document.getelementbyid(currseg).focus(); -- currseg dynamically set id of offending input-field. i've tried using switch statement individual case each possible bad input-field, , id of offending field specified directly rather calculated variable. validation testing prompted onblur event (i've tried using onchange event) each input-field. have alert("bad user input") in else condition, know function flowing else condition when input invalid, focus moves next input-field. everything i've tried fails stop progress of focus, whether move input-field mouse-

database - Projection in Relational Algebra -

there table called person has name, age, weight columns. name: a, b,c,d,e age: 34,21,23,34,12 how can use relational algebra project names ages 34? if remember relational algebra correctly should this: π name (σ age = 34 (person)) where π projection , σ selection. equal select name person age = 34 in sql , can read from person select relations age 34 , show name. the formatting options here rather limited doesn't quite should...

java - Android custom List SimpleAdapter - chose row icon -

layout: <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="wrap_content" android:orientation="vertical" android:background="@android:color/black"> <linearlayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:orientation="horizontal"> <imageview android:layout_width="40dp" android:layout_height="40dp" android:id="@+id/icon"/> <linearlayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:orientation="vertical"> <textview android:id="@+id/line_a" android:textsize="14dp" android:textcolor="@android:color/white" android:layout_width=

vim - Is there a quick way to rebuild spell files from wordlists? -

is there way tell vim update spell files languages listed in 'spelllang' pick wordlist changes outside of vim? i've started checking wordlist file git since i'm tired of adding same words on multiple computers. don't want add spell file git repo since merges ugly every time, whenever open vim, recent updates ignored until inside vim rebuilds spell file, such zg add word dictionary. i've solved adding *.spl .gitignore file , in vimrc (which synced git, add: for d in glob('~/.vim/spell/*.add', 1, 1) if filereadable(d) && (!filereadable(d . '.spl') || getftime(d) > getftime(d . '.spl')) exec 'mkspell! ' . fnameescape(d) endif endfor source: https://vi.stackexchange.com/questions/5050/how-to-share-vim-spellchecking-additions-between-multiple-machines this cause vim rebuild .spl file each time .add file has been updated when vim started.

performance - Kibana spinning for a long time -

we create es kibana installed. there 2 indices within it. 1 index test has 1000 documents. search in kibana , works , returned result immediately. other index push real data 40,000 documents. when search something, kibana _source section keep spinning >50 minutes while 'document types' section return immediately. i used curl tool query second index manually , return immediately. i compare mapping of these 2 indices , difference didn't use 'store' -> true in second document properties(some used). possible reason? this resolved. fact added json document without quote. es smart fix not in _source. however, kibana utilize _source in table field.

c++ - OpenMP unpredictable overhead -

i have simple openmp code runs 4 empty threads , reports time: #include "omp.h" #include <sys/time.h> #include <cstdio> double start_time; void process_thread() { } int main(){ struct timeval tv; gettimeofday(&tv, null); start_time = 1000*((double)tv.tv_sec + 1e-6*(double)tv.tv_usec); printf("beginning time: %.3fms ",start_time-start_time); #pragma omp parallel schedule(static,1) for(int i=0;i<4;i++) process_thread(); gettimeofday(&tv, null); double cur_time = 1000*((double)tv.tv_sec + 1e-6*(double)tv.tv_usec); printf("finishing time: %.3fms\n\n",cur_time-start_time); } without openmp running time small , consistent: beginning time: 0.000ms finishing time: 0.050ms beginning time: 0.000ms finishing time: 0.050ms beginning time: 0.000ms finishing time: 0.049ms beginning time: 0.000ms finishing time: 0.049ms beginning time: 0.000ms finishing time: 0.050ms beginnin

xml - XSL Contains that returns true if anything matches -

hey want below return true if of matches (for example, should return true because contains randomstuff though first part doesn't match). contains('otherrandomstuff', 'blargrandomstuff') cheers here's possible (not efficient) algorithm: (1) find characters appear in both strings. call common subset. (2) in both strings, find substrings consisting of characters in common subset (3) find substrings in both sets (4) of these, take longest (5) report success if longer threshold. however, i'm not going go further in terms of producing working code because suspect haven't thought requirement through fully. before writing code, want know trying achieve. also, while attempting in xslt 2.0 quite feasible, xslt 1.0 solution pretty grotesque.

java - How to verify if search result has more than one result? -

can please how find search result has more 1 results using selenium , testng. scenario follows: launch www.amazon.com enter search string in search box , click search now verify search result has more 1 result(>1). following line thought of assert.assertequals(actual, expected, delta); . right approach? try below code. fetches search results , checks if count greater 1 or not, prints accordingly. :- driver.get("http://www.amazon.in/"); driver.findelement(by.id("twotabsearchtextbox")).sendkeys("bagsasdfafds"); int count = driver.findelements(by.classname("suggest_link")).size(); assert.asserttrue(count>=1); system.out.println("count greater or equal 1. count is: "+count);//this line printed if count greater or equal 1.

c# - NDepend TypeInitializationExceptions when Testing with NUnit -

so i'm trying set project using ndepend api metrics on code (which works nicely), however, when attempt run testing framework (nunit) on it, i'm getting typeinitializationexceptions thrown. here code reproduce errors i'm getting: create class library project, , reference ndepend api dll @ $ndependinstallpath$\lib\ndependapi , setting copy local false . create class follows: public class ndependprojectloader { public void loadanndependproject() { var provider = new ndependservicesprovider(); } } create second class library project in solution test class. reference nunit , project created references ndependapi [testfixture] public class ndependprojectloader_tests { [test] public void i_can_load_an_depend_project() { new ndependprojectloader().loadanndependproject(); } } build, , run test using test runner of choice (i've tried resharper's test runner , nunit gui). you typeinitializationexception on line var provider = new ndepends

sql - Pivoting in MySQL table -

i have mysql table named switches follows: switchname switchcondition switchingtime ----------- --------------- ------------- first on 10:00 first off 11:00 second on 10:30 third off 13:00 third on 13:45 how can display report html table in following format using above table pivoting switching time respect switch condition? switchname on off ----------- ----- ------- first 10:00 11:00 second 10:30 - third 13:45 13:00 try this: select s.switchname, max(case when s.switchcondition = 'on' s.switchingtime else '-' end) switchon, max(case when s.switchcondition = 'off' s.switchingtime else '-' end) switchoff switches s group s.switchname;

extjs3 - Not able to set value for Ext.ux.form.MultiSelect in ExtJs 3.4 -

i using extjs 3.4. when set value ext.ux.form.multiselect, getting error. "uncaught typeerror: cannot read property 'clearselections' of undefined in multiselect.js:245". if have clear selected values in "ext.ux.form.multiselect" before setting selected values, how can that. please give suggestions this. if mean this component , in setvalue method there call this.view.clearselections() , , causes issues. view created in onrender method. combo not rendered when call setvalue . i see 3 solutions: ensure combo rendered when call setvalue check combo rendered; call setvalue when is, assign value when isn't override multiselect , fix it

html - jQuery Slidertron link to a slide -

hi i'm using jquery slidertron page turner. built in template using , of it, wonder if possible link specific slides. example, want button jump second slide in reel regardless of slide active. is possible? if not that, maybe initiate navigation action number of times behind scenes use navfirstselector slide one, turn number of pages? here example implementation <script type="text/javascript" src="jquery-1.7.1.min.js"></script> <script type="text/javascript" src="jquery.slidertron-1.1.js"></script> <!-- css --> <style type="text/css"> #slider { position: relative; width: 500px; } #slider .viewer { width: 500px; height: 375px; overflow: hidden; } #slider .viewer .reel { display: none; height: 375px; } #slider .viewer .reel .slide { position: relative; width: 500px; height: 375p

regex - regular expression for "measure units" -

i need regex support custom measure units. example: 1g valid gb valid 1 invalid m2 valid mt valid 22 invalid can support numbers words. not numbers. can me? ^(?!\d+$)[a-za-z0-9]+$ try this.see demo. http://regex101.com/r/yr3mm3/5 this not allow string containing numbers. you can use ^(?!\d+$)[a-za-z0-9]{1,2}$ if want allow upto 2 digits

Converting sql query WITH clause query to mysql query -

i converting sql queries mysql queries, queries have clauses failing. here query: with cte ( select sto.ndate ndate,sto.nstockname stkname,sto.nclosingprice stkclosingprice, sto.nvolume stkvolume, ind.nstockname indname,ind.nclosingprice indclosingprice, ind.nvolume indvolume, rownum = row_number() on (partition sto.nstockname order sto.ndate) equitystockoptions_nse sto join equitystockoptions_indices ind on sto.ndate = ind.ndate ind.nstockname='nifty' , str_to_date(date_format(sto.ndate,'%m/%d/%y')) >= date_format(v_fromdate,'%m/%d/%y') , str_to_date(date_format(sto.ndate,'%m/%d/%y')) <= date_format(v_todate,'%m/%d/%y') ) select curr.ndate,curr.stkname,curr.stkclosingprice, curr.stkvolume, curr.indname, curr.indclosingprice, curr.indvolume, log(curr.stkclosingprice / prev.stkclosingprice) stkreturnonlog, log(curr.indclosingprice / prev.indclosingprice) indreturnonlog cte curr inner join cte prev on pr

javascript - when I click on the div that div should get refreshed and refreshed data should be displayed -

$(document).ready(function () { var j = jquery.noconflict(); j('.refresh').click(refreshdiv); j('.refresh').css({ color: "" }); function refreshdiv() { j.ajax({ url: "refresh.php", cache: true, success: function (html) { j(".refresh").html(html); } }); } }); i have code ,but confused how display div gets refreshed.please provide me code or links refer.i making site in want update score when refresh div using ajax. in ajax request specify datatype:'html' shown :- j.ajax({ url: "refresh.php", datatype:"html", cache: true, success: function (html) { j(".refresh").html(html); } });

Why is a Javascript Error object not treated as an object by expressjs -

i have node/express backend. in backend create error object if there error, when try send in response not there. able make code work building new object in response, know why didn't work. the relevant code is: var error = new error('some error message') app.send({error}) // returns {} app.send({error: error.message}) // returns {error: 'some error message} according mdn docs, error object object, , should therefore able pass directly app.send(). didn't work in practice, , able explain why. help! i assume app.send converts value json. json.stringify considers (own) enumerable properties , message not enumerable: > object.getownpropertydescriptor(new error('foo'), 'message'); object {value: "foo", writable: true, enumerable: false, configurable: true}

android - Cancel swipe navigaton -

i'm trying cancel card swipe in glass if card has not been processed. have special indicator checked in swipe_right gesturedetector.setbaselistener(new gesturedetector.baselistener() { @override public boolean ongesture(gesture gesture) { if (gesture == gesture.tap) { openoptionsmenu(); return true; } else if (gesture == gesture.two_tap) { runspeechrecognition(); return true; } else if (gesture == gesture.swipe_right) { // on right (forward) swipe checkcards checkcard = mcheckcardsinfo.get(cardposition); if (checkcard.getstatus() == 1){ return true; }else{ return false; } } else if (gesture == gesture.swipe_left) { // on left (backwards) swipe return true; } else if (gesture == gesture.swipe_down) { finish(); } return false; }

c# - Inherit sublayouts created inside sitecore CMS in Visual Studio 2012 -

is there way can use layouts , sublayouts have created inside sitecore cms, in visual studio write c# codes assuming have sitecore rocks plug in installed on vs? while setting new connection not able physical access of sitecore instance. i checked same on internet not find reference. required. thanking in advance solved issue!! brad christie assumed right!! created using developer center without dependency vs. can create sublayout developer center gives option include .cs page if , can write codes directly in .cs page.

algorithm - Partitioning graph into 2 sets of vertices -

Image
i want partition connected graph 2 sets of vertices, such difference of sum of edge-weights among vertices of each set minimized. for example, if graph consists of vertices 1,2,3,4,5, consider partition: set - {1,2,3} set b - {4,5} sum = {w(1 2) + w(2 3) + w(1 3)} sum b = {w(4 5)} diff = abs(sum - sum b) ... (this 1 possible partition difference.) so, how find partition such difference minimized? this problem np hard because @ least hard partition problem . sketch of proof consider partition problem have numbers {1,2,3,4,5} wish partition 2 sets small difference possible. construct graph shown below: if comes algorithm solve problem can use algorithm partition graph 2 sets such sum of weights within each set minimized. in optimal solution blue , green nodes must placed different sets (because have edge weight infinity connecting them). remaining nodes connected either blue or green nodes. call ones connected blue set1, , ones connected green set2.

javascript - How to replace comma and point from a string -

this question has answer here: strip non-numeric characters string in javascript 6 answers i number format string input box like: 1,033.00 how can convert 1033 jquery/javascript? have use converted number add number. you can string replace numberstring= numberstring.replace ( /[^0-9]/g, '' ); to add number can use + operator convert numberstring number value. var numberstring= numberstring.replace ( /[^0-9]/g, '' ); var addition = +numberstring + anothernumber;

php - Path to the product in the list mode in magento -

hello guys can please tell me path product page in list mode in magento.in grid mode showing good,but when click list mode,i wanna remove items it, please me path for regular product list (and grid) situated here: app/design/frontend/base/default/template/catalog/product/list.phtml but ofcourse, vary depending on template using. templates keep same folder structure, should somewhere along these lines: app/design/frontend/templatename/default/template/catalog/product/list.phtml

javascript - Print current html page in next page onclick -

i need print current html page in new page using button attribute 'onclick()' used follwing javascript function printpartofpage(elementid) { var printcontent = document.getelementbyid(elementid); var windowurl = 'p2p money transfer'; var uniquename = new date(); var windowname = 'p2p money transfer -' + uniquename.gettime(); var printwindow = window.open(windowurl, windowname, 'left=50000,top=50000,width=0,height=0'); printwindow.document.write(printcontent.innerhtml); printwindow.document.close(); printwindow.focus(); printwindow.print(); printwindow.close(); } </script> <input type="button" value="print" onclick="javascript:printpartofpage('printdiv');" > but problem there no style implemented,so need current entire html page transfer method , write using document.write() has styles in it. i suggest use printthis jquery library achieve goal. w

database - Reserve sequence range in DB2 -

we moving application oracle db2. batch job. there sequencing logic assigns ids entries before processing: reserve range of sequences select my_sequence.nextval; // range_start; alter sequence my_sequence increment range_size; select my_sequence.nextval; alter sequence my_sequence increment 1; select my_sequence.nextval; // range_end; assign ids within range via in-memory incremented value: for id = range_start:range_end do this worked fine in oracle, gave unexpected results in db2. in oracle: drop sequence my_sequence; create sequence my_sequence minvalue 1 maxvalue 999999999999999999999999999 increment 1 start 1 cache 50000 noorder nocycle ; select my_sequence.nextval dual; // 1; select my_sequence.nextval dual; // 2; alter sequence my_sequence increment 100000; select my_sequence.nextval dual; // 100002; alter sequence my_sequence increment 1; select my_sequence.nextval dual; // 100003; in db2: drop sequence my_sequence; create sequence my_sequence d

c# - How Can I Use Class Generated Dynamic In Generic Method -

i generated class dynamically , want use class in generic method. and if can generate class dynamically in project code or add class dll project bin folder , access in code // method create class var mynewclass = mytypebuilder.compileresulttype(); // needed use class in generic list<mynewclass> returnobj = getdata(); // mytypebuilder class used generate class public class mytypebuilder { public static void createnewobject() { var mytype = compileresulttype(); var myobject = activator.createinstance(mytype); } static dictionary<string, type> _props = new dictionary<string, type>() { { "id", typeof(string) }, { "name", typeof(string) }, /*{ "productlists", typeof(string[]) }*/ }; public static type compileresulttype() { typebuilder tb = gettypebuilder(); constructorbuilder constructor = tb.definedefaultconstructor(methodattri

ios - How to handle the event for the UICollectionView custom cell? -

i have created custom cell uicollectionview. custom cell has 2 uiimageview - imageview1 , imageview2. how should handle event each imageview? can handle cell event on didselecteditemindex delegate of uicollectionview. want handle each imageview. - (void)collectionview:(uicollectionview *)collectionview didselectitematindexpath:(nsindexpath *)indexpath { photosviewcell *cell = (photosviewcell*)[collectionview cellforitematindexpath:indexpath]; int tag1 = cell.imageview1.tag; int tag2 = cell.imageview2.tag; .... } in cellforrowatindexpath method define tap gesture recognizer selector , assign image. uitapgesturerecognizer *tapgesture = [[uitapgesturerecognizer alloc] initwithtarget:self action:@selector(productimagetap:)]; [cell.imageview1 addgesturerecognizer:tapgesture]; [cell.imageview1 setuserinteractionenabled:yes]; [cell.imageview2 addgesturerecognizer:tapgesture]; [cell.imageview2 setuserinteractionenabled:yes]; then can want in productimagetap method

eclipse - Java Applet on Tomcat using servlet? -

i have working applet on tomcat server in applet need save information locally. i used writefile.. , working on eclipse, doesn't work on server.. i did lot of research servlet able save information in html file. know have use post, don't know how. i want know if servlet servlet.class placed in tomcat folder , how call java application? first, used writefile.. , working on eclipse, doesn't work on server.. continue using that. applet need digitally signed before can deployed, if declares all-permissions in manifest, should able write local file system.

ibm mobilefirst - Worklight SAP Netweaver GateWay Adapter - Client ID -

currently using worklight sap netweaver gateway adapter connect our development environment of sap. our customer has configured 2 client environments 101 , 211. default 101. when creating connection based on following adapter configuration... <?xml version="1.0" encoding="utf-8"?> <wl:adapter xmlns:wl="http://www.worklight.com/integration" xmlns:nwgateway="http://www.worklight.com/integration/nwgateway" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" name="sapadapter1"> <displayname>sapadapter1</displayname> <description></description> <connectivity> <connectionpolicy xsi:type="nwgateway:nwgatewayhttpconnectionpolicytype"> <protocol>http</protocol> <domain>10.9.5.27</domain> <port>8000</port> <servicerooturl>/sap/opu/odata/sap/services_x_y_z/</s

sql - Insert selected multiple records to a table from existing table with another value -

my first table voter userid | lgdiv -------------------- 1 | 3 2 | 4 3 | 6 4 | 3 5 | 3 in second table, both userid , elecid primary keys voterelection voterid | elecid | votertype| votingstatus -------------- 1 | 1 | normal | active 2 | 1 | normal | active 3 | 3 | normal | active i want insert selected rows of voter table voterelection table electionid, votertype , votingstatus . electionid, votertype , votingstatus same values selected items votertable. userid of voter table voterid of voterelection table. furthermore assume select users lgdiv 3 this select userid voter lgdiv=3 ; according data have given here select 3 records. i want insert 3 records selected voter voterelection elecid, votertype , votingstatus. records elecid, votertype , voting status same. assume select elecid =3 votertype='normal' , votingstatus='active' 3 records. after

tcp - Enormous amount of connections stuck in CLOSE_WAIT state with Varnish -

i'm getting kind of weird problem varnish, enormous amount of connections stuck in close_wait state, if varnish wasn't closing connections. this leads me think kernel waiting varnish close connections, considering this, either bug in varnish or kernel point of view. though, before digging deeper varnish code, i'd have point of view guys, , know if kind of symptoms caused other parameters ? obviously, if ever experienced problem , have solution, more helpful. fyi: # netstat -pan|grep varnish|awk '/tcp/ {print $6}'|sort|uniq -c 35902 close_wait 12148 established 3 listen you should inspect whether in client ⇄ varnish side or varnish ⇄ backend, in backend side, @ least that's case. according connections backend not closing : this per design, varnish keeps backend connections around if can reused, , revisits them when tries reuse them, may linger quite while before varnish discovers have been closed backend. apart

javascript - Timing fancybox popup -

i have popup window using fancybox add timings to, show after 1 second maybe , disappear after 5. cant figure out add delays in code using, please can help? <script type="text/javascript"> jquery(document).ready(function ($popup) { $popup("#hidden_link").fancybox({ oncomplete: function () { $popup("#fancybox-img").wrap($popup("<a />", { href: "mylink.html", target: "_blank", // delay: 9000 delay ideally })); } }).trigger("click"); }); </script> <a id="hidden_link" href="images/myimage.jpg" style="visibility:hidden;"></a> you can use $.fancybox.open() , see details here - can explain $.fancybox.open( [group], [options] ) params , if can add youtube link href? , , $.fancybox.close() . settime

c# - SensorCore with CameraCaptureTask -

in our wp 8.1 application, we're using sensorcore sdk collect information movements of user, , use cameracapturetask too. when launch task cameracapturetask.show(), application crashes, before capture, after, , after event completed, , message in vs 2013 : 'the program '[2512] aghost.exe' has exited code -1073741819 (0xc0000005) 'access violation'.' however, capabilities activated, , exact same piece of code work without sensorcore activated. use lumia 635. any ideas ?​ are deactivating sensorcore related stuff before navigating away/showing task? need that, otherwise app crashes. read sensorcore essential practices . there code samples both silverlight , winrt on how deactivate sensors. for example: protected override async void onnavigatingfrom(navigatingcanceleventargs e) { await _stepcounter.deactivateasync(); }

dataset - Aggregate function only occasionally working in R -

i doing analysis on 2 datasets split different countries (same both datasets different numbers) 3 of countries there missing data. using aggregate() function fill in dummy values can analysis without nas popping up. reason function won't work when merging new values original data. but if clear workspace , run again might work 1 or 2 of countries, or 1 of 2 datasets. can't understand why may work 1 time not another, when i'm not changing code time. appreciated. mil<-read.csv("c:/data_millions.csv",header=true) per<-read.csv("c:/data_percent.csv",header=true) ##fill in blanks za #create dummy numbers each category of age/age-gender aggregate(data=mil,za~typeofperson,mean,na.rm=true) #merge output original data ave_za<-ave(mil$za,mil$typeofperson,fun=function(x)mean(x,na.rm=true)) mil$za<-ifelse(is.na(mil$za),ave_za,mil$za) aggregate(data=per,za~typeofperson,mean,na.rm=true) ave_za_per<-ave(per$za,per$typeofperson,fun=function(x)me

objective c - How do I send the tag of a NSButtonCell together with his action? -

i have nstableview several columns. column made nsbuttoncells. each nsbuttoncell has specific tag. tag should used inside action method specify cell invoked method. setting tag cell useless in case, because sender object passed action nstableview , not nsbuttoncell. cell = [[nsbuttoncell alloc] init]; [cell setaction:@selector(openscreen:)]; [cell settag:tag]; [cell settarget:self]; -(void)openscreen:(id)sender //this sender nstableview, can't tag of cell my first recommendation switch view-based table views. in case, problem largely goes away, since sender nsbutton instance, not table view. if can't that, question: how compute tag want use cell? rather using astoria's answer (with corrections per comment), can use same logic used compute tag given row,column compute value purposes of action method. think it: cell-based table view typically reuses 1 cell entire column. configures cell setting object val

ios - Autolayout is sizing objects in a UIScrollView incorrectly -

Image
i'm trying create layout using interface builder, size classes , uiscrollview. the uiscrollview meant full screen, 0,0,0,0 left, top, right, bottom. however when set constraints of objects, (labels, textfields, etc) 20 away right size, doesn't appear correctly in either interface builder or simulator. i've tried several things fix this, putting objects in view container, making new storyboard file etc , nothing has worked. hopefully can figure out going on, don't want resort springs , struts.

php - How to exclude tables/children from result in RedBeanPHP -

i have modelled relation redbeanphp: car id color ownpart part id name so redbean creates sql tables expected: car id color part id name car_id this works great. however, have other tables in db, e.g. user has car_id identifying users car. when want query car s , children ( part s) by $cars = r::find('car'); $foo = r::exportall( $cars ); echo json_encode($foo); the json contains every user related car. how can query cars "real" children? exportall specifies third parameter $filter should able use specify relationships exported: $foo = r::exportall($cars, false, array('part'));

c# - How to get a process FriendlyName from process from instance name? -

i have following program code: var category = new performancecountercategory("process", _server.name); var names = category.getinstancenames(); where _server.name piece of data database representing environment.machinename computer somewhere on network. there way friendlyname process based on given instance name? note: must done remotely computers in local network...

Delphi 7 - ShellExecute command not working in situations -

i have made game launcher , use command: procedure tfmain.imgbtn1click(sender: tobject); begin shellexecute(tform(owner).handle, nil, 'starter.exe', '-lang rus', nil, sw_shownormal); end; with '-lang rus' parameter. works fine. game launches , language in russian(if put '-lang eng' still works fine , game in english). the starter.exe application inside folder named '' bin ''. when want relocate launcher outside folder use command: procedure tfmain.imgbtn1click(sender: tobject); begin shellexecute(tform(owner).handle, nil, 'bin\starter.exe', '-lang rus', nil, sw_shownormal); end; but game isn't launching. nothing happens. should change? you have use full path application trying start. extractfilepath(application.exename) give full path launcher exe. solution 1: using shellexecute procedure tfmain.imgbtn1click(sender: tobject); var executeresult: integer

javascript - Handling Different Child Object Names Recursively -

i'm working nested json feed d3.js my code works fine when child object named children , want able display nodes few of other objects too, not ones named children . for example, if within children object, have object named options . want display nodes object well. { "item": [{ "children": [{ "name": "banana", "definition": "this fruit", "group": "n", "options": [ { "color": "red", "shape": "square" } ], "countries": [ { "color": "america", "shape": "africa" } ] }, { "name": "apple",

javascript - jQuery - add icon to select option based on value -

i trying make use of polylang, wordpress plugin allows add language switcher website. it generates simple select dropdown menu , changes language upon selecting language, it's ok, unable style - it's raw dropdown menu. i add icons next displayed option, , far know jquery best shot here. the issue having <option> tags missing id or class tags, , impossible add them without modifying plugin itself. is possible create jquery script display flag next option based on it's value attribute? can show me example how to? <select name="lang_choice" id="lang_choice"> <option value="en">english</option> <option value="fr" selected="selected">french</option> <option value="de">deutsch</option> </select> solution 1 (flags outside of dropdown): try this: $('<img class=flagicon src="'+$("select#lang_choice").val()+'.

Sending an Post Request of an Array using Volley android -

i relatively new android , trying send array rails server in form "user"=>{"name"=>"jackson", "email"=>"jack@yahoo.com", "password"=>"[filtered]", "password_confirmation"=>"[filtered]"} i don't know if doing correctly here have. have user class save data public class user { private string name; private string email; private string password; private string password_confirmation; public user(string name, string email, string password, string password_confirmation) { this.name = name; this.email = email; this.password = password; this.password_confirmation = password_confirmation; } public string getname() { return name; } public void setname(string name) { this.name = name; } public string getemail() { ret

javascript - get wrong value when window resize -

first, window width , minus assign variable, second, resize window , want value current window width minus something but wrong value, alert 2 value 1 right , wrong,i not know why , how fix it, me, thx my html code <p class="test">click me value</p> js (function(){ test(); $(window).resize(function(){ test(); }); }()); function test() { var t = $(window).width()-74; alert('one ' +t); $(document).on('click', '.test',{t: t}, get); } function get(event) { var l = event.data.t alert('two ' +l) } the fiddle version http://jsfiddle.net/dxcqcv/xetbhwpv/1/ i not sure values expecting get, take @ resize function documentation on jquery api: http://api.jquery.com/resize/ code in resize handler should never rely on number of times handler called. depending on implementation, resize events can sent continuously resizing in progress (the typical behavior in internet explorer , webk

recursion - Recursive function in Javascript to fill Array? -

i trying fill array ranges of values in recursive function, see weird thing happening while returning array, though array has values, when alert outside function gives me undefined. not sure whether code issue or kind of behavior. same implementation when tired using simple loop worked fine. i don't know title give problem, please suggest me one. js fiddle with recursion var arr = []; function fillarray(n,i){ if(arr.length !== n){ if(i===0) arr[i] = i; else arr[i] = arr[i-1] + 1; fillarray(n,++i); } else{ console.log(arr); return arr; } } console.log(fillarray(10,0)); with loop var arr = []; function fillarray(start,end){ for(var i=start,j=0;i<=end;i++,j++){ arr[j] = i; } return arr; } alert(fillarray(1,10)); function fillarray(n, i, a) { a.push(i); return a.length < n ? fillarray(n, ++i, a) : a; } console.log(fillarray(10, 0, []));

Fixing brackets indentation. New line indentation off by one space or tab -

see image: http://www.criweb.com.br/jd/emmet.gif to reproduce take document. create element 1 or more children. set cursor @ end of parent element. press [enter] create new line. see how indentation short 1 space (or tab). have configuration fix problem?

Inject test data to Junit reports for failed tests (failsafe plugin used) -

i have several tests cases in list using failsafe , junit per below: @test public void testresults() { (testcase test : testcaselist) { int result = test.getactualresult(); int expected = test.getexpectedresult(); if (result != expected) { system.out.println("failed test " + test.gettestinfo()); } assertequals(result, expected); } } i want report : failed test <test description here> java.lang.assertionerror: expected: <4> but: <2> instead of just: java.lang.assertionerror: expected: <4> but: <2> is there way junit or other framework? you can add message assert: assertequals(test.gettestinfo(), result, expected); this creates following report: java.lang.assertionerror: <test description here> expected: <4> but: <2>

javascript - DOM only updating when debugging -

i ran in following issue. have built wrapper around function display loading progress bar , makes disappear after function executed. not display progress bar, except when set breakpoint @ execution of function foo. i had bit of success running on progress onload event, not execute endloading. function sleep(milliseconds) { var start = new date().gettime(); (var = 0; < 1e7; i++) if ((new date().gettime() - start) > milliseconds) break; } var progress = document.createelement('progress'); var fillelement = document.body; function foo() { console.log('foo start'); sleep(2000); fillelement.innerhtml = 'bar'; console.log('foo end'); } function startloading() { console.log('start'); fillelement.innerhtml = ''; fillelement.appendchild(progress); } function endloading() { console.log('end'); fillelement.removechild(progress); } startloading(); foo(); // if debug point

Quantiles in Matlab -

would there function in matlab, or easy way, generate quantile groups each data point belongs to? example: x = [4 0.5 3 5 1.2]; q = quantile(x, 3); ans = 1.0250 3.0000 4.2500 so see following: result = [2 1 2 3 1]; % quantile groups in other words, looking equivalent of thread in matlab thanks! you can go through n quantiles in loop , use logical indexing find quantile n = 3; q = quantile(x,n); y = ones(size(x)); k=2:n y(x>=q(k)) = k; end

java - Couchbase: How to create JsonObject from a string -

how convert/parse string representation of json object instance of com.couchbase.client.java.document.json.jsonobject? you can use jsontranscoder ( api document ) this. string rawjson = "{\"companyname\":\"apple\",\"employees\":[{\"name\":\"steve\",\"age\":48},{\"name\":\"michael\",\"age\":39}]}"; jsontranscoder trans = new jsontranscoder(); jsonobject jsonobj = trans.stringtojsonobject(rawjson); hope :)

java - Unable to identify the element inside another html -

i've got page below , 'm trying identify element divtofind using selenium . but, inside frame , inside html , i'm unable find it. i 've tried below. switchto().frame() - did not work window handler swapping - there 1 window handler any suggestions please? <html> <head> <body unselectable="off"> <div ..... > <iframe src="/something.jsp" name="framebox"> <!doctype html public "-//w3c//dtd html 4.01//en" "http://www.w3.org/tr/html4/strict.dtd"> <html> <head> <body> <div id="divtofind"> ........ </div> </body> </head> </html> </iframe> </div> </body> </head> </html>

facebook - How to add applink to custom story via Object Browser? (hosted object) -

Image
i'm trying post custom story applink. have defined action type complete , object step - user can "complete step" inside app. defined 1 step using object browser. how can add applink via object browser? there field al:android , assume needs filled data. there hint stating should put there json object or array. did. tried with: {"package":"com.example.myapp","class":"com.example.myapp.mainactivity","app_name":"my example app"} i've got error: is there way make work? you can use facebook mobile hosting api create app link objects. here documentation: https://developers.facebook.com/docs/applinks/hosting-api should in return this: {"id":"643402985734299"} , id of hosted applink - try it.