Wednesday, February 24th, 2010
Hg Init: a Mercurial tutorial by Joel Spolsky is awesome. Consise, funny, clear, and true. Plus the domain name is perfect.
Wednesday, February 24th, 2010
Hg Init: a Mercurial tutorial by Joel Spolsky is awesome. Consise, funny, clear, and true. Plus the domain name is perfect.
Wednesday, February 24th, 2010
dive into mark asks his wife to let him replace his car with nothing. Hilarious, yet interesting how hard it can be to simplify.
Tuesday, February 23rd, 2010
Software Carpentry’s tag line is “Basic software development practices for scientists and engineers.” Definitely worthwhile — although I’d recommend hg or git over subversion.
Tuesday, February 23rd, 2010
Best Explanation of Git and Mercurial’s Similarities
Mercurial for Git users answered many of my questions on the nuances of Mercurial. The branch model, bare repositories, and command equivalence table were especially helpful for someone like myself who has used both systems but never fully understood the distinctions.
Tuesday, February 2nd, 2010
Homebrew: a retake on Fink and MacPorts
The Homebrew Mac OS X package manager sounds like it might be worth a try.
Saturday, January 23rd, 2010
Trying to clear out my inbox today … so here’s a variety of interesting links I’ve seen in the last few months.
Python Debugging Techniques (code.interact(), logging, pdb)
Guide to Branching in Mercurial
Arduino Small Prototyping Board
mlabwrap Python to Matlab Bridge
eCircuit Center (former Varian guy’s EE circuit learning site)
Saturday, January 23rd, 2010
While experimenting with /etc/sshd_config settings on Snow Leopard (10.6), I had disabled PAM (by setting UsePAM no). This had an unintended side effect of making launchctl behave poorly for periodic tasks I run from the ~/Library/LaunchAgents folder. I turned PAM back on (set UsePAM yes) and all was happy.
launchd must use the Pluggable Authentication Module interface as part of the mechanism that allows user agents to run.
If you see something like the following error message when trying to run launchctl commands, you may also have this problem:
Bug: launchctl.c:2325 (23930):13: (dbfd = open
(g_job_overrides_db_path, O_RDONLY | O_EXLOCK | O_CREAT,
S_IRUSR | S_IWUSR)) != -1
launch_msg(): Socket is not connected
Thanks to these threads for getting me thinking along this solution path.
Saturday, January 23rd, 2010
I came across Google’s Python Style Guide and enjoyed it. It mentioned pychecker which is a nice static analysis tool for helping to find bugs in Python code.
Saturday, January 23rd, 2010
grin: Easy Search of Directorys Full of Source Code
I am loving the grin tool. It’s like a find/grep mashup with good defaults. In human-speak, that means you can easily search source code on the command line with a short command.
Just go pip install grin it already (or easy_install grin if you’re old school).
Saturday, January 23rd, 2010
Index Source Code with Spotlight
I was frustrated that Spotlight wasn’t indexing any of my source code. What’s the point of Great, instant, system-wide search that doesn’t look in files I care about most? What’s going on?
Thanks to the article Terminal commands for improving Spotlight on Mac OS X Tips (which, by the way is a nice tips site I never knew about) for showing me the way.
The method I used was to edit the info.plist file in RichText.mdimporter (found in /System/Library/Spotlight/), adding <string>public.python-script</string>. Then, I told Spotlight to re-index the RichText file format via:
mdimport -r /System/Library/Spotlight/RichText.mdimporter
Saturday, January 23rd, 2010
Profiling tools are essential to understanding where to focus your attention when improving software performance. RunSnakeRun is a nice way to visualize, sort, and better understand Python profiling data.
Saturday, January 23rd, 2010
Instant Ubuntu GUIs with Quickly
I like the idea of Quickly: make easy one-line commands for creating, editing, designing, running, packaging, and releasing Ubuntu GUI projects. Ars’s overview captures the gist of it well.
Sunday, January 10th, 2010
I’d like to congratulate my sister, Jessica, on winning Best of Show in the Madden Arts Center Art Show. Read all about it in the Herald and Review. Well done, sis!
Sunday, January 10th, 2010
Is Microsoft Security Essentials Good?
Is the free anti-virus tool now available directly from Microsoft any good? Any one out there used it? Ars Technica reviewed it positively. When I need to run Windows, I’ve never loved Norton or the free AVG. I have been using ESET NOD32 lately and it is ok. But next time I set up a Windows machine, I think I’ll give Microsoft Security Essentials a try.
Saturday, January 9th, 2010
Mercurial is a great version control tool. I like it for the following reasons:
hg is the shortest and easiest name to type on the command line compared to the only credible competitors: git, svn, bzr … it doesn’t get any better than 2 adjacent letters on the home row!Saturday, January 9th, 2010
TortoiseHg Usage Introduction (Mercurial on Windows)
I wanted to share a quick introduction to using a Mercurial repository on Windows with TortoiseHg. This assumes someone has already setup the repository on a shared network drive (we’ll call \\Shared\Repo\Project44) and you want to keep up do date with the changes directly in Windows Explorer.
\\Shared\Repo\Project44 in “Source Path”.A couple of good things to read to get started with Mercurial are:
Saturday, January 9th, 2010
Mercurial Command Line Quick Reference
There are two main ways I’ve been using Mercurial over the last couple years: on the command line and via tortoisehg (right-click) on Windows. This is a quick reference to the command-line interface. Mercurial on the command line is called “hg” (a reference to the element Mercury).
>> hg % lists basic commands
>> hg help % lists all commands
>> hg help pull % gives detailed help on command "hg pull"
>> hg status % tell which files have been modified
>> hg st % same as hg status (you can abbrevitate
% non-ambiguous commands)
>> hg log -l 5 % log of last 5 commits
>> hg diff % current changes to your working directory
>> hg diff -c 9 % changes made by revision 9
>> hg commit -m "change 1" % regular commit
>> hg add new.c % tell hg to start tracking a file
>> hg ci -m "change 2" % "ci" is short for commit (legacy)
>> hg rename new.c blue.c % rename a file (like copy + remove)
>> hg revert ---all % oops, I didn't want to rename
>> !del blue.c % del manually (stop tracking blue.c)
>> hg mv new.c red.c % "mv" is short for rename
>> hg ci -A -m "change 3" % "-A" adds/del's files, avoids
% the "hg add, hg remove" dance
>> hg pull % grab any new changes from default repo
>> hg update % update your working directory with the changes
>> hg merge % merge new code with your code
>> hg ci -m "merge" % commit merge result
>> hg fetch % short for "hg pull, hg update, hg merge, hg ci"
>> hg push % send your changes to the default repo
>> hg heads % list the potential heads that could be merged
>> hg merge % auto-merge (specify rev with -r if >2 heads)
>> hg resolve % if auto-merge failed, retry after manual edits
>> hg init % make a new repo in the current dir
>> hg clone C:\Repo % clone the repo to work on a branch/idea
>> hg view % launches a graphical history viewer
>> hg paths % where this repo pushes and pulls from
>> hg rollback % undo the last commit (only OK if not pushed)
>> hg shelve % stash work-in-progress to fix something else
>> hg unshelve % resume your work-in-progress
>> hg rebase % move a set of commits to a new baseline
>> hg tip -p % show latest committed changes
Hope this helps. Please send me ideas for other commands that you like to use often.
Saturday, January 9th, 2010
lxml.objectify == Best Python XML API
I’ve used a couple different XML parsing libraries in the past, but have always had a desire for XML to behave just like an object where accessing attributes maps directly to accessing XML children. Who would have known it — the lxml library, one of the fastest XML processors offers exactly this API, calling it lxml.objectify. I can’t wait to try it …
Saturday, January 9th, 2010
Generate Microsoft Word 2007/2008 docx Files from Python Code
In some situations, it would be nice to be able to spit out an automated report as a Word document. Mike Maccana has come up with a new tool for doing just that and shared the code on github as project python-docx. I like it.
Sunday, September 27th, 2009
Updating NumPy, SciPy, and Matplotlib
I recently upgraded to NumPy to 1.4.0.dev7419, SciPy to 0.8.0.dev5953, and matplotlib version 0.99.1.1.
svn co http://svn.scipy.org/svn/numpy/trunk numpy
cd numpy
python setup.py build
python setup.py install
cd ..
svn co http://svn.scipy.org/svn/scipy/trunk scipy
cd scipy
python setup.py build
python setup.py install
cd ..
python
>>> import numpy
>>> numpy.__version__ # '1.4.0.dev7419'
>>> numpy.test('1','10') # 26 errors in 2231 tests, but usable
>>> import scipy
>>> scipy.__version__ # '0.8.0.dev5953'
>>> scipy.test('1','10') # 165 errors in 4515 tests, but usable
rm -rf /Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib*
wget http://sourceforge.net/projects/matplotlib/files/matplotlib/matplotlib-0.99.1/matplotlib-0.99.1.1.tar.gz/download
open matplotlib-0.99.1.1.tar.gz
cd matplotlib-0.99.1.1
python setup.py build
python setup.py install
cd ..
ipython -pylab
>>> plot([1,2,3])
Monday, July 13th, 2009
I just found out that Python 2.5 or newer allows relative imports, something I had been writing custom code to work around. Python documentation gives examples in 3 forms:
from . import echo
from .. import formats
from ..filters import equalizer
Alex Clemesha explains modern python hacker tools virtualenv, Fabric, and pip. I find all three of them intersting.
pip is an alternative to easy_install where you can install and upgrade python packages easily with commands like:
pip install -U ipython
Fabric facilitates deploying code to a remote location.
virtualenv lets you setup and manage working environments that aren’t littered with everything you ever installed into your global site-packages directory.
I also recommend virtualenvwrapper, which puts a nice interface on top of virtualenv.