Bob's Notepad

Notes on projects I have done and things I have learned saved for my reference and for the world to share

Wednesday, October 15, 2008

MythNetTV on LinuxMCE

There is a utility for MythTV called MythNetTV which can be found here. This utility does a great job at grabbing videos from an RSS feed and importing them in to MythTV's database as recorded programs. Set up is quite simple in LinuxMCE but is done via the command line.

  • Login to a shell as linuxmce
  • Switch to a suitable directory. We'll just use /home/linuxmce
  • wget http://www.stillhq.com/mythtv/mythnettv/source/release-5/mythnettv-release-5.tgz
  • tar -xzvf mythnettv-release-5.tgz
  • cd mythnettv5-release
  • sudo apt-get install python-feedparser
  • sudo apt-get install python-ctypes
  • sudo apt-get install python-mysqldb
  • sudo apt-get install mencoder
  • mkdir data
  • Subscribe to Shows
  • ./mythnettv subscribe "URL" "Title of Show"

For example, if you want to subscribe to Tekzilla you would issue:

./mythnettv subscribe "http://revision3.com/tekzilla/feed/quicktime-large?subshow=false" "Tekzilla"

Repeat that step for any shows that you want to subscribe to

Get your shows and import them

./mythnettv update
./mythnettv download 1

(the number that follows "download" is how many of each show MythNetTV should download and import)

That's all there is to it.... The shows you subscribed to will now appear in LinuxMCE's Video category as well as in your MythTV Front Ends

Automating the process

In your mythnettv directory you can create a script that will automate this process and then add that to cron to automate the process.
touch get-shows
chmod +x get-shows
nano get-shows

When editting the get-shows script, just add the following lines:

cd /home/linuxmce/mythnettv-release-5/
./mythnettv update
./mythnettv download 1

Press Ctrl-X to save the file and then test it:
./get-shows

Now you can add it to cron so that it will be run automagically every day
cd /etc/cron.daily
sudo ln -s /home/linuxmce/mythnettv-release-5/get-shows mythnettv

Labels: , , , , ,

Reference Link


Sunday, August 24, 2008

Panduit S050X150YAJ Label Template

So I've come up with a system of labeling each end of a cable with a "serial number" so that when your running cables between racks of servers inside of bundles of wires you can locate which 2 cable ends connect. Then adding the serial number of the cables that are plugged into a server in your server database you're able to easily track them. My customer I am working on this project ordered a pack of Panduit cable labels (S050X150YAJ) that can be printed with a laser or inkjet printer. Panduit also makes their own software for labeling, etc but its at least $200 depending on what options you want. I created a template for these labels and I wanted to post that template here in case anyone else could benefit from it. This is in the open document format and will work in Open Office and should also work in Microsoft Office (but you may need a plugin).

Template: Panduit-S050X150YAJ-Blank.odt

Just for reference, I put this together in NeoOffice 2.2.2 Patch 11 on a MacBook and based on a Samsung ML-2010 printer. It should be universal but if something is wildly different, you may need to tweak it.

Labels: , , ,

Reference Link


Saturday, August 09, 2008

OSX is refusing to eject a CD

I had an ordeal tonight..... I needed to burn an ISO to a blank CD so I put a, what I assumed was blank, CD in my MacBook and Toast informed me that it was not writable. What was it? Some Windows CD, I guess. The problem was my machine refused to eject it. I clicked the eject button multiple times (both on the keyboard and in finder) and it just wouldn't do anything. I figured if I did a reboot of the machine I could eject it when it came back up -- wrong. Whatever was going on on this CD was confusing the hell out of OSX. After the reboot finder never loaded for me and half of my typical start up applications got stuck during boot up. I happened to have Disk Utility in my dock so I tried to open that and, again, no luck.

First thing to try (did not work for me):
  • Put the computer into sleep mode
  • Press the eject button on the keyboard


Second thing to try (this worked for me):
  • Power down your mac
  • Hold the mouse button (or trackpad button) down
  • While holding the button press the power button
  • After 30-120 seconds your mac should eject the CD
  • Let got of the mouse button and the machine should boot the OS


