« September 2006 | Main | November 2006 »

October 27, 2006

I Like Ubuntu Server for MySQL

I got a lot of feedback on my question a few weeks back when pondering what I might choose for an OS to run MySQL. I also got a few "so what did you go with" questions.

A week ago I decided to give Ubuntu server a shot at winning my favor. I haven't used Ubuntu much, but all the fuss over it warrants giving it a shot.

I'm quite pleased so far. It meets at least two of the items on my list from that original post (minimal processes and minimal footprint). I'm not familiar with the philosophy behind building the Ubuntu kernel, but I'll accept the fact that there's nothing specifically tailored for MySQL.

Four clues that the server is installed minimal:

What's great about starting with Ubuntu (standing on the shoulders of Debian) is that to get from the base install to what you need is very simple. In RPM or pkgadd land getting from a stripped OS up to the point of running a self-compiled, networked version of MySQL would mean going through some kind of an annoying build process. With apt-get it's so very easy.

Yea, so I'm back to using a self-compiled MySQL (after a long time using pre-compiled binaries), which is incredibly easy to get to from a fresh install of Ubuntu server. More on that later . . .

Posted by mike at 12:18 PM

October 25, 2006

MacBook Pro Back from Apple - New Guts Inside

Over the past 6 months that I've owned my MacBook Pro it's slowly gone south in a variety of areas. Most of them I've just dealt with over the months but it finally came to a head about a month ago when my MagSafe power adapter wasn't reliably connecting anymore and I ended up in a couple of situations with a dead battery and couldn't get a charge going.

So I called Apple, who were right to immediately inform me that I didn't have a service plan. I never quite understand this, but Apple gives you a 1-year hardware warrantee but only 90 days of phone support. Beyond the 90 days if you have a hardware issue you can't report it on the phone unless you pony up $50 for the phone call (which is reimbursed if it turns out to be a hardware issue).

Anyhow, I went ahead and bought the extended warrantee as I figured I was going to get my money's worth on this machine since I knew it had a slew of problems.

My list of issues:

  1. MagSafe no longer works reliably - doesn't seem to make the connection so isn't charging the battery
  2. Audio-out stuck on optical, internal speakers don't work
  3. Faulty power inverter (high-pitched squeal)
  4. Left-side fan noise
  5. Hot as heck, esp above the F1 key and around the same location underneath
  6. CD-drive freezes up from time-to-time ripping CDs

The MacBook was gone for around 3 weeks, during which I made several demanding phone calls. When it finally got back last week it included a list of the items that were replaced:

  1. Main logic board
  2. Fan assembly
  3. Power supply

The end result is a MacBook Pro that is actually consumer-worthy. The laptop isn't hot anymore and doesn't have the annoying sounds that it used to. And I can hear sounds through the speakers again (although I rarely use them).

I figure it's worth the cost of the service warrantee to get almost completely new guts for the laptop. Except for the fact that there is an updated line of MacBooks Pros now, it almost seems like a new laptop again.

Posted by mike at 8:32 AM

October 22, 2006

Afternoon at Boston's Symphony Hall

Today marks the 125th year since the Boston Symphony Orchestra's first performance. To mark the occasion there was a free, family-friendly open house at Symphony Hall for the afternoon. It was a great experience.

We left our youngest with a friend and took Jo (5) and Ezra (4) who we thought would appreciate the music. By the time we had met up with the rest of our party and gone in we didn't have enough time to get on an the official tour (2-hour wait). We spent the first hour walking the halls, listening to a presentation on the Symphony Hall organ, and doing some kid activities. The kids were very interested in the instruments, the decor, the performers. Was nice that they found it interesting.

The far-and-away best part of the open house was the BSO's performance of Schumann's Symphony No. 2. We sat close to the center of the hall about 5 rows back. The seats were incredible and gave us a very nice view of James Levine and the musicians. Very hard to describe the feeling once the music started, such rich, full, live sound. I was very much captivated by the progressions of each movement and the encompassing sound of the orchestra. I don't spend a lot of time listening to classical music, so perhaps to a more trained ear it would be different, but for me it was beyond enjoyable.

