Thursday, March 26, 2015

Tip of the day

Todays tip of the day is a windows tip.
If you shift right click on a folder the context menu will show 'open command window here' which opens a command prompt with the directory set to the path of the folder that was right clicked on.

Saturday, March 21, 2015

The times are a changin.

Its easy to get stuck in a rut as a programmer which is not a good place to be when technology is evolving so quickly. For web app development my stack has been predominantly cherrypy, mako templates, jquery ui, and jtable. This has given me a lean fast simple stack for tackling simple database applications. But this approach is getting kind of tired and I have been wanting to branch in to phone app development and have been looking at Polymer and Apache Cordova/Phone Gap. Polymer seems to be trending to overtake Angular.js and produces interfaces that look beautiful on the desktop and mobile devices. Cordova seems like the best ways to get browser based apps on to Android and iOS devices. It appears taking this route will mean I have to set sail and leave the comfortable waters of the Python ecosystem, the Py4A project is a contender but not a strong one compared to a Cordova /Polymer stack and there is no sense in not using the most powerful and easy to learn tool available to me.

Saturday, March 14, 2015

The invaluable tmux command.

tmux - Is a command that most linux vets especially those that work on remote servers probably know about, but somehow is one that I had missed. The thing that makes the command invaluable is that it allows you to run multiple command prompts from one ssh connection and then return to those prompts after you disconnect or worse when a connection drops. tmux is a pretty deep tool with panes, windows, and sessions allowing you to juggle command prompts in a myriad of ways but for a minimally viable, hit the ground running way of using the command all one need use is sessions. Using sessions you can spawn command prompts name them, delete them, switch between them and return to them whenever.
To start tmux with an initial session just type tmux and hit enter.
The way I typically start tmux is by typing tmux a which starts tmux with the last session used visible.
The tmux commands that I find essential to my workflow are:
  • Ctrl + b, s (to select a session)
  • Ctrl + b, :new (to create a new session)
  • Ctrl + b, $ (to rename the current session)
  • Ctrl + b, :kill-session to delete the current session and exit 
  • Ctrl + b, [ scroll mode (navigate with arrow keys, pgup, pgdn)
  • Ctrl + b, q to exit scroll mode

Thursday, March 12, 2015

Code Journal

I am working on a website that is deployed on many VPSs hosted in different datacenters and updated through a CSV file stored on a customers Google drive account. So I start to flesh out the code that is going to monitor the CSV for changes and retrieve it and figure a good place to start is with the google api docs and install using pip as advised but find that the google-api-python-client is erroring out in python 3.3. So I bang my head against the desk for a while googling, searching stack overflow, and in final desperation consider just using the REST API with out a library to help but before I go that route that I figure I should go to where ever the code is hosted and check the issues and post a new one if need be. So I go to google code only to be directed to a github repository. (Has google code been abandoned? Its future doesn't seem bright when even google projects are moving off of it.) I read to the bottom of the issue regarding python 3 compatibility and it appears to be resolved. I download the zip file from github unzip it and run python setup.py install try running the sample code in the google drive api quick start and success everything runs without error. 

The take away is that when you run into issues with libs from PyPi try going to the source first and build and install the latest version it is likely to prevent frustration and save time.