Posts

Showing posts from August, 2010

android - Margins not takign effect if value greater than container boundary -

if set bottom margin value greater container height, margin not have effect. want view go away whenever bottom/top margin > height or right/left margin > width. trying achieve anchoring effect, works fine if margin within container width/height. let me know if 1 has nay ideas on this. i want view go away whenever bottom/top margin > height or right/left margin > width. don't set margins way. if want "the view go away", use setvisibility() , please. a view , margins , all, cannot larger container.

authentication - Facebook connect cookie disappearing at first page change, on Google Chrome v11 -

i have been developing 2 websites rely on facebook connect javascript sdk . facebook sessions of these websites have been working on many browsers until switched google chrome 11... reason, works in "private" mode now. , friend (also using mac) experienced same difficulties today. in order understand went wrong, observed cookies (using development panel of google chome) while logging in , navigating on websites. when login facebook account, fbs_ cookie stored. transmitted server when requesting first page. but, page displayed, cookie disappears, requiring me login again facebook connect! i tried force cookie using set-cookie response header server, didn't help. when use browser (firefox, safari) or google chrome's "private" mode, both websites work well. do have clue reasons , solution of problem? update: problem disappeared following day, without having anything... that's weird! are doing fb.init() on each page? take here: ht...

How could I authenticate a user in facebook using oauth? -

i want know how authenticate user, visiting site, facebook using oauth 2.0 you can use javascript sdk. basically go here: http://developers.facebook.com/docs/reference/javascript/ add code async load fb all.js then authenticating can take many paths... can this: http://developers.facebook.com/docs/reference/javascript/fb.login/ or pass them here: https://www.facebook.com/dialog/oauth ? client_id=your_app_id&redirect_uri=your_url the can make proper graph calls necessary info need graph so: fb.api('/me', function(response) { alert(response.name); }); further information on available here: http://developers.facebook.com/docs/reference/javascript/fb.api/ hope helps.

osx - Is there any graphic library of C on mac? -

i want use c draw graphic on mac, there graphic library provided on mac? check out link http://www.opengl.org/wiki/getting_started#mac_os_x might need learn glut before developing useful graphics application.

iphone - How to change file extension from .txt to .rtf in ios programatically? -

how change file extension .txt .rtf in ios programatically? in xml parsing i'm getting rtf data rtf tags. possible save data in rtf file without tags? if load file, loading rtf tags in webview. if open , save file physically, opens in webview. there way task (file open & save) programatically using ios. if load rtf file ftp server, upto tables loading(only plain text before tables) using function of nsstring nsstring *string2 = [[nsstring alloc] initwithcontentsoffile:@"whateverfile.rtf"]; get text file , save in .txt format using nsmutablestring *mutstr2 = [[nsmutablestring alloc] init]; [mutstr2 setstring: string2]; [mutstr2 writetofile:@"whatevertxt.txt" atomically:yes encoding:nsunicodestringencoding error:&error]; you write file in .txt. format... guess best way u want

iphone - How to draw bullet in table views cell? -

i want draw bullet in table views cell. i found 1 method getting bullet : lbl.text = @"\u2022 hey bullet"; but giving small bullet. so there other way bullet in apps? if bullet small it's because standard size font-family/font-size using. you'd have set bullet font different font family or font size increase it's size. i assume you're using default cell view. create custom cell view , manually place bullet in interface builder uilabel after it.

bluetooth chat only works with android sdk 3.0? -

as 1 of first android projects downloaded bluetooth chat sample code http://developer.android.com/resources/samples/bluetoothchat/index.html and tried build it. seems can build project android sdk 3.0 - when using sdk 2.2 there compile time errors, classes not found. i wondering if there version of bluetooth chat compatible 2.2? reason i'm asking dev phone running android 2.2 (tmobile comet), , apk built 3.0 crashes on dev phone. the sdk contains samples different api versions. can download bluetoothchat app android 2.2 using sdk manager selecting "samples sdk api 8". after downloading, find in samples/android-8/bluetoothchat in sdk directory.

How to implement class/object metadata in Python? -

i working on structured data analysis framework based on streaming data between nodes . nodes implemented subclasses of root node class provided framework. each node class/factory need metadata, such list of node's attributes, description, node output. metadata might both: end-users in front-end application or programming use - other stream management tools. in future there more of them. (note started learn python while writing code) currently metadata provided in class variable class aggregatenode(base.node): """aggregate""" __node_info__ = { "label" : "aggregate node", "description" : "aggregate values grouping key fields.", "output" : "key fields followed aggregations each aggregated field. last field " "record count.", "attributes" : [ { "name": "keys"...

sockets - delphi tserversocket ignores 1st message -

pls advise why happens. on simple sample server app have following code: procedure tform13.serversocket1clientread(sender: tobject; socket: tcustomwinsocket); var str : string; begin str := socket.receivetext; showmessage(str); end; and on client side have clientsocket1.open; clientsocket1.socket.sendtext(txtmsg.text); nothing fancy. strange thing when send message server 1st time gets ignored. every time after works great. clientread event doesn't fire off @ on 1st message what can change on server make accept 1st message. have no control on client side 3rd party sends me messages, ut missing 1st message. thanks! if using tclientsocket in non-blocking mode (which default), can't send data after open() returns, connection not ready yet. have wait onconnect event triggered first, eg: procedure tform1.startconnectingtoserver; begin clientsocket1.open; end; procedure tform1.clientsocket1connect(socket: tcustomwinsocket); begin socket.sendtext...

iphone - Implementing Quick Look QLPreviewController Animations -

