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.

Microsoft doing the same thing in Vietnam

I am not searching for Microsoft doing stuff, really I am looking for positive stories like the last one about Open Source being a decisive factor in purchasing fighter jets, however I keep stumbling over stories where Microsoft are telling governments not to use Open Source software.
http://wikileaks.org/cable/2004/04/04HANOI966.html
This one is from Vietnam, it seems Microsoft and the BSA have been round a load of governments raising the issue of proprietary software in use that has not been correctly licensed. This is a good thing. The problem comes when they argue at this level against open source and ask for consular assistance in reinforcing this message.

¶6. (SBU) Microsoft representatives also highlighted their
concerns about recent GVN comments that it plans to switch
to open source software (like Linux) to “fix” its IPR
problems. While acknowledging that the decision on what
type of software the GVN wants to use is up to the
Government, Microsoft asked us to help convey the message
that the GVN should not switch to open source for the “wrong
reasons.”
Switching to open source does not insulate the
GVN from the responsibility of ensuring that all software
used by the GVN is legitimately licensed, Microsoft
asserted. Econoffs noted they had already raised this issue
with the GVN.

GVN is Government of Veitnam but who is Econoffs I wonder?

Open Source Sells Planes

Another one from the Wikileaks archive, in which Japan choose Open Source European fighter jets over closed American fighters.
http://wikileaks.org/cable/2009/08/09TOKYO1813.html

While U.S. weapons are shrouded in secrecy like a “black box,” BAE
Systems takes pride in “open source.”
Latham said: “We are willing to meet Japan’s requirements, whether
it is licensed production or importation.”
MOD officials in charge of arms trade with the U.S. have taken note
of BAE Systems’ posture of emphasizing the merits for Japan. A
senior ASDF officer says:
“Actually, the top secret documents in the MOD mostly consist of
information on U.S. weapons. When parts designated as top secret
black box break down, they need to be sent back to the manufacturer
in the U.S. for repairs. Sometimes, these parts are left unattended
for extended periods of time due to circumstances on the other side.
It is possible that we will not be able to use them at a critical
moment.”

and just to rub in how much they value access to the source code:

When Tamogami was in active service, he told this reporter: “We need
only some 50 FXs. I have a feeling that since the number is small,
the U.S. will not object too strongly if we choose the Eurofighter.
If the U.S. is willing to open up the black box of the F-35, we are
willing to consider it.

Obviously in this example they might not be talking about Free Software as such, I have no idea if the BAE fighter control software is licensed under the GPL or another copyleft license or if it is more of a “published but proprietary” thing. Either way, having the right to know what their hardware is being commanded to do is important to Japan, and it should be to you too.

Microsoft pulling dirty tricks in Thailand

I had a bit of a poke about in the newly released Wikileaks diplomatic cables archive looking for interesting stuff and came across a cable from the Chiang Mai Consulate that contains an allegation that the Microsoft Thailand Corporate Affairs Director was explicitly bad mouthing Open Source and being critical of Thailands Creative Economy policy of promoting the use of legal Open Source software instead of using unauthorised copies of proprietary software. The open source community generally doesn’t have this level of access into the heart of government, which is one thing that we have been working to fix in the UK with our friends at Open Forum Europe (who I work for part time). It really is important for the community to support organisations and individuals that can provide a credible voice at a high level and advocate for Open Standards, Free Software (yeah, approximately synonymous with Open Source) and a level playing field through the interoperability of systems and a lack of vendor lock in.

http://wikileaks.org/cable/2010/02/10CHIANGMAI18.html
---------------------------------------------
IPR: Concern Over Open Source Software and Data Protection
---------------------------------------------
9. (SBU) Microsoft-Thailand's Corporate Affairs Director
identified software copyrights as a big issue. On the one hand,
he praised the Thai government (RTG) for strengthening its IPR
enforcement and education efforts, and said Microsoft was "very
pleased" that Thailand's software piracy rate has decreased by
two percent a year since 2006. On the other hand, he expressed
concern over the RTG's Creative Economy policy of promoting the
"open source" software model over the "commercial source" model
as a means to curb piracy. (Note: this is an issue for IT
companies worldwide, and not unique to Thailand).

10. (SBU) The Business Software Alliance (BSA) Director for
Software Policy-Asia also urged the RTG not to favor open source
over commercial source. He argued that (1) the open source
model has been shown to have an insignificant impact on reducing
software piracy; and (2) by focusing on an open source policy,
the RTG signals the market to stunt the development of
commercial source software, which in turn undermines Thailand's
ability to fully service market needs.

In case you think this post is Microsoft bashing, I generally don’t pick on Microsoft, they are by no means the only big bad wolf out there. Remember, I didn’t pick Microsoft for this post, they picked the Open Source as the thing they wanted to get rid of in Thailand. There were other proprietary vendors in the meeting, the main anti-open source quote was attributed to Microsoft, but this kind of thing goes on all the time. The anti-FUD message needs to be just as strong and persistent.

« Previous PageNext Page »