Posts

Showing posts from April, 2015

java - Is it possible to map a servlet to /* without overriding JSP processing -

elaborating on this: i map servlet or filter "/*" now, if access url like: /test then directed servlet (which okay) but if access url like: /index.jsp this directed servlet, dont want behavior, want index.jsp processed jsp. how can done? map controller servlet on more specific url-pattern /controller/* , create filter mapped on /* , follows in dofilter() method. string uri = ((httpservletrequest) request).getrequesturi(); if (uri.endswith(".jsp")) { chain.dofilter(request, response); // let go. container's builtin jspservlet pickup this. } else { request.getrequestdispatcher("/controller" + uri).forward(request, response); // goes controller servlet. }

java - Background image in JScrollpane with JTable -

im trying add centered background image behind jtable in jscrollpane. position of background relative viewport should centered , static. ive tried adding jscrollpane jpanel drawn image , making else translucent, result ugly , had rendering issues. check out watermarkdemo @ end of article complete example.

iphone - use if with NSinteger? -

i want use nsinteger variable *strength in code if condition it's not work.. :( if(strength == 11){ } how can use if nsinteger* nsinteger primitive value type; don't need use pointers. declaration should read nsinteger strength; and not nsinteger *strength; however if do need use pointer nsinteger (that is, nsinteger * ) reason, need dereference pointer value: if (*strength == 11) { } but see, don't think case.

Blackberry webworks : support HTML5 -

please me.. know? blackberry bold 9700 (5.0.0.469) support html5 audio stream? thanks.. i've tested simple webworks smartphone application on similar platform, diff phone: bb curve 9300 (5.0.0.846) , there no support html5 audio tag.

Which algorithms are worth to learn or recall on preparation to Java developer interview? -

i know collections.sort() method in java think quicksort worth remember , try. work target general java: web, database access, integration, not game developer, scientific application or 1 depends on advanced algorithms. algorithms should learn pass without stress java developer interview? fizz buzz i don't care, if developer knows basic algorithms heart. care, if capabale of understanding requirements , translating them in correct, testable , understandable pieces of code. ah, , care if knows how implement common design patterns. , should know when , how use collections, threads , - string#split - it's amazing how many "developers" don't know how read , process simple csv file.

regex - Python: Regular expression... not working? -

i have code: # if username isn't alpha-numerics (inc: _, -, ., ) if re.match('^[a-za-z0-9 _\-\.]+$', repname) == false: print 'decline: '+repname else: print 'accepted: '+repname and when test against string: ɢᴀꜱᴛяɪᴄ (which grabbed website) returned: accepted: ɢᴀꜱᴛÑ?ɪᴄ why getting through? why python seem change string? unsuccessful re.match not false . none . but can try way: if re.match('^[a-za-z0-9 _\-\.]+$', repname): print 'accepted: '+repname else: print 'decline: '+repname

Oracle sqlplus HTML report - alternating rows color -

i use oracle sqlplus "set markup html on" convert query output html report - it's simlpe way publish database report online. i'm missing 1 thing - alternating colors every other row, helpful while viewing wide reports. is there way embed html color every row, make dependent on mod(rownum/2) - even/odd row number ? thank ! i don't think there is, using set markup html on. have write own markup like: select '<tr style="color:' || case mod(rownum,2) when 0 'red' else 'green' end || '"><td>' || ename || '</td></tr>' data ( select ename emp order ename ); then add surrounding table tags using prompts or whatever.

ios4 - iPhone SDK AVAudioPlayer - stop and then fail to start -

- (ibaction)triggersound { if (player == nil) { nserror *error; player = [[avaudioplayer alloc] initwithcontentsofurl:url error:&error]; } else if ([player isplaying]) { [player stop]; player.currenttime = 0; } if (![player play]) { nslog(@"fail"); } } where player avaudioplayer , action linked uibutton. sound can played, , can played again after sound finish, when press button again during playback, message "fail" logged , sound cannot played, without exception. i , using ipad ios 4.2.1. i have noticed audio stream fails play after calling stop(which according reference undoes preparetoplay , play does). instead of calling stop, setting currenttime player.duration(end of stream) worked.

c# - Get return value from pressed button -

i have form pops @ specific event. draws buttons array , sets tag value specific value. if press or click button function should return tag value. how can this? , how know button clicked? @ moment code returns dialogresult, want return tag value function. how shall modify code can this? public static dialogresult selectbox(string title, string[] btnarray, string[] btnvaluearray) { form form = new form(); button[] buttonarray; buttonarray = new button[5]; form.text = title; (int = 0; < btnarray.length; i++) { buttonarray[i] = new button(); buttonarray[i].text = btnarray[i]; buttonarray[i].tag = new int(); buttonarray[i].tag = btnvaluearray[i]; buttonarray[i].tabstop = false; buttonarray[i].location = new system.drawing.point(0, * 40); buttonarray[i].size = new system.drawing.size(240, 40); } form.clientsize = new size(240, 268); form.controls.addrange(new control[] { buttonarray[0...

asp.net - what is difference between server side submitting and client side submitting a form -

what difference between server side submitting , client side submitting form. can 1 explain example. thank you there's no such thing server-side form posting. (unless of course have server side code creates web requests different web site , post data there , reads responses, based on question doubt case) there 2 types of client-side form postings: the old-fashioned way having form element input elements , submit button (either input type="submit" or button type="submit" ); <form method="post" action="some url receive posted data"> <input type="text" name="username" /> ... <button type="submit>save</button> </form> the new user-friendlier ajax posting doesn't require particular elements @ all; there users enter data, don't exist @ all; example uses jquery simplify ajax posting; $.ajax({ url: "some url posted data" data: { u...

jquery - How to escape ":"? -

for example have id someform:somepanel:somebutton when jquery("#someform:somepanel:somebutton") returns someform, how automatically escape id? edit: i want this jquery(somefunction("#someform:somepanel:somebutton")) if it's specialized version, can .replace() character. function somefunction(selector) { return selector.replace(/:/, '\\\\:'); } jquery(somefunction("#someform:somepanel:somebutton")) is converted into jquery("#someform\\:somepanel\\:somebutton"); to have more generic version, can use regexp: function somefunction(selector) { return selector.replace(/(!|"|#|\$|%|\'|\(|\)|\*|\+|\,|\.|\/|\:|\;|\?|@)/g, function($1, $2) { return "\\\\" + $2; }); }

c# - Database to DropDownList and AutoPostBack to Label -

i have code this protected void dropdownlist1_selectedindexchanged(object sender, eventargs e) { string strconnectionstring = configurationmanager.connectionstrings["sqlservercstr"].connectionstring; sqlconnection myconnection = new sqlconnection(strconnectionstring); myconnection.open(); string musisim = dropdownlist1.selecteditem.value; sqlcommand cmd = new sqlcommand("select b.hesap_no yaz..mardata.s_teklif b b.mus_k_isim = dropdownlist1.selecteditem.value", myconnection); label1.text = cmd.executereader().tostring(); myconnection.close(); i have customer name "mus_k_isim" , number "hesap_no" all want is, (autopostback true) automaticly getting label "hesap_no" has number "mus_k_isim" in dropdownlist. how can that? error: description: unhandled exception occurred during execution of current web...

android - location listener -

i using location listener long & lat android application. i working following code: public location getlastknownlocation() { location location=null; try { // location manager mlocmgr = (locationmanager) ctx.getsystemservice(context.location_service); // list providers: // list<string> providers = mlocmgr.getallproviders(); criteria criteria = new criteria(); bestprovider = mlocmgr.getbestprovider(criteria, false); location = mlocmgr.getlastknownlocation(bestprovider); if(location==null) { thread.sleep(5000); location=mlocmgr.getlastknownlocation(bestprovider); } } catch(exception e) { log.i("program", e.getmessage()); } return location; } public location updatecurrentlocation() { location mloc=null; try { mloc=getlastknownlocation(); mloclistener = new loclistener(); mlocmgr.requestlocationupdates(bestprovider, 0, 0, mloclistener); mloc=getlastknownlocation(); } catch(exception e) { log.e("program", e.getmessa...

Retrieve Facebook Post Comments Using Graph API -

i tried facebook comments using: http://graph.facebook.com/[post_id]/comments it results 2 of 15 comments, , without count info. { "data": [ { "id": "[post_id]", "from": { "name": "[name]", "id": "[id]" }, "message": "[message]", "created_time": "2011-01-23t02:36:23+0000" }, { "id": "[id]", "from": { "name": "[name]", "id": "[id]" }, "message": "[message]", "created_time": "2011-01-23t05:16:56+0000" } ] } anyone know why 2 comments? also, want retrieve comments (default number) or retrieve comments limit number, , comment...

winforms - Catch an exception/error from an OCX hosted in a .NET Windows Form -

i have .net windows form use host older vb6 ocx form. that’s can’t run from! @ least now... i’m not sure if paragraph useful, in case share information. in order load control, .net application provides configuration file contain information ocx control. load control using reflection, create instance activator.createinstance , cast object system.windows.forms.control. then, add .net form’s controls collection. approach works me. so, want catch ocx exceptions , errors in .net form, or have way of knowing ocx form crashed. possible? did have similar experience? way, i’m using .net 2.0. thanks. since no-one more knowledgeable has answered yet... if calling direct .net code method/property in vb6, errors raised in vb6 should propagate .net exceptions. the vb6 code presumably include event handlers form , controls. need error handlers in routines, using on error goto . think unhandled errors crash application (there's no .net code in call stack beneath windows eve...

log4net - publish from VSIDE work but MSBuild(using NANT) doesnt -

log4net generates logfiles when used published version of vside when build same project msbuild.exe no logfiles created. its build scripts , nothing msbuild.exe log4net configuration specified assemblyinfo.cs, overwritten build script version stamping. moved log4net.xml....configure() program.cs & global.asax.cs's application_start

Algorithm for the allocation of work with dynamic programming -

the problem this: need perform n jobs, each characterized gain {v1, v2,. . . , vn}, time required implementation {t1, t2,. . . , tn} , deadline implementation {d1, d2,. . . , dn} d1<=d2<=.....<=d3. knowing gain occurs if work done time , have single machine. must describe algorithm computes maximum gain possible obtain. i had thought of recurrence equation 2 parameters, 1 indicating i-th job , other shows moment in implementing : opt(i,d) , if d+t_i <= d adds gain t_i. (then variant of multiway choice ..that min 1<=i<=n). my main problem is: how can find jobs carried out? use data structure of support? as have written equation of recurrence? thanks you!!!! my main problem is: how can find jobs carried out? use data structure of support? trick is, don't need know jobs completed already. because can execute them in order of increasing deadline. let's say, optimal solution (yielding maximum profit) requirers complete job a (deadline 1...

TCP Ack-Fin after Ack-Push -

in tcp/ip connexion, when server replies ack-fin ack-push, means ? client try send 1024 bytes. mean server refuses push ? no. fin means application on side closed socket (or exited, causing socket closed).

iphone - Pushing view from Modal View -

im trying push view modal view. im trying doing same things on other views. problem is, think, thats modalview doesnt have navigation controller. cadastroviewcontroller *vaicadastro = [[[cadastroviewcontroller alloc] initwithnibname: nsstringfromclass([cadastroviewcontroller class]) bundle:nil] autorelease]; [self.navigationcontroller presentmodalviewcontroller:vaicadastro animated:yes]; what can push view inside of modal view? thanks! "but problem is, think, thats modalview doesnt have navigation controller." yes, modal view controller doesn't have nav controller unless create 1 , add modal view controller. it'll work. btw, may wonder whether modal view controller , parent controller can share nav controller or not, well, answer no, need create separate nav controllers pushing-and-popping @ different controller hierarchies.

Where should libraries go in Rails 3? -

where's recommended location libraries in rails 3? simple 'lib'? i'm not sure because 'lib' seems more rails 2 remnant, considering it's no longer auto-loaded (and there lot of discussion that, apparently). initializers more (obviously) initialization tasks such overrides. specifically have small module attachment handling (paperclip doesn't fit here) that's large , distinct include in model, not generic or worthwhile enough implement gem. from functionality standpoint lives somewhere in middle among model, view, , controller. makes sound helper, in rails helpers intended views afaik. should put in 'lib' , autoload in application.rb? or maybe create custom form builder handle presentation (or both). i know how make work, i'm hoping learn new. :) lib still right place put these kind of things. autoloading lib removed in rails 3 because of way engines work, because it's easy add autoload_paths if want automati...

c# - ASP.net best practise - where do I connect to database from? -

cn = new sqlconnection( configurationmanager.connectionstrings["localsqlserver"].tostring()); cn.open(); where should code go assuming have content pages , master pages? should put in master pages page_init ? accessible every stage of execution on content pages? i'm used classic asp, it: declare variables open connection process code close connection render html but there lots of stages of page lifecycle in .net wondering best place code? and connection need closing, or garbage handling take care of me? for me id create dataaccess layer can remove database connectivity in codebehind files. webapp reference dal , expose public method allow dal interaction front end in terms of opening , closing dal connections - wrap in using statement - takes care of opening , closing connection when required. more information on can found here - http://davidhayden.com/blog/dave/archive/2005/01/13/773.aspx

msbuild - Is there a "ZIP project" in Visual Studio? -

Image
in visual studio there several "setup , deployment" projects, 1 of these " cab project ". but want simple "zip project" enables me add folders + dll's solution , package in zip file easy distribution on web. is there such project type ? when want create myself, resources , references should use build ? edit @cheeso created dummy 'class library' project has dependencies on sub projects. in dummy project used post-build event zip dll's using 7-zip. hoping there better solution this. the msbuild extension pack offers compression tasks use. for example, edit project file, uncommenting 'afterbuild' target , including appropriate compression task packages content want. <project> ... <!-- modify build process, add task inside 1 of targets below , uncomment it. other similar extension points exist, see microsoft.common.targets. <target name="beforebuild"> </target...

git cvs - Reverting part of a commit with git -

i want revert particular commit in git. unfortunately, our organization still uses cvs standard, when commit cvs multiple git commits rolled one. in case love single out original git commit, impossible. is there approach similar git add --patch allow me selectively edit diffs decide parts of commit revert? use --no-commit ( -n ) option git revert , unstage changes, use git add --patch : $ git revert -n $bad_commit # revert commit, don't commit changes $ git reset head . # unstage changes $ git add --patch . # add whatever changes want $ git commit # commit changes note: files add using git add --patch files want revert, not files want keep.

html - What causes some icons not to appear when I run my iPhone web app in Safari on the desktop? -

note: have rephrased title because i'm not getting answers. surely out there has experienced problem , knows do. thank you! i have iphone web app works almost in safari on desktop. 2 things not work correctly on desktop: radio buttons not appear. operational because can check 1 if know is; invisible. when select used, little box default selection in , little down arrow not appear. however, actual text of default selection appear. if click on text drop-down menu appears should. in both cases problem seems have icons missing or not rendered needed. what problem , how can correct it? thank you. dave have tried changing user agent mobile safari? if turn on develop menu in safari advanced prefs, can test app in different environments. it's thought.

jquery - jqGrid - TableToGrid -

newbie here. have html table (structured required tabletogrid method). table not static dynamically created on server side , returned client html content. following questions: 1] in markup page, have this: table id="list" inside jquery dialog pops when event invoked on web page. dialog contain jqgrid receives html table server side code based upon user event. please confirm if table markup required because dynamic html content generated can have line included. 2] dynamicallly generated html content, i'm doing below in javascript: tabletogrid("#list", { url: myfilelocation, //this server side page creates html mtype: 'post', postdata: { param1: parva1, param2: paraval2}, viewrecords:true } nothing seems happen this. doubt server side page isn't reached. the wiki document says tabletogrid converts existing html table grid. so, mean, dynamically created html table cannot show...

Setting Oracle's Column COMMENTS Attribute with NHibernate -

one of larger applications using nhibernate on oracle data store. testing/development, application uses nhibernate's schema generation create/re-create database when needed. prior delivery, 1 of things being asked of dbas include comments each field in database (there lot). i'm looking solutions let me specify comment in mapping file. has done this? nhibernate support activity little effort on end? yes, can use <database-object> add additional artifacts (comments, indexes, triggers, etc) need. see 5.6. auxiliary database objects

c# - Making A WinForm Change Background Color While Still Useable -

i need make winform of mine flash alert user, , want accomplish changing background color default red, , again every second 5 seconds. during 5 seconds, want able use form, makes me think should put flashing code in different thread, but, believe encounter problems because flashing code try modify form, created on different thread. what best way accomplish goal of creating flashing winform? thanks! you need use system.windows.forms.timer .

BIRT - how to set dynamic "Display text" for report parameter? -

how can dynamically set "display text" property of report parameter? what mean "display text" of parameter. refering "selected display value" combobox or listbox parameter? if so, can use scripted ds , generate display values in fetch method.

php - Ajax request with Javascript -

i have page on want show couple of mysql tables. there 1 table on right may change when different person selected. de second table main table in center. have dropdown box contains every person. results selected person showed in middle table. there multiple results each person there second dropdown box choose of these results want show. al done ajax xmlhttp request. the problem right table uses javascript. know not possible ajax in combination xmlhttp-request. without javascript can't make want. there way, show right table after javascript finished doing work? i use frames. not nice. because have style both pages nice together, , that's not easy said. way doing want be. so searched internet (a long time) , few minutes before wanted give found piece of code (coming http://www.javascriptkit.com/dhtmltutors/ajaxincludes.shtml ): function httprequest(url){ var pagerequest = false //variable hold ajax object /*@cc_on @if (@_jscript_version >= 5) ...

c# - Required Field Validator + AsyncFileUpload -

i have been trying apply default asp.net required field validator asyncfileupload control (from ajax control toolkit). the scenario i have created web user control. let’s call wucfileupload. wucfileupload has ajax update panel wrapping required field validator , asyncfileupload. (i have use ajax update panel particular reasons) . wucfileupload going used in many pages, , in of them, control going generated automatically, not know how many of them have per page. wucfileupload has property called required. if required true, enable required field validator, check if asyncfileupload has been filled @ least once. my try i found this solution here on stackoverflow , , tried apply it. however, case little bit different, 1 represented on question. my thoughts i liked idea of having hidden textbox or hiddenfield. because single asyncfileupload can upload n number of files. the textbox could value on first time onclientuploadcomplete runs … way i’ll know user has up...

resize - Perl - Image::Magick create specific size image "canvas" while maintaining aspect ratio of original image? -

i need create images within 480w x 360h pixel "canvas". i did create images remote url, no problem stackoverflow. however, desire maintain aspect ratio of image but, have end result 480x360.. therefore, "canvas" or border crop technique needs used (from have read) but, cannot seem going. here have: #!/usr/bin/perl use image::resize; use image::magick; use strict; $new = 'path/to/image/image.jpg'; $somewords = 'some words'; $imageurl='http://myimageurl.com/image.jpg'; $p = new image::magick; $p->read("$imageurl"); ($origw, $origh) = $p->get('width', 'height'); #### correct size images processed here annotation ######## if (($origw == 480) && ($origh == 360)){ system("convert $imageurl -fill '#ffffff' -font candice -pointsize 12 -undercolor '#00000080' -gravity southeast -annotate +1+1 '$somewords' $new"); } #### process images of incorrect original...

svn - How can you be confident that Subversion's automatic merges don't introduce logical conflicts? -

svn update automatic merges when thinks can. shouldn't there pre-requisite or something? if work in organization unit/regression tests during qa testing, how on earth can confident merge did not create insidious bug? in experience conflcts hapen more documentation says. easy solve must solved.

actionscript - Google Maps for Flash idle event -

i'm new google maps api. compared javascript , flash map events , found there "idle" event in javascript api. there following advice in google docs: note listen bounds_changed event fires continuously user pans; instead, idle fire once user has stopped panning/zooming. but haven't found such event in actionscript api. there zoom_changed, drag_end, etc events, nothing "idle". missing or event not ported actionscript api? far understand, useful thing - wait until user stops @ viewport instead of immediate handling of pan/zoom actions (cause affect performance , produce unnecessary requests marker data). maybe there workaround. i didn't find "idle" event either. listening zoom_changed , drag_end individually should give same results. there particular reason why looking avoid these 2 events generic idle event ? i argue individual events better 'coz give finer resolution @ understanding events.

asp.net - The jquery keyup event is not working -

i working on making sharepoint 2007 app more modern. using jquery actively , though no expert, have learnt enough know ways around. untill faced issue today. here bits: $(document).ready(function() { alert('doc ready'); var textbox1 = $("#mytest"); alert(textbox1); textbox1.keyup(function() { alert('key up'); }); textbox1.live("keyup", function() { alert('keykeykey live'); }); }); server-generated html: <input name="ctl00$spwebpartmanager1$g_1f2d211c_a0c3_490d_8890_028afd098cac$ctl00$mytest" type="password" id="ctl00_spwebpartmanager1_g_1f2d211c_a0c3_490d_8890_028afd098cac_ctl00_mytest" class="gh" /> so document ready handler fires, textbox1 variable not null, none of eventhandlers handle keyup event ever fire? mind reels... i doesn't work because id attribute actaully ctl00_spwebpartmanager1_g_1f2d211c_a0c3_490d_8890_...

java - Android Camera API - Force Close Does Not Release Camera Resource -

so while developing custom camera application i've realized on rare occasions , on various devices if app has force close, not release camera resource. is there way find/detect process holding onto resource , kill it? or other technique? rather difficult bug reproduce (for me anyway), device has restarted. thanks! from chasing on other posts have made on subject, appears there no sure fire way of getting camera after crash without restart of device. pain, sure. best option not crash / catch might fault. pretty rubbish answer, that's i'm endeavouring now. lots , lots of try catch !

Communicating between Android phone and PC using TCP in java -

i'm working on project want droid 2 able send , receive data on 3g, device connected ethernet port (not pc, i'm using testing communication). believe end end communication accomplished on ssl tunnel, right now, need establish basic communication show devices can communicate. i've written client/server applications worked between 2 computers on same network, i'm not sure if communication in case work because of different networks phone , pc on. i've been trying establish if can done pinging of pcs @ university , house using pinging program got off market, i've had no success far. however, friend has rooted phone, , able so. i suppose question has 2 parts: 1) possible? , 2) need root phone accomplish this, or should able without rooting? thanks responses. i've written client/server applications worked between 2 computers on same network, i'm not sure if communication in case work because of different networks phone , pc on. one p...

Ensure that form never submits without using javascript or jquery -

i have situation using custom jquery plugin hijack form submit. data in form sent via jsonp cross domain ajax call server. data cannot ever posted sever hosting form. my problem if client has javascript disabled, plugin won't prevent form submitting. how ensure form doesn't ever submit without javascript enabled? one option have considered use javascript write out form tags. <script type="text/javascript"> document.write('<form id="myform">'); </script> <!-- form html here --> <script type="text/javascript"> document.write('</form>'); </script> and apply plugin form $('#myform').myplugin(); while work, seems kind of hacky, considering third party clients going using plugin , i'd rather not dictate forms have written way. possibility if had go way force them attach plugin div containing form , auto-inject form tags around div , continue normal. tell...

c# - ASMX file upload -

is there way upload file local filesystem folder in server using asmx web services(no wcf, don't ask why:)? upd p.s.file size can 2-10 gb when developing free tool upload large files server, using .net 2.0 , web services. to make application more error tolerant large files, decided not upload 1 large byte[] array instead "chuncked" upload. i.e. uploading 1 mb file, call upload soap function 20 times, each call passing byte[] array of 50 kb , concating on server again. i count packages, when 1 drops, try upload again several times. this makes upload more error tolerant , more responsive in ui. if interested, this cp article of tool .

php - CodeIgniter: Measure Page Load Time -

how measure page load time in ci application using smarty? right now, have put benchmark points @ beginning , end of index() method, measures execution time of method, right? want know how long take render page. i point codeigniter profiler when used in conjunction benchmarking, gives detailed results, should looking for. make sure adjust benchmark points conform profiler specs though.

postgresql - DB:migrate fails on Heroku due NAMEDATALEN -

i appreciate easiness of deploying apps heroku far. has been great experience. however, repeatedly error, , cannot find cause it. work on latest rails framework. uploaded , app running. however, added columns tables , tried rake db:migrate command, when following error: input string longer namedatalen-1 (63) when googled it, found out, 63 maximum length of input string table name etc. in postgresql. however, checked table names, , none comes close it. have suggestions why migration fails? the migration in question following: class createposts < activerecord::migration def self.up create_table :posts |t| t.text :data, :null => false t.string :category, :null => false t.string :zip, :limit => 5 t.boolean :published t.integer :submittedby, :limit => 20 t.integer :reviewedby, :limit => 20 t.integer :likecount, t.timestamps end end def self.down drop_table :posts end end the err...

Windows Phone 7 isolated storage serialization errors with List of objects -

i have been trying serialize list of objects class , keep getting error stating there error in xml file @ point (25, 6)(these numbers change depending on trying serialize). here's example of how trying serialize data: using (isolatedstoragefile isf = isolatedstoragefile.getuserstoreforapplication()) { using((isolatedstoragefilestream fs = isf.createfile("data.dat")) { xmlserializer ser = new xmlserializer(user.data.gettype()); ser.serialize(fs, user.data); } } , here's how deserializing data: using (isolatedstoragefile isf = isolatedstoragefile.getuserstoreforapplication()) { if (isf.fileexists("data.dat")) { using (isolatedstoragefilestream fs = isf.openfile("data.dat", system.io.filemode.open)) { xmlserializer ser = new xmlserializer(user.data.gettype()); object obj = ser.deserialize(fs); if (null != obj && obj data) user.data...

webforms - How to redirect to another page in php after form is complete? -

i have registration form in site building. if filled correctly, want user go main page. i tried use header "cannot modify header information..." guess happens because post $_server['php_self'] ; any suggestions of how can redirect user if form ok? (other success page button) you can use header() function if no other text/string data has been output web server users browser. you'll need put logic redirect @ top of script before else: <?php // process form // if processing successful, redirect if($success) { header("location: http://www.main-page-url.com/"); } ?> the reason when browser receives information web server receives http header (which header() function outputs redirect to), , outputs body of http response after http header. if script echo ing before header command, you'll continue receive error.

xcode - Game Center posting bogus scores - iPhone -

i'm trying game center working , it's there. problem scores posted don't make sense. post score code: -(ibaction)subscore { { gkscore *scorereporter = [[[gkscore alloc] initwithcategory:@"katplay"] autorelease]; scorereporter.value = gcpost; nslog(@"posted"); nslog(gcpost); [scorereporter reportscorewithcompletionhandler:^(nserror *error) { if (error != nil) { nslog(@"failed!!!"); nslog(gcpost); } }]; } } so play game , score , view console log says gcpost = 2500. when view leaderboard score 100,929,392 points. have no idea number have come from. am missing basic? chris just implemented game center in app. need convert integer onto int64_t . in objective-c terms, thats longlong . can change this: scorereporter.value = gcpost; to this: scorereporter.value = [[nsnumber numberwithint:gcpost] long...

wcf security - WCF communication across domains -

i have workflow wcf service (servicedmz) installed on server across firewall. service running under windows account on server. account name: dmzdomain\dmzusername. i have workflow wcf service running on development machine (servicedev). self hosted service running under windows account: devdomain\devusername. servicedev communicates servicedmz using wshttpcontextbinding , context correlation in send , recieve activities. servicedmz uses callback address communicate servicedev when done completing task. i error in send activity of servicedev: system.servicemodel.security.securitynegotiationexception: caller not authenticated service. ---> system.servicemodel.faultexception: request security token not satisfied because authentication failed. @ system.servicemodel.security.securityutils.throwifnegotiationfault(message message, endpointaddress target) @ system.servicemodel.security.issuancetokenproviderbase`1.throwiffault(message message, endpointaddress target) @ sy...

regex - Extract values from a text body in Ruby -

i need extract values multi-line string (which read text body of emails). want able feed patterns parser can customize different emails later. came following: #!/usr/bin/env ruby text1 = <<-eos lorem ipsum dolor sit amet, name: pepe manuel periquita email: pepe@manuel.net sisters: 1 brothers: 3 children: 2 lorem ipsum dolor sit amet eos pattern1 = { :exp => /name:[\s]*(.*?)$\s* email:[\s]*(.*?)$\s* sisters:[\s]*(.*?)$\s* brothers:[\s]*(.*?)$\s* children:[\s]*(.*?)$/mx, :blk => lambda |m| m.flatten! {:name => m[0], :email => m[1], :total => m.drop(2).inject(0){|sum,item| sum + item.to_i}} end } # scan on text returns #[["pepe manuel periquita", "pepe@manuel.net", "1", "3", "2"]] def do_parse text, pattern data = pattern[:blk].call(text.scan(pattern[:exp])) puts data.inspect end do_parse text1, pattern1 # ./text_parser.rb ...

c - How to loop through a va_list if the number of arguments is unknown? -

how loop through va_list if number of additional arguments unknown? #include <stdio.h> #include <stdarg.h> int add(int x, int y, ...) { va_list intargs; int temp = 0; va_start(intargs, y); int i; (i = 0; < 3; i++) { /* how can loop through number of args? */ temp += va_arg(intargs, int); } va_end(intargs); return temp + x + y; } int main() { printf("the total %d.\n", add(1, 2, 3, 4, 5)); return 0; } use sentinel value terminator, e.g null or -1

