So, the other day, I received the latest issue of Make magazine. Overall, fun and quick to read, but really targeted towards the beginning maker. On the last page was an infortisement about the Nvidia Jetson TK1 development board, on sale for $99USD. Whats this, I say, so I consult the Book of Knowledge. The Nvidia site says the Jetson TK1 has a quad core A15 (nice) and 192 CUDA cores (???). I am not a GPU guy, but I assume the CUDA cores have something to do with an Nvidia GPU, probably the shader cores (otherwise, having a large focus on the GPU business, why would they mention it). Time for more knowledge. Wikipedia has all the knowledge you would ever want, so lets look there. I will paraphrase a bit, but GPU this, parallel programming that, then “supports programming frameworks such as OpenACC and OpenCL”. More Yak shaving. In the OpenAAC article, they talk about Open64, OpenUH, OpenARC, OpenMP and OpenHMPP.

At this point, I was not willing to dive deeper, because, well, you know, I was just looking at the basics of what this board can do. Now my brain is full of OpenX monikers. At this rate, the OpenX crowd are going to reserve or use up all of the good names, just like all the valuable TLDs were snapped up, leaving crap names for great products like toggl.

So this is my official announcement, that I would like to reserve OpenIAN before it gets squandered on some stupid Internet Application Networking, or some other equally atrocious backronym.

OpenTalk to you OpenLater,
– OpenIAN

Running rsync as a daemon

Adapted from

Environment: Lubuntu 14.04, QNAP TS-431

The first step in order to create a powerful backup facility with Time Machine like functionality requires that you run an rsync daemon on the machine to be backed up.

Create /etc/rsyncd.conf

In this case the foobarHome and foobarMusic sections are known as modules and foobarHome and foobarMusic are the module names. The module names are important and used when remotely connecting to the rsync daemon.

Create /etc/rsyncd.secrets

Secure /etc/rsyncd.secrets

Enable the rsync daemon


and enable by changing RSYNC_ENABLE to true. Optionally change the NICE values

Start the rsync daemon

Connect to the rsync daemon

To connect to the rsync daemon, specify a module name as set up in the rsyncd.conf file. You may append file paths to the module name

Samba, linux and QNAP

OS: Lubuntu 14.04

Here is the procedure that worked for me to access Samba shares published from your QNAP NAS.

Enable SAMBA on the NAS

From the web UI to the NAS, go to

and select the Microsoft Networking tab. Make sure that the “Enable file service for Microsoft networking” is checked. Set the workgroup to match the workgroup setting on all of your Windows boxes. For me, that is WORKGROUP. Click the Advanced Options button and set the “Highest SMB version” to the highest value, which for me was SMB 3.0. Note that this may not be necessary, as the default is SMB 2.1, which may work fine. I have not tested with that. Click Apply

Install cifs-utils on your Linux box

Create an SMB credentials file on your Linux box

In your home directory create and edit .smbcredentials and add the following

you can use the NAS default admin user account as the user

Add mounts to /etc/fstab on your Linux box

Edit /etc/fstab as sudo and add the following lines to the bottom

You can create as many mounts as you want. For example, I created a directory under /homes on the NAS and then mount that as /mnt/backup and backup my laptop to that share.

Mount the new mounts

Creating a time-lapse movie using avconv

This note explains how to take a number of still images and combine them into a movie using “avconv”.

This note applies to:

  • Ubuntu 14.04
  • avconv 9.16


Before starting a time-lapse project, one should consider some constraints. The number of pictures that can be taken by the camera is constrained by the size of the memory card where the camera saves its information. On the other hand, the largest possible number of pictures should be taken, since it provides for a smoother end video.

Therefore, an approximate length of the event to be recorded must be used, in conjunction with the total number of pictures that can be saved to memory, to compute the interval between each picture taken.

Also, one should consider the power needs for the extended duration that the camera is used.

