Thursday, May 31, 2007

First week of Summer of Code

The coding period of Google Summer of Code has officially started (since the 28th of May). A meeting was held on Tuesday for students and mentors working on Jabber projects.

So far...


The laptop


I have set up my new laptop for development, including development tools (subversion, SciTE), and server that I will be using to test my code against.

The server


I have chosen Openfire to be my reference server initially, although obviously I will be testing to ensure compatibility with all servers later on (just in case...). Openfire is easy to install and use, and includes XEP-0124 support by default.

Other implementations


I am interested in finding other clients or their developers that have XEP-0124 implemented already. It would help me make the final decisions this week about the way I will be implementing it. If you know something about it, or know someone who does, please contact me!

The code and protocol


Gloox thankfully already has a nice framework for adding new network-level connection methods. It is this way that HTTP proxy and SOCKS5 support has already been added. Thanks to Jakob's foresight it is also possible to chain multiple classes so that BOSH will be able to work though a SOCKS5 proxy, for example.

I need to create a class descended from ConnectionBase and write implementations of the pure functions from it. I will also have to descend from ConnectionDataHandler to parse the replies from the BOSH connection manager, before gloox is able to parse and handle the XML.

The main difficulty I have right now is deciding which BOSH parameters should be fixed in the implementation, and which should be configurable. I am also looking to see if I can make the connection degrade gracefully from HTTP pipelining to multiple connections, to polling, depending upon what is supported/available in the current environment.

Identifying possible client environments is also one of my tasks. This way I won't end up, for example, only supporting cases where the connection manager is at the same address as the XMPP server (which in the setup I will be testing with, it is).

From now on


I will be posting weekly updates to this blog, and I have decided I will aim for every Tuesday, before or after the weekly meeting. Watch this space!

PS. In the past couple of weeks I have seen BOSH spelt as BISH, NOSH and BOX. Stop it! :D

Tuesday, May 22, 2007

The Linux shell, a new user's friend?

Paul made another post yesterday, about the merits of the Linux text shell, and whether it was an ideal interface for new Linux users to have to learn.

So, they say that Linux forces users to learn how to use the shell and that, basically, Linux can't do anything without it.
It is a common argument made by Windows advocates, that it is impossible to use Linux without using the shell. I am glad to say, this is just not true.

Everyone knows that Linux grew from a shell-only interface, X and GUI applications came (much) later. Over the years Linux gained an image of being the hacker's operating system. It is far easier to hack (NOT 'crack') than Windows is.

Linux is growing beyond that now. Distributions (yes, I am saying it again) such as Ubuntu are doing their best to keep the shell to only those people that want it, and not require the people who don't to use it. In reality it is perfectly possible to use an Ubuntu system without knowing anything about the shell. There are graphical applications for practically any task you need to perform. I believe a little more could be done (ie. a GUI way to run programs as root), but still we are practically there already. One problem is that Linux tutorials nearly always show only shell way of doing things. This is at least better than Windows where a long how-to like this ("Click this tab, tick that box, click ok, oh, and again, and again...") could usually be done in a single command that could be copied and pasted.
Are shells good or not?
Yes, yes they are. There is no doubting the power of the shell. It is pretty easy to get started, you don't have to be a computer expert either. Knowing how to use the shell can help you take advantage of certain features in Linux that make it better than other operating systems - the possibility to bring it back to life from practically any crashed state, without data loss, and nearly always without rebooting. (Perhaps a simple how-to on this topic is in order... :) )

ObsidianLake: Another quarrel with my good friend...

In Paul's recent post about whether Linux is ready for the desktop, he debates whether there is a demand for Linux, and asks:

"Should or will Linux become a commercial product?"

I think we should look at how Linux started out, where it is now, and where it is heading.

For a start, the Linux kernel was started with entirely different goals to the components that make up the rest of a GNU/Linux system. Linux was not begun with intention of being free (as in freedom). It was a personal project of Linus. For GNU on the other hand, the philosophy came first. Ten years ago there was little commercial worth in either of these ventures, only once they were combined into a usable system would things start to gain interest and momentum.

GNU/Linux in the present day is doing quite well. It has taken a long time, but it is now ready for the desktop. GNU/Linux is earning recognition from both hardware and software makers, and the number of users is snowballing. I have to say this is in no small way helped by Ubuntu and a couple of other easy to use distributions. It is important to note that all of the most popular ones are free. Now that Linux is comparable to Windows in practically every way, what else is there to compare on, except the price? This is why I believe that free distributions will always be the most popular. Commercial distributions have their place almost only in the enterprise market.

