Posts

Showing posts from July, 2013

Getting Tumblr's API to work in ruby -

Getting Tumblr's API to work in ruby - can't seem tumblr's api working. i'm trying utilize tumblife gem. took @ source , think these equivalent calls it's trying make: consumer = oauth::consumer.new(app_key, app_secret, site: 'http://api.tumblr.com/') access_token = oauth.accesstoken.new(consumer, oauth_key, oauth_secret) access_token.post('http://api.tumblr.com/v2/user/dashboard') which returns not authorized error. help? ruby api tumblr

php - Login Script working local but not on live environment -

php - Login Script working local but not on live environment - i seem have problem login script, works on local php dev box, not on live environment, i'm assuming i'm missing can advise further? <?php $user = $_post["swtorun"]; $pass = $_post["swtorpw"]; // generate hash $enc_pwd = hash('sha256', $pass); // connect database include('../../settings.php'); $conn = mysql_connect($host,$username,$password); $db = mysql_select_db($database, $conn); // mysql query users $sql = "select * `users` username='$user' , password='$enc_pwd'"; $result = mysql_query($sql, $conn); $count = mysql_num_rows($result); // number of results (should 1) if($count==1){ // initiate session session_start(); $_session['logged'] = "1"; echo "you logged in, homecoming <a href=\"../../index.php\">index</a>"; } else { echo "wrong username or password"; } ?> add ...

c# - Autocomplete jquery not working? -

c# - Autocomplete jquery not working? - i have text box, within want auto complete. info auto finish going given through database. this jquery: var info = "autocompletetagdata.aspx" $("#item").autocomplete({ source: info }); this have set in autocompletetagdata now: protected void page_load(object sender, eventargs e) { string term = request.querystring["term"]; sqlconnection myconnection = new sqlconnection(connstr); myconnection.open(); string sql = ("select top 10 ltrim(rtrim(pgprdc)) pgprdc sroprg sroprg"); sqlcommand mycommand = new sqlcommand(sql, myconnection); stringbuilder sb = new stringbuilder(); seek { sqldatareader reader = mycommand.executereader(); if (reader.hasrows) { while (reader.read()) { sb.append(reader.getstring(0)) .append(environment.newline); } } ...

xmlhttprequest - JQuery AJAX and XHR2 responseType "document" -

xmlhttprequest - JQuery AJAX and XHR2 responseType "document" - i requesting website jquery's ajax function. little bit unclear responsetype of xhr request. far using "datatype: "html"" attribute not happy it. i'd rather have finish htmldocument returned allow me traverse dom tree , scrape info needed. believe "document" responsetype supported xhr2 requests. how can done jquery? there way homecoming domtree can navigate through? simply add together next $.ajax() call: xhrfields: { responsetype: "document" }, to retrieve document object, success phone call should this: success: function(data, textstatus, request) { if (textstatus == "success") { myresponse = request.responsexml; } else // not successful }, jquery xmlhttprequest

iphone - Always open application at rootViewController -

iphone - Always open application at rootViewController - in app want user see rootviewcontroller 's view when app opened if app has not been killed completely. one alternative have considered calling abort() in applicationwillresignactive: doesn't seem nice solution. any suggestions? set uiapplicationexitsonsuspend in info.plist true. iphone ios ipad

php - Calculating percentage changes without dividing by zero -

php - Calculating percentage changes without dividing by zero - i have next php using calculate percentage decreases or increases: function calculatepercentageincrease( $nlastmonthperiod, $ncurrentperiod ) { if ( !is_numeric( $nlastmonthperiod ) || !is_numeric( $ncurrentperiod ) ) homecoming 0; if ( $nlastmonthperiod == 0 ) homecoming 0; $nlastmonthperiod = intval( $nlastmonthperiod ); $ncurrentperiod = intval( $ncurrentperiod ); $ndifference = ( ( ( $ncurrentperiod - $nlastmonthperiod ) / $nlastmonthperiod ) * 100 ); homecoming round( $ndifference ); } the problem wondering if $nlastmonthperiod 0 , $ncurrentperiod 10 should returning 100 , not 0? if $nlastmonthperiod 0 , $ncurrentperiod 10 should returning 100 , not 0? thats coded ... if ( $nlastmonthperiod == 0 ) homecoming 0; did mean? if ( $nlastmonthperiod == 0 ) if ($ncurrentperiod>0) homecoming 100; //whatever w...

flex3 - global variable not getting set with proper values in another function in flex -

flex3 - global variable not getting set with proper values in another function in flex - i have global variable 'csid' of string type. in code below under drawchart() function, in loop, csid variable should set '1' modellocator when i=0 , csid should set '2' modellocator when i=1.(considering lengh=2). alert in drawchart() (for csid) seems printing right 'csid' values(both 1 , 2) in datafunction() 'columnseries_labelfunc' getting csid alert value '2' , never '1'. please find code below: drawchart() function:: public function drawchart():void { var cs:columnseries= new columnseries(); var lenght:number=appmodellocator.getinstance().ctsmodel.productsummary.getitemat(0).collmgmtofclist.length; mychart.series = [cs]; var tempobj:object; for(csloop=0;csloop<lenght;csloop++) { cs = new columnseries(); this.csid= new string(string(appmodellocator.getinstance()...

java - UnsatisfiedLinkError Eclipse with JNI -

java - UnsatisfiedLinkError Eclipse with JNI - i've had reoccuring problem , series of semi related posts issue. i've made progress , solved 32bit/64bit shared file .so file not beingness readable in jvm because of mismatched word lengths. have new error message new problem. my problem still getting unsatisfiedlinkerror time it's referencing actual methods within class instead of having problem class whole. exception in thread "main" java.lang.unsatisfiedlinkerror: com.bob.thrift.xda_core_java.ping(ljava/lang/string;)i @ com.bob.thrift.sig_xda_core_java.ping(native method) @ com.bob.thrift.xda_core_operations.main(xda_core_operations.java:10) now, think step closer want. @ to the lowest degree it's finding .so file , linking main class. how able link .so still have problem specific usage in method call. should point out i've said in other posts have run fine in brand new install of eclipse. think it's eclipse setting can't figure o...

payment gateway - Paypal Sanbox - IPN Not working -

payment gateway - Paypal Sanbox - IPN Not working - my site not receiving ipn paypal sandbox. verified working of notify.php page sending manual ipn via "ipn simulator" , works fine. receiving no ipn regular purchase simulation. i checked ipn history sandbox-test account. ipn end in failed after multiple retries. date/time created | message id | status | transaction id 1/30/2012 23:06 pst | 0j990932sn848805v | retrying | 1c574181pd653873s 1/30/2012 22:47 pst | 8uy41985u65227626 | failed | 7um32625t8929325l 1/30/2012 22:32 pst | 36444784fh458323t | sent | 7l3718344f253661j 1/30/2012 22:28 pst | 5ka14796r82961455 | failed | 9pu30039g7583750s i can't figure out issue! problem @ end or wrong @ sandbox overloaded or etc.? there no guaranty ipn work sandbox each time. responses can returned after few hours or never. also, sure that: your homecoming url public (not in local network "l...

binding - Can't get .NET Policy DLL to redirect application to newer assembly -

binding - Can't get .NET Policy DLL to redirect application to newer assembly - my background in technical back upwards had resulted in me putting far much info in post, leading nobody beingness interested in reading it, imho, more info improve less. there basic , fundamental assembly binding , redirection i'm missing. i'm trying create policy dll redirect applications have compiled against older version of assembly newest version. nil seems work. i've outlined steps take below. i'm not using visual studio, command line tools included .net framework , windows sdk. can tell me why, in step eleven, when run application compiled against v1.0.0 version of assembly, application not redirected towards v2.0.0 assembly registered in gac? as follow along did, you'll have take note of directory i've executed commands in. i more happy rtfm answer, if you'd kind point tfm i'm supposed read. thanks in advance, reg step 1 : create key p...

hibernate - Request processing failed; nested exception is java.lang.RuntimeException: java.lang.OutOfMemoryError -

hibernate - Request processing failed; nested exception is java.lang.RuntimeException: java.lang.OutOfMemoryError - i have error. i'm working gwt, spring, hibernate, maven. when may phone call webservice debugging see if bring info requested, no longer come view, when travels view phone call made asynccallback, goes limbo, , ended dialing: org.springframework.web.util.nestedservletexception: request processing failed; nested exception java.lang.runtimeexception: java.lang.outofmemoryerror: java heap space ayudenme took night trying solve , see nil solution grateful in too i'd attach visual vm 1.3.3 process throws exception , examine what's happening heap. you don't need advice here; need more info , visibility. no 1 reply based on you've posted. we're blind, you. more info clarify situation. hibernate spring gwt maven

Sending a matrix with each iteration: Matlab "engine.h" c++ -

Sending a matrix with each iteration: Matlab "engine.h" c++ - this question comes after solving problem got in question. have c++ code processes frames photographic camera , generates matrix each processed frame. want send matlab engine each matrix, @ end of execution have in stored matrices. conffused how this, send matrix in each iteration overwritting time, @ end have one. here code example: matrix.cpp #include helper.h mxarray *mat; mat = mxcreatedoublematrix(13, 13, mxreal); memcpy(mxgetpr(mat),matrix.data, 13*13*sizeof(double)); engputvariable(engine, "mat", mat); i tried utilize counter dinamically name different matrices, didn't work matlab engine requires variables defined first. help appreciated. thanks. if don't know number of frames priori, don't seek expand mxarray in c. not convenient. close start. problems can solved with: engevalstring(engine, "your command here") read more here. the simp...

asp.net - Get the Value of an asp:HiddenField using jQuery -

asp.net - Get the Value of an asp:HiddenField using jQuery - i have 2 pages. first page, open modal querystring holds value of client name. utilize set hiddenfield on modal opened. i need textbox on new modal display value has been sent through first screen. i've tried getting value using: var hv = $('hidclientfield').val();` but doesn't seem work. this hidden field: <asp:hiddenfield id="hidclientname" runat="server" />` i set in code behind on page_load this: hidclientname.value = request.querystring["client_name"] ?? "";` any ideas much appreciated. try of following if asp.net command , javascript both on same page, use var hv = $("#"+ '<%= hidclientfield.clientid %>').val(); if want access command js file, then // 'id$' cause jquery search command id ends 'hidclientfield' var hv = $('input[id$=hidclientfield]').val(); you ...

php - Mask outgoing links -

php - Mask outgoing links - on php web page, i'm displaying html5 player plays mp3 track, , there's download button next that. want mask download link only, visitors not able see directory tree of server (www.example.com/content/plugins/audio/downloads/test.mp3). want alter link more simple , smaller (www.example.com/download/test.mp3) without changing folders construction of server. i'm not sure if .htaccess or php thing. thanks in advance. with .htaccess need next rewrite rule: $ pwd /var/www $ cat .htaccess rewriteengine on rewriterule ^/download/(.*\.mp3) /content/plugins/audio/downloads/$1 [nc] it match http://yourdomain.com/download/….mp3 requests , redirect http://yourdomain.com/content/plugins/audio/downloads/….mp3 if want .htaccess work within subdirectory, utilize rewritebase : $ cat subdirectory/.htaccess rewriteengine on rewritebase /subdirectory rewriterule ^download/(.*\.mp3) content/plugins/audio/downloads/$1 [nc] i.e. htt...

debugging - How to debug .so on aix which is invoked from java -

debugging - How to debug .so on aix which is invoked from java - i have plane c code after built gives .so file on aix, , .so file invokes java, how can debug .so file? cheers bala check .so built debug symbols. if using gcc or g++, done using -g option. can attach gdb jvm process process number because .so run there. using appropriate equivalent "process=`ps | grep java | cutting -d' ' -f1`; gdb -p $process". add together source directory debugging using gdb command "dir $sourcedir" substituting path source directory $sourcedir. finally, set breakpoint @ desired line of source code .so. i referred info blog entry linux - gdb debug jni tomcat. debugging aix dbg

Django how to store forms data from several pages into one table -

Django how to store forms data from several pages into one table - i'm building django project, , creating user profile app. want user finish creating profile process in multiple pages. example: first page fill in address , phone number, , user click "continue" sec page, user can fill in other things gender, date of birth. want store info 1 table. what used store first page's info hidden field, , pass next page , submit them @ final page. right , secure way? how django handle condition? thank you. use django's formwizard django django-forms django-users

dynamic google map using php -

dynamic google map using php - i want archive functionality of dynamic map such when select place display in map if zoom map list refresh such display places in current map if click on next 10 places load new map accordingly by using , how going possible me in php? try read about openlayers gmap jmapping they helpfull dynamic , static maps. you may see this tutorial google maps. php google-maps

c# - WCF - Client Endpoint Configuration Error -

c# - WCF - Client Endpoint Configuration Error - in client application, i'm getting next error: could not find endpoint element name 'queuedservice' , contract 'imyservice' in servicemodel client configuration section. might because no configuration file found application, or because no endpoint element matching name found in client element. i used svutil.exe generate client proxy i'm using. typically hand-roll own proxy, , notice generated version of interface service contract not in namespace specified in service contract: // auto-generated proxy namespace myservices.contracts { // request object in right namespace [system.runtime.serialization.datacontractattribute( name="myrequest", namespace="http://schemas.datacontract.org/2004/07/myservices.contracts")] public class myrequest { // ... } } // service contract not in namespace [system.servicemodel.servicecontractattribute( ...

c - how to add Xorg event handing in g_main_loop -

c - how to add Xorg event handing in g_main_loop - i have a lightweight application catches xorg , dbus events. in order initialized dbus loop , started g_main_loop, don't know how add together xorg event handling in natural way: gmainloop * mainloop = null; mainloop = g_main_loop_new(null,false); dbus_g_thread_init (); dbus_init(); // <<<<<<<<<<<<<<<<<<<<<<<<< //1 way using timeout //g_timeout_add(100, kbdd_default_iter, mainloop); //2nd way using pthread //gthread * t = g_thread_create(kbdd_default_loop, null, false, null); //>>>>>>>>>>>>>>>>>>>>>>>>>>> g_main_loop_run(mainloop); in default iter i'm checking if there waiting x-event , handle them. both ways seems bad, first because have unneeded calls checking event, sec because create additional thread , have create additional locks. p.s. know can uti...

c++ - How to Detect Hidden Processes -

c++ - How to Detect Hidden Processes - wondering how application "process explorer" or "combo fix" observe hidden process ??? i'm assuming must done in c or c++. easy plenty access process list in .net not accurate, know root kits can mask task manager. through memory access , io ? curious if knows how accomplished. this question can't answered. depends how process has been hidden in first place. example, can hide process injecting usermode dll processes hooks enumprocesses , process32next , etc. , other apis related process enumeration. bypassed trampoline skips hook. however, if process hidden through modifying kernel eprocess linked list holds list of processes, method needed subvert code performed hiding. if define how think process beingness 'hidden', maybe can suggest how observe it. processes think beingness hidden still beingness discovered process explorer? also taking consideration there multiple ways hide p...

java - Is there a better way to persist a map with the value being a set? -

java - Is there a better way to persist a map with the value being a set? - i'm looked lot beingness able utilize hibernate persist map map<string, set<entity>> little luck (especially since want on 1 table). mapping multimaps hibernate thing seems referenced most, describes in detail how go implementing using usercollectiontype . i wondering, since written on 4 years ago, there improve way of doing now? so, example, have on entitya map map<string, set/list<entityb>> . there 2 tables: entitya , entityb (with entityb having foreign key entitya ). i don't want intermediate tables. the way how done on current project transforming beans/collections xml using xstream: public static string toxml(object instance) { xstream xs = new xstream(); stringwriter author = new stringwriter(); xs.marshal(instance, new compactwriter(writer)); homecoming writer.tostring(); } and using lob type in hibernate persisting : ...

actionscript 3 - Flex 3: Adding a sprite to a Container's "rawChildren" sometimes adds it to the content children instead -

actionscript 3 - Flex 3: Adding a sprite to a Container's "rawChildren" sometimes adds it to the content children instead - the basic problem i'm trying solve have mix of flex & flash components, , have generic function adding progress spinner component regardless. if component container , add together rawchildren , otherwise add together normally. however, i'm running problem component inherits vbox. call cont.rawchildren.addchildat(spinner, cont.rawchildren.numchildren); but when trace children, spinner shows in cont.getchildren() , , comp.numchildren increases one. , other containers seem work properly, other vbox controls. i walked through flex framework code , can't find explain why happen, either via inheritance or timing. has seen similar or can explain why rawchildren might not predictable in case? thanks. function: var bcu:number = u.numchildren; var bce:number = el.numchildren; el.addchildat(s, ((pos > -1)?pos : ...

makefile - Tips to make builds faster -

makefile - Tips to make builds faster - is there way create software builds / compilation faster ? have build tree c, c++ using makefile takes close 2hrs fresh builds. came across few commercial solutions electricaccelerator, sparkbuild, there opensource equivalent ? you may want @ distcc, ccache and, of course, -j create option. build makefile gnu-make

append - Concatenate txt file contents and/or add break to all -

append - Concatenate txt file contents and/or add break to all - i have bunch of.txt files need made 1 big file can read programs such microsoft excel. the problem files not have break @ end of them, end in 1 long line. here's illustration of have (the numbers represent line number): 1. | first line of txt file 2. | sec line here's want turn into: 1. | first line of txt file 2. | sec line 3. | i have around 3000 of these files in folder, in same format. there way take these files , add together blank line end of them all? i'd without need complicated code, i.e. php, etc.. know there similar things can using terminal (i'm on centos), if require i'm missing it. the simplest way accomplish bash for-loop: for file in *.txt; echo >> "$file" done this iterates on .txt files in current directory , appends newline each file. can written in 1 line, need add together ; before done . note $file quoted handle fi...

drawing - How erase a line draw in iphone(CGGraphics)? -

drawing - How erase a line draw in iphone(CGGraphics)? - i working on iphone application of drawing, user can draw line , can remove can body help me how remove line or drawing? code draw - (void)drawrect:(cgrect)rect { float newheight; float newwidth; if (!mydrawing) { mydrawing = [[nsmutablearray alloc] initwithcapacity:0]; } cgcontextref ctx = uigraphicsgetcurrentcontext(); if (mypic != null) { float ratio = mypic.size.height/460; if (mypic.size.width/320 > ratio) { ratio = mypic.size.width/320; } newheight = mypic.size.height/ratio; newwidth = mypic.size.width/ratio; [mypic drawinrect:cgrectmake(0,0,newwidth,newheight)]; } if ([mydrawing count] > 0) { cgcontextsetlinewidth(ctx, 5); (int = 0 ; < [mydrawing count] ; i++) { nsarray *thisarray = [mydrawing objectatindex:i]; if ([thisarray count] > 2) { f...

java - Trying to achieve a simple algorithm -

java - Trying to achieve a simple algorithm - i have n options, between 1 , thousands. example, explain 3 options, need algorithm work n options. a=30% possibilities b=50% possibilities c=20% possibilities i need randomly 1 of these 3 options, according probabilities. i achieved generating random number between 0 , 100, , i'm doing heavy , ugly code know when number between 0 , possibilities number, between possibilities , b possibilities, etc. do know improve way this? choose random number in range need, start subtracting probability of each alternative number until reach 0. lastly probability subtracted want. int[] possibilities = new int[] {20,50,30}; random rand = new random(); int r = rand.nextint(100); int = 0; (i=0;i<possibilities.length; i++) { r -= possibilities[i]; if (r <= 0) break; } system.out.println(i); // index of possibility java c algorithm

Scrolling in extjs grids -

Scrolling in extjs grids - im go crazy. i have panels configured follows: accordion = new ext.panel({ id:'accordionpanel', title: 'options', region: 'center', animcollapse: true, border:false, minwidth: 150, maxwidth: 400, autoscroll:true, autoheight:true, layout: 'accordion', layoutconfig:{ animate: true } }); var panelone = new ext.panel({ region: 'center', layout:'border', defaults: { collapsible: true, split: true }, items: [{ title: 'navigation', region:'west', margins: '5 0 0 0', animc...

How to display 4 rows from mysql database and then use a next button to show the next 4 in PHP -

How to display 4 rows from mysql database and then use a next button to show the next 4 in PHP - how result in php php display page 1 1 kirk 12 2 jj 45 3 smith 16 4 kk 50 php display page 2 1 tt 12 2 kim 45 3 monique 16 4 pp 50 i getting first 4 when click next button bring first 4 again. want next button bring next 4 , not first 4 limit [offset], [row_count] so, limit 0,4 on first page, limit 4,4 on sec page, limit 8,4 on next, etc. for more info, see: http://dev.mysql.com/doc/refman/5.0/en/select.html dev.mysql.com resource on syntax , general how-to. php mysql html sql

java - Making a VU meter from an audio buffer -

java - Making a VU meter from an audio buffer - so working on application deals audio, , have buffer containing of info sent sound card. wondering if has suggestions best way plot vu meter? if makes difference, using java. of examples have seen have been physical vu meters. edit: need figure out how volume of sound buffer @ given point. regards, jack hunt what reply calculate leaky integral of absolute values of buffer. 50% value "off" digital sound needs reproduce both postive , negative sound pressures. see wikipedia article on digital sound if don't this. real vu meaters leaky integrator of amplitude of signal. ( simple buffer , capacitor can suffice if galvanometer or electonic vu meter chip has sufficently high input resistance) so 16 bit samples code might like.... (off top of head) //set long total=0; const long half = 32768; //2^(n-1) const long decayinmilliseconds=30; // 30ms needle fall zero. // leak rate plenty reported signal deca...

c# - Fetch the template of a DependyObject received in an Attached Property's callback -

c# - Fetch the template of a DependyObject received in an Attached Property's callback - i'm developing application in wpf (.net 4). i have attached property created in order determine if command in "valid" state. /// <summary> /// initializes static members of <see cref="validationproperty"/> class. /// </summary> static validationproperty() { // register attached dependency property. isvalidproperty = dependencyproperty.registerattached("isvalid", typeof(bool), typeof(validationproperty), new frameworkpropertymetadata(true, validationvaluechanged)); } (...) /// <summary> /// gets or sets dependency property used determine if element valid. /// </summary> public static dependencyproperty isvalidproperty { get; set; } (...

android - getSharedPreferences not returning a value -

android - getSharedPreferences not returning a value - i've placed preferences file 'xml/sleeppreferences.xml' tabspec, thought that preferences part of app , there other preference files other parts. this seems work ok. create preference change, close emulator, re-run app, go preference page, , preference had set to. but when click tab, want utilize value of preference, goes wrong. i've looked high , low, cannot find answer. this excerpt of code: public static final string pref_file_name = "sleeppreferences"; : : : sharedpreferences prefs = getsharedpreferences(pref_file_name, mode_private); string test=prefs.getstring("edittextpref", "unset"); with "unset" beingness default response if doesn't find anything. it returns "unset" as say, i've looked over, , code i'm using seems right code. what's going on? thanks dave try using getsharedpreferences of context ...

SQL Server - BulkInsert from positional .txt using .xml fileformat error -

SQL Server - BulkInsert from positional .txt using .xml fileformat error - good afternoon all, have scenario: using sql server 'bulkinsert' command insert info in table positional (.txt) file. use, define construction of file, .xml file defines position (and lenght) of fields , names. these 2 sample rows of .txt positional file: aaa111111surname 1 name 1 bbb222222surname 23 name 99 my .xml format file defined below: <?xml version="1.0"?> <bcpformat xmlns="http://schemas.microsoft.com/sqlserver/2004/bulkload/format" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance"> <record> <field id="1" xsi:type="charfixed" length="3" /> <field id="2" xsi:type="charfixed" length="6" /> <field id="3" xsi:type="charfixed" length="20" /> <field id="4" xs...

c# - Access to the registry key is denied (ABCPdf) -

c# - Access to the registry key is denied (ABCPdf) - i trying out abcpdf 8.1 , when using addimageurl(...) method next error: access registry key 'hkey_current_user\software\microsoft\internet explorer\main\featurecontrol' denied. i have looked in registry , main\featurecontrol not exist current_user cannot alter permissions on it. has experienced before, or know of solutions try? thanks in advance perhaps it's problem between ie9 , abcpdf.if error comes using addhtml() or addimagehtml() , suggest alter rendering engine mshtml gecko. thedoc.htmloptions.engine = enginetype.gecko; http://www.websupergoo.com/support.htm in case, solution solved error. c# abcpdf

asp.net - using a custom button with PayPal -

asp.net - using a custom button with PayPal - i've got asp.net mvc 3 website , wish incorporate simple paypal button 1 product, wish utilize custom designed button. i couldn't find reference using paypal custom button - references help :) thanks! this custom button working sample code, 1 product. add together paypal total post paypal cart , need form way send informations 1 product. <form target="paypal" action="https://www.paypal.com/cgi-bin/webscr" method="post" > <input type="image" src="/img/custombuttonimage.jpg" border="0" name="submit" alt="buy it" /> <img alt="" border="0" src="https://www.paypal.com/en_us/i/scr/pixel.gif" width="1" height="1" /> <input type="hidden" name="add" value="1" /> <input type="hidden" name="cmd" value=...

if statement - Java - Turning the for-loop counter back based on a conditional -

if statement - Java - Turning the for-loop counter back based on a conditional - the next part of code college assignment. else if (!codelist.contains(usercode)) { i--; // counter for-loop } else if (userquantity[i]==0) { i--; } the first part makes sure if user enters wrong code, counter not increment 1, or rather, subtracts 1 incremented counter. part works fine. the sec part seem having problems with. userquantity[] int array , has array. not seem code. if 0 entered quantity, still incrememnts counter not desireable. i should explain, avoid confusion, infinite for-loop (with break statement). reason doing for-loop because required to. because of for-loop status isn't working or doing wrong it? this college assignment appreciate answers explanation , not quick-fixes. if need me explain, allow me know please. although it's not strictly illegal in java, it's not thought alt...

sql - MySQL sum negative and sum of positive values without sub query -

sql - MySQL sum negative and sum of positive values without sub query - i have 2 tables follows: tbl_answers : id, (fk)authorid ... tbl_answer_votes : id, (fk)voterid, (fk)answerid, vote (sint, ever -1 or 1) tbl_answers has 1 many relationship tbl_answer_votes , vote can either negative 1 or positive 1. i need bring together tbl_answer_votes on tbl_answers produce sum of negative votes reply , sum of positive votes reply 2 separate columns. i can sub-querying little part of larger query , after reading pitfalls on sub-queries seek , produce 2 negative , positive sums votes table efficiently possible. you can utilize case , join accomplish this: select a.id, sum(case v.vote when 1 1 else 0 end) upvotes, sum(case v.vote when -1 1 else 0 end) downvotes tbl_answers inner bring together tbl_answer_votes v on v.id = a.id grouping a.id this returns id tbl_answers , 2 columns total votes of either value tbl_answer_votes . didn...

c# - Novacode Docx Create Image from Bitmap -

c# - Novacode Docx Create Image from Bitmap - background my project urgent , requires iterate big xml file , homecoming base64 encoded images. each image must inserted ms word doc, , using docx library that. i converting base64 strings bitmap no problem. problem for life of me, can't seem bitmaps novacode.image object can inserted document. note: know how convert system.drawing.image format. novacode.image format (docx) giving me grief. if seek convert la (novacode.image)somebitmap; can not cast look of type image bitmap . if seek initialize new novacode.image object can not access internal constructor image here . using c#, .net 4, forms app, lots of coffee. question only novacode.image objects can inserted ms word doc via library, how heck bitmap in there?? i bleary-eyed @ point perhaps missing simple. you have utilize docx.addimage() method create novacode.image object. follow these 5 steps add together image word document: save ...

Array Index Out of Bounds Exception - Android -

Array Index Out of Bounds Exception - Android - i'm getting array out of bounds error. i'm setting array values in try/catch block i'm not sure why i'm getting array out of bounds error. private static string profilename; private string identity = null; private string address = null; private boolean valid = false; private int profileid; public string fullname=""; private linkedhashmap<string, string> namevalues = new linkedhashmap<string, string>(0); public profile(){ seek { string[] subnames = fullname.split("@"); this.profilename = subnames[0]; this.identity = subnames[1]; this.address = subnames[2]; this.valid = true; } grab (exception ex) { log.w(log_tag, "invalid profile, " + ex); this.valid = false; } } putting value code: public string getattributevalue(string key){ homecoming namevalues.get(key); } public void addattribute(str...

Is BlackBerry 9500 the only model with a clickable touchscreen? (and other questions) -

Is BlackBerry 9500 the only model with a clickable touchscreen? (and other questions) - as far remember, 9500 simulator processes left mouse clicks clicks on clickable touchscreen (the feature of 9500) , right mouse clicks touches on touchscreen. have questions. is blackberry 9500 model clickable touchscreen? if 9550 model not have clickable touchscreen , 9550 simulator still processes left , right clicks differently, - error of simulator? the 9800 simulator processes left , right clicks same way - normal? yes, 9500 has clickable screen. later touchscreen devices not clickable. blackberry blackberry-simulator touchscreen blackberry-storm

jquery - Storing JSON response in a mobile app -

jquery - Storing JSON response in a mobile app - i want maintain amount of http requests of mobile app lowest possible 1 request , store json locally in global variable. after this, have 3 ways display retrived data, query global variable using jlinq. run smoothly on desktop, takes more on smartphone, had cut down it's usage, , store result of query in global variable. @ end, have 3 global variable 3 ways can show json. don't solution since i'm afraid can heavy on low memory devices, thinking store results html5 web storage: think session/local storage better/faster solution or think global variable best way? what exactlyt trying store? hard tell method's preferably without digging deeper you're trying do. in short, storing info in localstorage 1 way locally store info onto user's browser. however, if storing in global variables doing job, see no reason not so. if wan't utilize localstorage , don't need info remain after user has c...

windows - Local System account event log permissions -

windows - Local System account event log permissions - does know of way can check permissions local scheme business relationship has application event log? there no customsd @ hkey_local_machine\system\currentcontrolset\services\eventlog\application wondering how check permissions has default? help much appreciated! i using windows server 2008. if run next command: wevtutil gl application security level on event log described using sddl in channelaccess section of output. windows windows-server-2008 event-log

.net - Take a screenshot with program minimized -

.net - Take a screenshot with program minimized - i wrote code programme making take screenshot when programme minimized. thing wrong code , not sure is. whenever take screenshot programme taking image application , not minimized. so need minimize application take screenshot , reopen programme after taken screenshot. sorry noob question brand new vb , been coding in less day. dim screenimage new bitmap(my.computer.screen.bounds.width, my.computer.screen.bounds.height) dim g system.drawing.graphics = system.drawing.graphics.fromimage(screenimage) g.copyfromscreen(new point(0, 0), new point(0, 0), new size(my.computer.screen.bounds.width, my.computer.screen.bounds.height)) me.hide() screenimage.save("c:\screenimage.jpg", system.drawing.imaging.imageformat.jpeg) dim tspan timespan = timespan.fromseconds(system.datetime.now.second) dim tspan2 timespan = timespan.fromseconds(system.datetime.now.second) while math.abs(tspan.subtrac...

objective c - iOS Pong Development, Collision Detection -

objective c - iOS Pong Development, Collision Detection - i in late phase of finishing first usable ios app. creating simple pong game using simple collision detection using cgrectintersectsrect , came problem. if(cgrectintersectsrect(mic.frame,plosina_a.frame)) { if(mic.center.y < (plosina_a.center.y + plosina_a.frame.size.height)) { rychlostmice.y = -rychlostmice.y; } } if(cgrectintersectsrect(mic.frame,plosina_b.frame)) { if(mic.center.y < (plosina_b.center.y + plosina_b.frame.size.height)) { rychlostmice.y = -rychlostmice.y; } } when utilize ball (mic) sort of gets paddles (plosina) , starts moving other way sort of in middle of paddle. programming teacher managed prepare problem 1 of paddles (the _b one) adding .frame.size.height instead of .frame have used before, when did same thing other paddle didn't work don't know what's that. also creates problem there situation ball get...

winapi - Can the handle be same on two windows? -

winapi - Can the handle be same on two windows? - suppose if window handle 123456 closed , window opened. can windows assign handle 123456 new window in rarest possibility? there's no guarantee anywhere windows won't re-use handle. in practice, extant implementations take steps seek avoid re-using handles. windows winapi process handle

matlab - Search for Optimal Point search algorithms -

matlab - Search for Optimal Point search algorithms - i have objective function b(s,r,l), calculated results s=1,...,10, r=1,...,10 , l=0.1:0.1:10. each s, generated 10 sizeof(l) matrices. want write search code code such homecoming me minimum b values. in more clear form minimize b(s1,r1,l1)+b(s2,r2,l2)+b(s3,r3,l3) s.t s1+s2+s3 = 10 r1 +r2 +r3 = 15 l1+l2+l3 = 30 s1,s2,s3,r1,r2,r3,l1,l2,l3 >=0 s , r integer. what best search algorithm above problem? i suggest create l3,r3,s3 dependent on selection of variables. example, if l1 = 1 , l2 = 2 implies l3 = 30 - 1 - 2. have 6 parameters left search for. should utilize kind of non-linear optimization method, fminsearh. define functional function of these 6 parameters. if function smooth, integer solution should near real solution. in order treat non-zero condition, can give huge error input gives negative output. so, functional should like: function d = f(l1,l2,s1,s2,r1,r2) l3 = 30 - l1 - l2; r3...

c++ - How to expect a static_assert failure and deal with it using Boost.Test framework? -

c++ - How to expect a static_assert failure and deal with it using Boost.Test framework? - if have method accepting template parameter should convertible to, base_of, or same type type returned, how should do? for instance, consider method: template <class t> class ifoo { public: template <class servicet> t* as() { static_assert(std::is_same< t, servicet >::value || std::is_convertible< t, servicet >::value || std::is_base_of< servicet, t >::value, "ifoo< t >::as< servicet >() requires servicet base of operations of t"); ... } }; now, boost_check it! class {}; class b {}; boost_auto_test_case(registering_incompatible_types_should_raise_a_static_assert_failure) { boost_check_static_assert_failure(ifoo< a* >().as< b* >()); } i want boost_check compile fine , pass well. but, want user code fail compiling ...

jQuery - Post Form Loaded from another page using AJAX -

jQuery - Post Form Loaded from another page using AJAX - i trying utilize jquery submit form without reloading page. although works jquery form plugin on standalone page need work on page i've loaded ajax. <script type="text/javascript"> $('#loadform').click(function() { $('#formdiv1').load('formgen.asp'); }); </script> when click submit on loaded form however, form submits , refreshes page instead of submitting ajax. <script type="text/javascript"> // wait dom loaded $(document).ready(function() { // bind 'myform' , provide simple callback function $('#myform').ajaxform(function() { alert("thank comment!"); }); }); </script> if set code in page phone call , utilize standalone works perfect. doesn't work when attempting load form page. you need utilize on() method bind things beingness loaded ajax - http://api.jqu...

asp.net mvc - Why do you need a route defined for Html.Action? -

asp.net mvc - Why do you need a route defined for Html.Action? - i have created otherwise empty asp.net mvc 3 application 2 controllers, homecontroller , othercontroller . homecontroller.cs looks this: public class homecontroller : controller { public actionresult index() { homecoming view(); } } index.cshtml looks this: @html.action("index", "other") and, of course, othercontroller.cs: public class othercontroller : controller { [childactiononly] public actionresult index() { homecoming content("ok!"); } } so far, good. run app, , tells me ok! now, take default registerroutes global.asax.cs: public static void registerroutes(routecollection routes) { routes.ignoreroute("{resource}.axd/{*pathinfo}"); routes.maproute( "default", // route name "{controller}/{action}/{id}", // url parameters n...