Ravings

Here I sit, the darkness is on the brink

the business of the day gone by

my emotions come to intrude even upon the solace of my coding

I reach out for the things I desire

yet the seem to far off to go

will I ever reach the destination?

Will it even be the destination I seek…

Oh how I long…

the memories of the past haunt me

dreams of the future wound me

yet what else is there for me?

But my memories and my dreams

Of the things lost

of the things sought

the road is narrow as I stumble

all there is here is pain

till I reach the end of the journey

yet I can not tell how long it shall be

only that it be long and hard

what will await at the end?

to truth or to sorrow

to passion or to torment

I reach towards the future yet my arm is blocked, tied, constrained

bound by the past, of wounds still fresh

I can’t help but wonder, what will the future bring…

Be it madness, be it happiness, as long as it comes to a success.

what is life but a tail of joys and sorrows.

the deeds of ones hands and thy toil.

Of loves lost, of loves to be found…

Tis to an end my dear,

for I can bear it no more.

the mind must learn to forget,

as a new day looms.

To a new horizon I set sail

and of the warm waters I dream

in search of that island paradise

once more, forever more.

— The driftings of a spider

EOF

Brushing up with Java

It’s been quite an interest of mine to brush up with Java and Perl for awhile now but time has never really allowed me to do so.

Java for me is a language to which a lot of knowledge is stored away in the ol’brain but little wisdom so to speak. Java was maybe my 3rd language but I’ve also done a pretty good job of writing almost no Java code over the years hehe. I’m used to the syntax though. One day the Library had a sale of old books and one was the Java Sourcebook by Ed Anuff.

This was maybe 2006 and the book was so old that some where in the interface I think it said that JDK 1.0 Beta would be released by the time people were buying the book. Until more recent aspects involving Python and C++ with Qt3 / Qt4 its introduction (unwritten) to Javas Abstract Window Toolkit (AWT) was the closest I ever got to GUI work.

It is a very good book IMHO but of course very dated, I don’t know how much java.lang.applet and whatnot has changed over the years, I never really cared much for Java applets! But I am pretty sure that a lot is different with AWT and the newer Swing toolkit. One thing that I actually find interesting, the Java Sourcebook is maybe the only book I’ve seen that uses the same brace style I tend to use in C. Hmm, maybe it was an influence on my ways of doing things :

Not to long ago I checked out a nice O’Reilly book on Java because I wanted to see how much the language had changed in the past ten years or so. Java indeed changed quite a lot, it is way more fatter then I remember but it is still just as sweet.

One thing I like about C, the syntax is small enough to cram in ones head easy and follow it up with a reference of the standard library for stuff you don’t use often. Java OTOH is probably a few orders of magnitude larger then that for most people. With the things I noted, inner classes, generics, etc I was a little suprised that they were there but the language seems to have grown naturally. As I read though parts of the book I was constantly like “Oh, that works just like I expected” when comparing the detailed explanations of how things work along side the code listings.

C++ was my first language aye but I think I’m more comfortable with Java. Because in the fields where C++ differs from C, I tend to get a little more lost, while with Java most of it is already there.

Perl, my second language but probably the weakest in my skill set. I quickly got board and skipped a lot which gradually filtered through over the years. I respect Perl for its power and flexibility but I think it has gotten a little to big for its own good IMHO, although I wait to see what Perl 6 will bring us.

I remember in the Java Sourcebook there were several examples, such as an implementation for Lamp and LightBulb classes that interacted and various cat related ones that used a speak() method to examine how overloading methods and inheritance worked.

This is a reworking of it from memory, same basic idea though:

Jeez now that I think of it, those examples remind me of stuff from an UnrealScript tutorial I looked at a couple years back too. Who knows with how much UnrealScript feels like a customized Java they probably read the same book hehe.


/**
* Feline.java, abstract representation of felines
*/
abstract class Feline {
abstract void speak();
}


/**
* HouseCat.java, implements a feline that meows
*/
class HouseCat extends Feline {
HouseCat() {
}
HouseCat(String call) {
this.speak(call);
}
void
speak() {
System.out.println("Meeeooowww!!!");
}
private void
speak(String call) {
System.out.println(call);
}
public static void
main(String[] args) {
HouseCat theCat,newCat;
theCat = new HouseCat(); /* use default constructor */
newCat = new HouseCat("I am a cat!");

theCat.speak();
}
}