Into the future? GNU and Linux will remain free, and Microsoft will have no choice but to switch away from its reliance on Windows being the dominant OS if it is to survive. Windows was the first easy to use OS, and it brought the possibilities of computers to those who would otherwise never have had it. This is the only reason it is on 99% of PCs today. Now that GNU/Linux is a competitor, with the added advantage of being free, Microsoft have no choice but to re-think their business. Very soon Haiku is also going to raise the BeOS community from the (un)dead, and this will only stir the mix even more.

Concluding by returning to the original question, is Linux a commercial product? No, at least, not while we are talking about the home-user's desktop. Should it become commercial? Well, supposing it did, it would lose one of the best things it has to attract people on the OS centre-ground - its freedom.

Sunday, May 20, 2007

C and C++

I think it is quite true to an extent...
A conjecture regarding C (and C++ too, although less so)...

Nice blog too, it's going onto my reading list :)

My favourite way to make an application at the moment is to create low-level (and possibly all platform-specific code) in C/C++, and then handle logic in Lua. It allows for a lot of flexibility, and faster development time. Lua should be better known :)

Making Scite the default editor in GNOME (Ubuntu)

For too long I was fighting with gedit, the default text editor in Ubuntu. While it is not too bad, Scite is far more powerful, and much better.

To install Scite, you can type the following in Terminal:

sudo aptitude install scite


I had the option of changing the editor associated with each of the file types in Nautilus (which is what I did on my desktop), but I was sure there must be a better way. I found it...

sudo aptitude install scite
cd ~/.local/share/applications
echo -e "[Default Applications]\ntext/plain=scite.desktop" >defaults.list
killall nautilus

Works a treat. Also, here is my Scite settings file:

line.margin.visible=1
default.file.ext=.lua
open.dialog.in.file.directory=1
check.if.already.open=1

Tip: A per-folder settings file can be created. For example, I have created a 'SciTE.properties' file in the gloox src folder, so Scite will automatically use the correct indentation for gloox, and insert spaces when I use the tab key.

Update: I found later that this only tells scite to open plain text files. If you are dealing with code (as I am) add the following lines too:


text/x-csrc=scite.desktop
text/x-c++src=scite.desktop
text/x-chdr=scite.desktop


If you want to add other file types, find the MIME type by right-clicking on a file and selecting 'Properties', the MIME type you need to know is listed there.

Who am I?

I asked this very question, and found my answer:

You are C++. You are very popular and open to suggestions.  Many have tried to be like you, but haven't been successful
Which Programming Language are You?

Ubuntu on my new laptop (+ how-to)

Yes, my laptop (Toshiba A100-062) did arrive, and yes I had installed Ubuntu within the hour :)

I installed the latest version, 7.04, and had no trouble at all. A far cry from the way Linux used to be, absolutely everything worked out of the box. Once that would have been something uncommon, especially on a laptop. Certainly a pat on the back goes to the Ubuntu developers, and all who contribute directly or indirectly to it.

One of the first things I did was install Beryl, a 3D window manager. A full-quality video of it is here (if you're on Windows and it won't play, you need the Ogg Theora codec, try VLC video player, I think it works there).

A couple of things I would like to document here, in case they help anyone...

Memory card reader

At first I thought it wouldn't work (since that is what a lot of people told me). Sure enough, putting an SD card into the slot did nothing. However I forgot to remove it, and I rebooted with it still in the slot. It seems this was enough to trigger Ubuntu to recognise it, and mount the card.

It worked absolutely fine, until I tried a new card. The one that works is 256MB, and the one that doesn't is 2GB, so perhaps it is incompatible with the reader.

A couple of filed bugs for Ubuntu caught my eye:
Ubuntu Bug #53923
Ubuntu Bug #105284

I get the output posted there while the card is in the slot (Ubuntu tries to load it, fails, and tries again and again...).

ubuntu kernel: [ 3545.540000] end_request: I/O error, dev mmcblk0, sector xxxxx

I still have to test the card in this reader in Vista, so I can be sure it is not just a hardware incompatibility.

None of the workarounds posted in comments to those bugs worked (though I admit I did not try compiling new drivers, I am using the Feisty tifm module). I expect this will be fixed in an update.

Update: It decided to start working all by itself... :D Don't ask me what it was all about.

