Convert a string to an enumerated (enum) value.

Another cool tip from Mark Wagner: Convert a string to an enumerated (enum) value.

Using the Enum.Parse method, you can easily convert a string value to an enumerated value. Doing this requires the type of the enum and string value. Adding the true argument will cause the case to be ignored.

Using the following enum for this example:

private enum Aircraft{ Beech, Cessna, Piper}

You can easily convert the string to an enum value like this:

Aircraft air = (Aircraft) Enum.Parse(typeof(Aircraft), “Cessna”, true);

Ideally you should wrap a try-catch around the Enum.Parse statement.

I can use with something that I’m working on now…

SqlDataReader performance tips

SqlDataReader performance tips

Some quick and easy performance tips for ADO.NET, courtesy of Adam Machanic.

He talks about calling GetOrdinal before looping through a DataReader. We do the same thing with classic ADO in Delphi when we need to optimize the scrolling through a recordset.

The other tip is to use static cases instead of Get

Roman Rehak commented with the tip to always close the explicitly connection when you are done with the reader.

FBI show how to crack a WLAN in 3 minutes.

At a recent ISSA meeting, a team of FBI agents demonstated how to crack the 128 bit WEP encryption used by wireless routers. They used freely available tools and accomplished their task in about 3 minutes. Over at Tom’s networking, they have an article that covers how the FBI did this in great detail.

It time to run the firewalls on the computers behind the router. I want a tool that can tell me if someone is trying to hack into my network.