Corrupting bash on Windows

Let’s asume bash is allready installed:
sudo apt-get install bb

If you are root exit to the normal user, bb won’t launch as root.

bb -loop -dim -bold -reverse -normal -boldfont -extended -inverse

After a while (especially during the heavier animations) the line width wil vary and result in some weird looking stuff.

ExtJs 3.4 – Tips and tricks


This post is mostly a whole bunch of information I have gathered to using ExtJs 3.4 grouped by different subjects.

I hope any one stuck with Extjs 3.4 to have use for it.

Errors and possible solutions

Writing code and debugging ExtJs can sometimes be a pain because errors trown by browsers are not always clear. Like with most software, not all errors shown point directly to the actual problem. Unforntunately because javascript is very flexible, it can go wrong on many levels.

The following list gives you a guide in which errors indicate to which problems.

this.addEvents is not a function:’statesave’
Check if you use new for all of your created Ext components.

‘events’ is null or not an object
Check comma’s in items arrays

‘minWidth’ is null or not an object
Check comma’s in buttons arrays.

Expected identifier, string or number
Check comma’s inside Ext element config objects or/and arrays.

Comp is undefined
Check for non existing or empty references in an items list.

‘id’ is null or not an object
Check comma’s in ColumnModel arrays.

Unterminated string constant
If it occurs in Internet Explorer it is likely caused by disabling a form prior uploading a file. This somehow causes internet explorer to not send any form information when it is submitted.

TypeError: this.ds is undefined
Stores is not defined for a grid(panel)

Unable to get value of the property ‘0’: object is null or undefined
Check comma’s in field array of stores.

TypeError: this.config[col] is undefinedvar width = this.config[col].width;
Column model with autoexpand not pointing to a valid column. Must point to an id that exists within the column model.

TypeError: c is undefined
Calling add() on a panel/component with an empty or otherwhise faulty reference

Debugging events

Blog about logging all events.

Ext.util.Observable.capture(myObj, function(evname) {console.log(evname, arguments);})

Store query on exact value

var selectedOptions = this.optionStore.query('id', new RegExp('^' + Ext.escapeRe(String(selRecord.get("answer"))) + '$'));
   //Returns: MixedCollection\\
   //Returns an Ext.util.MixedCollection of the matched records

Store ‘fix’ modifiedRecords()

