Posts Tagged ‘dotnet’

Jul
27
Ruby on Rails from the perspective of a .Net Developer


Posted: 27th July 2007
Tags: , ,
Posted in .Net, Ruby on Rails
Comments: No Comments »

My blog entries have been a little infrequent of late as I have had my nose deep in the excellent Agile Web Development with Rails (Pragmatic Programmers) (Pragmatic Programmers) and also the fantastic Ruby on Rails Essential Training (Lynda.com).

For those of you that don’t know Ruby is a dynamic open source language created by Yukihiro “matz” Matsumoto in 1995. Rails is an open source framework created by David Heinemeier Hansson in 2004 to support the development of 37 Signals suite of web applications (Basecamp, Packpack etc.)

So two months later what have I learnt ..Well enough to be a competent rails coder, but more importantly, I feel the the process has been nothing more than an awakening to a new approach in Software Development. I have to admit when I first heard about Ruby on Rails I was skeptical and it was easy to state through away comments such as rails is slow, it’s not scalable, it’s difficult to deploy, you can do the same thing on .Net blah blah blah. And to some extent these are all true, but back to that in a bit.

So have I given up on .Net well no, of course not, however there is a time and place for .Net just as there is a time and place for Ruby on Rails. Before I spent time with Rails I easily got caught up in the .Net vs Java vs PHP arguments but at the end of the day all these languages have their place and software development is an art that is transferable to any language. I really can\’92t understand why some people are so defensive about the programming languages they use, I have programmed Basic, Visual Basic, Pascal, C, C#, Java, PHP, Javascript etc in my past however Rails is different but not to the extent that it makes any skills I have learnt obsolete, it just teaches an approach that I can take back with me and use with any other language I use and made me a better software developer.

And this is why I am so excited about Rails, I have been programming since the age of 6 (24 years) and discovering Ruby on Rails has been like rediscovering programming again for the first time. It is taking a disciplined approach to development which then allows a flexibility and freedom to really allow creativity.

As I said earlier I was not convinced with Rails at first so I set myself a challenge. I had a personal project that I had been working on for just over a month, using .Net and Subsonic. So if in one month I could not only learn Ruby on Rails but get to the same point in a RoR version of my project I would be convinced.

Did I achieve this. Of course I did or I wouldn’t be raving about it now. I picked Ruby up enough to get started in two weeks (evenings and weekends) and it took me two weeks to get to the same point I had done with the .Net equivalent, not only that I had produced a better product as I had not had to implement workarounds for various technical barriers I had previously had with .Net.

So of these bad points well yes Rails is slower than compiled languages but it can still handle huge amounts of traffic, Basecamp is a good example. Hosting for Rails is patchy especially in the UK, there are one or two hosts but my advice is to have a form of dedicated or virtual host which you can configure with Apache, Mongrel (Ruby on Rails Application Server). As for scalability, there is no problem at all as sessions can be stored in a database or using Memcache and it uses mysql on the backend.

So the upshot is I really recommend all developers, not just .Net to look at Ruby on Rails. Like me I hope you will discover a flexible web framework which not only makes your life easier but more enjoyable and rewarding, but it might just make you a better developer.

For more information:

Ruby: http://www.ruby-lang.org
http://www.rubyonrails.org





Apr
26
Using ASP.Net / AJAX slide extender to create a color selector


Posted: 26th April 2007
Tags: , , ,
Posted in .Net, Javascript
Comments: 1 Comment »

Using the MS AJAX ASP.Net Extensions and the Ajax Control Toolkit (available through codeplex) You can easily make a colour selector using the Ajax Control Toolkits Slider Extender control.

The Slider Extender included in the Ajax control toolkit renders on the screen as a control that allows the user to click and drag to adjust a numerical value. Out of the box the slider extender is given an ASP:TextBox as it’s Target Control ID, the slider extender automatically hides these textboxes. We can use three slider controls to create a Red, Green and Blue sliders to set a colour. When working in RGB we can set a value of 0 to 255 for each of Red, Green or Blue. So the first thing we need is the three sliders on our HTML page.

 

ASP.Net MVC Diagram

Read the rest of this article »





Apr
24
Tip: ASP.Net/AJAX - Javascript in Label/Textbox Text


Posted: 24th April 2007
Tags: , , , ,
Posted in .Net
Comments: No Comments »

Hi All,

I though I would share a problem that I had (and resolved) using ASP.Net AJAX. The problem occurs if you want to output some Javascript to a Textbox (for example: for a user to copy and paste into their own page), which is nested in an UpdatePanel. AJAX returns an HTTP 500 error.

The reason seems to be that the Javascript in the textbox interferes with the javascript generated by MS AJAX to handle the partial page updates of the UpdatePanel.

So if like me you need to output some Javascript to the page for a user to cut and paste, a work around is to use a literal control and the HTMLEncode function of the Server object as follows:

  1. Literal1.Text = Server.HTMLEncode(<Script src=’example.js’ type=’text/javascript’></script>)

I hope that helps anyone that has been puzzled by this error.





Apr
20
Excellent WYSIWYG HTML editor (all platforms)


Posted: 20th April 2007
Tags: , ,
Posted in .Net, Javascript, Ruby on Rails
Comments: 4 Comments »

I have been trying out several HTML editors for ASP.Net and thought I would share this excellent find that works with several platforms, including ASP.Net, ASP, PHP, Java etc. Up until now I was using FreeTextBox, however this was giving me grief in Firefox so decided that I needed to find a new solution.

FCKeditor is an excellent HTML WYSIWYG editor for ASP.Net as an ASP.Net control is available to use with the Javascript source files to allow you to interact (Get / Set text) etc programmatic ally as you can do with FreeTextBox. In addition to this, FCKEditor allows you to upload images and other files making adding images a breeze and also includes a spell-checker.

Read the rest of this article »





Mar
29
Tim Shankarian’s MS Ajax Autocomplete Patch (and how to use)


Posted: 29th March 2007
Tags: , , ,
Posted in .Net
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 »





Mar
22
JQuery Interface Autocomplete with .Net


Posted: 22nd March 2007
Tags: , , ,
Posted in .Net, 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 »





Mar
14
A bite from the forbidden Apple..


Posted: 14th March 2007
Tags: , , , ,
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.





Mar
9
Writing an XML-RPC server or client in ASP.Net: Part 2


Posted: 9th March 2007
Tags: ,
Posted in .Net
Comments: 1 Comment »

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 »