Posts

Showing posts from September, 2013

ios - Using AVAudioRecorder and AvAudioPlayer simultaneously -

i need have have audio (a lecture etc.) recording on iphone , directly playing through headphones. i have code works - of time! i set avaudiosession [[avaudiosession sharedinstance] setcategory:avaudiosessioncategoryplayandrecord error:nil]; i set player , recorder, both pointing same url. audiorecorder = [[avaudiorecorder alloc] initwithurl:soundfileurl settings:recordsettings error:&error]; //set audio playing audioplayer = [[avaudioplayer alloc] initwithcontentsofurl:soundfileurl error:&error]; i prepare play , record [audiorecorder preparetorecord]; [audioplayer preparetoplay]; everything proceeds while. suddenly, player stops, , current time goes zero. it doesn't getting dealloc'ed, since can proceed play recorded sound fine start position. stopping occurs seemingly randomly, @ different times each time. anyone have suggestions problem or how debug? thank

cascade - OpenCV traincascade parameters -

i try train lbp cascade classifier emotion recognition i've managed 650 faces positives , 1002 negatives. these parameters: numpos: 650 numneg: 1002 numstages: 20 precalcvalbufsize[mb] : 1500 precalcidxbufsize[mb] : 1500 stagetype: boost featuretype: lbp samplewidth: 24 sampleheight: 24 boosttype: gab minhitrate: 0.995 maxfalsealarmrate: 0.5 weighttrimrate: 0.95 maxdepth: 2 maxweakcount: 100 the positives consists of 650 frontal faces laughing , negatives consists of faces not laughing , of others random pics of animals, nature, trucks etc i don't why doesn't find of parameters have default values. suggestion appreciated. i have increased number of positive faces 735 , negative 1700. xml loaded correctly detects random parts background or face , laughing doesn't change result.

vb.net - change input value of hidden input in current document webbrowser -

here html <input type="hidden" name="visited" value="aw5kzxgucghwpw==" /> vb.net dim pageelements htmlelementcollection webbrowser1.document.getelementsbytagname("input") each curelement htmlelement in pageelements if curelement.getattribute("name") = "visited" curelement.setattribute("value", "hhhhhhhhhhhhhhhhh") end if i want change value of input on current document webbrowser user in next action new value you can change input value javascript. var input = document.getelementbyid('visited'); input.value ="your new value"; you need set id of hidden field

networking - TCPDUMP: Bitmasking -

i taking digital securities class , dont understand 1 of examples on bitmasking. to find ipv4 packets run command tcpdump ip[0] & 0xf0 = 4 i believe wrong, bit mask correctly selects first 4 bits of ip header (which version number) , sets bits internet header length 0. but shouldnt answer be tcpdump ip[0] & 0xf0 = 0x40 this states set bits in first byte of ip packet header except first 4 bits (which version number) 0 , show packets value equal 0100 0000 this states set bits in first byte of ip packet header except first 4 bits (which version number) 0 more correctly, selects first 4 bits of first byte of ip packet header, , returns value in lower 4 bits zero. so are correct, in tcpdump ip[0] & 0xf0 = 4 never succeed (as ip[0] & 0xf0 in range 0x00 through 0xf0 , low-order nibble being 0, can never equal 4), , ip[0] & 0xf0 = 0x40 succeed if ip version number in ip header 4 (rather than, example, 6).

android - styling drop down/navigation bar actionbarsherlock font -

Image
in application have, have actionbar drop down's font white . till have following style: <style name="theme.myapplications" parent="@style/theme.sherlock.light.darkactionbar"> <item name="actionbarstyle">@style/actionbar.solid</item> <item name="android:textsize">18sp</item> </style> <style name="actionbar.title" parent="textappearance.sherlock.widget.actionbar.title"> <item name="android:textcolor">@android:color/white</item> </style> <style name="actionbar.subtitle" parent="textappearance.sherlock.widget.actionbar.subtitle"> <item name="android:textcolor">@android:color/white</item> </style> <style name="actionbar.solid" parent="@style/widget.sherlock.light.actionbar.solid"> <item name="tit

c# - How to enable RowTest in MSTest for VS2012 -

this question has answer here: how rowtest mstest? 6 answers guys, found there no such rowtest in mstest, how can enable functionary? thanks! check out blog post, extends unit test type include tests on rows. http://blogs.msdn.com/b/vstsqualitytools/archive/2009/09/04/extending-the-visual-studio-unit-test-type-part-2.aspx

