Creating a Better Print Screen

How I created a print screen command that automatically uploaded a screenshot to Google's free Picasa Image Hosting Service.

Working on an Issue from the Drupal Issue Queue

How to set up a development environment with git for working on issues in the Drupal Issue Queue.

honey badger picture and git logo from wikipedia cc-share-alike

Git Log to the Rescue

A summary of the different options for viewing a project's commit history with git log.

Vim Tip: yanking or deleting a big chunk of text

Using Vim to separate database sections in a Large Database Dump.

Election Badge Experiment

I've been experimenting with codepen a lot lately. There is something so cool about experimenting with some tricky javascript and sending a link to a code sandbox somewhere to someone and they fork it and say, "here's the fix". Or they take the idea a step further and say, "and what about this?"

Well, below is a ballot feature that I'd like to replicate with Drupal's webform module. (well except for the tricksy voting feature.)

See the Pen Election Badge Experiment by Bart Lantz (@majorursa) on CodePen.

Adding a Group By clause to a View

These are some quick notes on how I added a group by clause to a query for a view in Drupal 7.

I have a custom database in a module that I wrote and one of the fields in it: video_id corresponds to a node nid. So I wanted to pull this database into a view. However there can be many rows in my database for each node and all I wanted for the view was to print one message Update answer key if there was one or more entries in the database and a different message Create answer key if there were no entries.

Drupal Rules Notes

These are notes for some of the trickier situations for writing Rules.

Trigger Rule when a Node field has changed

In order to get the node-unchanged selector, the only event must be "Before Saving Content".

Tags: 

A Drupal-centric Vim Configuration

My .vimrc

In this post I'll describe my .vimrc, my vim configuration file. An important thing to keep in mind is that Vim has a handy built in help system. If there is any command that is unfamiliar to you, then you can look it up in a vim session by typing :help <command> and vim will pop open a buffer with the documentation for that command.

I generally use vim while in a ssh session on a dev server and this vimrc works well for that.

Fun with grep and bash aliases

Just a quick post to write up an bash alias I just created to list the sites enabled on a server and each sites location.

I often need to look up the list of sites enabled on a web server and also the document roots of each of these sites. In the past this meant loading the Apache configuration file into emacs or vim and searching for the site I was looking for. Today I decided to create an alias for this task. Here is the original combination of grep commands.

Tags: 

Creating a Better Print Screen

After reading Randall Degges excellent post How I learned to Program, I decided to give creating a screenshot program a try. It's always a bit of work to take a screenshot, upload it to the web and then grab its permanent link. So being a geek, I thought it high time this process was automated!

I tried writing the program in python only, so that there were fewer dependencies, but using the commandline program scrot as the screenshot snapping program added a lot of flexibility to the options for the screenshot.

Without further ado, here are the parts of the program.

Using Jekyll on NearlyFreeSpeech.net

NearlyFreeSpeech.net is a good simple, bare-bones fit for a Jekyll site once everything is set up. The price can't be beat, you can put down a $10 payment and just try it out. With a Jekyll site, that $10 investment should last a while!

Set Up SSH Alias

The first thing to do is set up an ssh alias in your .bashrc file. The hostname and username that are assigned at nfsn are generally pretty easy to forget, so I always create an alias for them, like:

alias sshnfsn='username_sitename@ssh.yourhostname.nearlyfreespeech.net';

Once you save the .bashrc file, you can source it with:

Tags: 

SAS to R Notes

How I did part of a SAS assignment in R

The residual plot in SAS was corrupted, luckily I was able to recreate it in R. (And actually it looks better in R too.)

Using Vim for Tricky Regular Expressions

So, I was trying to convert an orgmode file to html. There is an orgmode-export-as-html function, but it was choking on something, so I needed to do the conversion by hand. I tried many, many times to convert the file with emacs regular expressions, but was unsuccessful. The difficulty was the orgmode headlines, which look like this:

*** Use the sort function

I wanted to simply transform this into

<h3>Use the sort function</h3>

Vim Regexp

I was finally able to match the headline in vim with the following regular expression:

Tags: 

SAS Notes

SAS code in Emacs

The Data Step

Subsetting IF

In a Data Step you can exclude some observations from the dataset with an if statement.


data tornados_1980s;
  infile FileName;
  input year city damages;
  * this limits input data to 1980s data;
  if 1980 

  • IF .. IN statement
    if year in (1980, 1981, 1982);
    
  • AND, OR
    
    if year = '1980' and city = 'Baltimore';
    

    infile 'filename'

    In the data step, import data from a file with the infile command.