Sunday, November 30, 2008

Review: RapidSVN for Windows

While working with Linux and PHP, I used RapidSVN as my preferred client to manage my source code. However, after I made the switch from Linux system administration to .NET development, I used TortoiseSVN and that was pretty cool with the Windows Explorer (shell) integration.

I tried RapidSVN 0.9.6 (March 2008 build) for Windows today and found it to be less than acceptable in terms of stability. The first time I launched the application after installation, I did a Checkout to a new directory and RapidSVN simply crashed after about 2-3 minutes of getting the files from the source code repository. I then tried a clean up (which was under the 'Extras' menu item). I tried getting the source code again, but to no avail so I guess I'll have to work with a different source control repository to try it out.

Perhaps I'll get to use a newer version of RapidSVN sometime soon? I'm really looking forward to a stable release.

If you want to try RapidSVN 0.9.6, you can get a copy from here.

Tuesday, November 25, 2008

Fedora 10 Released Today!

The much-awaited Fedora 10 was released today. It is based on the 2.6.27 Linux kernel. You can view the entire feature set here.

Monday, November 24, 2008

iFrame Background White in IE

I was a little surprised when a page that I developed using IFrames appeared fine in Firefox and Safari, but in Internet Explorer the background of the iFrame appeared white, overlapping another element on the page.

The way around this behavior is to set the allowtransparency attribute of the IFrame tag to true i.e. add the following to your IFRAME tag.
allowtransparency="true"

Sunday, November 23, 2008

Google Whacks Dying Out

I've tried searching for the most recent 5 Google Whacks from the Google Whack site and just one of them continues to remain a Google Whack - "sensex underhairs".

So what happens to these Google Whacks, you ask? Well, when the words are put up on GoogleWhack.com, Google indexes them and that's when Results 1 to 1 of 1 loses the magical 1s. Then, there are bloggers and news reporters who write about them.

The hunt for Google Whacks just keeps getting harder and harder.

PS: Are you wondering what a Google Whack is? Visit http://www.googlewhack.com/rules.htm to find out.

Saturday, November 22, 2008

Identity Columns in MS SQL Server


Identity columns in MS SQL Server from Nitin Reddy on Vimeo.

Yet Another Deathcast

Abraham Biggs (alias CandyJunkie), a 19-year-old teenager from Florida, committed suicide last Wednesday while providing a live video feed via his webcam. The cause of his death was drug overdose.

A video of the incident can be found here.

Thursday, November 20, 2008

Software Engineering Conferences

International Conference on Software Engineering (ICSE)
http://www.icse-conferences.org/

Working IEEE/IFIP Conference on Software Architecture (WICSA)
http://www.wicsa.net/

Association for Computing Machinery: Special Interest Group on Software Engineering (ACM SigSoft)
http://www.sigsoft.org/

Working Conference on Reverse Engineering (WCRE)
http://swerl.tudelft.nl/wcre2008/

IEEE International Conference on Software Maintenance (ICSM)
http://www.icsm2008.org/

Themes in GMail

GMail has introduced a super-cool themes so you can customize the look of the interface. I particularly like the Ninja and the Graffiti themes. The Tea House theme require a really high resolution - my 1280x800 isn't enough and I have to scroll vertically to see the tea houses. Most of the themes work with just about any resolution though.

You can access the themes from the Themes tab under Settings.




Wednesday, November 19, 2008

Windows 2008 R2


Windows Server 2008 R2 Overview

From: aschek,
2 weeks ago


Windows Server 2008 R2 Overview
View SlideShare presentation or Upload your own. (tags: microsoft r2)






SlideShare Link

Javascript Libraries


JavaScript Library Overview

From: jeresig,
2 years ago


JavaScript Library Overview
View SlideShare presentation or Upload your own. (tags: dojo prototype)



JavaScript Library tutorial that I gave at the October 2007 Ajax Experience conference.



SlideShare Link

Monday, November 17, 2008

Multi-row INSERT

With SQL, we can SELECT, UPDATE and DELETE multiple rows simultaneously, but we can normally INSERT only one row at a time.

There ways around this, but they usually involve selecting a resultset and passing it to an INSERT statement like this:
INSERT INTO emp (id, ename)
SELECT 4567, 'nitin'
UNION ALL
SELECT 4568, 'naina'

With Microsoft SQL Server 2008, you can now insert multiple values with an INSERT statement. Example:
INSERT INTO emp (id, name) VALUES (4567, 'nitin') (4568, 'naina')

This ought to make help make applications more efficient as they can send multiple values in one go instead having to send data to the server one row at a time.

Will other database engines follow suit and adopt this syntax? Time will tell.

Windows Scheduler Task or Windows Service

I've noticed a lot of projects on which the developers add windows services when all they need is a console application running as a scheduled task (using the Windows task scheduler).

A windows service is a pretty good approach when you need to have something constantly running such as a network service to respond to client requests or a heartbeat service to check application health every couple of seconds.

