Tony's ramblings on Open Source Software, Life and Photography

Configuration of Asus Routers Running Merlin Firmware

Here's a guest blog post by Matthew Burkett on configuring the Merlin router firmware for OpenVPN.

Initial Setup
So starting from the point of opening the box or using the reset button, when you first power on the device you will need to enter the basic information. Secure username and password for the router login, wireless SSID (Name) and password for both 2.4 and 5 Ghz channels, and your internet connection info if it was not automatically detected by the router. At this point you should have a fast useable router with great wireless coverage, if you are a standard user congratulations your done. Get on face book and tell your friends, if you are like me however you have only just started.

Merlin firmware installation


Gluster on ZFS with Geo-Replication

I've been fighting with Gluster with geo-replication on ZFS for several months now but I believe I've finally stumbled on the configuration that works best and gives much better Gluster performance on ZFS.

First a peek at the landscape
I probably don't have your typical storage needs. On this particular cluster I'm storing around 15 million files averaging 20MB each. No more than 255 files or sub-directories in a given directory.

My Gluster configuration uses a two-brick configuration with replica 2 (mirroring) and a single geo-replication slave over SSH.

Each Gluster brick uses ZFS RAID-Z volumes, spanning four SATA3 7200 RPM drives, and a single 256 GB SSD configured as a cache drive for the volume. Each Gluster server is connected on a private gigabit network segment to each other, and for the initial data load the Geo-replication server was connected to the same segment.

The Geo-replication slave also uses ZFS RAID-Z, but does not have a cache drive.

The goal with this configuration is to enable snapshot backups on either brick, plus geo-replication backups to a distant datacenter.

It's Elementary My Dear Watson

A friend of mine has switched to Elementary OS and claims it's the best Linux desktop he's ever used. Debian / Ubuntu based but with a lot more focus on the user interface and making it both pretty and useful.

Is it time for Canonical to lose the Desktop Linux battle? Perhaps, as they seem to be diverging more and more from what the average Linux user want's to see. Unfortunately they seem to have missed that no matter how much you try to dumb down Linux for my Grandmother, 99% of Linux users are still going to be geeks, or have an install that is set up by a geek.

Maybe with Valve moving more towards Linux with SteamOS and porting their game platforms to Linux, and with Electronic Arts and Dice occasionally wanting to mention the word Linux so they don't feel left out, you'll see more mainstream adoption. I imagine we will go through something similar to Android - different vendors may try to push their own "versions" of Linux branded for them, just like Valve is doing with SteamOS.

Install Canon MG5220 Printer / Scanner in Ubuntu 13.04

I finally got around to setting up my Canon MG5220 printer / scanner in Ubuntu. It was a little challenging just because of a couple of settings and obscurity around how to use it in Linux.

First, using this old article, I was able to find, download and install the drivers.

The kicker in Ubuntu 13.04 is that they've pretty much nerf'd the printer administration system. Thankfully this printer plays nicely, once you change a setting.

After turning on your printer and attaching it to the wifi, you need to go to the web interface on the printer at http://[printeripaddress]/

Next, click the "Other Settings" button in the bottom right of that page.

Then, click "Network Settings" and change the "LPR Service Notification" to "On".

To recap this page you should see something like:

Once that's done go and add a printer and Ubuntu should find it automatically. If you've followed the steps to install the driver in the blog post linked above, it will find the driver automatically.


Getting Localized Date for Today in Android

I've been doing it all wrong.

As most seasoned developers know, making an application that works for many countries and languages is pretty much a requirement of modern software development.

And I've been doing it the hard way...

So, here's a snippet to get today's date in Android into a string that is formatted for the local language. Now, those not in the know may be thinking "A date's a date, right?" Wrong. American's have most things backwards. Dates are one of them. We're just so insulated that we don't realize it. For instance, today's date in the great USA looks like "10/3/2013" but in most European countries it would look like "3-10-2013" - progressing from smallest part of time to the largest.

So here's that snippet I promised (if you're in the UK, is that "promized?"):

Calendar c = Calendar.getInstance();
String mydate= android.text.format.DateFormat.getDateFormat(context).format(c.getTime());

DateFormat in Android will automatically structure the string in the way it's needed for whatever localization settings are on the device. Now you know. Yes, I'm slow to this, but that's ok.

PDF Creation for Android

So my latest app, Photog Companion generates PDF documents on Android.

I was thinking about supporting mark-up of existing PDF's. That's probably not all that difficult to implement myself but I don't want to spend the time learning the rest of the PDF spec. So, I did some research and even though a lot of people were saying bad things about the company I decided to contact iText to see what a license would cost. I was expecting something like a $500 developer license.

For my free application, they basically wanted from $0.17 to $0.55 per device installation. That means the more people that install my free application, the more I have to pay iText. Given even a low of 15,000 installs after a year (MilesTrac Free beat that) I'd owe iText a total of $2,650.

That's just nuts. It's about time someone wrote a PDF library for Android that's Apache 2.0 licensed. Maybe I should fork Apache's own PDFBox and start porting it to Android.


Designed For Tablets

The Google Play Store interface for publishers was repeatedly telling me that I needed to design my application, Photog Companion Model Release, for Tablets.

The confusing thing for me was that I already provided alternate layouts for tablets and went to great pains to make sure it worked nicely on tablets.

It turns out, they require the new Layout folders "layout-sw600dp-land" and "layout-sw700dp-land" for compatibility with 7 and 10" tablets. Simply using "layout-xlarge-land" wasn't enough.

Quick and easy fix, just copy the layout I'd already made into the newly created Jellybean specific folders and the warning went away.


Eclipse Hangs with Resolving Error Markers

This problem drove me nuts for hours today. I've recently upgraded to Eclipse "Kepler" with a completely new install. Everything went great for a while, but the next time I started Eclipse it wouldn't actually finish loading. Sometimes it would launch but never highlight my code.

A bit of digging showed that the Android Development Tools were hanging on a process described as "Resolving Error Markers".

Turns out, if your Internet connection is slow, bogged down or the servers at the other end are crappy this can happen. There's a quick and easy solution: Install the Android API documentation.


Bulk Converting M4A files to MP3

Let's say you suddenly realize some of your older music collection is in the wrong format. Everything is organized into folders for albums, etc. and you don't want to have to go into every subdirectory and individually convert the files.

Here's a little bash script for you. Place this in the top level directory of the tree you want to convert and it will bulk convert all m4a files into mp3 files. It's an easy way to convert all the files in a specific tree and could easily be modified for different file formats.


# Convert m4a to mp3 in subdirectories
# Make sure the file list will support the wildcard character:
shopt -s globstar

for F in **/*.m4a
  newname=`basename "$F" .m4a`
  mypath=`dirname "$F"`
  ffmpeg -i "$F" -acodec libmp3lame -ac 2 -ab 192k -ar 44100 "$mypath/$newname.mp3"

Jawbone Up First Impressions

Jawbone UPWell I've worn my Jawbone Up for 24 hours now and here's my first impressions.

  • It's comfortable. I was worried that getting a Medium would be too big for me because I have very small wrists, but apparently the Up sizes are designed for small and active people.
  • It's stylish. Some photos I saw made it look very thick, but it's just right.
  • The power nap feature is awesome!
  • The smart alarm feature is awesome!
  • The get off your butt reminder is awesome!
  • It's easy to use, sort of. The documentation is nonexistent. For instance, the paperwork that comes with it says almost nothing. The app help gives you some basics but doesn't even tell you how to disable the alarm in the morning or even if there's a snooze function (I don't think there is.) A few other questions I still have, like will the alarm work if it's not in "sleep" mode?
  • Despite sleep tracking, it's not a medical bracelet. I think too many people think this thing will break down exactly how much of each type of sleep they got. It simply logs light and deep sleep based on movement.