
> python
Python 2.5.1 (r251:54863, Jan 10 2008, 17:45:16)
[GCC 4.2.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import this
The Zen of Python, by Tim Peters
Beautiful is better than ugly.
Explicit is better than implicit.
Simple is better than complex.
Complex is better than complicated.
Flat is better than nested.
Sparse is better than dense.
Readability counts.
Special cases aren't special enough to break the rules.
Although practicality beats purity.
Errors should never pass silently.
Unless explicitly silenced.
In the face of ambiguity, refuse the temptation to guess.
There should be one-- and preferably only one --obvious way to do it.
Although that way may not be obvious at first unless you're Dutch.
Now is better than never.
Although never is often better than *right* now.
If the implementation is hard to explain, it's a bad idea.
If the implementation is easy to explain, it may be a good idea.
Namespaces are one honking great idea -- let's do more of those!
Related Posts
Tags: python
Posted in programming on February 19th, 2008 |
No Comments »
Here is a list of the most popular programming languages, in order of popularity. One column shows the popularity as of January 2008, and another shows the popularity in January 2007 for comparison. Python moved up, Perl is dying. I was surprised that some languages are as popular as the index shows.
According to the site:
The index can be used to check whether your programming skills are still up to date or to make a strategic decision about what programming language should be adopted when starting to build a new software system.
Related Posts
Tags: language • perl • programming • python
Posted in programming on January 21st, 2008 |
No Comments »
I’m constantly finding myself in need of small, quick, personal database programs. Something light and flexible. Quick to mock up, quick to write, easy to use, painless to dump. And I find myself wanting and writing the same kinds of applications again and again.
Sometimes a text file just isn’t enough. And writing redundant SQL queries can get tiresome. Perhaps I need to print nicely-formatted reports. Perhaps I need some web connectivity for retrieving remote information. Or, what if I want to give this program to someone else to run? How many people know how to do database administration? The data needs to be conveniently stored in one place for the easiest possible backups.
What I really need is a framework. A cross-platform framework that will allow me to create these types of applications in a heartbeat. I should even be looking forward to the two minutes it would take to copy a template project and build a whole new application and have it up and running in minutes. Any changes I want to make to the data model should be immediately reflected everywhere with no extra work. But if I want something powerful, I want the framework to be flexible enough to let me get in and make it so.
Interested? Here’s my solution… » Read the rest of this entry
Related Posts
Tags: cheetah • cherrypy • css • fltk • git • javascript • mysql • openoffice • python • resizable • sqlite • textarea • windows
Posted in programming on December 11th, 2007 |
No Comments »
I’ve added a new feature to posts here on the site. At the end of each post, where applicable, there is a “Related Posts” section. It shows a list of posts that may be interesting to readers who found the content useful.
» Read the rest of this entry
Related Posts
Tags: plugins • screenshot • tags • wordpress
Posted in programming on December 9th, 2007 |
No Comments »
I’ve been working on a web project that uses a python stack. It uses cherrypy for the web server, cheetah for the templates, and sqlite for the database engine. I wanted to get Unicode working throughout the application. The application should be able to transfer Unicode data to and from the database, have Unicode text in the script files themselves, and be able to display Unicode text, with UTF-8 encoding throughout. It took a bit to gather all the pieces together, but it’s finally working and here’s how.
» Read the rest of this entry
Related Posts
Tags: cheetah • cherrypy • python • sqlite • unicode • utf8
Posted in programming on November 16th, 2007 |
2 Comments »
Lately I’ve been noticing a void in my life that I want to see filled. I am speaking, of course, about my need for a personal wiki. Why, you ask?
» Read the rest of this entry
Related Posts
Tags: c • life • meditation • python • wiki
Posted in programming on November 12th, 2007 |
No Comments »
This tutorial, Code Like a Pythonista: Idiomatic Python is just tremendous. I learned some new stuff here and there, and the guidelines for module formatting I found very practical. Good stuff.
Plus, there is a great quote by Brian Kernighan:
Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it.
Related Posts
Tags: python • quotes • tutorial
Posted in programming on November 6th, 2007 |
No Comments »
How do you make a textarea element dynamically resizable? Or for that matter, any other html element? Is there a simple Javascript solution that doesn’t require me to change my markup, but just add an include or two, and set a class name of “resizable” on all elements that should be dynamically resizable?
Here is my solution. » Read the rest of this entry
Related Posts
Tags: css • dhtml • javascript • resizable • textarea • yui
Posted in programming, solutions on September 28th, 2007 |
No Comments »
I’ve been doing research lately into git. For the last couple of years, I have been a big subversion fan. All of my programming projects are kept safe in subversion repositories. Once I moved the databases from the bdb to the fsfs backend, maintenance has been a non-issue.
However, subversion leaves a couple things to be desired. The biggest missing feature is distributed control. When I go away for a weekend with my laptop, I’d like to be able to continue working on projects in a disconnected mode. But without access to my repositories, I can’t do that. So I have to do all the merging manually when I get back, which is a pain for some bigger projects.
Well, git was designed to handle situations like this. It was created by Linus Torvalds to handle the versioning needs of the Linux kernel. It’s super fast, super small, and so far I’ve been super pleased with it. There is documentation, a handbook, and a tutorial that I printed out and have gone through a couple times. I’m feeling pretty comfortable with it, so I’ve converted my subversion repositories, and will post some of my projects soon for the world to play with and send in patches.
Maybe one of my days I will put my home directory in git…
Related Posts
Tags: git • subversion
Posted in programming on September 15th, 2007 |
2 Comments »
Using ntext fields in ASP is a bit confusing at first. Selects work fine when you specify the column name in the select list. But if you don’t specify the right width for the parameter in your Command object, it will just drop the parameter in the Execute command to your SQL Server. So you’ll get errors about not being able to convert varchar to int, or that a later parameter wasn’t specified. That is because the missing parameter is moving all the following parameters up one in the list, throwing everything off. It took me a while to figure it out. Finally I opened Profiler and examined the query as SQL Server was seeing it.
Anyway, what you need to know is that the datatype is adLongVarWChar and that the maximum field width for ntext is 1073741823.
Related Posts
Tags: asp • ntext • sql server
Posted in programming, solutions on September 12th, 2007 |
No Comments »