Windows NT 4.0 in VirtualBox

Here are screenshots of Windows NT 4 VirtualBox installation that I’ve done recently. Gallery follows installation process and using Windows after installation.

If you are installing this on a Mac, use fn + down arrow for “Page Down” and fn + F8 for F8 when in setup.

Database Browser Portable – Free Database Management Tool

Database Browser Portable

Database Browser Portable is a free, easy to use tool, which allows you to connect to any database and browse or modify data, run SQL statements, export and print data.

It does not require installation, so it can be run from a USB stick on any Windows machine that you may have access to.

Features:

  • Works directly with Oracle, MS Sql Server, ODBC, MySql, PostgreSQL, SQLite, Ole DB, Interbase and Firebird
  • Support for ODBC connection strings
  • Unlimited number of connections
  • One click switching from one connection to another
  • One click table browsing
  • Data browsing
  • Data exports into CSV, Excel, Html files
  • Execution history
  • SQL Builder with wide range of supported databases
  • Execution Log
  • Incremental Table Search

I have tried connecting to and browsing MS SQL 2005, MS SQL 2008 R2 and MS Access 2007 databases without any problems. Very handy tool that you can carry around with you.

Get Database Browser Portable here.

NoSleepHD – Prevent external hard drives from going to sleep

No Sleep HD

NoSleepHD

Most external hard drives now days have an auto-sleep feature, which puts the hard disk to sleep after period of inactivity (e.g. 15-20 minutes).

While this has obvious advantages, sometimes you may not want this to happen – especially if hard drive has trouble waking up (like one of my drives).

NoSleepHD is a freeware utility that will stop your external drive(s) going to sleep. It works on a very simple principle – every few minutes (defined by user) it writes an empty text file to your drive(s).

It is very simple to use – once started, select which external hard drives you want to monitor, set the write timer interval, click on start and that’s it.

You can also set the app to start on every system startup.

Get NoSleepHD here.

Microsoft SQL Server: Search for text inside Database Objects

One handy feature missing from SQL Server Management Studio is the ability to search for a piece of text inside stored procedures or other database objects.

SQL query below will do this for you – it will search for a piece of given text inside stored procedures, triggers, views and scalar functions. This works on SQL Server 2005 and 2008.

SELECT o.type_desc AS ROUTINE_TYPE
        ,o.[name] AS ROUTINE_NAME
        ,m.definition AS ROUTINE_DEFINITION
FROM sys.sql_modules AS m
INNER JOIN sys.objects AS o
    ON m.object_id = o.object_id
WHERE m.definition LIKE '%search text goes here%'

Boxee – Freeware Home Theatre PC Application

Boxee

Boxee is a cross platform, freeware Home Theatre PC (HTPC) application. It uses XBMC media center as framework for its user interface and core media player functionality.

One feature that sets Boxee apart from its competition is the social networks feature. Boxee allows you to connect to several social networks (Facebook, Twitter, etc). This integration allows users to view and rate video posts by friends.

Boxee has versions for Windows, Mac and Linux. You can also download a free remote control app to your iPhone.

I downloaded Windows package and installed it on my home theatre PC, and also installed remote control app for iPhone. Installation and setup were easy and straight forward. Once I launched Boxee for the first time, I had a look through settings. Here you can do things like set up video, music and picture sources, change location, configure video and audio, install applications, etc. Remote control app for iPhone scans for computers running Boxee automatically on startup, which is a handy feature.

I found the interface to be very nice looking and easy to navigate, making it one of the better ones among all HTPC software I’ve tried so far. Main screen provides access to music, video, photos, apps and file browser. It also displays video feeds from any social networks you may have connected to, along with recommended videos and a current media player queue. Remote control for iPhone is also very easy to use, making the whole setup very user friendly.

If you are looking for a media center solution, I would highly recommend to take Boxee for a test run.

You can get Boxee here.

IBBDemo2 – iPhone and iPad Browser Simulator

iBBDemo2

iBBDemo2 is an Adobe Air application that emulates iPhone and iPad web browsing experience. It can be a useful tool for testing Web apps targeting the iOS family of mobile devices. It can also be useful for doing presentations to demo iOS Web apps if you don’t have access to a Mac.

I found this to be quite useful while developing mobile web apps using iWebKit.

Get it here or here.

Getting Started with WCF – Simple WCF Service and WCF Client

This tutorial explains how to create a simple WCF Service and a simple WCF Client. For this tutorial you will need Visual Studio 2010 and knowledge of C#.

If you are new to WCF, to find out more go to Microsoft WCF Developer Center.

Creating WCF Service

Creating Service

1) Open Visual Studio 2010. Click on File -> New Project -> Visual C# -> Console Application. In the “Name” textbox enter “WCFServiceExample”. (Make sure target framework is 4.0)

2) Add refernece to System.ServiceModel. Right-click References -> Add Reference. Go to .Net tab and select System.ServiceModel (version 4.0.0.0)

3) In Program.cs file, add:

using System.ServiceModel;
using System.ServiceModel.Description;

4) Define a service contract. Add the following code to Program.cs file:

[ServiceContract(Namespace = "http://Microsoft.ServiceModel.Samples")]
public interface ICalculator
{
	[OperationContract]
	double Add(double n1, double n2);
	[OperationContract]
	double Subtract(double n1, double n2);
}

5) Add a class with service contract method implementations. Add the following code to Program.cs file

public class CalculatorService : ICalculator
{
	public double Add(double n1, double n2)
	{
		double result = n1 + n2;
		return result;
	}

	public double Subtract(double n1, double n2)
	{
		double result = n1 - n2;
		return result;
	}
}

