Ketsuekiame 860 Master Poster Featured Poster

Hi thank you so much for these information!

I think we would be allowed to make the database do concurrency for us, how is this achieved?

Unfortunately I'm not a Database Admin, so I don't know how to configure it to do that for you. I typically rely on the ORM I use (Entity Framework or nHibernate) to sort that out for me, or roll my own using a pattern I gave above. This link looks useful though

And could we just like, create a hashmap within the server's memory that would contain a list of user's and the corresponding tables they are using during the system's run? There a lot of tables for the database as of the moment and, I am guessing that your methodology can be achieved through this with the same effect? Please correct me though if I sound wrong and obnoxious.

Sure, if you want to lock the entire table. I don't think this would be a good idea and leads to deadlock more readily. But this may be a requirement of your software. How you do it is up to you, just pick what is appropriate for your requirements.

Speaking of deadlock, this is something you need to approach very carefully and test rigorously. Although I'm sure you'll know what deadlock is, I'll explain just in case. It is when one part of a program holding a resource is waiting for another part of the program to release a different …

Ketsuekiame 860 Master Poster Featured Poster

Making the client "wait" can be achieved by including a "Thread.Sleep(milliseconds)" at your server side, after you receive the client message.

For concurrency, the first thing I can think of, is to store any database objects being used in-memory first at your server, along with the User ID that it belongs to. When you receive a command to access any data, you check your in-memory model first, if it exists, check the User ID, if that matches, carry on with whatever you're doing. Otherwise, bail out back to the client and say the record is locked.
You can also do this at the database, by updating your tables to include 2 new columns, "isLocked" and "lockedBy" which are Boolean and UserIDKey respectively. Perform the same steps as above, only do it on the database instead.

There is also a way to get the database to do this for you, but as you said you're working at low level, I don't know if this would be allowed or not.


Honestly, I don't like your login method. This seems bad design and also opens up the server to attack. So for a login, send both, encrypted and return one message that is ambiguous, "Username or Password not recognised" for example. This stops someone for checking for usernames in the database.
Unless you have a specific method that needs to wait for multiple messages, then it should already know how many it needs to wait for. …

ticktock commented: Lots of informative stuff!! +3
Ketsuekiame 860 Master Poster Featured Poster

You don't need 15 different classes.

public class Piece
{
    public Int32 Rank;
    public Point PiecePosition;
}

I don't know if you use a point, but I imagine you have an X, Y grid. So you can set the X and Y of the Point class to the correct grid position.

EDIT: What I mean by a common set of properties is, as you can see above, all the pieces have a rank and a pieceposition. It doesn't matter that some will have different numbers, because you will have more than one "instance". I think this may be where you're getting confused.

Using the class above...

static void Main()
{
    Piece[] myPieceArray = new Piece[15];
    myPieceArray[0].Rank = 1;
    myPieceArray[1].Rank = 2;
    ...
    Console.WriteLine(myPieceArray[0].Rank);
    Console.WriteLine(myPieceArray[1].Rank);
    Console.ReadLine();
}

Ok so what you can see there is that I have a single class (see top of post) but I can make 15 *instances* of that class, which I have inside an array (an array is a collection of the same object, in this example, my array contains 15 Piece objects, all of them are different)

zack_falcon commented: Despite my less than clear question, you got it spot on. +2
Ketsuekiame 860 Master Poster Featured Poster

You're returning every row in the data table. What this will do, is check one, ok that exists, update the date.

Check the next one (insert) check the next one (insert) check the next one (insert) because the members don't exists for every row, just one.

Use a "break" statement to get out of the foreach loop after you insert or update your member.

SyncMaster170 commented: likeit says under his name, practically a master poster +2
Ketsuekiame 860 Master Poster Featured Poster

Now, before you say it already exists (because it does) I found that those didn't really have the generic ability to find any control on a form, regardless of containers.

So, here you have a piece of code which will find any control on a form and will also search inside any containers those controls might have.

There are two ways of using this code. First is by Control Type and the second is by Control Name.

In each example below, I have used the variable "myForm" which can be any kind of Windows Form. However, you can perform the following on any control you wish. So it could have been performed on "myPanel" or "myGridBox" etc.

