Installing Google Maps on an iPhone 5 and iOS6

One of the reasons I bought an iPhone in the first place was so I could use Google Maps to navigate San Francisco’s public transit systems. I just started working in the City a couple of years ago and I went and bought an iPhone so I could punch in the address of where I wanted to be and the phone would tell me “go two blocks down and get on the #10 bus (which will be at the bus stop in 3 minutes).” I could even watch the phone’s GPS marker show me where I was so I knew when to get off the bus or MUNI or BART or whatever. I’ve since taken my phone to other cities and I don’t even bother to rent a car if the city has a decent transit system. I can navigate the ‘L’ in Chicago or Portland’s MAX transit using Google Maps.

So I was not happy to hear that Apple was replacing Google Maps on iOS 6 / iPhone5 with their own mapping program that doesn’t support public transit systems the way that Google Maps does. Not only that, they won’t let you download the Google Maps app from the iTunes store because they don’t want it to compete with the Apple Map app.

Luckily there’s an easy work-around that allows you to install Google Maps using a web shortcut:

 

Start up Safari on your iPhone.

 

Type “maps.google.com” into the location bar.

iPhone Safari Location Bar

 

Click “yes” if it asks if it can use your location.

 

Click the bookmark button at the bottom/middle of the screen.

iPhone Safari Bookmark Button

 

Select “Add to Home Screen”

iPhone Bookmark Options

 

You should now have a new “Google Maps” app on your iPhone screen that links you directly to maps.google.com. It doesn’t look exactly like the old app, but all of the functions are there, including the ability to plan a route using public transit.

Hope you find this useful.

Getting rid of self-resizing windows in Ubuntu Linux 12.04

I’ve been using a pre-release “daily build” installation of Ubuntu 12.04 “Precise Pangolin” and noticed that current default for Gnome is for windows to resize themselves when you get close to the edge of the screen. I have two 22″ widescreen monitors and if I moved a window near the top edge it would maximize and fill the screen. If I moved a window to any edge Gnome would decide for me that what I “really” wanted was to enlarge the window to fill half the screen or do something else equally annoying. This might work well on a 10″ netbook screen, but on dual 22″ monitors it’s annoying as hell.

I tracked the problem down to a setting in Compiz, the screen compositing tool used by many Linux desktop environments, so if you’re using KDE or Unity with Compiz and you’re finding self-resizing windows irritating this fix should work for you as well.

To fix the problem you need to install the CompizConfig Settings Manager, so fire up Synaptic Package Manager and search for “compizconfig-settings-manager” and install it.

Once installed, if you’re using Gnome go to Applications > System Tools > Preferences and click “CompizConfig Settings Manager” to start the tool.

Scroll down to “Window Management.”

Uncheck “Place Windows”.

Leave “Grid” checked, but click the word “Grid” to get the Grid settings, then go to the Edges tab and change all Resize Actions to “None”.

Click Back.

Now your desktop will do what you tell it to do, rather than second-guessing you and doing something that you do not want.

One thing that you can now do (that you probably really don’t want) is to have the title bar (and it’s controls) move off-screen, which means you can’t move or resize the window unless you Alt-right-click on it. To fix that issue:

Check the “Put” plugin.

Click the word “Put” to bring up more options, go to the “Misc Options” tab, check “Avoid Offscreen”, click Back, then Close Window.

Hope you find this useful.

Synchronizing Thunderbird e-mail filters using Dropbox

Two words: Use symlinks.

If you already know what a symlink is then you don’t need to read the rest of this article. If you want a better explanation, read on…

I use the Thunderbird e-mail client to read mail stored on my company’s IMAP mail server. I have a lot of filters set up that sort the mail into different folders, and Thunderbird stores the filter definitions in a file called msgFilterRules.dat. I read mail on different machines, some running various Linux distros and some running Mac OS X. I wanted all of the different machines to use the same rules for filtering e-mail into different folders, and if I make changes to the filters on one host I want those changes to take effect on all of the other hosts as well.

To do this I first set up a Dropbox account and installed the Dropbox software on my different machines, so now there’s a directory called “Dropbox” in my home directory that is synchronized between all of my different machines. I moved my filter file into the Dropbox directory and symlinked that to the location where Thunderbird expects to find the filter rules.

The step-by-step explanation if you want to do this:

Set up Dropbox on all of your machines.

Shut down Thunderbird if it’s running.

Start up a terminal window.

