Thursday, October 27, 2011

Exporting only the notes pages from an OpenOffice or LibreOffice presentation

Previous: Installing Coffeescript on Ubuntu 11.04

Since switching to Ubuntu as my primary (and almost only) platform, I've sometimes had some challenges with presentations created with OpenOffice or LibreOffice Impress. One challenge is producing handouts based on the notes pages in a presentation. The export to PDF feature cannot, apparently, produce a PDF containing only the notes pages. It always exports the slides as well.

I was happy to find a handy script at http://www.oooforum.org/forum/viewtopic.phtml?t=38797, contributed by user eponymous way back in 2006. The script reads the exported PDF file and writes two PDF files: One containing only the slide images and one containing only the notes pages. The script depends on pdftk (PDF Toolkit) from PDF Labs, available from http://www.pdflabs.com/. Pdftk can also be installed from an Ubuntu repository with
sudo apt-get install pdftk


Next: Ubuntu upgrade 11.10 to 12.04

Friday, September 2, 2011

Installing Coffeescript on Ubuntu 11.04

Previous: Ubuntu 11.04 on Dell Vostro - FAIL

Installing Coffeescript turned out to be slightly different than documented on the Coffeescript site at http://opinionated-programmer.com/2010/12/installing-coffeescript-on-debian-or-ubuntu/. This is how I did it:
sudo add-apt-repository ppa:gezakovacs/coffeescript
sudo apt-get update
sudo apt-get install coffeescript
At this point, when I ran coffee it was unable to find nodejs. I searched for help and discovered this is a known bug as of the date of this post: https://bugs.launchpad.net/ubuntu/+source/coffeescript/+bug/777554. The workaround is:
cd ~/bin
ln -s /usr/bin/node nodejs
With that, Coffeescript ran fine.

Next: Installing Coffeescript on Ubuntu 11.04

Saturday, July 30, 2011

Ubuntu 11.04 on Dell Vostro 3550 - FAIL

Previous: Getting Instiki wiki working on Ubuntu 11.04

I was thinking Natty and Wubi were having a spat. I couldn't get Ubuntu 11.04 running on a Dell Vostro 3550 using Wubi. After using it under VmWare for a while, I tried Wubi again and it worked. Things went very well for a week or so, and then one fine boot it blew chunks, just as it had done before. I could find no help online for the problem, but I did discover several postings that mentioned some kind of deep incompatibility between Ubuntu 11.04 and the Dell Vostro 3550, despite the fact some other Vostro models actually ship with Ubuntu pre-installed. So, the problem isn't an issue with Wubi after all, but an issue with this particular laptop model.

Next: Installing Coffeescript on Ubuntu 11.04

Saturday, June 25, 2011

Getting Instiki wiki working on Ubuntu 11.04

Previous: Installing rvm on Ubuntu 11.04

I started by copying my backup of the whole directory .wiki from an external drive to /home/.wiki.
Then I ran the following commands:
rvm gem install bundler
sudo apt-get install
libxml2-dev
libxslt1-dev
sqlite3
libsqlite3-dev
cd .wiki
bundle
Bundler installed other components Instiki uses, including nokogiri, rubyzip, and sqlite3-ruby.

