Thursday 26 April 2007

And so it begins... TSP (Team System Project)

Well today I have started our 1 1/2 week Team Systeam Project. This year we have to design a back end for a bank eg. Servers, interfaces, security. It sounds really cool and I can't wait to get into it, bring on UML and use case diagrams.

Monday 23 April 2007

Vista Activation.. Honestly it works


Well I got a copy of Vista Business N edition via my Computer Science departments MSDNAA license. I installed it and it was running fine till I ran Windows Update... It broke my computer! Ok it wanted to help by installing the latest drivers for my IDE drivers, graphics, webcam and a few other things but then after I restarted it said Windows was deactivated and I had to reactivate... darn. Its always nice to see 'This copy of Windows is not genuine' when in fact it is. So tried the online activation... again and that failed saying someone else was using my key. Crikey I thought, who could that be! then I thought..Me! So in the end I activated it over the phone and it now works but it kindly leaves the reminder as the notice won't dissappear from the corner of my screen. Well done Microsoft.

Programming a Student Rep Vista Sidebar Gadget


As you might not have guessed I am a Microsoft Student Rep, and I take part in their website http://www.studentpartner.com/rep

One part of this is their Star Rep Prize Competition in which you complete Microsoft based activities to gain points. There is a score board however I thought it would be a cool idea to create a Windows Vista Sidebar Gadget to list the top 10 along with the latest points awarded.

Well basically a Vista Gadget consists of a XML file for settings and configuration and a HTML file to house the actually visual UI. Scripting is done for the most part by Javascript.

There is an excellent tutorial to get you started on the MintSource blog, I used this as a base and added to it. Basicly as there is currently no RSS feed or plantext file to store the data the webpage had to be parsed. However the page containing the scores doesn't get parsed because it automatically redirects because it thinks a user isn't logged in. To test I copied the source and parsed it from a local source. Ok, this is my first use of Javascript but it was a great learning experience and I can't wait to make more Windows Vista Sidebar Gadget.
It may not look that good at the moment, I've never been that good with graphics or web design but that can be sorted in time. I will post a link to the download when its finished.

My life with Windows Mobile

I just wrote another article, this time about my life with a Windows Mobile Device. I submitted it to Student Zine Newsletter and I hope it gets published.

Like most students I crave the latest gadget, the definitive upgrade to which I can dedicate the next few months figuring out how to use. Well after using a WM5(Windows Mobile) device now for a while I thought I should give a short ‘day in the life of...’ to talk about how really amazing these devices are and how they aren’t just a fancy electronic diary but an integral part of anyone’s life who is fortunate to own one.

The day of course starts as most students wish to continue, asleep in bed. However I get woken up by the sound of ‘Sometimes I dream about cheese’; a witty game quote that’s now my ringtone and alarm. The initial thing I do is check my plan for the day using the calendar program, all lectures and appointments appear onscreen. I move onto checking my various email accounts using the built in Pocket Outlook; however usually by now I get an alarm kindly mentioning I have 15 minutes left to get to my lecture.

Going into my lectures I feel lighter; unlike the other students I don’t need any printed out slides, note paper or even pens. I just take out my WM, simply use the built in Wi-Fi combined with Pocket IE to download the lecture slides and view them in Pocket PowerPoint, taking notes is easy and I use Word for this task. No keyboard is required although a virtual one can be displayed on screen; I just use the character recognition and write on the screen. This function is great at making others want their own WM device!

A few lectures, phone calls and texts later I return home, plug it into my Windows Vista PC and use Windows Mobile Device Center to synchronise all my documents I edited throughout the day, meaning I never lose anything and they are always accessible to me and always up to date.
Now really this could just be called a glorified phone; however using Visual Studio you can extend its functions to anything you can think of by programming new features. I myself enjoy writing games but also mess around with applications to help streamline my life even more. If you can’t or don’t want to write programs yourself you can simply search around and there are 1000’s of free applications online to try.

