Posts

Showing posts from January, 2011

Does Matlab execute a callback when a plot is zoomed/resized/redrawn? -

in matlab, update data plotted in set of axes when user zooms plot window. example, suppose want plot particular function defined analytically. update plot window additional data when user zooms traces, can examine function arbitrary resolution. does matlab provide hooks update data when view changes? (or when redrawn?) yes, does. zoom mode object has following callbacks: buttondownfilter actionprecallback actionpostcallback the latter 2 executed either before or after zoom function. set update function in actionpostcallback , you'd update plot according new axes limits (the handle axes passed second input argument callback).

java - Posting updates to "a" wall -

i have facebook 'like' application - virtual white board multiple 'teams' share 'wall' common project. there 9-12 entities capture data. i'm trying have user's homepage display update of activities have happened since past login - how facebook posts notifications: "[user] has done [some activity] on [some entity] - 20 minutes ago" where [...] clickable links , activities (rather only) crud. i'll have persist these updates. i'm using mysql backend db , thought of having update table per project store activities. seems there needs 1 trigger per table , redundant. more it's difficult nail down tabular schema update table since there many different entities. the constraint use mysql i'm open other options of "how" achieve functionality. any ideas? ps: using jquery + rest + restlet + glassfish + mysql + java it doesn't have handled @ database level. can have transaction logging service call in

python - pymysql fetchall() results as dictionary? -

is there way results fetchall() dictionary using pymysql? pymysql includes dictcursor . think want. here's how use it: import pymysql connection = pymysql.connect(db="test") cursor = connection.cursor(pymysql.cursors.dictcursor) cursor.execute("select ...") https://github.com/pymysql/pymysql/blob/master/pymysql/tests/test_dictcursor.py

Efficient pagination with MySQL -

i'm trying speed pagination of data on site. i'd use following query, when explain says needs scan on 40,000 rows: select `item`.`id`, `user`.`id` `items` `item` left join `users` `user` on (`item`.`submitter_id` = `user`.`id`) `item`.`made_popular` < "2010-02-08 22:05:05" , `item`.`removed` != 1 order `item`.`made_popular` desc limit 26 but if add lower bound "made_popular" field needs scan 99 rows (the number of items between 2 dates). select `item`.`id`, `user`.`id` `items` `item` left join `users` `user` on (`item`.`submitter_id` = `user`.`id`) `item`.`made_popular` < "2010-02-08 22:05:05" , `item`.`made_popular` > "2010-02-07 22:05:05" , `item`.`removed` != 1 order `item`.`made_popular` desc limit 26 both queries use index have on "made_popular" column. in both cases shouldn't need scan 26 rows, assuming there no "removed" items? guess solution go second que

C -> sizeof string is always 8 -

#include "usefunc.h" //don't worry -> lib wrote int main() { int i; string given[4000], longest = "a"; //declared new typdef. equivalent 2d char array given[0] = "a"; printf("please enter words separated rets...\n"); (i = 1; < 4000 && !stringequal(given[i-1], "end"); i++) { given[i] = getline(); /* if (sizeof(given[i]) > sizeof(longest)) { longest = given[i]; } */ printf("%lu\n", sizeof(given[i])); //this returns eight!!! } printf("%s", longest); } why return 8??? there no string data type in c. c++? or string typedef? assuming string typedef char * , want strlen , not sizeof . 8 getting sizeof size of pointer (to first character in string).

xcode - iOS remote provisioning? -

right now, way can test app on device physically plug laptop, , build/deploy xcode directly it. there way can remotely without physically plugging device mac? to second moshe , clay said, can use number of services provide over-the-air distribution. testflight fully-featured service provides team , beta campaign management in addition over-the-air distribution. hosted service there no setup. hockey similar in execution , great job well. haven't used hockey, can't speak it's full feature set. full disclosure, 1 of mobile devs on testflight.

java - Ehcache write-behind caching thread-priority -

i'm trying use ehcache write-behind caching write batches of transactions database. need write-behind cache dump transactions @ 5 second intervals (or more often). i must missing something, because try might, won't work. set write-behind caching, , put load onto server. thousands, , hundreds of thousands of transactions later, , after waiting several minutes, there still nothing in database. isn't until shut down load on server cache begins writing database. is problem thread-priority? there way modify ehcache perform db writes when server under load? here configuration: <cache name="server.db.model.request" maxelementsinmemory="10000" eternal="false" timetoidleseconds="5" timetoliveseconds="5" overflowtodisk="false" memorystoreevictionpolicy="fifo"> <cachewriter writemode="write_behind" maxwritedelay="5" ratelimitpersecond="5" writecoalesc

iphone - iad on spitview controller -

can add iad on ipad splitviewcontroller? if yes how? thanks, shyam paramr according documentation, use predefined constants set size of iad view. these constants representative of width of screen , small height, 65 pixels. seem then, iad not compatible uisplitviewcontroller. i suggest taking peek @ the iad adbannerview documentation . may achieve want. (you can try putting iad beneath splitviewcontroller, since view view, no matter subclass of uiviewcontroller is.)

Denial of permission while deleting SQL Server 2005 Express database file on Vista -

