Archive for March, 2007
Posted: 29th March 2007
Tags: .Net, AJAX, dotnet, Javascript
Posted in Misc..
Comments: No Comments »
Contrary to the advise I have received from several fellow developers (and never being one to miss a challenge), I have decided to ignore all advise and attempt to use the Microsoft Ajax framework with my current .Net project for TktIt.com. The MS Ajax Frawework is extended to provide functionality such as Autocomplete etc using the AjaxToolKit. Although a lot of these are excellent, (like the pop-up calendar control) the Autocomplete feature is poor compared to many others out there. However, thanks to Tim Shankarian, it has got a little better!
Read the rest of this article »
Posted: 22nd March 2007
Tags: .Net, AJAX, dotnet, Javascript
Posted in Javascript
Comments: 1 Comment »
JQuery is an excellent easy to use Javascript Framework and has several excellent plugins, one of which is the Interface plug-in by Stefan Petre which provides lots of effects and features. One such feature is the autocomplete feature, which provides suggestions as the user types into a text box. Unfortunately the Interface plugin’s documentation does not cover how to implement the server side, which I will cover in this article.
Read the rest of this article »
Posted: 14th March 2007
Tags: .Net, apple, dotnet, mac os x, OS X
Posted in Misc..
Comments: 1 Comment »
As a .Net developer, I am probably the last sort of person that would leave the world of Microsoft Windows based PCs in favor of an Apple Mac. But I have successfully made the transition and wanted to share my experiences with any other .Net / would be Apple fans.
I had been deliberating for a good year whether to buy a mac or not. I originally had no intention of leaving my PC altogether and though that it would be nice to have a Mac (maybe a Mac Mini) for the more creative / design aspects of my work. But now, having used a Mac for the design side it is true that the Mac fits the design role better than a PC, for a start the operating system is beautifully designed and therefore inspires the same in your own work. On top of that it displays colour more accurately and printed material looks the same colour as it does on screen. Other features just make working faster such as when clicking the middle mighty mouse button accesses Exposé, which allows very rapid switching between programs. Dragging files around is a joy, you automatically drill down into directories as you hover over icons and the list goes on. To the point, in fact, that I can’t go back, I have sold my PC and am based 100% on Macs. So where does that leave me as a .Net developer.
Well thanks to the Intel processors in Macs, running windows when needed is a breeze, in fact I would swear in runs Windows faster than on my PC, even in Parallels (virtualisation software like Virtual PC or VMWare but that can display running applications on the Mac OS desktop rather than within a host window). Once Parallels is running, when I open Visual Studio 2005 Professional it seems to open instantly and is very workable, even on my MacBook. So now I can design my web sites’ look and feel in Mac OS X and then when ready to code in asp.net, boot up Parallels and work in Windows giving me the best of both worlds.
The transition wasn’t as easy as Apple like to make out. For a start you have to look at computing in a new way. When George Cook, a friend of mine who also recently made the jump, advised me to switch to Mac, he described the problems I encountered “like the matrix, your eyes are open but you are not seeing”. Which is very true when you switch to Mac OS X you have to stop treating it like a PC. For example, with Mac OS X when you click the red X in a window’s title bar, you don’t actually close the application, just the window, which can be very confusing for a windows user and your first reaction may be to try and kill it (either by pressing Apple-Q or by holding the mouse button over it’s icon in the launcher and selecting quit), but you don’t need to. This is Mac OS X and it is designed to have these applications left running. So for example when you next open iTunes, Firefox etc they open instantly, and amazingly it does not seem to impact performance (Although iPhoto seems to struggle). Getting emails over from Outlook on my PC was a challenge but I succeeded in the end (using IMAP) but in the end it has all been worth it and I have not looked back.
So I can recommend to anyone who would like to go Mac but feel that cannot as they are .Net developers, to go for it. I have had no regrets and for any Windows only software you can just boot into Parallels. I recommend you still keep your Windows copy of Microsoft Office on your Parallels based Windows, as Mac Office 2004 is not designed for Intel Macs so crawls along. Also there does not seem to be an official port of OpenOffice to Mac OS X but Neo Office is not bad if you really don’t want to run office in a virtual machine.
Posted: 9th March 2007
Tags: .Net, dotnet
Posted in Misc..
Comments: 4 Comments »
In my previous article I covered how to setup an XML-RPC server in .Net, in particular looking at how to service XML-RPC MetaWebLog API requests. In this second part I am looking at how we can easily construct an XML-RPC client to ping blog directory or search services such as Technorati, Google BlogSearch, blo.gs etc.
Read the rest of this article »
Posted: 3rd March 2007
Tags: .Net, dotnet
Posted in Misc..
Comments: 1 Comment »
I have recently be working on a project which needed to implement the blogging MetaWebLog API, allowing users to post blog messages from their favorite blog editor, such as Windows Live Writer or blog directly from MetaWebLog API enabled websites such as Flickr or Digg. My tutorial below will show you how to easily create or consume an XML-RPC service such as the MetaWebLog API.
Read the rest of this article »
Posted: 1st March 2007
Tags: .Net, dotnet
Posted in Misc..
Comments: No Comments »
I have been recently getting into Ruby on Rails and wanted to share my experiences of applying a similar philosophy to ASP.Net development. One of the core principles of RoR is based on the development of dynamic websites around the Model, View, Controller Methodology. This gives a clean code separation and by following this convention we reduce the risk of duplication and always know where to look for a certain bit of functionality.
Ruby on Rails is based on the MCV model and implements it cleanly out of the box. ASP.Net is not designed around this, so we have to take a slightly different view of our ASP.Net projects to achieve the same thing.
For this approach, I am making use of the SubSonic ActionPack (Zero Code DAL). If you do not know, or have not used SubSonic before, I cannot stress enough how useful this components is. Once SubSonic is setup correctly and pointing at your database. You simply run an .aspx page that generates classes for the selected tables in your database. This allows you then to access information in the database as if a member of a class. Effectively SubSonic is a self-building Object Relational Model (ORM).
View
The View of the MVC model is as you would expect, the .apsx page itself. To follow the model other than JavaScript, etc, avoid .Net coding in this file and keep it cleanly in the code-behind page.
Controller
In the MVC model, the controller deals with the interaction between the view that the user interacts with and the model, that contains are business logic. In here our event handlers, such as button1.click etc are handled as normal, however I stress these event handlers should not contain any business logic. Instead purely use code here to control the view. For example, in here you would call the Model to get you the required information to populate to a GridView and simple databind that data. The business logic to get the required information (for example all products of a certain category) is stored in your Model.
Model
To implement the Model in the MVC model, we need to create our own classes for this. I like to group all functions that relate to a certain theme in one class or model. Using our examples of Products, I would create a ProductModel.cs file and store all my functions such as the above GetProductsByCategory() method.
By doing this I can change the business logic at any time without having to worry about which ASP.Net code behind pages I have accessed the products table from.
To show you the simplicity of SubSonic, to access the Products by a certain category we could define the following:
public static ProductCollection GetProductsByCategory(string category) { SubSonic.Query query = Product.CreateQuery(); query.AddWhere(Products.Columns.Category, category); ProductCollection pc = new ProductCollection(); pc.Load(query.ExecuteReader()); return pc; }
That’s it no SQL, no worries, the ProductCollection, SubSonic.Query and Product classes are all generated for us by SubSonic.
SubSonic DAL/ORM
The pink classes on the diagram labeled SubSonic ActionPack are created for us and automatically built around our pre-designed database.
Helper Files
Finally the helper files are classes created by us to contain methods that we regularly use throughout our application. For example, a method to strip HTML from a string. I normally name these with Helper in the name to distinguish them from my Models and SubSonic classes.
So as you can see it is fairly easy to take the MVC approach when building a Web Application in ASP.Net. The core engine behind this is the SubSonic ActionPack which really makes all the difference.

![[image]](http://mowser.com/img?url=http%3A%2F%2Fclockobj.co.uk%2Fwp-content%2Fthemes%2Fcwo2%2Fimages%2Frss_large.png)
![[image]](http://mowser.com/img?url=http%3A%2F%2Fclockobj.co.uk%2Fwp-content%2Fthemes%2Fcwo2%2Fimages%2Fcwo-title.png)

![[image]](http://mowser.com/img?url=http%3A%2F%2Fclockobj.co.uk%2Fwp-content%2Fuploads%2F2008%2F09%2Ftwitter.png)




