gusano79 247 Posting Shark

I'm trying to create a struct for an 8 bit signed integer,
I need information on how to build structs so that they can be assigned values such as:

private Int8 Input8Bit = 0;

Using a struct like:

public struct Int8
{

}

But I don't even know where to begin. As I stated, any help is appreciated.

If you just need a signed 8-bit data type, try sbyte.

gusano79 247 Posting Shark

I am making an application like an antivirus, My question is that
I am able to detect the infected hash value, can I delete or remove this infected hash value from this file?

Either you're confused or I am. Would you please elaborate on how you're deriving this "infected hash value"?

gusano79 247 Posting Shark

Well, in the end it all boils down to pixels on a screen of course.
But with the advent of truetype fonts, the discrete handling(with integers) was not sufficient, hence the use of float.
You could perhaps read this article.

It's not just for vector fonts; GDI+ as represented by the Graphics class does a lot more than twiddle pixels. It's also meant for printing and displaying to a variety of devices. To support drawing to a wider range of devices, GDI+ uses a few different but related coordinate spaces that allow you to easily rotate, scale, and translate your graphics in two dimensions.

OpenGL uses floating point coordinates for similar reasons.

gusano79 247 Posting Shark
gusano79 247 Posting Shark

Here's a quick reference on getting OpenGL to do 2D cleanly.

gusano79 247 Posting Shark

Anyone know of a way to obtain an MD5 checksum of a file (through HTTP) before downloading it through HTTP?

Only one way that I'm aware of: Request the file using a HEAD request instead of GET --the server should only return the HTTP headers for the file. One of the possible headers is Content-MD5 , which is a base64-encoded MD5 hash of the content. I say "possible" because it's entirely up to the server which headers it returns. If a server provides it, great; if not, you're out of luck.

pseudorandom21 commented: tyvm +9
gusano79 247 Posting Shark

The problem file, grade.h.gch , is a GCC precompiled header. Did this file come with the example code? If it did, try deleting it and compiling again.

gusano79 247 Posting Shark

I've just tried that, and I have tried a variation of that in previous attempts; it just seems to keep the munchies constantly re-spawning at the top of the screen as if they're constantly colliding with one another... =S

Can you post the new code?

gusano79 247 Posting Shark

I have an array of enemies (munchies) and trying to stop them spawning on top of each other is proving difficult (They re-spawn in a random x and y coordinate):

for (int i = 0; i < noOfMunchies; i++)
                    if (CollisionCheck(munchiePos[i].X, munchiePos[i].Y, munchieSize, munchieSize, munchiePos[i].X, munchiePos[i].Y, munchieSize, munchieSize))
                    {
                        // change the position of the munchie that collided
                        munchiePos[i].X = Math.Max(0, rand.Next(gameWidth) - munchieSize);
                        munchiePos[i].Y = Math.Max(-500, rand.Next(gameHeight) - gameHeight);
                    }
                }

I understand the problem, it's just checking a collision with the munchie at position i, with the same munchie at position i... but I don't understand how to fix it :/
Thank you to anyone who can help, i'm truly stuck T_T

If you want to check for collisions between munchies, one way to do it is to use two loops, along these lines:

for(int i = 0; i < noOfMunchies - 1; i++)
{
    for(int j = i; j < noOfMunchies; j++)
    {
        // Check for collision between munchies i and j here.
    }
}

This is a very simple, inefficient technique, but it serves to illustrate a point: One loop isn't enough to detect all of the collisions.

If you use this method or something like it, beware of modifying positions during the loop. The safe way to do it would be to only modify the munchie at position j , and in such a way that it can't collide with any of the munchies at positions 0..j-1 .

You also might look …

gusano79 247 Posting Shark

thanks for your help charlybones

im having a problem with the part before now

