Title photo
frugal technology, simple living and guerrilla large-appliance repair
Sun, 21 Jun 2015

I wrote my Ode Indexette time-stamp program in golang

Last year I decided to write a short script that outputted the time/date-stamp line required for Ode's Indexette add-in.

Back in 2014, I did it in Perl, Ode's "mother" language. It's really just a two-liner with a whole lot of notes:

#!/usr/bin/perl

# The purpose of this script is to generate a in Perl
# that allows automatic creation and insertion of an Indexette
# tag into an Ode blog post. The tag looks like this:
# tag : Indexette : index-date : 2014 02 17 19:30:42

# This program should produce the above output with the current
# timestamp.
#
# The next task is to get the output into your text editor
# without needing to copy/paste out of the terminal.
#
# To bring the output of this program into the Gedit text editor:
#
# 1. Make sure Gedit's Snippets plugin is installed and active
# 2. In Gedit, under Tools > Manage Snippets, create a new Snippet
# and call it as a shell command like this:
# $(1:/your/path/to/this_script)

# Here is the script:
#
    ($sec,$min,$hour,$mday,$mon,$year) = gmtime();
    printf("tag : Indexette : index-date : %04d %02d %02d %02d:%02d:%02d\n", $year+= 1900, $mon+=1, $mday, $hour, $min, $sec);
#
# Notes on the script:
# Adding 1900 to get the current year, adding 1 to get the current month

I've been playing around with lots of other languages since then. I know I should stick with one and really learn it, but for now it is what it is.

I decided to try to get the same output from the Google-created go (aka golang) programming language, and with the help of this web page, I was able to hack it together pretty quickly:

package main

 import (
    "fmt"
    "time"
 )


 func main() {

    // get the current time in UTC

     indexette_time := time.Now().UTC()

    /* print the time to standard output in the format
    required by Ode's Indexette add-in. Note that the 
    .Format parameters use an "old" date just to set 
    the format, the output will be the current time
    due to the use of time.Now() */

     fmt.Println("tag : Indexette : index-date :", indexette_time.Format("2006 01 02 15:04:05"))

}

I'm still calling the script into gedit the same way (through Snippets), and it works just as well as the Perl version.

One thing I just learned about go that's pretty cool is you can run your go program as a script, or compile it as a binary and run that. Advantages of a binary are that it's portable -- anybody with a system for which the binary is built can run it without needing to install go on their own system. And the binary should run faster than the script, though this is admittedly not an issue for three lines of code.

But it's cool anyway.

In the case of this script, I named it ode_time. Through experimentation, I figured out that the go build program that makes the binaries takes their name from the directory containing the file. So since I wanted the go binary to have the same name as the file, I gave the directory the same name, too:

