Ubuntu 12.10 and MythTv

Quite recently I was tinkering around with new update Ubuntu 12.10 trying to get my Hauppauge HD-PVR (Gaming Edition) to work with MythTV, had hell of a time trying to configure it properly so I could record some gameplay footage with it. Getting the first initial setup did seem a little easy at first, but not until after I discovered I had to install some additional packages to get it all to work properly. Following the guide on getting and setting up MythTV from http://parker1.co.uk/mythtv_ubuntu.php, before discovering a different and more easy to follow guide in a video from YouTube user called UbuntuHelpGuy. Fantastic guides I should recommend following if you’re needing help or stuck with something that you’re trying to do.

 

 

So if you follow as instructed from this video you should be able to get setup with your Hauppauge HD-PVR recording device with no problems. –– I would highly recommend installing MythBuntu repo packages, that is one vital thing you need to do to make sure this works. http://www.mythbuntu.org/auto-builds

 

Once you’ve downloaded it, it should open up the Ubuntu Software Center and begin installing, it may ask for your password to install, and get a little dialogue for confirming you wish to accept and install agreement stuff.

After you’ve installed the repo packages, and other additional stuff from the Ubuntu Software Center as well as MythTV itself, you then run MythTV Backend to begin the initial setup as follows in the above video shown.

 

 

Step 1:

Make sure you’ve got your Hauppauge HD-PVR plugged into the computer then open up MythTV Backend then select Capture Cards, select New Capture Card from the menu list, then for Card type, select H.264 encoder card (HD-PVR), it should then in the next box say /dev/videoN where the N is, is the number it’s assigned, for example; /dev/video0 or /dev/video1. The probed info should say Hauppauge HD PVR [hdpvr] if you’ve got it plugged in.  For Audio input it should automatically have selected RCA Back, and the tuning timeout set at 12500 ms, make sure you hit Finish to save it.

 

Step 2:

Go back to the main menu by hitting Esc button then select Video Sources then select (new video source), you can name your video source whatever you want, so for example; HDPVR or Hauppauge HD-PVR, whatever you want to name it.  For the Listings Grabber make sure you select it as No Grabber. Leave Channel frequency table at it’s default and click Finish to save it, then return to the main menu again by hitten Esc.

 

Step 3:

Select Channel Editor from the menu, then select (Add New Channel), so again for Channel Name you can name it whatever you want, ie; Hauppauge HD-PVR so you know and remember what the channel is called. Next assign a channel number that you wish, it can be any number, so assign it 1 if that’s the number you want it. Name the callsign, ie; HDPVR. Make sure the checkbox Visible is checked. Next the Video Source, select from the list, it should already automatically select the one you created earlier. From here you can select the TV format type, ie; PAL, NTSC, NTSC-JP, etc… doesn’t really matter which leave it on Default if you’re fine as it is. For the Commercial Detection Method select All Available Methods. Click Next then Next again, the next page here you can adjust the TV video source settings like Finetune (kHz), Contrast, Brightness, Color, Hue, These settings are usually best left at their default state, but you can come back later if wish to change it to suit what you’d like, so just hit Finish for now, and you’ve created your channel for your Hauppauge HDPVR, then hit Esc to go back to the main menu.

 

Step 4:

Now it’s time for Input Connections, here you’ll see 3 things that says. Component, S-Video and Composite, what you want to select is Component. The display name you can name it whatever as an optional thing, ie; HDPVR. Make sure the Video Source is selected on from the menu list says HDPVR or from whatever you named it before in the previous steps. In the External channel change command text box make sure you type in /bin/true, then put Starting Channel to the number you created earlier if it’s not already selected. Now press Next then Finish and you’ve completed this step. You can now exit MythTV Backend by pressing Esc to go back to the main menu then again to quit.

 

When you close MythTV Backend it’ll ask you for your password, then it’ll ask if you wish to run Mythfilldatabase, just select No. Next you may have to logout and log back in again for the changes to take immediate effect, I’d recommend doing it as an optional thing, but do it anyway just to be sure. Next open up MythTV Frontend. Once opened up go down and select Watch TV, it should then bring you to live screen video feed that your Hauppauge HD-PVR is connected to like your game console for example. To begin recording something just press the R key on your keyboard, and if you wish to stop recording, just hit R key again.

 

