Ivan Porto Carrero

IO(thoughts) flatMap (_.propagandize)

04

Jan
2006

Got Added to the New Zealand User Group

I haven’t been posting much lately because I got pretty busy over the past few months and it looks like it isn’t going to change quickly either.

I got added to the new zealand .NET user group with this blog. and would like to thank nic wise for adding me. his blog can be found @ http://www.fastchicken.co.nz/blog

I decided together with 2 other guys to start writing a book about quick and simple programming using .NET 2 technology. And what better way is there than to write a fully working application for this.
The application that we will be writing will be a Forum engine à la Communityserver

The software will be developped under an open source license. I will be posting regularly articles about what I did and the controls I built. 

If somebody has a suggestion on features that are missing now in communityserver, or in other forum engines in general, now would be a good time to comment them in this post.

For the moment I am planning the rss engine.  I decided that I will just be supporting RSS 2.0 and Atom 1.0  as syndicators (OPML seems to be becoming pretty popular too, so maybe I will look at OPML as well).
The feed outputs will be kept as simple as possible (I think simple is good, the simpler it is the more programs will be able to read it even the poorly written ones.)

The aggregator used should be based on AJAX and if I feel really bored someday I will build a smart client to as an extension as well.

That’s all for now..

04

Jan
2006

Atlas New RC Build Released

There is a new Atlas RC available for download. 
This one has got really cool new features.  If you haven’t looked at atlas before you should look at it now.

AJAX just became as simple as 1-2-3.

Nikhil Kothari blogs about the new features :

A quick tour of Atlas December CTP :
http://www.nikhilk.net/AtlasM1.aspx

The role and functionality of the Atlas Scriptmanager :
http://www.nikhilk.net/AtlasScriptManager.aspx

That should get your appetite for AJAX going :-D

04

Jan
2006

A Good Url Regular Expression ?

I have been looking for a good first layer of validating an url to see if it is valid.

For checking the format of the url it seems to me to be the most logical approach to use regular expressions. Up until now I always discarded them as being to “geeky”, meaning i don’t consider it my life’s biggest goal to be typing (/?[]\w) all day long (so why did i become a programmer, aaaah yes to make life easier for other people)

Anyway.. to find a good regular expression to that validates urls not url domains. One that doesn’t allow spaces in the domainname and where the domain can be suffixed with the port number.  Also I need support for the ~/ paths

This is what I came up with.. if somebody as a better idea… or finds a mistake please let me know.. Always happy to learn something new.

^(((ht|f)tps?\:\/\/)|~/|/)?([a-zA-Z]{1}([\w-]+.)+([\w]{2,5})(:[\d]{1,5})?)/?(\w+.[\w]{3,4})?((\?\w+=\w+)?(&\w+=\w+)*)?

I was a bit quickly in using this regex. Simeon pilgrim indicated that the ftp urls won’t validate when you add a username and a password. 

I don’t really need to validate ftp so I should have removed the ftp protocol from the list of choices.  I need this just to validate urls for weblinks and the link element in an rss feed.  When I need them for ftp I will post the ftp version.. but for now I don’t have time to spend on elaborating the regex.

Anyway here is the right one : ^(http(s?)\:\/\/|~/|/)?([a-zA-Z]{1}([\w-]+.)+([\w]{2,5}))(:[\d]{1,5})?/?(\w+.[\w]{3,4})?((\?\w+=\w+)?(&\w+=\w+)*)?

A full url validation would include resolving names through dns or making a webrequest to the provided url to see if we get a 200 response. The only way to be sure is to test if it is there in my opinion.

Thanks Simeon.

And for those who really want the ftp validation : ^((ht|f)tp(s?)\:\/\/|~/|/)?([\w]+:\w+@)?([a-zA-Z]{1}([\w-]+.)+([\w]{2,5}))(:[\d]{1,5})?/?(\w+.[\w]{3,4})?((\?\w+=\w+)?(&\w+=\w+)*)?

I am not sure about numbers in the username but I believe you can have a username of numbers alone.

Comments don’t seem to work on this blog engine.. so just send me a mail through the contact form. thanks

Two days later …

I discovered there is still a problem with my regular expressions… folders don’t get parsed.
I’ve solved the path issue, so now it should be finding all url’s

Expression:
^((ht|f)tp(s?)\:\/\/|~/|/)?([\w]+:\w+@)?([a-zA-Z]{1}([\w-]+.)+([\w]{2,5}))(:[\d]{1,5})?((/?\w+/)+|/?)(\w+.[\w]{3,4})?((\?\w+=\w+)?(&\w+=\w+)*)?

Should parse the url below
http://hh-1hallo.msn.blabla.com:80800/test/test/test.aspx?dd=dd&id;=dki

But not :
http://hh-1hallo. msn.blablabla.com:80800/test/test.aspx?dd=dd&id;=dki

 

To top