Citrix on Ubuntu

Running Citrix from Ubuntu is getting progressively more difficult. This post is an attempt to document a few of the changes that we’ve had to make to keep it usable.

In my home folder, there’s a hidden folder named .ICAClient

To get rid of the extreme lagginess when Outlook or Lync show notifications we’ve edited appsrv.ini to include entries for ForceLVBMode and DeferredUpdateMode as follows:

; appsrv.ini
; Session configuration file for Citrix Receiver for Unix
; Copyright 1994-2002, 2006, 2009 Citrix Systems, Inc. All rights reserved.
Version = 2
ForceLVBMode = 1
DeferredUpdateMode = 1



To get rid of black boxes around the mouse pointer, I added an entry for DisableXRender in my wfclient.ini file. Like this:

; wfclient.ini
; User configuration for Citrix Receiver for Unix
; Copyright 1994-2006, 2009 Citrix Systems, Inc. All rights reserved.
Version = 2

... more follows below


Chmod 20,000 files

I have a memory card in one of those slideshow picture frames with nearly 20,000 photos. I found that they were somehow read-only due to the file permissions.
I needed to chmod them but kept getting error until I did it like this:

find . -name '*.jpg' -print0 | xargs -I{} -0 chmod 777 {}

I read an interesting article about common lighting patterns but the example images were lacking some clarity. I took a copy of the images and added some details that would help me remember each technique.

Roll your mouse over the image to see the original without my markups.


Let me know if you found this post useful or if I got anything wrong.


Windows 7, really?

I took this photo with my cell phone one morning when I turned on my Windows 7 machine.
How many updates per day does that work out to

Really? 84264 software updates? Why do people put up with crap like this.



Linux bandwidth throttling

While doing a large file upload from my Ubuntu laptop, my internet connection was unusable from other machines at my house. I looked at the bandwith monitor on my router and saw that it was solidly uploading at 60KB/second – the upper limit of my home connection. I didn’t want to interrupt the upload already in progress so I installed an app called wondershaper.

 sudo apt-get install wondershaper

Now, on the Linux machine doing the upload I was able to limit the network interface upload speed to 20KB/second with the following command.

sudo wondershaper wlan0 1000 200

Check the man pages for documentation, but just testing various combinations of numbers and calling the ‘clear’ command in between was good enough for me.

When it’s finished I can reset the connection speeds with:

sudo wondershaper wlan0 clear

Replacing the domain name in a large file

I had a large text file (MySql database dump) with many instances of a domain name that I needed to change out for a website that’s being deployed under a new domain name. My first attempts to do a search & replace from a simple text editor failed and eventually crashed the editor. As well, it was not something I could repeat exactly the next time I had to migrate that same database again. The Linux utility ‘sed’ is a streaming editor that would easily handle large files and seemed like a simple solution. I ran it against the file twice, being careful to replace only the domain name as it appeared in URLs, and not where it appeared in any stored email addresses.

  • www.my-old-domain.com —> www.objectclarity.com/~newhome
  • ://my-old-domain.com —> ://objectclarity.com/~newhome
sed -i.bak -e 's%www\.my-old-domain\.com%www.objectclarity.com/~newhome%g' huge-mysql-dump.sql 

sed -e 's%:\/\/my-old-domain\.com%://objectclarity.com/~newhome%g' huge-mysql-dump.sql

Here’s a breakdown of what the commands mean:

(-i.bak) creates a backup of the original file.
(-e) tells sed that a script follows
The part in single quotes is my search-and-replace expression in the following form:


(s) defines a search & replace expression
(%) is my delimiter. “/” is the default delimiter but as I’m working with URLs, I don’t have to escape each character and results in a simpler espression.
(g) tells sed to replace *all* instances of my regex with the replacement string.

Each command ran in about 1 second on a 40Mb file and it did the job perfectly.


Selecting rows in a paginated data grid

When displaying sets of records on the web it’s a very common thing to include a checkbox on each row to allow users to select rows for things like, deleting multiple records, moving records from one place to another or whatever your case may be. It’s pretty standard and a nice addition to add a single checkbox in the header to allow users to select all the rows with one click – and then you add pagination and the user experience falls apart. I had a user ask me, “When I click the ‘select all’ checkbox, are all the rows selected, or just the ones on this page?”.
Clearly I needed to be a bit more specific. Here’s the solution that was used.

I swapped out the header checkbox with the following set of 3 checkboxes and bits of HTML.

<div id="moreOptsParent">
	<input title="Check all records" id="checkAllDisplay" type="checkbox">
	<div id="moreOptsPanel" style="display:none; position:absolute; background-color:#a6d9f4; padding:5px; text-align:left;">
		<input title="Check all records on current page" 
			id="checkAllRecords" type="checkbox"> 
				All records on current page <br />
		<input title="Check all records on all pages" 
			id="checkAllPages" type="checkbox"> 
				All records on all pages

