Python : Basic statistics with the numpy module

The numpy module features some useful functions for statistics, like “mean()” and “median()”: https://docs.scipy.org/doc/numpy/reference/routines.statistics.html For example let´s consider a 2D array with age and height of some people and print out some statistics: The code can be also found on github: https://github.com/lauraliparulo/python-scripts/blob/master/statistics/person_stats.py

MySQL CHECK constraint alternative: triggers!

Yesterday I discovered the powerful hibernate check constraint (@org.hibernate.annotations.Check) , which can be directly added in your entity class like this: Unfortunately, as you can read in the official MySQL docs, “the CHECK clause is parsed but ignored by all storage engines”. Yesterday I found out that MySql 5.X doesn´t support the SQL CHECK constraint. […]

“Hello world” kernel module

Make a directory called “helloM” in your home dir and edit the following .C file, called “hello.c”: /*hello.c – The simplest kernel module.*/ #include <linux/module.h>  /* Needed by all modules */ #include <linux/kernel.h>  /* Needed for KERN_ALERT */ int init_module(void) { printk(“<1>Hello world 1.\n”); // A non 0 return means init_module failed; module can’t be […]

Perl script using LWP module

Library FOR WWW in Perl (LWP) In Linux you can istall all the perl modules about the web (LWP, URI, URL, HTTP…) at once: :~$ sudo apt-get install libwww-perl LWP is the most used Perl module for accessing data on the web. LWP::Simple – module to get document by http its functions don’t support cookies […]

Perl script for a Hollywood Sqlite database

Let’s analyze the following perl scripta “cinema.pl”, to create and populate a simple database about  movies, and “query_hollywood.pl” to execute a simple SELECT-FROM-WHERE query on it. —————————————cinema.pl———————————————————— #!/usr/bin/perl -w use DBI; use strict; # CONFIG VARIABLES my $platform = “SQLite”; my $database = “hollywood.db”; my $host = “localhost”; my $port = “3306”; my $user = […]