Posts

Showing posts from January, 2013

php - MySQL Sleeping Threads Eating up all my Connections -

php - MySQL Sleeping Threads Eating up all my Connections - i've been continually getting "too many connections" errors on site uses php , mysql. in looking @ info mytop (show processlist), find of these connections sleeping ones. tried setting mysql settings interactive_timeout , wait_timeout 120 seconds processes still somehow sleeping longer that. php max_execution_time set 30 seconds why script maintain mysql connection open more 30 seconds? not explicitly calling mysql_close in of scripts , i'm not using pconnect. have suggestions or advice on need or at? give thanks you! try adding explicit mysql_close($conn) or relevant function particular driver scripts you're using see if it's php failing kill connections. php mysql connections

jquery - How to check whether selected node is having child nodes or not in jstree? -

jquery - How to check whether selected node is having child nodes or not in jstree? - i m taking selected node next code. var selected=$("#warehousetree").jstree('get_selected'); and want check kid nodes selected node. try this: var tree = jquery.jstree._reference('#warehousetree'); var children = tree._get_children(selected); which homecoming array of jquery objects of children of selected node. jquery jstree

css - How to force table cell content to wrap? -

css - How to force table cell <td> content to wrap? - heres entire page * wrappable definded in main.css file /* wrappable cell * add together class create sure text in cell wrap. * default, data_table tds not wrap. */ td.wrappable, table.data_table td.wrappable { white-space: normal; } heres entire page: <%@ include file="../../include/pre-header.html" %> <form id="commentform" name="commentform" action="" method="post"> <ctl:vertscroll height="300" headerstyleclass="data_table_scroll" bodystyleclass="data_table_scroll" enabled="${user.scrolltables}"> <ctl:sortabletblhdrsetup toptotal="false" href="show.whatif_edit_entry? entryid=${entry.entryid}"/> <table class="data_table vert_scroll_table"> </tr> <tr> <ctl:sortabletblhdr styleclass="...

"411 Length required"-response from Google Docs Api using Android API 10 and below -

