Wordpressing scientific stuff

I found two things today:
1. You can highlight code on WordPress. Here’s the guide and an example -the pythonic HelloWorld:

print "Hello world!"

2. You can write LaTeX in you WordPress blog in order to publish nice little equations (paraphrasing Jonathan Geffen in his poem “Thunders and Lightnings”, you seldom get to meet nice big equations). Here’s the guide and an example – the famous Fisher’s fundamental theorem of natural selection:

\frac{d\bar{\omega}}{dt} = Var(\omega)


If you need a tool for experimenting with LaTeX, Texify is very useful.


Setting up a Python working envrionment on Windows

The following is a quick walkthrough on how to setup a Python working environment on a Windows machine.

This working environment is especially useful if you are a scientist, or working on a 64-bit Windows, because the python distribution mentioned below contains many important packages for scientists and for everyone precompiled for 64-bit python. Also, in this walktrhough you will setup and config IPython, which is great. And of course I already RTFMed (almost) everything for you.

  1. Install the Enthought Python Distribution (EPD), which is a Python 2.7 bundled with many python scientific packages such as Numpy, Scipy, IPython, etc. Academics get a free license.
  2. Setup IPython:
    1. Add these arguments to the shortcut running the IPython QT console:
      --pylab=inline --editor="c:\python27\lib\idlelib\idle.pyw -e"
    2. Add imports you like to C:\Users\<USERNAME>\.ipython\profile_default\startup
  3. Change the IDLE configuration file C:\Users\<USERNAME>\.idlerc\config-main.cfg 
    default = 0
    name = up-down
    autosave = 1
    editor-on-startup = 1
  4. If you don’t want a to install a revision control system, you’re done. If you do, go on.
  5. Install Mercurial by downloading and installing ToirtoiseHg.
  6. Setup TortoiseHg – in C:\Users\<USERNAME>\mercurial.ini:

# Generated by TortoiseHg settings dialog
 username = Full Name

 push_ssl = True

 fetch =

Search Google Scholar using a bookmarklet

This bookmarklet* allows you to search Google Scholar, one of the leading search engines for academic manuscripts and publications.

To use it, you simply highlight some text in your browser and click the bookmarklet, and the next thing you know you’re looking at a Scholar page with the highlighted text as a search query.

I wanted to simply give you a link that you drag to your bar, but WordPress won’t allow JavaScript in links.

So, there are two options left to get the bookmarklet:

  1. Go to this web page and grab the bookmarklet from there.
  2. Create a new bookmark in your browser, give is whatever name you’d like (I use Search Scholar) and paste the following in the bookmark address (note this might be an older version of the bookmarklet):

*If you don’t know what a bookmarket is, you should RTFM it right now, seriously.

Set up VLC HTTP interface to allow connections on the LAN

RTFM from one of the following:

  1. http://www.banamalon.net/android/wiki/index.php?title=VLC_-_Remote#Installation
  2. http://hobbyistsoftware.com/vlcsetup-win-manual

Controling VLC from the browser then looks like this:

VLC controled from the browser via HTTP interface

VLC controled from the browser via HTTP interface

Now you can choose your Android remote control app from the following list.

Enjoy pausing your lame sitcoms from your smartphone.

Creating cusomized RSS alerts for scientific articles

I’ll show you how to create an RSS feed to get alerts when your favorite scientist publishes new papers (this might only work for life sciences publications). 

  1. First decide which scientist you want to follow. For my example I will use Richard E. Lenski – he’s an evolutionary biologist that does really cool stuff. 
  2. Now go to PubMed – that’s an aggregator/indexer of life science and medicine publications.
  3. In the search box at the top, type, including the apostrophes: "Lenski RE"[Author] and press Search.
  4. You’ll get a list of Lenski’s publications, recent first.
  5. Now click the RSS icon at the top, just below the search box.
  6. Choose the maximum number of item in the drop down menu (100).
  7. Click Create RSS.
  8. Now right-click the XML icon, and choose Copy Address or something like that (Copy Link?). Alternatively, you can just left-click the XML icon, go to the new tab that opened, select the URL address and copy it.
  9. Now, open you’re favorite RSS reader. Mine is Google Reader.
  10. Click the Subscribe button (if it’s not Google Reader, you’d have to RTFM to find out how to subscribe to a new feed).
  11. Paste the URL you copied from PubMed.
  12. Now you can rename the feed and put it in some folder – I name it Lenski RE and place it under Paper Alert folder.
That’s it, you’ll never again miss a paper by your favorite authors. That’s a relief.

I imagine this procedure can be adapted for other scientific publications aggregators (Mendeley? Google Scholar?) but if you’ll want to do that you’ll have to RTFM.

Adding a scale label to an axis in Mathematica

This is a trick that eluded me for a few days but finally I managed to RTFM it.

There’s no built-in option for this but it is easy to do once you know how.

Normally you would do this with AxesLabel->{"xlabel","ylabel"}.

But what do you do when you use a frame (Frame->True)? Which is what you would do when you prepare a good looking figure…

FrameLabel->{"xlabel","ylabel","x2label","y2label"} appear in the middle of the axes, as they should as they tell you what the axes are about.

But if you also want an axis scale, like 10^4 or 10^-5 then you need to use the following (for a y-axis label):

Epilog->Inset["10^3", ImageScaled[{0.03,0.97}]],

The important commands are in red.

FrameTicks allows you to choose which ticks are labeled but also HOW they are labeled – 2 instead of 2000, etc.

Epilog allows you to add some graphics to the plot.

Inset is… well here it allows you to add some text.

ImageScaled is a clever way to position the text. Usually you just give a couple of coordinates based on the plot axes (like 0,0 for something that will appear on the origin). But with ImageScaled you can position something on the whole image, and not just inside the plot area.

PlotRangeClipping is an important option to use, because it allows things outside of the plot area to be displayed instead of clipped.

Here’s the result:

The figure created by the code above

Fig. 1 – The exponential function

All the options and functions used (marked as code) can be easily RTFMed in Mathematica’s online documentation.

I’ve used Mathematica 8 so I’m not sure how these things respond to older versions.

See Also: