- 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.
I didn't want those changes anyway.
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.
(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.
Holidays and New Server
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
Another try at a blog a day?
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.
Exercise even a programmer can do.
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.
Voting and the land of ice and snow.
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]