With all that you’ll be able to replay video by going back to the main menu and selecting Watch Recordings. Another thing is if you have Media Server turned on, on your console like PS3 for example, you can playback the recordings on your PS3 as Ubuntu will broadcast it’s media server for MythTV to any computer that’s capable of receiving on your home network.

Typing Japanese Characters

When it comes to typing something your default is usually English unless of course you’ve got it as something else by default like French or Germen. But for those with English Keyboards you may be wondering how you can type Japanese characters on your keyboard? Answer is simple really, you don’t need another keyboard with the japanese characters on it, everything you need is already there to use on your computer, all you have to do is enable it and add it to your set of usable languages so you can switch between English and Japanese instantly and type whatever.

Here I’m gonna show you how to do it on Mac OSX, I’m doing it on Snow Leopard 10.6.8, I’ll show you how to do it on Windows below, so feel free to skip to the bottom of this post to see how to do it. –– Ok first for Mac OSX go and open up System Preferences from the (Apple Menu) 

Click on Language & Text from the list, once that’s loaded up select the Input Sources tab.

Then select from the list Kotoeri and click the checkbox, it should check all in that list there. Don’t forget to click the checkbox at the bottom there for Show Input menu in bar. This will make it easier for you to switch between different language inputs.

Next select from the Input Menu bar at the top of the screen and select from Hiragana, Katakana or Romaji. Romaji let you type in plain English when you press the ⌥ + ⇧ + E hotkey combination, this will put you into Hiragana typing mode.

And if you’re needing help with typing certain characters you can refer to the Kana Table which can help you type Hiragana, Katakana and Romaji characters. Here’s a useful tip to remember if you’re not use to typing Japanese or ever learnt Japanese. Hiragana is used for writing words in general, adjectives and some names, Katakana is for writing names, and names of things, places. Kotoeri’s dictionary isn’t perfect so it won’t have words or names of everything in there so you’ll have to register some yourself, it’s best if you refer to a Japanese Dictionary so you can learn each word so the Dictionary can learn correctly of new words you put into it. –– There is no actual difference from typing with Full-width Romaji or Half-width Katakana, it just types the same way as Hiragana and Katakana, only the width of the characters changes.

Another thing, when you’re typing Japanese Characters you’ll have a quick popup menu for letting you change the characters of a word like so for example; 

To get this popup just press the Space bar on your keyboard, but take note here that it only shows up when the word is underscored, when it’s underscored you can press the Space bar and the little popup menu will appear.

 

___________________________________________

Alright… Windows users… here is how you do the what I’ve explained above, I’m doing this on Windows 7. –– Firstly open up Control Panel, then select Region and Language.

This will open up the window for Region and Language, next click on the Keyboards and Languages tab, then click Change Keyboards… button.

 

That will then bring up the Text Services and Input Languages window like so…

Now because I’ve already added the Japanese IME, you’ll just pretend that we’re adding it for the first time. OK… You next have to click on Add… to then bring up Add Input Language window. Then scroll down and check the checkboxes for Japanese (Japan) and make sure you check the boxes for Japanese and Microsoft IME then click OK button.

 

 

Now that you’ve done that you’ll be all set to begin typing in Japanese, all you have to do next is click Apply then close the windows for Text Services and Input Languages.

You should have on your Taskbar with words EN on it next to a keyboard icon, click that then select JP, the icons on the task bar should change like so, next click on the red circle and paintbrush icon and select Microsoft IME.

and lastly click on the A icon and select from Hiragana, Full-width Katakana, Full-width Alphanumeric, Half-width Katakana and Half-width Alphanumeric.

Now that you’ve added the right keyboards for typing in Japanese on Windows, you should now be able to type almost anything in Japanese. There isn’t really any helpful stuff for typing Japanese on Windows like a Mac does… you may have a hard time trying to type the character you want without a table that’s ready there to use. :p  But don’t let that stop you since there’s plenty tables and guides out there on the Internet to help you type out stuff, Google Translate is one example that can help you type stuff for words or phrases.