ExtJS store by default does NOT remove records from modified records on remove or load.
To make this happen use pruneModifiedRecords: true to do this{
        pruneModifiedRecords: true

Create new record for store

   var data = { id: 4, name: 'something' }; //initial data
   var recCreate = myStore.recordType;      //cosntructor for a new record (can allso be called directly)
   var rec = new recCreate(data);           //create record
   rec.set("id", 0);                        //alter after creation
   myStore.add(rec);                        //add to store

Find row index from record

   var recIndex = myStore.indexOf(rec);

Find data index from columnIndex and record from rowIndex

var dataIndex = fGrid.getColumnModel().getColumnAt(fColumnIndex).dataIndex;
var record = fGrid.getStore().getAt(fRowIndex); 
var recValue = record .get(dataIndex);

Using filter with combobox

Apply following config options on combo to make it work

clearFilterOnReset: false, //to make filter on store work
lastQuery: '', //another filter fix

Grid rendereres

percentageRenderer:function(fValue, fMeta, fRecord, fRowIndex, fColumnIndex, fStore) {
        fMeta.css += "cssClass";
        return fValue + "%";
checkboxRenderer:function(fValue, fMeta, fRecord, fRowIndex, fColumnIndex, fStore){
    return '
'; }

Set scope of renderer to current object

renderer: {
    fn: this.someUsefulRenderer,
    scope: this

Grid cellclick with image or other elements in renderer

When rendering images or other deep elements within a cell the cellclick events do not longer work correctly. To fix this increase the GridViews depth search paramters. This works on any type of grid view.

view: new Ext.grid.GridView({
   cellSelectorDepth: 4, //increase to find deeper elements
   rowSelectorDepth: 10 //increase to find deeper elements

Grid using drag an drop in grids

define following grid config options

enableDragDrop: true, 
ddGroup: 'mygrid-dd',  
ddText: 'Place this row.'

Create drop target class after render"afterrender", function(){
   var store = this.stores.periodEdit; //change to actual store
   var grid = this.periodGrid;  //change to actual grid
var ddrow = new Ext.dd.DropTarget(grid.getEl(), {  
     ddGroup: 'mygrid-dd',  
     copy: false,
     scope: this
}, this);

Override notifyOver on this dropTarget instance to see if may be dropped Notice: using ‘dd.getDragData(e)’ causes the selections in the selectionModel to be changed

notifyOver : function(dd, e, data){
  var sourceIndex = data.rowIndex; //get sourceIndex
  var targetIndex = dd.getDragData(e).rowIndex; //get targetIndex

Override notifyDrop on this dropTarget instance to do an action when dropped

notifyDrop : function(dd, e, data){
    var sourceIndex = data.rowIndex; //get sourceIndex
    var targetIndex = dd.getDragData(e).rowIndex; //get targetIndex

Prompt for question

When you want input from the user on a question. Questions like: “sure you want to delete this?”, “Sure you want to go on and lose your unsaved data” etc.
Use the here under described function
Note: Although the buttons can be localized the answer inside the function doesn’t change. Look up the function to see more button configurations if needed.{
	title: "Opslaan",
	msg: "Would you like to delete this item?", //use translate to localize the message
	width: 400,
	buttons: Ext.Msg.YESNO,
//      buttons : { ok: 'Actie uitvoeren', cancel: 'Terug' },
	closable: false,
	hideBorders: true,
	style: "border: 0;",
	fn: function(answer, text){
		if (answer == "yes"){
		else {
			//do nothing
	icon: Ext.MessageBox.QUESTION,
	scope: this

Checkbox column in grid

Toggle selection

    this.grid.on("cellclick", function(grid, rowIndex, columnIndex) {
        //get record
        var rec =;
        //get data index
        var dataIndex= grid.getColumnModel().getDataIndex(columnIndex);
        //toggle value false/true
        rec.set(dataIndex, !rec.get(dataIndex));
    }, this);


	function(fValue, fMeta, fRec, fRow, fCol, fStore){
             fMeta.css += " x-grid-col-selected";
             return '
'; }

Grouping grid The column you want to group with must be included within the columnModel. Even if it’s hidden, it MUST be included.

Use CSS background class to an image


Replacing or reseting upload field

Because of security reasons an upload field cannot be set or reset.
The only way to do so, is to replace the whole field.

See the example below:

//replace upload field
var config = uploadField.initialConfig;
uploadField = new Ext.form.TextField(config);
//re-add to the fomd the upload field contained too
//this can also be a grouping label etc

Show / hide loadmask

When you are loading or saving something inside your interface, you don’t want the user to change things that might get updated the next second or will not be saved because the actual data is already send to the server. Additionally you would like show the user a vissual indication something is going on.

The following functions add a loadmask to a component to achieve this. The inner workings have been proven to fix problems that occur when this function is called before the actual component is rendered. And even shows the loadMask in the event that rendering completes before loading does.

    //show load mask
    //shows it on this gui, waits for gui to render if not already done 
    //and if hideMasks is called before showLoadMask. The loadMask will not be shown.
        //see if main screen is already rendered
            //if no loadmask created
                //create loadmask
                this.loadMask = new Ext.LoadMask(this.getEl(), {
                    msg: app.instance.translate("loading data") + "..."
            //if supress load mask flag is set
                //do now show mask
                delete this.surpressLoadMask;
                //if everything ok, show load mask
            //if main screen not rendered, rerun when rendered with small delay
            this.on('render', this.showLoadMask, this, {single: true, delay: 100});
    //hide the load mask (and additional masks if added)
        //if loadmask is created
            //hide loadmask
            //if loadmask is not created, but this function is called. 
            //set supressloadmask flag to prevent load mask from being shown here after
            this.surpressLoadMask = true;

Virtualization woes

This storm has been brewing (in hindsight) for the last couple of months, but shit only hit the fan today when Pure-ftpd was fired up.

It’s a quite simple setup, windows 8.1 pro, VMware and a few virtual machines used for debugging and a basic network and internet connection.

The transfer speeds weren’t great, but hey it’s still way better than the internet connection we have. For legacy purposes we installed Pure-ftpd and started it without a problem, the VMware host connected just fine, so far so good.

But as luck ran out for the rest of the day no other machine was able to connect, a “quick” hour of happy debugging later and nothing was fixed.

The first clue came from a ping, all machines reported “(DUP!)”, a closer inspection with Wireshark revealed that all virtual machines had this issue (even the Windows server and the VMware host). All packages were being quadrupled, most protocols seemed to handle this just fine, except for the FTP.

Some quick googeling pointed towards the “Routing and Remote Access” service, but since that was already disabled and no other interesting suggestions popped up it was nearly back to square one. It did however lead to the simple test of disabling the “Base filtering engine” which did do the trick for some unknown reason.

As we don’t care about the machine’s firewall and don’t need ipsec either the case is closed for now.

Etherpad lite


If you are interested in running your own multi user collaboration text editor from a browser, then Etherpad might be the thing for you.

To be more precise: Etherpad lite

Years ago I used to role play on MUCK servers that had this kind of functionality. Asynchronously editing text, their the focus was more role play oriented. Which led me to find Inifiny note which later got renamed to Gobby.

Gobby does the same as Etherpad does, but runs from a hard coded client instead of a browser.

Background info

Currently I’m in the process of implementing Etherpad Lite for a non profit organization I do technical tid bits for.
As such this post will grow as my understanding of the application, its installation and customizations grow.

Most formerly if you want to give Etherpad a try, without installing it I suggest trying either:


Which is run by the Swedish pirate party and is free, but only runs on HTTP.


Which is run by a non profit organization that holds it up from donations. It supports HTTPS secure connection by default.

Both need a little disclaimer as I write this on 25-06-2015, things might change over time. They might even disappear (which would be a shame, but entirely possible).

First impressions

The first try out installation I have been given to try out by the non profit organization is pretty good. Etherpad is quick and does what is advertised. When called in Firefox it springs up within a second and you are up and editing immediately without a hassle.

The interface is mostly intuitive, it has all the bits you a expect from a simple editor, you see others adding text real time and show up in their respective colors.

Installation instructions, settings and plugins look pretty well also. However, I bumped in to problems as soon as I tried installing it on my Raspberry Pi (which is a Model B+ for who might want to know)

Installing stuff from Apt-Get is no trouble at all and pulling the application from git neither. However, if you start it, you first need to bypass the fact you run it in root.
I do not understand this mechanism, but it is probably to discourage using the application under the root user.
Then after a lengthy startup it start spewing all kinds of errors which do not make a lot sense to me.
I must be doing something wrong, however I do not understand what yet. I have retried several times, but I have given up for the time being. I might retry on my full fledged server, which is a Intel Core Duo, which might have an easier time running it.

Their, this is the first part, I hope to add more soon.