i trying implement following method of qlpreviewcontrollerdelegate , method requires me return view shows preview item before preview controller; should self.view getting following compile error: automatic reference counting issue: implicit conversion of objective-c pointer 'uiview *__autoreleasing *' disallowed arc how fix this? //called when quick preview presented full screen or dismissed, provide zoom effect. - (cgrect)previewcontroller:(qlpreviewcontroller *)controller frameforpreviewitem:(id <qlpreviewitem>)item insourceview:(uiview **)view { // set source view view = self.view; // set rectangle of icon return self.view.bounds; } the view parameter pointer pointer view. set it, you'd use syntax: *view = self.view;

Rails changing routes.rb stops new records being created -

i've changed routes.rb to: root :to => 'pjobs#index', :as => 'pjobs' now when try add new pjob not add list. if remove line routes.rb , go url location manually , try adding pjob works. am missing not being caught exception?

Separating txt file to many csv files with PHP -

so able parse txt file csv file $data = array(); while ($line= fgets ($fh)) { $stack = array($laus,$fips,$countyname,$date,$_clf,$_emp,$_unemp,$rate); array_push($data, $stack); } $file = fopen('file.csv','w'); foreach ($data $fields) { fputcsv($file, $fields,',','"'); } fclose($file); my question is, best way create multiple csv files seperated month (also year, jan01.csv, jan02.csv). i'm taking bit of guess @ formatting of date while ($line = fgets ($fh)) { // not sure you're getting these values, i'm assuming it's correct $stack = array($laus,$fips,$countyname,$date,$_clf,$_emp,$_unemp,$rate); // assuming $date looks '2011-10-04 15:00:00' $filename = date('my', strtotime($date)) . '.csv'; $file = fopen($filename,'a+'); fputcsv($file, $stack,',','"'); fclose($file); } this little slow since you're opening , closing ...

qt4 - QextserialPort 1.2 win-alpha build error -

i'm new qt. hi, got know qextserialport 1.2-win-alpha api useful develop serial communication application, downloaded , started build. however, raising error dialog , "coudn't find executable, specify @ least one" when pressing executable browsing button. if use cancel button in dialog appeared qextserialport-build-desktop thanks quick response... i guessing problem missing header files i see in posix_qextserialport.h file #include "termios.h" #include "sys/ioctl.h" #include "sys/select.h" are underlined wavy green line and build log shows below starting ... the process not started! the above error same qserialdevice i dont know how add header files/library qt4... can 1 me deducing name, have older copy sourceforge. afaik project has moved http://code.google.com/p/qextserialport/ while ago (although development has stalled there, too, apparently). try fetching latest version of code google code repo...

javascript - PHP/MySQL OnClick Update MySQL -

need update hitcount field in mysql table when user clicks on banner ad. have random ad display script working can't figure out how update table when click..assuming have pass id ajax no idea how approach it? code below: include 'connection.php'; $query = "select * ads adtype = 'small' , status = 'yes' order rand() limit 3"; $result = mysql_query($query) or die(mysql_error()); $num_results = mysql_num_rows($result); if ($num_results !="0") { for($i=0;$i<$num_results;$i++) { $row = mysql_fetch_array($result); $client = htmlspecialchars(stripslashes($row['client'])); $link = htmlspecialchars(stripslashes($row['link'])); $filename = htmlspecialchars(stripslashes($row['filename'])); $id = $row['id']; echo "<tr>"; echo "<td>"; echo '<a href="'; echo $link; echo '"><img src="thimg/'; echo...

HTML Validation -

1. there no attribute x you have used attribute named above in document, document type using not support attribute element. error caused incorrect use of "strict" document type document uses frames (e.g. must use "transitional" document type "target" attribute), or using vendor proprietary extensions such "marginheight" (this fixed using css achieve desired effect instead). this error may result if element not supported in document type using, undefined element have no supported attributes; in case, see element-undefined error message further information. how fix: check spelling , case of element , attribute, (remember xhtml lower-case) and/or check both allowed in chosen document type, and/or use css instead of attribute. if received error when using element incorporate flash media in web page, see faq item on valid flash. line 335, column 52: there no attribute "key" …t type="text" value="full name:" ...

How to know if a PHP variable exists, even if its value is NULL? -

$a = null; $c = 1; var_dump(isset($a)); // bool(false) var_dump(isset($b)); // bool(false) var_dump(isset($c)); // bool(true) how can distinguish $a , exists has value of null , “really non-existent” $b ? use following: $a = null; var_dump(true === array_key_exists('a', get_defined_vars()));

java - How to make a swing component's bounds fixed -

i have jpanel have added few components (checkbox, combo etc. ). have noticed that, when frame maximized, bounds of components move or shift right. then, on restore components shifted original position. on 21 , above inch monitor, components shift makes difference can see components move far right. we using customized layout manager implements java.awt.layoutmanager2 . class content quiet huge, point areas determine bounds components. protected int hmargin = 0; .. insets insets = target.getinsets(); dimension size = target.getsize(); int x = (size.width - insets.left - insets.right - 15 * hmargin); and frame calls layout , add components shown below: jpanel pl = new jpanel(new ourlayout(this)) //add component panel pl.add(checkbox); .. at point decide x , want add line prevent components shifting when frame on calling panel added maximized. can suggest ideas on how achieve this? example code appreciated. if have custom layout manager, layout manager sho...

*python code* problem/s with .txt file and tuples + dictionaries -

i writing game, , having trouble coding high scores list. the high score table consists of .txt file name, score listed in order, each on new line right testing has. matthew, 13 luke, 6 john, 3 my code record score is: print "you got it!\nwell done", name,",you guessed in", count, "guesses." save = raw_input("\nwould save score? (y)es or (n)o: ") save = save.upper() if save == "y": infile = open("scores.txt", 'a') infile.write("\n" + name + ", " + str(count)) infile.close() count = -1 if save == "n": count = -1 and code show score is: def showscores(): infile = open("scores.txt", 'r') scorelist = {} line in infile: line = line.strip() parts = [p.strip() p in line.split(",")] scorelist[parts[0]] = (parts[1]) players = scorelist.keys() players.sort() print "high scor...

