Monday, August 27, 2007

MythTV Upgraded to R5F1 - now using SchedulesDirect

As I wrote in my last blog post, I've now upgraded my KnoppMyth box to the latest release, R5F1. What a difference five revisions makes! :-P

In the hopes of preserving all the programming that we'd recorded on the prior install, I chose to upgrade, rather than reinstall. That proved to be only partially successful. The raw files still live in /myth/tv, but MythTV no longer knows anything about them. When I have time, I'll try to figure out how to move the videos so that MythVideo will recognize them.

I also took the effort to migrate my listing service from Zap2IT to SchedulesDirect. The project leader for KnoppMyth posted the procedure on the phpBB forum.

Signing up for the service was no problem, and the manual upgrade procedure went fairly straightforward. The only two hiccups I have are with the channels recognized by MythTV for the input source. After doing the upgrade and setting up MythTV to use my SchedulesDirect account, the channel scan failed to eliminate the channels that I don't have. The other problem was that the names for the channels are all listed as "Adding Channel". Both problems are being encountered by others, per the postings to the forum.

If I find any solutions besides just manually correcting, I'll post it.

Saturday, August 25, 2007

Eh, it was time to upgrade MythTV anyway...

Okay, so like I posted last week, I'm interested in figuring out how to export videos from MythTV to my 5G iPod. Also like I last posted, Google lead me there and it wasn't very difficult after all is said and done. The good news is that I was right. Using the following ffmpeg command, I was easily able to take the default format that MythTV records in and export it to a format that my iPod could read.
  ffmpeg -vcodec xvid -b 300 -qmin 3 -qmax 5 \
-bufsize 4096 -g 300 -acodec aac -ab 96
-i /myth/tv/1011_20060820230000.mpg -s 320x240 -aspect 4:3 \
ipod_output.mp4

All I had to do was import the resulting file in iTunes & synchronize the device. Works like a champ.

The bad news is that I killed my MythTV install in the process of doing so.

It wasn't the above command that did the damage, it was my attempts to mess with Myth2ipod. I strongly recommend that any Knoppmyth user avoid it at all cost, if their system is newer than March 2006.

It really is my own fault. I should have taken a moment to look and see that the project hadn't been updated since March 2006. By comparison, I (was) running Knoppmyth R5C7, which was released May 2006. The Myth2ipod perl script is harmless enough, but it was the instructions for upgrading ffmpeg that did me in. Here's what the start of that looked like:
root@mythtv:~# apt-get install ffmpeg
Reading Package Lists... Done
Building Dependency Tree... Done
The following extra packages will be installed:
libasound2 libasound2-dev libavcodec0d libavformat0d libc6 libc6-dev
libdc1394-13 libdirectfb-0.9-25 libgsm1 libogg-dev libogg0 libraw1394-8
libsdl1.2-dev libsdl1.2debian libsdl1.2debian-alsa libsysfs2 libvorbis-dev
libvorbis0a libvorbisenc2 libvorbisfile3 locales tzdata
Suggested packages:
libasound2-plugins libasound2-doc glibc-doc manpages-dev libraw1394-doc
Recommended packages:
libaa1-dev libdirectfb-dev libcucul-dev
The following packages will be REMOVED:
alsa-headers base-config initrd-tools libsdl1.2debian-oss
The following NEW packages will be installed:
libavcodec0d libavformat0d libdc1394-13 libdirectfb-0.9-25 libgsm1
libraw1394-8 libsdl1.2debian-alsa libsysfs2 tzdata
The following packages will be upgraded:
ffmpeg libasound2 libasound2-dev libc6 libc6-dev libogg-dev libogg0
libsdl1.2-dev libsdl1.2debian libvorbis-dev libvorbis0a libvorbisenc2
libvorbisfile3 locales
14 upgraded, 9 newly installed, 4 to remove and 633 not upgraded.
Need to get 17.3MB of archives.
After unpacking 4898kB disk space will be freed.
Do you want to continue? [Y/n] y


I had a bad feeling about it when I saw so many packages that were being replaced. In the end, when I went to reboot to validate nothing serious was broken, MythTV wouldn't go past the boot splash screen. (I can't even find a way to get the raw output from the boot, the box locks up just after the LILO screen disappears).

