JM

  1. Articles
  2. Asides
  3. Currently
  4. Portfolio
  5. Photos
  6. About
  7. Contact

04:07 SF
13:07 SE

Kim and I went to a house warming party for a co-worker last night. He, like probably 90% of 08′ers*, lives in an apartment building and resides on its second floor.

This apartment building had a central stair case which twisted upwards around a central shaft elevator. Also all elevators in Stockholm of these types have a 3 person limit. So, on our way to the roof, me and two other people clamber into the elevator and get ready to go to the roof. However, a fourth gentlemen starts stepping into the elevator as well. Despite our shouting of “No! 3 people only! Serious! Wait!” he stumbled in.

When the sign said “3 people only” it really meant it.

As soon as his other foot hit the elevator floor the counter weight was out done. The lift door still open the elevator started moving downwards. At this point, all I can recall thinking about was hoping that the last guy was all the way in because we were going past that opening and I didn’t want him half in and half out. Shudder.

The next concern is, of course, “oh shit, this isn’t going to nicely stop…” However, I was hardly able to finish that thought before SMASH and we’d arrived at ground floor. Holy Shit. Elevator was still in tact and no one was dead, but lights were blinking and we were half way into the floor — not at quite the right level with the floor outside. We’re all standing there and one of the other guys who had dropped a beer on the floor, decided to pick it up. Upside down. Pointed at my pants. Sigh. After a few moments collecting his sanity, the fellow at the front finds the handle to open the door and we all step out.

End of the story: I’ve survived being in a 2 story drop in a small metal cage of death with 3 other men and I managed to walk away with nothing more than some jitters and a long beer stain down my pants.

Fun.

* 08 is the Stockholm extension. It’s like saying “I’m a 415er” for people in San Francisco

I thought I might take a moment to talk about my web hosting setup.

I run a decent amount of websites (roughly 12 or so) and some of them quite popular. Popular enough that, long ago, I’d outgrown shared or VPS hosting packages. I tried dedicated for a bit, which was nice but expensive. So, in the end, I built a kick ass server and sent it off for colocation. There’s nothing like knowing the machine you built and getting the best in prices.

However, one of the great perks about shared/vps type hosting is that they come with all the “extras” already hooked up for you –  web server installed and setup, databases ready to go, and an email server prepared. I can not emphasize how under appreciated that last item on the list is. After 3 years of self hosting, I can say that, without a doubt in my mind, email services are the toughest part of running a web setup.

Email is not only complex from a theoretical point (understanding MTX’s, routing, user/virtual local/remote delivery, and more) but also very difficult to setup — relying on a large number of interdependent packages that (in my experience) aren’t very easy to get tied together. (Take this with a grain of salt as I am not a trained Linux Master, but I’ve got enough experience to compile a webserver, php, and mysql in a morning where as getting a mailserver up takes me a day with precompiled code and a tutorial.)

However, you still have to be able to provide email for the websites you host so I had two options:

  1. Take all my email and do a simple ‘dump’ off to some other service like GMail.
  2. Figure it out.

I’m too much of a control freak (somewhat a part of deciding to self-host), so I went with 2. However, I didn’t want to break my primary hosting machine with all this mail server gunk. Plus, my main server has a habit of needing down time or location shifts and I did not want to deal with server backups directly.

To solve these problems, I spend 20$ a month on a VPS slice from SliceHost. Amazing service, fast, great control panel, automatic complete system backups, and overall a 100% awesome experience. I use this slice for specificaly hosting my email (and Trac/SVN) services. All of my domains point to this machine to deal with email. I had managed to cobble this together with Ubuntu 6.06 last year to take any mail (for any domain!) and save it for a single user — it took me nearly 3 days to get that working right.

Obviously, that solution is somewhat lame: What if I want other users? What if one domain needs mail to go else where? I couldn’t address any of these options really.

In addition to these dilemmas, the Ubunut 6 was rocking Trac0.9 and python2.4 — ew. Time to upgrade.

5 minutes later (that’s how long it takes Slicehost to completely reimage your VPS for a completely bare OS install — wow) I was up and rocking Ubuntu 8 and its shinny, new repositories.

Using two tutorials, Complete Mailserver Setup in Ubuntu 8.04 and Trac on Hardy Heron, I’ve got the machine now setup to server as a Trac/Subversion hosting machine as well as a mailserver capable of gracefully handling mail for multiple domains and users as defined by a pleasant-to-work-with mysql database.

With the Trac/SVN/Email server and the larger Web/Database server setup, I’ve not got a complete, fully self-hosted solution and I’m ecstatic about having all the pieces tied together.

I have long since ditched MySQL 4, and about a year ago I stopped installing the plain MySQL libraries with PHP. (Mostly, they are a pain to install when you are custom building MySQL 5 and PHP 5 on 64 bit architecture, but I digress…)

However, not having access to the plain mysql_* functions makes Wordpress very sad. In WP2.3 there was a work around that was pretty painful, involving some core editing. However, between then and WP2.5, the meek sobbing of folk like myself have been heard!

Simply download this updated db.php and place it in at wp-content/db.php.

You’re done. No really. That’s it! From what I can tell this should even work for fresh installs, not just current installs. If you find anything broken with it, let me know and I’ll give it an update.

I was doing my regularly schedule Vanity Search and this came up:

Made. My. Day. :D :D :D

Kim was browsing the Banana Republic site looking at buttons on jackets ( her’s keep falling out :( ) and she showed me this neat rollover zoom image feature:


Regular


Mouse Over’ed

This is a very neat effect — simple, useful, intuitive, and easy to degrade (click would enlarge). Love it! I plan on keeping this little gem in my back pocket. :)

I took a few hours today to review some of my old code and update it. The Color Palette Generator is an old project of mine — probably 3 years old now — which takes images and, as it says on the tin, creates a color palette from it.

The algorithm introduced originally was fairly simple:

In this method, you would choose a “grid” (in the above, 3×3). The image would have 9 lines drawn through it and where those lines meet, the color of the underlying pixel would be used as the “palette”. While this wasn’t “wrong”, it wasn’t perfect. Many times the pixel under it would not be incorrect, per se, but it wasn’t very accurate.

Since writing the code, a few other methods have surfaced, one of my favorite, however, is the resize-and-sample. This process is very straight forward, and tends to deliver reliable results despite appearing to “wash out” some of the more vibrant portions of the image.

In this method, the image is resized down to the grid size (so, 3px by 3px) and the resizing causes a “blurring” of the image and all the colors get averaged down to 9 total pixels. These remaining pixels are now the average colors of the image.

Both methods are valid, and sometimes one is better than the other, however now they are both available. Pick a favorite and enjoy :)

Additionally, the updated source code is now freely available for download. Please note! I will not provide support for this code.

Me and Kim went to visit the Tekniska Museet (National Technical Museum) which happens to be a short walk from our apartment. (Like, really short — just across a huge park down the street).

Anyway, some photos!


Kim in the park


I head the top of this tower is a restaurant


The place had a really cool light up “Where is something” navigation piece


Another label, this time on a turbine


A Steam Engine Plate


Driver in the back, two passengers in the front