odyniec.net

Archive for the ‘Uncategorized’ Category

Rocket

Friday, October 23rd, 2009

Meet Rocket.

Rocket

Rocket is a (approximately) seven weeks old, cute-as-hell kitten.

I found him about a month ago, while going for a walk around my neighborhood. He was crawling through some bushes, squeaking silently, but loud enough for me to hear. I have had a few kittens throughout my life, so I immediately recognized the characteristic squeak of a baby cat calling for help. When I saw him, the poor thing looked really miserable, messy, with eyes completely matted shut. Seeing no signs of his cat mother anywhere near, and knowing that the little guy had no chance of surviving on his own, I decided to take him home.

He was soon seen by a veterinarian, and it turned out he was literally covered with ticks. As the doctor put it, they would have “sucked him dry” if he hadn’t been found. It took a whole hour to remove all those little bastards. The doctor also opened Rocket’s matted eyes, and there was some bad news. His eyes were badly infected (in doctor’s words, the infection looked “horrible”), and it was highly likely that he will be blind or nearly blind for the rest of his cat life.

This didn’t sound optimistic, but I thought, what the hell, whatever chance there is, it’s worth trying, so I took him back home and started his treatment. At that time, his eyes looked really bad, lifeless and empty, like those of a zombie. Rocket could open them, but it was obvious he can’t see a thing.

I have other cats in my apartment, and since Rocket’s infection was contagious, I had to isolate him. I arranged him a cozy therapy room in the bathroom and he stayed there most of the time. However, he had an unstoppable urge to explore the world around him, and whenever I opened the bathroom door, he shot out of there like a freaking rocket. Yup, that’s how he got his name.

Despite being sightless and weakened by his illness, he was unbelievably full of life. I got him a toy rat, and he spent hours biting, strangling, and generally torturing the hell out of it. Whenever he smelled food, he sniffed his way towards it like a hunting dog — and when he got to it, he ate like crazy.

I’m sure it was this exceptional lust for life that made him defeat his illness. After a few days of intensive treatment, I noticed some changes. His eyes looked less zombielike every day, and there were undoubted signs that Rocket was starting to see. This was mostly observable when he paused his activities (which mostly involved running around and biting everything) for a brief moment, and turned his head only slightly, obviously experiencing the formerly unknown sensation of sight.

About two weeks after I found him, he was all better. His eyes looked almost normal, with just a few barely noticeable spots left after the infection. The first time I saw him play with a tiny piece of paper, I had no doubt that he is able to see pretty clearly. Even the doctor was amazed by how well he was doing.

I could not keep Rocket in my apartment for good, because the other cats weren’t getting along with him especially well. Luckily, my mom decided to take him, so now Rocket has a new, loving home, and he’s a happy little troublemaker.

Shoehacking

Monday, May 25th, 2009

Did I ever tell you that I like running? Probably not, as all I’ve been blogging about so far was web development or technology-oriented stuff. And even if I tried writing about something else for a change, I ended up with a Greasemonkey script, damn it.

Anyway, I like running. Not long ago, I’ve decided to try out the Nike+iPod Sport Kit, which seems to have gained significant popularity among some runners. If you haven’t heard of it, the Nike+iPod kit is a neat accessory that turns your iPod into a workout companion. While you’re running, it measures your distance and pace, and gives you voice feedback on your performance.

So I got myself an iPod Nano and the kit, which consists of a receiver that is attached to the iPod, and a sensor that should be placed in your shoe. Nike “strongly recommends” that you buy a special pair of running shoes that have a little pocket under the insole where the sensor is supposed to go. However, I already had an excellent pair of Ecco Receptor shoes that I found very comfortable, and I wasn’t keen on switching just because of the sensor issue.

Suspecting I wasn’t the only one on the globe with this problem, I googled around and found that I have two options: buy a special holder for the sensor, or hack it into the shoe somehow — I chose the latter, of course. I came across this blog post, which has a nicely collected list of hacks (as well as commercial products) that people invented to use their sensors with non-Nike+ shoes.

