odyniec.net

Archive for 2010

WebService::EditDNS – Perl interface to EditDNS API

Monday, July 26th, 2010

I have created a simple Perl module that talks to EditDNS API, allowing for easy manipulation of domains/records hosted at EditDNS from within Perl programs. A while ago, I developed a command-line utility that serves a similar purpose, named editdns.pl. The module is sort of an extension of that idea, although it works in a different manner — while editdns.pl impersonates a web browser to access the EditDNS control center website and uses hacky HTML scraping techniques, the module plays it nice and only uses elegant API calls.

The module is called WebService::EditDNS, and is available for download at CPAN. Eventually, it will probably also get a project homepage here on my website (some day in the not-too-distant future).

SelectList Documentation Updates

Tuesday, July 20th, 2010

Just a quick notice for selectList users — I have updated the documentation page for the plugin, adding the missing API methods reference. I also added some explanatory text on the examples page. Take a look if you’re interested.

SelectList 0.3

Monday, July 19th, 2010

I’m releasing a new version (0.3) of selectList. This release brings support for the core jQuery method .val(), allowing you to retrieve the list of currently selected options at any time (which might be useful when you want to, for instance, send the selection with an AJAX request).

Thanks to John Watson and Dan Young for notifying me of this.

Space Invaders Strike Again

Thursday, April 15th, 2010

I’m doing some spring cleaning of my files, and while browsing a forgotten partition on an old hard drive, I came across an ancient archive directory containing a few megabytes of miscellaneous source code. It’s dating back to my late teens, when I got a kick out of programming simple DOS games in Turbo Pascal. Of course, I couldn’t resist trying to run some of the old programs in DOSBox. Here’s a screenshot of my unfinished Space Invaders game:

This brings so many memories. I remember my ambition back then was to code the game completely from scratch, not using any libraries — I wrote the graphics code, keyboard handling, sprites and such all by myself in Turbo Pascal and some X86 assembly. This taught me a lot about programming, the X86 architecture, and DOS — most of this stuff is now obsolete and pretty much useless (especially when you make a living as a web developer), but it was really fun back then.

Hmm… I wonder if it would take long to port the game to Linux…

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.