The HouseCat class implements a Feline (abstract meaning you can subclass it but you can’t create it directly). There is a simple constructor made to behave like a default constructor and one that invokes a private version of the speak() method using a supplied string.

I have the Java Development Kit and Run Time Environment installed from the packages on the FreeBSD Foundation website. Compiles fine with javac and gcj42, that is the GNU Compiler for Java ;-).

What I do like about Java, its fairly portable between systems running the same implementation (e.g. Suns JRE) as far as language features go. It also follows a largely logical behavior for many things from what I have seen.

And to top it all off, GCJ can compile to native machine code rather then Java Bytecode — for me a huge plus. I do have Qt4 bindings for Java installed on my desktop so I am interested to see where that goes, as far as my laptop is concerned I would probably need to use Suns compiler for AWT/Swing apps though. Not sure if Qt Jambi is in FreeBSD ports yet either.

As much as I love C, there are just some things that I don’t really want to have to implement in it. And as productive as I am in Python and Ruby I really need to cuddle up with some thing a bit closer to C’s end of the spectrum. I don’t really care a lot for C++, I can use it fine but don’t see much point for it over C besides templates and exceptions. Java lacks pointers in the same light as C/C++ uses but the references should be fine enough for my general needs.

C++ is multiple inheritance and Java is single, I’m not really partial to either concept as long as nether takes to biting me often. I have long enjoyed the design of Java’s classes and interfaces though, I love the interface thing in Java.

I don’t exactly care much for Suns compiler though but hey, if it works (y).

R&R The Training Way

Having been successfully stress-increased for the day I hit RvS Custom Mission mode for a little time to cool off. I set it to MP Peaks and took a Walter WA-2000 sniper rifle loaded with .30 Magnum FMJ and a MK23 SOCOM .45ACP with JHP ammo for self defense. 3 Flash bangs and 3 Smoke grenades, meaning 5 magazines of 6 rounds + 1 in the pipe for my Walter and another set of 4 12 round magazines for the sidearm plus one chambered.

The first round I maanged to have a turkey shoot, they kept coming to see where I was hiding only to be gunned down. The volume of the Magnum cartridge drawing more X-Rays to there doom… then I got overrun and flanked trying to retreat under fire to the nearest dead ground. I made a quick run but still got shot in the ass as the enemy ignored the smoke screen.

The second round, I got compromised just moving into position and ended up with about 4 or 5 X-Rays on the hill line itching for hairs.

Within about 1-2 minutes I had expanded as good as 3 magazines from my Walther and I was starting to worry about X-Rays coming around from behind. I worked up the hill and started picking off the enemy, working slowly to the winter lodge.

With about 3 rounds left and maybe one full mag left between me I took fire on the way. I knew with a group of X-Rays aware of me and an active shooter after me with a sniper rifle; you stand, you die.

So I decided again to redeploy but this time I did it the *right way*. I downed the nearest threat, pulled back and puffed a smoke between me and the incoming column.

Then ran like hell for the hills behind me, turned around and drew a bead on the incoming X-Rays. A few more down and off running further back to the bridge and another smoke grenade to screen my retreat. One tango gimped me but I managed to leap from cover to cover: taking position, suppressing, smoking, and running like hell to do it all over again until I limped myself back to the dead ground the bridge passes over.

At least two X-Rays close, one bought it from my current magazines last rounds as he tried fragging along with his teammate. Slung the rifle and slide out flash bang for shock value. The .45 sidearm coming out to finish the job… No point running when you’re already at the most secure place in town eh?

Took down the last threat, reloaded my Walther and moved on with the last 2 or 3 rounds loaded. Moved back to the lodge on one leg finding only one enemy left. who took shelter inside unaware of me.

Closing in with rifle ready, threw a bang into the lodge and went in with my MK23, 2 X-Rays down and the lodge was secured shortly. Back outside I checked the corner to see a shooter dashing close.

Slapped back into cover and went ready with the last of my sniper ammo, one miss and two hits as he lobbed a frag and readied to shoot me before it even blew up !

