Posts

Showing posts from May, 2011

performance - Play Framework and Node.js non-blocking behaviour for relational databases -

play framework advises relay blocking io appropriate sized thread pool, in: https://www.playframework.com/documentation/2.5.x/threadpools this case relational database access because there no non-blocking jdbc drivers available (with few exceptions) . i learning node.js , couldn't figure out how handled in node. didn't see need code thinking thread pools in node. so, relational database drivers used in node.js able non-blocking io? or these computations being relayed kind of worker threads behind scenes? on broader sense: correct way code node.js app db (relational) intensive? node single threaded there no user thread pools [1] . instead need scale horizontally more node servers. , can within node app: https://devcenter.heroku.com/articles/node-concurrency and on note, i've had success async-jdbc-ish postgresql-async driver. i've used jdub-async , scalikejdbc . here blog wrote on using scalikejdbc: https://www.jamesward.com/2015/04/07/reac

haskell - Unwrapping the STT monad in a transformer stack? -

this question apparently related problem discussed here , here . unfortunately, requirement different questions, , answers given don't apply me. don't understand why runst fails type check in these cases, doesn't help. my problem this, have 1 section of code uses 1 monad stack, or rather single monad: import control.monad.except type kerr = except kinderror another section of code needs integrate wraps within stt monad : type runm s = stt s (except kinderror) at interface between these sections, need wrap , unwrap outer layer. i've got following function work in kerr -> runm direction: kerrtorun :: kerr -> runm s kerrtorun e = either throwerror return $ runexcept e but reason can't converse type check: runtokerr :: runm s -> kerr runtokerr r = runst r i'm working on assumption runm 's inner monad has same structure kerr , can return once i've unwrapped stt layer, don't seem able far, runst complains type argum

git - How to trigger forked pull request in jenkins build? -

Image
i started use forked branches instead of branches inside primary repo, , when try pull request main repo triggers jenkins fail. when @ log fails grab branch forked repo. is there i'm doing wrong?

ios - UIImageWriteToSavedPhotosAlbum freezes the app -

Image
so have interesting problem. when call uiimagewritetosavedphotosalbum freezes app , don't know why. so code have uiimagewritetosavedphotosalbum(leftimage, self, @selector(image:didfinishsavingwitherror:contextinfo:), nil); uiimagewritetosavedphotosalbum(rightimage, self, @selector(image:didfinishsavingwitherror:contextinfo:), nil); - (void)image:(uiimage *)image didfinishsavingwitherror:(nserror *)error contextinfo: (void *)contextinfo { if (error != nil) { nslog(@"image can not saved"); } else { nslog(@"successfully saved image"); } } so works , doesn't. when remove 2 lines, never freezes. can go wrong. assuming can't see didfinishsavingwitherror because app freezes. here stack the problem calling method twice in succession: uiimagewritetosavedphotosalbum(leftimage, self, @selector(image:didfinishsavingwitherror:contextinfo:), nil); uiimagewritetosavedphotosalbum(rightimage, self, @selector(image:did

Wordpress/WooCommerce plugin to translate content -

for wordpress/woocommerce, want find plugin translate content of post, pages, custom post-types, based on .po files, not wpml because lot of paragraph need reuse that. what can use purpose? you can't translate content of posts or pages based on .po / .mo files, because theme or plugin localisation, not multi language content. for content translation in wordpress, can chose between two: qtranslate free plugin wpml commercial plugin each 1 has strengths , weaknesses… comparison: comparing wpml free , paid alternatives

java - How to configure spring boot mvc app for JSP? -

i new spring boot ( , servlet 3.0 ). trying create spring mvc project jsp view. when return view controller not getting resolved jstlview. here did: @springbootapplication public class myapp extends springbootservletinitializer { public static void main(string[] args) { springapplication.run(myapp.class, args); } } @controller public class maincontroller { @requestmapping( value="/main" , method = requestmethod.get ) public string main(){ return "main"; } @requestmapping( value="/" , method = requestmethod.get ) public string welcome(){ return "welcome"; } } created both .jsp files in src\main\webapp\web-inf\jsp . after googling found need specify in application.properties added following in props: spring.mvc.view.prefix: /web-inf/jsp/ spring.mvc.view.suffix: .jsp logging.level.org.springframework: trace logging.level.com: trace even after not working.