To use by Control Type simply perform the following: myForm.FindControl<Label>(); This will return an IEnumerable<Label> containing every single label on your form, regardless of any container it is placed in. You will be able to iterate back up the tree using the "Control.Parent" attribute to see which container it belongs to.

Secondly, you can search by Control Name. You may also filter the Control Type: myForm.FindControl<Control>("myLabel"); The above code will search every control on the form until it finds the control named "myLabel". "myLabel", however, is pretty obviously a Label control. So in order to speed up the comparison (not by much in 99.9% of cases, but you never know) you can do the following: myForm.FindControl<Label>("myLabel"); And there you have it. I hope you guys can find some …

ddanbe commented: Great! +14
Ketsuekiame 860 Master Poster Featured Poster

i can confidently say that SDKs didnt come up once during my degree. and neither did C#. my course covered things like PHP, .NET, javascript, CSS, flash, XML, SQL...(cut for brevity)

If you did .net but didn't cover C#, what part of .net did you cover? C# is part of the whole .net framework. SDK's and API's are fundamental to *all* development, be it Web or Desktop. Google SDK? Facebook SDK? No?

Also, how do you know that this won't turn into a web development project? I can see uses for having GPS data available from a web service (written in .net (C#)) and provided through web interface to the user (using either ASP .NET (which is predominantly C#)) in fact, this is close to a public sector project I worked on 2 years ago.

You will find the more you're in the business world, the boundary between web developer and desktop developer and services developer becomes more blurry as the internet evolves. I started as a Games Developer, this led to web development. I moved and became a micro and embedded devices developer and through this I'm now also a web services developer. The back-end is written in C#, it communicates to a WCF Service (with http endpoints) and we access it via a web user interface (using PHP with SOAP or ASP .NET with service binding).

Hence, I continue with my recommendation that you take C# a little more seriously and in fact contemplate you …

ddanbe commented: Well said! +14
Ketsuekiame 860 Master Poster Featured Poster

Just though I'd add my 2p.

You're probably best not writing the entire of your data buffer to the memory every time.

You have a value you can use numberOfBytesRead . Instead of receivedData.Write(buffer, 0, buffer.Length); I believe you ought to be using receivedData.Write(buffer, 0, numberOfBytesRead); otherwise you could be messing up your memory stream with 0 bytes at the end of the file.


Also, what it may be worth doing, is actually setting your data buffer to the correct size you're expecting first.

So change your receive method to be something more like:

Byte[] dataBuffer = new Byte[4];
Int32 totalBytes = 0;
do
{
    totalBytes += stream.Read(dataBuffer, totalBytes, 4 - totalBytes);
} while(totalBytes < 4);
Int32 dataSize = BitConverter.ToInt32(dataBuffer, 0);

Int32 bytesRead = 0;
totalBytes = 0;
dataBuffer = new Byte[dataSize];

do
{
    bytesRead = stream.Read(dataBuffer, totalBytes, dataSize - totalBytes);
} while(totalBytes < dataSize);

File.WriteAllBytes(@"C:\file.png", dataBuffer);

That should get you what you want, I haven't tested this, but I'm pretty confident :)

nick.crane commented: Good one. Much more memory efficient. +10
Ketsuekiame 860 Master Poster Featured Poster

MSVCR80D.dll is part of the Visual Studio 2005 Runtime DEBUG library. Although why you would need this if you're building in 2010/2008 I have no idea. In any case, so long as that version of visual studio is installed you should have no problem running the program.

To get around this issue, you can compile your project in Release mode or change the Runtime library from /MTd to /MT

The other option is to installed Visual Studio 2005.

Ketsuekiame 860 Master Poster Featured Poster

It was one of the links on that page that contained the actual code.

You will need the rest of the code (about the notification) so that windows and the various windows updates to recognise the new path information.

Ketsuekiame 860 Master Poster Featured Poster

Google came up with This link.

I believe it does everything you need it to =) (I suggest following its instructions by the way and doing it as a set-up process or perform some kind of detection so you don't add it repeatedly during your program execution)

pseudorandom21 commented: ty ty +8
Ketsuekiame 860 Master Poster Featured Poster

The code is actually incorrect. Although syntactically correct, your closing parenthesis is in the wrong place.

On your line: MessageBoxPrintf (TEXT ("Screen Resolution"), TEXT ("The screen is %i pixels by %i pixels high." ,cxScren, cyScreen)); Now I have removed the line feeds you should be able to see the problem ;)

