Tuesday, January 1, 2008

Happy New Year

I would like to wish you all a Happy New Year with many more blog articles coming up on .NET, Java and technology in general. Looking forward to much better times ahead.

Saturday, December 29, 2007

VarArgs in Java 5

Introduced in Tiger (Java 1.5.0), variable arguments enables Java methods to accept a variable (0..*) number of arguments thus allowing users greater flexibility in passing calling methods, previously dealt with using arrays.

The last parameter in the list is defined with a "type ... variable_name" syntax (note the ellipsis).

Example:
private static int sum(int ... numbers) {
  int accum = 0;
  for (int i=0; i<numbers.length; i++) {
    accum += numbers[i];
  }
  return accum;
}

Implicit variable declaration in .NET 3.5

In C# 3 and Visual Basic 9, you can declare variables without having to specify the type of the variable. This isn't the same as the variant type in Visual Basic, but rather the compiler's ability to determine the type of the variable from the initialization value.

Here's how it works:
var i = 3; //C#
Dim i = 3 'VB

Using implicit declaration of variables requires you to specify a non-null value since a null only represents the generic object type.

EDIT: You can get the implicit declarations feature in LINQ projects (CTP) with Visual Studio 2005.

Friday, December 28, 2007

Google's 403 for View as HTML


Google is probably having to deal with a load on it's servers this holiday season and so they're restricting access to their "View as HTML" feature. The message displayed is:

We're sorry...

... but your query looks similar to automated requests from a computer virus or spyware application. To protect our users, we can't process your request right now.

We'll restore your access as quickly as possible, so try again soon. In the meantime, if you suspect that your computer or network has been infected, you might want to run a virus checker or spyware remover to make sure that your systems are free of viruses and other spurious software.

We apologize for the inconvenience, and hope we'll see you again on Google.

MacOS X's .DS_Store files

I noticed a couple of .DS_Store files appearing in some of the archives that I've been receiving and recognized them as MacOS X files used for display, much like the Windows thumbs.db (created to store thumbnails of files - check the "Do not cache thumbnails" in Tools > Folder Options > View). I looked up more info and here's what I came across:

Under Macintosh OSX .DS_Store holds the information which controls the way a folder will be opened; i.e., the shape and size of the window, the position of the window on the desktop and whether file, folder or icon view has been selected. If you were to delete the .DS_Store the folder would revert to the system default next time it is opened and a new blank .DS_Store would appear (invisibly).

You can disable the creation of .DS_Store files by MacOS X by running this command from the terminal window: defaults write com.apple.desktopservices DSDontWriteNetworkStores true

Tuesday, December 25, 2007

NetBeans 6.0 bug

Although I'm a fan of NetBeans because it's a simple IDE that runs with limited memory too, I must admit that it is quite buggy. One of the features of NetBeans is that it locks the GUI code so you can't accidentally break the GUI builder. I've tried Borland's JBuilder and breaking the GUI builder with custom code was one of the problems I came across. However, when NetBeans breaks itself, I can't get into the code to change it, which is one of the complaints that I have with the IDE. I wish it had a "hack-the-code" option where I could at least change the variable names - all I did was delete a menubar and add a new menubar... when I went into code view, it still had the old menubar and used the old menubar for the frame - the new one was an unused variable!

Anyway, I guess it's back to Wordpad for me.

Monday, December 24, 2007

Column-oriented vs Relational

Column-oriented databases are the next big thing for data warehouses, having passed through object databases for specialized applications. For a while, InterSystems Cache enjoyed the spotlight as a high performance object database. Now, Vertica is the hottest thing the database world has to offer as a column-oriented database.

Column-oriented databases store column-data as a contiguous sequence, as opposed to relational databases which store row-data in contiguous allocation units. This makes it simpler to make schema changes, and offered better performance for OLAP applications. Relational databases still are the best solution for general purpose OLTP applications so it isn't the end for them yet, although they were architected almost three decades ago.