The above HTML leaves one checkbox in the header and two more in a hidden div. The one that’s visible will be used to indicate some kind of selection, and the other two will be shown and hidden with jQuery to allow two choice options.

  • All records on current page
  • All records on all pages

The first part to be handled is the showing and hiding of the checkboxes. Using a timer, I added a delay to the ‘hide’ function so that it’s less jumpy and moving your mouse outside the element by accident won’t hide it and frustrate my users. While it’s not required, notice that I named my anonymous functions with something that helps clarify their purpose, “enterElement” and “exitElement”.

var moreOptsTimer;
$("#moreOptsParent").hover(function enterElement() {
		$("#moreOptsPanel").show().animate({ height: 40 }, 
						{ duration: "slow" });
	function exitElement() {
		moreOptsTimer = setTimeout(function () {
			$("#moreOptsPanel").animate({ height: 0 }, 
			{ duration: "slow" }, 
			function () {
				// Animation complete.
		}, 500);

Now that the two selection choices hide and show nicely we have to add code to manage the state of the checkboxes to show selections. When we select “all rows current page”, we need to check the header checkbox and the one on each row. When we select “all rows on all pages”, we need to check the header checkbox and uncheck & disable the one on each row. For completeness I’ve mirrored the “All Records current page” function on the original checkbox but because the behaviour is so slightly different, it gets it’s own click function.

	/* attach event handler to "check all" checkbox */
	$('#checkAllDisplay').click(function () {
		$("#MyGridItems tbody input:checkbox").removeAttr("disabled")
						.attr("checked", this.checked);
		$('#checkAllRecords').attr("checked", this.checked);
		if (!this.checked) {
			$('#checkAllPages').attr("checked", false);

	/* attach event handler to "check all on current page" checkbox */
	$('#checkAllRecords').click(function () {
		$("#MyGridItems tbody input:checkbox").removeAttr("disabled")
					.attr("checked", this.checked);
		$('#checkAllDisplay').attr("checked", this.checked);
		if (this.checked) {
			$('#checkAllPages').attr("checked", false);

	/* attach event handler to "check all on all pages" checkbox */
	$('#checkAllPages').click(function () {
		$('#checkAllDisplay').attr("checked", this.checked);
		if (this.checked) {
			$('#checkAllRecords').attr("checked", false);
			$("#MyGridItems tbody input:checkbox")
							.attr("disabled", true)
							.attr("checked", false);
		} else {
			$("#MyGridItems tbody input:checkbox")

Try the demo and leave a comment below if you found it useful or had a suggestion.


Hide changing content with JQuery UI

While working on an ajax UI, I wanted to show that something was happening while preventing the user from interacting with page elements that are getting replaced. I used the .position() function from JQuery UI to place a div directly over the changing content.

        of: $("#changingContentDiv"),
        my: "left top",
        at: "left top",
        offset: 0,
        collision: "none none"

Looking at the code above, you can see that we’re setting the top left corner of our busy indicator at the top left corner of our changing content. The collision property is used to deal with bumping into the edges of the window and since we’re not showing popup menus etc, we don’t want to do anything special so I left it at ‘none none’.

In my particular case I had several elements that were all being loaded with ajax, so I used the JQuery .clone() function to make duplicates of a busy indicator div for each one. I was careful to change the id attribute of each clone to keep them unique and something that I would be able to find easily when it’s time to remove the busy indicator.

$('#busyOverlayBase').clone(true).removeAttr('id').attr('id', busyName).insertAfter($('#busyOverlayBase'));

Try the demo and leave a comment below if you found it useful or had a suggestion.


Updating Thunderbird on an older Ubuntu installation

I’m running Ubuntu 10.04LTS on my desktop at home and while there’s a year left on updates, my Thunderbird was telling me that it’s about to stop receiving security updates. While I typically don’t care about installing all the latest and greatest (as is obvious by my 10.04!), I don’t want to be using ‘old’ software either. I thought I’d investigate what’s required to update to the latest Thunderbird mail client.
As it turns out, it’s pretty easy.

We simply have to add the Mozilla repositories and re-install it. Below are the commands required to update your Thunderbird. It took only a couple minutes!

sudo add-apt-repository ppa:mozillateam/thunderbird-stable
sudo apt-get update
sudo apt-get install thunderbird

What roles do I have?

Ever wanted to know what Oracle roles your oracle user has? This simple query will offer up a complete list including the objects and privileges for each as specified in the role.

SELECT a.role, a.owner || '.' || a.table_name tbl,
  FROM role_tab_privs a, dba_role_privs b
 WHERE a.role = b.granted_role
                 AND b.grantee LIKE UPPER (USER)

Obviously it requires that you have a catalog role that allows you access to:

  • role_tab_privs
  • dba_role_privs