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?

thoughtful darkness, uncertain light.

My dreams haunt me, the memories of the past chase me… hopes of the future torment me.

Am I sane or insane? Does it matter…

My soul longs, the spirit is strong but the flesh is unable to endure.

My pain surrounds me, like a wall of razors

Each to an end, each to a beginning.

I grow so tired of the runners stress.

Yet peaceful shores lay so far off.

Is there nothing to comfort me?

I see again that face in my minds eye

that which haunts me

of the love lost

what future could have been?

oh is there no end to it.

The heavy weights come crushing down

my bones creak and fray

but refuse to shatter

the struggle never ending

the escape is null

while the path lay shrouded in darkness

the road back bleak as the distraught.

this eternal business no longer serves its purpose

my feelings overcome me

my mind trashed, heart rended loose.

fear, uncertainty, doubt are but trifles.

of anger and sorrow

nothing else to give, nor to take

only one thing remains

I stand alone against the onslaught

but not truly alone

yet my strength is week,

I have little more to resist with

the temptation is strong

the mind cracks and buckles

and the body flows

but only an empty sorrow prolongs

tis to which end?

And what fate shall lay before

to one road lays death

to the other, does my heart reside?

only time will tell

as I try not to fail

I crumble ever so

but unyieldingly remain

to struggle on to an uncertain end.

hope is like a sword with two edges

it lends the power to survive the terror

yet it cuts as deep as the bone

surrender is not a ranger word

though I be not one, my vocabulary is the same.

the ability to give up is not mine

to the true path I seek

to stay the course and fail no more

until that fateful day comes

when I become one again

no longer spread to the winds

but to a bright future bound.

— the ravings of a lune.

TODO: Make Packages

build on test machine, transfer to laptop:

GIMP

Qt4

PyQt4 ?

probably inkscape

logic:

kolourpaint doesn’t go far and krita is not a program I’m formfotable with

I’d like access to Qt4.3.3 on my laptop rather then just my desktop — compiling under windows is not fun compared to a unix box that includes a compiler, debugger, editor, make, and most every thing else to start with 🙂

Some times it pays to be single

Well usually my Grandfather sends me a check for my Birthday and a check to split between me and my Mother every Christmas. It didn’t come for Christmas so of course my mom took him off her card list, yeah you could say she’s like that 8=).

When he noticed that the checks was never cashed he had my Aunt call and resend them so… $400 arrived today. Normally I split things 50/50 with my Mom and the Christmas check usually is sent for both of us. I’m not going to say what I usually do with my share of the Christmas money less any one start thinking I’m a nice guy :

According to my estimates we spent it at a rate of about $130 an hour LOL.

I figured I could get the memory card I’ve had on my brain and stop buy and ogle the Digital Cameras and Printers at Best Buy. I didn’t find the 1GB Kingston card I was looking for but there was a 2GB SanDisk one for the same price plus a cheaper 1GB one from PNY (makers of my nVidia GPU).

When Ma saw there was actually a few cameras for $99.99 she was interested in (finally) getting one. Because the family camera, uhh predates digital cameras by 2 or 3 generations of de facto standard film? I wasn’t very set on buying one initially but, why not when there’s finally a chance to afford it lol. So I got myself the 2GB SanDisk card and went back for the 1GB PNY so there would be one SD Memory Card for transferring my files and one for using in the Camera.

We got a Nikon Coolpix L11 Digital Camera. It’s a compact 6 Mega pixel one with an LCD on the rear. I think I like it, first time I’ve ever used a digital camera really. I find it a little hard to aim using the LCD Monitor on the back because I’m used to the old family 110 film using camera for which my own is a similar model I got as a kid. It had the view port in the centre of the rear lined up with the lense and the flash to one side of it. So even if you couldn’t see crap you at least knew what you were aiming at ^_^

I’m no Peter Parker when it comes to photography but I think I’d like to learn more about the science involved in taking decent pictures. Thumbed through the user manual but I’ve yet to play with the new Nikons feature set. I know it can do Wav audio and Mov video and stuff but as always. Either RTFM or play as you go hehe. On this one the flash is centered and the lens is offset towards one side. It’s very nice that you can see what your about to capture on the screen. When I read the manual about how it dealt with pushing the shutter release half way for the AF/blah blah and all the way for taking the shot I was some what worried it would be to easy to by pass the half-push but it works really well.

It’s got the USB Cable and an Audio/Video cable with it. So using regular umass or PTP it should be able to transfer files easy; my Desktop has a 9-in-1 card reader but Ma’s only has USB. This also makes me happy that my Flat Screen TV has a set of A/V ports in back and in front, i.e. DVD and PS2 ;-).

It is technically the “Family Camera” now but I think I’m probably going to be the only moron who knows how to do more then take a snap shot with it without jogging peoples memories (I’m the RTFM guy) lool.

Sadly I was unable to find any reasonable Laser Printers that were not also all in ones. Found three inkjet based Hewlett Packard models, one regular printer and two all in ones. The regular printer was makreed as working perfectly on linuxprinting.org as was the two all in ones but the scanners were not listed as supported by SANE :

I could probably have gotten things going with the one all in one over a Wifi connection but I didn’t want to spend $120 for the sale price for parts I was not going to need (Ma has an all in one). So I took the cheap regular one. It’s just a HP Deskjet D1455 printer but it should work great with HPIJS.

The thing is compact which is great because there is almost no space to put it !!! The paper tray is a good enough capacity because where it’s likely to be put — reloading it will be unpopular for me. I also liked a lot how the Ink Cartridges come in two packs, if they gotta charge ya $30 or so they outa give you a fair deal for it after all. But not only can that you can also get two colour or two B/W cartridges instead of one of each in a package. I don’t do a lot of printing myself so most of the time it is just hard copy. Ma wanted me to get an extra cartridge so I got a pack of 2 blacks.

Me and printers generally don’t mix well, hey I use hard drives for a reason !!!! Namely that I don’t own a filing cabinet lol. I also like the idea because if my mothers printer goes down or needs fresh ink she could always use this one and I do intend to hook it up to my OpenBSD Box for network printing.

Tomorrow I’ll need to fsck with it. To be honest, I wouldn’t mind putting it on my desk here just for the extra space but that is still at a high premium : I don’t really need a printer so much as I wanted one. I also like the idea because ma could use this one for work rather then going nuts buying cartridges for hers if it goes down. She does a lot of B/W printing and her all in one gets very pissy about doing any printing if you don’t keep all colours full which can be bloody expensive in the middle of the month !!!!!!

With the memory cards, I had an interesting problem. Trying to write to the 2GB card made FreeBSD reboot. I used Vi as root to create a new file on it with a test string. The file got created empty as the machine rebooted… After I stuck it in the new family camera and took a random snap shot of my desk. Plugged it back into the box, mounted it and used FreeBSD to view and delete the files – worked perfect, even made another test. Funky but hey, as long as it works lol.

The only problem is while FreeBSD detects my desktops internal USB 9-in-1 card reader it doesn’t seem to find my laptops 4-in-1 🙁 So that is gonna take a little mucking around.

While walking around I also saw some thing by chance, nab’d a Trace Adkins CD which just happens to have my favorite song on it :-). This is like the first time I’ve bought myself a Music CD in 5 or 6 years or so loool. While we were there my mom grabbed a few collections of Johnny Cash so hopefully I’ll get to rip those later xD.

I used my laptop to rip my CD, worked quite well and I’ve got a nice battery of oggs. Konqueror can also do inflight ripping. Just open the CD in the file manager, choose the format (wav/ogg/mp3/etc) and copy the files to your hard drive and it will automatically rip them for you ! I tested it but found it a little slower then I cared for but I’ve got to admit. That is some pretty damn good desktop integration of music cd’s !!!!!

I fed the CD through kaudiocreator and ripped them. I chose ogg because I generally only rip to MP3 when I use Windows Media Player for the deed. I think I might let Amarok finally organize my music collection, it’s small, under two gigabytes but that’s because I almost never buy (or can afford to buy) music. If I had the money to spare and parts of the music industry wasn’t such jerks I think I would probably get most of the songs I listen to on the Radio, on Audio CD. But hey, in this world of DRM and $$$ crazed people I’d rather listen to the radio and skip the on-demand freedom of ripping the CD to my hard drive when it sends more ca$h their way.

I just hope I can get the card reader on my laptop going because I don’t have enough cash left for an external USB one… And that’s the main reason I spent the $20 for a 2GB one. If I dumped ~/Music and ~/Video’s to my file server and maybe my wall papers collection I could fit my entire home directory on this Secure Digital memory card.

For me, it’s just a pest to have to use my file server as the man in the middle if I want to work on files from one system or another. So often projects started on my desktop get done there and ones on my laptop Dixie get done there. Which is probably why the master version of my “home directory” and all personal files are on my laptop along with lots of source code and documentation lol

I remember one time I had money to spend.. I set aside $100 to donate for [SAS]. I’ve always wanted to be able to donate but my personal income is not connected to how much work I do :. It was a good idea… Until my family bled me dry before it could be done.

You could say my family can smell money… lol.

It’s kind of odd that I’m the only one that doesn’t place much value on it. It’s just paper, you can trade it for stuff but not good for much else unless you’re short of toilet paper.

I was able to set aside like $70 dollars or so by ***NOT*** spending the gift money I’d received for several holidays but that got drained to.. I never ask for repayment and with the exception of the $100 I set aside last year… Usually give when there’s a need. My replacement graphics card was bought with the money my mom would have used to repay me for the money I gave her from my schooling. I thought about setting aside some of this money today in hopes of donating some to [SAS] but I knew if I tried that some one would find a way of spending it.. *sighs*.

If I had a steady personal income I could donate weekly.. and without others finding ways to spend it for me :

You know, I think I am glad to be single at the moment.. Not currently involved so no fund fundellation spent that’a way. Because I know what I would do with that kinda cash to spend on that special some one today, ok I can be a bit of a romantic at heart, so sue me :-P. Got to admit, pretty good timing as things happen to be… hehe.

My family would still have some thing to say through 8=). I could always be a bastard and say no.. but I’m not greedy, selfish maybe but not greedy. And my family usually finds a way of being needy whenever I have the ability to be of assistance… I’m not complaining but I’d still enjoy a little more freedom.

I figured, it was about time I spend money on myself for a change (y). I’m $400 lighter but it was well spent and not all of it on me either.

out of $400,

Private expenses:

Printer – $70
Extra ink – $30 (Ma’s idea)
HP Paper – $8
Memory card – $20, $15
1 Music CD – $14

Family expenses:

Camera – $100
3-4 Music CD’s – ?
Dinner – ?

Remainder used as a gift and empty pockets for me again hehe.