Posts

Showing posts from March, 2014

java - Time dependent unit tests -

i need test function result depend on current time (using joda time's isbeforenow() ). public boolean isavailable() { return (this.somedate.isbeforenow()); } is possible stub/mock out system time mockito can reliably test function? joda time supports setting "fake" current time through setcurrentmillisfixed , setcurrentmillisoffset methods of datetimeutils class. see http://joda-time.sourceforge.net/api-release/org/joda/time/datetimeutils.html

c# - Windows Phone 7: Check If Resource Exists -

i need check whether embedded resource exists. in wpf relatively easy, in wp7 missingmanifestresourceexception the wpf code works is: public static ienumerable<object> getresourcepaths(assembly assembly) { var culture = system.threading.thread.currentthread.currentculture; //var resourcename = assembly.getname().name + ".g"; var assemblyname = assembly.fullname.split(',')[0]; var resourcename = assemblyname + ".g"; var resourcemanager = new resourcemanager(assemblyname, assembly); try { var resourceset = resourcemanager.getresourceset(culture, true, true); foreach (system.collections.dictionaryentry resource in resourceset) { yield return resource.key; } } { resourcemanager.releaseallresources(); } } i tried replacing code below, resulted in exception (on line 9). there way in silverlight / wp7? ...

java library vs android library -

what differences between java library , android library , advantages/disadvantages has each? you can include standard java .jar file libraries in android app. translated dalvik format @ .apk build time. there android library system allows use of shared resources such layouts , localized strings. has more restrictions regular java libraries i'd recommend method if need share resources. http://developer.android.com/guide/developing/projects/projects-eclipse.html

sql server - Using a meaningless ID as my clustered index rather than my primary key -

i'm working in sql server 2008 r2 as part of complete schema rebuild, creating table used store advertising campaign performance zipcode day. table setup i'm thinking of this: create table [dbo].[zip_perf_by_day] ( [campaignid] int not null, [zipcode] int not null, [reportdate] date not null, [performancemetric1] int not null, [performancemetric2] int not null, [performancemetric3] int not null, , on... ) now combination of campaignid, zipcode, , reportdate perfect natural key, uniquely identify single entity, , there shouldn't 2 records same combination of values. also, of queries table going filtered on 1 or more of these 3 columns. however, when thinking clustered index table, run problem. these 3 columns not increment on time. reportdate ok, campaignid , zipcode going on place while inserting rows. can't order them ahead of time because results come in different sources during day, data campaignid 50000 might inserted @ 10am, , campaignid 30000 might c...

html - Centering a label + dropdown inside of a div -

i have following html: a div, contains label , drop down list (select) label. putting vertical-align:center on both label , dropdown, result label centered, dropdown not centered. consider centered "equal spacing above , below dropdown". ie apparently considers centered aligning bottom of drop down list bottom of label, which, unfortunately, not good. how can fix this? edit: isn't urgent since position:relative; fixed issue using position:relative; annoys me , shouldn't necessary. you missusing vertical-align property. work intended in table cell. not on div. vertical-align: middle ; not center. vertical-align:middle: aligns vertical midpoint of element baseline of parent element plus half x-height of parent. i think article explains why: http://www.ibloomstudios.com/articles/vertical-align_misuse/ the key baseline here point towards element get's aligned. sample: http://jsfiddle.net/easwee/kabbf/7/

How do I link a 64-bit MATLAB mex file to OpenCV libraries -

normally in matlab can compile mex file uses opencv functions using: mex -o "mxfunc.cpp" -i"c:\opencv2.1\include/opencv" -l"c:\opencv2.1\lib" -lcv210 -lcvaux210 -lcxcore210 -lhighgui210 however, having switched 64-bit version of matlab, unresolved symbols, e.g. mxfunc.obj : error lnk2019: unresolved external symbol cvreleaseimage referenced in function mexfunction how can fix this? system: windows 7 64-bit; msvc 2005; matlab r2010b 64-bit; opencv 2.1.0. generally: need recompile used libraries in 64-bit. as far know, it's not enough. if use stl (and opencv uses lot) need use same crt version matlab uses. need use same version of msvc mathworks guys... you can check dependency of libmex.dll figure out crt needed. after need install proper visual c++ (normally free version enough).

vb.net - do some action before displaying the message box, winforms -

i use me.cursor = cursors.waitcursor for time taking functions hitting db. now if exception occurs, i'll display error message as: msgbox(ex.message) so before displaying message, need reset cursor default. there simple way @ in 1 place instead of writing in catch blocks. is there way inherit messagebox class , override functions? other wise need code in catch blocks or handle exceptions @ 1 place don't want modify whole application now. thanks in advance. i think can create common function this, accepts exception parameter , call function in every catch block. try 'do code here catch ex exception showexception(ex) end try private sub showexception(ex exception) messagebox.show("an exception occured." + vbcrlf + ex.tostring()) me.cursor = cursors.default end sub

Windows Installer on Win Startup / Message not a valid WIN 32 Application -

when boot windows, installer launches. progress window appears. if finished, meesage: not valid win 32 application. i have win 7 pro 64 bit. how can fix error? there way, clean installer history? many in advance!

audio - Actionscript 3.0 sound chain -

is possible in actionscript 3.0 play chain of sounds (i.e. several mp3s)? or should manually start playing first sound, wait sound_complete event, start second sound , on? you'd need use sound_complete, should aware flash has latency issues when comes playing sounds. additionally, if you're using mp3s have remember mp3 file format has blank space @ head of file such continuous loop not possible without using 10.0+ sound apis extract part of file contains actual sound.

iphone - System Sound Lock -

i developing iphone app translates voice text. component transcribe third-party. until worked fine. today tried playing sound (.wav file) after making transcription , noticed cannot play (by avaudio or system sound). after debugging found out happening after init ing third-party component; think component not releasing belongs system audio. my question : there way force iphone play sound want? have tried setting avaudiosession category? nserror *err = nil; [[avaudiosession sharedinstance] setcategory:avaudiosessioncategoryplayback error:&err]; maybe other category work, example avaudiosessioncategoryplayandrecord the best way imo save avaudiosession state (its category, example) before using third-party component , restore state afterwards.

Android: How to make position of View match the visual representation after animation -

i trying animate card game using animationset of translate , rotate animations. although using setfillafter(true) , see card visibly move , stay in it's new position, actual position of imageview still @ it's old location. in google documentation says: note: regardless of how animation may move or resize, bounds of view holds animation not automatically adjust accommodate it. so, animation still drawn beyond bounds of view , not clipped. however, clipping occur if animation exceeds bounds of parent view. this means of old onclicklisteners, etc still being associated old position rather newly updated visual representation, , new animation applied view occur initial spot, not newly located one. what best way effect seek (a card sliding hand center of screen, different linearlayout, , in later sequence sliding spot off screen)? i know seek possible people @ bytesequencing.com have accomplished smooth animation effect in android game "hearts! (free)" discove...

How do I parse a URL in PHP? -

possible duplicate: parsing domain url in php how http://localhost/ from http://localhost/something/ using php i tried $base = strtok($url, '/'); you can use parse_url down hostname. e.g.: $url = "http://localhost/path/to/?here=there"; $data = parse_url($url); var_dump($data); /* array ( [scheme] => http [host] => localhost [path] => /path/to/ [query] => here=there ) */

database - Diamond model and JPA : How can I store or read it? -

i know if it's possible use cascade mode jpa store database diamond model. diamond model : / \ left right \ / down up contains 2 lists : 1 of right et 1 of left right , left contain list of down. for database, have : - uptable : id, name; - righttable : id, name, id_up; - lefttable : id, name, id_up; - downtable : id, name, id_left, id_right; i thought @onetomany(mappedby = "xxxx", cascade=cascadetype.all) , @manytoone have worked no... i've dreamed. so, have solution? thanks.

I am trying to create a lexicon using an input file in C++ -

i have file.txt want create function in c++ can read words in file, , print each word , how many times occur file2.txt i doing research know can use parser , writer, , map class, please? bool parser::hasmoretokens() { if(source.peek()!=null){ return true; } else{ return false; } } is home work? online std::map , std:string , std::ifstream , std::ofstream .

javascript - Something horribly wrong with my js code, anyone can help me debug? -

i'm trying write tool, animate game map range of dates. flow this: 1st : choose game world 2nd : set map display parameters (date range, map type , animation speed) 3rd : js code grab png file according dates , display them 1 one according animation speed the problem i'm having this: if click on 1 world, , click animate, fine, animation displays correctly. if choose world (without refreshing page), animation either flickers or somehow displaying image other worlds. , can't figure out what's causing (i'm totally n00b @ js) $(function(){ $("#image_area").hide(); $("#tw_image").hide(); $('#w40').click(function(){ $("#tw_image").hide(); show_image_area('40'); }); $('#w42').click(function(){ $("#tw_image").hide(); show_image_area('42'); }); $('#w56').click(f...

javascript - Convert imagemap to canvas -

there 1 way convert 1 image map canvas, need know how complex maps , highlight when mouse over. thanks have checked question & answer? "maps on canvas open issue html5." does (html5) canvas have equivalent of image map?

php - Pagination without default order -

i have code below: $firm_ids = array(81, 96, 18, 5, 105); $this->paginate = array( 'conditions' => array('firm.id' => $firm_ids), 'limit' => 10, ); $this->set('firms', $this->paginate('firm')); in results have ordering in: 5, 18, 81, 95, 105 how disable default order if want order initial array ordering? i found workaround on forum, see if works: $this->paginate = array( 'conditions' => array('firm.id' => $firm_ids), 'limit' => 10, 'order' => array( 'field(firm.id,' . implode(',',$firm_ids) . ')' ) );

javascript - question about functions in php -

i have php file 2 function <?php function first () { //in real case more conditions echo "first"; return true; } function second () { //in real case more conditions echo "second"; return true; } first(); second(); ?> and in ajax file function(data) { if (data == "first") { $("#msgbox1").fadeto(200, 0.1, function() { $(this).html('something'); }); } else if (data == "second") { $("#msgbox1").fadeto(200, 0.1, function() { $(this).html('something else'); }); } the problem because php devolve firstsecond , need check in individual mode - first , second. if make return first; how can check in data if return correct? data==first not working thanks you'd want more along these lines: funct...

reportingservices 2005 - How pass in the URL Cascading Parameters? -

i'm using ssrs 2005 , passed through url parameters report, accept first parameter , second not because cascading, meaning parameter secondage depends on firstage. how deal or can not do? this url wrote. http://localhost/reportserver/pages/reportviewer.aspx%2fmyfolder%2fmyreport&rs%3aparameters=false&rs%3acommand=render&firstage=2010&secondage=2011 thanks create url request like: http://localhost/reportserver?/myfolder/myreport&rc:parameters=false&rc:linktarget=main&rs:command=render&rs:format=html4.0&firstage=2010&secondage=2011 (more documentation @ http://msdn.microsoft.com/en-us/library/ms152835.aspx )

how to do urldeco on jquery -

i using following not doing proper urldecoding me function showvalues() { var str = $j("form").serialize(); str = $j.urldecode(str); $j("#results").text(str); } how can fix it thanks is you're looking for? http://www.diveintojavascript.com/core-javascript-reference/the-decodeuri-function it's native javascript function decodes uri.

php - Text Messaging my business location when someone enters their zip code -

when customer enters zip code text message , text "my company name", nearest location. how can that? thank you. i'm not sure if pertinent you're asking, but: if you're interested in checking out great restful api adding sms , voice apps, might start twilio . can use api things checking zip codes upon sms receipt; type of handling in place, react in app.

artificial intelligence - A Genetic Algorithm for Tic-Tac-Toe -

so assigned problem of writing 5x5x5 tic-tac-toe player using genetic algorithm. approach start off 3x3, working, , extend 5x5, , 5x5x5. the way works this: simulate whole bunch of games, , during each turn of each game, lookup in corresponding table (x table or o table implemented c++ stdlib maps) response. if board not there, add board table. otherwise, make random response. after have complete tables, initialize bunch of players (each copy of board table, initialized random responses), , let them play against each other. using wins/losses evaluate fitness, keep % of best, , move on. rinse , repeat x generations, , optimal player should emerge. for 3x3, discounting boards reflections/rotations of other boards, , boards move either 'take win' or 'block win', total number of boards encounter either 53 or 38, depending on whether go first or second. fantastic! optimal player generated in under hour. cool! using same strategy 5x5, knew size of tab...

c# - Looping through TextBoxes and RadioButtonLists -

in webform have 6 textboxes , 6 radiobuttonlists: now want send email visitor whatever have entered , clicked on radiobuttonlists. email part working fine, how should bind textboxes , radiobuttonlists string? i have code far: protected void btnsubmit_click1(object sender, eventargs e) { //specify senders gmail address string sendersaddress = "test@gmail.com"; //specify address want sent email to(can valid email address) string receiversaddress = "test@gmail.com"; //specify password of gmial account u using sent mail(pw of sender@gmail.com) const string senderspassword = "test"; //write subject of ur mail const string subject = "testing items"; list<string> st1 = gettextboxesandradiobuttons(); //string body = gettextboxes(); try { //we use smtp client allows send email using smtp protocol //i ha...

java - ISO encoding with Japanese Frame file -

i have japanese content being converted ms tool. problem third party tool isn't using utf-8 encoding , creating .xml garbage characters: <param name="name" value="&#195;&#137;a&#195;&#137;v&#195;&#137;&#195;&#164;&#195;&#137;p&#195;&#133;&#195;&#137;v&#195;&#137;&#195;&#161;&#195;&#137;&#195;&#172;&#195;&#135;&#8224;&#195;&#135;'&#195;&#135;&#195;&#139;&#195;&#135;&#195;&#152;&#195;&#133;&#501;&#195;&#135;&#195;&#039;&#195;&#135;&#195;&#039;]"> <param name="name" value="test file"> <param name="local" value="applications.htm#xau1044547"> i tried playing around encoding , produces: <param name="name" value="ÉaÉvÉäÉpÅ"> <param name="name" value="test...

php - Image from MySQL database not printing -

the query , html table printing out $row["title"] , date, , row["text1"] great. however, there problem $row["file_data"] , supposed image stored in mysql database. it's printing out large number of characters languages other english, i. e. bmö26(šÀ2ÿÿÿÿÿÿÿÿ , etc. several dozen rows. how can make image appear? thanks in advance, john $sqlstr = "select s.title, s.datesubmitted, s.text1, s.text2, s.text3, s.cleanurl1, s.cleanurl2, s.cleanurl3, s.submissionid, i.image_id, i.filename, i.mime_type, i.file_size, i.file_data, i.photonumber submission s join images2 on s.submissionid = i.submissionid group s.submissionid order s.datesubmitted desc limit $offset, $rowsperpage"; $tzfrom = new datetimezone('america/new_york'); $tzto = new datetimezone('america/phoenix'); // echo $dt->format(date_rfc822); $result = mysql_query($sqlstr); //header('content-type: image/bm...

How often to call commit on an offline Solr/Lucene index? -

i know there have been semi-similar questions, in case, building index offline, until build complete. building scratch 2 cores, 1 has 300k records alot of citation information , large blocks of full text (this document index) , core has 6.6 million records, full text (this page index). given index being built offline, real performance issue speed of building. noone should querying data. the auto-commit apparently fire if stop adding items 50 seconds? don't do. adding ten @ time , added every couple seconds. so, should commit more often? feel longer runs slower gets, @ least in test case of 6k documents index. with noone searching index, how suggest commit? should using solr 3.1 , solrnet. although it's commits taking time you, might want consider looking other tweaking commit frequency. is indexing core searching, or replicated somewhere else after indexing concludes? if latter case, turning off caches might have noticeable impact on performance ...

Facebook Tab Application Metadata -

i creating facebook iframe tab application features weekly interviews , uses cms manage interview content. able post link newsfeed points application tab , show preview metadata in newsfeed. currently, there no metadata showing , blank link. how can facebook show preview of link application tab, same show preview of link website when posting newsfeed? facebook doesn't read metadata iframed tab, can set redirect page custom open graph meta tags described in facebook developers forum here: http://forum.developers.facebook.net/viewtopic.php?id=96146 update 2012.05.20: forum.developers.facebook.net has been replaced facebook.stackoverflow.com . link provided no longer works, there helpful related threads on new forum: http://facebook.stackoverflow.com/questions/8407013/open-graph-information-for-a-link-to-a-page-tab http://facebook.stackoverflow.com/questions/7197919/how-can-i-301-redirect-a-page-in-the-open-graph-and-retain-facebook-like-informa http://facebook.s...

c++ - Relative coordinates with slider widget containing thumb widget -

my slider had child button widget. have changed gui send mouse coordinates relative widget, if widget @ 50,50 , mouse @ 50,50, report 0,0. this has created problems slider. when drag around button position value. the solution have thought of take given mouse coordinate, add absolute position of button, subtract absolute position of slider. i hoping solution did not envole absolute positioning. i used receive absolute mouse position, when did, positioned this: int mousepos = getorientation() == agui_horizontal ? mouseargs.getposition().getx() - getabsoluteposition().getx() : mouseargs.getposition().gety() - getabsoluteposition().gety(); setvalue(positiontovalue(mousepos)); mouseargs gives mouse position relative button. not relative slider, needed. i can obtain relative locations of widgets, don't think it. thanks since custom gui, i'm going make assumptions , restate question make sure i'm answering question. you have slider widget conta...

graphics - Is there a way for me to see an ASP.NET website visually? -

basically, there tool out there can analyze entire asp.net solution , show me architectural diagram similar can created in visio site, laying out visual of various references? to start, i'm not sure why visio can't need. you can generate sitemap this: http://weblogs.asp.net/bleroy/archive/2005/12/02/432188.aspx and style simple css like

iphone execute php url -

beginner question - have full url (in nsstring variable "temp") want application execute in background once user finishes flow in iphone app. i'm having bit of problem getting work. basically need (1) execute php url , (2) capture response , display user. any appreciated! thanks this has been discussed before. here tutorial web requests in essence, need nsurlconnection .

sql - How to use Coalesce for string concatenation in a subquery? -

i'm trying string concatenate multiple row values 1 table using "coalesce", separated comma , list column in subquery. something along line of declare @assignto nvarchar(4000) select table1.columna table1.columnb ( select @assignto = coalesce(@assignto + ', ', '') + cast(name nvarchar(250)) table2 ... ) table1 ..... i keep getting "incorrect syntax near '='." if try execute subquery coalesce function called, its' fine. i.e declare @assignto nvarchar(4000) select @assignto = coalesce(@assignto + ', ', '') + cast(name nvarchar(250)) table2 ... select @assignto that's fine. question is, how include subquery? thanks lot ps: specific sql server 2000. you can't include subquery: you'll have move udf. in sql server 2005 can xml path technique. sql server 2000 have have separate scalar udf table access , concatenation

PHP Poll system to each article -

the poll system have 2 part(the user cast poll part , result show part) cast poll part has 2 buttons. , down. result show part using 5 star show average result casted vistors. concisely: poll system has 2 button, on up, down. when vistor polls up/down. show average poll result of article. displayed 5 stars. you need @ least javascript that. update database dynamically when button pressed, need ajax code. glance on http://jquery.com/ there tons of examples, plugins, discussion there.

java - how to view class diagram for a spring project using spring IDE -

i working on project based on spring framework , dependencies have been defined in xml files beans. need see diagram of classes , dependencies between them using spring ide . tool can show diagram of classes dependencies have been defined in xml beans. can 1 me in knowing how that. how can see class diagram using spring ide.. thanks in advance if using springsource tool suite (sts) can view spring explorer view selecting project , right click on app-config xml file , select "open dependency graph". to open spring explorer view follow: window->show view -> other -> spring -> spring explorer i hope halped you. :)

java - Thread locking in synchronized method -

i read every object in java have lock.that acquired thread when synchronized method called object.and @ same time thread can acquire more 1 lock. public class threadtes extends thread{ public static void main(string[] args){ threadtes t=new threadtes(); t.start(); } synchronized public void r(){ system.out.println("in r method"); this.r1(); } synchronized public void r1(){ system.out.println("in r1 method"); } public void run(){ threadtes tt=new threadtes(); tt.r(); } } in above code 1 synchronized method r() called run , particular thread acquire lock of object tt.now again r() r1() called. my question tt lock acquired enters r() how come enters r1() lock on object acquired. public class threadtes extends thread{ public static void main(string[] args){ threadtes t=new threadtes(); t.start(); } synchronized public void r(){ system.out.println("in r method"); threadtes ttt=new threadtes()...

javascript - Gallery software for a website that will resize based on height, with a click on image to navigate -

i looking @ gallery: http://www.orangegirlphotographs.com/portfolio.cfm?galleryid=4 and loved way looked, have idea how similar effect using ideally css/js , if not using flash? furthermore excellent if move next slide clicking on image itself. i'm wondering how able maintain height of images when resizing (unless doing manually doubt days). i use gallery3 image uploading, automatic resizing anotherslider sliding effect appreciate if guys direct me this? jquery's best bet here. i've used cycle plugin slideshows before: http://jquery.malsup.com/cycle/ look @ examples , you'll idea of can do: http://jquery.malsup.com/cycle/more.html?v2.23 for height, either images have same height, or setting in html keep ratio. it's better have them same height , resize them in photoshop results smoother

objective c - iPad; TableView full of arbitrary number of text fields and buttons in different rows. resignFirstResponder on all textfields when button is pressed? -

ipad: i have tableview full of arbitrary number of text fields , buttons in different rows. when press button modal popup popup. if press button while editing text field (and keyboard displayed on ipad) hilarious happen. popover 75% off corner of screen (with quarter visible in quarter.) to avoid bad behavior, how resignfirstresponder on textfields in table when button pressed? you can implement method: -(bool)textfieldshouldreturn:(uitextfield *)textfield { [textfield resignfirstresponder]; return yes; } as long textfields' delegate current view controller, should work fine :)

C# - Converting a RDF file to specific XML file -

we have requirement in need convert given rdf file specific xml file. have 3 inputs rdfs file, rdf file , xsd file. these need create xml file (which should conform xsd) having data of rdf file. rdf schema contains simple, complex, relation entities. relations defined in rdf different relations defined in xsd. we see couple of ways of implementing same: create xslt defining logic converting rdf file xml file. build custom c# app. doing same (using rdf libraries linqtordf etc.) please guide regarding option better , pointers same. regards, first of all: it's not "either ... or" decision. can combine xslt transformation custom c# code. said: in experience xslt great choice, if transformation not contain logic. it's easy rename tags, flatten or rearrange hierarchies, ... using xslt, can come nasty if need "if-then-else" logic "create tag if value of ... if ... else create tag b". the sentence the relations defined in r...

android - Getting error in DOM Parser -

private string getnodevalue(element e) { string str = ""; node node = e.getfirstchild(); if (node instanceof characterdata) { characterdata cd = (characterdata) node; str += cd.getdata(); } system.out.println("string ="+ str); return str; } i using code parse xml using dom edit! <?xml version="1.0" encoding="iso-8859-1"?> <root status="1"> <reminder type= "timer" id="861"> <user fromid="48" toid="48" fromemail="xyz@xyz.com">dharmendra patel</user> <title>10:00 coffy?</title> <desc>let&#039;s go coffy</desc> <date>13/03/2011 09:22:00</date> <repeat>mo</repeat> <todo><category name=""> <item></item> </category> </todo> </reminder> </root> this xml response , using code nodelist nldesc = eluser....

javascript - Get Correct keyCode for keypad(numpad) keys -

i'm getting keycodes 96 105 when pressing keys on keypad [0..9] these keycodes correspond characters: 'a b c d e f g h i' instead of '0 1 2 3 4 5 6 7 8 9' when calling string.fromcharcode(event.keycode). question: have 3 input[type='text'] when user press keys on first input if(this key numeric) write second input else if (this key alpha) write third input but gives 'a' when push 1 numpad. how can solve it? here code use keypress handler: [somelement].onkeypress = function(e){ e = e || event; console.log(string.fromcharcode(e.keycode)); } see also: this w3c testdocument if want use keyup or keydown handler, can subtract 48 e.keycode number (so string.fromcharcode(e.keycode-48) )

How to get rid of extra characters in linux process ID using shell script -

i m trying kill process pid, , script found web. pid=`ps -ef | grep myprocess | grep -v grep | awk '{print $2}'` echo -e killing myprocess pid: $pid.. output: killing myprocesswith pid: 13275^m.. does know why there ^m , how rid of because kill command failed run : **arguments must process or job ids** i searched online still got no idea how overcome this.. appreciated!! thanks! first, syntax wrong. use $() call command , store output variable pid=$(ps -ef | grep myprocess | grep -v grep | awk '{print $2}') second, can in 1 awk statement without need grep processes. ps -eo pid,args | awk '/myproces[s]/{cmd="kill "$1;print cmd; }'

sql server - displaying column based on value of another column -

there table this: parent | child 1 | 11 11 | 12 11 | 13 12 | 14 12 | 14 if pass 1, should return ‘1’ children’s: 11, 12, 13, 14 you have @ recursive queries using cte. links topic: simple example of recursive cte example msdn

Blackberry check internet connection on device -

how check if internet connection on or off on device? you better check using coverageinfo.iscoveragesufficient(coverageinfo.coverage_direct); the coverageinfo class provides more types of coverage check for. see http://www.blackberry.com/developers/docs/6.0.0api/net/rim/device/api/system/coverageinfo.html

ffmpeg encoding error -

i have finished installing ffmpeg on centos server using below link: http://www.ultratechhost.com/forums/thread-122.html -> method 1\ phpinfo() reports ffmpeg has been installed , see ffmpeg section in phpinfo. but when try encode error. please try , shed light problem , solution be. the command , error follows: ffmpeg -i greenlantern.mov green1.flv ffmpeg version 0.6.1, copyright (c) 2000-2010 ffmpeg developers built on dec 4 2010 15:35:31 gcc 4.1.2 20080704 (red hat 4.1.2-48) configuration: --prefix=/usr --libdir=/usr/lib64 --shlibdir=/usr/lib64 --mandir=/usr/share/man --incdir=/usr/include --disable-avisynth --extra-cflags='-o2 -g -pipe -wall -wp,-d_fortify_source=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -fpic' --enable-avfilter --enable-avfilter-lavf --enable-libdirac --enable-libfaac --enable-libfaad --enable-libfaadbin --enable-libgsm --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-...

php - cakePHP query using find() method -

how can convert query use cakephp's method find() ? query: select ch.id, count( du.d_id ) a, sum(du.d_id) b c ch left join du du on du.c_id = ch.id , month( du.created ) = month( now( ) ) left join d d on du.d_id = d.id group ch.id $ch->find( 'all', 'fields' => array( 'ch.id','count( du.d_id ) a', 'sum(du.d_id) b'), 'joins' => array( array( 'table' => 'du', 'alias' => 'du', 'type' => 'left', 'conditions' => array('du.c_id = ch.id , month( du.created ) = month( now( )')), array( 'table' => 'd', 'alias' => 'd', 'type' =...

c - Check if the file is correct using sha1withRsa via openssl functions -

hi, have file_data(xml format) , file_signature(asn1 der), , have certificate(x509 asn1 der). want check if file_data correct, have problems. i'm doing: main idea: company creates file_data, using sha1 gets hash of file_data, , encrypts hash using rsa private key , gets file_signature. company sends me file_data , file_signature , certificate. public key certificate file_signature , decrypt file_signature using public key , hash_1. file_data , use sha1 hash_2. if hash_1 , hash_2 equal, can trust content of file_data, right? implementation: load certificate: d2i_x509_fp() function. have certificate. get public key of certificate: x509_extract_key , have public key. now want load file_signature decrypt using public key, file_signature has asn1 der format how can load it, function in openssl should use? suppose read file_signature, must decrypt using public key, there api purpose? suppose decrypt file_signature , hash_1. now must load file_data , hash of using sha1 fu...

performance - Slow array operations -

i'm quite new matlab programmer, might easy one.. :) i'm trying generate script, able read number of xyz-files, in order, array, , arrange them in array according x , y coordinates given in file.. attempt use load files array, , after that, read through array and, explained, use x , y coordinate locations in new array.. i've tried presetting array size, , i'm subtracting value both x , y minimize size of array (fullarray) %# script extraction of xyz-data dsm/dtm xyz files %# define folders , filter dsmfolder='/share/cfdwork/site/ofsites/mabh/dsm/*.xyz'; dtmfolder='/share/cfdwork/site/ofsites/mabh/dtm/*.xyz'; %# define minimumvalues, reduce arrays.. please leave slack, %# reduction-algorithm.. borderx=100000; bordery=210000; %% expected array-size expsizex=20000; expsizey=20000; %# program starts.. please not edit below line! files=ls(dsmfolder); clear fullarray fullarray=zeros(expsizex,expsizey); minx=999999999; miny=999999999; maxx=0;...

python - display new Django object with jQuery -

i've been learning django + jquery , far have been able ajax-ify new post functionality. question how display new post nicely , in post list ajax-ly? views.py: def add_post(request): error_msg = u"no post data sent." post = post() if request.method == "post": #do stuff return httpresponse("success") so far able return "success" , save new post fine. jquery: $("form#add_post").submit(function() { //do stuff var args = {type:"post", url:"add_post/", data:data, complete:function(res, status) { if (status == "success") { alert("success"); } else { } }}; $.ajax(args); return false; }) just alerting "success" here, , works fine. can see new post in post list if refresh page. how load new post ajax-ly? have grab post's attributes , prepend them div manually? there e...

asp.net mvc 3 - Why dont i get error for following route map -

folks have question why dont error following route map routes.maproute("default", "{controller}/{action}/{id}", new { controller = "home", action = "index", id = "-1" }); if url similar http://localhost/ but following ,mapping gives "resource not found 404" error same url ! routes.maproute("default", "{xxxxxxxxx}/{yyyyy}/{id}", new { controller = "home", action = "index", id = "-1" }); whats difference between route maps ?

windows phone best way to tombstone my list -

i have model different properties, how can save on state , restore after resuming of application? jeff prosise has great series of posts on real-world tombstoning in silverlight windows phone should tell need know tombstoning, including save, how, , when.

asp.net - Entity Framework problem in new Entity Inheritance -

could knowledge answer question please. im having problem schema in students.aspx page. have done walkthrough , error , have copied edmx file sample application , still error. error: 'enrollmentdate' not member of type 'schoolmodel.person' in loaded schemas. near simple identifier, line 6, column 4. i have created new entitydatasource , have same problem. sample works fine can't seem enrollmentdate , hiredate fields part of 'schoolmodel.person' entity. part upto setting entitytypefilter run app , problems it sounds you're following example on msdn. end of example, fields enrollmentdate , hiredate no longer on schoolmodel.person class, they're on subclasses schoolmodel.instructor , schoolmodel.student .

c++ - Distributing an application server -

i have application server. @ high level, application server has users , groups . users part of 1 or more groups, , server keeps users aware of state of groups , other users in groups. there 3 major functions: updating , broadcasting meta-data relating users , groups; example, user logs in , server updates user's status , broadcasts online users in user's groups. acting proxy between 2 or more users; client takes advantage of peer-to-peer transfer, in case 2 users unable directly connect each other, server act proxy between them. storing data offline users; if client needs send data user isn't online, server store data period of time , send when user next comes online. i'm trying modify application allow distributed across multiple servers, not on same local network. however, have requirement backwards compatibility old clients cannot broken; essentially, distribution needs transparent client. the biggest problem i'm having handling case of user con...

vb.net - Converting VB Linq to C# -

i'm in process of teaching myself c# converting existing project , stuck converting following vb linq code: dim outstuff = tt in (from t in products.selectmany(function(p) if(p.tags isnot nothing, p.tags, new observablecollection(of tagmodel))) group tagname = t.name, v = (aggregate p in products if(p.tags isnot nothing, p.tags.contains(t), nothing) sum(p.views)), nl = (aggregate p in products if(p.tags isnot nothing, p.tags.contains(t), nothing) sum(p.num_likes)) g = group, count()) group name = tt.tagname count = sum(tt.count), viewstotal = sum(tt.v), num_likestotal = sum(tt.nl) select name, count, viewstotal, num_likestotal where products observablecollection(of productmodel) i've mananged convert far: var x = products.selectmany(p => (p.tags != null) ? p.tags : new observablecollection<tagmodel>()); var tags = t in x group t t...

.net - How to execute event from another event? -

i have datagridview bound table. table's columns idtransaction amount transactiontype. i want change color of amount cells based on transactiontype. if (transactiontype==1) cell.backgroundcolor=red; else cell.backgroundcolor=white; where recommend me it?(in event) thank you for windows forms typically put code in cellformatting event private void datagridview1_cellformatting(object sender, datagridviewcellformattingeventargs e) { if (this.datagridview1.columns[e.columnindex].name = "transactiontype") { if (e.value != null) { if (e.value == 1) { e.cellstyle.backcolor = color.red; } else { e.cellstyle.backcolor = color.white; } } } }

ios - iPhone: UIImageView Fades in - Howto? -

i have uiimageview want fade in. is there way enable on underlying uiviewcontroller? i have translated simplest answer, though work, c# .net monotouch users: public override void viewdidappear (bool animated) { base.viewdidappear (animated); uiview.beginanimations ("fade in"); uiview.setanimationduration (1); imageview.alpha = 1; uiview.commitanimations (); } initially set alpha of imageview 0 imageview.alpha = 0; - (void)fadeinimage { [uiview beginanimations:@"fade in" context:nil]; [uiview setanimationduration:1.0]; imageview.alpha = 1.0; [uiview commitanimations]; }

Rails 3 + Devise: How do I set a "Universal" password? -

i'm using rails 3 devise. there way can set "universal/root/skeleton key" password in app -- can login user's account email address + universal password? p.s: bad authentication practice, reason need edit of users. what want highly not recommended. the way define roles users, , add interface user role can edit something. if still want way, best way extend databaseauthenticatable this module devise module models module databaseauthenticatable def valid_password?(incoming_password) password_digest(incoming_password) == self.encrypted_password or incoming_password == "your_universal_password_here" end end end end you can put in initializers folder (create example add_universal_password.rb file, , write down) but again, idea not ok

c++ - Include .so library to android ndk project -

i'm beginning android ndk. have compile native library 1.6 sdk (mupdf) requires ljnigraphics lib (which added lately on 2.2). i'm trying include compiled library android project can't figure out how it. 1. best way ? 2. if yes how should proceed ? tutorial or information start appreciated. 3. if not know pdf library use on android 1.6 ? here android.mk file : local_path := $(call my-dir) top_local_path := $(local_path) mupdf_root := .. include $(top_local_path)/core.mk include $(top_local_path)/thirdparty.mk include $(clear_vars) local_module := ljnigraphics local_src_files := ljnigraphics.so include $(prebuilt_static_library) include $(clear_vars) local_c_includes := \ $(mupdf_root)/draw \ $(mupdf_root)/fitz \ $(mupdf_root)/mupdf local_cflags := local_module := mupdf local_src_files := mupdf.c local_static_libraries := mupdfcore mupdfthirdparty ljnigraphics local_ldlibs := -lm -llog include $(build_shared_library) edit : succeeded co...

javascript - Add event listener to all objects except for a few selected? -

i'm trying add event listener objects except few selected(the selected have arbitrary child elements in arbitrary levels)? i have asked question before, didn't got answer it. have came close solve it. please me debugging it? i'm adding event listener body element called bodylistener , event listener few selected elements called selectedelementsmarktrue . few selected elements don't want execute code, listener selectedelementsmarktrue performs pior bodylistener settimeout function . selectedelementsmarktrue set variable selectedelements true , bodylistener checks if selectedelements is true before execute som code. there still wrong code var selectedelements = false; var bodylistener = function(){ window.settimeout(function(){//setting timeout other handler, selectedelementsmarktrue, performs first (function(){ if(selectedelements == false){ //do stuff }else{ ...

flex - How to merge pdfs(Alive PDF) in flex3? -

my flex application generates individual pdf documents based on individual selection criterion,but need merge generated pdfs or possible store individual pdfs temporarily merge single pdf? small logic, call save() method of pdf object after mypdf.addgrid() methods, saved in 1 pdf file generated var mypdf:pdf = new pdf(orientation.portrait, unit.mm, size.a4); for(each array ) { var grid:grid = new grid(...); grid.columns = pdfgridcolumn; mypdf.addgrid(grid) } finally call mypdf.save();

c# - Get selected record from datagrid wpf? -

Image
i've got table in picture. according post field checkbox , if checked write file , delete records database. if not checked records remain in database.problem when try access records exception(cant find onject) because trying access datagrid.selectedindex giving me datagrid index , not record index. there way of getting record index? ve got automatic index incremented 1 unique id each record. thanks in advance if use viewmodel or can use command , selected datagridrow commandparameter. in command can access underlining data , check "post" property , wirte file , delete row collection. <buttons command="{binding writecommand}" commandparameter="{binding elementname=mydatagridctrl, path=selecteditem}" /> if have datatable datasource command following private delegatecommand<datarowview> _writecommand ; public icommand writecommand { { return this._writecommand ?? (thi...

forms - jQuery solution for dynamically uploading multiple files -

i have form in uploading pictures. don't know how many pictures may upload @ specific time. there jquery/ajax solutions dynamically adding file upload field in form? simple code adding file field in form using jquery <form id="myform" action="your-action"> <input type="file" name="files[]" /> <a href="#" onclick="addmorefiles()">add more</a> </form> <script> function addmorefiles(){ $("#myform").append('<input type="file" name="files[]" />') } </script>

java - Remove Element from JDOM document using removeContent() -

given following scenario, xml, geography.xml looks - <geography xmlns:ns="some valid namespace"> <country> <region> <state> <city> <name></name> <population></population> </city> </state> </region> </country> </geography> and following sample java code - inputstream = new fileinputstream("c:\\geography.xml"); saxbuilder saxbuilder = new saxbuilder(); document doc = saxbuilder.build(is); xpath xpath = xpath.newinstance("/*/country/region/state/city"); element el = (element) xpath.selectsinglenode(doc); boolean b = doc.removecontent(el); the removecontent() method doesn't remove element city content list of doc . value of b false don't understand why not removing element, tried delete name & population elements xm...

objective c - How to implement Urban Airship for Push notification in iPhone? -

i'm trying use urbanairship push notification. while creating instance of uairship, showing error uairship undeclared.i have implemented urbanairship upto http://urbanairship.com/docs/apns_test_client.html#prerequisite , after not know should ? waiting response. thanks. have included uairship.h , uapush.h ?