Au revoir, Mozilla. Good bye Mozilla!

Note the date. This was published on April 1.

From today I will not be an active Mozilla contributor anymore.

I’ve spent last couple of years contributing to Mozilla project by translating and localizing content, organizing events, migrating businesses and individuals to open web tools like Firefox, Thunderbird and Bugzilla, talking to conferences, universities and user groups in Europe about Freedom and open web and free culture, organizing fund-raising campaigns, supporting couple of forums about Mozilla technologies, evangelizing developers to write addons and jetpacks and many many more thing, but I don’t see my impact:

 

  1. The Firefox is still the slowest browser in the world on my favorite Windows.
  2. The only e-mails i’ve got from Mozilla are about – “donaaaate more moneyyyy, Bogo”
  3. Most of the people within Mozilla doesn’t care about community at all.
  4. Month after month the things community suppose to do are more that previous month. I have to quit my job in order to drive with the same speed as others.
  5. Most of the people in the World still think Google Chrome is a good browser and Google respect their privacy.
  6. They still don’t want to hire me :(

This is enought!

Au revoir Mozilla.

The new feature

The good part of this is thanks to my Mozilla experience I was hired by Microsoft OpenWeb team as a consultant and  I will try to convince Firefox users to download the new Internet Explorer with “The FX migrator” tools – to transfer ALL of your Mozilla data to Microsoft platform, including your Thunderbird and Bugzilla data and to use the new Microsoft Open Web Cloud provider for storing your data.

Au revoir Mozilla and Thanks for making me leave :(

 

 

GeekOut 2012 – Java conference in Estonia, Europe.

Conference GeekOut is a great possibility to meet the luminaries of the Java community right in Tallinn, Estonia. You can listen to great talks and network with your peers. We invite rock star speakers from all over the world to introduce you to the latest and greatest aspects of Java technology. And we make sure, as it was in 2011, that each and every talk focuses on technology and technology only.

When: June 14 – 15, 2012

New issue is out: Java Weekly Bytes – 13.03

  • Henry Kewl is our first ever winner.
  • Interview with Mario Fusco – the author of Lambdaj and Hammurabi.
  • Picture of the Week : Finland JUG
  • What is “Secure Architecture”
  • Comparing Java and Scala’s Expressiveness
  • Transaction configuration with JPA and Spring 3.1
  • GeekOut 2012 speakers announced
  • SCALEX HTTP API
  • Rebel with A Cause: Interview with Jevgeni Kabanov
  • Something old, but cool: Skype Bot in Java for Fun and Profit
  • Get ready for jBPM Web Designer 2.1!!
  • Apache Commons Math 3.0 arrives
  • Java Developer Conference in Cairo, Egypt
  • How Badly Do We Want a New Java Date/Time API?
  • JavaOne 2012 Call for Papers
  • FindBugs and JSR-305

Click here to read it.

How to control HTML5 slides with your hands via webcam

I had an idea to show kind of human computer interaction during my Fosdem talk. I may not use that, because I will not have time to polish it, but it works quite well if you want to use it.

The Idea
The idea is to control slides only by moving my hand, without any devices in it.

The plan:
0. My web-cam should detect my move
1. After detection an event should be triggered
2. As a final action the slide should move to the next one :)

Motion detect

$ git clone https://github.com/sackmotion/motion.git
$ cd motion
$ ./configure
$ make & make install

Configure it

Motion comes with a great almost working config file, so just copy it to make it “official”:

$ cp  /usr/local/etc/motion-dist.conf /usr/local/etc/motion-dist.conf

Open it, search for those values, edit them and read what are they for:

;on_event_start value
event_gap 60

to become:

on_event_start xdotool key Right /OR xdotool search "Mozilla Firefox" windowactivate --sync key --clearmodifiers Right/
event_gap 1

Event triggering

You may need to install xdotool using your package manager. This tool allows you to emulate keyboard action in different combinations, but I will need to emulate pressing the right arrow key.

How it works:

When web-cam detects movement an event emulating ‘right arrow’ key is pressed. Since I am using HTML5 DZslides from here, this allows me to move to next slide only with moving my hand in front of my webcam.

Run

Run it and move your hand in front of your camera. You may want to turn on the logging to see the motion detection and the event detection if it’s not working at first.

$ motion

If you have any questions, please let me know.

Rust Language – Hello World

What is RUST?

Rust is an experimental, concurrent, multi-paradigm, compiled programming language developed by Mozilla Labs. It is designed to be practical, supporting pure-functional, concurrent-actor, imperative-procedural, and object-oriented styles. /wikipedia/

How to install it on your Gnu/Linux box?
Pre-requirements:

  • g++ 4.4 or clang++ 3.x
  • python 2.6 or later
  • perl 5.0 or later
  • gnu make 3.81 or later
  • curl

Continue…

Get number of likes of your/any Facebook page via PHP

If you want to use somewhere the number of people who likes your fan page, here’s the way to do that:

Create
Create a new basic application from here. Just enter some data and you will receive AppID and Secret keys.

Download
Download the PHP library to work with Facebook API.

git clone https://github.com/facebook/php-sdk.git

Write

require('php-sdk/src/facebook.php');
$facebook = new Facebook(array(
	'appId' => '000000000', // put appID here - see Create section
	'secret' => '0000c000c000c000c', //put your secret key here - see Create section
	));
$zt = $facebook->api('/ZeroTurnaround'); // my Facebook page is http://www.facebook.com/ZeroTurnaround
echo $zt['likes'];

Done

Face Recognition with Node.js

It’s pretty simple to have a basic face recognition in Node.js using the Face.com API.

Pre-Requirements :
0. You will need apikey and api-secret from face.com. You can obtain them by clicking here.

1. I am using a package called restler to handle REST requests.

npm install restler

Here is the code:

var sys = require('sys'),
     api = require('restler');


var api_key = '....';
    api_secret = '...'
    image_url = 'http://farm6.static.flickr.com/5127/5284942130_ab25c2dafd_b.jpg'; 
    
api.get('http://api.face.com/faces/detect.json?api_key='+api_key+'&api_secret='+api_secret+'&urls='+image_url).on('complete', function(data) {
  sys.puts("the object gender is: "+ data.photos[0].tags[0].attributes.gender.value + ". I am  "+data.photos[0].tags[0].attributes.gender.confidence+" % sure");
  sys.puts("The object is smiling: "+ data.photos[0].tags[0].attributes.smiling.value + ". I am  "+data.photos[0].tags[0].attributes.smiling.confidence+" % sure");
});

The script returns object gender and is it smiling or not.


Change the picture and be amazed by the results. Click here for the detailed API explanation and more examples.

P.S Here is an interesting project – Face.js

MongoDB, Node.js and admin auth

There is a big challenge to make MongoDB driver to work with Node.js, but here is an cool and working example to do that:

Require:

var mongodb = require("mongodb"); //require node-mongodb-native
var settings = require('./mconfig'); //for settings

Connect to the admin database:

var mongoserver = new mongodb.Server(settings.mongo_host, settings.mongo_port, {});
admindb = new mongodb.Db('admin', mongoserver);	

Try to auth with admin cretentials:


exports.adminlogin = function(callback) {

		admindb.open(function (error, client) {
			
			admindb.authenticate(settings.mongo_user, settings.mongo_pass, function (err, val) {
		        if (err) {
		             callback(0);
		        } else {
		            	callback(1);
		          		         
		        }
   		 });

 	 });
	
	
};

It returns 1 on success and 0 on failure.

Full HTTPS REST server in Node.js

I will show you now, how to write a simple HTTPS JSON REST server using node.js components. Grab a beer, open your IDE and let’s start hacking.

0. Create certificates.

If you don’t have valid https certificates, you can generate one for testing purposes. If you need one cool certificate, you can join cacert community. Anyway, let’s openssl for a while:

openssl genrsa -out privatekey.pem 1024 
openssl req -new -key privatekey.pem -out certrequest.csr 
openssl x509 -req -in certrequest.csr -signkey privatekey.pem -out certificate.pem

1. Install additional modules.

We will need just one aditional module, called journey.

It’s working only in JSON mode, but anyway I don’t like XML REST at all. JSON is the future, baby.

npm install journey

2. Writing the router.js file.

– Define the modules required:

var journey = require('journey');
var https = require('https');
var fs = require('fs');

– Define the certificates part:

var privateKey = fs.readFileSync('../certs/privatekey.pem');
var certificate = fs.readFileSync('../certs/certificate.pem');

var options = {
  key: privateKey,
  cert: certificate
};

– Define the router that will handle all REST requests (GET, POST, PUT, DELETE):

var mrouter = new (journey.Router)();

– Define the map of all requests. In other words what to do when the router receive a request:

mrouter.map(function () {
// Default URL
this.root.bind(function (req, res) { res.send("Welcome to my application") });

//GET request on /databases
this.get('/databases').bind(function (req, res) {
do something
});

//GET request on a specific database - /database/users21
this.get(/^databases\/([A-Za-z0-9_]+)$/).bind(function (req, res, id) {
	 //id contains 'users21' part       
 });

/**PUT request example. 
* You can deal with as many parameters as you need, just write the regexp for it and assign a parameter. 
* Here is an example to update a document on a collection on MongoDB database. 
* We have 3 user parameters - 6 parameters in URL:
**/
this.put(/^databases\/([A-Za-z0-9_]+)\/collections+\/([A-Za-z0-9_]+)\/documents+\/([A-Za-z0-9_]+)$/).bind(function (req, res, dbid, collid, docid, data) {
	        res.send('update '+docid+ 'in '+collid + 'on: '+ dbid);
 });
}); //end mapping

3. And the last thing we should do is to turn on the HTTPS server and the router

https.createServer(options,function (request, response) {
    var body = "";

    request.addListener('data', function (chunk) { body += chunk });
    request.addListener('end', function () {

        mrouter.handle(request, body, function (result) {

            response.writeHead(result.status, result.headers);
            response.end(result.body);
        });
    });
}).listen(8081);

4. Run and connect your JSON client on httpS://127.0.0.1:8081 to test it.

node router.js

One file to rule them all

Here you can see the whole WORKING simple app including nice tricks like adding settings and whole bunch of regexp examples for handling the URL parameters.

Enjoy!

Offline AddonSDK (#jetpack) activities

One of the coolest way to bring the knowledge to the masses is to …write an article for a magazine. I know it’s kinda old fashion, but there are a lot of people that are reading actually magazines.

I will write 2 articles in next several days about JetPack and AddOns in general for JSMag and .Net Magazine (Bulgarian edition) and I hope I will get more people trying to write an AddOn or just diving into this new technology.

jsmag netmag.bg

I will be stick on:

0. What is an Addon and why we should create more of them.
1. JetPack Architecture and structure.
2. JetPack API (panel, widget and more).
3. How to write an external reusable library.
4. How to remix the code and add your JS to an AddOn;
5. How to use SDK to develop, pack and test your AddOn.

Any recommendations?