6) Now we need to set up the service. Add following code to Main() method in Program.cs, so that Main() looks like this:

static void Main(string[] args)
{
	//address for the service
	Uri baseAddress = new Uri(
		"http://localhost:8000/ServiceModelSamples/Service");
	//Service host instance to host this service
	ServiceHost selfHost = new ServiceHost(typeof(CalculatorService),
		baseAddress);

	try
	{
		//Add endpoint that exposes the service
		selfHost.AddServiceEndpoint(typeof(ICalculator),
			new WSHttpBinding(), "CalculatorService");

		//Enable metadata exchange
		ServiceMetadataBehavior smb = new ServiceMetadataBehavior();
		smb.HttpGetEnabled = true;
		selfHost.Description.Behaviors.Add(smb);

		//Open ServiceHost and wait for incoming messages.
		selfHost.Open();
		Console.WriteLine("The service is ready.");
		Console.WriteLine("Press to terminate service.");
		Console.WriteLine();
		Console.ReadLine();

		// Close the ServiceHostBase to shutdown the service.
		selfHost.Close();
	}
	catch (CommunicationException ce)
	{
		Console.WriteLine("An exception occurred: {0}", ce.Message);
		selfHost.Abort();
	}
}

Thats all you need to do to create WCF service. Full code inside Program.cs file should look like this:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ServiceModel;
using System.ServiceModel.Description;

namespace WCFServiceExample
{
	class Program
	{
		static void Main(string[] args)
		{
			//address for the service
			Uri baseAddress = new Uri(
			"http://localhost:8000/ServiceModelSamples/Service");

			//Service host instance to host this service
			ServiceHost selfHost = new ServiceHost(
				typeof(CalculatorService), baseAddress);

			try
			{
				//Add endpoint that exposes the service
				selfHost.AddServiceEndpoint(
					typeof(ICalculator),
					new WSHttpBinding(),
					"CalculatorService");

				//Enable metadata exchange
				ServiceMetadataBehavior smb =
					new ServiceMetadataBehavior();
				smb.HttpGetEnabled = true;
				selfHost.Description.Behaviors.Add(smb);

				//Open ServiceHost
				//and wait for incoming messages.
				selfHost.Open();
				Console.WriteLine("The service is ready.");
				Console.WriteLine(
					"Press Enter to terminate service.");
				Console.WriteLine();
				Console.ReadLine();

				// Close the ServiceHostBase
				//to shutdown the service.
				selfHost.Close();
			}
			catch (CommunicationException ce)
			{
				Console.WriteLine("An exception occurred: {0}",
				ce.Message);
				selfHost.Abort();
			}
		}

		[ServiceContract(
			Namespace = "http://Microsoft.ServiceModel.Samples")]
		public interface ICalculator
		{
			[OperationContract]
			double Add(double n1, double n2);
			[OperationContract]
			double Subtract(double n1, double n2);
		}

		public class CalculatorService : ICalculator
		{
			public double Add(double n1, double n2)
			{
				double result = n1 + n2;
				return result;
			}

			public double Subtract(double n1, double n2)
			{
				double result = n1 - n2;
				return result;
			}
		}
	}
}

Creating WCF Client

1) Open Visual Studio 2010. Click on File -> New Project -> Visual C# -> Console Application. In the “Name” textbox enter “WCFClientExample”. (Make sure target framework is 4.0)

2) Add refernece to System.ServiceModel. Right-click References -> Add Reference. Go to .Net tab and select System.ServiceModel (version 4.0.0.0). In Program.cs file, add:

using System.ServiceModel;

3) Now add WCF service reference. Start the WCF Service created previously. Right-click Referneces -> Add Service Reference. Enter http://localhost:8000/ServiceModelSamples/Service as Address and click Go. Enter WCFService as Namespace. Click OK.

4) Create WCF client instance inside Main() with:

WCFService.CalculatorClient client = new WCFService.CalculatorClient();

5) Now call service operations. Inside Main() add following code:

// Call the Add service operation.
double value1 = 100.00D;
double value2 = 15.99D;
double result = client.Add(value1, value2);
Console.WriteLine("Add({0},{1}) = {2}", value1, value2, result);

// Call the Subtract service operation.
value1 = 145.00D;
value2 = 76.54D;
result = client.Subtract(value1, value2);
Console.WriteLine("Subtract({0},{1}) = {2}", value1, value2, result);

6) All that is left to do now is to close client gracefully. Add following code to Main():

client.Close();

That is all that is needed to create WCF client. Full code inside Program.cs file should look like this:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ServiceModel;

namespace WCFClientExample
{
    class Program
    {
        static void Main(string[] args)
        {
            WCFService.CalculatorClient client =
				new WCFService.CalculatorClient();

            //Call the service operations.

            // Call the Add service operation.
            double value1 = 100.00D;
            double value2 = 15.99D;
            double result = client.Add(value1, value2);
            Console.WriteLine("Add({0},{1}) = {2}",
				value1, value2, result);

            // Call the Subtract service operation.
            value1 = 145.00D;
            value2 = 76.54D;
            result = client.Subtract(value1, value2);
            Console.WriteLine("Subtract({0},{1}) = {2}",
				value1, value2, result);

            //Closing the client gracefully closes the connection
			//and cleans up resources.
            client.Close();

            Console.WriteLine();
            Console.WriteLine("Press Enter to terminate client.");
            Console.ReadLine();
        }
    }
}

And that is it. Start the Service exe file first, and then start the Client exe file. The client should perform Add and Subtract functions and display results. Press Enter key on both Service and Client to close them down.