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.