Profile cover photo
Profile photo
Fred Sobotka
The database is the beating heart of your company.
The database is the beating heart of your company.


Post has attachment
The beautiful, shiny interior of Granville Island Brewing in Vancouver, BC.
Add a comment...

Post has attachment
This single-page cheatsheet is an impressive reference for anyone who uses bash to get things done. Some of these little two-character tweaks can remove the need for a small program or at least a few lines of scripting code.
Add a comment...

Is IPv6 the next Y2K?
How will your code react to IPv6 network addresses?

» Introduction Just as Y2K required a serious sweep of software, firmware, and storage, there's also no hiding from the impact that IPv6 addresses will have in your environment, even if your organization has the luxury of staying on IPv4 indefinitely.

» It's time for a new IT scare
Remember how entertaining it was back in the 1990s to speculate on the potential severity of the Y2K bug? There was practically no upper bound on what could break, providing a diversity of failure scenarios that sparked passionate debates, even among Y2K true believers. Although we've moved on to other techno-bogeyman issues since then, most of them aren't as broad and sweeping as the Y2K scare. That may change, however, once more systems start recognizing and using IPv6 network addresses, but first, a bit of background.

» How did we get here?
It took a while (about 30 years or so), but we finally burned through the billions of unique, globally routable IPv4 addresses that a 32-bit number can hold. None of this comes as much of a surprise, so the imminent exhaustion of the planet's IPv4 addresses is not the big, new scare I alluded to earlier. In fact, the cabal of bearded, suspendered elders who control the Internet Protocol IETF started anticipating this event so long ago that they've had ample time to discuss and invent a new protocol called IPv6, which offers many benefits over IPv4, in particular a massive 128-bit address space. Hardware and software vendors have already spent years making the necessary adjustments, leading to an ever-growing market IPv6-enabled products for home and business use.

» I inflict IPv6 on my home office
When my ISP told me how much it would cost to add more static, globally routable IPv4 addresses to my network, I decided instead to enable IPv6, which gave me a practically limitless supply of unique network addresses at no extra charge. My firewall, computers, and media devices already supported IPv6, so I figured it would be a slam dunk, and for the most part, it was. The exception was a sneaky, highly localized bug took some time for us to notice, but, when found, immediately reminded me of the spooky "what if" scenarios trotted out by the old Y2K worriers.

» The thing that broke under IPv6
Like Y2K before it, the reason to treat an IPv6 rollout with a healthy amount of caution and respect is the sheer amount of code written on an increasingly incorrect assumption, in this case, the format of a network address. When I slapped a numeric IPv6 address on everything in my home that could handle it, an obscure little program on my media player stopped working. That program was a third-party MythTV helper script I downloaded and installed to play ISO copies of my DVD collection, and I'm not even upset at it for failing the way it did. After all, it would be unfair of me to single out an otherwise useful script for exhibiting the same short-sightedness that is baked into countless other programs.

