snoring through logging

been working on a simple logging module for npm, so far I’ve set it up to handle 3 different outputs, the usual STDERR for big problems, a regular log file for every thing but debugging, and a developers log file for use during debugging.

stderr
CRITICAL: critical message
ERROR: error message
WARNING: warning message
run log
2007-12-27 07:27:45,156: CRITICAL -:- critical message
2007-12-27 07:27:45,157: ERROR -:- error message
2007-12-27 07:27:45,157: WARNING -:- warning message
2007-12-27 07:27:45,158: INFO -:- info message
dev log
2007-12-27 07:27:45,156 root CRITICAL: logger.logger.py.73
critical message
2007-12-27 07:27:45,157 root ERROR: logger.logger.py.74
error message
2007-12-27 07:27:45,157 root WARNING: logger.logger.py.75
warning message
2007-12-27 07:27:45,158 root INFO: logger.logger.py.76
info message
2007-12-27 07:27:45,159 root DEBUG: logger.logger.py.77
debug message

The formats are just a matter of what I find easy on the eyes, think the middle one could stand with a shorter date format.

I might ditch the idea of a second log file and just follow my original idea of being able to specify the level of logging to use. It’d also be less work then

Either way yee slice it, I need some freaking sleep… because I can’t think no more.

:wq!

OH how sweet it would be to have the freedom to get through even one day without any headaches……

Remembering

Hail Mary, full of grace,
the Lord is with thee,
blessed art thou among women,
and blessed is the fruit of thy womb, Jesus.
Holy Mary, mother of God,
pray for us sinners, now, and at
the hour of our death.
Amen.

Qute I/O

Been meandering about with Pythons subprocess and various IPC (inter Process Communication) focuses modules tonight. When I remembered I had noted that QT and KDE had classes for working with processes.

Looked up the class in the documentation and played with it. Then I found a small example program that they included. Here is the QT written example using C++, the primary language.


/****************************************************************************
** $Id: qt/process.cpp 3.3.7 edited Aug 31 2005 $
**
** Copyright (C) 1992-2005 Trolltech AS. All rights reserved.
**
** This file is part of an example program for Qt. This example
** program may be used, distributed and modified without limitation.
**
*****************************************************************************/

#include <qobject.h>
#include <qprocess.h>
#include <qvbox.h>
#include <qtextview.h>
#include <qpushbutton.h>
#include <qapplication.h>
#include <qmessagebox.h>

#include <stdlib.h>

class UicManager : public QVBox
{
Q_OBJECT

public:
UicManager();
~UicManager() {}

public slots:
void readFromStdout();
void scrollToTop();

private:
QProcess *proc;
QTextView *output;
QPushButton *quitButton;
};

UicManager::UicManager()
{
// Layout
output = new QTextView( this );
quitButton = new QPushButton( tr("Quit"), this );
connect( quitButton, SIGNAL(clicked()),
qApp, SLOT(quit()) );
resize( 500, 500 );

// QProcess related code
proc = new QProcess( this );

// Set up the command and arguments.
// On the command line you would do:
// uic -tr i18n "small_dialog.ui"
proc->addArgument( "uic" );
proc->addArgument( "-tr" );
proc->addArgument( "i18n" );
proc->addArgument( "small_dialog.ui" );

connect( proc, SIGNAL(readyReadStdout()),
this, SLOT(readFromStdout()) );
connect( proc, SIGNAL(processExited()),
this, SLOT(scrollToTop()) );

if ( !proc->start() ) {
// error handling
QMessageBox::critical( 0,
tr("Fatal error"),
tr("Could not start the uic command."),
tr("Quit") );
exit( -1 );
}
}

void UicManager::readFromStdout()
{
// Read and process the data.
// Bear in mind that the data might be output in chunks.
output->append( proc->readStdout() );
}

void UicManager::scrollToTop()
{
output->setContentsPos( 0, 0 );
}

int main( int argc, char **argv )
{
QApplication a( argc, argv );
UicManager manager;
a.setMainWidget( &manager );
manager.show();
return a.exec();
}

