Archive for the ‘Web Development’ category

Changing URL parameters with jQuery

September 20th, 2011

You can find plenty of resources about this topic just by googling the web, most of which will point to jQuery plugins.
But the fact is that it’s so easy to achieve this by simply using jQuery that you do not need a plugin.

The code is pretty much self explanatory:

/*
 * queryParameters -> handles the query string parameters
 * queryString -> the query string without the fist '?' character
 * re -> the regular expression
 * m -> holds the string matching the regular expression
 */
var queryParameters = {}, queryString = location.search.substring(1),
    re = /([^&=]+)=([^&]*)/g, m;

// Creates a map with the query string parameters
while (m = re.exec(queryString)) {
    queryParameters[decodeURIComponent(m[1])] = decodeURIComponent(m[2]);
}

// Add new parameters or update existing ones
queryParameters['newParameter'] = 'new parameter';
queryParameters['existingParameter'] = 'new value';

/*
 * Replace the query portion of the URL.
 * Query.param() -> create a serialized representation of an array or
 *     object, suitable for use in a URL query string or Ajax request.
 */
location.search = $.param(queryParameters);

You can clearly improve the regular expression, but the one above meet my needs.

samaxesJS JavaScript library updates

April 5th, 2010

Both the TOC (Table of Contents) components from samaxesJS JavaScript library have been updated.

Changes include:

  • Reduced file size by removing duplicated code using a for loop when defining and processing indexes (1.8KB for the minified jQuery TOC plugin).
  • Added a new option: context, allowing the TOC to list headings from only a portion of the page.

Please report any bug you may find in the project Issue Tracking.

W3C Widgets Compatibility Matrix for Packaging and Configuration

November 14th, 2009

Daniel Silva, Marcos Caceres and myself have completed Phase 1 of Widget Packaging and Configuration compatibility testing. We have also detailed the results as part of the conformance matrix.
We would like to publish the results as a working group note. Phase 2 will begin in about 3 weeks, in which we are hoping to start working with vendors to improve overall conformance.

We need help with Phase 2: if you know a team contact for any of the targeted products that are claiming conformance to W3C Widgets, then would appreciate your help in making them aware of the results of the testing – Implementation Report: Widgets Packaging and Configuration.

Cross Browser Testing

April 7th, 2009

No matter how anxiously expected, the release of IE8 hasn’t resulted in the end of the support for the old, deprecated, IE6 rendering engine. Giving us, the web developers, need to test against yet another version of IE.

Hopefully the eighth version is going to be a lot easier to test and support since it’s more standards compliant and in that perspective, much closer to the other modern browsers. It’s also comes with easier debugging functionality as it has an integrated set of developer tools available by pressing F12 or by clicking ‘Developer Tools’ under Tools menu.

But right now, together with other major players (Firefox, Opera, Safari and Chrome) you can end up with a total of 7 browsers to test. You might even want to test different versions of individual browsers, transforming this task into a nightmare. Fortunately tools, allowing you to compare different rendering engines in a single unified interface, are emerging and can really save the day. Two great examples are:

  1. Microsoft Expression Web SuperPreview
  2. DebugBar IETester

For a complete list of browser’s compatibility, check the great Compatibility Master Table from QuirksMode.

Internationalization of the File Upload Form Field

January 27th, 2009

Internationalization, or i18n, is the design and development of a product, application or document content that enables easy localization for target audiences that vary in culture, region, or language. Localization refers to the adaptation of a product, application or document content to meet the language, cultural and other requirements of a specific target market (a “locale”).

Adapting application to various languages is for me, as a Java and HTML developer, more than a common task. Usually the solution involves a set of supported locales, which is very often different from the system locale and/or browser configuration. Majority of such cases are covered by the scenario when user chooses particular language settings and the only place where the locale setting can be stored is the HTTP Session.

Support for this behavior is now handled by majority of frameworks; nevertheless there is still one HTML element that you can’t effectively change – the file upload form field.
» Read more: Internationalization of the File Upload Form Field

The Semantic Web and RDFa

August 29th, 2008

There is a lot of momentum around Semantic Web and RDFa.
This may be caused by the big milestone reached for RDFa, a Candidate Recommendation of RDFa in XHTML: Syntax and Processing.

Recently, several discussion threads have been started on the WHATWG mailing list around the effort of integrating RDFa into the HTML5 specification as XHTML1.1 and XHTML2 that will have it integrated.

While I was pretty aware of the Microformats activity, I can’t say the same about RDFa. But Manu Sporny makes it a lot easier. In fact, this is by far the most comprehensive explanation of RDFa that I have ever seen.
» Read more: The Semantic Web and RDFa

samaxesJS JavaScript Controls

July 23rd, 2008

samaxesJS is a set of utilities and controls, written in JavaScript, for building rich interactive web applications.

The first extension is a dynamic Table of Contents script.

The TOC control dynamically builds a table of contents from the headings in a document and prepends legal-style section numbers to each of the headings:

  • adds numeration in front of all headings,
  • generates an HTML table of contents,
  • degrades gracefully if JavaScript is not available/enabled.

More information available in the project home page at Google Code Hosting.

HTML 5 @media 2008

June 16th, 2008

Now that almost everyone has heard about HTML 5, maybe not all of you know what’s new for us developers.

Lachlan Hunt and James Graham have presented on 2008-05-29 at @media 2008 in London Getting Your Hands Dirty with HTML5.
I really find it a great presentation and a good start if you want to check what’s new with the new HTML/XHTML version.

Lachlan Hunt is also the editor of The Web Developer’s Guide to HTML 5. Any suggestions can be added to the wiki.
We are all welcome to contribute, so let’s get our hands dirty!

Internet Explorer 8 Application Compatibility VPC Image

March 6th, 2008

Alongside with the IE6/IE7 Application Compatibility VPC Images (VPC Hard Disk Image for testing websites on IE on Windows XP SP2), Microsoft now provides an IE8 version.

This is a great way to test your web applications since the IE8 Beta1 installation overwrites the previous IEs present in your system.

Web Standards Support in IE8

March 5th, 2008

I’m really impressed about Microsoft responding to their customers and to the community.

Microsoft Expands Support for Web Standards
Company outlines new approach to make standards-based rendering the default mode in Internet Explorer 8, will work with Web designers and content developers to help with standards behavior transition.

Microsoft’s Interoperability Principles and IE8
We’ve decided that IE8 will, by default, interpret web content in the most standards compliant way it can. This decision is a change from what we’ve posted previously.
Microsoft recently published a set of Interoperability Principles. Thinking about IE8′s behavior with these principles in mind, interpreting web content in the most standards compliant way possible is a better thing to do.

That’s awesome. An unified industry can move forward.