The method that I used is a modified version of the first hack shown on that page. In the original method, the sensor is tucked under the shoelaces and kept in place with a small piece of velcro. I didn’t use velcro, I just stuffed the sensor under the laces, but first I wrapped it in a tiny ziploc plastic baggie. Here are the ridiculously simple instructions:

Step 1. Put the sensor in a plastic baggie

Putting the sensor in a ziploc plastic bag

Step 2. Stuff the baggied sensor under the laces

Baggied sensor tucked under the laces

The use of the plastic bag has two major benefits:

  1. It makes the sensor sit tightly under the laces, making it virtually impossible for it to fall off.
  2. It protects the sensor from dirt and rain (yes, I’m tough enough to run when it rains).

I have now run about a hundred kilometers with the sensor attached like this, and it never even got loose. If you’re looking for a quick hack that doesn’t involve any sort of shoe surgery, I recommend you try this one. It might not work with your shoes as well as it worked with mine (the spot under the laces needs to be quite tight), so go for a test run first and make sure the sensor sits steadily after a few hundred meters. Have fun!

Postfix and Google’s SMTP Server

Tuesday, March 24th, 2009

I was recently configuring my local Postfix e-mail server to relay messages destined for Gmail accounts through Google’s SMTP server. The setup is actually pretty simple, and there are numerous good articles on this subject available on the Intertubes, to name a few:

The above sources will give you a detailed description of what you need to do (including creating a certificate, in case you don’t have one already), I’m just going to list the essential parts here. As a prerequisite, you need a Gmail account, as Google’s SMTP server requires you to authorize before allowing you to relay anything.

Note: My e-mail server is running FreeBSD, so if you’re on a different operating system, the location of Postfix configuration files will probably be different — you might have /etc/postfix instead of /usr/local/etc/postfix.

To tell Postfix to relay all messages destined for *@gmail.com through Google’s SMTP server, put this into /usr/local/etc/postfix/transport:

gmail.com smtp:[smtp.gmail.com]:587

Then, create the /usr/local/etc/postfix/sasl_passwd file, telling Postfix to authorize with your Gmail login credentials when connecting to Google’s SMTP server:

[smtp.gmail.com]:587 username@gmail.com:password

Finally, put the following into /usr/local/etc/postfix/main.cf:

transport_maps = hash:/usr/local/etc/postfix/transport smtp_sasl_auth_enable = yes smtp_sasl_password_maps = hash:/usr/local/etc/postfix/sasl_passwd smtp_sasl_mechanism_filter = plain, login smtp_sasl_security_options = noanonymous smtp_use_tls = yes

The transport and sasl_passwd files need to be hashed with postmap:

# postmap transport && postmap sasl_passwd

That’s it for the configuration. Restart Postfix to make the changes effective (again, the command below is for FreeBSD):

# /usr/local/etc/rc.d/postfix restart

That’s it — you can now test it by sending something to your Gmail account.

It’s working? Grrreat. However, you might notice that there’s one fundamental problem with this solution — any message transmitted this way has it’s original “from” address replaced with your Gmail account’s address, making it look as if it was actually sent from Gmail.

Luckily, as I found out, the “from” address will be left intact if it is listed as one of the “other addresses” assigned to your Gmail account. So, you just need to log in to your account, go to Settings → Accounts, and use the “Add another email address” option to add any addresses that you want to relay mail for.

Playing with Images in JavaScript

Tuesday, September 30th, 2008

A couple days ago I received an e-mail from an imgAreaSelect user, asking me if it’s possible to blur an image in JavaScript. The question intrigued me, so I Googled around a bit, and came across an interesting image effects library written by Jacob Seidelin. Apart from blurring, it lets you mangle images in a number of other wicked ways — all with just JavaScript. Go and play with the demo to see for yourself.

