Archive for posts tagged with 'C#'
-
Bulk Photo Resizing with ImageProcessor
I'm currently on a month long holiday in Sri Lanka, taking a nice overdue break from work, (much respect to Rich for holding the Umbrella fort!). During my travels, I've been keeping a family blog - journal updates, add a few photos, etc. However the WiFi upload speeds at the various hotels we've been staying at have been painful slow; uploading a single photo (around 3Mb) to our blog or even Facebook is taking an…
-
How to convert NameValueCollection to a (Query) String [Revised]
Following on from a comment on my previous post about converting a NameValueCollection to a (query) string – I have finally got around to revising my code snippet. Now the method will handle same key multiple values, (it no longer comma-separates them). I have also added extra parameters so that you can define your own delimiter (since the HTTP specification says that you can use both ampersands & and semicolons ;) and there is an…
-
MySql data-source support for ELMAH
Following on from my last post (a couple of months ago) about Integrating ELMAH with Umbraco, I received a comment if it was possible for ELMAH to use MySQL as a back-end data-source. After a few emails back and forth between myself and Rajiv, (as well as Rajiv’s requests over at the ELMAH support group), the advice was to simpily develop some code that implemented the ErrorLog class, (making use of the 3 core methods:…
-
Convert XmlReader to String
I was in the middle of developing a member look-up AJAX function for an Umbraco project, when I ran into a slight problem, (confusion rather), about how to pull the XML back from SQL Server and return it to the browser (AJAX). The SQL statement was straight-forward, very simple, does a LIKE query against the members table, no problem there. Added “FOR XML AUTO” to return the result-set back as an XML data-type ... all…
-
Populating multiple DropDownList controls with generic ListItem array
I’ve just had some fun spending the last half-an-hour trying to figure out why when I used the SelectedValue property of a DropDownList, it also set the value of another DropDownList control. Here’s some background to the problem. On my web-form, I have 2 fieldsets, one for a "Start Date", the other for an "End Date". For each fieldset there are 3 DropDownList; Day, Month and Year. Now rather than populating the values declaratively, using…
-
Last.fm Web Services
Last weekend, the good folk at Last.fm revealed version 2.0 of their public API: The new API introduces a user authentication protocol which for the first time allows applications to create user sessions, bringing both read and write services to web apps, desktop apps and mobile devices. Take our new tagging API’s. Developers can both pull and apply tags to music content from any application on any platform now. The same goes for sharing –…
-
How to convert NameValueCollection to a (Query) String
Most ASP.NET developers know that you can get a key/value pair string from the Request.QueryString object (via the .ToString() method). However that functionality isn't the same for a generic NameValueCollection object (of which Request.QueryString is derived from). So how do you take a NameValueCollection object and get a nicely formatted key/value pair string? (i.e. "key1=value1&key2=value2") ... Here's a method I wrote a while ago: /// <summary> /// Constructs a QueryString (string). /// Consider this method…
-
Making Request.QueryString writable (by clone/copy)
Every now and then I completely forget that the Request.QueryString (and Request.Form) object is read-only. Today I had a bit of functionality where I needed to remove a key/value from the collection - but the Remove() method (of the NameValueCollection object) throws an exception. Unfortunately, the Request.QueryString's CopyTo method assigns the values to an ARRAY, not a NameValueCollection - losing functionality and flexibility. You need to copy the Request.QueryString object to a new NameValueCollection instance,…
-
I am an ALT.NET Developer
I am an ALT.NET Developer. (more here)