Friday, July 9, 2010

Running Balsamiq on ArchLinux

Finally spent sometime to get balsamiq running on my archlinux today, after referencing this guide, these are the steps i've taken with the downloaded adobeair sdk:

# Unpacking the sdk:
sudo mkdir /opt/AIR-SDK
cd /opt/AIR-SDK
sudo tar jxvf <PATH_TO_DOWNLOADED_ADOBE_AIR_SDK>

# Unpacking the balsamiq package:
sudo mkdir -p /opt/AIR-apps/MockupsForDesktop
sudo unzip <PATH_TO_DOWNLOADED_BALSAMIQ_PKG>

But the above is not enough for my 64bit system, i need to pacman install the following as well:

sudo pacman -S lib32-gtk2 lib32-libxml2

And the very verbose command to launch balsamiq is:

export BALSAMIQ_DIR=/opt/AIR-apps/MockupsForDesktop
/opt/AIR-SDK/bin/adl -nodebug ${BALSAMIQ_DIR}/META-INF/AIR/application.xml $BALSAMIQ_DIR

Of course, i can always throw in an alias (eg. balsamiq) to make everything short & sweet !!

Tuesday, July 6, 2010

Binding of or/and & ||/&&

Got bitten today by:
1
2
3
4
5
def call_1 ; false ; end
def call_2 ; true ; end

x = call_1 or call_2
# x => false

Because of binding issue of or, x is assigned to return of call_1 first, prior separated calling of call_2. Since what i actually want is to assign x to whichever valid (non nil/false) value of call_1 or call_2, i should use ||, which as a stronger binding, and code as:
1
2
x = call_1 || call_2
# x => true

The same applies for && & and.

Friday, March 12, 2010

ck-launch-session & wallpaper

In order to allow auto mounting to work in thunar, i have to start my openbox (in ~/.xinitrc) using:

exec ck-launch-session openbox-session

So far, the problem with this approach is that the wallpaper set prior this command is lost. Meaning when launching X, i see the wallpaper for a split second, and then, it disappears altogether, and i get a plain grey background. To work around this, i added a customized X startup script ~/bin/startx:
1
2
3
#!/bin/bash
feh --bg-tile ~/pictures/wallpaper/current.jpg &
openbox-session

And amend the line in ~/.xinitrc to:

exec ck-launch-session ~/bin/startx

That's all !!

Saturday, February 6, 2010

Concatenating pdf files

Very frequently, i have to scan documents for my family. I do it using xsane, yet i always end up with many separate pdf files, one for each page of the document. A simple and sweet way to concatenate pdf files (assuming they are sequentially named, eg. 01.pdf, 02.pdf, etc) is:

for f in `ls *.pdf` ; do pdf2ps $f ; done
cat `ls *.ps` > final.ps
ps2pdf final.ps

Yeah !!

Thursday, December 24, 2009

Scanning for badblocks in a a harddisk

Just bought a new harddisk, did scanning of badblocks with:

sudo badblocks -svwf /dev/sdc1

Amazingly, for 320GB, it takes 30:33:41.35 hrs to complete.

Thursday, December 10, 2009

Adding Webrat Matchers to Culerity

If u are using culerity, and somehow u missed the webrat matchers, eg. has_xpath(), here's what u can do:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
require 'webrat/core/xml'
require 'webrat/core/matchers'

module WebratLike

include Webrat::Matchers

def response
html = $browser.html
def html.body ; to_s ; end
html
end

end

World(WebratLike)
end
end

Enjoys !!

Wednesday, December 9, 2009

Testing of Clicking of Checkbox

We have checkboxes registered for onchange event handler. In testing using blueridge, to simulate checking of a checkbox, the following more ideal approaches, sadly, don't work:
1
2
$("input:checkbox:first").change(); #1
$("input:checkbox:first").click().change(); #2

But the following works:
1
$("input:checkbox:first").attr('checked', true).change();

Bitten once.

Labels