Instiki did not start, and reported this error:
/home/dave/.rvm/rubies/ruby-1.9.2-p180/lib
/ruby/1.9.1/psych.rb:148:in `parse':
couldn't parse YAML at line 18 column 14 (Psych::SyntaxError)


I found an explanation and workaround by vicvega on
Stack Overflow. I added the lines
require 'yaml'
YAML::ENGINE.yamler= 'syck'
at the top of Instiki's config/boot.rb file (just above the comment that reads, "Don't change this file!"), and Instiki started up clean. In a nutshell, the problem was that bundler uses psych as the default yaml parser, psych is not compatible with rails, and Instiki is a rails app.

In .bash_aliases I added a line to start the wiki conveniently:
alias wiki=~/.wiki/instiki


Next: Ubuntu 11.04 on Dell Vostro 3550 - FAIL

Installing rvm on Ubuntu 11.04

Previous: GoogleEarth installation on Ubuntu 11.04

I started by referring both to the rvm installation guide and to the notes I had made when I installed rvm on 10.04: Ubuntu 10.04 upgrade on Toshiba Satellite: Ruby Version Manager.

They have simplified the installation process for rvm. You used to have to comment a line in .bashrc and then run a script and
then uncomment the line again. They've improved the process so that isn't necessary anymore. Makes the world a better place.

The rvm installation itself worked exactly as documented in the rvm installation guide, so I won't repeat the steps here.

Installed ruby 1.9.2 and 1.8.7 and set 1.9.2 as the default ruby version:
rvm install 1.9.2
rvm install 1.8.7
rvm --default use 1.9.2
This all worked fine and it was easy to switch between versions:

ruby -v (it reported 1.9.2)
rvm use 1.8.7
ruby -v (it reported 1.8.7)
use default
ruby -v (it reported 1.9.2)

Next: Getting Instiki working on Ubuntu 11.04

GoogleEarth installation on Ubuntu 11.04

Previous: Ubuntu 11.04 on VmWare Player with Windows 7 host

The GoogleEarth installation on Ubuntu has changed since I last installed it. This time, the installation went this way:

(1) From the GoogleEarth download site at http://www.google.com/earth/download/ge/agree.html download "64 bit .deb (For Debian/Ubuntu)".
(2) In a Terminal window, install the Microsoft TrueType basic font set:
sudo apt-get install ttf-mscorefonts-installer

(3) In a Terminal window, install prerequisite packages to support GoogleEarth:
sudo apt-get install lsb-core
If Ubuntu complains about missing prerequisites for lsb-core, run:
sudo apt-get -f install

(4) In a terminal window, install the .deb package downloaded from the GoogleEarth site:
sudo dpkg -i google-blah-blah.deb

(5) Log out and back in again so that the fonts will be available to Google

Next: Installing rvm on Ubuntu 11.04

Ubuntu 11.04 on VmWare Player with Windows 7 host

Previous: Ubuntu 11.04 on Virtualbox with Windows 7 host - FAIL

Despite the issues with Virtualbox, I still felt the VM approach was the way to go to run Ubuntu 11.04 with Windows 7 on the Dell Vostro. It seemed as if there was no free virtualization proram available that would do the job, so I went to the VmWare site expecting to pay around $80, as in years past. I didn't like the idea of having to pay just to use my personal system when on the road, so I was pleasantly surprised to see that VmWare now offers a product called VmWare Player that is available free for personal use. I tried installing Ubuntu 11.04 on the Dell laptop using VmWare Player.

The installation went smoothly and it was easy to see what was going on at all times.

Just as with Virtualbox, VmWare Player "thought" the system lacked the hardware necessary to run Unity. I don't understand well enough how virtualization software works to have a guess as to why that might be. The "real" hardware is certainly adequate. Of course, for this limited purpose the classic Gnome desktop is perfectly adequate, too.

On edit: Found a solution from David Tam on his blog. It seems Unity depends on hardware 3D graphics acceleration, which is not supported in a guest VM. The solution is to switch to a 2D version of the Unity desktop:
sudo add-apt-repository ppa:unity-2d-team/unity-2d-daily
sudo apt-get update
sudo apt-get install unity-2d-default-settings
then log out and in again. Voilá!

Network connectivity from the guest OS was seamless. I plugged a USB stick into a port, and VmWare Player connected it to the Ubuntu instance with no problem.

I shut down the Ubuntu guest from inside the guest, then double-clicked its entry in VmWare Player's list to restart it. All normal.

Good to go.

Next: GoogleEarth installation on Ubuntu 11.04

Ubuntu 11.04 on Virtualbox with Windows 7 host - FAIL

Previous: Windows 7 boot menu issues

With Ubuntu 11.04 running as a VirtualBox VM on a Microsoft Windows 7 host system, USB devices are not visible to the guest Ubuntu instance. Community documentation at https://help.ubuntu.com/community/VirtualBox/USB says, "Add yourself to the user group vboxusers, then log out and back in." I found no group named vboxusers, so I created one and added my own account, logged out and back in. This had absolutely no effect.

Another source at http://www.ubuntugeek.com/running-ubuntu-11-04-natty-unity-3d-on-virtualbox-4-x.html suggested installing "Virtualbox guest additions," and said to "click on Devices->Install guest additions," which I could not find anywhere, in any menu of any application on either the host or guest systems.

As a last resort, I looked at the Virtualbox user manual. On this page http://www.virtualbox.org/manual/ch04.html#idp11234128 it suggested the following procedure to install Virtualbox guest additions for Ubuntu:
apt-get update
apt-get upgrade
apt-get install dkms
and then...oops...point to the VBoxGuestAdditions.iso file, which doesn't seem to exist anywhere at all. Searching further, I found a thread on Ubuntu Forums at http://ubuntuforums.org/showthread.php?t=584763 where people were looking for this file. This thread also recommends opening the "Devices" drop-down menu in Virtualbox, but there is no such menu item. A thread on the Virtualbox forums at http://forums.virtualbox.org/viewtopic.php?f=3&t=7007 also recommends using this drop-down menu, which does not exist.

Finally, I found an answer at http://forums.virtualbox.org/viewtopic.php?f=2&t=38548. The Virtualbox menu bar in the guest window does not appear when running in "scale" mode. Used host-C to get out of "scale" mode, and the menu appeared. (I had switched to scale mode early on, since the Ubuntu screen image does not fit inside its Windows window, and resizing the Windows window had no effect on the size or aspect ratio of the Ubuntu screen.) The option to install the virtual guest additions resulted in an iso file appearing as an external CD-ROM drive in the guest Ubuntu instance.

At that point, I ran the update and upgrade and installed dkms. Upgrade did quite a lot and took several minutes to run.

After following the instructions at http://www.virtualbox.org/manual/ch04.html#idp11234128, the guest OS still did not see the USB drive. Virtualbox reported the error, "USB device ' ' with UUID {blah} is busy with a previous request. Please try again later," and under Details it gave the result code E_INVALIDARG (0x80070057) for component HostUSBDevice and interface IHostUSBDevice.

Next: Ubuntu 11.04 on VmWare Player with Windows 7 host

Windows 7 boot menu issues

Previous: Ubuntu 11.04 on Wubi with Windows 7 - FAIL

After I removed the Wubi-installed copy of Ubuntu from the Dell laptop, there was just the one OS on the system. Yet, the boot menu continued to appear on startup, showing the now-defunct entry for Ubuntu. I discovered that Microsoft had made Windows a bit harder to use since Vista, in that there was no easy way to remove this entry from the boot menu. Msconfig was mentioned on several forums, but it doesn't appear to include a boot menu editor.

I took a chance on a downloaded product from NeoSmart Technologies called EasyBCD. It was intuitive to remove the entry from the boot menu and did no collateral damage. However, on restart the system still displayed the boot menu, now showing only one entry. When there is only one OS installed, there is no need to display the boot menu. It's just a waste of time. Haven't found a fix yet.

Next: Ubuntu 11.04 on Virtualbox with Windows 7 host - FAIL

Ubuntu 11.04 on Wubi with Windows 7 - FAIL

Previous: Ubuntu 11.04 installation

Recently I joined a company as a consultant, and the job requires frequent travel. The company laptop runs Microsoft Windows 7, and some of the company's software tools require Windows. I wanted to have some personal computer time while on the road but I didn't want to have to take two laptops with me, so I decided to install Ubuntu 11.04 under Wubi on that machine. This is a Dell Vostro laptop.

I was never able to get 11.04 to run properly after a Wubi install. There seemed to be some problem related to the video driver. Unfortunately, I could not get to a command line prompt at all. Once the machine reached a certain point in the installation, the display just displayed multicolored garbage or part of a memory dump, and did not respond to the keyboard or mouse.

I did not want to mess with the partitions on that machine, since Windows tends to be very sensitive to that sort of thing (see [blog post link]. Instead, I downloaded VirtualBox and installed 11.04 in a VM. It's functional, but doesn't take good advantage of the host system's video adapter. It won't even run Unity, thinking the "hardware" isn't up to the challenge.

One strange thing...after installing and creating a user account and so forth, when I restarted the guest OS it always wanted to install Ubuntu from scratch. I never found a good reason for it, but when I deleted all the Virtualbox log files (but not the log directory), the problem went away and the guest OS came up normally. After Virtualbox wrote to its log files again, the problem reappeared. Therefore, there did not seem to be any way to establish a reusable Linux instance. Every time I started the virtual machine I had to install Linux again. This is not especially useful.

Due to the issues with a Wubi install of 11.04, I decided not to upgrade the Acer Netbook. It happily runs 10.10.

Next: Windows 7 boot menu issues

Ubuntu 11.04 installation

Previous: Installing Android SDK and Eclipse ADT plug-in

I managed to corrupt the root partition on my main personal system, a Toshiba Satellite P500. Since I had to re-install Ubuntu anyway, I took the opportunity to move on to 11.04.

I wanted to keep the same partition structure as I had before on the Toshiba, with a 30GB partition mounted at /, an 8GB swap partition, and the rest of the disk as a single partition mounted at /home. The installation went smoothly. Just remember to connect your machine to the internet by wire for purposes of the installation. It won't find your wireless adapter during the installation process.

Default settings in .bashrc are a little different in 11.04 than they were in 10.04.
It ships with popular ls aliases and with .bash_aliases already sourced.
I made no changes to .bashrc this time.

Next: Ubuntu 11.04 on Wubi with Windows 7 host - FAIL

Saturday, March 12, 2011

Installing Android SDK and Eclipse ADT Plug-In

Previous: Ripping CDs on Ubuntu 10.04

My interest in Android development was rekindled when I got a new Android phone last month. After upgrading to Ubuntu 10.04, I had not reinstalled the Android development tools, so I installed them fresh.

Prerequisites



sudo apt-get install ia32-libs
sudo apt-get install sun-java6-jdk

Get the Android development kit



The Android development kit contains tools for building and testing Android apps. There are some very good tutorials on developer.android.com/resources/ that will help you get started.

1. Create home directory for android development tools. I chose ~/.android.

2. Download sdk from developer.android.com/sdk. At the time I did this, it was release 10. Note that the file name contains the releacd tse number. Place the downloaded file in the android development home directory.

3. In a command line window, change to the android development home directory.

4. Unpack the distribution.
gunzip -c android-sdk_r10-linux_x86.tgz | tar xopf -
You will end up with ~/.android/android-sdk_r10-linux_x86/. (The directory name contains the release number.)

Get Android platform development tools



The basic Android SDK contains only the core development tools. From the readme:

"In order to start developing applications, you must install the Platform-tools
and at least one version of the Android platform, using the SDK Manager.

"Platform-tools contains build tools that are periodically updated to support new
features in the Android platform (which is why they are separate from basic
SDK tools), including adb, dexdump, and others."

1. Change to the Android development home directory and start the SDK Manager:
tools/android
From the selections on the left side of the window, choose Available packages, then expand Android Repository. Tick the checkboxes next to the items you want to install. I chose Android SDK Platform-tools, revision 3, Documentation for Android SDK, API 11, revision 1, SDK Platform Android 3.0, API 11, revision1, SDK Platform Android 2.3.3, API 10, revision 1, Samples for SDK API 10, revision 1, and Samples for SDK API 11, revision 1. I got 3.0 because it was the latest version at the time, and 2.3.3 because it was the version that came with my shiny new Android phone.

After making your selections, click the button labeled Install Selected, in the lower right-hand corner of the window. It will display a list of components and licenses. You must choose Accept for each component or Accept All before the download will proceed. After accepting the licenses you want, click the Install button. It will display download progress.

If you don't have ADB running (and you won't at this point, if this is a fresh install, because ADB is not part of the base distribution), you may see the message "'adb kill-server' failed -- run manually if necessary." The installer attempts to kill the server because the server must be down for the install. This does not stop the installer.

If you get the message, "A package that depends on ADB has been updated. Do you want to restart ADB now?" choose Yes.

When the installation is complete, click Close to close the progress dialog box. Now if you choose Installed packages from the left-hand menu, you will see a list of the components you just installed.

Get the Eclipse IDE


It is not necessary to use Eclipse for Android development. You can use any IDE or other development tools you prefer. The course of least resistance is to use Eclipse, since that is what the Android team uses and all the tutorials and documentation assume you are using it, too. You can do everthing from the command line; there are no hard dependencies on Eclipse.

1. Download the appropriate Eclipse distribution from www.eclipse.org.

Eclipse is available preconfigured to support several common types of development. For Android development, you need only the most basic packaging of Eclipse. At the time I did this, it was called "Eclipse IDE for Java Developers."

2. Create home directory for Android-specific instance of Eclipse

I prefer to have Eclipse configured separately for each project rather than to have a single instance loaded with every imaginable plug-in.g I created a directory named ~/.eclipse-android for this instance.

3. Unpack the Eclipse distribution in its home directory.
gunzip -c eclipse-java-helios-SR2-linux-gtk-x86_64.tar.gz | tar xopf -
This resulted in ~/.eclipse-android/eclipse/

Install the Eclipse ADT plug-in



The documentation at developer.android.com/sdk/eclipse-adt.html#installing is very clear and helpful.

I started the new instance of Eclipse and created a workspace called android-sandbox to play in. I installed the ADT following the instructions at developer.android.com. This is a conventional Eclipse plug-in install, so I am not going to repeat all the steps here. One thing to note is that some of the content is unsigned, and you may see a warning message about that.

Configure the Eclipse ADT plug-in



For convenience, I created a symlink for to the Android development home directory in .profile:
ln -s ~/.android/android-sdk-linux_x86 ~/.android-sdk
. This matches the default configuration of the ADT plug-in. To change it, in Eclipse go to Windows > Preferences, choose Android, and set the value of SDK Location.

Create an Android Virtual Device



After installing the Eclipse ADT plug-in, you can run the Android SDK and AVD Manager from inside Eclipse. The plug-in adds a menu item to Eclipse's Window menu titled Android SDK and AVD Manager.

Start the Manager. If this is a fresh installation, you will see the message "No AVD available." Click New to get the "Create New Android Virtual Device (AVD)" dialog. Enter anything you please as the Name (it doesn't like spaces in the name).

The Target drop-down will contain a list of the Android platforms you installed. Pick the one you want for the new AVD.

Click Create AVD.

Verify the installation



The simplest way to verify the installation is to create an Android project and see if you can build a simple app and run it on your AVD.

The first indication of success is that the ADT options appear in Eclipse menus. Try File > New > Project and see if the Android entry appears in the list of project types.

When you create an Android project in Eclipse, ADT gives you a skeletal Java file to start you off. This isn't runnable as is. I suggest following the "Hello World" tutorial at developer.android.com/resources/tutorials/hello-world.html.

Once you've got the Hello World code in place, you can run the app in the emulator from inside Eclipse by right-clicking the project entry in Package Explorer and choosing Run As > Android Application.

A word of warning. The first time I ran my Hello World app from inside Eclipse, the emulator seemed to hang at a point before it loaded the app. Eventually it timed out, and complained that it could not load the app. However, the emulator itself finally started up. I could then run the app with no problems. If you see this behavior, it doesn't mean your app is configured wrong. The emulator just takes a long time to initialize itself. A long time. Several minutes.

If you eventually see the words "o;Hello, Android" appear on the emulator screen, then your installation was successful. Good luck and have fun.

Next: Ubuntu 11.04 installation