However, if you've got a windows service running in the background waiting on a timer to execute some bit of code, then you might want to consider using a scheduled task. They're easier to debug, require less development effort and do their job reasonably well.

Sunday, November 16, 2008

DB Tables for Static Values? Puh-leez!

A couple of developers believe strongly that values for every dropdown list should come from the database, even if it's something like gender and marital status. I mean this is stuff that never changes - I wouldn't wake up to read the newspaper headline on a new gender being introduced unless I lived in mutant city at Chernobyl or Hiroshima.

In a traditional C program, you can use constants to keep track of the values for globally static data. For an ASP.NET application, it makes perfectly good sense to declaratively set the values in the dropdown lists. If you must keep the values as (numeric) IDs, you might as well use an enumeration. To support a null, you can either use nullable types (.NET 2.0 feature) or add a NotSpecified as the first enumeration value. If you have absolutely got to store values in the database, you could create a stored procedure that returns values from a temporary table or put together the values in a single dataset using SELECT and UNION. There's no use adding extra disk I/O or taking up cache space for something you know will absolutely never change!

Windows 2008 R2 to release in 2010

Microsoft plans to release Windows 2008 Release 2 in the year 2010. New features include HyperV 2.0 and Powershell 2.0. You can get more details about the release here

Saturday, November 15, 2008

ScreenCast: Schema Binding in MS SQL Server









Schema Binding in SQL Server from Nitin Reddy on Vimeo.

This is my 2nd attempt at creating a screencast for my blog. I made a couple of grammatical errors on the subtitles and the laptop's fan sound is annoying. I'll have those issues ironed out in my next screencast though so keep watching this blog for more coming your way.

Friday, November 14, 2008

More Efficient and Accurate Date-Time Data Types in MS SQL 2008

MS SQL Server 208 includes several new data types, one of which the the 'date' data type which occupies 4 bytes. Most applications that need to store only the date currently use the datetime data type which uses up 8 bytes.

Also available is the 'datetime2' data type which can store date & time with much more accuracy than the 'datetime' data type.

The date and time data types included with SQL Server 2008 are:
time, date, smalldatetime, datetime, datetime2, datetimeoffset

Wednesday, November 12, 2008

Remoting with .NET

Remoting simplies development of client-server or service-oriented applications greatly. To start off, you need an interface that declares all the methods that you would like to make available to the client application. This interface should ideally be placed in a client library that you can reference from both the server and the client application, but you can also define the interface in both applications.

Example: Interface (Server & Client)


namespace Sinkhole1
{
public interface IWiseMonk
{
int getSquare(int a);
}
}


We now need to define the class implements this interface.

Example. Service class (Server)


namespace Sinkhole1
{
[Serializable]
public class WiseMonk : MarshalByRefObject, IWiseMonk
{
public int getSquare(int a)
{
return a * a;
}
}
}


Next, we need to make a hosting application that can serve the requests of the client application. The end point for the service class needs to be defined. The server application should ideally be a Windows Service application, but can also be a console or windows forms application.

Example. Server application (Server)


namespace Sinkhole1
{
class Program
{
static void Main(string[] args)
{
RemotingConfiguration.ApplicationName = "WiseMonk";
WellKnownServiceTypeEntry wkste = new WellKnownServiceTypeEntry(typeof(WiseMonk), "MathEngine", WellKnownObjectMode.SingleCall);
RemotingConfiguration.RegisterWellKnownServiceType(wkste);

TcpChannel tch = new TcpChannel(109);
ChannelServices.RegisterChannel(tch, false);

//Keep the server waiting for client requests
Console.ReadLine();
}
}
}


The client application doesn't really have all that much to do - it needs to get an instance of the service object and make method calls.

Example. Client application (Client)


namespace SinkHole1Client
{
class Program
{
static void Main(string[] args)
{
IWiseMonk iwm = (IWiseMonk) Activator.GetObject(typeof(IWiseMonk), "tcp://localhost:109/WiseMonk/MathEngine");

Console.Write(iwm.getSquare(5));

Console.ReadLine();
}
}
}

Tuesday, November 11, 2008

Ubuntu 8.10 guest user

You've probably heard about the release on Ubuntu 8.10 (Intrepid Ibex) on 30th last month. Apart from a newer kernel and updated packages, the new release supports guest sessions that prevent users from writing to disk. I'll post more about it as soon as I get myself a copy of the DVD edition.

Sunday, November 9, 2008

MS SQL Views Don't Sort Data

If you're new to Microsoft SQL Server, one of the things that would bite you in the back is the ORDER BY clause within a view. SQL Server displays an error when you try to include an ORDER BY clause within the SQL statement used to define the view, but you can get around the warning by using the TOP 100 PERCENT clause. This, however, does not force SQL Server (2008) to order the data - the ORDER BY clause is simply used to determine which rows will be returned in the dataset.