Your arguments, cxScreen and cyScreen are being sent into the TEXT macro and not your MessageBoxPrintf function.

Also, you typo'd cxScreen as cxScren


EDIT: In my opinion Visual Studio is the best IDE you can get.

L3gacy commented: thanks for hints +2
Ketsuekiame 860 Master Poster Featured Poster

Yah that is the good thing about it but im just a beginner :) and those WinExec were just explored through net..Anyone suggestions?

Whatever website told you WinExec was a good idea, please burn it in a fire :)

Use a loop like jonsca suggested with a conditional to set whether or not to repeat said loop.

Ketsuekiame 860 Master Poster Featured Poster

Why would it be missing?

Also, separation is good! It makes code more manageable and easier to read. You don't end up getting lost in reams of code!

You should always follow good code practice, regardless of the conditions of the application.
Just because your code base is small, does not mean you should just ignore the rules of good programming ^^

Also, repeating code in each of your clients is bad...What if you make a mistake in one client, you then copy and paste that to the rest and release it. Your customer comes to you one day and says "Hey I have found a bug!" You fix the bug from that client but you forget to fix it in the others.

However, if you had a central DLL that all the applications used, you would only have to change that one file and it would update all the clients.

Manageability and maintainability and VERY important. You will learn this when you move into the business world.

kvprajapati commented: + +15
Ketsuekiame 860 Master Poster Featured Poster

Well, C# is not C... At beggin i confused a bit because in Visual Studio there is not any option for C... anyway

C# Is part of C
C++ is part of C

well i think C# dont support Inheretic/polymorphism... anyway

#Tellacla
Yea my mistake, some time i forgot that C# is not C ;ppp

But if you read any book for C++ it say that "The good with c++ is that c++ support inheretic/polymorphism,encapsulation and others no"

soz for my bad engl

Don't think of the languages as part of each other. The compilers for them are different and even though they may share some of the same syntax, only C/C++ are closely related (a C++ compiler will compile C code, albeit with some warnings of depreciation perhaps).

C# is very different and definitely does support inheritance (and by extension Polymorphism). public class Dog : Animal { } The comment you put for the construction of an object...In C++ you have, effectively, two ways of instantiating and object. MyObject obj = MyObject(someVal); In this case, the obj variable contains all the information about MyObject, so if you were to pass this variable into methods around the program, you would end up moving a fair amount of data around (a copy would be made every time you passed this object to a method)

The second way is MyObject* obj = new MyObject(someVal); Here you create a pointer to the object. A pointer simply "points" to where …

ddanbe commented: Well said! +14
Ketsuekiame 860 Master Poster Featured Poster

The University of Hull, The University of York, Sheffield Hallam, The University of Sheffield, The University of Nottingham, Doncaster College, Pontefract NEW College are ones that I know of =)

These are supposed to be top paid UK institutions, so some of the cheaper ones I imagine would perform similar "time saving" measures, but I can only guess.

Narue commented: Fair enough. +17
Ketsuekiame 860 Master Poster Featured Poster

Might I suggest DJGPP :)

Ketsuekiame 860 Master Poster Featured Poster

This is code to enable a user to cheat during online play at warcraft 3. I would kindly ask that you at least remove the post of the code before/after you close it. It wouldn't be so bad if he was trying to write one himself, but this is blatant copy paste from somewhere.

I abhor cheating, especially by script kiddies, which is I believe what v1nc3nt is...

Ketsuekiame 860 Master Poster Featured Poster

Please post the code you have for listening and connecting over LAN.

GPXtC02 commented: helpful +2
Ketsuekiame 860 Master Poster Featured Poster

Hey, I do something similar for work. I use a DLP-IOR4 board to bridge connections. It's USB attached and utilises a virtual com port.
It's very easy to use, just two simple commands fired down the serial port.

http://www.dlpdesign.com/usb/ior4.shtml

There are other more powerful and better rated models, choose the right one for your circuit =)

jonsca commented: Good suggestion. +14
Ketsuekiame 860 Master Poster Featured Poster

It is the entry point for Win32 applications (not console). If you're doing cross platform, you will need to check the definitions to see which OS you're compiling for and use some #ifdef pre-processor statements to include the correct entry point.