I thought it would be nice to have a jQuery plugin with similar functionality, especially that jQuery’s chaining would make it possible to combine effects and do things like:

$('img.example').imgFx('blur').imgFx('brightness', {value: 10});

So, I’ve started working on the implementation — there’s not much to see yet, as just the blur effect is working for now, but if you’d like to take a peek, here’s a simple demo. It works in recent versions of Firefox and Opera, and in Internet Explorer 6 or above. That’s because the effects are implemented using canvas, which basically lets you draw inside the browser window and over images, but it’s a new element defined in the upcoming HTML 5 specification, and is not (yet) widely supported.

You might be wondering, since the blur demo works in Internet Explorer 6, does it mean that such a pitiful browser supports the brand new canvas? Actually — no, it does not, and neither does IE7. I’ve heard rumors that canvas is (or will be) supported in IE8, but haven’t seen it for myself. How does the blur demo work in IE then? Well, by using the proprietary implementation of image effects that Microsoft has built into the browser, accessible with the CSS property "filter".

I don’t know if the plugin will turn out useful for any practical purpose and not merely for demonstration, but I’m going to give it a shot anyway and develop it. If you have any ideas on what additional effects or features could be implemented, feel free to leave a comment or send me an e-mail.

I’m Alive, Honestly

Sunday, July 20th, 2008

It’s been a while (two months, to be precise) since my last post, but I’m not dead, and neither is my blog. I just got somewhat overloaded with work, and had little spare time for my own projects — thus, little to blog about.

Now that most of my large work projects are completed, I’ve finally had some time to update the article on multiple select fields and work on a few additions to the imgAreaSelect plugin that were requested by people (expect a release soon).

Multiple Select Fields

Sunday, May 11th, 2008

I’ve just added a new web development related article on the subject of multiple select form fields. If the topic sounds boring, it probably is, as there’s not much to be excited about checkboxes and such, but I tried to make it at least a bit more attractive by introducing a colorful DHTML example.

The article is still a work in progress, as I intend to add some more information on a couple things (like pre-selecting options and limiting the number of choices), nonetheless I guess it’s mature enough to be brought into the daylight. I’d be glad to know what you think of it, so don’t hesitate to send me some feedback.

Stop. Hammertime!

Wednesday, April 16th, 2008

I’ve just upgraded my primary workstation — my old, overheating, and noisy as a vacuum cleaner Pentium D unit has been replaced by a new Core 2 Quad machine, which does not get hotter than room temperature and remains heavenly silent.

I assembled the new unit by myself, as with most of the machines that I’ve been using over the years, dating back to the prehistoric times of PC XT. However, it wasn’t until today, the high-tech era of quad-core CPUs, that I had to make use of this particular tool:

Yes, a hammer.

No matter how hard I tried, and how badly I cursed, I couldn’t install the damn heatsink on the motherboard — despite what the manual said, the “Push Pins” just wouldn’t get “firmly secured” in the holes. So I literally hammered them to the board. Apparently, I did it gently enough not to break anything, otherwise I wouldn’t be able to write this post on the new machine.

Now, I just need a new power supply to complete the upgrade. This means more assembling — I better get an axe, just in case.

Musketeers!

Monday, March 17th, 2008

This is what I learned yesterday:

Do not watch The Three Musketeers while working on a use case diagram for your next project, or your diagram will end up like this:

En garde!

Drawn with Umbrello UML Modeller, by the way.

I Live… Again!

Thursday, January 10th, 2008

As some of you, my dear visitors, might have noticed, I used to have a blog on this website. You might have also noticed that my blog has been dead for over a year. When something is dead for so long, it’s probably better for it to stay that way, but what the hell, I’ll try to resurrect it anyway.

The blog is alive again, but I’ve decided to throw away all the old content, since it was, well, old, and boring. Rest in peace, old content, you won’t be forgotten (until you get deleted from Google cache).

*sigh*

Well, nothing left to do but populate the blog with new, shiny, and interesting stuff. And make the blogosphere a little better place.