Posts

mysql - Can I use a String as a WHERE CLAUSE -

can me jsp problem. im trying update database using code similar this: so, have on servlet: string querycondition = "id = 1"; that passed stored procedure: create definer=`root`@`localhost` procedure `storedprocedure_1`(querycondition text) begin update users set name = 'john' querycondition; end i thinking if possible because update fail. if isn't possible can recommend how can such thing you can use in stored procedure prepared statement. example : delimiter // create definer=root@localhost procedure storedprocedure_1(querycondition text) begin set @query := concat( 'update users set name = \'john\' ', querycondition ); prepare stmt @query; execute stmt; drop prepare stmt; end; // delimiter ;

html - Use jQuery to check percentage width of div and perform conditional style -

i've got ten instances of .progress. of have percentage based widths. if given instance of .progress on 100% width, i'd style it's backround red , force 100% width. any help? this feeble attempt. if ($( '.progress' ).css("width") > '100%') { $(this).css('background-color', 'red'); // or $(this).addclass('red'); } i think width in % not available in js think should try check target's width parent's width: if ($('.progress').css("width") >== $('.progress').parent().css("width")) { $(this).css('background-color', 'red'); // or $(this).addclass('red'); } or way: $('.progress').each(function(){ var $target = $(this); if ($target.css("width") >== $target.parent().css("width")) { $target.css('background-color', 'red'); // or $target.addclass('re...

uitableview - iOS: How can i display the section content in Grouped Table View? -

i using following sample code have section contents in "grouped table view". showing contents in "grouped table view" fine. but, issue is, sorts section content based on alphabetical order, order of section header content not displaying expected. example: want "about" shown @ end of section in tableview, here shows first (because of alphabetical sort there). how can display section content based on below code without alphabetical sorting. please advise! - (void)viewdidload { [super viewdidload]; nsarray *arrtemp4 = [[nsarray alloc]initwithobjects:@"quick logon",@"stay logged on", nil]; nsarray *arrtemp3 = [[nsarray alloc]initwithobjects:@"notifications",@"text messaging",@"family members",@"social media",nil]; nsarray *arrtemp2 = [[nsarray alloc]initwithobjects:@"payment accounts",nil]; nsarray *arrtemp1 = [[nsarray alloc]initwitho...

jquery - AJAX Post on Field Completion? -

i have code below validates form field called lms_domain. checks whether subdomain selected user available using ajax call file executes mysqli count query. code works on submission of form execute ajax post when user types field, or has completed field. how achieve using jquery? $('#lms_name').keyup(function(){ /* code here */ $.ajax({ type: 'post', url: 'assets/lmsdomaincheck.php', data: "lmsdomain="+value+".thedomain.com", async: false, success: function(htmldata){ if (htmldata=="success") { $('#spanlmsdomain').html('good'); }else { msg+="<b>error on lms domain name : </b>"+value+".thedomain.com not available.<br/>"; $('#spanlmsdomain').html('bad'); } } }); /* code here */ }); thanks in advance tips! ...

c# - How to select from DropDownList in HttpWebRequest -

1.httpwebrequest+httpwebresponse login go page "ex.asps" 2.send httpwebrequest(with select option ddl)+httpwebrespons save info need streamreader. 1.i succeed see info work 2.i see dll(id, options,values,name) cant find out way select right option can see , save first one,nut need go trow ddl select 1 one , save data. ex: ddl 4 user , each 1 have own data (age,id...) can save 1 user need change ddl new data this code if (islogin) { httpwebresponse redirectresponse = redirecttourl("https://services.test.com/pages/trans.aspx"); stream streamresponse = redirectresponse.getresponsestream(); streamreader streamread = new streamreader(streamresponse); outstring = streamread.readtoend(); system.collections.arraylist straccountlist = getlistbyid("ctl00_placeholdermain_accountsddl_ddlaccounts"); (int intaccountcount = 0; intaccountcount < straccountlist.count; intaccountcount++) { string[] stracctli...

printing - Python stdin request coming before stdout prints -

i've been trying learn python 3.3 , run problem. here test code using: print('should print before stdin') x = raw_input('enter something: ') and here output looks like: >>something should print before stdin enter something: why print statements coming after stdin? in python 3.x, raw_input("") has been eliminated , use input() instead. refer docs . print('should print before stdin') x = input('enter something: ') output should print before stdin enter something: yes process finished exit code 0

javascript - Can't get colour of div to change using loop / switch statement combination -

i'm trying make simple memory game, shape flashes on screen x number of times , user has remember colour. i'm trying use loop combined switch statement change colour on each iteration. however, colour not change , i'm stuck. can tell me i'm doing wrong? code follows: $(document).ready(function() { var colorarray = []; // stores colours have been generated var changecolour = function(){ var generateshape = math.floor(math.random() * 5) // generates number 0-4 switch (generateshape){ case 0: $('#shapediv').css('background-color','black'); $('#shapediv').fadeout(500); colorarray.push('b'); break; case 1: $('#shapediv').css('background-color','red'); $('#shapediv').fadeout(500); colorarray.push('r'); break; case 2: ...