How to load google ads using jquery ajax -

in site want load google ads using jquery ajax,here using php code igniter developing sites.page contents load using jquery ajax,with in content want load google ads. thanks if worried page loading time, , reason trying use ajax why don't try putting adsense code in footer. can use css , position wrapper div if want show code elsewhere(just trial thing though). edit: can try this

jQuery a more complex toggle() (disable+fadeIn) -

i have form div inside it. want disable the inputs when "checked" , simultaneously fadein 0.3 labels inside div... else enabling inputs , simultaneously fadein 1 labels... $("#toggleelement").click(function() { if ($("#toggleelement").is(":checked")) { $('#elementstooperateon :input').removeattr('disabled'); $("#elementstooperateon").fadeto("slow", 0.99); } else { $('#elementstooperateon :input').attr('disabled', true); $('#elementstooperateon :input').attr('checked', false); $('#elementstooperateon :input').attr('value', ''); $("#elementstooperateon").fadeto("slow", 0.33); } }); ok, figured out works me follows function togglestatus() { if ($('#toggleelement').is(':checked')) { $('#elementstooperateon :input').removeattr('disabled'); $(...

logging - Is there a Logger.setLevel like method in Android class Log? -

is there logger.setlevel -like method in android class log ? no there no built in methods in log class.[as per know]. but can build own like: public void setlevel(int level) { switch (level) { case off: this.logger.setlevel(level.off); break; case all: this.logger.setlevel(level.all); break; case info: this.logger.setlevel(level.info); break; case warn: this.logger.setlevel(level.warning); break; case error: this.logger.setlevel(level.severe); break; default: break; } } also can change default level setting system property: setprop log.tag.<your_log_tag> <level> level either verbose, debug, info, warn, error, assert, or suppress. you can create local.prop file following in it: log.tag.<your_log_tag>=<level> , pla...

c# - How to install USB driver after the installing of software -

i want install (or @ least, prepairing installing of) usb driver after software installed on client computer. i have small program, written in c# in visual studio 2008, , can install program using standard feature in vs2008. program talks hardware device via usb cable. usb driver came ftdi , can installed when user plugs in usb socket. works fine, want file copied during installation of software. once done, show message on screen e.g. "please plug in usb cable in socket , click ok continue", on installing of driver automatically carried out moment. (the same when install software new printer). please advice how can it. , it's great if can me start examples. great thanks, henry. this works: // szinfdirectory directory on hard drive installer copied driver files to. tchar szinfpath[max_path]; _tcscpy( szinfpath, szinfdirectory ); _tcscat( szinfpath, _t("yourdriver.inf") ); tchar szdestinationinffilename[max_path]; if( (!setupcopyoeminf( sz...

caching - jpa hibernate and 2nd level cache -

my configuration follows persitence.xml <property name="hibernate.cache.provider_class" value="org.hibernate.cache.singletonehcacheprovider"/> <property name="hibernate.ejb.classcache.demo.entities.userid" value="read-only"/> <property name="javax.persistence.sharedcache.mode" value="all"/> ehcache.xml <?xml version="1.0" encoding="utf-8"?> <ehcache xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xsi:nonamespaceschemalocation="http://ehcache.org/ehcache.xsd" updatecheck="false"> <diskstore path="java.io.tmpdir/customer-portlet-cache"/> <defaultcache eternal="false" maxelementsinmemory="1000" overflowtodisk="false" diskpersistent="false" timetoidleseconds="0" timetoliveseconds="600" memorystoreevictio...

java - Dynamic form, with or without multipart/form-data -

i designing simple crud framework in java, in html page have dynamic form (2 multipart create , update file upload , 1 without fileupload , multipart delete). server side, request modulator checks parameters using request.getparametermap(); , checks hidden type input <input type="hidden" name="returntype" value="create"> whether create, update or delete operation. based on call necessary handlers. note: form enctype , encoding set multipart/form-data note: parammap.size() returns 0 here , returntype getting null , getting null pointer exception. if not use enctype , encoding @ runs fine, again file upload gives me exception encoding type shoud multipart/form-data . can me in way can have dynamic form can create crud? or why not able use request.getparametermap(); multipart/form-data :) given below code of request modulator public string identifynow()throws servletexception, java.io.ioexception { uploadxmlagent uploadagent;...

How to write some command on a batch file through C++ program? -

i need regarding c++ program. batch file named abc.bat located somewhere in hardisk. know in c++ can use line of code execute abc.bat file: system ("file path here\\abc.bat"); i want send commands batch file after executing abc.bat file c++ program should write commands console , execute them. how can that? you can opening pipe . in brief: file *bat = popen("path\\abc.bat", "w"); fprintf(bat, "first command\n"); fprintf(bat, "second command\n"); pclose(bat); the text write bat end on standard input of batch file.

curl - How to send a photo to a rest service -

what best approach able send photo iphone client rest service (jax-rs) , save there? current server code: @post @path("/newphoto/{eventid}") @consumes("application/octet-stream") public void newphoto (@pathparam("eventid") string eventid, inputstream pict) throws exception { // save photo } is ok or recommend else? , how can test service on terminal curl command? it looks me. usually, put inputstream first param, checked , it's ok.

c++ - Input validation for Integer and Double data types -

because there error in code when posted question, not question. have deleted , replaced link correct solution. correct solution input validation cin.getline(buffer, '\n'); <-- wrong, need buffer size. cin.getline(buffer, 10000, '\n');

php - Disqus Comments Pagination -

i have disqus comments in webpage. using below script given disqus, displaying recent comments. <script type="text/javascript" src="http://prati.disqus.com/combination_widget.js?num_items=10&hide_mods=0&color=blue&default_tab=recent&excerpt_length=200"></script><a href="http://disqus.com/">powered disqus</a> i have more 10 comments. can display 10 comments. there possibility set pagination display recent comments? ravichandran, still looking answer problem? here html expose 'show all' button. help? <button type="button" class="dsq-button-small dsq-paginate-all-button" onclick="return disqus.dtpl.actions.fire('thread.paginate', 1, this, 0);"> show comments </button>

iphone - How to create image contains a text for UITabBarItem -

Image
i trying put image contains text on uitabbaritem. i went our graphics designer , asked him create image me contains text "summary". he did. ( png image).. when put inside app, saw horrible look.. the image: how in app: to create image tab bar or toolbar item, or designer must work in image's alpha channel. colors in image don't matter @ all, os interested in alpha channel. in case, background of image should transparent instead of black.

networking - Linux Loopback performance with TCP_NODELAY enabled -

i stumbled on interesting tcp performance issue while running performance tests compared network performance versus loopback performance. in case network performance exceeded loopback performance (1gig network, same subnet). in case dealing latencies crucial, tcp_nodelay enabled. best theory have come tcp congestion control holding packets. did packet analysis , can see packets being held, reason not obvious. questions... 1) in cases, , why, communicating on loopback slower on network? 2) when sending fast possible, why toggling tcp_nodelay have more of impact on maximum throughput on loopback on network? 3) how can detect , analyze tcp congestion control potential explanation poor performance? 4) have other theories reason phenomenon? if yes, method prove theory? here sample data generated simple point point c++ app: transport message size (bytes) tcp nodelay send buffer (bytes) sender host receiver host throughput (bytes/sec) message rate (msgs/se...

c# - WIX Autogenerate GUID *? -

let's generate wix xml file product id of *. each component guid use *. <product id="*" name="xxx" language="1033" version="1.0.0.0" manufacturer="xxx" upgradecode="xxx"> behind scenes * spinning unique guid each time compile wix installer? let's have version 1.0.0 installed machine. recompile wix installer version 1.0.1. when go install 1.0.1 how wix know 1.0.0 installed , remove files/registry entries , install 1.0.1? should using * guid or should have unique id/guid in wix xml configuration? product/@id="*" generates new guid (i.e., randomly). component/@guid="*" calculates guid stays same long file path stays same.

c - Callback with parameters -

im trying figure out how use callbacks parameters in c. following isnt working. best way archieve it? (passing arguments callback function) #include <stdio.h> void caller(int (*cc)(int a)) { cc(a); } int blub(int a) { printf("%i", a); return 1; } int main(int argc, char** argv) { caller(blub(5)); return 1; } you doing call before passing function, not passing callback function itself. try this: #include <stdio.h> void caller(int (*cc)(int ),int a) { cc(a); } int blub(int a) { printf("%i", a); return 1; } int main(int argc, char** argv) { caller(blub, 1000); return 1; }

java - Code generation between JSP <-> Swing -

is there tool can convert programmed swing j2se jsp j2ee shell?. thanks! no, there no such tool. although might found attempts it, desktop , web paradigms way different have tool converts between between them properly. if absolutely must run app on web environment, might find easier convert swing application web applet. it's not same though. applet swing application running inside browser. not web-web application.

Why does a simple PHP unset() memory test utilize twice the amount of memory in PHP 5.3? -

i testing out whether unset() affects memory while script running, see if unset() or other known method, $var=null more efficient. unset() did affect memory, since tested out on 2 different virtualhosts, wondered why 1 take more or less twice amount of memory same script? i'm guessing answer simple, escapes me @ moment. script below: <?php $init=memory_get_usage(); $test=array(); for($i=0;$i<=100000;$i++){ $test[$i]=rand(0,10000000); } echo 'memory change: '.((memory_get_usage()-$init)/1024/1024).'mb<br/>'; for($i=0;$i<=100000;$i++){ unset($test[$i]); } echo 'memory change: '.((memory_get_usage()-$init)/1024/1024).'mb<br/>'; //output on php 3.2.5 virtualhost: //memory change: 6.98558807373mb //memory change: 0.500259399414mb //output on php 5.3.5 virtualhost //memory change: 13.970664978mb //memory change: 1.00063323975mb ?> thanks! php 3.2.5? that's old doesn't reach stone age. php's ...

how to do multiple pages in VB.NET form -

i've inherited vb.net code think needs restructuring. project has 3 forms, each of own windows form file inherits system.windows.forms.form. the problem these forms share common navigation menu bar not change user switches between forms, , original programmer has duplicated menu code in each of 3 files generate menu on each one! figure can't right. to restructure it, thought create base form implemented menu, , let other forms inherit that, ran problem windows forms inherit class mentioned above, , can't inherit class. i noticed can add item called "inherited form", way go here? problem of creating multiple screens common menu bar has incredibly common. there 1 true way this? should use inherited forms, or should have 1 base form , make other screens plain classes , not forms @ all? or else i'm not thinking of? depending on specifics; might want consider using mdi forms. another option i've seen having menu/shared toolbars encaps...

How to get the progress status of the copy function in PHP? -

i need know how status of copy() function in php. i using function download remote file, , want progress bar program. you'll need write own copy function. first check file size through http head request, example solution: http://php.net/manual/en/function.filesize.php#92462 then fetch file: $remote = fopen('remote-file', 'r'); $local = fopen('local-file', 'w'); $read_bytes = 0; while(!feof($remote)) { $buffer = fread($remote, 2048); fwrite($local, $buffer); $read_bytes += 2048; //use $filesize calculated earlier progress percentage $progress = min(100, 100 * $read_bytes / $filesize); //you'll need way send $progress browser. //maybe save file , let ajax call check it? } fclose($remote); fclose($local);

mapping of an image on another image :how to do in matlab? -

i have image ,imagea (cropped image) how map on imageb @ top left... (x,y) coordinates of 1 image maps on (x,y) coordinates of other image. i presume want overwrite top left corner of b a [m, n, ~] = size(imagea); imageb(1:m, 1:n, :) = imagea; remember take care number of colour channels.

php - Doctrine does not return null for NULL values when you use get magic methods -

i have symfony application configured doctrine, , have designed one-to-many relationship between 2 models: item belongs customer , alias sfguarduser . let's there situations item not have customer. test i'm trying make comparison: $customer = $this->getcustomer(); if ( $customer ) { return $customer->getnbinvoices(); } else { return 'n/a'; } however $this->getcustomer() not return null or other 'false' value compare with, , foreign key set null in database. how can compare object not store actual value in database? i think $this->getcustomer() return blank instance of customer doctrine_record. can test if customer has id, or can use method of doctrine_record class exists() : if($customer->exists()){ code... } http://www.doctrine-project.org/api/orm/1.2/doctrine/doctrine_record.html#exists%28%29

makefile - Explaining circular dependency in make -

make thinks have circular dependency: $ make blah > /dev/null make[1]: circular <- dependency dropped. is there way make print out path circular? big , complicated makefile did not write , finding near futile figure out hand. any other technologies people have resolving circular dependencies? thanks. make[1]: circular <- all right, 2 things: 1) all <- all means that's whole path. that's right, all prerequisite of all . 2) make[1] means recursive make. somewhere in makefile there command $(make) all (probably obscured variable names, functions, arguments, whatever). does help?

