Debugging in python

3 months, 3 weeks ago
[ Geek ]

If you’re a tech caveman like myself then you may not have a loving relationship with IDE’s in general. Hang on, now that I think about it, I grew up with IDE’s and I’ve tried, and spent a lot of my career in, most of them. This isn’t a case of not wanting to use the kid’s fancy new tools. Ok, stopping tangent…

When I lived in the java enterprise world, I was a heavy jdb user. Yes, even in a java shop I was in the minority in using a “simple command-line debugger”. Sorry but I’m a simple guy.

Lucky for me, python has pdb which “defines an interactive source code debugger for Python programs. It supports setting (conditional) breakpoints and single stepping at the source line level, inspection of stack frames, source code listing, and evaluation of arbitrary Python code in the context of any stack frame. It also supports post-mortem debugging and can be called under program control.”

I don’t know for certain, however, if pdb is like jdb then this is the module that any python IDE is using to offer you debugging capabilities. They build their gui on top of this module and expose pretty pictures and some subset of pdb to you. That’s another reason I prefer to use, and understand, things like jdb and pdb instead of relying on an IDE’s rendition.

If you have any interest, there are the ugly details and a gentle introduction.

VI Love

4 months ago
[ Geek ]

I’m embarrased to say I didn’t know about shift-k in vi and stumbled upon it with a caps-lock incident. Yes, I am admitting this in public. I didn’t say I was good at this computer crap.

Now I don’t know how I survived without it. Not only will it hook you directly into man pages, it takes file context into place. So shift-k with my cursor over “range” in a python file takes you directly to…

“Help on built-in function range in module __builtin__:

range(…)
range([start,] stop[, step]) -> list of integers………….”

To get the python docs working, you’ll need python-doc installed “sudo apt-get install python-doc” and you’ll need something like this in your .bashrc or related file…

# PYTHONDOCS
PYTHONDOCS=”/usr/share/doc/python2.5/html/”
export PYTHONDOCS

Now can someone comment and tell me how I can wire django docs into this as well??

Convenience Stores Save the Planet?

4 months ago
[ General ]

convenient.jpgWarning, there is no geek stuff in here…

I love my local convenience store. It’s a short walk from home and I can get most things I need in a pinch, including a decent dvd. Having that allows me to walk over at 9pm, grab milk, bagels, chips, and a movie. It’s run by Bea who would often say “if you can’t find something, let me know and I’ll make sure it’s here for you next time”. Up until recently I knew all the staff by name.

My lovely little store was recently sold. One of the staff told me yesterday that all staff are being let go so who really knows what the future holds for our store. What’s my point? I think we all deserve a well run convenience store within walking distance from our homes. When I think back over the years to all the times I would have had to climb into my car and drive, instead of walk, to a store further away, it blows my mind. Yes, I’m suggesting that convenience stores are an environmental issue!

Here’s my pitch. Someone, since I’m out of time, needs to start up a franchise network for convenience stores based on Great Harvest’s model. That being a solid supporting network of owners with heavily customized, local franchises. The goal being quality, walkable convenience stores that are shaped, influenced, and ‘owned’ by the communities they support and serve. Traditional cookie-cutter 7-11 franchises won’t work for this.

Oh boy, apparently my new platform is ‘convenient convenience stores for all’?

Facebook in Reality

4 months ago
[ General ]

Holy crap, I cried, I almost literally wept. Thanks Kyle for this…

Treat Community Problems Not User Symptoms

4 months ago
[ Software Development ]

Steve doesn’t have to listen to users. Mark Hurst and others say you must talk, and listen, to your customers. Do you listen to customers? Do you give them what they ask for?

Of course the answers yes and no. No you should never listen to what users are asking for, then go off and build it for them. Yes you should always listen to, and effectively solve your users problems. What’s the difference?

Almost universally, a user does not know, and therefore cannot express, their root problems and the most effective way to solve them for your community of users. They do, however, know the symptoms they’re dealing with and they may have even dreamed up a potential solution.

Think of it in terms of problems, or symptoms, and solutions. People will rarely talk to you in terms of root problems. They just don’t know their problems. People instead like to talk about symptoms and potential solutions they’ve dreamed up.

Look at doctors. You go to your doctor and say you can’t hear properly and you’re coughing a lot. He crams some hearing aids in your ears to amplify sounds and gives you some cough syrup. You die two weeks later from a nasty chest infection. No, good doctors don’t blindly treat symptoms. They instead use them as clues to find and understand their root causes. Doctors also have patients who diagnose themselves. “Doc, I’ve got the flu, I need some medX” Again, the good ones take that potential solution as a clue, ask more smart questions to learn the real problem and then treat it properly.

