Velocity Conference @Berlin.

Velocity Conference is an that is in my check list since …forever.
This year the event comes to Europe and unfortunately I will not be able to attend, because I have another event scheduled at the almost same time.

If you’re web person this event is a must attend event :)

Velocity Europe is the convergence of performance and site reliability experts and rock stars who share the unique experience that can only be gained by operating at scale. Velocity gives you two days of critical training, best practices, and case studies from the web ops and performance ecosystem, about how you can make your site scalable, reliable, and fast.

Discount
I’ve got 19.99% discount code and can share it with you if you write me to shopov.bogomil@gmail.com

WordCamp Prague 2012

I am planning to organize a conference focused, but not limited to blogging, hacking and freedom of speech and WordPress in Praha /Prague in February or March 2012.

If you are interested in helping, speaking nor sponsoring the event, please drop me a line via my contact page. The conference will be on English and Czech.


Mám v úmyslu uspořádat konferenci zaměřené mimo jiné na blogování, hacking a svobodu projevu a WordPress v Praze v únoru nebo březnu 2012.

Pokud máte zájem pomoci, mluvit ani sponzorování akce, prosím, napište mi linku přes kontaktní stránku . Konference bude v anglickém a českém jazyce.

What is a WordCamp?
/click on the image to see it big/
What is a Wordcamp

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!

Capture API

I am looking forward Capture API to become part of Firefox soon. It’s really cool if I have the opportunity to capture my camera and my microphone.

function success(data) {
  var container = document.createElement("div");
  document.body.appendChild(container);
  
  for (var i in data) {
    var img = document.createElement("img");
    img.src = data[i].uri;
    container.appendChild(img);
  }
}
 
function error(err) {
  alert(err.message + " (" + err.code + ")"); 
}
 
navigator.device.captureImage(success, error, { maxNumberOfMediaFiles: 1 });

This is already implemented here and it’s really useful if you want to work on mobile devices:

// capture callback
var captureSuccess = function(mediaFiles) {
    var i, path, len;
    for (i = 0, len = mediaFiles.length; i < len; i += 1) {
        path = mediaFiles[i].fullPath;
        // do something interesting with the file
    }
};

// capture error callback
var captureError = function(error) {
    navigator.notification.alert('Error code: ' + error.code, null, 'Capture Error');
};

// start audio capture
navigator.device.capture.captureAudio(captureSuccess, captureError, {limit:2});

Subscribe to my RSS and win a free postcard (via snailmail)

Hello,
If you don’t know me, my name is Bogomil – Bogo for short. I am from Europe (Bulgaria).

I am an openweb hacker and a community enchanter (because I help people to create magic with their skills).

I am writing here about OpenWeb, FOSS Community management, hacking, Javascript, PHP and different interesting stuff and if you subscribe to my RSS feed (click here to do that) and if you send me your address (click here to send it to me via secure form) I promise I will send you a nice postcard using snail mail or I can buy you a beer if we meet somewhere.

Visit my blog

If you are coming from a planet or a link, please visit my blog to see what I am writing about.

Thanks,
Bogo

Create a class-based library in #JetPack (addon SDK)

I just commit to GitHub a class based library called JPersona..

You can get the background color and text color of the active persona your Firefox is wearing and to do whatever you want.

This example shows :
0. How to import LightweightThemeManager – the one responsible for handling Personas.
1. How to write class-based library for JetPack
2. How to import this library in your main.js and how to use it.

Go now to github and give me a feedback

JetPack: How to add a button to a webpage + events

This is a Jetpack example for beginners that shows:

0. How to add a simple DOM element – button to a webpage using Mozilla Addon SDK (Jetpack)
1. How to attach an event
2. And how to handle it.

If you want to try it – go here click on Test icon and when it loads, visit: http://talkweb.eu/labs/jetpack/button.html or use your own SDK


var buttonScript = [
'var butt = document.createElement("button");', //define button element
'var btext = document.createTextNode("Click me");', //define the text
'butt.appendChild(btext);', //attach text to the button
'butt.addEventListener("click", function(){document.bgColor="red"} , false)', //handle onclick event
'document.getElementById("test").appendChild(butt);' //put the button on the page
];
 

var pageButton = require("page-mod").PageMod({
include: 'http://talkweb.eu/labs/jetpack/button.html', // this script will works only on this website
contentScriptWhen: 'ready',
contentScript: buttonScript
});

Are you interested in learning something new and cool?

Well, why don’t you join me at P2PU in a Mozilla JetPack course. The main idea of P2PU is to give the opportunity to anyone to teach anyone to a certain topic.

It doesn’t matter if you are beginner or if you are Mozilla JetPack guru – P2PU course perfect place for you to learn or to share knowledge.

If you are part of Facebook, please join the JetHack group also.

Jetpack.ruble 0.2

