CodeRush Express – Useful tool for C# developers in VS.NET 2K8

(I quote):

Developer Express and Microsoft are proud to announce a new version of CodeRush licensed exclusively for C# developers working in Visual Studio. The new product is called CodeRush Xpress, and it includes a fresh selection of hand-picked features taken from CodeRush and Refactor! Pro.

And I love it! It has very handy functions for refactoring your code very fast!

I recommend it for everyone!

Usefull links (both contain the downloads):

If you are interested in learning the features you can access these movies:

Dustin Campbell also presented a video on this tool, among other useful Visual Studio 2008 shortcuts  on PDC 2008, you can find it here (click below for wmv-hd download).

Java: casting Object to int

I found something odd when writing a Java program yesterday.

In a JTable you have an int to display (the amount ordered e.g.), but when getting the value of a cell you obviously get an Object, not an int.

In order to get the Object into an int variable, you might experience this issue:

//this does not works (obviously)
int element = this.jTableProducts.getElementAt(4, 4);

//this works! (obviously, Integer is a subclass of Object)
Integer element = (Integer)this.jTableProducts.getElementAt(4, 4);

//this odly enough does not works
int element = (int)this.jTableProducts.getElementAt(4, 4);

//but this works
int element = (Integer)this.jTableProducts.getElementAt(4, 4);

This is due the autoboxing of Integer to int (and vice versa).

MSDN downloading on Vista

Let’s say you are one of the gifted persons to have MSDN access.

Let’s say you use Vista 64-bit (I don’t know if the problem occurs on 32-bit).

Let’s say you want to download something from MSDN with Microsoft File Transfer Manager.

And it does not work.

Well use this workaround:

First: download the File Transfer Manager from here.

Download and install the MSI. The default path is c:\Program Files (x86)\Microsoft File Transfer Manager”. Remember this.

Then use Firefox to go to the MSDN website, start a download, and it will prompt you to do something with the default.aspx. Well open that file with the File Transfer Manager. And it works!

Woei!

AVG 8 update marks user32.dll as False Positive on XP SP2

DO NOT REMOVE user32.dll, even though AVG 8 states that there is a virus in the file.

Doing so will remove the file, and cause a BSOD, and makes your system unable to boot.

It marks the file as infected with Trojan Horse PSW.BANKER4.APSA.

Possibilities are to wait for an update from AVG, or (preferably) upgrade to XP SP3!

Java: My FileFilter implementation

This is my javax.swing.filechooser.FileFilter implementation (for the JFileChooser):

FileFilter fileFilter = new FileFilter()
{
	@Override
	public boolean accept(File file)
	{
		return file.getAbsolutePath().endsWith(".xml") || file.isDirectory();
	}

	@Override
	public String getDescription()
	{
		return "xml settings files";
	}
};

It accepts .xml files, but allows browsing through directories

SQL Server 2008 Express Edition + Visual Studio 2008 x64 User instance problems.

As described in this connect article there is an issue with the integration of SQL Server 2008 Express Edition ans Visual Studio 2008 if you are running on an x64 system (the OS itself! Not runing 32-bit Vista on a Core 2 Duo) (although some report this bug on a 32-bit OS).

This issue is currently unresolved, but you still can open the database in the server explorer if (and only if) you modify the connection string NOT to use a User Instance.

You can do this by rightclicking the database in the server explorer, modify connection and set ‘User Instance’ to ‘False’ (last item)

User Instances are not allowed anymore since SQL Server 2008, as described here.

In order to make it work as it should be you can either install a 32bit SQL Server 2008 Express (which I do) or do as described here.

Update: Back to SQL Server 2005 Express Edition, all the rest fails as described.

SQL Server Management Studio Express 2005 Security Error (29506)

Should you ever want to install SQL Server Management Studio Express 2005 you MUST run it as Administrator.

When you try to install it on Vista (by double clicking the .exe) it extracts the files to a temp folder.

Then it launches the setup, asking you some questions. After that UAC asks you to gain Administrative access.

No problem so far, but at the end the installer notifies you of error number 29506, it cannot modify the security properties.

Solution is described here, run the installer as Administrator from cmd.