Ketsuekiame 860 Master Poster Featured Poster

Ok, I found a solution, not pretty but it works..
Now there isn't any problem at all?
What is so special about the Shapes, that makes them thread bastards?
Still, if anyone have a better solution, then please write..

- hmortensen

The Shapes class inherits UIElement from FrameworkElement. MSDN Link

This will force it to attach to the creating thread (which is your UI thread) as I noted in my first post =)

A better way is to not include UI Elements in your class data if at all possible. If needs be, create another class or struct to hold the data and use this data to construct your Shape class on the UI.

The other way is to use the Dispatcher to move back onto your UI thread but this removes most if not all of the benefit of using Async calls.

hmortensen commented: Got to the core of the problem in a few lines +2
Ketsuekiame 860 Master Poster Featured Poster

When you put a thread to sleep, everything executing on that thread stops. So if you put the UI Thread to sleep, it won't update the form.

If you aren't using multi-threading, then you're effectively putting your entire application to sleep!

Timers can be set to execute at a set interval. They are run on a different thread (unless you're using one of the other timers, I forget which as I never use them)

I think you're looking at this from the wrong perspective. You seem to be looking at this from a what code do I want to *stop* running for a second. Whereas, you should be thinking, what code do I want to *start* every second.

Windows programming and C# in particular is very event driven. You should be using a timer to execute certain code every second, not stopping your application's execution for a second.

PS. When you start using Threads and Timers, you also need to start looking at "Invoke", "InvokeRequired" and "delegate methods".

Ketsuekiame 860 Master Poster Featured Poster

You haven't initialised your List.

Also, there is a pre-defined collection for this called "Dictionary" Dictionary<String, ConsoleColor> colorList = new Dictionary<String, ConsoleColor>();

Tellalca commented: Thanks for the lightning fast and correct reply +1
Ketsuekiame 860 Master Poster Featured Poster

This is what you have to decide for yourself. Based on your permission set, you should enable or disable certain controls.

So maybe using my example, your form has a CanMakeCoffee(Boolean isAllowed) Inside are all the controls represented for coffee making. You would enable/disable all the controls in this section based on the isAllowed variable.

This isn't the best way but it is quicker.

The correct way, would be to decide which controls are represented by each permission. So for example, making toast and coffee require electricity. So if you have a "Turn on power" button, this is required for both coffee and toast makers. If both permissions are disabled, you disable the button (or hide it, whichever). If one OR the other is allowed, then you enable (or show) the button.

AngelicOne commented: good and clear explanation +1
Ketsuekiame 860 Master Poster Featured Poster

Short Answer:
Yes, you need a row for every user account on your system.

Long Answer:
Not necessarily. If you choose, you can assign a standard set of permissions to each user by using a permissions link table.
This link table contains the user id and a permissions id. You can then assign a single permission set to multiple users.

eg.
User Table = User ID, Username, Password
Permission Table = Permission ID, IsAdmin, CanMakeCoffee, CanMakeToast
UserPermission Table = UserPermission ID, User ID, Permission ID

If I make a permission set of:
Permission ID = 1, IsAdmin = 0, CanMakeCoffee = 1, CanMakeToast = 0
Permission ID = 2, IsAdmin = 1, CanMakeCoffee = 1, CanMakeToast = 1
Permission ID = 3, IsAdmin = 0, CanMakeCoffee = 0, CanMakeToast = 0

I can use those with my following users:
User ID = 1, Username = Tom, Password = 1234
User ID = 2, Username = Richard, Password = 5678
User ID = 3, Username = Harry, Password = 9012
User ID = 4, Username = Admin, Password = ahAHJhjkDsAh^&7

So I make a UserPermission table with the following rows:
UserPermission ID = 1, User ID = 1, Permission ID = 1
UserPermission ID = 2, User ID = 2, Permission ID = 3
UserPermission ID = 3, User ID = 3, Permission ID = 1
UserPermission ID = …

Ketsuekiame 860 Master Poster Featured Poster

Well you'd have a table with a user id, this would link it to your user table. You would then create fields for each permission you want to give. When you read that information back into the program, you decide what you want each permission field to represent in your program.

I can't really make it any more simple than that.

Ketsuekiame 860 Master Poster Featured Poster

It's however you want. If you aren't being told what is available and you have free reign to do what you want, then you can go as far as you want to with it. You can have a field for "IsAdmin" in your user table, or you can have a permissions table, you can do anything.

I would always opt for a permissions table. It's just more expandable.

Ketsuekiame 860 Master Poster Featured Poster

Without know the rest I can't say for sure, but usually the way to go is to have a "Permissions" table.
With the permissions table you can add a row for each user which the permissions set that you require. So you could add a field for "Read Access", "Write Access", "Administrator", "Can Control Toaster" etc.

Ketsuekiame 860 Master Poster Featured Poster

Enum.TryParse()

Come on man, took me 10 seconds to Google ;)

