Not bad for a setup on an old IBM thinkcenter A50

The server I describe in links 1) and 2) up for 52 days 🙂 . Not bad for a setup on an old IBM thinkcenter A50.


Update (September 8, 2012):

Now going on 83 days… call me a happy kid =)

Add new JSON document using plain text string with LightCouch


Small post outlining a small modification to the 0.4 lightcouch source to allow direct plain text json insertion. A colleague and I had a JSON string which we wanted to insert into lightcouch without having to create a JSON object – only to have .toString() be called during the final POST request.


Limiting TOP command to a specific process name and keeping interactivity


In this post we analyze the following command which allows you to run “top interactively without having to look up the pids” your interested in.

top -p `pgrep process-name | tr "\\n" "," | sed 's/,$//'`


The command is split into multiple sub commands.

  • top: displays running processes. With -p option  means monitor specific process IDs.
  • pgrep: Looks through the currently running processes and lists the process IDs which matches the selection criteria (proccess-name).
  • pipe (|): The pipe operator. It is used to direct the stdout of the first command to the stdin of the second command.
  • tr (translate): Is used for replacing or removing specific characters in its input data set. Above: linefeed(\n) is replaced with comma(,) .
  • sed: sed is used to remove the last comma(,) for the list. Sed is a stream editor which are used to perform basic text transformations on an input stream (a file or input from a pipeline). sed‘s ability to filter text in a pipeline particularly distinguishes it from other types of editors.


Simulating Keypresses / keystrokes with Javascript using Greesemonkey in Google Docs

This is a quick post about creating dispatching events using javascript and specifically key press events (for use with greesemonkey or whatnot and firefox).

Note that this will not work for the latest versions of firefox in many instances. I believe this is due to security updates.

Personally I am using this dispatch keypresses to google docs from a greesemonkey script.

Below the code for typing “hello world” to google docs from a greesemonkey user script.

I suspect there may be a more efficient ways though I noticed not all browsers support the same API 🙁 .
Specifically, on  we see that initKeyEvent is only available in firefox. On the other hand, initTextEventis available in IE, chrome, and Safari.

Sample Greesemonkey Script:


Killing CouchDB on Ubuntu 10.04

I Wanted to do some maintenance and move my couchdb data files to another partition but couchdb would not stop when I called the usual stop commands:

1)sudo /etc/init.d/couchdb stop
2)sudo service couchdb stop

Found a lot of posts and out of all of them found this nice tidbit below:

ps -U couchdb -o pid= | xargs kill -9


Note: It’s not the best thing to viciously kill a process. I imagine databases usually have shutdown tasks to do, must end with current insertions, etc. I’ll post if I find a bug fix.


Data insertion to CouchDB using Lightcouch lib in Java (Sample)


Hello, a small sample on how to insert JSON data to couchDB.

First off there are MANY java libraries for accessing couchdb. For information on which one to choose for you the 2 links below may help:

In this post we made use of LightCouch as we wanted something relatively simple without object mappings and other such features.

Aside: an also interesting tutorial utilizing couchdb4j with description of sessions is:


Reverse Proxy in Apache2 (Ubuntu 10.04) for CouchDB

Installing Modules

There are various sites with instructions that did not work.
However, following the instructions here> did the trick.

The reverse proxy module was installed:

sudo apt-get install libapache2-mod-proxy-htm

Libxml was installed:

apt-get install libxml2-dev


Reading web data with VBA from excel using Microsoft HTML Object Library and Microsoft Internet Controls

Excel VBA

Excel VBA


This is a sample script showing how I pull web-banking balances off the internet when I want to have a total picture of how my finances are. For the boring reasoning go to the last page. Otherwise technical details follow.

Project References:

Add the following to the references for this to work:

-Microsoft HTML Object Library
-Microsoft Internet Controls

VBA references

VBA references



The code below is an example of how to do this missing error handling. As it uses IE, it saves the developer the task of implementing SSL in VBA. 

Navigating the Site

Public oBrowser As InternetExplorer
Sub Login_2_Website()

    Dim oHTML_Element As IHTMLElement
    Dim sURL As String
    Dim text As String
    Dim avarSplit As Variant

    sURL = ""
    Set oBrowser = New InternetExplorer
    oBrowser.Silent = True
    oBrowser.navigate sURL
    oBrowser.Visible = True

    ' Wait till the Browser is loaded'
    Loop Until oBrowser.readyState = READYSTATE_COMPLETE

    oBrowser.document.all.Item("_contentPlaceHolder__loadedControl_NewLayoutSignOn__userName").Value = "USER"
    oBrowser.document.all.Item("_contentPlaceHolder__loadedControl_NewLayoutSignOn__Pswd").Value = "PASSWORD"

    ' Wait till the Browser is loaded'
    Application.Wait DateAdd("s", 0.1, Now)
    Debug.Print (oBrowser.document.readyState)
    Debug.Print (oBrowser.LocationURL)
Loop Until oBrowser.document.readyState = "complete"

oBrowser.navigate ""

    ' Wait till the Browser is loaded'
    Application.Wait DateAdd("s", 2, Now)
    Debug.Print (oBrowser.readyState)
    Debug.Print (oBrowser.LocationURL)
Loop Until oBrowser.document.readyState = "complete"

Application.Wait DateAdd("s", 2, Now)

oBrowser.document.all.Item("_contentPlaceHolder__loadedControl_balancesStatements__productsPagedDropDownList__selectionList").selectedIndex = 1
oBrowser.document.all.Item("_contentPlaceHolder__loadedControl_balancesStatements__productsPagedDropDownList__selectedIndexHiddenField").Value = "1"

' Wait till the Browser is loaded'
    Application.Wait DateAdd("s", 0.1, Now)
    Debug.Print (oBrowser.document.readyState)
    Debug.Print (oBrowser.LocationURL)
Loop Until oBrowser.document.readyState = "complete"


End Sub



Analysis follows on next page More

Backup on Bash Login from other server using SSHFS and RSYNC

Dear All,

Quick little post about a small script I made for backing up some files from a webserver (hosting apache+mysql).

I wanted a script which would remind me to backup whenever I would log onto the specific machine.

I would have preferred automated but I’m a little paranoid about security. Why?
I don’t want to automatically compromise the security of a public webserver if another computer is hacked…so even if the backup server is hijacked no certificate/password will be stored.

Hence running the backup script required an actual user to type in the password.


Editing Text within SWF files!

Today I was faced with the problem of changing a string within an SWF file, though I took it more of as an interesting challenge.

A colleague of mine had compiled an SWF using Adobe Captivate – an educational material builder.

Unfortunately, some of the paths were hard-coded and hence it only worked correctly on his own laptop…and I was itching to test something out.

So what does someone do ?

1st Attempt: SWF Decompiler and Options

I opened up the file in SoThink SWF Decompiler and attempted to export as an FLV file. More