OT: Chillies 2012

It’s that time again.

This evening (Saturday 21/01/2012) I have sowed 13 varieties of chillies, just over 50 seeds! I’m very excited about the prospects for the year ahead but have absolutely no idea what I will do if I have 50 plants to tend – they won’t all fit in our small greenhouse and we don’t have a conservatory… Suggestions welcome.

From the left there is “Black Naga” which I managed to grow last year and by the end of October the pods had ripened to a dark chocolate brown colour. They were hot too :-) . Next is a Red Habanero – These seeds were a gift from my sister-in-law and I have no idea what they will be like but Habaneros are generally quite hot and a have lovely fruity flavour. Finally in this tray is Goat Horn which I also grew last year and they were an absolute delight! A lovely traditional torpedo shaped chilli with a great flavour. They aren’t blisteringly hot but a very, very nice chilli.

In this tray I have the famous “Dorset Naga” which has been a reliable variety over the last two seasons. Hope these seeds still germinate OK. Next is a Bhut Jolokia and to be honest I can’t remember where these seeds came from or if I have grown from this packet before, but there were only 5 seeds in the bag so they have all gone in the tray. Finally is another Habanero style called Congo Trinidad.

I have two varieties in this tray I also grew last year from the first time and liked them so much am growing again: Aji Crystal was quite prolific and produces big meaty chillies with a nice (but not insanely hot) kick. The Lemon Drop on the other side was also quite a good cropper and I loved the bright yellow chillies. These look great on the plate and taste yummy too – a slight citrus note. In the centre is a new variety for me this season – The Habanero 7 Pot. Called the 7 pot apparently as this is how many pots of stew one chilli will flavour! I’m really looking forward to getting these on my tongue!

Here are the “HOT Ones”… The Naga Viper held the hottest chilli world record in 2011 for a while at around 1.4million Scovilles! However within just a few days this Viper was beaten by the Trinidad Scorpion “Butch T” which was measured at just under 1.5million Scovilles. Also in this tray is a chilli called Portugal, which is a Jumbo Cayenne type. Not in the same league heat-wise as it’s 2 neighbours but I like a bit of variety.

And finally, I remember growing this one a few years ago and being pleasantly surprised so I thought I’d give it another go. It’s Italian seed with a description of Peperoncino piccante tondo calabrese. It’s a round chilli that is commonly used for stuffing or in salads. I recall it having a nice punch and the plants being excellent croppers.

I’ll provide updates through the year as, hopefully, the seeds germinate, plants grow and bear fruit.

Ubuntu IRC Council

The new Ubuntu IRC Council was announced this week and I am pleased to have been appointed to it. The Ubuntu project makes extensive use of the Freenode Internet Relay Chat network, with a team of operators doing a grand job keeping it all running smoothly for the thousands of users online each day. The IRC council has a few duties to assist the team, which you can read about in more details here https://wiki.ubuntu.com/IRC/IrcCouncil. Our first open team meeting will be on the 14th January at 11:00UTC in the #ubuntu-meeting channel, we have decided to keep the same meeting schedule as the previous council as it seems to work for most people. If you have any questions about the council do feel free to join our meeting or find us on Freenode IRC, we are all very approachable and here to help.

ERPpeek, a tool for browsing OpenERP data from the command line

We have been rather busy implementing OpenERP for a number of our customers and I have been tweaking and customising and extending it all over the place. It is a great fun product to work with, very flexible and Python is a really nice language to use. One thing I have been finding is that as a developer I really want to know more about the fieldnames and field values that are stored behind the scenes on an object, I want a command line utility to allow me to inspect a particular document and figure out why it displays what it displays etc. There might be one out there somewhere, but I figured it would be more fun to write my own, so I did. The best way to show how it works is with an example

./erppeek.py -d testdb -u admin -p admin -m res.users 1

