In this last period I had the small idea to create a small website for stocks and actions. Nothing very fancy, but something too try to learn something new about the magic world of finance.

Looking around for a good API to retrieve an historical data, I was able to found Yahoo Finance API (deprecated few weeks ago), Intrinio (pretty) and AlphaVantage. The last one was my choice to try to experiment with this world.

AlphaVantage Documentation

The AlphaVantage HTTP Api works more than efficiently for my taste, but I was disappoint to discover that there were no available gem (Ruby libraries) for it.

Since I like works well done, I had a boost of confidence in myself and I create AlphaVantageRB: a nice Ruby wrapper for AlphaVantage HTTP API.

If you are curious and you want to know a little more: please visit my GitHub page or download the Gem from Rubygem.

Update website and Pinterest

From when I create around one year and half ago many things are changed. I found a new job, I bought a house with my wonderful wife and together we adopt a cute cat.


However life is changing, but this website was remaining the same. For this reason in the last days I did a general update.

Now the published papers are updated with a more complete list. This was necessary since two papers were accepted for publication.

I update my working skills by adding my new Ruby knowledge and database management. Furthermore I add my gem ArangoRB to the project lists.

A new Pinterest page


Both my normal curriculum vitae and my academic curriculum vitae have been updated with an update data.

At the bottom to the Bitbucket repository, I add a link to my GitHub repository, where you can find the already cited ArangoRB.

Last, but not less important, I add a new page dedicated to Pinterest where you can have a preview of five of my main boards. Feel free to follow me if you own a Pinterest account too.


As a developer I found myself with the struggling problem which type of Database was more convenient to use. Without revealing our company choice, I can say that I tried several ones.

In particular, I was attracted by the graph database like Neo4j, OrientDB and ArangoDB. I like in particular the last one, that provide a splendid documentation and, in comparison with the other three, in my humble opinion, a better performance.

ArangoDB logo

The only problem that I had was the lack of a good maintained driver for, the programming language that I was, and I am, using. After a while of research, I understand that my hope to find something already built was useless. If I wanted to use efficiently ArangoDB with Ruby, I should work for myself and for all the ArangoDB/Ruby community.

I used a couple of weeks and at the end I create my first gem ArangoRB.

I was going to contact ArangoDB to ask some advice about it, but they were faster  and they e-mail me to thanks for this new driver.

At the moment, I proud to say that ArangoRB is the main driver for ArangoDB. A little satisfaction for my first experience in the open-source programming world.

Between Music and Books

Since our life is not only computer, work and programming, for once we leave the digital world to talk a little about music and books.

My music (in the website is interactive)
My music (in the website is interactive)

Playing, listening music and reading books are some of my favourite hobbies. In my free time I enjoy to play piano, listen some electro-swing or read an amazing historic book. But my website did not give enough emphasis on these important parts of my life: for this reason I create two new pages under the new category “More about me”.

One page is for music:

The other one for books:

I had a little problem to illustrate these two hobbies since I do not have a very definite taste. For example for music I listen rock, classic music, Italian pop, epic metal, Irish music, soundtrack and so on. About books I am not better since I enjoy fantasy, science fiction, historical, politics, detectives stories, thriller…

My books (in the website is interactive)
My books (in the website is interactive)

To solve this bad situation, I recovered two of my favourite social networks: and Goodreads. The first one collects all my listened music between a process called “scrobbling”, the second one is a good list of my reading in the past years. By using the available apis and widgets, it was not difficult to obtain two elegant interactive showcases.

As last thing I cannot conclude the section music without showing a little my ability to play piano. For this purpose I embedded two videos with me on the piano.

Have fun!

Stefano Martin

Connect Four in C

And here we are again!

After all these cryptographic methods I was thinking: maybe this blog is becoming too much serious. I need to give a little of fun to my poor readers.

For this reason I recover from the grave an old program in C that I created in my Bachelor. It was in Italian language, but… Come on! You don’t have to worry! I translate this game in English and I correct some small bugs. So! Have fun!

Eh?!? I didn’t say what about is this program? Really? Oh…

As you can read from the title is “Connect four” on terminal. A simple picture so you can understand better what I am talking.

This is connect four

It is a turn game 1 against 1 where you need to be the first to insert four coins in line horizontally, vertically or diagonally.

In my version you can play against a friend or, if you are alone, against a little smart pc. It is not a very high AI, but it can provide a small challenge.

At the end of every match, a score and the time used will be saved on your pc. In this way you will be able to recover easily the chronology of your matches!

Full of smiles! 😀

Instructions and rules are also provided inside of the game. You can download it by here.

Connect Four in C

Give a try and let me know what you think!

Your sincerely,
Stefano Martin

AES with C

Welcome everybody again!

This week is a cryptographic period and I want to present again AES.

AGAIN?!? Ok… I can understand your concern. Already in the last week I gave you a very similar program in Java. But there was something that bothers me.

When I want to protect something, I want to be able to protect everything. With Java I was quite happy to be able to encrypt any type of language (Chinese, Russian, Italian, Arabic, and so on). But it was not enough for me. I didn’t want only to encrypt simple text files, but even pictures, video or more complicate files.

A simple example of how to use this new program

For this reason I recover an old friend called C and I went brutally on the basis of the file code. To overcome the simple letter structure as ‘A’, ‘b’ or ‘胡’ and transcend in the fantastic world made of zeros and one, i.e. something like this 10101010101.

I am happy thus to make you available a new program in C, downloadable without any problem by here.

AES-128, AES-192 and AES 256, this time in C