Good thing I was behind the wall and a pile of logs hehe.

A proper way of retreat though, puff the smoke to screen it. Move away, get some ground, fire back, rinse and repeat until contacts broken or you get a spot to fend them off from. With a proper 2 or 4 man Element it would actually work better. Because you could have a fire group suppress the enemy while a maneuver group jogs it to cover; switch positions with the fire group leaping next as they reload. While the maneuver group lays down the cover fire.

This video shows the concept very well in my humble opinion.

I’m used to doing it in pairs… not solo. Because it was impossible to run full out and fire at an enemy to my rear the smoke was really an essential part of trying to break contact alone.

Now having some one next to me with a nice SAW would have been a good combo with it though 😉

Creating Firefox searchplugins for any site – including Qt !

You know, Firefox and friends have a nice search system but there are so many websites that just don’t have a canned search plugin you can install like the Wikipedia and Google ones. Because I use Qt and Python for most work on Neo Ports Manager I tend to RTFM a lot and one of the things I truly love about using KDE’s Konqueror webbrowser is I can go to the address bar and

qt3: someclass

and it will take me there, in fact I have it setup in Flock at the moment to use qt3, qt4 e.t.c as keywords to take me to the index. The thing is, I would like to search, after all there is a bloody search bar !

I tried looking online on how to make one but didn’t find any thing helpful, I think the stuff was written for Firefox 1.x so to heck with it. I opened profile and looked for where the search scripts were located. My laptop and desktop use Flock as the default web browser but the only difference this should make here is that my profile is stored in ~/.flock instead of ~/.mozila/*

The searchplugins are in your user profile, for me with flock it is:

/home/Terry/.flock/browser/t247gnll.default/searchplugin

On Windows the profile goes in your %UserProfile%Application Data in a folder such as mozillafirefoxprofile-name or flockbrowserprofilename depending on the browser you are using. Don’t have a Mac so dunno where it goes on there but thats why there is a FAQ online 😉

In here are several XML files,

Terry@dixie$ ls                                                            7:25
dictcc.xml gmail.xml qt3.xml youtube.xml
dictionarycom.xml photobucket.xml weathercom.xml
Terry@dixie$ 7:26

Each one is a search plugin in the search bar in the top right of my browser, qt3.xml is a file of my own creation.

If you are like me, when you are surfing the fine web you occasionally look at the URL’s of the web pages you visit, since I spend alot of time looking around at the Qt documentation I know that the documentation for each class is stored as ClassName.html in a specific folder on trolltechs web servers. This means if you can find out how your favorite website stores it’s files you can create a search plugin for nearly any website on the world wide web !!!!

I opened the dictcc.xml file to see how it is done, so simple it is easy as pie. And unlike Operas easy way of doing it in the GUI, we can set an ICON to use in the search bar 🙂

Qt class docs are in http://doc.trolltech.com/major-version.minor-version/classname.html so we want the text we type in the search bar to be replace the classname part of the URL with out search text, we do that with a little string interpolation.



Qt Toolkit
Qt3 - Search all classes
UTF-8
data:image/x-icon;base64,
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAACQkWg2AAABtUlEQVQokY2Rv0sbYRjHv+97d1zu
8gtzwauGGmgjXU+hpaVCMlUMDnZox4IS/AvcCg4Obv4HLZk6dNLFJJ3SQoYkpSTQVUMj8Vf10KaX
O+Jd7u2QkHha0O/4PJ8Pz/PwkE8/XuB+cWwGBv6eNIAri7nuLeG4Yde/WidNGwxqXNBS0uRjod+S
QxQAGa7EXOSz7Uquw9jIJwRP5+V0JkzpoDKakM+2y7sdUSJzS4HEjAiC/Vq3tGNUCyaAxdVwH6PD
TSq5jiiRzKaSfBOIJYSwwkVjfGZT8cn0+xfzcM/2CPVvFmN4uRRQ4wIA49LNruufty7OWr25137G
UC+aHuH0lw0goYlD+qzljKncwyfC9IwI4PTA8QiDE6/Rnuq1DI5W40Lj59VevTs+xetHTmSCo5Sc
HzrZdX161gdAneI9E7SURAhKO0bkAfd2bWxlQ1neUKIxXj/ulXc7hEBLyR5h4pHwbMHftdiH9/p5
yzEu3b8Xvf72AHwBGowMyNHjXBf5j3+qBfPG46QgNdvu87Q/nQl5hH6O9u1a0frdtAGMx3ktKYei
XGnbePUuyPHkP8KdoXcj3vwDRIGtlNEJQYAAAAAASUVORK5CYII=





I saw that icons were encoded in Base64 much like with E-Mail attachments by looking at the dictcc.xml file so I wanted to include an icon for my qt3.xml search plug.

So I went to trolltechs website, downloaded their logo, opened it in kolourpaint and resize/scale’ed it down to 16×16. I then searched for a base64 encoder/decoder that could handle more then plain text, because opening an image file in a text editor to copy/paste is a pain in the neck. I consider this fair-use of the logo, if Trolltech doesn’t they can write me a search plugin ^_^.

I copy and pasted the encoded form of the icon into the file as you can see above and volia we have a search plugin muhauahauha ! Then saved the file, restarted flock, wrote “QLineEdit” in the search bar without qoutes and clicked the ‘Qt Toolkit’ entry and flock opened a new tab with the QLineEdit class documentation for Qt3.3 ;-).

In a few minutes I will make a Qt4 one and change the ShortNames accordingly. With a little attention to detail this means a search plugin can be created by most any user for most any website. In fact with a little work I could probably set it up so I could search the [SAS] or PC-BSD forums this way, either through the search functions ability to look for topics posted or by thread #’s to go straight to a thread (which would not be fun to have to search by!).

I wonder if with a little poking around at the Open Search and XML specifications if I could have the searchTerms passed on to a perl script to do a a few tricks and pass it back in… I should look at that option some day hehe.

I love it when people make it so you can plug into an application without having to compile crap !

so fscking tired…

I’ve spent most of the day hoping and jumping about doing things, a good headache is here to show for it too.

I’ve also got work very early tomorrow for which I’ve been reminded about 5 times in the past half hour and many more over the past 2 or 3 days — my thinking on the matter

If I could get /work/ done during the day rather then running ragged or worse. I wouldn’t be up till 5 in the F’ing morning !!!!

Dynamic Coffee Break

A little test of XFire’s Video BETA feature. The original is about 2.49GB of AVI file but the image quality is equal to my game. This ones been converted to a 43MB VCD compliant MPEG file and uploaded to my photobucket profile (uses flv/flash)

My dynamic coffee break on the MP Presidio map. I think this is a good enough example of pace — Dynamic is as fast as is safe, if you’re not safe you are going to fast. If you can go faster without losing safety, you’re to darn slow. The video is however not an example for others, it’s a demo of what can be made from the video capture in xfire 😉

A pretty typical kit for me, Eddie Price (UK; SAS) character, H&K MP5A4 9x19mm FMJ; Sig Sauer P228 9x19mm JHP; 6 Flashbangs; Light Green BDU. All weapons without attachments and the crosshairs off.

Click To View

This is far from a perfect run, I see at least 9 or 10 things that are just obvious fowl ups on my part. Lucky for me being an RSM does not mean you play like a God… lol. I wanted to take a video to see if I could use XFires video system for training purposes without having to ‘get’ a camera man to video for me.

Technically this was just fooling around but some of the obvious errors every one can see are:

/* note: timer is from counting up from 0, as in WMP. */

  1. reloaded in the nude, missed the door button
  2. overly exposed while deploying flash bangs (box room 1min in)
  3. Forgot to slice the corner at top of the stairs (I was being flanked and in a hurry)
  4. Again I greatly exposed myself while deploying the bang against the enemy on the stairs / foot of stairs.
  5. missed bang upstairs (1:49) and demonstrated poor aim. Throwing grenades accurately without the reticle enabled is sadly one of my big failing points during my own trainings…
  6. I didn’t check the corner before entering crevice on top of the back stairs (2min in) — I could’ve been shot in the back of the head.
  7. 3min in, didn’t know what I was doing before I got to my point of entry (double door, bang diversion + rush other). You can see the moment of hesitation as realization hits me
  8. The back ally (3:50), I took the most exposed route to improve my accuracy for fear a side-sweep would let one of them get behind me. In the end the next group of X-Rays basically had me pinned down in a very bad position (4:20).
  9. Very poor accuracy overall for an [SAS] Member — 50% or 54/108 (rounds on target / fired)

