Friday, November 18, 2005

Instant C/C++ in Python

Instant is a module if found using PyPi that has a nice option for python developers, and C(++) developers alike. Just take al ook at this:
>>> c_code = """
double sum(double a, double b){
return a+b;
}
"""
>>> import Instant
>>> ext = Instant.Instant()
>>>
>>> # create the wrapper code, compile and link it to a shared library
>>> ext.create_extension(code=c_code, module='test1_ext')
>>> from test1_ext import sum
>>>
>>> # use the C code
>>> print sum(3.7, 4.8)
8.5


It creates C source code as a Python String, only to compile it in 3 lines! Compile something else, 1 more line!!

Import the newly created compiled module, takes 1 extra line, but i guess everyone can live with that.

Thursday, November 17, 2005

Enum('red', 'blue', 'green')

This package provides a robust enumerated data type for Python.

>>> color = enum.Enum('red', 'blue', 'green');

>>> color.red > color.blue

False


But has a few other nice things as well. enum.Enum('one').one != enum.Enum('one').one because they are two different enums!

Shelve supports seems to be there, as long as your import enum

Wednesday, November 16, 2005

Tip: Disable XP�s Balloon Tips

From http://aaltonen.us/archive/2004/03/26/tip-disable-xps-balloon-tips/

If you�re like me and find it annoying when Windows XP pops open alert balloons from the taskbar�s notification area, there is a way to disable this feature.

Open your registry using regedit and go to:

HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced
Create a new DWORD value (or modify the value, if it exists) called EnableBalloonTips and set the value to 0. Exit regedit, and restart or log out for the changes to take effect.

Monday, November 07, 2005

jpeg comment

Using Gheorghe Milas' jpeg.py it's now possible to do comment read writing. . (as well as other exif info, but check his site for more info).
import jpeg

#read/write JPEG comments (aka the COM area)
jpeg.getComments(file)
jpeg.setComments(txt, file)

Looks promising wouldn't you say? :D

Tuesday, November 01, 2005

Eddie - Monitor a machine

From their website:

What is it really?

The EDDIE Tool is a monitoring agent. It runs standalone on a system and performs checks and other actions as defined by an extensible configuration.

What can it do?

The EDDIE Tool can perform all basic system monitoring checks, such as: filesystem; processes; system load; and network configuration. It can also perform such network monitoring tasks as: ping checks; HTTP checks; POP3 tests; SNMP queries; RADIUS authentication tests; and customized TCP port checks. Finally, a few checks lend themselves to security monitoring: watching files for changes; and scanning logfiles.
The EDDIE Tool can also send any collected statistic to RRD files to be displayed graphically by any standard RRD tool. No need to run multiple monitoring and data collection agents.
Monitoring rules are just like Python expressions and can be as simple or as complex as needed. Advanced alert control functionality such as exponential back-off and dependencies are also standard.



Looks nice eh?