Compiled Option In RegEx

There seems to be a bug in .NET RegEx for Windows Vista 64 when using RegexOptions.Compiled option.

Regex rex = new Regex(pattern, RegexOptions.Compiled);

If the pattern is a really big string then the actual compilation will get stuck in an infinite loop. I tried with a RegEx that took 20 ms to compile on Windows XP 32 bit, that froze the entire program on Vista 64 bit. I killed the process after 5+ minutes. It had then consumed 300 mb of memory.

Removing the Compiled option made the it run as usual with no delay. It did not happen on Vista 32 bit.

Tried this in framework 2.0, 3.0 and 3.5 with same results.

GetHostEntry.AddressList

The common solution seems to be extracting element 0 and use that:

_Socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
_EndPoint = new IPEndPoint(Dns.GetHostEntry(host).AddressList(0), Port);


This causes a SocketException when trying to use "localhost" in Windows Vista and Windows 7. The reason is that the first element is not of type InterNetwork. The cause is probably ipv6 but I've not investigated it further.

Assuming element 0 is a valid address without checking the other seems like a bad idea for anyone.


Here is my solution:

private IPAddress GetIPAddress(string host)
{
    foreach (IPAddress addr in Dns.GetHostEntry(host).AddressList) {
        if (addr.AddressFamily == AddressFamily.InterNetwork) {
            return addr;
        }
    }
   
    throw new SystemException("Invalid hostname.");
}
_Socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
_EndPoint = new IPEndPoint(GetIPAddress(host), port);

Convert to VB.NET and back

I may post code for both C# and VB.NET. If you would like to easily convert between the two I recommend this site: http://www.developerfusion.com/tools/convert/csharp-to-vb/

Syntax Highlighter

http://alexgorbatchev.com/wiki/SyntaxHighlighter

That's what I use.

First!

I've been thinking about sharing my .NET solutions and thoughts for a while. So I decided to create this blogg. I'll write a little about myself once some material are in. Welcome!

About Me

Resume

Conny Wallström
Age: 31
Location: Gothenburg, Sweden


E-Mail: conny.wallstrom@gmail.com

Contact me on e-mail for additional contact details.


I am an experienced software developer that has worked professionally for 12 years. I am mostly self-educated, with computers and programming having been my main focus for as long as I can remember. I am an optimist and pride myself on finding solutions where others may only see problems. I am a fast learner, a team player and I love challenges and opportunities for personal and professional growth. Swedish is my native language but I speak and write English fluently.

Other interests include marial arts training and instruction, professional dj'ing, and fishing.


Areas of Expertise

Programming languages
C#, VB.NET, C, C++, Objective-C, JavaScript, ASP, ASP.NET, Perl, PHP, DHTML, PL-SQL, T-SQL, LUA

Operating Systems
Windows 9X/XP/Vista/7, Server NT/2000/2003/2008, OSX, HPUX, Solaris, FreeBSD, Linux

Databases
Microsoft SQL Server 97/2003/2005/2008, Oracle 8/9/10i, MySQL, SQLite

Design
Adobe Photoshop, Adobe InDesign

Planning
Microsoft Project, Microsoft Visio

Methodology
Scrum, XP, GTD


Experience

2007 - Manifact AB Chief of Development/Software Engineer
As one-time part owner of Manifact AB I focused mostly on software engineering. Manifact's two main products are Pitstop, a software efficiency solution for factory maintenance and changeover, and Commander, which is an advanced workflow and ticket management system for the web.
http://www.manifact.com/

2005 - Lindex IT DBA/Project Manager
Along with a partner, I was responsible for implementation and maintenance of the central warehouse databases (Oracle) for all of Lindex. I was also a project manager for technical requirements of the e-commerce venture (rfp).
http://www.lindex.se/

2003 - Freelance Consulting
For two years I ran my own consulting company full-time and worked on a large variety of projects for various companies. These projects included design-work for an advertizing agency called Art Connection, an intranet and website for a newly-started company that rented movies on the internet, and later on in 2007, software development for another company that rents movies through vending machines.
http://www.artcon.se/
http://www.instantdvd.se/

2001 - Qondoc AB Software Developer
Qondoc develops software for IT-documentation. Among other duties, I was responsible for developing advanced software agents to automatically collect data in the networks.
http://www.qondoc.se/

1999 - Sigma eHandel AB Software Developer/Project Manager
During my time as a consultant for Sigma I helped start a large number of the leading e-commerce websites in Sweden. I was often the lead technician and was responsible for project guidelines.
http://www.sigma.se/

Websites included:
http://www.netonnet.se/
http://www.ginza.se/
http://www.ellos.se/
http://www.elektroskandia.se/

1997 - Alingsås Kommun ICT-Coordinator
After completing high school I started working for the local municipality. Responsibilities ranged from workstation installations to network installation, administration and more.
http://www.alingsas.se/


Personal Projects

Genie Client
Genie is an extremely advanced multi-threaded MUD text-based game client geared towards games developed by play.net. Among other advancements, Genie has its own script language, plugin interface and window skinning. I started this project in 2003 and everything is my own creation. It is an immensely popular client with a large user base.
http://www.genieclient.com/

Budvakt
This project launched in May of 2009. It is an auction sniper software for a Swedish website called Tradera.
http://www.budvakt.com/

Time Beacon
This software is my latest creation and has yet to be launched. It is an automatic time tracker, productivity monitor, and statistics engine. Its main purpose is to create accurate time sheets effortlessly.
http://www.timebeacon.com/

Simon Lau Centre Website
I created a quick design and CMS for the martial arts club where I train and teach.
http://www.simonlaucentre.org/


References

Available upon request.