I found that you can get a recording of James Levine directing Schumann's Symphony No. 2. It seems to be hard to come by but I found a used copy. It is available on iTunes, but I'd rather spend my money on a CD to get better quality sound.

The photo is Johanna sitting between her grandmother and aunt waiting for the performance to begin.

Posted by mike at 10:46 PM

October 21, 2006

Evening at the Pumpkin Festival

Late this afternoon the family bundled up and rode the train into Boston to check out the Life is Good Pumpkin Festival in Boston. We've been to it in the past, but had never seen a crowd like the one drawn out to attempt to set a world record for candle-lit pumpkins. We met up with the chef (and the big guy) who has a post with more photos and more information.

Was a bit cold, and extremely crowded so we hung out for awhile, walked around looking at the creative pumpkin carving, marvelled at the sheer volume of 30,000 pumpkins, took some photos, and then headed home.

At one point Jo and Ezra were being incredibly loopy "posing" for photos. I think this photo catches the moment just about right.

Posted by mike at 8:26 PM

October 19, 2006

Wrestling with Building a New Page View

I've been wrestling with an issue over the past few days that I just can't seem to get right. Hopefully hammering it out here might provide some clarity.

I'm writing a new view of an existing, very complex, time entry form. It's like a timesheet, but it contains a lot more than just days of the week and entry boxes for hours worked. A user can split their hours on one given day over any number of projects, entering the specific hours and times associated with each project. There is also some semi-complex javascript to provide on-the-fly calculations as different points on the grid are updated.

The issue is this. The code is organized in such a way that all the data is gathered and then painted to the screen using a specific method for output (something like TimeGrid->paint).

So the logical thing to do seems to be to subclass TimeGrid and create a new class that has just the paint method. In a perfect world all the calls to the new class would go up to the super class for data processing and handle only printing the information out to the screen in a new format.

Unfortunately TimeGrid->paint doesn't just paint, it also contains a fair amount of processing to decide what to paint and how to respect various settings in the application. So creating a subclass object and duplicating the paint method is going to result in a ton of duplicate code, which I'd like to avoid.

Here are the ideas that have crossed my mind. Some of them I've attempted, others seemed wrong enough off the bat that I moved on:

  1. Create a DynamicGrid class, a subclass of TimeGrid, with only a paint method. Step through TimeGrid->paint and pull logic out into a separate TimeGrid method that can be accessed from both TimeGrid and DynamicGrid.
  2. Create a new method in TimeGrid, paint_dynamic_grid, and duplicate the paint method's logic but change the presentation.
  3. Split TimeGrid->paint into two methods, trying to provide better separation between logic and display. Let the logic method choose which display method to use (paint or paint_dynamic_grid).
  4. Move the pieces of TimeGrid->paint logic that aren't for presentation back up into the calling class.
  5. Create a second method (paint_dynamic_grid) in TimeGrid that contains all data manipulation and business logic in TimeGrid->paint, but doesn't paint. Create a new class and method, DynamicGrid->paint, that is presentation only and takes the data from TimeGrid->paint_dynamic_grid and performs the presentation of the data. Where possible consolidate TimeGrid->paint and TimeGrid->paint_dynamic_grid into common methods.

I think the last approach is really what needs to be done, it may produce some duplicate code if it's hard to centralize logic into common methods, but is probably the best as far as moving toward a cleaner interface.

I've learned that 1) it's not always easy or intuitive to create a true MVC separation in the code and 2) it's very difficult to add a new view when there isn't a tight MVC implementation.

Thanks for being my tech sounding board today.

Posted by mike at 1:46 PM

October 10, 2006

Interesting Announcement at Tonight's MySQL Meetup

I think the most interesting announcement made at the Boston MySQL Meetup tonight was by a man who I'd seen before but couldn't place. I didn't think it had been at a previous MySQL meetup. He sat down when things were getting going and said something like:

I have some exciting news . . . [long pause] . . . the next release of Perl 6 will be in 3 days!!

