Did you see my link a few days ago, about PyCharm being released by JetBrains? I hope so because it is a very interesting IDE for python and django developers.
PyCharm attempts to up the Python IDE stakes, by bringing the expertise of the rather brilliant IntelliJ Java IDE to the python world. The idea is nice, and the execution is good, especially with the Django integration.
Installation was as simple as downloading the linux tar.gz file and extracting it.
My first issue was that on a 64 bit system, it fails to start up with the message
This is because it attempts to load a library for java profiling that is 32bit compatible only. The easy workaround is to edit bin/pycharm.vmoptions and delete the line "-agentlib:yjpagent=disablej2ee,sessionname=PyCharm". I think you could also download the 64 bit version of yjpagent and put it in the lib or bin directory, but haven't tried it yet.
I did open directory and opened an existing Google App Engine project, which opened quite nicely. I immediately got some nice warnings to let me know that I was not overriding some methods correctly along with a spurious error that self.request and self.response are unresolved attributes. I guess that's a slight problem, the IDE can't possibly know that webapp.RequestHandler.initialise will be called before the get method, and since the __init__ method doesn't create those attributes the IDE can't be sure that they exist.
This kind of bug is the exact reason that python IDE's are hard, and not as helpful as in Java. In Java the fact that RequestHandler has a request attribute would have to be declared in the class. Since in python it doesn't, the IDE can't tell what type that attribute is, and therefore can't autocomplete the methods on it. So using this for the App Engine webapp framework is no better than any other application.
I next opened the pure django implementation for this website. I had a weird issue here. I use pip and virtualenv to ensure I have the correct version of django installed for each python project I build. However PyCharm doesn't support a per project set of library dependencies, and my work machine doesn't actually have django installed system-wide. I installed Django 1.1 system wide, and using Settings -> Python Interpreter -> Reload I was able to get PyCharm to reload.
I was struck by some issues immediately. Where I was previously doing import home.models I now need to include the project name, so import bruntonspall.home.models. I also have a funky bit of python path manipulation in my settings.py, unfortunately PyCharm doesn't seem to handle them properly. So several of my imports did not work anymore, which caused weird warnings everywhere.
This is only an early access program, and I will admit that for creating a new project from scratch, for general python programming this is as good an IDE as I've used. It doesn't handle all of the really weird behaviours that I've started to use in my django projects, but for non-advanced systems it's probably highly useful.
The biggest issue as far as I am concerned is the lack of good support for virtualenv, pip and pythonpath modification in settings.py. It's possible that I've missed something, and the next few days I'll be using it heavily to test it out and find out what it does well, and what it does poorly.
So as 2009 draws to a close, I look back over the year and consider what has happened. With this being the end of the decade for everyone but pedants (that will be another year yet), I've also thought about the previous decade.
10 years ago I was halfway through my degree, determined that I would become a famous game designer, or at least be designing with a major games studio. I was still determined not to become a programmer, and instead wanted to spend my days fiddling with excel, scripting langauges and writing design documents and so forth. Fast forward 10 years and I'm now working as a programmer in the web industry, speaking at conferences and even organising conferences like scale camp!
This year has been real fun, I've really settled into my role at the Guardian newspaper, and the coming year will hopefully see me extending that role into more developer evangalism focused areas. I was pleased to recently read a list of a number of technologies that one "must have used" in 2009, including a NoSQL datastore, a dynamic language framework and a non-blocking long poll framework such as node.js. I've had the opportunity this year to spend time using Reddis, Django, Python and even a brief play with node.js and the tornado framework.
How about resolutions for 2010? Well I'd like to increase the quantity and quality of my blogging. That will hopefully mean writing more often, as I'm repeatedly told that the best way to improve ones writing abiity is to practice it as often as possible. I wont promise any particular update schedule, as I've tried that before, but rest assured like all new years resolutions, january will be more active before I get bored and forget to do any more!
I also wish to try my hand at some more new technologies, trying to keep up with the changes in the industry and the way in which programming is changing. The main aims for the early year is going to be trying to have a play with Yahoo Application Framework and the Facebook platform, and trying out some more social tools to explore the concepts and patterns involved.
I hope you have had a great 2009, and have a good new year and an enjoyable 2010.
I'm not a big fan of regular expressions. They can be powerful, but for anything remotely complicated they can be a nightmare to maintain and re-read. I had an idea recently for an easy to use chaining regular expression building library but I can't find anybody doing it, so I've created one myself.
I've borrowed the concept of chaining from the jquery library, so each function on the Regular Expression Builder object returns the modified object. This makes the interface easier to read, and makes constructing a complex object pretty simple.
The code can be found at github.
Using it in your code is pretty simple, import the library, and start building the regular expression
So why is this useful? Regular expressions can start to get pretty large and funky. So for example, we might want to match a set or urls something like/travel/france and /travel/france+skiing and also /travel/france+science/nanotechnology
Writing this in the first place without making a mistake is painstaking and fiddly. Coming back to it 6 months later and having to change it is even worse. Here is the equivalent using my library.
Now it's not perfect by any stretch of the imagination. I'd love to not have to use str and literal to repeat a defined regex, but the current architecture means that executing "slugword.literal('a')" modifies every instance of slugword.
Other Todo's includes adding word, whitespace and digit methods, adding an any_character method and finding bugs by actually using it. I'll also be extending the framework to automatically match using the re module, so you won't have to manually compile and match by hand.
I also think it would be fairly easy to port to Java, so thats on the cards
Let me know what you think, use it and tell me what regex functions you use that I'm missing. I only implemented the simplest functions, so there is a lot of lazy flags, special repeat types and stuff that I've never personally used, and so didn't implement.
What do you do when you are at a conference and bored? Do you start using the backchannel to start sniping at the presenters taste in clothing, presentation background, or speech idiosyncrinisities? I've seen this at a number of conferences and I find this to be extremely unprofessional behaviour, especially in a public forum. If you see my twitter feed, you will see that I might object to the content of a presentation, for example my dislike of Objective-C as a language. However to object to a presentation because of the presenters choice of words to describe a fuzzy topic, or the quality of photography in their slides as I saw at a recent conference, is the epitome of rudeness. When somebody who is an expert in their field, has given up their time to attempt to share with you, picking holes in the format of the message rather than the content of the message is small-minded and rude.
So what should you be doing? In my opinion what you should be doing is asking yourself one very important question - What is this presenter doing that is not keeping my attention?
As a sometime presenter I find myself analysing what good and poor presenters do. I find myself looking to see what is irritating me, whether it be the presenters suit, or the way she keeps swearing, or the number of times he says Um. But at the core I tend to find that if I'm focusing on how many times the presenter says Um it's because I've lost interest in the core topic.
There are a number of reasons that a presenter can lose my interest as a listener. It could be that I'm just not interested in the topic, but a really good presenter might be able to keep me interested regardless. It's more likely that the presenter is making a mistake in preparing and delivering the presentation. this can be caused by
In a future presentation I'll cover what I try to do to prevent these from being a problem when I present, but for now I leave you with this question,
Why am I not interested in this presentation?
I've been to a fair few conferences recently, and something that has struck me is the large number of people who are dealing with similar issues. How to deal with large numbers of users. how to scale their website to handle peak loads, how to identify what capacity they have for peak loads and so on. The problem here is that although people are talking about it at conferences, and there are a few books around, there isn't anything dedicated entirely to performance and scalability. The only thing I could find was the Velocity conference, run by O'Reilly over in the states, but over here in London? Nothing that I could find.
I first raised this with Simon Willison soon after he joined the guardian. He, and other colleagues here agreed that a conference would be a good thing, and suggested I might like to organise it. So much for my big mouth!
So it gives me great pride to announce the first UK Scale Camp.
We decided early on in the planning, that the best format for this conference would be a *Camp style event, like BarCamp or FooCamp. A *Camp for those not in the know, sometimes called an Unconference or an Open Space, is a conference where the delegates themselves do the presenting. Essentially everybody coming to the event is encouraged to participate, to make the conference what they want. There is a big blank grid, with timeslots and rooms on it, and delegates come with talk or discussion ideas prepared, they find a slot for their idea, and put it on the grid. This means that the conference is completely open, any of the delegates can speak, and anybody can go to anything.
The reason for choosing a *Camp style is that with an event of a smaller size, it helps to break down the barriers between speakers and attendees. At some conferences, the speakers get VIP treatment, they stay hidden away in special rooms and don't mix with everyone else. But at a *Camp, all the speakers are on an equal footing. That means that there is an equal chance to share what we know.
*Camps also tend to encourage more discussion based panels than a normal conference. These can include discussion panels where a number of experts sit and discuss, as well as roundtable discussions or even goldfish bowls, where anybody can take a seat and join in the discussion.
This really matches the vision of the Scale Camp. I came up with the idea because I've been focused for a time now at the guardian of making our website scale, and we've done a pretty good job of it but I don't know everything about scaling. In fact I hardly know anything about scaling, because our approach is based upon our under.lying architecture and our usage patterns. In a room with 100 of the brightest and best minds in performance and scalability in the UK, I didn't want everybody to be focused on a few people, I wanted everybody to talk, to discuss and to share ideas. I wanted to find myself talking one minute to a genius in RabbitMQ, and the next minute to somebody who manages hundreds of servers in a data center.
To get this all organised has been made much easier by the wizard events team here at the guardian and our first sponsor, Nestoria. The day itself will be pretty simple, there will be some tea and coffee and a brief introduction into the concept of a *Camp and the vision of Scale Camp, and hopefully people will start to put up some session ideas. The sessions themselves will continue all day, with a few breaks for lunch and tea and coffee, and then we will have a quick thank you talk, and notification of a nearby pub that people can retire to.
If you've already got your ticket, then taking part is easy. Think up something you want to talk about or something you want to learn. We'll probably kick the day off with an introduction game, asking you to identify yourself with a few "tags" so people know something about you, then hopefully you can either put up a talk suggestion or find someone who's tags interest you and ask them to talk about something.
If you plan on presenting, then there will be projectors and whiteboards available in most of the rooms, but feel free to do a talk that is technology lite. If you plan on doing a talk that is code heavy, please let people know in advance by putting that in your talk title. "Memcached - Implementing it in a java stack" is better than just "Memcached". We would love to encourage you to use a talk that allows for participation and discussion rather than lectures.
This event is already looking to be a great day, talking and learning from some of the brightest minds in the industry. We already have people from such companies as Yahoo, Flickr, Google, the BBC, Claranet, Cloudsoft, Nestoria, and Thoughtworks coming to the event.
There are still some tickets left, but they are going fast. We've reserved 20 tickets until a few days before the event, the rest will probably go in the next week or so.