"411 Length required"-response from Google Docs Api using Android API 10 and below - i developing application android devices, , 1 part of enabling downloading , uploading between users google docs , device storage. problem have i'm getting different behavior between different versions of android api. i've been doing of development on api lvl 10 (android 2.3.3). no problems on virtual device (i don't have real device test api lvl or higher). on device , emulator of api lvl 8 (2.2.x) , below run 411 length required error google docs api when requesting start resumable upload session. not happen when running same application on emulator of api lvl 10. i developing eclipse , using google api java client 1.4.1-beta communicate docs api. documentation follow google docs api lies here: http://code.google.com/apis/documents/docs/3.0/developers_guide_protocol.html according said documentation, start resumable upload session 1 send empty post request. "root...

Reading the BitBucket API with Authentication for a Private Repository in C#.net -

Reading the BitBucket API with Authentication for a Private Repository in C#.net - i've been trying few days bitbucket api work me, have come grinding halt when comes getting work private repository authentication (with issues set private, when they're set public , no authentication needed works fine) code sample follows: static void main(string[] args) { webproxy prox = new webproxy("proxygoeshere"); prox.credentials = credentialcache.defaultnetworkcredentials; var address = "repositories/userfoo/slugbar/issues/1"; var repcred = new credentialcache(); repcred.add(new uri("https://api.bitbucket.org/"), "basic", new networkcredential("userfoo", "passbar")); webclient client = new webclient(); client.credentials = repcred; client.proxy = prox; client.baseaddress = "https://api.bitbucket.org/1.0/"; client.usedefaul...

java - Detecting which way mouse is scrolled -

java - Detecting which way mouse is scrolled - there 1 method in mousewheellistener interface. need different things depending on whether mouse scrolled or down. how accomplish such thing? information, have jpanel within jscrollpane. utilize mouse wheel motion zoom in or out. the mousewheelmoved method takes mousewheelevent parameter. there fields in parameter can utilize determine direction of scrolling (see mousewheelevent). 1 time know direction wheel moved in, can decide action perform. java swing event-handling mousewheel

c# - Generic Method where T is List that implements interface -

c# - Generic Method where T is List that implements interface - this similar c# - multiple generic types in 1 list however, want generic method take list of objects implement same interface. this code gives error there no implicit reference conversion. public interface itest { } public class interfaceuser : itest { } public class testclass { void genericmethod<t>(t mylist) t : list<itest> { } void testgeneric() { genericmethod(new list<interfaceuser>()); } } can done? define t itest , take list<t> argument public interface itest { } public class interfaceuser : itest { } public class testclass { void genericmethod<t>(list<t> mylist) t : itest { } void testgeneric() { this.genericmethod(new list<interfaceuser>()); } } c# generics

iphone - Zooming only an image in mobile Safari -

iphone - Zooming only an image in mobile Safari - i'm looking see if has experience this. i'm developer first , designer second, not strongest suit. i have project i'm working on goal image , text side-by-side in landscape mode on iphone. i'd able zoom in on image using pinch normal, not zoom in on text while happening. don't know if possible or kind of hacks take working. if thinks bad in general ui perspective, open suggestions. i have considered keeping 2 copies of image (low , high res) , swapping them out within of div overflow: scroll; users can zoomed version , scroll around. doesn't give total effect of zooming, might accomplish similar goal. don't know if work either. if has suggestions or experience on subject, please chime in. give thanks you! to in mobile safari have utilize javascript. theres jquery plugin here: http://plugins.jquery.com/project/pinch might of help iphone ios mobile-safari image-zoom

Send Email through C++ using Gmail Account -

Send Email through C++ using Gmail Account - i want send email through c/c++ programme using gmail account. find resources linux , did not work me. want on windows. sample program, or suggestion, how can appreciated. thanks #define win32_lean_and_mean #include <stdio.h> #include <stdlib.h> #include <fstream.h> #include <iostream.h> #include <windows.h> #include <winsock2.h> #pragma comment(lib, "ws2_32.lib") // insist on @ to the lowest degree winsock v1.1 const version_major = 1; const version_minor = 1; #define crlf "\r\n" // carriage-return/line feed pair void showusage(void) { cout << "usage: sendmail mailserv to_addr from_addr messagefile" << endl << "example: sendmail smtp.myisp.com rcvr@elsewhere.com my_id@mydomain.com message.txt" << endl; exit(1); } // basic error checking send() , recv() functions void check(int istatus, char *szfun...

java - How to clear bodycontent of a custom tag? -

java - How to clear bodycontent of a custom tag? - how clear body content placed within custom tag? <abc:mytag display="true"> <b> clear content </b> <abc:mytag /> based on display="true" boolean flag in tag handler, want clear out content "clear content". tried: if(display){ getbodycontent(); } else seek { getbodycontent().clear(); } grab (ioexception e) { // todo auto-generated grab block e.printstacktrace(); } but throwing null pointer exception if have reference custom element can do for (node child; (child = mycustomelement.getfirstchild()) != null;) { mycustomelement.removechild(child); } if need reference custom element can like element mycustomelement = mydocument.getelementsbytagnamens(namespaceforabc, "mytag"); or if aren't using xml namespaces, ...

malformed XML returned by curl command line -

malformed XML returned by curl command line - i'm sending string of xml tags , info in php api on server expecting xml. we sending string via command line this exec("curl http://addresstoapi.com/index.php?xml=$xml", $response); $xml string of tags , pringoperties sending api. the api processes string xml fine , returns response. $response contains returned success or failure xml sent array doesnt include of xml tags. unfortunately sending info string because server running php 4.3.9 without domxml extension , doesnt have php curl installed either. cannot run on server , cant upgrade server due other software running on it. so since need work api figured send xml string (which seems work fine) response isn't returned string or xml. we know api server returning xml logs every request , can see input document , returned response in log. somehow seems command line curl changing xml response array without tags. im hoping makes sense. know ...

.net - Correct calling of Dispose() for opened form -

.net - Correct calling of Dispose() for opened form - let's suppose have 2 forms: forma , formb . on forma button click instance of formb created , shown. how dispose() formb instance correctly after has been closed? to more precise, let's suppose code creates form: public void settings(object sender, eventargs e) { if (_settings == null) _settings = new settings(_repositorycollection, _config, this); _settings.show(); _settings.focus(); } if want modal dialog, utilize using (var settings = new settings(_repositorycollection, _config, this)) { settings.showdialog (); } otherwise, normal form shown @ same time forma... may not have to. see post.: _settings = new settings(_repositorycollection, _config, this); _settings.closed += delegate {_settings.dispose ();}; .net winforms

Java project was running, but when I'm trying to build it I have NullPointerException at startsWith (NetBeans) -

Java project was running, but when I'm trying to build it I have NullPointerException at startsWith (NetBeans) - i have next problem. when i'm running project netbeans ide evrything fine. when i'm trying build project have exception: compiling 2 source files d:\java\projects\streamer\build\classes exception has occurred in compiler (1.7.0-ea). please file bug @ java developer connection (http://java.sun.com/webapps/bugreport) after checking bug parade duplicates. include programme , next diagnostic in report. give thanks you. java.lang.nullpointerexception @ java.lang.string.startswith(string.java:1433) @ java.lang.string.startswith(string.java:1462) @ com.sun.tools.javac.file.symbolarchive.addzipentry(symbolarchive.java:49) @ com.sun.tools.javac.file.ziparchive.<init>(ziparchive.java:63) @ com.sun.tools.javac.file.symbolarchive.<init>(symbolarchive.java:41) ............ d:\java\projects\streamer\nbproject\build-impl.xml:603: ne...

download - Need org.eclipse.jface for Eclipse Plug-in (Eclipse Profiler) -

download - Need org.eclipse.jface for Eclipse Plug-in (Eclipse Profiler) - good afternoon-- after reading lot of posts on site profile tool, , in search produce phone call graph, have found eclipse profiler meet needs nicely. however, when seek run programme (create new profile), error regarding org.eclipse.jface, believe erroring out because not have bundle (or @ least, cannot find on computer). searched several hours lastly night, , see lots of references using jface, have been able find no location it. here error: problems occurred when invoking code plug-in: "org.eclipse.jface". i not including entire stack trace, not sure good. here environment info provided eclipse: eclipse.buildid=m20110210-1200 java.version=1.6.0_18 java.vendor=sun microsystems inc. bootloader constants: os=win32, arch=x86_64, ws=win32, nl=en_us framework arguments: -product org.eclipse.epp.package.modeling.product command-line arguments: -os win32 -ws win32 -arch x86_64 -pro...

android-Image View set Tag -

android-Image View set Tag - i working on app in image view uses imageview.settag("id"+","+"type") i.e imageview.settag(string) .. category id , type of category perform phone call specific url per id , type on click of image.... this id , type splited "," , used separately farther operations depending on type. the code f9 scenario... when utilize lazy list (image loader) displaying images requirement,,,, uses set tag creates problem,,, how manage both conditions..... is other alternative set tag either of purposes.... thank you,,, with regards, arpit there 2 version of settag 1 takes object argument , other takes key , object argument here link. hope help!!! android

php - Increase the chances of a record being selected in a random select -

php - Increase the chances of a record being selected in a random select - when using order rand() how can go giving more "weight" records on others chances of them beingness selected increase? i found an extensive article on problem provides ordering solution. i'm very, very, far mastering probability, statistics, or sort of math, based on own testing seems pretty solid. uses same thought of "selection weight" column.. create sure default , values column nonzero. where selection_weight > 0 ... order ( -log(1.0 - rand()) / selection_weight ) using better random-selection query mike posted, seek like: select users.* ( select id users selection_weight > 0 order ( -log(1.0 - rand()) / selection_weight ) ) random_users bring together users on random_users.id = users.id this query ran in 10 - 20 ms on 2,000-record table using testing. hope helps! original answer if have integer column in table corresponds ...

java - Comparing Slickedit and Eclipse -

java - Comparing Slickedit and Eclipse - i've been using slickedit 10 years. it. eclipse has become standard in java community, think might might pay larn little bit of create transitioning new jobs easier ( own own copy). experience has been bosses/coworkers less hostile me using slickedit 1 time see can , if see can manipulate code way on computers when discussing problem. to end wondering features eclipse has slickedit not......or features seem easier, more efficient in eclipse. thanks in advance i've never used slickedit either, except trial several years back, think, here's quick list of other features consider (from both eclipse , intellij idea): as fvu mentioned, lots of mutual refactorings extract variable, parameter, field, constant, method, class, interface, superclass; pull , force downwards members; surround with...; move, copy, clone, rename classes, methods, variables, etc. templates allow type short combo , hotkey create common...

time - Using %f with strftime() in Python to get microseconds -

time - Using %f with strftime() in Python to get microseconds - i'm trying utilize strftime() microsecond precision, seems possible using %f (as stated here). when seek next code: import time import strftime time print strftime("%h:%m:%s.%f") ...i hour, minutes , seconds, %f prints %f, no sign of microseconds. i'm running python 2.6.5 on ubuntu, should fine , %f should supported (it's supported 2.6 , above, far know.) you can utilize datetime's strftime function this. problem time's strftime accepts timetuple not carry microsecond information. datetime.datetime.now().strftime("%h:%m:%s.%f") should trick! python time strftime

video capture - how can we start and stop the webcam in opencv? -

video capture - how can we start and stop the webcam in opencv? - i trying capture images webcam using opencv. when phone call cvqueryframe() image read , cam starts. want cam stop because used other application. can help me this? thanks lot. isn't cvreleasecapture() working ? i stop frame query, (stop loop utilize capture frame) , release capture... searching ? here documentation opencv video-capture

objective c - Iphone uiwebview and uitableview together possible? -

objective c - Iphone uiwebview and uitableview together possible? - i have uitableview long , scrollable, utilize uinavigationcontroller. @ bottom of page in footer plan set next button help go next page. the problem "sometimes" page may need show messages in html, must utilize uiwebview preferebaly @ bottom of page above footer, shouldnt effected scrolling. -can utilize uitableview , uiwebview on same page? page in command of uitableview controller, how command or set delegates of uiwebview? -can create uiwebview invisible , not allocate space when there no messages shown? yes, it's possible. i believe stocks app iphone utilizes multiple views own controllers. think improve solution have uipagecontrol , create uitableviewcontroller when uipagecontrol 's value changed. if still want create uinavigationcontroller , set rootviewcontroller uitableviewcontroller , set toolbarhidden property no , toolbar has behavior want, stays fixed o...

ruby on rails - How do I know which modules are associated with ActiveRecord::Base? -

ruby on rails - How do I know which modules are associated with ActiveRecord::Base? - i'm having difficulty locating methods invoked on activerecord instances defined. come mixed-in module, can't find documentation indicating modules mixed in. there documentation anywhere lists modules mixed activerecord? or have open base.rb find out? this specific instance of dealing rails in general- if want find method defined, how go looking it? people go straight code? the rails source code can convoluted sure. when lost start going rails api , ctrl-f , method name. specific method asking about? ruby-on-rails ruby activerecord

iphone - Putting a button in table footer view -

iphone - Putting a button in table footer view - i creating custom button , putting in table's footer view button going way out right corner. what wrong here!?! here code , output image: uibutton *abutton = [uibutton buttonwithtype:uibuttontypecustom]; [abutton settitlecolor:[uicolor whitecolor] forstate:uicontrolstatenormal]; [abutton settitlecolor:[uicolor colorwithwhite:0.0 alpha:0.56] forstate:uicontrolstatedisabled]; [abutton setbackgroundimage:[[uiimage imagenamed:@"test.png"] stretchableimagewithleftcapwidth:kbuttonslicewidth topcapheight:0] forstate:uicontrolstatenormal]; [abutton settitle:@"click me" forstate:uicontrolstatenormal]; [abutton.titlelabel setfont:[uifont boldsystemfontofsize:kfontsize14]]; [abutton setframe:cgrectmake(10.0, 15.0, 300.0, 44.0)]; [self.tableview settablefooterview:abutton]; i added button in uiview , set tablefooterview uiview object , worked. cannot straight set uibutton ta...

mod pagespeed - how to improve webpage speed in drupal -

mod pagespeed - how to improve webpage speed in drupal - i have big content website hosted on rackspace in usa. site downloads time close 12 seconds despite using cdn module, image jss etc. per pagespeed, website gets close 85/100 , on yslow gets b grade. how can bring website speed less 3 seconds. have installed apc memcached , varnish drastically improve page load speeds. this presentation 2bits introduced me world of server optimization. check out lullabot series on improving performance. drupal mod-pagespeed

asp.net mvc - Simple Validation for dropdownlist in mvc using (Html.ValidationMessage) -

asp.net mvc - Simple Validation for dropdownlist in mvc using (Html.ValidationMessage) - controller var productlist = enumerable.range(1, 80).select( x => new selectlistitem { value = x.tostring(), text = x.tostring() } ); viewdata["products"] = new selectlist(productlist.tolist(), "value", "text"); view <%: html.dropdownlist("products", viewdata["products"] selectlist, "--select--")%> <%: html.validationmessage("products", "please select product list")%> //this doesnt works on (modelstate.isvalid) know dropdown list info coming //from view info not model , thats why model doesnt validate particular dropdown //list while validates other fields linked model, //just want know, how can validate above dropdownlist you binding both name of ddl , values products . that's wrong. of course of study that's to the lowest degree problem code. far bigger , more ...

windows - Lossless reading from mic -

windows - Lossless reading from mic - i'm using naudio (but applies reading directly) capture microphone wave data. seems if app busy drops/skips input info mic. i've set reading thread top priority, i'm doing heavy calculations in several other thread @ same time. is there way read info lossless? (or lossless, , bug elsewhere?) when making similar app , had similar problem, turned out needed buffer can hold @ to the lowest degree 3 seconds of data. seek increment buffer 10 seconds of info , if doesn't solve problem there more issues. if works seek decreasing buffer size until works properly edit: here quick & dirty managed dx recording try. public class bmsrecordingeventargs : eventargs { byte[] data; bool endrec; public bmsrecordingeventargs(byte[] data, bool endrec) { this.data = data; this.endrec = endrec; } public byte[] info { { homecoming data; } } public bool e...

Static methods & inheritance in Coffeescript -

Static methods & inheritance in Coffeescript - i've been reading bit coffeescript's inheritance model , have feeling i'm on fringes of ideological debate don't understand. so, happy find out i'm doing things in wrong way. basically doing writing set of widgets which, among other things, need handle events on dom elements. thought way go have class method called once, delegate events widget might need. base of operations widget class might have simple click handlers, while subclass might add together mouseover handlers or click handlers. however, appears i'm not supposed seek , equivalent of calling super() within static method. there workaround exists, ( this.__super__.constructor.methodname() i've seen lot of suggestions isn't best way i'm trying do. has got insights on how should construction code? maintain using workaround, or set delegation totally different place? can't stick in prototype, since won't have instance ...

actionscript 3 - Fash-CS5 after changing movieclip size fonts/images are getting squeezed -

actionscript 3 - Fash-CS5 after changing movieclip size fonts/images are getting squeezed - i have 1 film clip of size 1280 x 720 images, buttons , text in it. run-time need alter size of film clip 1280 x 300, after doing images, buttons , text in film clip gets squeezed vertically. how display same move clip images , text in different sizes without disturbing size of contains. new edit/update: in case have list within film clip. want archive want maintain list item size static , should not alter if parent re-sizes. if not possible in flash how can re-size items in list. don't know why list not using scrolling property display it's contains according size. suppose illustration if list size of 600px should display 7 items in list , provide scroll other items , if re-size list suppose 300 , should display 4 items , provide scroll for. remaining item thanks. if movieclip main document class set next properties of stage: stage.align = stagealign.t...

asp.net mvc 3 - BDD - Dynamically change a Ninject binding in MVC3 -

asp.net mvc 3 - BDD - Dynamically change a Ninject binding in MVC3 - i'm new ninject , i've set using own ninjectdependencyresolver class per: http://www.shahnawazk.com/2010/12/dependency-injection-in-aspnet-mvc-3.html i'm trying setup bdd cross-process mocking ala steve sanderson's post here: http://blog.stevensanderson.com/2010/03/09/deleporter-cross-process-code-injection-for-aspnet/ steve suggests like: deleporter.run(() => { var mockdateprovider = new mock<idateprovider>(); mockdateprovider.setup(x => x.currentdate).returns(datetosimulate); ninjectcontrollerfactoryutils.temporarilyreplacebinding(mockdateprovider.object); }) how implement temporarilyreplacebinding can dynamically alter binding in mvc3 project spec project? is there reason why cannot utilize steve's implementation of ninjectcontrollerfactoryutils class (and tidyuputils class) in whattimeisit project on github? asp.net-mvc-3 ninject bdd

json - Web scraping using ruby -

json - Web scraping using ruby - i new programming , have project have write ruby script retrieve info on specified repository github, parsing info json format, , printing in usable format on command line. i have checked out mechanize guide. documentation can check in order finish this? use github's repositories api. want done there, without scraping or weird hacks. json formatted responses default. ruby json github

wpf - Bind RibbonComboBox.SelectionBoxItem -

wpf - Bind RibbonComboBox.SelectionBoxItem - i'm trying bind item selected in ribboncombobox property of object. problem i'm encountering ribboncombobox.selectionboxitem provides accessor; therefore, cannot bind in xaml. any ideas how bind item property of object? utilize regular combobox there more appropriate control? xmlns:ribbon="clr-namespace:microsoft.windows.controls.ribbon;assembly=ribboncontrolslibrary" <ribbon:ribboncombobox itemssource="{binding source={staticresource collectionofpossiblechoices}}"/ selectionboxitem="{binding path=propertytobindto}"/> <!--not valid--> ribboncombobox unlike combobox (which i, also, find confusing). seek this; <ribbon:ribboncombobox> <ribbon:ribbongallery selecteditem="{binding path=propertytobindto}"> <ribbon:ribbongallerycategory itemssource="{binding source={staticresource collectionofpossiblechoices}}" /> ...

codeigniter - Only the first IF statement out of 3 is executed within a PHP loop -

codeigniter - Only the first IF statement out of 3 is executed within a PHP loop - the next code uploads multiple images no problem. however, i'm trying update field in table based on iteration loop in. problem: if statement seems not work when looped. i.e. adds first file_name database. anyone see i'm doing wrong here? much appreciated if so!!! for ($i = 1; $i < 4; $i++) { /* handle file upload */ $upload = $this->upload->do_upload('image' . $i); /* file failed upload - go on */ if ($upload === false) continue; /* info file */ $data = $this->upload->data(); $uploadedfiles[$i] = $data; if ($i == 1) { $filenames1 = array( 'product_image_front' => $data['file_name'], ); $this->db->where('id', $this->db->insert_id()); $this->db->update('products', $filenames1); } if ($i == 2) { $filenames2 = array( 'product_image_back'...

stored procedures - MySQL user-defined variables losing value immediately? -

stored procedures - MySQL user-defined variables losing value immediately? - so having issue mysql 5.5 drive me insane. have few nested stored procedures , 1 of them inserts info table , selects last_insert_id() out-bound parameter. next stored procedure: delimiter $$ create definer=`root`@`localhost` procedure `createnewsession`( in inputip varchar(15), in inputposttime bigint, in inputpostinterval bigint, in inputplatform varchar(45), out outsessionid int) begin insert mydb.session (ip, starttime, lastpost, platform) values (inputip, inputposttime - inputpostinterval, inputposttime, inputplatform); select last_insert_id() outsessionid; end;$$ now, if pass right parameters (ie: parameters have tested against insert statement , working) , phone call next right id back call mydb.createnewsession('127.0.0.1', 1310062874228, 1310062894228, 'platform', @outvar); select last_insert_id(); however if phone call ...

c# - Updating ListBox with changes in item property in BindlingList -

c# - Updating ListBox with changes in item property in BindlingList - when alter property in item in bindinglist, changes not propagate listbox although underlying object changed. public class myclass : inotifypropertychanged { public override string tostring() { homecoming this.name; } #region name private string name; public string name { { homecoming this.name; } set { if (value == this.name) return; this.name = value; this.onpropertychanged("name"); } } #endregion #region inotifypropertychanged event ///<summary> ///occurs when property value changes. ///</summary> public event propertychangedeventhandler propertychanged; /// <summary> /// raises <see cref="propertychanged"/> event /// given property. /// </summary> /// <param name=...

php - how can we mix two mp3 files into one (i need mixing not concat) -

php - how can we mix two mp3 files into one (i need mixing not concat) - i have 1 mp3 file have blank spaces in that. have mp3 file want insert spaces of first mp3 file. i running php, ffmpeg just split 1 have blank spaces 3 parts, bring together "first part" + "second file" + "third part" :) php ffmpeg audio-recording

using intent on android to show activity -

using intent on android to show activity - i have 2 activity classes. have button on first 1 , want show sec when clicked, force close when ever run application. here classes: public class app extends activity { private texttospeech tts; private button b1,b1a,b2,b2a,b3,b3a; @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.main); /** called when activity first created. */ setcontentview(r.layout.main); tts = new texttospeech (this, null); b1 = (button)findviewbyid(r.id.btn_time); b1.setonlongclicklistener(new button.onlongclicklistener(){ @override public boolean onlongclick(view arg0) { string hi = "time"; tts.speak(hi, 0, null); homecoming false; }}); b1a = (button)findviewbyid(r.id.btn_time); b1a.setonc...

c# - XmlReader hangs after first Read -

c# - XmlReader hangs after first Read - i'm trying read xml stream through tcpclient: tcpclient clientsocket = new tcpclient("172.16.1.222", 80); after creating stream networkstream serverstream = clientsocket.getstream(); i proceed on read: xmlreader r = xmlreader.create(serverstream); while (r.read()) { if (r.nodetype == xmlnodetype.element) { somename = r.name.tostring(); } if (r.nodetype == xmlnodetype.text && somename == "abc") { readboxid.text = r.value.tostring(); } } this works fine first stream. see info fine hangs next error @ while(r.read) : cannot evaluate look because native frame on top of phone call stack any suggestions? c# xmlreader networkstream

Reading/Opening a text file in Java -

Reading/Opening a text file in Java - i know there hundreds of posts dealing exact question, life of me, cannot figure out. have "open" case in programme have committed myself finishing, origin java exercise. i've gotten save function work, looking @ gets me no closer trying problem. here code. if(arg.equals(editor.filelabels[0])){ if(editor.verbose) system.err.println(editor.filelabels[0] + " has been selected"); filedialog = new filedialog(editor, "open file dialog", filedialog.load); filedialog.setvisible(true); if(editor.verbose){ system.err.println("exited filedialog.setvisible(true);"); system.err.println("open file = " + filedialog.getfile()); system.err.println("open directory = " + filedialog.getdirectory()); } } i have tried solutions before writing question; however, of examples i've seen separate methods of own. help appreciated. :) ...

c++ - Mapping dynamic texture causing "Already Mapped Error" -

c++ - Mapping dynamic texture causing "Already Mapped Error" - i starting using direct3d11 , trying create dynamic texture plan update new info several times second. issue every time update texture new data, error d3d debugger: d3d11: error: id3d11devicecontext::map: resource mapped! [resource_manipulation error #2097213: resource_map_alreadymapped ] which turns e_outofmemory error map phone call after running application while. i creating texture this: d3d11_texture2d_desc td; td.arraysize = 1; td.bindflags = d3d11_bind_shader_resource; td.cpuaccessflags = d3d11_cpu_access_write; td.format = dxgi_format_b8g8r8x8_unorm; td.height = height; td.width = width; td.miplevels = 1; td.miscflags = 0; td.sampledesc.count = 1; td.sampledesc.quality = 0; td.usage = d3d11_usage_dynamic; hr(m_device->createtexture2d(&td, 0, &texture)); and updating info this: hr(m_devicecontext->map(texture, 0, d3d11_map_write_discard, 0, &mappedresource)); by...

How do I open a new window (shell) from command line in Linux? -

How do I open a new window (shell) from command line in Linux? - i'm working tool right requires me putty remote host, login, run series of commands start engine, open new window (and login again) start different engine, open 3rd window (and again, login) utilize tool (leaving engines running in first 2 windows). i'd write shell script automate process open 1 window, type "sh whatever.sh" , off , running, without physically opening new windows , logging in again. however, can't find command me 1 window next. thoughts? you can background first processes adding ampersand ( & ) command line or pressing ctrl+z when running (and come in bg allow process continue, more info jobs ). if that's not enough, can create virtual shells screen or tmux. if you've redirected x (i.e. can access guis on ssh), can start new window executing favorite (gui) console program, xterm , konsole , gnome-terminal , etc. linux command-line putty

javascript - URL of file-download link -

javascript - URL of file-download link - i downloading file location. download link of file that's beingness downloaded. want save link in text file , later utilize link other places straight download object. working on firefox, generalized approach appreciated. there way this? tried jsoup , didn't succeed since generic external links. often times downloaded files not have source links. example, click "download" button on website - send post info form on 'download.php' page this: <?php header("content-type: application/force-download"); header('content-description: file transfer'); readfile($_post['file']); ?> javascript android firefox firebug download

State Machine Workflows dead in .NET 4.0 or not? -

State Machine Workflows dead in .NET 4.0 or not? - i'm confused. i'm avid reader of several sharepoint related blogs , says "don't utilize state machine workflows in .net 3.5 anymore - not exist in .net 4". reading on topic, .net 4.0 not back upwards state machine workflows, uses flowchart wfs instead. fine. there platform update 1 - introduces state machine workflows again. announcement "new" state machine functionality doesn't much why - seems have state machine wfs again. my question: did microsoft add together state machine workflows mix or totally "new" state machine workflow activity (relating compatibility). move due client pressure level of people complaining not having state machine workflows anymore? i'm looking kind of explanation of why there are state machine workflows in .net 4 (with platform update 1). and: remain (.net 5) or temporary move? ps: take @ official state machine guidance whitepapers, still i...

c# - Best practice for passing parameters, which can take two values -

c# - Best practice for passing parameters, which can take two values - how write better? public void foo(bool isstart) { // code [common] if (is start) { // code [start] } else { // code [end] } // code [common] } or public enum myenum { start, end } public void foo(myenum param) { // code [common] switch (param) { case myenum.start: // code [start] break; case myenum.end: // code [end] break; } // code [common] } update: i'm looking little solution. "common", "start" , "end" parts short, not want split foo several methods. how about: public class foo { public void start() { precommon(); // code [start] postcommon(); } public void stop() { precommon(); // code [stop] postcommon(); } private void precommon() { // code [pre-common] } ...

iphone - Add titles to tabbar created programmatically -

iphone - Add titles to tabbar created programmatically - i new iphone development... trying build application in creating uitabbarcontroller programmatically below: uitabbarcontroller *tabbar = [[uitabbarcontroller alloc] init]; firstviewcontroller *firstview = [[firstviewcontroller alloc] initwithnibname:@"firstviewcontroller" bundle:nil]; uinavigationcontroller *tabitemone = [[[uinavigationcontroller alloc] initwithrootviewcontroller: firstview] autorelease]; secondviewcontroller *secondview = [[secondviewcontroller alloc] initwithnibname:@"secondviewcontroller" bundle:nil]; uinavigationcontroller *tabitemtwo = [[[uinavigationcontroller alloc] initwithrootviewcontroller: settings] autorelease]; tabbar.viewcontrollers = [nsarray arraywithobjects:tabitemone, tabitemtwo,nil]; tabbar.view.frame = cgrectmake(0,0,320,460); [self.view insertsubview:tabbar.view belowsubview: firstview.view]; [self presentmodalviewcontroller:tabbar animated:no]; in this, ...

mysql real escape string - PHP Sanitized markdown - html output -

mysql real escape string - PHP Sanitized markdown - html output - i have wmd editor on site, , store markdown in db. before send markdown database filter mysql_real_escape_string, that: $to_database = mysql_real_escape_string($_post['markdown']); and it's okay. want show it, utilize php markdown (which converts markdown html). problem shows me \r\n , \n instead of new lines. tried nl2br function, didn't help. if not escape output (do not convert markdown html , using htmlpurifier) still \n instead of new lines. when remove mysql_real_escape_string looks fine. bbbbbbbbbbb nnnnnnnnn they beingness converted , no longer acting line breaks. want replace them: $markdown = str_replace('\r\n','<br/>',$_post['markdown']); $markdown = str_replace('\n','<br/>',$markdown); you might want this: $markdown = html_entity_decode($markdown); php mysql-real-escape-string wmd-editor wmd-markdown

Where linux signals are sent or processed inside the kernel? -

Where linux signals are sent or processed inside the kernel? - how signalling(interrupts) mechanism handled in kernel? cause why inquire is: somehow sigabrt signal received application , want find come from.. you should looking in application cause, not in kernel. usually process receives sigabrt when straight calls abort or when assert fails. finding piece of kernel delivers signal gain nothing. in conclusion, code or library code using causing this. see abort(3) , assert . linux kernel signals abort

jquery - Accessing JSON data -

jquery - Accessing JSON data - if given next info web-service: { "d": [ { "col1": "col 1 info 1", "col2": "col 2 info 1" }, { "col1": "col 1 info 2", "col2": "col 1 info 2" } ] } how access sec col1? as following: success: function( info ) { alert( data.d ) ; }, gives me: [object object],[object object] its array 2 elements containing col1 , col2 , like: alert(data.d[1].col1); ( 0 first element, , take "col1") json jquery

c# - method for XML dump or read to SQL 2005 server -

c# - method for XML dump or read to SQL 2005 server - i have page app gets xml info flash media server, need fastest , efficient method xml info database. xml nodes columns perfect. <%@ page language="c#" %> <%@ import namespace="system.io"%> <%@ import namespace="system.xml"%> <script runat="server" language="c#"> protected void page_load(object sender, eventargs e) { //response.write(datetime.now); string action = request.params["action"]; if (action != null && action != string.empty) { switch (action.tolower()) { case "add": add2db(); break; } } } protected void add2db() { httprequest request = httpcontext.current.request; system.io.stream body = request.inputstream; system.text.encoding encoding = request.contentencoding; syst...

python - Calling os.fsync on the stdout/stderr file descriptors kills a subprocess -

python - Calling os.fsync on the stdout/stderr file descriptors kills a subprocess - after spawning subprocess using python subprocess library, i'm using stderr pass message kid process parent process containing serialized data. want parent homecoming (via stdin ) result of function applied data. in essence, have function within subprocess this: sys.stderr.write("some stuff write") # time later some_var = sys.stdin.read() however, completes locks parent while waiting stderr input, tried call: sys.stderr.flush() os.fsync(sys.stderr.fileno()) however, doesn't work. nil after os.fsync executed. in addition, when phone call proc.poll() in parent process, appears, child's homecoming code 1. what can prevent this? should consider approach? i consider approach. may utilize indipendent process (multiprocessing.process) , using 2 queues communicate (multiprocessing.queue) 1 input , other 1 output. illustration on starting process: ...

scripting - Perl - Import contents of file into another file -

scripting - Perl - Import contents of file into another file - the below code i'm trying produce trying this: what i'm trying running bteq script gets info db exports flat-file, flat file picked perl script (the above code), post trying perl import file gets fastload file. create more sense? while (true) { #objective: open dir, flat-file exported bteq opendir (dir, "c:/q2refresh/") or die "cannot open /my/dir: $!\n"; #open directory flat-file @dircontent = readdir dir; $filetobecopied = "c:/q2refresh/q2_refresh_prod_export.txt"; #flatfile exported bteq $newfile = "c:/q2refresh/q2_fastloadfromflatfile.txt"; #new file flat-file contents copied "fastload" copy($filetobecopied, $newfile) or die "file cannot copied."; close dir; $items_in_dir = @dircontent; if ($items_in_dir > 2) { # > 2 because of "." , ".." -->>>>>...

c# - No Definition for System.Windows.Forms.Form.WndProc -

c# - No Definition for System.Windows.Forms.Form.WndProc - i seek register hotkey windows mobile application can't override system.windows.forms.form.wndproc because there's no definition found. what missing override method? use messagewindows class target registerhotkey call. can overrride wndproc , utilize receive hotkey messages. c# windows-mobile

app id - Retrieving the all-numeric appId for an iOS app? -

app id - Retrieving the all-numeric appId for an iOS app? - i'm looking 10-digit appid (all numeric) ios app; when go provisioning profile, see appids 10 characters, include alphanumeric text. believe there should all-numeric appid (to utilize when sending users app store rate app, etc.) not clear on or how retrieve it. any help gratefully received. thanks. -d ios app-id

jquery - Slidedown menu not lining up -

jquery - Slidedown menu not lining up - here's jsfiddle of have. reason, list containing dropdown elements keeps sliding downwards pushed way left, float:none; i'm not sure if obvious overlooking, or whats going on, i'm issue in css. the issue in css. giving dropdown class position: absolute; not defining values. shows in default left: 0; top: 0; . jquery css

c - In parallel processing, how to make each processor execute a block of program using mathematica -

c - In parallel processing, how to make each processor execute a block of program using mathematica - i want write block of c code , send every processor execute it is possible using mathematica? using gateway link c mathematica or ever thank .. :) i think is, need distribute function on cpus in c code. default, mathematica isn't able observe functions atomic. have checked out http://reference.wolfram.com/mathematica/tutorial/mathlinkdeveloperguide-unix.html ? edit: if want check out http://reference.wolfram.com/mathematica/ref/paralleltable.html . doesn't work particularly c++, thats why didn't recommend :-). c parallel-processing mathematica-8

eclipse - Copying an Android Project Folder is Not a FULL Backup? -

eclipse - Copying an Android Project Folder is Not a FULL Backup? - several weeks ago took snapshot of android project copying entire folder (windows 7) network share. a few weeks later, wanted build snapshot in new (and different) workspace. i: created empty folder workspace, switched eclipse it, then used file > import... re-create snapshot workspace. i surprised find errors in project - errors weren't there before copied on network share. the first symptom lastly file in project had multiple errors. "fixed" entering eclipse (again!) android's sdk location: windows > preferences > android > sdk location: c:\android-sdk-windows this resulted in numerous files having errors, next hint @ console: android requires .class compatibility set 5.0. please prepare project properties. i fixed hovering on @override , selecting change workspace compliance , jre 1.5 balloon suggestion. unusual because checked windows > preferences > ...

c++ - Having a pair how to find if its part of some pair in map? -

c++ - Having a pair<string, string> how to find if its part of some pair in map<string, string>? - we have pair of strings illustration such pair accept-language : ru , , search thru map, illustration of http request headers. ned know if there such pair in map or not - bool value. how soft search meaning not need find exact same pair pair accept-language : ru-ru,ru;q=0.8,en-us;q=0.6,en;q=0.4 valid pair , if such exists can think have found our map contains our pair. how create function performing such search in c++? first of all, if using map , cannot have multiple entries same key. e.g. can't have both accept-language : ru , accept-language : ru-ru,ru;q=0.8,en-us;q=0.6,en;q=0.4 because have same key `accept-language'. perhaps in case should utilize vector of pairs, or multimap. next, question consists of 2 parts: how check, whether element (such string or pair ) matches pattern. assuming have such check, how apply each element in containe...

codeigniter - updating multiple values to mysql database using codeignter -

codeigniter - updating multiple values to mysql database using codeignter - my post info form coming array ( [radiogroup_1] => 1 [radiogroup_2] => 4 [radiogroup_4] => 11 [submit] => submit ) and model function add_votes(){ foreach($post[] $k=> $v){ $id = $v; } $this->db->where('answerid','radiogroup_'. $id ); $this->db->set('votes', 'votes+1',false); $this->db->update('vote_table'); } apparently, it's not working, please help me in code maybe function add_votes(){ foreach($_post[] $k=> $v){ $this->db->where('answerid','radiogroup_'. $v ); $this->db->set('votes', 'votes+1',false); $this->db->update('vote_table'); } } or function add_votes(){ foreach($_post[] $k=> $v){ $this->db->where('answerid', $v ); ...

python - Simplest way to get initial text input in pygame -

python - Simplest way to get initial text input in pygame - so, iv'e got pygame application. right now, takes command line argument specify display show main screen on. however, i'm running on windows, it's hard specify command line input graphical application. so, i'd have very simple dialog box pops up, prompts user integer, closes. research has shown pygame can't dialog box this, , can't input in pygame window, because programme doesn't know yet monitor draw pygame window to. so, question is, simplest way create dialog box input? i've looked wx , tkinter. utilize either of them, i'm wondering is, want import to the lowest degree number of toolkits. i.e. don't want have start wx main loop can create 1 dialog, close it, start whole new pygame window. i know how in wx, i'm looking advice/ideas toolkit simplest, opposed instruction on how (though that's nice too). since tkinter built python, might better. prefer wx, i...

c# - Custom Authentication - User Account Impersonation Best Practice? -

c# - Custom Authentication - User Account Impersonation Best Practice? - i have custom authentication mechanism in .net app stores hashes of user passwords , tests entered passwords against hash grant authentication ticket. with passwords beingness hashed, don't know users passwords. for debugging etc, need able impersonate users , log in account, need scheme of getting around fact don't have password. one alternative have considered secondary test on authentication failure against master password, though consider little weak since if master password compromised, accounts accessible if email address known. does 1 have solution issue? this admittedly indirect response, building functionality enable application circumvent authentication process risky approach. i'd @ actual processes you're attempting debug, particular accounts helps test focus on working out problem. perhaps you'll solve via more robust unit testing, perhaps need test accounts ...

Windows how to create an startup application? -

Windows how to create an startup application? - i have webpage want open every time startup pc. webpage password protected. how create desktop startup application, runs every time pc turned on. , login webpage , goes total screen mode? i running windows 7. if create programme login webpage , goes total screen mode. can set in start map. but how should create desktop program? i new windows programming, know programring rails. i haven't created windows programs before. i hoping tips language easiest create little programme with. you create winforms or wpf application , utilize webbrowser control. it's .net wrapper around net explorer allows embed desktop applications. depending on how web application tracks authenticated users utilize next overload of navigate method allows send post request web page , provide contents of post request (such username , password in example). way able authenticate. windows

How to make sure I am writing jQuery 1.6 -

How to make sure I am writing jQuery 1.6 - i have been using jquery 1.3 , upgraded jquery 1.6. not sure if code writing 1.6 since it's hard list api difference 1.3 1.6. what in case? techniques follow? there not many differences , chances code have written work same. library projects jquery conscious of backward compatibility. jquery

hash - Why doesn't Perl support interpolation of hashes in double quotes? -

hash - Why doesn't Perl support interpolation of hashes in double quotes? - #!/usr/bin/perl utilize warnings; %hash=("no1"=>1, "no2"=>2, ); print %hash; #prints no11no22 print "%hash"; #prints %hash why doesn't perl back upwards interpolation of hash within double quotes? supports interpolation scalars ($), arrays (@) why not hashes (%)? how should hash stringify? scalars obvious , arrays too. should hash be? how useful such stringification be? more or less useful beingness able utilize % character unescaped in interpolating string? worth amount of work take prepare of code uses % in interpolated strings today? if can come answers these questions, sure p5p willing hear them. perl hash interpolation

Remove last call from Call Log OR keep it from being stored on Android -

Remove last call from Call Log OR keep it from being stored on Android - things simple, broadcast receiver intercept phone call. because calling broadcast can't aborted, incallscreen appears , phone call get's stored in phone call log. manged somehow block incallscreen appearing need phone call log. so, i've got phone number , date of call. how delete phone call log ? if list of items phone call log uri, phone call first in list ? the simplest solution start service in broadcast receiver, after phone call state becomes ide. service have sleep time of 5 seconds, time needed create sure android inserted phone call call log, , query phone call log info calls. android

remove Repeat values from a list in haskell -

remove Repeat values from a list in haskell - i need accomplish few tasks in haskell: find maximum of list, along number of times occurs: maxcount [2,4,7,2,3] --> [7,1] remove repeated values list delrep [1,3,2,1,4] --> [3,2,4] delete instances of element list: delete [1,3,4,1] 1 --> [3,4] question 1. maxandreps l = allow m = maximum l reps = length $ filter (== m) l in [m,reps] this solution has bad asymptotic performance because list traversed twice. ideally, solution find maximum , count repetitions in 1 pass. if write maximum , filter , , length in terms of fold, should see how combine them single pass. also, more natural homecoming tuple instead of list. question 2. @ using data.set.set . also, output list need in same order? if not, there's particularly easy solution. question 3. above reply question 1 covers this. function removes non-maximum values list, problem. figure out how ...