2015
12.15

Open

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

2015
12.10

Running rsync as a daemon

Adapted from http://www.jveweb.net/en/archives/2011/01/running-rsync-as-a-daemon.html

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

Edit

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

2015
12.03

Samba, linux and QNAP

OS: Lubuntu 14.04
NAS: QNAP TS-431

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

2014
12.02

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 studio.sh file in Android Studio’s bin directory. I added the following at the top of the script:

notification

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 http://askubuntu.com/questions/189231/where-are-the-stock-icon-names-defined-for-the-unity-panel-service-indicators-an

2014
11.13

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.

2011
06.02

Login package updates messages are incorrect

We have a couple of machines running 10.04 LTS and they have been showing messages similar to the following when you ssh to them.

11 packages can be updated.
7 updates are security updates.

And yet, when you do an update, there is nothing to update. There was a bug that caused the package update information to be incorrectly dumped into /etc/motd.tail and never updated. The bug was fixed, but the incorrect /etc/motd.tail was never cleaned up. This can be fixed by removing /etc/motd.tail. The correct information will be generated when available in /var/run/motd.

Reference: http://old.nabble.com/Where-does-the-%22n-packages-can-be-upgraded%22-message-come-from-td31632514.html

2010
03.28

GWT apps using Maven and Eclipse

Used to be that getting a GWT project together using Maven and Eclipse was a tedious and frustrating task. Times have changed so that the process is quite a bit easier.

Uses:
openjdk-6-jdk
Eclipse 3.5
Google plugin for Eclipse 1.32 http://code.google.com/intl/en/eclipse/
gwt-maven-plugin 1.2 http://mojo.codehaus.org/gwt-maven-plugin/
Maven plugin for Eclipse 0.10.0 http://m2eclipse.sonatype.org/

Install the Google plugin for Eclipse into eclipse specifying the update site url http://dl.google.com/eclipse/plugin/3.5 through Eclipse’s Help->Install New Software->Add… and specify the url

If you have a previous version of the m2 plugin you will need to uninstall it as the 0.10.0 version will not upgrade properly otherwise. Install the Maven plugin.

From Eclipse, create a new Maven project:
File->New->Other->Maven->Maven Project

Do not check Create a simple project as we want to do archetype selection, but fill the rest in as you see fit then click Next.

Select either Nexus Indexer or All Catalogs as the catalog, then scroll down the list looking for a Group Id of org.codehaus.mojo with an Artifact Id of gwt-maven-plugin and choose the highest version (1.2 at this time) then click Next.

Fill in your Group Id and your Artifact Id and the rest of the fields and click Finish.

The next set of the instructions are mostly from http://code.google.com/intl/en/eclipse/docs/faq.html#gwt_with_maven.

In Eclipse, select your project then choose Project->Properties->Google->Web Toolkit and click Use Google Web Toolkit.