My jetpack.ruble project has a new version. Hooray. The idea is to provide a rapid development tools for opensource IDE called Aptana, as a part of a bigger project to provide such tools for all Open Source tools we’re using.

Of course it’s still experimental, but as soon as I found some time I will create some nice features like snippets and preferences.

Here is the URL in GitHub – if you are interested, please watch it.

Help
Also I still need help. If you are JS hacker, please answer me this questions 3: http://talkweb.eu/openweb/768

Announcing the Kolab Server 2.3.0

“For the plane in the fog, the mountain is unforeseeable, but then it is suddenly very real, and inevitable.”

Simon Forster, Minister for foreign relations

WHAT IS KOLAB?

Kolab is a personal information management solution, also referred to as groupware. It can provide and manage your information including email, address books, calendars and tasks.

The Kolab server acts as the central information repository and thanks to its uniquely powerful design can host up to tens of thousands, theoretically even hundreds of thousands of users.

All these users can freely share email, address books, calendars and/or tasks with all, some, or none of the other users. This allows Kolab to provide the support base for a wide variety of activities, such as coordinating appointments, working on common projects and ensuring consistency in customer contact.

FEATURES

The new Kolab 2.3.0 server includes a lot of new features, namely:

  1. Z-push synchronization for mobile devices
  2. A reworked webadmin
  3. The possibility to have multiple accounts with the same name.
  4. Modular packaging of the webclient
  5. Many updated core components
  6. Tons of bug fixes

A detailed list of changes is available here

UPGRADING

Because of the changes in LDAP, upgrading from 2.2.4 is not trivial and requires manual intervention. Please make sure you read and follow the upgrade instructions in http://files.kolab.org/server/release/kolab-server-2.3.0/sources/1st.README

Documentation and OpenPKG packages are available from here as shown on http://kolab.org/download.html.

DOWNLOADS

Binary packages for Debian GNU/Linux 6.0 (Squeeze/stable) and 5.0 (Lenny/oldstable) on x86 platforms can be found next to the sources.

Support for Debian GNU/Linux 4.0 (etch/oldstable) was dropped because it is no longer supported by Debian ether.

As soon as they have synced, you can also use the the mirrors listed on http://kolab.org/mirrors.html

You can check the integrity of the downloaded files by importing our file distribution key and verify the OpenPGP signature and SHA1 checksums:

$ wget https://ssl.intevation.de/Intevation-Distribution-Key.asc
$ gpg –import Intevation-Distribution-Key.asc
$ gpg –verify SHA1SUMS.sig
$ sha1sum -c SHA1SUMS

NOTICE

This release marks the end of a long development cycle. After over 2 years, the master and the stable branch are (more or less) in sync again. We
introduced many new features and fixed a large number of bugs. We tested the release intensively but due to the massive code changes, we might have missed something or even introduced new bugs.

Before you use this release in a critical environment, we’d like you to test it. Please report any problems you encounter in our bug tracker: https://bugzilla.kolabsys.com/

Depending on the number and severity of bugs, we will issue an updated release soon. We already have a number of fixes in the queue such as the today’s Z-push 1.5.2 release, so Kolab 2.3.1 will come soon.

CREDITS:

I’d like to thank a few people for their help, namely and in no particular order:

Paul and Georg, for giving me the chance to work on a great project like Kolab
– Bernhard for his coordination
– Thomas and Sascha for their support, especially during this week
Bogo for the awesome new look of the webadmin
Jeroen for his input and providing me the infrastructure I need
Gunnar for responding so fast to the issues we spotted

Without these people the Kolab Server 2.3 would not be possible. Thank everybody for your hard work!

Regards,
Christoph

OKFN community and me.

I will help OKFN in building their community around CKAN ant other important topics for me and them. They really like what I did for SUMO project, when applied for a job last year and we will use this document as a checklist together with other ideas we have. (I am full with ideas, yeah)

It’s really awesome because most of the CKAN community members are programmers like me and I think we have a lot of common interests.

This project will be probono and will take 1-2 h of my free time per day, but it will be great if I can help the OKFN to spread the Open Data ideas and technologies around the World.

OpenCamp Sofia 2011

In June a 2 day event will take place in will take place in Sofia, Bulgaria, under the title ‘OpenCamp Sofia‘, addressing open government, PSI re-use, Open Web, Free Software and Open Source, Open Knowledge and other important topics.

On the first day a workshop/camp will be held. Both presentations (a growing list of presenters is on the site) and discussions are planned on topics such as Open Web, Open Government, Open Knowledge, and Open source software. In that context PSI re-use is sure to be part of the discussion as well.

On the second day a Mozilla-related event will be held. At the same time in Sofia will be next Balkan’s Meeting of Mozilla Communities.

website: http://opencamp.talkweb.eu

hashtag: #opensofia