All the same, Knoppmyth's latest release is R5F7, published May 2007. So, I'll just rebuild with that (hopefully I can save all the TV shows I've recorded).

After I get MythTV up and running again, I'll hack that myth2ipod script and make it work with the modern version. I'll then post the results, after I get it cleanly done.

Sunday, August 19, 2007

iRediculous

So as I count down to my iPhone1, I try and make do as best I can with my iPod. One thing I have yet to do is figure out how to convert MythTV default format AVI files to the iPod video format I've don't that once before, but I didn't really figure out a quick & easy way to do it repeatably. Thirty minutes experimenting with transcode and a little research on Google and I'll have it.

In the meanwhile, I figured it'd be quick and easy to put some eBooks on the iPod. Sure enough, when I look on my iPod in the "Extras" menu, I see a "Notes" section, with the following text:
To view text files here, enable iPod for disk use, then drag text files to the Notes folder on iPod. See the iPod Features Guide or go to www.apple.com/support/ipod for more information.


Simple enough.

Connecting my iPod to my PC, I activated "Enable disk use" for the device. It then appeared in my explorer as E: drive, with a "Notes" folder under the root. Doing some research, I learned that the iPod will allow up to 1000 files, each with up to 4012 characters. That's a fair bit of text, though I would have expected more, given the disk space on the gadget. But then, I guess Apple is all about multimedia these days (sound and video, not text).

Given that the Gutenberg Project has lots of great books, there's lots of free content to choose from. So, I wrote up a simple Perl script to hack up a large text file into smaller pieces so it could fit into the iPod's inane requirements.

Here's what I came up with.

#!/usr/bin/perl

$filename = $ARGV[0];
open(INFILE, "$filename");
undef $/;
$content = ;
close INFILE;
$ipod_max = 4012;
$ipod_max -= 17; #Title tags
$ipod_max -= 34; #tail link tags
$ipod_max -= length $filename;
$ipod_max -= 7;

print "Slurped ". length($content) . "\n";
$chapter = 'CHAPTER ';
#break it up by chapters
@chapters = split(/$chapter/, $content);
print "Found " . $#chapters . " chapters.\n";

$count = "000";
foreach $chapter (@chapters)
{
print "Working on chapter $count, ";
my $part = "001";
my $outfile = $filename;
$outfile =~ s/\.txt/$count\.$part/;
open (OUTFILE, ">$outfile");
$content = "CHAPTER ";
@chapter_by_lines = split("\n", $chapter);
$chapter_length = length($chapter);
print "found ". $#chapter_by_lines . " lines ($chapter_length bytes)\n";
foreach $line (@chapter_by_lines)
{
$len_content = length $content;
$len_line = length $line;
$len_total = $len_content + $len_line;
if ($len_total > $ipod_max)
{
$part++;
$outfile =~ s/[0-9]{3}$/$part/;
print OUTFILE $content;
close OUTFILE;
$content = "";
open(OUTFILE, ">$outfile");
}
if ($line =~ /^$/)
{
$content .= "<b><p>$line";
} else {
$content .= "$line";
}
($chapter) = $content =~ /(CHAPTER \S+)/;
}
$count++;
print "Writing to $outfile...\n";
print OUTFILE $content;
print "done.\n";
close OUTFILE;
$content = "";
}


Running the script on Huck Finn from the Gutenberg Project looks like this:
earnoth@twinstar[07:32 PM|508]$ bin/splice_book.pl books/huckfinn.txt 
Slurped 597298
Found 43 chapters.
Working on chapter 000, found 72 lines (1748 bytes)
Writing to books/huckfinn000.001...
done.
Working on chapter 001, found 116 lines (7207 bytes)
Writing to books/huckfinn001.002...
done.
Working on chapter 002, found 234 lines (12337 bytes)
Writing to books/huckfinn002.004...
done.
<SNIP>
Working on chapter 043, found 433 lines (22487 bytes)
Writing to books/huckfinn043.006...
done.


The result is 172 text files, all less than 4012 characters long (avg 3400). A nice fit on the iPod.


Monday, August 6, 2007

New Brew - American Cream Ale

Yesterday I brewed a new beer, an EZbrew American Cream Ale. It's a pretty simple brew, using both liquid and solid malt extract, along with some cluster hops. The only interesting part is the lactose that gets added during bottling (making the cream part of the ale).

This morning the fermentation started off strong, bubbling well. This afternoon it's tapered off a bit. I'm concerned the higher temperatures may be impacting it. My pantry seems to run a bit warm in the summer.

I'm writing it up in my Document Trove.

Sunday, August 5, 2007

New Document Trove online

Previously I attempted to set up documentation for my various geek efforts. It was modestly successful for what it was, I received comments from a few people that they found the write ups useful. Unfortunately, MediaWiki proved to be a very high-maintenance and difficult to use wiki solution.

So now that I've finished migrating my website from one hosting company to another (more on that later) I've set about recreating my Document Trove. Unfortunately, the database that I had been running on was corrupted, so I lost the two-dozen articles I'd posted. It's partly my own fault, however, as I hadn't backed up the database in a long time. However, the former hosting provider was no help (again, more on that later).

Fortunately, I was able to salvage a few postings. Thank heavens for Google's cache. ;-)

My new Document Trove is running DokuWiki. I'm very pleased with it. It follows all of the standard Wiki conventions, and doesn't require a database backend. Very slick.

Wednesday, July 4, 2007

Remapping CTRL and CAPS LOCK in Windows Vista

As any Unix geek will quickly tell you, one of the greatest frustrations of serious geeks with the PC keyboard is the placement of the CTRL key and the CAPS LOCK key. Look at your PC keyboard, you'll see the CAPS LOCK by your "a" key and the CTRL key waaaay down in the bottom left (and usually also on the right). That wasn't the way it was back in the day. Once upon a time, the CAPS LOCK and CTRL keys were switched.

Now, I'm too young to have cut my teeth on Sparc stations, mainframes, mid-ranges, or minis back in the days of BSD and AT&T Unix, where these keyboard configurations were standard. However, I've read about them in various Linux & FreeBSD mailing lists, websites, etc. Amongst the Linux crowd, it's still a big todo.

Having carpal tunnel syndrome and being an avid Linux CLI user, the concept was always appealing to me. For those that don't know, the CTRL key is used heavily in advanced CLI operations (e.g., CTLR-L will clear your terminal screen, CTRL-U will clear the line of text you're typing, CTRL-K will clear the text after your cursor, etc.)

