Missing Maximize / Minimize in Gnome

Gnome 3 continues to be abhorant. Not only can I not get to a terminal easily anymore, but there’s no maximize / minimze button on windows? Who designed this and have they used graphical user interfaces for more than a few minutes / hours? Anyway to turn this basic functionality back on using Fedora try (thanks to this thread):

sudo yum install gnome-tweak-tool

Then search for ‘tweak’ in the Gnome 3 Applications menu, open ‘tweak tool’ app and click the ‘Windows’ tab and enable the titlebar options as follows:



VNC to Linux PITA

A stubborn or short-sighted developer, it seems, is the cause of many people’s grief and effort to get VNC working to a linux box from any of the standard VNC clients (tiger, realvnc etc.). As of Fedora 19+, the code has changed in vinoserver, the default linux VNC server, such that the encryption mechanism is incompatible with ALL standard VNC viewers. You’ll see something like ‘No matching security types':


The only option for the average user is to disable encryption. Pretty stupid, but I’ve seen this before. A developer ‘David King’ says “My code is right, everyone else is wrong.” and marks a bug as ‘NOTABUG’. How sad. Anyway, until someone else can take a look at this from another perspective, make sure you only use VNC to linux on a secure LAN environment and then do this:

gsettings set org.gnome.Vino require-encryption false