If by now you’re as interested as I am, I suggest checking out the Windows Mobile website, you will be able to find out some really cool stuff and learn how you can get your very own Windows Mobile Device.

Friday 20 April 2007

Microsoft Silverlight; a brief introduction.

I guess if I mentioned Microsoft Silverlight to most people they wouldn’t know what I am talking about. Sounds more like a Sci-Fi weapon than what it actually is; a cross-platform rich multimedia technology allowing for Videos, animations and graphics to be displayed in a variety of browsers. Now if I said it was codenamed Windows Presentation Foundation/Everywhere or WPF/E I guess people might start catching on.

XAML is used to represent the text, while scripting is currently achieved using JavaScript. Virtually anything is possible with this current combination; a huge variety of examples are available from the Silverlight website. One of its greatest strengths I feel is that it is able to play Windows Media content without the need of an ActiveX control for the other browsers currently supported. So only just one download and you’re sorted!

So what can you make using Silverlight, well a lot of things! But I will mention some of the demo’s as examples; reading stuff on screen isn’t that interesting, it’s never as good as a book where you can turn a page. Well now you can, grab the edge corners and slowly turn the page right before your eyes. Well if reading isn’t for you how about organising your media collection or what about a cool interactive game. The list goes on.

Now I mentioned earlier that currently the scripting is solely achieved using JavaScript, now many people myself included prefer CLR based languages, and so just wait a little while for Version 2.0 as the CLR (Common Language Runtime) will be included therefore C# and VB.Net will have never looked so good. Of course for safety the local file system can’t be accessed by default by the CLR Languages.

Now this sounds great doesn’t it, rich interactive applications that are cross platform between Windows and Mac and it’s only a 2MB download that works on the majority of major browsers.

I guess there is one downside for Microsoft Silverlight, and it’s a rather major one at that... It’s not out yet! It’s only at a CTP (Community Technology Preview) level at the moment. Don’t worry; I guess Microsoft has lots of Code Monkey’s typing away trying to complete it soon.

I guess now’s the time to suggest visiting the site so you can find out more about it, there are currently a few things available Demos, SDK, Wallpapers. Your epic journey to click on the link below won’t be in vain. I strongly suggest you check it out.

http://www.microsoft.com/silverlight/

Wednesday 18 April 2007

Free Office & Vista - UK Developer launch

Well I just recieved my copy of Office 07 in the post today, thus meaning I got a free copy of Vista Ultimate and Office Professional from Microsoft which is cool. I won them as part of the UK Developer Launch event in which Microsoft gave these away to the first 1000 that answered a question. Cool!

Windows Mobile - Student Rep Article

Below is the article about Windows Mobile devices that I wrote for Microsoft Student Rep.

The description for the article is:
How Windows Mobile devices can help free up your time and increase your productivity, plus... they are awesome!