Since it's so heavily used, putting the CTRL key next to the "a" key makes a lot of sense. One doesn't have to move too far from the home keys in order to hold it down while pressing the other key of interest. One also strikes the CTRL key far more frequently than the CAPS LOCK key. Less movement of the fingers is a BIG and GOOD thing when having to deal with RSI. That's the same reason I'm teaching myself the Dvorak keyboard...but that's a story for another post... ;-)

So, switching the CTRL key with the CAPS LOCK key is a very good idea, for those of us who live on the command line interface.

In either case, the remapping is easy enough to achieve in any Linux distro. I had thought I could achieve the same in Windows using Mark Russinovich's CTRL2CAP. It's worked well for me in the past, on Win2K and even WinXP. However, my new Toshiba is running the dreaded V, and I face the imminent and depressing prospect of having to use the same at work. So, finding a way to make the switch was somewhat important to me.

After a thorough job of Googling, I found this link with instructions to directly manipulate the Windows registry to achieve the switch in WinNT and Win2K. I was wary about it working, since when I clicked through on the in-depth technical background on the registry tweak referenced a mailing list posting from 1996 that talked about the hack definitively working on NT 4.0, and maybe on 3.5...!

Still, I figured, what's the worst that could happen?

The answer is, nothing bad happens. I got it wrong the first few times and nothing failed or crashed, it simply didn't change anything. Once I got it right, it worked like a champ on Windows Vista. I fixed my keyboard problem, my CTRL key is now completely switched with my CAPS LOCK. I'm now a much happier and healthier geek.

Oh, just in case the page evaporates, as things are wont to do on the Internet from time to time, here's the original posting in full:
Windows Registry Key-remap
Changing NT and Win2K Keymaps through the Registry