Make sure you do it as standard (not sudo) user. Sucks to disable security – but if complexity is a barrier to entry, that is the result. :(

Mime types with Gnome Commander

One of the things that mime types are used for is to specify the default program to associate with a file extension. Unfortunately, this is currently broken with Gnome Commander (at at v1.2.8.17). To fix it, you’ll need to add a line to the following file:


Create that file if it doesn’t exist and add [Default Applications] on the first line. Then add the mime type (as shown on the gnome commander error dialog when you try to open your file) and specify the program to use. For example, for PNG file extension you might want to use Eye of Gnome (eog) so you’d add:



Save the file and you’re done. If it still doesn’t work, you should check this thread on the Ubuntu forums. Tested with Zorin OS 9. Hopefully this is fixed in a future version.

Opening files from Gnome Commander in foreground

Gnome Commander is my preferred file commander on linux, it’s simple and it works. However, I usually map F3 to my preferred editor (gedit) rather than use the internal viewer and when you do that, gedit is not brought into the foreground if it is already open. Which is totally lame. Luckily there’s an easy way to fix it. Create a script named e.g. gedit-foreground.sh with the following content:

gedit $1
wmctrl -a gedit

Obviously you can modify this to open any app if you prefer. Save this in your home directory somewhere and then make it executable using:

chmod a+x gedit-foreground.sh

Then install wmctrl using:

sudo apt-get install wmctrl

Now in Gnome Commander go to Settings->Options->Programs and set the viewer to:

/path/to/your/scripts/gedit-foreground.sh %s

Now when you press F3 or whatever your key for ‘open in external viewer’ is, your editor will be launched and be brought to the foreground instantly!

Dual boot Zorin 9 with Windows 8.1

I got myself an Alienware 13 laptop after years of building desktop PCs, and I have to say i’m impressed with it so far. I intend to use it for both Android and Windows development, and I prefer to develop Android on Linux, so I needed to set up dual-boot. The linux distro I use is Zorin OS, which is by far the best desktop linux distro I have used yet. However, with this new UEFI bios that all computers come with these days, dual-booting linux and Windows 8+ is not as straightforward as in the past days of regular old BIOS. Here’s how I got it to work, based on Nehal Wani’s excellent YouTube video (but without the need to use a Ubuntu live disk):

  1. Laptop came with Windows 8.1 OEM pre-installed on a 256Gb HDD, so if you haven’t installed Windows already, do that first.
  2. You MUST shrink your OS partition down to make room for linux, which is easy to do using the built-in disk management utility in Windows (diskmgmt.msc). Just right-click you OS partition and choose ‘Shrink’, then enter the amount of space you want to reserve for linux, I chose 60Gb.
  3. Disable ‘Fast Startup’ in windows 8 (via Power Options -> choose what the power button does).
  4. Go into your UEFI setup (I had to press F2 at boot time, but you may need to use Shift+restart to access it via Windows 8 logon screen).
  5. Disable ‘secure boot’, but you can leave everything else related to booting alone (i.e. you don’t need to enable ‘legacy boot’).
  6. Create a UEFI-enabled bootable USB key from the Zorin OS 9 ISO file using Rufus, making sure to select ‘GPT partition scheme for UEFI’.
  7. Make sure you are connected to the internet with a wired ethernet cable at this point, or the zorin installation can fail due to needing to download updated packages relating to UEFI-enabled grub bootloader.
  8. Plug in the USB key and when booting, press F10 or whatever you need to access boot options. It should give you the option to boot from the UEFI-enabled USB key at this point, select that.
  9. Zorin OS 9 menu should appear, select to install or boot to live and then install, it makes no difference.
  10. When the installer gives you the option to download updates during installation, make sure you tick that checkbox.
  11. When the installer asks you where to install, it will NOT detect Windows 8 and therefore will NOT give you an option to install ‘alongside’. That’s fine, we will still achieve this regardless. Choose ‘Something else’ to specify partitioning manually.
  12. Now you have to select the free space you reserved for linux from step 2 and create a the following 3 partitions (using the plus button – credit to Nehal Wani for screenshots from his YouTube video):
  13. First create a 5Mb primary partition located at the end of this space for use as ‘Reserved BIOS boot area':
  14. Next create a 2043Mb primary partition located at the end of this space for use as ‘swap area':
  15. Finally create a primary partition located at the beginning of this space for use as ‘Ext4 journaling file system’ and mount point ‘/':
  16. Proceed with the rest of the install as normal, and when you are done and you restart you should hit the zorin grub-based bootloader, which should give you the option to enter Zorin (as the first preference) and also the option to enter Windows Bootloader which will enter your existing install of Windows 8.1.

That’s it!

Note that this laptop comes with WIFI hardware that is currently only supported in the very latest builds of linux, and is not supported by Zorin OS 9, which is based on Ubuntu 14.x. It may work with Zorin OS 10, which is based on Ubuntu 15.x, but I haven’t tested it and i’m not interested in an OS where the security updates last only a few months. The bug for this is here. I guess that’s still life when using linux on new hardware.

Can’t scp using git-shell

I recently created a new Android app on my local dev box, but when I went to copy it to my git server using:

scp -r -P 9876 AppProjectFolder.git git@myserver.address.com:/opt/git

I got this:

fatal: unrecognized command ‘scp -r -t /opt/git’
lost connection

After researching, I found it is due the git user on my server using git-shell (to restrict commands that can be used). However, I’m sure I used to be able to use the scp command even when using git-shell. I couldn’t find the root cause, so I just modified /etc/passwd to set the git user to use /bin/bash temporarily, then switched it back after the files were copied. My server is running Fedora 19, if anyone knows what can cause this and/or how to fix it please post a comment.

Run unit tests in a batch loop

We had a case where a tests was randomly crashing the MSTEST agent process, leave no trace of the root cause. So to reproduce, we ran the test in a loop in both MSTEST and xUnit frameworks using the following scripts, posted here for future reference:

rem Run unit tests in an assembly in a loop using xUnit (build 1705).
FOR /L %%i IN (1,1,5000) DO (
xunit.console.clr4 UnitTests.dll /xml C:\xunit-results\output%%i.xml

rem Run unit tests in an assembly in a loop using MSTEST.
FOR /L %%i IN (1,1,5000) DO (
mstest /testcontainer:UnitTests.dll /resultsfile:c:\mstest-results\output%%i.xml

CSR bluetooth dongle killed by Windows update

An optional update for my USB bluetooth dongle (which I used to connect my Logitech bluetooth keyboard) recently appeared on one of my Windows 7 machines. Trustingly, I proceeded with the update, only to find that afterwards, my keyboard no longer worked! And there was no blueooth icon in the system tray to inspect the status of bluetooth devices. After googling, I found out that this update has killed many people’s bluetooth hardware and the solution is to uninstall it an go back to the default Windows drivers. The solution that worked for me (and others) detailed on this thread, which I will summarise (paste) here:

To accomplish this select “Update Driver Software” from “CSR BlueCore Nanosira” (the working device), then select “Browse my computer for driver software” and then “Let me pick form a list of device drivers on my computer”. In my case Windows presents the new driver from CSR (“CSR BlueCore Nanosira”) and two generic drivers as you can see in screenshot 2.

I selected “Generic Bluetooth Radio” from the list and clicked OK. Then I had “Generic Bluetooth Radio” and “Microsoft Bluetooth Enumerator” back under “Bluetooth Radios” and the Bluetooth icon appeard in the taskbar again. After that I was able to use my bluetooth mouse and keyboard again (even without pairing it again).

Thanks to davewebb8211!

Then you will want to hide that nasty windows update as follows:


No sound in Kodi / XBMC with ASUS Xonar

I recently replaced the motherboard in my media centre due to on-going bluescreens, and I unwittingly selected a refurbished board with no on-board audio (ASUS Rampage Extreme II). The two main PCIE sound card manufacturers appear to be ASUS and Creative. I selected ASUS Xonar PCIE 7.1 DX for two reasons:

  1. I’ve used plenty of Creative hardware before and they are getting worse over time.
  2. It was the only one they had in the shop!

Anyway, first problem was that the card didn’t physically fit in my PCIE x1_1 slot due to the CPU heatsink placement! Luckily I found out that you can put a smaller PCIE card in any larger PCIE slot. So I was able to install it in my 2nd PCIE x16 slot.

Second problem is that when I went the install the drivers from ASUS, the driver installation didn’t detect the card and just hung. I forced a reboot, ran the installation again, and amazingly the installation worked 2nd time around and sound in Windows 7 was now working.

When I fired up Kodi however, there was no sound. Looking into the log file i saw this:

CAESinkDirectSound::Initialize: cannot create secondary buffer (DSERR_UNSUPPORTED)

And after googling that I saw that many people were having problems with ASUS Xonar cards in XBMC / Kodi. The main solution was to go into system – audio settings and change from using DirectSound to WASAPI. This did work for me, however it means that when Kodi is running, no other application can output sound, i.e. Kodi has exclusive access to the audio hardware. While not optimal, this is at least a workable solution. But I probably won’t be buying ASUS Xonar sound cards in the future.

Starting a legacy animation with delay from script in Unity

Applies to: Unity 4.5.5f1 (and possibly other versions)

Unity has introduced a new animation system called Mecanim, but the existing animation system is still available to use. If you are using the old animation system you’ll be using an ‘animation’ component rather than an ‘animator’ component on your gameobject. And when you do so, you’ll likely see at least one of these warnings:

The AnimationClip ‘x’ used by the Animation component ‘y’ must be marked as Legacy.
Default clip could not be found in attached animations list.

There are two ways to solve this, depending on whether you have a model (e.g. via a prefab) or not.

You have a model
Select the model and on the Rig tab of the import settings, change the animation type to ‘legacy’.


You don’t have a model
In this case, select the animation and then in the inspector, RIGHT-click the ‘Inspector’ tab and choose ‘Debug’.


Then change the animation type value from 2 to 1. Then change back to ‘Normal’ mode on the Inspector tab and when you run your app, this warning should be gone.

It is simple to apply your legacy animation to a gameobject by simply adding an ‘animation’ compoment and dragging the animation to appply onto that component. In this case, the animation will by default play on startup of your app. But what if you want to start the animation after some delay via a script, for example. To do this, uncheck ‘Play automatically’ in the animation component, then add a new script component to your game object. You can use the following code to start the animation after a 3 second delay. This also demonstrates how to achieve a fixed delay from a script.

public class startanim : MonoBehaviour {

	private bool started = false;

	// Use this for initialization
	void Start () 
	// Update is called once per frame
	void Update ()
		if (!started)
			started = true;

	private void executeWait()
		Debug.Log("This line runs *immediately* after starting the Coroutine");
	private IEnumerator Wait(float seconds)
		yield return new WaitForSeconds(seconds);
		Debug.Log("3 seconds has passed, animation is now starting.");
		this.animation.Play ();

Finally, the debug output can be viewed at the bottom of the unity window: