Sunday, March 25, 2007

mmc

I've made a patch for MMC (mud client). With this patch, mmc supports 256 color space of xterm/rxvt/putty/..., broken terminals (no more "terminal cannot insert/delete characters") and keypad characters. Screenshort.

Tuesday, March 13, 2007

wtf

The code snippet from former coworker of mine. There are about dozen things like that:
if (System.getProperty("time.to.sleep").equals("null")) {
timeToThreadSleep = prefs.getLong(TAG_SLEEP, timeToThreadSleep);
System.out.println("....p: " + timeToThreadSleep + " millis" + " \t");
} else {
timeToThreadSleep = new Integer(System.getProperty("time.to.sleep")).intValue();
System.out.println("...p: " + timeToThreadSleep + " millis" + " \t");
}

OSD Desktop

Yet Another Long Deferred (for years) Post. At last I've recorded how a working upon my desktop looks like (640x480 10fps 2mb or 1024x768 10fps 6mb). The idea concerning osd'ish desktop had floated around for long, before I sat and wrote first lines of code. Due to a logical evolution of my desktop I had gotten used to work with any application in fullscreen mode. Things like clocks, bars and meters had quickly been rid from my desktop. Although I found myself in a world without notifications. I was happy. Then, OSD came to me as a solution to keep fullscreenness and be aware of events. Using python and osd library for it, I've implemented an events daemon. The daemon reads lines from the ~/log/events file and parses them using one of the following patterns:
  • string - add this string into a list of displaying strings.
  • [][][]\d\d\d\d: string - the same as previous case, but the string is visible for the \d\d\d\d (four digits) ms.
  • \d\d\:\d\d:\d\d: string - the same as first case, but with a date preceeding string. The date is not visible on OSD.
  • \d\d\:\d\d:\d\d: [][][]\d\d\d\d: string - The same as second case with the mark as in third case.
    Now it was a time to implement programs that would write to the ~/log/events file. First such program became aktimelog that writes time into the events log every 25 minutes. Others I've made: plugin for irssi to see either public, private or both messages, monitoring of keyboard layout changes, workspace switching, mail notifications, shell notifications. Also it is not needless to say that workspace switching is driven by shortcuts. For instance, if you press the MOD-e shortcut, in addition to switching workspace, ion3 checks whether emacs is runned and run it if it is not yet and you confirmed it for. I usually know where I have to switch to, and don't waste my time running through the list of open programs. So MOD-e is for emacs, MOD-p -- revelation, MOD-c -- eclipse, MOD-b -- browser, MOD-1 -- first terminal, MOD-2 -- second terminal... and so on. That is how my desktop works. But how does yours work? :)

    Sources.
  • Friday, March 9, 2007

    LPTRA

    And for EE fanatics I've implemented the resource adapter (JCA 1.5 with CCI), a right-way to access parallel port from inside EE applications. To use it, you need UParPort library installed. Then, simply deploy this RAR (resource adapter archive) into your application server. When you have done it, create a datasource for the LPTRA. You will have to specify pin names, while you are creating the datasource, like this: 1PinName=eye1, 2PinName=eye2 and so on. That's all. You may download the sources of the LPTRA as well.

    Example:

    @Resource (name = "eis/ParPort")
    private ConnectionFactory connFactory;

    Connection conn = null;
    try {
    conn = connFactory.getConnection();
    Interaction interaction = conn.createInteraction ();
    MappedRecord r =
    connFactory.getRecordFactory ().createMappedRecord ("");

    r.put ("eye1", true); // turn eye1 pin into the on state
    r.put ("eye2", false); // turn eye2 off
    interaction.execute (null, r);
    } catch (ResourceException e) {
    e.printStackTrace (); // Not sexy
    } finally {
    if (conn != null) {
    try {
    conn.close();
    } catch (ResourceException e) {
    e.printStackTrace (); // Not sexy
    }
    }
    }

    UParPort

    It had been a long time since I planned to publish this piece of software. Now here it is. UParPort - is the java library for accessing the parallel port (printer port) from inside a Java program. But unlike parport, it doesn't require root privileges. There is the main class UParPort in package ru.toril.uparport. It takes a device name as the constructor's agruments. And the device name should look similar to "/dev/par0" or "lpt1". When an instance of the UParPort class has been created, the following methods can be called on it: getData, getStatus setData, close. isClosed, toString. There are the binaries and the sources of the UParPort.

    Monday, March 5, 2007

    WM5DevSpy

    Here I've published the program intended to monitor device drivers of WM5. Actually, you don't need it if you are not a programmer-hacker. Thus you need it, if you are interested in an information about calls to a device drivers, such as function's arguments and a transferring data. The program has to be compiled before using (and yet again, if you don't know how, you don't need it). A device name is located in the WM5DevSpy.c and you would find it without extra work. I feel too lazy to write a good gui interface for it. As a bonus, this program describes each interrupt, showing a process and a thread of the process that handle interrupt. Feel free to ask.

    Instance of log:
    2007.02.22 00:15:32: Starting ------------------------------------------------------
    2007.02.22 00:15:33: interrupt 5 (abs 13): event struct at 8ffb2818, thread struct at 8efb4024, owner proc at 8c5976d0, proc name=NK.EXE, thread start addr=8c215240
    2007.02.22 00:15:33: interrupt 8 (abs 16): event struct at 8f7a5xf0, thread struct at 8e7a2a64, owner proc at 8c597ad0, proc name=gwes.exe, thread start addr=015c39b4
    2007.02.22 00:15:33: interrupt 9 (abs 17): event struct at 8f796yc4, thread struct at 8e785400, owner proc at 8c597ad0, proc name=gwes.exe, thread start addr=01e944e4
    [...]
    2007.02.22 00:15:34: fsDev_t at: 06048c50
    2007.02.22 00:15:34: LegalName: BAT1:
    2007.02.22 00:15:34: DeviceName: BAT1
    2007.02.22 00:15:34: BusName: BuiltInPhase1_0_26_0
    2007.02.22 00:15:34: DeviceKey: Drivers\BuiltIn\Battery
    2007.02.22 00:15:34: control (openData=0x00000001, code=0x00290400, inBuf=0x0806fa8c, inSize=0x00000004, outBuf=0x0806fa60, outSize=0x00000014, outUsed=0x0806fa20) -> 0x00000001
    2007.02.22 00:15:34: [ *outUsed : 0x00000018 ]
    2007.02.22 00:15:34: IN:
    2007.02.22 00:15:34: 01 00 00 00
    2007.02.22 00:15:34: OUT:
    2007.02.22 00:15:34: 00 08 5a 00 ff ff ff ff
    2007.02.22 00:15:34: ff ff ff ff 00 ff 00 00
    2007.02.22 00:15:34: ff ff ff ff ff ff ff ff
    2007.02.22 00:15:37: Calls to open function: 0
    2007.02.22 00:15:37: Calls to close function: 0
    2007.02.22 00:15:38: Calls to control function: 1
    2007.02.22 00:15:38: Calls to read function: 0
    2007.02.22 00:15:38: Calls to write function: 0
    2007.02.22 00:15:38: Calls to seek function: 0
    2007.02.22 00:15:38: Calls to powerup function: 0
    2007.02.22 00:15:38: Calls to powerdn function: 0
    2007.02.22 00:15:38: ----------------------- stop -------------------------

    Sunday, March 4, 2007

    LooxLight 2007-03-04

    LooxLight is a tool for PDA Fujitsu Siemens C550/N560 (click here to find more information).

    I've released new version of LooxLight. Changelog:
  • Full support for the GPS led.
  • Support for the Broadcom Bluetooth Stack.
  • Full support for the power led.
  • Better support for the keyboard led (it survives brightness changing).
  • The LooxLight service is not an EXE, but a DLL now. It is an improvement becouse wince has the limitation on amount of proccesses -- 32 processes.
  • Twice as smaller footprint than even before.

    The CAB archive zipped: here.
    The source code (GPLed): here.

  • New versions and latest news about LooxLight will be published right here.
    Another project helps reduce power consumption on Fujitsu-Siemens Loox N560/C550.