Second update: In fact this problem seems to be a completely intermittent problem. Sometimes it will work, sometimes it will not. When it doesn't work, I have yet to find a way to fix it, except to repeatedly remove and re-insert the card. Hopefully the next kernel will indeed fix this.

Touchpad
I knew there was a program called 'GSynaptics' which allows extra configuration of your touchpad. Being me, I had to install it. I got an error that I needed to set SHMConfig to "true" in xorg.conf. Not very helpful. Here is what I really had to do:

If you have a section that says "Synaptics Touchpad" in /etc/X11/xorg.conf already, you can just add the line:

Option "SHMConfig" "true"

to the section for the device. You must be root to edit this file, so run 'gksudo gedit /etc/X11/xorg.conf' for a GUI or 'sudo nano /etc/X11/xorg.conf' in Terminal.

If you don't have such a section, add this somewhere in /etc/X11/xorg.conf:
Section "InputDevice"
Identifier "Synaptics Touchpad"
Driver "synaptics"
Option "SendCoreEvents" "true"
Option "Device" "/dev/psaux"
Option "Protocol" "auto-dev"
Option "SHMConfig" "true"
EndSection
Close all your applications, log out, and press Ctrl+Alt+Backspace to restart the X server. If you haven't already, install GSynaptics.

Supend to RAM (Sleep), Hibernation and Resume

Although initially working, and working at the time I made this post, I have added this section when I discovered that somehow suspend/resume was broken. I fixed it by doing the following:

Change these options in /etc/default/acpi-support:

SAVE_VBE_STATE=false
POST_VIDEO=false
DOUBLE_CONSOLE_SWITCH=true

Note: I also changed: MODULES="tifm_core tifm_sd tifm_7xx1"
This probably isn't right, but I'm too lazy to change it back right now :). I am concerned that it may lose write-cache data for the SD card if you suspend to RAM. Maybe it won't, but you have been warned!

Next, reboot, and immediately press F2 to enter the BIOS. Change "Enable support for legacy USB devices" to 'Disabled', then Save and Exit.

Test suspend/resume, it should work. If you have a problem with the keyboard/touchpad not working after resume, download the patch (and apply it with the instructions) from this blog post.

Suspend/resume now works fine for me.

LCD Brightness

Maybe not an issue for most people. For some reason the LCD brightness controls in most places don't seem to work, yet controlling the brightness manually is possible.

Create a file /usr/bin/setbrightness:

sudo nano /usr/bin/setbrightness


Paste into it this:

#!/bin/bash
sudo sh -c "echo $1 > /proc/acpi/video/VGA/LCD/brightness"

Press Ctrl+O to save, and Ctrl+X to exit. You can now change the brightness with:
`sudo setbrightness 10` (this is the lowest brightness)
Possible values are: 10 25 35 50 60 75 90 100 (other values will be ignored)

To allow any user on the system to use setbrightness with no sudo:
`sudo chmod a+w /proc/acpi/video/VGA/LCD/brightness` (without the quotes)
This may not last between reboots though.

Links (the places from which I gathered all the information I used):
Debian Etch on a Toshiba Satellite A100-159
Ubuntu: Synaptics Touchpad

