wake on power in giada n20

Written by: daniel

Date December 30, 2011

I have recently got a Giada N20 for our digital signage system. Before that we used older N10, but for the same price we get now a slimmer and newer device. For now they seem to be 100% compatible (at least for what we use them) the only problem was the “wake on power” feature, which apparently is missing in the N20’s bios.

This would be a major problem - as signage players wouldn’t get up after a power failure, but fortunately there is a simple solution for it.

All that need to be done is to add this line:

/usr/bin/setpci -s 0:1f.0 0xa4.b=0

to /etc/rc.local file
It’s sets the chip register responsible for auto wake up when the power comes back.
This must be configured after each wake up, that’s the reason we add it to our /etc/rc.local file.

node-ping and node-portchecker available on npm

Written by: daniel

Date November 23, 2011

My two simple opensource nodejs libraries “ping” and “portchecker” are available on npm.

Ping - is a simple wrapper for the system ping utility

Portchecker - allows you to perform some checks on open ports in a given host. you can use it for availability testing, getting a random non used port from a given range and so on.

More info on my github page:

http://github.com/danielzzz

a port checker / scanner library for nodejs

Written by: daniel

Date September 29, 2010

I am working on a bigger system monitoring application and one of things I had to create for this project, it’s a just published tcp port checker / scanner library for nodejs.

This little utility allows you to:
- check if a given port is being used
- get the first available port from a given range (useful when you need to find some free port for forwarding)
- get all open ports in a given range

the code is opensourced and it’s available at:
http://github.com/danielzzz/node-portchecker

A fight is going inside me

Written by: daniel

Date September 15, 2010

An old Cherokee is teaching his grandson about life. “A fight is going on inside me,” he said to the boy.

“It is a terrible fight and it is between two wolves. One is evil - he is anger, envy, sorrow, regret, greed, arrogance, self-pity, guilt, resentment, inferiority, lies, false pride, superiority, and ego.” He continued, “The other is good - he is joy, peace, love, hope, serenity, humility, kindness, benevolence, empathy, generosity, truth, compassion, and faith. The same fight is going on inside you - and inside every other person, too.”

The grandson thought about it for a minute and then asked his grandfather, “Which wolf will win?”

The old Cherokee simply replied, “The one you feed.”

found here

Just Delpoy It!

Written by: daniel

Date September 14, 2010

So many projects (and there is also shame on me) suffer from delays when publishing. Amongst different problems that may cause it (bad project definition, changed specifications, previously unknown conditions and so on…) there is one that has probably killed more than one good project.

I am talking about “over-polishing”.

It happens when you secretly develop your project, polishing every possible detail before you finally publish it, hoping to take over the world. Sadly, either it may never finally get published because you never consider it to be “ready”, or when you publish it after months of hard work, you notice that your customers wanted something completely different, or during the time when you were on your way to develop your superior project, many other competitors released less featured but similar own versions and took most of the market share.

Either way, you are screwed.

One possible solution would be to “publish as you go”. Google took it to the perfection with their “beta” slogan (which all of the web2.0 cool kids followed, of course). If you have an idea, try to get a minimal working version as soon as you can. Allow your customers to give you some feedback, improve and publish again. Over and over, till you get there. Needless to say, that any feedback is very, very helpful to your work.

This, of course, can be applied to any kind of project. When I started living on my own and learning how to cook, there was a time my friends had always “an emergency to attend” when invited to come over ;) But then after some practice I started producing some edible meals, and afterwards some of them became le-gen-dary ;)

So next time, try to make your idea “touchable” as soon as you can, and then improve on your way.
It took over 10.000 times Edison to get his light bulb working. Hopefully, you will get there faster, but every step counts in spite what other say.

one line http server

Written by: daniel

Date September 7, 2010

Sometimes I find myself doing some simple html project. Usually, it could be seen right from the hd using file://, but there are some stuff, that doesn’t necesarily work this way.

Instead of creating a new apache account etc. etc.. I found this simple line to create a http static server that server files from the current directory:

python -m SimpleHTTPServer 8900

and you can access your files with http://localhost:8900

automating openvpn configuration with php

Written by: daniel

Date July 21, 2010

Virtual Private Networks can be very handy, but even with easy-rsa scripts it’s a little time taking to add new computers to the network, especially if you frecuently add new machines.

With this handy php script you can automate this process a little bit - you could for example publish it on a web server and then make customers to connet to it in order to generate their access keys and configuration (It would be a good idea to password protect it first ;) )

You will need to generate the CA key and certificate first before you will be able to use it.

