Archive for the 'Main' Category

13FebIntentional programming

This is a great read. It’s a really long article but i found it really interesting and continued it to the end (which is very very rare in my case)

It’s about Charles Simonyi and what he has been up to in his carreer plus his plans for the future.

Charles Simonyi–Microsoft’s former chief architect, the tutelary genius behind its most famous applications, the inventor of the method of writing code that the company’s programmers have used for 25 years, and now the proponent of an ambitious project to reprogram software

http://www.technologyreview.com/Infotech/18047

01MarFTP Server with sql acces

I have the need to run an ftp server for one of my applications. It is to complement a web application where there is a pretty big datatransfer.  Users need to be able to register and upon activation they need to be able to upload movies (20-70MB) to a folder online. These movies need to be made available online and proposed for review to somebody in the company.

So far so good. Were it not that we are running IIS Ftp server for the moment who stores it’s users in the AD of the server. That is not the place where I want to store credentials for my users. Also I wanted to make only one folder available for a user and to accomplish this IIS is just too difficult to manage.  Thus again time for an internet hunt and yessss there is is Blackmoon FTP server who allows to do the entire configuration in a sql database or an access database. 

Fits like a glove in my opinion :)
I downloaded it, installed it end yes it just works. I can now do the full configuration through the generated DAL from ORM.NET. All it took to integrate an FTP server in my application was one afternoon and that’s it.

You can download blackmoon from their site. They offer a free version for personal use. But even from the enterprise edition with domain license you won’t become  poor man :)
http://www.blackmoonftpserver.com

01MarA poor man’s code generation

There has been a lot of talk about code generation and ORM software around where I was.

I got curious and embarked on a free codegeneration exploration. Being new to the concept of codegeneration my requirements were the following :

  • It needs to be faster then the dataset generator of visual studio 2005
  • It needs to support relations
  • It needs to support stored procedures or at the very least use dynamic query language that uses parameters to set up queries to the database.
  • It needs to be with a very very fast learning curve.
  • It needs to be free (although I also looked at the wilson O/R mapper which is practically free and LLBL codegen which is definetely not free)

These are my findings :

The one that is most easily found is mygeneration with the dOOdads architecture out of the box. Of course you can create your own templates to customize the generated code to you your specific needs and architecture.
my generation can be found at : http://www.mygenerationsoftware.com/portal/default.aspx
It does work fine but the dOOdads architecture does not support relations and these you have to make yourself again.  I found it all a bit too much fiddling about and it didn’t meet my 2 of my requirements, thus the search went on.

Next I found ORM.NET, which is the one I am using for the moment. Total setup time of a DAL that is easily queried 1,5 min flat. I was impressed, and best of all it is completely free. Apparently it is written by a consulting firm that used it for their internal needs. They no longer support it and it turned open source.
ORM.NET gets my stars. And I will be using it a lot in simpler scenario’s like websites etc.
ORM.NET can be found at : http://www.olero.com/OrmWeb/index.aspx?p=ORM.ascx

While looking for some documentation on ORM.NET I came across a link to ntiergen.net which can handle about any job. It generates stored procedures for you, along the DAL and the needed classes. You get to configure all your stored procedures beforehand and get the opportunity to create views and complicated queries through their interface.  Normally it is priced at $449 but the link I found offers a fully functional licensed version open for the public. I downloaded it and just gave it a brief look as I am very pressed for time at the moment.
nTierGen.NET can be found at http://weblogs.asp.net/gavinjoyce/archive/2004/08/28/222017.aspx

Happy code generating !!!

 

26FebSeems like work isn’t slowing down for the moment

I thought I was busy before I got this thing on my hand.   Now it’s even worse. 
I don’t know where to crawl first.

I got my MYOB professional partner subscription last week and am trying to integrate it now in the program I’m writing.  And I have to say.. It’s not all that hard.. just open the docs and you’re good to go.

