Sorry, I really could not resist ;-) But I got a better logo monster for the new git website than Dōmo-kun:
Sorry, I really could not resist ;-) But I got a better logo monster for the new git website than Dōmo-kun:
Link: "Python Google Chart".
Easy to use python wrapper for Google's Chart API.
Emacs tip #0: Always search EmacsWiki when you think you might need something.
Emacs tip #1: To navigate studlyCapped words, M-x c-subword-mode, as found on the CamelCase page. I had to add the following lines to my .emacs to get it work with C-left/C-right, M-b/M-f worked right out of the box:
(define-key global-map [(control right)] 'forward-word)
(define-key global-map [(control left)] 'backward-word)
Before that, they were bound to the -nomark variants.
But what happens behind the scenes is quite interesting to me. The URL hits a deployment in the Azure cloud where I’m hosting an IronPython runtime. Then it invokes that runtime on a file that contains this little Python program:He updates this post with a status report:
hello = "Hello world"
Finally, it gets back an object representing the result of that program, extracts the value of the hello variable, and pops it into the textbox.
This is the proof of concept I’ve been looking for.
I’m exploring the viability of Python as a way of programming the newly-announced Microsoft cloud platform, Azure. Partly that’s because I love Python, but mainly it’s because I believe that the culture surrounding Python and other open source dynamic languages can fruitfully cross-pollinate with the culture that infuses Microsoft’s platforms.It isn't as straightforward as he'd hoped - both because of the lack of C extensions used by standard library modules and because of the Azure security policy.
Along the way, I’ve been recalling something IronPython’s creator, Jim Hugunin, said at the Professional Developers Conference back in October. Jim’s talk followed one by Anders Hejlsberg, the creator of C#. Anders showed an experimental future version of C# that makes use of the Dynamic Language Runtime which supports IronPython and IronRuby on .NET. The effect was to create an island of dynamic typing within C#’s otherwise statically-typed world. We all appreciated the delicious irony of a static type called ‘dynamic’.His more recent posts track the development of this project, including how his experience of Python development is affecting the C# he writes.
Jim might have sounded a bit wistful when he said: “I’m not sure what a dynamic language is any more.” But I think this blurring of boundaries is a wonderful thing. Many smart people I deeply respect value the static typing of C#. Some of the same smart people, and many different ones, value the dynamic typing in languages like Ruby and Python. If I can leverage the union of what all of those smart people find valuable, I’ll happily do so.
by Fuzzyman (noreply@blogger.com) at January 06, 2009 01:34 PM
One of my projects implemented in C# makes frequent use of extension methods. Recently I started using IronPython to script that project and what I learned is that consuming those extension methods in C# is straightforward but with IronPython some extra work is involved.
by Fuzzyman (noreply@blogger.com) at January 06, 2009 11:11 AM
Once again my post about Jinja and the Django template engine appeared on reddit. The second time in the last two weeks, probably because my feeds changed and planets re-displayed it.
I originally wrote the post a few months ago to promote Jinja a bit. I was and still am very happy with Jinja2 and wanted to write some lines about what I like about it and how it works. And I also was hoping that the Django guys have a look at it and copy some features of it. Mainly because every once in a while I contribute code to a Django powered project or have my fingers in some way in such a project's code. And every time I'm kinda puzzled how simple some really complex tasks in Django are.
So what has changed in Django's templates the last four months? Not that much. The only changes in the Django template engine was the addition of {% empty %} blocks in {% for %} loops (which does exactly what Jinja's {% else %} does for loops) and some bug fixing. Is that a problem? I don't know, but probably not.
Django's templates are still slow and limited as they were, but it's not causing problems so that users have to switch. Every once in a while I notice that people switch to Jinja from Django templates because of performance of the limitations, but very often they throw away half the framework because they discover that Python has more to offer than just Django. And with that in mind I guess the Django guys are doing the right thing.
Django is designed for content driven websites not so much for independently deployed applications (like trac, WordPress, MediaWiki and others). So not so much for applications and also not so much for stuff where you need crazy database queries that are not possible with Django. The template engine is designed for simple HTML generation and that's it. If you want more, you often want something different than Django anyways.
I know many successful projects that are running Django without problems and it works out for them, because their requirements match (nearly) exactly what the framework was developed for. And I know many that adopted Django because of the fuzz but what they actually want to do does not fit into the Django style of development.
In many ways Django reminds me a bit of unpacking cool stuff. You download it and are instantly blown away how cool it is. Database just works, templating is awesome, URL routing gives you these incredible neat looking URLs and much more. It's so cool that many are trying to suddenly do everything with it. And that's kinda where the problem lays. You are forcing Django to do things it's not designed for.
I think what is missing is a website that explains the advantages and disadvantages of the particular solutions and what projects work best with what solution. There are Pylons, Werkzeug, Paste, Repoze and a lot more frameworks and utility libraries that focus on different kinds of web applications. And that does not only apply to full blown frameworks or WSGI utilities, but also template engines, database libraries and even databases themselves. It would prevent a lot of frustration if people could find the framework or toolchain of choice before they start developing their project.
But such a page would have to be designed by someone unbiased. And neither me, nor anyone else who develops on/for a Python powered framework should create such a comparison page. But I would encourage everybody with experiences in multiple frameworks to write down their experiences with different Python frameworks, template engines, database adapters and combinations thereof.
Update: Fixed misleading sentence. Swapped complex and simple.
# -*- coding: cp1252 -*-
'''
Find the difference in words used in two documents
Asks for two files which then have their words extracted and compared.
Most punctuation, and all words of just numbers are dropped.
(C) 2009 Donald 'Paddy' McCarthy. paddy3118@gmail.com
'''
import Tkinter, tkFileDialog, re, datetime, sys
root = Tkinter.Tk()
root.withdraw()
def wordsinfile(f):
words = set()
txt = f.read()
words = set( w.lower() for w in re.split(r"""[ \t\n\-,;:\.\?@#~=+_!"£$%^&\*\(\)<>|\\\[\]{}`]""", txt)
if w and not all( c in '0123456789' for c in w) )
return words
f1 = tkFileDialog.askopenfile(parent=root,initialdir="/",title='First text file for word diffing')
if not f1: sys.exit()
f2 = tkFileDialog.askopenfile(parent=root,initialdir="/",title='Second text file for word diffing')
if not f2: sys.exit()
f3 = tkFileDialog.asksaveasfile(parent=root,initialdir="/",title='Save output as file (end with .txt to create a windows text file)')
if not f3: sys.exit()
set1 = wordsinfile(f1)
set2 = wordsinfile(f2)
print >>f3, "Output from program word_differ.py (Author Donald McCarthy: (C) 2009)."
print >>f3, " Generated on: " + datetime.datetime.now().isoformat()
print >>f3, " First File: " + f1.name
print >>f3, " Second File: " + f2.name
print >>f3, " Output to: " + f3.name
print >>f3, "\nWords in the first file that are not in the second:"
for w in sorted(set1 - set2):
print >>f3, " ", w
print >>f3, "\nWords in the second file that are not in the first:"
for w in sorted(set2 - set1):
print >>f3, " ", w
print >>f3, "\nWords common to both files:"
for w in sorted(set1 & set2):
print >>f3, " ", w
f1.close(); f2.close(); f3.close()
back black jump bored hair missile lamb little played sent
Mary had a little lamb Who's hair was long and black. She played with it, Got bored with it And then she sent it back! By Paddy McCarthy - 2009-01-04.
Output from program word_differ.py (Author Donald McCarthy: (C) 2009). Generated on: 2009-01-04T07:20:18.890000 First File: C:/Documents and Settings/All Users/Documents/Paddys/word_differ/word list.txt Second File: C:/Documents and Settings/All Users/Documents/Paddys/word_differ/rhyme.txt Output to: C:/Documents and Settings/All Users/Documents/Paddys/word_differ/diff.txt Words in the first file that are not in the second: jump missile Words in the second file that are not in the first: a and by got had it long mary mccarthy paddy she then was who's with Words common to both files: back black bored hair lamb little played sent
by Paddy3118 (noreply@blogger.com) at January 06, 2009 06:45 AM
I am moving my blog to Posterous and taking the opportunity to separate concerns.
Technical articles will be posted to http://swapoff.posterous.com while personal stuff (probably mostly rants) will go to http://alecthomas.posterous.com.
by Doug Hellmann (noreply@blogger.com) at January 05, 2009 07:11 PM
The next release of Appcelerator Titanium (PR2, due January 23rd) is slated to include support for Python and Ruby!
Titanium is a completely open source competitor to Adobe AIR. It lets you build installable desktop applications that build their GUIs via a built-in WebKit renderer (in other words, you can use HTML/CSS/JavaScript to build a GUI, just like you do on the web). The next version of Titanium is going to include support for Python and Ruby, which means that you can use something other than just JavaScript for creating your desktop apps.
I haven’t built Titanium yet to see how it works (script type=”text/python”?), but the fact that they’re working on this is very interesting.
We make shitty software… with bugs!
old Living Videotext slogan, as reported by Dave Winer
I love that quote. On the surface, it sounds disparaging about the software you have today, but it’s actually more of a statement of hopes for the future. The status quo, in fact every status quo, is less than ideal. It’s great to be proud of your products and where you are, but it’s even more important to keep in mind how much more there is to do.
Early in my career, I worked at the ANS Network Operations Center. ANS ran the original NSFNet and provided internet and dial-up connectivity for America Online, as well as a number of large companies and research labs. We had the internal slogan “we suck less”, and it was the same idea as the “we make shitty software” quote. At ANS, we did suck less than our competitors. But, every time a customer’s connection was down we knew we had work to do to make things even better.
I’ve been doing web-based software development for a long time, and the tools for creating web-based software have improved tremendously. Server side frameworks like Rails, TurboGears and Django have made writing typical server side code far easier. Client side toolkits like Dojo, jQuery and Prototype/Scriptaculous have made creating better client experiences even easier. And tools like Firebug have made it much easier to debug an application and tweak its appearance on the fly.
But, developing compelling web-based applications still sucks. Its still more work than it should be in the ideal case. I’m sure that the people working on all of those tools, and all of the competing tools, all have ideas on how to make things better and will all be pushing the state of the art forward and removing a bit of suckyness with each release.
I’m delighted to say that starting today I am working with Ben Galbraith and Dion Almaer at Mozilla Labs on web development tools. I’ve been a reader of Ben and Dion’s Ajaxian site for years and I know how much thought they’ve put in to making webdev better, so I’m really excited to be joining their group. And Mozilla looks like a fantastic organization to be a part of.
It’s still a very new group, but you can bet that every day I’m going to be thinking about how I can help make web development easier, faster and better.
yml2tex is a simple Python script which generates LaTeX code for LaTeX Beamer presentations out of YAML files.
If you prefer creating presentations with the LaTeX Beamer class but have a hard time remembering LaTeX syntax (like me) then this project is for you.

See the project page at Google Code for more information about yml2tex or the CHANGELOG file in the Git repository for a full list of changes. The most important ones are:
Previous versions required dashes before each section, subection or frame due to the fact that PyYAML maps keys to Python dictionaries (correct according to the YAML spec) which don't have an element order—the presentation would be a mess as everything would be mixed up. However, if you put a dash before each line the key is mapped as a Python list and therefore has an order.
Version 1.2 now comes with a custom Composer for PyYAML which eliminates the need for dashes by mapping keys to tuples with two elements (pairs) instead of dictionaries.
So, instead of writing:
- Introduction:
- Features:
- General:
- Easy & fast to generate simple presentations
- Adds a nice default style to the document
- Generates a TOC out of sections/subsections
- Separates content from presentation
You can now write:
Introduction:
Features:
General:
- Easy & fast to generate simple presentations
- Adds a nice default style to the document
- Generates a TOC out of sections/subsections
- Separates content from presentation
It is now possible to specify metadata in the YAML file itself:
metas:
outline: 0
highlight_style: borland
Introduction:
Why?:
Why?:
- Creating Presentations in PowerPoint/Keynote etc. takes too long:
- No automatic TOC generation
- No Code Highlighting
- Applications not for free
- Proprietary formats
You can, for example, disable the automatically generated outline or choose another Pygments highlighting style for your code. Take a look at the README file for a list of all supported values.
Special characters in LaTeX are another thing I personally can't remember. I always get an error during the compile, have to open up the TeX file and escape the character which caused the error just to find that I forgot to escape another character later on.
Version 1.2 now fixes this by auto-escaping LaTeX special characters (&, %, #, _, { and }) in section, subsection, frame titles and item text.
by Shannon -jj Behrens (noreply@blogger.com) at January 05, 2009 08:18 AM
The decision of python-dev to deprecate bsddb has left us in a bit of a pickle (hah!) over in the pygr project. We're looking for a replacement for bsddb for default storage of infrequently- (or never-) changed pickled Python objects. Some of the parameters under consideration are:
- Python version availability: does it work for 2.2 on up? What about py3k?
- cross-platform availability: is it readily available for Mac OS X and Windows, no compilation required? Byte-order compatible across platforms? Comes with Python by default is a plus...
- scalability: can it scale to gigabytes or 10s of gb of data? 10s of millions of records?
- is it fast, whatever that means?
- is it simple to set up: no sysadminning required?
We're looking at sqlite and python-cdb right now, as well as a home-grown solution. What have we missed?
So far Istvan Albert has benchmarked bsddb hashopen and btopen, sqlite, GNU dbm, and python-cdb; you can see the results here. The whole discussion thread on pygr-dev may be worth reading if you're interested.
A few additional notes --
- Couchdb, MySQL, PostgreSQL, etc. violate the "no sysadminning required" rule. We will probably support them, but they will not be the default.
- python-cdb looks blazingly fast, but we would have to port it to Windows, and make binaries available. What's the scoop on python-cdb, anyway? Is it well maintained, a well-used project, etc?
- sqlite isn't "built in" prior to Python 2.4.
Anyway, at this point I'm just trying to figure out what we're missing, if anything!
thanks, --titus
I have not blogged a lot lately, so I'm trying to use the energy the new year provides for getting some rhythm back into my postings. I like blogging, but writing posts takes a lot of time and that's been harder to find lately. I have found my blog and other time sinks like Twitter and IRC to be not only entertaining, but actually useful for my work, but right now I feel one of those has to go. Since blogging is harder, I wonder if this is a lost battle already...anyway, on to my exclusive 2009 preview.
Plone will once again bring home the bacon this year. I already have a couple of projects booked and, despite the economical crisis, it seems like I'll be able to land a couple of outsourcing gigs here and there. It's a great time to be working with Plone, though doing so effectively requires you to keep current on lots of technologies and ideas. Zope 3 libraries and concepts have not yet finished transforming Plone, while at the same time there's a push for simplicity that will bring still more changes to the table as Plone 4.0 comes around.
The effort employed in keeping current is not wasted, as I have usually a couple of chances each year to offer Plone training here in México or in other Spanish speaking countries south of the border. Since we are actively trying to make Plone more popular in México through our newly formed user group, I hope I get a few more training opportunities this year than in 2008.
Speaking of training, allow me to do a little advertising. My friends and colleagues at Jazkarta will be offering a course in Montreal next week, on January 13th. If you live near that area and are thinking about getting into Plone, you should strongly consider taking advantage of the discount that they offer through this link. If you do that, I'll give any referral fees I get straight to the Plone Foundation.
My work in Plone for 2009 will be centered around a project I'm doing for the Library of Congress in Chile. The main objective of this project is to get Plone used as a CMS backend and push the content into a relational database with the help of the remarkable ContentMirror product. This content will be used by several frontends powered by other Python web frameworks. Thus Plone will be used for what it does best and other web development work will be done on the frontend application. The idea is to make Plone the Product a lot more appealing for developers who use other Python web frameworks. The project is in an advanced state and a release will be coming before March, when I will be showing this work at the PyCon in Chicago.
As part of this work I've developed yet another ajaxy page composition tool for Plone, which will also be released near March. This tool uses the Component Architecture for easy extensibility and includes a CSS grid layout generator based on YUI Grids. In previous work for magazines and newspapers I've found that they are always very interested in this kind of solution and even though Plone 4 will be exploring other approaches to solve this problem, at least the use of layouts and tiles give my product something in common with the future of Plone.
For my frontend work I have been using repoze.bfg and I have to say that I really like it. It's simple, flexible and very, very fast. In my tests I've been serving Plone content at around 400 requests per second, before caching (I'm getting 10 or so from Plone, so do the math). One of the nice things about repoze.bfg is that it uses familiar Zope concepts and technologies, so an experienced Plone developer will find it a breeze to get going. It won't force you to use those concepts in your code, though, so Python developers with no Zope experience can also get some productive work done. I highly recommend that you get a look at this framework.
While you are at it take a good look at the repoze project, which is a separate initiative coming from the same guys, the Zope legends at Agendaless Consulting. The objective of this project is to get Zope technologies working with other Python web frameworks using WSGI. So far there's a lot of middleware available and special distributions of Plone, Grok and Zope that work in a WSGI pipeline. I hope I can contribute to the repoze.* projects as part of my open source work in 2009.
One other Python web framework that I will be using a lot in 2009 is Grok, which is the best way right now to take advantage of Zope 3 technologies. A frontend for my Chile project is on the works and I hope I get to use it for other applications throughout the year. There's also a future project with Grok that involves something I have wanted to do for a long time, but I'll write about this when I get to do it.
In all, this is a very promising year, with a lot of work ahead. A lot of things are going on in the Python world and it will be fun to be a part of it. I wish you all a very active and rewarding 2009.
by Grig Gheorghiu (noreply@blogger.com) at January 04, 2009 10:10 PM
by Doug Hellmann (noreply@blogger.com) at January 04, 2009 04:47 PM
by Simon Wittber (noreply@blogger.com) at January 04, 2009 03:25 PM
by makkalot (noreply@blogger.com) at January 04, 2009 10:34 AM
Update: Doh! Sorry for flooding everyone’s feed readers with my epic post. Evidently WordPress ignored my “more” tag. I think I ran into this problem before…
Update 2: Retracted the meaningless Google Trends point. Thanks to commenters for pointing out how meaningless it was. I still feel like git has a much stronger web presence than bzr or hg, but its just another one of the many “gut feelings” in this post.
The DVCS wars have been raging for a while now, and in case you haven’t been keeping score, git is winning. Admittedly I have no proof and don’t even know if proof is possible, but I have some good evidence of git’s march toward VCS dominance:
Also note some of the major upstream projects using each DVCS:
Communities
Git seems to be attracting the most diverse communities as well:
Git: Linux Kernel, X.org/FreeDesktop, Ruby on Rails
Bazaar: Ubuntu, Ubuntu, Ubuntu
Mercurial: Pythonistas, projects that need better Windows support than Git offers
Once again I don’t really have any stats to back up these assertions, they’re just my biased observations.
Personally…
I tried learning Git soon after it was first released and failed like so many others. Unlike many of those others, I never went back to give it another shot.
Next I learned Bazaar and felt comfortable in it almost immediately. Now I use Bazaar as my preferred VCS and quite like it mainly because it works well and was very easy to learn. I know its not the fastest, but its so far from being a bottleneck in my development process I don’t notice.
I learned Mercurial for work and use it at least as much as Bazaar, but I’m not sure why anyone would use it over Bazaar. I think people who learned Mercurial first think the same thing about Bazaar.
And perhaps thats part of why Git is winning. It seems fundamentally different from the other two which is probably why its the only 1 of the 3 I haven’t learned.
THE FUTURE!!!!!!!11
I actually don’t plan on learning git any time soon. My time for playing with new technology is currently taken up testing nginx, spawning, and FastCGI.
I suspect thats the norm as well: people who already know a DVCS probably aren’t looking to migrate between them. The few that are, are probably moving to Git.
I think we’ll see the current trend of Git’s lead widening over bzr and hg as well.
However, I don’t see the war ending anytime soon. The fact of the matter is all 3 of them are great and the weaker DVCSes have already fallen prey to evolutionary forces (monotone, darcs, etc).
Flamebait
What are your thoughts on my completely contrived DVCS War? Which do you prefer? How many do you use? Are my assumptions about popularity (in particular the various communities around each) accurate?
I wish Ohloh or cia.vc gave VCS usage statistics, although I’m not even sure they record that data.
James shows his oldest files, a meme he picked up from Doug who got it from Brandon, its creator.
See one of the above posts for details, but the idea is to find the oldest file in your home directory tree, and tell its story.
I found these:
1986-08-20 .\pscom\avl.h
1986-08-20 .\pscom\avl.c
PSCom was a PostScript preprocessor that I wrote while employed at Digital. We wrote a lot of PostScript code, and wanted to be able to use conditional inclusion, macro replacement, and lexical compression (similar to what jsmin does for JavaScript today). PSCom was the result. It's a C program, and I'm amazed to remember the amount of work that went into providing basic features we take for granted now in the Python world, and in any modern programming environment.
avl.c starts like this:
/***
*** avl.c --
***
*** The AVL height-balanced tree abstraction.
*** Six functions are defined:
***
*** newavl()
*** returns an empty avl tree.
*** addnode(tree, key, data, compare)
*** Adds a new node to the tree given.
*** node = findnode(tree, key, compare)
*** Finds the node in the tree.
*** modnode(tree, key, data, compare)
*** Modify an existing node.
*** im = startiter(tree)
*** Starts an iteration over the nodes, returning an
*** iteration map.
*** im = nextnode(tree, im, &node)
*** Returns the new map, and writes a pointer to the next
*** node.
*** size = avlsize(tree)
*** Returns the number of nodes in the tree.
***
*** N.Batchelder, 5/7/85.
*** Adapted 1/13/85.
***/
Clearly this would simply be a dictionary today, but I had to go and write an entire data structure to be able to store the symbol table for PSCom. The adapted date must be a typo, it was adapted 1/13/86, based on the comment in avl.h If it was truly begun in May of 1985, then it was originally part of a different project, perhaps a PostScript-like language implementation I was working on while at Penn.
One odd feature of PSCom: when shortening identifiers, you could choose the set of characters that would be used. PostScript has very lenient rules regarding allowable characters in identifiers, so you could use -_= as the set to choose from, and end up with a final file that looked like hardware timing diagrams, or ,.:;' which would be indistinguishable from chicken scratch.
One thing about the code that strikes me now: I wrote a lot of comments back then! I should get back into that habit...
The docs for glHistogram clearly say that if the GL_ARB_imaging extension is not supported then glHistogram is not present... except it appears to be present (and even accepts calls), but if I pass GL_HISTOGRAM to glEnable( ) I get an invalid enumerant error.
I'm pretty sure this card should support the whole of the imaging extensions (it's an ATI Mobility Radeon HD 3650), but it does not declare itself to support ARB_imaging. So it seems that, while the function is there, its functionality is not there if the ARB_imaging extension isn't declared.
It is to sigh. Half an hour wasted on this, which means I'm not likely to get a new release out today.
by Mike Fletcher (nospam@example.com) at January 03, 2009 10:26 PM
My editor (SciTE) has always worked fine for programming Python 2.x. I'm now trying some Python 3.0 code and ran into an issue on my first script. The issue doesn't happen running the same code under 2.x. It is really confusing and annoying me and I have no idea who to file a bug with.
For whatever reason, as soon as I call an http.client request() method from within a while loop, nothing further is printed to the editor's console (stdout). If it is not in a loop, I get the output. The script executes fine aside from printing output. If I run the script from a regular command prompt (outside of SciTE), it works fine also.
Setup:
* Windows (tested on XP and Vista)
* Python 3.0 Final
* SciTE Version 1.75-wbd-1
This works: ('foo' is printed once to console)
import http.client
conn = http.client.HTTPConnection('www.goldb.org')
conn.request('GET', '/')
conn.close()
print('foo')
This works: ('foo' is printed repeatedly to console)
import http.client
while True:
conn = http.client.HTTPConnection('www.goldb.org')
# conn.request('GET', '/')
conn.close()
print('foo')
This doesn't work: (nothing is printed to console)
import http.client
while True:
conn = http.client.HTTPConnection('www.goldb.org')
conn.request('GET', '/')
conn.close()
print('foo')
This same exact setup works fine in Python 2.x. I've also tried starting Python with the '-u' option to get unbuffered output.
Anyone have ANY clue what could be going on?
Update: This seems to be related to Issue 4705 at bugs.python.org. It has to do with how Python 3.0 does (or doesn't) do unbuffered I/O. A patch was already submitted. Hope it's fixed in next release.
by Corey Goldberg (noreply@blogger.com) at January 03, 2009 06:29 PM
In addition to full support of all Java platforms (Java SE, Java EE, Java ME, and JavaFX), the NetBeans IDE 6.5 is the ideal tool for software development with PHP, Ajax and JavaScript, Groovy and Grails, Ruby and Ruby on Rails, and C/C++.Python is only supported in the early access release. I expect Python support to improve over time.
Discover the joys of Python programming with the NetBeans IDE for Python Early Access. Enjoy great editor features such as code completion, semantic highlighting, and more. The EA release also includes a community developed Python debugger and offers a choice of the Python and Jython runtimes.
The NetBeans editor for Python supports Smart Indent, Outdent, and Pair matching, additional to syntactic and semantic highlighting, code folding, instant rename refactoring, mark occurrences, finding undefined names, and Quick Fixes. Code completion is available for local function and variable names as well as Python keywords. The editor also assists you by inserting and fixing import statements.All that stuff seems to work. I opened a file. It gave me a PyLint-like warning that said, "The first argument to a method should be self or cls. I was using klass. I right clicked on klass and said rename. It renamed all the occurrences. Easy.
With the NetBeans IDE for PHP, you get the best of both worlds: the productivity of an IDE (code completion, real-time error checking, debugging and more) with the speed and simplicity of your favorite text editor in a less than 30mb download.The IDE stuff works well. However, it definitely can't touch the speed of my favorite text editor ;) The fact that the download was only 25mb (109mb uncompressed) was indeed quite impressive in comparison to Eclipse.
The PHP Editor in NetBeans IDE 6.5 supports all standard features such as code completion, syntax highlighting, mark occurrences, refactoring, code templates, documentation pop-up, code navigation, editor warnings and task list.The documentation pop-ups are amazing. The documentation for JavaScript even includes browser compatibility notes, and the documentation for HTML is straight from the DTD. Furthermore, the code completion isn't pre-baked as it is in Komodo Edit. If you register a new JavaScript library, it can do code completion on that too.
The NetBeans IDE has the JavaScript tools you need: an intelligent JavaScript editor, CSS/HTML code completion, the ability to debug JavaScript in Firefox and IE, and bundled popular JavaScript libraries. Your favorite JavaScript framework will get you 80% of the way, NetBeans IDE will help you with that last 20%.Yep, all that stuff seems to work. It was even able to do code completion on CSS content when I was in a PHP file. You probably shouldn't put CSS blocks in PHP files in general, but the fact that it could still parse it and do code completion is impressive.
by Shannon -jj Behrens (noreply@blogger.com) at January 03, 2009 12:57 PM
I have packaged and released version 0.2.4 of gerald. This is a minor release with a couple of little features and some documentation and admin updates. You can find all of the details in the CHANGELOG.txt file that comes with the source distribution (or view it here) but in a nutshell the changes from the last release are;
Please download, install and enjoy. Bug reports or tumultuous praise to the usual address please.
I've wanted to post about this topic for a while now, though I haven't been able to come up with an approach that doesn't make it look like I'm begging for work! I'm employed and I usually enjoy my job!
I've had dozens upon dozens of conversations with fellow developers regarding freelance software work. Many of them think that it's a fairly trivial process to strike out on their own and simply "freelance." You know, if they could only shake the management overhead, they would make gazillions.
I don't get it.
First of all, how exactly does an individual with a software engineering background find work as a freelance developer? This has always escaped me. It seems as though there's a bit of marketing knowledge needed.
I have friends that find work. I have coworkers that keep busy on the weekends. These opportunities seem to pass me by. Is it a situation where a developer needs to setup an entire corporate facade and pawn himself off as "Synergistic Corporate Solutions" or "Logimental Systems Design?" Complete with domain, eight-hundred number, and phony sales department? Is it a word of mouth thing?
Next, what about ongoing maintenance agreements, bug fixes, and support? All of this sounds like a lot for one dude. How do you folks out there running one man shops set this stuff up? My first thought is that the amount of money required to fully support someone would require a level of service too high to provide with such limited resources?
Is there even a market for it? I've a second degree black belt in Python-Fujitsu, a small collection of vendor certifications, 12 years of professional Linux experience, and I understand enough of the business voodoo to get invited to the fancy marketing meetings. Aren't there 45,000 guys just like me out there trying to make a buck on the side the same way? It seems as though it would be a bit of a saturated market.
I'm coming to the end of a two week vacation. I could really get used to working in a home office. It's been nice to see my kids during the day and enjoy a bit more time with the family. I'm really starting to like not having to sit in Atlanta traffic twice a day (and my blood pressure is thanking me!). My current employer doesn't allow telecommuting so it's not really an option right now.
I guess I'm looking for a good book or similar resource that touches on the subject. Perhaps the experiences of others that have tried to make a living doing what it is we do.
by Jeff McNeil (noreply@blogger.com) at January 03, 2009 03:50 AM
I use VirtualBox OSE for virtualizing test environments for Miro development. I built a Windows XP vm a year ago and when I did it, I put it on a virtual disk that was 8 GB which turned out to be waaaay too small for my needs. It's non-trivial to build a Windows build environment for Miro so I really wanted to clone the partition to a new virtual disk that was a lot bigger, then resize the partition rather than create a new virtual disk and reinstall and set everything back up.
I pretty much did that this morning in a couple of hours.
First thing I did was download the LiveCD of Clonezilla (version 1.2.1-23) and the LiveCD of GParted (version 0.4.1-2).
Second thing I did was create a 25 GB virtual disk in VirtualBox.
Then I attached the new virtual disk to the winxp vm that I had. Thus it should show up as hdb.
I booted into the Clonezilla LiveCD, cloned the old virtual disk to the new one keeping the partition sizes the same and making sure to copy over the MBR, too.
I switched around the virtual disks attached to my winxp vm and booted into the new virtual disk--worked great!
I booted into the GParted LiveCD, launched qtparted and grew the NTFS partition so that it used the whole virtual disk.
Then I booted into the new virtual disk. It did an NTFS disk check on startup which I thought might indicate the process didn't work right. Disk check passed, Windows XP booted and everything worked as well as I expected it to.
by Mike Fletcher (nospam@example.com) at January 02, 2009 06:01 AM
Python 3.0 (r30:67503, Jan 2 2009, 00:20:15)
[GCC 4.3.1] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import concordance
>>> concordance.__file__
'/usr/lib/python3.0/site-packages/concordance.so'
>>>
by Arc Riley (noreply@blogger.com) at January 02, 2009 05:39 AM
This is part three of my continuing adventure in packaging my Python application.
Thanks again for the advice given in response to my last post on Linux-specific application packaging issues. I've decided to leave packaging up to the experts and help them as much as possible. To this end I've:
The approach I've taken for the stand-alone packages is as follows:
Since the examples directory is pretty big I've also created a separate "examples" zip file.
This is implemented as a new setup.py command "build_apps" (as BuildApps.) I didn't use zipfile's PyZipFile but rather implemented my own. PyZipFile only includes compiled modules (.pyc or .pyo). The problem I have with this is that the compiled modules are not compatible across Python minor releases (modules compiled for Python 2.5 are not compatible with 2.6 and vice versa.) I would have to include separate library zip files for each system interpreter I wished to support. After some very simple checks I determined that the performance difference is negligible if I just bundle the original .py files instead.
I wrote "build_apps" so it'd fake being an "sdist" command enabling me to upload the resultant file to the Python Package Index (PyPI). This part is really quite inelegant but I'd like to keep the downloads all in one place. Unfortunately the file listing in PyPI lists the files as "Source" which isn't good. PyPI has no concept of an "application" though.
The Windows and OS X application bundles are completely untested.
I intend to investigate py2app and py2exe in the longer term to produce more system-friendly programs (no need to install Python, have icons, etc) but for now I believe this solution is good enough.
by Arc Riley (noreply@blogger.com) at January 01, 2009 11:11 PM
I believe dependency injection can improve the design and quality of Python applications. It seems this idea is somewhat controversial. My previous post invoked a wide variety of responses. (It was the first time I got email resembling hate mail
It seems that a longer and more detailed explanation may be helpful.
I am working on an article describing the benefits of dependency injection to Python applications. If you have reason to believe otherwise I would really like to hear from you. I want to make sure that the article addresses the community’s thoughts. If you don’t know what dependency injection is or just want to say that Python is not Java don’t bother.
I look forward to reading your comments! Go ahead and comment on this post or email me at dstanek [at] dstanek [dot] com. Thanks in advance.
Celebrate the new year with a blog post discussing the oldest files that are still sitting somewhere beneath your home directory! The procedure is simple:
#!/usr/bin/env python
"""Print last-modified times of files beneath '.', oldest first."""
import os, os.path, time
paths = ( os.path.join(b,f) for (b,ds,fs) in os.walk('.') for f in fs )
for mtime, path in sorted( (os.lstat(p).st_mtime, p) for p in paths ):
print time.strftime("%Y-%m-%d", time.localtime(mtime)), path
Only include files whose last-modified time is a date on which you really touched the file. The file's time should neither result from an error (a few files beneath my own home directory have an incorrect date of 1970-01-01), nor from unpacking someone else's archive that has old files inside of it. For example, I myself have excluded the following pair of nearly 17-year-old files because their dates reflect their age inside of the Python 3.0 source archive, instead of the actual moment last month when they became part of my home directory:
1992-03-02 ./src/Python-3.0/Demo/scripts/wh.py 1992-03-02 ./src/Python-3.0/Tools/scripts/dutree.doc
But there is no requirement that the actual content of each file you list be your own. Whether you wrote the file yourself long ago, or downloaded it from some ancient and forgotten FTP site, you have a story to share!
Within the rules given above, here are the oldest files beneath my own home directory:
I like using unusual text characters to decorate my site, for example, my home page uses lots of mid-dots (· ·) and chevrons (» »), as well as other special characters. To keep the HTML source from being cluttered with those inscrutable numeric entities, I wrote this Django tag:
special_ch = {
'': '',
'>>': '»', # RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK
'<<': '«', # LEFT-POINTING DOUBLE ANGLE QUOTATION MARK
'(c)': '©', # COPYRIGHT SIGN
'S': '§', # SECTION SIGN
'*': '•', # BULLET
'.': '·', # MIDDLE DOT
'-': '–', # EN DASH
'--': '—', # EM DASH
':>': '▶', # BLACK RIGHT-POINTING TRIANGLE
'o': '◦', # WHITE BULLET
'[]': '▫', # WHITE SMALL SQUARE
'<>': '◇', # WHITE DIAMOND
}
@register.simple_tag
def ch(value):
return ' '.join([special_ch[s] for s in value.split(' ')])
Now I can use the ch tag with a mnemonic representation of the character in question. Spaces become non-breaking spaces to help control the layout around these characters:
<p>{% ch ">> " %}more text..</p>
<p>{% ch "(c) " %}2002{% ch "-" %}2009</p>
becomes
» more text..
© 2002–2009
The tag reference takes more space than the entities, but I can tell how they will display, without having to memorize the Unicode code points.
…of 2008. (Not that I’m really blogging that much these days.)
Everyone else seems to be doing these big end-of-year posts, summarizing their years, their learning, achievements, setbacks, joys, and sorrows. I’m not sure when it happened, but I’ve largely lost the patience to go on and on about my life (I guess Twitter kind of takes care of that for me any more), so I’ll keep this short (if not sweet).
2008 was a year. We had a miserable few months of illness and sleeplessness, followed by a good long stretch of absolute, utter joy with our daughter, Claire. I read less than I like to, but greatly enjoyed what I did. I wrote far less code for myself than I like to, but I was able to instigate a quantum leap in the level of Javascript written at work, as well as contributing a number of fixes back to the Dojo framework. I played an awful, awful lot of Rock Band. I enjoyed PyCon and Velocity, in spite of their flaws, and I wish that work and family allowed me more time to contribute to the community. I continued to grow as a photographer, though I was frustrated by several months of inaction and lack of inspiration from which I’m still trying to play catch-up. And in these rocky economic times, I’m happy to remain in my position at American Greetings.
I’m overwhelmingly proud of my wife’s accomplishments, both academic and parental. I’m ridiculously happy to be my daughter’s father–the role of Daddy suits me just fine; she amazes me daily and has truly transformed my emotional well-being.
I am immensely grateful for my friends, for my family, and my good fortune. I hope for a better, more peaceful future in 2009, that we may all heal the hurts of these mad days and enjoy the fruits of the life we’re given.
To all who may read this, here’s a quick little toast to the passing of the old year and the dawning of the new. Cheers!
I wish I could find a dedicated feed for Computerworld’s “A to Z of Programming Languages” series — I’d subscribe, they’re great reading. (My second wish is for online magazines to find a better way of generating revenue than all those noisy adverts.) Subscribed or not, I found and read the recent interview with Larry Wall about Perl. Perl 6 gets its first mention in the Q and A on the second page.
Would you have done anything differently in the development of Perl if you had the chance?
Either nothing or everything. See Perl 6.
Except you can’t really see Perl 6 yet. This ambitious new version of the language is, Larry Wall says, scheduled for release on Christmas Day. When pressed further on progress, he adds
We’re certainly well into the second 80 percent.
A metric all software developers can relate to!
As a consequence of its protracted emergence, some of Perl 6’s best features have been backported to Perl 5.10. Larry Wall, again:
One of the most popular things is the use of “say” instead of “print”.
I don’t follow Perl closely enough to know if say and print are synonymous; and even if they are I can see why this change would be popular. Programmers use print frequently, especially when trying to figure out what a program is doing (all of the time, that is!), and say is two characters fewer to type, it’s chatty, and I’m all for variety.
Perl 6 may have slipped another Christmas, but notably, soberly, sensibly, Python recently hit a milestone in its own ambitious trajectory. Python 3.0 (final) was released on December 3rd 2008. Python 3.0 is, I think, the first version of the language which breaks backwards compatibility: so, for example, a Python 2.2 program should work unchanged in Python 2.6, but a Python 2.6 program is unlikely to work in Python 3.0.
It’s a bold move, and one which has taken a lot of smart people a lot of hard work. For many others the hard work has just begun: forking the language marks the start, not the end, of a period of transition.
As Perl 5.10 anticipates Perl 6, so Python 2.6 anticipates Python 3.0. Some features, such as binary literals, have been backported from 3.0; the -3 flag warns about Python 3.0 incompatibilities in 2.6 code; and a new tool, 2to3, converts 2.6 code into 3.0 code.
Despite looking forwards in this way, Python 2.6 is unlikely to mark the end of the Python 2.N line, and even for new users on greenfield projects Python 3.0 may not be a wise choice. For one thing it’s new, whereas (e.g.) 2.5 is battle-hardened; for another, many popular third-party libraries and frameworks have yet to be released against 3.0. Although the standard documentation for Python 3.0 is complete, the “current documentation” linked to from the Python homepage resolves to Python 2.6.1, and that’s where you’re likely to find yourself if you e.g. google for help on a particular Python topic, or click a link from an online article. If you’re after a book on Python, the choice for Python 3.0 is limited.
As with Perl 6, print has changed: in Python 3.0 print is a function, not a statement. So while Perl loses a couple of characters, Python gains two (the parentheses required for function application). On the other hand, it would no longer be a syntax error to assign the function print to a variable say.
$ python3.0 -c "say = print"
$ python2.6 -c "say = print"
File "<string>", line 1
say = print
^
SyntaxError: invalid syntax
Here’s a blot on Python 2.6 and its predecessors: the range() builtin function returns a complete list, even if you only want to consume its elements one at a time. Xrange(), which generates numbers on demand, is more efficient and generally what’s needed. Similarly in 2.6 map() and filter() return complete lists; for elements on demand, use itertools.imap() and itertools.ifilter(). And Python 2.6 provides both lazy and complete ways to access keys, values and items in a dict.
Note the redundancy here: range() is equivalent to list(xrange()), etc.
Python 3.0 simplifies things, letting range() do what xrange() used to, and eliminating the awkwardly named xrange(). Similarly map/filter() replace itertools.imap/ifilter(). Dict.iteritems() etc. have gone; thus dict.items() is lazy, and if you need the complete list of all (key, value) pairs in a dict, list(dict.items()) does the job.
These changes add little to the power of the language, and may even seem to wilfully break backwards compatibility. For me, they’re about consistency, and reducing interfaces to a minimal complete set. I applaud them.
☀ ☁ ☂ ☃
More significantly, Python 3.0 builds in proper support for Unicode, or at least the basis for proper Unicode support. The problem here being, Unicode is necessarily complex — as any system which encompasses so many subtle cultural differences must be — and however cleverly Python has adapted to the challenge, some of this complexity must rise to the surface of Python 3.0 programs.
Is this complexity really essential? Could a modern language reasonably ignore Unicode, or delegate its support to a standard library? Has Python become less attractive to learners and novices? When Paul Graham launched a new lisp dialect, Arc, at the start of 2008, he noted:
I went to a talk last summer by Guido van Rossum about Python, and he seemed to have spent most of the preceding year switching from one representation of characters to another. I never want to blow a year dealing with characters. Why did Guido have to? Because he had to think about compatibility. But though it seems benevolent to worry about breaking existing code, ultimately there’s a cost: it means you spend a year dealing with character sets instead of making the language more powerful.
Which is why, incidentally, Arc only supports Ascii. MzScheme, which the current version of Arc compiles to, has some more advanced plan for dealing with characters. But it would probably have taken me a couple days to figure out how to interact with it, and I don’t want to spend even one day dealing with character sets.
Sad to say, it would take me more than a couple of days to figure out MzScheme’s advanced character plan, so I’m not qualified to comment on Paul Graham’s decision. Many others did, at the time, and if you follow the link in the blockquote above, you’ll find a few words of explanation which I’ll paraphrase here: Arc is not about the details of character sets, it’s a high-level language, for writing short programs.
I class Python as a high-level language too, and regard its power and accessibility as the source of its popularity. Python is also a mainstream language and one increasingly used at the heart of internationalised applications. I agree with James Bennett: Unicode support is fundamental and necessary.
Anyone who’s visited Word Aligned before will know that most of the example code here is in Python. I’m aware that on several occasions I’ve waved away Unicode issues (an anagram solver which fails to identify “face” as an anagram of “café”, for example).
Like Paul Graham, I can justify my decision. I want the code presented on this site to work, but not just so you can cut and paste it. I’m not a library provider. I use Python here primarily because it’s succinct and accessible. I want you to read it! Sometimes blurring the distinction between characters and bytes makes for short and sweet examples.
If I switch to Python 3.0, will I still be able to cut these corners? Or will my code become more fiddly because it must deal more explicitly with character encoding issues? The truth is, I don’t know yet, I’ve only written one Python 3.0 program.
import antigravity
At work, our choice is obvious. We shall continue to use Python 2.5 for the im