Thursday, November 29, 2007

Intel vPro

Intel's vPro is a hardware based management solutions for systems. The benefit of using a hardware based approach is that you do not require the PC to be running and don't even require the Operating System to be started up.

The Altaris Console Management is probably more popular among the vPro-based tools for administration, but you'll find more tools shipped from Avocent, BMC Software, CA, Farstone, Kingsoft, HP OpenView, LANDesk, Medialand, Microsoft SMS, StarSoftComm, and SyAM.

You can also get the Intel AMT developer tools from:
http://softwarecommunity.intel.com/articles/eng/1034.htm

For details from an Altaris Console Management demo, go to:
http://arstechnica.com/articles/paedia/hardware/vpro.ars/2

VS2008 and .NET 3.5 released on 19 Nov 07

Visual Studio 2008 was released on 19th November 2007. The Express editions are available as a free download. .NET 3.5 brings a lot of updates to C# and VB.NET as languages. LINQ is probably the most awaited feature.

For newbies, having Windows Presentation Foundation, Workflow Foundation and Communication Foundation integrated in the IDE is probably the best part.

Google BAdSense

Google AdSense is buggy. I've tried signing up using my existing GMail account and it replies with "a user with the specified email address already exists". Of course it does exist, what do you think an existing Google account means?

Anyway, I'm as interested in placing ads on my site yet since I don't receive a lot of traffic. Perhaps when I get the traffic to make something on the side to help pay for Internet connectivity costs.

Downgrading from Windows Vista to XP

The firm I work at just ordered 10 new desktop PCs pre-installed with Windows XP to replace the PCs running Windows Vista. I guess this one is a first - replacing a newer version of an Operating System with an older version.

Saturday, November 24, 2007

Top 'n' SQL Query

The Top 'n' SQL Query is a common interview question and I've asked it a couple of times to fresh graduates who couldn't answer it - some didn't even know about the existence of the MAX group function.

I'm pretty sure everyone is familiar with the Oracle-specific statement:
SELECT sal FROM (
SELECT sal FROM mytable ORDER BY sal DESC
) WHERE ROWNUM < 10;

MySQL (and PostgreSQL) is pretty similar where you use a:
SELECT sal FROM mytable LIMIT 10;

With Microsoft SQL Server, you can use the SET ROWCOUNT 10 (Sybase supports this too) before executing a query to return ordered rows and this approach is similar to the MySQL approach. You can also use the TOP keyword (Firebird uses the FIRST keyword instead of the TOP keyword) as follows:
SELECT TOP 10 sal FROM mytable;
The TOP keyword also support the PERCENT keyword after the number, making it more flexible.

Also, with Microsoft SQL Server, you can use a ROW_NUMBER() OVER (ORDER BY column_name) to provide something similar to the ROWNUM pseudocolumn in Oracle. RANK is used similar to ROW_NUMBER, except that RANK supports the use of PARTITION BY (optional) in addition to ORDER BY.

I think an ANSI compliant statement that works across all databases would be something like this:
SELECT sal FROM mytable a WHERE 10 > (
SELECT COUNT(1) FROM mytable b
where b.sal > a.sal
)
ORDER BY sal DESC;

I think a more challenging question for a beginner would be to return the next highest after the Top 'n'. I think I'll save that for the time I'm interviewing experienced job applicants.

New PHP, No IMAP

I got PHP 5.2.5 compiled on my system with a new shiny Apache too. I started off with an old version of CURL so it didn't work. I then got the new version of CURL and it worked! I decided to get IMAP working by trying both the 2006 and the earlier versions, but neither work - the compilation stops due to a variable name conflict. I'm not sure if the 2007 release is stable, but I'll give it a shot.

Anyway, I'll probably just have to go without IMAP till someone decides to work on the source code and come up with a new release.

Saturday, November 17, 2007

NAnt ...a short introduction by Nitin Reddy Katkam

What is NAnt?

NAnt is a tool used to compile source code without using an IDE. It is a command-line utility and runs with instructions written in XML. With the ability to perform most compilation tasks and to execute commands, just as shell scripts do, NAnt makes a useful addition to the tools used by any large .NET software project. NAnt is actually a .NET version of the popular Apache Ant for Java.

Getting Started

If you would like to install NAnt, you can download the binaries required from: http://sourceforge.net/project/showfiles.php?group_id=31650

Compilation directives can be provided in the instruction file by either explicitly specifying the source files or by specifying the solution file from which all details required for compilation can be obtained. You can override solution settings by excluding projects from a solution.

You can find a sample build instruction file at: http://nant.sourceforge.net/release/latest/help/fundamentals/buildfiles.html

How does NAnt work?