i using ms sql server 2005 dbms winforms app. data stored in encrypted archives containing .mdf , .log files. app running admin rights. while app using given data file, .mdf , .ldf files extracted users temp folder , attached dbms. when file closed app menu, db detached , db files archived original archive file, , deleted users temp storage. everything has been working fine on win7, xp , vista machines. on of clients vista machines denial of access errors logged, while app moving detached .mdf , .ldf files archive them. @ same time there no such errors on other machines, having same os (vista) , antivirus (avast) the main things check are: be sure have admin rights. if pcs on different domain, check "administrator" gives rights think you'll get. sql server may still have database files open. may simple waiting few seconds after dismounting sure it's finished before start working on database files. a better approach may ask sql server handle dat

Insert new values in Sub-Arrays in PHP -

i have array this: array( 'person0' => array( 'name'=>'name0','address'=>'address0' ), 'person1' => array( 'name'=>'name1','address'=>'address1' ), 'person2' => array( 'name'=>'name2','address'=>'address2' ) ); i want change this. (just append new value in each sub-array) array( 'person0' => array( 'name'=>'name0','address'=>'address0','type'=>'type0' ), 'person1' => array( 'name'=>'name1','address'=>'address1','type'=>'type1' ), 'person2' => array( 'name'=>'name2','address'=>'address2','type'=>'type2' ) ); is there related function in php perform action? shortest way thi

Creating Reports in Silverlight (either as PDF or send it off to a printer) -

i have attempted generate reports in silverlight 4. in problem domain, these reports either need go directly printer and/or client-side sl application creates pdf , allows user store somewhere. as report, it's composed of 50% flow text (incl. enumerations), 30% tables , 20% charts. flow text part makes slighty more challenging, proper line breaking have take place. so far, have tried following approaches - each own shortcomings make them not feasible: silverlight's own printdocument : technically, there 2 major concerns. one, getting page breaks work , printing uielements on proper layout bit of dirty hackjob , full of compromises; thankfully that's part i've managed working far. however, printdocument class renders visuals bitmaps before sending them off; not fun, if 1 uses pdf printer , hopes still able search in / select text. david poll's approach in "silverlight , beyond" [1] wasn't helpful inherently follows same approach , suffers s

android - Multiple layout in one Tabactivity -

how few layout , require create in 1 tabactivity. i have try code below no luck got error. tabhost.addtab(tabhost.newtabspec("sales order").setindicator("sales order").setcontent(r.layout.frm_txn_so_item_list)); ok let me explain clearly. i have code below, can see have 4 tab layout page. each of has own activity class. have button belong cls_so_item_list.class, whenever try call in cls_so return me null value. so have come out idea, remove tab page(item,product,summary,report) activity classes create 1 standalone class cls_so. my question how put layout page inside tabhost.addtab? thanks public class cls_so extends tabactivity implements onclicklistener { protected tabhost tabhost; int intsalesorderid; src_txn_so.cls_so_obj objsalesorder; static final string list_id = "list_id"; @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); tabhost = gettabho

linux - command for filtering files by permissions -

i need recursively search directory in linux(fedora core 12) , filter files based on permissions. but using find -perm able filter files based on specific permissions. eg., files permissions 777 or 007. is possible search wildcards using find -perm command?? e.g., list files read, write, execute permissions 'others'(root , group can have kind of permission). also possible display count of list of files matched filter , not list of files itself?? thanks in advance. is possible search wildcards using find -perm command?? e.g., list files read, write, execute permissions 'others'(root , group can have kind of permission). yes, use -perm -007 minus before 007 , set minimal condition. also possible display count of list of files matched filter , not list of files itself?? command | wc -l instead of command

javascript - Embed js file in another -

