Posts

Showing posts from August, 2013

creating a rotating space in Chipmunk -

i'm looking make small app in ball bounces around inside square frame. thats simple enough implement, user able rotate frame manually (using rotating gesture) ball moving around. have looked using chipmunk accomplish seems not possible rotate cpspace, bodies held within it. my question is: can such process implemented in chipmunk using cpbody objects, or woud wasting time trying? easier try , create own system using things bezierpaths containspoint method? thanks help, james you should @ "tumble" demo comes chipmunk. sounds pretty want.

libxslt - XSLT: xsltApplyStylesheet returns null -

i've xml , xsl file. output xsl text i.e if conditions fail, result description of failure. if conditions pass, result null. if run in xsltproc, works fine. however, if run using libxslt using function xsltapplystylesheet, see empty result. input xml xsltapplystylesheet created dynamically in code. xsl file read using xsltparsestylesheetfile. (i used xmldocdumpformatmemory of both xml , output of xsltparsestylesheetfile->doc, both seems fine). tried xsltsaveresulttostring after applystylesheet, doesn't work well. what possible issue here? code snippet: xmldoc = xmlnewdoc(bad_cast "1.0"); c = xmlnewnode(null, bad_cast "company"); xmladdchild(c, node); //node child in xml xmladdchild(c, d); //d child in xml xmldocsetrootelement(xmldoc, c); ..... xsl = xsltparsestylesheetfile("xsl.file"); .... output = xsltapplystylesheet(xsl, xmldoc, null); .... //output has "<?xml version="1.0"?>"

What are some reasons for jquery .focus() not working? -