Dangerous Assumption #1: Neither a host name nor a numeric IP address will ever contain a colon.
The script used : as a field separator to parse what it thought would be a host:port string, so a perfectly valid IPv6 address like [1234:5678:90ab::cdef] was treated as host [1234 followed by port 5678. That misstep alone was enough to stop the program dead in its tracks.

Dangerous Assumption #2: Network addresses won't contain special characters that require escaping in a regular expression.
The script simply pasted the host and port directly into the search pattern of a search-replace regex - no backslashes or anything. Since IPv6 addresses can contain square brackets that have special meaning inside of a regex search pattern, the expression won't work as intended when [ or ] isn't escaped with a preceding backslash.

» Other Dangerous Assumptions to Hunt Down and Kill
- Program variables and database columns that aren't wide enough to store numeric IPv6 addresses
- Input normalization routines that shrink or expand IP addresses by adding or removing leading zeroes
- Logic used to recognize localhost, internal, external, and broadcast addresses
- Easily overlooked data validation rules that are buried in XML Schema documents and database column constraints

Good Luck,
+Fred Sobotka
Add a comment...

Post has attachment
During my most recent attempt to organize my office, I came across an old gigabit switch that I'd stopped using after its internal fan became too noisy to endure. I admit I may hold on to old gadgets longer than I should, but I kept reminding myself that - aside from the terrible noise it makes - this switch is still fairly decent and worth keeping.

Nearly three years ago, I started looking for help on how to fix it, but I didn't find any encouraging leads. Every few months, I'd fire up the same searches and see if anyone had gotten further with it than I had, only to find my own question as one of the top-ranked results. That all changed this week, when I expanded my search to include other models in the same product family. As I'd hoped, the other models were built more or less the same way, and the largest models attracted an even greater interest in quieting down its angry fans. Naturally, I used this information to reply to the same question I originally posted back in 2009.
Add a comment...

Post has attachment
Assuming the document is authentic, this would have to be the most enjoyable and sincere employee manual I've ever seen.
If you don't already know about Valve Software, your kids probably do. Valve makes really good computer games, so good that fans go on pilgrimages to Bellevue, WA to picket the company to offer thanks and/or beg for an earlier release date for the next installment of a beloved game.

Valve also runs Steam, a software licensing and delivery network that is second only to outright piracy in terms of ease and reliability.

Sections of the handbook remind me of a small software firm where I used to work. (Mostly) good times.
Add a comment...

Post has attachment
Add a comment...

A few quirks about posting on Google+

I'll admit that my intended use of G+ as a basic replacement for Blogger is perhaps not a reasonable expectation, but I decided to explore it anyway and found more than a couple surprising limitations.

You've only got one shot at specifying which of your G+ circles can see your post. After that, it can only be an embedded as an attachment in a new post with a new URL.
Since G+ doesn't a "save a draft" option, I thought I could approximate this feature by initially publishing it to a deliberately empty circle. Although the content of a G+ post can be edited repeatedly, its visibility cannot. When I was ready to publish the post to Public, my only choice was to attach it to a new post, which creates a distracting citation headline and indents everything from the original post.

If you edit a G+ post that's already been embedded in another post, the changes do not propagate.

G+ posts don't show up in generic, public Google search results nearly as quickly as updates to other web sites.
Sure, you can see your own G+ posts in Google Search right away when you're signed into your Google account, but it can take days before the rest of the web will see the same post in the Google results of a keyword search.

Google forces you to sign on to Google Accounts just to view a public G+ post from Safari on iOS (iPod, iPhone, etc.).
This has got to be a defect. I can't think of any other explanation for such an unreasonable policy.
Add a comment...

Post has attachment
Does anyone know how long it takes Google to index a G+ post? I shared my MythTV build notes so people could find them when searching for a solution to specific problems, but the post is still not showing up in Google Search unless I am signed on to Google+.
Add a comment...

Post has shared content
After a few years of running MythTV 0.21 as part of an old Knoppmyth distro, I recently reloaded my MythTV box with Mythbuntu 11.10, which runs MythTV 0.24 on Ubuntu Oneiric Ocelot. MythTV is a wonderful mix of programs that really have come a long way, but there are still more than a couple challenges facing its users. The only way I have any chance of efficiently handling hardware or software issues later on is to take lots of notes during the build, so I am posting mine here, not only to assist other MythTV enthusiasts, but also to remind my future self how I got here in the first place.
My Rig

MythTV version: Mythbuntu 11.10 running MythTV v0.24.1-80-g1de0431, fixes/0.24 code branch
Setup type: Single server running mythfrontend and mythbackend
Mainboard: Intel DG965OT mainboard (965 Express chipset) with latest BIOS applied
CPU: Core2 Duo E6320 1.86GHz with 65W TDP and 60.1℃ max temperature
RAM: 4x1GB Corsair PC2-6400 800MHz 240-pin DDR2 CL5 Dual Channel
Graphics adapter: Asus GeForce GT520 fanless PCIe2.0 x16 with GF119 core and 1GB video RAM
Capture: Two pcHDTV HD-5500 PCI capture cards
Boot drive: WD3200AAKS-75B3A0 Caviar Blue 320GB 3.5" 16MB Cache, 7200 RPM SATA II
Media drive: WD1001FALS-00J7B0 Caviar Black 1TB 3.5" 32MB Cache, 7200 RPM SATA II
Optical drive: DVD-RW drive connected via IDE ribbon cable
IR receiver: Streamzap USBIR2
Remote: Logitech Harmony 628 (MythTV frontend is defined as a Streamzap Media PC)
Display: Samsung LN-R268W 720p 26" LCD HDTV, connected with VGA cable
Output resolution: 1360x768, 60Hz
Video signal: Clear QAM-256, carrying digital SD and HD content from Comcast
Scheduling data provider: subscription

The following section describes the actions I took to resolve a variety of issues I encountered on the road to achieving a hassle-free MythTV. I am certain that some of the actions I took weren't the most efficient way to solve the problem at hand, so please post comments if you think I overlooked a more straightforward or elegant approach.*

Significant Issues

Problem: Booting from installation CD shows "Select CD ROM boot type" menu with two empty choices
Solution: Selected option 1, pressed ENTER, and hoped for the best. So far, so good.

Problem: Booting the install CD with default settings fails with "unable to load a failsafe session"
Solution: Press TAB at the right moment to bring up boot options, press F6, and remove "quiet splash" from the end of the boot string.

Problem: Frontend volume level is forgotten between sessions
Solution: Increased volume levels with alsamixer, then locked them in with sudo alsactl store

Problem: Image quality of HD channels on Live TV is very poor (purple vertical stripes and other visual artifacts)
Solution: Installed latest proprietary nVidia drivers and enabled VDPAU for better HD playback

Problem: If first channel watched in Live TV session was SD, changing to an HD channel always fails and then exits to the main menu with "Error opening jump program file buffer" message
Solution: The error message turned out to be more of a side effect than a pointer to the underlying root cause, which was inappropriate default configuration settings for the DVB-based pvHDTV capture cards. The problem went away after I enabled quick tuning for the capture cards, and restricted each card to record only one stream at a time.

Problem: Accessing the on-screen program guide when playing back pre-recorded content (either a pre-recorded MythTV program or a MythVideo file) results in unwatchable video (very dark, with a grainy picture) after exiting the guide. The grainy pattern is apparently a background texture from the MythTV menus that is not hidden properly when the guide is dismissed.
Solution: Until a fix is available (presumably in version 0.25), avoid bringing up the guide during playback, and limit its to Live TV sessions only.

Minor Issues

Problem: OSD menu options for grabbing metadata from the web for MythVideo recordings don't appear to work
Solution: Added LIRC remote mapping for w key (DownloadMetadata), which works better than the options on the MythVideo popup menu.

Problem: Poor handling of DVD ISO files in MythVideo
Solution: This problem may only involve ISOs of DVDs that are still CSS encrypted, but I wasn't interested in converting my files. Instead, I found a MythTV community script called (which uses the mythavtest player) and defined the script as an alternate player for ISO files.

Problem: MythVideo metadata grabber occasionally overwrites data for archived TV episodes with incorrect data from
Solution: Renamed video files to work better with the parser's built-in logic for grabbing the title, season, and episode number from the name of the file. In some cases, that wasn't enough, so I also made a few spot edits in the video manager area of MythWeb, and occasionally sent some hand-crafted update statements to the videometadata table in MySQL. Assigning the proper ID number from TheTVDB or TheMovieDB helps a lot, along with the season and episode numbers for TV shows.

Problem: MythTV 0.24 does not allow live TV to have different remote key bindings than playing back a recorded MythTV program or watching a movie in MythVideo. This is unfortunate, since everyone in my household had grown accustomed to different menu button behavior in older versions of MythTV. In version 0.21, pressing the menu button would show the program guide (S) in live TV mode, and the regular pop-up menu (M) when playing pre-recorded content. Developer messages to the mailing list hint that a future MythTV release will re-introduce this ability through a hierarchy of context-specific key bindings, but this quirk was distracting enough to warrant an immediate workaround.
Solution: After more than a couple unsuccessful attempts to coax MythTV into behaving the way I wanted (see below), I took the problem to the LIRC layer and achieved exactly what I wanted through irexec, a LIRC utility that spawns programs based on IR keypress events. The menu key on the remote now triggers an irexec action that spawns a simple shell script to determines if the frontend is currently watching live TV. If it is, then the script sends an S key (via /bin/netcat) to MythTV's network control daemon, otherwise it sends an M.

Problem: System events triggered by pressing keys on the remote do not fire while watching TV or any other video playback mode
Solution: Gave up on MythTV system events and instead used irexec to bind a keypress event to a command string

Problem: The irexec utility won't find your LIRC mappings unless it is spawned by the user that starts the Xwindows session and start mythfrontend.
Solution: Define the irexec key binding and command string in ~/.lirc/irexec, and ensure that ~/.lircrc references ~/.lirc/irexec in its list of files to include. When MythTV detects the presence of an irexec mapping during the frontend startup process, it will spawn an irexec daemon as the correct user.

Problem: Accessing the network control daemon on the frontend via nc (netcat) can crash mythfrontend if the connection is broken while the server is still sending its response to a query or command.
Solution: Invoke netcat with the -i 1 option to specify an interval delay of 1 second between commands, which will give the server enough time to send its response. An alternative that works a bit more quickly is the -q 1 option, which only incurs the delay after issuing the final command. A full second of wait time is quite a lot, but, unfortunately, it is the shortest delay that netcat will allow.

Problem: Query functions provided by the network control daemon can be unacceptably slow when accessed via /bin/netcat, since the minimum mandatory netcat delay interval is one second.
Solution: See if the desired information is published somewhere on the MythWeb server, and, if so, retrieve it instead over HTTP with /usr/bin/wget.
Add a comment...

Post has attachment
Wait while more posts are being loaded