#include "process.moc"

Needless to say, I am not really a fan of C++ at times ^_^. I translated the example into Python for a simple test and I like it quite a bit.

#!/usr/local/bin/python

# I translated the example: process/process.cpp to python and boy do I love qt!
#
#############################################################################
##
## Copyright (C) 1992-2005 Trolltech AS. All rights reserved.
##
## This file is part of an example program for Qt. This example
## program may be used, distributed and modified without limitation.
##
##############################################################################

import sys
from qt import *

class UicManager(QVBox):
def __init__(self):
QVBox.__init__(self)
self.output = QTextView(self)
self.quitButton = QPushButton(self.tr('Quit'), self)
self.connect(self.quitButton, SIGNAL('clicked()'), qApp,
SLOT('quit()'))
self.resize(500,500)

# QProcess related code
self.proc = QProcess(self)

self.proc.addArgument("uic")
self.proc.addArgument("form1.ui")

self.connect(self.proc, SIGNAL('readyReadStdout()'),
self.readFromStdout)
self.connect(self.proc, SIGNAL('processExited()'),
self.scrollToTop)

if not self.proc.start():
sys.stderr.write('fatal error could not start uicn')
sys.exit(1)

def readFromStdout(self):
'read in proc data which may be in chucks'
self.output.append(str(self.proc.readStdout()))

def scrollToTop(self):
self.output.setContentsPos(0,0)

if __name__ == "__main__":
a = QApplication(sys.argv)
manager = UicManager()
a.setMainWidget(manager)
manager.show()
sys.exit(a.exec_loop())

QProcess is nice but I’m not sure about using enormous amounts of data though yet.

EDIT:

As a test I set up the Python script to pass a ‘ls -R /’ basically causing it to list all files on all mounted file systems. The code to scroll back to the top caused major lock up to the program and some performance loss for the entire laptop: probably screaming at being down to about a 150MB of swap space left.

Removing that and closing programs so only konsole running it and top + amarok playing music was running. At times top reported free memory over < 1MB about 30-40% swap usage. However without the scroll to top thing gone it didn't cause any real performance for the laptop; probably because there was much less swap usage used up. As a test I ran ls -R / direct afterwards and while it did pile on the stats in top, it still kept to about 50MB free and even less swap usage on the displays.
So far I think it would probably work for whatever is needed as long as the computer continues to provide adequate memory and the kernel doesn’t have a hissy fit about the pipes and things in the background.

Well, been meaning to do this for awhile now since I had re-installed PC-BSD awhile ago in the course of an upgrade.

A list of all ports and packages I’ve ‘added’ to the base install (not counting depends).

Note that I installed a bunch of KDE packages on CD#2 since they were not in PBI format,

kdeedu-3.5.7        Collection of entertaining, educational programs for KDE
kdegames-3.5.7 Games for the KDE integrated X11 desktop
kdesdk-3.5.7 KDE Software Development Kit
kdevelop-3.4.1_1 IDE for a wide variety of programming tasks
koffice-1.6.3,2 Office Suite for KDE3

For software I’ve installed since the first boot up,