While it was interesting to me and a few of the other Perl folks in the room, the reality was that this exciting news was met by mostly blank faces. After a few moments someone suggested that perhaps the next room over, where the Perl user's group was meeting tonight, was probably the place he was looking for. Sorry to turn such an exciting announcement into such a deflating experience. I realized then that I knew the face from my sporadic visits to the Boston.pm user group.

It is a good reminder to check in on what's happening with Perl 6. It's been awhile since I've given it a good look.

I took video tonight of Sheeri talking about storing/retrieving bits in MySQL. Hopefully will have it up in the next few days.

Posted by mike at 9:59 PM

Upgrading a Web App to Web 2.0

It seems like Web 2.0 is thought of primarily as a collection of new, not existing, companies and applications revolutionizing the way the web is used. This is done with new and emerging technologies such as Ajax, web services, and new thinking about value from consumer-driven knowledge and data.

But what about your legacy web application still going strong but rooted in the dot-com era of web technology. Is there a way to pull it into the future, or present?

I'm here to say yes, it is. One piece of being Web-2.0 compliant is about organization leadership focusing on consumers, and driving functionality in that direction. This can be done regardless of the technology under the hood. If you want to provide a mechanism for consumers to provide feedback on and rate your widgets it can be done with any web-enabled toolset. The same can be said of web services, opening up data isn't much a matter of technology. It comes from the leaders of the organization.

Another (big) piece of the Web 2.0 picture is new and improved uses of new technologies. Can you upgrade your very complex, but mostly static HTML pages that come out of your web application framework to be more Web 2.0-ish? Sure. Can you do it gradually, and over time. Yes.

I write this because I work at a company that built their hugely complex web application in the late 90s using the best practices of those days. It has thousands of developer hours poured into it over many, many years and works very well. The underlying application that drives everything is well-architected and is very solid. It is providing a huge set of customers the functionality they need to keep their business running. I don't think anyone at the company, or their customers, want to see that change.

Over the past several months much of what I've been doing has been finding ways to incorporate ideas of the new web backward into the existing application. The leadership, and other engineers want to see it happen, but in a way that allows us to continue to provide ongoing. Nobody is going to allow the engineering department to dissappear for a year while the application is re-architected for Web 2.0. It's something that has to be done gradually, over time, and in a way that integrates along with the needs expressed by the customers.

Adding an Ajax Framework

The first, and perhaps easiest stop to using new technology, was to implement an Ajax framework. I did this a few months back and it's starting to become the standard. In reality "implementing an Ajax framework" really meant writing document and installing an Ajax library. The document describes how to quickly, and with just a few lines of code, weave new functionality into the existing appliction to replace clunky page-reloads with dynamically build data-driven elements on the page.

For awhile the Ajax framework was used for one dropdown on one page, but as more changes are made to the application the documentation and working examples provide a pretty simple and clear set of instructions on how to upgrade the usability of the application. These upgrades tend to happen when an egnineer is working on a piece of the code for another purpose and tacks on the Ajax improvement as a part of the change.

Dynamic Page Features

Web 2.0, and the new web tools, provide much-needed ability to create improved user interfaces. Much of this centers around moving the web to be more like a desktop app. Again, even with a legacy web application there's a lot that can be done to provide these enhancements to your existing pages.

The project I've become best known for at work is a user interface improvement (the CEO says it's one of his standard things to talk about as he meets with folks). We have tons of grids and lists with project, task, budget information, reports, graphs, etc. We have all kinds of great controls for sorting, filtering, and displaying the information a user wants to see. As good as those are a user often ends up scrolled down on a page somewhere in a sea of numbers and isn't quite sure what they are looking at.

The UI improvement was to allow the user to anchor the column titles to the top of the browser window if they scrolled down below the titles. With this feature they'd always have the column titles floating at the top of their browser, regardless of where they had to scroll on the page. Of course, when they return up to the top the column titles are put back where they started.

