Hello everyone,
First of all, before I begin, I am using VC++ 2008 professional, running an Intel core2 on windows OS. I also know that this code will NEVER be executed on anything other than a core2/corei7 running Windows.
I have a while loop with 2 conditions that looks something like this:
note: this is a much simplified version.
...
I am new to Perl. Know a little bit of C though. I came across this snippet in one of our classroom notes :
$STUFF="c:/scripts/stuff.txt";
open STUFF or die "Cannot open $STUFF for read :$!";
print "Line $. is : $_" while (<STUFF>);
Why is the while after the print statement? What does it do?
...
I'm a total newb to LINQ.
Here is the code I have so far:
public class Folder
{
public Folder(string path)
{
string[] files = Directory.GetFiles(path);
IList<FileInfo> fis = new List<FileInfo>();
files.SomeMethod(x => fis.Add(new FileInfo(x)));
}
}
What is the correct method name to replace SomeMet...
I would like to write a windows batch file for the purpose of renaming a file every 25 seconds. I would also like the batch file to terminate after 300 seconds have passed. How would I go about doing this? Here is what I have thusfar.
START
RENAME test.g test.go
SLEEP 25
RENAME test.go test.g
GOTO START
...
Hi.
I'm trying to implement my own List system in Java.
the List class file :
package RoutingDemo.List;
/**
* A 2-way Linked-List to store generic elements.
*
*/
public class List {
/*
Instance Variables
---------------------------------------------------------------------------
*/
/**
* Reference to el...
I want to use nokogiri to loop through a html and create an object corresponding to every row. I am able to define the root xpaths where I want the data to fill the object varibles comes from but I dont know how to group these as an object.
My code is below. I know it doesn't work but I dont know what direction to go to make it work.
...
I want to "functionalize" more of my jQuery code, instead of writing little standalone snippets. Here's an example. Let's say I have some li's that I'd like to use as triggers, like so:
<li class="alpha-init" id="a-init">A</li>
<li class="alpha-init" id="b-init">B</li>
<li class="alpha-init" id="c-init">C</li>
And some stuff I'd like ...
Hi! I have a loop in MySQL stored procedure where i insert record almost for each iteration. Well known problem is that inserting row-by-row is inefficient and i'd rather see inserts with multiple value lists instead.
Pseudo-example of current procedure:
CREATE PROCEDURE p_foo_bar()
BEGIN
DECLARE foo VARCHAR(255);
DECLARE my_cursor...
The only thing I can find when dealing with master/detail and LINQ is through databinding. However, I am using LINQ to query my data and will need to manually loop through results without the need for databinding. My final intent is to loop through a master result set, get a grouped list of children, and output the master/detail data as ...
Hi, I am trying to create a macro that has a loop which copies a function down column 1 (VOL) and another function down column 2 (CAPACITY) for each Station. This is what I have so far:
Sub TieOut()
Dim i As Integer
Dim j As Integer
For i = 1 To 3
For j = 1 To 3
Worksheets("TieOut").Cells(i, j).Value = ...
because obj, the playingCard object is created inside a nested for loop does that mean after the second for loop completes, obj gets deallocated from the stack each time?
and a small side question,
does a compiler use the stack (similar to recursion) to keep track of loops and nested loops?
for(int c = 0;c<nElems;c++) {
for(int...
I ALMOST got my code working but there are still two things wrong with it (two major things anyway).
1) The absolute cell ref. is not working as it does in Excel. I want for example $A5 but instead of changing to A6 A7 etc., it stays A5 throughout the loop.
2) There is a third column that I need to skip over. I only need my loop to wri...
In this code sample, is there any way to continue on the outer loop from the catch block?
while
{
// outer loop
while
{
// inner loop
try
{
throw;
}
catch
{
// how do I continue on the outer loop from here?
continue;
}
}
}
...
Is there a difference in the runtime of the following two snippets?
SNIPPET 1:
for ( Object obj : collection ) {
step1( obj );
step2( obj );
step3( obj );
}
SNIPPET 2:
for ( Object obj : collection ) {
step1( obj );
}
for ( Object obj : collection ) {
step2( obj );
}
for ( Object obj : collection ) {
step3...
Why is the ( i < UniqueWords.Count ) expression valid in the for loop, but returns "CS0019 Operator '<' cannot be applied to operands of type 'int' and 'method group'" error when placed in my if? They are both string arrays, previously declared.
for (int i = 0;i<UniqueWords.Count;i++){
Occurrences[i] = Words.Where(x => x.Equals(Uni...
Thanks to everyone in advance.
I'd like to access the nth byte of a binary scalar. For example you could get all the file data in one scalar variable...
Imagine that the binary data is collected into scalar...
open(SOURCE, "<", "wl.jpg");
my $thisByteData = undef;
while(<SOURCE>){$thisByteData .= $_;}
close SOURCE;
$thisByteData...
I have the following code in my layout file:
<% @families = ProductFamily.find(:all, :include => :products) %>
<% @families.each do |f| %>
<h2><%=h f.name %></h2>
<ul>
<% f.products.each do |product| %>
<li><%=h product.name %></li>
<% end %>
</ul>
<% end %>
Two things: I doubt this follows standard MVC pr...
My first question on SO, thanks. :)
I'm developing a support issue logging system for my company and it must allow for files to be uploaded aswell as any problems submitted to our database.
There could be from 0-6 different uploads to check, along with a support issue. I've managed to get an accurate variable of how many files there is ...
Hi,
Suppose we want to loop through all the items in a dropdown list and no item is added or removed while we are looping. The code for it is as follows:
for (int i = 0; i < ddl.Items.Count; i++)
{
if (ddl.Items[i].Text == text)
{
found = true;
break;
}
}
If it is changed to this:
for (int i = 0, c = ddl....
I know of the find_in_batches method for ActiveRecord, but this doesn't allow me to set my :order or :limit.
I am trying to loop through my data, and for every 6 items I want to wrap them in a <div>.
I was trying to whole...
<%
i = 0
@media.each do |media|
%>
<% if i%6 %><div class="section"><% end %>
[...]
<% if i%6 %></div><% en...