in it’s simplist form that will connect to an openerp server running on localhost, (port 8069) with username admin and password admin to a database called testdb. It will then return all fields for the model res.users with id 1 (which will be the admin user)

./erppeek.py --server 'http://myserver.com:8069' -d testdb -u admin -p admin -m res.partner 1 3 5

This connects to a remote server called myserver.com and returns all fields from partners 1, 3 and 5

./erppeek.py --server 'http://myserver.com:8069' -d testdb -u admin -p admin -m res.partner -f name -f city 1 3 5

and now we are using the -f field parameter to return just the name and city (and it always returns the id as well) of those partners

./erppeek.py --server 'http://myserver.com:8069' -d testdb -u admin -p admin -m res.partner -f name -f city -s "name like School" -s "city = Southampton"

This time it is not relying on us passing in a list of object IDs, but it is doing a search of the res.partner objects where the name field contains ‘School’ and the city field is equal to Southampton.

To grab a copy of this small but handy little utility please download it from launchpad and make it executable. It works fine on Ubuntu, and should work on most platforms with Python. Do let me know in the comments what you think of it and what else you would like it to do.

Security note – this does at the moment get you to enter a password on the command line, which means the password will be available in your bash history and other users on your computer looking at processes you are running. This doesn’t bother me much as I am only using it on local development databases with trivial passwords anyway, but you have been warned. If someone wants to help fix that then great.

Free Ubuntu 11.10 CDs for the UK

Today the Ubuntu UK LoCo team CD allocation arrived from Canonical, as is traditional I have upgraded the Kubuntu CD that my chickens peck at. I have a different set of chickens to the ones in the last photo due to a series of unfortunate events. In July we restocked by purchasing three rather young hens, Specky, Chocolate and Snowdrop who entertained the crowds at the Oggcamp Crew BBQ and have been growing fast ever since. Pictured here with the new Kubuntu CD is Specky. We wanted three nice new hens to lay lots of eggs and they are approaching egg time. Of the three, Specky has grown the fastest and has a nice comb and a tail and really is quite a lot bigger than the others and . . . actually Specky is looking a bit um, butch, for a hen. . . and those cockadoodledoo noises are not a good sign. I think we may have a problem here. Girls are lovely and useful and hard working. Boys are big, noisy and useless. I think Specky needs to urgently get in touch with it’s feminine side and lay some eggs, or there will be a less full henhouse and a more full curry pot.

Anyhow, back to the subject of this post, which is the CDs. If you are living in the UK and want an Ubuntu CD, a Kubuntu CD or an Ubuntu Server CD (or combination thereof) then you are most welcome to one. Please follow the procedure and I will send one out to you. For a while I will also include an 11.04 CD until I run out of them. If you want more than one CD then do ask me and we will try and work something out particularly if you are wanting to distribute them at a University or similar.

I almost forgot to mention, I removed their old Kubuntu 11.04 CD and washed the muck off and stuck it in a desktop, it still boots!

If all else fails, switch to Open Source

An element of comedy in the open source cable of the day, this one is from Latvia in 2008. The country is facing significant economic issues and they are trying to reduce their public sector costs. They are OK with reducing spending, cutting staff, postponing wage increases, but if that doesn’t work they will have to take drastic measures . . .
http://wikileaks.org/cable/2008/10/08RIGA644.html

Next year’s central government budget proposal, which the Cabinet
of Ministers has now submitted to the parliament for review, has
dominated the headlines in Latvian media in recent weeks. The
Cabinet has been struggling to prepare a budget with a target
deficit rate of 1.85% of GDP by reducing ministry spending,
eliminating staff positions, postponing planned wage increases for
public sector employees, and even proposing measures as drastic as
closing specific ministries and switching to open source software.

Labor unions and other affected parties have met these proposals
with strong condemnation.

Sounds like switching to open source would release a saving in the order of magnitude of closing a ministry.

Hello World in Python