cscope-15.6         An interactive C program browser
ctags-5.7 A feature-filled tagfile generator for vi and emacs clones
de-kde-i18n-3.5.8 German messages and documentation for KDE3
diablo-jdk-1.5.0.07.01 Java Development Kit 1.5.0_07.01
diablo-jre-1.5.0.07.01 Java Runtime Environment 1.5.0_07.01
docker-1.5_5 A dockapp with support for GNOME2 and KDE3 tray icons
doom-data-1.0_1 Doom data files (Doom, Doom II, Hexen, Heretic and Strife)
elinks-0.11.2_2 Elinks - links text WWW browser with enhancements
emacs-22.1_1 GNU editing macros
gmake-3.81_2 GNU version of 'make' utility
javavmwrapper-2.3 Wrapper script for various Java Virtual Machines
konversation-1.0.1_1 A user friendly IRC client for KDE
kscope-1.6.0 KDE front-end to Cscope
libdvdcss-1.2.9_2 Portable abstraction library for DVD decryption
libdvdnav-0.1.10_3 The library for the xine-dvdnav plugin
linux-flock-0.9.0.2 The free web browser that makes it easier to share with you
linux-mplayerplug-in-3.50 Embed MPlayer into browser
linux-realplayer-10.0.8.805.20060718_2 Linux RealPlayer 10 from RealNetworks
lynx-2.8.7d7 A non-graphical, text-based World-Wide Web client
mg-20050820 A small, fast Emacs-like editor
portaudit-0.5.11 Checks installed ports against a list of security vulnerabi
portupgrade-2.3.1,2 FreeBSD ports/packages administration and management tool s
prboom-2.2.6_2 A multiplayer-capable and modified version of ID's classic
psearch-1.2 An utility for searching the FreeBSD Ports Collection
ruby18-atk-0.16.0.20071004 Ruby binding for ATK
ruby18-cairo-1.4.1_1 Ruby binding for Cairo
ruby18-doc-stdlib-0.10.1 Documentation for the Ruby language standard library
ruby18-gdk_pixbuf2-0.16.0.20071004_1 Ruby binding for GdkPixbuf2
ruby18-gems-0.9.2 Package management framework for the Ruby language
ruby18-glib2-0.16.0.20071004 Ruby binding for GLib2
ruby18-gtk2-0.16.0.20071004_1 Ruby binding for GTK+2
ruby18-pango-0.16.0.20071004_1 Ruby binding for Pango
ruby18-usersguide-20051121_1 Ruby users guide, in HTML format
rubygem-ini-0.1.1 Ruby INI File Parser and Writer
rubygem-rake-0.7.3 Ruby Make
rubygem-rtags-0.96 A Ruby replacement for ctags
scheme48-1.7 The Scheme Underground's implementation of R5RS
supertux-0.1.3_2 Super Tux is a side-scroller similar to Super Mario Brother
wesnoth-1.2.6 A fantasy turn-based strategy game
windowmaker-0.92.0_3 GNUstep-compliant NeXTstep window manager clone
wmappl-0.6_2 An application launcher dockapp similar to wmbutton
wmbsdbatt-0.1_1 Dockapp for battery & temperature monitoring through ACPI
wmclock-1.0.12.2_2 A dockable clock applet for Window Maker
wmdrawer-0.10.5_3 A dockapp which provides a drawer to launch applications
wmicons-1.0_2 Icons mainly for use in Window Maker
wmmatrix-0.2_2 A DockApp that runs a version of the xmatrix screenhack
xgalaga-2.0.34_2 Galaga resurrected on X
xpdf-3.02_3 Display PDF files, and convert them to other formats
zsh-4.3.4_1 The Z shell

This basically amounts to my standard shell (zsh), a few time wasters; xgaliga, supertux, wesnoth, and stuff to play doom.

A couple of useful tools; java runtime and development kit, exuberant ctags, cscope, kscope (just for the heck of it), and gmake because it’s essential to GTK+/QT based projects.

Window Maker and a couple of applets including docker and wmclock (the two I use).

xpdf because I’ve got vim programed to open PDF’s as read only text (using pdftotext)

A few extra editors, (gnu) emacs and mg (micro gnu emacs) just in case => I installed vim from source as I usually do so it’s not listed above hehe. Vim is about all I use regularly.

A couple of libdvd* ports to make use of my laptops DVD-ROM πŸ˜‰

Web browsers lynx, elinks, and linux-flock, I also have netscape 9 installed manually to the /opt directory within the Linux ABI because it wasn’t in ports.

psearch, portupgrade, and portaudit for managing ports as I’m used to

The linux version of realplayer because although the many codecs I manaually installed for mplayer will play the real media I’ve asked it to, I never had time to twist Mozilla based browsers into using it instead of website foo asking me for a realplayer plugin..

konversation, the worlds greatest IRC client πŸ˜‰