selection - How to make architecture decisions that could apply for any application -

i serious getting bogged down various technologies that's available today. example, point can select java framework; have numerous options in market - apache wicket, tapestry, click, struts, seam, spring, grails, play framework. comes database, orm, caching, javascript framework , on. small mistake here have serious effect during development or during maintenance phase, feel brought down expert decision making. i learn experts here, how decide during such architecture decision making phase. generic pattern important decision points consider when selecting framework , related technology stack web application development that's done scratch. for example, if making architectural decisions social networking site how should go listing down various technologies, categorize it, evaluate , shortlist final tech stack? i looking out generic pattern or process decision making all. process should applicable application. (banking solution, social network or else). please point bo...

mapping - ArcGIS Android Support -

the website claims touch gestures supported android browsers. i'm running 2.2 , have not been able touch gestures work. can done enable it? this works iphone not android browsers. how 1 go making possible enable touch support on android browser? here's link can try on mobile android browser: http://help.arcgis.com/en/webapi/javascript/arcgis/demos/mobile/mobile_simplemap.html

java - Hibernate criteria filter inner collection -

i have next classes/tables: user id name works // list of work work id name user_id and following code: criteria criteria = session.createcriteria("user"); criteria.list(); returns list of user s contain list of work object assotiated them (by id=user_id). how can modify query same list of user follow restriction: list of work should not includes work s name ='fck'? it's possible, not wise, because loaded users wouldn't reflect actual state of database : list of works should contain works, , not of them. modifying them lead unwanted deletes in database. i rather load works you're interested in, associated user : criteria c = session.createcriteria(work.class, "work"); c.createalias("work.user", "user"); c.setfetchmode("work.user", fetchmode.join); c.add(restrictions.ne("work.name", "fck"));

java - Cannot create project in Eclim -

hello people of stack overflow, have come yet question bountiful knowledge answer. having problem using eclim, program integrates features of eclipse java development vim editor. i unable create project using syntax defined on eclim.org , vim command, ":projectcreate /path/to/dir -n java". typing this, ":projectcreate /home/username/java -n java", username username. error is, java model exception: java model status [java not exist] while executing command (port: 9091): -command project_create -f "/home/username/java" -n java this led me test if java installed on system, using java -version. output is, java version "1.6.0_22" openjdk runtime environment (icedtea6 1.10.1) (6b22-1.10.1-0ubuntu1) openjdk server vm (build 20.0-b11, mixed mode) so had java installed, , believe openjdk version not used in eclim installation. version specified java 1.6.0_24 of sun java jdk. that's beside point though, have java installed. so that'...

javascript - Raphael - event when mouse near element -

i make mouse event triggers when mouse near raphael element. (so guess need know x,y position of mouse. ideas on how might possible? thank you! you could, suggest in question, track mouse position , compare position of element. but that's doing things hard way. far easier exploit mouseover or mouseenter events. obviously mouseenter , mouseover triggered when mouse pointer goes on element, rather merely near per question, resolved adding invisible area around element, , having mouse event trigger on that. this invisible area element positioned in same place raphael element, extending beyond in each direction distance, or same raphael object, make bit bigger , don't draw way edge. hope helps.

c++ - Deletion of Pointers Issue -

i having trouble deleting pointers have created. program creates double pointer point threads. creates threads dynamically. @ end deletes them getting glibc error. uses boost create threads. puzzling delete similar double pointer same exact way , executes fine. issue @ end of code block under heading of /*clean up*/ : boost :: thread** thrds; //create threads , bind p_variantforloop_t thrds = new boost::thread*[numthreads]; (int = 1; <= numthreads; i++) thrds[i] = new boost::thread(boost::bind(&p_variantforloop_t, e, a, d, (i*n-n)/i ,(i*n)/n, numthreads, n)); /* join threads */ (int = 0; < numthreads; i++) thrds[i]->join(); /* cleanup */ (int = 0; < numthreads; i++) delete thrds[i]; delete[] thrds; the error is: *** glibc detected *** ./hw9: munmap_chunk(): invalid pointer: 0x0957d480 *** ======= backtrace: ========= /lib/tls/i686/cmov/libc.so.6(+0x6b591)[0x264591] /lib/tls/i686/cmov/libc.so.6(+0x6c80e)[0x26580e] /u...

asp.net mvc - In MVC3 how do I have a dropdown that shows/hides fields based on the selected value? -

i have dropdown of countries, , address form. depending on country selected, want hide/show fields. i'm quite new mvc , mvc3, best way this? i have on page 'dropdownlistfor' populates correctly. when changes, imagine need ask server fields show/hide. perhaps put jquery change event calls method, , returns json saying visible:true each field, don't know if that's ideal or how implement (possibly $.ajax or something). any ideas? edit: should add hard part of asking server fields show each country there many countries , possibilities stored in database. accustomed webforms not mvc ordinarily postback , have serverside logic, isn't option mvc afaik... i have deleted first answer irrelevant. with mvc3 can send ajax request method. in homecontroller.cs : public list<string> getfieldstoshow(string id) { // if routing left default, parameter passed in called 'id' // gotta do... list<string> listoffieldstoshowbasedo...

regex - javascript RegExp: how to match multiline and closetag -

var ex = /(<script\s?[^>]*>)([\s\s]*)(<\/script>)/; //note: here 2 script tags var str = '<script>\nvar x=0;\n</script>\n<div>\nhtml\n</div>\n<script>var y=0;\n</script>' str.replace(ex, function(full, prefix, script, suffix) { return prefix + dosomething(script) + suffix; }) but got wrong script: var x=0;</script><div>..</div><script>var y=0; what want is: var x=0; , var y=0; use regex below: <script>([\s\s]*?)</script> in javascript cannot make . dotall use [\s\s] character class matches character either whitespace or not whitespace including newline. ? non-greedy match don't nest script tags.

ruby - MongoDB and MongoRuby: Sorting on mapreduce -

i trying simple mapreduce on documents stored in mongodb. use map = bson::code.new "function() { emit(this.userid, 1); }" for mapping and reduce = bson::code.new "function(key, values) { var sum = 0; values.foreach(function(value) { sum += value; }); return sum; }" for reduction. works fine when call map_reduce following way: output = col.map_reduce(map, reduce, # col collection in mongodb, e.g. db.users { :out => {:inline => true}, :raw => true } ) now real question: how can use upper call map_reduce enable sorting? the manual says , must use sort , array of [key, direction] pairs. guessed following should work, doesn't: output = col.map_reduce(map, reduce, { :sort => [["value", mongo::ascending]], :out => {:inline => true}, :raw => true } ) do h...

javascript - how to center columns based on window width -

<link rel="stylesheet" type="text/css" href="reset.css" /> <style type="text/css"> body { position: relative; } .contain { position:relative; overflow: hidden; width: 80%; height: 100%; margin: 0 auto; } .box { background-color: #f0f0f0; color: #888; font-family: arial, tahoma, serif; font-size: 13px; } .box p { padding: 10px; } .box span { float: left; font-size: 26px; font-weight: bold; } div.alt { background-color: #ccc; } </style> <script type="text/javascript" src="jquery-1.3.2.min.js"></script> <script type="text/javascript"> var myfluidgrid = { colnumber : 2, // minimum column number. colmargin : 10, // margin (in pixel) between columns/boxes. colwidth : 240, // fixed width of colu...

ruby on rails - why does heroku change the order of hashes? -

for life of me not figure out. if have in local dev/production: fields = { :name => { ...}, :description => { ...}, :amount => { .... } } its fine loop through hashes , print fields name how declared it. in heroku, sequence different in printed order?? have complete no idea why , can't clue why heroku printing them in different order. does make sense? edit: omg driving me nuts. in templat, sorting variable reaaaaaly weird reason, still coming out in manner heroku understands. - @form_columns = @form_columns.sort_by |i| - if i[1][:rank].nil? - i[1][:rank] = rank - i[1][:rank] - rank = rank + 1 this how loop way: @form_columns.each |column_name| please understand there no issue in local production/dev server. if reason have use ruby 1.8 can ordered hash using orderedhash in rails activesupport . to see stack using on heroku: heroku stack and migrate 1.9.2: heroku stack:migrate bamboo-mri-1.9.2

Problem by Lazy loading in entity framework -

i have 2 entities in 1:n relationship: link, category. @ first categories , links , put them list. next fill links of every category manually category.links.add(link) connect db , link again , cause double data in result. know action because of lazy loading. lazy loading true , not want disable it. how can fill links of every category manually without connecting db again? please not offer eager loading or disabeling lazy load. var categories = categoryrepository.getcategories().tolist(); var alllinks = linkrepository.getlinks().tolist(); foreach (var category in categories) { var links = alllinks.where(l => l.categoryid == category.categoryid); foreach (var link in links) { category.links.add(link); } } even mentioned don't want turn off lazy loading insists because lazy loading triggered when access navigation property first time. way avoid is: turning la...

Python Regex pattern not being matched -

i'm trying regex parse values stored in set of lua files, each line looks 1 of these 2 lines item.id = 'item_clock';\r\n item.cost = 150;\r\n . when run regex pattern on first line expected result >>> re.search("item.(?p<key>[a-za-z]\w) = (?p<value>.*);", line).groupdict() {'key': 'id', 'value': "'item_clock'"} however when run on second line, don't match object. the regex looks item. followed letter followed exactly one word character (the \w in regex). you meant item.(?p<key>[a-za-z]\w*) ... (note added asterisk). item. followed letter followed zero or more word characters. also, it's idea use raw strings regular expressions avoid hard-to-spot bugs: r"item.(?p<key>[a-za-z]\w*) = (?p<value>.*);" (note r prefix).

opencv - Open CV EyeDetection Using Haar -

i using opencv object detection detecting eyes on image. used cvhaardetectobjects , used classifier provided opencv(haarcascade_eye.xml). ran application through multiple set of images , images eyes not getting detected. observation is, if image not having enough lighting , if complexion around eyes dark in nature eyes not getting detected properly. here question is, know whether technology limitation of haar detection or there way further improve this. one approach thinking create custom cascade xml using set of positive , negative images using haartraining.exe. before attempting know whether cascade xml provided opencv optmized 1 or not. if optmized cascade classifier there no point in putting efforts on direction thanks in advance regards, sujil c

javascript - How to get an object's methods? -

is there method or propertie methods object? example: function foo() {} foo.prototype.a = function() {} foo.prototype.b = function() {} foo.get_methods(); // returns ['a', 'b']; update: there method in jquery? thank you. function getmethods(obj) { var res = []; for(var m in obj) { if(typeof obj[m] == "function") { res.push(m) } } return res; }

python - Pylons & Beaker: JSON Encoded Sessions -

need read pylons session data (just read, not write to) in node.js once decode base64, i'm left string containing serialized python object which, pain parse in node.js how can beaker serialize json instead? far easier node.js handle. i had inside beaker find call "python serialized strings" python pickles. i don't think more few lines change use json store dict. here patch against https://bitbucket.org/bbangert/beaker/src/257f147861c8 : diff -r 257f147861c8 beaker/session.py --- a/beaker/session.py mon apr 18 11:38:53 2011 -0400 +++ b/beaker/session.py sat apr 30 14:19:12 2011 -0400 @@ -489,10 +489,10 @@ nonce = b64encode(os.urandom(40))[:8] encrypt_key = crypto.generatecryptokeys(self.encrypt_key, self.validate_key + nonce, 1) - data = util.pickle.dumps(self.copy(), 2) + data = util.json.dumps(self.copy()) return nonce + b64encode(crypto.a...

visual studio 2010 - How to make VS2010 C++ see the windows 7 64bit SDK? -

been trying 2 hours now, , theres no luck. wanna make got templets win64 app (not .net) can't find add platforms. please help? there no "win64" api. there 32-bit win32 apps , 64-bit win32 apps, , difference a compiler/linker option compiler/linker used (different directory). the win32 templates work fine 64-bit development. while (much) earlier versions of visual c++ shipped private copy of sdk headers, vs2010 installs version of windows sdk , uses environment variable find sdk headers during build. installing new sdk, long updates environment variables, automatically found visual c++ projects @ build-time. (with old visual c++ versions, sdk installer supposed edit tool paths in visual studio section of registry, fail)

asp.net mvc - How do I pass my data to a JsonResult so that it formats correctly -

i using mootools textboxlist in mvc app create autocomplete tag suggester, similar stackoverflow one. the script uses json suggestions. json string seems expect different able generate. script's demo, should this: [[32,"science",null,null]] but can't figure out how string come out of mvc quite that. best looks more like: [{"id":11,"text":"science"}] with actual field names showing up. here controller method: public jsonresult suggest(string search) { jsonresult jsonresult = new jsonresult(); var tags = t in db.tags t.text.contains(search) select new {id=t.tagid, text=t.text}; var result = dosomethingto(tags); // <---???????? jsonresult.data = result; jsonresult.jsonrequestbehavior = jsonrequestbehavior.allowget; return jsonresult; } i've tried several variations of passing variables jsonresult.data ...

servlets - HTTP 404 the requested resource can not be found -

this question has answer here: servlet returns “http status 404 requested resource (/servlet) not available” 1 answer i getting http 404 requested resource can not found. i executing servlets comfortably while ago. compiled last servlet , compiled fine. added web.xml file , restarted webserver , ever since getting same error on applets ones running fine earlier. checked web.xml file errors seems ok. i getting http 404 requested resource can not found. this can have several causes: url plain wrong. has match <url-pattern> of servlet in web.xml . mapping in web.xml plain wrong. read server startup log details. servlet construction/initialization failed. read server startup log details. webapp startup failed completely. read server startup log details.

javascript - jquery addClass adding subclass not working -

this 1st time posting here, can give me advice! <html> <head> <style> </style> <script src="jquery-1.5.2.js"></script> </head> <body> <div class="super" style=" border: solid black 1px; height:100px; width:100px; "> </div> <div class="super .eight" style=" background: blue; "> </div> <script> $(".super").click(function () { $(this).addclass(" .eight"); }); </script> </body> </html> so problem want add example background or other type of element onto class defined super. trying use subclasses not seem working. please ask me if there unclear, apologize if there is. no dot (in classname). $(".super").click(function () { $(this).addclass("eight"); });

tomcat - Which Java EE technologies to use? -

we're building web service scratch, right deciding java ee technologies use. it looks apache-cxf choice frontend. accessing database, hibernate looks candidate. business logic in between? should ejb3 used? if ejb3 not used, tomcat candidate app server? if ejb3 used, tomcat still good? or full-fledged java ee server better, glassfishv3 example? basically asking question java developers did @ point or of careers. should go full blown application server or simpler container open source stack above it. couple of years ago advice go tomcat (or jetty), spring , whatever open source stack feel confortable with. lower turnaround time compensate time needed put together, solution more "lightweight" , simple. today java ee 6 web profile pretty simple , lightweight, glassfish has decent deploy , publishing time, , ejb 3.1 far being monster once (say ejb 2). fire app server , pretty setup (at cost of, maybe, little "service layer overhead" compared using ...

Add friends from facebook with Rails 3 + OmniAuth + FBGraph -

i'm trying write add friends step our registration system, , i've been asked implement similar way foursquare works. it pulls down friends facebook, checks see if of them on foursquare site, , asks if want connect them. what best way go implementing kind of functionality? i have seen examples fb js sdk, prefer more integrated approach. thanks adam the best way found using devise oauth , fb_graph gems (like specified here , here ). had issue versions gemfile configuration looks this: gem 'devise', :git => 'git://github.com/plataformatec/devise.git' gem 'omniauth', '>=0.2.0.beta' gem 'oa-oauth', :require => 'omniauth/oauth' gem 'fb_graph' (my configuration quite old - it's possible devise latest branch supports omniauth in more out-of-the-box way). my devise initializer: config.omniauth :facebook_publish, "app_id", "app_secret" in user model: devise :omniauth...

database - On update, PHP is making all fields empty -

i using following code. whenever form used update, php empty fields in db. know happen if field_names don't match, have triple checked them, work. first time getting error. not sure do. code: //getting unique id $sql = "select `person_id` `accounts` `username` = '$username'"; $query = mysql_query($sql) or die ("error: ".mysql_error()); while ($row = mysql_fetch_array($query)){ $pid = $row['person_id']; } mysql_free_result($query); $newname = mysql_real_escape_string($_post['full_name']); $newgender = mysql_real_escape_string($_post['patient_gender']); $newmonth = mysql_real_escape_string($_post['month']); $newday = mysql_real_escape_string($_post['day']); $newyear = mysql_real_escape_string($_post['year']); $newacctss = mysql_real_escape_string($_post['acct_ss']); $newaddress = mysql_real_escape_...

indexing - Choosing data.table keys in R -

how choose right keys data.table objects? are considerations similar rdbmss? first guess have documentation indexes , keys rdbmss. google came helpful stackoverflow question related oracle. do considerations answer apply data.tables? perhaps exception of relating update, insert or delete type statements? i'm guessing our data.tables objects won't used in way. i'm trying head around stuff using documentation , examples, haven't seen discussion on key selection. ps: @crayola pointing me toward data.table package in first place! i not sure helpful answer, since mention me in question i'll think anyway. remember bit of data.table newbie myself. i use keys when there clear benefit it, e.g. merging datatables, or seems clear doing speed things (e.g. subsetting repeatedly on variable). knowledge, there no real need define keys @ all; package faster data.frame without keys.

c# - .NET Find Windows Sleep Settings -

i find out current windows sleep mode setting i.e. switched on , timer period. ideas? my preferences (in order) are: .net managed code api read registry value here stored in registry: [hkey_current_user\control panel\powercfg] "currentpowerpolicy"="2" power scheme (default="0") "0" = home/office desk "1" = portable/laptop "2" = presentation "3" = on "4" = minimal power management "5" = max battery then access it: registrykey key= registry.currentuser.opensubkey("control panel\powercfg", true); var value = key.getvalue("currentpowerpolicy", 0); there key called policies reg_binary stores specific information. can use example on page read it: http://www.eggheadcafe.com/community/aspnet/2/13312/registry-access-for-regbinary-values.aspx

gradient - Newton's method for multivariate optimization in matlab -

how compute gradient , hessian matrix when equation cannot solved numerically? my minimization equation is: c=c[(x/y/(1-x)^2)^0.6 + (1-(x/y)/(1-y)^2)^0.6 + 6/y^0 i tried matlab function "diff" compute gradient , hessian. derivations longer 1 can handle. how write code computing hessian or gradient? why equation cannot solved numerically? mean cannot solved analytically? there appears typo in statement of function c wish optimize. when refer use of matlab's diff() function, mean evaluated function on grid , differenced it? or talking passing function handle matlab's symbolic library?

c# - Should i use regular expression in this situation? -

i have xml file containing expressions :- 1. aaaaaaa-1111 2. aaaaa-1111-aaa 3. aa11111-11111 4. aa111-111-111111 (aa static text) (aaaa-any alphabet only) hyphen (1111 - digit only) i thinking should write regular expression these believe regex should right approach. but xml file dynamic. user can remove or add different expressions in list. how can use regular expression here? there dynamic regular expression kind of thing. show me light here please. update:- using these expressions validate user input. whatever user entering in box, should matched of these expressions list. for example:- if user enters aaabc-4567-trr , should validated coz matches 2nd expression in list well, what assume question that: a letter a a letter 1 number that's way see aaabc-4567-trr matches aaaaa-1111-aaa is correct? if correct, yes, use regular expressions. need translate your patterns regex patterns . assuming have new pattern: aaa-aaa-111 ...

vb.net - ShowWindowAsync() don't show hidden window (SW_SHOW) -

hello i'm using visual basic 2008 here part of code: private const sw_hide integer = 0 private const sw_show integer = 5 <dllimport("user32.dll", setlasterror:=true, charset:=charset.auto)> _ private shared function showwindowasync(byval hwnd intptr, byval ncmdshow integer) boolean end function button1 code: try dim p() process = process.getprocessesbyname("notepad") dim mwh = p(0).mainwindowhandle showwindowasync(mwh, sw_hide) catch ex exception msgbox("error") end try button2 code: try dim p() process = process.getprocessesbyname("notepad") dim mwh = p(0).mainwindowhandle showwindowasync(mwh, sw_show) catch ex exception msgbox("error") end try when click button 1 ( hide windo...