aaronmk2 commented: Sometimes you just need a little help finding it +1
Ketsuekiame 860 Master Poster Featured Poster

How about you don't take jobs you can't do?

Put some effort in, then come back with a specific problem. Or, for a small fee, I'll do it for you. =)

Ketsuekiame 860 Master Poster Featured Poster

None of you seem to have read the assignment properly ;)

Let me highlight a section for you... All digits are sent back through parameters by reference.

This is an assignment to teach the students how to use reference variables =)

There is a keyword called "ref" you can attach to a variable in a method definition. void MyMethod(ref int myInteger){ /* stuff */ } The "ref" keyword says that this variable has been passed by reference, not by value. The difference being, that variable is not a "copy" of something else, but a variable which points back to the original.

void Main()
{
   int myInt = 3;
   Console.WriteLine(myInt.ToString());
   MyMethod(ref myInt);
   Console.WriteLine(myInt.ToString());
}

private void MyMethod(ref int myInteger)
{
   myInteger = 9;
}

Output:
3
9

=)

EDIT: I agree it is silly that you would need to pass 8 variables by reference. An array would do the job lovely. (Which can still be passed by reference. Perhaps the teacher doesn't know how to use them properly either ;))

Ketsuekiame 860 Master Poster Featured Poster

You could use String.Format(System.Globalization.Culture.CurrentCulture, "{0:C}", Math.Round(amount / 100.0, 2)); The format command sets the string conversion culture to your current culture, it then says, "My first parameter is of type currency", and then you round the amount / 100 to two decimal places.

Please take care with rounding errors =)

Another way, if you don't want to use culture based currency conversion... String.Format("${0}.{1:00}", amount / 100, amount%100) {1:00} indicates that this parameter must always have at least 2 digits. If amount%100 = 1, it would print 01. If amount%100 = 10, it will print 10.

ddanbe commented: Keep up the good work. +8
Ketsuekiame 860 Master Poster Featured Poster

Well if you need to use XML as your "message" then how about something like this as your markup...

<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<ClientMessage>
    <SourceClientId>SomeIdHere</SourceClientId>
    <ClientCommand>Message</ClientCommand>
    <TargetClients>
        <Client>TargetClientOne</Client>
        <Client>TargetClientTwo</Client>
    </TargetClients>
    <Data>Whatever the message is here</Data>
</ClientMessage>

Obviously you would need a DTD that also matches this and the DTD should cover a message that is either from a client or a server. This is just to give you an idea.

Once you have the XML, you can serialise it into a byte stream fairly easily. Look into the BinaryFormatter

Ketsuekiame 860 Master Poster Featured Poster

If you take Jonsca's idea and sodomise it slightly...

On your form, keep a list of the selected items. (As in List<String> MySelectedItemNames; )
Every time you make a selection, clear this list and re-add all selected items again.
Every time you make a selection, clear each box apart from the selected item.
Every time you make a selection, re-add all the items that appear in your original list and NOT in your new list to each box.

This is probably a bad way to do it, but is the only way I can think of, off the top of my head.

Semi-Psuedo-Code (ie. I have no idea if this works. I wrote it without the IDE)

