Wednesday, October 31, 2012

CSS preprocessing with SASS

Don't write CSS directly.  It's just not worth it anymore.  Use SASS and precompile your CSS to avoid repetition, make changes easier, and to use the nesting features that should have been built into the spec in the first place.  The SASS website explains how to install and use it, but if you are clever enough to be using Linux you can just install it from the repositories.  Don't be put off by the Ruby connection if you are not a Ruby person...it is written in Ruby but the CSS it generates is completely independent of any backend languages.

Tuesday, October 30, 2012

Good hype-free overview of using data

I came across Lessons for a Data Driven Business the other day and found it a nice, succinct overview of the things that are important for managing data at the enterprise level.  He breaks it down into five basic points:


  • defining and communicating a “single version of the truth”
  • creating an auditability chain from your metrics to your raw data
  • establishing specific, actionable KPIs
  • ensuring around-the-clock availability of data
  • accepting the limitations of your data

This is a good roundup, and he didn't even have to use buzzwords like "cloud" or "big data" even once!

Tuesday, October 23, 2012

Command Line Arguments in Python

Reading your command line arguments in Python is incredibly easy, but I have to look it up every time.  Also, there are a thousand different ways to do it as the language has evolved through the years.  This seems to be the latest (or one of the latest) ways of doing it:

Tuesday, October 2, 2012

Spitting out CSV data in Python

Something I do frequently in python is to spit out data into a CSV file. I do it so often, I created a simple function to copy/paste in my scripts.

Sunday, September 30, 2012

Transferring files from Ubuntu to Nexus 7

When I first got my Nexus 7 tablet, I had difficulty transferring files to and from Ubuntu.  Earlier Android gizmos would allow the SD card space to be mounted as a standard USB device (and that's what I found with my Nexus S on Jelly Bean), but this tablet offers me two choices: MTP or PTP.  MTP is a standard around media devices (e.g. MP3 players) and PTP is a standard for cameras.

Friday, September 28, 2012

Moving to Blogger

I have decided to move the contents of this blog from self-hosted Drupal to Blogger. I like Drupal, but Blogger is so much easier to manage. I am, of course, losing the freedom to make alterations and customizations as I fit, but I have never done that in the several years the blog has been live. Also, I am getting a little fed up with the blog spam. I was getting multiple spam attempts every day and a few were squeaking through the antispam measures (mostly just filtering and a captcha). Blogger seems to keep that more at bay.

Sunday, February 26, 2012

Python and byte order marks


I am working with some files that have byte order marks (BOM) at the beginning. The first bytes in the file are FEFF. When I load them with the standard Python open command, the first two characters of the first line are corrupted with these two bytes before any text. There are two basic problems here, easily solved.

First, the file is encoded with UTF-8, which is unicode and not plain ASCII (though in most cases UTF-8 is directly compatible with ASCII). Whether or not this file contains any non-ASCII characters represented with multi-byte Unicode, it is more appropriate to load it encoded as UTF-8.

Second, the byte order mark is showing up as part of the data. I could just assume it is there, read the first two bytes and ignore them, but I need to let Python handle it properly so I don't have to think about it. Writing special code for the first two bytes of the first line is annoying and ugly. Note that a BOM is not required for a UTF-8 file, but many applications—particularly on Windows—include it.

Saturday, February 18, 2012

Connect to wifi at boot

Like all good nerds, I have needs for computers in several places around the house, but I have little desire to run cat5 cables all over the place to provide internet connectivity. That's what wifi is for. In most Linux distributions, though, the wifi connection is dependent on the user login and storing the keys in the users keyring. Consequently, there is no internet access via wifi until after the user logs in. With some simple configuration, though, it is possible to connect to wifi on startup and have that connection available even if the user has not yet logged in.

Friday, January 27, 2012

Deleting an item from bash history


I was pecking away commands on the bash command line and, without paying attention, I typed in my password when I thought it was needed for a command. But looking up I saw that I was not getting a password request, but was on the command line. Aside from being thankful that I do not use a valid command for a password, I was concerned that I was leaving my password in plain text in my bash history. My home directory is encrypted, so there is little chance that someone will get access to it, but I wanted to delete it nonetheless.