Then click on Web Application (Project->Properties->Google->Web Application and change the War Directory to src/main/webapp and uncheck Launch and deploy from this directory then click OK.

Open the pom.xml file under your project and check some Properties values. You want gwt-version to be 2.0.3 and maven.compiler.source and maven.compiler.source to be 1.6.

Right click on your project and select Run As->Maven Clean, then Run As->Maven Package.

Right-click your project and select Run As->Web Application. The first time you do this, you’ll have to select the location of the exploded WAR directory (by default it should be /target/).

If everything works out fine, you are now running in hosted mode. Click on the Development Mode view tab down where the Console tab is and copy and paste the URL shown there into a browser to see your app running.

GWT development/hosted mode is now running out of the WAR directory created by Maven. You can step through and debug your code as usual. If you make changes, it is sometimes possible to have your running application reflect those changes without restarting your debugging session:

  • If you change client-side code, just click Refresh in your browser.
  • To have server-side code changes reflected, your project’s build output path must be set to /target//WEB-INF/classes (Project properties > Java Build Path > Source > Default output folder). Then, when you change a server-side class click the Reload web server button in the Development Mode view.
  • If you change resource or configuration files in your WAR directory (HTML, JSP, CSS, etc.), you’ll have to terminate the launch configuration, run mvn clean package, and then launch again.
2010
02.27

SysRq and Inspiron 1720

While trying to figure out while my laptop, a Dell Inspiron 1720, has been freezing occasionally, I found out that you can use SysRq codes to communicate directly with the Linux kernel to get system operations done even while the machine is locked up. This is handy as it allows you to specify a sequence of actions to safely sync your disks prior to rebooting your computer. Then you don’t have to go through the trouble of running fsck on your filesystems.

The typical sequence that you are told to input is to hold down Alt+SysRq and then slowly type r e i s u b. This presents a slight problem on the Inspiron 1720 since the SysRq key is shared with F11. Accessing the SysRq key requires pressing the Fn key but you must not have the Fn key depressed while you type the subsequent letters or they are interpreted as something different. I have found the easiest way to perform this magical little finger dance is to use your right hand to press the right Alt key with your thumb and the SysRq with a finger. So the sequence is:

Left hand: Press and hold “Fn” key (between Ctrl and the Windows key)
Right hand: Press and hold “Alt” + “SysRq” keys (Alt+F11)
Left hand: Release “Fn” key
Left hand: Press and release “r” key. (Screenshot dialogs may start popping up. Ignore them)
Left hand: Press and release “e” key. (Your GUI should collapse to a tty, most processes terminated)
Left hand: Press and release “i” key. (Progress of key shown in the tty, most proceses killed)
Left hand: Press and release “s” key. (Progress of key shown in the tty, syncs filesystems)
Left hand: Press and release “u” key. (Progress of key shown in the tty, unmounts filesystems)
Left hand: Press and release “b” key. (Progress of key shown in the tty, starts reboot)
Right hand: Release all keys

2009
12.08

Over the past couple of days, I have seen a situation where I boot my laptop (Ubuntu Karmic) and the Network Manager applet insists that the wireless is disabled. Rebooting does not help. Examining the syslog showed that the OS found 2 kill switches and one of them was disabling the wireless. Examining the state showed that each kill switch state was affected by the single physical kill switch, but their states were the opposite of each other. So regardless of which position the kill switch is in, one of the kill switch devices would disable the wireless.

I turned the kill switch off and reboot the computer. When it came up, the kill switch drivers were now synchronized and turning the kill switch on caused the Network Manager to start looking for Wireless connections. Listing the kill switch states shows they are again synchronized.

This post at LinuxTrap shows that others are experiencing a similar condition.

2009
11.23

Wave Extension Installer

Once you have built your wave extension, you will need a way to install it into the user interface of the Google Wave client. A Wave Extension Installer is just that beast. You will need to create an Extension Manifest, which is an XML file describing where to find your extension, where you want it installed in the client UI and other information you want displayed.

We started out with the Wave Extension Installer Guide, but this document has some problems with the robot extension installer sample. Maybe its out of date, I don’t know.

The part that is in error is that there is no action element defined within the menuHook element. This is easily fixed by wrapping the participant element by the createNewWave element.

Once this was straightened out, we put together an extension manifest for our existing sample robot, Frakky.

Once you have your extension manifest set up for your extension, you need to make it Internet accessible. A reasonable place to put this is next to the index.html file for your robot, in the war directory. We named the file install.xml. Then whenever you upload your robot to Google App Engine, the extension manifest will be uploaded to http:/yourappname.appspot.com/install.xml. To be able to install this manifest in Google Wave Preview, you will need to install the Extension Installer. Yeah, its name is a little confusing but I am not sure that calling it Extension Installer Extension (which better describes its function) is any less confusing.

Once this is done, you can select the dropdown next to New Wave in the center panel and choose New Extension Installer. When you are asked for the Extension Manifest URL, be sure to specify the URL including the http:// portion or else you will end up receiving an error message that implies there is something wrong with the manifest instead of saying it just cannot find the manifest. This creates a wave with a puzzle piece from which you can install the manifest into the Google Wave client. Push the Install Extension button to hook it up.

Extension Almost Installed

Extension Almost Installed

You will notice that the attributes you specified in the extension element such as name, description and thumbnailURL are used to display the puzzle piece.

Now, if you check the muted wave, Extension Settings, your extension is listed at the bottom.

Installed Extension

Installed Extension

Since our manifest added a new item to the New Wave button, clicking the dropdown next to this gives us an entry that says “Creates a new Frakky wave.” Clicking this creates a new wave with our robot set as a participant.