string stem = null;
            String EmQuery = "SELECT [Email] FROM Accounts WHERE Email = " + tbemail.Text + ""; // adds query to "EmQuery"
            OleDbCommand command = new OleDbCommand(EmQuery, AccConn);
            OleDbDataAdapter AdAcc = new OleDbDataAdapter(EmQuery, AccConn); // runs the query
            if (AdAcc == null)
            {
                i = false;
            }
            else
            {
// run rest of code

if i is false a dialog message shows up saying "email not registered"

You don't seem to understand how data adapters work.

Consider this line:

OleDbDataAdapter AdAcc = new OleDbDataAdapter(EmQuery, AccConn); // runs the query

This doesn't run the query. All it does is construct the OleDbDataAdapter object, which in this case initializes the SelectCommand property of the adapter for later use by its Fill method.

Constructors don't return null, either, so the code for if (AdAcc == null) should never actually happen.

Another issue:

DataTable dtacc = AccDS.Tables["Password"]; // puts found password in data table
String PW = dtacc.ToString(); // converts data table to string for validation

This doesn't actually get the password; read the documentation for DataTable.ToString to see what actually happens.

Take some time to read the MSDN section on DataAdapters and DataReaders.

gusano79 247 Posting Shark

To paraphrase, you want your INPUTNXT loop to only consider the last two characters entered, right?

You already have the information you need to find where those two characters start within NUMFLD : The user entered ACTLEN out of MAXLEN possible characters, so there are ( MAXLEN - ACTLEN ) extra characters at the start that you don't care about. Rather than start converting characters at NUMFLD , use that value as your starting offset.

gusano79 247 Posting Shark

The magic word I don't see anyone using here is "logarithm."

From the Wikipedia article, a little below where I linked it:

log10(x) is related to the number of decimal digits of a positive integer x: the number of digits is the smallest integer strictly bigger than log10(x).

Once you know the number of digits, you can start at the largest one and work your way down.

gusano79 247 Posting Shark

Hi guys
i'm trying to just do a simple email/password validation on two text boxes.
This code runs but when i type in a correct email address it throws an error "Object reference not set to an instance of an object." on AdAcc.InsertCommand.Connection = OleAcc;

This is happening because AdAcc.InsertCommand is null. You need to create a new OleDbCommand and assign it to AdAcc.InsertCommand. The linked MSDN page has an example.

gusano79 247 Posting Shark

i have made a program with this algorithm but its not working properly my code is given below can you help me to remove the errors

There's only one compiler error: You can't call getch with any parameters, like you are when you say getch(f) . The only call you can make is getch() . But the real error is that you can't use getch to read from files. You probably want fgetc instead.

Other problems that you should correct: void main() isn't proper C; it should be int main() --with a matching return at the end, of course. if(f != 'NULL') is wrong. NULL isn't a character constant, it's a symbol defined in stddef.h . You meant if(f != NULL) . while(ch = fgetc(f) != EOF) is potentially confusing. You might want to write while((ch = fgetc(f)) != EOF) , which makes it clear that you're comparing the result of the assignment with EOF , instead of assigning a truth value.

gusano79 247 Posting Shark

Hello everyone,

I'm a java programmer writing a half graphical half text rpg. For the moment I read my data from text files, e.g.
Enemies.txt

id
name
hp

and so forth. However, I want to make it a little more clear to handle, as in a database format. I can work with MySQL, but I want all the data to be on the end-user's computer, so without having to connect to the server database.

The only other thing I can think of is Excel, but I'm wondering if there aren't any other alternatives. If you know how real games used to do it, it would be really helpful.

I'd avoid Excel; that's a nightmare waiting to happen.

A proper database might be overkill, though, especially if your data are simple. Does "clear to handle" mean you want it to be human-readable and editable, or are you referring to making it easier for your code to load stuff in? Or is it a balance of the two?

As a step up from plain text, XML might be a good choice for you. It's structured and well-supported by standard libraries, so it helps the machines, but it's also still text, so it's still easy enough to edit by hand.

JSON is another option for text-based structured data.

If you really want a local-only database, I recommend SQLite. It's been widely adopted for use by Web applications and in embedded …

gusano79 247 Posting Shark

A bit of clarification: In a single-threaded application, the main thread handles updating the forms and other user interface elements. If you simply put a long-running task in a button's click handler, the main thread stays busy there, and doesn't get a chance to update the UI until it's done. This is why you can't do anything on the form once it starts. When you call DoEvents on the main thread, it processes any pending messages to the application, so the UI remains responsive. The trick is you have to call it repeatedly while your task is running.

So. You could sprinkle your "start" task with calls to DoEvents, have the "abort" handler set some Boolean variable when clicked, and have your "start" task check this variable periodically and stop when it's set.

If you search the Internet, you'll find a variety of opinions about DoEvents. Here's mine: It's fine for simple tasks you want to happen in the main thread, and lets you avoid the complexity of multithreading. As your tasks get longer and more involved, though, it can get ugly.

I don't use DoEvents, and I don't recommend it to anyone, either. Instead, consider the BackgroundWorker class. All you have to do is add an event handler to do your work, and this class takes care of the multithreading for you. To abort, you would use the CancelAsync method; your "do work" event handler has to check the

nick.crane commented: Exactly what I do. +10
gusano79 247 Posting Shark

The errors that I am still getting are the invalid id message is printing for every invalid data even if the id is correct. The grades are not printing out correctly either, every grade is a F. Also the grade counters are not working at all either they are giving random numbers like 0 41976350 -44000068032767. I was wondering what needs to be done to correct these things, I have done everything that I can think of/know how to do.

Sounds like you've made some changes; we'll need to see them to help with what's left... please post the updated files. Maybe as attachments this time; it's easier for us than copying/pasting everything.

gusano79 247 Posting Shark

My program is compiling fine but my issue is with the output. The grades are not correct and the counters are not working either.

You'll get more help if you tell us what grades you expect to see, not just that they're "not correct." What output are you expecting? But first, what input are you feeding your program? It's looking for " in.data " but you haven't included that here.

The code is not "compiling fine," at least using GCC. I see three warnings in my compiler output; they all indicate areas in your code that need some attention. Always, always pay attention to your compiler warnings; they usually point at something weird going on.

In extStud.cxx, extStudType::findGrade :

grade == 'A';

I'm sure you meant grade = 'A'; there.

In stud.cxx : Both findMax and findMin don't always return a value. Look at your if / else statements; do you see why?

Also, in findMax :

if((exam1 || exam2 || exam3) > max)

This is not how to use an if statement to test multiple conditions. Try this:

if((exam1 > max) || (exam2 > max) || (exam3 > max))

Same goes for findMin .

gusano79 247 Posting Shark

Hm. You might be accidentally indexing outside of the bounds of one of your arrays. It sounds odd that it would just stop working... is this a release build? I'd expect to see some sort of exception message. Are you running it from within an IDE?

gusano79 247 Posting Shark

I am passing to the function a list, such as '(1 2 3), and I need the function to return seperate lists, such as '(1)'(1 2)'(1 2 3).

It's not entirely clear what you want. Are you trying to return all possible sublists, so that (sublists '(1 2 3)) returns ((1) (2) (3) (1 2) (1 3) (2 3) (1 2 3)) ?