1. Run Start->Run...
2. Open: regedt32 to edit the registry.
3. Select the key

HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Keyboard Layout


4. From the Edit menu, choose "Add Value" to add a value named "Scancode Map" with type REG_BINARY.
5. Set the value for the layout you want (copy and paste the bold text below):
* Map CapsLock -> Left Ctrl:
0000000000000000020000001d003a0000000000
* Swap CapsLock and Left Ctrl:
0000000000000000030000001d003a003a001d0000000000
* CapsLock->Left Ctrl, Left Ctrl->Left Alt, Left Alt->CapsLock:
0000000000000000040000001d003a0038001d003a00380000000000
6. Reboot your machine


I tried the third option, to do a full three-key switch between CTRL, ALT, and CAPS LOCK, but immediately realized it was a mistake. The ALT key is used too frequently for things like ALT-TAB window switching. It's native placement by the space bar makes it handy to hit with the thumb, which is the strongest digit on the hand - a good thing for those of us with carpal tunnel.

In addition, here's the original email that the original poster references. It's fairly interesting.
Scancode Map Email

From: Shane Holder <holder@mordor.rsn.hp.com>
To: "Jeff McCarrell" <jwm@cccpp.com>
Cc: cmcmahan@Teknowledge.COM, Jonathan Payne <jpayne@marimba.com>, ntemacs-users@cs.washington.edu
Subject: Re: Re[2]: problem with caps/ctrl swap on NT 4.0
Date: 04 Dec 1996 14:36:21 -0600


Found this on the net somewhere.

Add this value:

HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\KeyBoard
Layout\Scancode Map

It's a binary value that lets you map keystrokes in the low-level keyboard drivers in NT. As a result you don't have to worry about applications bypassing mappings that you've done at a higher level (i.e. it just works).

Here's the format of the value:

DWORD: 0x00000000 header
DWORD: 0x00000000 header
DWORD: length (in DWORDs) of remaining data, including terminating DWORD
DWORD: mapping 1
...
DWORD: mapping n
DWORD: 0x00000000 terminating null DWORD

Each mapping DWORD has two parts: the input scancode, and an output scancode. To map scancode 0x1d (left control) to scancode 0x3a (caps lock), you want a value of 0x003a001d. Note that this does not swap the keys. Using just this mapping value, both the left control and the caps lock key will behave as caps-lock. To swap, you also need to map 0x3a to 0x1d, using 0x001d003a. So, the complete registry value you'd use to swap left-control and caps-lock is:

00 00 00 00 00 00 00 00 03 00 00 00 1d 00 3a 00 3a 00 1d 00 00 00 00 00

This works on NT 4.0, I don't know about 3.51. This registry value is system wide, and can't be made user-specific. It also only takes affect on reboot.




--
Shane Holder e-mail: holder@rsn.hp.com
Hewlett Packard phone: (214)497-4182
3000 Waterview Never underestimate the bandwidth
Richardson, TX 75083 of a truck moving at 70 MPH.


So, I hope this posting helps some other poor geek who's tearing out his hair about how to make Windows Vista somewhat tolerable to work within. (I'd say work with, but it's more similar to operating within the confines of a cage, really...)

Friday, April 6, 2007

Toshiba Satellite A135-S4427: More Display problems

As nice of a unit as the new laptop seems to be, it has not been without its problems. I bought the computer about two months ago. Just past 30 days of purchase, the LCD back light went dead. After backing up my data I took it back to CompUSA and asked for an exchange. They gladly obliged me (mainly because I had bought their extended warranty). Within 20 minutes, I had a brand-spanking new laptop and was happily on my way.

Fast forward to today, and suddenly in the last twenty-four hours my screen has stated acting...funny. I've been booted into Windows since this morning, and whenever I open my lid, the display flickers in a frighteningly familiar fashion. It's very similar to the way the LCD back light on the last unit started behaving before it went kaput.

