2005/03/28

CommitMessage and HTML emails

I'm playing with Subversion these days, and a co-worker pointed me at this occasion to the CommitMessage framework. Small and neat architecture. The default text message is quite complete but can get a little bit obscure for large commits, so I hacked a HTML message extension. Here is the result:
User: olg
Date: 2005/03/28 03:56 PM
Log:
Support for subject/content filters
Modified:
/metameta/English.lproj/TextFilterInspector.nib/
info.nib, keyedobjects.nib
File Changes:
Directory: /metameta/English.lproj/TextFilterInspector.nib/
File [modified]: info.nib
Delta lines: +1 -1
===================================================================
--- mm/English.lproj/Test.nib/info.nib 2004-05-28 20:49:23 UTC (rev 81)
+++ mm/English.lproj//Test.nib/info.nib 2004-05-28 20:49:37 UTC (rev 82)
@@ -11,6 +11,6 @@
   14
  
  IBSystem Version
- 7F44
+ 7H63
 
 
File [modified]: keyedobjects.nib
Delta lines: +0 -0
===================================================================
(Binary files differ)
Instructions
You should now receive HTML-formatted emails on your commit (there is also a plain text alternative, Tigris-style, in the message).
Other notes
The HTML message is styled with embedded CSS. The CSS rules are currently hard-coded in the Python file, it should probably stored in a separate CSS file and embedded on message construction or with an option to override.

Some problems with Python when writing this extension. I'm an absolute beginner in Python, so I'm probably missing something. My first implementation used mimetools and MimeWrite, but I learned that the email module was probably better, I rewrote it. The issue was that I included my HTMLStyleEmailView inside the commitmessage-provided email.py (thus commitmessage.views.email module), and doing an import email from within this module was ambiguous. I moved everything to a separate commitmessage.views.extensions module and everything was fine. Please let me know if there is a clean way to reference a top-level module from a module with a similar name.

I was not able to just inherit from BaseEmailView as the execute method finishes the mail headers before calling generateBody, and I needed header customization to define the MIME multipart info.


2005/03/09

Obj-C runtime fun

Some time ago, I discovered this neat little tool, LJV (for "Lightweight Java Visualizer"). Basically, a small Java program that takes a data structure as input, and generate a GraphViz file as output.

So of course, I had this irrepressible urge to hack something similar for Objective-C.

Let's take the following Obj-C code:

@interface Bi : NSObject {
        NSString* xxa;
}
@end

@interface Bo : Bi {
        NSString* d;
        id e;
}
@end

@implementation Bo 
-(id)init
{
        [super init];
        e = [[NSScanner scannerWithString:@"asdfasdf asdf"] retain];
        return self;
}
@end

@interface Ga : NSObject {
        NSString* grunt;
        NSMutableArray* a;
        Bo* x;
}
@end

@implementation Ga 
-(id)init
{
        [super init];
        grunt = @"pok";
        a = [[NSArray alloc] initWithObjects:@"ag",
                                   [NSString stringWithString:@"b"],
                                   nil];
        x = [[Bo alloc] init];
        return self;
}
@end
(yes, I know, I did not code release methods, I'm leaking). Just use some magical NSObject category:
Ga* g = [[Ga alloc] init];
[g dumpObjectGraph];

And shazam !

Some additional notes:

update: I wrote a new post with additional explanations and the source code on


2005/03/01

Airport Extreme-Express and SNMP

So I received my new toy a few days ago: an AirPort Extreme Base Station to complement the Express (which migrated to the audio system).

Installation went (almost) smoothly: my previous airport setup was just MAC based, and this not the best idea for WDS setup. Apparently doable, but it was simpler to switch to WPA.

Then ? Then I have this little obsession these days about data representation. How to express and manipulate complex data structure, provide high-level representation, graph running data, etc. Thus my current interests in Software Visualization, end-user 'big data', alternative representations for common tasks, etc. And in that context, I'm playing with automated graphing tools, for instance for network usage patterns, and so on, and trying things like Cacti, RRDTool. Somewhat too much sysadmin-oriented to my taste, but that's just a piece in the puzzle.

Back to the Airport: what about graphing the bandwidth usage, number of clients and see when my laptop is connected, etc. The Airport base station does have SNMP support, but a simple

$ snmpwalk -v 2c -c yourBasePassword 10.0.1.1
.. seems to only return classic and basic statistics. Replace 10.0.1.1 by your Airport IP, of course. That's a start as in/out packets are included, but nothing about Airport-specific stuff.

Actually, Apple did release a MIB for Airport Express/Extreme base stations a while ago, but I did not find any useful information about how to exploit these, among with some comments 'great, but how do I access these paramters'. Motivation for further digging, so here is my findings. I must confess I was a SNMP absolute beginner, so most of this is probably very common.

Next steps: create a configuration file for Cacti, and actually graph these.

This page is powered by Blogger. Isn't yours?