The trickiest part of this feature was, like with the Ajax enhancements, weaving the code for the improved UI into the complex nest of table structures that came out of the dot-com era. It took a little extra JavaScript that it would have if the whole row would have been in a div tag, but it works. On all of our supported browsers (IE, FireFox, and Safari on PC and Mac).

The cool part of having a well-architected application is that there are three kinds of lists, and all of them are centralized into three classes. While I was a little nervous about making those kinds of sweeping changes down in the application, it has been gratifying to see the anchored column functionality available site-wide, in hundreds of pages in the application.

Conculsion

I'll be the first to admit that these are pretty simple things, and by no means put us alongside the big boys of Web 2.0. We're going in that direction in, hopefully, a safe and profitable ways.

But even more important is that it may just be possible to upgrade a web application to Web 2.0. If the leadership has the right vision, the technology can be moved forward without loosing the value that's already there.

And yes, there will be more to say about this. I've only just gotten started and there are is some major Web 2.0-ness in what's on my FogBugz queue for the next few releases.

Posted by mike at 12:19 PM

October 5, 2006

Building an Aux Input Cable for Bose SoundDock

Update: I've had a number of requests from folks interested in purchasing this cable. If you don't want to go through the trouble of making one for youself, you can now buy one from CableJive.

It's been about 3 months since I hacked my Bose SoundDock to include an auxiliary input. I've gottent a fair amount of response from folks about it, SoundDock owners everywhere are seriously interested in being able to listen to more than just the iPod on the speakers. However, most folks aren't up for pulling the unit apart and taking a soldering iron to it. A lot of folks have wished for a cable that simply plugs into the iPod connector.

Here's how to do it. With the right tools and supplies it doesn't take more than a few hours.

First order of business is getting a female iPod dock connector from Ridax to plug into the SoundDock. I don't believe there's a home-made solution to this, you've just got to wait for Ridax to get the order processed and the mail to snail it's way to your house. While shopping at Ridax you might notice that they now have a SoundDock friendly adapter that takes a 1/8" jack. Perhaps you'll decide that's a better option, in which case you can skip the rest of this exercise.

I ordered two of the white female adapters a few months back. It took them a few weeks to arrive, and then they sat on my desk for a long time waiting for me to get motivated to tinker. The adapter is easily pulled apart and as you can see has a small metal piece with the stretch of exposed pins that you can use to make connections through the female adaptor to the iPod-compatible device.

Once I had the adapters in hand I wrestled with how to figure out how the SoundDock is activated. My first aux input hack required leaving the iPod on the SoundDock for power activation. With this female adaptor hack I needed to figure out how to turn on the SoundDock from the adapter. I figured worse case scenario is that the SoundDock detects a small battery charge and uses that to trigger the power. The easier place to start was some testing to determine if bridging any of the pins triggered the SoundDock to turn on. After a little trial and error, I got the SoundDock to activate by connecting pin 18 and 19 (counting from left to right). The iPod Connector specs indicate that these are voltage pins. For whatever reason, connecting them triggers the on switch for the SoundDock.

Important notice, please ready the update at the end of this post. There's is more to the story for powering on the SoundDock.

To make that connection permanent I pushed the 18 and 19 pins together until they were crossed and making a solid connection. For good measure I stuck a small spec of solder on the two pins to make the connection more permanent. Not easy to solder on such a small scale, but sitcking just a small shaving of solder onto the crossed pins and pressing the tip of the solder iron down did the trick. Of course I tested to ensure that popping it on the SoundDock did indeed activate the unit. With that major issue resolved the rest was fairly straightforward.

The iPod connector specs indicate that pins 1 & 2 are grounds (connected together on logic board of iPod), pin 3 is right line out, and pin 4 is left line out. I had a spare 1/8" jack with a 2 foot cable in my cable box that looked just right for the job. (I thought about using an RCA-type plug but I think the 1/8" jack will be more universal for my use). After putting a small knot in the end of the cable to help keep it secure in the female adaptor housing I stripped back the ground, left and right wires just enough to give space for soldering. I should add at this point that soldering on these tiny prongs is a challenge, especially if you don't have any special soldering equipment (I have a $10 kit from RadioShack). I was able to get fairly nice, solid solder connections but sensed some risk that there could have easily been a drip of solder that would have covered and connected 5 or more of the tiny pins. You'll notice in the picture that I snipped off a few of the unused pins to the right of the audio connection pins just to free up some space.

With the cable soldered in place I put a good blob of clear epoxy over the soldered wires and pins to reduce movement and ensure the wires would stay in position and not accidentally short out.

After giving the glue some time to dry I snapped the unit together and have been listening happily to my laptop via the SoundDock ever since. It's worthy of note that the sound quality from the SoundDock is much improved over the original hack. I suspect it's because when the iPod is attached the audio out from the iPod causes problems with the aux input, even though the iPod isn't actually sending a signal. The extra hiss that I noticed in my first hack is completely gone when using this cable/adapter.

Important update: Some digging around with the multitester indicates that the SoundDock provides 12V, 500 mA from pin 19. Looking at the dock connector specs indicates that on pin 18, the iPod provides a 3.3V output. Using the multitester on my 4G iPod indicates that it outputs 3.3 V, 40mA. I checked using two 1.5 V batteries and indeed, providing ~3V to the SoundDock on pin 18 triggers the on switch. As documented above, I'm sending 12V, 500 mA into pin 18. It works, but may prove harmful over time. To convert the voltage and amperage down to a safe level a resistor should be used between pin 19 and 18. My calculations indicate that this should be a 250 Ohm resistor (drop 12 V by 8.7 V to be 3.3 V with 40 mA). Am headed over to the electronics shop at lunch to pick a range of resistors up and will update with information when I have a chance to try it.

Final Update: After a few trips to Radio Shack, some diagnistoc work, and conferring with a retired college professor/electrician (my father) I have a final update on connecting the current from pin 19 to pin 18. Pin 19 outputs 12V (firewire, used to charge the iPod). Pin 18 accepts 3.3V (for the iPod to power accessories) and uses that to trigger the on switch of the SoundDock. Initially I thought putting a 220 Ohm resistor between the 12V and 3.3V would reduce the electricity by 8.7 volts and be just what is necessary.

Unfortunately it isn't that simple. A resistor only reduces voltage if there is a significant draw in amps (or milliamps). Circuit 18 draws almost nothing, so putting a resistor between pin 19 and 18 made no significant change in voltage. The amount of draw is undetectable by my multitester. It can go down to hundredths of a milliamp and still wasn't registering anything when attempting to test the draw of electricity from pin 18.

The good news about that is that the SoundDock doesn't seem to be actually using the electricity coming in on pin 18 other than detect that there's some current there. So my original attempt to make a direct connection between pin 19 and 18 to trigger the on switch by sending 12V into the 3.3V doesn't seem to cause short-term damage. It's uncertain whether it causes long-term damage, as pointed out in the comments. Until someone verifies the electronics inside the SoundDock, or an engineer from Bose comments here, it's risky to send the 12V from pin 19 directly into the 3.3V on pin 18. It may prove to be damaging in the long run.

For those of us who'd like to play it on the safe side, there's still a way to reduce the voltage by hooking up resistors in serial and tapping out at the right point to get 3.3V.

Without going into a lot of electrical theory the idea is that you want to connect the 12V to the ground through two resistors, selected in a ~4/1 ratio. If you tap out between the two resistors you will get approximately 1/4 the voltage coming off the 12V. At first I chose a 1K and a 220 Ohm, put the 1K on the 12V side and the 220 on the ground site. Tapping off between them provided just about 3.3V. Since the SoundDock requires almost no current I decided to try a 10K Ohm on the 12V side and a 2.2K on the 3.3V side (both 1/4 watt resistors). Even with close to 0 amps coming off the tap between the two resistors the SoundDock powers on. I believe this is the best method (using the 10/2.2K resistors) for channeling power from the 12V to the 3.3V as it provides only a bare minimum current. I've made a few of these now and will take some photos to post on the next one I make.

Making this cable is just a bit more challenging when you have to put the resistors into the small connector housing.

Posted by mike at 10:13 PM