mha.dk

Random thoughts of wisdom - the personal blog of Michael Holm Andersen

Visual Studio Vibrant Ink Scheme

A while ago I read an article called Join the Dark Side of Visual Studio about the colours used in the Visual Studio IDE, however I found the colour-scheme of Infinities Loop a bit too dark.

But last week I stumbled upon this article about using the Textmate Vibrant Ink colours in the Visual Studio IDE. I admit, it takes a couple of days to get used to, but after having used these colours for about a week now, I really like it and find it to be easier on the eyes. Scott Hanselman also has an article about black vs. white and Jeff Atwood have written an article about Code Colorizing and Readability

So give the "dark side" a try and download the Visual Studio Vibrant Ink Scheme created by Maruis Marais: Vibrant-Ink.rar (2.15 kb)

Create virtual machines for VMware Player

EasyVMX! is the simple and failsafe way to create complete virtual machines for VMware Player on the web. You can install any Windows, Linux, BSD or Solaris, and test LiveCDs in a safe environment.

Simply use EasyVMX 2.0 and enter the configuration you need, click "create" and you have a .zip file containing your new virtual machine ready for download - it's awesome! :-)

You might aslso want to check out this VMware Mount Utility 

Force Firefox to be default browser

I had a weird problem the other day. Eventhough I clicked the "Make default browser" inside Firefox nothing happend (this occured after installing the Maxthon2 browser) - so I had run this command: 

firefox.exe -silent -nosplash -setDefaultBrowser


Which solved the problem - Now links in mails (in Outlook) actually opens in Firefox again - nice!

 

top 300 free software

WinAddons.com have compiled a list of the top 300 freeware software for Windows - check it out, lot's of good stuff.

Protect your privacy!

A couple of days ago (on the 15th september), the danish government launched a new law which forces tele communication companies and ISP's in Denmark to log all calls and Internet activity (not the content, just date/time, phone number, URLs, IP).

Eventhought it has been stated again and again, by many organizations/people in Denmark, that this logging is easy to overcome/bypass it is now in effect. 

If you're a dane and you want to protect your privacy I recommend you download PROSAs Polippix which is a CD (ISO file) containing software to protect you (aka cover your tracks) from any logging what-so-ever. The CD contains a lot of software (e.g. TOR, MAC-Changer). You can read a brief description of the software on the CD at IT-Politisk Forening (danish) .. so hurry up, go "undercover", protect your privacy and fight the evil forces of logging :-) 

If you're lazy, you can simply use encrypted mail, e.g. Gmail which uses standard 128bit encryption or/and Skype which also supports encryption.

World Flag Database

Ever needed an image of a flag (for a website, maybe!? :-) - Well, look no furhter - the www.flags.net website contains multiple images for any flag you can think of. 

Formatting cheat sheets

We all use ToString(), String.Format() etc. to output strings, however figuring out all those different formats is a struggle - luckily John Sheehan has put together a C# / VB.NET Formatting cheat sheet (PDF) which is available for download: msnet-formatting-strings.pdf (123.71 kb)

Using Oracle with ASP.NET

I've been using Oracle in a ASP.NET 2.0 Web Application for the first time, and I must say it's a bit different that using Microsoft SQL Server. I've been through quite a bit of trial-and-error, and for those of you who are planning to use Oracle as the backend data in your .NET application, the following tips might be very useful:

Use SqlDataSource
Some articles state that using the SqlDataSource object is not working properly, however I had only a few (see below) problems using both static and dynamic SqlDataSources. The SqlDataSource can of course be used as datasource against GridView, Repeaters and other data-binding controls.  


Use dynamic SqlDataSource's if you need to change Connection String

It seems (at least in my environment) that the Oracle Client or .NET (or perhaps due to Connection Pooling ?!) cache the Connection. I needed to change the credentials for the current connection, however simply changing the ConnectionString property for a static SqlDataSource did'nt have any effect. The code run without errors, but when I checked which credentials the query actually used, it was the old values (the ones used when the SqlDataSource object was created). So I had to create my SqlDataSource programmatically like this:

SqlDataSource SqlDataSource1;
string connString = "Data Source=XX;Persist Security Info=True;User ID=ZZ;Password=ABC;Unicode=True;";
string providerName = "System.Data.OracleClient";
SqlDataSource1 = new SqlDataSource(providerName, connString, "");


AutoCommit might be necessary
Using a static declared SqlDataSource I had to use "Autocommit=true" in my ConnectionString in order to persist (commit) my changes to the database, e.g.:

string connString = "Data Source=XX;Persist Security Info=True;User ID=YY;Password=ZZ;Unicode=True;Autocommit=True";


Use to_date in your SQL

As my application is a kind of "generic table editor" all SQL is actually generated at run-time (against any table the current user has access to). This caused some problems, especially with dates in different formats. I ended up using the Oracle "to_date" function in order to explicit tell Oracle the format - here's a simplified example of how my code looks like:

protected string ConvertToExplicitOracleDate(string value)
{
    IFormatProvider ci = new System.Globalization.CultureInfo("en-US", true);
    DateTime dt;

    if (DateTime.TryParseExact(value, "dd-MM-yyyy HH:mm:ss", ci, System.Globalization.DateTimeStyles.None, out dt))
    {
         value = "to_date('" + dt.ToString("dd-MM-yyyy HH:mm:ss", ci) + "', 'dd-mm-yyyy hh24:mi:ss'), ";
    }

    return value;
}


Alter Session is ignored

Oracle has a command called "Alter Session" which may be used to change the values of NLS parameters at run-time. However I never got this to work, instead I used the Oracle to_date and to_number as mentioned above.

New blog-engine

I've switched from Presstopia to BlogEngine.NET - This is another great free .NET project, which is also to be found at CodePlex.

The blog is 100% XML-based (no need for a SQL Server) and has tons of features - which of course includes a great comments system and the possibility to rate every post - so comments are welcome... Enjoy!  :-)

Ultimate Tool List for Windows

Scott Hanselman's has put together a very comprehensive list together - he calles it The Ultimate Developer and Power Users Tool List for Windows 2007 - Be sure to check it out as there's a lot of good (free) stuff...