Thursday, June 10, 2004

.Stories of a .NET Newbie (1)

Lately I've been doing some development in VS.NET 2003 every day now, so I thought I 'd start writing about it. There's just so much things to the language, and almost everything I do in the wonderfully overloaded IDE is new for me. It feels kind of 'fresh' for me after working for years with Visual Studio 6. Well, let's not spend too much words here, just give it a start.

1) This morning I realised I opened a Web Project on the local disk, which is not very good in case it's crashing. To overcome file loss, I sometimes do things like zip directories and place the zips on a network drive, labeled with some identifier (mostly the current date). But I figured there should be some option to transfer all a solution's files to another drive.
My eye immediately fell on the / Projects / Projectname Properties menu option. There you find an option 'file share', which can be changed. It was no problem to change it. However the next time I opened VS.NET I got a 'Web Access Failed' complaint from the system about localhost/webproject1 and this file share not matching. Well, I can imagine that. But how have the virtual directory point to the new location. Or rather, would I be able to do that: will that be enough and will I be out of additional problems... first lemme put the original File Share location back, to get back to the initial -working- setup.
There is a more general IDE wide option under / Tools / Options / Projects / Web Projects where you can change "Offline Projects" which is the location of the web project cache. Unfortunately, not everything is cached there, I only found some dll's, resource and debug data. No source code, which is my only interest. So out of luck again.
Then: let's just copy the projects' files over to the network location and create a fresh blank solution to which you add this project. This in turn yielded the error "the web server reported the following error when attempting to create or open the web project located at the following url: 'http://webserver:/WebProject1'. A connection with the server could not be established'. Well, for the time being I give up.
2) Markus Renschler's Rexexp Builder I needed something to get my regexes correct. I'm a total Regex n00b, and I don't have the time to become an expert in it. Only need them every now and then. But still, it's *very* difficult to produce even the simplest of expressions when you're not at ease with the syntax. What I needed was a check on a username being entered into a Web Form: it should only contain letters (small and/or CAPITAL). So I though it should be something like [azAZ]. Well, in the end it turned out to be ^[a-zA-z]+$ Which is not something the builder will come up with on it's own, but it's still a very convenient tool to quickly check some expression. Otherwise I would have had to change it in the IDE, rebuild the Solution and check on the web page whether it worked (And before you complain: I'm not using Unit Tests -so far-, making NUnit not an option here)
Last minute note: Chris Sells has a real RegEx builder tool which is a little bit more elaborate: after creating a regexp you can also generate VB/C# code for including the specific exp in your own application; handy