But what annoys the hell out of me, apart from not being able to run myob on a win2k3 server, is that myob is slow as a dog.  A request can easily take up to 30 seconds to complete. This gives me an excuse to delve into the async pattern. It appeals a lot to me.. but seens as I ‘m always pressed for time I don’t get to experiment all that often.. But this problem does give me the necessity to do it.

Maybe I will post my findings later.  If the async pattern doesn’t give me a good viable solution to my problem I have another way of going about it.  SQL server 2005 supports managed code, which we are all very aware off, so  I can reference and consume a webservice and stick all the myob datatable queries in a sql db as xml, index it and it is also searchable.

But first let’s get to the async pattern..

08JanCan’t remember the connection string ?

There is a website out there that remembers them for you. I’ve used them on multiple occasions because my memory for these things seems to be in need of a reboot

Anyway here’s the url : http://www.connectionstrings.com/

04JanA 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

 

04JanValidation of viewstate failed.

This happens when you want to enable your security to encrypt your password and enable password retrieval.

If you set your own machinekey.

My fix was in the web.config :

<

pages enableViewStateMac=true viewStateEncryptionMode=Always>pages>

<

membership defaultProvider=SqlMembershipProvider hashAlgorithmType=SHA1>
    <
providers>
   providers>
membership>

<

machineKey validation=SHA1 validationKey=8EF2706A98DAB8DFD9DED53180A02BD172A45586AACD63500D5290CF44BACCC1697F402AE0F5D734940BD19BB98A6EBBE788E943B7293E6356B25B00DF2891FB,IsolateApps decryption=AES decryptionKey=8F103358F65FD53132A2856C8BAC9273AA92493D5570945EC74C5856B626BB66,IsolateApps/>

04JanWebresource.axd. How do I use it ???

Ever since I got my hands on .NET 2.0 I noticed the handler webresource.axd which seemed to provide a similar function as what I was using handlers for. 

I used handlers in .NET 1.1 and before today also in .NET 2.0 to handle my javascript and css that I need in controls I developped.
I mark them before compiling as embedded resource and then later on read them out via reflection and they get served up by the browser.

I probably don’t have to explain that (as long as your parameters don’t change) this scripts get cached by the browser so they will only be downloaded once and re-used afterwards.

Well in asp.NET 2.0 there is a feature that uses webresource.axd to handle all kinds of embedded resources (images, pages, etc…)

Nikhil Kothari has a post on how to use them in his blog, and I just copy pasted the text below.

Using Web Resources
Imagine I am writing an HtmlEditor control and I want to use a stock bold button icon. Here’s what I’d do:

  1. Embed “Bold.gif” as a resource with the same name into my control’s assembly.
  2. Mark it as Web-accessible via the attribute:
        [assembly: WebResource("Bold.gif", ContentType.ImageGif)]
  3. Use the GetWebResourceUrl() method on Page to get a URL that can be rendered out to the client.
        boldButton.ImageUrl = Page.GetWebResourceUrl(typeof(HtmlEditor), "Bold.gif");

This results in a URL of the form:
    WebResource.axd?a=MyControls&r=Bold.gif&t=632059604175183419

04JanA clear explanation of generics in c# 2.0

http://www.ondotnet.com/pub/a/dotnet/2004/05/17/liberty.html?page=2

04JanMS Antispyware doesn’t do its job

I had a discussion with my friend Miel (Coolz0r) about spyware and their scanners for it. 6 months ago I did a test of several anti-spyware programs and MS antispyware became the winner. It found the most spyware and what I liked most about it was that it provide everything that Ad-aware and Spybot supplied all together. This and the spynet option.  But in 6 months a lot can change and now I have whenU on my machine together with some other heavy duty spyware.  More on the reasons for this you can find in the link below

http://blog.coolz0r.com/posted/microsoft-antispy-downgrades-claria-apps.html

So the search for a good, free spyware cleaner goes on … I’ll post more when I’ve found one.  If anybody has a recommendation please let me know, because spyware me-no-like.


Recent Flickrs

    Blogroll

    Recent Listening

    Scrobbler