Carter Bailey Tech Thoughts, lessons learned, and motivation

26Oct/122

Quick Simple (and kinda dirty) URL Manipulation with JavaScript/jQuery

Posted by Carter Bailey

This is probably not something unfamiliar to you, maybe you've done it before or maybe you think this is the dumbest way to do this ever.

I thought it was pretty nifty (the wonders of JavaScript and jQuery never end), and I thought I'd share.

1
2
3
4
$('a').attr('href',
  function () {
    return this + '&AdditionalQueryVar=newvalue';
});

Click through to let me know in the comments what you think and what you would do for this.

[Updated 25 April 2013: Commenter Mike made a suggested rewrite for this snippet and has a great little URL manipulation library available on GitHub: https://github.com/Mikhus/jsurl]

Filed under: Code Continue reading
13Oct/120

Using JSLint: A Couple Suggestions and Reminders

Posted by Carter Bailey

Recently, we've been redesigning an ASP.net and VB.Net web app at work to fully utilize a Client-Side architecture instead of the usual Server-Side ASP page life cycle that comes baked into similar web apps. We've moved away from the server "owning" the data to the client's browser "owning" the data (using the JSON format), processing adjustments to that data, and making the requests to web services that handle any analyzing of the data. All that to say that I've been working heavily in Javascript, jQuery, AJAX, and various plugins that go along with those. Free, online tools like JSLint and JSONLint are invaluable tools for the client-side developer.

The following are some suggestions and reminders for situations that I've come across for using JSLint the most effectively.

21Jul/110

XML XSLT Quirk – Transformation Resulting in Extra Characters (Using C#)

Posted by Carter Bailey

Recently, I've been working with XML and XSLT transformations at work to build Continuity of Care Documents (CCD), and I thought I'd share a little quirk I came across. This might be one of those "duh" moments for most people, but I had to find out the hard way, so maybe this will help someone else out there.

I am creating an XmlDataDocument with a DataSet returned by an Oracle stored procedure, and then I am transforming it using an XslCompiledTransformation and XSLT file.

For code examples and results click "Continue Reading"