Monday, December 18, 2006

The brains behind jQuery

Originally a one-man show, jQuery has evolved far enough to be managed by a team of developers (work on the jQuery code), evangelists (promoting the product - e.g. to developers using Cold Fusion, Drupal, Ruby on Rails etc), web developers (working on the jQuery website backend) and designers (jQuery website, frontend). For more information and a list of the members - jQuery: Blog: » Meet The People Behind jQuery.

Thursday, December 14, 2006

Get remote page contents (ASPX C#)

A simple function for getting the contents of another page in your code behind

private string GetHTML(string url)
 WebRequest request = WebRequest.Create(url);
 // use logged in user credentials
 request.Credentials = CredentialCache.DefaultCredentials;
  // get the response
  HttpWebResponse response = (HttpWebResponse)request.GetResponse();
  // set the content length
  int contentLength = (int)response.ContentLength;
  // get the stream
  Stream responseStream = response.GetResponseStream();
  // Pipes the stream to a higher level stream reader with the required encoding format. 
  StreamReader readStream = new StreamReader(responseStream, Response.ContentEncoding);
  // create a char array
  char[] data = new char[contentLength];
  // load from the stream into the char array
  readStream.Read(data, 0, contentLength);
  // return the data as a string
  return new String(data);
 catch(Exception ex)
  return string.Empty;
 return string.Empty;

Wednesday, December 13, 2006

New Version (1.0.4) of jQuery is out

As detailed in the post jQuery: Blog: » jQuery 1.0.4 there are quite a few bug fixes as well as some enhancements to its AJAX functionality. While the new additions are useful, the fact it is a point/minor release (i.e. from 1.0.3 to 1.0.4 rather than to 1.1) can be of an issue as generally minor releases are for bug fixes only not API changes. Although, to be fair, it looks like nothing was removed from the API and if you tried to use the new features on a page using the old version, they simply would not work. Like in previous releases, a lot of the fixes have been provided by Jörn Zaefferer.

Tuesday, December 12, 2006

A simple solution to Firebug not picking up styles

When you upgrade Firefox from 1.5 to 2 and are a user of the Firebug 1.0 beta, you may notice that when you inspect an element you can't see the styles - i.e. you get an error message - 'Unable to show styles. You must install DOM Inspector.'. This can happen even if you have the DOM Inspector installed. You may also notice that you cannot see the styles in that either. So the problem seems to be that the DOM Inspector is not upgraded to the latest version when you upgrade (or some old files are not removed).

To get it working, simply close all instances of Firefox, navigate to the components directory in the Firefox application folder (i.e C:\Program Files\Mozilla Firefox\components and delete all files beginning with the word inspector. Once you have done this, reinstall Firefox to the same folder. When you start Firefox again, you should now be able to edit and disable styles within Firebug.

What I have noticed, is that after reinstalling, the files that were deleted are not in the components folder, which suggests that the DOM Inspector actually uses a feature built into Firefox (i.e. it just provides a GUI interface) and it may be the case that Firebug can actually work without installing the DOM Inspector. Infact I have disabled it and Firebug still works.

Tuesday, December 05, 2006

Select dropdown options using jQuery

Finally an update to my Select box manipulation collection of plugins for jQuery. You can select options that match a given string or regular expression. The original code for this particular plugin was created by Mathias Bank, with a modification by me to use a regular expression as a parameter as well as a string. He wrote it over a month ago, but I have only just got round to implementing it.

Monday, December 04, 2006

Firebug Lite

While Firebug only works on Firefox, there is an option for other browsers (IE, Opera, Safari) called Firebug Lite. While not as powerful as the full Firebug, it is still a good way to debug for other browsers. You just include it on your page as you would any external JavaScript file and then press F12 on the page to show the console.

Firebug 1.0 Beta 1

Firebug 1.0 is available as a beta version. Initially it was going to be a commercial extension, but it looks like it will be open source. Hopefully it will be maintained (and not just by one or two people), although I am not sure how it can be improved (aside from working on IE as well). Very good for debugging (JavaScript and CSS) as you can set breakpoints, view a box-model representation of any selected element, disable CSS (down to specific properties (i.e. font-size)) and more.

Get Firebug and make a donation to show your appreciation for Joe Hewitt's hard work.

Friday, December 01, 2006

Mono Migration Analyzer (MoMA)

Mono Migration Analyzer (MoMA) is an application (requiring .NET 2.0 or Mono 1.2) that you can use to analyse your assemblies (.exe, .dll) to see if there are any incompatibilities with Mono. While it can't analyse web pages (.aspx, .ascx, .ashx etc), it can be used on any assemblies compiled for use within your website that are stored in the bin folder under your site root. Once done, you can submit a report (that only contains methods you call that are not implemented) which will help the Mono team prioritise their work (as it reflects real world applications).

Microsoft eases IE6 development

Microsoft has released a Virtual PC Image containing Windows XP SP2 and IE6. It is free (so you don't need to buy another license for Windows). Finally there is an official way to test websites in both IE6 and IE7 without extra cost to you. For more details - IEBlog : IE6 and IE7 Running on a Single Machine. Expires on April 1, 2007 so hopefully they will release a new image, or a way to run IE6 without Virtual PC by then.