Most times I reloaded I was a bit ‘lite’ on ammo. I’ve used the MP5A4 long
enough in RvS that I can ‘feel’ my shot groupings out so I know when I’m
reaching a dangerous level of remaining rounds. The bean counter is helpful for statistical purposes lol. Although ideally one would want to reload around 14~16 rounds instead.

Codes before Pillows

Sat down and started working on NPM again, this is my first commit in a few weeks… Mainly because the last few weeks have been a living pain in the ass rather then a codeathon.

Terry@dixie$ svn log -r HEAD                                               8:55
------------------------------------------------------------------------
r53 | sas_spidey01 | 2008-02-20 08:54:55 +0000 (Wed, 20 Feb 2008) | 23 lines

optionsinterface.py added

A thin wrapper around a dictionary of options (to be kept private)
that exposes a getter and setter method for each key:value pair.
For which is intended to be used as a slot from the GUI or a call back
of sorts from a slot in the GUI to the options interface.

A simple 'flush' method is provided to update saved config (not
finished). NPM_OptionsInterface is to be integrated with NPM_Options
in some suitable manor that removes as much as possible of the system
from the 'middle' of code that needs to get / set options values.

The question of using Qt's settings subsystem or the existing one
remains to be decided.

npmwidgets.py modified, gaining an extra slot for NPM_SpinBox -> man I wish Python had Cs Preprocessor some times.

