Custom Search

Sunday, February 28, 2010

PHP - OpenID library integration

An excellent introduction to the openID library as a consumer from the PHP here.

Tuesday, February 16, 2010

Erlang based WebSocket client in place

An erlang based WebSocket client in place here , for clients that deal with web socket protocol as yet. 

Storing Data in a Hash - Erlang

Came across this nice example in the Erlang mailing list for storing data in an hashmap.

-module(db_server).

-export([start/0, init/1, write/2, read/1, delete/1]).

start() ->
register(server, spawn(db_server, init, [dict:new()])).

init(Records) ->
receive
{add, Pid, Key, Value} ->
RecordsNew = dict:store(Key, Value, Records),
Pid ! {ok, Key, Value},
init(RecordsNew);
{show, Pid, Key} ->
case dict:find(Key, Records) of
{ok, Value} -> Pid ! {ok, Value};
error ->  Pid ! {error, no_such_value}
end,
init(Records);
{delete, Pid, Key} ->
RecordsNew = dict:erase(Key, Records),
Pid ! {ok, ok},
init(RecordsNew)           
end.

write(Key, Value) ->
server ! {add, self(), Key, Value},
receive Res ->
Res
end.

read(Key) ->
server ! {show, self(), Key},
receive Res ->
Res
end.

delete(Key) ->
server ! {delete, self(), Key},
receive Res ->
Res
end.



Friday, February 5, 2010

Deleting tags from remote in git

Happened to go through a build process , and while flipping around with versions - it created some tags on the remote repository that I wanted to get rid of entirely.

For example - lets assume the tag name is artifactA-0.1.0 .

$ git tag -d artifactA-0.1.0 

This deletes the tag locally ( in your local clone )
To push the change to remote and to delete the tag remotely as well - we can give -

$ git push origin :artifactA-0.1.0
where , I assume origin is the name of the remote branch from which I cloned initially.

This should delete the tag remotely as well.


Thursday, February 4, 2010

GPG agent

When preparing some artifacts to be published to a maven repository - needed some help with gpg publishing.

More often that not - when the gpg key verification was happening - it was reporting about a missing file -    ~/.gnupg/S.gpg-agent .

'touch'ing would not help because that is not a file , but a socket for the agent to listen on.

$ gpg-agent --use-standard-socket --daemon 2>/dev/null
This makes the agent listen on the socket.


Friday, January 29, 2010

Google Collections SVN repository

Google Collections 1.0 was released recently towards the end of December 2009. While very useful from an API and performance perspective, the API had quite an amount of surprises / deprecations / removals in its later stages ( 0.7 / 0.8 etc.) .

With 1.0 the API seems to have been stabilized and as an added benefit for those integrating with mvn - it is also available here as the mvn repository - http://google-maven-repository.googlecode.com/svn/repository/com/google/collections/google-collections/1.0/ .

com.google.collections / google-collections / 1.0 should do the trick in ivy.xml / pom.xml as appropriate.


Thursday, January 28, 2010

libevent 2.0 released

As per this update on the google developer blog , libevent 2.0 seems to be released.

For those of you new to the library - libevent provides a platform agnostic event handling library so that the user does deal with the quirks of the operating systems like Linux and Solaris and chooses the best event handling adapter present in the kernel ( Eg: In Linux, from 2.6 - epoll performs much better than poll / select . The former in O(1) in handling of connections whereas the latter group is O(n) in event handling proportional to the number of active connections at that time instant ).

More details are available in the book available here.

Specifically about the update - it seems like the developers on Windows would benefit a lot from the API changes made. I will probably write a more detailed review of the same after playing around with the software / API on various platforms and distributions.