Finally, the memory card used by the camera should be fast enough to record the images at the rate that they will be produced.

Image collection

After all pictures have been taken, one ends up with a large collection of images, generally numbered sequentially by the camera using a special naming convention. For this note, an example is used to demonstrate the process. In this example, about 2300 pictures were taken every two seconds, over a period of 1 hour and 20 minutes. The resulting collection was picture named as follows:

Creating Movie

On Ubuntu, the command-line tool “avconv” can be used to combines still images into a movie. The command required to combine the images from the previous example is:

The parameter “-r 10” sets the number of frames per second on the input stream. This is an important parameter since it influences both the smoothness of the video and its length. The higher the number, the smoother the resulting video. Ideally, the input frame rate should be 25 to 30 frames per seconds for the best smoothness.

However, following our example, at 25 frames per second, the resulting video would be 1.5 minutes long. In our example, we wish to have the resulting movie showing the original event over 4 minutes. Therefore, the input rate is set to 10.

The parameter “-start_number 6796” specifies the number at which the file name sequence starts at. This parameter is used with the input file format parameter “-i IMG_%d.JPG”, where the portion of the name with %d is replaced by a number, to find each image file.

The parameter “-q:v 0” sets the highest output video quality.

The parameter “-s hd1080” is used to sets the output dimensions of the video to high definition.

The parameters “-vcodec libx264” and “-crf 25” are used to set the output CODEC to H.264 and output frame rate. The output frame rate does not affect the length of the movie.


Although there are many factors to consider when making a time-lapse movie, the command-line tool “avconv” is really useful stitch together the video portion of the project. “avconv” is the successor to “ffmpeg”. Both tools are mature and contain a large number of options.

Therefore, use the options above as a starting point and experiment until you reach the desired effect.

Graphical notification from scripts

Environment: Linux

My laptop is getting long in the tooth and some programs load very slowly. Since some of these programs are exposed on the desktop as shortcuts to scripts, you need to double click on them to launch them. Unfortunatly, because they load slow and there is no feedback, I can never tell if my double click was recognized. After looking around a bit, I found a tool, notify-send, that allows you to inject messages into the desktop’s notification system.

First, install the package

I wanted to modify the launch script for Android Studio, which is the file in Android Studio’s bin directory. I added the following at the top of the script:


This puts up a notification message for 6000ms with the idea.png icon with a summary of Starting and the body of Android Studio in bold below it. The notification pops up immediately, giving sufficient feedback so that I don’t keep mashing the mouse button to launch it.

Note that the body allows some simple HTML to be used and the icon argument can either contain the location of an image file or the name of a system standard icon such as these listed here

Oracle Java and update-alternatives

Environment: Ubuntu 14.04

The Linux alternatives system is an excellent way to install and use different program equivalents. If you update Oracle Java quite often (or even once), it can be a tedious task installing new links and removing any old ones.

Since I always install the JDKs in the /usr/lib/jvm directory with the pattern jdk* (eg /usr/lib/jvm/jdk1.8.0_20), this can make it easy for a script to find all of the JDKs. The script shown below will search for all of the JDKs in /usr/lib/jvm and allow you to install or remove all of the programs in the JDK’s bin directory into the alternatives system.

The syntax is:

to install a JDK and

to remove a JDK.

The script will show the list of JDKs and prompt as to which JDK it should perform the install or delete. Selecting the number corresponding to the JDK and hitting Enter will start the operation.

Access WebDAV drive over SSL using Basic Auth via Windows 7

This note explains how to use a WebDAV drive using Windows 7. In particular, this note addresses issues that arise when the WebDAV drive enforces SSL, using a self-signed certificate, and basic authentication. All the steps detailed below are performed on a Windows 7 computer where the Web drive is intended to be used.

This note relates to:

  • Windows 7 client
  • WebDAV drive served by Apache 2.2


Adjust Registry

This step is required if the WebDAV drive enforces user authentication using HTTP “Basic Auth”.

