Category Archives: Programming

Rosalind MMCH – Maximum Matchings and RNA Secondary Structures Solution

For some time now I’ve been working on the little problems on Rosalind. Adn I’ve been stuck on one quite easy one, for ages.

And I’ve just solved it.  And the problem wasn’t to do with my code at all, it was to do with the differing versions of Python.

To solve this problem you use the inbuilt factorial function and the results from that differ under Python 2.7 and 3.

I am using 3 and obviously the people who are running Rosalind, are using 2.7.

So for instance, with this dataset:


Python 2.7 gives  the answer: 124917299331128613009585280018022400000000 which is accepted.

And Python 3 gives the answer:124917299331128612574021702489190831226880 which looks to be more accurate to me, but is not accepted.

So I’m just posting this here in  case others who are stuck on this one can find the answer here.

Line Profiling in Python

For ages I tried to get Robert Kern’s line_profiler to install on my Windows 8.1, WinPython 3.3 system.

And I’ve had no luck at all.  All the instructions etc. are for ‘nix systems and so don’t make a lot of sense for Windows users.

So I downloaded and installed this profiler:  and I had it downloaded, installed and running inside of like 5 mins.

The only thing I’d like from now is to be able to run it from an IPython console, instead of a command window, which I’m sure you can do.  Still, I can get a command window inside Spyder2, the IDE I use, so I’m 99% happy.

So now I can see where time is spent on each line of any python program! Awesome.

I Love Julia

Nope, she’s not a woman, she’s a programming language!

I’ve been learning this language for a few weeks now and I’m quite enjoying it.  I’m using Windows 8.1.  Here is what I like and don’t like:


  • It runs really fast.  Julia is an interpreted language, but it runs nearly as fast as C and Fortran for most things.
  • The syntax is pretty nice.  Much nicer than C/C++ and Java.  No curly braces, type casts everywhere etc.
  • It’s free.  Anyone can download it and play with it.
  • There are a huge amount of people/resources/packages etc. behind it.  Including optimisation packages, graphs, algorithms and so on which is what I’m really interested.
  • There is a free IDE for it called Julia Studio which is pretty good actually.  It has syntax highlighting, a packaging system (which I’m just learning about today) for adding in code, and many other features.  It’s still pretty new and pretty basic but hey for free, it’s pretty bloody good actually.
  • I feel I’m on the cusp of something, like getting in early, like part of a select few who are learning about this language, part of a club, do you know what I mean?  And that’s kinda cool.
  • It’s got a profiler, which is pretty easy to use.


  • I’ve found the language quite tricky to learn.  Previous to this I’ve been programming in Python and previous to that things like C++, VB and so on.  Julia is quite different to all of these and I’ve needed a lot of help with syntax.  The online documentation is thorough except in one regard: examples – there aren’t many.
  • Julia is a new language, so the tools for it are pretty new too.  Julia Studio, by Forio is great for a free tool, but is nowhere near as flash as say Visual Studio – but then you pay thousands for that and it still has bugs.
  • Error descriptions.  Related to above, I’ll often get errors that are really cryptic, don’t give a valid line number (if using functions) and can take quite some time to work out what’s going wrong.  I often have to resort to println statements to work out where the program is going wrong.

Oh well, anyway, I’ll carry on with this and who knows where it will take me?