Archive for the ‘developers’ Category

The decimal module in Python

Wednesday, August 12th, 2009

Python has a brilliant decimal module (http://docs.python.org/library/decimal.html) you may need if you want to avoid floating point errors.  This may be necessary if you are faced with compounding errors under special circumstances e.g. if testing a statistical routine against a purpose-built test dataset (e.g. http://www.itl.nist.gov/div898/strd/anova/SmLs09_cv.html).  The performance hit is substantial, however, so it has to be used judiciously.  Anyway, here is an example:

import decimal
D = decimal.Decimal
decimal.getcontext().prec = 120
d1 = D("1.1")
f1 = 1.1
print "Decimal result is: %s" % round((d1**1000 - D("2.46993291801e+41")),3)
print "Floating point result is: %s" % round((f1**1000 - 2.46993291801e+41),3)
>>>

Decimal result is: -4.17366587591e+29
Floating point result is: -3.97456123863e+29

Usually, floating point is good enough – but not under all circumstances.  In which case, it pays to be familiar with the decimal module.

Please report bugs – it’s good for the project

Saturday, July 18th, 2009

Bugs are never welcome, but the only thing worse than a bug is a bug you don’t know about and could easily fix.  Even worse, an unknown bug could put some people off using your software, which is not a good outcome for anyone.  So how do you report a bug in SOFA Statistics?  Fortunately, Launchpad (which is where the SOFA Statistics source code lives) makes bug reporting easy.  Just go to: https://launchpad.net/sofastatistics/+filebug/+login and register the bug.  I’ll do my best to fix it and keep everyone informed along the way.

Remember – reporting a bug is an act of kindness so please don’t hold back.  Your report could help many other users.

Bazaar – Simple Yet Powerful

Sunday, June 28th, 2009

This project uses Bazaar to provide versioning control.  AlthoughBazaar is very powerful, it is also very easy to start using.  Here are some of my most commonly used commands:

bzr add – adds file to versioning control

bzr commit -m “Message in here about changes” – takes the copies and creates a new version

bzr push – pushes the revision out to Launchpad

bzr ls -V – lists all versioned files (if any are missing just use add)

Installation testing using VirtualBox snapshots

Thursday, May 28th, 2009

VirtualBox is brilliant.  You can set up Windows XP, Ubuntu Jaunty etc and test installations into them.  Then reset to snapshot and rinse and repeat.  Installing onto systems that are not “clean” is never as certain – perhaps you have already installed comtypes or whatever.

One tip for sharing files between a host OS and a Linux (Ubuntu) guest OS (see http://www.virtuatopia.com/index.php/VirtualBox_Shared_Folders).

Within the guest OS, make a directory e.g.

sudo mkdir /transfer

Then mount the shared folder you set up externally in VirtualBox using:
sudo mount -t vboxsf sharename mountpoint
in my case:
sudo mount -t vboxsf transfer /transfer
It is then easy to grab files from the host OS e.g. a deb package that needs to be installed.

Ubuntu packages the only Linux option

Thursday, May 28th, 2009

I have just watched a fascinating video entitled “Why Desktop Linux Sucks” by Bryan Lunduke (http://anotherubuntu.blogspot.com/2009/05/why-desktop-linux-sucks.html).  Desktop Linux works really well for me but Bryan makes a lot of important points.   I certainly agree that packaging is a big problem.  The approach I have taken for Linux installation with the SOFA Statistics project is to only release a deb package aimed at Ubuntu (http://www.sofastatistics.com/downloads.php).  I am already spending a lot of time packaging as it is and would like to spend more time developing new features.

SOFA Statistics working under Karmic already

Thursday, May 28th, 2009

The SOFA 0.7.1 deb package installed successfully under Karmic alpha 1 so it has now been tested in Jaunty and Karmic.  Intrepid should work but feedback would be welcome on this.

Resolving Windows installation glitches

Tuesday, May 26th, 2009

If you had problems installing the Windows version of SOFA 0.6.8, try 0.7.0 (http://www.sofastatistics.com/misc/sofa-0.7.0_python-2.5.zip).  It resolves the main issues with that installation package.  Version 0.7.0 also resolves some other issues within SOFA and represents the first of the 0.7 series – the goal of which is to enable importing of spreadsheets and other, non-SQL database type data.

The Windows comtypes package relied upon by SOFA 0.6.8 proved to be faulty.  The 0.7.0 version of SOFA Statistics, which has just been released, uses an older version of comtypes (0.5.2) which is known to work.  A version of comtypes 0.6.0 for python 2.5 is apparently forthcoming.

There is still a delay when using SOFA’s table making functionality for the first time while comtypes generates some data it needs.  NB this is a one-off delay which doesn’t affect anything else.  Ideally, SOFA will handle this process better in a forthcoming release.

Launchpad puts the Open into Open Source

Friday, May 22nd, 2009

I have made some more revisions of SOFA Statistics (bugs fixed, mainly regressions after refactoring).  Launchpad makes it easy to see every difference between the different versions.   http://bazaar.launchpad.net/~launchpad-p-s/sofastatistics/main/revision/5 Truly, nothing is hidden which shall not be revealed!  These are very powerful tools, all made available through the power of open source.

Using Bazaar on Launchpad

Wednesday, May 20th, 2009

Just started using Bazaar on Launchpad to provide distributed version control for SOFA Statistics.  Very nice.  And commands like:

bzr commit

bzr push -m “description in here”

are very easy to remember.

Also adding lots of public and internal process documentation.  Soon it will be back to adding new features.