3 Modules and a pillow.

Been at work on 3 modules tonight, the searchlet looks like it’s able to stand alone quite well, leaving the NPM_MainWindow() to sort out how to lay it out in the main window. The module to handle pkg_info is becoming likewise (atm it’s just a thin layer around QListView). I’ve also made a few minor changes to the dialogs module, as soon as I have time to learn a more effective way of dealing with the arg’s involved I can get several classes sorted quickly in that module.

Very productive day all around it seems lol.

Now for some Simpsons and Sleep……. zzzZzzzzZzzzZzzZzzz

Spent last night working on further modulariation of the NPM_MainWindow class and I ended up sleeping next to Dixie =/

How many lucky guys get to wake up next to a laptop hahaha !!!

Today every one else was out so I managed to get time to sort out my paper work, makes me feel a little better at having dozed of after 2-3am =/

We also had a nice live op.. Went quite nice until we came to an area, from what I could see through lakes cam I thought the area was maybe 25-30m square. So I figured, roll a sting ball out and dominate along the two flanks. One man down in the entry attempt, 2 pinned down and one separated…

Moving out and trying to take cover we lost 2 more men so I shouted for Pittman to hold in cover.. Only to get sniped by a buckshot firing shotgun lol…. My failure not the teams.

Playing through the round for fun after we failed the live op (yuke whent to post the report). The resut of us went through again to explor, finding out that the area was closer to 45-55m square with evated shooters along one flank.

Nice secrets we uncovered, lake found a secret passage ‘ghost wall’ that opens a passage into hallway below. There’s a |_| area there that leads into a pair of dark rooms, one of which the door to the out-side is closed until you get to the room; it was there when we were exploring. But not there when me and Lake when hunting, until we cleared that room!

The passage under the pools, I h ad fired several 5.56x45mm FMJ into it before but no go, Lake applied his .45Cal UMP45 and it worked :-). So we went through the water, up to the secret room, and back through a sand filled set of hallways and boom.

We found out that the statue of a Crypt guarded by Anubis had slid to one side, unveiling the next hidden passage and exit.

While Lake went off to hunt down stuff, I tried walking off a platform into some plants. To my shop I fell through and found myself in an armour, varius pisol, smg, ar, sg, and tac aids on shelves and I took this screen shot of names on the wall:

[Click to Enlarge]
Free Image Hosting at www.ImageShack.us

Spent most of the dy with a headache and killing time in the servers..

I did manage to get time to read most of the documentation on QT’s I18N & L10N features and it actually seems to be a lot easier then I thought.

I knew there was some thing I liked about the folks at Trolltech ^_^

As far as coding for tonight, I’m not sure what I’ll be working on.. All I know is my paper work is late and the dead lines in two days… So I think that has priority if my family would ever leave me be…

I don’t really know what is worse, taking aspirin so often you get stomach ulcers or putting up with the results of life here =/

code at last

Spent tonight working on rewritten logger and options modules for the next phases of their prototypes.

There still is a fair bit of work to do with logger (i.e. telling it / getting from it the name of log file(s)) but it’s now essentially integrated with the rest of the program. Internally the module might change quite a bit but it’s usage throughout NPM will remain pretty much the same save where the above is concerned ^ (basically within the options module).

The options module is quite a lot cleaner imho, now has a search for a config file and can write the configuration file, the module matures bit by bit. I’ve also streamlined the configuration file a bit but I’ve still got to find the time to work on some concept drawings of the GUI’s configuration menu.

I also want to take a look at QAction and QActionGroup later on based on inputs from the QT4 doc’s.

*technically* I could probably get it operational for building a port right now with a wee bit of work… But I’d much rather have the bloody thing working properly and tested first :-).

*sigh* after 0400… time for bed because work is in the morning. It sucks that I’ve to wait till like 2300 or later to start coding… Any attempt at getting stuff done while the rest of my family is awake has proved futile over the last year and a half….. I could be so much more productive if I didn’t have to cram-things around every one.. I’ve got paper work due for En4cers inbox that’s overdue, school work piling up, and a project to work on (npm) and I’ve got to fit it all into the time slot of

>= every one else in bed
< I'm ready to pass out
< the time to go to work
<= time to go to bed if I'm ever gonna get to work on time
Grrr…

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.