Thursday, January 27, 2011

C#, Windows mobile 5.0, delegate and multithreading

This week was the 3rd week of school and it was also the week i started to code the 3rd year project! The project goal is in fact to add internet multiplayer functionality to an already existing racing game, after spending 2 weeks refining the software requirements and filling papers and papers of documentation, we finally got to the interesting part, the part where we actually learn something.

So I started the week by beginning the development of a chat interface which will run on a Windows mobile 5.0 PDA (old stuff dating from over 3 years ago). The interface part was pretty easy to do, Winforms is great for that, you just have to drag' n drop to create the layout and then you can start programming. I got all the layout working within 1 or 2 hours but then i wondered what was the best way to keep the information between the window, and also create the communication to the server. After talking to a collegue, i decided to simply create a "Session" object which will control the displayed page as well as the messaging service, I don't know if that was the best way to do it but i'm open to comments, i'm at school to learn.

So after that i started to think of the best way to receive messages from the server, i decided to go with starting a thread which would wait for the input from the server and then would go on notifying the interface to update itself. But to do that i needed to know 2 things: what is a delegate and how to start a thread! After 1-2 hours of reading tutorials, i got the hang of delegates and decided to continue on with the implementation. I created the thread which ran on an instance of the messaging object (yeah I know, that is probably not the best way to do it) and don't worry it didn't access any data, it was actually just waiting for an answer from the server. The real problem was calling the delegate to afterward, since it resided on the main thread, the function couldn't be accessed except by quitting the thread, so i had to learn to use the .Invoke function (which blocks the incoming thread). But finally, I was able to make the 2nd thread totally separate from the first one. Now the next step is to actually communicate with the server.

Tuesday, January 25, 2011

New domain name, and trying to post more often

Hello everyone!

I know there's probably nobody reading this, but i just wanted to say that i changed my domain registrar to Hover.com and, since godaddy kept my old domain name, i had to change the domain for my blog, it is now awesoftsomeware.net. No wonder you already figured that out since you are reading this but i just wanted to say a couple of things about godaddy.

This winter, i forgot to renew my domain with GoDaddy ( i was busy at the time and never found the time to do it) so now that i was ready to renew my domain name, they were charging me 90$ to renew it, that is an enormous amount to me so i just decided to move to a better registrar, hover.com. The domain name did cost me a little more (5$ more a year which isn't THAT much).  So i don't recommend godaddy to anyone!

So now that the blog is back up, I told myself that I would try to post at least one small post every week, I don't know if i'll be able to keep up with this, but I will definitely try.