Friday, November 16, 2007

Unreal Tournament 2004 Rocks

I've been gaming lately. With a new copy of Unreal Tournament 2004, I decided to kill a couple of hours and have some fun. The game is revolutionary when it comes to team games. You can right vehicles with the truck being my favorite of the lot and you can have teammates shoot while you drive, or the other way round. There's also a tank that can take quite a lot of beating and turrents to defend the bases/camps. The graphics are not that great and gameplay may take a while to get used to, but once you're hooked, it's addictive, particularly the ability to have a voice chat with other players while in battle.

Wednesday, November 14, 2007

The MVC Pattern

The Model-View-Controller pattern is the most commonly used pattern for software development, after the N-tiered model. In the MVC pattern, the model is responsible for managing data. It's state is accessed by the view and mutated by the controller. The sole function of the view is to display data to the user. The controller is responsible for reacting to triggers from the user, for changing the state of the model, and for updating the view. Both the controller and the view are dependent on the model; however, the model is independent of both the controller and the view.

There are two variants of the MVC - the passive model, in which the model does not notify the view of any changes to it's state, and the active model, in which the model notifies the view of changes to it's state usually via the observer pattern.

The 3-tier architecture differs from the MVC in that there is a strict separation between the three layers, which prevents the top layer from communicating with the bottom layer. In the MVC, the model can notify the view of changes to it's state.

A pretty good diagram of the MVC can be found here:
http://java.sun.com/blueprints/guidelines/designing_enterprise_applications_2e/images/app-archa2.gif

Message Queue Characteristics

Message Queues can be characterized by the following attributes:

Delivery

Guaranteed delivery of messages are provided by persistent queues, which store messages in files or databases. Non-persistent queues store messages in memory and thus message delivery is not guaranteed if the message queue provider fails. A persistent message queue is required to confirm the receipt and receive acknowledgement of the delivery of a message.

Transaction Support

Messages can be grouped together into a transaction, such that either none or all of the messages in the transaction would be processed by the client.

Messaging Models

The two types of domain models or messaging models are Peer-to-peer and Publish-subscribe. In the peer-to-peer model, the message from the queue is received by one recipient after which it is deleted from the queue. In the publish-subscribe model, the publisher sends a message to the queue with a topic and all registered subscribers receive the message.

Durable/Non-durable

A non-durable subscriber can receive messages only if it is connected to the message queue. A durable subscriber can receive unexpired messages after it reconnects to the queue.

Push/Pull Delivery Mechanism

Messages can be delivered by a queue using either a push mechanism where the queue actively sends the messages to the receiver, or a pull mechanism where the receiver polls the queue periodically to check for messages.


Synchronous and Asynchronous messaging

In synchronous messaging, a message isn't stored on a queue while sending, but a direct connection is established to a client where the message is placed on a target queue thus providing real-time delivery.

In asynchronous messaging, the message is placed onto a remote queue and is sent to an intermediary store for delivery to a client.

Virus Killer

While searching for an antivirus to run on Linux, I came across this game called the Virus Killer. In the game, you'll have to protect your files by blasting away the viruses that come crawling from Microsoft Outlook Express, Microsoft Internet Explorer and the Recycle Bin by zapping them with the mouse cursor. It's fun and the game's got a nice theme to it.

Tuesday, November 13, 2007

Auto-update of Windows Service

I was thinking about an developing application to perform an auto-update of a Windows service. In my previous post, I've posted details on controlling a windows service so to add more to it, I could get the path of the EXE from the registry at HKLM-System-CurrentControlSet-Service-[ServiceName]. So, if I could stop the service and replace the executables with a new version of the service, I could create an auto-updater for the service!

Now, if there's a DLL that's being started by svchost.exe, there's a name following the "-k" that represents multiple DLLs. Updating those is a story I'll write about some other time! :-)

My Web Windows Services Console

I've been thinking about working on a tiny web application to remotely start and stop Windows services via a browser and I finally stopped thinking and did something about it. It was remarkably simple with the GridView control and it took a little over fifteen minutes, including the time to chat via IM with a buddy.

I had to include the System.ServiceProcess assembly and calling the System.ServiceProcess.ServiceController.GetServices() method returned an array of System.ServiceProcess.ServiceController. Now, the GetServices method has an overload that takes a machine name but I haven't tried it yet. It probably needs either a Windows domain or some way to authenticate with the other machine - the former I don't have and the latter I can't be bothered with right now.

I added a Start/Stop button and it did actually effect the service, but I had to add an ASP.NET Button to act as a refresh button to actually see the new status of the service due to the time it takes to actually start/stop. I added a two second sleep and tested it against the Windows Time service but that didn't seem to work and I'm guessing I need a longer sleep time.

Anyway, that's as far as I'll build for my little web Windows Services console.

UPDATE: I decided to venture a little further and found the method ServiceController.WaitForStatus that takes in the desired status and timeout as parameters.

Monday, November 12, 2007

Remotely enable remote access

If you've forgotten to enable Remote Desktop on your Windows box and you really need to get in, there's a free bit of software from IntelliAdmin to enable it. Check it out at: http://www.intelliadmin.com/blog/2006/06/remotely-enable-remote-desktop.html