Thursday 25 July 2013

Memory Calculator (Native Cascades)

I have finally released my first app coded entirely in Native Cascades SDK for Blackberry 10. It is called Memory Calculator and it is available for free on BB10 devices everywhere!

Having come from having experience with Webworks and Marmalade SDK, I found the Cascades SDK experience to also be a bit of a learning curve.... but once you understand it and get the hang for things, it is a nice environment to develop in! You can make smooth and highly-sophisticated apps in a record amount of time.

Memory calculator allows you to convert easily between megabytes, gigabytes and terabytes in both the decimal and binary definitions to determine exactly how much storage capacity you really have.

Tuesday 16 July 2013

Misleading Hard Drive Advertising

Somewhere along the way, definitions of hard drive sizes have changed. I'm not sure when and how, but I was brought up to believe that storage capacities were measured in bytes, KB, MB, GB, TB and that these sizes were factors of 2 apart (more specifically, usually 1024x the previous which is 2 ^ 10 or 2 raised to the 10th power).

In short, a byte was 8 bits. A kilobyte (KB) was 1024 bytes, a megabyte (MB) was 1024 KB, a gigabyte (GB) was 1024 MB, and a terabyte (TB) was 1024 GB. Well, apparently this is no longer correct. This is why when I purchase a 750 GB hard drive, it shows up in Windows as having 699 GB! Where did all my storage go!

The answer lies here: Bit and byte prefixes

At some point when I must have been sleeping, the computer industry invented a number of different prefixes which totally confuse what is meant by KB, MB, GB and TB. Apparently, GB refers to GIGAbyte whereas the old definition that I was taught (powers of 2) is now referred to as a GIBIbyte. How odd? Is this because the hard drive manufacturers want to trick people into thinking they are buying a larger drive than they really are? Is every hard drive manufacturer referring to GB as GIGAbyte, or do some use GB to be short for GIBIbyte? Which is it?

So for now:

1000 bytes = 1 kilobyte, and 1024 bytes = 1 kibibyte.
1000 kilobytes = 1 megabyte, and 1024 kibibytes =  1 mebibyte
1000 megabytes = 1 gigabyte, and 1024 mebibytes =  1 gibibyte
1000 gigabytes = 1 terabyte, and 1024 gibibytes =  1 tebibyte

So by the time you get up to 750 GB, depending on what you are defining as "GB" (gigabyte or gibibyte) you end up with the following numbers of bytes:

750 x 1000 x 1000 x 1000 = 750000000000 bytes (750 gigabytes)
750 x 1204 x 1024 x 1024 = 805306368000 bytes (750 gibibytes)

Windows obviously handles things the traditional way, which is why it is reporting my 750 GB as only 699 GB. If you take 750,000,000,000 divided by 1024x1024x1024 you end up with 698.5 GB, which is what Windows is reporting, essentially. So what happened?

Windows is obviously using the traditional definition with factors of 2 to some power (1024 x) whereas hard drive manufacturers must be trying to mislead the public by over-inflating their hard drive sizes by using a power of 10 (1000 x). How do you know which company is using which definition, when the box only states GB or TB and doesn't state whether that is the new or old definition?

Thursday 4 July 2013

Jailbreaking Apple TV 3 (Well Sort Of) with Plex

I managed to inherit a couple of Apple TV's but was disappointed when I found out they were 3rd Generation which meant no jailbreak was found for them. At least until now.... well.... sort of.

So what does jailbreaking do for an Apple TV anyways? Those of us who have Roku, Boxee or WDTV media players know that we can access internet videos and apps easily, media servers and computer storage on our network, and also plug a USB key directly in the device (loaded with movies in various video formats) and play them directly on the screen.

Unfortunately, Apple TV comes with many restrictions on these features. For example, the feature I need the most is the ability to plug in a USB flash drive with movies. There is no way to attach external storage to the Apple TV. You can play movies loaded into iTunes using the "Home Sharing" feature but that seems to be flakey on my setup, and it will only support certain media format types.

Thanks to Plex and some clever "hacking" on the back-end using PlexConnect, we can now access our non-iTunes media library through any Apple TV (including Apple TV 3). The way it works is it redirects the Trailers section of Apple TV to your Plex Media Server instead, so you can access your media through there. In order to perform this hack though, you need to download a few things. Read this Installation Guide for full instructions.

In summary:

Setting up computer:

1. Download Plex Media Server (PMS) for your computer and install it.
 - Set up your libraries in PMS by setting up the folders with your movies

2. Download Python 2.7.5 and install it (needed to run the PlexConnect scripts)
 - Must download 2.7x (need the older version), not 3.0

3. Download PlexConnect for Apple TV OS pre-5.1 and for OS 5.1+
 - You can also access the iBaa PlexConnect GitHub page directly for latest builds

4. Unzip PlexConnect and double-click "PlexConnect.py" to launch.
 - This pretends to be the Trailer server for your Apple TV but instead will inject your media
 - Note the IP address that is listed when it runs in the command window
 - It should say (on about the 6th line) "IP_Self: 192.168.0.87" or similar
 - Alternatively, in Windows use "ipconfig /all" and look for IPv4 address for your network adapter

