xAppSoftware Blog

erlang-logo-darkback 0

Handling lists with erlang – part 2 : Lists Comprehensions

Erlang provides Lists Comprehensions to build or modify lists. List Comprehensions in Erlang are about building sets from other sets.
LC is based off the idea of set notation, set notation basically tells you how to build a set by specifying properties its members must satisfy.
In the post Handling lists with erlang – part 1 : start using lists I have shown how to build a list of the even integers number less than 100 using the seq function.
With LC we are going to define the set in the following way:
We want all the X contained in N (Integer numbers) such that X < 100 and the remainder of the division by 2 is 0. So we can write the code:1> EvenNumbers = [X || X <- lists:seq(0, 100), X rem 2 == 0]. [0,2,4,6,8,10,12,14,16,18,20,22,24,26,28,30,32,34,36,38,40, 42,44,46,48,50,52,54,56|...] 2>

vim 0

How to use vim to save highlighted syntax in HTML

Vim is a fantastic text editor.

It provides a lot of interesting funvtionalities like syntax highlighting for many programming languages.

If you want to export your source code with the syntax highlighted, vim provides a way to export what you see in html format.

erlang-logo-darkback 0

Erlang read user input and write outputs to file

Last week we added two recursive functions to the calculus.erl code.
Today we are going to add a little interaction to our program, requesting to the user the number for which we want to compute the factorial.

So we’ll add a new function to ask the number and then to store (in append mode) the result into a text file.

vim 0

4 ways to fix arrow keys that display A B C D on vim while running on remote shell

While you are running vim on a remote terminal (putty, ssh or similar), it may happen that when you are in insert mode on vim and you press arrow keys, vim will insert a letter in the set {A, B, C, D}

Fibonacci-Spiral 0

Compute recursive functions with Erlang (factorial and fibonacci examples)

Last week we computed the distance between two points in the cartesian plane, today we want to compute the factorial of a number and the fibonacci serie.
Then we want to add both the function in the calculus source code.
The factorial of a non-negative integer n, denoted by n!, is the product of all positive integers less than or equal to n.
The value of 0! is 1.
The value of 1! is 1.
The value of 3! is 3*2*1 = 6.

shell1 0

A batch file to create a wifi hotspot on Windows 7 or Windows 8

Creating an hotspot with windows 7 is easy, but you may have to install some additional software.

If you don’t want to install anything you can write a simple batch file that will do the work.

Simply create a wifihotspot.bat file containig the following two lines:

pythagoras-abc 0

Compute distance between two points in the cartesian plan in ERLANG

Today, we are going to write a function to compute the distance between two points in the cartesian plane.
We’ll call our module calculus.


A point in the cartesian plane has two coordinates X and Y, so we’ll need a function handling 4 parameters, and then the interface will be: