Linux Tip: How to Transfer Files from Ubuntu to Android

img credit:
File transfers have been notoriously painful between Linux and Android. While it works seamlessly on Windows, and on Mac you can use the Android File Transfer App, let me show you how to get his done on Linux. There are many ways to achieve it, but I'll use gMTP, which gives you a nifty little UI to manage file transfers. Later on, I'll also list other alternatives, in case this fails. So let's begin.

1. Fire your terminal using ctrl + alt + T, and

> sudo apt-get update

> sudo apt-get -y install mtp-tools mtpfs gmtp 

2. Connect your Android device to your PC, and launch gmtp

3. If you have only 1 android device attached to your pc, just click on Connect. It should automatically detect the device and show you the directory listings. I have noticed there is 30s-1min delay for the connection to happen, so do give it some time.

4. Once connected, you can drag drop files to and from your device.


gMTP is slow, unreliable and buggy.  Partially, the blame falls on mtpfs and Android's implementation of MTP. So if the above method fails, below are some alternatives

1. Transfer over your local network:  Ubuntu and most linux variants support network sharing using samba. Just right click on the folder you wish to share, and select sharing and security. On your Android device, download a file manager like ES File Explorer, which can easily access your network shares. For step by step how to, see this CNET article

2. Use Dropbox/Google Drive: Works well for small files and documents

3. Try go-mtpfs:  There is a detailed video below on mounting your device. I have limited success using this but I'll keep trying.

Hope this helps. Do drop me a comment on how the above methods worked for you. And if you have found other alternatives.

Google Trix! - Waterfall Charts on google spreadsheet

Waterfall charts are very common. You see them everywhere. They let you visualize a series of Business events, drivers or activities to explain 2 data points. An example below is a 2013 Revenue waterfall for a Business. It explains where the incremental revenue in 2013 was generated from.
There are tonnes of excel tutorials out there, but here is one for google spreadsheets.

There are multiple ways to achieve the same result. I like to use a stacked column chart. The live spreadsheet can be downloaded here.  Steps:

1. First get the basic data for your waterfall. Mine looks like the one below. Notice the start is 2012 Revenue, the end is 2013 Revenue. And all other rows are either +ve or -ve numbers.

2.  Reorganize your data into rows and columns below to plot your stacked column chart.

This is probably the most important step and I'll explain in detail. For our stacked chart, we need 2 bars. One a base bar which will control the height, and then the second bar to plot the positive and negative values for each row. Bar 1 and Bar 6 are the initial and final bars in the waterfall.
Bar 2 to 5 control the height of each waterfall element.

Negative values are trickier, since in a waterfall chart, negative values are displayed as bars starting at the same height as the previous bar, and going down. We achieve that using 2 simple formulaes for the Base and Bar 2-5.

Value for Base: =if(B3 >= 0 , sum($B$2:B2), sum($B$2:B2) + B3)
Values for Bar2-5: =if($B3 >= 0, $B3, -$B3)
Values for Bar1,6: =$B3

3. Select data from Columns C-J and plot a column stack chart

4. Now some formatting tricks to make the waterfall appear.
a) Select the Base bar and change the fill color to None
b) select the Bar 5 and change it's color to red, since it represents a drop/decrease
c) Change other colors as desired. I like to show growth/incrementals in green
d) Remove the legend

5. Viola! Waterfall chart is ready. Simple right. There is obviously some extra work needed in terms of reorganzing the data into multiple columns to plot the chart but it works

Did you find this helpful? Feel free to share your comments. And if there are better ways of achieving the same, do share them across. Thanks!

Fixing UNetbootin on Mac OS X to create a Bootable Linux USB

If you had issues trying to create a bootable linux usb for a pc, from your Mac, the below tutorial might help you. Even though it sounds slightly ironic, creating a pc bootable linux distro from a Mac, it's a situation I recently faced. So sharing the workaround.

The issue is the last version of UNetbootin I tried, extracts and installs linux successfully, however fails to create a bootable usb. So here are the steps

1. Go to finder/Spotlight, and launch Disk Utility
2. Select the usb disk, and create a partition. Format it as MS-DOS FAT and select Options > MBR
3. Go to the Terminal, and type the following

diskutil list

locate the name of your usb device. In my case it was rdisk2. Depending on your OS version it could differ.

diskutil unmountDisk /dev/rdisk2

Make the partition active and unmount the disk

sudo fdisk -e /dev/rdisk2
f 1
diskutil unmountDisk /dev/rdisk2

4. Now, download the latest, and extract and locate the mbr.bin
Go back to the extracted folder in the terminal, and install mbr.bin

sudo dd conv=notrunc bs=440 count=1 if=mbr.bin of=/dev/rdisk2

5. Now download and install UNetbootin for Mac, and proceed as usual. Select the distro and click ok.

This usb stick should be bootable on any pc, with your favorite distro :)

Credit: Paul Maunders SuperUser Forum

Google Spreadsheet tip: how to SUMIFS

SUMIFS is probably the most useful feature, Microsoft rolled out in Excel 2007. It lets you SUM a range, using multiple criteria. For instance, in the situation below, if we wanted to find out how much John made in 2010 Q3, you could use this simple formula.

Now how do you do this in google spreadsheet? Unfortunately, it only has the older SUMIF formula, which lets you select a single criteria. Let's see how to make it work.

SUM can be chained with the FILTER formula, to achieve the same results. The syntax is very simple.
SUM (Filter ([Sum Range], [All the criteria Ranges separated with a ; or a , ]))
e.g. =sum(filter(D2:D11,C2:C11= "John";B2:B11="Q3";A2:A11=2010))        

Sample example sheet

Pretty easy right!... Enjoy!