Better VNC viewer in Ubuntu 8.04

Another post regarding my recent switch to Ubuntu as my primary OS, this one concerns the VNC client/viewer bundled.  I’ve been having problems with Remote Desktop Viewer which is the bundled and preferred VNC client in a default installation of Ubuntu 8.04, I’ve had random freezes and disconnects with a logout/login of my machine sometimes resolving the issue temporarily.

The alternative is to use the Terminal Server Client application to connect to a VNC server, should just be a case of selecting VNC in the protocol dropdown right? nope, it’s greyed out*sigh*

To enable the VNC option in the Terminal Server Client dropdown you need to install the xtightvncviewer package either in Synaptic or with

sudo apt-get install xtightvncviewer

I fired up the Terminal Server Client, selected the VNC protocol, set the display to full screen and connected to my server.

Job done? not quite. I’m now prompted by my server with a “press ctrl-alt-del to logon” message. That’s where I had some problems, pressing ctrl-alt-del caused Ubuntu to ask me how I want to shut down. I needed some way of sending a ctrl-alt-del to the remote machine but I couldn’t see any obvious way of doing it. Queue the next problem, I’d selected full screen and that’s what I got, completely full screen, I couldn’t even switch to an alternative workspace since the VNC viewer remained on top.

I really didn’t want to restart my machine just because I couldn’t get rid of one window so I started randomly hitting buttons whereupon I found that F8 was rather useful! Pressing F8 with the VNC viewer focussed brings up a small menu with a number of options one of which was to toggle full screen and another was to send ctrl-alt-del to the remote machine, hooray!

I’ve found this VNC viewer to be a bit quicker at screen refreshes (though it does more of them) and more stable than the bundled viewer in Ubuntu, feel free to leave a comment to the contrary or suggesting another alternative that you may use.

YouTube GData API returning error 400 when uploading a video

I’ve been battling with the YouTube API for the last 2 days now and found the single line of code that has been preventing me from generating a form upload token.

I was following the example code at http://code.google.com/apis/youtube/developers_guide_php.html#UploadingVideos and kept receiving “Expected response code 200, got 400″ when calling the getFormUploadToken function. HTTP error code 400 is a bad request which wasn’t really much help.

Eventually I found the problem and I will own up straight away that it was basically my fault, I’d made what I considered to be a slight change to the example code, I changed

$mediaGroup->category = array(  $yt->newMediaCategory()->setText('Autos')->setScheme
('http://gdata.youtube.com/schemas/2007/categories.cat'),

$yt->newMediaCategory()->setText('mydevelopertag')->setScheme
('http://gdata.youtube.com/schemas/2007/developertags.cat'),

$yt->newMediaCategory()->setText('anotherdevelopertag')->setScheme
('http://gdata.youtube.com/schemas/2007/developertags.cat')

);

to the following

$mediaGroup->category = $yt->newMediaCategory()->setText('Autos')->setScheme
('http://gdata.youtube.com/schemas/2007/categories.cat');

because I wasn’t interested in multiple categories, just something simple. My mistake was not in removing the two developer tags but removing the array(). This took me almost an entire day to realise and resulted in a “You have to be kidding” comment from me once fixed. *Sigh* oh well, not going to get that time back but at least I learned not to mess with example code.

Smarty template syntax highlighting with gedit

Update: I have posted an alternative way to do the same thing this post describes, the alternative way should be more reliable. See it here http://www.c3b.co.uk/2008/12/16/alternative-method-for-opening-smarty-templates-with-html-syntax-highlighting-in-gedit/

I’ve started using gedit as my code editor after a couple of niggles with bluefish and wanted my smarty templates (*.tpl) to use the same syntax highlighting as HTML. Not wanting to have to manually select the language each time I open a .tpl file I went searching for a way to add them to the definition of what an html file is. I was getting frustrated with all the references to a syntax highlighting tab in the preferences dialog that just didn’t exist! Even the help file in gedit 2.22.1 still mentions the syntax highlighting tab but I can assure you it’s not there.

The solution I came up with was to manually edit the HTML language definition file for gtksourceview which is what gedit uses to define the syntax highlighting. To achieve this you must change the following line in the /usr/share/gtksourceview-2.0/language-specs/html.lang file:

<property name="globs">*.html;*.htm</property>

to

<property name="globs">*.html;*.htm;*.tpl</property>

Or download my version here (html.lang) of the file and run the following command:

Backup existing file

cd /usr/share/gtksourceview-2.0/language-specs
sudo cp html.lang html.lang_bkup

Then move the downloaded version of the file into place (this assumes you download the file and extracted it to your home directory)

sudo mv ~/html.lang /usr/share/gtksourceview-2.0/language-specs/html.lang

Restart gedit and when you next open a .tpl file it will be highlighted in the same way as an HTML file.

Flash plugin with Ubuntu

I recently installed the latest and greatest version of Ubuntu, version 8.04 aka Hardy Heron, from Vista (which was pre-installed when I bought the laptop)

I managed to switch quite happily, replacing many of the applications I used daily (Notepad++, FileZilla, TortoiseSVN, Winamp) with either their linux counterparts or alternatives (Bluefish, Exaile and I’m going with the command line for SVN) one thing that was becoming annoying was the swfdec-mozilla plugin for playing flash content in Firefox, it only kinda worked for me. Google analytics graphs wouldn’t render, YouTube videos were occasionally very slow and worst of all I couldn’t watch the latest installment of Zero Punctuation!

I went to Adobe’s website and downloaded the nonfree version of the flash plugin, ran the install script, restarted FF, then restarted Ubuntu but swfdec persisted.  I couldn’t find any way to replace the default flash player in Firefox so then I had the bright idea of removing swfdec-mozilla.

Launched Synaptic, searched for swfdec, marked swfdec-mozilla for removal, shut down Firefox and hit apply. Less than 30 seconds later I’m launching up Firefox again and listening to Ben “Yahtzee” Croshaw deliver his opinion on Gods of War: Chains of Olympus and another 30 seconds later I have a huge smile on my face, thanks Synaptic and thanks Yahtzee.