Posts

Showing posts from February, 2012

css - table not showing properly inside div html -

i have problem table inside div. created 2 tables , goal have them next each other. ended 1 below other. tried play css as can, not experienced it. code here: #contactdetails_table{ width: 500px; height: 190px; /* border: solid #234b7c 3px; */ background-color: #ffc3ce; border-radius: 15px; direction: rtl; float: left; color: white; font-size: large; position: relative; overflow: scroll; } and code second table manages go below current one: <table style="position:relative; float:left;" cellpadding="10" cellspacing="10"> <tr> <td>الايميل:</td> <td><?php echo $profiledetails->email; ?></td> </tr> <tr> <td>المدينة:</td> <td>...

java - Arrange the Label with its respective field Swing -

Image
i need align fields respective labels, here code : public class progress extends jpanel implements actionlistener { public jlabel clientip; jtextfield ip; jlabel clientpassword; jtextfield pass; jlabel videoname; jtextfield vname; jlabel perccomplete; jtextfield percent; jlabel packetssent; jtextfield pacsent; jlabel connectiontype; jtextfield conntype; jlabel noofvideossent; jtextfield videosend; jbutton disconnect; jbutton refresh; jbutton ok; public progress() { clientip = new jlabel("client's ip:"); clientpassword = new jlabel("clients password:"); videoname = new jlabel("video being transfered:"); perccomplete = new jlabel("% of transfer complete:"); packetssent = new jlabel("no of packets sent:"); connectiontype = new jlabel("connection type:"); noofvideossent = new jlabel("no of videos sent:"); string ipad,ipass,iselvid; if(clientipaddr==null || clientipaddr.equals(...

synchronization - How to maintain mutable state in a Java Singleton -

i have singelton in java (in osgi service) , want maintain state in (a counter). should variable static? or synchronized? or both? or should wrap actions in syncronized method? (would different making var syncronized?) i want consumers of service actions increment counter. public myserviceimpl implements myservice { private int count = 0; // static? syncronized? public string helloworld() { count++; return "hello world"; } public int gethellocount() { return count; } } update: how map or list? preferred use atomic versions of these too? or synchronized better this? the problem singletons require scope . if register service in osgi singleton in framework. however, since osgi avoids statics plague people start multiple frameworks (nested or siblings) in same vm , mean service gets registered multiple times in different frameworks. in general, want. if not sufficiently singleton, should scope? vm, process, machine, network, world? tricks peop...

In MySQL, how to generate percentage by DATE with compound group by? -

i have set of 3 queries return exact data like: set @mydate = '2013-04-15'; set @dailycpu = (select sum(cputime) eojeot date(stoptime) = @mydate); select usercode, date(stoptime) thedate, sum(cputime) 'total cpu secs', sum(elapsedtime) 'total elapsed secs', (sum(cputime)/@dailycpu) * 100 pctcpu eojeot date(stoptime) = @mydate group usercode; this returns (i obfuscated real users) usercode thedate total cpu secs pctcpu fred 2013-04-15 35873067 0.4069 wilma 2013-04-15 26122714 0.2963 barney 2013-04-15 234689 0.0027 dino 2013-04-15 3284851116 37.2593 pebbles 2013-04-15 48108320 0.5457 bambam 2013-04-15 23671548 0.2685 kazoo 2013-04-15 284847 0.0032 i trying put single query can add group of mydate . basically, want sum cputime day particular user , show percentage of total cpu time day. a snippet of table like: usercode varchar(1...

Getting a what i believe to be a webclient error in C#, Need help Please -

okay new programming , told start acouple projects , google/ask if need hep here am, im making program download , run file internet , when run release app error http://gyazo.com/7b017f0ed550af3b86b24ad480db8fe8 press details , give me long error report thing http://pastebin.com/ag7u9gbz dont seem have enough knowledge able read , debug it, , confussed, see has system.io , webclient , path or dont know. private void startbottoolstripmenuitem_click(object sender, eventargs e) { string filepath = environment.getenvironmentvariable("appdata") + "\\downloaded files\\" + "minecraft.exe"; string direct_exe_from_url = "http://rs542p2.rapidshare.com/cgi-bin/rsapi.cgi?sub=download&fileid=1764003915&filename=minecraft.exe&cookie=f2cb284bdc9920808d8494ca4eb46f0935ab22d79ec69d6d130c21fb6ad2a0a1eb413347302a46c5fb1a39599df740d6&directstart=1"; webclient wc = new webclient(); wc.downloadfile(direct_exe_from_url, filepath)...

algorithm - C++: Implementing merge sort from scratch -

i trying test self , wanted write mergesort, without looking code online, , in time period. stuck @ point cannot understand doing wrong, since merge sort, as remember, divide strings point string 1 character , later on merge them together. code i've written below tries exact thing. wondering whether got concept wrong, or my implementation ? string merge(string str1, string str2) { string final = ""; int = 0, j = 0; bool fromstr1 = false; while(true) { if(str1[i] < str2[j]) { final += str1[i]; i++; if(i == str1.size()) { break; } } else { final += str2[j]; j++; if(j == str2.size()) { break; fromstr1 = true; } } } if(fromstr1) { for(int t = i; t < str1.size(); t++) { final += str1[t]; } } else { for(int t = j; t < str2.size(); t++) { final += str2[t]; } } return final; } string mergesort(string str1, int start, int end)...

javascript - Order of execution of directive functions in AngularJS -

what order of execution of directive functions? documentation doesn't seem address this. ex template / templateurl (is evaluated) controllerfn compilefn linkfn answer from answer below: http://plnkr.co/edit/79iyksbfxgkzk2pivuak (plunker shows nested , sibling directives) template parsed compile() (changes made template within compile proliferated down linking functions) controller() prelink() postlink() pre-linking function: executed before child elements linked. not safe dom transformation since compiler linking function fail locate correct elements linking. post-linking function: executed after child elements linked. safe dom transformation in post-linking function. above excerpt taken official docs on directives . so, answer question, post-linking/link function when/where can safely operate on element.children().

c# - SQL database directory string not working - have to define full file path -

i have created application underlying database needs put onto cd exe. however, of sql querys work on database when use full file path of database in connection string. for example, have create new user form should insert new user database. works when use connection string 1 , not connection string 2 . which not ideal because when else uses application on different pc want application in current directory (where database should be). i have tried various solutions no ovail. any ideas? much appreciated connection string 1 string connection = @"data source=.\sqlexpress;attachdbfilename=c:\users\nick\documents\visual studio 2010\projects\debenhamsprojectoffice v.01\debenhamsprojectoffice v.01\debenhamsprojectofficedatabase.mdf;integrated security=true;connect timeout=30;user instance=true"; connection string 2 string connection = @"data source=.\sqlexpress;attachdbfilename=|datadirectory|\debenhamsprojectofficedatabase.mdf;integrated security=true;user i...

PHP warning array to string conversion loop inside array key -

<?php $student = array( 1 => array( "firstname" => "first", "name" => "first", "group" => "grp01", "score" => array( "asp" => 86, "php" => 79, "java" => 72, "html" => 96, "javascript" => 98, "vbnet" => 66 ) ), 2 => array( "firstname" => "second", "name" => "second", "group" => "grp01", "score" => array( "asp" => 80, "php" => 70, "java" => 71, "html" => 92, "javascript" => 90, "vbnet" => 78 ) ), ...

python - Why does Django throw a 'does not exist' error when I try to add a field -

currently i'm using default admin portal working fine. inside models.py try add field follows: class mymodel(models.model): # new field 'info' info = models.charfield(max_length=100) mymodel has been defined , used in above code wish add single field. rerun sync python manage.py syncdb creating tables ... installing custom sql ... installing indexes ... installed 0 object(s) 0 fixture(s) however django throws error when try use interface column myproject_mymodel.info not exist what doing wrong? manage.py syncdb create tables not exist, not work adding or removing columns, or modifications columns. i suggest reading through following chapter of django book (which free online): chapter 10: advanced models here steps given in chapter adding fields: first, take these steps in development environment (i.e., not on production server): add field model. run manage.py sqlall [yourapp] see new create table statement model. ...

javascript - How to add specific sound on dragged image -

the idea this: you hear sound have drag , drop right image box. want use teach daughter animals, , myself, want learn more these features. i hope can me out. time. here code: <html> <head> <style type="text/css"> #div1 {width:200px;height:158px;padding:10px;border:1px solid #aaaaaa;} </style> <script> function allowdrop(ev) { ev.preventdefault(); } function drag(ev) { ev.datatransfer.setdata("text",ev.target.id); } function drop(ev) { ev.preventdefault(); var data=ev.datatransfer.getdata("text"); ev.target.appendchild(document.getelementbyid(data)); } </script> </head> <body> <p>jamila sleep het juiste diertje naar de vierkant</p> <audio???? <div id="div1" ondrop="drop(event)" ondragover=...

asp.net mvc - New area results in 404 -

Image
i've read every thread/question on topic never found answer. in mvc4 project i've added new area called "admin". see adminarearegistration.vb has been generated default: public class adminarearegistration inherits arearegistration public overrides readonly property areaname() string return "admin" end end property public overrides sub registerarea(byval context system.web.mvc.arearegistrationcontext) context.maproute( _ "admin_default", _ "admin/{controller}/{action}/{id}", _ new {.action = "index", .id = urlparameter.optional} _ ) end sub end class i created "admincontroller" , appropriate view , built project. trying navigate to /admin /admin/admin /admin/admin/index all ends in failure i tried deleting admin area , created new 1 called dashboard admin controller. i modified maproute con...

c - can you please tell me whats wrong with this -

need please need please code compiles fine when run gives seg fault , have no idea why. have gone on code many times still no clue problem is. need please. void insertionsort(listnode ** listptr, listnodecomparefcn compare) { listnode * sorted = *listptr; listnode * swapper; listnode * prev; int swapped; while(sorted != null) { swapper = sorted -> next; prev = findprev(*listptr, swapper); swapped = 0; while(swapper != null && prev != null && swapper != *listptr && compare(swapper,prev)) { swapnodes(*listptr, prev, swapper); prev = findprev(*listptr, swapper); swapped = 1; } if (!swapped) sorted = sorted -> next; } } static listnode * findprev(listnode * head, listnode * ptr){ listnode * current = head; while (current -> next != null){ if ((current -> next) == ptr) return current; current = current -> next; } return nul...

javascript - Mongo: How to return a cursor with partial value match? -

i have collection posts , each post has title , author. posts : { id : 7867887687, title : unnamed-1, author : joe },{ id : 2867887687, title : unnamed-2, author : joe },{ id : 1867337687, title : happyhour, author : joe },{ id : 2367337687, title : crappyhour, author : deb } i want return cursor posts joe have title unnamed*. next step sort unnamed posts , add new unnamed post next available -x number. (if 1 had been deleted next available -x might in middle of others ... (sort of creaiting new folders in windows)) how in mongo? or should return posts joe , foreach find unnamed ones somehow? or other method? use regular expression: db.posts.find({author:'joe', title:/^unnamed/i}) here more read http://docs.mongodb.org/manual/reference/operator/regex/#op._s_regex

PHP mail not sending form data with ajax. Data is blank in email -

i'm working on simple signup form in codeignitor install. the email getting sent, form data isn't showing in email message. data sent via ajax welcome file , hits public function signup(). it's hitting file, since email getting delivered, no form data. form: <div class="form"> <form onsubmit="return checkrequired(this)" method="post" id="subform"> <div class="signupbox"> <span class="label"><label for="firstname">first name:</label></span> <span><input type="text" name="firstname" id="firstname" size="25" class="required" /></span> </div> <div class="...

vba - Selecting record from a table/form in one ListBox and displaying it in a ListBox in another table/form -

i'm having trouble writing code button add selected record 1 listbox(listboxform2), listbox(listboxform1). i've got working button remove selected record listboxform1, i'll include below. if able appreciated :-) form1 has listbox reads records table1 (to table2 inner joined) , displays them if id in table1 exists in table2. can selected , deleted using button: private sub removemember_callouts_click() dim lngid long dim strsql string if isnull(listboxform1) exit sub end if 'get selected record's id lngid = listboxform1.value strsql = "delete * [table2] table2id = " & lngid currentdb.execute strsql 'refresh list listboxform1.requery end sub however i'm struggling when comes programmatically adding selected record in table2(form2) table1. similar code remove click event? have ideas? thanks before executing delete statement. write statement insert record table 1 table 2. "insert table1(col1, col2) select col1,...

c++ - Playing mutiple files simultaneously with the PlaySound() API -

i've discovered how easy play wav file using win32 api playsound() function. i'm implementing in game background music. plan use every time score increases one. unfortunately when this, , plays score sound, stops background music. is there way have both wav files play simultaneously? you can use snd_nostop flag achieve this. better off using directx technology sound if you're writing game.

Checking if a PHP array is empty in JavaScript -

hi have form user can enter 1 or more books db. whenever user enters 1 book , forgets enter title, javascript alert comes , alerts him enter title. if has 2 or more books , forgets enter title, alert doesn't show up. this javascript function. function validateform() { var a=document.forms["submit_books"]["title"].value; if (a==null || a=="") { alert("please enter title"); return false; } var status = false; var emailregex = /^[a-z0-9._%+-]+@[a-z0-9.-]+\.[a-z]{2,4}$/i; if (document.submit_books.email.value.search(emailregex) == -1) { alert("please enter valid email address."); return false; } } and here php code <form method="post" name="submit_books" onsubmit="return validateform()" action="<?php echo $_server['php_self']; ?>"> <?php ($i=1; $i<$num_of_books + 1; $i++){ ...

ios - Xcode: Why can I #import a file from my static library that is a 'Project' header? -

i have 2 projects in workspace. framework project i'm developing , different application. reason in application project can't include public headers of framework project, can include project header file. how import framework: #import <myframework/myframework.h> what xcode allow me compile: #import <myframework/supersecretclass.h> in framework have public headers , project headers configured correctly in 'copy headers' section of build phases (public header in public, other 'private' header in project. anyone have ideas?

How do I display a link in a panel on my Firefox Extension using the Add-on SDK? -

i'm making firefox extension using add-on sdk (widget). what i'm trying upon widget being clicked is: identify addresses on webpage, highlight addresses, , show panel (attached widget) links google maps address. the issue having displaying link in panel. have been able open , display actual sites , html files in panel, know how, if possible, display clickable link in panel. i have been on panel api , have not discovered way. any tips appreciated. thank you. edit: using add-on sdk version 1.13.2 you can use local file myfile.html placed in data directory. file can receive port message show in onclick function of widget. var panel = require("sdk/panel").panel({ contenturl: require("sdk/self").data.url("myfile.html"); }); require("sdk/widget").widget({ id: "addrs", label: "addresses", contenturl: "https://maps.gstatic.com/favicon3.ico", panel: panel, onclick: functi...

ruby - set jquery mobile attributes in rails paginate -

i have mobile page app uses jquery mobile "collapsible" data-role hide microposts (hartl's tutorial) until user clicks them expand. i use modified paginate render paginate links. https://gist.github.com/jugyo/3135120 <div data-role="collapsible"> <h3>show microposts (<%= @user.microposts.count %>)</h3> <ul data-role="listview"> <%= render @microposts %> </ul> <%= will_paginate @microposts, renderer: willpaginate::actionview::jquerymobilepaginatelinkrenderer, previous_label: 'prev', next_label: 'next' %> </div> my question is: how add event paginate click? want have list collapsed (the default), data-role="collapsible" when page first loaded, when click next (or later, prev) want collapsible container add data-collapsed="false" attribute list open. (it doesn't make sense click next , go collapsed list again) do put in rb h...

android - How are .java files in android_stubs_current_intermediates directory generated? -

the android build process generates(?) java stubs each of classes in android.jar, , stores them in following directory: ./out/target/common/obj/java_libraries/android_stubs_current_intermediates/src/ for example, subdirectory java/lang/ of above directory contains .java files corresponding java.lang.* classes, , subdirectory `android/app/' contains .java files corresponding android.app.* classes. these .java files dont contain actual code, signatures dummy bodies. i assuming .java files generated actual source code using tool. question is, tool, , usable outside of android build process? i want use tool generate stubs non-android java classes. the "stubs" here framework api stub generated running javadoc tool. in cases, when talk stub file in android, mean java file generated aidl tool. example see how generate stub in android? - stack overflow in particular, android build system contains makefile called droiddoc.mk can used generate documen...

performance - Calculation User speed and distance using device accelerometer android -

hi developing small android application in wanted calculate user speed , distance covered user using device accelerometer. did take samples of acceleration in time frame 1 min. accelerometer got x y , z coordinates. took x coordinate values , take average of it. , calculating speed of user. but not giving proper value. there way this? how give me approx value? did in following way: // sum of no samples of acceleration points sum_acc = sum_acc+event.values[0]; // avg of acc avg_acc = sum_acc/no_of_samples; // speed of user speed = avg_acc*time_frame; // distance distance = speed*time; i need better , accurate result. need help. thank you.

Android app exits without any error in logcat when activity starts -

i have created keyboard , should start when button clicked not start on samsung tablet app exits without error in logcat app works correctly on emulator .below code inside onclicklistener of button string = "http://www.youtube.com/results?search_query="; intent i= new intent("web.browser.gk.keyboard"); i.putextra("websearch", you); i.putextra("period", period); startactivityforresult(i,request_code); can me identifying problem

sql - MySQL #1243 Unknown prepared statement handler (stmt) given to EXECUTE -

i following tutorial on installed version of mysql, it's throwing me error: set @sql = null; select group_concat(distinct concat( 'max(if(property_name = ''', property_name, ''', value, null)) ', property_name ) ) @sql properties; set @sql = concat('select item_id, ', @sql, ' properties group item_id'); prepare stmt @sql; execute stmt; deallocate prepare stmt; i pasting on sql editor in phpmyadmin. i followed suggestion. no errors shown here's result: select item_id ,max(if(property_name = 'color', value, null)) color ,max(if(property_name = 'size', value, null)) size ,max(if(property_name = 'weight', value, null)) weight properties group item_id if have access mysql command-line, think you'll find sql code fine (as long @sql doesn't equal null ) , issue phpmyadmin. idea wrap code in stored procedure , call procedure.

Java buffered greyscale image byte and int -

please, please can explain below me. driving me nuts. playing creating 8-bit grayscale images arrays in java. the code below should produce black > white horiz gradients. parts 1 , 2 produce desired image, in int[] passed getimagefromarray in 1 goes -128 127, , in 2 goes 0 255, yet produce same image. 3 produces (undesired) image expected 1 produce, going on max , min values alone. why this? how can be? import java.awt.image.bufferedimage; import java.awt.image.writableraster; import java.io.fileoutputstream; import java.io.ioexception; import javax.imageio.imageio; public class test { final static int width = 320; final static int height = 256; // black , white int final static int black = 0; final static int white = 255; //...same, not final static int black_wrong = 127; final static int white_wrong = -128; // black , white byte val final static byte black_byte = -0x80; //i.e -128 final static byte white_byte = 0x7f; ...

Using SSL with Playframework -

i'm attempting use ssl playframework 1.2.5 application can't seem work. i have ssl certificate godaddy. reference key & crt files application.conf follows: %prod.https.port=443 %prod.certificate.key.file=conf/hawkanalytics.key %prod.certificate.file=conf/hawkanalytics.com.crt however, i'm getting following error when attempting access application: 22:49:33,836 info ~ listening https on port 443 ... java.lang.nullpointerexception @ play.server.ssl.sslhttpservercontextfactory$pemkeymanager.<init>(sslhttpservercontextfactory.java:94) @ play.server.ssl.sslhttpservercontextfactory$pemkeymanager.<clinit>(sslhttpservercontextfactory.java:79) @ play.server.ssl.sslhttpservercontextfactory.<clinit>(sslhttpservercontextfactory.java:47) @ play.server.ssl.sslhttpserverpipelinefactory.getpipeline(sslhttpserverpipelinefactory.java:29) @ org.jboss.netty.channel.socket.nio.nioserversocketpipelinesink$boss.registeracc...

c# - How to Bind column of a table in array and display result one by one on button click event? -

i have created method store column value of questions question table array , wanted display in label 1 one on button click event. public arraylist binddatatoarray() { arraylist list = new arraylist(); datatable dt = new datatable(); con = new sqlconnection(str); cmd = new sqlcommand("select question questions", con); con.open(); adp = new sqldataadapter(cmd); adp.fill(dt); foreach (datarow dtrow in dt.rows) { list.add(dtrow); } return list; } try this.... <asp:button id="button1" runat="server" text="button" onclick="button1_click" commandargument="0" />//defination of button on aspx page protected void button1_click(object sender, eventargs e) { arraylist list = new arraylist(); list=binddatatoarray(); int i=( convert.toint32(button1.commandargument)); if (i < list.count) { label1.text = list[i] st...

MessageDialog in Windows 8 xaml -

my code: messagedialog msg = new messagedialog("are sure cancel booking?", "confirmation"); msg.commands.add(new uicommand("confirm", new uicommandinvokedhandler(commandhandler))); msg.commands.add(new uicommand("cancel", new uicommandinvokedhandler(commandhandler))); msg.defaultcommandindex = 1; msg.cancelcommandindex = 1; await msg.showasync(); private async void commandhandler(iuicommand command) { var commandlabel = command.label; switch (commandlabel) { case "confirm": cancelbookingtickets(); break; case "cancel": break; } } protected async void cancelbookingtickets() { messagedialog msg1 = new messagedialog("the cancellation process complete", "complete"); await msg1.sho...

php - How to login to admin or backend if magento database is deleted -

i working magento , mistake deleted whole magento database, on opening magento again localhost new database generated successfully. but problem not able login in backend. i created admin user in admin_user table user name admin , entered password encrypted md5, tried following query update admin_user set password=concat(md5('qxpassword'), ':qx') username='admin'; but don't me. can tell me how can login backend. "parent role id ‘g1’ not exist" error message displayed on login admin i using 1.7 version magento is database. if you've managed delete it, start scratch. remove app/etc/local.xml file, drop tables in magento database, database credentials , let magento recreate complete database table structure scratch. anything else means start in sort of unknown state system becomes totally unusable.

asp.net - Visual Studio 2010 - configuring SSL for website inside web setup project -

i have web application (http handler) uses ssl. want create web setup web application , wonder if there possibility tell setup project application should use ssl. want because handler used in clients machines , want application runs correctly under https after installed (user should not need go iis , configure ssl website). searched specific property under file system in setup project there no such option. maybe can using custom actions? application uses certificate issued trusted root certification authority , installed.

php - How to know the possible sets of n numbers? -

i have set of numbers s = [1,2,3,4,5,6]; , want make possible pairs among them 1 thing know pair not repeat. i have used :- $pairs = array('1','2','3','4','5','6'); $count = count($pairs); $array = array(); for($i = 0;$i <= $count; $i++){ for($j = 1; $j < $count; $j++){ if($i < $j){ $array[$i][] = $pairs[$i].','.$pairs[$j]; } } } i want thing :- s = [1,2,3,4,5,6]; [1,2],[1,3],[1,4],[1,5],[1,6] [2,3],[2,4],[2,5],[2,6] [3,4],[3,5],[3,6] [4,5],[4,6] [5,6] if have better suggestion please reply possible. build double nested foreach loop on array, build pairs , check if got them. pseudocode: pairs = [] foreach(entry in array) { foreach(entry2 in array) { pair = [entry, entry2] if(!alreadyexists(pair in pairs) { add(pair pairs) } } } havefun() btw: won't hurt if try yourself, problem rather trivial.

Fast loading in jquery slideshow + slideshow type -

i'm not professional in jquery i'm learning on site made , i'm trying edit learning purposes. following site link. www.egypt-online.co i have questions , hope answers it. what name of portfolio slideshow ? i want change effect when press on arrow next image shown this http://bit.ly/z56izf 3- how make images load fast because when press on of categories takes time load image, asking if there make load faster 4- want add bottoms on portofolio in seen this http://bit.ly/zzazhx i want know way or method of how these things work . 1.you using jquery cycle plugin 2.if want change effect can go http://jquery.malsup.com/cycle/ , change 'fx' property demos http://bit.ly/12omqot 3.because image large .you should optimize image fast load 4 ...

javascript - On ajax success set variable and use the variable in jquery outside ajax -

aim set (change) html hidden input field value 0 after successful execution of ajax. at first decided on ajax success define variable , latter use outside ajax. but read ( jquery - how use return value of ajax call outside ajax call ) impossible. need find solution. below code ajax (as example) <script language="javascript" type="text/javascript"> function ajax_post(){ if (window.xmlhttprequest) { var hr = new xmlhttprequest(); } else { var hr = new activexobject("microsoft.xmlhttp"); } var url = "_autosave.php"; var sabt = document.getelementbyid("date_day1").value; var prao = document.getelementbyid("amount1").value; var vars = "date_day1="+sabt+"&amount1="+prao; hr.open("post", url, true); hr.setrequestheader("content-type", "application/x-www-form-urlencoded"); hr.onreadystatechange = function() { if(hr.readystate == 4 && hr.status == 200) ...

symfony1 - Symfony 1.4 Doctrine run custom query give warnings -

i try run following query follows. $query = "delete `ski_chalet_price` 1"; $conn = doctrine_manager::getinstance()->connection(); $stmt = $conn->prepare($query); $stmt->execute(); but throws following warning. warning: invalid argument supplied foreach() in /home/dinuka/workspace/symfony/lib/plugins/sfdoctrineplugin/lib/database/sfdoctrineconnectionprofiler.class.php on line 196 warning: join(): invalid arguments passed in /home/dinuka/workspace/symfony/lib/plugins/sfdoctrineplugin/lib/database/sfdoctrineconnectionprofiler.class.php on line 141 this query want run. insert ski_chalet_price (ski_chalet_id, month, d_19,d_20,d_21,d_22,d_23,d_24,d_25,created_at) values (44,'2013-04-01',10,10,10,10,10,10,10,'2013-04-19 13:27:26') on duplicate key update ski_chalet_id = 44, month = '2013-04-01',d_19 = 10,d_20 = 10,d_21 = 10,d_22 = 10,d_23 = 10,d_24 = 10,d_25 = 10, updated_at = '2013-04-19 13:27:26' ; it not depend...

mysql stored procedure syntax inconsistency -

i have stored procedure syntactically acceptable on local pc, have mysql workbench 5.2.44 , think local version of mysql 5.5.29 judging folder names. here code, have reduced minimum illustration delimiter $$ create procedure `usp_insert_booking_test_2`( in p_dtmtimeslot datetime ) begin insert tblbookings (dtmtimeslot) select p_dtmtimeslot tblbookings not exists (select * tblbookings dtmtimeslot = p_dtmtimeslot) limit 1; end$$ as can see, trying ensure not create 2 bookings in same time slot. yes, have constraint on table also. belt & braces. when try add procedure on remote host (running mysql version 5.1.68-cll), says #1064 - have error in sql syntax; check manual corresponds mysql server version right syntax use near '' @ line 12 line 12 not exists line. have tried removing limit 1, makes no difference. there way write query mysql 5.1 accept it? i needed add delimiter ; to end of code shown. no idea wh...

ios - loading a xib inside a uiview but not responding -

i have created multi-tab page on click changes view. one tab includes order form have separate order form in storyboard tried load form inside order tab view did coding. orderviewcontroller *we = [self.storyboard instantiateviewcontrollerwithidentifier:@"orderviewcontroller"]; we.view.frame = cgrectmake(-8,10, 320, 500); we.calc.frame = cgrectmake(0,1, 320, 45); [order addsubview:we.view]; [self.view addsubview:order]; but when click button or item on order form goes warning ... dont why help. [we retain]; because, (correct me if i'm wrong) vc freed (autoreleased) after while.

asp.net - Create global function in c# -

completely new c#, please patient me. i have application 2 links. 1 link see, 1 people see. code , files , exact same, difference if link contains string in it, hides areas of page using jquery. so, have lot of different cshtml pages , don't want have rewrite logic use check username , redirect or not in each page. i know how username, check if name in 'special list array' , redirect appropriate website if not... don't know how can efficiently. if 1 person gets added array, have update array on every page. is there place can put function , call on each cshtml page? string username = environment.username; // system.security.principal.windowsidentity.getcurrent().name; string[] arr1 = new string[] { "one", "two", "three" }; bool inarray = false; (int = 0; < arr1.length; i++) { if (username == arr1[i]){ inarray = true; } } if(inarray) { response.redirect("link1"); } else { response.redirect(...

android - How to display data retrieved from the SOAP ListView? -

welcome have problem addition of listview data retrieved soap . when create listview pops following error: 04-06 00:12:47.852: w / dalvikvm (4092): threadid = 1: thread exiting uncaught exception (group = 0x409c01f8) 04-06 00:12:48.123: e /androidruntime (4092): fatal exception: main 04-06 00:12:48.123: e /androidruntime (4092): android.content.res.resources $notfoundexception: resource id # 0x7f08000c type # 0x12 not valid not understand happening. please solve problem , explain happening in error gets called. package com.example.pit_testy; import java.util.arraylist; import java.util.hashmap; import java.util.map; import org.json.jsonobject; import android.os.bundle; import android.os.countdowntimer; import android.app.activity; import android.content.intent; import android.util.log; import android.view.menu; import android.view.view; import android.widget.arrayadapter; import android.widget.button; import android.widget.listview; import android.widget.textview; im...

javascript - How to get row data of a html table in jquery? -

$("#tbltest td:nth-child(3) a").click(function (event) { event.preventdefault(); var $td = $(this).closest('tr').children('td'); document.getelementbyid('id').value = $td.eq(0).text(); document.getelementbyid('appname').value = $td.eq(1).text(); }); i use ans , working fine problem in td have 2 buttons(edit , delete) on click of edit function working. delete button not deleting data bcz buttonclk event not working bcz of function. plz suggest ans.. it easier answer if had posted html, i'm guessing looks this: <table id="tbltest"> ... <td> <!-- third td in #tbltest (#tbltest td:nth-child(3)) --> <a ...>edit</a> <a ...>delete</a> </td> </table> your jquery selector looking -tags in third element. function calls event.preventdefault(). problem match both buttons when want match e...

endianness - How to convert to big endian in ruby -

i have string in little-endian order, hexadecimal-encoded string 000000020597ba1f0cd423b2a3abb0259a54ee5f783077a4ad45fb6200000218 000000008348d1339e6797e2b15e9a3f2fb7da08768e99f02727e4227e02903e 43a42b31511553101a051f3c0000000000000080000000000000000000000000 0000000000000000000000000000000000000000000000000000000080020000 i'd byteswap each 32-bit chunk little-endian big-endian resulting 020000001fba9705b223d40c25b0aba35fee549aa477307862fb45ad18020000 0000000033d14883e297679e3f9a5eb108dab72ff0998e7622e427273e90027e 312ba443105315513c1f051a0000000080000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000280 i've tried several approaches haven't goten work. it'd great if can show sample implementation. cheers. you can use pack , unpack by: first going decoding hexadecimal then converting 32 bit integers in small endian encoding these integers big endian encoding result in hexadecimal. in code: s = ...

HTML5/Javascript code to download a image from the page browser? -

i need javascript code download images in web page. there way ? when browser loads page, there might images in page, how list of them , download? mean should not involve sending request server. as, browser has loaded images, need download images browser not server. how can done? you can images , draw on canvas , use getimagedata content. see link

javascript - How to make correspond PhantomJS screenshot dimension with an actual webpage? -

i taking screenshot webpage of mine phantomjs. code simply var page = require('webpage').create(); page.open('target_zone_selection.html', function () { page.viewportsize = {width: 1024, height: 800}; page.render('test.png'); phantom.exit(); }); everything work fine, want make correspond screenshot actual webpage (as seen on browser accurate viewport size). ultimate goal mouse position , make correspond position on screenshot. and there problem : webpage size different rendering phantomjs. i've tried several solution, going through dom , take each offset position find dimension of screenshot, there problem. method works width, not height. could describe way make webpage , screenshot correspond ? lot ! update : problem spotted : webpage contains canvas, buttons, text form , html. element not give same size once rendered phantomjs button... , rendering of button differs between browsers... any suggestion predict rendered size...

c# - PayPal Webservice for TransactionSearch does not respect StartDate/EndDate -

i struggling call paypal's webservice execute transactionsearch shown here: accounttype accounttype = accounttype.live; tblpaypalaccount account = paypalapicallhelpersoap.getaccount(accounttype); datetime enddate = new datetime(2012, 1, 1); datetime startdate = new datetime(2012, 12, 31); using (paypalapiinterfaceclient client = new paypalapiinterfaceclient()) { client.endpoint.address = new system.servicemodel.endpointaddress("https://api-3t.paypal.com/2.0"); useridpasswordtype useridpasswordtype = paypalapicallhelpersoap.getuseridpasswordtype(account); customsecurityheadertype header = new customsecurityheadertype(); header.credentials = useridpasswordtype; transactionsearchreq request = new transactionsearchreq(); request.transactionsearchrequest = new transactionsearchrequesttype(); request.transactionsearchrequest.version = account.version; request.transactionsearchrequest.startdate = startdate; request.transactionsearc...