<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>biotext.org.uk &#187; firefox</title>
	<atom:link href="http://biotext.org.uk/tag/firefox/feed/" rel="self" type="application/rss+xml" />
	<link>http://biotext.org.uk</link>
	<description>Not a typewriter</description>
	<lastBuildDate>Sat, 05 Feb 2011 14:18:41 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Running RasMol from Firefox and Finder in OS X</title>
		<link>http://biotext.org.uk/running-rasmol-from-firefox-and-finder-in-os-x/</link>
		<comments>http://biotext.org.uk/running-rasmol-from-firefox-and-finder-in-os-x/#comments</comments>
		<pubDate>Tue, 24 Mar 2009 22:17:53 +0000</pubDate>
		<dc:creator>Andrew</dc:creator>
				<category><![CDATA[Tips]]></category>
		<category><![CDATA[firefox]]></category>
		<category><![CDATA[OS X]]></category>
		<category><![CDATA[RasMol]]></category>
		<category><![CDATA[X11]]></category>

		<guid isPermaLink="false">http://biotext.org.uk/?p=271</guid>
		<description><![CDATA[A colleague asked me today, how can we set up someone&#8217;s Mac to open .pdb files in RasMol when clicking a .pdb link in Firefox. This turned out to be a non-trivial operation. Here&#8217;s how I did it, with RasMol 2.7.2 and Firefox 3.0.7 on OS X 10.4. The first step is to install RasMol. [...]]]></description>
			<content:encoded><![CDATA[<p>A colleague asked me today, how can we set up someone&#8217;s Mac to open <a href="http://www.pdb.org/">.pdb</a> files in <a href="http://rasmol.org/">RasMol</a> when clicking a .pdb link in Firefox. This turned out to be a non-trivial operation. Here&#8217;s how I did it, with RasMol 2.7.2 and Firefox 3.0.7 on OS X 10.4.</p>
<p><span id="more-271"></span><br />
The first step is to install RasMol. There are various OS X ports out there &#8212; but I used the dead handy <a href="http://www.finkproject.org/">Fink</a> to do this in one line:</p>
<pre>fink install rasmol</pre>
<p>However, RasMol is a Unix executable and not an application in the OS X sense, i.e. a .app file, which means you can&#8217;t select it as a download handler in Firefox. So, we need to wrap it in some AppleScript in order to allow this. The following AppleScript &#8212; my first :-) &#8212; gives you a RasMol Launcher &#8216;droplet&#8217; which does the trick:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
</pre></td><td class="code"><pre class="applescript" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">-- flag to indicate whether script has been invoked as a droplet</span>
<span style="color: #ff0033; font-weight: bold;">set</span> filecount <span style="color: #ff0033; font-weight: bold;">to</span> <span style="color: #000000;">0</span>
&nbsp;
<span style="color: #808080; font-style: italic;">-- run X11 if not running, then run RasMol (command shell and visualization window)</span>
<span style="color: #ff0033; font-weight: bold;">on</span> run_rasmol<span style="color: #000000;">&#40;</span>filename<span style="color: #000000;">&#41;</span>
	<span style="color: #0066ff;">do shell script</span> <span style="color: #009900;">&quot;open /Applications/Utilities/X11.app; export DISPLAY=:0; /usr/X11R6/bin/xterm -e /sw/bin/rasmol &quot;</span> <span style="color: #000000;">&amp;</span> filename <span style="color: #000000;">&amp;</span> <span style="color: #009900;">&quot; &amp;&gt; /dev/null &amp;&quot;</span>
<span style="color: #ff0033; font-weight: bold;">end</span> run_rasmol
&nbsp;
<span style="color: #808080; font-style: italic;">-- open subroutine invoked by OS X if we run this as a droplet (i.e. file[s] supplied)</span>
<span style="color: #ff0033; font-weight: bold;">on</span> <span style="color: #0066ff;">open</span> <span style="color: #000000;">&#40;</span>filelist<span style="color: #000000;">&#41;</span>
	<span style="color: #ff0033; font-weight: bold;">repeat</span> <span style="color: #ff0033; font-weight: bold;">with</span> filename <span style="color: #ff0033; font-weight: bold;">in</span> filelist
		<span style="color: #ff0033; font-weight: bold;">set</span> filecount <span style="color: #ff0033; font-weight: bold;">to</span> <span style="color: #000000;">1</span>
		<span style="color: #ff0033; font-weight: bold;">set</span> filename <span style="color: #ff0033; font-weight: bold;">to</span> <span style="color: #0066ff;">quoted form</span> <span style="color: #ff0033; font-weight: bold;">of</span> <span style="color: #0066ff;">POSIX path</span> <span style="color: #ff0033; font-weight: bold;">of</span> filename
		run_rasmol<span style="color: #000000;">&#40;</span>filename<span style="color: #000000;">&#41;</span>
	<span style="color: #ff0033; font-weight: bold;">end</span> <span style="color: #ff0033; font-weight: bold;">repeat</span>
<span style="color: #ff0033; font-weight: bold;">end</span> <span style="color: #0066ff;">open</span>
&nbsp;
<span style="color: #808080; font-style: italic;">-- if no files supplied (e.g. user double-clicked icon) run RasMol wih no params</span>
<span style="color: #ff0033; font-weight: bold;">if</span> filecount <span style="color: #000000;">&lt;</span> <span style="color: #000000;">1</span> <span style="color: #ff0033; font-weight: bold;">then</span>
	run_rasmol<span style="color: #000000;">&#40;</span><span style="color: #009900;">&quot;&quot;</span><span style="color: #000000;">&#41;</span>
<span style="color: #ff0033; font-weight: bold;">end</span> <span style="color: #ff0033; font-weight: bold;">if</span></pre></td></tr></table></div>

<p><a href="/static/rasmol-applescript.txt">Click to download</a></p>
<p>This script starts X11 automatically, if it&#8217;s not already running, and for each PDB file dropped onto it, loads it into a separate RasMol instance (command prompt and visualization window). This kind of script is called a &#8216;droplet&#8217;, and can also handle being started from another application with one or more files supplied. If it&#8217;s just double-clicked, the <code>on open</code> subroutine is never called, and it opens a blank RasMol.</p>
<p>To create the script, open Script Editor &#8212; it&#8217;s in /Applications/AppleScript &#8212; paste in the source code, hit Compile, and save it as an application bundle called RasMol Launcher. This is a .app file which is really a directory containing the script and its metadata. Most OS X applications are bundled like this.</p>
<p><strong>N.B.</strong> You may have to change /sw/bin/rasmol to wherever you installed it to, but this is the default Fink location.</p>
<p>Now, when you next click on a .pdb file in Firefox, you can choose your new RasMol Launcher droplet just like any application, and hit OK, and it should pop up just as if you&#8217;d double-clicked a local file. <strong>However</strong>, see the note about Firefox limitations below.</p>
<h3>Associating .pdb files with RasMol Launcher in Finder</h3>
<p>Because of the way OS X manages file associations, you can only associate .pdb files with the launcher droplet on a file-by-file basis to begin with (see <a href="http://lists.apple.com/archives/applescript-users/2009/Jan/msg00183.html">this thread</a> for why). This isn&#8217;t very helpful.</p>
<p>To fix this, we need to go into the bundle and edit some metadata. Go into the bundle in Finder by doing Show Package Contents (ctrl-click menu) and open Contents/Info.plist in a text or XML editor (or Property List Editor if you have the Apple developer tools). Find the <code>CFBundleSignature</code> key and change its string (should be <code>dplt</code>) to <code>RSML</code>. Then add a new entry underneath this with the key <code>CFBundleIdentifier</code> and the string <code>uk.org.biotext.RasMolLauncher</code>. Finally, open the Pkginfo file in the same folder, and change its contents to just the string <code>APPLRSML</code>.</p>
<p>After doing all this, you need to get OS X to re-read the application&#8217;s metadata &#8212; the quickest way is to move it to another folder, and back again. Now you should be able to Get Info on a .pdb file, change the application it opens with to RasMol Launcher, and click Change All to apply this to all .pdb files.</p>
<h3>Firefox limitations</h3>
<p>One quirk about Firefox &#8212; I think it&#8217;s a bug but Mozilla don&#8217;t &#8212; is that sometimes, the &#8220;do this automatically from now on&#8221; option when downloading a file doesn&#8217;t work. i.e. you can check it, but still get asked next time. The reason behind this is that some web servers are configured to serve files with the <code>Content-disposition: attachment</code> HTTP header, but don&#8217;t supply a specific MIME type. Instead they&#8217;ll have something like <code>Content-Type: application/download</code>.</p>
<p>In these instance, Firefox doesn&#8217;t consider it safe to open the file with the default app based on its filename extension alone, even if you asked for the automatic option before. So it pops the same dialogue box up again. Sadly, one of the sites that does this is <a href="http://www.pdb.org/">pdb.org</a> itself.</p>
<p>However, you don&#8217;t have to go all the way through the application selection process again. On my version of Firefox at least, assuming &#8220;Open with&#8230;&#8221; is selected, you can just hit OK and it&#8217;ll fire up RasMol Launcher again.</p>
]]></content:encoded>
			<wfw:commentRss>http://biotext.org.uk/running-rasmol-from-firefox-and-finder-in-os-x/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Installing Flash on 64-bit Linux (Centos 5)</title>
		<link>http://biotext.org.uk/installing-flash-on-64-bit-linux-centos-5/</link>
		<comments>http://biotext.org.uk/installing-flash-on-64-bit-linux-centos-5/#comments</comments>
		<pubDate>Thu, 29 Jan 2009 16:23:59 +0000</pubDate>
		<dc:creator>Andrew</dc:creator>
				<category><![CDATA[Tips]]></category>
		<category><![CDATA[64bit]]></category>
		<category><![CDATA[centos]]></category>
		<category><![CDATA[firefox]]></category>
		<category><![CDATA[flash]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[redhat]]></category>

		<guid isPermaLink="false">http://biotext.org.uk/?p=166</guid>
		<description><![CDATA[This took a fair bit of searching, and the answer&#8217;s non-obvious&#8230; Everybody (?) knows that in theory, if you have 64-bit Firefox on 64-bit Linux (x86_64), you can use nspluginwrapper to install 32-bit plugins, like the Flash Player. There&#8217;s some instructions here for example. However, those instructions are flawed in two regards. Firstly, Flash Player [...]]]></description>
			<content:encoded><![CDATA[<p>This took a fair bit of searching, and the answer&#8217;s non-obvious&#8230;</p>
<p>Everybody (?) knows that in theory, if you have 64-bit Firefox on 64-bit Linux (x86_64), you can use <a href="http://gwenole.beauchesne.info/en/projects/nspluginwrapper">nspluginwrapper</a> to install 32-bit plugins, like the Flash Player. There&#8217;s some instructions <a title="Installing Flash Player 9 On 64Bit Linux (x86_64)" href="http://www.howtoforge.com/installing-flash-player9-on-64bit-linux">here</a> for example.</p>
<p>However, those instructions are flawed in two regards.</p>
<p><span id="more-166"></span>Firstly, Flash Player 10 doesn&#8217;t come with a .xpt file any more, but that&#8217;s not apparently a problem.</p>
<p>Secondly, and more mistifyingly, nspluginwrapper seems to require you to give the <strong>absolute </strong>path to the plugin&#8217;s .so file, for some reason. So if you get an error like this:</p>
<pre>$ nspluginwrapper -v -i libflashplayer.so
*** NSPlugin Viewer  *** ERROR: libflashplayer.so: cannot open
shared object file: No such file or directory
nspluginwrapper: no appropriate viewer found for libflashplayer.so</pre>
<p>Then try again with the full path to the plugin:</p>
<pre>$ nspluginwrapper -v -i /home/bsm/clegg/.mozilla/plugins/libflashplayer.so
Install plugin /home/bsm/clegg/.mozilla/plugins/libflashplayer.so
  into /home/bsm/clegg/.mozilla/plugins/npwrapper.libflashplayer.so</pre>
<p>Restart Firefox, and away you go, joy! No feeling for stability yet, but I&#8217;ll post again if there are any problems.</p>
<p>Incidentally, I first tried installing nspluginwrapper via yum, and got a whole bunch of unsatisfied dependencies:</p>
<pre>Error: Package devhelp needs libgtkembedmoz.so, this is not available.
Error: Package devhelp needs libxpcom.so, this is not available.
Error: Package devhelp needs gecko-libs = 1.8.0.12, this is not available.</pre>
<p style="text-align: left;">Then I just tried installing the RPMs from the<a href="http://gwenole.beauchesne.info/en/projects/nspluginwrapper"> nspluginwrapper home page</a> (first the one marked Viewer, then the one marked Plugin) and it worked like a charm.</p>
<p style="text-align: left;">Hat tip to <a title="Ubuntu Forums" href="http://ubuntuforums.org/showthread.php?t=646167">this thread on the Ubuntu Forums</a> for finally revealing the key bit of information about absolute vs. relative paths.</p>
<p style="text-align: left;"><strong>UPDATE:</strong> Aaargh, sound doesn&#8217;t work. But that seems to be the fault of my ALSA drivers rather than Flash or nspluginwrapper. Apparently Flash can only use ALSA for sound, and not any of the other various Linux sound architectures, and only OSS works on this PC&#8230;</p>
<p style="text-align: left;">Andrew.</p>
]]></content:encoded>
			<wfw:commentRss>http://biotext.org.uk/installing-flash-on-64-bit-linux-centos-5/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>