php - If $_POST variable is not 3 numbers long -

i person's weight, on 18 years old 100 pounds plus, want check if $_post variable weight entered 3 digits only. have form user enters weight... if (!is_numeric($weight)) { echo "you did not enter numeric weight."; die; } using above make sure it's numeric... want verify number 3 digits. thank you you can do: is_numeric($weight) && ($weight > 99) && ($weight < 1000)

iphone - detect collision with sprite in sprite sheet -

i have sprite sheet in there 4 images(bat1,bat2,bat3.bat4) , in image there person holding bat , when images combined in animation looks playing baseball. below code have used add sprite sheet. [[ccspriteframecache sharedspriteframecache] addspriteframeswithfile:@"baseball.plist"]; spritesheet = [ccspritebatchnode batchnodewithfile:@"baseball.plist"]; [self addchild:spritesheet]; background = [ccsprite spritewithspriteframename:@"bat4.png"]; background.position = ccp(220, 185); background.tag = 10; [self addchild:background]; for(int = 1; < 5; i++) { [walkanimframes addobject:[[ccspriteframecache sharedspriteframecache] spriteframebyname:[nsstring stringwithformat:@"bat%d.png", i]]]; } ccanimation *walkanim = [ccanimation animationwithspriteframes:walkanimframes delay:5.0f]; self.walkaction = [ccrepeatforever actionwithaction:[ccanimate actionwithanimation:walkanim]]; [background runaction:_walkaction]; and detectin

c - Converting old C99 program to C11 using MinGW -

i'm trying convert old program written in c99 c11 compiled mingw. came across line of code here contenu[/size] = buffer; and code output[k] = ((s[(s[i][/i] + s[j])%size]) ^ texte[k]); i'm not used c99. says [/size] , [/i] old c99 syntax or writing code wrong? also i'm using -std=c99 toggle mingw. each of expressions contenu[/size] , s[i][/i] neither c99 nor c11. problem not converting c99 c11, quite easy (there few differences between revisions , hidden) converting c-like language c.

qt - While rotation of Images, Size of image decreases -

hello all, trying rotate images in qt. while rotating again , again, size of image decreases. how can stop size decrement ? please me out. using code. void mywidget::rotatelabel() { qpixmap pixmap(*my_label->pixmap()); qmatrix rm; rm.rotate(90); pixmap = pixmap.transformed(rm); my_label->setpixmap(pixmap); } in qt files qpixmap::transformed, states: - the transformation transform internally adjusted compensate unwanted translation; i.e. pixmap produced smallest pixmap contains transformed points of original pixmap. use truematrix() function retrieve actual matrix used transforming pixmap. i assume width , height of image not equal. therefore, you've observed, each rotation reduce size, ensure full image maintained. change original image have equal width , height adding border, or scale image before or after rotation, image quality suffer. alternatively, if you're rotating 90 degrees, rotate images in ex

overlay - how to deploy config files for webapps in jetty 9 -

we using jetty overlay deployer install our confings (which defer testing, dev, prod) along our binary war files. according documentation feature has been dropped: http://wiki.eclipse.org/jetty/tutorial/configuring_the_jetty_overlay_deployer is there recommended alternative deploying web config jetty? thx andreas post note on bug , should bring quicker. https://bugs.eclipse.org/bugs/show_bug.cgi?id=404508 aside have normal jetty style of using context xml files describe things, nothing quite overlay setup in terms of reducing memory usage in multiple iterations of same webapp being loaded. http://www.eclipse.org/jetty/documentation/current/configuring-contexts.html

c++ - why does left shift with variables generate different result from that with constant? -

after compiling code below, got weird result, =1 while b =0. explain what's going on behind scene? #include<iostream> using namespace std; int main(){ int n=32; int a=1<<n; //turns out a=1 int b=1<<32; //turns out b=0 cout<<"a="<<a<<endl; cout<<"b="<<b<<endl; } the standard not define, or rather, defines "undefined behaviour", happens in case left shift beyond size of integer type. [the reason undefined behaviour different hardware may or may not behave same given, example, 32-bit shift left]. in first case [at least without optimization], compiler generates instructions calculate 1 << 32 - on x86 turns 1 << (32 & 31) same 1 << 0 - 1. in second case, compiler calculate value itself, turns overflow, , gives zero. it's quite (but not certain) if change compiler options optimize code, gives 0 both cases. , going behaviour want if

java - SQL 'case when' in hibernate Criteria -