Start the program “regedit.exe” using the following steps:

  • Press “Start” button
  • Choose “Run”
  • Enter “regedit.exe” and press enter

In the regedit program, navigate down the tree using the following path: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\WebClient\Parameters

Within the “Parameters” section, set the value of setting “BasicAuthLevel” to 2. The meaning of the values are:

  • 0 – Basic authentication disabled
  • 1 – Basic authentication enabled for SSL shares only
  • 2 or greater – Basic authentication enabled for SSL shares and for non-SSL shares

Close the regedit program.

Reboot Windows.

Import Self-Signed Certificate

This steps imports the WebDAV certificate to the store of trusted certificate. This step is necessary only if the certificate
is self-signed.

Open Internet Explorer as an administrator. Only IE will work for this step (Firefox and Chrome are not helping for this situation).
To open IE as an administrator, press on the “Start” button and find the Internet Explorer entry. Right click on the Internet Explorer entry in the start menu and choose “Run as administrator”.

  • In IE, browse to the site where the WebDAV is stored. It should be a URL that looks like “”. If the certificate has not been previously accepted, a dialogue box opens warning the user that the certificate is not trusted. Choose to “Continue to this website (not recommended)”.
  • Once the page of the WebDAV is displayed, the address bar will contain a tab titled “Certificate Error”. Click on this tab and choose “View Certificates”.
  • Click on the “Install Certificate…” button.
  • Choose the option “Place all certificates in the following store” and click on the “Browse…” button
  • Select “Trusted Root Certification Authorities” folder and press “OK” button
  • Click on “Next” and then “Finish”
  • Accept warnings

Once the certificate is installed, IE can be dismissed since it is no longer used.

Mount WedDAV drive

Mount the WebDAV drive using the following steps:

  • Start Windows Explorer (Start > All Programs > Accessories > Windows Explorer)
  • Right-click on “Computer” icon and select “Map Network Drive”
  • Select a letter for your drive
  • Enter the URL for the WebDAV drive ( in the field titled “Folder”
  • Select “Connect using different credentials”
  • Press “Finish” button
  • Enter user name and password

At this point, the WebDAV drive should be accessible like any other drive.

Send message with SSL or STARTTLS using Java Mail

This note explains how to send an e-mail message using JavaMail, including using an SSL connection or the STARTTLS built-in security.

This note applies to:

  • Java version 1.7
  • JavaMail version 1.4.1

If using Maven, the JavaMail artifact can be obtained using the following dependency:

Often, a properties file is loaded to configure the SMTP transport layer. This allows a user to configure outgoing mail server without having to change the code. Here is a code excerpt to obtain a session and

Plain Text

For plain text access to the SMTP service, the following properties can be used:


For sending a message using the STARTTLS built-in security, the following properties should be used:


For sending a message using SMTP over SSL, the following properties should be used:


There is a property which sets the “debug” mode for JavaMail. It can be set with the following properties:

Setup development environment for EZ430-F2013 using Eclipse in Ubuntu

This note explains how to set up Eclipse for developing images for the EZ430-F2013. This note assumes that the development environment is set up in Ubuntu 12.10.

This note relates to:

  • Ubuntu 12.10
  • EZ430-F2013
  • msp430-gcc version 4.6.3
  • Eclipse Classic version 4.2.1


Install Command-Line Tools

The installation of command-line tools to support the EZ430-F2013 development kit is covered in a different note. Please refer to the note Use EZ430-F2013 in Ubuntu to complete this step.

Install CDT

In Eclipse, the packages that support C/C++ development are named the C Development Toolkit, or CDT. Portions of the CDT are required to enabled a development environment for the EZ430-F2013:

  • C/C++ Development Tools
  • C/C++ Development Tools SDK
  • C/C++ Debugger Services Framework (DSF) Examples
  • C/C++ GDB Hardware Debugging

To install the CDT, in Eclipse:

Create a C project to use MSP-GCC

Create a C project:

  • “File” > “New” > “Project…” > “C/C++ / C Project”
  • Enter a project name
  • Use default location
  • Project Type: Executable > Empty Project > Linux GCC
  • Press Finish

Set up new project to use MSP-GCC:

  • Right-click on project, select “Properties”
  • Select page “C/C++ Build” > “Settings”
  • Select configuration “[ All configurations ]”
  • Select settings “Tool Settings” > “GCC C Compiler”
    • Command: msp430-gcc -mmcu=msp430f2013
  • Select settings “Tool Settings” > “GCC C Compiler” > “Includes”
    • Add include path: /usr/msp430/include
  • Select settings “Tool Settings” > “GCC C Compiler” > “Optimization”
    • Optimization Level: “Optimize for size (-Os)”
  • Select settings “Tool Settings” > “GCC C Linker”
    • Command: msp430-gcc -mmcu=msp430f2013 -Wl,-Map=${BuildArtifactFileBaseName}.map
  • Select settings “Tool Settings” > “GCC C Linker” > “Libraries”
    • Add library search path: /usr/msp430/lib
  • Select settings “Tool Settings” > “GCC Assembler”
    • Command: msp430-as
  • Select settings “Tool Settings” > “GCC Assembler” > “General”
    • Add include path: /usr/msp430/include
  • Select settings “Build Artifact”
    • Artifact type: “Executable”
    • Artifact extension: “elf”
  • Select settings “Binary Parsers”
    • select “Elf Parser”
  • Press “Apply” and “OK”

Once the project is set up correctly, it should be possible to build an image from source by right-clicking on the project and selecting “Build Project”. In the console, the output of the build should look something like the following:

Set Up Debugger Configuration

To debug the project directly from the IDE, a debugger must be configured. The following steps are used to configure a debugger to use the command-line tool “msp430-gdb”:

  • Select “Run” > “Debug Configuration…”
  • Select “GDB Hardware Debugging”
  • Press the “New” icon
  • Set name
  • Tab “Main”:
    • Project: select project
  • Tab “Debugger”:
    • GDB Command: msp430-gdb
    • Set “Use remote target”
    • JTAG Device: Generic TCP/IP
    • Host name or IP address: localhost
    • Port number: 2000
  • Tab “Startup”:
    • Reset and Delay: 3
    • Set: “Halt”
    • Initialization Commands: “monitor erase”
    • Set: “Load image”
    • Set: “Use project binary”
    • Set: “Load symbols”
    • Set: “Use project binary”
  • Tab “Common”:
    • Save as: “Shared file” (select project)
    • Display in favorite menu: “Debug”
  • Press “Apply”

Running the debugger from the IDE is the equivalent to running “msp430-gdb” at the command-line. It first requires that “mspdebug” runs to bridge to the EZ430-F2013 development kit. This can be perform from a terminal or from an Eclipse run configuration (next section).

To run the debugger, select from the menu “Run” > “Debug Configurations…”, choose the debugger create and press the button “Debug”.

Run MSPDEBUG from Eclipse

It is possible to run “mspdebug” from Eclipse using a run configuration. Here are the steps to set it up:

  • Select “Run” > “External Tools” > “External Tools Configurations…”
  • Right-click on “Program” and select “New”
  • Enter name: MSPDebug
  • Select “Main” tab:
    • Location: /usr/bin/mspdebug
    • Arguments: uif -d /dev/ttyUSB0 gdb

Once set up as an external tool, to run “mspdebug”, select “Run” > “External Tools” > “External Tools Configurations…”, click on the program called “MSPDebug” and press the “Run” button.


There are many short-cuts in Eclipse to run external tools and debug configurations without using the tedious menus. One of these short-cuts are located on the main tool bar. These short-cuts makes it very convenient to start “mspdebug” and “msp430-gdb”. The ability of developing and debugging using the EZ430-F2013 directly from Eclipse greatly reduces the development cycle of an image targeted for the MSP430.

Use EZ430-F2013 in Ubuntu

This note explains how to install the command-line tools in Ubuntu to compile, load and run images destined for the Texas Instrument EZ430-F2013.

The TI EZ430-F2013 is a USB development environment for small dongles that host a TI MSP430 micro-controller (MSP430-F2012 and MSP430-F2013).

This note relates to:

Install Packages

The packages required to work with the MSP430 are available from the main repositories.

Verify Drivers for EZ430-F2013

Insert the EZ430-F2013 in a USB port. Then, run “dmesg” to verify that it was detected correctly:

The output should end with a set of lines that looks as follows:

The report from “dmesg” shows that the development kit was mounted to /dev/ttyUSB0. For the remainder of the note, this value is assumed. However, you might need to adjust this value to fit your particular installation.

Writing a program for MSP430-F2013

Create a new source file.

Paste the following code:

The code above drives the LED found on the MSP430-F2013 to emit “SOS” in Morse code. A number of definitions are already declared in the file “msp430f2013.h”. Many header files relating to the MSP430 can be found in the directory /usr/msp430/include.

Compiling and Linking Program

Compiling and linking programs/images for the MSP430 is done by using “msp430-gcc”, which is a version of “gcc” that targets the MSP430 micro-controller. Most options available for “gcc” are also available for “msp430-gcc”.

Compiling using “msp430-gcc” yields object files, as with “gcc”. However, invoking the linker produces *.elf files, which can be loaded on the MSP430-F2013 via the development kit (EZ430-F2013).

Following the example started above, the two lines required to produce an object file from the source code, and then link into an image:


A command line utility called “mspdebug” is used to perform most operations that involves the EZ430-F2013 development kit.

First, insert the EZ430-F2013 in a USB port and verify that it is mounted to /dev/ttyUSB0 (see steps above).

When invoking “mspdebug”, one must specify the device that the EZ430-F2013 is mounted as.

This command opens a shell where a number of commands can be sent to the development kit. To leave the shell, press CTRL-D.

Loading Image on MSP430-F2013

Loading an image on an instance of MSP430-F2013 via the development kit is accomplished by using “mspdebug”:


  • <device> refers to the device file name where the USB development kit is mounted
  • <elf-file> refers to the ELF file produce by the msp430-gcc linker

Following the example above:

Debugging MSP430

Via the EZ430-F2013, one can debug the program loaded in the MSP430, including single-step execution, via the “gdb” debugger provided by the MSP430 packages. The command-line utility “msp430-gdb” is similar to “gdb” but designed for the MSP430 micro-controller. However, “mspdebug” is needed to bridge “msp430-gdb” to the MSP430 via the EZ430-F2013 development kit.

The command “gdb” within the shell provided by “mspdebug” start a server that listens to commands from “msp430-gdb” and forwards them to the EZ430-F2013 development kit. When “msp430-gdb” connects to “mspdebug”, it provides a shell similar to the one provided by “gdb”.

The command required to start the server is:

In a different terminal, attach the debugger with the following command:

The commands available in “gdb” are also available in “msp430-gdb”:

  • To execute program: continue
  • To stop program: CTRL-C
  • To list stack variables: info locals
  • To list global variables: info variables

To continue the example started above:

Debug using X Debugger: ddd

If X is available, one can use “ddd”, which is a GUI application to simplify the use of gdb.

To use “msp430-gdb” via “ddd”, one must first start “mspdebug” and then invoke “ddd” by specifying “msp430-gdb”. To continue the example in this note:


Using the TI EZ430-F2013 development kit with an Ubuntu platform is a snap since all the tools required are readily available in the main repositories. Furthermore, anyone familiar with gcc and gdb can easily transition to the line of tools designed for the MSP430 since the commands and options are almost the same.