Search Results

Search found 12044 results on 482 pages for 'foreach loop'.

Page 43/482 | < Previous Page | 39 40 41 42 43 44 45 46 47 48 49 50  | Next Page >

  • I want to do a sql update loop statement, by using the do--while in php

    - by Jean
    Hello, I want to loop the update statement, but it only loops once. Here is the code I am using: do { mysql_select_db($database_ll, $ll); $query_query= "update table set ex='$71[1]' where field='val'"; $query = mysql_query($query_query, $ll) or die(mysql_error()); $row_domain_all = mysql_fetch_assoc($query); } while ($row_query = mysql_fetch_assoc($query)); Thanks Jean

    Read the article

  • bash shell date parsing, start with specifc date and loop through each day in month

    - by Joe Stein
    Hi, I need to create a bash shell script starting with a day and then loop through each subsequent day formatting that output as %Y_%m_d I figure i can submit a start day and then another param for the number of days. My issue/question is how to set a DATE (that is not now) and then add a day. so my input would be 2010_04_01 6 my output would be 2010_04_01 2010_04_02 2010_04_03 2010_04_04 2010_04_05 2010_04_06 Thanks

    Read the article

  • Creating a simple sencha listview using a loop

    - by chris_sencha
    How do we substitute a hardcoded data with a for loop in sencha and extjs? Say, I have below hardcoded one Ext.application({ launch: function() { Ext.create('Ext.List', { fullscreen: true, itemTpl: '{title}', data: [{ title: 'Item 1' }, { title: 'Item 2' }, { title: 'Item 3' }, { title: 'Item 4' }] }); } }); In the above one, how to replace data to something like below Ext.application({ launch: function() { Ext.create('Ext.List', { fullscreen: true, itemTpl: '{title}', data: [ for(int i=0;i<5;i++){ {title: 'Item '+i}, } ] }); } });

    Read the article

  • slowing down a loop in a recursive function

    - by eco_bach
    I have a difficult problem with a recursive function. Essentially I need to 'slow down' a for loop within a function that repeatedly calls itself(the function); Is this possible, or do I need to somehow extract the recursive nature of the function? function callRecursiveFuncAgain(ob:Object):void{ //do recursive stuff; for (var i:int = 0; i < 4; i++) { _nextObj=foo callRecursiveFuncAgain(_nextObj); } }

    Read the article

  • using generic and for each loop in jsp

    - by mawia
    I am developing a web application. I am using Eclipse as IDE. I was using generic and for each loop, both being feature of java 1.5, and it compiled quite fine when used in backend means in simple java classes. But when I'm using these on jsp, jsp is failing to compile with error showing generic and for each as culprit. Can you shed some light on this? Maybe I am at fault with Eclipse settings?

    Read the article

  • Socket Programming : Inputstream Stuck in loop - read() always return 0

    - by Atom Skaa ska Hic
    Server side code public static boolean sendFile() { int start = Integer.parseInt(startAndEnd[0]) - 1; int end = Integer.parseInt(startAndEnd[1]) - 1; int size = (end - start) + 1; try { bos = new BufferedOutputStream(initSocket.getOutputStream()); bos.write(byteArr,start,size); bos.flush(); bos.close(); initSocket.close(); System.out.println("Send file to : " + initSocket); } catch (IOException e) { System.out.println(e.getLocalizedMessage()); disconnected(); return false; } return true; } Client Side public boolean receiveFile() { int current = 0; try { int bytesRead = bis.read(byteArr,0,byteArr.length); System.out.println("Receive file from : " + client); current = bytesRead; do { bytesRead = bis.read(byteArr, current, (byteArr.length-current)); if(bytesRead >= 0) current += bytesRead; } while(bytesRead != -1); bis.close(); bos.write(byteArr, 0 , current); bos.flush(); bos.close(); } catch (IOException e) { System.out.println(e.getLocalizedMessage()); disconnected(); return false; } return true; } Client side is multithreading,server side not use multithreading. I just paste some code that made problem if you want see all code please tell me. After I debug the code, I found that if I set max thread to any and then the first thread always stuck in this loop. That bis.read(....) always return 0. Although, server had close stream and it not get out of the loop. I don't know why ... But another threads are work correctly. do { bytesRead = bis.read(byteArr, current, (byteArr.length-current)); if(bytesRead >= 0) current += bytesRead; } while(bytesRead != -1);

    Read the article

  • .bat for shutdown/reboot on xp loop problem

    - by Luca
    hello! i have a little problem... on win xp, if i write on commandline shutdown -t 00 -r -f the reboot works fine. but if i paste it, as is, in a bat file...the prompt show me an infinite loop. anyone can say me why? thanks a lot for any suggestion :)

    Read the article

  • callback for each for loop iteration

    - by SWKK
    Hi Guys, a bit of a naive question, but nonetheless. I am trying to break up a for loop in which a 2d Matrix is being read. I would like to write a callback function to consume row-wise/col-wise chunks per row/col iteration. Any hints on how to tie up the callback function with iteration?

    Read the article

  • Random number in a loop

    - by Sam
    Hi all, having an issue generating random numbers in a loop. Can get around it by using Thread.Sleep but after a more elegant solution. for ... Random r = new Random(); string += r.Next(4); Will end up with 11111... 222... etc. Suggestions?

    Read the article

  • Passing input value thru XML loop and return value

    - by Mike Dyer
    "X" is reading the form value, but it is still passing and older "var thisMarket" value. The objective is to take a zip code via HTML form: <form id="market" name="market" onSubmit="return validateZIP(this.zip.value);" method="get" action=""> <input type="text" name="zip" id="zip" value="zipcode" onfocus="if(!this._haschanged){this.value=''};this._haschanged=true;" style="float:left; width:100px; margin-top:5px;"> <input type="image" style="float:left; margin-top:5px; border: 0pt none ; width: 22px; height:17px;" src="images/nav/bottom/linkbar/btn_search_btn.gif" onClick="findLda();"> </form> The script being passed thru is: function findLda(x){ marketName = new Array(); marketURL = new Array(); zip = new Array(); zip_temp = new Array(); zipMatch = false; var shareZip = "Shared Zips"; var thisMarket = "Market value"; xmlDoc=loadXML("/_includes/market.xml"); var Offer,node; document.getElementById('market').innerHTML=''; for(var j=0; j<xmlDoc.getElementsByTagName('market').length; j++){ node = xmlDoc.getElementsByTagName('market')[j]; marketName.push(node.childNodes[3].textContent); marketURL.push(node.childNodes[5].textContent); for(var k=0; k<node.getElementsByTagName('zip').length; k++){ if(node.getElementsByTagName('zip')[k].textContent!=null){ zip_temp.push(node.getElementsByTagName('zip')[k].textContent); } } zip.push(zip_temp); zip_temp = new Array(); } //loop the zip Array to find a match for the query Zip. for(k=0; k<zip.length; k++){ for(m=0; m<zip[k].length; m++){ if(x == zip[k][m].toString()){ zipMatch=true; thisMarket=marketName[k].toString(); } } } alert(thisMarket); } The objective naturally is to take field input (A), pass it thru market.xml - initialize a loop and match a zip (B), alert the result (C). Looking for any direction with what is existing or a completely new direction. Thanks!

    Read the article

  • AddDays() not working within a while loop

    - by r0bb077
    Is there anything that stops the DateTime AddDays() method that doesn't run within a while loop. I have this simple bit of code; DateTime last_day = monthCalendar2.SelectionRange.End; DateTime first_day = new DateTime(year, month, day); //Insert dates into vector while (first_day != last_day) { dates.Add(first_day); first_day.AddDays(1); } I step through the program and first_day never changes, anyone know why?!

    Read the article

  • Replace for loop with formula

    - by hamax
    I have this loop that runs in O(end - start) and I would like to replace it with something O(1). If "width" wouldn't be decreasing, it would be pretty simple. for (int i = start; i <= end; i++, width--) if (i % 3 > 0) // 1 or 2, but not 0 z += width; start, end and width have positive values

    Read the article

  • Getting a loop when using link_to :back

    - by onildo
    I have this structure for the table course: Search page - Result Page - Edit Page - Show page When i go from result page to a specific course edit page, i edit it, and end up on the show page, but when i hit back, i get a loop from show to edit, and back to show and so on. I want the edit page to back to the result page if it came from there. im using this on both: <%= link_to "Back", :back %>

    Read the article

  • Trimming lists using a loop

    - by Vishal
    I have few lists like: a = [1, 2, 3, 4, 5] b = [4, 6, 5, 9, 2] c = [4, 7, 9, 1, 2] I want to trim all of them using a loop, instead of doing as below: a[-2:] b[-2:] c[-2:] I tried but got confused with pass by value or pass by reference fundamentals, looked into other questions as well but no help. Thanks

    Read the article

  • Whats wrong with this while loop?

    - by David
    boolean r = false ; int s = 0 ; while (r == false) ; { s = getInt() ; if (!(s>=0 && s<=2)) System.out.println ("try again not a valid response") ; else r = true ; } The text never displays itself even when a 3 or a 123 is entered and the loop never terminates. Whats wrong here?

    Read the article

  • Traditional loop versus Action delegate in C#

    - by emddudley
    After learning about the Action delegate in C# I've been looking for ways I can best use it in my code. I came up with this pattern: Action<string> DoSomething = (lSomething) => { // Do something }; DoSomething("somebody"); DoSomething("someone"); DoSomething("somewhere"); If I were to have used a traditional loop, it would look something like this: List<string> lSomeList = new List<string>(); lSomeList.Add("somebody"); lSomeList.Add("someone"); lSomeList.Add("somewhere"); foreach (string lSomething in lSomeList) { // Do something } Are there any appreciable differences between the two? To me they look equally easy to understand and maintain, but are there some other criteria I might use to distinguish when one might be preferred over the other?

    Read the article

  • Exporting info from PS script to csv

    - by George
    Hi, This is a powershell/AD/Exchange question.... I'm running a script against a number of Users to check some of their attributes however I'm having trouble getting this to output to CSV. The script runs well and does exactly what I need it to do, the output on screen is fine, I'm just having trouble getting it to directly export to csv. The input is a comma seperated txt file of usernames (eg "username1,username2,username3") I've experimented with creating custom ps objects, adding to them and then exporting those but its not working.... Any suggestions gratefully received.. Thanks George $array = Get-Content $InputPath #split the comma delimited string into an array $arrayb = $array.Split(","); foreach ($User in $arrayb) { #find group memebership Write-Host "AD group membership for $User" Get-QADMemberOf $User #Get Mailbox Info Write-Host "Mailbox info for $User" Get-Mailbox $User | select ServerName, Database, EmailAddresses, PrimarySmtpAddress, WindowsEmailAddress #get profile details Write-Host "Home drive info for $User" Get-QADUser $User| select HomeDirectory,HomeDrive #add space between users Write-Host "" Write-Host "******************************************************" } Write-Host "End Script"

    Read the article

  • Cannot loop through Excel 2003 files in SSIS 2008

    - by Techspirit
    Hi, I am trying to execute a SSIS 2008 package on a 64-bit OS and import Excel 2003 files to SQL Server 2008. I have created an OLEDB Connection to the Excel file with a Connection String that retrieves the Excel file from a variable, inside the ForEach Loop Container. The Run64BitRunTime is set to false. I am not able to edit the SQL Command on the OLEDB Source in the Data Flow task. It returns an error : Error 2 Validation error. Load List Staged Table: Load List Staged Table: SSIS Error Code DTS_E_CANNOTACQUIRECONNECTIONFROMCONNECTIONMANAGER. The AcquireConnection method call to the connection manager "List OLEDB to Excel" failed with error code 0xC0202009. There may be error messages posted before this with more information on why the AcquireConnection method call failed. 0 0 Appreciate any help.

    Read the article

  • Using multithreading for loop

    - by annelie
    Hello, I'm new to threading and want to do something similar to this question: http://stackoverflow.com/questions/100291/speed-up-loop-using-multithreading-in-c-question However, I'm not sure if that solution is the best one for me as I want them to keep running and never finish. (I'm also using .net 3.5 rather than 2.0 as for that question.) I want to do something like this: foreach (Agent agent in AgentList) { // I want to start a new thread for each of these agent.DoProcessLoop(); } --- public void DoProcessLoop() { while (true) { // do the processing // this is things like check folder for new files, update database // if new files found } } Would a ThreadPool be the best solution or is there something that suits this better? Thanks, Annelie

    Read the article

< Previous Page | 39 40 41 42 43 44 45 46 47 48 49 50  | Next Page >