Monday, January 03, 2011

Saving Large Video Recordings From An iPhone

This is a pain. This needs to be fixed. Workarounds should not be needed, but for now we do what we must...

There is some kind of limitation on the iPhone 4 (and iPhone 3GS apparently) that will not allow you to download / save video that you have recorded if it is larger then about a couple hundred MBs. If you have recorded video on your iPhone of any significant length of time—and your file ends up being say, 1GB or so—you simply won't be able to copy it to your system. Picasa can't even do it.

The simplest workaround that I have found as I Googled:
  1. Use iTunes to Sync your phone
  2. Open up My Computer and navigate your way to C:\Documents and Settings\UserName\Application Data\Apple Computer\MobileSync\Backup\
  3. Open up the folder contained at this location (it'll have a lengthy name ce46da1123whatever)
  4. Select View → Details
  5. Select View → Size or click on the Size column label to sort in ascending or descending filesize
  6. Look for the largest file(s)
  7. Copy them to the location of your choice, rename them and add the .mov extension
  8. Done!

Saturday, January 01, 2011

Multiple HTML files to Single PDF with wkhtmltopdf

Very useful (to me). It took a good deal of searching to find the right little application to do what I needed—convert locally saved HTML pages to PDF and collate them into a single file.

It sounds so simple, but actually finding a free / Open Source app to do this was problematic. I hoped HTMLDOC would do the trick and perhaps with a little more experience, I could achieve the desired results. In the meantime I discovered an app for Linux (also available for other operating systems) called wkhtmltopdf that did just what I needed it to do.

It's a command line utility, very easy to use and quite effective. It doesn't make a mess of the pages when converting/collating them. It also allows you to customize page headers & footers among other things. I have been using it under Windows XP1 (which is kind of a pain due to shell limitations compared to bash under Ubuntu, but whatever as long as it works). Entering the command: wkhtmltopdf.exe --extended-help gives you a nice list of options to explore.

My goal was (or seemed) simple enough: Create a single PDF file from the multiple web pages that I had saved locally via the Firefox add-on DownThemAll!

Why do this? The print version pages of the (lengthy) material I wanted to read seems to be intentionally organized on the website to make it difficult to work with for off-line viewing. Lame, but not uncommon by any means of course. Here's the method I used to solve my dilemma:
  • Made a list of the printable version URLs and saved the html files locally. (Not as tedious as it sounds, and mostly automated once the structure of the URLs was determined.)

  • Saved the pages locally with DownThemAll!

  • Used wkhtmltopdf to put the files together using a command similar to the following:
"C:\Program Files\wkhtmltopdf\wkhtmltopdf.exe" --footer-center [page] -s Letter articles.htm articles_001.htm articles_002.htm articles_003.htm articles_004.htm articles_005.htm articles_006.htm CoolRead.pdf
--footer-center [page] gives me page numbering at the bottom and -s Letter sets it to 8.5" x 11" page size (other page size options available). Several other options are also available. Can you simply create a lists of the pages you want to collate instead of listing them on the CLI? I haven't noticed that as an option in --help or --extended-help but it's probably there and easy enough to do. (Can you tell I have only recently started using wkhtmltopdf?) I wanted some kind of cover and toc-type page for the articles. and it just so happens that the main webpage with the links for the on-line articles fit the bill well enough. wkhtmltopdf can work directly with on-line pages so away we went:
"C:\Program Files\wkhtmltopdf\wkhtmltopdf.exe" -s Letter -O Portrait "http://supercoolwebsite.org/docs/?docID=6" Cover.pdf
Update 1/3/2010: I decided I didn't like the "cover sheet" generated with the command above. I ended up creating my own cover page and "table of contents" in OpenOffice Draw and exporting it to PDF. To make life simple I put the wkhtmltopdf command text into a batch file and ran it in the same folder containing the html files. Easy to modify the options & run until I got the (more) precise results I wanted.

Example:
"C:\Program Files\wkhtmltopdf\wkhtmltopdf.exe" -g --disable-smart-shrinking --footer-center [page] -s Letter -T 14mm -B 14mm -L 14mm -R 14mm --disable-external-links --disable-internal-links articles.htm articles_001.htm articles_002.htm articles_003.htm articles_004.htm articles_005.htm articles_006.htm CoolRead.pdf
The additional options shown apply the following formatting to the generated PDF file:
  1. -g = Generate in Grayscale
  2. --disable-smart-shrinking = Without this option, the font size of the generated PDF files was too small. This option provided a larger font-size and made the documents easier to read.
  3. --footer-center [page] = Add page numbers to the bottom-center of each page in the file.
  4. -s Letter = Letter sized pages.
  5. -T 14mm -B 14mm -L 14mm -R 14mm = Increase the page margins. The default put the text too close to the edges of the page.
  6. --disable-external-links & --disable-internal-links = These options do just what you would think: they remove the hyperlinks that are in the html files from the generated PDF file.
Time to put the Cover Page/TOC & the collated HTML-turned-PDF files together for the finished product.

Enter PDFTK Builder from the PortableApps collection.
  1. Add the Cover page/TOC & the collated articles PDF files to PDFTK Builder's Collate option
  2. Click Save As... to combine them.
  3. Done!
Does it sound like a lot of work? It's really not, and I get (almost) exactly what I want. Should there be, or is there an all-in-one Open Source application that does ALL of this for you in one shot? Probably, but I haven't found it yet. The most irratating aspect of this approach? HTML files with bad character entities in them. Tracking those weird characters down in the files and figuring out what to use to replace them is a real pain (depending on how large your final file turns out to be).

At the end of the day, using FireFox + DownThemAll!, wkhtmltopdf, and PDFTK Builder (with a generous nod to Notepad++—a great text / code editor for working with the batch files, link lists, etc.) the job gets done.

There are several HTML articles, etc. that I would like to collate into single PDFs. This combination of free tools is a valuable solution for me.

1 I was not able to use the version of wkhtmltopdf in the Ubuntu repositories as throws an error message about not being built with the correct version of QT4 or something like that. There are articles on how to fix this but I haven't bothered with it yet.

Friday, May 14, 2010

Virtual Box Guest Additions & CentOS 5

Installed CentOS into a VirtualBox virtual machine this evening. I recommend installing the Guest Additions into your virtual machines. Simple to do under Ubuntu. A little more involved with CentOS, but still easy enough.

Google is your friend. Here it is quick and easy:
  1. Start the CentOS virtual machine.
  2. Mount the VboxGuestAdditions.iso
  3. Right-click on the VirtualBox CD icon
  4. Click VboxGuestAdditions.iso to mount it as a virtual CD in CentOS




  5. Press Ctrl+Alt+F2 to open a terminal session if you are not already in one.
  6. Login as yourself (if you have sudo permisions) or root (yes, I know, a terrible thing to ever do)
  7. As yourself preface your commands below with sudo; as root simply enter the following:
  8. mount /dev/hdc /media
  9. cp /media/VBoxLinuxAdditions-x86.run /home/your_username/
  10. cd ~/your_username
  11. chmod +x VBoxLinuxAdditions-x86.run
  12. yum -y install gcc
  13. If not already installed, you will also need to run:
  14. yum install kernel-devel kernel-headers
  15. Time to install the Guest Additions
  16. ./VBoxLinuxAdditions-x86.run
  17. reboot or telinit 6
That's pretty much it. More pointers can be found here.

Saturday, May 08, 2010

Ugly Boot Screen Ubuntu 10.04

Recently did a network upgrade from Ubuntu 9.10 to 10.04 LTS (desktop edition). The upgrade didn't work initially--there was some conflict with XUbuntu which I also had installed under 9.10. I removed all traces of Xubuntu and xfce, and then the network upgrade worked fine.

10.04 LTS is a fine distribution. I really like it. It's been a while since I used Ubuntu and one of the things I enjoy about it is that things just work. Wireless set-up, which had been so painful previously, was a breeze and the connection is fast! Much faster then it had been under XP on the same machine.

Well, to the point. One of Ubuntu 10.04's failings was the boot up splash screen!! So incredibly ugly! I should have taken a picture. The word UBUNTU was outlined in some kind of psychedelic malaise. Painful to look at. Not a show stopper, but please. This isn't a hack distro, this should be slick, professional, pleasant in every way.

Are they working on a fix? I know from bug reports that I am not the only one who's seen similar issues. I don't know, but there is a workaround. I just applied it on this very system I am using to post this entry. Here it is, step-by-step for new users. I used "Alternative One". The only thing I did differently was change screen resolution entries from 1280x1024 to 1024x768 to accommodate the maximum resolution of this relic of a laptop I am using. Here it is, fix that ugly boot logo in Ubuntu 10.04 (Lucid Lynx):

How to Fix the Big and Ugly Plymouth Logo in Ubuntu 10.04

I should post the fun I had doing a network upgrade from Ubuntu 8.04 LTS Server to the 10.04 LTS edition. I'm sure it would have been painless if I wasn't booting from a software RAID1 drives. I hope I can recall how I made it work so I can post for reference the next time I upgrade and it happens again--which of course it will. I have no doubt. It always does.

Oh, and I should mention I am having excellent success running XP from VBox OSE on this dinosaur. I can't believe it works, but it actually works very well!

Well, time to reinstall the Xubuntu desktop.