Cannot See Video For Google Plus Hangout on Linux

After installing the Google Talk plugin, run the following to add an override for your video settings.

sudo echo "O3D_OVERRIDE_RENDER_MODE=2D" >> /opt/google/talkplugin/envvars

Use sudo if necessary. Restart your browser after doing this and check to see if you can see video streams now.

Sublime text 2 Unity Launcher

I’ve looked into Sublime text 2 today, mostly unhappy with the speed Java based IDEs have on linux 64bit. When launching it, although I chose “keep in launcher”, the icon does not stay there, so i created a custom launcher.

Create a file sublime2.desktop and save it in ~/.local/share/applications. The file should look like this:

#!/usr/bin/env xdg-open

[Desktop Entry]
Name=Sublime Text Editor
Comment=Sublime Text Editor
Exec="/usr/bin/sublime" %F
MimeType=text/plain;
Terminal=false
Type=Application
Icon=/home/mimir/sublime.png
Categories=GNOME;GTK;Utility;TextEditor;Development;Utility;

You can find the link to the icon here: http://d2o0t5hpnwv4c1.cloudfront.net/1038_sublime/sublime.png

Make sure to change the Exec path, to where you have installed Sublime2. I’ve installed in /opt but i’ve symlinked in /usr/bin

Install synergy client on Lion

I do most of my work on my Ubuntu laptop but i also have one mac mini next to it so i can debug websites in Safari or iPhone/iPad. In Snow Leopard i had setup synergy server on the laptop and the client on my mac, and i could easily use laptop’s mouse and keyboard to control both machines. Here is how you can setup this:

On Ubuntu machine (server):

# install synergy 1.3.6 (other versions seem to have all sort of bugs)
# if 1.3.6 is not in repo anymore, check the download page: http://synergy-foss.org/download/
sudo apt-get install synergy

Now create the server config file (you might need to adapt this according to your setup

section: screens
	orion:
	io.local:
		ctrl = super
		alt = alt
		super = ctrl
end
section: options
        mousebutton(7) = keystroke(control+right)
	mousebutton(6) = keystroke(control+left)

end
section: links
       orion:
           left = io.local
       io.local:
           right = orion

Add this line to startup:

/usr/bin/synergys --config /home//synergy.conf -f

On Mac mini (client):
First of all, you’ll need to install brew, if you haven’t already (http://mxcl.github.com/homebrew/). For that check the installation at: https://github.com/mxcl/homebrew/wiki/installation

After you have brew installed open a terminal and install synergy:

brew install synergy

Now create a .profile file in your home directory and add:

if [ "$(pidof synergyc)" ]
then 
    echo "Synergy is already started";
else   
    /usr/local/bin/synergyc 
fi

Force IE to use the latest engine

If by some unknown reason IE8/9/10 are rendering your site in compatibility mode, ie IE7 mode or something lame like that, just force it to use the latest engine available:


note that the code added right before the doctype declaration. the using_ie() boolean function below (credits to Simeon for this solution: http://www.php.net/manual/en/function.get-browser.php#101314)

function using_ie() 
{ 
    $u_agent = $_SERVER['HTTP_USER_AGENT']; 
    $ub = False; 
    if(preg_match('/MSIE/i',$u_agent)) 
    { 
        $ub = True; 
    } 
    
    return $ub; 
} 

HTTP response headers in Zend Framework

I needed to display a Zend Framework generated PDF using the browser plugins and after a bit of looking around it turns out that some headers need to be set in order to achieve that.

$this->getResponse()
     ->setHeader('Content-Disposition', 'inline; filename=invoice.pdf')
     ->setHeader('Content-type', 'application/x-pdf');

If you’d want to automatically download the PDF instead of displaying it using the browser plugins, you need to change the ‘Content-Disposition’ as follows:

$this->getResponse()
     ->setHeader('Content-Disposition', 'attachment; filename=invoice.pdf')
     ->setHeader('Content-type', 'application/x-pdf');