hyperlink - Jquery to change links to _blank if they don't start with a specific url/domain -

i know $("a[href='http://testtesttest.org/']").attr("target", "_blank"); find , change links match test url, i'd know how change links not match url. links take users other webites -- outside links you can use :not : $("a:not([href='http://testtesttest.org/'])") if want select don't start url, have use attribute starts selector ^= : $("a:not([href^='http://testtesttest.org/'])") you mention: essentially links take users other webites -- outside links that depends on how consistent structure of internal urls is. e.g. previous shown selector select links such as <a href="/images">images</a> or <a href="foo/bar">bar</a> which internal. if every internal link starts domain name, fine. if not, either have possibility adjust links, have consistent structure, or use selector: $("a[href^='http']:not([href^='http...

PHP - Is there a portable version of PHPUnit? -

is there portable version of phpunit can bundle web app? want able use phpunit on server while avoiding issues of using pear (version conflicts, breaking other hosted apps, etc.). portable phpunit (taken https://github.com/sebastianbergmann/phpunit "using phpunit git checkout" ) for phpunit 3.5: git clone git://github.com/sebastianbergmann/phpunit.git git clone git://github.com/sebastianbergmann/dbunit.git git clone git://github.com/sebastianbergmann/php-file-iterator.git git clone git://github.com/sebastianbergmann/php-text-template.git git clone git://github.com/sebastianbergmann/php-code-coverage.git git clone git://github.com/sebastianbergmann/php-token-stream.git git clone git://github.com/sebastianbergmann/php-timer.git git clone git://github.com/sebastianbergmann/phpunit-mock-objects.git git clone git://github.com/sebastianbergmann/phpunit-selenium.git cd phpunit && git checkout 3.5 && cd .. cd dbunit && git checkout 1.0 &...

ruby on rails - Migrate from restful_authentication to devise -

i've been using rails 2 project , restful_authentication it. recently, changed project rails 3 , found out devise, eyes seems better solution restful_authentication. therefore, decided idea migrate devise, seems procedure pretty tedious , error prone. ask if know of resource describes procedure, because doing scratch bit of hassle. rails generate devise:install rails generate devise user rake db:migrate that's there now, routes , functionality /users/sign_(in|out|up) start. resources: railscasts "introducing devise" devise readme example application

cocoa - Capturing undo/redo key events on NSTableView -

i need capture undo/redo key commands in nstableview , forward down managed object context's undo manager. have tried overriding -keydown, that's hard navigate. need internationalized solution problem doesn't revolve around checking "z" key command key modifier mask. is there way can set tableview standard "undo" key binding? ideas? implement windowwillreturnundomanager in delegate of window containing nstableview. return object context's undo manager there. table view able receive events. [nswindowdelegate windowwillreturnundomanager:]

.htaccess - url segments based redirect in modx Evo -

let's have url entered in modx evo www.zipit.com.org/reference/toamovie/ if have page called toamovie parent called reference but when enters url want equivalent of this www.zipit.com.org/reference.html?myvar=toamovie additionally, or more importantly, i'd result more this, 12 wouls id of document `www.zipit.com.org/reference.html?myid=12' i'm wondering if @ possible modx evolution.i'm thinking should possible htaccess magic, first part anyway. how value document? quite inaccessible htaccess, there need part plug database , value. it should possible custom plugin called on "onpagenotfound" event. <?php $url = $_server['request_uri']; //get url //split url pieces , remove empty values $pieces = array_filter(explode('/', $url)); //reset array keys $temp = array(); foreach ($pieces $piece) { $temp[] = $piece; } $pieces = $temp; //basic checking of url if (count($pieces) == 2) { $modx->send...

iPhone in-app purchases -

how test in-app purchases before app submitted apple, let alone accepted or released? apple docs have plenty of info it's rather vague in places. may try read this: http://troybrant.net/blog/2010/01/in-app-purchases-a-full-walkthrough/

Android: How I get amplitude from mediaplayer? -

i need amplitude mediaplayer. i try use audiomanager, maudiomanager.getstreamvolume( audiomanager.stream_music ); not need. thanks. i find solution. can use visualizer api level 9.

c# - MVVMLight Combobox Binding Silverlight4 -

(mvvm light in sl4) my displayworkorder view has field named warehouse_code. in viewmodel, bind property. if use textbox , set text="{binding warehouse_code}", open existing workorder, textbox populated value of warehouse_code (e.g. lombard). if change textbox combobox, have issues. the combobox set so: <combobox grid.column="1" grid.row="1" x:name="cbowarehouse" margin="4" itemssource="{binding path=warehouses}" selectedvalue="{binding path=warehouse_code, mode=twoway}" /> my warehouses property (for design mode) list build in constructor of viewmodel: warehouses = new list<string> { "docks", "pearl", "lombard", "powell", "goose hollow" }; when load blank work order, combobox populated list. however, when select existing work order, combobox blank. not don't display selectedvalue work order, itemssource doesn...

c# - How to combine 2 lists using LINQ? -

env.: .net4 c# hi all, i want combine these 2 lists : { "a", "b", "c", "d" } , { "1", "2", "3" } into one: { "a1", "a2", "a3", "b1", "b2", "b3", "c1", "c2", "c3", "d1", "d2", "d3" } obviously, use nested loops. wonder if linq can help. far understand, zip() not friend in case, right? tia, essentially, want generate cartesian product , concatenate elements of each 2-tuple. easiest in query-syntax: var cartesianconcat = in seq1 b in seq2 select + b;

algorithm - How to effectively find areas in two-dimensional array? -

i need idea how find areas below marked 0 in two-dimensional array. should noted there other areas, such picture shows 1 of 2 owns coordinate (0.0) , other owns coordinate (21.3). 00000000000111110000111 00000000001111110000111 00000000011111100000111 00000000000111000001101 00000000011100000011101 00000001111100001111001 00000111111111011111001 00000001111100001111001 00000000010000000011001 00000000000000000001111 of course real array larger. recursive version goes sides , stops @ mark 1 or array side isn't fast enough. it looks you're looking flood-fill algorithm . wikipedia page linked lists few algorithms may faster obvious recursive method. flood-fill match if areas you're looking small compared entire array, , don't need search all of them. if need know or of them, computing them in single shot using union-merge based connected component labeling algorithm may better choice. here's code implements such algorithm (note i've altered run...

javascript - Save data to ViewState -

i can tried save data viewstate, error: microsoft jscript runtime error: sys.webforms.pagerequestmanagerservererrorexception: error serializing value 'hermessaas.bussinesprocess.bussinesservices.candidateservice' of type 'hermessaas.bussinesprocess.bussinesservices.candidateservice.' code: private iactionservice actionservice { { return viewstate["actionservice"] iactionservice; } set { viewstate["actionservice"] = value; } } private void initializefield(iactionservice service) { actionservice = service; } how can store value viewstate? s hermessaas.bussinesprocess.bussinesservices.candidateservice decorated serializable attribute? eg: [serializable] public class candidateservice { } if not simple class recommend storing in session rather viewstate take longer page download , render

jquery - Display DIV and then go to an element inside that DIV -

i trying unhide div , right after scroll down element. i have "index" of text have list of anchor tags href'ing different id's down page, @ first sight text hidden , first display when click on 1 of index links. works fine untill scroll part. there nothing special code far, it's mere if statement adding & removing css class depending on client action. how page automatically scroll down after div displays? i tried solution: how go specific element on page , couldn't seem fit in own script. if ($('#<%=paragraph.clientid%>').hasclass("readable")) { $('#<%=paragraph.clientid%>').removeclass("readable"); // readable class hides paragraphs. // run function scroll down selected element here. } else { $('#<%=paragraph.clientid%>').addclass("readable"); } what first tried this: (function($) { $.fn.goto = function() { $('html, body').ani...

cygwin on win7 problem - Could not use curl because "cygcurl-4.dll" is missing -

where find , how install it? thanks follow-up: i did use full installation , specific file not there. i had same problem. i installed curl using setup-x86.exe on 64 bit windows 8.1 machine (run setup-x86.exe, search curl, install net curl: multi.... ) to fix re-ran installer , searched curl , installed libs libcurl4.... (you can run installer , search libcurl4 )

android - How do I make so my spinner target links to a website? -

hey, i'm new android development started few hours ago. need make application school project , needs done soon. so far have made spinner alternatives choose from. here problem. how make when click on 1 of targets listed in spinner links webpage. i don't know how use "adapterview.onitemselectedlistener." or if necessary here or not. i thankful advices. head you can try setting onitemselectedlistener spinner: edit: super.oncreate(savedinstancestate); setcontentview(r.layout.main); spinner spinner = (spinner) findviewbyid(r.id.spinner); arrayadapter<charsequence> adapter = arrayadapter.createfromresource( this, r.array.planets_array, android.r.layout.simple_spinner_item); adapter.setdropdownviewresource(android.r.layout.simple_spinner_dropdown_item); spinner.setadapter(adapter); spinner.setonitemselectedlistener(new onitemselectedlistener() { @override public void onitemselected(adapterview<?> arg0, view arg1, int ...

jQuery address plugin -

i learn basics of plugin: http://www.asual.com/jquery/address/ can show me simple example of how works (the basic concept of it). thanks. the plug-in’s website has several examples . view source on each 1 see use of plug-in.

.net - C# Mouse Move and Click relative to active window -

hi have been using code similar in piece of automation have been working on public static void leftclick(int x, int y) { cursor.position = new system.drawing.point(x, y); //<= fails without mouse_event((int)(mouseeventflags.leftdown), 0, 0, 0, 0); mouse_event((int)(mouseeventflags.leftup), 0, 0, 0, 0); } however unless being dumb move mouse x,y top left of screen causes me problems if active window isn't im expecting be, can suggest way of achieving same functionality moving mouse point relative active window. thanks you need pinvoke getwindowrect() find out window located. can adjust x , y window position. visit pinvoke.net declarations.

design - Controller want to know if list's View is empty -

admit have 2 class : view , controller , knows each other. view has object list named list , controller want know if list empty or not. what best way ? if that's interaction between list , controller, implement boolean islistempty() method in view class in define logic determine whether list empty. way, don't have expose type of list controller , keep program flow in controller simple if view.islistempty() something .

android - How to automatically pop-up keyboard? -

i have edit text field have input password, have push field. how automatically pop-up keyboard without touching edit text? there edit text xml field: <edittext android:id="@+id/editpasswd" android:focusable="true" android:focusableintouchmode="true" android:layout_width="fill_parent" android:layout_height="wrap_content" android:inputtype="phone" android:password="true"/> use code in point want display keyboard (may in ocreate?) edittext myedittext = (edittext) findviewbyid(r.id.editpasswd); ((inputmethodmanager)getsystemservice(context.input_method_service)) .showsoftinput(myedittext, inputmethodmanager.show_forced);

iphone - Gaussian filter with OpenGL Shaders -

i trying learn shaders implement in iphone app. far have understood easy examples making color image gray scale, thresholding, etc. of examples involve simple operations in processing input image pixel i(x,y) results in simple modification of colors of same pixel but, how convolutions?. example, easiest example gaussian filter, in output image pixel o(x,y) depends not on i(x,y) on surrounding 8 pixels. o(x,y) = (i(x,y)+ surrounding 8 pixels values)/9; normally, cannot done 1 single image buffer or input pixels change filter performed. how can shaders? also, should handle borders myself? or there built-it function or check invalid pixel access i(-1,-1) ? thanks in advance ps: generous(read:give lot of points) ;) a highly optimized shader-based approach performing nine-hit gaussian blur was presented daniel rákos . process uses underlying interpolation provided texture filtering in hardware perform nine-hit filter using 5 texture reads per pass. split separa...

nhibernate - Join two tables by comparing equal value on two columns -

for simplicity , clarity, assume have these 3 tables. employee [ id ] employeename [ employeeid, name ] employeeaddress [ employeeid, address ] the properties/relationships defined in 'sub-tables' employeename & employeeaddress employeename belongsto employee employeeaddress belongsto employee there are no properties/relationships (collections) in main employee table such as employee hasmany employeename employee hasmany employeeadress. i want perform join using detachedcriteria between employeename , employeeaddress only (not involving employee) , such select employeename.name, employeeaddress.address employeename inner join employeeaddress employeename.employeeid = employeeaddress.employeeid , employeeaddress.address '%somelocation%' order employeeaddress.address not query you're looking , haven't tested if works.. may you: var addresscriteria = detachedcriteria.for<employeeaddress>(...

javascript - Jquery only show/hide but only one instance -

i building interface in when user clicks on target display new menu, interface, has multiple instances of target , each target shows same menu, want show menu under target has been clicked, @ moment, whatever target click menus become visible. $('.statuses').hide(); $('.employer .status').click(function(e){ alert('clicked'); $('.employer .status').next('.statuses').show(); }); and html <div id="left-column"> <?php foreach($jobs $j): ?> <p><strong><?php echo $j['jobtitle']; ?></strong> &pound;<?php echo $j['salary']; ?>, <?php echo $j['job_summary']?> </p> <ul> <?php foreach($applications $a): ?> <?php if ($j['jobtitle'] == $a['jobtitle']): ?> <li> <img src="/media/uploads/candidates/<?php echo preg_replace('/(.gif|.jpg|.png)/', '_thu...

multiplication - jQuery multiply only values that are not hidden -

i pondering how add values of inputs specific names via jquery if container div set display block. something link if ($('#product_' + this.alt).css('display','block')) { then needs add .each fetching input this. $('#product_price_total_pri_' + this.alt).val any ideas on how put of together? edit: obviously should clarify. encased in alt tag of multiple checkboxes , radio buttons id corresponds ids of hidden containers , fields. therefore combination of buttons , checkboxes checked determines hidden areas visible seen here. function product_analysis_global() { $(':checked').each(function(){ $('#product_' + this.alt).css('display','block'); $('#product_quantity_pri_' + this.alt).val(this.value); var quantity = $('#product_quantity_pri_' + this.alt).val(); var price = $('#product_price_pri_' + this.alt).val(); var duration = $('#product_duration_pri_' + th...