Posts

Showing posts from May, 2014

iphone - cocos2d - how to extract rgb from color -

iphone - cocos2d - how to extract rgb from color - i'm making final part of game tells score is. wanted create flash, dynamic , animated, want score sort of total up, plan making text displayed score closer actual score in each draw event, until reaches total score. however, want digits of score flash increment, , fade. plan extracting lastly digit score displayed 1 step away, , comparing lastly digit score displayed. then, if different, set color of lastly digit white orange. happen every digit. but want digits fade downwards white again, need help (i've looked everywhere , can't find answer) need color of every letter, , merge white. don't know how red, greenish , bluish components. here's i've got far: -(bool) colourcount:(cclabelbmfont*)label currentno:(int)cno targetno:(int)tno { ccarray *characters = [label children]; //-------the code making letters orange go here---------- //below makes color of every letter more white ...

javascript - How can I refresh a webpage without the browser asking if I want to resend again -

javascript - How can I refresh a webpage without the browser asking if I want to resend again - i got next code refresh webpage. works great if don't submit post if do, message browser when webpage refreshes (see image below) location.reload(true); i'm not looking browser settings tweak. i'm looking alternative code refresh without asking. this caused due page beingness requested post instead of get . refreshing resubmit post data. can forcefulness using window.location = window.location.href; . if want allow people reload page through browser controls need implement prg pattern redirects get after post . javascript

Have I misunderstood how to set up Selenium RC with Python? -

Have I misunderstood how to set up Selenium RC with Python? - i having difficulty selenium rc. when trying run scripts in python, see message "cannot import name webdriver". i'm missing basic. allow me explain every step i've taken (better granular vague...): download , set java development kit , set paths. command 'java -version' yields "1.6.0_26" download selenium rc standalone server. started server downloaded , installed python 2.6 32-bit version downloaded python bindings http://selenium.googlecode.com/files/selenium-remote-control-1.0.3.zip. zip file, have copied selenium.py python27\libs directory. created script in selenium ide. exported python. when seek run script idle, see message "importerror: cannot import name webdriver". script i'm using starts from selenium import webdriver i see no definition of function named 'webdriver' in selenium.py. wrong file? quite confused. scripts don't ...

php - Using regex to filter strings by length -

php - Using regex to filter strings by length - i trying validate input field regex pattern [a-za-z]{,10} want find match if 10 or less chars sent in input field, problem match words less 10 chars. is there way if there more 10 chars in input field come false, or improve strlen php? there of import syntax error beingness made here op , current regex answers: when using curly brace quantifier php (pcre), need specify first number. (i.e. expression: {,10} not valid quantifier!) although comma , sec number optional, the first number in curly brace quantifier required. look should specified so: class="lang-php prettyprint-override"> if (preg_match('/^[a-za-z]{0,10}$/', $text)) // valid input else // invalid input php regex

c++ - Giant switch statement for constructors -

c++ - Giant switch statement for constructors - i have container holds bunch of pointers base of operations class, , function takes input , returns class subclass of base of operations class. subclass returns depends on input. right now, have giant switch statement this: class base of operations { ... } class : public base of operations { ... } class b : public base of operations { ... } ... class z : public base of operations { ... } base* depends(int input) { switch (input) { case 1: homecoming new a(...); case 2: homecoming new b(...); ... case 26: homecoming new z(...); default: ... } } i wondering if there's improve way design this. don't know many "design patterns" (i think that's they're called) don't know if there's (obvious) improve way design this. what looking factory method pattern. the of import thing here remove need base of operations class ...

ruby on rails - Good RoR Gravatar gem/plugin and detect if the gravatar account exists or not -

ruby on rails - Good RoR Gravatar gem/plugin and detect if the gravatar account exists or not - i'm using mdeering's gravatar_image_tag plugin gravatar images users dilemma seek observe in code if user has gravatar: if display gravatar image. if not, display local default image file on server. i'm open using other plugins if offer functionality. please provide code examples. help me larn best. thanks! you don't need gems/plugins. screencast explains need step-by-step. comes downwards using next helper method: def avatar_url(user) default_url = "#{root_url}images/guest.png" gravatar_id = digest::md5.hexdigest(user.email.downcase) "http://gravatar.com/avatar/#{gravatar_id}.png?s=48&d=#{cgi.escape(default_url)}" end ruby-on-rails gravatar

java - response.sendRedirect() from jsp:include being ignored? -

java - response.sendRedirect() from jsp:include being ignored? - i've got jsp file, includes jsp file check values , such: <jsp:include page="setup.jsp" /> inside setup.jsp i've got conditional code determines if needed values set in session , if not redirects them different page. or @ to the lowest degree supposed to, redirect seems getting ignored. system.err.println("redirecting!"); response.sendredirect("http://www.google.com"); return; i see "redirecting!" logged console, page continues on , renders normally. had curl dump headers me , saw response http/1.1 200 ok isn't sending 302 redirect. any thought problem , how can prepare this? edit: have verified response not yet committed. response.iscommitted() returns false meaning status code , headers have not been sent yet. edit 2: i've tried calling response.sendredirect() in many other places , find can redirect before . redirect within jsp s...

javascript - Change element in each JQuery tab to dynamically generated colors -

javascript - Change element in each JQuery tab to dynamically generated colors - i'm using jquery ui tabs widget , have button add together additional tabs. i'm tying each tab markers on map coordinating randomly generated color using function gen_color() { homecoming '#'+(math.random()*0xffffff<<0).tostring(16); } so each tab has color corresponds number of markers of same color on map. i'm trying add together 15x15 block of color within tab's tab left of it's label. right i'm using tabtemplate alternative , trying alter when new tab added: $tabs = $("#tabs").tabs({ tabtemplate: "<li><span class='ui-icon-color' style='background-color:#000000;'></span><a href='#{href}'>#{label}</a> <span class='ui-icon ui-icon-close'>remove tab</span></li>", selected: 0, add: funct...

whitespace - Git rebase for a branch created days back -

whitespace - Git rebase for a branch created days back - i need help in understanding git rebase situation. checked out branch created 1 10 days back. checked out using git checkout -b <some name> origin/branchname (i used different name identify it) after checkout, if rebase beingness in checked out branch, git rebase origin/master it shows errors 1) trailing whitespace - read after trying command found online, still see warnings. git config core.whitespace nowarn 2) auto-merging conflict (add/add): merge conflict in... these files in master branch content modified little bit in checkout branch. how should prepare this? don't have authorization alter in master straight if that's way prepare it. these files should have content checkout branch testing work fine it's related that..please clarify me.. regards guys have pretty much answered question whitespaces didn't touch rebase part of question. here what's happening wh...

assembly - Difference between MOVDQA and MOVAPS x86 instructions? -

assembly - Difference between MOVDQA and MOVAPS x86 instructions? - i'm looking intel datasheet: intel® 64 , ia-32 architectures software developer’s manual , can't find difference between movdqa , movaps x86 instructions? in intel datasheet can find both instructions: this instruction can used load xmm register 128-bit memory location, store contents of xmm register 128-bit memory location, or move info between 2 xmm registers. the difference is: to move double quadword or unaligned memory locations, utilize movdqu instruction. and to move packed single-precision floating-point values or unaligned memory locations, utilize movups instruction. but can't find reason why 2 different instructions? so can explain difference? in functionality, identical. on some (but not all) micro-architectures, there timing differences due "domain crossing penalties". reason, 1 should utilize movdqa when info beingness used...

database - Problem with SQLite DB for Android -

database - Problem with SQLite DB for Android - i new android , have been next tutorials create app. having much difficulty inserting info database. have tried can think of no avail. database class is: package com.mckallip.beeronthewall; import android.content.contentvalues; import android.content.context; import android.database.cursor; import android.database.sqlexception; import android.database.sqlite.sqlitedatabase; import android.database.sqlite.sqliteopenhelper; import android.util.log; public class databaseutil{ private static final string tag = "databaseutil"; /** * database name */ private static final string database_name = "beer_database"; /** * database version */ private static final int database_version = 1; /** * table name */ private static final string database_table = "beer_list"; /** * table columns */ public static final string key_beer_name = "beer_name"; public static final string key_beer_styl...

voice recognition - How large must a corpus be to create a language model for Sphinx? -

voice recognition - How large must a corpus be to create a language model for Sphinx? - i know how many documents or sentences or words need process in order language model of domain , utilize in voice recognition tools such cmu sphinx. to create decent language model little domain it's plenty have 100 mb of texts. can mix them generic language model improve generalization of language model. to create generic language model developers utilize big corpora. illustration there google 1tb corpus contains millions of words , terabyte of data. trigram part of 40gb of bigram counts must hundred terabytes of texts. voice-recognition sphinx4

Java ClassLoader - Adding dynamically loaded jars to the system class loader -

Java ClassLoader - Adding dynamically loaded jars to the system class loader - is there way update scheme class loader @ runtime? after i've dynamically loaded jar file, there can add together classes/packages loaded jar scheme class loader? the reason i'm trying while i've had success through passing around newly created classloader in own code, i'm having problem 3rd party library (apache-wsif) doesn't seem working passed in classloader. i've been able accomplish attempting using following: thread.currentthread().setcontextclassloader(myclassloader); as discussed in top reply here: how alter classpath within java? basically, before calling wsif library need create sure i've set custom classloader contextclassloader on current thread. java classloader

property sheet in dialog using WINAPI example (without using MFC) -

property sheet in dialog using WINAPI example (without using MFC) - can point me @ winapi illustration of embedding property sheet in dialog box using winapi (not mfc)? how msdn example. winapi dialog propertysheet

jQuery: Delay fadeOut div multiple times -

jQuery: Delay fadeOut div multiple times - i tried write sloppy jquery code inline-confirm "dialog". works fine, except delay() runs 1 time each #row_id . delay meant fade out "dialog" if user doesn't interact within specific time span. "cancel" link works great every time. any ideas on i'm doing wrong? here's js: $("a.i_delete").click(function() { var parent = $(this).attr("id"); var parentrow = "#row_" + parent; var inlineconfirm = $('<div id="confirm_' + parent + '" class="inline_c"><a href="#cancel" class="ic_cancel">cancel, want maintain it</a><a href="/?id=' + parent + '" class="ic_confirm">delete</a></div>').hide().fadein(500); $(parentrow).append(inlineconfirm).delay(3500).queue(function() { $("#confirm_" + parent).f...

iphone - parse 2 rss feeds in app delegate -

iphone - parse 2 rss feeds in app delegate - im next tutorial below , working fine if wanted parse 2 rss feeds seems overwrite 1 array instead of saving them in respective arrays, http://www.iphonesdkarticles.com/2008/12/parsing-xml-files.html this in delegate: nsurl *url2 = [[nsurl alloc] initwithstring:@"myrssfeed1"]; nsxmlparser *xmlparser1 = [[nsxmlparser alloc] initwithcontentsofurl:url2]; //initialize delegate. xmlparser1 *parser1 = [[xmlparser1 alloc] initxmlparser]; //set delegate [xmlparser1 setdelegate:parser1]; //start parsing xml file. bool successs = [xmlparser1 parse]; if(successs) nslog(@"no errors"); else nslog(@"error error error!!!"); //vids nsurl *url = [[nsurl alloc] initwithstring:@"myrssfeed2"]; nsxmlparser *xmlparser = [[nsxmlparser alloc] initwithcontentsofurl:url]; //initialize delegate. xmlparser *parser = [[xmlparser alloc] initxmlparser]; //set delegate [xmlparser setdelegate:parser]; //sta...

persistence - Making message queues non-persistent in Linux -

persistence - Making message queues non-persistent in Linux - this may newbie question message queues, having issues them beingness persistent across linux system. running fedora 14 , using message queues pass info , threads. the problem create message queue: q = mq_open (strname, o_rdwr | o_creat | o_nonblock, 0666, &sqattr) where: strname = "/info_upd_q" or "/poll_q" ... sqattr.mq_flags = 0; sqattr.mq_maxmsg = imaxnummessages; /* 1 - 10 */ sqattr.mq_msgsize = iszofmessages; sqattr.mq_curmsgs = 0; the issue having alter size of messages passed or app crashes/exits/aborts , queues have not been closed , emptied, next run of programme floods scheme old messages or not open correctly , info not threads. at moment solving issue changing name of queues , rebooting scheme every often. how queues stop doing this? thanks. from shell can see existing queues using: # ipcs -q and can remove stale queues: # ipcrm -q msqid...

node.js - WebSockets Servers -

node.js - WebSockets Servers - if have found tutorials websockets, have been how create client-side sockets. how can create websocket servers , can info (something in node.js)? i don't need done libraries websockets, need larn how create websockets servers without libraries websockets. thanks replies anyone! https://github.com/joyent/node/wiki/modules#ws-ajax node.js websocket

php - cut array from a specific character -

php - cut array from a specific character - i have in $array[0]: attack-responses.rules?rev=1.35&content-type=text/vnd.viewcvs-markup i want have in $array[0] attack-responses.rules i mean when see '?' must cutting it. is there php function? parse_url() $array[0] = parse_url($array[0], php_url_path); or list() / explode() list($array[0]) = explode('?', $array[0], 2); or substr() / strpos() $array[0] = substr($array[0], 0, strpos($array[0], '?')) php arrays multidimensional-array

Java ignore certificate validation -

Java ignore certificate validation - i'm trying create sample java projects connect self-signed https server. can't seem java stop trying validate certificate. don't want have trust certificate, want ignore certificate validation altogether; server within network , want able run test apps without worrying whether certificate valid. java -dcom.sun.net.ssl.checkrevocation=false helloworld org.apache.axis2.axisfault: connection has been shutdown: javax.net.ssl.sslhandshakeexception: sun.security.validator.validatorexception: pkix path building failed: sun.security.provider.certpath.suncertpathbuilderexception: unable find valid certification path requested target the -dcom.sun.net.ssl.checkrevocation=false didn't help. tried adding next code: public static void disablecertificatevalidation() { trustmanager[] trustallcerts = new trustmanager[]{ new x509trustmanager() { public x509certificate[] getacceptedissuers() { homecoming null; } ...

.net - Read live video stream from port and play in form C# -

.net - Read live video stream from port and play in form C# - i need find code allow me able connect freeview box laptop, read incoming live video stream , play in form. overlay image on top of stream advertising pub offers. project c# or there software out there can allow manipulation of live video? connecting laptop tv via hdmi output. any help or direction great thanks in advance try , microsoft look encoder 4. comes encoder sdk includes classes developers can utilize stream , manipulate video. comes sample code help that. i hope helps. c# .net video video-streaming video-capture

xml - significance of '#' in, e.g., -

xml - significance of '#' in, e.g., <ruleref uri="#cardinalOnes" /> - as illustration of using "#" sign in next manner, line in xml document such <ruleref uri="#cardinalones" /> mean? reference find possible significance "#" sign usage attribute id called "implied" or "required". not sure means in case. it? deduction, looking @ rest of xml document, can figure out "#cardinalones" referencing rule within same document called <rule id="cardinalones"> . not find explanation of usage in text 'xml in nutshell' or w3.org. can please verify deduction correct? usage explained anywhere? thanks. in case, there's no significance xml. xml doesn't know, or care "ruleref", "uri" or "#cardinalones" is. they're element, attribute, , string tokens xml parser. now, doesn't mean have no value whatever is trying read xml file. m...

java - Problem with multi-line JTextField -

java - Problem with multi-line JTextField - i have jtextfield , need have 3 lines in it, such these: hi name mehdi how can set text in jtextfield ? tried \n , didn't work. 1 : jtextfield not back upwards multiline. want jtextarea 2 : newlines aren't same on systems, might have utilize "\r\n" if running windows. since java 7, there system.lineseparator solve issue. (see oracle documentation) java uitextfield jtextfield

php - Magento: Show different action links in on column in the backend data grid -

php - Magento: Show different action links in on column in the backend data grid - im working on custom product list in magento backend. heres code using add together row: $this->addcolumn('action_widget', array( 'header' => mage::helper('catalog')->__('action'), 'width' => '110px', 'type' => 'action', 'getter' => 'getid', 'actions' => array( array( 'caption' => mage::helper('catalog')->__('create widget'), 'url' => array( 'base'=>'*/*/create_widget', 'params'=>array('store'=>$this->getrequest()->getparam('store')) ), 'field' => 'id' ) ), 'filt...

regex - Regular expression that accepts alphanumeric , non consecutive dash and non consecutive white space -

regex - Regular expression that accepts alphanumeric , non consecutive dash and non consecutive white space - can help me create regular look accepts alphanumeric (numbers , letters only) , dashes , white spaces. it shouldn't take consecutive dashes , consecutive white spaces. or dash followed white space , vice versa. should begin , end alphanumeric characters well. thank much. help much appreciated. (^-^)v 'abcde' , '324 3a-32' : valid '-' , '324 3a - 32' , '-2323 d-', 'z- -a' : invalid thanks guys help. v(",)\ try this: ^[a-za-z0-9]+(?:[\s-][a-za-z0-9]+)*$ when first [a-za-z0-9]+ runs out of letters , digits, [\s-] within grouping tries match hyphen or whitespace character. if succeeds, sec [a-za-z0-9]+ tries match more alphanumerics. , grouping gets repeated many times necessary. regex

android - button on homescreen widget -

android - button on homescreen widget - i have widget button (r.id.button) when click button, should open activity: "openactivity" can this. it's basic question because i'm new in android developing. i hope understand me, , help me. gaauwe use pendingintent, described in the android docs here: http://developer.android.com/guide/topics/appwidgets/index.html#appwidgetprovider android widget

Lightweight Java web framework - specific requirements -

Lightweight Java web framework - specific requirements - the first time encountered e.g. ruby's sinatra framework or php's zend framework, wondered if there adequate in java, seems bloated here. although there myriads of frameworks around, have found none far deemed perfect kind of architecture implement. i wanted design web application heavy on javascript of application logic implemented on client, java back-end more or less serve info store or perform complex computations. i did through related questions here couldn't find perfect answer, each of suggested solutions had quirk not match requirements. so looking for, open source framework next features: convention on configuration no xml configuration except web.xml pure java (no scala, no groovy, ...) natural rest-style urls such /news/2011/july (no .do, no .jsp, ...) rest-aware it shouldn't forcefulness me deploy on application server (e.g. ejb should optional) session back upwards nice not mandato...

postgresql - SQL update in one statement instead of two -

postgresql - SQL update in one statement instead of two - is possible next in 1 statement instead of 2. need set isactive flag 1 id , set others false. im using postgres db. tblnames ------------------------ id,name,isactive 1,'n1',true 2,'n2',false 3,'n3',false 4,'n4',false update tblnames set isactive = true id = 4 update tblnames set isactive = false id != 4 does work? update tblnames set isactive = (id = 4) in case doesn't (i don't know postgres syntax enough), certainly work: update tblnames set isactive case id when 4 true else false end sql postgresql

java - Call function pointer from JNI -

java - Call function pointer from JNI - i have function implemented in cpp prototype myfunction(int size, int (* callback)(uint16* arg1, uint16* arg2)); second argument function pointer must implemented in java. how can implement function? how can phone call myfunction in jni? please help try this java import java.util.*; public class jniexample{ static{ try{ system.loadlibrary("jnicpplib"); }catch(exception e){ system.out.println(e.tostring()); } } public native void setcallback(jniexample jniexample); public static void main(string args[]){ (new jniexample()).go(); } public void go(){ setcallback(this); } //this called within native method public string callback(string msg){ homecoming "java callback echo:" +msg; } } in c++ native: #include "jniexample.h" jniexport void jnicall java_jniexample_setcallback (jnienv * jnienv, jobject jobj, jobject classref) { jclass jc =...

php - How to change the name text of sender when sending mail with Swift_Message? -

php - How to change the name text of sender when sending mail with Swift_Message? - i using swiftmailer send emails application. all working fine far. need able alter text of sender dynamically. code snippet below , next paragraph should clarify mean. currently, code looks this: try{ $message = swift_message::newinstance() ->setfrom($from) ->setto($to) ->setsubject($subject) ->setbody($content); $mailer->send($message); }catch (exception $e) { // ... } the $from variable contains email address of sender - sysmail@mydomain.com however, want send daily digests (for example) different entities (example forums, groups etc), want able set name text of sender 'forum abc members daily digest', though sender still sysmailer@mydomain.com. notice linkedin doing similar - send out different digests under different sender names, though sender group-digests@linkedin.com. the default name...

select - mySQL joins or subquery -

select - mySQL joins or subquery - i have 3 tables: show, episode, , airing. each show has multiple episodes, , each episode has multiple airings. want 1 row each show airing.start_time closest start_time right (but in future). if there isn't future start_time , want row anyway ( start_time should empty). here's current query: select s.project_id, s.title, s.description, s.topic, s.status, a.start_time, a.channel show s left bring together episode e on s.project_id = e.project_id left bring together airing on e.episode_id = a.episode_id s.status = "active" , s.title "a%" , a.start_time > now() order s.title asc, a.start_time asc grouping s.project_id i'm not sure go next. help? without showing airing.channel : select s.project_id, s.title, s.description, s.topic, s.status, ...

SOAP Security Negotiation Error in WCF Duplex service -

SOAP Security Negotiation Error in WCF Duplex service - i'm working on wcf service duplex communications , having issue getting work anywhere other through localhost on dev machine. no matter do, comes next error: {"security back upwards provider interface (sspi) authentication failed. server may not running in business relationship identity 'host/crpnyciis20e'. if server running in service business relationship (network service example), specify account's serviceprincipalname identity in endpointaddress server. if server running in user account, specify account's userprincipalname identity in endpointaddress server."} my service web.config follows: <?xml version="1.0"?> <configuration> <system.web> <compilation debug="true" targetframework="4.0" /> </system.web> <system.servicemodel> <protocolmapping> <add scheme="ht...

graph - When can one consider a subgraph as a giant component of a network? -

graph - When can one consider a subgraph as a giant component of a network? - i doing network resilience analysis of co-occurrence network of words. what understand that, minimum fraction of total nodes must nowadays in connected component(sub-graph) of network considered giant component. for example, in network of 20,000 nodes if maximum nodes sub-graph contains 3, can considered giant component? as understand, asking definition of term "giant component". it (qualitative) observation if add together "enough" edges graph (especially in case of random graphs), there 1 component contains bulk of nodes. called giant component. this qualitative observation. there's no precise definition of "giant component" based on fraction of nodes belonging it. observation in random graph of lots of nodes, there's threshold connectivity around fraction of nodes belonging largest component increment sharply. is there problem trying solv...

opengl - Getting the true z value from the depth buffer -

opengl - Getting the true z value from the depth buffer - sampling depth buffer in shader returns values between 0 , 1, expected. given near- , far- clip planes of camera, how calculate true z value @ point, i.e. distance camera? from http://web.archive.org/web/20130416194336/http://olivers.posterous.com/linear-depth-in-glsl-for-real // == post-process frag shader =========================================== uniform sampler2d depthbufftex; uniform float znear; uniform float zfar; varying vec2 vtexcoord; void main(void) { float z_b = texture2d(depthbufftex, vtexcoord).x; float z_n = 2.0 * z_b - 1.0; float z_e = 2.0 * znear * zfar / (zfar + znear - z_n * (zfar - znear)); } [edit] here's explanation (with 2 mistakes, see christian's comment below) : an opengl perspective matrix looks : when multiply matrix homogeneous point [x,y,z,1], gives you: [don't care, don't care, az+b, -z] (with , b 2 big components in matrix). opengl next perspect...

How do I change the default text for PublishingWebControls:RichHtmlField in Sharepoint 2010? -

How do I change the default text for PublishingWebControls:RichHtmlField in Sharepoint 2010? - by default showing text looks this: your-field-name-here field value. lorem ipsum dolor sit down amet, consectetur adipisicing elit, sed eiusmod tempor incididunt ut labore et dolore magna aliqua. ut enim advertisement minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore european union fugiat nulla pariatur. excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. we using custom form templates , turns out incorrectly setting form field mode edit instead if new mode: < publishingwebcontrols:richhtmlfield runat="server" id="ff2" fieldname="answer" controlmode="edit" / > sharepoint sharepoint-2010

visual c++ - Understanding a C++ sample - printers, handles, strings -

visual c++ - Understanding a C++ sample - printers, handles, strings - there few question next code came across here: // rawdatatoprinter - sends binary info straight printer // // szprintername: null-terminated string specifying printer name // lpdata: pointer raw info bytes // dwcount length of lpdata in bytes // // returns: true success, false failure. // bool rawdatatoprinter(lptstr szprintername, lpbyte lpdata, dword dwcount) { bool bstatus = false; handle hprinter = null; doc_info_1 docinfo; dword dwjob = 0l; dword dwbyteswritten = 0l; // open handle printer. bstatus = openprinter( szprintername, &hprinter, null ); // question 1 if (bstatus) { // fill in construction info "document." docinfo.pdocname = (lptstr)_t("my document"); // question 2 docinfo.poutputfile = null; // question 3 docinfo.pdatatype = (lptstr)_t(...

java - Add StartElement to JAXBContext marshal -

java - Add StartElement to JAXBContext marshal - i have object x want marshal file. xml of x : <x id="0"><f1>bla</f1><f2>bla </f2><f3>bla</f3></x> this part figured out ... if have list of x's want write file. but want start file <z> <y> <k> <x id="1"> ... </x> <x id="2"> ... </x> <x id="3"> ... </x> </k> </y> </z> is there anyway can marshel ?! add together z y , k list of x's , close z y , k ?! thank ... you leverage jaxb , stax , following: import javax.xml.bind.jaxbcontext; import javax.xml.bind.jaxbelement; import javax.xml.bind.marshaller; import javax.xml.namespace.qname; import javax.xml.stream.xmloutputfactory; import javax.xml.stream.xmlstreamwriter; public class demo { public static void main(string[] args) throws exception { ...

php - Change Number string 1000000 to 1.000.000 -

php - Change Number string 1000000 to 1.000.000 - using php want create numbers more 'readable'... i want modify example: 10 ... 10 (no change) 100 100 (still no change) 1000 1.000 1.000.000 1.000.000 1000000000 1.000.000.000 etc number_format() php string numbers units-of-measurement

php - Direct upload to s3 without the use of a production server -

php - Direct upload to s3 without the use of a production server - we creating media driven website requires our users submit big broadcast quality video files on internet. want cutting bandwidth issues out eliminating utilize of our production server (where website is), , creating connection between user , s3 account. to create matters more fun, our hosting service allows 50mb upload through php... i've looked on net feasible solution, can help? a progress bar terrific well. the simplest way s3 post upload api. if need progress bar, you can on html5 browsers; if need back upwards older browsers may need flash uploader. php asp.net drupal upload amazon-s3

javascript - AJAX response problem -

javascript - AJAX response problem - i've got function: function ajax() { var xmlhttp, onready, open, response; if(window.xmlhttprequest) { this.xmlhttp = new xmlhttprequest(); } else { this.xmlhttp = new activexobject("microsoft.xmlhttp"); } this.onready = function(onready) { this.xmlhttp.onreadystatechange = function() { if ( this.xmlhttp.readystate == 4 && this.xmlhttp.status == 200) { onready.call(); } } }; this.open = function(_filename, _method) { this.xmlhttp.open(_method, _filename, true); this.xmlhttp.send(null); }; this.response = function() { homecoming this.xmlhttp.responsetext; }; } function rc() { var ajax = new ajax(); ajax.onready(function() { document.getelementbyid("comments").innerhtml = ajax.response(); }); ajax.open("ab.php","get"); } rc()...

sql - Declaration of multiple values in Oracle BIND Variables -

sql - Declaration of multiple values in Oracle BIND Variables - i trying pass multiple values 3000 values, bind variable in oracle sql plus command prompt like.. select job emp job in :job -- bind variable value i want see result, values in emp table on column job matching variable list has fetched out. as beingness production environment can't create tables have grant on select clause. need more info on how executed when run same query unix-sql plus environment. will prompt asking come in bind variables values or can refer file has values as... :job1 := 'manager' :job2 := 'clerk' :job3 := 'accountant' oracle bind variables one-to-one relationship, you'd need 1 defined each value intend include in in clause: select job emp job in (:job1, :job2, :job3, ..., :job3000) you need aware oracle in supports maximum of 1,000 values, or you'll get: ora-01795: maximum number of expressions in list 1000 the ...

java - android client cannot do a post action to a wcf json service -

java - android client cannot do a post action to a wcf json service - the problem cannot phone call wcf json service android client. able phone call wcf json service c# client , fiddler, same exact request parameter. everytime seek calling service android client error: "http/1.1 405 method not allowed." i've done research both here , on google android developer group, still cannot code working correctly. i don't know problem more, if could, please help. thank in advance. // #################################### // android client // #################################### servicerequest servicerequest = new servicerequest(); servicerequest.setaccesskey("ee404d54-ea45-421a-9633-1ea35c0c211e"); servicerequest.setfbaccesstoken("2227470867|2.aqaeyiajuxtmsrqi.3600.1310490000.0-757629911|mz1jfutonif0y84aeutxcwgypzi"); servicerequest.settype("c"); servicerequest.setplatform("a"); // request.setd...

Any good sites or suggestion for jquery overlay dialog? -

Any good sites or suggestion for jquery overlay dialog? - hi new jquery , wanted create jquery overlay dialog in have input fields textboxes , radiobutton , ok , cancel button. need display table on clicking ok button displaying input fields in webform. have basic dialog knowledge bt confused how implement this. sites or suggestion similar tutorial learning me. jquery ui dialog demo: modal form. jquery dialog overlay

php - Prevent codeigniter session library from sending set-cookie header parameter if autoloaded -

php - Prevent codeigniter session library from sending set-cookie header parameter if autoloaded - i have codeigniter based website , have controllers called via ajax , homecoming json values. problem since i've autoloaded session library that's sent response codeigniter has the set-cookie ci_csrf_token=65d0857a89345g5sg5695e71fa687b14c; expires=sat, 09-jul-2011 17:00:29 gmt; path=/ header parameter set. seems unneccessary bandwidth overhead, there way prevent codeigniter sending header? not without modifying session class: not expose command on header in published interface. in addition, cookie not generated session class, security class. have disable csrf protection, unfortunately not can using published interface on per-request behavior. php session codeigniter http-headers

c# - MySQL Query To Retrieve Data With Column Names -

c# - MySQL Query To Retrieve Data With Column Names - i writing tool has retrieve column names of retrieved info set when query applied it. if you're familiar phpmyadmin, realize sql pane runs query , shows result column names. wonder how hard query be, results in column names , what's programming behind scene? like, analyzes query , find table names , first retrieve column names using query show columns table-name , data? is there improve way? updated sorry incomplete information, think must using mysql connector .net , using c#. your columns part of metadate of datareader or datatable load in c# from msdn datatable: private void printcolumnnames(dataset dataset) { // each datatable, print columnname. foreach(datatable table in dataset.tables) { foreach(datacolumn column in table.columns) { console.writeline(column.columnname); } } } for datareader, see can column names sqldatareader? c# .n...

using jQuery/javascript to display an image created by the server -

using jQuery/javascript to display an image created by the server - i have script uses jquery post info through ajax php script, uses info create dynamic jpg image. php script returns binary image info output using php header image/jpeg command (so far good). now want display image in client, haven't been able find proper solution yet. after reading bit understand possible solution have php script encode in base64 , homecoming string client info uri. however, solution won't suffice because not supported ie < 8 , still limited 32k images in ie 8. for moment, writing image temp dir on server , homecoming filename client. however, there must way solve more elegantly through. advise on how can utilize jquery/javascript display returned binary image info in browser? thanks! per comment, here's had in mind. perchance solution you, depends on code. you create img tag dynamicaly , pass url parameters php script instead of doing ajax post. code...

c# - Which features make a class to be thread-safe? -

c# - Which features make a class to be thread-safe? - in msdn .net classes described this: "this type thread safe." or "public static (shared in visual basic) members of type thread safe. instance members not guaranteed thread-safe.". my question features create class thread-safe? is there standard, recommendation or guidelines thread-safety programming? when utilize lock(c#) keyword, means class thread-safe or not? how evaluate thread-safety of class? there tests sure class 100% thread safe? example: public class myclass { public void method() { lock (this) { // now, class 100% thread-safe microsoft classes? } } type m_member1; type m_member2; } thanks a class considered thread-safe if methods can invoked multiple threads concurrently without corrupting state of class or causing unexpected side-effects. there many reasons why class may not thread safe, although mutual reaso...

jquery - Check if event is triggered by a human -

jquery - Check if event is triggered by a human - i have handler attached event , execute if triggered human, , not trigger() method. how tell difference? for example, $('.checkbox').change(function(e){ if (e.ishuman()) { alert ('human'); } }); $('.checkbox').trigger('change'); //doesn't alert you can check e.originalevent : if it's defined click human: look @ fiddle http://jsfiddle.net/uf8wv/ $('.checkbox').change(function(e){ if (e.originalevent !== undefined) { alert ('human'); } }); my illustration in fiddle: <input type='checkbox' id='try' >try <button id='click'>click</button> $("#try").click(function(event) { if (event.originalevent === undefined) { alert('not human') } else { alert(' human'); } }); $('#click').click(function(event) { $("#try").click(); ...

c# - True Parallel Downloads -

c# - True Parallel Downloads - this method using concurrent downloads. public void downloadconcurrent(action method) { action[] methodlist = new action[concurent_downloads]; (int = 0; < concurent_downloads; i++) { methodlist[i] = method; } parallel.invoke(methodlist); } i trying download urls simultaneously, no. of active downloads one. like downloads invoke, 1 url start downloading data, not start progressing downloads. i want downloads work parallel same time, unable accomplish that. update: methord using queue, downloading diffrent urls, form queue. instance members of webclient not thread safe, ensure have separate instances in each action. in method have shown seem multiplicating same action delegate multiple times. not downloading different urls, downloading same url multiple times. , because webclient not thread safe might run problems. here's illustra...

user interface - Any book/documents/web pages about UI Application Software Architecture? -

user interface - Any book/documents/web pages about UI Application Software Architecture? - this not software architecture: it's ui software architecture update: main focus keys might be: generic construction of ui application automatic 2d layout (horizontal, vertical, absolute , custom) in flex 4 focus manager this book awesome: http://www.aosabook.org/en/index.html you have many examples of ui architecture of famous systems: audacity (sound edit) eclipse (ide) vistrails (visualization tool) battle wesnoth (game) user-interface software-engineering

ms access - Calculated control does not recalc automatically -

ms access - Calculated control does not recalc automatically - firstly, bit setup. i have primitive database of 3 tables: a. table lists various locations: [location_code], [location_name] b. table describes items: [item_code], [item_name], [item_price] and table ties roo^h^h^h whole database together c. table says items stored @ each locations , in quantities: [location_code], [item_code], [item_quantity]. table can have multiple entries same [location_code], since different items can stored @ same location. basically, schoolbook implementation of one-to-many relationship locations items, attribute (quantity) attached each location-item link. now, need create form list items stored @ location. basic use-case "subform" feature in access. main form navigates through different locations, while subform lists items. i use select c.location_code, b.item_name, b.item_code, b.item_price, c.item_quantity b inner bring together c on b.item_code=c.item_code a...

git - gitignore matching character repetitions -

git - gitignore matching character repetitions - i have directory in git repository files in it, let's phone call matchdir : $ ls matchdir 2fd4e1c67a2d28fced849ee1bb76e7391b93eb12 da39a3ee5e6b4b0d3255bfef95601890afd80709 file.py someotherfile.txt i want add together files match 40 hex characters .gitignore file. matchdir/[0-9a-f]{32} doesn't seem work. there way match specific number of repetitions of character in .gitignore file? matchdir/???????????????????????????????????????? will match files 40 letters. that's not hex letters, it's improve matchdir/* match length. typing 40 ? takes 3 keystrokes under emacs: c-4c-0?. it's easy search , replace ? [0-9a-f] if want grab hex numbers: matchdir/[0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f...

How to create an XML file using TXML Document in Delphi 7 -

How to create an XML file using TXML Document in Delphi 7 - i have used next code create xml document : procedure tform1.btncreatexmlclick(sender: tobject); var rootname:string; childname:string; attrchild:string; ixml: idomdocument; iroot, inode, inode2, ichild, iattribute: idomnode; begin xmldoc.active:=false; xmldoc.xml.text:=''; xmldoc.active:=true; xmldoc.filename:='c:\documents , settings\a\desktop\new text document.xml'; ixml := xmldoc.domdocument; //iroot:=ixml.documentelement(ixml.createelement('xml')); iroot := ixml.appendchild(ixml.createelement ('xml')); // node "test" inode := iroot.appendchild (ixml.createelement ('test')); inode.appendchild (ixml.createelement ('test2')); ichild := inode.appendchild (ixml.createelement ('test3')); ichild.appendchild (ixml.createtextnode('simple value')); inode.insertbefore (ixml.createelemen...

2d - Unity - Autoresize with Abn sprite manager 2 -

2d - Unity - Autoresize with Abn sprite manager 2 - hi building 2d game , using sprite scrits anb soft.i trying build iphone tall res simulator gets max resolution of 640 * 865 instead of 640 * 960 can't position elements on screen.because pixel perfect checked,auotresize checked , generates problems. monitor set max res available. ideas? 2d sprite manager unity3d

asp.net - Why is sharepoint 2010 targeting .Net version 2.0? -

asp.net - Why is sharepoint 2010 targeting .Net version 2.0? - whenever have error on page prints out .net , asp versions beingness used. says: version information: microsoft .net framework version:2.0.50727.5446; asp.net version:2.0.50727.5420 why targeting 2.0 , how can alter utilize 3.5? remember purposes of asp.net, 3.5 set of extensions 2.0 runtime. 3.5-based sites still show 2.0 here, because running in 2.0 app pool. if have 3.5 code need, should work fine here. .net asp.net sharepoint

php - send data to android set -

php - send data to android set - how send info php page open in browser particular person has android set him.the person connected net , me also.i know person imei number.kindly tell me possible solutions.please new android probably best way utilize c2dm - http://code.google.com/android/c2dm/index.html php android

python - How to fix Unicode encode error using the hashlib module? -

python - How to fix Unicode encode error using the hashlib module? - after multiple searches have not been able determine how avoid error stating: "unicode-objects must encoded before hashing" when using code: pwdinput = input("now come in password:") pwd = hashlib.sha1() pwd.update(pwdinput) pwd = pwd.hexdigest() how can past error? how encode unicode-objects? pwdinput = input("now come in password:").encode('utf-8') # or whatever encoding wish utilize assuming you're using python 3, convert unicode string returned input() bytes object encoded in utf-8, or whatever encoding wish use. previous versions of python have well, handling of unicode vs. non-unicode strings bit messy, whereas python 3 has explicit distinction between unicode strings ( str ) , immutable sequences of bytes may or may not represent ascii characters ( bytes ). http://docs.python.org/library/stdtypes.html#str.encode http://docs.p...