Thursday, January 24, 2008
A Field Guide to Free Software Supporters
Quite a good summary on what sort of people inhabit the free software world.
Wednesday, January 23, 2008
Linux is just great
Got this email from my father the other day:
Just to let you know that I think Linux is just great. I plugged in the old Cannon Printer and the HP 3300C Scanjet and they both worked without a hitch.
I think I installed 5.04 on my fathers laptop a few years ago. I upgraded him to 7.10 the other month (he would have been able to do it himself but I had to flash the bios to get rid of a password and enable CD-ROM booting). The only additional application he needs to add is Gramps (Genealogy). From the perspective of someone wanting things to "just work" each release has been definitely been getting better.
Just to let you know that I think Linux is just great. I plugged in the old Cannon Printer and the HP 3300C Scanjet and they both worked without a hitch.
I think I installed 5.04 on my fathers laptop a few years ago. I upgraded him to 7.10 the other month (he would have been able to do it himself but I had to flash the bios to get rid of a password and enable CD-ROM booting). The only additional application he needs to add is Gramps (Genealogy). From the perspective of someone wanting things to "just work" each release has been definitely been getting better.
Saturday, January 19, 2008
The Gnome Foundation
Well I'm now a member of the Gnome Foundation and I'm about to take over maintainership of gcalctool. Looks like my plans to become more involved in Gnome is coming along nicely...
Wednesday, December 19, 2007
Sharing media with Xbox 360
My flatmate has an Xbox 360 so I thought I should I should work out how to share my media from my Ubuntu laptop...
Turns out to be pretty simple.
Notes:
You don't need to add any routes that they recommend (as long as your default route is OK and you're only using one network interface). Remember to set the appropriate interface (in my case my wireless is eth1) as the USHARE_IFACE option.
The default config file in 1.1a had invalid config item names. All config items should start with USHARE_. The Xbox one did not in my default config file.
Turns out to be pretty simple.
- Install ushare. There is a ushare and libdlna package to install
- Edit the config file in /etc/ushare.conf. Set USHARE_ENABLE_XBOX, USHARE_DIR and USHARE_IFACE
- Restart with /etc/init.d/ushare restart
Notes:
You don't need to add any routes that they recommend (as long as your default route is OK and you're only using one network interface). Remember to set the appropriate interface (in my case my wireless is eth1) as the USHARE_IFACE option.
The default config file in 1.1a had invalid config item names. All config items should start with USHARE_. The Xbox one did not in my default config file.
Sunday, December 09, 2007
Ubuntu Python Upgrading
The other day I went to a SyPy. One interesting thing I learnt from a Canonical employee I was talking to there is what caused a much duplicated glChess bug. The symptoms of the bug are basically glChess crashes on startup while upgrading due to not being able to import the glchess module. Unfortunately as an Ubuntu upgrade can take some time users tend to be looking for some small task to amuse themselves; say, playing a game :)
I'm not 100% sure of all the details but essential the following occurs when python files are upgraded in Ubuntu:
At some point in the upgrade the site-packages Python directory (which contains all the python modules to import) is moved/symlinked out of the way. This is done to avoid binary incompatibilities between .pyc files between Python versions. The .pycs are rebuilt and then the directory returns.
What this means for application developers like me... Files installed into bin/ directories remain so a user can launch the application but the libraries have dissappeared so the application will fail with an ImportError exception.
I'm not convinced the upgrade needs to be this dramatic as .pyc files are only a load optimisation but this means that the ImportError should be caught at the top level and the user warned they have an invalid install (a good thing to report anyway) or they are upgrading and must wait for the upgrade to complete.
I'm not 100% sure of all the details but essential the following occurs when python files are upgraded in Ubuntu:
At some point in the upgrade the site-packages Python directory (which contains all the python modules to import) is moved/symlinked out of the way. This is done to avoid binary incompatibilities between .pyc files between Python versions. The .pycs are rebuilt and then the directory returns.
What this means for application developers like me... Files installed into bin/ directories remain so a user can launch the application but the libraries have dissappeared so the application will fail with an ImportError exception.
I'm not convinced the upgrade needs to be this dramatic as .pyc files are only a load optimisation but this means that the ImportError should be caught at the top level and the user warned they have an invalid install (a good thing to report anyway) or they are upgrading and must wait for the upgrade to complete.
Monday, November 19, 2007
Confused about sound on Linux?
I know I am... With the arrival of PulseAudio to join OSS, ALSA, GStreamer, aRts, ESOUND, NAS, Phonon etc etc it's a bit hard to see any clarity. A linux.com article clears up things a bit.
I seems to me the "standard" way for Gnome will probably be:
- Applications decode/generate audio using GStreamer
- GStreamer sends the audio to PulseAudio which performs volume control and routing
- ALSA drivers play the routed audio onto physical cards
All three projects have some overlap and do not require any of the others to work. OSS was replaced by ALSA. ESOUND was replaced by PulseAudio.
KDE is also using Phonon as a fourth layer for API stability and to allow applications an easy way to play sounds.
I seems to me the "standard" way for Gnome will probably be:
- Applications decode/generate audio using GStreamer
- GStreamer sends the audio to PulseAudio which performs volume control and routing
- ALSA drivers play the routed audio onto physical cards
All three projects have some overlap and do not require any of the others to work. OSS was replaced by ALSA. ESOUND was replaced by PulseAudio.
KDE is also using Phonon as a fourth layer for API stability and to allow applications an easy way to play sounds.
OpenGL 2.0
I noticed that since upgrading to Gutsy I appear to have OpenGL 2.0 support callable from Python... Since I've never done any OpenGL 2.0 and I have the Orange Book sitting beside my I should give it a try.
After hacking the installed libraries I got the early result of the shaders in the picture which shows hemispherical lighting (not possible in OpenGL 1).
It all seems to work quite well. I was working on some cell shading but changing shaders while drawing the scene makes everything go black. I hope it's not a driver/binding issue but something I'm doing wrong (can't work it out yet though). Hopefully sometime in the future there will be fluffy chess pieces too :)
As for putting this into glChess I think this one will have to be handled very carefully. There is enough bugs from differing OpenGL setups (and broken drivers) that the code will have to be very robust. When things start working better I'll add a secret gconf key that turns on the shaders for those in the know...
Tuesday, October 30, 2007
No more glchess.sourceforge.net
Well I finally got around to it and have removes glchess.sourceforge.net and the glChess launchpad account. They were very neglected and no longer appropriate with the work in Gnome. The sourceforge page now points to live.gnome.
That is all; move along.
That is all; move along.
Is Gnome for the 80%?
I work with Engineers with most of us running Ubuntu for day to day work. I however seem to be the only vocal supporter of Gnome. The loudest bunch of GUI users seem to be the KDE (Kubuntu) camp with the general complaint being "it's too simple/dumbed down" (also heard outside of work). My complaint with KDE is "it's too complex". :) The question is:
Is Gnome for the 80% of users like subversion?
I think that is the direction Gnome has been going in for some time and I think this is the direction Gnome should be going. In saying that I don't think Gnome leaves a power user like me high and dry. I like how Gnome keeps my day to day problems simple and for power tasks I stay in Gnome Terminal and use the odd app like Firefox, Gedit, Gimp, Inkscape, Glade and Meld.
Is Gnome for the 80% of users like subversion?
I think that is the direction Gnome has been going in for some time and I think this is the direction Gnome should be going. In saying that I don't think Gnome leaves a power user like me high and dry. I like how Gnome keeps my day to day problems simple and for power tasks I stay in Gnome Terminal and use the odd app like Firefox, Gedit, Gimp, Inkscape, Glade and Meld.
Wednesday, October 17, 2007
Moving gcalctool UI to Glade
The another night the Gnome Calculator (another "core" open-source project without a website) was annoying me in how it has a separate memory register window. I'm a big fan of reducing the number of floating dialogs (unless there is a good reason to have them) so I made a patch to move this window inside the main window (Bug 485398). I blind tested this on Henry and he agreed it was better. Unfortunately it doesn't work when the numbers in the registers are huge (can't think of a good UI workaround) so it hasn't been accepted.
However I was foolishly tempted to convert the ~3500 line gtk.c into using Glade (Bug 485919). Which has been taking up all my glChess/GGZ development time but is nearly finished. But I think it's a useful addition for the future of gcalctool.
However I was foolishly tempted to convert the ~3500 line gtk.c into using Glade (Bug 485919). Which has been taking up all my glChess/GGZ development time but is nearly finished. But I think it's a useful addition for the future of gcalctool.
Saturday, August 25, 2007
Seam Carving for Content-Aware Image Resizing
This is a very cool algorithm. Makes me a little keen to go back to and do a signal processing post-graduate degree at Uni...
Researchers are Shai Avidan and Ariel Shamir.
Researchers are Shai Avidan and Ariel Shamir.
Friday, August 03, 2007
Got a spare computer lying around?
SSL in Java
Got SSL working in Python, and for my next trick the Java end! As you may know I am no fan of Java and so this seemingly simple task took much longer than expected...
The initial program is quite simple:
But when I connected I got:
Oh, what a readable exception... So it appears it doesn't like the certificate of my Python end and I should probably supply that to Java somehow. keytool is the tool for the job (a very cheap and nasty tool). I tried doing a:
Which did seem to import it (shows with
Tried some debugging:
It showed the standard signing authority certificates but not my one...
And that's when I give up and copy someone else's solution to the problem. This is how to replace the certificate checking with a null implementation:
So now it works (for transport) but I must find out how to do the certificates properly.
The initial program is quite simple:
import javax.net.ssl.SSLSocketFactory;
import javax.net.ssl.SSLSocket;
public class JVT
{
public static void main(final String[] args) throws Throwable
{
SSLSocketFactory sslSocketFactory = (SSLSocketFactory)SSLSocketFactory.getDefault();
SSLSocket sslsocket = (SSLSocket)sslSocketFactory.createSocket("localhost", 12345);
sslsocket.getOutputStream().write("Hello from the world of Java\n".getBytes());
}
}
But when I connected I got:
Exception in thread "main" javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
Oh, what a readable exception... So it appears it doesn't like the certificate of my Python end and I should probably supply that to Java somehow. keytool is the tool for the job (a very cheap and nasty tool). I tried doing a:
$ keytool -import cert
Which did seem to import it (shows with
keytool -list) but still the exception.Tried some debugging:
-Djava.protocol.handler.pkgs=com.sun.net.ssl.internal.www.protocol -Djavax.net.debug=ssl
It showed the standard signing authority certificates but not my one...
And that's when I give up and copy someone else's solution to the problem. This is how to replace the certificate checking with a null implementation:
import javax.net.ssl.SSLSocketFactory;
import javax.net.ssl.HostnameVerifier;
import javax.net.ssl.TrustManager;
import javax.net.ssl.X509TrustManager;
import javax.net.ssl.SSLSession;
import javax.net.ssl.SSLContext;
import javax.net.ssl.SSLSocket;
public class JVT
{
public static void main(final String[] args) throws Throwable
{
// Create empty HostnameVerifier
HostnameVerifier hv = new HostnameVerifier()
{
public boolean verify(String urlHostName, SSLSession session)
{
System.out.println("Warning: URL Host: " + urlHostName + " vs. " + session.getPeerHost());
return true;
}
};
// Create a trust manager that does not validate certificate chains
TrustManager[] trustAllCerts = new TrustManager[]
{
new X509TrustManager()
{
public java.security.cert.X509Certificate[] getAcceptedIssuers()
{
return null;
}
public void checkClientTrusted(java.security.cert.X509Certificate[] certs, String authType)
{
}
public void checkServerTrusted(java.security.cert.X509Certificate[] certs, String authType)
{
}
}
};
SSLContext sc = SSLContext.getInstance("SSL");
sc.init(null, trustAllCerts, new java.security.SecureRandom());
SSLSocketFactory sslSocketFactory = sc.getSocketFactory();
SSLSocket sslsocket = (SSLSocket)sslSocketFactory.createSocket("localhost", 12345);
sslsocket.getOutputStream().write("Hello from the world of Java\n".getBytes());
}
}
So now it works (for transport) but I must find out how to do the certificates properly.
Making an SSL connection in Python
For a work project I want to make a secure point-to-point link between a Java application and a Python server. Here is the result of googling/tinkering to get the link working in Python...
The client side is pretty simple. Python comes with built in SSL support for connecting sockets. Basically you just wrap a standard socket with an SSL socket:
The server is a bit more tricky, you need to install pyopenssl (apt-get install python-pyopenssl) for more SSL features. The server needs a private key and certificate to identify itself with.
The quick and dirty way to generate a test key+certificate is:
And the server wraps the sockets much like the client does:
OpenSSL also provides a test SSL client/server in the style of telnet/netcat, great for debugging:
The client side is pretty simple. Python comes with built in SSL support for connecting sockets. Basically you just wrap a standard socket with an SSL socket:
import socket
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect(('localhost', 12345))
sslSocket = socket.ssl(s)
print repr(sslSocket.server())
print repr(sslSocket.issuer())
sslSocket.write('Hello secure socket\n')
s.close()
The server is a bit more tricky, you need to install pyopenssl (apt-get install python-pyopenssl) for more SSL features. The server needs a private key and certificate to identify itself with.
The quick and dirty way to generate a test key+certificate is:
openssl genrsa 1024 > key
openssl req -new -x509 -nodes -sha1 -days 365 -key key > cert
And the server wraps the sockets much like the client does:
import socket
from OpenSSL import SSL
context = SSL.Context(SSL.SSLv23_METHOD)
context.use_privatekey_file('key')
context.use_certificate_file('cert')
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s = SSL.Connection(context, s)
s.bind(('', 12345))
s.listen(5)
(connection, address) = s.accept()
while True:
print repr(connection.recv(65535))
OpenSSL also provides a test SSL client/server in the style of telnet/netcat, great for debugging:
openssl s_server -accept 12345 -cert cert -key key
openssl s_client -connect localhost:12345
Friday, July 27, 2007
Tool for checking key events with curses
I'm doing a bit of curses programming at the moment. I've made a tool to check the keys entered are as expected. Do what you like with it.
#!/usr/bin/evn python
import curses
import curses.ascii
keys = {}
for name in dir(curses):
if name.startswith('KEY_'):
keys[getattr(curses, name)] = name
for name in dir(curses.ascii):
if name.isupper():
keys[getattr(curses.ascii, name)] = name
for i in xrange(128):
if curses.ascii.isprint(i):
keys[i] = "'%s'" % chr(i)
s = curses.initscr()
s.keypad(1)
curses.noecho()
try:
while True:
c = s.getch()
s.clear()
try:
key = keys[c]
except KeyError:
key = '%d' % c
s.addstr("Key = %s" % key)
s.refresh()
except:
curses.endwin()
Wednesday, June 13, 2007
Google Analytics = WOW
Wow.
I just went back to Google Analytics for the first time in a while and their new interface is just amazing.
Check it out:
I just went back to Google Analytics for the first time in a while and their new interface is just amazing.
Check it out:
Safari on Windows
So apparently you can get Safari for Windows.
There are two possible reasons I can see Apple doing this:
My gut instinct is that this started when the iTunes developers tried to see how easy it would be to port other apps. Apple must have a reasonable number of Windows savvy developers by now...
There are two possible reasons I can see Apple doing this:
- The want to improve website compatibility with Safari - by having a Windows version hopefully more page designers will check compatibility and thus their core OSX users will get better support.
- They want to use this as their iPhone development platform - Safari will have a mode for running iPhone applications in a browser window the same size and behaviour as the iPhone (which will be like Dashboard applications?).
My gut instinct is that this started when the iTunes developers tried to see how easy it would be to port other apps. Apple must have a reasonable number of Windows savvy developers by now...
Wednesday, June 06, 2007
Have you mooed today?
I notice that
apt-get is not the only mooer in town. Try ip moo (from iputils).
Sunday, June 03, 2007
The thin Gnome line
I'm finding recently I'm not making any significant progress on glChess. When I get around to some development after I've gone through the flood of incoming bugs there's no time to add new features! I really want to get the GGZ support into 2.20... I stopped spending time on the flood of Sudoku bugs a while ago.
It is interesting as more distributions change to Gnome 2.18 how many 1 in a million (or other appropriate large number) bugs turn up. I can only assume this user has somehow overwritten their gobject install... Weird *. There seem to be a lot of errors in peoples libraries. Hard to know what to do with these bugs as they're outside the scope of glchess but I'd prefer not to close them NOTGNOME too quickly.
* It would be good from a maintainers point of view if the big distributions like Ubuntu had a background process that audited all installed files so corruption could be picked up (and the packages re-installed).
It is interesting as more distributions change to Gnome 2.18 how many 1 in a million (or other appropriate large number) bugs turn up. I can only assume this user has somehow overwritten their gobject install... Weird *. There seem to be a lot of errors in peoples libraries. Hard to know what to do with these bugs as they're outside the scope of glchess but I'd prefer not to close them NOTGNOME too quickly.
* It would be good from a maintainers point of view if the big distributions like Ubuntu had a background process that audited all installed files so corruption could be picked up (and the packages re-installed).
Monday, May 21, 2007
Nouveau + Linux Graphics
One thing the Nouveau project is doing well is to make open-source graphics more accessible. There are links to a bunch of articles which while still young give insights into what does what. Looking at the nouveau source code shows it really isn't overly complicated - that hard work has already been done by Mesa. A DRI 3D driver basically requires a kernel module to do the IO and an X driver that can convert OpenGL to native card protocol. The difficulty is this protocol is not (publically) documented. But looking through the code and googling shows that a lot of the information is out there. It needs to be compiled into a "Missing Manual".
If I had the time I would love to work on a project like this. Once past a critical point the value to the open-source world would be immense.
As Dave Airlie and Ben Skeggs said at LinuxConf.au; "Graphics drivers are not that hard..."
If I had the time I would love to work on a project like this. Once past a critical point the value to the open-source world would be immense.
As Dave Airlie and Ben Skeggs said at LinuxConf.au; "Graphics drivers are not that hard..."
Subscribe to:
Comments (Atom)