Sean’s Obsessions

Sean Walberg’s blog

From My Monitor

On one of my monitors at work I’ve been putting a label it whenever I come across a relevent saying. Here’s what I have so far:

Never attribute to malice that which can adequately be explained by stupidity
Don’t screw the pooch
The early bird gets the worm, but the second mouse gets the cheese
90% of the Internet is crap, I’m not sure about the rest
Darwin was right
On the Internet, nobody can hear you being subtle
The simplest explanation is probably correct
Measure with a micrometer, mark with chalk, cut with axe

BenQ Monitors Buy BenQ Monitor in Australia

MythTV Working Great

Hauppauge dropped their prices on the PVR-350 to $150US, so a few friends and I split the shipping and bought some. A few hours later, my Myth box was up and running, and I’ve been slowly tweaking it. I ran into a few snags, which I’ll explain below.

Previously I had used KnoppMyth, but since I was keeping this one around I wanted to use Fedora like my other computers. I followed the instructions in the Step-by-step guide to building a MythTV System on Fedora Core 4 w/ATrpms, which was excellent.

The only problem I had with the document was that some yum repositories had bad keys, so I ended up changing “gpgcheck=1” to “gpgcheck=0” in /etc/yum.conf and /etc/yum.repos.d/*.

The lirc_i2c module that controls the PVR-350’s remote wouldn’t load on boot, so I added

modprobe lirc_i2c
service lircd restart

to /etc/rc.d/rc.local to load it and restart lircd on boot.

The window was too big for the TV, which meant the edges of the screen were cut off. After working on this for a while with a friend, we realized that changing the size of the X-Windows display was going to be impossible, so fixing the MythTV components was the way to go.

From within mythfrontend, go to Utilities/Setup -> Setup -> Appearance. In the second screen, I set the GUI width and offset as follows:

This makes the frontend window fit on the TV (your settings may differ). Setting the GUI size rather than 0 for automatic made things a lot easier.

Utilities/Setup -> Setup -> TV Settings -> Playback , find the Overscan page. The following settings made the on screen stuff work:

Finally, fixing the TV out part was done with:

# ivtvfbctl
Syntax is:
ivtvfbctl /dev/fbX the framebuffer device for your tuner card
[-window left top width height] sets the screen area to use for video

#ivtvfbctl /dev/fb0 -window 45 45 630 390

The last line was put in rc.local. The easiest way to determine these numbers is to start watching TV, and log in remotely to your MythTV box. I started off with 100 100 100 100 and worked on the top left corner, then the bottom right.

When in the menus, there are some acceleration buttons that can be checked, I checked them all. The ffmpeg stuff seemed to make the biggest difference.


It looks like Amazon has these cards for $138 plus free shipping, which is cheaper than the way we ordered it if you’re in the US.

Reordering Tapes in AMANDA

AMANDA has been my favourite Unix backup solution since I was first introduced in 1998. After rebuilding my workstation (which hosted the tape drive), I started reusing my old tapes. Somehow the tapes got out of order, so I ended up with a weird sequence like 1,2,4,7,11,…

I finally got annoyed enough to do something about it. After using tape BackupSet204 from BackupSet2 I was prompted to put in BackupSet207 for the next run.

$ amadmin BackupSet2 tape
The next Amanda run should go onto tape BackupSet207 or a new tape.

To make BackupSet205 the next tape, remove it from the pool, forcing the next tape to be a new tape:

$ amrmtape BackupSet2 BackupSet205
amrmtape: remove label BackupSet205.
Warning: no curinfo record for mythupstairs:/etc
amrmtape: preserving original database in curinfo.orig.26763 (exported).
Discarding Host: bob, Disk: /home, Level: 2
Discarding Host: bob, Disk: /home, Level: 3
Discarding Host: poochie, Disk: /dev/Volume00/LogVol02, Level: 2
Discarding Host: poochie, Disk: /dev/Volume00/LogVol02, Level: 3
-bash-2.05b$ amadmin BackupSet2 tape
The next Amanda run should go onto a new tape.

Now I just do this whenever I’m prompted for the wrong tape, and soon, I’ll be back in order.

This also points out that if you’re expanding your pool, do it when you’re at the last tape. Otherwise, your new tapes will be inserted in the middle!

Things I Thought I’d Never Have to Do

Wipe someone else’s bottom
Jump for joy when someone pees
Let myself be a trampoline
Eat a two year old marshmallow cookie so that _someone_ wouldn’t get at it and spend the next hour running in circles screaming
Use the phrase “leaving without dignity”
Leave without dignity
Stay up all night cleaning up after a pukey toddler
Look around the room for “pirates and cats” before one goes to bed

And so forth.

Happy Father’s day to all the Dad’s out there!

PVR’in With MythTV and Hauppauge WinTV PVR 350

I’ve been wanting to build a PVR with MythTV for a while, and when talking to my friend Barry McKay about it, he said he had a Hauppauge PVR-350 I could borrow. So, I took him up on the offer, and with an old PC I built one.

However, much of the documentation I found on setting this up was out of date, resulting in some extra work for me to get it going. The rest of the article shows how I set it up.

The PVR-350 has hardware encoding and decoding, along with TV out. This means that it’s usable on low end computers, and can handle both the recording and viewing of TV. Since it only has one tuner, you can’t simulatenously watch a show and record a different show, though you can watch the show you’re recording.

I ran it on a P3-700 with a 10GB disk. It was pathetic until I got the hardware decoding for TV out working (hardware encoding is on by default). After that, it ran perfectly with very little CPU activity.

I used KnoppMyth R5A15.1, which is a live CD based on Knoppix. The idea is that you boot the CD, select “Autoinstall”, and it images your hard drive with a full MythTV installation, including extra utilities. That was the first step.

I followed the instructions for the autoinstall, and then followed the prompts in the setup as follows.

After boot (output to monitor), enter the root password.

From now on, use tab to select the field, and the left/right arrows to change options. Some menus may require you to select “new” before being able to enter the settings.

Here are my settings:

Option 2, Capture cards. This defines what will be recording the TV:
mythsetup_2.jpg

Option 3, Video Sources. This defines where you’re getting your channel listings from. For this one, once you enter your username and password (assuming you’re in North America), it will retrieve the lineups you register over on Zap2It (see next paragraph)
mythsetup_3.jpg
You need this lineup not only for the schedules, but it populates the SQL database with the frequencies of the channels. Without this, you can’t watch TV (or you only get one channel)

My username and password were registered at labs.zap2it.com using code ‘TGYM-ZKOC-BUTV’ (Letter O, not zero). Give it some time!. The site was slow. I had to wait overnight before the previous step worked.

Option 4, Input Connections.

Unfortunately I don’t have the card anymore so I can’t show this screen. All I did was linked “Tuner0” to “Cable” for my card, essentially giving Myth the linkage between the card and the channels (you can have multiple tuners)

After that, reboot, and MythTV should work. I was able to watch TV on my monitor, pull up a list of channels, and record stuff.

The next thing was to get the remote working. Even though the 350 should come with a Grey remote, I had a silver one, and guess what, they’re all different. I followed the instructions for the PVR 250 Remote, which had me download new config files for lirc and it worked. Note that the model number they say on that page didn’t appear on my remote.

At this point, the only thing left was TV out. Follow the instructions on the Wiki, until you finish step 2. Then run step 7, which recompiles IVTV. The IVTV on my system was 0.3.3u, so what I did was

cd /usr/src/
tar -xjf kernel-source-2.6.11.7-chw-4.tar.bz2
tar -xzf ivtv-0.3.3u.tgz
cd ivtv-0.3.3u/
cd driver
make install
cd ../utils
make install

Then, follow the instructions at http://ivtv.writeme.ch/tiki-index.php?page=XDriverHowTo which is partly done in the above steps. To find the busID, I used scanpci instead of lspci, as lspci’s output was backwards.

I then edited /etc/mythtv/modules/ivtv, and the big “install ivtv” line added “; /sbin/modprobe ivtv-fb” to the end. Unfortunately with ivtv-fb loaded, your regular console goes away, so I had to ssh in from then on. However, after I moved the PC to the TV, it worked. At that point, follow steps 4 and 5 from the big set of instructions earlier to centre your screen and enable hardware playback. In the second set of menus is the option to let you use the PVR-350 for the audio out, which is what I chose. I had it working through the sound card while it was on my monitor, but I didn’t have a set of speakers attached near my TV.

At that point, everything worked, and I was able to record, play back, and watch live tv. It rocked. Unfortunately I had to give back the card to my friend, and the way KnoppMyth partitioned the disk only gave me 1.5 hrs of recording. Since it would cost me CAD $350+ to buy the parts, this project will have to wait.

Just a note on the cost of the card, Amazon currently has the PVR-350 for $171US which includes shipping. I searched Froogle, and the best I could find was $163 but with added shipping. Buying the card retail is around $200US. I compared the price of a separate TV tuner card and a TV out card and it was around the same, not to mention you need a much faster computer to do the MPEG decoding to TV (most tuner cards have the encoder in hardware, but the tv out cards don’t have a hardware decoder). So, the PVR-350 is a pretty good buy. And if you buy enough from the Amazon affiliate link above, maybe I’ll be able to afford one of my own :)

Update September 12, 2005. Hauppauge dropped the price of this card to $149USD on September 1. I’ve called a few places and they haven’t seen the update yet. I’ll be ordering one of these directly from Hauppauge’s website in the next week.

Asterisk and an AS5350 SIP Peer

I’ve been playing with Asterisk lately, and needed to get out to the PSTN. Since I had a Cisco AS5350 with a PRI attached for incoming RAS, I figured I could use that. I also had some DIDs on the line that I could use to separate voice and data calls.

Googling around, I couldn’t find a good example of anyone who has done it, so I was on my own.

My goals here were simple:

  1. People dialing 555-1111 should be picked up by the AS5350’s internal modems
  2. People dialing 555-222X should be forwarded to my Asterisk box for handling
  3. The Asterisk box should be able to dial out using the PRI

Already the DIDs were assigned to this PRI, so that wasn’t a problem.

The configuration on the AS5350 is fairly straightforward once you get it working:

voice service voip
sip
! Bind the SIP and RTP sessions to a known interface
bind control source-interface FastEthernet0/0
bind media source-interface FastEthernet0/0
! Normal T1-PRI configuration using all channels
controller T1 3/0
framing esf
linecode b8zs
cablelength short 133
pri-group timeslots 1-24
! Anything not picked up by a dial peer defaults to a modem call
interface Serial3/0:23
isdn incoming-voice modem
! Use a data dial-peer to answer anything to 555-1111 with a modem
dial-peer data 10 pots
incoming called-number 5551111
! Match inbound calls to the voice DIDs
dial-peer voice 100 pots
incoming called-number 555222.
! All digits are collected and sent along
direct-inward-dial
forward-digits extra
! The IP leg of the call... send to the sip server defined below
dial-peer voice 200 voip
destination-pattern 555222.
session protocol sipv2
session target sip-server
! Any digits collected after the call has been answers get forwarded
dtmf-relay sip-notify rtp-nte
! I want g711 ulaw for a codec
codec g711ulaw
! Anything else gets sent out the PSTN
! Note you need the data dial-peer above to accept modem calls, otherwise
! this dial-peer will give dialtone to anyone who calls!
dial-peer voice 1000 pots
application session
destination-pattern .T
port 3/0:D
forward-digits all
! define your SIP server
sip-ua
authentication username USERNAME password PASSWORD
! xxx.xxx.xxx.xxx represents the Asterisk box
registrar ipv4:xxx.xxx.xxx.xxx expires 3600
sip-server ipv4:xxx.xxx.xxx.xxx

After that, it’s just a matter of configuring a sip peer in /etc/asterisk/sip.conf

The Laws of Thermodynamics

Why is it that I find the laws of thermodynamics somewhat comforting?

The first law states that energy can only change forms. There is a parallel to the working world in terms of efficiency. The energy required out of a project (q) is basically a constant, you can work extra hard at it (E), but the delta ends up wasted (w).

The second law says that everything moves to a state of order. Everything wants to settle down, so if you’re pushing against it, you’re not going to win. Efforts should be directed with entropy in mind. Furthermore, this law also shows that no system is perfect (there must be a w factor in the first law)

The third law shows that unless we’re at absolute zero, entropy (change) still exists.

Skype Me

I’ve just installed Skype and it seems to work well. My username is seanwalberg if you want to say hi.

National Credit Report Day

As reported last year, I’m requesting my credit report every March 15th. This year I missed it by a week or so, but better late than never.

In Canada, there are two places to send a request to:

TransUnion - Send a letter with your information
Equifax - Fill out the form

This report from the Canadian privacy commissioner details a case that shows some of the rights that Canadians have about access to the information that banks use to make decisions about them.

Apologies to the non-Canadians in the crowd, if someone has information on the policies in other countries please let me know or post it and send a trackback.

(update: How to get a free credit report for Americans)

Getting Things Done

One of the feeds I subscribe to made a mention of a system called Getting Things Done, which is based on a book by the same name. I did a bit of reading, and ended up borrowing the book from a coworker.

GTD, as it’s called on the ‘net, is a personal organization system. I’m almost done the book and am eager to try it out. The basic idea is

  • Having to remember things causes you to be distracted
  • You should have some well defined areas, including a calendar, in baskets, and series of lists that hold everything you need to do
  • Separate things that are actionable from those that aren’t
  • You should be primarily concerned with “the next action item” rather than all the tasks you need for a particular project or thing

It seems to be really popular with the technical crowd because of the classifying and workflow that goes on to organize your life, it specifically includes processes for working with email, and it lends itself to PDAs.

I often find myself forgetting things because I’ve got a lot on my mind. This system appeals to me because of the novel use of lists (separate lists for each context rather than function, ie a “while I’m at my computer” list vs “personal tasks”). It also seems doable in that it doesn’t impose much overhead, it seems to address some problems I have now, and work with methods I already use.

So, I’m going to use my company issued Blackberry to track the calendar and action items, and use some of my Post-it Note tracking systems. I’ll give it a couple of months (assuming I last that long), and see if it helps.