# Recent blog entries for afayolle

This may be old news for most people using Numeric Python on a daily basis, but I've just "discovered" that Numeric ufuncs can be applied to class instances, if they implement the right interface, which is a method with the same name as the ufunc.

One dumb example :

```class ZeroAngle:
def sin(self):
return 0.
def tan(self):
return 0
def cos(self):
return 1

a = ZeroAngle()
import Numeric as n
print n.cos(za)
print n.sin(za)
```

This of course does not work with the functions in math or cmath, which try to coerce there argument to float.

A very nice usage of this is in Konrad Hinsen's Scientific.Functions.Derivatives (part of the Scientific Python package)

18 Feb 2004 (updated 18 Feb 2004 at 09:10 UTC) »

Logilab managed to push out new releases of some free software projects yesterday:

logilab.common 0.4.4, a set of shared python utilities (the 2 other projects mentionned below depend on this one)

pylint 0.3.3 a python lint tool, which features an emacs mode integrated with the python mode, and a small gui, mainly to ease use on windows boxes, but can be usefulk on other platforms too

pyreverse 0.5 a tool to reverse engineer python code, which is able to create UML diagrams, visible in ArgoUML or dot

Someone on fr.comp.lang.python asked for a way to format a float as a french currency (i.e. with thousands separator). There doesn't seem to be anything available in the standard library and the % operator has no specific format for currency. Here's the code I came up with:

```def as_currency(amount, thousand_sep=' ', decimal_sep=',', symbol='¤'):
num = '%.2f'%amount
left, right = num.split('.')
left_digits = list(left)
spaced_digits = [decimal_sep, right, symbol ]
while left_digits:
spaced_digits = [thousand_sep] + left_digits[-3:] + spaced_digits
del left_digits[-3:]
return ''.join(spaced_digits[1:])
```

This could probably be enhanced by using the locale module to get the values. It's rather unfortunate that locale.format has not % substitution for currencies.

Long time no write.

Kiddanet project is almost over now. I'm struggling with the last configuration and installation problem, namely auto configuring the client machine to run multiple instances of squid in parallel, with different redirector settings.

So, I'm finally back online. Feels good. I almost killed the 'd' key of my keyboard while going through 12K+ mails.

I'm back working on the Kiddanet EC-funded project, and doing SVM classifiers. The existing code has to be rethought because of changes in the layout of the database. And I also have to code a Web interface for the validation and training of the classifier.

Well, it's been a while since my last post. I've finally moved to Annecy and I feeling much better.

My current problem is network connection. I can't seem to be able to get a DSL connection installed, so I'm living on my old 28.8 modem, that I'd normally be using as a fax. sigh... Well, things should get sorted out in the next days, I hope. I'm worried since I have some mail on Logilab's network that I can't reach, especially debian related mail, and I heard there are some problems with the packages I maintain.

23 Sep 2002 (updated 23 Sep 2002 at 08:40 UTC) »

Hi there.

Life has been pretty fast during the past two weeks.

I'm currently living in the middle of cardboard boxes full of books, and I'm filling up more boxes with dishes, clothes and the like. Yup, I'm moving. Target date is next saturday.

In the meanwhile, I've been working on constraint, and I've somehow managed to get a 4x speed increase on the 8-queens test problem. I'll be releasing a new version very soon.

It's been a while since the last entry in this diary. I've felt a bit low lately. I have great hope in my moving back to Annecy by the end on the month. I'm really fed up with Paris, and it's time I get back in the mountains.

I spent the week-end playing music with my brother. We found a rehearsal studio available with a old drumset, and he brought his double bass. That was real nice. It's been years since I could get my hands on a pair of sticks for more than half an hour due to neighbours complaining :o(

We worked on Lincoln Goines and Robby Ameen's Funkifying the Clave book. I had some hard time with hand-leg independence, but finally managed to get an OK groove on the first tune of the method, and this really felt good, playing again.

We also watched a video tape I had recorded of Michel Camilo live in Marciac this summer. The band featured Antony Jackson on bass, Cliff Almond on drums and Alex Acuña on percussion. They played stuff from the One more once album. Great concert. I'll try to go to Marciac next summer.

Back to work... I have a core dump to hunt down...

Uninteresting diary entry. Feel free to skip ;o)

Thanks to vdv (hello Eric!), I'm rated Master. I'm not sure I deserve it and I think more of myself as a journeyer than of a master. 'nuf said. I still have some bugs waiting to be squashed...

I finally managed to write the new chapter of the Python course. I used Yapps2 which generates very readable parsers, and is quite easy to use, and designed a very simple statemachine description language to use as an exerecise (from parsing to C code generation).

I'll try to find the time to make a debian package for yapps.

3 older entries...

New Advogato Features

New HTML Parser: The long-awaited libxml2 based HTML parser code is live. It needs further work but already handles most markup better than the original parser.

Keep up with the latest Advogato features by reading the Advogato status blog.

If you're a C programmer with some spare time, take a look at the mod_virgule project page and help us with one of the tasks on the ToDo list!