Le journal du Freenaute

Ok, une petite news en Fr ;) ..

Pour les gens qui lisent les feeds RSS de Freenews, et qui subissent les 15 bandeaux de pub par page… Bah il suffit de changer de site :)

Donc voila un bon site pour avoir des infos sur Free, et les Freebox HD:
Le Journal du Freenaute

Et pour les hackers de tout poil, il y a aussi OpenFreeBox

Un peu de pub gratuite, n’a jamais fait de mal à personne.

Nixie clock: “Buy the nixies”

I decided to build a nixie clock, a long time ago. I finished this stuff, and I decided to write some articles on the way to achieve this.

So this is the first of a short serie of article, on my nixie clock. Beside I want people to be able to reproduce this for the own purpose, I choose to use some really common stuff, and cheap too.

The first step, is to buy the nixies and the nixies drivers. Every month, the nixie price tend to be higher .. so..

I bought some nixies on eBay. This is a good place to find some, at a decent price. Jan have some at good price too. Take care that a lot of website, buy some tubes on eBay and sell them after. (with a very large price increase..)

So, first choose the type and size of your nixie, Dieter website is the best place to look at the nixie specs. After look at the corresponding prices on eBay. Some users reports receiving broken tubes, but if you choose a serious vendor, you won’t have this kind of problem.

Here is a couple of pics, on the first nixies I bought. It’s some IN-8-2. They have a good price, a good shape, and quite good size. Bigger nixies cost a lot to much money for me.



The next post, will be about powering and testing a nixie with a generic microcontroller and a simple power supply.

Feel free to ask questions Bye bye..

VFD Teaser

Hi all, I haven’t post here since a while right now. In fact, I spend quite all my time w/ playing with some electronics stuff.

Some people asked what I’m doing .. that it .. here a teaser

This is some New Old Stock Russian VFD vaccum tubes.. ready for my next RSS reader !

I’m looking for some good electronics blogs, or planet.. If you know one please give me a comment

Update video is here (RSS reader block the embeded video)

Enjoy

Python blackhat tools ?

Yesterday, somebody send me a link to some really interesting slides: Silver Needle in the Skype. This really impress me, how much energy Skype spent to hide his code, and protect their buisness. But on the other side, the work done to dissect the binary and the protocols is even more surprising. (What a great job !!)

I have to admit that I used Python for quite everything, and that I’ve ever done some strange stuff with it (a IPTV packet scrapper, firewall shapping .. ) but this guys
pushed the limit far beyong from what I’m seeing like usual python use. And the best part: they wrote some powerfull tools ( and use them to “debug skype”), and publish them.

Look at here, you will find a bunch of really backhat python tools written by the Secdev team.

/Enjoy

Playing with Realtime with Python

For a little app, I need to send stream over UDP at a fixed rate. I have done severals tests w/ some buffers and sleep(), but I can’t achieve the desired speed. Mainly because sleep() doesn’t provide a stable enought result.

I decided to look at this a little deeply, and decided to use /dev/rtc to do the trick. Here a little example of the stuff.

from  fcntl import ioctl
import os, time

# some linux kernel header
RTC_IRQP_SET = 1074032652
RTC_PIE_ON =  28677
RTC_PIE_OFF = 28678

# open the realtime clock
f = open ("/dev/rtc", "r")
fd = f.fileno()

# 2048 freq
ioctl(fd,RTC_IRQP_SET,2048)
ioctl(fd,RTC_PIE_ON,0)

t0 = time.time()
interupt = 0

# the read will block until the next interrupt.
while interupt < 1000 :
    os.read(fd,4)  # 4 = size of double
    interupt = interupt + 1

delta = time.time() - t0
print interupt / delta

# drop the scheduler
ioctl(fd,RTC_PIE_OFF,0)

This is quite accurate enought, the only issue is that I’m unable to call the sched_setscheduler() from Python right now. So, if the host isn’t loaded I get the 2048 interrupts.. but it can be less :(

Update:
The sched_setscheduler can be done w/ a simple pyrex extension:

cdef extern from "sched.h":
struct sched_param:
int sched_priority
int sched_setscheduler(int pid, int policy,sched_param  *p)

SCHED_FIFO = 1

def switchRTCPriority(nb):
cdef sched_param sp
sp.sched_priority = nb
sched_setscheduler (0,SCHED_FIFO , &sp);

After this quick Pyrex hack, I now have a accurate realtime interrupt in Python ;)

Playing with binary in Python

While debuging an AVR microcontroller, you need to play with bits. After playing with my calculator I decided to find another way to decode bin/hex etc .. I found a good recipe on ASPN.

Now, this is a little reminder for people (like me) which doesn’t read binary op fluently.

# This will off the bits according to value
x &= ~(value) 

# Here a little reverse: This will set bits on according to value
x |= value

Have fun w/ bits :)

2*PIII 600 on a dual Asus P2BD

I have for a long time now, a Asus P2BD motherboard with 2 PII 350 on it. After googling a bit, I discover that I can put 2 Katmai PIII at 600Mhz on this board.

I have been looking at eBay for a while, I bought a pair of matched CPUs. Today, I received them. After a bios upgrade, I put the CPU “as is” on the motherboard. In fact, my motherboard haven’t the x 6 jumper settings.. but despite the jumpers settings are totally wrong, the CPUs work at 600Mhz.

Yes, I get 1200 BogoMips for 42 Euros :)

Thanks eBay ! and this faq !

Nixie clock at home ?

Ok, I’ve been off for a while right now. In fact, I’m playing with electronic’s stuff a lot. I just decided to build a nixie clock (for the fun).

For those wondering what is a nixie. Take a look at Wikipedia