Which are the advantages of this version?
+  You can encrypt (and decrypt) any files.
+  It it faster than Java
+  It works fine in Linux too (here the download for Linux version)

Which are the disadvantages?
–  The application is not user friendly (you need to use the terminal)
–  It is a little harder to select the file that you want to encrypt (or decrypt)

Give a try! But be careful! I will give you the same alert of the last time. If you encrypt a file and you delete the original one (DON’T DO IT), then you can recover your original document only if you own the password. I can’t accept any responsibility or liability for damages arising from the misuse of this program.

Your sincerely,
Stefano Martin

AES with Java

Welcome everybody!

Today I want to show a new Java created by myself. It is useful in the case that you want to protect your messages from possible eavesdropper. If you like stories of espionage, the names of Snowden and Wikileaks will not sound new to you. In both the cases the protection or discovery of a secret were the main point of the debate.

When we want to protect our message we are doing “cryptography”.

In general, when we want to protect our message we are doing “cryptography”. At the contrary, if we want to discovery a message (without a password) we are doing “cryptanalysis”. With the java program that you can download from the next link, we are doing “cryptography”.

AES-128, AES-192, and AES-256 in one program

With this program you will be able to encrypt and decrypt text files (not photos, programs or videos) with one of the most secure method of encryption: AES-256 (or alternatively AES-128 or AES-192).


To create this Java program I used the original paper that the authors, Joan Daemen and Vincent Rijmen, used to propose Rijndael, better known as AES. At this link you can find the original pdf.

For the creation of this program I found two interesting problems: the first one was of mathematical nature. To work with a field with 256 elements, called GF(256), is not simple and required some notion of not trivial algebra. Especially if you don’t understand that he chosen “x” in GF(256) is not a primitive element, but “x+1” it is. Luckily my PhD came to help me, and the creation of a the encryption systems was not really hard for myself. The use of Sage (Python with mathematical steroids) was fundamental to create efficiently this mathematics part.  If you don’t understand the problem, don’t worry! And be happy!

This is a good friend for a programmer that wants to use mathematics.

The second problem was with the implementation of AES. By having a Chinese wife and being myself Italian, I should use symbols as “我” or “é”. For this reason I should say goodbye to my old friend UTF-8 and say welcome to UTF-16 and its UNICODE world. It was not really challenging, but still interesting.

Give a try! But be careful! If you encrypt a file and you delete the original one (DON’T DO IT), then you can recover your original document only if you own the password. I can’t accept any responsibility or liability for damages arising from the misuse of this program.

Your sincerely,
Stefano Martin


Project Euler

One famous website to test your own ability to code is Project This website offers over 500 different challenges that can be solved only by the use of some programming language.

The programming language of my choice is Java. Thus with courage and ambition I started quickly to write and compile lines and lines of codes.

Since I just began, the quantity of my solved exercises (25) is not actually exciting. But it permits me to obtain the first level of Euler that equivals to be in the 14.75% of people that was able to solve at least 25 problems.

I want to add one thing: the exercise usually are very specific, by requiring an exact value. For example problem 7 asks: “What is the 10001st prime number?”
My program solves instead: “What is the n-th prime number?” where n is a positive integer. I like to have more general answers.

If you are curious you can find my Bitbucket repository here: click me!

Oh! About the repositories! At the bottom of my webpage you can find now a small bucket. That one will permit you to find my repositories on Bitbucket.

Stefano Martin

Stefano Website

Today I am happy to communicate that I open a new website about myself.

You can find at this link:


In this way you can know a little more about me.
For now the website has four main section:

  • Programming: I illustrate my programming skills and the projects available to the public.
  • Academic: In this area you can learn more about my accomplishments at Aalborg University as PhD Student and Research Assistant.
  • Education: The level of my education and the languages that I am and I will be able to speak.
  • Contact: The best ways that you can use to contact me.

From every page it is possible to download my CV. If you are more interested about my academic career until now, you can even download my academic CV from the section “Academic”.

I plan to keep this website updated with new projects and ideas.
Don’t worry! Follow this blog and I will keep you updated!

Stefano Martin

Fractals with Java

Hello everybody!

Today I created a new program in Java to create self similar sets. This are a type of fractals generated by rotations, translations and shrinking. However pictures are worth thousands of words. Let me to give some examples!

Likes leaves
Pythagoras tree
Pythagoras tree

The slider on the left are used to create your fractal on the right. Here the meaning of any sliders:

  • S indicates in how many way we want to repeat our fractals. For example for the Pythagoras tree we use two ways.
  • Times indicates how many times we want to repeat our pictures.

The user needs to be careful on using the “Times” slider because the number of points will increase exponentially.
In general, by using a little of math, we know that we have (S+1)^Times squares, so 4(S+1)^Times points. For example, for S = 2, Times = 10, our picture will represents 3^10 little squares.

  • For any function S we need to assign a rotation in degrees (with “Grade”), a shrinking in percentage (with “Size”) and a translation (in x with “X axis” and in y with “Y axis”).
    For example if we have Grade=45, Size=75, X axis=100, Y axis=-50, it means that we rotate our square of 45°, our new picture will be 75% the original one, and it will moved on the right of 100 pixels and on the bottom of 50 pixels.

You can download this small Java programs from here: Link v1.0 (9 KB) (old version with black fractals)

Link v1.1 (10 KB)
+ Added at the bottom a save button to save your fractals in .png files
+ Now the fractals are in red
+ Correct small mistakes

Note: To open a jar file in Windows, you must have the Java Runtime Environment installed.

Stefano Martin