some thoughts element_id.focus() inside divs hidden @ times. this should easy problem solve -- i'm struggling :( ***code works fine -- text field isn't being focused on upon page loading up. step1 [solved] javascript: $("#goal-input").focus(); $('#goal-input').keypress(function(event){ var keycode = (event.keycode ? event.keycode : event.which); if(keycode == '13') { etc, etc, etc } html <input type="text" id="goal-input" name="goal" /> [step2] javascript: if (goal) { step1.fadeout('fast', function() { step1.hide(); step2.fadein('fast'); etc, etc html: <div id="step-2"> <div class="notifications"> </div> <input type="text" id="name" name="name" placeholder="name" /> <script type="text/javascript">

font face - CSS Padding variations between Chrome, Firefox + Safari -

i'm using font-face + css. text padding appears fine in browsers except safari , chrome on mac, it's rendering top padding 20px or so... piece of css in question: p.style10 {font-family: 'titilliumtext22lthin', arial, sans-serif; font-size: 17px; line-height: 19px; color: #ffffff; padding: 20px 40px 10px 10px} here's how appears incorrectly in chrome/safari (mac): http://siddharthkhajuria.com/srv/chrome.png and correctly in firefox (mac): http://siddharthkhajuria.com/srv/firefox.png any help/suggestions on why it's appearing padding in chrome/safari on mac? thanks! sidd. -- here's relevant bit of html too: <!-- start of promos 1 --> <div class="g320" style="background-image:url(img/p1.png); width:310px; height:354px; overflow:hidden;"> <p class="style9"><strong>'bootylicious' tom rosenthal</strong><br /><br />a video tom's reworking of destiny'

javascript - Is it not a right way to call my obj function? -

i have function return object. in object have 2 function show popup , close it. works within parent function, it's not out side.. not right way call that.. else how can call obj function out side? my function : var popuphandler = function(handler,msg,popup){ msg = msg == "help" ? "help" : "results" $(handler).click(function(){ popobj.showpop(); //works }) $('.cls-how2play').click(function(){ if(msg == 'help') popobj.closepop(); //works }); var popobj = { showpop : function(){ if(!(popup).is(':visible')) $(popup).fadein().children().find('.'+msg).show().siblings().hide(); }, closepop : function(){ $(popup).fadeout() } } return popobj; } from calling ouside : $('.ui-footer').click( function(){ var closeit = popuphandler(); closeit.popobj.closepop() }) //not w

terminology - Are "class functions" referred to as "functions" or "methods" in Python -

see code below class helloworld: def print(self): print "hello world" is helloworld.print(self) called method or function in python? they referred class methods or instance methods.

lucene - Fuzzy search with punctuation -

i'm using lucene.net , have text t-rex saved in lucene document. want find t-rex when enter following keywords: t rex , trex i haven't managed results fuzzy search yet. , have no experience in lucene. can solve custom analyzer? should save text different? trex instead of t-rex ?

How to send a 'hand coded' http request? -

for test , learning purpose, console available send http request like /index.html http/1.1␍␊ host: www.example.com␍␊ ␍␊ and response. i know curl pretty handy, what explore what's under hood or write request in text file , send curl? grab hold of netcat tool: echo -en 'get /index.html http/1.1\r\nhost: stackoverflow.com\r\n\r\n' | nc stackoverflow.com 80

actionscript 3 - Away3D with Starling -

i have away3d 4.0 application ui made in old flash display api, can partly hardware accelerated. on pc works fine, frame rate of ui on mobile devices low, hence porting starling. so tried using both away3d , starling, don't work (it compiles there run-time errors). have change? or maybe 2d library such nd2d. there libraries support out of box? edit: first add away3d content , there no errors. when initialising starling, error in starling.as (a library class) on line 249. tried this suggested, didn't make difference (also information 3 months old , libraries being updated). edit 2: error caused having different enabledepthandstencil value in away3d, hardcoded in sparling false, because doesn't need it. well, after "fixing" there no runtime errors: away 3d content displays, add starling , canvas becomes black. guess have dive away3d source. you can view source of starling library on github repository. here link starling.as file> https://gi

c# - SaveChanges doesn't do anything using LINQ Entities over OData -

in cases have been able trick detecting change using updateobject: public updateorderdescription(int userid) { var entities = new databaseentities(new uri("http://someserver/orderservice.svc")) { useposttunneling = true}; var order = (from o in entities.orders o.userid == userid select o).single(); order.description = "hello"; entities.updateobject(order); entities.savechanges(); } but doesn't work when using many-to-many relationship using navigation properties, since can not perform updateobject on navigation property. take @ article: http://msdn.microsoft.com/en-us/library/dd756361.aspx in short client library wcf ds needs notified changes want make. default done using updateobject, setlink, addlink , similar methods on context.

flex - File Upload with Adobe Air -

i'm trying upload file flex minus.com the api reference explain upload example: post /api/v2/folders/0fqhjakl/files?bearer_token=[token] http/1.1 host: minus.com content-type: multipart/form-data; boundary=----webkitformboundaryxecy8varbqixzw4f accept-charset: utf-8,*;q=0.5 ------webkitformboundaryayaohdwfizxzb8oe content-disposition: form-data; name="file"; filename="test.txt" content-type: text/plain test ------webkitformboundaryayaohdwfizxzb8oe content-disposition: form-data; name="filename" test.txt ------webkitformboundaryayaohdwfizxzb8oe content-disposition: form-data; name="caption" testfile ------webkitformboundaryayaohdwfizxzb8oe-- my as3 code is: var params:urlvariables = new urlvariables(); params.caption = object.offlinefiles[0].name; params.filename = object.offlinefiles[0].name; params.bearer_token=appmodel.logindata.access_token; var fr:file = (object.offlinefiles

php - pass link text to next page -

for actual web-project, made tagcloud. when click on tag, should passed page showrecipesfromtags.php . <form name="tagform" id="tagform" method="get" action="/showrecipesfromtags.php"> <?php include('php/getrandomtags.php'); $tagsarr = json_decode($return4634, true); foreach ($tagsarr['data']['tag'] $key => $tag11) { echo '<a id="seastags" href="#" onclick="document.tagform.submit()"><font size="' . rand(1,4) .'">' . $tag11['tag_name'] . '</font> <br/></a> '; } ?> </form> it can go page clicking on href, need pass id of clicked tag. name of tag called tag_name . name shown don´t know how pass id next site. id in json array , called tag_id . how can manage this? why need form? use plain links. try using in foreach loop: echo '<a id="seastags" href="/showre

Is it possible to create dynamic HTML pages with Javascript? -

is possible create dynamic html page javascript ? or tomorrow... (is possible see javascript replacing php, asp, jsp or asp.net ?) it sounds question whether js can used server-side code. answer yes - popular node.js , highly recommend. it's not version 1 yet, it's being used in production bunch of high-profile companies. for more info, see this question.

character encoding - What's the difference between \r\n and \n -

in terminal seems no difference between two echo -en 'first\r\nsecond' , echo -en 'first\n\second' but in code without \r doesn't work echo -en 'get /test http/1.1\r\nhost: localhost\r\n\r\n' | nc localhost 9292 works, but echo -en 'get /test http/1.1\r\nhost: localhost\n\n' | nc localhost 9292 doesn't anyone can explain why is? some applications can handle both \r\n (a.k.a. crlf, carriage return line feed) , \n (a.k.a. lf, line feed) equivalently newline sequences. terminal example. the http/1.1 specification dictates http header lines end crlf. so, http server adheres specification (such 1 you're running on localhost:9292) not interpret lf valid http header line termination sequence.

java - IndexOutOfBoundException when reading a file -

i working on tftp server application. managed process successful file transfer server client other way around bugged. client instead of transmitting entire file terminated whit compiler returning no errors. debugger shows iobe exception on marked code referring array out of range. the whole transfer process goes so: client transmits file name , requested operation wrq - write request server received packet , determines operation if wrq gives new file appropriate name. server starts executing receivedata() until gets packet < 512 indicationg eot client keeps transferring data read file. key code: client: private void sendwrq() throws exception { string rrq = "wrq-" + data; outgoingdata = rrq.getbytes(); datagrampacket output = new datagrampacket(outgoingdata, outgoingdata.length, serveraddress, serverport); clientsocket.send(output); //thread.sleep(50); senddata(); } byte outgoingdata = new byte[512]; private void senddata() thr

python - Struggling with slice syntax to join list element of a part of a list -

suppose have simple python list this: >>> l=['0', '1', '2', '3', '4', '5', '6', '7', '8', '9'] now suppose want combine l[2:6] single element this: >>> l ['0', '1', '2345', '6', '7', '8', '9'] i able in steps new list, this: >>> l2=l[0:2] >>> l2.append(''.join(l[2:6])) >>> l2.extend(l[6:]) >>> l2 ['0', '1', '2345', '6', '7', '8', '9'] is there way (that missing) more , in place on original list l ? edit as usual, sven marnach had perfect instant answer: l[2:6] = ["".join(l[2:6])] i had tried: l[2:6] = "".join(l[2:6]) but without braces, string produced join treated iterable placing each character in list , reversing join! consider: >>> l=['abc','def','ghk

netbeans - Adding a component to jPanel java -

i'm trying add jtable component jpanel unable see it. doing wrong?. table gui = new table(data,colum); mainpanel.add(gui.table); class table extends jframe { public jtable table; public table(vector data, vector colum) { setlayout(new flowlayout()); table = new jtable(data,colum); table.setpreferredscrollableviewportsize(new dimension(900,10)); table.setfillsviewportheight(true); jscrollpane scrollpane = new jscrollpane(table); add(scrollpane); } } extending jframe seems odd; don't use of top level container capabilities. here's example extends jpanel, main() drops panel jframe. --edited accept existing jpanel public class tablepanel { public static void addtabletopanel(jpanel jpanel, vector rowdata, vector columnnames) { jtable jtable = new jtable(rowdata, columnnames); jtable.setfillsviewportheight(true); jscrollpane jscrollpane = new jscrollpane(jtable); jscrol

write object to file java -

i creating application manages agenda. each contact must written in object file. how can check if file exists , there way write next object without overwriting?? my class: import java.io.*; public class writefile { public void setcontact(agenda contact){ objectoutputstream out; try{ file file = new file("contacts.txt"); out = new objectoutputstream(new fileoutputstream(file)); out.writeobject(contact); out.flush(); out.close(); system.out.println("object written file"); } catch (filenotfoundexception ex) { system.out.println("error specified file") ; ex.printstacktrace(); } catch (ioexception ex) { system.out.println("error i/o processes") ; ex.printstacktrace(); } } } using code, believe easiest thing make use of file.exists() met

r - Replacing for-loops with apply to improve perfomance (with weighted.mean) -

i r newbie solvable problem of you. have dataframe containing more million data-points. goal compute weighted mean altering starting point. to illustrate consider frame ( data.frame(matrix(c(1,2,3,2,2,1),3,2)) ) x1 x2 1 1 2 2 2 2 3 3 1 where x1 data , x2 sampling weight. i want compute weighted mean x1 starting point 1 3, 2:3 , 3:3. with loop wrote: b <- rep(na,3) #empty result vector for(i in 1:3){ b[i] <- weighted.mean(x=a$x1[i:3],w=a$x2[i:3]) #shifting starting point of data , weights further end } with real data impossible compute because each iteration data.frame altered , computing takes hours no result. is there way implement varrying starting point apply command, perfomance increases? regards, ruben building upon @joran's answer produce correct result: with(a, rev(cumsum(rev(x1*x2)) / cumsum(rev(x2)))) # [1] 1.800000 2.333333 3.000000 also note much faster sapply / lapply approach.

memory management - Invalid free Valgrind -

for reason calling function 'delall' more once cause invalid free error valgrind. don't understand why if call function second time cause program go while loop again though "delall" of node //p linked list call struct node{ char *str, int data, struct node *next; } //here's function having trouble with: void delall() { struct node *temp,*temp2; temp=p; while(temp!=null) { temp2=temp; temp= temp->next; free(temp2->str); free(temp2); } } p pointer list, , right still after delall call point (free'd) start of list. i'd do; p=null; ...right after while loop set p null (ie have list cleared). prevent delall trying free elements again. of course depend on p not being temporary variable, i'm assuming it's real "start of list" pointer.

css - right align text to edge of embedded media -

i need text appear below embedded media (in case video), , text right-align video. i'm not sure how this, since layout needs fluid. videos wider others. currently text right-aligning wrapping div. here's fiddle have far http://jsfiddle.net/thwackukulele/2n6a9/ i text "watch more videos on our youtube channel" align video's right edge. thanks help! videos can varying width never wider 960px set on content-unit? if content-unit centering everything, set framewrap inline-block. make shrink-wrap contents (here, video), , if content-unit has text-align: center set on it, inline-block framewrap centered (at whatever width turns out be). now, because width contrained widest content (the iframe here, inline element), h4 can set text-align right , text should restricted right side of framewrap, since block h4 still expand 100% of whatever framewrap is. ah, have lot of positioning , margins in there can't see doing, don't expect code fix

osx - MySQL: Remove all references to database -

while importing dump newly created database, server stopped classic server has gone away message. know why happened , fact did occur isn't part of problem. i've removed database directory /usr/local/mysql/data/ , still mysqld not start successfully, because of log or init file. the goal fixed without having reinstall mysql. mysql err log: innodb: page checksum 1559794421, prior-to-4.0.14-form checksum 641317514 innodb: stored checksum 3364647797, prior-to-4.0.14-form stored checksum 641317514 innodb: page lsn 16 1049927436, low 4 bytes of lsn @ page end 1049927436 innodb: page number (if stored page already) 43379, innodb: space id (if created >= mysql-4.1.1 , stored already) 0 innodb: page may index page index id 0 3302 innodb: (index "some_index" of table "some_database"."some_table") innodb: database page corruption on disk or failed innodb: file read of page 43379. innodb: may have recover backup. innodb: possible operating innod

c++ - Why is my output stream seg faulting and my virtual destructor does not work but when i kill virtual it does -

i reviewing test , working on personal project doing incremental development. want in university studies. it seg faults on ostream operator , virtual function not work unless out virtual . #include"mystring.h" mystring::mystring( ) //constructor { size=0; capacity=1; data=new char[capacity]; } mystring::mystring(char * n) //copy constructor { size=strlen(n); capacity=strlen(n)+1; data=new char[capacity]; strcpy(data,n); } mystring::mystring(const mystring &right) // { size=strlen(right.data); capacity=strlen(right.data)+1; data=new char [capacity]; strcpy(data,right.data); } mystring::~mystring( ) { delete [] data; } mystring mystring::operator = (const mystring& s) { if(this!=&s) { mystring temp=data; delete [] data; size=strlen(s.data); capacity=size+1; data= new char [capacity]; strcpy(data,s.data); } } mystring& mystring::append(const

.net - Where can I find a "stable" or "release" version of the MVC Mini Profiler source code? -

i downloaded mvc mini profiler source code github , compiled it, , integrated company's website. however, i've started noticing couple of bugs, made me realize didn't download particular "stable" or "release" version -- downloaded latest, in-development version github. so now, i'm trying figure out if there's stable version can download, nothing mentioned on github nor google code repos! as understand it, there nuget package can used grab latest "release" binaries. however, require source code, because have couple of modifications i'm making source. does know how find latest stable version? version stackoverflow use? edit : mentioned implementing .net 3.5 support, that's unrelated question. i don't have specific pin, however! se inc. using build (checks repo) wed feb 22. ties in 2.0.0-rc1 . therefore, think can conclude 8325ee327870 commit want, although next 2 (397592adda97 , c6f8413a4727) innoc

ssl - Troubleshooting Java RMI Client network connection refusal -

this has never worked before - i'm setting environment first time. multiple updates below i've got rmi server running in "daemon" type of process because want running @ system startup service (not using xinitd feature), can utilize ssl, , can give commands daemon pertaining goes registry via separate mechanism. (iow, i'm not using runtime.getruntime().exec("rmiregistry 2020"); ) i know rmi server , running because works: telnet localhost <port> my client code encodes lot of environment varriables ssl command line start - later, i'll programatically, now, starts with: $ java -djavax.net.ssl.truststore=/var/rmissl/truststore -djavax.net.ssl.truststorepassword=<pwd> -djava.rmi.server.hostname=localhost my.package.test at first got was: java.rmi.connectexception: connection refused host: localhost; nested excepti on is: java.net.connectexception: connection refused which pretty useless, except there error. so,

c# - Thread: How to re-start thread once completed? -

i have method void dowork(object input) takes 5 seconds complete. have read thread better suited threadpool these longer operations have encountered problem. i click button calls threadrun.start(input) runs , completes fine. click button again , receive following exception: thread running or terminated; cannot restart. can not "reuse" thread? should use threadpool? why thread "better suited longer operations" compared threadpool? if can't reuse thread, why use @ (i.e. advantages offer)? can not "reuse" thread? you can. have code thread not terminate instead wait more work. that's thread pool does. should use threadpool? if want re-use thread, yes. why thread "better suited longer operations" compared threadpool? imagine thread pool serving large number of quick operations. don't want have many threads, because computer can many things @ time. each long operation make thread pool ties thread

mysql - php header location wont work -

i tried make ip based deny list stored ip numbers in mysql. basicly try header redirect if user's ip in array wont work. wrong? $ip_array = array(); $ip_ban_query = mysql_query("select ip banned_ips"); while ($deny = mysql_fetch_assoc($ip_ban_query)){ $add_ip = $deny['ip']; $ip_array[] = $add_ip; } if (in_array ($_server['remote_addr'], $ip_array)) { header("location: http://www.google.com/"); exit(); } we can simplify code here.. reducing complexity flushes away bugs. :) // there several different methods accomplish this, , // should using statements here, both out of scope of question. $ipbanquery = sprintf("select ip banned_ips ip = '%s'", mysql_real_escape_string($_server['remote_addr'])); $result = mysql_query($ipbanquery); if (mysql_num_rows($result)) { header('location: http://www.google.com/'); exit(); } it depends on you're calling code. extra-sure being called before

iphone - UIPageControl using Interface builder -

i succeeded in implementing horizontal scroll using uipagecontrol + uiscrollview using code. views in pages more involved , need fine grain control. trying design views using interface builder. all examples uipagecontrol & uiscrollview seem use code generate views. 1) can point me example uses ib design views , manage scrolling in code? need support ios4 - no storyboards. 2) if advise against approach due memory concerns, can please suggest alternative approach maintains similar effect? i use navigation based project.

Gzip html files shows weird chars in chrome -

Image
using gzip on php output this if( isset($compression['html']) && $compression['html'] == true) { ob_start("ob_gzhandler"); header("cache-control: must-revalidate"); header("expires: ".gmdate('d, d m y h:i:s', time() + $compression['expire'])." gmt"); } produces error show in image below. works fine in ff , safari, in chrome not. idea how solve it? this header get request url:http://www:8888/formandsystem/gzo/de/dashboard request method:get status code:200 ok request headersview source accept:text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 accept-charset:iso-8859-1,utf-8;q=0.7,*;q=0.3 accept-encoding:gzip,deflate,sdch accept-language:en-us,en;q=0.8,de;q=0.6 cache-control:max-age=0 connection:keep-alive cookie:ci_session=kyk5%2bhpx3n6de7v9ioztdznrwt8rhedqatyz7ztaoaahbubmwfk2escdjozl0bzwfi89yspmwere6nz24t%2bccgq4imtysjl12fv%2b2gmmma%2fpiolxulo7cbx%2b%2bmfzblteneenhjbc16oxg456nykd

actionscript 3 - Building a swc in command line or ant -

first off - i'm not super familiar flash builder or actionscript. have actionscript project in flash builder. know can generate swc file doing project > build, , build swc file actionscript source code. is there way generate swc in command line or ant? i'd able put build process inside build script don't need go through flash builder build swc file everytime. thanks! yes, see compc . compc -source-path . -include-classes mycomponent -output mycomponent.swc mycomponent.as (source file mycomponent ) in current directory, why -source-path set . . if have many classes library, can use manifest file namespace. see: http://livedocs.adobe.com/flex/3/html/help.html?content=compilers_22.html there's compc ant task.

Getting previous line in Bash after new command? -

in bash terminal, type command , realize needed sudo command. hit arrow previous command , backtrack beginning type sudo , enter. is there way type sudo, press key pull down previous command after sudo? thanks! yes: can use "history expansion" , , write !! : $ foo bash: foo: command not found $ sudo !! sudo foo <-- prints out expanded command bash: sudo: command not found <-- , runs

php - How to handle network failure in paypal Express Checkout after payment? -

i using paypal express checkout method in php site payment user. problem if loss internet connection after user made payment in paypal website if network fails before reaches website result array transaction details transaction id, amount, etc., how handle situation? finally found answer own question left unanswered lot of days based on robert's comment. please read this complete document know complete details.

How to force to show PDF in google chrome using Adobe PDF Plug-In only -

i facing problem while showing pdf in google chrome. issue chrome shows pages of pdf black. this happens when chrome pdf viewer enabled. if disable plug-in , use adobe pdf plug-in works fine. is there way show pdf in google chrome using adobe pdf plug-in only. as showing pdf using html object tag, there parameter forces chrome show pdf using adobe pdf plug-in? there's no way website force browser use 1 renderer or another: decisions made client-side. noted, disabling chrome pdf plugin bubbles adobe plugin top, that's decision user have make. that said, if have pdf rendering issues can share, please file bug @ http://new.crbug.com/ . i'll happy put in front of correct team triage.

spring - Accessing attribute with argument from file.properties in Java class -

let me explain want do: i got properties containing property this: message=hello {0}, welcome. i'd access property in java class using string , set parameter in class. i've use fmt:message , fmt:param display kind of property in jsp want manipulate in java object (i know how inject property class). any idea on how this? you can use java.util.resourcebundle , java.text.messageformat examples private string getstring( string bundle, string key, string defaultvalue, object... arguments ){ string result = resourcebundle.getbundle( bundle ).getstring( key ); if ( result == null ){ result = defaultvalue; } if ( arguments.length > 0 && result != null ){ result = messageformat.format( result, arguments ); } return result; }

xml - XForms repeat - JavaScript error -

i using xforms build web application xml-db exist-db backend. exist transforms xforms code html , javascript. first of got 2 instances: <xf:instance xmlns="" id="results"> <result> <servicedefinition> <inventorylabel lastchange="2012-01-24">svc380712435</inventorylabel> <systemname ipaddress="111.222.333.123">xxx</systemname> <service servicecategory="internetservice">web-server</service> <osclass operatingsystem="centos">unix</osclass> <systemtype manufacturer="vmware">vm</systemtype> <backup/> <location systemcontact="max power" admingroup="power">n22</location> </servicedefinition> .... </result> </xf:instance> <xf:instance xmlns="" id="domain"> <system name="xxx"> <

haskell - Automatic migration between different Persistent backends -

i wonder if there's tool automatic migrations between different dbms's using persistent package. in theory, should relatively easy do, thought there should tool written it. one (maybe hacky) solution create program uses mkpersist twice in different modules same definitions different backend configurations, , manually perform copy operation. there is, however, not tool available far know.

linux - Executing 'sed' through 'spawn' into a expect script -

i writing simple expect script accessing remote server without introducing password command window. i able access remote server, , there want modify text file. modification performed ' sed ' command finding 'keyword', line 'keyword' located deleted. the part of code giving me problems combination of ' spawn ' ' sed ' following one spawn sed -i -e '/keyword_to_delete/d' /home/my_file since doing in expec file have through 'spawn' command. switch on debug info mode , main error info in screen : expect: set expect_out(buffer) "exit\r\nsed: -e expression #1, char 1: unknown command: `''\r\n" cannot interact self - set spawn_id spawned process i hope have show problem here clear , in nice way, if not tell me , try better. thanks much code: set ip [lindex $argv 0] set port [lindex $argv 1] set password <pswd> proc sendpass {} { global ip global port global password spawn "/us

c# - Xdocument.Load is failing -

i unable load xdocument.load unable load xdocument.loadi unable load xdocument.loadi unable load xdocument.loadi unable load xdocument.loadi unable load xdocument.loadi unable load xdocument.loadi unable load xdocument.loadi unable load xdocument.load public void authornames(string uri) { credentialcache credentialcache = new credentialcache(); credentialcache.add( new uri("https://www.restwebservicessite.com"), "basic", new networkcredential("userid", "pwd")); httpwebrequest request = (httpwebrequest)webrequest.create(uri); request.allowautoredirect = true; request.preauthenticate = true; request.credentials = credentialcache; request.automaticdecompression = decompressionmethods.gzip; try { using (httpwebresponse response = request.getresponse() httpwebresponse) { xmlreader responsereader = x

Mouse events propagation from marker to underlying map -

i have 1 question, why dose mouse events related map never fire when on marker exp. having mouse move listener added map never called when move on marker (there not called event propagation or bubbling). this actully working on maps v2! is bug, or changed behavior in v3? blaze here example... if move around map, maplabel updated should if u move on marker maplabel never updated var map; function initialize() { var mylatlng = new google.maps.latlng(-25.363882,131.044922); var myoptions = { zoom: 4, center: mylatlng, maptypeid: google.maps.maptypeid.roadmap } map = new google.maps.map(document.getelementbyid("map_canvas"), myoptions); google.maps.event.addlistener(map, 'mousemove', function() { document.getelementbyid('movelabel').innerhtml = 'mouse map move' + math.random(); }); var marker = new google.maps.marker({ position: mylatlng, map: map, title:"hello world!" }

How to load FTGLES (or any other text rendering) for Android -

i tasked writing application uses opengl es 1.0 (or 1.1 if necessary) , need able render text on screen. bitmap text , textured fonts aren't choice here. know ios there's ftgles, states android support in "near future", given deadlines on project, need answer (whether works/could work/doesn't work/etc) sooner "the near future" unfortunately. i've scoured through posts here , other places , haven't found of helps. i've tried using jni , ndk in eclipse, nothing useful has come that. i'd appreciate if can point me in right direction. i've tried jumpcore, application isn't native code, it's written in java. i'm bit surprised hasn't resolved (in fashion have found now). , me find solution this. edit: in jni folder, placed source (each in own subfolder) freetype , ftgles. had compile different version of sqlite enable rtree. getting caught because compiling wrong files. proves helpful. here's make file ftgles

c++ - Possible to re-name STL vector? -

i working on big , old c++ project. word "vector" has been used on place. trying add new functionality project utilizing stl vector. not working. in addition, allowed modify specific sections of code, can not change use of "vector". is there way rename stl vector , use it? use c++ namespaces . #include <vector> // note absence of `using namespace std;` line int main() { // note `std::` qualification std::vector<int> x; // ... }

c# - MsTest with Task.ContinueWith() and Task.Wait()...? -

i'm still in .net 4.0 , wondering whether pattern hold in various kinds of async unit testing situations: /// <summary> /// noaa weather test: should read remote xml. /// </summary> [testmethod] public void shouldreadremotexml() { var uri = new uri("http://www.weather.gov/xml/current_obs/klax.xml"); var wait = httpverbasyncutility.getasync(uri) .continuewith( t => { assert.isfalse(t.isfaulted, "an unexpected xml read error has occurred."); assert.istrue(t.iscompleted, "the expected xml read did not take place."); if(t.iscompleted && !t.isfaulted) frameworkfileutility.write(t.result, @"noaaweather.xml"); }) .wait(timespan.fromseconds(7)); assert.istrue(wait, "the expected xml read did not take place within 7 seconds."); } will task.continuewith()...task.wait() pattern hold in real world? i'm re

php - How strip a section of a url away to get the remaining unique ID -

hi have variable youtube url user-generated. there lot of threads on here regex , not, being executed in js. want run server-side in php, here simple function: function youtubeid($url){ $url = preg_replace('http://youtu.be/ regex goes here', '', $url); return $url; } markup: <a href="http://youtu.be/yhxhvmkxnky"><img src="http://img.youtube.com/vi/'.youtubeid($variable).'/0.jpg" /><img src="play.png" alt="watch video" title="watch video"/></a> question: know proper regex http://youtu.be/ ? i'm sure quick answer, i'm not savvy regex. on side note,does know of resources can teach myself regex don't have ask silly syntax questions this? cheers. why use (relatively slow) regex @ all? $url = substr($url, strlen('http://youtu.be/')); obviously have set start point no need calculate each time call function, doing here demonstrate idea.

android - gps app reverse geocoding error -

im trying change code reverse geocoding well. coordinates work fine. im gettin error: location cannot resolved variable. error @ line of code: list<address> addresses = geocoder.getfromlocation(location.getlatitude, location.getlongitude, 1); my full code is: package gps.attempt; import java.io.ioexception; import java.util.list; import java.util.locale; import android.app.activity; import android.content.intent; import android.location.address; import android.location.location; import android.location.geocoder; import android.location.locationlistener; import android.location.locationmanager; import android.location.locationprovider; import android.os.bundle; import android.util.log; import android.widget.textview; import android.widget.toast; public class gpsattemptactivity extends activity implements locationlistener { /* class implements locationlistener, listens both * changes in location of device , changes

css - Difference between CSS3 transitions' ease-in and ease-out -

what’s difference between css3 transitions’ ease-in , ease-out , etc.? css3's transitions , animations support easing, formally called "timing function". common ones ease-in , ease-out , ease-in-out , ease , , linear , or can specify own using cubic-bezier() . ease-in start animation slowly, , finish @ full speed. ease-out start animation @ full speed, finish slowly. ease-in-out start slowly, fastest @ middle of animation, finish slowly. ease ease-in-out , except starts faster ends. linear uses no easing. finally, here's great description of cubic-bezier syntax, it's not necessary unless want precise effects. basically, easing out slow halt, easing in accelerate, , linear neither. can find more detailed resources @ documentation timing-function on mdn . and if want aforementioned precise effects, amazing lea verou’s cubic-bezier.com there you! it’s useful comparing different timing functions graphically. another, the steps() t

asp.net - Eval() showing null value -

i using <%#eval("sectionid") %> data binding expression bind data code-in-front. setting sectionid in code behinde using following code, public partial class productdetails : system.web.ui.page { private string sectionid = string.empty; protected void page_load(object sender, eventargs e) { if (!page.ispostback) { if (request.querystring.count > 0) { if (request.querystring["secid"] != null || request.querystring["prodid"] != null) { sectionid = request.querystring["secid"].tostring(); } } } } } where in .aspx page have code this, <a href="sectionwiseproduct.aspx?secid=<%#eval("sectionid") %>">enviro section</a> every time value sectionid set in code behinde not reflecte

Elegant way to implement Login page in JSP -

i'm beginner in jsp web development. have login (login.jsp) page webapp has standard login controls (eg. username, password text-boxes, remember me checkbox , login button) want attain when user provides credentials, upon submitted details, authenticate.jsp called, credentials matched database, if they're correct, session user created , if credentials incorrect. redirect user login page response.sendredirect("./login.jsp?status=fail"); on login.jsp, status parameter checked , when gives value fail have <div> below textboxes has message user name or password incorrect! , shown user upon such failure. safe send such parameters via url (for given purpose)? more appropriate or standard way implement this? also, when user visits login page first time, looking status parameter throw nullpointerexception . have entire login.jsp code checking parameter below. try { string stat = request.getparameter("status"); if(stat.equals