gusano79 247 Posting Shark

In my opinion, it doesn't matter which language you choose. The challenges and problems you will face are going to be independent of the implementation language. The major difference between languages as they relate to graphing functions will be in how you draw the graph and show it to the user. Java and VB.NET are different, but for your purposes, they're roughly equivalent.

If you're looking for a Java/VB.NET comparison, I'm sure a quick Internet search will turn up a wide variety of opinions.

gusano79 247 Posting Shark

What are the specs on your development machine? Usually this will happen if you have a simple main game loop that doesn't check the time--it will just run as fast as possible with whatever machine it's on. If this is what's happening, then you should probably try to separate your game logic from the frame rate.

gusano79 247 Posting Shark

Is there any way to "clear" work space in Lua similar to the clear command in Matlab ?

There's not a built-in function to do that. Offhand, I think the simplest thing to do would be to run through the global environment, setting everything to nil . You'd have to be careful not to nuke any standard libraries you still want to have available, though--library functions are stored in global tables.

gusano79 247 Posting Shark

Hi,

I would like to know the significance of lua methods beginning with an underscore.. for example __init().. Thanks !!

The only place I'm aware of that double underscores mean anything to Lua is in metatables.

Basically they allow you to create custom behavior for certain object; it's an operator overloading feature.

For example, you create a struct or class in your C/C++ code, add it to a Lua state as a userdata object, add a Lua function to the object's metatable with the key "__add", and then that function will be called when your objects are added in Lua with the + operator. The section of the Lua Reference Manual I linked explains in more detail.

