Shared State

Jeff McGee's Blog of Messages Worth Passing
  • Connecting to PostgreSQL in Python with PyOdbc in Mac OS X Yosemite

    Posted on Sat 21 March 2015 in Tips

    I spent an embarassing amount of time on this, so I thought I would document it.

    brew install postgresql unixodbc psqlodbc
    

    Start up postgres:

    postgres -D /usr/local/var/postgres
    

    Check that you can connect to the database:

    psql
    

    Inside postgres, create a user with a password. You probably need …

  • Marking a Vertica Node as Ephemeral

    Posted on Thu 13 November 2014 in Tips

    First you will need to know the name of the node:

    select * from nodes;
    

    Then mark it as ephemeral:

    alter node v_demo_node0001 is ephemeral;
    
  • Using a Vim Clutch

    Posted on Wed 18 December 2013 in Tips

    I've wanted to try a Vim Clutch for a few years now, but once I got it set up, it turned out to be disapointing.

    A Vim Clutch is a foot pedal that toggles between insert mode and normal mode. I set my clutch up a bit differently than the …

  • Finding Local Political Conversations on Twitter

    Posted on Wed 22 May 2013 in Projects

    I think it would be cool to find local crowds of people discussing a topic online. What are people in Brazos county saying about Obama? Who in my town is having interesting philosophical discussions? What are people in Austin saying about Starbucks?

    While working towards that goal, I did my …

  • Sharing Models Between Node and the Browser

    Posted on Fri 03 May 2013 in General

    Imagine you're building a web app in Django, and you want the user to enter a number between 1 and 100 on a web form. Where do you put the code to check that the number is between 1 and 100? If you want a slick user interface, you have …

  • Picking MVC Frameworks in Javascript

    Posted on Thu 02 May 2013 in General

    Lately, I've been looking into using Javascript for both client and server-side web development. Starting a project in Node.js today feels a lot like reading a Choose-Your-Own-Adventure book—every few minutes you have to choose between a few options, and it's not obvious which one is the optimal. Javascript …

  • Problems with prefetch in python requests

    Posted on Thu 11 April 2013 in Tips

    Requests is a great library for making HTTP requests. We're using it quite a bit in Infolab to talk to Twitter. Right before they released version 1.0, Requests made a slight change to its streaming API, so the old code results in this error message:

    Traceback (most recent call …
  • The History of One Line in Underscore.js

    Posted on Sat 23 March 2013 in General

    Programmers often read through code one function at a time or trace through a program following the path of execution. Today, I'm going to look at a program in a different way: I'm going to look at how one line changed over time. The line I'm going to look at …

  • FriendlyLocation

    Posted on Thu 21 March 2013 in Projects

    FriendlyLocation is a system for predicting the location of users on Twitter. It was the topic of my masters thesis, and I am currently converting the thesis into a paper for publication.

  • VineMap

    Posted on Thu 21 March 2013 in Projects

    VineMap is a quick project I did a few days after Vine launched. I use Twitter's streaming API to listen for links to Vines. I then geocode the location field from the Twitter's user profile. (I'm throwing away vines posted by users without understandable locations.) I put the tweets in …

  • IPython with PyLab Breaks Built-ins like any() and all()

    Posted on Wed 23 January 2013 in Tips

    Ipython's PyLab breaks some uses of any(), all(), and possibly other built-in functions. Here's a normal IPython shell:

    >ipython
    In [1]: all([x for x in [0,1,2]])
    Out[1]: False
    
    In [2]: all(x for x in [0,1,2])
    Out[2]: False
    
    In [3]: all
    Out[3 …
  • Using Git and Unittesting in a CS Course

    Posted on Sat 15 December 2012 in General

    I was the TA for Texas A&M's Information Retrieval class in 2012. We took some interesting directions with the homework assignments, so I'd like to spend some time talking about the experience for the benefit of other educators. The professor, Dr. Caverlee wanted to change the existing set of …

  • Running Screen in a Sudo Session

    Posted on Sat 07 July 2012 in Tips

    If you use sudo su to become a different user, and then try to create a screen session for the new user, it gives this error message:

    Cannot open your terminal '/dev/pts/1' - please check.
    

    The problem is that your original user still owns the pseudo terminal. The best …

  • Create a Python Breakpoint in Vim

    Posted on Thu 18 August 2011 in Tips

    Pdb is Python's built-in debugger. To make it easier to start pdb, I added this line to my .vimrc:

    noremap <D-d> Oimport pdb; pdb.set_trace()<Esc>:w<Return>
    

    When I type Command-d in normal mode, vim will insert the line import pdb; pdb.set_trace() and save the current file …

  • GWJeroo

    Posted on Mon 15 September 2008 in Projects

    GWJeroo is a library that lets students run Jeroo programs in GridWorld. GWJeroo is intended for students in Pre-AP and AP classes who are transitioning from Jeroo to Java.

    I developed this in 2007 when I was a high school computer science teacher. I no longer teach, so I don't …

  • Fitz Window Decoration for KDE 3

    Posted on Wed 13 June 2007 in Projects

    Fitz is a window decoration for KDE that allows you to work (or play) faster.

    Unlike other decorations, Fitz does not have a titlebar above the window; instead, it puts the buttons on the top right corner of the window in the menubar. As a result, when a window is …

  • Texan Flying Jacob

    Posted on Fri 01 June 2007 in Food

    Ingredients

    3 chicken breasts 3 slices fried bacon 1 cup whipping cream 1⁄4 cup tabasco chipotle sauce 3 bananas 1 T cummin 1⁄2 cup peanuts 1 cup cooked rice

    Instructions

    1. Marinate the chicken breasts in Tabasco Chipotle sauce and grill them. Fry bacon and break it into bits …
my photo

Jeff McGee — builder, problem solver, teacher, and general nerd.

Github:
@JeffAMcGee
Twitter:
@JeffAMcGee
Email:
jeffamcgee AT gmail