Source Guru

Tag: python

It’s nice to see young people getting into Open Source

by on Jul.12, 2009, under Personal

I live in one of the roughest areas of Birmingham, in the UK. Today I was walking from my flat to go and visit my mother, and as I was turning a corner, a kid of about 10 years old started to give me some funny looks as he went past me.

“Oh Great” I thought, thinking that I’d have some cocky little kid trying to cause trouble.

At the time, I was wearing a T-Shirt that I’d gotten while I was at EuroPython, with the Google logo on the breast, and “Python – Programming the way Guido indented it” across the back.

The kid asked me whether I worked for Google. Still thinking that he was going to try and start causing trouble, I answered no, and walked on. It was great to hear afterwards though “You use Python? I’m learning Python”

Good to see that even amongst the rough, there are some people out there starting young in the Open Source world.

Good luck to you kid, whoever you were!

5 Comments :, more...

EuroPython 2009

by on Jul.04, 2009, under Geeky

So, for most of the last week, I’ve been at EuroPython 2009. The conference was amazing, even if I am still completely shattered.

A lot of people who know me have asked why I went to EuroPython. I know at least one person made the comment “But you’re a PHP Hacker (hiss)”. Yes. I’m a PHP hacker by trade, but I’ve been trying to teach myself Python over the last few months, and I’ve really been enjoying it. I’ve not done much of great interest, but I’ve found that Django is a pretty awesome tool, and lets me build stuff like my Video Site with minimal effort.

Anyway, back to the conference. I got involved pretty simply because I’m a local, and know most of the organisers from my Local LUG. I’m glad I did get involved in it though. I enjoyed it (though, until I got home from it, I hadn’t had time to realise I’d enjoyed it!).

Day 1

I arrived at the conservatoire at about 7:30 am. I was half asleep, and didn’t really know what was going on. I found the registration desk, got my badge, and buggered off to the crew room to get changed into my lovely blue shirt, and then I started off helping set some stuff up (projectors and such)

Knowing that I’d previously lost my Bank Card, and that I’d need cash, I scarpered pretty quickly to the bank, to go get some money for the week. I headed back to the conference for about 10, and then wandered aimlessly around looking at the different stalls. I hadn’t volunteered to do anything till 11:30.

At about 11:15, I headed to the Adrian Boult hall to get ready and Mic up the first speaker I had to work with. This was Simon Willison, talking about CrowdSourcing with Django. A pretty cool talk, which was kind of interesting to me after listening to Matthew Somerville’s talk at my local LUG the month before.

Next up was the talk that had been advertised in all the toilets around the venue. I’ve no idea why it was advertised in the toilets, and I didn’t really watch that much of the talk. The speaker had wanted a screen with IRC in for the talk, and this was where the first major fail came in. Chris Swift’s laptop didn’t like the projector, so I had to dash up and replace it with mine. Unfortunately, for some reason, my laptop didn’t want to work with the projector under Ubuntu, but happily worked with it under vista, so I loaded that up, loaded up putty, and SSH’d into my irssi session. Anyone who saw this will probably agree that I need to be in less IRC channels!

Lunchtime next. I quickly ran off to McDonalds to grab some food (not wanting to have to stand in the long queue!) and headed back to set my laptop up with the projector for the big Twitter screen, which people seemed to enjoy (espescially Fiona!).

After lunch was the first Keynote from Cory Doctorow, who I’ve already mentioned before, is one of my favourite authors. Cory managed to give us a dark perspective on where life in the digital age could be going, and a rallying cry for us to fight against that (though surely,this is reminiscent of M1k3y?? I wonder if the DHS will be after Cory now!). I also managed to snag a copy of “Little Brother”, which Cory asked that we email a copy of the ebook to people after we’d read it. I’ll one up that, and tell you that you should go read it (espescially if you saw his talk!) If you want to be emailed a copy, please leave a comment and I’ll add you to the list I’ll be sending it to!

It was about this point that I started wanting to get onto IRC and chat to people. Unfortunately, my laptop is a right dodgy thing, and doesn’t like using wireless of any kind. Luckily, I had my E71 to hand, and so managed to get online with that (and it shocked me how easy it was to set up in Ubuntu). I ended up using this as my primary means to access the net throughout the conference. I just wish I’d had my E71 Desktop Charger with me, as I’d then have been able to charge my phone via USB at the same time! Unfortunately, it meant that I had to spend my time at the hotel flicking and changing between the charger for my phone and my laptop to try and keep them both going (why a hotel room only has one plug socket, I don’t know!)

