jQuery: Form Plugin, Sweet… Almost
November 8, 2006 | 1 Comment
I am a recent convert to the powers of jQuery ever since Matt fell in love with it at "The Ajax Experience". The syntax and simplicity exceeds the combination of Prototype and Script.aculo.us that I was using.
By far one of the greatest features of jQuery is the ability for the community to create amazingly useful plugins. As I become dependent on many, I will highlight them here (mostly so I don't forget). The plugin I want to talk about right now is the form plugin from malsup.
Basically this plugin allows you to have a form be submitted through an XHR call. It uses the form's defined action URL to determine where to post the values and by default will update a specified div with returned data. It has additional flexibility to get returned data in XML or JSON if you would prefer. Go check out the example on his site, this is extremely simple to implement. This is exactly what I was looking for and I was quite happy, until I found a bug...
There is a problem with the internal formToArray() function when dealing with multi-select lists. If you are pre-selecting values in the list on load with some sort of server side language (PHP in my case), the pre-selected values will be submitted along with the newly selected user values. Obviously this is not what you would want to happen. The problem code occurs around 300 lines in:
-
if (t == 'select-multiple') {
-
jQuery('option:selected', this).each( function() {
-
a.push({name: n, value: this.value});
-
});
-
return;
-
}
The jQuery search is finding more than it should. I have two ways in mind to resolve this issue. Most simply, you can add an if statement before the push, like this:
-
if (t == 'select-multiple') {
-
jQuery('option:selected', this).each( function() {
-
if(this.selected == true)
-
a.push({name: n, value: this.value});
-
});
-
return;
-
}
This makes sense and is simple, yet it feels dirty since you receive more data from the search than necessary. I'm not certain about the efficiency, so here is another option:
-
if (t == 'select-multiple') {
-
for(var i=0;i<this.options.length;i++) {
-
if(this.options[i].selected==true)
-
a.push({name: n, value: this.options[i].value});
-
}
-
return;
-
}
In this second one, we loop over all the elements in the multi-select to determine which are checked.
Like I said, I'm unsure which would yield the better performance, so hopefully someone will do the benchmarking and it can be rolled into the next version of this sweet plugin.
Tags: AJAX, ajax experience, ajax form, form plugin, javascript, jquery, jquery form plugin, jquery plugin, jquery plugins, malsup, plugins, xhr
Great Stats
March 23, 2006 | 1 Comment
It turns out I love stats. I'm sometimes amazed at how many different statistics I poke at on a regular basis.
Inside of Wordpress I use the phenomenal bsuite. Basically this keeps track of my individual story reads, incoming search terms, as well as tagging my posts and building related story references at the bottom of each post. If you run Wordpress, get bsuite, it rules.
There are more general web like stats that are often needed. For example, user browser, screen resolution, country of origin, time of day traffic, broken links, adword conversion, etc. These things are all handled superbly by Google Analytics.
Sometimes however, I want to compare my overall stance with other blogs on the net. For this I (like most) turn to Technorati. They do a great job of ranking known blogs on the internet both in general and based on certain tags or keywords. It's good to know where you stand, but even better to have others to compare against.
Finally, my favorite site of all: Alexa. Alexa is an Amazon property which ranks the top few million websites. For the top 100,000, they provide detailed traffic analysis and graphs. While working for a major internet company, I became very familiar with Alexa as a daily tool to measure our success against our competition. Especially in internet advertising, traffic is important.
Ken recently pointed me at Pub Sub as another site to check out stats on my blog, but overall I find many of the numbers here questionable. Compare some blogs you are familiar with and I think you'll see my complaints clearly.
If anyone has any other great stats packages or web services they know and follow, let me know. I'm always looking to feed this strange addiction.
Tags: advertising, adwords, alexa, blog, blogging, bsuite, google, google analytics, internet advertising, plugin, plugins, pubsub, statistics, technorati, web, web development, web statistics, wordpress
Import Remote RSS in WordPress
March 7, 2006 | 13 Comments
The delivered WordPress import utility for RSS is a little annoying in that it requires you to provide a file. Who actually downloads a copy of an RSS feed to their desktop?
Anyway, when we began alpha testing WordPress MU for deployment at Plymouth State, we realized we needed a version of the importer that would allow a user to simply give a URL of their RSS and have it work.
This is simply a modification of the existing RSS importer, a majority of the code is outwardly taken from that. This will work for both WordPress and WordPress MU.
- Download this PHP file.
- Drop it in your wp-admin/import/ directory.
- Go to the Import link in your admin interface.
- Celebrate!
Please use this plugin at your own risk, no warranties or guarantees are implied with usage!
Tags: blog, blogging, importer, plugin, plugins, rss, rss importer, wordpress, wordpress mu
JPEG 2000, first attempt
July 11, 2005 | 7 Comments
I recently learned a bit about a "new" technology called JPEG 2000 (.JP2 or .J2C). I'm a little unsure how this missed me for so long, but oh well.
In a nutshell, JPEG 2000 is a way to store multi-resolution images which can be delivered in a streaming fashion at the desired resolution. It also sports greater compression rates than JPEG, with far less quality loss. It does this using what is called "wavelet technology." Strange buzzword, I kinda hope it doesn't catch on...
Anyway, from a practical standpoint, I poked my head into Adobe PhotoShop CS and JPEG 2000 is not listed as a file type I can save as. However, poking around a bit, I found a product by LuraTech called LuraWave which provides a PhotoShop plugin, but alas it only runs in OS9, which I don't have. I then found Lead Technologies offering a free plugin, but it is PC only... I then decided to step away from PhotoShop and try out Graphic Converter. It's supposed to convert everything, right? Well, it does, all built-in and functional in the demo.
So now I have one created. The next step is figuring out how to get it embedded in a web page. Luckily a google search turned up this how-to guide. Which implies that all you need to do is use an embed tag. This proves to be an oversimplification, and most likely only compatible with IE.
This is an immature technology, which currently only appears to have support in the PC/IE area. I'm going to try some more tests with this at work on my PC and I'll post again if I have luck in that area. As a side note, JPEG has been around for 15 years, so I guess it is time for something new here...
More Info:
http://www.jpeg2000info.com
LuraTech: LuraWave - JPEG 2000 implementation
Pegasus Imaging: Compression
Aware: Compression Software
Whitestone CommunitY: JPEG 2000
Tags: adobe, browsers, compression, graphics, image, imaging, jpeg, jpeg 2000, jpeg2000, photoshop, plugins, technology