Setting up Apple TV:

5. Go to General > Network Settings page and either Wi-Fi or Ethernet settings

6. Choose to Configure DNS Manual and change it to your computer's IP address
  - This is your computer running the PMS and PlexConnect
  - See step #4 above to find out your computer's IP address
  - Usually IP is similar to 192.168.0.x (where "x" is a number from 1-255)

7. Apple TV will now try to access the internet through your computer's DNS
  - PlexConnect handles the DNS now and intercepts the Trailer section
  - Instead of Trailers it substitutes your Plex library, tricking the Apple TV

So for now we can at least hack the Apple TV into playing from another media source besides iTunes Home Sharing and the built-in apps (like YouTube and so on). I look forward to seeing what else can be done with the Apple TV 3. Otherwise, I'm off to purchase a WD TV Play which will give me the flexibility and freedom to play anything I want off a simple plug-in USB flash drive!

DVD Decrypter 3.5.4.0 and HandBrake 0.9.8

My experiments with "space-shifting" my DVD content for viewing on my portable devices has led to a generally easy combination of software to use that is freely available, light-weight and powerful enough for most tasks. Since the legality of DVD ripping for personal use (much like ripping your music CD's to listen to on your MP3 player) varies from country to country, check with your local jurisdiction. In fact, in some countries it is even considered illegal to download or own software that bypasses CSS!

The steps involved in converting your DVD's to MP4 are relatively simple. Once "unleashed" from the DVD player, you have the freedom to view your movies on a tablet, phone, or your TV-media player (WD TV, Roku, Boxee) and so on. The first step is to copy the movie to your hard drive using DVD Decrypter, in a way that is decrypted and can be encoded properly. HandBrake doesn't seem to handle this on it's own, perhaps for legal reasons it was not allowed to include decrypting code. However, it can deal fine with unencrypted DVD's (which are almost non-existent anyways). When I tried to have HandBrake read directly from the source DVD in the drive, it would always complain or even if it did read properly, the movie would come out with tons of strange artifacts and jitters which made it unusable.

So with your VOB files ripped successfully to your hard drive using DVD Decrypter, you can set your source in HandBrake to the directory containing your VOB files. It will successfully find your files and let you encode it. I generally use the Regular Normal setting which is good enough and leads to a file size about anywhere from 650 MB (1 hour 17 minutes) to about 1.5 GB (1 hour 50 minutes), depending on the length of the movie and complexity.

Regarding software versions, you basically have no choice but to use DVD Decrypter 3.5.4.0 because it is the last version available and is still very old. The developer was forced to stop developing this software due to legal action, but newer versions were merged into ImgBurn but which lacks the decryption functionality, essentially making it useless for transcoding (it is only good for copying your DVD to another DVD to play on a DVD player). However, you can use special drivers with ImgBurn to decrypt on-the-fly if needed.

HandBrake is up to version 0.9.9 but I had problems with it on my Windows 7 32-bit system. Therefore, I found that 0.9.8 (available from SourceForge) is more stable and works better. So for now my power punch combination is DVD Decrypter 3.5.4.0 to copy the VOB's over to the hard drive, and then HandBrake to convert over to MP4.

DVD Ripping Home Library

Well there comes a time when we amass a large collection of DVD's and would like to enjoy them on other devices. Today, many titles (Blu-Ray) come with the option to download a digital version. For example, the UltraViolet service www.uvvu.com is a frequent add-on to many titles.

However, unless you buy a new Blu-Ray with this option, how do you manage to enjoy your bought DVD collection on your phone or tablet? And what is the legality of converting your own DVD's to view on your own devices, without sharing it? The legal term is know as "space-shifting" as as long as you are the only one viewing it, once at a time, it appears to be legal.

There are lots of copy protection schemes built into DVD's these days. One good option is to use DVDFab at www.dvdfab.com simply to copy the main title onto your hard drive (VOB files). Then you can usually use HandBrake to convert the file down to any format you like (www.handbrake.fr). Usually just using "Normal" should do the trick and convert into an mp4 file of good quality. It seems using HandBrake directly for the copying leads to bad corrupt movies that are simply unviewable. However, copying the VOB's to your hard drive with DVDFab (or other copy software) strips some of the copy protection schemes to allow you to properly convert in HandBrake. Of course, you can also do the conversion directly in DVDFab but if you are looking for a free option this combination may do the trick.

Just one last note... It takes a long time to copy, then to convert... We are talking hours (at least on my setup). So it may not be worth it. As well, DVDFab only has a 30 day trial, but at least you can see how it works before buying it (it has many other features). There may be other VOB copying software that strips copy protection in the open-source/free community. Finally, not all DVD's work. I found many Disney titles almost impossible to copy, and others gave corrupt reading errors (yet they play fine on a DVD player). Have fun and stay legal!