Next up was “Mashing up the Guardian” and “Flickr for Formulas”. .. the second talk I don’t actually remember any of. But the first one was pretty interesting. I thought during it “Oh, I could link that up to twitter and generate a personal news feed based upon what they were twittering about. Unfortunately, the last few slides was showing someone who’d done exactly that. I guess my ideas aren’t that original!

Off to the Australian bar for the social, where I got rather tipsy, and chatted to some very cool people (thanks for the link to the Biltong seller Brad!)

Day 2

Bruce Eckel started the day off with the keynote. I was half asleep during this, having been out for most of the day, but I do remember that there were some pretty amusing pictures, and some good commentary. I also enjoyed the talk about unconferences, which led me to thoughts about possibly doing something similar for FizzPOP.

The day dwindled away with me running round until Bea’s talk “We need to fail, and we need to fail fast” – a very good insight into Agile Methodology (some of which we should probably adopt at work!). First barefoot presentation I’ve seen. Bea’s a very good speaker though, you can tell she has a lot of passion about what she’s talking about.

Next was a caged deathmatch. I didn’t really know much about Unit Testing in Python, being a bit of a n00b and all, but the talk was interesting nontheless. Even if I did end up running up and down the stairs like a trained monkey (ah well, I needed the exercise anyway!)

Next Keynote: Bletchley Park. I found this talk had some interesting content, but it’s delivery was a bit dry.

Then it was time for the GPG Keysigning. I’d left my ID in the hotel. What an idiot!

Lightning talks were next, followed by another keynote, followed by a spectacular fail trying to get Guido up on the big screen (10 second delays, him not hearing anything, and then the laptop battery running out). Alex took it in his stride though, the bow with a flourish was certainly amusing!

Off to the conference dinner. Good food, good conversation, good talk.

Day 3

I’m surprised I made it in. I was tired. Too much running around.

Tobias started off the day with a short talk on OSS, BSS, and Python, and then I went to the “Clean Code Challenge” talk, which was interesting, though I’m not too sure about the actual coding bit of it. There were a few things in the talk that I wish has been delivered to my bosses, but I’m not too sure the example “Clean Code” that was meant to be pythonised was the best code to work with.

Another Keynote, lots more lightning talks, and then a prize draw. I didn’t win anything, but I enjoyed myself.

After that, there was a “secret” organisers meal at the Hyatt Hotel. Good food and good conversation again.

And that was it, I headed home, and slept for 16 hours!

Thanks to everyone who made EuroPython a success. All the organisers, all the speakers, and all the delegates.

Though hopefully more people will help out next time. I don’t think Ciaran got to sit down for more than 5 seconds during the day!

2 Comments :, , more...

Django – S3 Storage Engine

by on Dec.02, 2008, under Personal

After having read James Bennett‘s article on Django Media and Performance I decided that I wanted to be using S3 for storing and serving media for a new site that I’m working on (in Django)

So, it seems that it’s not that easy. I did first of all experiment with using FUSE, but decided against it.

Anyway, looking through some obscure documentation, I found that Django can use custom storage methods. So, I thought I’d write one.

You can find the file here

The code requires you to have Amazon’s S3 API installed.

So, how do you use it? It’s pretty simple really. First of all – you need to setup your configuration – so edit settings.py and add the following (changing the values to suit your needs!)

S3_SETTINGS = {
    'aws_key': 'XXXXXXXXXXXXXXXXXXXX',
    'aws_secret_key': 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX',
    'bucket': 'bucket_name',
    'default_perm': 'public-read',
    'vanity_url': False
}

The settings should be self-explanatory – apart from ‘vanity_url’. S3 allows you to CNAME a domain name to a bucket with a similar name – for example, I could CNAME files.sourceguru.net to files.sourceguru.net.s3.amazonaws.com and it would allow me to serve information from that bucket as if they were coming from my own domain. (infact, I’m tempted to do this – I’ve too much stuff in my files section!) – the vanity_url – when set to True – will use the bucketname as the domain instead of <bucketname>.s3.amazonaws.com.

Now, to use it in a model, it’s as simple as adding an import line at the top of the models file

from site.app.s3storage import S3Storage

and then, in your model

class Item(models.Model):
    storage = S3Storage()
    image = models.ImageField(upload_to='path', storage=storage)

Pretty simple, :D

Hope this helps some people out there!

6 Comments :, , , , , more...

Looking for something?

Use the form below to search the site:

Still not finding what you're looking for? Drop a comment on a post or contact us so we can take care of it!