Setting up Japanese Keyboard is more tedious than Mac OSX, …Windows has……well…pretty much……TOO MUCH windows, whereas Mac OSX……all you do is Apple Menu  > System Preferences > Text and Language > Input Sources > Checkbox > Done. It’s done faster than you can say Microsoft Windows. :P

Code Academy

Code Academy

Code Academy | Learn to Code

Great intractable site for learning how to code, once you get into it it’s pretty good, and you can enjoy some of the tasks in learning as you go along, some tough ones along the way that gets you to think hard and remember everything you’ve learned from the beginning.

Reset Network Preferences (OSX)

At times there may be one or two occasions where the network adapters such as AirPort or the Ethernet in your Mac suddenly cease to function properly, be that from hardware fault, software fault or accidental modification faults to your network. There is a way to reset them when things stop working as they should. If none of these methods work, you may have to send your machine in for some repairs if it’s hardware fault.

Resetting PRAM –

First steps, always try resetting SMC’s PRAM to see if that fixes the problem. Shutdown your computer and remove the power cable for atleast 15 minutes or so, I usually tend to do it in 7 to 8 minutes. If you’re doing it on Macbook or Macbook Pro, remove power cable and battery pack. Then you’ll  plug them back in. Next hold down  ⌘ + ⌥ + P + R   as you turn it back on, You should know if it was successful as usually you’ll hear the startup sound twice.

Network Preference File –

If the above method didn’t work then try this, this may well guarantee a 100% proper fix. In guidance for this I’m using Mac OSX 10.6.8 Snow Leopard, newer systems like 10.7 Lion will most likely be the same. Older systems may well differ from what I’ll show you here.

Navigate to /Library/Preferences/SystemConfiguration in Finder  (⌘ + ⇧ + G).  You will find two files there which relates to your network. NetworkInterface.plist and Preferences.plist, you will want to rename them and give them the extension on the end with .bak, so it looks something like this;

You will have to change the current permissions temporarily for that folder so you can rename them just hit  ⌘ + I  to bring up information, then click on the Padlock and enter your password if it asks for one, next click on the + sign and add yourself into the group permissions and change it from Read Only to Read & Write then make your changes to those files. You can go ahead and leave the permissions for that folder or revert them back to their original state to Read Only for you then remove yourself by clicking on your name then click on the  sign. Next all you just have to do is Reboot and should be in working order hopefully, this method should reset and restore AirPort and Ethernet together.

When you’ve done your Reboot, the computer will automatically recreate those Plist files you edited and be in ready normal working conditions. I think it will be safe to delete the old Plist files after the computer has created the new ones, as you shouldn’t need it anymore.

FoDel {Shell}

A while back I created a simple Bash Shell script for fixing an annoying occurrence that sometimes happens on a Mac, sometimes it would refuse to delete files properly from the Trash folder, and so you’d have to force delete it by hand in Terminal, so I decided to come up with the idea for creating an autonomous program to take care of the process for you so you don’t have to type everything out like so;

(ignore the appending $ sign, it’s just an example of the current shell you are in.)

$ rm ~/.Trash/
$ mkdir ~/.Trash/
$ killall Finder

It’s not really much to type out, but the script I created executes it in a matter of seconds with one command, by simply typing FoDel into the command line. I first wanted to create a sequence of menu commands, where you select your options from the menu to execute the script, but that wasn’t quite working out so well, still need to actually work on that. So I ended up scrapping that idea for now and replaced it with countdown timers instead. I put a short interval in between each command so it’s not trying to cram everything in all at once, because that would like trying to cram in 300 biscuits into your mouth all at once.

I called this script FoDEL for a very good reason, it’s short for Force Delete.

So…… anyway here’s the code.

#!/bin/sh

echo // @@ ======// === FoDEL script v0.2b ==== \\====== @@
echo // @@ ======// ====== by ShadWolf ======== \\====== @@
echo // @@ ======// ========= ©2011 =========== \\====== @@
echo // @@ ======// ++ Force Delete Trash ++ \\======= @@
echo // ————————————————————
echo // Force delete files from ~/.Trash/ folder, use with caution!
echo // improper use of the rm command could mess up your system.
echo // !! This script is designed to delete the ~/.Trash/ folder !!
echo // !! then Re-Create it, then kill Finder to relaunch it. !!
echo // ————————————————————
echo