how embed following inside js file <script src="http://ajax.googleapis.com/ajax/libs/swfobject/2.2/swfobject.js"></script> you can not embed javascript file in another. can load more javascript files in dynamically function such one. function loadjs(file) { // grab head element var head = document.getelementsbytagname('head')[0]; // create script element var script = document.createelement('script'); // set type script.type = 'text/javascript'; // set source file script.src = file; // add script element head head.appendchild(script); }

php - Can foreach architecture be modified? -

this strange question, it's interesting thought i'd ask. let's don't how php's foreach loop operates , use in format, did added counter outside , used inside foreach loop tell if we're in last element. $counter = 1; $array_size = count($array); foreach($array $item){ //code if($counter == $array_size){ $islast = true } else { $islast = false; } $counter++; } my question is: can override or fork or inherit (or whatever want call that) original php foreach loop include new ability, can this, without need initializing counter , such. newforeach($array $item){ //code $islast = //something returns true/false; } it's interesting idea, wonder if 1 of hardcore php guys here can somehow make possible? or sort of modification way complicated without hacking language itself?! if question "can override implementation of php's language constructs" answer no. feature of other dynamic langauges javas

winforms - C#, background worker class -

when compile code error, object reference set null, , error location in dowork, argumenttest.valueone = 8; public partial class form1 : form { backgroundworker bgw1 = new backgroundworker(); public form1() { initializecomponent(); // bgw1.runworkerasync(test1); test test1 = new test { valueone = 5, valuetwo = 10 }; bgw1.runworkerasync(test1); } class test { public int valueone { get; set; } public int valuetwo { get; set; } } private void bgw1_dowork(object sender, doworkeventargs e) { test argumenttest = e.argument test; thread.sleep(10); argumenttest.valueone = 8; argumenttest.valuetwo = 10; e.result = argumenttest; } private void bgw1_runworkercompleted(object sender, runworkercompletedeventargs e) { test test12 = e.result test; button1.text = test12.valueone.tostring();// +test.va

internet explorer - How to programatically check if a particular version of flash player is installed or not using JavaScript.? -

i have java script code , want check if flash player installed or not , if @ installed version ? requirement demands me achieve without using swfobject. instead want simple javascript code. used following snippet: currentver = new activexobject("shockwaveflash.shockwaveflash.10"); version = currentver.getvariable("$version"); but throwing error msg, file name or class name not found during automation operation i want achieve using javascript coding itself, without downloading software swfobject. using ie. kindly me this. you have of right there, you're missing testing part of it. unfortunately there isn't way access given property tells want. have try create object. function getflashversion(){ var flash = 'none'; // count down 10. for(var = 10; > 0; i--) { try{ flash = new activexobject("shockwaveflash.shockwaveflash."+string(i)); }catch(e){ //console.log(e); } if(flash

java.io.IOException: Permission denied on network folder -

i'm having the post's title error when trying write file on window folder , mounted on unix system. i've developed web service runs inside tomcat 6 on linux os , need write on windows network folder. system administrators have mounted on linux sever , have no problem create , modify file on it. when try execute posted code following exception : permission denied java.io.ioexception: permission denied @ java.io.unixfilesystem.createfileexclusively(native method) @ java.io.file.createnewfile(file.java:850) the weird thing seems related file.createnewfile method on network folder , in fact service can write on local file system without problems, both on debug (the pc use develop service) , tomcat folder system administrators have provided me on linux server. file gets created empty , log entry following create method doesn't printed. if use plain outputstream create , write file i've no problems. i cannot find explanation exception on web. sin

msbuild - Is there any task to copy files from TFS to a folder? -

scenario : need part of deploy scripts have task copy files source origin. now have change source. instead of being normal folder has location in tfs. is there task it? can't find any. i trying files manually tfs using similar to: <propertygroup> <tf>"c:\program files\microsoft visual studio 9.0\common7\ide\tf.exe"</tf> <tfsourcelocation>$/tfsdir</tfsourcelocation> <solutionroot>.</solutionroot> <remotewebroot>$(destinationroot)\dir</remotewebroot> <copy>xcopy /e /i /r /y</copy> </propertygroup> <exec command="$(tf) $(tfsourcelocation) /force /recursive /version:t /noprompt" continueonerror="true" /> i don't have compile anything. need copy files stored in tfs folder. question: best approach? or exists task allows me copy tfs folder? i don't understand question completely, if want download files tfs folder on build server, command

mysql - regular expression how to match with backreference two mixed type string -

assume have 2 strings following. $sa = "12,20,45"; $sb = "13,20,50"; i want check whether of number in sa present in sb reference can numbers , calculation. the numbers nothing unique id's in database. checking whether ids in sa present in list of ids in sb. besides if possible matching , non matching ids nice. doesn't have 1 operation. multiple operations fine.(like executing match twice or more). what trying creating subscribers , assigned groups. i create newsletters , assign groups. if try assign newsletter same group want group id can exempt group , assign newsletter rest. so if group 15,16,17 assigned newsletter , next time trying assign group 15,20,21 want 15 exempted , want newsletter assigned 20,21. and... if mysql example nice. any type of answer if please post it. thx first of all, not problem want solve regex. at.all. second, shouldn't have list of ids values in database, if need on them. it's ineffic

unix - Sed/Awk deleting selective lines -

this may simple question, struggling find solution, provide simple unix sed or awk command delete every 3rd , 4th line of file starting 5th line. if you're using gnu sed, can use first~step address format, eg. sed -e '6~3 d' -e '8~4 d' file deletes 6th line, every 3rd, , deletes 8th line, every 4th.

How to Generate 3x3 HTML Table From an JavaScript Array -

i have array of values in javascript follows: var data = {"a", "b", "c", "d", "e", "f", "g", "h", "i" }; how can generate 3x3 html table following a b c d e f g h var data = ["a", "b", "c", "d", "e", "f", "g", "h", "i" ]; // corrected array syntax var table = document.createelement("table"); var = 0; (var r = 0; r < 3; r++) { var row = table.insertrow(-1); (var c = 0; c < 3; c++) { var cell = row.insertcell(-1); cell.appendchild(document.createtextnode(data[i++])); } } document.body.appendchild(table);

javascript - RTSP stream for QuickTime player does not show movie -

did faced problem when quicktime cannot play streaming video , shows blue question mark instead or errors - 400 (bad request) , 10060 (disconnected)? have tried switch getting stream ufp http protocol custom port in quicktime settings did not help. and know can find streaming video using rtsp protocol testing, links online streams (not downloaded trailers) appreciating. these links not work me due issue mentioned above: http://mac.sillydog.org/qt/mov/embed_stream.php and here last 1 works (among other streaming types) : http://quicktime.tc.columbia.edu/users/iml/movies/mtest.html thanks, links , advices. the best way i've found rtsp streams play in browser window using apple's own javascript. i've tried hard coding tags same parameters, , embed tags won't work, js will. js file called ac_quicktime.js. google , should able find link enough. use 1 apple's site make sure you're getting unmodified code. load in html page, , in body, i

startup - Cannot run Eclipse; JVM terminated. Exit code=13 -

Image
i append -vm c:\program files\java\jre6\bin\javaw.exe in eclipse.ini try start eclipse again , got error. give me how solve or link solve it. this eclipse.ini -startup plugins/org.eclipse.equinox.launcher_1.1.0.v20100507.jar --launcher.library plugins/org.eclipse.equinox.launcher.win32.win32.x86_1.1.1.r36x_v20100810 -showsplash org.eclipse.platform --launcher.xxmaxpermsize 256m --launcher.defaultaction openfile -vm c:\program files\java\jre6\bin\javaw.exe -vmargs -xms40m -xmx384m thank you it may way error shows (and not how written in eclipse.ini file), there text in eclipse.ini (specifying jvm) says following: the -vm option , value (the path) must on separate lines. the value must full absolute path java executable, not java home directory. the -vm option must occur before -vmargs option, since after -vmargs passed directly jvm

rails + paperclip + plupload -

hi i'm using paperclip , plupload in tutorial: http://www.theroamingcoder.com/node/50 it works. if try set thumbnails paperclip like: has_attached_file :data, :styles => { :medium => "558x418>", :thumb => "60x82>" } it doesn't work. receive error: [paperclip] identify -format %wx%h '/tmp/stream20110209-26212-1l2obtp-0.png[0]' 2>/dev/null [paperclip] convert '/tmp/stream20110209-26212-1l2obtp-0.png[0]' -resize "558x418>" '/tmp/stream20110209-26212-1l2obtp-020110209-26212-cl5lbg-0' 2>/dev/null [paperclip] error received while processing: #<paperclip::papercliperror: there error processing thumbnail stream20110209-26212-1l2obtp-0> [paperclip] identify -format %wx%h '/tmp/stream20110209-26212-1l2obtp-0.png[0]' 2>/dev/null [paperclip] convert '/tmp/stream20110209-26212-1l2obtp-0.png[0]' -resize "60x82>" '/tmp/stream20110209-26212-1l2obtp-020110209

c++ - Why is it not possible to define a fully-qualified function within a foreign namespace? May I know what the standard says? -

is wrong? why? may know standard says? namespace n{ namespace n1{ namespace n2{ struct a{ struct b{ void fun(); };//b }; //a } //n2 }//n1 namespace n3{ void n1::n2::a::b::fun(){} //error }//n3 }//n int main() { return 0; } may know why failing? this invalid due §9.3/2: a member function definition appears outside of class definition shall appear in namespace scope enclosing class definition. the scope of namespace n3 not enclose definition of class b

database security on the net ; secure access to monitoring servers -

i facing 2 issues before publishing web application.i have main questions. how protect database publicly accessible on net ? monitoring servers on net. what best secure , flexible way manage staff's authentications on these monitoring servers ? should use ldap system ? more secure use domain name these servers ? thanks in advance helping me :) i can't tell question whether have public-facing web application need secure, or if need secure publicly accessible database. if second, can't (not area of expertise). if first, asking complex topic can't answered thoroughly in forum. check out open web application security project ( http://www.owasp.org ) , start reading up. have lot of relevant , detailed information on securing web applications. specifically, recommend @ development guide ( http://www.owasp.org/index.php/category:owasp_guide_project#tab=downloads ), great starting point.

iphone - How to make UIButton respond only to touch, not drag -

take @ method: [textbutton addtarget:self action:@selector(articlemodalwillappear:) forcontrolevents:uicontroleventtouchdown]; when button touched, calls articlemodalwillappear: . works well. problem button calls action when dragged. (the button big , contains text paragraph) i put 6 such buttons subviews of uiscrollview (with uipagecontrol). works when dragging uiscrollview horizontally. pops modal views when dragging vertically because when finger dragging across button, button considers touch, , touch calls articlemodalwillappear: . if still don't understand problem, think new york times ipad app. can drag pages horizontally. can touch article description go full article view. nothing happens when drag vertically inside article description. how achieve this? use different event e.g.: [textbutton addtarget:self action:@selector(articlemodalwillappear:) forcontrolevents:uicontroleventtouchupinside]; uicontroleventtouchupinside used in case.

javascript - jQuery .click() method not behaving as expected -

i wrote function that, on clicking element, replace div hidden span. when had event handler in "onclick=" attr in tag, function worked fine. tried "fancy" , replace onclick attr jquery's .click() method. now, when try use on page, nothing clunk -- nothing happens. however, if execute exact same code in chrome's js console, works great. here js: $("a#delete").click(function () { $("a#delete").replacewith($("span.hconf").attr("style", "none")) }); here relevant html (the inside div, outside): <a class='modify' id="delete" u="{{ i.id }}" href='#'>delete</a> <span class='hconf' style="display:none;">are sure? <a class='confirm' id='del_conf_true' onclick='deltrue();' href='#'>yes</a> | <a class='confirm' id='del_conf_false' href='#'>no</a></

jquery - how to compare the result of success function of ajax with a string -

$.ajax({ type: "post", url: "test.jsp", data: "user="+name.val(), success: function(msg) { $('#result').hide(); $("#result").html(msg) .fadein("slow"); if( msg =="available") { alert(msg); } } }); test.jsp <h1> <% string user=request.getparameter("user"); if(user.equals("prerna")) out.print("available"); else out.print("not available"); %> </h1> i want compare value returned success function compared string above code not working want add css class "#result" id. alert box not comming. something there blank space. $.trim() function can delete blank spaces. works!

In MySQL, is it possible to have a UNIQUE constraint on a row? -

appears mysql's unique constraint on columns column basis, i'm looking way make sure row unique on row row basis; guessing answer create hash concatenating columns per row want unique unique on column storing hash row. also, rows unless create control unique, since id row surrogate_key; meaning it's integer sequential growing +1 of id of last row's integer. you can create multiple-column unique index.

unix - Extracting word from file using grep or sed -

i have file in format below: file : \\dvtbbnkapp115\nautilus\030db28a-f241-4054-a0e3-9bfa7e002535.dip processed. entries found : 0 unarchived documents : 1 file size : 1 k error : following line not processed. bad document type. error : marketing , contact preference change update||7000003735||078ef1f3-db6b-46a8-bb0d-c40bb2296ab5.pdf file : \\dvtbbnkapp115\nautilus\078ef1f3-db6b-46a8-bb0d-c40bb2296ab5.dip processed. entries found : 0 unarchived documents : 1 file size : 1 k error : following line not processed. bad document type. error : declined - bureau data (process)||7000003723|252204|2f1d71f4-052c-49f1-95cf-9ca9b4268f0c.pdf file : \\dvtbbnkapp115\nautilus\2f1d71f4-052c-49f1-95cf-9ca9b4268f0c.dip processed. entries found : 0 unarchived documents : 1 file size : 1 k error : following line not processed. bad document type. error :

compression - Unzip 4gb file in c# -

i using sharp lib zip , unzip. works fine upto 4gb file looking .net framework solution. tried gzipcompression in dotnet. fails uncompress 4gb files. know other zip library handles large files. thanks dotnetzip handle zip64 archives (>4.2gb) correctly, in 100% managed code. (from testing) has dramatically better feature set , better job framework libraries compression (ie: equal or better perf. smaller files - 1/3rd size of framework's compression routines).

version control - git repository sync between computers, when moving around? -

let's have desktop pc , laptop, , work on desktop , work on laptop. what easiest way move git repository , forth? i want git repositories identical, can continue left of @ other computer. i make sure have same branches , tags on both of computers. thanks johan note: know how subversion, i'm curious on how work git. if easier, can use third pc classical server 2 pc:s can sync against. note: both computers running linux. update : so let's try xani:s idea bare git repo on server, , push command syntax kingcrunch. in example there 2 clients , 1 server. so let's create server part first. ssh user@server mkdir -p ~/git_test/workspace cd ~/git_test/workspace git --bare init so 1 of other computers try copy of repo clone: git clone user@server:~/git_test/workspace/ initialized empty git repository in /home/user/git_test/repo1/workspace/.git/ warning: appear have cloned empty repository. then go repo , add file: cd workspace/ echo "test1

android - Create a simple timer in a game -

i grateful if explain how create simple timer in game starts off @ 30 seconds , goes until 0. @ 0 stop game , invoke method allow next player take turn. any advice appreciated. thanks edit: import android.os.countdowntimer; import android.widget.textview; public class mycount extends countdowntimer { static textview timedisplay; public mycount(long millisinfuture, long countdowninterval) { super(millisinfuture, countdowninterval); } public void onfinish() { timedisplay.settext("done!"); } public void ontick(long millisuntilfinished) { timedisplay.settext("left: " + millisuntilfinished / 1000); } } in seperate class have created method: public void settimer() { timedisplay = new textview(this); this.setcontentview(timedisplay); mycount counter = new mycount(30000, 1000); counter.start(); } within onclick method have called method above: public void onclick(view v) { settim

php - How to pass SESSION variable to a page in the parent directory? -

on web site have several sub-domains. files create context given sub-domain stored in corresponding sub-directory. sometimes need link files not belong sub-domain. for example, on "subdomain1.mysite.org" have link "www.mysite.org/login.php". "login.php" stored in directory contains subdirectories corresponding sub-domains. if make link "www.mysite.org/login.php" in way: href='../login.php' , not work. because browser tries access "subdomain1.mysite.org/../login.php". solve problem make link in way: href='http://www.mysite.org/login.php' think in way cannot pass session variables new page (can case?). so, problem cannot find way pass session variables page located in parent directory (or page located on domain). know how problem can solved? added as recommended, tired use session_set_cookie_params solve problem. still cannot manage desired result. in more details following: i have in index.php file ge

c# - How to add a new treeview at the selected node? -

i have treeview 4 levels; parent, child, grandchild, great-grandchild. selectednode @ grandchild level. what i'm trying create new "treeview" @ grandchild - no, dont wnat create new node "selectednode" (grandchild). should somelike this: parent child grandchild (new treeview) parent grandchild great-grandchild child great-grandchild child grandchild grandchild it similar parent table mother , father went off , had new childern different spouse other spouse of there existing children. private sub populaterootlevel() ' query find first round of parent populatenodes(dt, jcatreeview.nodes) end sub private sub populatenodes(byval dt datatable, byval nodes treenodecollection) each dr datarow in dt.rows dim tn new treenode() tn.text = dr("title").tostring()

python - Determining if an xlsx cell is date formatted for Excel 2007 spreadsheets -

i'm working code reads data xlsx files parsing xml. pretty straightforward, exception of date cell. dates stored integers , have "s" attribute index stylesheet, can used date formatting string. here examples previous stackoverflow question linked below: 19 = 'h:mm:ss am/pm'; 20 = 'h:mm'; 21 = 'h:mm:ss'; 22 = 'm/d/yy h:mm'; these built in date formatting strings ooxml standard, seems excel tends use custom formatted strings instead of builtins. here example format excel 2007 spreadsheet. numfmtid greater 164 custom format. <numfmt formatcode="mm/dd/yy" numfmtid="165"/> determining if cell should formatted date difficult because indicator can find formatcode. 1 date, cells formatted number of ways. initial attempt ms, ds, , ys in formatcode, seems problematic. has had luck problem? seems standard excel reading libraries lacking in xlsx support @ time. i've read throu

Will android mobile OS support css file format? -

i developing android server-client application draw user requested interfaces dynamically. interfaces transfered client server according requirement. access fields of interface file, , manage well, can use css file format? yes, if render document in webview user interface control http://developer.android.com/guide/webapps/webview.html

c# - limit itextsharp pdf to just 1 page -

the contents in pdf populated database. there way limit pdf output 1 page if content gets longer. fine if pdf have cut contents want limit pdf 1 page pdf. the thing can think of build pdf normally, save it, open again pdfstamper , delete first page. that sounds great way experience serious data loss though.

html - Why hangs the web page after it started a daemon on the underlying server? -

i start/stop daemon process on home server via simple web page. the html this: <form action="http://192.168.2.101/cgi-bin/managedaemon.pl" method="post"> <input type="submit" value="start" name="start"/> <input type="submit" value="stop" name="stop"/> </form> the managedaemon.pl this: #!/usr/bin/perl system("/usr/local/theprog/startserver"); print "content-type:text/html\r\n\r\n"; print "<html>"; ... and startserver this: #!/bin/bash cd /usr/local/theprog ./theprogserver -daemon when execute perl script command line, daemon process started , script terminated. however, when trigger web browser, daemon process started, page hangs until started daemon killed. please let me know how avoid 'hanging'. thanks, marton your daemon not detaching properly, so answer daemonizing contains summary of steps required

workflow - generate java code from a flowchart -

Image
the following flowchart: may described following java code: if (a == 1 && b ==1){ actiona(); } if (b == 3 || (b == 1 && == 2)){ actionb(); actionc(); } if (b == 2){ actionc(); } is there better way translate flowchart in java code? looking sort of general pattern this. question arises fact adding single condition flowchart results in significant changes code. you encapsulate actionb , actionc, while actionc being called after actionb in actionbc , make new method each cell in flow chart. in general should like: void b1(){ if(b==1) a1(); if (b==2) actionc(); ... } void a1(){ if(a1==2) actionbc(); } private void actionbc(){...} and on... in way, expanding flowchart won't explode code.

php - Get all combinations of array -

i need combinations of array. example: array ( array("a","b"), array("1","2","3","4") ); and need array ( array("a","1"), array("a","2"), array("a","3"), array("a","4"), array("b","1"), array("b","2"), array("b","3"), array("b","4"), ); of course must work when sizeof($array) >= 2. thanks much

Weighted Graph Algorithm -

i have weighted, directed graph multiples edges starting ending @ same nodes. ex. multiple edges going node node b. what best search algorithm of paths node , associated costs of these paths? since want paths, i'd use simple breadth-first search. however, suggest collapse parallel edges single edge has list of weights. once different paths (that is, paths in nodes visited different), each path can calculate possible alternative parallel routes. so if you've got following edges: a -> c (5) -> c (3) -> b (7) b -> c (1) b -> c (4) the first step transforms into: a -> c (5,3) -> b (7) b -> c (1,4) the breadth-first search on graph yield following paths between , b: a -> b (7) -> c -> b (5,3) + (1,4) so second path, you'll following costs: 5 + 1 5 + 4 3 + 1 3 + 4 this isn't going faster in doing bfs on original graph, simpler graph easier handle.

c++ - "Functions may not be part of a struct or union" when trying to use a constructor for a struct -

i wondering if compiler specific problem or not. i've seen examples of use of constructors struct in c++. i have like: struct example { example() { } }; i still compiler error "functions may not part of struct or union". using old borland 4.5 compiler (best not ask why...). (and yes, done in c++). i can't myself: why? using compiler announces it's support windows 95 sort of interesting. c++ standard 1998, published before perhaps not date? :-) other that, code ok.

What is Performance Counter and how to use them in ASP.NET application -

what performance counter , how use them in asp.net application. please explain. from msdn : counters used provide information how operating system or application, service, or driver performing. counter data can determine system bottlenecks , fine-tune system , application performance. operating system, network, , devices provide counter data application can consume provide users graphical view of how system performing. the .net framework has several classes allow use , create performance counters, main ones performancecounter , performancecountercategory , countercreationdata (for creating new counters). from documentation on system.diagnostics namespace: the performancecounter class enables monitor system performance, while performancecountercategory class provides way create new custom counters , categories. can write local custom counters , read both local , remote counters (system custom). can sample counters using performancecounter class, , calcul

python - os.path.relpath not returning a relative path when using drive as start point -

why os.path.relpath , on windows, not returning proper relative path when using drive start point, either explicit or implied (current directory) >>> os.getcwd() 'u:\\projects' >>> os.path.relpath(r'd:\foo\something', r"d:\\") '..\\foo\\something' >>> os.chdir("d:\\") >>> os.getcwd() 'd:\\' >>> os.path.relpath(r'd:\foo\something') '..\\foo\\something' >>> os.path.relpath(r'd:\foo\something', r"d:\\foo") 'something' i expecting see 'foo\\something' or '.\\foo\\something' does have os.path.join note on windows? note on windows, since there current directory each drive, os.path.join("c:", "foo") represents path relative current directory on drive i using python 2.7 issue fixed under python 2.7.1 issue #5117: fixed root directory related issue on posixpath.

c# - Compare two objects and find the differences -

this question has answer here: finding property differences between 2 c# objects 6 answers what best way compare 2 objects , find differences? customer = new customer(); customer b = new customer(); one flexible solution: use reflection enumerate through of properties , determine , not equal, return list of properties , both differing values. here's example of code start asking. looks @ field values right now, add number of other components check through reflection. it's implemented using extension method of objects use it. to use somecustomclass = new somecustomclass(); somecustomclass b = new somecustomclass(); a.x = 100; list<variance> rt = a.detailedcompare(b); my sample class compare against class somecustomclass { public int x = 12; public int y = 13; } and meat , potatoes static

c# - RegEx vs string manipulation functions: What is better -

if have find let's word in sentence, can think of 2 approaches using string.indexof using regex which 1 better in terms of performance or best practice it depends on exact requirements. if need find word in sentence (not substring), believe expressed more concisely , more explicitly using well-named regex pattern using indexof plus logic make sure you're getting complete single word. on other hand, if you're looking substring, indexof far superior in terms of performance , readability.

Perl, strings, floats, unit testing and regexps! -

ok, preface question potentially 'stupider' normal level of question - problem has been annoying me last few days i'll ask anyway. i'll give mock example of problem can hope generalize current problem. #!/usr/bin/perl -w use strict; use test::more 'no_plan'; $fruit_string = 'apples cost $1.50'; ($fruit, $price) = $fruit_string =~ /(\w+)s cost \$(\d+\.\d+)/; # $price += 0; # uncomment great success ($price, 1.50, 'great success'); now when run message # failed test 'great success' # got: '1.50' # expected: '1.5' to make test work - either uncomment commented line, or use is ($price, '1.50', 'great success') . both options not work me - i'm testing huge amount of nested data using test::deep , cmp_deeply. question is, how can extract double regexp use double - or if there better way altogether let me know - , feel free tell me take gardening or lol, learning perl hard.

C++ streams question (explanation of comment in code) -

i playing around fastcgi application found here . the following comment in code: if (content) delete []content; // if output streambufs had non-zero bufsizes , // constructed outside of accept loop (i.e. // destructor won't called here), // have flushed here. my knowledge of c++ streams rather weak. please explain following: which streambufs being referred in comment? under conditions streambufs had non-zero bufsizes? last not least, can point resource (pun intended) online provides clear gentle introduction c++ io streams? which streambufs being referred in comment? it's referring request.out , part of reassigned cout : fcgx_request request; ... fcgi_streambuf cout_fcgi_streambuf(request.out); ... cout = &cout_fcgi_streambuf; this reassignment means user can call cout << "content-type: text/html\r\n" << ... and have text show-up on either console (for testing) or across netw

java - Adding "intelligence" into game -

i doing exercises website: http://www.env3d.org/beta/node/79 all code there , everything. i'm working on question 3, have come nothing. have no idea try next. ideas? how make object moves nearest object? first need know nearest object , is, right? i suggest start writing code know nearest enemy object. :)

html - Recommended mobile dimensions -

i'm embarking on first foray mobile site design - i've set method redirect mobile users separate url, need design mobile version of site (targeting smart phones android / iphone). dimensions should create to? there way force mobile browsers scale content down? (currently site appears big within mobile window , must scroll horizontally , vertically see all). 320 x 480 pixels standard mobile sites. things absolutely must know footers mobile. iphone has bastard of browsers , no emulator emultates correctly - specifically: css footer style - position:fixed; bottom:0; don't try it. iphone recognizes position:relative; iphones not recoginized position style of fixed - in case want footer stay on teh bottom.

mySQL: Multi-column join on several tables part II -

i adding 5th table existing join. original query return single row because clause specifies unique id. here tables using: table 1 carid, catid, makeid, modelid, caryear table 2 makeid, makename table 3 modelid, modelname table 4 catid, catname table 5 id, caryear, makename, modelname here existing query using: select a.*, e.citympg, e.hwympg table1 join table2 b on a.makeid=b.makeid join table3 c on a.modelid=c.modelid join table4 d on a.catid=d.catid join table5 e on b.makename = e.make , c.modelname = e.model , a.caryear = e.year a.carid = $carid; there 2 issues need solve - when there no match on table 5, not return results. seem need sort of left join or split query , union. when there match on table 5, returns multiple rows. since criteria return single row not being used, settle average of citympg , hwympg. can both objectives achieved single query? how? assuming understand want correctly... query c

SQL Server/DB2: Same query returns different results? -

summary i'm working on project have query against underlying database engine last changes of records represents users accesses. each user may, , not mandatory to, have children accounts. children accounts stored within same data table reference parent through id_pusr table field. when account primary, id_pusr null each time acces changed, new record created in database users table, last update date ( dt_updt ). data sample please consider following: create table users ( id_users int // primary key , ln_user varchar(128) , fn_user varchar(128) , cd_user varchar(128) , dt_updt datetime , id_pusr int // foreign key users.id_users. ) id_users cd_user ln_user fn_user dt_updt id_pusr ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯ 808 t_pei00 ln_user_00 fn_user_00 2011-01-01-00.00.00.000000 null 809 t_pei00 ln_user_00 fn_user_00 2010-01-01-00.00.00.000000

JQuery UI display the autocomplete list triggered by the focus() event -

i want display autocomplete list triggered focus() event, looks works first time when focus on "id" text box, , focus on "id2" textbox, , focus on "id" textbox, autocomplete list not displayed, reason why? <link media="all" type="text/css" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.6/themes/smoothness/jquery-ui.css" rel="stylesheet"/> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.3/jquery.min.js"></script> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.6/jquery-ui.min.js"></script> <script type="text/javascript"> $(function() { $('#id').autocomplete({ source: ["actionscript", "applescript", "asp", "ba

java - OSGi can't find the activator -

manifest: manifest-version: 1.0 bundle-name: mahjong bundle-activator: mahjongactivator bundle-symbolicname: mahjong bundle-version: 1.0.0 import-package: org.osgi.framework compiling & jarring: $ javac -classpath equinox.jar src/start/*java $ jar -cfm mahjong.jar mahjongmanifest.mf src/start/*class the activator: package start; import org.osgi.framework.*; public class mahjongactivator implements bundleactivator { public void start(bundlecontext context) { system.out.println("hi!"); } public void stop(bundlecontext context) { system.out.println("bye!"); } } then load .jar in osgi , when try start() it, says: org.osgi.framework.bundleexception: activator mahjongactivator bundle mahjong invalid @ org.eclipse.osgi.framework.internal.core.abstractbundle.loadbundleactivator(abstractbundle.java:156) @ org.eclipse.osgi.framework.internal.core.bundlecontextimpl.start(bundlecontextimpl.java:751

MySQL Joins - getting all data from 3 tables -

i trying data 3 different tables @ once, , don't think quite understand joins correctly, i'm getting fast. example, lets tables houses , sellers , , selling_details . houses , sellers linked selling_details : has seller_id , house_id , plus more information such price, , link user. i want build query returns houses in system, matched sellers, , list selling details if present. example: +------------+-------------+-------------------------+----------------------+-----------+ | house.name | seller.name | selling_details.details | selling_details.date | user.name | +------------+-------------+-------------------------+----------------------+-----------+ | 1 | 1 | details | 2011-02-18 | bobby | | 1 | 2 | details | 2011-02-24 | frank | | 1 | 3 | null | null | null | | 1 | 4 | null | null

jQuery performance on Firefox -

hi have page http://samarjit.net78.net/jquerybrowser/jquery.apitest.snapshot.xml has large amount of data. hmtl generated xslt transformation browser. when click on left menu shows filtered contents in center. same filtering can done using right side search box. same method same parameters called on click of go button left menu. now when refresh page , couple of times filtering using left menu works pretty fast. once filter using textbox , press go takes longer filter. subsequent filtering left menu appears slow. if not use search box once keep on clicking main menu not slow down. this quite strange , experienced in firefox 3.6.8 firebug, firequery, pixelperfect, , firefinder . tested without opening firebug. in ie8 , chrome runs faster firefox in general , slow down never happens. can test @ end , tell me if behavior visible?

c# - htmlanchor string URL dropping leading '..' -

i trying write string link htmlanchor tag. url has 2 leading '..' when @ source, leading '..' being dropped. write process: string pagenumstr = "../pdfview/pdfview.aspx?pgid=" + page + "&adid=" + pageid + "&ref=50"; how ensure leading '..' not dropped? is asp.net? "source", mean html source in browser? have <base href> tag on page? , how string onto page (you show being assigned variable). it's hard tell seeing without context. make sure aren't looking @ resolved url when ".." removed. before , after urls?

ios - Adding a UIGesture to a button -

i created number of buttons in ib , linked them actions successfully. have action occur if button pinched. there basic have missed don't seem able figure out how add uipinchgesturerecognizer button. i dont u can add uipinchgesturerecognizer button add view right. think uibutton actions available "touchupinside" defined in ib.

c# - How do I capture video from a webcam? -

i need capture video webcam. there classes in c#/.net can me this. interested in real time data. and there c#/.net books can study gain deep knowledge on language , platform? this use. need first class iterate devices: public class devicemanager { [dllimport("avicap32.dll")] protected static extern bool capgetdriverdescriptiona(short wdriverindex, [marshalas(unmanagedtype.vbbyrefstr)]ref string lpszname, int cbname, [marshalas(unmanagedtype.vbbyrefstr)] ref string lpszver, int cbver); static arraylist devices = new arraylist(); public static tcamdevice[] getalldevices() { string dname = "".padright(100); string dversion = "".padright(100); (short = 0; < 10; i++) { if (capgetdriverdescriptiona(i, ref dname, 100, ref dversion, 100)) { tcamdevice d = new tcamdevice(i); d.name = dname.trim(); d.versio