Skip to main content

Posts

Showing posts from October, 2011

Going to FUDCon Pune

Just got my visa. See you all there!

Dennis Ritchie (1941-2011)

A titan of which all tech giants and all of us stands on

Opps ..

Opps , to Fedora Planet, sorry that some old posts appeared in frontpage .. I changed my feed to aggregate the PlanetFedora tag instead of Fedora, and tagged a number of old contents ..

but seems like PlanetPlanet sorted items by updated date rather than published date ..

A simple demo application using collective.trajectory

Last week I wrote about a Plone library called collective.trajectory which allows you to do url routing on Plone content type. Back then it was only able to route the context, but I have yet to try develop something on it yet.

A few days ago on geekcamp.my, I gave a talk on it, so naturally, I'll need to test to develop something on it first before doing the talk. Using trajectory, I hacked together a simple app, which fetch a profile page from Facebook, to demonstrate the library capabilities. Here's the howto.

Goals

Create a content type which can be added on any part of site, where if user load a subpath of the content, it will load a profile info from graph.facebook.com, and serve it as a context in Plone.

Creating an archetype project

First you'll need ZopeSkel in your buildout. Add this section into buildout.cfg:

[paster] recipe = zc.recipe.egg eggs = ZopeSkel PasteScript
Execute ./bin/buildout install paster afterwards. Once thats done, you should have paster c…

Email server with Postfix, Dovecot, and LDAP

I think I'll skip the introduction as this is mainly a note for myself

The LDAP Setup

I'm not going to cover how to setup LDAP. The setup that I'm using for this system is organized where all users are under an Organizational Unit called 'people' (ou=people,dc=organization,dc=org) with this schema:

dn: uid=user,ou=people,dc=organization,dc=org objectClass: posixAccount objectClass: inetOrgPerson uid: user homeDirectory: /home/user userPassword: <passwordhash>

Configuring Dovecot

Add these into dovecot.conf

mail_uid = 5000 mail_gid = 5000 auth default { mechanisms = plain passdb ldap { args = /etc/dovecot-ldap.pass } userdb ldap { args = /etc/dovecot-ldap.user } # for postfix to authenticate against socket listen { client { # Assuming the default Postfix $queue_directory setting path = /var/spool/postfix/private/auth mode = 0660 # Assuming the default Postfix user and group …

Radiate: A simple push server for SocketIO (alpha)

Based on my previous post on WebSocket server using Tornado, I've hacked the code more to be a SocketIO server instead of just WebSocket, so that it can be used on many browsers until everyone support WebSocket. The SocketIO connection is handled by TornadIO, a neat SocketIO library for Tornado.

I've uploaded the code here in github: https://github.com/kagesenshi/radiate

I've packaged Radiate together with a buildout.cfg, so you can deploy it easily by just using these few lines of commands
git clone https://kagesenshi@github.com/kagesenshi/radiate.git radiate cd radiate python bootstrap.py ./bin/buildoutTo start the daemon, just execute:
./bin/radiate-admin fgThe readme file on how to deploy and use Radiate is here: https://github.com/kagesenshi/radiate/blob/master/README.txt.

Simple websocket push service using Tornado

WebSocket server side documentation/guides around tend to be very node.js oriented. However, I don't fancy rewriting stuff I already have simply to be able to make use of WebSocket. After some research, I figured out a mechanism for a service which will handle push for WebSocket, in a simpler manner which are familiar to everyone - simple POST/GET!

Example server code: (on Tornado 11.0)

import tornado.ioloop import tornado.web from tornado import websocket GLOBALS={ 'sockets': [] } class MainHandler(tornado.web.RequestHandler): def get(self): self.write("Hello, world") class ClientSocket(websocket.WebSocketHandler): def open(self): GLOBALS['sockets'].append(self) print "WebSocket opened" def on_close(self): print "WebSocket closed" GLOBALS['sockets'].remove(self) class Announcer(tornado.web.RequestHandler): def get(self, *args, **kwargs): data = self.get_arg…