Find the msgFilterRules.dat file that you want to use as your “master” copy. On both my Mac laptop and Linux hosts the file is stored in ~/.thunderbird/[profile name]/ImapMail/[imap server name]/, where [profile name] is your Thunderbird profile name on that host, usually some random characters followed by ‘.default’. (Type cat ~/.thunderbird/profiles.ini if you want to see all of your profile names.)

Make a backup copy of the msgFilterRules.dat file:

cd ~/.thunderbird/[profile name]/ImapMail/[imap server name]/

cp msgFilterRules.dat msgFilterRules.dat.backup

Move the filter file to Dropbox:

mv msgFilterRules.dat ~/Dropbox/

Symlink the Dropbox copy of the file to the current directory, where Thunderbird expects to find it:

ln -s ~/Dropbox/msgFilterRules.dat .

Verify that the symlink was created correctly:

ls -al

You should see a line that looks like:

lrwxrwxrwx  1 earl users        37 Oct 25 21:12 msgFilterRules.dat -> /home/earl/Dropbox/msgFilterRules.dat

Now the machine you’re on is using the Dropbox copy of the filter file. To set this up on your other machines:

Verify that the file exists in the ~/Dropbox directory:

ls -al ~/Dropbox

Get to the directory where the filter file lives, remove the local copy, then create the symlink:

cd ~/.thunderbird/[profile name]/ImapMail/[imap server name]/

rm msgFilterRules.dat

ln -s ~/Dropbox/msgFilterRules.dat .

One word of warning: Thunderbird reads the filters into memory when it starts, and writes them back to disk when it exits. That means that if you have two hosts and Thunderbird is running on both of them, the last host that exits will write it’s version of the filters to disk. So if you make a change to the filters on one host and exit from Thunderbird, then exit from Thunderbird on the second host, the older filters on second host will overwrite the filter you just added. Because of this, I recommend exiting from Thunderbird whenever you leave your computer. I added a “killall thunderbird-bin” that runs from cron at 2am just to make sure that my copy at work isn’t running if I check mail from home in the morning.

Corosync / Pacemaker

While building high-availability Linux computing clusters with Corosync, Pacemaker and OpenSUSE I’ve assembled a collection of useful notes. I’ll share them here, and add to them as time permits.

Terms and abbreviations

Corosync allows any number of servers to be part of the cluster using any number of fault-tolerant configurations (active/passive, active/active, N+1, etc.)

Corosync provides messaging between servers within the same cluster.

Pacemaker manages the resources and applications on a node within the cluster.

OpenAIS can be thought of as the API between Corosync and Pacemaker, as well as between Corosync and other plug in components.

The ClusterLabs FAQ explains it this way: “Originally Corosync and OpenAIS were the same thing. Then they split into two parts… the core messaging and membership capabilities are now called Corosync, and OpenAIS retained the layer containing the implementation of the AIS standard. Pacemaker itself only needs the Corosync piece in order to function, however some of the applications it can manage (such as OCFS2 and GFS2) require the OpenAIS layer as well.”

“DC” stands for “Designated Co-ordinator”, the node with final say on the cluster’s current state.

“dlm” is the “distributed lock manager” used for lock-update-unlock data updates across the cluster.

Pacemaker Daemons (managed by Corosync):

  • lrmd – local resource manager daemon
  • crmd – cluster resource manager daemon
  • cib – cluster information base (database of cluster information)
  • pengine – policy engine
  • stonithd – “shoot the other node in the head” daemon
  • attrd – I would guess “attribute daemon”, but I haven’t found a formal definition yet of what this does. Need to check the source code and see what it says
  • mgmtd – management daemon. I haven’t found a formal definition yet of what this does. Need to check the source code and see what it says

Operations

To start Corosync on an OpenSUSE server:

# rcopenais start

To stop Corosync on an OpenSUSE server:

# rcopenais stop

To get the current cluster status:

# crm status

Text-based cluster monitoring tool:

# crm_mon

To list all of the resources in a cluster:

# crm resource status

To view the current pacemaker config:

# crm configure show
# crm configure show xml

To verify the current pacemaker config:

# crm_verify -L -V

Force the ClusterIP resource (and all related resources based on your policy settings) to move from server0 to server1:

# crm resource move ClusterIP server1

Note that to transfer the resources this actually sets the preferred node to server1. To remove the preference and return control to the cluster:

# crm resource unmove ClusterIP

Making a new shadow (backup) copy of a working CIB called “working”:

# crm configure
crm(live)configure# cib new working
INFO: working shadow CIB created

Updating the “working” backup copy of the live CIB:

# crm configure
crm(live)configure# cib reset working
INFO: copied live CIB to working

Setting the “working” CIB to act as the “live” configuration:

# crm configure
crm(live)configure# cib commit working
INFO: commited 'working' shadow CIB to the cluster

Saving the configuration to a file, modifying the file, and loading just the updates:

# crm configure show > /tmp/crm.xml
# vi /tmp/crm.xml
# crm configure load update /tmp/crm.xml

To get a list of all of the OCF resource agents provided by Pacemaker and Heartbeat:

# crm ra list ocf heartbeat
# crm ra list ocf pacemaker

To see which host a resource is running on:

# crm resource status ClusterIP
resource ClusterIP is running on: server0

To clear the fail count on a WebSite resource:

# crm resource cleanup WebSite

Cluster configuration

On OpenSUSE servers OCF resource definitions can be found in /usr/lib/ocf/resource.d/.

Pacemaker resources are configured using the crm tool.

To disable STONITH on a two-node cluster:

# crm configure property stonith-enabled=false
# crm_verify -L -V

Adding a second IP address resource to the cluster:

# crm configure primitive ClusterIP ocf:heartbeat:IPaddr2 \
        params ip="192.168.1.97" cidr_netmask="24" \
        op monitor interval="30" timeout="25" start-delay="0"

To turn the quorum policy OFF for two-node clusters:

# crm configure property no-quorum-policy=ignore
# crm configure show

Adding an Apache resource with https enabled:

# crm configure primitive WebSite ocf:heartbeat:apache \
        params configfile="/etc/apache2/httpd.conf" options="-DSSL" \
        operations $id="WebSite-operations" \
        op start interval="0" timeout="40" \
        op stop interval="0" timeout="60" \
        op monitor interval="60" timeout="120" start-delay="0" \
        statusurl="http://127.0.0.1/server-status/" \
        meta target-role="Started"
 

Note that the Apache mod_status module must be loaded and configured so that http://127.0.0.1/server-status/ will return the server status page, otherwise Pacemaker cannot tell that the server is actually running and it will attempt to fail over to the other node, then fail again.

Adding a DRBD resource (based on http://www.drbd.org/users-guide-emb/s-pacemaker-crm-drbd-backed-service.html):

# crm configure primitive VolumeDRBD ocf:linbit:drbd \
        params drbd_resource="drbd_resource_name" \
        operations $id="VolumeDRBD-operations" \
        op start interval="0" timeout="240" \
        op promote interval="0" timeout="90" \
        op demote interval="0" timeout="90" \
        op stop interval="0" timeout="100" \
        op monitor interval="40" timeout="60" start-delay="0" \
        op notify interval="0" timeout="90" \
        meta target-role="started"
# crm configure primitive FileSystemDRBD ocf:heartbeat:Filesystem \
        params device="/dev/drbd0" directory="/srv/src" fstype="ext3" \
        operations $id="FileSystemDRBD-operations" \
        op start interval="0" timeout="60" \
        op stop interval="0" timeout="60" fast_stop="no" \
        op monitor interval="40" timeout="60" start-delay="0" \
        op notify interval="0" timeout="60"
# crm configure ms MasterDRBD VolumeDRBD \
        meta clone-max="2" notify="true" target-role="started"

Note that the resource name drbd_resource="drbd_resource_name" must match the name listed in /etc/drbd.conf and that drbd should NOT be started by init — you want to let Pacemaker control starting and stopping drbd. To make sure DRBD isn’t being started by init use:

# chkconfig drbd off

Telling Pacemaker that the floating IP address, DRBD primary, and Apache all have to be on the same node:

# crm configure group Cluster ClusterIP FileSystemDRBD WebSite \
        meta target-role="Started"
# crm configure colocation WebServerWithIP inf: Cluster MasterDRBD:Master
# crm configureorder StartFileSystemFirst inf: MasterDRBD:promote Cluster:start

Fixing the “broken horizontal scrollbar” problem in LibreOffice Calc

This problem affects people using the KDE4 desktop with the “Oxygen” style and a recent version of the LibreOffice suite. (I’m running LibreOffice 3.4.2 on OpenSUSE 11.4) The horizontal scrollbar in Calc just doesn’t work, so if your spreadsheet is wider than your screen you can’t use the scollbar to view the right hand side.

The problem is with the Oxygen widget style. On a host running OpenSUSE 11.4 you can change this by going to:

Applications > Configure Desktop > Application Appearance > Style

Then set “Widget Style” to any style except “Oxygen”. Click Apply.

Problem solved.