Also, how to automatically switch off the touchpad while you are typing (I haven't tried it yet):
Disable Touchpad While Typing - Ubuntu Forums
Ubuntu Tutorials - Temporarily Disable Touchpad While Typing
Disable Touchpad Tapping While Typing - Ubuntu Forums
Toshiba Satellite Laptop Success Story -Ubuntu Forums (Where I found the suspend/resume fix I wrote above, slightly modified for the A100 with Intel graphics)

Sunday, May 06, 2007

Versioning FIle System

I haven't tried it, but the idea is a good one. Every time you create, modify, or delete a file, Ext3Cow records the changed part of the file in a different place on the disk, preserving the old data that was in the file.

Using this system it is possible to find out what any file was like, at any given point in time. There is even a file manager that supports browsing ext3cow volumes.

There are many applications for this kind of file system, especially in places where revision control tools (CVS, SVN...) will not suffice.

New Laptop

Finally I ordered a laptop for myself. I've been saving up for a while, but now I will be able to use my GSoC money towards it also. It should be arriving this week.

I'll be probably doing most of my development on it, so the first thing I will do is install Ubuntu alongside the pre-installed Vista. Yes, because I still need access to Windows for testing things, I will probably keep Vista, but reduce its partition size and dual-boot it.

Seeing as I have never used Vista before (only looked over someone's shoulder) you can be sure I will be posting a Vista vs Ubuntu right here very soon :)

OLPC and Microsoft

The OLPC project is hoped to bring computers, technology, and even the internet to those who currently have no access to it. Since the project began it has been known to have been intended to run a version of Linux. Despite recent rumours that OLPC had been persuaded otherwise by Microsoft, the OLPC is, and will remain, "a free and open-source shop.". Microsoft on the other hand have their own project to reach to the same user base as the OLPC - they will introduce a new $3 bundle of software (the BBC article linked to also draws parallels between the 2 projects).

The AACS Saga

It is unlikely that many missed this one. At one point it was even responsible for the news site Digg going offline...

It started when details of a crack for scrambled HD-DVDs was posted on the internet. This crack involved a (supposed to be) secret key used to decode the DRM-enabled DVDs. It caused quite a storm, and spread across the internet, mainly through blogs. Bloggers excercising their right to free speech posted the key. Obviously it was not long before the story got 'Dugg'. However after the AACS-LA announced that it was prepared to take legal action against those publishing the key, Digg began censoring stories linking to the number.

Disgruntled Digg users rebelled, and began mass-posting stories about the crack to the site. The whole issue has become something of an internet phenomenon, and the key can be found from T-Shirts to well, anywhere! In the end forcing Digg to side with its users, saying they had made their wish clear.

Though the AACS-LA's threats have stirred up internet users worldwide, and only served to publicise the key more than ever before, a more important story may have been forgotten. There exists a crack published a while ago that can not be revoked the way this infamous key has been. A much deeper flaw exists in the copy protection method itself. Perhaps HD-DVD and the video industry in general will go the same way as the music industry, which is now shifting away from DRM.

Microsoft gives guidance on OS design

Some of you may have tried Windows Vista. It has a great new feature 'User Account Control', or UAC.

UAC allows users with administrative privileges to use the PC without the privileges enabled, until they are required. When a program requires the extra privileges, Windows pops up a dialog, describing what program is asking for administrative rights, and you must enter your password to continue. This is a great feature, and it makes using the computer for everyday tasks much more secure. For example, if your web browser was compromised, it would be limited in what damage it could cause, unless you had previously granted it administrative rights.

You may wonder why I am telling you this (you probably already know about UAC). However Microsoft have publicly said last week how great UAC in Vista is (though it hasn't stopped Apple making fun of it!). In fact they recommend that other operating systems should support it too!

"If you look at it from an architectural direction User Account Control is a great idea and strategically a direction that all operating systems and all technologies should be heading down," -- Peter Watson, Microsoft Australia's chief security advisor.


Chief security adviser? He must have used Linux, even briefly, at some time, right? This is a feature that Linux has had since the beginning, in the form of 'su' and 'sudo'. Before you think otherwise, no, Windows Vista was not even the first OS to bring it to the desktop! Here is a screenshot of Ubuntu:

Ubuntu 7.04 Released

I was originally posting a single, long post, of interesting news since I last posted. I decided to split it up though, so here goes...

Well, Ubuntu version 7.04 ('Feisty Fawn') has been released, and I'm running it :) Not too much has changed, except that this time I decided to opt for the standard Ubuntu, and not Xubuntu which I have been running up until now.

There is no particular reason for this. I still love Xubuntu, I'm just going for a change, that's all. Putting up with GNOME, too :) That said, I am not finding resource usage /that/ much higher than Xubuntu. I find that Xubuntu's interface is actually far more intuitive, and far more customisable - perhaps this is from being an ex-Windows user. However the GNOME interface wins in features, and it is well polished.

EDIT: I also forgot to add that the next version has been announced too, and it will be 7.10 'Gutsy Gibbon'!

Dell will offer Ubuntu


Dell are set to offer Ubuntu pre-installed on their consumer PCs. This news comes not long after Michael Dell was discovered to be running Ubuntu 7.04 (which was still a release candidate at the time) on his laptop. This is a huge step forward for Ubuntu, and desktop Linux. Perhaps the age-old argument "Is Linux ready for the desktop?" finally ends here...

Linutop


A small, power-efficient, inexpensive computer/device, that runs not only Linux, or even Ubuntu, but... Xubuntu! Linutop has many possibilities, especially with being so portable. Media streaming (if the CPU proves able), it is also a handy as just a portable PC. It has no internal storage, but comes with a 1GB USB key containing the OS and software. It has ethernet, USB and audio ports, and of course connects to an external monitor.