5 Jan
I just found a nice comparison chart of different compression programs for PNG images (optimizations). It seems that PNGout is the best of the best :-) On the author’s website, there’s only a windows version. The link to the Linux version gets redirected to a gtagaming website?!
After asking the great oracle Google where I could find a version for Linux, he replied to me I could find it on JonoF’s website.
29 Dec
BNPParibas in association with the FIDE created a new nicely done website (in french only). The goal of this website is to show the usefulness of chess to parents/teachers or schools. Children will also be happy to consult this website, there are cool games, and even a quiz, where one can win a sort of printable “diploma”. A really nice initiative.
26 Mar
If you want to use any Asterisk module that needs a timer, like MeetMe, you have to use a module named dahdi (previously named zaptel). DAHDI has one module for each Digium supported card (B410P), and a dummy module (named dahdi_dummy) if you don’t have a hardware card, like me.
The problem appears when you have your Asterisk in a Xen environment. Xen does not allow the use of the RTC, so when using Dahdi/meetme, you get the following in you logs:
res_timing_dahdi.c: Asterisk has detected a problem with your DAHDI configuration and will shutdown for your protection.
So get the sources, and let’s patch it!
In dahdi_dummy.c, you’ll have to comment the two defines USE_RTC, as in a Xen, you can’t use it:
# diff -u dahdi_dummy.c.ori dahdi_dummy.c
— dahdi_dummy.c.ori 2009-03-23 09:50:36.000000000 +0000
+++ dahdi_dummy.c 2009-03-23 08:55:38.000000000 +0000
@@ -59,11 +59,11 @@
#if defined(CONFIG_HIGH_RES_TIMERS) && LINUX_VERSION_CODE >= VERSION_CODE(2,6,22)
#define USE_HIGHRESTIMER
#else
-#define USE_RTC
+//#define USE_RTC
#endif
#else
#if 0
-#define USE_RTC
+//#define USE_RTC
#endif
#endif
#endif
Then compile the module, as usual, with :
Verify that your module has been correctly installed:
Comment out all the defined modules in the /etc/dahdi/modules file.
19 Mar
In a Django project, I have a template that is used by two urls, which is quite common (generic views, using ‘create_object’ and ‘update_object’). The problem is that I had to add a supplementary menu just when the template is loaded from the ‘update’ generic view, and not from the ‘create’ generic view.
Making the difference between the two urls calls at the template level is a problem because it’s managed by generic views, so the same template is used.
Anyways, there are several possibilities:
In urls.py, use the ‘template_name’ variable, where you can speficy a specific template for this url(). That is instead of using the default <model>_form.html.
What I don’t like in this situation, is that I will have two nearly similar templates, just for an added menu. Not cool. Another problem is that I use a loop to create all my urls. So if I add a special template, I’ll add it to ALL my models :-(.
Another solution, is to find a way to use a variable in the template that would be different wether the template has been loaded by update_object or create_object.
In our urlpatterns in urls.py, we can use the ‘extra_context‘ variable (takes a dictionnary as parameter). It is correctly managed, even when using generic views. So, you’ll have :
url(r‘foo/%s/(?P<object_id>\d+)/modifier/$’,
‘django.views.generic.create_update.update_object’,
dict(form_class=modelForm,
extra_context={‘usage’:‘modify’},
name=‘foo_update’))
We can also use, in urls.py, the ‘context_processors’ variable. For more information about the context processors, have a look at this tutorial. The goal is to add ‘django.core.context_processors.request’, like this:
and in the url(), add context_processors:
The last possiblity is a more global solution. It’s like the context_processors usage above, but added into every templates automatically.
To do this, you’ll have to edit the list of Template Processors in your settings.py file. That list is run each time a template is loaded, and allows one to add any variable to the template automatically. By default (on Django 1.0.x) this list is commented out, so it has by default the list:
You’ll have to uncomment it, and add ‘django.core.context_processors.request’. By doing this, you get the variable ‘request.path’ available in your template.
Finally, you’ll be able to test your variable with {% ifequal %} and display your conditional elements.
19 Mar
Calcubetimer’s website doesn’t seem to work anymore :-( Fortunately, gnehzr has moved the code to Google Code.
12 Feb
If you configured your Asterisk/FreeSWITCH server to talk to your freephonie.net (french Free ISP provider), you’ll see in the logs the following warning message:
This is not really a problem, but an annoyance, as it fills up your logs. This is a known problem for more than years, but has never been corrected (neither by Asterisk nor by Cirpack devs). The usual correction was to add the following line to your startup scripts (/etc/rc.local on Debian for example):
But the syntax has changed in iptables, and you’ll get the error:
so, just add one of the 2 available algorithms (bm and kmp):
2 Feb
In my journey to teach chess to Ido, an easy (I thought) job was to generate diagrams where he has to find mate in a fixed number of turns. Starting with mate in one.
It appeared that making diagrams is an easy task, as there are many programs (Linux and Windows) that permit this.
On Linux, the best I could find is scid. That’s cool as I use it to maintain my databases of games. Even cooler, is that scid development has just restarted (stopped around 2004!), with the help of Pascal Georges. Using scid (I’m using the 3.7devel2009 version) I can export games to HTML or even to LaTeX files.
At first I thought I’d create the endings myself, for example, using online diagrams generators or using Wikipedia/MediaWiki’s templates, but it was not so easy, so I thought about making a program to generate them.
Generating one from scratch would take me time I really don’t have, and there are just two python modules that give high-level functions to chess.
So I started looking for projects similar to mine, that include games with mate in one. I found a small database of mate in one on my favorite chess website, in the download section: a Chessbase datafile with 1171 mate in one studies! So cool.
Well, It was really a pain to convert that Chessbase (.cbv) file, as the only program able to convert to PGN is running on Windows (at least it’s free). You just have to follow the instructions from this thread.
After getting a nice PGN file, just open it with scid, go to “Tools”, then select “Write the filter”, and choose LaTeX. You’ll get a TeX file. Use you favorite TeX generator (Live TeX seems to be the one today), like this for example, to generate directly a PDF file:
(Yes I had to cleanup a bit the file before generating the .pdf)
The result is here, 196 pages of tests (6 one each page) if you don’t want to fight with the missing TeX modules (you’ll need chess12.sty) and get a nice result.
I’m sure many people search for this kind of file, so I’m pretty happy to help other parents/coaches.

White mate in one
Edit: I added a PDF version without the solution included.
28 Jan
How to teach chess to a 3 year old kid? That’s a good question. I wanted to teach Ido chess for a long time, but each time I tried, he lost focus after 2 minutes, even just for teaching him just rook movements.
I decided I needed to plan it a little more, make it much more fun, and “embed” it in mini-games. It seems to work much better now, but that’s maybe because he matured a lot.
Here are some ideas (some not yet implemented):
For quick single diagrams, I found wbeditor, an online javascript diagram generator.
There’s a thread (french) about experience from different teachers, giving really good advices.
Most notably, Véronique Houck who has 15 years of experience of teaching chess to kindergarten/maternelle children. She wrote two books (in french). One is named Bibou & le monde des échecs, and the other one Le jeu d’échecs au cycle2. It’s not so easy to find, but using Google, you can find shows many links.
I’ve not yet read them. I’ll make a review when I get them.
28 Jan
Mediawiki allows one to send Recent Changes (RC) to a UDP port.
The ip address is defined by the variable wgRC2UDPAddress, and the port by the variable wgRC2UDPPort. It’s a really good idea that it’s a UDP transfer, since there is no need for any ACK, so Mediawiki doesn’t block if there is nothing listening on that port.
These parameters must be set in the LocalSettings.php file, like this, for example.
I wrote a really simple python program (more a proof of concept) that receives the data, cleans it, and then prints it to stdout :
HOST,PORT = ”, 9390
class MyUDPHandler(SocketServer.BaseRequestHandler):
def handle(self):
print re.sub(r‘\x03\d{0,2}’, ”, self.request[0])
if __name__ == ‘__main__’:
server = SocketServer.UDPServer((HOST, PORT), MyUDPHandler)
server.serve_forever()
I plan to make it into a complete project that will send the data/notifications using Jabber(XMPP).
18 Jan
You installed Mediawiki some time ago, and now something bothers you: aren’t you tired of having an intermediate page named “Login successful” saying “You are now logged in to” before being allowed to go to the page you wanted to go? I am.
I found there’s a hook that is called just when a user successfully logs on (UserLoginComplete), and even an extension named RedirectOnLogin that does the redirection for you, BUT to a fixed one. It seems the hook doesn’t give you the page you previously were before the login request.
So to correct this, I just found a dirty hack. That means you’ll have to patch the source, meaning also that you’ll loose some flexibility when upgrading Mediawiki :-(
Anyway, if you still want to do this, here is the magic stuff:
Edit the file mediawiki/includes/specials/SpecialUserlogin.php and look for the function successfulLogin().
At the end of it, just add (it’s just one line):
That’s it. You’ll get redirected to the previously accessed page automatically! Really cool.
This has been successfully used on a Mediawiki 1.13.
Search engine optimization by SEO Design Solutions
Recent Comments