Check this guide on how to do it:
http://www.openvpn.net/index.php/open-source/documentation/howto.html#pki

and here goes the code:


//this should be unique for each client

$commonName = 'ayd-test';

$tmpDir = '/tmp/openvpn-'.time();

$dn = array(

"countryName" => 'ES',

"stateOrProvinceName" => 'Baleares',

"localityName" => 'Palma de Mallorca',

"organizationName" => 'AYD',

"organizationalUnitName" => 'AYD test',

"commonName" => $commonName,

"emailAddress" => 'test@test.com'

);

$privkeypass = null;

$numberofdays = 3650;

//load previously generated server private key

$fp=fopen("./ca.key","r");

$caData = fread($fp,8192);

fclose($fp);

// $passphrase is required if your key is encoded (suggested)

$caKey = openssl_get_privatekey($caData);

//load previously generated server cartificate

$fp=fopen("./ca.crt","r");

$caCrt = fread($fp,8192);

fclose($fp);

//--------------- generating a new user cert and key -------------

// create private key for the user

$privkey = openssl_pkey_new();

openssl_pkey_export($privkey, $privatekey, $privkeypass);

//make certificate request for the user

$csr = openssl_csr_new($dn, $privatekey);

openssl_csr_export($csr, $csrStr);

//sign certificate request with the CA key

$sscert = openssl_csr_sign($csrStr, $caCrt, $caKey, $numberofdays);

openssl_x509_export($sscert, $publickey);

//create a tmp dir

mkdir($tmpDir);

//write a private key

echo "writting private key...\n";

echo $privatekey; // Will hold the exported PriKey

file_put_contents($tmpDir."/".$commonName.'.key', $privatekey);

//write an user cert

echo "writting ceritifate...\n";

echo $publickey;     // Will hold the exported Certificate

file_put_contents($tmpDir."/".$commonName.'.crt', $publickey);

//copy server certificate (we need it for openvpn config)

copy('./ca.crt', $tmpDir.'/ca.crt');

//generate and write openvpn config file

//edit data for according to your configuration

$config = "client

dev tun

tun-mtu 1200

proto udp

remote yourserver.com 1194

resolv-retry infinite

nobind

persist-key

persist-tun

ca /etc/openvpn/server_ca.crt

cert /etc/openvpn/$commonName.crt

key /etc/openvpn/{$commonName}.key

comp-lzo

verb 5

";

file_put_contents($tmpDir.'/server.conf', $config);

echo "generated files are in: ".$tmpDir;

you can then copy the generated files to your /etc/openvpn directory and you should be able to connect to the vpn.

google releases a high quality video codec

Written by: daniel

Date May 19, 2010

This is some good news for the cross-browser video support in html5. As you might already know, there is a video tag, that allows videos to be played in browsers without any third party plugins (like flash player, for example).

The problem was that browser developers could not agree on which codec should be used for video encoding. There is the h263 mp4 codec used by many vendors, and which offers a ver good quality and a small size, but it’s protected by patents, which makes it a no-option for many people. (Btw. did you know that most of cameras, even the “professional” ones that allow to record natively in mp4, don’t allow for professional usage of the recorded videos by licence?)

On the other hand there is an open source theora video codec which offers quite good quality (we used it for www.tvmallorca.net project) and it seems not to be limited by any license (although some vendors like apple or microsoft say otherwise)

This gives a big headache to us, developers, because we need to prepare content in many different formats to be sure everyone will be able to watch it. Not fun at all!

Luckily, google released today an open web media project, which includes they recently aqqured vp8 codec. Will this finally bring the html5 video to the masses? Let’s hope so. Youtube, Chrome browser and Firefox already support this codec in their nightly builds, and hopefuly other vendors will jump on the wagon soon.

http://www.webmproject.org

html5 - The future is here

Written by: daniel

Date April 18, 2010

http://apirocks.com/html5/html5.html#slide1

(check it out in a chrome browser - which seems to have most features implemented)

node.js - javascript para servidores

Written by: daniel

Date February 18, 2010

éste es uno de los nuevos proyectos más prometedores que he visto últimamente. es un servidor de javascript, basado en la misma idea de callbacks que tiene por ejemplo Twisted de python.

según varias fuentes el servidor es rápido, permite muchos usuarios concurrentes y, lo que no es sin importancia, en muchos casos permite reusar el código js que uno tiene por allí, lo que puede accelerar bastante el desarrollo. hay bastante librerías externas en github.

combinado con xmpp, websockets o incluso cometm abre muchas posibilidades de crear aplicaciones web interactivas de nueva generación.

muy recomendable!

www.nodejs.org