odyniec.net

Archive for 2010

SelectList 0.2

Wednesday, April 14th, 2010

A new release of selectList (my multiple selection jQuery plugin) is now out. Version 0.2 brings proper handling of optgroup elements (as requested by a few users), and fixes one minor bug.

Thanks to Łukasz Ledóchowski for his feedback.

When Cats Go Fishing

Wednesday, April 7th, 2010

One of the advantages of having a cat: free delivery of fresh fish.

Yep, that’s what one of my cats brought home yesterday. A fish. And it was alive — didn’t even seem injured.

I put the little guy in a food container filled with water (pictured above), then set it free in a nearby water ditch where it probably came from. Must have been one hell of a ride for him.

New Look

Saturday, March 20th, 2010

My website just got a new look. I got bored with the old one, so I played a few hours with GIMP, and this is the result. It’s still simple like the previous one, and it’s probably pretty obvious that my design skills are rather limited, but I like it better, and I hope it won’t burn anyone’s eyes.

New Version of ImgZoom in Development

Tuesday, March 9th, 2010

Last weekend I started working on the next version of imgZoom, the jQuery plugin that uses vector graphics to implement a smooth zoom effect on thumbnailed images. With the initial release (a couple months back), I boldly announced that I intend to one day turn it into a decent substitution for Lightbox, and I think I’m actually getting closer to that. The current version has the lightbox-esque features of displaying images in a window, and allowing to navigate between previous and next images.

I transformed one of my testing pages into a nicely-looking gallery, so if you want to take a look at the development version in action, be my guest. The gallery should work correctly in most browsers, only Internet Explorer might still have some issues — I’m working on that. As always, I’m open to feedback.

WordPress Blog and Multiple Server Names

Friday, February 26th, 2010

I was recently updating my WordPress installation to a freshly released version. My traditional procedure of updating the website is to first make changes to a test version (which is set up on a subdomain of odyniec.net), make sure everything works and looks right, then copy the test files to the public location.

Unfortunately, WordPress didn’t get along with this solution especially well. The WordPress engine didn’t like being accessed through the test subdomain, as it expected a single host name to be designated as its home location. Even though I could open the blog at the test address, all the dynamically generated links to scripts, style sheets, archives and such still pointed to the live version. I also couldn’t log in to the administrative interface at the test version, as it kept redirecting me to the live login page.

I knew PHP stored the actual host name that was used to access the page in the $_SERVER['SERVER_NAME'] variable, and I thought a simple solution would be to make WordPress use that instead of the basic URL set in the configuration. I had very little experience with WordPress internals, so it took me some time to figure out how to implement this, but I eventually succeeded. I wrapped the code into a plugin so that the functionality can be easily enabled or disabled and doesn’t affect the base WordPress code.

So, behold! My first WordPress plugin ever:

<?php /* Plugin Name:    Server Name Support Description:    Allows the blog to be accessed with multiple server names Author:         Michal Wojciechowski Version:        0.0.1 Author URI:     http://odyniec.net/ */ $sns_home = preg_replace('!://[a-z0-9.-]*!', '://' . $_SERVER['SERVER_NAME'], get_option('home')); function sns_home() { global $sns_home; return $sns_home; } function sns_replace_host($url, $path = '') { return preg_replace('!://[a-z0-9.-]*!', '://' . $_SERVER['SERVER_NAME'], $url); } add_filter('pre_option_home', 'sns_home'); add_filter('pre_option_siteurl', 'sns_home'); add_filter('pre_option_url', 'sns_home'); add_filter('stylesheet_uri', 'sns_replace_host'); add_filter('admin_url', 'sns_replace_host'); ?>

In case you’d like to use it (not very likely, as I don’t think my use case is that common), all you need to do is save the above code in a .php file, place it in the wp-content/plugins directory, and activate it in the WordPress admin interface.

ImgAreaSelect 0.9.2

Saturday, February 20th, 2010

ImgAreaSelect version 0.9.2 is out. This version fixes a few minor bugs, and introduces a new option that allows you to completely remove the plugin from the image that it was attached to. Thanks to all the people who helped me by reporting bugs and sending feedback.

I have also added a new example to the Advanced Usage page — it demonstrates an extension of the plugin API that allows you to animate the selection area.

Running Multiple Versions of Firefox in Ubuntu 9.10

Tuesday, February 9th, 2010

Here’s a simple howto on running several different versions of Firefox in Ubuntu 9.10. This is the setup that I use to test my jQuery plugins and other JavaScript code — I hope some of you fellow developers out there will find it useful too. The basic advantage of this solution is that is does not clutter your basic system with unnecessary software packages, as all the additional files are stored in your home directory and nowhere else.

I’m going to create a directory where all the different Firefox versions will reside. I have a dedicated directory for any software that I can’t or don’t want to install the standard way (using apt), and it is located in my home directory – /home/michal/opt. It serves a similar purpose as the system-wide opt directory, which is intended for “optional” software.

$ mkdir /home/michal/opt/firefoxes

There it is. Now, I’m going to get all those versions of Firefox that I want to run. As of this writing, the version running in my system is 3.5.7. I decided to also install the latest version of the 3.0 series (3.0.17), the prehistoric 2.0.0.20 release, as well as the freshly released Firefox 3.6.

Actually, according to browser usage statistics (such as those run by Clicky and StatCounter), Firefox 2.0 has a market share below one percent, so it’s questionable whether web developers should still care about it. I just happen to like to see if new versions of my jQuery plugins still work in the older browsers, so I’m going to install it.

Binary packages for all Firefox releases can be downloaded from the Mozilla FTP server at ftp://ftp.mozilla.org/pub/mozilla.org/firefox/releases/. Here are the respective URLs for the versions that I’ve chosen:

So now I’ll go to the firefoxes directory and download the three packages with wget (of course, you can also download them using your browser or any FTP client):

$ cd /home/michal/opt/firefoxes $ wget ftp://ftp.mozilla.org/pub/mozilla.org/firefox/releases/2.0.0.20/linux-i686/en-US/firefox-2.0.0.20.tar.gz $ wget ftp://ftp.mozilla.org/pub/mozilla.org/firefox/releases/3.0.17/linux-i686/en-US/firefox-3.0.17.tar.bz2 $ wget ftp://ftp.mozilla.org/pub/mozilla.org/firefox/releases/3.6/linux-i686/en-US/firefox-3.6.tar.bz2

(more…)

SelectList 0.1.2

Sunday, January 31st, 2010

I’ve just released a new version of the selectList jQuery plugin — no exciting new features, though, this release only fixes a bug that generated a JavaScript error in IE6 when there were no options in the original select field (thanks to CJ for reporting this).