List<String> MySelectedItems = new List<String>();
// Assign Selected index changed to this method
private void ItemSelectedIndexChanged(object sender, EventArgs e)
{
    /* In my Form Designer, each Combo box is assigned the tag "ItemSelection" */
    MySelectedItems.Clear();
    foreach(ComboBox comboBox in this.Controls)
    {
        if(!comboBox.Tag.ToString().Equals("ItemSelection"))
            continue;

        String temporaryItem = comboBox.SelectedItem.ToString();
        comboBox.Items.Clear();
        MySelectedItems.Add(temporaryItem);
        comboBox.Items.Add(temporaryItem);
        comboBox.SelectedIndex = 0;
    }

    // Unfortunately we have to do this loop again... =(
    foreach(ComboBox comboBox in this.Controls)
    {
        if(!comboBox.Tag.ToString().Equals("ItemSelection"))
            continue;

        // Ugh embedded loops >.<. The original list is whereever you keep your original item list or whatever
        foreach(String itemString in originalList)
        {
            if(MySelectedItems.Contains(itemString))
                continue;
            comboBox.Items.Add(itemString);
        }
    }
}

EDIT: I also know that this CAN be improved upon with LINQ. But without the editor I wouldn't like to start guessing at the query structure needed …

jonsca commented: Interesting metaphor. Stay away from my children, just kidding. +6
Ketsuekiame 860 Master Poster Featured Poster

To transmit the data over the network, you still need to break it down into bytes. But the message you send can be in XML.

I imagine you will be running a server, which communicates with all the clients? If not, that's going to be rather difficult to implement ^^

Ketsuekiame 860 Master Poster Featured Poster

Well...
Unfortunately I can't recommend any books on .net at all. I learnt through doing.

I decided on a project, then tried to make it. I encounter all sorts of problems on the way and not knowing how to do anything, but with the help of logic and the internet, learning the language was actually quite easy.

No doubt there are some people here who would have a book to recommend. But I learned the basics of C# in a month and the advanced parts of the language thereafter (although I do come from a C/C++ background so it may have helped)

My advice to you is to learn by doing. Think of something simple but beyond your current level and do it. Learn how to overcome your problem by googling, asking for help and the MSDN. There is nothing better than practical experience.

ddanbe commented: Good advice. +8
Ketsuekiame 860 Master Poster Featured Poster

Delegates are used mainly for callbacks and event listeners. They're a bit like function pointers I guess in that they're a "type" which references a method.
You typically call a delegate when you're multi-threading, but this isn't the only use for them.

See the MSDN Article for more information.

Ketsuekiame 860 Master Poster Featured Poster

First put the lines of your file in a List like this:

// Read in all lines in the file, and then convert to List with LINQ.
        List<string> fileLines = File.ReadAllLines("file.txt").ToList();

then select a random line by indexing the list. See here: http://msdn.microsoft.com/en-us/library/0ebtbkkc.aspx

This is the thirst method I also thought of, however, this can eat your memory and eventually crash if you have a very large file and not much memory. It would also consistantly, take a very long time (with large files)

A quick google found me this:

public string RandomLine( StreamReader reader )
{
    string chosen = null;
    int numberSeen = 0;
    var rng = new Random();
    while ((string line = reader.ReadLine()) != null)
    {
        if (rng.NextInt(++numberSeen) == 0)
        {
            chosen = line;
        }
    }
    return chosen;
}

This has the advantage of, if the random line is found at the beginning of the file, you haven't just read in a huge amount of data for nothing, speeding up the execution time. But this will also take a very long time if it manages to read all the way to the end.
Also, this will not eat away at the available memory.

In short: If your file is going to be relatively small ( < 500Mb ) I would use ddanbe's method, otherwise, something like the above would be better, simply to avoid eating memory.

Ketsuekiame 860 Master Poster Featured Poster

I don't think the problem is regarding his calling object.

I believe what is happening, is that when you disable the button, the events for that button are also disabled. So when you disable the button, you are no longer processing the MouseEnter event.

A quick way to test this, is to place a BreakPoint on your if statement and enter the button with it enabled and then disabled. If the event is being called, the code execution will stop and you will be pushed back into your development environment. The line containing the breakpoint will be highlighted yellow.

ddanbe commented: You are absolutely right! +8
Ketsuekiame 860 Master Poster Featured Poster

Surely, your best bet for tutoring, if you want a PhD, is to take the course? In the UK at least, this takes around 6 years and so doesn't fit into your 1-2 year time scale. The fact also remains is, it's all well saying "I want a PhD in computing" but what would you do for your PhD? You would then need to begin HEAVILY specialising in that area, especially if you expect this in 2 years.