Ember 2.5 QueryRecord Return's All Records Instead of Only One -

i having tough time building test ember app right way. when hit main index page, route succesfully grabs 7 records database, should , sticks them in store. however, when go single post link-to helper , use queryrecord, still returns 7 records. have tried , without reloadrecord , tried filter key. ** standard disclaimer, always, stupid! import ember 'ember'; export default ember.route.extend({ model(params) { console.log(params); //20160422-tutorial let post = this.store.queryrecord('post', {slug: params.slug}, { reload: true }); console.log(post); //shows 7 records here , in ember inspector. return post; } });

How to check which terminals are open using c -

i trying check terminals open using c. when type "w" terminal shows 4 terminals open (which how many terminals have open). however, when run code tells me there 20 open. how fix this? #include <stdlib.h> #include <stdio.h> #include <string.h> #include <ctype.h> #include <unistd.h> #include <sys/wait.h> #include <signal.h> #include <time.h> const char pts[] = "/dev/pts/"; int s1=0; file *fp = null; char *terminal[4]; char* check; int main(int argc, char *argv[]){ int i; char strdev[100]; for(i=0; i<100; i++){ sprintf(strdev, "%s%d", pts, i); printf("opening %s...\n", strdev); fflush(stdout); if((fp = fopen(strdev, "w")) == null) ; else{ printf("\topened %s\n", strdev); fflush(stdout); terminal[s1] = strdev; s1++; } } return 0; } running w reasonably portable. count needed, not headers. first line of headers usually status lin

c# - Radio Button Validation in WinForms -

so have multiple different radio buttons, in different group boxes. before user able "save" form, fields need filled in. trying make sure radio buttons filled in. @ moment trying use following code: if (!(this.roundtrip.checked || this.oneway.checked)) { messagebox.show("select option trip type"); if (!(this.northrad.checked || this.expressrad.checked || this.expressrad.checked)) { messagebox.show("select option route type"); } if (!(this.yesneeded.checked || this.notneeded.checked)) { messagebox.show("select option accessibility"); } if (this.adultnum.value == 0 && this.seniornum.value == 0 && this.childnum.value == 0) { messagebox.show("select @ least 1 ticket"); }

SQL Server : trouble with ROW_NUMBER OVER PARTITION BY -

i having trouble in calculating maximum of row_number in sql statement. i query search originaldocumentnumber data not same query http://i.stack.imgur.com/xwvn9.png select originaldocumentnumber, filterround, p2_reason, rowno, p2_finalgrade (select * ,row_number() on (partition originaldocumentnumber,filterround order p2_finalgrade desc) rowno #tempda ) l l.p2_finalgrade in ('d','f') , l.rowno = 1 , l.originaldocumentnumber='590200054' , l.originaldocumentnumber+l.filterround not in (select originaldocumentnumber+filterround #tempda p2_finalgrade in ('a','b','c')) query 2 output image query 2 select originaldocumentnumber ,filterround , p2_reason , rowno , p2_finalgrade ( select * ,row_number() on (partition originaldocumentnumber,filterround order p2_finalgrade desc) rowno #temp

javascript - Mouse click object unity 5.3 UI? -

i'm working on project due monday school. i've been working on while, when comes coding unable solve errors since i'm practically beginner. how should format code every time click object gui appears? i'm using unity version 5.3. code: #pragma strict var scanners : uitext //variable gui text function start () //scanner not clicked { scanners.enabled=false; } function onmousedown() //scanner clicked { scanners.enabled=true; } function onmouseup() //scanner unclicked { scanners.enabled=false; } gui elements drawn inside ongui() function. old way of doing things. since unity 5 can add ui text element (rightclick hierarchy > ui > text) or use 3d text , , gameobject.setactive(true/false); on text when run onmousedown/up() functions.

event handling - iOS: How does multitouch affect touchesBegan, Moved and Ended? -

i don't have apple developer license yet, can't test out find out. when touch screen 1 finger, know nsset sent touchesbegan has 1 uitouch object in it. when 2 touches occur @ once, set has 2 uitouch-es in it. when have 1 finger down, , touch somewhere else too, assume touchesbegan fire again, have both uitouch objects in nsset? or 1 started? i assume whatever answer is, holds true touchesmoved , touchesended, if not, let me know too? thanks, peter i tried: - (void) touchesbegan:(nsset *)touches withevent:(uievent *)event { nslog(@"number of touches : %d", touches.count); (uitouch *touch in touches) { cgpoint loc = [touch locationinview:self.view]; nslog(@"location %f, %f", loc.x, loc.y); } } it turns out yes, touchesbegan fire again when 1 touch held when making touch attempt, in case second fire reports "number of touches : 1" , location of second touch. don't know sure whether same true tou

javascript - Google Recaptcha (Contact Still Send Through) -

i having issue contact page , appreciated me google recaptcha coding. i have added scripts , keys html. showing in website contact page stills goes through if did not click on recaptcha. know java script passing through recaptcha. below html code, javascript , php codings. hope can let me know went wrong. html code: <div class="col-md-6 col-md-6"> <h3 class="title">contact form</h3> <p class="form-message"></p> <div class="contact-form"> <!-- form begins --> <form role="form" name="contactform" id="contactform" method="post" action="php/contact-form-recaptcha.php"> <div class="row"> <div class="col-md-6"> <

python - Error occured when processing local signature- Pydev plugin installation on indigo eclipse -

enter image description here i tried installing pydev plugin on eclipse , suggested in pydev eclipse plugin fails update in eclipse update manager have updated version of eclipse. still can't proceed installation due ' error occurred while processing signatures file'. configuration details : os: win 7 64 bit eclipse: version: indigo service release 2 java version : 1.8.0_60 installation type : fresh installation of pydev , rest eclipse , java pre-installed please !!! in advance pydev.error

postgresql - What is the proper syntax for aliasing a recursive CTE in SQL? -

i have postgresql database of tasks , subtasks. here recursive cte statement: with recursive getchildren (childname, childid, parentid, parentname) ( select child.name,child.id,child.parent,parent.name lists child, lists parent child.parent=parent.id , parent.id=30 union select l.name,l.id,l.parent,g.childname lists l, getchildren g l.parent=g.childid ) select childid,childname,parentid,parentname getchildren; here output: childid | childname | parentid | parentname ---------+-----------------------------+-------------+----------------- 46 | fix escaped chars | 30 | list program 51 | add comments | 30 | list program 47 | rename task | 30 | list program 36 | dependencies | 30 | list program 34 | obfuscate id | 30 | list program 37 | move task | 36 | dep

java - Extract text in a order using jsoup -

i want extract text inside "job title" , text inside "summary" class. there many same class names. want job title of first 1 , summary of it. , job title of next 1 , summary of it. in order. the following code works. first gives titles , text inside summary classes. want first job title , first summary. second job title , second summary , on. how modify code this? please help. <div class=" row result" id="p_64c5268586001bd2" data-jk="64c5268586001bd2" itemscope="" itemtype="http://schema.org/jobposting" data-tn-component="organicjob"> <h2 id="jl_64c5268586001bd2" class="jobtitle"> <a rel="nofollow" href="/rc/clk?jk=64c5268586001bd2" target="_blank" onmousedown="return rclk(this,jobmap[0],0);" onclick="return rclk(this,jobmap[0],true,0);" itemprop="title" title="fashion assistant" class="

postgresql - Accessing row values in a trigger -

Image
here code far: create or replace function updatedegreestatus() returns trigger $updatedegreestatus$ begin if(new.degreename = old.degreename , old.enddate = null) update degree set old.enddate = current_date degree.degreeid = old.degreeid; end if; return new; end; $updatedegreestatus$ language plpgsql; create trigger updatedegreestatus before insert on degree each row execute procedure updatedegreestatus(); what having trouble accessing current values of row trigger on. how stored procedure should work, if new insert has same degree name current row , current row value end date null this. keyword old not how access current row values. , have been reading through documentation , still can not find answer. if has input on how fix issue, love help. here current table: and insert this: insert degree(degreeid, degreename, type, startdate, enddate) values(3, 'computer science concentration in software deve

Anyway to disable "Confirm Form Resubmission" on Google Chrome? -

chrome browser of choice web development. whenever reload page has form using "post" "confirm form resubmission" pop-up. extremely time consuming on course of day. is there known way disable this? i've searched answer have found posts 2010-2011 no relevant information. any appreciated!

javascript - Adding number to p.value -

here 's fiddle. i'm trying make when press button, adds 1 #num . js: $(document).ready(function () { $('#b').button({ icons: { secondary: '.ui-icon-triangle-1-n' } }); $('#b').click(function () { var x = '#num'.value; var u = x + 1; document.getelementbyid('#num').innerhtml = u; }); }); try .it should work $(document).ready(function () { $('#b').button({ icons: { secondary: '.ui-icon-triangle-1-n' } }); $("#b").click(function () { var x = parseint($('#num').html()); var u = x + 1; $('#num').html(u); }); });

c# - Problems with UDP in windows 10. UWP -

i having following problem: communicating 2 different machines in local network udp. in 1 side have windows 7 machine 4.5 framework installed. using class system.net code: public static void udpwriter() { task.run(async () => { byte[] data = new byte[10000]; ipendpoint ipep = new ipendpoint(ipaddress.pars("192.168.0.16"), 5002); socket udpclient = new socket(addressfamily.internetwork, sockettype.dgram, protocoltype.udp); udpclient.connect(ipep); while (true) { await task.delay(24); string input = packagetosend; data = encoding.ascii.getbytes(input); var receivedresults = udpclient.send(data, socketflags.none); } }); } in other side working windows 10 universal app code: async static private void enablerlistener() { //click hostname hos

local every minima in a kernel density function with R -

i hope can me. created kernel density function. multimodal curve. curve has several maxima , minima. want r shows me every minima (not maxima) (see enter image description here the yellow points in attached chart). i used follwing code: all.modes <- function(x, h="nrd0") { den <- density(x, bw=h, kernel=c("gaussian")) den.s <- smooth.spline(den$x, den$y, all.knots=true, spar=0.8) s.0 <- predict(den.s, den.s$x, deriv=0) s.1 <- predict(den.s, den.s$x, deriv=1) s.derv <- data.frame(s0=s.0$y, s1=s.1$y) nmodes <- length(rle(den.sign <- sign(s.derv$s1))$values)/2 lengths <- rle(den.sign <- sign(s.derv$s1))$length if (is.na(nmodes) == true) { nmodes <- 0 } cum <- cumsum(lengths) x <- den$x[cum] y <- den$y[cum] return(list(x=x, y=y)) } but code shows every modes. thank help.

c# - Can't access Exception property -

Image
i catching argumentexception , of want specific property. when put breakpoint on code argumentexception caught, see has errormessage property: but trying access gives result: what's going on here? the problem in first screenshot display httpwebresponse or similar object, while in second screenshot working actual exception. exceptions have message property , not errormessage . change second code ex.message , work.

javascript - Div fading in and out -

i need help, working on website want div delay 2 seconds fade in when div clicked, when want click again (to close it) want fade out instantly. help? if can use jquery, following code got want: default css: .inviselem{display:none} and jquery code: $('body').on('click', '.boxbutton1', function(){ var counter = $(this).data('count'); if(counter == undefined){ counter = 0; settimeout(function() { $('.gymtext').fadein(500)//fadein after 2 seconds(2000 ms) }, 2000); } else if(counter == 0){ $('.gymtext').fadeout(function(){ $('.gymtext').remove() });//fadeout remove } }) i tried write down novice friendly if needed add comment

eclipse - Maven is not detecting ArangoDB 2.8.6 java driver -

i'm trying create maven project in eclipse java application arangodb 2.8.6 version. unfortunately maven project throwing below error after pom.xml entry: "missing artifact com.arangodb:arangodb-java-driver:jar: 2.8.6" my entry in pom.xml below: <dependency> <groupid>com.arangodb</groupid> <artifactid>arangodb-java-driver</artifactid> <version>2.8.6</version> </dependency> when try giving version 2.4 in pom.xml working out issues. work on 2.8.6 version. please how proceed further. also saw arango db java driver in github: https://github.com/arangodb/arangodb-java-driver how bundle maven project. please help. you have mixed versions. latest available version of driver 2.7.4 (or 2.7.5-snapshot if prefer snapshots), in github link have provided. however, arangodb version supported includes arangodb 2.8.x 2.7.4 driver should able use arangodb 2.8.6, suspect want. edit: clarify, sho

node.js - findOne not working in mongoose/node -

this question mongoose module nodejs platform. when run below, how response db?: router.get('/profilesettings', securepages, function(req, res, next){ databaseusermodel.findone({'profileid':req.session.facebookprofileid}, function(err, userfromdb) { if(userfromdb){ done(null, userfromdb); } else { console.log('result not exist'); } }); res.render('profilesettings', {title:sitename + ': profile settings', user:userfromdb}); }) it doesn't seem work me userfromdb doesn't seem exist - both in findone , in res.render methods! (undefined precise) my databaseusermodel looks this: var databaseuser = new mongoose.schema({ profileid:string, fullname:string, profilepic:string, email:string, birthday:string, location:string, about:string }); var databaseusermodel = mongoose.model('databaseuser', databaseuser); the error message is: referenceerr

asset pipeline - Rails NoMethodError: undefined method `[]' for nil:NilClass Error while precomple for production -

i 'm using trying precompile assets prduction using rails_env=production rake assets:precompile --trace but gives me error nomethoderror: undefined method `[]' nil:nilclass complete logs are /home/faisal/.rvm/gems/ruby-2.2.3/gems/sprockets-3.5.2/lib/sprockets/sass_processor.rb:278:in `sprockets_context' /home/faisal/.rvm/gems/ruby-2.2.3/gems/sprockets-3.5.2/lib/sprockets/sass_processor.rb:124:in `asset_path' /home/faisal/.rvm/gems/ruby-2.2.3/gems/sprockets-3.5.2/lib/sprockets/sass_processor.rb:200:in `font_path' /home/faisal/.rvm/gems/ruby-2.2.3/gems/sass-3.4.21/lib/sass/script/tree/funcall.rb:140:in `_perform' /home/faisal/.rvm/gems/ruby-2.2.3/gems/sass-3.4.21/lib/sass/script/tree/node.rb:50:in `perform' /home/faisal/.rvm/gems/ruby-2.2.3/gems/sass-3.4.21/lib/sass/script/tree/funcall.rb:170:in `perform_arg' /home/faisal/.rvm/gems/ruby-2.2.3/gems/sass-3.4.21/lib/sass/script/tree/funcall.rb:124:in `block in _perform' /home/faisal/.rvm/gem

c++ - Error passing a cv::Mat to JNI using OpenCV on Android -

i developing android project opencv , jni. actually changing face-detection sample. the problem have when pass cv::mat reference gives strane output , not passed well. to put in situation, have in fdactivity.java, main activity of android app: public mat oncameraframe(cvcameraviewframe inputframe) { rgb = inputframe.rgba(); mat res = mnativedetector.process(rgb); return res; } the process function this: public mat process(mat rgb) { mat n = null; if(rgb.empty()) { system.out.println("empty image"); } else { system.out.println("the image " + rgb.rows() + "x" + rgb.cols()); n = nativeskinfilter(mnativeobj, rgb.getnativeobjaddr()); } return n; } where nativeskinfilter native function declaration private static native mat nativeskinfilter(long thiz, long inputimage); in c++ side have function declaration (detectionbasedtracker.h): jniexport jlong jnicall java_org_opencv_sam

android - Exception locking surface, java.lang.IllegalArgumentException -

i using thread handle wallpaper , using surface view. getting following error , unable solve it. there answer in told there problem in sequence of lock surfaceholder.lockcanvas() , surfaceholder.unlockcanvasandpost(canvas) . check , right. plese someone.. logcat below: 07-06 12:58:24.459: e/surfacetextureclient(719): queuebuffer: error queuing buffer surfacetexture, -19 07-06 12:58:24.459: e/surfacetextureclient(719): queuebuffer (handle=0x2a185508) failed (no such device) 07-06 12:58:24.470: w/system.err(719): java.lang.illegalargumentexception 07-06 12:58:24.479: w/system.err(719): @ android.view.surface.nativeunlockcanvasandpost(native method) 07-06 12:58:24.489: w/system.err(719): @ android.view.surface.unlockcanvasandpost(surface.java:457) 07-06 12:58:24.489: w/system.err(719): @ com.android.internal.view.basesurfaceholder.unlockcanvasandpost(basesurfaceholder.java:215) 07-06 12:58:24.489: w/system.err(719): @ com.shagun.sunsetlivewallpaper.backgroundselector$leafthrea

javascript - Pre Select interest Groups Mailchimp -

i using mailchimp add subscribe form on site, have added interest groups, checkboxes, 40, i need show form in popup on site, upon click, , have used jquery modal it. the issue want display checkboxes of interest groups checked default when form loads, how can ? i using form url mailchimp provides me in iframe included in modal box body. currently use embedded form , check checkboxes manually, upon submit, redirects me tab, should remain in same modal box afaik, isn't possible iframe modal. it's not feature mailchimp offers , browser security not allow javascript site interact html in iframe. in order implement feature, you'll need write own form.

How to remove a class from a check in a jQuery Mobile Table -

Image
i have check box inside jquery mobile table id of deletetable , has following class added it: i want remove class ui-checkbox have following code: $("tabledelete input[type='checkbox'] div").removeclass("ui-checkbox"); but somehow doesn't seem work , i'm sure why. you try : $("tabledelete .ui-checkbox").removeclass("ui-checkbox"); on other hand, mustn't doing this. if dont want styling applied element, example, checkbox, must have data-role=none in it.

xpath - check text is present in table (selenium IDE) -

i trying check text "autotest" present somewhere in html table "tabletest". in selenium ide, put code : <tr> <td>verifytextpresent</td> <td>//table[@id='tabletest']</td> <td>autotest</td> </tr> here code of html table : <table id="mytable"> <tr> <td><a href="#">autotest</a></td> <td>test</td> </tr> <tr> <td><a href="#">uoi</a></td> <td>test</td> </tr> </table> but assertion return false whereas text present in table. command can use check text present in table ? i think reason you're trying verify 1 bit of text using entire table locator, rather specific section contains text you're looking for, result isn't matching because have other content within table, , verify step looking exact match. you'd need p

Android selector with urls -

Image
now,i have multiple radiobuttons internet url resource,and need set selector radiobutton 2 urls returned server. i've thought change url resource when radiobutton state changed,but think complex. there can me. pictured above, under normal circumstances, put in selector drawable local resources, state 1 normal, state 2 elections, 2 pictures loaded network

c# - How to populate an array in side a model for postback -

i have model contains list of milestone , want list populated (inside model) given set of textboxes in webpage. public class project { public string projectnumber { get; set; } public ilist<parameter> parameters; public ilist<milestone> milestonelist = new list<milestone>(); } and inside html.beginform("edit", "home", formmethod.post, new { project = model })) have following textbox. @for (int = 0; < model.milestonelist.count; i++) { <td style="align-content: center;">@html.textboxfor(model=>model.milestonelist[i].value)</td> } my problem in controller below milestonelist null in model project [httppost] public actionresult edit(project project) { helper.createproject(project, system.web.httpcontext.current.user.identity.name); return view(); } so how should program list inside model populated through textboxes? your using fields in model, not properties, defaultmodelb

html - jQuery height function not working -

i've run issue jquery, when set height of div window height, using code @ js bin , works, when reduce window height manually reducing size of browser, gets chopped off, portion of div goes out of screen. i set on js bin if resize browser window, notice list number 3 (and on) out of screen. can't wrap head around why happens, i've tried changing jquery version, i've double triple checked code, can't find wrong it. i've rewritten too, still not working. searched on forum, told me add jquery resize function, , proved me hadn't took @ code, because have function, it's setheight function not being executed on window resize. please advise. actually don't need scripts achieve want. heres css solution - https://jsbin.com/xopamakiru/1/edit?html,css,js,output your navbar position: fixed positioned relative body , can add height: 100% , take whole height of viewport. need add same height children elements 100% height of nav bar. have 3 li

shell - In bash, what does <<< is used for? -

i've documentation sign <<< can't find explanation. here example: ifs=';' read -ra addr <<< "allo;hi;salut" what line ? , specificaly <<< in line? thanks it's used create here string

php - How to write to Z drive by using fopen()? -

i have mentioned below code. $commandfile = "contains big string"; if($fp = fopen("file:///z:/testname.txt","w+")) { fwrite($fp,$commandfile); fclose($fp); } z drive has user credentials i.e (username:network,pass:network). z drive mapped computer. how write file z drive? in advance. if z regular drive on machine running script , plain: fopen('z:/testname.txt',"w+") should sufficient.

jquery - Not able to play sound on iphone using JavaScript but able to play on Android -

i trying play sound notification on android , iphone using javascript library able play sound on android , not on iphone. i using javascript ion.sound.play("beep") function play sound. have kept sound file in folder. can 1 me out; how can play sound on iphone using javascript? the sounds require user input in ios9. can initialize sound "invisible" button disappears after 1 press @ initialization of app. once triggered, should able call ion.sound.play("beep") programatically. you. css: <style> #init { position: absolute; margin-right: 0px; margin-left: 0px; margin-top: 0px; margin-bottom: 0px; z-index: 1000; } </style> javascript: if((navigator.useragent.match(/iphone/i)) || (navigator.useragent.match(/ipod/i)) || (navigator.useragent.match(/ipad/i))) { document.write('<a id="init" ontouchstart="javascript:sndinit();"></a>'

javascript - jQuery price calculator -

i trying create simple jquery calculator doesn't seem working hope be. should calculate automatically @ 0 price input boxes , multiply when +/- clicked. it doesn't seem or show errors. jquery(document).ready(function(){ var qty = parseint($('.qty').val()); var price = parsefloat($('#price').val()); $("#price").each(function(){ total += parsefloat(this.value); }); http://jsfiddle.net/hktxyz5z/1/ i not sure if on thinking, got ideas? you need give variable declarations inside click event: var qty = parseint($('.qty').val()); var price = parsefloat($('#price').val()); the reason is, statically setting values 0.00 @ first load. every time increment or decrement, values not change. set once , not set when changed. don't dynamically change, after click events fired. the solution put above 2 lines inside .click() functions. jquery(document).ready(function(){ $("#pri

mySql: a faulty returned result -

i have table: product_id | name | status |update_date ___________|________|___________|___________ 1 | prod1 | bought | 2016-04-20 2 | prod2 | bought | 2016-04-20 3 | prod3 | bought | 2016-04-20 1 | prod1 | sold | 2016-04-22 i execute following query: select status, max(update_date), product_id product group product_id; i result: bought| 2016-04-22 12:25:00 | 1 bought| 2016-04-20 10:10:10 | 2 bought| 2016-04-20 10:10:10 | 3 i wonder why product product_id = 1, status bought , not sold!! i wanna last status each product. try this: select p.status, p.update_date, p.product_id product p inner join ( select max(update_date) max_time, product_id product group product_id ) t on p.product_id = t.product_id , p.update_date = t.max_time it lies in category : select whole row having max value . please @ post

ios - Objective-c newbie - UIViewController managedObjectContext unrecognized selector sent to instance -

Image
using code below following error: 2016-04-25 10:04:51.520 ecoss[1700:620301] -[__nscfstring managedobjectcontext]: unrecognized selector sent instance 0x160383a0 objc[1700]: exceptions: throwing 0x14f94500 (object 0x14d07b70, nsexception) objc[1700]: exceptions: searching through frame [ip=0xffffffff sp=0x26a0b0] exception 0x14f944e0 objc[1700]: exceptions: searching through frame [ip=0x2 sp=0x26b980] exception 0x14f944e0 objc[1700]: exceptions: unwinding through frame [ip=0xffffffff sp=0x26a0b0] exception 0x14f944e0 objc[1700]: exceptions: unwinding through frame [ip=0x2 sp=0x26b980] exception 0x14f944e0 objc[1700]: exceptions: handling exception 0x14f944e0 @ 0x231e33b9 objc[1700]: exceptions: rethrowing current exception objc[1700]: exceptions: searching through frame [ip=0x6 sp=0x26b980] exception 0x14f944e0 objc[1700]: exceptions: terminating objc[1700]: exceptions: searching through frame [ip=0x1 sp=0x26b820] exception 0x14f944e0 objc[1700]: exceptions: catch(id) objc[1700]:

javascript - custom series order in dygraphs legend -

i have series in csv: date,color,pressure,air 23.12.1912,green,1090,good ... dygraph displays them in legend in order in csv can resorted "date,air,color,pressure" without reordering whole csv file? import csv javascript , reorder want.

django - All groups list with additional boolean field showing user membership -

i list of available groups additional boolean field showing if particular user member of group. #this give me groups related user "myuser" mygroup = myuser.groups.all() the result list of id, groupname related user "myuser". how can have list of groups (including not part of mygroup) evidence of membership "myuser" on additional boolean field (user_membership)? id, groupname, user_membership(true/false) you use a conditional expression : group.objects.annotate(user_membership=case( when(user=myuser, then=value(true)), default=value(false), output_field=booleanfield(), )) this return groups additional user_membership field containing true or false values.

Selenium with Python: can't find element by link text -

could me understand why in particular case find_element_by_partial_link_text doesn't catch element. from selenium import webdriver import unittest class registernewuser(unittest.testcase): def setup(self): self.driver = webdriver.firefox() self.driver.implicitly_wait(30) self.driver.get("http://web.archive.org/web/20141117213704/http://demo.magentocommerce.com/") def test_register_new_user(self): self.driver.find_element_by_link_text("log in").click() pardon strange link. i'm reading book on selenium , link there. contents has changed. book seems ok me. so, extracted old web page archive. well, if view page source, can find link there. can't reach via selenium. could give me hint? thank in advance. the link hidden, need click first on menu ( account )

Numbers at the end of a URL Magento 1.9 -

on our website used have loads of links had 4 digits on end of them. looked www.example.com/example-1234.html. the urls numbers had overridden normal url www.example.com/example.html. we got rid of them truncating core_url_rewrite table , turned active url's numbers @ end of them 404's. however, have noticed these numbers have come , i'm not sure why. however, time effecting category urls of our category urls like: www.example.com/main-category/sub-category-1234/product.html i found article on stackoverflow useful: magento - removing numbers in url key/product url . however still don't understand why happening. found function getunusedpath causing these numbers happen , looks create numbers @ end of url if ($rewrite && $rewrite->getid()) // , $rewrite` equal $rewrite = $this->getresource()->getrewritebyrequestpath($requestpath, $storeid); do know can find out getresource()->getrewritebyrequestpath($requestpath, $st

c# - convert sql (row_number and DENSE_RANK) to linq -

i have below sql(ms-sql 2014) statement works . how convert sql linq? i'm reading now, putting out there in case can't it. select originaldocumentnumber ,filterround , p2_reason , p2_finalgrade , rowno , s_index , t_index ( select * , rowno=row_number() on (partition originaldocumentnumber,filterround order p2_finalgrade desc) , s_index = row_number() over(partition filterround,originaldocumentnumber order p2_finalgrade), t_index = dense_rank() on (order p2_finalgrade) #tempda ) l l.p2_finalgrade in ('d','f') , l.rowno = 1 , l.originaldocumentnumber = '590200054' , l.p2_reason = 'test' , l.originaldocumentnumber+l.filterround not in (select originaldocumentnumber+filterround #tempda p2_finalgrade in ('a','b',&