My script file is here (I'm leaving out most of the path, but suffice it to say this is the place where I keep my program files):

/golang_code/ode_time/ode_time.go

I run the uncompiled script this way while in the /ode_time directory:

$ go run ode_time.go

I get this output:

tag : Indexette : index-date : 2015 06 21 00:52:23

Perfect!

I wanted to make a binary just because.

Here's how I did it. I am working in the /ode_time directory that contains ode_time.go:

$ go build ode_time.go

Now the directory contains two files:

ode_time ode_time.go

The first is the binary (which was automatically made executable by the go build command), and the second is the "raw" go script.

So I can now run the binary from my console like I'd run any binary that isn't in my path:

$ ./ode_time

And I get the same output.

tag : Indexette : index-date : 2015 06 21 00:55:04

The takeaway: I wanted to write a go program, and with the help of the Internet (and people who actually know how to do these things), I did it. And it was a program that I use on a daily basis -- whenever I write a blog post for my Ode system.

I like the idea of go, which is the language used by the Hugo static blogging system. The documentation seemed OK, but I did have to go "off the reservation" to find an example that I could work off of.

I'll clearly have to seek out tutorials and books if I want to pursue programming with go. Fortunately there are a few go books about to be released, and that might help me figure it out.

Sat, 06 Jun 2015

I love the design of wit.io

I stumbled across the wit.io blog. The layout is nice, but it's the typography I love.

Here's an entry: Clojure: All grown up

The font, the sizes, the colors of the type and the background. I like it.

Font color is #666

The background color is #e9e9e9

From the CSS:

font-family: "Gentium Book Basic",Vollkorn,Baskerville,"Hoefler Text";

The Vollkorn font is drawn in from Google:

@import url(http://fonts.googleapis.com/css?family=Vollkorn:400italic,400,700&subset=latin);

Nice!

Sat, 30 May 2015

Getting rid of workspaces in GNOME 3

It's not that I don't like virtual desktops (aka workspaces) in Linux.

On the contrary, I love them.

But when I'm using the horrible Citrix-delivered applications my company provides, switching to another workspace (or virtual desktop) causes those apps to lose their connection to the server.

So I have to be disciplined in order not to switch to another workspace.

In Xfce I removed the desktop pager from my panel.

And just now in GNOME 3, I was searching for an Extension that would do this for me. I found an out-of-date Extension that included a very good workaround in the comments:

This extension didn't work for me on Fedora 20/GNOME 3.10. Instead I used GNOME Tweak Tool and set the 'Workspace Creation'=Static and only 'Number of Workspaces'=1.

I already have GNOME Tweak Tool, since you really can't run GNOME 3 (successfully anyway) without it. I went into the Workspaces portion of the utility and made the changes.

Now my Workspaces are gone, as is the ability to even go to them with ctrl-alt up/down-arrow, and I should be safer than ever to use GNOME Shell for my Citrix work ... unless minimizing apps, or switching between them, kills the connection.

Update: Switching between applications, including my Citrix-delivered ones, and minimizing them with the Super (aka Windows) key or mousing into the hot corner does NOT cause the Citrix apps to lose their connection to the server.

So we can call this a win. I'll know for sure when I try to do a full day of production in GNOME 3 on Monday.

Tue, 26 May 2015

Gear review: The iRig 2 guitar interface to iPhone, iPod Touch and iPad

The iRig 2 guitar interface

Here's my short and not so sweet review of [IK Multimedia's iRig 2] guitar interface to the iPhone, iPod Touch, iPad and some Samsung Android devices.

The iRig 2 was floating around the office, and I figured that I'm a guitar player, I've always been interested in headphone-amp type solutions, and maybe this would enable me to play an electric guitar, with the aid of my iPod Touch 5th Generation, and leave amplifiers behind.

Here's the challenge: I play jazz mostly. I don't like distortion. Jazz guitar for the most part requires a lot of headroom but no distortion.

Can the iRig 2 handle it?

First of all, the iRig 2 is an inexpensive device. It's something like $39. That's cheap. So how much can you expect from it? How good is the onboard preamp?

Read the rest of this post

Dodgy Windows 8 leads to me running Citrix on Fedora Linux

I wasn't even going to write about how I used to run Citrix on Windows 8 instead of Linux on my HP laptop because my particular Citrix-delivered application reacted poorly to the horrible DSL Extreme broadband service at home and its frequent (every three minutes or so) total dropouts. Maddeningly, the crucial link to "reconnect" to my application was present the Firefox and Chrome web browsers under Windows but absent in those same browsers under Linux.

No, I was instead going to write about how to configure Citrix in Linux to allow you to access local drives via your Citrix apps. I'd like to thank the Ubuntu community for that very helpful portion of an overall Citrix-on-Linux page that has helped me many times.

But since I'm already going this road, here is how and why I decided to do my Citrix-based production work in Fedora Linux instead of Windows 8.

Initially I thought I "had" to use Windows for the ungainly Citrix-delivered apps that my employer requires, including Adobe InCopy (which I wouldn't wish on anybody) and a proprietary CMS from Hell. That was when I was having Internet issues at home and kept getting disconnected from my Citrix apps.

But since then I've "solved" my broadband issue, and the connection is slow yet consistent (as opposed to slightly faster but extremely inconsistent; thanks DSL Extreme, who I'm dropping as soon as my contract ends).

So once I had "consistent" broadband, I thought I was home free. I could run my Citrix apps under Windows 8 (the 8.1 upgrade fails for me every time, probably because I dual-boot Fedora, and an encrypted Fedora at that) and all would be well.

Except that Win 8 started crashing. Yeah, I'm stressing the #$%& out of it, but that's how I work.

Read the rest of this post