Technically the doctor metaphor doesn’t even apply here. In building software products, we’re practicing epidemiology more than plain old medicine. We have to look at the health of our community and solve the problems for that population not an individual. (Wow, apologies Andria for utterly trivializing what you do…)

Yes, listen to users but assume what they’re requesting is one potential solution to a real problem. Your job is to keep working, ask smart questions, practice the 5 whys, talk to more users and ultimately learn what the root problem is and solve that in the best way possible.

*args and **kwargs

4 months, 2 weeks ago
[ Geek ]

A lovely simple explanation, with examples, of how to use variable length arguments in python. Of course there’s always the ugly version as well.

Medium Format

4 months, 2 weeks ago
[ General ]

Thanks for the pic Rannie, see all mesh08 pics here. I think I look grumpier in medium format?

Early Adopters

4 months, 2 weeks ago
[ Software Development ]

Interesting read by Charles Stross that a friend sent along. In there, he briefly discusses the history of flight and transportation in general. It got me thinking about early adopters in general. Anyone involved with a software startup should be thinking, and worrying, about early adopters.

Think about the very first planes. Think about the pilots that flew them, how they used flight. Now contrast that with modern aviation. Modern airports, 747’s, red eyes, and food courts. Early adopters rarely, if ever, use technology in a way that the eventual masses will. All I’m saying is keep it mind when you’re writing those fancy features for that flock of early adopters.

Don’t Sell Me Features

4 months, 2 weeks ago
[ Software Development ]

Leah Culver from pownce was at Mesh08. Her software pownce is obviously compared to twitter in practically every conversation. As she openly admitted, it’s great for pownce. Most articles published about twitter inevitably mention pownce.

She also made a point of saying several times how much more you can do with pownce. Disclosure time, I’ve never used pownce so I’m talkin out my #s$, however, I have used twitter and I think I get the two. Here’s my take, if you’re competing with something like twitter, you will never sell me on a competing product by adding more features. The one reason I think twitter has any value at all is it’s lack of the features pownce is pimping. Not to mention twitter’s about the people using it. If twitter allowed longer posts, files, music, images, etc, I’d run for the hills.

Flip this around. I met the guys behind spreed at mesh08 (I can’t find a link, will post later). Spreed enforces speed reading and effective reading comprehension practices by only presenting a few words to you at a time. You can’t drift by looking ahead or pause and stare at one word for a minute.

What’s my point? Well let’s say spreed’s app was the first online reader ever built. At some point someone would build a competitor named sprounce. They’d listen to what users are asking for and add some features to compete. They’d give their users ‘more control’. “Let’s allow our users to see ALL the words in an article. They can then choose the speed they read and how much or little to comprehend”.

In this light, spreed is actually reducing the control their users have. Like riding a single speed bike, a lack of control can actually be a freeing experience. So while I’m on the fence about twitter as having any real use, please don’t sell me twitterPlusMore because the only thing it’s got going for it is the freedom it’s lack of features brings us all. I need more features in twitter about as much as I need more gears on my bike.

Task Software

4 months, 2 weeks ago
[ Geek ]

I’ve been using Mark Hurst’s gootodo for over a year now and I can’t imagine work life without it.

I’m not sure if Mark’s a fan of GTD but the app certainly supports it if that interests you. I think it’s keys are the ubiquitous smtp interface and it’s calculated simplicity. It’s a simple, some may say oogly, application that works.

The quick story. It’s a web-based task application with an smtp interface. That allows me to send an email to today@gootodo.com with subject “eat a good lunch from McDonalds”. Or tomorrow@gootodo.com “eat a better dinner from Harvey’s”. This allows me to easily push tasks onto my task list from any email client including my blackberry. As well I can easily forward emails, pictures taken on blackberry, links, and other digital artifacts. It nicely supports the concept of 43 folders as well as an empty inbox.

Some quick examples of how I use it….

  • Receive an email, no time to reply, must respond at some point…..Forward email to 2d@gootodo.com with subject “reply to jojo’s email”.
  • See a cool shelf I’d like to build…..Take a picture with blackberry and forward in email to tomorrow@gootodo.com with subject “print shelf picture”
  • Browse a site about an interesting conference with registration closing in April….Email site link to march15@gootodo.com with subject “decide about conference”

Oh, did I mention it’s a whooping $3 per month.