do

Should I change my utilities.pl to a utilities.pm module?

In our product we have a big utilities file that we require (with do) at the beginning of a lot of our files. Is there a reason not to turn this into a module? For example, instead of doing this: do '../dbi_utilities.pl'; our ($db,$user,$pw,$attr); my $Data = DBI->connect($db,$user,$pw,$attr) or die "Could not connect to database: $DB...

Lisp DO variable syntax reasoning

In Peter Seibel's Practical Common Lisp, he gives this example: (do ((nums nil) (i 1 (1+ i))) ((> i 10) (nreverse nums)) (push i nums)) I can see how it works, using nums inside the loop but not giving it a step-form. Why would you put nums in the variable-definition rather than do this: (let (nums) (do ((i 1 (+ i 1))) ...

What are your tips for keeping track and avoiding bugs in loops ?

I just found ... AGAIN ... a real time wastage bug as follows for (int i = 0; i < length; i++) { //...Lots of code for (int j = 0; i < length; j++) { //...Lots of code } } Did you notice straight ahead the inner i which SHOULD BE j ? Neither did I. So from now on I am going to use: for (int i = 0; i < length; i...

Real Time File sharing - Windows Mobile

Hi, Is there any technology, library or component that provide real time file sharing on mobile platforms like Symbian , and windows mobile?? RealRime File Sharing means, the ability to share for example word file on windows mobile (Group of users), and the ability to edit the file in real time by any one of the usrs , while the other...

Replay tic tac toe game

So I am trying to program a way to replay a tic tac toe game after someone wins, loses, or ties. So basically my attempt to get replay to work, doesnt work. If player 1 won and I type 1 to replay, it would ask player 2 for their input A basic outline of my code looks like this: do { set entire 2d array to '*' do { ...

Is it possible to have a while loop in c++ that makes the check in the middle of the loop instead of the beginning or end?

I want to have a while loop do something like the following, but is this possible in c++? If so, how does the syntax go? do { //some code while( expression to be evaluated ); // some more code } I would want the loop to be exited as soon as the while statement decides the expression is no longer true( i.e. if expression i...

Why am I unable to load a Perl library when using the `do` function?

I'm new to Perl, and I'm updating an old Perl website. Every .pl file seems to have this line at the top: do "func.inc"; So I figured I could use this file to tag on a subroutine for global use. func.inc #!/usr/bin/perl sub foobar { return "Hello world"; } index.pl #!/usr/bin/perl do "func.inc"; print "Content-type: text/html...

Ruby Print Inject Do Syntax

Why is it that the following code runs fine p (1..1000).inject(0) { |sum, i| sum + i } But, the following code gives an error p (1..1000).inject(0) do |sum, i| sum + i end warning: do not use Fixnums as Symbols in `inject': 0 is not a symbol (ArgumentError) Should they not be equivalent? ...

Java do while, while

Hello, what behaviour can I expect when I run this code: do while(testA) { // do stuff } while(testB); Will it behave like: do { while(testA) { // do stuff } } while(testB); Or: if(testA) { do { // do stuff } while(testA && testB); } Or something totally unexpected? I ask this question...

do while loop in C#

Hi I am new to programming in C# can some one give me an example of how to write do while loop in C# EDIT: FYI I am a VB.NET programming trying to make the move to C#, so I do have experience with .NET / VB syntax. Thanks again! ...

what does "do" do here? (java)

I saw this bit of code on the interents somewhere. I'm wondering what the do is for. public class LoopControl { public static void main(String[] args) { int count = 0; do { if (count % 2 == 0) { for (int j = 0; j < count; j++) { System.out.print(j+1); ...

Objective C "do - while" question

The example for one of the exercises in the book I am reading shows the following code: #import <Foundation/Foundation.h> int main (int argc, const char * argv[]) { NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; int input, reverse, numberOfDigits; reverse = 0; numberOfDigits = 0; NSLog (@"Please inp...

VB.NET 2008 Application crashing during Do Loop

I am writing an application to compare each item on listbox1 to all items on listbox2. If the item is found, then remove it from both lists. The goal is to only have the items that were not found remain on both lists. The problem is, the application just hangs and I never get any results. I looked at my code several times and I cannot f...

Rotating do while PHP

Hello all! Well I have unusual question I think. I am making a web site and the products must be shown as a line I will past a link for better understanding. http://partyclub.mdkbg.com/products_carbonated_mix.html Clicking the bottle in the right will change the products to the next. But if you keep clicking will see that when the end...

parallel computing of a function with doSMP on Windows

I'm trying to multicore a function (in Windows), which, at one point, calls another workhorse function (function within function). Here is a minimal working example. You will need doSMP and revoIPC packages (to get them, see Tal's post here). func1 <- function(x) {sqrt(x)} func2 <- function(y) { func1(y) } library(doSMP) wrk <- sta...