How to compile Ncbi IgBlast with GCC >= 5.X

If you are trying compiling igblast from sources and get this error:

configure: error: Do not know how to build MT-safe with compiler /usr/bin/g++  5.2.1

the fix is very simple. Open the file src/build-system/configure and search for this section:

if test "$GCC" = "yes" ; then
   compiler_ver="`$real_CXX -dumpversion 2>&1`"
   case "$compiler_ver" in
     2.95* | 2.96* | 3.* | 4.* )
                 WithFeatures="$WithFeatures${WithFeaturesSep}GCC"; WithFeaturesSep=" "

What it does is it checks that GCC has one of the specified versions, including any version 3 or version 4. No version 5, sadly.. so just change the following line:

2.95* | 2.96* | 3.* | 4.* )


2.95* | 2.96* | 3.* | 4.* | 5.* )

Now save and go back to the release/ directory, and run the usual ./configure && make && sudo make install command.


Short C++ remainder on passing objects to functions

Suppose you have an Object class. You instantiate three objects locally:

Object o1, o2, o3;

Then you have a function:

void f(Object o1, Object &o2, Object * o3);

This summarises the three ways you can pass an object to a function: by value, by reference and by reference via a pointer (let’s call it for simplicity call by pointer). Say you call the function like this:

f(o1, o2, &o3);

Inside the function, you may access these objects’ fields like this (note o3):

o1.x  += 3;
o2.x  += 3;
o3->x += 3;

These are the take home messages:

  • [Call by value]: o1 is going to be copied inside the function f, then after f returns the copy is going to be destroyed. This means that any changes made by onto o1 are not going to be visible outside fIn addition to being unsuitable to persist changes, the copy overhead can be very deleterius in certain high-performance applications – however, there is no access overhead.
  • [Call by reference]: o2 is NOT going to be copied, so any changes made to o2 inside f are going to remain even after f returns. This is very efficient: no copy and methods/fields have no access overhead.
  • [Call by pointer]: you are actually passing a pointer to o3 to f, so to access the objects’ fields and methods you need to dereferentiate every time (using the -> operator). This makes it averagely efficient: no copy but access overhead.

It’s clear that, even when you don’t actually need to modify an object, call by reference should be your default approach.

KryoNet: very fast and easy to use network library

I’ve been experimenting a bit with this library and it’s a relief: I don’t have to maintain my own (crappy) one within ZenithMUD.

Easy to use, documented and very efficient, according to benchmarks I’ve found around. One can use the start() method that runs the library in a Thread and takes care of getting data from the connected clients and running user-defined actions on them, or just call the update() function in your own game loop (if you are more of a control freak :))

A good starting point, besides the README, is this Chat client-server example the author has provided.

Good job!

Update and misc

Added a few things in the About page. I’ve a job in UK, I’m working with Erlang, an amazing language designed and tweaked to deal with extremely concurrent, distributed systems. I love the actor model built in Erlang, and I’m getting used to functional programming (pattern matching is just about the best tool I’ve ever used).

Added some more information about my projects, just explore the menu up there. Nothing too impressive but you may be curious, who knows.

If you want to learn Erlang, start with the book Erlang/OTP in Action. It has a pragmatic approach and helps you write a decent OTP application quickly. If you want to start from the fundamentals, OReilly’s Erlang Programming is very thorough and is also nice to read. I recommend Geany as an editor, if you are GUI-inclined but like simple and efficient stuff (I’ve done a pull request for a few more Erlang-oriented configurations, if they don’t accept it you’ll find info in my own github account).

Intellij-Idea or SublimeText (which sadly is shareware) are more appropriate if you are into fancy GUIs in addition to functionality. There’s also a plugin for Eclipse called Erlide.

For the old and pure, instead, there are good plugins for Emacs and VIM. For the latter, search on github for “vimerl“, that’s the best.

And a new MUD is growing up!

Finally, after years of thinking and non-doing, I decided to start developing what has always been a little dream of mine: a multi-user game with fairly complex mechanics to put online and manage. In the spare time, even before enrolling in my Bachelor, I looked into 3D and 2D engines in various languages, MMORPGs open source in development and so on, when I finally realized that to test my skills and to really do something toward this direction, I’d have had to start simple!

But paraphrasing (in a totally different context, but who cares!) Einstein, things should be put in the simplest way possible, but not simpler. A puzzle game wouldn’t have done the job. I needed a kind of MMORPG, but easier. What about 2D? I don’t really like 2D fantasy game: you neither have beautiful descriptions nor beautiful graphics!

Descriptions: that’s the key. Text-based games. MUD (Multi-User Dungeons) have been around for decades, but are still played by many people. Even in Italy there are still communities alive and well. So, that’s the answer: I had to develop a MUD.

And I started, using Java…and unbelievably, I found it quite easy to setup a network infrastructure, and a system capable of handle multiple parallel commands. Test with a few users have been done and seems OK. The movement and speaking, login and logout, the persistence of the world, are all handled correctly. The first steps are done, and as soon as I have the time, the rest will be set up: more commands, a name for the project, a site, a forum, an alpha test period for the fun of the players.

I’m so excited! :°D