gusano79 247 Posting Shark

segmentation fault...:(
some one help me pls..

Always, always check your compiler output. Does your compiler report any warnings? Mine does: "warning: 'temp' may be used uninitialized in this function" at line 28.

Your code declares temp as a char * , and then tries to strcpy into it without allocating any memory. This is why you get the segfault.

Depending on what how you intended the code to work, there are two possible solutions:

  1. Allocate some reasonably-sized memory for temp so you can strcpy into it.
  2. Don't use strcpy , just swap the pointers.

All else being equal, I'd recommend option (2).

gusano79 247 Posting Shark

Also: String.Split is convenient if you're allowed to use it.

gusano79 247 Posting Shark

I was watching a tutorial that says that we first need to check if any direction key was pressed, and only then we check which key was pressed, like this:

But then i tried to do it wihouth checking if any key was pressed and just jump to the specific key that was pressed:

And the thing is that for some reason when i use the tutorial method it works just fine, but when i use my method the surface moves when i press the button and when i let go of it. Why do we even need to check if any key was pressed?

if ( event.type == SDL_KEYDOWN ) //checking if any key was pressed

The comment "checking if any key was pressed" is misleading. Really it's checking if the specific key event we're responding to is a "key down" event. Without this line, your code executes on all key events, including "key up"--this is why it behaves the way you describe.

gusano79 247 Posting Shark

But what I want to know is what is << doing exactly, I read something about moving the binary number

<< is a left shift. From the linked article: "Shifting left by n bits on a signed or unsigned binary number has the effect of multiplying it by 2^n."

but since 1 is 1 in binary wouldn't this make it 1? And then the other 1 would not be 1 000 000? Why is that that it becomes 64?

In your example, the value of bits[i] is always 0 or 1, and i is the position of each bit, so shifting bits[i] left by i will get you the numeric value that bit represents in a byte.

Break it down:

The statement bits[] = {1, 0, 0, 0, 0, 0, 1, 0} is the same as

bits[0] = 1;
bits[1] = 0;
bits[2] = 0;
bits[3] = 0;
bits[4] = 0;
bits[5] = 0;
bits[6] = 1;
bits[7] = 0;

And the loop with character += bits[i] << i; is the same as

char character = 0;
character += bits[0] << 0;
character += bits[1] << 1;
character += bits[2] << 2
character += bits[3] << 3;
character += bits[4] << 4;
character += bits[5] << 5;
character += bits[6] << 6;
character += bits[7] << 7;

Substituting the values of the bits array:

char character = 0;
character += 1 << 0;
character += 0 << 1;
character += 0 …
gusano79 247 Posting Shark

1 For a console app, does .NET need to be installed on a PC to run the app executable?

Yes, it still runs on the CLR and uses the .NET Framework Class Library.

2 What is the line code to launch an external program? I already have the drive and path variables set, but I don't remember how to have the app launch another program.

The Process class launches other programs. For a simple setup, Process.Start should work fine.

If the answer to #1 above is yes, is there a CS2CPP conversion I can do? I'm using VS2010.

There are various converters out there; I'm sure Google can find more than enough. Your mileage may vary, though, depending on which C# features and .NET Framework classes you're using that don't have a simple, native C++ equivalent.

My own experience with code converters is that they are all a bit shy of the glory--there's always some manual cleanup/conversion you'll have to do after the automated process is done.

gusano79 247 Posting Shark

if anyone could see anything i might have missed in the process it would be much appreciated

I copied your code in, and it builds, but I also got 37 warnings, for example, "warning: unknown conversion type character 'l' in format" Are you getting these as well?

gusano79 247 Posting Shark

When I need to serialize things to a byte array I usually write the array to a MemoryStream first then use the binary formatter to serialize it to whatever (file, another byte array whatever).

The question I had was, can I just serialize a byte array instead of converting it to a memory stream and then back again?

The binary formatter says it needs a "stream" to serialize...is there another method?

BinaryFormatter.Serialize writes to a stream, so if you want to serialize an object to a byte array, using a MemoryStream is the simplest way to go.

I'm not sure what "write the array to a MemoryStream first" is intended to accomplish; you can create an expandable MemoryStream without creating a byte array first.

gusano79 247 Posting Shark

Not only my database is on a Linux server, but also my files are.
So, is it possible to build a Windows application using C# and connect it to a server the operating system of which is Linux??

Short answer: Yes.

The OS of the database server shouldn't matter; you'll be connecting over a network anyway. Connector/Net makes it relatively painless to connect to a MySQL database from a C#/.NET application.

Files may be a little trickier; see this post on SO for some ideas.

gusano79 247 Posting Shark

The readme on the fnv hash page lists an example usage:

//For example to perform a 64 bit FNV-1 hash:

	#include "fnv.h"

	Fnv64_t hash_val;
	hash_val = fnv_64_str("a string", FNV1_64_INIT);
	hash_val = fnv_64_str("more string", hash_val);

// Produces the same final hash value as:

	hash_val = fnv_64_str("a stringmore string", FNV1_64_INIT);

...

I have not encountered anything that explains why you would send the previous hash value to calculate the next.

I'm not familiar with the specifics of the FNV hash, but looking at the code you quoted, here's what I think is going on:

In your example code, the fnv_64_str function takes two parameters; first, the string to hash, and second, an initialization value. This appears to be representative of the internal state of the FNV hash function, which also the result that is returned from the hash.

The first call to fnv_64_str starts with an internal hash value of FNV1_64_INIT , which you can consider a sort of "null hash"--I would expect this value to be returned if you tried to hash the empty string ( "" ). Then for each character in the string to be hashed, it updates the internal hash value, until it reaches the end of the string, then it returns the internal hash value.

So the two-line example is just a way to show you can "interrupt" the hash and finish it later. This might be useful, for example, if you're hashing some sort of input stream as it comes across a network connection, …

gusano79 247 Posting Shark

if I have a new linked list element I would like to hash into my array, my hash array size must be 2^(Bit size of hash)?

Conceptually, yes... your hash table should be able to accommodate every possible hash value.

In practice, though, you wouldn't normally allocate the entire hash table at once. This can work for short hash functions, but (for example) a 32-bit hash table storing 32-bit pointers would need (2^32)*4 bytes = 16 GB of storage. Hash tables are typically implemented using some kind of dynamic array.

--smg

gusano79 247 Posting Shark

I would take that to mean that the hash function has two operating modes, one that produces a 32-bit hash, and another that produces a 64-bit hash. The FNV hash you linked actually has six different hash lengths.

Better terminology might be that you have a family of hash functions that represent the same basic hashing technique, and the individual hash functions are variations that produce different hash sizes.

gusano79 247 Posting Shark

Code::Blocks isn't working. I recently reinstalled to get a newer version and when I hit build I get the following error:

mingw32-g++.exe -Wall  -g    -I"C:\Program Files\CodeBlocks\MinGW\include"  -c D:\Programming\C++\TESTINGOPENGL\main.cpp -o obj\Debug\main.o
Execution of 'mingw32-g++.exe -Wall  -g    -I"C:\Program Files\CodeBlocks\MinGW\include"  -c D:\Programming\C++\TESTINGOPENGL\main.cpp -o obj\Debug\main.o' in 'D:\Programming\C++\TESTINGOPENGL' failed.

Please help!

Details? Which version of C::B were you on, which version did you switch to? Is this all of the output you got, or were there other messages?

gusano79 247 Posting Shark

What have you come up with so far?

gusano79 247 Posting Shark

The type 'T' must be a non-nullable value type in order to use it as parameter 'T' in the generic type or method 'System.Nullable<T>'

Key phrase: "non-nullable value type"

So T can't be a reference type (i.e., a class), and it can't be a nullable value type (e.g., int? ).

You have to limit T to be a structure:

private SqlParameter op<T>(T? t, string name)
    where T : struct
{
    // do stuff
}
gusano79 247 Posting Shark

I need to find the length of a long variable (how many numbers it holds). So if the variable holds: '1234567890' then I want to return an int value
of '10'.

One way to do this is with Math.Log10. There's a trick to getting the right answer, though... look at the example output on the linked page for clues.

gusano79 247 Posting Shark

is this valid? or is there a better (preferrably faster, more elegant) way of doing this?

Does it work the way you expect it to? That's the first test. =)

Here's a few things to improve:

1. The loop to add the GUID data shouldn't be inside the loop that adds the rest of the data. You'll end up with the GUID repeatedly copied into NewCommandData , which isn't what you want. It should be separate:

int TotalBytes = dataLength - 4 + 16;
int i = 0;

byte[] NewCommandData = new byte[TotalBytes];

//add the Guid byte array
while (i < 16)
{
    NewCommandData[i] = sockId.ToByteArray()[i];
    i++;
}
    
while (i <= TotalBytes)
{

    //add the commandData byte array
    NewCommandData[i] = commandData[i - 12];
    i++;
}

2. You're calling sockId.ToByteArray() multiple times inside a loop, but sockId doesn't ever change, so it's more efficient to do this conversion once, outside of the loop:

int TotalBytes = dataLength - 4 + 16;
int i = 0;

byte[] NewCommandData = new byte[TotalBytes];
byte[] sockIdBytes = sockId.ToByteArray();

//add the Guid byte array
while (i < 16)
{
    NewCommandData[i] = sockIdBytes[i];
    i++;
}
    
while (i <= TotalBytes)
{
    //add the commandData byte array
    NewCommandData[i] = commandData[i - 12];
    i++;
}

3. You don't need to copy each byte by hand; that's what Array.Copy is for:

int TotalBytes = dataLength - 4 + 16;

byte[] NewCommandData = new byte[TotalBytes];
byte[] sockIdBytes = sockId.ToByteArray();

//add the Guid byte array
Array.Copy(sockIdBytes, …
gusano79 247 Posting Shark
_ip.IPport = array[0];
_ip.Gate = array[1];

This looks backward; the port should come after the colon, not before.

internal class MyIP
{
    public string IPport { get; set; }
    public string Gate { get; set; }
}

Storing the endpoint information in strings is fine if all you want to do is display the values, but if you want to actually create a connection, you'll still have to create an IPEndPoint anyway. Also, there's no validation here, so something like "XXX#$%^&:snarkus" would get passed along as a valid IP address/port pair, which it isn't.

Picking at names... "IPport" can just be "Port" since you already have "IP" in the class name; no need to be redundant. "Gate" doesn't make any sense here, it should be "Address"; this is more or less universal terminology.

gusano79 247 Posting Shark

i see that the IP is stored in 'endpoints' does all the IP list is stored here is it stored 1 by 1 ..

If I understand you correctly, yes, every single IP endpoint in the file will be added to the list.

i need to load a new IP and port to vars on a button click,,
can you help me to make this a function and use it on a button or a instance to update the varable with latest ip and port ?

I'm not sure what exactly you want to do here... just take the last (latest?) line of the file and assign it somewhere? The last entry is in endpoints[endpoints.Length - 1] . As far as doing something from a button, if you make endpoints a member of the form, you can access it directly from the handler for your button's click event.

gusano79 247 Posting Shark

You can read a file with code that looks like this:

String infile1 = @"c:\ipAddresses.txt";
                StringBuilder currentWords = new StringBuilder();

                StreamReader sr = new StreamReader(infile1);

                try //read the file into lines of data
                {
                    do
                    {
                        currentWords.AppendLine(sr.ReadLine());
                    } while (sr.Peek() != -1);
                }
                catch
                {
                    MessageBox.Show("File [" + infile1 + "] is empty");
                }
                sr.Close(); //close the file
                String final = currentWords.ToString()

infile1 is the directory of your text file. StringBuilder is a special class designed for doing a lot of string concatenations. If you were to concatenate just a normal string many times, it would be very slow.
Once you have your final string, you can use the Split method to split the string into two strings around the colon.

I don't think StringBuilder is appropriate here, as we need to treat each line as a separate IP endpoint... all this does is cram the contents of the file into a string without separating them. A List<string> would be much more useful. But you're going to want to build IPEndpoints anyway, so why not convert inline? Also, StreamReader.ReadLine will actually tell you when the file's done; no need to peek.

Improved code:

List<IPEndPoint> endpoints = new List<IPEndPoint>();
StreamReader reader = new StreamReader("filename.txt");

string line;
while((line = reader.ReadLine()) != null)
{
    string[] parts = line.Split(':');
    
    if(parts.Length == 2)
    {
        // We have two parts, which are hopefully an IP
        // address and a port number. Let's see...
        
        IPAddress address;
        int …
gusano79 247 Posting Shark

what i want to do is to read a text file like this :

91.210.46.1:8080

and i want to separate the port and the IP ...
example :

IP IS : 91.210.46.1
PORT IS : 8080

i need to store the 2 values to variables when i call a function or something similar to it...

In general, you can do this kind of thing using regular expressions with grouping constructs.

This is a simple case, though, and you don't have to bust out a regex. Here's an example of how you might parse each line.

gusano79 247 Posting Shark

True. I guess I was asking what the popular convention is?

There are a variety of conventions, none of which is overwhelmingly popular over all the others... since we're talking about C#, you could use Microsoft's official guidelines. Wikipedia has a more general discussion of various styles.

With respect to the inconsistency you mention, the Microsoft standard says:

The two abbreviations that can be used in identifiers are ID and OK. In Pascal-cased identifiers they should appear as Id, and Ok. If used as the first word in a camel-cased identifier, they should appear as id and ok, respectively.

By their own standard, PlatformID is incorrect, but I prefer it over PlatformId because the latter always reminds me of the id monster.

gusano79 247 Posting Shark

if(textBox.Text != String.Empty)
{
//not empty (not null, even empty and null are not the same things)
}
else
{
//empty!

See also: String.IsNullOrEmpty or String.IsNullOrWhiteSpace; depending on what your needs are.

if(String.IsNullOrWhiteSpace(textBox1.Text))
{
    ...
}
gusano79 247 Posting Shark

There are a couple of different ways to do what you're asking. Are you familiar with XPath?

gusano79 247 Posting Shark

Another useful method that only requires one line is Directory.GetFiles:

string[] matchingFiles = Directory.GetFiles("F:\\", "student_*.xml", SearchOption.AllDirectories);
var RootDir = new System.IO.DirectoryInfo("F:\\")

Just be aware that you need to specify a doube backslash in order to be interpreted a s a single one.

I recommend using @-style string literal for the search path in this case, as it results in code that in my opinion is a little clearer and easier to read:

string[] matchingFiles = Directory.GetFiles(@"F:\", "student_*.xml", SearchOption.AllDirectories);
ChrisHunter commented: Straight to the point and a great help +1
gusano79 247 Posting Shark

Hmm.

In my experience, the practical fact is that you don't really need much mathematical ability at all to understand programming. You can even become quite competent and (dare I say?) successful with no more math education than basic high school algebra.

That said, here's another practical fact: Any and all mathematics you learn can be used when you're programming, and the more you know, the better you're going to be at writing software. This is especially true of game programming. Half of the benefit is just knowing the subject matter. The other half is the type of problem-solving thought processes that more advanced math requires.

My advice: You don't need much math to be good at programming, but truly great software engineers are also math nerds. You can learn to be a math nerd--push yourself to take as many math courses as you can, but stop before you get burned out. Even if the material doesn't seem directly relevant, you'll be training your brain.

A short list of recommended courses/topics for any aspiring software engineer: Symbolic logic, discrete mathematics, linear algebra, probability and statistics, number theory, cryptography.

More advanced topics, if you're up for it: Multivariable calculus, differential equations, complex variables, optimization, abstract algebra, abstract geometry, game theory, stochastic modeling.

gusano79 247 Posting Shark

What is Stroupstrup trying to get at with this exercise?

The point is that you have to be careful. If you keep allocating and never free anything, you will run out of memory.

What will happen if I run a program with an infinite loop? I am very reluctant to run such a program because I am fearful of doing something I can't undo.

That depends on the program. If you don't do anything in the loop, you won't run out of memory--it will just run forever. Normally you won't write infinite loops; there should always be something that will break out of the loop. The loop/allocate exercise is just a quick way to demonstrate what happens if you don't free memory you've allocated.

How does a programmer estimate the amount of memory that a program might need in order to avoid this situation? For example, the number of int variables times 4 bytes per int?

The exercise is looking specifically at dynamic memory allocation, probably using malloc . IMO, this is mostly taken care of by careful program design, because memory management in C++ is tricky.