Various language stuff, mostly scheme48 and various Ruby things including GTK+ bindings. I used to have QTRuby installed manually but lost it during the reinstall/upgrade of PC-BSD. I’d like to experiment with a few C compilers and a few of the GCC based ports later.

I also have the German language files for KDE handy, using a program in another language can some times be a nice ‘crash course’ or pop quiz to ones own studies hehe.

The Christmas party

Ahh today was the big bang bash that is the [SAS] 22 EVR‘s Christmas party πŸ™‚

JB lead the guys in warming up the crowd while stuff was getting set up. Wiz and Valroe DJ’d and I tried to keep an eye on things; a nice SHOUTcast server for the music thanks to Wiz. The clan teamspeak server equipped with a party channel and Lake hosting the group chat on XFire with an average of 10-14 [SAS] Members, Recruits., and Friends around to enjoy the fun all around.

About all that was missing in my humble opinion was the Wine, Women, and Dance floor πŸ™‚

Spent most of the day ‘omni-tasking’ and with a headache but I got to enjoy the party and kick back in TG#1 for some RvS. I think every one had a good time and we probably filled two servers most of the day, think Lake led the SWAT favoring elements of the party on a rampage hehe. I had lunch, chores, tech-check, crowd control, two group chats, and numeris IM’s while trying to game to boot.

I remember after the party Lake put up a quick video of him on the webcam lighting the fire works, ‘This ones for the DJs’ hehe.

All in all, really freaking stressful but quite fun. I hope we do it again next year xD. It was also a lot more docile then the last Christmas Party I was at, where we had a nice ‘friendly’ brawl and I was like “Oh come one” and wound up with some ones knuckles in my teeth — good party though haha. I’m glade I wasn’t the bouncer on that one though =/

Afterwards, a little time to relax watching part of The Hustler (yes I like pool) and taking some time to clean my laptop. I finally peeled off the peeling sticker, blew out her keyboard with a can of air, shined up the case, double checked the battery, and whipped off the touch pad. It’s funny that now I seem to have much greater speed and control of it hehe.

Some time though I’d like to strip her down and really clean out the keyboard, uhh that sounds strange doesn’t it +S I’m taking about a computer after all πŸ˜‰

Another sleepless night

Did some major clean up to the prototype for configuring build options tonight as well as experimented with a few solutions. I just wish I didn’t have to cram every thing into such a narrow time slot.

The main problem is I’m so zonked out by the time I get to start, I may as well try and code drunk (mm interesting idea… not!).

As hard as I try to get things done my family twarts me at every turn.. It’s like they have some kind of magic radar =/.

During the day, I’d have a better chance of surviving jumping in front of an on comming 18-wheeler then getting stuff done in day light…

At night, I can only work until my brain crashes from lack of sleep.

I can’t even remember the last time I had a good nights sleep any more…

At least for today I’ve managed to get Radio 1 working, although I can play real media in mplayer it konks out after awhile in konqueror.. So I opened it in realplayer rather then keeping the web interface in.

Guess I’ll read some doc’s before I start snoring with my eyes open….

Ramblings of a drowsy spider

I comptemplate using C++ again as one of my primary languages, it was the first I started to learn with but one I’ve never put to much good use.

I generally consider C and C++ different languages, with C++ being C like in so far as C++ is similar to C. Although I do actually like it if the commonalities allow for using either a standard C compiler or C++ compiler. But I still think one should pick one and stick to it.

The main reason for considering C++ as a primary language again, is that it is more C like then any language I use regularly (besides C) so adapting it would be easy. The differences it has over C, might actually make C++ potentionally more productive for me or just annoying but.

The main reason I think digging back into C++ would be counter-productive is the low-level aspects it shares with C, would likely have the same result. Namely the reason I tend look at Bourne shell scripting before deciding to implement things.

The many utilities available outweigh the sense of writing ones own methods of processing the problem. Why have a specialized set of functions when you can just use cat, sed, grep, and awk? And with languages like Ruby or Python; the ability to test code quickly in an interpreter and a fast library of useful tools (batteries included) can be time savers of the write it or find a library for it problem I often face in C.

