while-loop

How does this while loop exit?

一笑奈何 提交于 2019-12-08 04:26:35
问题 So, how does this code exit the while statement when the thread is started? (Please do not consider indentation) class ThreadUrl(threading.Thread): """Threaded Url Grab""" def __init__(self, queue, out_queue): threading.Thread.__init__(self) self.queue = queue self.out_queue = out_queue def run(self): while True: #grabs host from queue host = self.queue.get() #grabs urls of hosts and then grabs chunk of webpage url = urllib2.urlopen(host) chunk = url.read() #place chunk into out queue self

Firebase Storage download multiple photos Urls

五迷三道 提交于 2019-12-08 04:18:06
问题 I have a Firebase storage which contains photos. I'm organizing the photos by name 1,2,3 and so on.... I'm trying to get all the photos dowload URLs , so in the future i will enter them into Arraylist of URLS and present them in a photo gallery using Glide ( that's why i'm only looking for the URLS ) I'm looking for a method that will keep giving me the Urls only if the onSucsess is called, when onFailure is called (becuase there are no more photos) i want the loop to end. I'm was trying

How to make my own while Loop just like Wordpress Loop?

时光怂恿深爱的人放手 提交于 2019-12-08 03:26:21
问题 im new here and new in PHP too.. Just wondering how to make my own flexible loop just like in Wordpress... Note im not talking about wordpress.. I want to implement it on myown PHP application... let's look back in WP, there is a code something like this: while (have_post() : thepost())// .. bla bla... echo the_title(); echo the_content(); endwhile; // this is just an ilustration Could you figure out how have_post() or the_post() interact with database, so that they can be loop.. thanks.. 回答1

How to do a “while”-like loop in XSLT?

橙三吉。 提交于 2019-12-07 22:51:37
问题 I'm a novice in XSLT and I'm struggling a lot with this issue: I need to do a while-like loop in XSLT. I don't think the for-each will be enough to solve this problem. I have a variable that is the result of a SELECT statement. It can return 0 or an integer. If the value is 0, it needs to do the SELECT again sending another parameter to see if the value is different. I can only think in using a while-like loop, but maybe it has another way of achieving this? Like using a template and calling

The code is supposed to transform every letter of every word to uppercase. But running the code results in a bus error. What causes the bus error?

做~自己de王妃 提交于 2019-12-07 21:10:41
问题 The code is supposed to transform every letter of every word to uppercase. But running the code results in a bus error. What causes the bus error? #include <stdio.h> char *ft_strupcase(char *str) { int index; index = 0; while (str[index] != '\0') { if (str[index] >= 97 && str[index] <= 122) str[index] = 65 + str[index] - 97; index++; } return (str); } int main() { char *name = "sEbas"; printf("%s\n", ft_strupcase(name)); return (0); } Input: sEbas Output: SEBAS 回答1: The string "sEbas" is a

SQL query not displaying the first result?

╄→гoц情女王★ 提交于 2019-12-07 19:51:31
问题 I am trying to dynamically create a navigation menu in my php page. I have a query to create a list of the active pages but for some reason the first result never shows $menu = mysql_query("SELECT link FROM myTable WHERE active_page='y' ORDER BY menu_order"); $menulist = mysql_fetch_array($menu); while($menulist = mysql_fetch_array($menu)) { $themenu = $themenu . "<li><a href='#'>" . $menulist['link'] . "</a></li>"; } $echo $themenu; returns item 2 item 3 item 4 ... Any ideas why this might

Why is this code an infinite loop?

两盒软妹~` 提交于 2019-12-07 17:59:29
Before completing this code, I just tested it by mistake and realized that it will not stop: $var = "any"; for ($i=1; $i < 2; $i++){ $var.$i = "any"; } Why does this produce an infinite loop? And why doesn't PHP produce an error? I did a simple test : echo $i; $var.$i = "any"; var_dump($var); Result : 1string(3) "any" anzstring(3) "any" So $i get transformed to "anz" and doesn't pass the validation to get out of the loop. $var.$i = "any"; is not really correct, i don't know what you are trying to do, but if you want to fill and array you should do something more like : $var = array(); for ($i

Delphi - How to make timer in milliseconds or nanoseconds with start/stop functions?

北战南征 提交于 2019-12-07 17:26:44
问题 I am looking for a timer in milliseconds or nanoseconds in Delphi7. I have to check the speeds of three ISAM files with sequential search. The first ind file contains 50 strings like "record_0" to "record_50". The second - "record_0" to "record_500" and the third - "record_0" to "record_5000". I've implemented everything but I don't know how to make the timer. I am comparing a string with the last item in each ISAM file. Here is my code for the first ind file: procedure TForm1.Button1Click

While loop help

不羁的心 提交于 2019-12-07 15:28:41
问题 Hey guys... its the newbie again :) I'm putting together a program that will calculate the area of either a triangle or a square and then prompt the user whether they wish to calculate another. I've got the code working to the point that it will calculate the area of either shape, but then doesn't continue with the rest of the code. For example is square is selected, the area is calculated and then goes back to the prompt for the square's side. I'm assuming that it's again the while looping

UPDATE Stored Procedure not Updating

喜你入骨 提交于 2019-12-07 15:20:27
I've got a SQL Server stored procedure that references a table in my database where users can manually update values for a rent field ( 'Rent1' ). The procedure compares this rent value to a rent field in a different table ( 'Rent2' ). If Rent1 is different from Rent2 the value for Rent2 Is updated to the value of Rent1 ... or at least that's what is supposed to happen. When I execute this stored procedure, it runs fine and I receive these output messages: (1 row(s) affected) (1 row(s) affected) Which is the result i'd expect, because as a means of testing, I have changed two values to be