authored by Wayne Witzel III

I didn't want those changes anyway.

On March 12, 2009 In personal, sourcecontrol, deploy Permalink
I use hg (Mercurial) for version control. Since switching to hg I have adopted the following process. I also do this for my Git projects at work.
  • I create a local branch to working.
  • I setup my External Tools in Eclipse to run my test suite.
  • The output of my test suite gets committed to my local branch.
  • I squash the local branch messages when I merge in to master.
  • I add some insightful commit message for my master commit. Like, I haz changes.
So yesterday, I roll up my sleeves and prepare to dive in to an older project that smells like rotten potatoes. The plan of attack is to take this project and bring it up-to-date with Python 2.6, Pylons 0.9.7, and SQLalchemy 0.5.2 in the process of doing it, re-factor and extend where needed, of course letting the tests drive. I start my work and wand waving and 2-3 hours in I've removed about 200 lines of cruft and copy paste inheritance extended flexibility by further encapsulating some behavior using the Strategy pattern. I've got 47 tests (including functional doctests) passing and I'm green bar and happy with my time spent. So now time to merge this baby back in to master. My test suite external tool performs the hg add . and I keep my .hgignore pretty up-to-date for Python projects, so I feel confident doing that. I open up the terminal to check out the change sets and start the merge and I notice I missed a binary format in my .hgignore. So I now have about 15 unwanted files staged for adding. Being lazy and knowing my last commit was when I just ran my test suite, I blindly run. [sourcecode lang="bash"] $ ^R hg revert (Ctrl-R, hg revert - shell previous command search) $ hg revert -a --no-backup # ...my work being destroyed because I was lazy and not paying attention # whimpering [/sourcecode] It is at this point my day goes from great to awful. I face palm as I watch the uncommitted changes I've been making over the last 3 hours get reverted. As I mentioned, this project was older, in fact, it was started before the migration to hg and I never updated the External Tools runnable for this project in Eclipse to do the new hg add / commits. So every time I thought I was committing when I was running the tests, I was in fact not. Fortunate for me, I did have some buffers open and was able to recover the end result in about 45 minutes of hacking, but I did lose all of my change history which was very very disappointing (not to mention scary). So if I had any advice after this it would be ensure your older projects are up-to-date with how you do things now and they follow your current development process before you start refactoring. I guess the oneliner could be; When refactoring a project start with the tool set first.
Read and Post Comments

Holidays and New Server

On December 28, 2008 In project, personal Permalink
I've been a little behind on my posts what with the holidays here and me doing all sorts of traveling and migrating to the new server for pieceofpy.com I haven't really had time to make any new useful posts. So just taking the time to let everyone know I am not dead and wishing everyone happy holidays and a good winter. Oh and the new server is lovely. The specs are below and so far I couldn't be happier.
  • 3.2GHz P4 Core Duo2
  • 2GB Memory
  • 36GB 15k SCSI (Mirrored)
  • 500GB monthly transfer
Read and Post Comments

Another try at a blog a day?

On December 03, 2008 In personal Permalink
This month is a little calmer for me. No Iceland trip, no Thanksgiving trip, basically no nothing except work and side projects. So I figure I'll have another go at this blog a day thing, minus the 1st and 2nd of this month because I had food poisoning. November I made it deep in to the first day before my blogging stopped. Hopefully December will be better for me. Unrelated note, get the book American Lion. Excellent book about Andrew Jackson.
Read and Post Comments

Exercise even a programmer can do.

On November 05, 2008 In python, personal Permalink
So I've been exercising lately. The last visit to the Dr. was a wake up call. 300 lb .. WHAT?! So, taking an iterative approach to exercise, I've manged to work up to 6-day a week cardio routine and a 3-day a week strength training routine and have gone from just over 300 lb. to 270 lb. in a couple months. Couple friends asked how I started and what I do, so I figure I'd break it down here. I started by walking. 3 times a week for a couple weeks. Then after reading a Lifehacker post about a morning routine and matabolism, I added my very fast morning routine and actually eating breakfast to my day. Made it a whole week Monday-Friday. Then I bumped up the walking to Monday through Saturday. Did the morning routine and the walking for another week, then I bumped up the walking to targeted cardio 3 out of the 6 days and did that for another week. Added strength training 1 out of the 6 days and did that for another week. Switched from walking to cardio on all 6 days and + 1 more week. Then strength training 3 days out of the week. And slowly over about 3 months, I built up to this routine. Every morning I do this right after eating breakfast 2 sets, push-ups, 30 sec OR failure 2 sets, scissor kicks, 1 minute OR failure Monday through Saturday 2 minute warm up 20 minutes of cardio (140-160 heart rate, check with your Dr.) 2 minute cool down Strength training This adds another 20 minutes to my workout, so schedule for that Monday - Push (chest, triceps) Wednesday - Pull (bicep, shoulders) Friday - Legs (legs and stomach) Now, it is just habit. Also, I am sure there is some study somewhere to prove or disprove this, but I find it makes my mind much sharper. I am more alert through out the day and I sleep much better at night. Not to mention clothes fitting better and just feeling better. My personal goal is 250. Python tip Prefer xrange to range when you need an arbitrary number of iterations as range actually generates a list for you, this will consume memory and be more costly than xrange.
Read and Post Comments

Voting and the land of ice and snow.

On November 04, 2008 In python, personal Permalink
Today is election day in the states. Lots of free coffee and donut offers floating around for those few people wearing their I voted sticker. Tomorrow I head out for my trip to Iceland. From Florida to Iceland in the Fall, makes perfect sense right? It was an excuse for me to purchase some new warm wear and jogging shoes, have to keep up with the exercise routine even on vacation. I should be able to maintain the blog from there keeping the spirit of blog every day in November. Snippet of Python In an effort to always have something a little Python related in all my posts, here is how to use list comprehension to filter out no value items from a list. [sourcecode language="python"] foo = ["A", "", "C", None, "E"] bar = [i for i in foo if i] print bar ['A', 'C', 'E'] [/sourcecode]
Read and Post Comments
« Previous Page