echo “I will begin to run FoDEL, if at any time you want me to stop press ^C. Starting in 6 Seconds…”

echo

wait ## First initial countdown with 6 seconds, incase you wish to cancel it before it runs.
function countdown
{
local OLD_IFS=“${IFS}”
IFS=“:”
local ARR=( $1 )
local SECONDS=$(( (ARR[0] * 60 * 60) + (ARR[1] * 60) + ARR[2] ))
local START=$(date +%s)
local END=$((START + SECONDS))
local CUR=$START

while [[ $CUR -lt $END ]]
do
CUR=$(date +%s)
LEFT=$((END-CUR))

printf “\r%02d:%02d:%02d” \
$((LEFT/3600)) $(( (LEFT/60)%60)) $((LEFT%60))

sleep 1
done
IFS=“${OLD_IFS}”
echo ” “
}

countdown “00:00:6” ## First step, 6 Second Countdown

echo

## This will delete the .Trash folder

`rm ~/.Trash/`
echo “\”~/.Trash/\” folder Deleted!”

echo

## Small time interval between each command ‘3 seconds’.

wait
function countdown
{
local OLD_IFS=“${IFS}”
IFS=“:”
local ARR=( $1 )
local SECONDS=$(( (ARR[0] * 60 * 60) + (ARR[1] * 60) + ARR[2] ))
local START=$(date +%s)
local END=$((START + SECONDS))
local CUR=$START

while [[ $CUR -lt $END ]]
do
CUR=$(date +%s)
LEFT=$((END-CUR))

printf “\r%02d:%02d:%02d” \
$((LEFT/3600)) $(( (LEFT/60)%60)) $((LEFT%60))

sleep 1
done
IFS=“${OLD_IFS}”
echo ” “
}

countdown “00:00:03”

echo

echo “Creating new ~/.Trash/ folder…”

echo

wait
function countdown
{
local OLD_IFS=“${IFS}”
IFS=“:”
local ARR=( $1 )
local SECONDS=$(( (ARR[0] * 60 * 60) + (ARR[1] * 60) + ARR[2] ))
local START=$(date +%s)
local END=$((START + SECONDS))
local CUR=$START

while [[ $CUR -lt $END ]]
do
CUR=$(date +%s)
LEFT=$((END-CUR))

printf “\r%02d:%02d:%02d” \
$((LEFT/3600)) $(( (LEFT/60)%60)) $((LEFT%60))

sleep 1
done
IFS=“${OLD_IFS}”
echo ” “
}

countdown “00:00:03”

echo

## This will make the .Trash folder (recreate)

`mkdir ~/.Trash`
echo “\”~/.Trash/\” folder Created!”

echo

wait
function countdown
{
local OLD_IFS=“${IFS}”
IFS=“:”
local ARR=( $1 )
local SECONDS=$(( (ARR[0] * 60 * 60) + (ARR[1] * 60) + ARR[2] ))
local START=$(date +%s)
local END=$((START + SECONDS))
local CUR=$START

while [[ $CUR -lt $END ]]
do
CUR=$(date +%s)
LEFT=$((END-CUR))

printf “\r%02d:%02d:%02d” \
$((LEFT/3600)) $(( (LEFT/60)%60)) $((LEFT%60))

sleep 1
done
IFS=“${OLD_IFS}”
echo ” ”
}

countdown “00:00:03”

echo

## This will kill Finder which may take upto a minute or less

## If using this script on a different UNIX machine you probably won’t need this
## Just comment out the command line from what you see below.

`killall -v Finder`
echo “Killing \”Finder\” please wait…!”

echo

## Lastly this is not idiot-proof so if you somehow fuck this up while using it, I won’t be held responsible for it. You brake it. You deal with it!
## Oh and you better not cancel the task by the time it reaches the 1st, because you’ll have to execute these commands
## mkdir ~/.Trash/ && killall Finder

echo “I’m done here…. exiting.”

To run the script you would just have to do;

$ ./fodel.sh

If you wish to make it much easier to use, just stick it into your .Profile file, should be either called .profile, or .bash_profile  or something similar. Here’s an example of what I did for mine.

alias fodel=’~/scripts/FoDel-0.2b.sh’