Naturally, this has me greatly concerned. It's only just started, and maybe it's just the way that Windows behaves vs. Ubuntu (where I haven't yet seen such a strange behavior). I'm going to watch it closely over the next few days, however. I have a bad feeling this one's on its way out, too.

If this goes, I'm getting something completely different. Should I have a second dud unit, it either speaks poorly for this model of Toshiba or Vista, or some combination thereto.

God I hate hardware...

Sunday, April 1, 2007

New Laptop - Toshiba Satellite A135-S4427

Recently I bought a new laptop, a Toshiba Satellite A135-S4427. It's a decent enough, middle-of-the road computer. It has a dual core Centrino chip, 1 GB of memory, and a 120Gb HD. In all, pretty good for a laptop. :-)

Of course, I had to install Linux on it. I wasn't about to run with Windows Vista as my primary OS. I've been playing with Ubuntu lately, and have been pretty pleased with it. So, I decided to give it a go as a laptop OS.

Unfortunately, I couldn't just wipe Windows. There are still some apps that I need (Quicken foremost among them) so I went dual boot. Compared to previous Windows versions, it wasn't quite so painful a process. The last time I did it, I needed some next-gen Fdisk that could handle resizing existing NTFS partitions. Now, with Vista, Microsoft has finally put in facilities to resize the disk natively.

The install for Ubuntu was a breeze, as is just about everything with that distro. Most things just worked the only exception being (drum roll please...) ACPI. This, however, should not surprise any Linux aficionado whose used a Toshiba laptop. Unfortunately, the Toshiba BIOS tools available for Linux don't work on this model laptop, as it's of of the models using a Pheonix BIOS.

The ACPI support I've got is limited. Hibernation and screen blanking work, but suspend doesn't (the system never quite gets all the way into suspend mode and doesn't come back). The fan seems to work, but I get the sense it's a dumb thermistor switch in the BIOS that is not managed by the OS. I can't read the system temperature, the CPU speed isn't being stepped, and I can't adjust the screen brightness (in fact, none of the special Toshiba function keys work).

I've done some initial investigation into additional packages to deal with the Pheonix BIOS on Linux. The main (only?) one I've found is the Omnibook project. However, the project doesn't seem as well maintained as its sister project.

So, hopefully I'll be able to pursue more research soon and figure out how to make it work. My ambition makes me want to contribute to the Omnibook project, but my expectation says I don't have the requisite experience to write code for kernel modules. :-P

Wednesday, March 28, 2007

First email post!

Just giving the post-by-email thing a try.  It's a pretty clever delivery mechanism I just wish the security was a little better than a "secret" value in the destination email address itself. 

Then again, it's about all that one might expect for simply making use of simple email.  It's not like there's any hooks for an authentication mechanism, or anything.

I've also been looking at client software with which to post, but it seems like the move of Blogger to a Google service has broken the old apps that were written for Atom.  I checked the Google API developer's guide and compared it to the atom.c file in drivel, a nifty-looking Linux client for Blogging.

Unfortunately, in comparing the code, it looks like going out of Beta for Blogger 2 also brought a new API, which perhaps requires a rewrite of the other client packages out there?

On the other hand, it might simply be a user error.  When I try and log into the https://www.blogger.com/atom URL, it doesn't seem to acknowledge my account.  Maybe that's a Blogger v 1.0 thing, though. 

Still too new to know.

C'est la vie.

My blog, version 3.0 - First Post!

Ever since the mid nineties, I've been dabbling with posting stuff online (though it wasn't called blogging back then...). My website has gone through many different forms over time, from a set of static pages hosted first on my home account the University of Delaware webservers to hosted on @Home and then Comcast.net.

Then I decided I wanted something a bit more elegant, and got myself a small web hosting account. I installed PHPNuke (what was I thinking??) and ran with that for a while. It was fairly serviceable, though not very well suited for a blog. In particular, spammers started to exploit security holes to post their garbage. Not to mention, I had the entire burden of administration. Backups, upgrades, all that happiness.

So, I locked the site down and tried some software specifically suited for blogging. Simple PHP Blog was the software I settled on, for the very reason of it's namesake. It was simple. While I found the result appealing for a while, it too had its disadvantages. Again, as time went on, security holes were found and spammers started to spew upon it.

In addition, since my site was off on its own, there was nothing really to draw people to it. what's the point of blogging if no one's watching?

So, I figured I'll give an account on Blogger a try. Allow me now to christen my latest blog version with the time-honored Slashdot tradition...




....FIRST POST!!!