May 242016
 

To revert to your previous commit in Subversion, you’ll need the current revision number and the previous revision number, then:

 

Aug 112012
 

I’ve been trying to install Mountain Lion in as a guest in Parallels 7, and I kept getting stuck at the initial grey Apple logo.

To fix it, I just changed the number of CPUs to 2, and it booted right up.  Other documents I’ve seen have indicated that you need to increase the video memory.  I did not need to do that, but it would probably help with performance.

May 252012
 

I can’t believe it’s taken me this long to learn this: Python’s default argument values are only evaluated once during runtime. I’ve never encountered this before because I don’t use default arguments very often, and when I do, it’s often to set something to a static value.

Today, I encountered a function definition where I wanted to default an argument to the current date/time:

Every time I ran the function, the value of date_time was the same: Whatever the date/time was when the method first ran. So, instead, I did something like this:

This is actually mentioned in the Python documentation.

May 252012
 

Install Visual Studio 2008 SP1 Express Edition.

Go to the command prompt.

First, I had to set the following variable:

Note the trailing backslash – that needs to be there. The value must also NOT be in quotes.

Then, from your PyCrypto directory, run:

And it should install with no problem.

May 032012
 

Because Python isn’t strongly typed, sometimes PyDev doesn’t know what type a variable is – and therefore it cannot give you accurate code completions. Here’s how to make that better.

In simpler situations, PyDev works very well. For example:

Typing ’emp.’ will get you a good autocomplete.

Now, let’s say you have something like this:

Then ’emp.’ won’t get you anything – PyDev doesn’t necessarily know what type is being returned.

If you use python’s assert method:

PyDev now knows what type the variable is, and you’ll get more effective code completions.

When running in production, you can pass the “-O” flag to the interpreter, and it will ignore the assert statements.