I'm relatively new to programming and I have to write a function that reads in input from the user and to fill two arrays then compare them. I guess what I'm confused on is how to read in both arrays.
This is what I'm supposed to do,
Write a table_diff fuction that compares two arrays of integers and returns the subscript of the first ...
I am extremely new at php and I was wondering if someone could help me use either a for or while loop to create an array 10 elements in length
...
When looking at C# code, I often see patterns like this:
DataType[] items = GetSomeItems();
OtherDataType[] itemProps = new OtherDataType[items.Length];
int i = 0;
foreach (DataType item in items)
{
// Do some stuff with item, then finally
itemProps[i] = item.Prop;
i++;
}
The for-loop iterates over the objects in items, b...
As being quite a newbie in linux, I have the follwing question.
I have list of files (this time resulting from svn status) and i want to create a script to loop them all and replace tabs with 4 spaces.
So I want from
....
D HTML/templates/t_bla.tpl
M HTML/templates/t_list_markt.tpl
M HTML/templates/t_vip.tpl
M HTML...
So I have a loop that's supposed to do three things, go through a text file line by line, the text file contains pathnames and filenames(C:\Folder\file1.txt)
If the line contains a certain string, it then copies a file to that location, renames it to what it is named in the text file, and then replaces a string within the copied file(sti...
Sorry for the newb question. I'm still learning programming. So I'm using C++, and I need to do something like this:
int n;
do {
n = get_data();
if(n != -1)
send(n);
} while(n != -1);
This is just a sketch. Anyway it doesn't feel real elegant. I have to have my test twice. I could just test once and set a flag, bu...
I'm trying to insert multiple rows, one after another, to a database. Here is the relevant code.
Private ConnectionString As String = "Provider=OraOLEDB.Oracle;Data Source=(DESCRIPTION=(CID=GTU_APP)(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=xxx)(PORT=xxx)))(CONNECT_DATA=(SID=xxx)(SERVER=DEDICATED)));User Id=xxx;Password=xxx;"
Private SQ...
I have two SQL scripts which get called within a loop that accept a number parameter. Here is what I'm currently using:
for /l %%i in (1, 1, 51) do (
sqlplus u/p@name @script.sql a%%i.html %%i
sqlplus u/p@name @script.sql b%%i.html %%i
)
Everything works fine, but it seems like a waste of time and resources to connect twice fo...
Hi, is it possible to create my own custom keys in the asp.net web.config file and iterate through them with C#? How do you do both (where do I put the key? what format?)? I have an application for an intranet that does certain things based upon the IP address of the client. Instead of hard coding those in the codebehind file, I thou...
Hi all,
As I continue my quest of learning functional programming, I've come
to wonder if there may be alternatives to my default "procedural" way
of thinking. To be more specific, I'm looking at a function I
wrote. Here is what it does:
Swap two elements of an unordered list of numbers, such that one of the elements
is now in the r...
I'm trying to update a hashtable in a loop but getting an error: System.InvalidOperationException: Collection was modified; enumeration operation may not execute.
private Hashtable htSettings_m = new Hashtable();
htSettings_m.Add("SizeWidth", "728");
htSettings_m.Add("SizeHeight", "450");
string sKey = "";
string sValue = "";
foreach (D...
I'm working with a bit of html and Javascript code that I've taken over from someone else. The page reloads a table of data (via an asynchronous request) every ten seconds, and then re-builds the table using some DOM code. The code in question looks something like this:
var blah = xmlres.getElementsByTagName('blah');
for(var i = 0; i < ...
I'm building a website in ASP.Net, using MVC, and need to list a set of results. Both of the following work as I want them to but I'm wondering which is faster, cleaner and/or better - or if another option entirely would be more appropriate?
Note: ViewData.Model is of type IEnumerable<Thing> and I need to display more attributes than Na...
Hi,
I'm trying to create a Python script that opens several databases and compares their contents. In the process of creating that script, I've run into a problem in creating a list whose contents are objects that I've created.
I've simplified the program to its bare bones for this posting. First I create a new class, create a new ins...
I have a procedure that is run for a lot of items, skipping over certain items who don't meet a criterion. However, I then go back and run it for some of the individuals who were missed in the first pass. I currently do this by manually re-running the procedure for each individual person, but would ideally like a solution a little more...
I often want to trigger a certain function just once, but I need to trigger it from within another function that gets repeatedly called. For instance, taking a snapshot of something for later use. I usually do it by setting a global boolean.
I'm wondering whether the way I do it is actually best way?
I seem to recall reading that glob...
I was reading the great article about binding and unbinding events (because I am a js beginner using jQuery) on Karl Swedberg's blog, and I became totally puzzled at this part of the code (simplified for brevity):
function addItemUnbind() {
$Add a button but it won't have it's event added;
addItemUnbind();
});
Why is...
I have a question similar to the one here: http://stackoverflow.com/questions/341723/event-handlers-inside-a-javascript-loop-need-a-closure#341759 but I'm using jQuery and the solution given seems to fire the event when it's bound rather than on click.
Here's my code:
for(var i in DisplayGlobals.Indicators)
{
var div = d.createElem...
I want to skip to the first line that contains "include".
<> until /include/;
Why does this not work?
...
Hi Guys,
I have an animation and I want it to play it just only once. From where can I set so when I export to SWF the default will be AUTO LOOPING disabled.
Thanks
...