settingspages.py -> checkboxes, spinboxes, and the override server prompt connected to the NPM_OptionsInterface provided.


More to be changed in the future design wise (for the better).. When I've got more sleep to think about it.


------------------------------------------------------------------------
Terry@dixie$ 8:5

If I didn’t have work in the next city tomorrow I’d be working on this for another two hours nut alas it’s already approaching 0400R / 0900Z rapidly… And I’m to tired to comment much more.

I do know this, I want to be able to get / set options as necessary through slots. Without having to have any understanding of how the config file is handled else wheres. At the moment I’ve basically started a switch from NPM_Options::config to NPM_OptionsInterface::config for storing the options in memory. The difference being at the moment NPM_Options is only able to read the configuration files using Pythons INI parsing classes for our needs. And it exposes a dictionary of option=settings. The difference between obj.config[‘optionKey’] = value and obj.getOptionKey(value) is negiable for me.

The thing of it is, what if we need to do more then just assign a value to keep things in order ? At least with a set of methods around the problem the rest of the program can be insulated from any major changes in that part of the system. I also know that I have very little interest in extending pythons dictionary class just for the occasion lol.

sleep….

Some how I knew today was going to be a living hell before I even went to sleep :

I think the best description of today would be emotionally bleeding out… I think if I was any one else I know except me. That I would’ve spent most of today stone cold, stark raving drunk.

Being myself however I’m sober as a cod fish.

*sighs*

I love my family… Even if it is hard some times.

Beware of Pythons

One sad side effect of using Python so much the past few months..

I actually had to invoke GDB’s ‘help’ command when debugging some C code tonight :

I know several languages but I tend to do things in “the language of the moment”, if I’m working on some thing in C, most of what I do on the side will usually end up in C. Like wise if its a project in Ruby, ruby scripts start filling up lol.

Maybe my brain could use an extra 256K of memory?

Writer’s Block: It’s Hard to Describe

What is one thing you struggle to describe?

Live Journals Writer’s Block

The internal functioning of the human mind and its processing of information.

I know how my head generally works so I’ve got a base of whats to be described

but to actually put it into words… I generally find the only way I can express it is through computer code. The way I talk of how I think is closer to how one might describe issues of implementing a memory manager unit (MMU) and a scheduler. Because for what little I know of them at the conceptual level is a lot more then I know about psycho-babel for describing thinking ^_^

I think the internal workings of computers are also a fair analogy to the human mind. GOD created our minds in his own assembly language, so why not describe it in our own terminology?