And a nixie clock look like this:

http://jkx.larsen-b.com/photos/NixieProject/dsc01941.sized.jpg

There is a couple of hard stuffs to fix for that:

  • find the nixies (ouch prices)
  • build a custom power supply. (~170 VDC.. not really easy without external transformator)
  • find a way to drive the nixies (BCD drivers with 250VDC are hard to find)
  • find a way to have a working clock. Crystals aren’t really stable with temperature.. perhaps a DCF77 module is the right way
  • Build the stuff without too much pain, and too much money.

That sound funny ..so let’s give it a try ;)

Ouch: Plone 2.0 vs Plone 2.1

I run into a little test of Plone 2.1 today. And the whole stuff, seems to be slower than Plone 2.0.5. I decided to do a little benchmark, and yes Plone 2.1 seems to be really slower..

Plone 2.0.5 (python 2.3.4)

Total transferred:      239130 bytes
HTML transferred:       234620 bytes
Requests per second:    5.52 [#/sec] (mean)
Time per request:       181.261 [ms] (mean)
Time per request:       181.261 [ms] (mean, across all concurrent requests)
Transfer rate:          128.54 [Kbytes/sec] received

Plone 2.1 (python 2.3.5)

Total transferred:      240740 bytes
HTML transferred:       237440 bytes
Requests per second:    3.54 [#/sec] (mean)
Time per request:       282.476 [ms] (mean)
Time per request:       282.476 [ms] (mean, across all concurrent requests)
Transfer rate:          83.19 [Kbytes/sec] received

Grr, here is two point to read:

  • The 2.1 version is really slower look at the transfer rate..
  • But this is astomish slow

The bench was done on:

  • pure zope httpd (no apache or squid frontend)
  • without debug enable
  • with default HTTPCache and RAMCache enable (default install setting)
  • a dual Xeon at 2.6Ghz with 1Go of RAM ! (I know python only use 1 CPU but !!!)

I first think my setup is buggy, but no.. nobody with a good CMS in stock ?

Python on Rails: The bazzar

Everybody know Ruby on Rails right now. There is a lot of post all over the web, showing us the new latest new web programming style. This is a little funny because in a past life (4 years ago), I worked on something quite similar for Zope, name ZModeling. And I guess a lot of people has done the same, by generating the html from a data model (It tooks me about 1hours to do that for my latest website). That’s it and this is the latest hype stuff. IT loves hype !

Anyway, as this become usual, (grrr) there is a bunch of projects that try to clone the rails features. The well know python proverb can be used:
Divide to loose

Here ‘s a little list:

Django

Django is the total new one, it’s written from scratch, and doesn’t re-use anything.

  • it use mod_python for apache integration (no SCGI for lighttpd ??)
  • custom ORM
  • custom template engine (why not another one !!)

This one has a lot of good comments, and a lot of people see in this stuff a Zope killer app.. or something like that but ..

Subway

Subway was born just after Ruby on rails, and is the direct competitor.

  • CherryPy: stable, simple and robust HTTP framework
  • SQLObject: the world famous ORM for Py
  • Cheetah: a plain old fashion template engine.

This is nothing more a app skelton generator, with a little wraps around the whole stuffs, nothing magic, but simple .. perhaps too simple ?

TurboGears

TurboGears is a the latest one I think

  • CherryPy
  • SQLObject ORM
  • Kid template: a simple ZPT like
  • A powerfull Ajax toolkit.

The API is a bit Frankhein right now I think (I don’t like the raise CherryPy in the middle), and the templating is not powefull enought. But it’s really interesting (meanly the Ajax API).

Paste

Paste is something a bit different of rails, It has a more large framework

  • WSGI
  • SQLObject ORM
  • ZPT: The powerfull Zope Page Templates

So now, which is the best ?

Perhaps none right now:

  • Django use (for me) too much indoor product, I think there is a lot goods frameworks for python right now, and re-writting a ORM expose the project to a some strange bugs, or missing features, or wrong design (the meta api is freak) . same for template engine.
  • Subway and TurboGears are really quite the same product, and they are lacking of some features like the admin page for objects. I prefer TurboGears meanly for the Ajax toolkit.
  • Paste, is as usual a very well written stuff from Ian. The API is clear, and tools are well known. But I think the framework take too much place. I mean force you too use it’s configuration stuff, and other WSGI server.

So perhaps, you can pick just one of this, as they’re all looking close:

  • If you want to discover something really different: Django
  • If you want something closer to rails: TurboGears
  • If you like the servlet and threads choose: Paste ..

But take care that the framework you choose feet with:

  • your way of web programming (servlet vs controller + template)
  • the project load (I mean mod_python is awfull to debug but provide some very good performance)

Anyways, the choice is really hard because it’s time to choose right now, and I believe that some frameworks will die sooner than others.. Django seems to be the next big python project, but some people share my opinion about :” I don’t want to learn another ORM !”

But, beside there is a lot of frameworks, they ‘re loosing the main goal: Using a good framework is a good stuff. But using good products is better. They all miss the component model. HTTP + ORM + Template engine = Web Framework, but for a application framework you need a little more. Some stuffs have been done on Webware, and Quixote about this, but it looks like people designing framework never look at the past, and keep on going building the same stuff over and over.

What we need now, is a application framework. Something we can use to build website not webapp. Clients are now asking for : “I need something to post articles + a forum + a wiki + ..” That’s too much for a quick answer like: “Ok I gonna use this web frameworks”. On the PHP scene right now, you have some great products that tend to share some component, like user rights, templating .. and this is really a bad news for Python users, because the only stuff we have to fight against this is Zope. And it’s getting even worst since right now, most products need Plone and all the bloat it’s about.