I will now list the three biggest wishes I have for Mac computers and despite how small and petty they seem they make a night and day difference to me (Please, Steve Jobs, take note):
  1. CD-Rom eject button and/or emergency pin hole
  2. Hard drive activity light
  3. Network (NIC) lights for activity and link

Labels: , , , , ,

Reference Link


Tuesday, July 08, 2008

USB to PS/2 Chipsets

I've been dealing with a lot of issues with repeating keys (sticky keys) when using USB to PS/2 adaptors. My one client needs to use these because the Startech IPKVM solutions mixed with the Aten masterswitch KVM switches requires it now that ATEN has discontinued the CS1216. We've recently ordered in a bunch of different brands and I checked to see what the chipsets were in each of these devices. It appears that the majority of them use a chipset by CHESEN and from what I am seeing that is the chipset that seems to have the most problems. I don't have a solid solution for anyone with the problem but the Q-Stor is looking good at this point. I simply want to post this list so that it is documented since I havent been able to find this information anywhere. If I end up getting more brand names I will append this list. If anyone has any reviews on any of these or another brand please leave a comment with the information.

-----------
Startech USBPS2PC

PS2 to USB Converter:
Version: 0.10
Bus Power (mA): 500
Speed: Up to 1.5 Mb/sec
Manufacturer: CHESEN
Product ID: 0x0205
Vendor ID: 0x0a81
-----------
SIIG USB to PS2 (UPC: 6 62774 02359 5)

USB to PS2 Adaptor V3.10:
Version: 3.10
Bus Power (mA): 500
Speed: Up to 1.5 Mb/sec
Manufacturer: Composite USB PS2 Converter
Product ID: 0x0001
Vendor ID: 0x0b39
-----------
Belkin F5U119vE1

PS2 to USB Converter:
Version: 0.10
Bus Power (mA): 500
Speed: Up to 1.5 Mb/sec
Manufacturer: CHESEN
Product ID: 0x0205
Vendor ID: 0x0a81
-----------
Keyspan UPS2A

PS2 to USB Converter:
Version: 0.10
Bus Power (mA): 500
Speed: Up to 1.5 Mb/sec
Manufacturer: CHESEN
Product ID: 0x0205
Vendor ID: 0x0a81
-----------
Rosewill RCW-606

PS2 to USB Converter:
Version: 0.10
Bus Power (mA): 500
Speed: Up to 1.5 Mb/sec
Manufacturer: CHESEN
Product ID: 0x0205
Vendor ID: 0x0a81
-----------
Q-Stor QUPCBL

Generic USB K/B:
Version: 0.01
Bus Power (mA): 500
Speed: Up to 1.5 Mb/sec
Product ID: 0x0017
Vendor ID: 0x13ba
-----------
Cables to Go 27225

USB To keyboard Mouse Converter:
Version: 0.01
Bus Power (mA): 500
Speed: Up to 1.5 Mb/sec
Product ID: 0x8329
Vendor ID: 0x04b4
-----------

Labels: , , , , , , ,

Reference Link


Tuesday, May 06, 2008

Rapidly flashing light on MacBook

There seems to be a huge lack of information on this so I wanted to share it here. If all of a sudden your MacBook or MacBook Pro refuses to start and all you get is the rapid flashing sleep light then the problem is most likely related to the RAM. The MacBook tends to have RAM that is tough to install and, in mnay cases, you have to push the RAM into the slots MUCH harder than you would expect. Since this is the case it is also highly likely that the RAM wasn't 100% installed at the factory and simply the normal moving of the laptop can losen it enough to create this issue.

This isn't really a HOW-TO but just a bit of information for if your MacBook suddenly gives you the rapidly flashing light :)

Labels: , , , , ,

Reference Link


Tuesday, April 22, 2008

Using sudo on a remote rsync session (via ssh)

I have been using rsync to back up almost a dozen servers for years now and I am convinced that it is the best solution for remote back ups. A couple of months ago I ran into a situation where I need to rely on one of those backups and everything went expected.... well, sort of. All of my data was there and I was able to get things back up and running on a new server in only a few hours but it would have been much quicker if the permissions and file ownership was preserved. Once I got the system back up and running I wanted to make sure my the back up process was going to start preserving the file permissions and ownership. I found that the to accomplish this you absolutely had to be putting the files on the remote server as root. Of course, this is a security concern. The solution was permitting the rsync process to have access to sudo.

