Posts

Showing posts from February, 2011

javascript - Simpler way to combine a if else statement (.contains?) -

javascript - Simpler way to combine a if else statement (.contains?) - what best way simplify code. thought using .contains i'm unsure how. tell me if need more code. thank you. $.each(catalog.products, function(index, value) { if (filtervalue == '' || value.name.touppercase().indexof(filtervalue.tolocaleuppercase()) != -1) { items.push('<li id="' + index + '">' + '<a data-identity="productid" href="./details.page?productid=' + index + '" >' + '<img class="ui-li-thumb" src="' + value.thumbnail + '"/>' + '<p>' + value.brand + '</p>' + '<h3>' + value.name + '</h3>' + '<span class="ui-li-count">' + value.price + ' $</span>...

delete a line in .txt using python by matching the number in the line -

delete a line in .txt using python by matching the number in the line - i came lastly part.. , i'm stuck.. in orderlist.txt file have [99 ,1, "3/03/2011", ["screwdriver", "hammer", "stone"]] [2 ,2, "3/03/2011", ["hammer,nails"]] [31 ,2, "3/03/2011", ["plaster,studd"]] [100 ,2, "3/03/2011", ["hammer,studd"]] my code: def delorder(): f=open('orderlist.txt',"r+") lines=f.readlines() num_del=int(input("what ordernumber deleted:")) new="" line in lines: listline=eval(line) if not(num_del==list_line[0]): new +=(line + "\n") homecoming (new) at part give me traceback (most recent phone call last): file "e:/cscs 120 testint in lab/assignment 1/customer assignment 1/customer assignment 1/testing oder", line 13, in <module> print(delorder()) ...

JwPlayer: Get the Exact postition with getPosition() -

JwPlayer: Get the Exact postition with getPosition() - i able alert position of video using jwplayer().getposition() function 3.6064999999999996 timer on video showed me 03:36. how can position 03:36 instead of 3.6064999999999996? screenshot: http://i.imgur.com/m8u2u.png any help appreciated. taking fractional part , multiplying 6 give number of seconds. examples: 0.5 * 6 = 30, 0.6 * 6 = 36 jwplayer

web services - why WS-I profile specification is specific to SOAP encoding -