NAnt follows the 'build target' concept from Make that allows you to perform a sequence of steps by providing a parameter; if no parameter is found, the default target specified is built. As is the case with makefile, NAnt can run without any parameters by looking for an instruction file in the current directory; for NAnt, the instruction file ends with a .build extension.

The command line parameters you can provide are: , -buildfile:, -D:=

Reference

For reference, you will probably want to start off with looking at the tasks that you can provide to NAnt at: http://nant.sourceforge.net/release/latest/help/tasks/index.html

You can get more at: http://nant.sourceforge.net/release/latest/help/

Additional Notes


When you build a project, NAnt compares the timestamp of the source code with that of the executables and only compiles if the timestamp of the source code is newer.

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

Inflexible ASP.NET Calendar control

The ASP.NET Calendar control forces developers to use Saturdays and Sundays as the weekend. Now, although this may seem insignificant, a lot of developers require a calendar control to display working and non-working days and they need to define these as the 'weekend' days. Also, some parts of the world observe the weekend on Friday and Saturday, or Thursday and Friday, or just Friday.

There is an awkward way - by overriding the DayRender event and resetting the styles for Saturday and Sunday, and applying the styles for the days you want to mark as non-working days.

Either way, when I'm developing a calendar control, I know what I'm going to build into it.

Wednesday, November 7, 2007

The Joys of Distance Interviewing

I'm having a first solo at recruitment and so I asked a co-worker about her experiences at hiring new staff. She mentioned about an online interview she took for .NET. She's into PHP and open-source technologies so she got a question off the Internet. The reply was the answer pasted from the same website!

Sunday, November 4, 2007

MSDN: About Enterprise Architects

There's an interesting blog article on MSDN about Enterprise Architects. Check it out:
http://msdn2.microsoft.com/en-us/library/bb945098.aspx

You may also want to take a look at some other blogs by Microsoft Architects:
http://msdn2.microsoft.com/en-us/architecture/aa699386.aspx

Friday, November 2, 2007

Resource files in Java

Just as we have resource files when developing with .NET, Java can read from resource files located in a directory listed for the class path.

You can use one of the following two statements depending on the context from which you want to read the resource file:

[className].class.getClassLoader().getResourceAsStream
("filename"); //to call from a static context

this.getClass().getResourceAsStream("filename"); //to call from a non-static context

Bridging Business and I.T.


In many firms, the department working on the core business shares little with the I.T. division and they talk completely different languages. Here's a little comic that I found at: http://www.insurancebroadcasting.com/Cartoon_2.gif

Findstr to grep on Windows

If you've been using grep all week only to come home to an PC running Windows, you're probably missing a part of your life when you leave your Linux workstation.

If you've been in the dark on the Findstr command line utility for Windows, you'll certainly love my blog for this. If you're on a text file containing huge amounts of text, such as a log file (I've got a log4net log that generates a few hundred lines every hour... that is after disabling the memcache logging) you can get Findstr to search for all lines with a particular word. Findstr does regular expressions too. It's got many of the options that grep does - printing filenames for matches, printing lines that do not match, and multiple file search.

iPod Touch picky about its electrons

I just came across a blog post by Daniel Schneller about his iPod Touch being very picky about where it gets its electrons from. It can get charged via a USB port and gets charged while running Windows or MacOS but not when running Linux. The fix was to install a driver, but it seems pretty odd anyway. I connect my iMate Jasjar to the computer (irrespective of which OS is running) and sometimes to the DVD player.

I can understand people being cautious about where they get their money from to avoid counterfeit but why would an iPod touch want to know where it gets its electrons from?

An AppSettings Equivalent

I've been looking for an equivalent of the AppSettings file in Java and came across the java.util.Properties class. I haven't tried it yet but I'm guessing I've got to explicitly specify the file from which I'm going to read the properties from and save the values to. It's good enough for me.

Episode 6 of Bionic Woman missing

Bionic Woman Episode 6 of Season 1 seems to be missing. Usually the episode comes up in a search on Mininova for download as a torrent on Wednesday or latest by Thursday.

I prefer to download them before watching because I've got a slow connection :-(

Method Extensions in C# 3.0

One of the new features in C#.NET 3.0 is method extensions. You can add additional methods, for example, to the String class so you can have a ToEmployee method in it. The only difference between a regular static method and a method extension is the addition of the "this" keyword before the parameter declaration.

Generic software components

When building software, most projects reduce development time by making integrating re-usable components. When building a re-usable component, there are two popular strategies for configuring a generic component to the application - you could either have a configuration file, as most .NET applications do, or you could have all configuration parameters sent in via code through setting properties and calling constructors or other methods.

The essence of building a generic component is that you should think of the component as a breadboard - somebody somewhere would want to do something that you did not intent and the ability to adapt the component to the scenario is what makes a successful component.