Step 1:
On the server that is receiving the back ups you need to add the following line to the /etc/sudoers file:

  • username ALL= NOPASSWD:/usr/bin/rsync


You will, of course, want to replace "username" with the user that the sending server will be logging in as through the rsync process.

Step 2:
Now you'll need to make sure that your rsync command is using the -a flag and then use the --rsync-path flag to tell it to run the rsync process on the remote via sudo. Here is an example command line:

  • rsync -av -e "ssh" --rsync-path="sudo rsync" /source/ user@server.com:/destination/


You're all set

You can combine this with using automated SSH login keys. Also, I want to note that this can compromise security in some scenarios.

Labels: , , , ,

Reference Link


Monday, January 07, 2008

Doing your own OpenID authentication

OpenID is an open standard for authentication on various, unrelated, websites. There are many providers that will provide you with an OpenID idenity but, in some ways, this defeates the purpose of OpenID since your ID is controlled by a person other than you. Just last night I ran into a situation where I was not able to do something with my ID that I wanted since I was using MyOpenID.com because I am not in control of my idenity page. Thanks to a fit of insomnia I did some research and implemented my own OpenID idenity -- and it was actually a lot easier than I expected.

In order to implemt this you need a website with PHP support. This can be done on any web server whether you are in control of it or not but it is recommended that it be a server you are in control of for obvious security reasons. We will use phpMyID since it is simple and serves the purpose well.

This works well if it has it's own domain or subdomain but it really isn't a required thing. The OpenID that I created was is http://id.bobkmertz.com. My instructions assume you've created a domain or sub-domain for your OpenID but you can adapt as needed.

First thing, you need to register a domain and point that domain's DNS to your webserver and, of course, configure your webserver. I'm not going to touch on that because if you're doing this you probably should already know how and if not there are plenty of web pages out there that can help you with that.

Now you want to grab phpMyID. The latest version is 0.7 BETA and can be found here.

For me, I have my own server with shell access so I downloaded this directly to my server. This is, by far, the easiest method of implementing this but not everyone has this access so you can download it to your local machine, do the edits and then upload the files to your webserver. If you are uploading keep in mind that when I say editing a file you need to edit it and upload it if your not on the server.

There are 2 files that make up phpMyID. Really, that's it. Your OpenID set up is going to use only 2 php files. Let's get started:

  1. Put both files from the archive into your public_html or www directory
  2. Rename MyID.config.php to index.php
  3. Edit index.php and change "auth_username", "auth_password", and "auth_realm"
    • auth_realm doesn't need to be changed but can be anything you want it to be
    • auth_username is the username you want to authenticate as - this is for your use only
    • auth_password is an encrypted password which you can use OpenSSL to create (echo -n 'username:realm:password' | openssl md5).
      • Make sure you replace username and realm in the command with the same as used in auth_realm and auth_username
      • Windows User? Check here


  4. To use SREG, remove hash (#) marks from the values under the sreg array and replace the values with appropriate information. This allows these fields to be automagically filled in when logging into a site
  5. Save the file


You now have a working OpenID service. But if your OpenID is pointing to your OpenID then it would make sense to have some information about yourself on that page, wouldnt it? The PHP script doesnt allow any easy way of editing your page but it's something that may well be desired. You may ever want to use other Web 2.0 features like a pavatar. Let's make an easy way of doing this.

  1. First, create a file to contain your HTML code. We'll use "id.html" in this example.
  2. In this file you'll want to create your HTML page as you wish. Do not include body or html tags as we're going to leave the headers and such to the PHP script and then just inject this file in the middle.
  3. Open MyID.php in your favorite editor and go to line 1392
  4. Following the function call and the header information you will see some HTML code. Under the body tag we want to add the following:

    ';
    readfile("id.html");
    echo '

  5. Now look for the title tags above that. You can change the title to whatever you'd like the name of your OpenID page to be.


You should be all set and have an easier way to edit the information on your OpenID page.

Optionally, you may want to give credit to the author of phpMyID. You can place an HTML link before the close body tag in MyID.php.

Labels: ,

Reference Link