Operating System

Test Internet/Connection Speed from Linux Command Line

See complete post of Test Internet/Connection Speed from Linux Command Line

Do you use Ubuntu Server? or have a VPS or Dedicated Server hosting that runs Linux which only can be accessed via Console/Command Line/SSH? I Do! And now i want to check whether if the hosting company give me correct package of dedicated bandwidth for my server…

Yes, most people would think about speedtest.net, the most popular and distributed internet/connection speed test in the world. But the problem is speedtest.net is using a website and my server cannot open a web page and run the test widget there… Fortunately there is a “speedtest-cli” built on python and support any operating system as long as can run python code.

Read More →

Get All Local Network Interface Card (NIC) C# Source Code

Yeah, actually i’m back to blogger activities… This is the part of my next projects, M-NIC Projects. The goal is to get all information of our network interface card (NIC) information such as IP addresses, link speed, name, etc. So after doing some head-to-head within some programming languages, my choices is C# .NET, because i think it’s easiest way to get that. The result is something like below, i retrieve all of my NIC which status is UP

Name            : Wireless Network Connection 2
Type            : Wireless80211
Status          : Up
Speed           : 4294967295
Description     : Microsoft Virtual WiFi Miniport Adapter
InterNetworkV6  : fe80::e1cf:b2ee:f5c7:e23e%31
InterNetwork    :
Name            : Local Area Connection
Type            : Ethernet
Status          : Up
Speed           : 100000000
Description     : Atheros AR8152 PCI-E Fast Ethernet Controller
InterNetwork    :
Name            : Loopback Pseudo-Interface 1
Type            : Loopback
Status          : Up
Speed           : 1073741824
Description     : Software Loopback Interface 1
InterNetworkV6  : ::1
InterNetwork    :

And here is the code: Read More →

Building PHP Webserver on Nginx with PHP CGI

Doesn’t like the Apache webserver, nginx didn’t have the auto-configuration feature from PHP and library loading. The way to make nginx be a PHP webserver is passing the request to PHP CGI. How?

The first step must be installing the nginx and php5 package. For this post i’m using Ubuntu 10.04 LTS.

apt-get update nginx
apt-get update php5

Check your nginx installation with start the service:

service nginx restart
/etc/init.d/nginx restart

Now, if the nginx working, let’s connect it to the PHP CGI. First, run the PHP CGI so that the PHP listen at with port 9000.

/usr/bin/php-cgi -b &

Read More →

Matrix-Matrix Multiplication MPI C Source Code

Expanding from my previous post, “Matrix-Vector Multiplication MPI C Source Code”. Now we create a program to calculate two two-dimensional matrices (array) with MPI. Same concept and algorithm with matrix-vector used to solve this problem, row-based operation.

Now the differences from matrix-vector just the array size and dimension.

#define AROW 3
#define ACOL 2

#define BCOL 3

#define MAX_VALUE 10

For proc_map() function please look at matrix-vector post, and here’s the computational code for matrix-matrix multiplication.

Read More →

Matrix-Vector Multiplication MPI C Source Code

Here’s my first task for MPI Programming. Create a matrix-vector multiplication program using Message Passing Interface. Let’s go directly to the source code and we can discuss it later if you want.

First, MPI with C language commonly use “mpi.h” and you still can use standard C library.

#include "stdio.h"
#include "stdlib.h"
#include "time.h"
#include "math.h"

#include "mpi.h"

Now, we need to define the size of matrices, A as [AROW x ACOL] and B as [ACOL x 1] so the result let’s call it matrix C [AROW x 1]. Because the row of B must be equals with column of A and the result matrix C has row = AROW and single column. MAX_VALUE is the constant for defining maximum value of random number for matrices elements value.

#define AROW 3
#define ACOL 2

#define MAX_VALUE 10

proc_map() function is the function to map the each task to which process to do it.

/* Process mapping function */
int proc_map(int i, int size)
	size = size - 1;
	int r = (int) ceil( (double)AROW / (double)size);
	int proc = i / r;
	return proc + 1;

Read More →