Wouldn't it be great to check your emails on the go, make notes during lectures and to have a music player all in one device? Well this is possible with a Windows Mobile 5 device, which is available on a range of stylish PDA's or smart phones. Connected to Windows Vista using the new Windows Mobile Device Centre this creates a perfect partnership in which you can sync all your important data, web favourites and emails to make sure you don't miss out on any important task or appointment. Don't worry if you’re still using Windows XP you can still connect to your Windows Mobile with ActiveSync. With miniature versions of the Microsoft Office applications you can have your desktop on the move, this coupled with Outlook Mobile and other available Windows Mobile applications will improve your productivity and make college and University a lot less confusing. Many times have I been saved by my Windows Mobile device! Developing on the Windows Mobile Platform is easy; all that is required is a copy of Visual Studio 2005 and the Windows Mobile 5 SDK (System Development Kit) which is available from (http://www.microsoft.com/downloads/details.aspx?FamilyID=83a52af2-f524-4ec5-9155-717cbe5d25ed&DisplayLang=en). Once installed you can use either C#, Visual Basic.Net or VC++ to create managed or native applications with ease that can be developed, debugged and tested using the built in PC based emulator or using the Windows Mobile device connected to your PC. If developing isn’t for you, then you can access lots of cool free content from the official Windows Mobile site such as free games and programs, of course another great resource is Mobile2Market which helps developers bring their programs to market, however anyone can look around at http://www.microsoft.com/windowsmobile/catalog/cataloghome.aspx Even after all this it gets better, soon to be released is Windows Mobile 6 which adds even more features and abilities such as more Windows Live features, better office support and a great new look. If you want to learn more about Windows Mobile why not visit http://www.microsoft.com/windowsmobile/default.mspx and have a look around.

Windows vs. Linux

Well I just had to, how could I be a nerd without mentioning this topic. Now you will get people camped out on both sides saying theirs is better, but have they ever just stepped back and looked at what’s good and bad about their operating system. So to start off with here are a few of the Pro's and Con's of each operating system. Now for the Linux side of things I am basing my answers around Ubuntu as that’s the one I use and have more experience in, also it seems the most common amongst the people I chat to.

Windows (Vista Ultimate)

Pros:
Lots of games
Most applications are designed for it
Easy to use
Not many driver issues
Can play most video formats

Cons:
Expensive
Unstable
Viruses & Spyware

Now the turn for Linux:

Linux (Ubuntu 6.10)

Pros:
FREE
Applications easy to download and manage
Virtually No Viruses or Spyware
More and more common programs are now available

Cons:
Very few new games are available
Drivers not available for all hardware
Less user friendly

Now really, even with whatever people say with the pros and cons of Windows the 3 Con's for Linux is basically what kills it for an everyday person. An average person, not nerd or computer scientist, an AVERAGE person wants above all else user friendliness. Now for an average person I am using my parents for an example.

For example if a driver isn't available for Linux by default, most people say search the internet, chat on forums and get advice. Now for example my parents have no idea what a forum is and so if it doesn't work, it’s useless. They would give up and go back to Windows.

Although most parents don't want to say it but computers are usually for their children to play games on, I doubt I know of anyone that doesn't use their home computers for gaming. So if you can't play for example the copy of Supreme Commander that you just went to PC World for, you will be pretty annoyed and probably go back to Windows where it will work.

Now of course the greatest Pro for Linux, its FREE. The operating system is free and most of the major software for it is free eg. Firefox, OpenOffice etc. Which I think was why when talking about it with my parents they got interested. £350 for Vista Ultimate and another £350 for Office or £0 for Ubuntu and OpenOffice. Hmm, which is cheaper for an average family? Of course not all the software is as good as the Windows counterpart, but it’s free. What do people expect?

Ok Windows, it’s easy to use. It’s shiny and I can play games on it. But once you installed it you have to go and buy everything else, or after buying a PC with it preinstalled it’s got loads of software from companies that isn't needed. It would be better if they just came with Vista and Office preinstalled, once again ease of use!

It does of course depend on which version of Linux you go for, there are lots to choose from, and I currently suggest Ubuntu. Now most of the problems about Linux are slowly disappearing, the new version of Ubuntu will be out soon and has greatly improved its usability which is awesome. So regrettably in the long run I would have to say that for an average family Linux is slowly becoming ever more a real life consideration.

Don't worry Microsoft, I love you really.

Tuesday 17 April 2007

IT Box, Who needs a job anyway?



Well if you do not know what an IT Box is, its a PC based games station normally found in pubs, it contains a variety of games that you can win for cash prizes. Now some of these games are based answering questions but some are based on skill, therefore they are open to outside help in the form of a computer program to help win money.

Of course this isn't allowed but its just a proof of concept.

Hex Appeal

This game is a bit like hangman, you pick a category and you have to guess the word choosen by picking letters. Therefore to solve this all you require is a program to do the following:
  • Store a list of possible solutions, most can be downloaded as lists from Wikipedia based on the categories eg. elements, countries

  • After entering the length of the word and letters in and not in the word use statistical analysis to show possible answers and which letters to use.
Pool
Well its a simple game of pool, point and shot. Therefore to make a tool, take a picture using a camera thats part of the smartphone and then after selecting the positions of the balls, or just write a subroutine to find the ball positions. Work out the best possible shot to score. Hopefully the 'physics' in the game would be close enough to use this solution.

These programs can be made on Windows Mobile devices, but of course you shouldn't... naughty you for thinking you could!

Monday 16 April 2007

Writing a Pocket PC Paint Program in C#

Well I was rather annoyed that my PPC doesn't contain a Paint Program, a simple doodling program would be so amazing to show off to your friends. But I guess Microsoft doesn't know what nerds like.

So I thought about it and went about getting everything ready. After downloading a few things, such as the shiny new Windows Mobile 6 SDK with the PPC emulator 2. Shame really that I am only developing the program for WM5. Though I wouldn't mind having a shiny new Windows Mobile 6 device *hint* *hint*.

GDI has never really been that fast, even on a modern PC. Show just think what its like on my 200mhz Pocket PC Phone. So when I was looking into doing some of the coding for the graphics filters I thought there must be a better way. Below for example is a piece of code to inverse the colours on a bitmap using GDI.

private void Inverse(Bitmap bmp)
{
//Declare a colour to store the colour in each pixel
Color c;

//Iterate through each pixel
for (int y = 0; y < bmp.Height; y++)
{
for (int x = 0; x < bmp.Width; x++)
{
//Get the colour of the pixel
c = bmp.GetPixel(x,y);

//Set the colour of the inverted pixel
bmp.SetPixel(x, y, Color.FromArgb(255 - c.R, 255 - c.G, 255 - c.B));
}
}
}


Ok, so its quite fast for small images. But for my image editing programming program I want it to be editing sizes of 1000x1000 or more and at this size it takes a rather long time. So looking around MSDN I stumbled upon using Unsafe bitmaps, in which you can access the byte array of the image directly thus equalling awesome speed. Ok takes more coding but hell is it fast! Below is the new version of the inverse function.

private void Inverse(Bitmap bmp)
{
//Specify Pixel format
PixelFormat pxf = PixelFormat.Format24bppRgb;

//Create region of the bitmap to lock
Rectangle rect = new Rectangle(0, 0, bmp.Width, bmp.Height);

//Lock original bitmap
BitmapData bmpData = bmp.LockBits(rect, ImageLockMode.ReadWrite, pxf);

//Get address of the first line of the image
IntPtr ptr = bmpData.Scan0;

//Declare array to hold the bytes of the bitmap
int numBytes = bmp.Width * bmp.Height * 3;
byte[] rgbValues = new byte[numBytes];

// Copy the RGB values into the array.
Marshal.Copy(ptr, rgbValues, 0, numBytes);

for (int counter = 0; counter < rgbValues.Length; counter += 3)
{
//Store the new colour
rgbValues[counter] = 255 - rgbValues[counter];
rgbValues[counter + 1] = 255 - rgbValues[counter + 1];
rgbValues[counter + 2] = 255 - rgbValues[counter + 2];
}

// Copy the RGB values back to the bitmap
Marshal.Copy(rgbValues, 0, ptr, numBytes);

// Unlock the bits.
bmp.UnlockBits(bmpData);
}


Though now extra using statements have to be included, such as System.Drawing.Imaging and System.Runtime.InteropServices.

I hope you found this little snippet interesting, I will post more about the paint program soon, don't worry. Its currently got quite a lot of cool features, hopefully in the next couple of days there will be a download link also.

My Blog++

Well I thought it was about time to start writing my own blog, it seems everyone out there have their own blogs and so it was about time I had one too. Mostly this blog will cover my computer science twist on the world along with random bits of code and articles about computers and such. Hopefully people may find it interesting, though really does anyone actually read blogs. I bet no one has actually read up to this point yet.. blah blah.