so I can just run the command right off the bat without having to type ./fodel-0.2b.sh. It doesn’t really matter if the file name has capitols, it’ll still run either way when you call it from the command line. It may not be much of a script, but atleast it gets the job done that it’s suppose to do. Hopefully when I can be bothered I’ll probably revise this code a little more and maybe improve it to be better. I was gonna try implement the Secure Remove command, but it’s a little tricky and doesn’t like it’s command options bundled together. I’ll have to look into that more, and maybe if I do improve this code I’ll try get a Menu Option execution inserted, instead of having those countdown timers in place. Possibly might be revised and changed in v0.3b.

I would gladly like it for anyone to suggest how to improve this. You are free to edit and change it up to make it a better script. :3

Secure Erase Trash

When it comes to deleting files and useless junk data from your computer, that one thing on your mind is…… “Has it been erased forever?” Answer may probably be no. Luckily Mac OSX comes with a Secure Erase Trash feature hidden in the Preferences. Finder > Preferences (⌘ ,) > Advanced, the standard for Secure Erase Trash is 7-Pass Erase which is standard for the US DoD.

By default Secure Erase Trash isn’t enabled, but turning it on will be sure delete junk data more securely by writing over it 7 times. However 7-Pass erase may not enough for you and you may be wondering if you can alter that to make it go over the data 35 times. There is a way to change the default 7-Pass erase to the 35-Pass Erase (Gutmann Algorithm). Paranoid or not, but it’s best you’re gonna get in ensuring those files can never be recovered by recovery software. However… changing the pass writes over the files will take longer naturally, without Secure Erase enabled files you sent to the trash will be easily recovered, lets just call it ghost data. Ghost data can be easily recovered by file recovery software. The normal Zero-Pass Erase will delete files in minutes, while 7-Pass and 35-Pass will take half-hour/hour maybe longer or less, depending on the size of files that are being erased.

If you want to switch the default Secure Erase of 7-Pass to the 35-Pass you’ll need Xcode 4.3 to edit the Plist file, you can download and install that from the App Store, it’s Free to downloadhttp://itunes.apple.com/gb/app/xcode/id497799835?mt=12 it’s about 1.68Gb

Now you’ll need to find the Plist file you’re going to edit, first open Finder or click on Go from the Menu and select Home then click on Library > Preferences then search for com.apple.finder.plist next Right-Click and select Open with ‣  Xcode 4.3

Next right-click anywhere on the Plist and select Add Row, then type in the first text box _FXSecureEmptyTrashLevel next you want to make sure the type is String then enter the value -1

Entering the value of -1 will change the erase to use 35-Pass Erase. If you were to change it to another value……say 9, it will only do single erase, I’m not 100% what the other values are that can be used which would probably default to 7-Pass Erase, but I’m gonna take a guess and say 1, there are other values which should only just Zero Out Data which only erases information used to access your files and writes 0’s all over them once. I only found out this info after a bit of digging around the Internet, hopefully this proves useful.

So now that you’ve entered a new Plist item, go ahead and save it and quit Xcode, you should notice that data gets erased much slower than usual because it’s doing it 35 times. If you wish to remove the Plist item, just edit the Plist in Xcode and delete the Item by clicking on the minus button next to it’s name.

For extra added security, if you’re a first time Mac user or just gotten a new Mac, be sure to turn on FileVault Encryption from Security in Preferences. This will encrypt your entire Home folders, but will Encrypt and Decrypt as you use your files automatically. Be sure to set a strong Master Password for the FileVault, if you can’t think of good strong password, then use Password Assistant to help create a strong random password. But be warned… if you forget your password you’ll lose all access to your files. Turning on FileVault will create a stronger chance that any data you send to Trash and Secure Erase will be unrecoverable to a near 100%. –– Normally… if you’re gonna sell off your Mac, you’ll use the Disk Utility to erase everything off the drive, by selecting Erase Options, you can select the 35-Pass Erase. If you do select it to erase everything off your disk it may take a few days to erase everything depending on how big the drive is and how much stuff is on there, but in the end it’s well worth it.

FYI: Done on Mac OSX 10.6.8, so it may differ on older systems. Newer systems such as Lion 10.7 will probably be similar.