So I think your best bet is to decide what your PhD thesis will be about, see what Universities have available and you will then need some lower qualification to make yourself applicable to the position. In the UK, you will not be accepted to a PhD without at least a Masters which is a 2:i or above. To get a Masters, you need a Bachelors of 2:ii or above. (Which takes 3 years, Masters 1 year)

I highly doubt anyone here would be able to tutor you heavily enough in such a concentrated time frame for the amount of money you'd be willing to pay, even if there is anyone of that level who is willing to do it.

I know this sounds harsh, but I think you'd be better investing what time you have left into something else.

Ketsuekiame 860 Master Poster Featured Poster

A 10 year old on a computer programming course and their task is to create an operating system for children...

1. If he is indeed 10 years old and on a computer programming course and part of that course is the creation of Operating Systems, congratulations you have a genius on your hands.
2. See point above, if in fact this is the case, he would know what to do and wouldn't need to come to Daniweb as he would be able to use the internet in order to google and figure out what he needs. Nor would he need to make his Uncle post the question.

Is he incapable of typing? Then how does he program?
Is he not intelligent enough to be able to sign up? Then how is he a programmer?

Creating an Operating System is a complex task and certainly not one that any normal 10 year old can accomplish. But good luck if you're not lying/trolling.

jonsca commented: Yeah that about says what I was thinking! +5
Ketsuekiame 860 Master Poster Featured Poster

The "end" of the vector is not actually a value you've inserted but more of a marker. This is why you would use, for example, for(myIterator = vector.begin(); myIterator != vector.end(); ++myIterator) The "begin" points to the first item in the vector, however, the "end" does not point to any valid item you have inserted. You would need to point to "end - 1" effectively.

Ketsuekiame 860 Master Poster Featured Poster

I personally, would read in each criminal as a whole entity. Check if the Criminal has a crime type of "Theft" and if so, save this in a vector or list. Once you've iterated through the entire file, return the list to the calling method.

So some pseudocode

...
Open File
While Not End of Criminal File
{
    Read a Criminal From File into Criminal Object
    If CrimeType Equals "Theft"
        List.Add Criminal
    Increment File Pointer Position
    Continue Loop
}
Close File
Return List
claudiordgz commented: Thanks!!! really helped me out on this subject +0
Ketsuekiame 860 Master Poster Featured Poster

The better way to do it is to use the "SelectTab" method

{
   /* Here I declared myTabControl and added three tabs named: "TabOne", "SecondTab", "EndTab"
      I also have an TabPage object bound to "SecondTab" called tabMySecondTab */
   myTabControl.SelectTab(0); // This selects "TabOne" as it is the first in the list
   myTabControl.SelectTab("EndTab"); // This selects the tab "EndTab"
   myTabControl.SelectTab(tabMySecondTab); // This selects the tab "SecondTab"
}
Ketsuekiame 860 Master Poster Featured Poster

Personally I would use a database. As you can use arbitrary time slots though, your method of using XML is a good one.

However, you will need to jig around your XML format a little.

So rather than a string array, make an object that contains your appointments (I have no idea what they actually represent but I'm sure you'll get the idea) a timetable and a user object also.

So let's start with a description of your appointment object. From your requirements I'm guessing that you simply need to hold a DateTime and a String describing what is happening at that time. That's pretty much it done.

public class Appointment
{
   [Serializable]
   public DateTime AppointmentTime;
   [Serializable]
   public String Description;
}

Ok so now we have somewhere to store our appointment. You can no go one of two ways. You can store an array of Appointments inside your User object, or, you can store them inside a single TimeTable class. Then the user can hold an array of TimeTables.

Let's go with option two as this allows more flexibility later in the software design, if it's needed.

The job of the TimeTable object for now, is to simply store the list of Appointments.

public class TimeTable
{
   [Serializable]
   private List<Appointment> _appointmentList = new List<Appointment>();
   public IList<Appointment> AppointmentList { get return _appointmentList; }
}

As you can see I'm holding a private List and returning an IList. IList is read only (as it's an …

Geekitygeek commented: serialised list is a good approach :) +1
Ketsuekiame 860 Master Poster Featured Poster

This is very related to my last post.

When you look at program.cs you will see that the last line is Application.Run(new Form1()); This sets up what's known as the "ApplicationContext" and sets your form as the application parent and shows it on screen.
In order to exit the application, all you need to do is close that form, this is great in terms of management and making sure your application isn't sat there doing nothing after you've closed all the forms (meaning you cannot exit)