The main reason I use C, is I love the language and find it very beautiful. Learning the inner secrets of how computers work is a goal for me, one I also find can be a bit of an anti-problem for just getting stuff done.

Using C++ again might also have the problem of my understanding of C interfering with my use of C++ and vice versa after awhile…

Of all the languages I have encountered, The worst things I can say about them…

C -> All fine and dandy till you shoot yourself in the foot without realizing it.

C++ -> See above

Java -> Well, other then the shere bulk these days… I would prefer it to C++ if I wasn’t more used to gcc/g++ then javac πŸ˜‰

Perl -> A fine language but I dislike reading other peoples scripts at times; nether beautiful nor elegant but like a sharp knife very effective if occasionally complicated to use it as such.

PHP -> I just hate using PHP, period; I’d rather use Perl or C++ — Assembly might be preferable to PHP in my book !

Python -> A radical departure syntactically from other languages I am used to working with but it is growing on me… The documentation also is quite nice and the occasional irks I have with Ruby are missing.

Ruby -> Like wise very different from the CBF but much more productive for me then either C or Java. A big advantage for me is similarities Ruby has with Perl, while remaining *not* Perl.

Scheme -> very rudermentry knowledge of as I never got to finish reading the standard before work caught me again lol.

Also I have had brief looks into Ada and X86 Assembly but I still consider Bourne Shell, Python, and Ruby my strongest languages; with C and Java as secondary. I don’t honestly consider myself a good programmer but I think I am better at programming then I am at playing Chess b||b

Ada fascinates me but never had the time to really study it the way I want to. Assembly, is more so some thing that interests me for one I could learn through it rather then some thing I would want to work with a lot.

I love to study different programming languages, it allows me to learn a lot and to try and wrap my head around different ways of doing things.

Standard libraries and things aside, I am mostly indifferent to language, to me it is just another way to write. I used my abilities to read English to learn C++ and Perl. I bumped into C one day and that was that.. lol. It is just a matter of my ‘comfort zone’ that I tend to prefer specific languages, namely that I can get stuff done very quickly in Ruby and Python, bourne shell saves me time, and I love C.

From Ada to Vim script, it is all fun to learn.

When I was entering the 7th Grade I tested as having college level reading comprehension and most related things also had high marks aside from my Spelling. It was actually quite strange to get the test results because I was held back one grade as a child because I “couldn’t read”. My little secret?

I failed the 2nd Grade because I did the reading tests systematically my way. Rather then only hunting down and reading what I could read on the exam when I saw it.

I scanned it for the words I could read and there were plenty of them but the instructor didn’t tell me what she wanted me to do other then read it.

So I went through it word by word, left to right, line by line reading what I could: just as I would today now that I could read. And of course I ran out of time; personally I think the instructor thought my scanning time was just struggling on the bigging of the test lol.

Because I was only scored on the words I read allowed, all of the ones I could read down them, well I guess like 80-90% of the test papers; they didn’t count. I might very well have passed that test as a boy and got into the 3rd Grade rather then having to repeat the 2nd Grade.

My mechanical nature made me fail that test horribly as a child but if I had merely sat down and tried to ‘pass’ the test rather then ‘doing’ it my way. I might never have learned to read the way I did, which I must say is the greatest thing I have ever learned.

English is a very screwed up language when it comes to its written form -> and the family dictionary admits this! But I feel if one can read and understand English well enough, you can learn computers easy.

That is why I find it a bit strange when people struggle with simple tasks on the computer. I don’t expect any one to be able to decipher a hexdump but applying a little reading comprehension and common sense yeah I do expect ^_^

I first used a computer when I was still in diapers, I needed to find the command names on a piece of paper in order to run a program. Because I didn’t know how to list the contents of a floppy disk and figure out what was on it. Today I regularly use 3 PC’s and the command line is my friend. And although I have found superiors when it comes to people that know computers I have never found any one that shares my love of learning.

