I ran into an interesting problem yesterday. All I wanted to do was some simple tokenizing of a partial HTML document, an HTML fragment (it was article content from the website I work on) based on certain elements. At first it seemed like a really simple string manipulation thing, but quickly blew out of proportion into something crazy.
I just completed another project contract on Friday. After decompressing over the weekend I wanted to write a few thoughts out about some of the successes and failures I’ve learned during this project.
I was using some cool features of jQuery to do AJAX instead of using UpdatePanels, but when The Intern wanted to do some AJAX he got totally lost. In the end I taught him to use both jQuery and (despite how dangerous it is), Ihow to use UpdatePanels. In the end I encouraged him to use the UpdatePanel with his pages, read on to find out why.
OK, I know this is just a re-tweet, but in the light of my previous post on jQuery I figured I’d better post this too: http://blogs.msdn.com/webdevtools/archive/2008/10/28/rich-intellisense-for-jquery.aspx
It’s just a quick article on how to enable Intellisense for jQuery in Visual Studio.
It was recently announced that the next version of ASP.NET (4.0?) would ship with jQuery, and the new Beta of the ASP.NET MVC Framework shipped with jQuery as well. I’ve been using jQuery with ASP.NET for a while, so I wanted to post some links related to jQuery to help some other people who are jQuery noobs out.
ORM tools are probably one of the most time-saving tools for a web developer. Nothing is more tedious than building a data access layer, adding caching or coordinating transactions. Well okay, sometimes things like that are really fun, but when you’re trying to start a project out from scratch you want to get something up and running ASAP to show to your customers.
In the .NET world there are two powerful ORM tools out there, NHibernate and SubSonic. NHibernate is based on the successful and popular Java EE ORM Hibernate. SubSonic is an entirely new ORM developed in the Ruby on Rails ActiveRecord development model, with some nice .NET 2.0 features like Controllers that you can use with ObjectDataSource controls.
For a recent project I quickly evaluated both software tools, and I’m publishing what I learned here.
Okay, UpdatePanels aren’t dangerous, but they do use more bandwidth and server CPU than a simple web service call. I figure a web developer ought to know what is being sent behind the scenes, but I can understand that a lot of people don’t. UpdatePanels require sending the ViewState and building the control structure behind the scenes, as well as doing a subset of the ASP.NET Page event model, which means more data being POSTed behind the scenes and it takes a little longer to do all that processing.
UpdatePanels are easy though, and for some things in ASP.NET it is so much easier to use. But Encosia does give us an awesome was to still use ASP.NET User Controls within web services and jQuery gives us some awesome tools to build pages dynamically without using UpdatePanels here: http://encosia.com/2008/02/05/boost-aspnet-performance-with-deferred-content-loading/. It’s not quite as easy to maintain as UpdatePanels, but it’s still very easy to use, and also very very fast.
I’m finding CodeIgniter a little frustrating right now. I really wanted to use an MVC tool, but CI is not playing well with IIS. Also, the documentation really isn’t that great, even for an open-source project.
Alas, like most PHP projects it just wasn’t designed or tested with IIS in mind. Fortunately I’m discovering this relatively early in the project, but I’m a little frustrated that some of these things are coming up now.
I think given the choice, since the IIS setup was decided for me before, I might have push ASP.NET Forms (vs MVC) instead. Something I’ll keep in mind for next time.
Of course, CodeIgniter does work much better on my local Apache development environment. I don’t want to come down too hard on it. I’m just not impressed with how it works on IIS.
I think it’s really great that they’re building an MVC product for ASP.NET at Microsoft! I think it has the possibility to bring a lot of PHP, Python and Ruby guys onto the platform.
But it’s not ready to use yet so I’m going to use CodeIgniter. Sure people are out there coding with the beta, or I could even use plain ol’ Web Forms, but long story short: it isn’t ready. It’s going to be awesome when it’s done, it’s awesome now, but every new beta brings out breaking changes.
So even though it makes me sad to leave my beloved C# for one site, I’m gonna have to stick with PHP for this one.
I just found out after tracking down a weird popup alert error “Object reference not set to an instance of an object” that it was being caused inside an ASP.NET asmx web service being called from a ComponentArt grid control. The web service was causing an exception but it was not caught by Application_Error!
I spent a few hours trying to find out where on the client the exception was occurring before tracking it to the web service. I figured nothing was happening on the server since Application_Error didn’t log the error for me.
So, unless you know something I don’t know, make sure you add your own error handling to your Web Services.