Unfortunately this has the added side effect that closing the form, regardless of where and how you do it in your application, will close the entire application.

There are only two ways around this.

1. Only hide the form. This doesn't close it and hence your application will stay running. The best way of doing this is to show your second form as a dialog.

{
   /* ...Code Here... */
   Form3 myForm = new Form3();
   this.Hide(); // The main form can no longer be seen
   myForm.ShowDialog(); // Shows the form as a dialog and PAUSES execution of this method. The next line will not be executed until "myForm" is closed
   MessageBox.Show("This is a message!");
}

That's the simplest way.

2. Create your own ApplicationContext and run that.

Having your own ApplicationContext is great for controlling your application and when it exits and what it does. If you wanted a tray icon application, you would …

Jazerix commented: Thank you +0
Ketsuekiame 860 Master Poster Featured Poster

My mathematics knowledge is quite high because that's where my work lies. However, I've written applications which require no maths at all.

This program I wrote basically stores and retrieves data using a database, displays the data to the user in a Windows Form and asks the user to modify/look at/ignore it.

That application required no maths at all it was literally just ferrying data to and from a database. If you take up C# you will find that this is where most of the applications lay. That is unless you work in the financial markets, in which case your maths better be damn good ;)

For the majority of my work, I need to have a high level of maths as it involves 3D animation, rendering and manipulation of objects inside a virtual space. So I need to know such mathematics as Quaternions, Vector manipulation, Differentiation and a fair amount of physics :)

If you struggle at maths and you want to be a programmer, pick your employer carefully and you'll never need to use it in programming, although typically you'll see a great reduction in salary. For example; working for a certain financial institution in the UK will net you £75,000 pa (about $127,500) whereas the same quantity of work in a more basic institution that doesn't have the same complexity, will net you around £25,000 - £35,000 pa ($42,500 - $59,500 pa)

progcomputeach commented: good comments. took the time to answer the question +1
Ketsuekiame 860 Master Poster Featured Poster

Totally depends what you want to do.

If you want to build a web application, I wouldn't use C :P

A good collection to know would be C++, C#, PHP, ASP .NET and Javascript. I baulk at saying Visual Basic because I honestly don't know what advantages it has over C#.

C# is good for Web Services, business applications and anything where development time is more important than the performance of the application.

C++ is useful for the lower level development that you simply can't do in C#. When you need high performance applications (such as the latest in 3D rendering or complex algorithmic computation). Knowing C++ also allows you a quick step to C which you can use to write Drivers in Windows or Kernel mods for Linux.

PHP and ASP both effectively do the same thing except ASP is tied to Microsoft where-as PHP isn't. I find ASP to be more useful but that's because of the work I do, especially in MVC patterns. PHP hasn't quite caught up to the same standard as Monorail and ASP .NET MVC 2.

Javascript is a must for any web developer. Keen subjects to look into are jQuery and AJAX which allow asynchronous and "apparent" two-way communication between web services and your page. They can do a lot of work without the user having to reload the page or refresh it.

This forum uses a combination of AJAX and jQuery to update the pages.

progcomputeach commented: good in-depth comments +1
Lusiphur commented: Darn you for beating me to it :) +1
Ketsuekiame 860 Master Poster Featured Poster

Ok you need to think about what your method calls do and your order of execution.

The ShowDialog method does just that. It shows the form you created as a dialog box. This means that the code from your parent form stops executing (unless you have multiple threads running which I won't go into)

So when you get to the line form.ShowDialog() execution in that method pauses at that point, until you close the new dialog box.

What you should do, is put the Hide method *above* the ShowDialog call and then a show method *after* it.

Ketsuekiame 860 Master Poster Featured Poster

It may be worth installing Oracle VirtualBox and create a new Virtual Machine that runs Windows XP SP3.
Once Windows XP SP3 is installed, create a snapshot for you to easily revert back to.

On this virtual machine you can now debug in 2 ways.
1: Install visual studio and use it to debug your source code
2: Use the remote debugger. The way to set this up is a little more complex and you will have to include code that delays the start of your application so that you have time to hook the process before it crashes.


Personally I would do option 1. If it works, then it's something to do with Visual Studio (maybe it is using a library you aren't aware of that VS installs). In that case I would then move onto option 2.