web services - why WS-I profile specification is specific to SOAP encoding - there 1 thing confused reading ws-i profile specification. ws-i institute aimed interoperability between web services..as per understanding web service can defined in wsdl per rules of ws-i profile specification....now wsdl\ws-i supposed independent of info , transport binding. , soap 1 way of info binding not way of info binding. why ws-i profile explicitly cover soap info binding protocol? why ws-xxx specifications talk in terms of soap protocol headers? why did n't ws-i profile describe various headers in info binding independent way? in word, there difference between soap , web services? q: there difference between soap , web services? a: there's huge difference (unless you're marketing dept in microsoft ;)) the main alternative soap rest (i.e. rest-ful web services) here 2 first-class overviews of ws-interoperability, 2 different perspectives: http://msdn.m...

writing SQL queries to get neighbour rows -

writing SQL queries to get neighbour rows - i have come across problems writing queries getting neighbour rows , have no thought it. this scenario (it not purely implemented using sql @ moment, rather mix of sql , java implementation) : there entity has 1000 entity b, each entity b has 1000 entity c, each entity c has 1000 entity d. need utilize info stored in d. @ first have query entity ds within entity a. implement logic can navigate particular d next d or previous d, logic not written sql queries. question 1 if want implement navigation logic sql queries, how can go next d in select query? suppose original query simple select * d inner bring together c c.id = d.fk inner bring together b b.id = c.fk i looking universal solution both oracle , sql server. question 2 how know position current row (within result of above query). example, if want implement logic "this no. x of y". for confused neighbour rows is, mean previous or next row of ...

stack trace - Glassfish v3.1 jaas error -

stack trace - Glassfish v3.1 jaas error - i have problem creating easy authorization using jaas, glassfish v3.1 , server 3.0. i configure web.xml, sun-web.xml , done according david heffelfinger's book "java ee 6 glassfish 3 application server", still have problem. i'll glad anyone, can help. web.xml: <security-constraint> <web-resource-collection> <web-resource-name>admin pages</web-resource-name> <url-pattern>/add/*</url-pattern> <http-method>get</http-method> <http-method>post</http-method> </web-resource-collection> <auth-constraint> <role-name>admin</role-name> </auth-constraint> <user-data-constraint> <transport-guarantee>confidential</transport-guarantee> </user-data-constraint> </security-constraint> <security-constraint> <web-resource-collection...

javascript - how to pass data with quotation(") to a dialog in jQuery -

javascript - how to pass data with quotation(") to a dialog in jQuery - supposed have next code: <html:link onclick="jquery('#add').data('name','${name}').dialog('open');" href="#"> and this, if ${name} = a"b"c, problem occurs, link not rendered well. have tried escape value, serialize maybe way wrong. any suggestion how this? have been searching, cant find answer. thanks in advance. you need escape quotes or take out of dom (which recommend) putting listener on it: $('a').click(function(){ $('#add').data('name','${name}').dialog('open'); }); javascript jquery

resque - ActiveRecord "SHOW TABLES" queries -

resque - ActiveRecord "SHOW TABLES" queries - i'm using rails 2.3 project, resque processing background tasks. activerecord "show tables" , "show fields from" query first time utilize model, caches it. issue resque forks new process every job, never cached, , activerecords run queries 1 time again on every job. what recommended way forcefulness activerecord cache these queries? adding "model.inspect" of models in initializer helps, few "show tables" queries still remain. in rake task have environment initialization resque, add together next snippet: # create sure we've pre-loaded of schema info resque.before_first_fork activerecord::base.send(:subclasses).each { |klass| klass.columns } end for example, in lib/tasks/resque.rake : task :resque_environment => :environment # create sure we've pre-loaded of schema info resque.before_first_fork activerecord::base.send(:subcla...

c# - LINQ-to-SQL .ExecuteCommand() doesn't work with parameterized object names -

c# - LINQ-to-SQL .ExecuteCommand() doesn't work with parameterized object names - i'm little flummoxed 1 , hoping can clarify what's going on. i'd programmatically disable foreign key constraint using linq-to-sql info context. seemingly should easy following: context.executecommand( "alter table {0} nocheck constraint {1}", "mytable", "fk_mytable_myothertable" ); unfortunately, code bombs sql error "incorrect syntax near '@p0'." when fire profiler see sql beingness generated is: exec sp_executesql n'alter table @p0 nocheck constraint @p1', n'@p0 varchar(4000),@p1 varchar(4000)', @p0=n'mytable', @p1=n'fk_mytable_myothertable' from can find in sql books online , in linq-to-sql documentation should work. i've resorted doing instead: context.executecommand( string.format( "alter table {0} nocheck constraint {1}", "mytable", "fk_mytable_my...

testing - jmeter help - test around polling /w meta refresh -

testing - jmeter help - test around polling /w meta refresh - i new jmeter , working on putting test plan. hurdle i've encountered follows: first, post made processform.aspx then, user redirected pleasewait.aspx this page either redirects results.aspx or loads, meta refresh tag set refresh in 5 seconds (and step repeated). now -- can execute doing following: http sampler post processform.aspx assert response contains "<something on pleasewait.aspx>" while lastly http sampler pleasewait.aspx assert response contains "<something on results.aspx>" however -- don't care method, because results in failed assertions (even though things working expected). sure there must other way this? more familiar jmeter i? update: got going using regular look extractor instead of assertions. 1) add together user defined variables section @ test plan root 2) add together variable "loginwait" , "false" htt...

iphone - Objective-C (iOS) replace all occurrences of Wildcard in a string with the alphabet -

iphone - Objective-C (iOS) replace all occurrences of Wildcard in a string with the alphabet - first of all, not homework! :) say have nsstring: "the?or?" each wildcard want string come @ to the lowest degree 26 (not including 'ñ' , 'ng' seem have been added countries phillipines). word 2 ? give me 26^2 (i think) results. i want homecoming nsarray of following: theaora theaorb theaorc ... thezora thezorb thezorc ... thezorx thezory thezorz since recursion (i assuming) having issues... i working on this: nsarray *countofwildcardarray = [wordtosearch componentsseparatedbystring:@"?"]; int countofwildcard = [countofwildcardarray count] - 1; if (countofwildcard > 0) { ( nsinteger = 0; < countofwildcard; i++) { nslog(@"looking wildcard #%i",i); for(char = 'a'; <= 'z'; a++) { ...

c# - IHttpModule Response.Filter Write with No Close HTML -

c# - IHttpModule Response.Filter Write with No Close HTML - i wrote custom ihttpmodule causing issues when there no closing tag in source. have ran across few pages in cms running .aspx page used more handler , forgoes closing html give response via ajax user. here source: public class hidemodule : ihttpmodule { public void dispose() { //empty } public void init(httpapplication app) { app.releaserequeststate += new eventhandler(installresponsefilter); } // --------------------------------------------- private void installresponsefilter(object sender, eventargs e) { httpresponse response = httpcontext.current.response; string filepath = httpcontext.current.request.filepath; string fileextension = virtualpathutility.getextension(filepath); if (response.contenttype == "text/html" && fileextension.tolower() == ".aspx") response.filter = new pagefilter(...

html - applying css to everything inside element -

html - applying css to everything inside element - how apply css property within element. like if have: p { font:15px "lucida grande", arial, sans-serif; padding-right:150px; } <p> <span> <div> </div> </span> </p> you posted invalid html. block-level elements such <div> not go within of <p> tags, , not within of inline elements such <span> . anyway, css selector match * p, p * { font: 15px 'lucida grande', arial, sans-serif; padding-right: 150px; } be careful using * selector. "slow" when there lot of elements match. html css

java - How to pass parameters between Request-Scoped Controllers? -

java - How to pass parameters between Request-Scoped Controllers? - i have simple jsf-page , want pass parameter page1 page2. every page has own controller in request scope. the 2 controllers this: controller1: @component("requestcontroller1") @scope("request") public class requestcontroller1 { private list<product> products; private product selectedproduct; @postconstruct public void init() { //load products db } public void setproducts(list<product> products) { this.products = products; } public list<product> getproducts() { homecoming products; } public void setselectedproduct(product selectedproduct) { this.selectedproduct = selectedproduct; } public product getselectedproduct() { homecoming selectedproduct; } controller2: @component("requestcontroller2") @scope("request") public class requestcontroller2 { private long selectedproductid; @postconstruct public void init() ...

c# - WPF - creating (image) wall or prezi effect? -

c# - WPF - creating (image) wall or prezi effect? - i want develop windows wpf application using kinect great gui/nui. i've found nice examples of user interfaces more admirable using kinect device. example: prezi effects - http://prezi.com/jipjiqvj6dsc/about-perspective/ 1 big wall , nice zooming / moving. thinking similar metro ui too. do know how create nice gui elements in wpf? or maybe heard resources topic? a starting point josh blake's upcomming book (you can meap preview now) , "naturalshow" sample app includes. can code @ http://blakenui.codeplex.com/ c# wpf styles

java - A class in Swing or AWT Library that has flexible size -

java - A class in Swing or AWT Library that has flexible size - i'm looking class in javax.swing or java.awt gives flexible size object. name class myclass . when add together myclass mypanel , shaped objects lie within it. more specific, if draw rectangle, myclass's size of rectangle's, if draw circle, myclass's size of circle's, etc. so far i've seen classes rectangular in shape: container, canvas, jlayeredpane , etc. any suggestions? given suitable layout, class implements shape interface candidate. can utilize createtransformedshape() method of affinetransform transform it, seen in example. java swing awt

Python integer infinity for slicing -

Python integer infinity for slicing - i have defined slicing parameter in config file: max_items = 10 my class slices list according parameter: items=l[:config.max_itmes] when max_items = 0 , want items taken l . quick , dirty way is: config.max_items=config.max_items if config.max_items>0 else 1e7 assuming there less 1e7 items. however, don't fancy using magic numbers. there more pythonic way of doing it, infinity integer constant? there no "infinity integer constant" in python, using none in piece cause utilize default given position, beginning, end, , each item in sequence, each of 3 parts of slice. >>> 'abc'[:none] 'abc' python integer infinity

java - JfileChooser wont show image selected inside Jpanel -

java - JfileChooser wont show image selected inside Jpanel - i having no luck getting image show in jpanel when selected using java's jfilechooser. want selected image automatically resized , fit set size of jpanel? here code have written far. jfilechooser shown in new jframe , want close jframe when image uploaded , viewable in jpanel. here upload button should open jfilechooser, allow file selected , upload image (to resized, need help in how create image automatically resized), close jframe "frame" when image show in jpanel "picturepanel"? edit: added sscce of trying accomplish. i want after "upload" button click, show image sized appropriately (must fit jpanel "picture panel") show image in black bordered panel. import classes.backgroundpanel; import java.awt.borderlayout; import java.awt.dimension; import java.awt.image; import java.awt.event.actionevent; import java.awt.event.actionlistener; import java.awt.image.buffe...

linux - Is PTHREAD_STACK_MIN defined differently in Ubuntu 10.04 then on Ubuntu 9.04? -

linux - Is PTHREAD_STACK_MIN defined differently in Ubuntu 10.04 then on Ubuntu 9.04? - first seems if location of definition has changed: in 9.04 somewhere through pthread.h , in 10.04 through limits.h (can please confirm it? defined in each version?) second, have values changed between 2 versions? thanks ben you should include <pthread.h> , should include pthread_stack_min definition, straight or indirectly. can't check ubuntu, searching in glibc sources http://www.google.com/codesearch#search/&q=%22define%20pthread_stack_min%22%20glibc&type=cs&p=1 shows in pthread.h , in bits/local_lim.h . this typically 16 kb x86 , bigger mips , itamium. update: hmmm.. wrong. definition moved <limits.h> (indirectly), should include both files. linux pthreads ubuntu-10.04 ubuntu-9.04

ruby - watir install report failed to build gem native extension -

ruby - watir install report failed to build gem native extension - i've installed instantrail2.0. want install watir 1.65 first installed watir-1.6.5.gem said 302 fetching http://gems.r.... then downlord rubygems-update-1.3.7.gem , type gem install --local rubygems-update-1.3.7.gem successfully installed. type in update_rubygems next type in gem install watir-1.6.5.gem appears error:failed build gem native extension i searched , found reply 1.3.7 doesn't back upwards win32. type gem install sqlite3-ruby -v 1.3.0 gem install watir-1.6.5.gem error:failed build gem native extension gem install sqlite3-ruby -v 1.2.3 gem install watir-1.6.5.gem error:failed build gem native extension how can next?? use more current version of watir ruby rubygems watir

css position:absolute problem -

css position:absolute problem - i have css problem. here need. no matter how many words title have(example: title what's new today? , hello world ) it have background line pass through whole div, , word's background white. (the word should text-align:center; , it's background looks broken line) here code: <style> .ocell { width:960px; height:42px; text-align:center; padding: 20px 0 20px 0; } .wd { margin: 0 auto; background-col: white; margin-left: -10px; padding: 5px; } .line { position: absolute; border-bottom: solid 1px #999; margin-top:-18px; width: 960px; } </style> <div class="ocell"> <div class="wd">title</div> <div class="line"></div> </div> also in http://jsfiddle.net/zapla/ may can utilize background-image instead of line. thanks. this can achieved using div border-bottom line, , positioning element text on line. fiddle here. css

objective c - object detection in iphone using openCV? template matching or haar? -

objective c - object detection in iphone using openCV? template matching or haar? - i need iphone app can image pattern in image. (sth this) after numerous google searching, sense alternative have in utilize template matching function in opencv has been ported objectivec. i found first-class starting point simple opencv project in objectivec this github code. but using border detection , face detection features in opencv. need objectivec illustration uses template matching function - "cvmatchtemplate" - in objectivec iphone? below code have @ moment: (at to the lowest degree not giving me error, piece of code, homecoming black image, expecting result image matched area brighter?) iplimage *imgtemplate = [self createiplimagefromuiimage:[uiimage imagenamed:@"laughing_man.png"]]; iplimage *imgsource = [self createiplimagefromuiimage:imageview.image]; cvsize sizetemplate = cvgetsize(imgtemplate); cvsize sizesrc = cvgetsize...

c# - Silverlight application not responding when multiple threads launched -

c# - Silverlight application not responding when multiple threads launched - i have silverlight application kicks off number of jobs on server side. each job unit of work independent of each other. i used parallel.foreach() , works fine realized if had big number of jobs (say on 300), when thread count increases 50 silverlight application seems stop responding (it not freeze browser grid should have info populated in empty , little doughnut keeps spinning). only when thread counts drop 1 time again (i.e. jobs have finished processing) grid populated. i testing asp.net development servers (cassini based) , wondering has it. i switched code utilize async programming model got same problem threads increased. any ideas may causing this? jd i thinking doing threadpool.setmaxthread() read somewhere may not work web hosted apps. if go gobbling threads parallel each there aren't threads left available service wcf requests grid depending on fetch info needs...

html - On select javascript not working with pull down? -

html - On select javascript not working with pull down? - i new javascript. i have function modifed when user selects "yes" pull downwards menu creates 3 text boxes in div area. here form pull downwards code: <select name="dosage" id="dosage" onchange="function dosage(sel)"> <option value="no">no</option> <option value="yes">yes</option> </select> <div id="dosagearea"></div> this javascript modified created message box user when selected something. function dosage(sel) { if(sel.options.selectedindex == 0) { homecoming false; } else if(sel.options.selectedindex == 'yes') { x=document.createelement('input'); x.setattribute('rows',1); x.setattribute('cols',20); x.name='dosage_emitte...

android - Loading raw VBO data via MappedByteBuffer into OpenGL (not working) -

android - Loading raw VBO data via MappedByteBuffer into OpenGL (not working) - i've attempted load raw, uncompressed vbo info via method presented in talk google did @ gdc 2011. method uses mappedbytebuffer load info in subsequent phone call glbufferdata. unfortunately, me, it's not working. able find hacky work around (its commented out in code below), working without hack. here sample of code: fileinputstream fis = new fileinputstream(new file(location)); filechannel fc = fis.getchannel(); mappedbytebuffer mbb = fc.map(mapmode.read_only, 0, fc.size()); // hackery because passing mbb glbufferdata isn't working. //floatbuffer fb = mbb.asfloatbuffer(); //float triangles[] = new float[fb.capacity()]; //for(int = 0; < triangles.length; i++) { // triangles[i] = fb.get(i); //} //fb = floatbuffer.wrap(triangles); bufferinfo = new int[3]; bufferinfo[0] = newbufferid(); int size = (int)fc.size(); gles20.glbindbuffer(gles20.gl_array_buffer, bufferinfo[0]); gl...

How do i receive serial data via bluetooth in android? -

How do i receive serial data via bluetooth in android? - i trying receive serial info via bluetooth unable so.please suggest how this. simple illustration how bluetooth connection established , info received. have @ bluetooth section in devguide http://developer.android.com/guide/topics/wireless/bluetooth.html and bluetooth chat illustration well http://developer.android.com/resources/samples/bluetoothchat/index.html android bluetooth

php - Help with setting up class.PHPmailer version 2.0.4 -

php - Help with setting up class.PHPmailer version 2.0.4 - basically i've got little family project going. i'm trying create little family website , need form of authentication , i'd them able register. i came across script works except phpmailer section. i've got testing server wamp. next code phpmail script - can help me configure it? , edit? i'm using version 2.0.4 of 'class.phpmailer.php'. tutorial website: http://www.html-form-guide.com/php-form/php-registration-form.html thanks replies :) php phpmailer

c# - Lotus Notes - Add a Form Programmatically - NotesForm -

c# - Lotus Notes - Add a Form Programmatically - NotesForm - i re-create form 1 nsf nsf programmatically. aware notesdocument class has copytodatabase method, , notesdatabase class has createview method. however, have not found allow me add together form nsf. i using lotus notes 8.5.2, com, , c#. i have no problem retrieving info forms or deleting them, , have next code snippet: //notesconnectiondatabase , nd2 objects of type notesdatabase , //members of same session. //write name of each form console. //delete each form database. (int = 0; <= (((object[])notesconnectiondatabase.forms)).length - 1; i++) { console.writeline(((notesform)((object[])notesconnectiondatabase.forms)[i]).name); ((notesform)((object[])notesconnectiondatabase.forms)[i]).remove(); } //for each form in nd2, re-create form notesconnectiondatabase. (int j = 0; j <= (((object[])nd2.forms)).lengt...

css - div overlapping/misplaced -

css - div overlapping/misplaced - i have footer on my page, content placing correctly, under div#main (which includes div#left , div#right), background (the big bluish thing) placed way on div#main. i have tried display:block , z-indexing divs, no avail. anyone have thought what's going on? code: body { background:url(aaa-bg.jpg) repeat-x #e7e9e9; margin:0; padding:0; color:#383838; font:12pt verdana; } img { border:0; } a:link { color:#e29511; text-decoration:none; } a:hover { color:#e29511; text-decoration:underline; } a:visited { color:#808080; } /* header ------------------------------------------------------------------------------ */ #header { margin:10px auto 10px; width:800px; height:97px; } /* nav ------------------------------------------------------------------------------ */ #nav { width:800px; margin:0px auto 3px; height:30px; } #nav ul { margin:0 0px 0px 0; padding:0; list-style:none; } #nav ul li { ...

c++ - Problem with passing object as an argument to createProcess -

c++ - Problem with passing object as an argument to createProcess - i trying right programme makes other programs createproces call. the problem when pass object of brick class parameter of createprocess call. i create object (in main) way: char ipapplicationname[1000]; startupinfo startinfo; process_information processinfo; strcpy(ipapplicationname, "c:\\documents , settings\\eigenaar\\bureaublad\\bluetoothtestr\\recvproc\\bin\\debug\\recvproc.exe"); //set nxt connection *connection = new bluetooth(); brick *nxt = new brick(connection); char *nxt_ptr = (char *)&nxt; then connect ( 6 comm port of bluetooth dongle): connection->connect(6); createprocess(ipapplicationname, nxt_ptr, null, null, false, create_new_console, null, null, &startinfo, &processinfo); this works fine think, problem when cast char* brick class in recvproc.exe process this: brick *nxt = (brick*)argv[0]; if comment this, programme works fine......

c - RGBA Hex from RGB Hex -

c - RGBA Hex from RGB Hex - i want create color 0xff0000 (rgb), rgba color ff alpha, 0xff0000ff . bits, think. thanks in advance, kacper uint32_t rgb=0xff0000; uint32_t rgba = (rgb << 8) | 0xff; explanation: (rgb << 8) shifts rgb value 8 bits left. means moves 1 byte left illustration 0x12345678 alter 0x34567800 . top 2 digits won't fit in 32 bits after shifting, removed. every thing else shifts left , new zeroes added in low position. the next operator bitwise or . it's or applied on every bit 0x34567800 | 0xff result in 0x345678ff (thanks @gajet explanation) c colors hex rgb rgba

@Secured on Spring controllers and context mess -

@Secured on Spring controllers and context mess - for web mvc need @ to the lowest degree 2 configs: dispatcher-servlet.xml , applicationcontext.xml . utilize next filter security: <filter> <filter-name>springsecurityfilterchain</filter-name> <filter-class>org.springframework.web.filter.delegatingfilterproxy</filter-class> </filter> <filter-mapping> <filter-name>springsecurityfilterchain</filter-name> <url-pattern>/*</url-pattern> </filter-mapping> this filter needs springsecurityfilterchain , defined in applicationcontext.xml <security:http /> however, want utilize @secured annotation on @controller , defined in dispatcher-servlet.xml . again, needs <security:http /> - in context file! all i'm trying accomplish security on @controller level. don't care securing deeper layers ( @service etc.) @ since entry point. what way out of mess? doing wrong? ...

javascript - How to get the new line break if there are some in the text area -

javascript - How to get the new line break if there are some in the text area - i have textarea , want, when post form if there new lines in text area them , output text them, wysiwyg editors does. what can't understand i have form , want te text area value on post if there new lines in value of text area want when output text form geted new lines displayed actualy new lines wysiwyg editors> line breaks interpreted \n . with javascript can utilize regular look observe new line character. regex: /\n/ update: var newstr = "string line breaks".replace(/\n/g,"<br />"); this replace new line in textarea <br> tag create new line javascript html

iphone - How to create a back button with a large left-facing arrow like the iPod app -

iphone - How to create a back button with a large left-facing arrow like the iPod app - how create button big left-facing arrow in ipod app? i'm not asking how create left-facing button, how left-facing arrow label on button, seen in ipod app's playing screen: obviously image trick, perhaps there unicode character used? also, i'm surprised there's no give-and-take (or @ to the lowest degree none find). this way it. create image , set button. code below have in application. uiimage *imagefullscreen = [uiimage imagenamed: @"fullscreen.png"]; [[self navigationitem] setrightbarbuttonitem:[[[uibarbuttonitem alloc] initwithimage:imagefullscreen style:uibarbuttonitemstyleplain target:self action:@selector(hide)]autorelease]]; iphone ios uibarbuttonitem ipod

I cannot call an android function from javascript -

I cannot call an android function from javascript - i started create kind of android hybrid app, application webview. first step, tried phone call function of android code javascript. but, app keeps crashing while @ it. all did setting webview, adding class used javascript code, calling function javasscript. thanks in advance. the android codes following: public class grand_ride_androidactivity extends activity { webview mwebview; ... public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.main); mwebview = (webview) findviewbyid(r.id.webview); mwebview.getsettings().setjavascriptenabled(true); mwebview.addjavascriptinterface(new javascriptinterface(this), "android"); mwebview.loadurl(config.url); } } public class javascriptinterface { context mcontext; javascriptinterface(context c) { mcontext = c; } public void ensure...

php - Routing requests to module -

php - Routing requests to module - hi im looking info on best way route requests custom module in yii framework. i implementing restful api project , hoping there way route requests api/ module rest api lives. improve away how route api requests custom urlmanager class extends curlmanager in module deals routes. request mydomain/api/user/model deferred , handled urlmanager component in module , other requests ie mydoamin.com/client/create handled normal yii applicaton. far can tell isnt possible!! so settle definig url manager class in config catches api routes so class urlmanager extends curlmanager { protected function processrules() { if(!isset($_get['r'])) { $this->seturlformat('path'); $this->showscriptname=false; $this->rules=array( //api rest patterns array('api/list', 'pattern'=>'^api/user/<model:\w+>',...

c# - How is the RoutedCommand.Name property used? -

c# - How is the RoutedCommand.Name property used? - the routedcommand class has name property can set in contructor. msdn has routedcommand.name : this property can used when referencing routedcommand in xaml. however, can't seem find info on how this. currently, commands referenced in xaml this: command="{x:static somenamespace:commands.somecommand}" this does not refer command name property, , works whether or not set name . what purpose of routedcommand.name , , how can used? routedcommand.name literally serves name of routedcommand bind dependencypropery of uielement , menuitem or button . please, refer xaml code below, applicationcommands class included in system.windows.input namespace(presentationcore.dll). <button command="{x:static applicationcommands.open}" content="{binding source={x:static applicationcommands.open}, path=name}"/> c# .net wpf routed-commands

c++ - Is it possible to manually calculate the byte-offset of a class member? -

c++ - Is it possible to manually calculate the byte-offset of a class member? - that is, standard compiler uses generate class? example, let's have class c members x , y , , z , , want know offset of z within class. can add together data-type sizes of other members, structure? no cannot. compilers free align members chose to.it implementation detail of compilers. if you're working pod, can utilize offsetof macro. but if working non-pod, suppose there won't portable method so. c++ compiler-construction class-members

PHP/PEAR - Retain trailing zeros when creating spreadsheets -

PHP/PEAR - Retain trailing zeros when creating spreadsheets - i'm using php pear bundle generate excel spreadsheets. have info of type double trailing zeros need retained. how can preserve info without having worksheet::writenumber function truncate zeros? i've tried changing format string in pack function no luck yet. add ' before it, e.g. "'" . $number php pear

python - Convert a list into a nested dictionary -

python - Convert a list into a nested dictionary - for illustration have x = ['a','b','c'] i need convert to: y['a']['b']['c'] = '' is possible? for background, have config file contains dotted notation points place in json data. i'd utilize dotted notation string access specific info in json file. example, in config: path_to_data = "user.name.first_name" i'd script recognize as: json_data["user"]["name"]["first_name"] so can value of first_name field. converted original string list, , don't know how convert nested dict. edit: there existing info construction need apply dict with. let's say: m = {'a': {'b': {'c': 'lolcat'}}} so that m['a']['b']['c'] gives me 'lolcat'. if right dictionary construction (as of replies did), still need apply existing dictionary ...

Google Docs Link and Viewing PDF -

Google Docs Link and Viewing PDF - https://spreadsheets.google.com/spreadsheet/pub?key=0ap6nkducjz8sdhzjowm1bkfxz0wxuw9bcnl3qmrsbgc&single=true&gid=0&output=pdf the link above downloads pdf, want open in browser. there way this? remove output=pdf. https://spreadsheets.google.com/spreadsheet/pub?key=0ap6nkducjz8sdhzjowm1bkfxz0wxuw9bcnl3qmrsbgc&single=true&gid=0 google-docs

Android live wallpaper based on the current wallpaper -

Android live wallpaper based on the current wallpaper - i'm trying create live wallpaper uses current device wallpaper background. you can see illustration of in 'bubbles' live wallpaper, need. i have tried using transparent canvas no luck. any thought / reference / sample much apprichiated. thanks lot, e. you can seek using wallpapermanager current wallpaper, save file , them utilize background on live wallpaper. not sure gonna work though. android live-wallpaper

Saving file locally and remotely in Aptana Studio -

Saving file locally and remotely in Aptana Studio - i have installed aptana studio 3 on pcs (windows xp, windows vista) set ftp connection , seems work fine. however, how save files locally well? not see alternative that. had problem file on server , didn't have file - or @ to the lowest degree couldn't find it. when set aptana studio, used default settings. guess question is: how set save files locally , remotely? can saved locally , remotely simultaneously when nail 'save'? thanks help. kevin i've been looking similar functionality while now, , submitted feature request: http://jira.appcelerator.org/browse/apstud-3143 aptana

c# - Reason for Using IDisposable Interface -

c# - Reason for Using IDisposable Interface - we know idisposable interface using disposing unmanaged resources. have class contains next code. here have implemented dispose method idisposable interface. class classa:idisposable { public classa() { console.writeline("classbeingtested: constructor"); } private bool disposed = false; image img = null; public image image { { homecoming img; } } ~classa() { console.writeline("classbeingtested: destructor"); // phone call dispose false. since we're in // destructor call, managed resources // disposed of anyways. dispose(false); } public void dispose() { console.writeline("classbeingtested: dispose"); // dispose of managed , unmanaged resources dispose(true); // tell gc finalize process no longer needs // run object. gc.suppressfinalize(this); } protected virtual void disp...

javascript - Best CSS and JS Minifer for ASP.net Web Forms -

javascript - Best CSS and JS Minifer for ASP.net Web Forms - criteria work asp.net mvc support dotless generate little qs param support css , js both support development mode , production mode support minification, bundling support provider of minification (ajax minifier, yahoo ui) etc. looks want squishit. don't know if supports bundling. another option: create t4 template uses microsoft ajax minifier (the ajaxmin.dll can loaded appdomain) , bundling. javascript asp.net css bundle minify

sql - Is an EXCLUSIVE lock the only way to prevent multiple sessions from simultaneously inserting? -

sql - Is an EXCLUSIVE lock the only way to prevent multiple sessions from simultaneously inserting? - i'm thinking implementing queue in oracle database using table queue , trying decide how prevent multiple sessions inserting table @ same time , messing ordering. is doing lock table mytable in exclusive mode way prevent multiple sessions inserting table? edit: "queue" not right term here. more of list, in relative order between elements what's important. i'm thinking of on order of java's arraylist. are sure need implement own queue? oracle provides built-in queuing (called oracle advanced queuing). tend improve alternative implementing same thing yourself. if implement queue yourself, why need prevent concurrent inserts? order concerned beingness "messed up"? assuming using oracle sequence object populate primary key, don't see reason you'd have prevent concurrent updates. sql oracle concurrency insert

scala - Filtering resources in SBT -

scala - Filtering resources in SBT - i trying setup sbt compile existing project not utilize maven directory structure. using full configuration , have set javasource & resourcedirectory settings follows: def settings = defaults.defaultsettings ++ seq( resourcedirectory in compile <<= basedirectory( _ / "java" ), javasource in compile <<= basedirectory( _ / "java" ) ) now want able filter resources include in jar artifact, ant, plus exclude .java files our resources mixed in source code. example: <fileset dir="java" includes="**/*.txt, **/*.csv" excludes="**/*.java" /> is there way this? use defaultexcludes scoped unmanagedresources task , optionally configuration. example, setting excludes .java files main resources: defaultexcludes in compile in unmanagedresources := "*.java" in compile restricts setting apply main resources. using in test instead, apply te...

php - Cut 1 big image into small images with the same size -

php - Cut 1 big image into small images with the same size - given jpg image, cutting off in horizontal direction size of spic around 100k any tips? have used function in past works me... this take input file , create tiles of specified size... function maketiles($name, $imagefilename, $crop_width, $crop_height) { $dir = "source dir"; $slicesdir = "target dir"; // might check if $slicesdir exists etc if not create it. $inputfile = $dir . $imagefilename; $img = new imagick($inputfile); $imgheight = $img->getimageheight(); $imgwidth = $img->getimagewidth(); $cropwidthtimes = ceil($imgwidth/$crop_width); $cropheighttimes = ceil($imgheight/$crop_height); for($i = 0; $i < $cropwidthtimes; $i++) { for($j = 0; $j < $cropheighttimes; $j++) { $img = new imagick($inputfile); $x = ($i * $crop_width); $y = ($j * $crop_height); $img-...

c++ - reading a line from ifstream into a string variable -

c++ - reading a line from ifstream into a string variable - in next code : #include <iostream> #include <fstream> #include <string> using namespace std; int main() { string x = "this c++."; ofstream of("d:/tester.txt"); of << x; of.close(); ifstream read("d:/tester.txt"); read >> x; cout << x << endl ; } output : this since >> operator reads upto first whitespace output. how can extract line string ? i know form of istream& getline (char* s, streamsize n ); but want store in string variable. how can ? use std::getline() <string> . istream & getline(istream & is,std::string& str) so, case be: std::getline(read,x); c++ string ifstream getline

xcode - iPhone - ShareKit Facebook Password field is not in secured text entry for second time -

xcode - iPhone - ShareKit Facebook Password field is not in secured text entry for second time - hi using sharekit api sharing text in iphone app,i facing problem in facebook login page while sharing if come in wrong userid , password 1 time , next time password field not in secure mode whatever password come in visible. can help in advance shkformfieldtypepassword of import check out not shkformfieldtypetext - (nsarray *)authorizationformfields { homecoming [nsarray arraywithobjects: [shkformfieldsettings label:@"username" key:@"username" type:shkformfieldtypetext start:nil], [shkformfieldsettings label:@"password" key:@"password" type:shkformfieldtypepassword ...

javascript - Highlight selected text on a page when spanning multiple non text nodes -

javascript - Highlight selected text on a page when spanning multiple non text nodes - i'm trying write code highlight text selected on page, next code works in cases not when range partially selects non-text node (see http://www.w3.org/tr/dom-level-2-traversal-range/ranges.html#level-2-range-surrounding more details). is there way split range 2 ranges , embolden both halfs separately around problem? function makebold() { var selection = window.getselection(); if (selection.rangecount) { var range = selection.getrangeat(0).clonerange(); var newnode = document.createelement("b"); range.surroundcontents(newnode); selection.removeallranges(); selection.addrange(range); } } you utilize document.execcommand() . note in non-ie browsers you'll have temporarily create document editable. jsfiddle: http://jsfiddle.net/c7j5h/1/ code: function highlight() { var range, sel; // ie case if (...

scala - Working with wide SQL tables using ScalaQuery (or something else type-safe) -

scala - Working with wide SQL tables using ScalaQuery (or something else type-safe) - many databases have tables many columns, scalaquery uses tuples represent table schemas, , scala doesn't back upwards such wide tuples. there way work such tables using scalaquery (short of dropping downwards executing raw sql)? if not, there other type-safe querying language supports this? squeryl scala mysql orm appears map table rows classes using name equivalence, should have no problem working many-column tables. haven't used looks easy use. sql scala scalaquery

Adding to Java classpath breaks ant -

Adding to Java classpath breaks ant - i wanted have jar in classpath easy access jython repl. in .bashrc put: export classpath=:/home/tmacdonald/path/to/jar/thing.jar however, breaks ant both compiling jar can compiling jar different subpackage: $ ant jar invalid implementation version between ant core , ant optional tasks. core : 1.8.0 in file:/usr/share/ant/lib/ant.jar optional: 1.5.1 in file:/home/tmacdonald/path/to/jar/lib/gt2-2.3.3/ant-optional-1.5.1.jar $ echo $classpath :/home/tmacdonald/path/to/jar/thing.jar changing classpath fixes it: $ export classpath= $ !ec echo $classpath $ ant jar [compiles successfully.] but seems awkward , not right thing have maintain changing classpath, depending on whether wanted run ant or jython repl. i'll admit knowledge of both ant , classpath pretty weak. think of classpath being, "path java libraries; or pythonpath java", , ever add together little changes existing ant config files inherited--i...

Is it possible to have two different Resource folders in Android development? -

Is it possible to have two different Resource folders in Android development? - i utilize widget dateslider provided http://code.google.com/p/android-dateslider/ however, has own resource files, wonder how can separate resource files mine. you can set android library project slider , include library own project. take @ library project documentation android

python - Cherrypy 3.2 virtual host - application configuration -

python - Cherrypy 3.2 virtual host - application configuration - i trying utilize cherrypy virtualhost dispatcher serving multiple different applications. thought have separate configuration file each application, kinda lost. if utilize virtualhost dispatcher, applications in same namespace, illustration section database connection can occur once. or not? can please help? for current purposes, satisfied solution: i create separate config file cherrypy application , using same class cherrypy parsing file. from cherrypy.lib.reprconf import config settings = config(os.path.join(confpath, "settings.cfg")) also, there python standard module handling config files named configparser. this question quite irrelevant me, because serving multiple cherrypy applications (as thought it) quite hard cherrypy server. decided utilize cherrypy wsgi server behind appache , solves problem explicitly. python python-3.x cherrypy virtualhost

workflow - Get workflowApplication state -

workflow - Get workflowApplication state - we know if there way current state (running, idle, completed,...) of workflow instance, using workflowapplication hosting. when application shouting down, want wait idle (or completed) state of our workflow instances(we have collection of them) in order persisted in instance store. we know can state when idle, completed, aborted,... events, need status @ anytime... thanks in advance. there no out of box status property can check this. using workflow tracking quite easy implement. workflow workflow-foundation-4

How to pass SqlDbType.Varbinary field (using Eval) to C# method in .NET? -

How to pass SqlDbType.Varbinary field (using Eval) to C# method in .NET? - in aspx code have (devexpress image control): <dx:aspxbinaryimage value='<%# getphoto(eval("photo")) %>' id="binaryimagepreview" runat="server" clientidmode="autoid" width="100px" /> then in code behind have this: protected static byte[] getphoto(byte[] photo) { homecoming photo; } my table column photo of type varbinary(max) reading sqldbtype.varbinary mapped byte[] there shouldn't problems here, compiler throws error: the best overloaded method match 'storeprofile.admin.getphoto(byte[])' has invalid arguments why? the reason want is check if photo exists (is null), show default photo disk, no_photo.jpg. uh, ok. missing casting. calling method way solved problem: getphoto((byte[])eval("photo")) c# .net eval photo varbinary

xsd - Generating closing tag for empty elements using XMLBeans -

xsd - Generating closing tag for empty elements using XMLBeans - i have next xsd : <?xml version="1.0" encoding="utf-8"?> <xs:schema attributeformdefault="unqualified" elementformdefault="qualified" xmlns:xs="http://www.w3.org/2001/xmlschema"> <xs:element name="employee" type="employeetype"/> <xs:complextype name="employeetype"> <xs:sequence> <xs:element type="xs:string" name="name"/> <xs:element type="xs:int" name="age"/> <xs:element type="xs:string" name="address"/> </xs:sequence> </xs:complextype> </xs:schema> if set value only name i.e employeedocument request=employeedocument.factory.newinstance(); employeetype emp=employeetype.factory.newinstance(); emp.setname("name"); request.setemployee(emp); then...

java - What's invokedynamic and how do I use it? -

java - What's invokedynamic and how do I use it? - i maintain hearing new cool features beingness added jvm , 1 of cool features invokedynamic. know , how create reflective programming in java easier or better? it new jvm instruction allows compiler generate code calls methods looser specification possible -- if know "duck typing" is, invokedynamic allows duck typing. there's not much java programmer can it; if you're tool creator, though, can utilize build more flexible, more efficient jvm-based languages. here sweetness blog post gives lot of detail. java reflection invokedynamic

iis 6 - How to get a list of sites and SSL certificates from IIS 6.0 using C#, WMI, and/or System.Management? -

iis 6 - How to get a list of sites and SSL certificates from IIS 6.0 using C#, WMI, and/or System.Management? - i trying export ssl certificates on iis 6.0 sites specificed remote server centralized backup server can migrate and/or backup our ssl certificates, cannot figure out how iis 6.0 (all our servers in staging , production still run iis 6.0). there way c# , system.management targeting iis 6.0 web sites. have tried think of. pseduo logic: list of iis web sites on server x if site has ssl certificate binding associated it, export ssl certificate name of iis web site. here’s code closer need for iis 7.0: using (servermanager servermanager = servermanager.openremote(this.servername)) { string collectiondisplay = null; if (servermanager.sites != null) collectiondisplay = "there " + servermanager.sites.count.tostring() + " sites:\n\n"; string sitedisplay = null; foreach (site ...

iphone - UITableView scrolls too far when editing embedded UITextView -

iphone - UITableView scrolls too far when editing embedded UITextView - i've embedded uitextview within uitableviewcell, , of table working fine. however, when enable editing on uitextview , start editing, table shifts far, obscuring cursor. there way command how far tableview scrolls? manually scrolling view cell works, view still scrolls before scrolling downwards , view. here illustration of mean: editing uitextfield - field neatly placed straight above keyboard. http://imageshack.us/photo/my-images/13/textfield.png/ editing uitextview - field placed above keyboard removing toolbar keyboard doesn't impact anything) http://imageshack.us/photo/my-images/809/textview.png/ here's code relevant uitextview in uitableviewcontroller object: - (void)viewdidload { [super viewdidload]; self.navigationitem.rightbarbuttonitem = self.editbuttonitem; [[nsnotificationcenter defaultcenter] addobserver: self ...