how can tranform following query hibernate criteria? select pr_name, count(*) (select (case when serv.type=xyz serv.namea else serv.nameb end) pr_name db.serv serv serv.date null group pr_name; i have got following handle rest (except case part) currentsession.createcriteria(storeddata.class) .setprojection(projectionlist() .add(groupproperty("pr_name"), "pr_name") .add(rowcount(), "count")) .add(isnull("date")) .setresulttransformer(new prcounttransformer()) .list(); you can create property prname in storeddata , define "case" part pure sql using annotation @formula .

using checkbox in telerik grid -

i'm using checkbox in telerik grid. following code @(html.telerik().grid<productmodel>(model.products.data) .name("products-grid") .columns(columns => { columns.bound(x => x.id) .clienttemplate("<input type='checkbox' name='checkedrecords' value='<#= id #>' />") .title("") .width(36) .htmlattributes(new { style = "text-align:center" }); columns.bound(x => x.id); columns.bound(x => x.name); columns.bound(x => x.published) .width(100) .template(x => x.published.tostring().tolower()) .centered(); }) .pageable(

c++ - how to get rid of escape character in a token with spirit::lex? -

i want tokenize own extension of sql syntax. involves recognizing escaped double quote inside double quoted string. e.g. in mysql these 2 string tokens equivalent: """" (the second double quote acts escape character) , '"' . have tried different things stuck @ how replace token's value. #include <boost/spirit/include/lex_lexertl.hpp> namespace lex = boost::spirit::lex; template <typename lexer> struct sql_tokens : lex::lexer<lexer> { sql_tokens() { string_quote_double = "\\\""; // '"' this->self("initial") = string_quote_double [ lex::_state = "string_double" ] // how ignore + ctx.more()? | ... ; this->self("string_double") = lex::token_def<>("[^\\\"]*") // action: ignore + ctx.more() | lex::token_def<>("\\\"\\\"") // how set token value '"' ? |

osx - NSOutlineView scroll animation is not working -

i want remove nsoutlineview 's show/hide button.so,i override nsoutlineview , mousedown event.the follow code. -(void)mousedown:(nsevent *)theevent { nslog(@"leftfolderlistoutlineview mousedown"); [super mousedown:theevent]; nspoint localpoint = [self convertpoint:theevent.locationinwindow fromview:nil]; nsinteger row = [self rowatpoint:localpoint]; id clickeditem = [self itematrow:row]; if (![clickeditem iskindofclass:[nsdictionary class]]) { return; } if ([self isitemexpanded:clickeditem]) { [[self animator] collapseitem:clickeditem]; }else{ [[self animator] expanditem:clickeditem]; } } it should scroll animation when nsoutlineview collapse or expand.but in case it's not working.anyone tell me why , how can improve this? to remove 'show/hide button' (outline cell) implement - (nsrect)frameofoutlinecellatrow:(nsinteger)row method

customized calendar app for iOS -

i complete beginner ios development.i want work calendar. jobs download data(like birthday,reminder) remote server , mention in calendar. again upload event(like birthday or reminder) entered calendar server. there tutorial these work.thanks you can try following tutorials ios calender: http://oleb.net/blog/2012/05/creating-and-deleting-calendars-in-ios/ http://maniacdev.com/2011/09/open-source-customizable-ios-calendar-component-with-landscape-orientation-support these may you.

python - Convert DataFrame with index-OHLC data to index-O index-L index-H index-O (flatten OHLC data) -

i have dataframe looks that open high low close volume (btc) volume (currency) weighted price date 2013-05-07 112.25000 114.00000 97.52 109.60013 139626.724860 14898971.673747 106.705731 2013-05-08 109.60013 116.77700 109.50 113.20000 61680.324704 6990518.957611 113.334665 2013-05-09 113.20000 113.71852 108.80 112.79900 26894.458204 3003068.410660 111.661235 2013-05-10 112.79900 122.50000 111.54 117.70000 77443.672681 9140709.083964 118.030418 2013-05-11 117.70000 118.74000 113.00 113.47000 25532.277740 2952016.798507 115.619015 i'm looking way transform kind of data to index open index+1 low index+2 high index+3 open index+4 low index+5 high so in sample should looks like date 2013-05-07 00:00 112.25000 2013-05-07 08:00 97.52 2013

iphone - Putting isCancelled Property in an NSOperationQueue -

this question has answer here: how cancel out of operation created addoperationwithblock? 2 answers so, using addoperationwithblock^{} method of nsoperationqueue , want put fine grained iscancelled property check @ points in operation code. how instance of operation run while in block? for example, code snippet: [operationqueueinstance addoperationwithblock:^{ if (!???.iscancelled){ nslog(@"instruction 1"); } if (!???.iscancelled){ nslog(@"instruction 2"); } nslog(@"instruction 3"); }]; how instance of operation block run in can evaluate iscancelled property instructions? tia from apple docs: you should not attempt reference newly created operation object or divine type information. you instantiate nsblockoperation , assign variable keep explicit reference instead. add

iphone - Twitter search for hashtag -

i'm trying parse tweets using twitter framework , write following code , it's working fine, it's not synchronous . now i'm trying tweets #ios. i have used following code search result ios hashtag: -(void)fetchresults { // simple search, using twitter api twrequest *request = [[twrequest alloc] initwithurl:[nsurl urlwithstring: @"http://search.twitter.com/search.json?q=ios%20&rpp=20&with_twitter_user_id=true&result_type=recent"] parameters:nil requestmethod:twrequestmethodget]; // notice block, handler process response [request performrequestwithhandler:^(nsdata *responsedata, nshttpurlresponse *urlresponse, nserror *error) { if ([urlresponse statuscode] == 200) { // response twitter in json format // move response dictionary , print nserror *error; di

java - Difference between "Eclipse Indigo" and "Eclipse Juno" -

currently i'm using eclipse indigo (v3.7) selenium webdriver automation tests java. there eclipse juno (v3.8 - 4.2) available have never used. what's difference between eclipse indigo , eclipse juno ? since 2006, eclipse foundation has coordinated annual simultaneous release. each release includes eclipse platform number of other eclipse projects. far, each simultaneous release has occurred on fourth wednesday of june. eclipse indigo corresponds platform version 3.7, while eclipse juno - platform version 4.2. juno has lot of improvements on ui, results in bit slower performance previous versions. personally, prefer using indigo rather using juno .

asp.net - c# entity , deleting a db record from a drop down list selected value -

how delete record drop down list selected value? i have populated drop down list database , having problems delete delete button. doing right way? ( sorry if codes messy ) this how populate drop down list: protected void droptask() { droplisttask.datasource = daotask.getall(); droplisttask.datatextfield = "taskname"; droplisttask.datavaluefield = "taskid"; droplisttask.databind(); } this delete button : protected void btndelete_click(object sender, eventargs e) { if (!page.ispostback) { model.task del= new model.task(); del.taskid = convert.toint32(droplisttask.selectedvalue); daotask.delete(del); daotask.save(); } } i need add postback btn codes, if removed it gives me error says; the object cannot deleted because not found in objectstatemanager. so put in postback , error gone. don't know if right way. please advise me h

ios - Custom size for Modal View loaded with Form Sheet presentation -

i'm trying load uiviewcontroller in ipad form sheet presentation. problem size of new view, put size values in ibuilder modal view take fixed value. also tried make in prepareforsegue this: helpviewcontroller *viewcontroller = segue.destinationviewcontroller; viewcontroller.view.superview.frame = cgrectmake(0, 0, 200, 200); but don't work, help? thanks! for ios 8, use: self.preferredcontentsize = cgsizemake(width, height); i've placed in viewdidload . swift 3 self.preferredcontentsize = cgsize(width: 100, height: 100)

android - Fill up table layout and show progress dialog -

i filling table layout via program. taking time. till whole tablelayout don't filled up, want show progress dialog. cannot use new thread other uithread show progress dialog filling table layout. how can show porgress dialog @ same time while filling table layout. thanks. here whole code public class mainactivity extends activity { private static textview edtsearch; private progressdialog mprogressdialog; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); final arraylist<string> lsmdlmaterial = new arraylist<string>(); for(int i=0;i<1000;i++){ lsmdlmaterial.add("item:"+(i+1)); } final textview txt= new textview(this); final handler handler= new handler(); final handler handler1= new handler(); showprogressdialog(); new thread(new runnable() {

Windows.Networking.dll with Windows 8 Desktop app -

msdn says windows.networking.dll available used desktop apps on windows 8 , windows server 2012 platforms not able find way it. i tried using them windows 8 store app , worked music windows 8 desktop app not able through with. or pointers awesome

iphone - how to show the contract form like text in the ipad application -

Image
i want make ipad application in there form in user enter name , date , other things hardcode show in following form control may use functionality may use textview or webview perform functioning. this top of form should in ipad in user enter date , doctor name and below form user sign in bottom in above page. unfortunately haven't found (non-paid) solution editing forms , pdf files. can display form uiwebview place uitextfields on top of editable areas store data need. either way fields need mapped out it's not tough form have here. the other solution recreate forms using textfields , native components.

Alignment missing in android multiplescreen style -

the below style wrote in values>style.xml <style name="phoneletters"> <item name="android:textsize">12sp</item> <item name="android:layout_marginleft">5dp</item> <item name="android:gravity">center</item> </style> i have added textsize 12sp 22sp bigger appearance in tablet - values-sw600dp>style.xml <style name="phoneletters"> <item name="android:textsize">22sp</item> </style> above styles marginleft , garvity missed in tablet. should duplicate above styles here tablet styles also? you can have style duplicate there no problems, must add in different folder in res different screen resolutions. for example if have style this: <style name="phoneletters"> <item name="android:textsize">12sp</item> <item name="android:layout_marginleft">5dp</item>

eclipse - Persisting entities -

Image
i getting started ejb development, created test system consists of following 3 projects: actually, helloworldbeanremote interface exist in ejbtest project. haven't found way import other project without runtime exceptions. the ejbtestinterfaces plain java project contains remote interface. ejbtest contains program logic. helloworldbean session bean. constructor sets created field current time. in sayhello() method uses injected persistencemanager retrieve testentity id 0 (or creates if not exist), increments ´hit` variable , returns it: @persistencecontext(name="manager1") private entitymanager em; @override public string sayhello() { string info; if (em == null) info = "entity manager null"; else { testentity entity; try { entity = em.find(testentity.class, 0); entity.sethits(entity.gethits() + 1); em.merge(entity); info = "hit entity " + entity.

javascript - Changing IFRAME height dynamically -

how possible fix height issue of google trend charts dynamically. example take on output of following code. <iframe width="600" height="320" src="http://www.google.com/trends/fetchcomponent?hl=en-us&q=css-showcase&content=1&cid=timeseries_graph_0&export=5&w=600&h=320" style="border: none;"></iframe> <hr> first contents <hr> <iframe width="600" height="320" src="http://www.google.com/trends/fetchcomponent?hl=en-us&q=html5&content=1&cid=timeseries_graph_0&export=5&w=600&h=320" style="border: none;"></iframe> <hr> second contents on jsfiddle: http://jsfiddle.net/yzw8y/ i didn't test it, work. function autoresize(id) { var newheight; newheight=document.getelementbyid(id).contentwindow.document.body.scrollheight; document.getelementbyid(id).height=newheight + "px"; } <iframe

jquery - select2 - Setting different width to input and dropdown -

i using select2 3.3.2 i have very long options in select. example: <select id="e1"> <option value="al">alabama</option> <option value="wy">wyoming</option> <option value="wy">very long long long text</option> <option value="wy">very long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long text</option> </select> the purpose avoid wrapping of options when dropdown opens up. i set long width dropdown when opens (for example - 800px, or automatic evaluated width). but keep input short width when dropdown closed (for example 300px). i followed "add option set dropdown width" issue of select2. but couldn't work, width of optio

java - android.database.CursorIndexOutOfBoundsException....crash report -

i crash report error app. use imported sqlite database in assets folder. doing wrong? here's error user crash report: android.database.cursorindexoutofboundsexception: index 0 requested, size of 0 @ android.database.abstractcursor.checkposition(abstractcursor.java:418) @ android.database.abstractwindowedcursor.checkposition(abstractwindowedcursor.java:136) @ android.database.abstractwindowedcursor.getstring(abstractwindowedcursor.java:50) @ rs.androidaplikacije.zastaveigradovi.kviz20hard.nextquestiongrad(kviz20hard.java:328) @ rs.androidaplikacije.zastaveigradovi.kviz20hard.access$1(kviz20hard.java:307) @ rs.androidaplikacije.zastaveigradovi.kviz20hard$2.run(kviz20hard.java:68) @ android.os.handler.handlecallback(handler.java:615) @ android.os.handler.dispatchmessage(handler.java:92) @ android.os.looper.loop(looper.java:137) @ android.app.activitythread.main(activitythread.java:4921) @ java.lang.reflect.method.invokenative(native method) @ java.lang.reflect.method.invoke(meth

php - CakePHP 1.3 - Radio label without legend? -

in cakephp 1.3 form inputs i'm able add label option 'label' => 'mylabel' , radio button input works bit differently. uses legend , fieldset organize buttons , label buttons. there way remove legend , fieldset (using 'legend => false' ) while @ same time adding regular label other input use? in same format other inputs it? example, like: $this->form->input('active1', array('type' => 'radio', 'options' => array(1=>'yes', 0=>'no'), 'label' => 'active', 'legend' => false)); this removes label. there way leave label in option? or have create custom function me? thank much! there not way use standard label option radio button, easy add in view without use of custom function: <label>mylabel</label> <?php echo $this->form->radio('...

c# - ProtocolViolationException when doing a WebRequest with GET -

i'm trying gather data public api windows phone app. private void gatherposts() { string url = baseurl + "?after=" + lastpostid + "&gifs=1"; httpwebrequest request = webrequest.create(url) httpwebrequest; request.contenttype = "text/json"; request.method = "get"; asynccallback callback = new asynccallback(postrequestfinished); request.begingetresponse(callback, request); } private void postrequestfinished(iasyncresult result) { httpwebrequest request = (httpwebrequest)result.asyncstate; httpwebresponse response = (httpwebresponse)request.endgetresponse(result); } but keep getting protocolviolationexception on last line of callback method message a request method cannot have request body. . read it's because i'm trying send data, forbidden protocol, don't see i'm doing it, i.e. how avoid it. it's contenttype makes think there request body, exception. you want set ac

javascript - Accessing fields with Python CGI FieldStorage from a JQuery AJAX call -

i have written jquery makes ajax call python script. i've been successful in passing strings , forth between them, i'm getting weird behaviour cgi fieldstorage object i'm using input in python script. i've managed send simple object key/value pairs, this: deptobj = { 1 : '1', 2 : '2'}; $.ajax({ data: deptobj, url: "simple.py", success: function(result) { console.log("success!"); console.log(result); }, error: function(request, error) { console.log("error"); console.log(request); } }); here python script, simple.py: #!/usr/bin/env python import json import cgi import cgitb print "content-type: application/json\n\n" cgitb.enable() # display error messages in web browser fs = cgi.fieldstorage() print json.dumps(fs.keys()) when run javascript, correctly prints out keys in object, i.e. ["two", "one"] (i'm not sure why they're reversed). can corresponding v

c# - global keyboard hook/Raw input Capture keyboard input -

does of know how capture data keyboard based on vid or pid keyboard? well it's possible raw input in c# can't block data, or redirect application.. , can block data global keyboard hook can't see source it's comming from.. possible merge these two? or there anykind of plugin of sort can use? great if in .net! i've been searching , trying find days.. no luck yet! found program job: http://nate.dynalias.net/dev/keyboardredirector.rails

scroll - jQuery in page back button scrolling -

i looking create page allows use of , forwards buttons content within page. have accomplished basic functionality using jquery address featured at http://www.asual.com/jquery/address the issue having how callback function work in coordination jquery scrollto plugin provide animated , forwards scrolling experience. //navigation between slides $('.nav-button').click(function(e) { e.preventdefault(); $.scrollto($(this).attr('href'), 'slow', {easing:'easeinoutexpo'}); }); //storage , activation of , forwards attributes $('a').click(function() { $.address.value($(this).attr('href')); }); //callback scroll on or forwards //need here $.address.change(function(event) { $.scrollto(event.value(), 'slow', {easing:'easeinoutexpo'}); }); as im sure can see problem isnt difficult, since im still learning out of scope of knowledge. appreciated. all of content contained within 1 page divided different &qu

java - Nested Map or equivalent to store triple -

i have store values list/map contains 3 values: size | amount | description 2,34 | 4 | "i'm long string" 1,14 | 2 | "i'm long string" so thought using nested map : map<double, map<integer,string>> = new hashmap<double, map<integer,string>>(); but how can easy add entries map? syntax a.put(1,43, new map.entry<>(7,"9890")); didn't work, cause map abstract. best way nested map? it's going tedious: map<integer,string> val1 = a.get(2.34); if (val1 == null) { val1 = new treemap<integer, string>(); a.put(2.34, val1); } val1.put(4, "i'm long string"); i've updated treemap since want access smallest element. should change map "a" treemap too. edit 2 i made effort here, hope it's you're looking :) import java.io.ioexception; import java.util.map; import java.util.treemap; import java.util.treeset; p

video.js - Playing m3u8 on any devices (IOS, Android, PC) -

is possible play m3u8 file using video.js on devices? far, able play them on android or ios. want play them on pc well. this using no luck. thanks help <source src="http://www.domaine-name.com/name/playlist.m3u8" type='video/mp4'> from wikipedia : an m3u file plain text file specifies locations of 1 or more media files. file saved "m3u" or "m3u" filename extension. each entry carries 1 specification. specification can 1 of following: an absolute local pathname; e.g., c:\my music\heavysets.mp3 a local pathname relative m3u file location; e.g. heavysets.mp3 a url. as m3u stores multimedia items locations, should parse , play them using proper audio/video playback lib. take @ question edit: link in comment points m3u, should link multimedia files: content of first m3u: #extm3u #ext-x-stream-inf:program-id=1,bandwidth=613798 http://tveurope1.zion3media.com:1935/demoweb1/mystream/play

security - How to enable SSL for the built-in WSGI server from Python? -

i run wsgi application within python file, using make_server command. (i don't know if practice or whether more common setup apache or nginx purpose.) i want make little server secure adding ssl support. start? is built-in wsgi server python considered safe? want connection secure. came across wsgi , thought easy use, within python. app used proxy has little functionality, want secure possible. basically wsgi interface communication between web-server software (e.i. nginx or httpd ) , python script/app contains code process requests (usually either application callable or applications list of callables). you need enable ssl on web-server layer. if don't want involve external software may follow @demz's advice , try using eventlet.wrap_ssl . please find more relevant information here .

ember.js - Ember manual url change does not update the page -

im in need of help. if come ember app url so /#/clients/some-client/claims/123 the page loads should. if manually change url simple this /#/clients/some-client/claims/456 it not change data. have make sure page hard refresh current data. i getting event trace in console since have log_transitions set in app transitioned 'clients.client.claims.claim.index' any idea on going wrong? the router nucleus.router.map(function () { this.resource("clients", { path: 'clients' }, function () { this.resource("client", { path: ':client_id' }, function () { this.resource("claims", function () { this.resource('claim', { path: '/:claim_id/:claim_sub' }, function () { this.resource('lines', function () { this.resource('line', { path: ':line_id' }, function () { this.resource('flags', function () { this.resource

WordPress php redirect -

i've added code below functions.php file in wordpress it's not working -- tips? if(is_page( 'company-registration' )) { wp_redirect('http://www.example.com', 301 ); exit; } http://codex.wordpress.org/function_reference/is_page by not working mean redirect not taking place. have tried using wp page id. you should wrap snippet in function hooked template_redirect , or put @ top of page.php (or other page template), before get_header call.

image processing - Changing Black to Transparent in PHP -

this question has answer here: how to remove colors image php or ruby? 3 answers i'm trying replace black background gif/jpeg files transparent background, , because it's tiring manually 1 one via photoshop, thought of trying use php. code i'm using, doesn't work. why that? $image = imagecreatefromgif( 'items/item_spear06.gif' ); imagealphablending($image, true); $transparentcolour = imagecolorallocate($image, 0,0,0); imagecolortransparent($image, $transparentcolour); and image got same image last time in png format. update $image = imagecreatefromgif( 'items/sword/iv_sword_refined19.gif' ); //get pixel data $rgb = imagecolorat($image, 10, 10); $r = ($rgb >> 16) & 0xff; $g = ($rgb >> 8) & 0xff; $b = $rgb & 0xff; $index = imagecolorexact($image, $r, $g, $b); if ($index === -1) { $index = imagec

ncurses - Trouble porting over python-2.7 curses to python-2.4 -

i wrote python code @ home 2.7, i'm trying fix run on 2.4 here @ work. the first hline not work me. have stdscr.hline(0,0,'=',5) but prints out 1 = sign. second chgat not work in screen.chgat(0,0,-1,curses.color_pair(2) as returns attributeerror: chgat not sure how disable cursors since curses.curs_set(0)` doesn't work either.`enter code here` i can't find documentation on curses python 2.4.3 i'm having trouble porting over. the answer precise question "documentation on curses python 2.4.3" is: http://docs.python.org/release/2.4.3/lib/module-curses.html

c++ - gluDisk() function opengl -

i trying create function in program draws disk. have .h file called drawshape have drawing functions there. trying add drawdisk it, seen below;howerver keep getting error saying have undefined reference glunewquadric , gludisk. have #included glu.h library, i'm not sure wrong code. void drawdisk(double indiameter, double outdiameter, int vertslices, int horizslices) { gluquadricobj *disk; disk = glunewquadric(); gludisk(disk, indiameter, outdiameter, vertslices, horizslices); } here makefile requested below in comments section. vrui_makedir := /opt/local/vrui-2.6/share/make ifdef debug vrui_makedir := $(vrui_makedir)/debug endif installdir := $(shell pwd) # set resource directory: resourcedir = images ######################################################################## ######################################################################## # include definitions system environment , system-provided # packages include $(vrui_makedir)/systemdefinition

ruby on rails - Mass change attribute, with check box and a select box -

on index page of users, application lists user's names(string) , if particular user active (boolean). on page able select multiple users, using checkboxes, using select box, select true or false. application should update users checked boolean attribute. how accomplish rails 3? can supply of code if necessary, didn't think didn't explain it's self. thanks. resources :users post 'setup', :on => :collection end your usercontroller def setup @ids = params[:users][:ids] user.where("id in ? ", @ids).update_all(active: true) end supply @users = user.all in view , add following form: =form_tag setup_users_path -@users.each |user| =check_box_tag "users[ids][]", user.id =user.name =submit_tag "setup" this rough idea of how have done it. wrote away code above without testing in machine; prone errors. hope helps. :)

vb.net - Update Text Box Properly when Cross-threading in Visual Basic (VS 2012 V11) -

here question in short: how use backgroundworker (or invokerequired method) make thread-safe calls append text text box? here question in detail , background: i've been working on program copies file 1 location backup purposes. set option save file when file modified using filesystewatcher. here code: private sub form1_load(byval sender system.object, byval e system.eventargs) handles me.load dim directorypath string = path.getdirectoryname(textbox1.text) dim varfilesystemwatcher new filesystemwatcher() varfilesystemwatcher.path = directorypath varfilesystemwatcher.notifyfilter = (notifyfilters.lastwrite) varfilesystemwatcher.filter = path.getfilename(textbox1.text) addhandler varfilesystemwatcher.changed, addressof onchanged varfilesystemwatcher.enableraisingevents = true end sub private sub onchanged(source object, byval e filesystemeventargs) my.computer.filesystem.copyfile(e.fullpath, textbox2.text & "\" & e.name, t

winforms - C# Slow down random number GUI display -

i have application generates random numbers 20 seconds , shows random number on fly in label in screen. i want show numbers in same label slow down display of numbers 5 seconds before stoping process, display of number should smoothly slow down more , more until stops in final number. raffle. any clue? i can start telling not to. not use thread.sleep -- doing "worst practice" , make ui unresponsive. if use thread.sleep on second thread, mcl suggests, won't freeze ui burning extremely expensive thread little work. if using c# 4 or earlier create timer set tick, say, 4 times second. handle tick event, , if enough time has passed since last tick event, change label. or, change interval of timer each time ticks. if using c# 5, can use await task.delay(x) : async void animate() { int delay = 5; for(int = 1; < 10; ++i) { updatelabel(); await task.delay(delay); delay = delay * 2; } } so start 5ms delay, 10, 20

serial port - GSM modem doesn't respond on at+cmgl command -

i'm writing linux program interact gsm modem through at-commands. modem respond on at+cmgl="all" command , return sms messages, modem doesn't respond on command(no answer, no ok, no error). i use python , pyserial, doesn't matter, because tested modem via bash terminal, send commands modem via echo , read answers modem via cat /dev/ttyusb0 . same situation (sometimes responds, not). private void button3_click(object sender, eventargs e) { po.write("at+chup"+environment.newline); po.close(); button3.enabled = false; button1.enabled = true; }

Ruby beginner trying to call a method from another class in Ruby? -

i trying below working. not sure failing. receive following error: 1) error: test_google(google): nomethoderror: undefined method `new' method:class google.rb:15:in `setup' i new ruby, pretty 101. can explain me errors , why can understand. thanks! require "test/unit" require "selenium-webdriver" require "json" require "time" require_relative "methods" class google < test::unit::testcase def setup @driver = selenium::webdriver.for :firefox @base_url = "https://www.google.com/" @accept_next_alert = true @driver.manage.timeouts.implicit_wait = 30 @verification_errors = [] @search = method.new() end def teardown @driver.quit assert_equal [], @verification_errors end def test_google @driver.get(@base_url + "/") @search.search end end class method def search @driver.find_element(:id, "gbqfq").clear @driver.find