Hi,
I want to pass many arguments to a shell script which I don't know how many arguments they are going to be and I want to handle them. I did the following code:
int=$1
src=$2
r=$3
string=$4
duration=$5
./start.sh $int $r $src "$string"
sleep $duration
shift; shift; shift; shift; shift
while [ $# -gt 2 ]
do
r=$1
string=$2
...
Hello.
Assume I declared an Array isFind[] like this,
bool[] isFind = new bool[5];
for (int i = 0; i < 5; ++i)
{
isFind[i] = init(); // initialize isFind[]
}
bool init();
{
...; // some code here
}
Is there any quick method (less typing code) to detect there is false element or not in isFind[]?
I don't want to for/foreach Loo...
hey I'm looking for are clean solution to this problem:
i start the loop with i = 0 in the second loop step the i = 1, then i = -1 and then i = 2 ect.
how to programm this with a for loop in a clean way?
...
Dear Python Experts,
I have written the following trial code to retreive the title of legislative acts from the European parliament.
import urllib2
from BeautifulSoup import BeautifulSoup
search_url = "http://www.europarl.europa.eu/sides/getDoc.do?type=REPORT&mode=XML&reference=A7-2010-%.4d&language=EN"
for number in xran...
So I'm setting up a system that has a lot of emails, and variable replacement within it, so I'm writing a class to manage some variable replacement for templates stored in the database.
Here's a brief example:
// template is stored in db, so that's how this would get loaded in
$template = "Hello, %customer_name%, thank you for contact...
Hi. I have this code `
require("db_connect.php");
function xx()
{
$conn = db_connect(); //here it works
(...)
date_default_timezone_set('Europe/Paris');
if(time() <= $x[0]){
(...)
}else
{
(...)
for...
So i have an array that contains 100 elements
foreach($obj as $element){
//do something
}
I want to loop through the first 50 but the problem is sometimes the $obj array maybe less then 50
...
I have a snippet of code that I though should work because of closures. However the result proves otherwise. What is going on here to not produce the expected output, one of each word.
Code:
string[] source = new string[] {"this", "that", "other"};
List<Thread> testThreads = new List<Thread>();
foreach (string text in source)
{
tes...
PROBLEM RESOLVED
My Problem: I want to count inverse in the for loop.
This is the opposite of what I want to do:
for($i=1;$i<=10;$i++){
echo $i;
}
If I put $i-- doesn't works (my server crashes).
Help meeee!
Best Regards,
Adam
...
I have a "Category" model, and a "Project" model, which contains a ForeignKey to "Category." So each Project can only belong to one Category.
I want to create a list that ends up looking like the following:
Category 1
Project 1
Project 2
Category 2
Project 3
Project 4
etc.
I think the following psuedocode will work:
<ul class="cate...
I have couple of questions about the javascript for loop.
First question:
for (i=0; i<=2; i++) {;}
console.log(i);
Output is 3. Shouldn't it be 2?
Second question:
for (var i=0; i<=2; i++) {
setTimeout(function(){console.log(i);}, i*1000);
}
Timeouts are set correctly: 0, 1000 and 2000. But the output is 3,3,3 (should be 0, ...
How can I loop right in the middle of objective c? For example in the .m file:
#import "untitled.h"
@implementation untitled
- (IBAction) runSample:(id)sender {
(this is running when the button is pressed)
}
(Something here that just constantly repeat that won't mess anything else up)
@end
Any ideas??
Elijah
...
I'm trying to modify items in a list using a for loop, but I get an error (see below). Sample code:
#!/usr/bin/env python
# *-* coding: utf8 *-*
data = []
data.append("some")
data.append("example")
data.append("data")
data.append("here")
for item in data:
data[item] = "everything"
Error:
Traceback (most recent call last):
Fil...
Hi
I am using the following code to populate an array:
$number = count ($quantitys);
$count = "0";
while ($count < $number) {
$ref[$count] = postcodeUnknown ($prefix, $postcodes[$count]);
$count = $count +1;
}
postcodeUnknown returns the first row from a mysql query, using a table prefix and an element ...
for this json api response I am able to parse with json_decode:
$string = '{"name": "Google",
"permalink": "google",
"homepage_url": "http://google.com",
"blog_url": "http://googleblog.blogspot.com",
"blog_feed_url": "http://googleblog.blogspot.com/feeds/posts/default?alt=rss",
"twitter_username": "google",
...
Any good ways to do this?
...
Hello!
In R, I would like to create a loop which takes the first 3000 columns of my data frame and writes them into one file, the next 3000 columns into another file, and so on and so forth until all columns have been divided as such. What would be the best way to do this? I understand there are the isplit and iterators functions avai...
I have a data frame in R with POSIXct variable sessionstarttime. Each row is identified by integer ID variable of a specified location . Number of rows is different for each location. I plot overall graph simply by:
myplot <- ggplot(bigMAC, aes(x = sessionstarttime)) + geom_freqpoly()
Is it possible to create a loop that will create a...
Hi-
I'm trying to figure out the best programming language for an analytical model I'm building. Primary consideration is speed at which it will run FOR loops.
Some detail:
The model needs to perform numerous (~30 per entry, over 12 cycles) operations on a set of elements from an array -- there are ~300k rows, and ~150 columns in the...
If I have the following,
<% @feed.sort_by{|t| - t.created_at.to_i}.each do |feed| %>
<% end %>
How can limit it to only show the 10 most recent results
...