In gaming I have often said, give me a secure firing position, a mark to shoot at, and I’ll hit it given a good sniper rifle for the job. Like wise, give me a book and often I can inhale it, give me a manual and I might love it. I love to learn but I find school boring as shit… teaches nothing beyond the 3 R’s… In way to many years.

Heck, I could learn more visiting the library daily then I have from school since completing the 3rd or 4th Grade… And it would be quite a bit less boring at the library I bet.

POST, Power On Self Test

luckily I am off for about a week, well as good as off work hehe. So hopefully I’ll have some more time to get things done.

I want to,

work towards getting ‘nco’s task completed…

send Wiz that memo

send GCHQ that other memo

experiment with a custom widget in both C++ and Python / QT3

continue expanding the configuration systems in NPM.

camp out TG#1 and TG#3

enjoy the [SAS] Virtual Christmas Party

For tonight, I’m not sure what I’m going to work on but I’m glad that I don’t need to get up in the morning… I’m also looking forward to the clans big bash, Wiz and Valroe will be DJ’ing so that should be a good pair hehe. It’s also a good thing since this close to Christmas, it’s unlikely to find me or any of my family on the road more then necessary lol.

I also need to start logging into AIM more often, I havn’t gotten to talk to any one lately other then teammates over XFire =/. And since I *hate* phones and the aDSL tends to disconnect when the phone rings, I mostly use Instant Messengering.

“Why the heck did you call me ?”

lol. Unlike phones, IM’s allow some measure of coping with life here and actually getting to talk to some one… Without being deafened or inaudible, or losing the cordless.. hahaha.

I don’t think I would mind phones so much if it wasn’t just a complication of my already insessent multi-tasking.. A clone would be nice, then I could be in two rooms at once rofl. But a clone would probably be as annoyed as I get at it..

As much as I love my family, they can drive me bonkers given a chance +S

Extreme Multi-tasking on the PC and off the PC at the same time can be tricky lol.

Sorted my play list for the night, I have a fair system of selection. Using Amaroks file tab, finding each track that matches my listing mood… As usual a mixture of Metal, Rock, Country, and a couple other odds and ends.

Now if my mood… never mind.

Just for the heck of it, I’ll feed my m3u file through a little ruby script I wrote some months back out of boredom; it generates a HTML listing from the file, even has the ability to offer a little more information then this when used with id3lib. It also conveniantly has a switch to suppress the HTML tags that make it a full doc, thus generating output that can be copy/pasted into another HTML file or blog πŸ˜‰

I think I might actually tweak it a little bit, so it can be used as a filter. I liked working on it because it gave me an excuse to learn a bit of binary because of how I chose to implement it’s differing modes lol.

  1. Breaking Benjamin The Diary Of Jane
  2. Bruce Dickinson River of no return
  3. Cybrogs Montage Track02
  4. Cocaine Blues
  5. Die Toten Hosen The little Drummer Boy
  6. Die Apokalyptischen Reiter Ghostriders In The Sky
  7. Daryll Ann Surely Justice
  8. Elvis Presley Johnny B
  9. Folsom Prison Blues
  10. Hinder Lips of an Angel
  11. Hammerfall The unforgiving blade
  12. greenswat
  13. Green Day SeptemberEnds
  14. It Ain’t Me Babe
  15. Jackson
  16. Jeff Wunder Way of the sun
  17. JBJ Santa Fe
  18. Jørn Lande Duke of love
  19. LeAnn Rimes Hurt Me
  20. LeAnn Rimes Clinging To A Saving Hand
  21. LeAnn Rimes Blue
  22. LeAnn Rimes On The Side Of Angels
  23. Michael Gungor GOD Is Great
  24. Manowar Call to arms
  25. Nashville Electric Cooperative You Are Still My Only Love
  26. Nashville Electric Cooperative Where Love Was Born
  27. Pillar Frontline
  28. Pillar Rewind
  29. Sammy Kershaw Little Did I Know
  30. SAS
  31. Wildwood Flower
  32. Wiz July07
  33. Wiz Minimix4