Today I ran a class session as part of the Ubuntu Application Developer week. My topic was a really basic introduction to python, starting with the traditional “Hello World!” program and here is the transcript from the logs:

[19:01] good morning/afternoon/evening all
[19:01] welcome to this Application Developer week session on Python
[19:02] so after jderose turning things up to 11 we are going to go back and start with 1 2 3
[19:02] This session is an introduction to Python from the very very beginning, I going to do my best to assume no prior knowledge at all.
[19:02] just so I can see who is here say hi in the #ubuntu-classroom-chat channel o/
[19:03] great, I love to have an audience :)
[19:03] so Python is a programming language, but not a scary hard one.
[19:03] Python is kind of like BASIC, except you don't have to be embarrassed about saying you are a Python programmer!
[19:04] we are going to write a computer program, which is a set of instructions to the computer to tell it to do some interesting stuff for us.
[19:04] Lets get set up first, we are going to need a text editor to write the instructions in and a terminal to tell the computer to do the instructions.
[19:05] hopefully you will find them next to each other in the Applications-Accessories menu
[19:05] or if you are using unity hit the super key and type gedit and return for the editor
[19:05] and terminal for the terminal
[19:06] they are also somewhere to be found in the apps lens, but that is another story altogether
[19:06] so open both of them now and get comfortable with the three windows on screen, IRC, terminal and gedit
[19:06] are we sitting comfortably?
[19:07] plain old text editor is perfect, none of your fancy IDEs for this session
[19:08] Traditionally the first program you should write in any language is one to get the computer to say hello to the world! so lets do that.
[19:08] in the text editor type the following:
[19:08] print "Hello, World!"
[19:09] that is it, your first program, now lets save it and run it (I did tell you it looked like BASIC)
[19:09] file-save as and call it hello.py
[19:09] this will save it into your home directory by default, fine for now, but you would probably want to be a bit more organised when doing something serious
[19:10] feel free to be more organised right now if you like :)
[19:10] ok, now in the terminal lets run the program
[19:10] python hello.py
[19:10] did it say hello to you?
[19:12] as I saved it in the home directory and terminal starts there by default it should just work, if you are putting things in folders you might need to navigate to it with the cd command or specify the path to the program
[19:13] ok, so that was running the program by running python then the name of our application, but we can do it a different way, by telling Ubuntu that our program is executable
[19:13] What we are going to do now is try to make our program directly executable, in the terminal we are going to CHange the MODe of the program to tell Ubuntu that it is eXecutable
[19:13] so at the $ prompt of the terminal type:
[19:13] chmod +x hello.py
[19:14] now we can try to run it
[19:14] again at the $ prompt
[19:14] ./hello.py
[19:14] oh noes!!!
[19:14] Warning: unknown mime-type for "Hello, World!" -- using "application/octet-stream"
[19:14] everyone get that?
[19:16] ubuntu doesn't know how to run this application yet, we need to add some extra magic at the top of our program to help it understand what to do with it.
[19:16] back in the editor, above the print "Hello, World!" add the following line
[19:16] #!/usr/bin/env python
[19:16] so the /usr/bin/env bit is some magic that helps it find stuff, and the thing it needs to run this application is python
[19:16] now you should be able to save that and flip back to the terminal and run your program
[19:17] ./hello.py
[19:17] that should now run :)
[19:18] as has been pointed out in python 3 you need to put brackets round the string so
[19:18] print ("hello world")
=== mohammed is now known as Guest99895
[19:19] which works in all versions of python
[19:20] OK, lets go on to the next concept, giving our program some structure
[19:20] back to the editor, and between the two lines we have already add a new line
[19:20] while 2+2==4:
[19:20] and on the next line put four spaces before the print ("Hello, World!")
[19:20] and save that
[19:21] Moshanator asked: can i just ./hello.py?
[19:21] lunzie asked: ​ are the quote brackets proper form?
[19:21] the brackets round the quotes are better form as they work on python 3
[19:22] so the while statement we added starts a loop, in this instance it will carry on until 2+2 is equal to something other than 4
[19:22] the double equals means "is equal to" a single equals is used to assign a value to something (more on that later)
[19:23] the colon at the end is an important part of the while statement
[19:23] There is no "until" "wend" "end while" type statement at the end, as you might expect to find in lesser languages :)
=== yofel_ is now known as yofel
[19:23] the indentation of the print statement is not just cosmetic and for our benefit
[19:23] the indentation level is part of the language, when the indentation stops that is the end of the loop (or other structure that you might expect to have an end)
[19:24] this means that python always looks neat and tidy (or it doesn't work)
[19:24] Always use four spaces to indent, not three, not five and certainly not a tab.
[19:24] Other indentations will work, but if you ever have to work with anyone else you must always be using the same indentation, so we all get in the habit of using four spaces.
[19:24] in gedit you can set it up to use 4 spaces instead of a tab
[19:25] edit-preferences, on the editor tab choose tab width 4 and insert spaces instead of tabs
[19:25] many other editors and IDEs have a similar option
[19:25] Lets run our new program, just save it in the editor and run it again in the terminal with ./hello.py
[19:26] and that is 4 spaces per level of indentation you want so if you have a loop in a loop then the inner one will be 8 spaces indented
[19:26] now we can wait for 2+2 to be something other than 4
[19:26] * AlanBell taps fingers
[19:27] or, if you are in a hurry, you can press ctrl+c
[19:28] ok, so ctrl+c is handy for breaking in to an out-of-control python program
[19:28] you can do other fun stuff with the print statement, if you change it to read:
[19:28] print "Ubuntu totally rocks! ",
[19:28] and run it again (note the comma at the end)
[19:29] print ("Ubuntu totally rocks! "), <- for the python 3 contingent I should think
[19:30] it should fill the terminal with text
[19:30] the comma prevents it doing a newline
[19:31] ctrl+c again to break out of it
[19:31] lets do something different now
[19:31] in the terminal, type python at the $ prompt and hit return
[19:31] you should have a >>> prompt and a cursor
[19:32] this is the interactive python console
[19:32] you can type print("hello") here if you want
[19:32] or do some maths like:
[19:32] print 2**1000
[19:32] which will show you the result of 2 multiplied by itself a thousand times
[19:33] python is kinda good at maths
[19:33] you don't need the print statement here either
[19:33] so 2**1000 should work in python 2.7 or 3
[19:34] you could even try 2**100000 it won't take long, and you can always stop it with ctrl+c
[19:35] while we are on the subject of maths, lets get the value of pi
[19:36] print pi won't do anything useful (but feel free to try it)
[19:36] we need more maths ability than the python language has built in
[19:37] so we need to get a library of specialist maths stuff, so type
[19:37] import math
[19:37] it will look like it did nothing, but don't worry
[19:37] now type
[19:37] math.pi
[19:37] >>> import math
[19:37] >>> math.pi
[19:37] 3.141592653589793
[19:38] So we have seen here how to import a library of functions to do something, and called one of the functions from the library (to return the value of pi)
[19:39] ok, so what is in the math package, apart from pi?
[19:39] try typing dir(math) at the python console
[19:39] ['__doc__', '__name__', '__package__', 'acos', 'acosh', 'asin', 'asinh', 'atan', 'atan2', 'atanh', 'ceil', 'copysign', 'cos', 'cosh', 'degrees', 'e', 'exp', 'fabs', 'factorial', 'floor', 'fmod', 'frexp', 'fsum', 'hypot', 'isinf', 'isnan', 'ldexp', 'log', 'log10', 'log1p', 'modf', 'pi', 'pow', 'radians', 'sin', 'sinh', 'sqrt', 'tan', 'tanh', 'trunc']
[19:40] you can also look at http://docs.python.org/library/math.html
[19:40] callaghan asked: Is there a way to see which functions are in the imported library?
[19:40] yes :)
[19:41] and to get more descriptive help on each one try help(math)
[19:41] so dir() lists the names and help() lists names, parameters and a little bit of help text
[19:43] TheOpenSourcerer asked: is help() a python function useful for anything else?
[19:43] try help(help)
[19:44] it is a function that could be used, I can't off hand think of any particularly useful use of it other than for getting help
[19:44] Mipixal asked: Your favourite IDE for dev with Python, on bigger projects. (In before IDE flame wars :p )
[19:45] honestly my favourite is gedit
[19:45] I have used eclipse and pydev
[19:45] and I liked stani's python editor (SPE) for a bit
[19:46] but all I really want is a text editor with syntax highlighting
[19:46] and normally several terminal windows open across a couple of monitors
[19:46] All this command line stuff is all very well, but we want to do applications that have pretty windows and stuff!
[19:47] In the interactive console type or paste the following
[19:47] import gtk
[19:47] which will load a library full of stuff to do with the gtk toolkit that powers the gnome desktop
[19:47] now type
[19:47] foo=gtk.Window(gtk.WINDOW_TOPLEVEL)
[19:47] that assigns a window object to a variable called foo
[19:47] (the name doesn't matter, the single equals does)
[19:48] but nothing much seems to have happened yet, so type:
[19:48] foo.show()
[19:48] yay, a real live little window should be on screen now!
[19:49] lets see what we can do to it with dir(foo)
[19:49] quite a lot! lets try:
[19:49] foo.set_title("my little window")
[19:49] go ahead and change the title a few times
[19:50] so if you type "foo.show"
[19:50]
[19:50] There are 10 minutes remaining in the current session.
[19:51] you get printed out a reference to where the code for the show function is
[19:51] you need to do foo.show() to actually call the function
[19:51] ahayzen asked: In gedit is there anyway of adding code completion for python programming, like pydev in eclipse, via a plugin?
[19:51] teemperor asked: is there any naming convention in python? (because of set_title)
[19:52] ahayzen: I believe there are some plugins for that, last time I tried one it was rubbish though
[19:53] if anyone has any good ones I would be interested to know of them
[19:53] teemperor: http://www.python.org/dev/peps/pep-0008/ here is the python style guide
[19:54] many projects have their own more detailed conventions for object names
[19:54] everyone agrees on the indentation levels though :)
[19:54] Alliancemd asked: In a program changelog I saw a developer saying that he ported the code from python to java to make it faster and he said "because java is sometimes x10-x100 times faster than python". We know that java is very slow, does python have this big impact on speed?
[19:55] this is a myth
[19:55] There are 5 minutes remaining in the current session.
[19:55] sometimes java does take a while to start if it has to launch a JVM, this gave applets a reputation for being slow
[19:56] once up and running it is not particularly slow
[19:56] unless you are doing something massively time sensitive (where every nanosecond counts) then any language will do any task
[19:57] the performance problem is never the language, it is always the algorithm
[19:57] normally rewriting code so that it does fewer disk or database accesses will speed it up thousands of times more than changing the language it is implemented in
[19:58] Alliancemd asked: What do u think of PyQt? Is it that good how people say?
[19:58] mohammedalieng asked: what about python performance compared to Java ?
[19:58] callaghan asked: will there be a follow-up lesson, or where should unexperienced python-devs go from here?
[19:59] not played with Qt much
[19:59] there are some great books
[19:59] snake wrangling for kids is excellent
[20:00] and the dive into python book is in the repos, you can install it from software centre
[20:00] I believe there are other python classes in this channel so check the schedule
[20:00] Logs for this session will be available at http://irclogs.ubuntu.com/2011/09/05/%23ubuntu-classroom.html
[20:00] ok, think I am out of time
[20:00] thanks everyone o/

It was great fun to do, and thanks to David Planella and the classroom team for putting on these regular educational events.

Next Page »