mha.dk

Random thoughts of wisdom - the personal blog of Michael Holm Andersen

LINQ Standard Query Operators

Just a short note (while I wait for my rebuild/new PC to return home!) - Hooked on LINQ has put together a great list containing most of the Standard Query Operators in LINQ.

Take a closer look here: StandardQueryOperators

Using LINQ to join SQL table and in-memory collection

It's been on my TO DO list for quite some time now!! - "Upgrade the ASPNETHOTEL website!" .. So a couple of weeks ago, I decided to actually do something about it!

I'll be adding credit card payment, automatic retrival of customer address information, 3 different hosting plans, payment for 1-5 years with discount, a lot of minor changes, and last but not least - I've created a completely new design for the website.

The site will be build using VS2008, .NET 3.5 and LINQ. A couple of days ago I was working on the "domain check" functionality, which turned out to be a good opportunity to play around with some LINQ. Let me clarify:

I have a simple table in my database containing TLD (Top Level Domain, e.g. "dk", "com", etc.), prices and other stuff. When the user enters a domain (without TLD), I want to check wether the corresponding domains are free for registration. In order to check this, a call to the WhoIs server is made and a text string is returned (reply) and I determine wether the domain is available or not.

During the loop where I call the WhoIs servers, I add an item to a List of type domainInfo (below is a simplified version of the class):



The code for the List:



During the "WhoIs loop", I simply add an item the list:



Using LINQ, I can now join my SQL table (DomainPrices) with my in-memory collection (TLDs) and simply bind the result (domains) to a standard Repeater control:



That's it!! - It's that simple! .. I'm - far from it! - a LINQ expert, but the above example clearly show the benefits of being able to join SQL tables with in-memory collections (or what-ever you want to join!) - Just to be clear: I'm using LINQ to SQL to generate db.DomainPrices in the above example!

 

Debug with VS2008 and the .NET Framework Source Code

Microsoft have finally released the source code for the .NET framework v3.5, which makes it possible to debug the framework. Shawn Burke have written a detailed article about how to configure VS 2008. Please note that this functionality is not available in the Express versions of the Visual Studio 2008 products.

A new member of the family!

We've got a cat! - A small (1.3kg) total black "panther" with yellow eyes and an energy level one can only be envy of :-)

It's 3 months old (born 1st October) and is called "LuLu"

My wife's a geek!

 

Hanne bought a HTC Touch yesterday .. and now - eventhough I'm working at a mobile telephone company (Sonofon A/S) - she has a cooler phone that me (damn!)

She actually (at first) wanted an iPhone - but come on ... It's an Apple (need I say more! :-) 

The HTC Touch is really, really cool featuring both WiFi and Bluetooth. So she's able to surf using Internet Explorer at home really fast (for free!) and synchronize her Outlook contacts, tasks etc. using Bluetooth - it simply works!

Check the phone out at http://www.htctouch.com/ 

101 LINQ samples

I'm in the process of creating the next version of www.aspnethotel.dk using .NET v3.5, LINQ, AJAX / AJAX Control Toolkit and of course Visual Studio 2008 - the design is done and the database has been updated and LINQified :)

Anyway .. what I actually wanted to say was that if you're into LINQ, you should take a look at 101 LINQ Samples provided by Microsoft (thanks, Torben!)

Get Mobile!

I'm in the process of creating a "Mobile PC" using a 1GB USB key and my favorite applications. When I'm done I'll put the entire key on the blog for a free download. The plan is to have a USB key which I can use on any computer and still have all my favorite browser (and favorites), email etc. - If you think this sound interesting take a look at http://opera-usb.com/ and http://portableapps.com/

The above screenshot is Opera@USB v9.25 - The browser runs entirely from the USB key, no install or any other footprint left behind on the host PC.