It's probably Microsoft's way to put an end to developers' abuse of the sort functionality - sort the data once from a view, again in a subquery and finally in the select statement returning the final data.

Natural Joins - Still not in MS SQL Server

One of the coolest join options in Oracle is the Natural Join. Provided that the tables' columns were named such that the column name indicated which columns in two or more tables should be used for a join, it reduced the effort in writing SQL queries.

Instead of writing a:
SELECT ContactName, CityName
FROM Contact
JOIN City ON Contact.CityId = City.CityId
you could simply write:
SELECT ContactName, CityName
FROM Contact
NATURAL JOIN City

Considering how Microsoft has been trying to make development easier for software programmers, this is one feature that they ought to think about.

SQL Join and NULL Values

A common problem face by inexperienced SQL developers is in forming joins with tables containing NULL values. Let's take the following ContactInfo & City tables as an example:

ContactInfo columns:
ContactId INT
ContactName VARCHAR(50)
CityId INT

ContactInfo Data: { (1, 'Nitin', 1), {2, 'Reddy', NULL) }

City columns:
CityId INT
CityName VARCHAR(50)

City Data: { (1, 'Dubai') }

When joining the ContactInfo and the City tables, using the SQL statement
select * from ContactInfo
join City on ContactInfo.CityId = City.CityId
you would get only one row in the result: { (1, 'Nitin', 1) }

This occurs because the join removes the rows with NULL values as the expression from the join condition (NULL = 1) evaluates to false.

To retrieve data with the null values, the query has to be modified to:
select * from ContactInfo
left outer join City on ContactInfo.CityId = City.CityId

Saturday, November 8, 2008

Hosting Screencasts

If you've come up with a really cool screencast, hosting it would be a bit of a problem. Most video hosting services such as YouTube (the video upload feature on Blogger is, currently, very YouTube-like) limit the size of the video thus reducing the clarity, often making text unreadable.

However, there are services such as Vimeo and Screencast.com that are just perfect for sharing screencasts. They support much larger sizes for videos and are free to use. (Screencast.com limits you to 2GB of storage and 2GB of bandwidth for their free services)

Management Studio 2008 'dislikes' SQL 2005

The Microsoft SQL Server Management Studio 2008 included with the Microsoft SQL Server 2008 runs in a 'downgraded' mode when connecting to SQL Server 2005 & 2000, disabling the Intellisense. If you would like to have intellisense support with older versions of SQL Server, you could use the RedGate SQL Prompt.

Filestream storage in MS SQL Server 2008

You can store binary data to the filesystem using the Filestream attribute for a column with the Varbinary(max) data type. A standard Varbinary(max) column has a capacity of 2GB but using Filestream storage extends it to the file system volume size. Filestream data is stored in filestream file groups (they consist of data containers or file system directories). A backup of the database includes filestream data (use a partial backup that excludes the filestream file groups to avoid this). Using filestream storage also enables the use of Win32 interfaces to manipulate data. Deleting a row also removes the associated data from the filestream storage.

Filestream data is not encrypted and uses the system cache instead of the buffer pool. Filestream storage is not enabled by default.

The use of filestream storage is suggested for large (over 1MB) data; storing small amounts of data in the database provides better performance.

Note: When using failover clustering, the file groups must be on a shared storage medium.

MS SQL Server 2008 - Installation Incompatibilities

I installed the Microsoft SQL Server 2008 yesterday. The setup required me to get rid of the Express editions of Visual Studio 2008 as they weren't SP 1, but I didn't mind as I had the SP1 on Visual Studio Team Suite 2008. I also had to get rid of SQL Server 2005 Express Edition for the installation to continue. Oh well, out with the old stuff and in with the new.

The certification exams associated with MS SQL Server 2008 are 70-432 for DBAs and 70-433 for database developers. The one-exam certification makes it really attractive especially since they aren't forcing DBAs to turn into developers or vice versa to prepare for the exams.

Validation Application Block - Video

Check out this video demonstration on using the Validation Application Block from the Microsoft Enterprise Library. (Sorry, no sound)

video

Monday, November 3, 2008

Paste Table: MS IE for MS Excel

Have you ever tried to paste a table on a web page into an Excel sheet? If you use Microsoft Internet Explorer as your web browser, everything plays along nicely, but when you use Firefox instead you end up with a mess of data splashed against your worksheet in Excel.

On MacOS X, however, there are reports that Firefox is able to paste data into Excel while Safari is not.

I guess we should just post everything in XML to work across all combinations of browsers, spreadsheets and operating systems :-(

Sunday, November 2, 2008

ThreadAbort within an Event Handlers in ASP.NET

If you attach multiple event handlers to an event, the handlers are executed in the order in which they were attached. If an event handler appearing earlier causes a ThreadAbortException (such as when calling Response.Redirect), the later event handlers are skipped.

This is an issue when a button has an event handler on the page to navigate to another page but the event is also handled by user controls to save data. Just one of those not-so-common scenarios......