Author: Fabio T.

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.* )
       compiler="GCC"
       ncbi_compiler="GCC"
       ncbi_compiler_ver="$compiler_ver"
                 WithFeatures="$WithFeatures${WithFeaturesSep}GCC"; WithFeaturesSep=" "
       ;;
   esac

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.* )

with

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!

Things every wanna-be game designer/developer should know

Game Design 101 by Tom Sloper

Very funny and thoughtful series of advice, divided in more than 80 “lessons”, on the common pitfalls of young chaps with a strong will to make their own game.. or so they think.

‘Cause the will, the determination, easily withers when faced with the reality of making a proper game. Read carefully!

An excerpt on why you won’t get other people (programmers, artists or whatever) do most of the work for you just because you had the Fantastic Idea:

Pretend for a moment that you have a great idea for a novel, not a game. How would you go about getting it written and published? Would you go to a bulletin board and advertise looking for an author to write it for you? No, you would have to get off your butt and write it yourself. I have heard that a friend of Frank Herbert (author of Dune) asked Herbert to author the friend’s idea and split the profits 50/50. Herbert refused, even though the guy was a good friend — Herbert’s reply was basically that ideas are easy; the writing is the hard part. Think about it for a minute — would YOU want to have a friend come up to you, tell you a few sentences, then have you spend months hunched over a keyboard turning his few sentences into the Great American Novel? I doubt it. If you did spend months writing that book, would you want to give half of the money to that guy? I don’t think so.

If only humans were as good-natured as animals..

..what a wonderful world would it be!

  • we would often be commiting infanticide for the sake of our lineage
  • we would be defining strict hierarchies where only two individuals are allowed to reproduce, or where the male has a harem of several females and fights hard any competitors
  • we would have males poisoning their female “soul mate”, but since she’d do the same with a stronger poison these males would inevitably die
  • we would have males beating their females and going with little armies to kill nearby groups of the same species or of other species, you know, the one that only thinks about sex
  • we would be committing suicide, either alone or “kamikaze style”

and plenty of other funny and lovely things!

On a more serious note

I know the common objection to this. “They cannot choose”, “It’s their nature” and so on. What really does bug me is that people aren’t able to see that we humans are actually an improvement, because we can choose and we can define our own “nature”, which becomes culture- and ratio-based instead of strictly genetic/impulsive.

Ethics can be defined, followed, enforced by law. All the bad things I listed, that indeed have been proudly performed by many humans and still cause suffering to a lot of people in the world, can be made forbidden or depicted as despicable, thus reducing them statistically.

In some of the cited articles, you may read explanations of why animals do such bad things. Sometimes had been indeed proved that those behaviours increase their probability, as a species, to survive.

I don’t know if you noticed, but the important thing seems to be the “species” when talking about animals. Not the “individual”.

Would you really like that? We have been constructing abstract wrappings around pain and suffering (as well as good feelings) for thousands of years, but you know: also animals suffers. When a male lion kills a pup, his mother (maybe, I don’t know) suffers but the pup suffers more, before dying. It’s physical suffering, which is really bad.

I guess it’s also worse when they starve to death or are plagued by different kind of damn diseases.

Would you like that to happen to you, your family, your friends? Don’t you see how humans, yet despicable on many areas, are actually an improvement for the individual, regardless of the species?

For me the individual is important, what I feel, what I want, and the same for the people near me: the more “far away” they are, the less I care. And that’s pretty normal: we’d die in a minute if we cared about all problems affecting people worldwide.

A lot still has to be done, on the ethical and technological side, to build a really safe and enjoyable world for us and our beloved.

For sure, the wrong way is that of be willing to go back to tribal societies, reviving our animal instincts, because animals are soooo cute and they are full of love while we are just reckless filthy humans.

Go down from the trees, ethical-driven humans! Your modern society needs you. Well educated, conscious and rational.

How to remotely use your workstation with ssh and vnc

I assume that you use a Unix-like operative system, but this apply to any OS.

Let’s say about a problem: you are in your office, you are waiting for some kind of simulation to end. Everything seems to go well, so you go home, quite confident that the next morning you’ll have some results to analyze.

Unfortunately, it’s unlikely to happen. Ten seconds after your departure, the program ends for a low-frequency bug that you missed.

Luckily, we have a solution for the future. Instead of losing a long night (or even a weekend) of program executions, you can check your office workstation when you are at home, in your warm bed, or everywhere you like to be (with an internet connection, ça va sans dire).

What do you need in your workstation?

You need to install (or ask the sysadmin to install):

  1. the ssh server
  2. a vnc server: x11vnc

Remember to ask the sysadmin:

  1. the public IP of your workstation
  2. the range of unused open ports, if the workstation is behind a router

What do you have to do from home?

Ok, now it’s very simple. You’ll only need to install a vncviewer, but you’ll probably already have one. Let’s say that your workstation username is goofy, the public IP is 1.0.0.1, and the free open port on the workstation is the 5900. Now we need another port, this time a local one (of your home computer), to create the http tunnel. I suggest the port 5901:

ssh -p 42 -L 5901:localhost:5900 goofy@1.0.0.1

You’ll have to insert your workstation password, and then you can explore with the shell your remote operative system. If you want to use it graphically, only execute the command:

x11vnc

Wait for 5-6 seconds, then open another shell without closing the current one, and type the following:

vncviewer localhost::5901

Et voilà! You have to move your mouse on the new black window, and then you’ll see the remote display to appear.