Simple Identi.ca to Jaiku Bridge

Enlaces y noticias No Comments »

Well since I barely use my jaiku account, even when it has xmpp support. Probably is that I’m not really interested on the conversations there and no one uses jaiku channels. It would be a lot better if it used something like “track” the one you find in identispy for identi.ca, twitterspy for twitter and Jance for Pownce.

Anyway I decided that I wouldn’t bother setting yet another account on some random service to update identi.ca,twitter and jaiku at the same time so I decided to write something myself.

After very little effort I came out with this, it’s pretty basic and with ZERO error checking but it does what I want.

I used feedparser and simplejson python modules.

  1. #!/usr/bin/env python
  2.  
  3. import simplejson
  4. import urllib
  5. import feedparser
  6. import time
  7. import re
  8.  
  9. identica_rss="http://identi.ca/IDENTICA_USER/rss"
  10. user = ‘JAIKU_USER’
  11. api_key =‘JAIKU_KEY’
  12.  
  13. class JaikuInterface:
  14.     method = ‘POST’
  15.     api_url = ‘http://api.jaiku.com/json’
  16.     def __init__(self,user,key):
  17.         self.user=user
  18.         self.api_key=key
  19.     def post(self,message):
  20.         body_dict = (
  21.             (‘user’,self.user),
  22.             (‘personal_key’,self.api_key),
  23.             (‘method’,‘presence.send’),
  24.             (‘message’,message)
  25.             )
  26.         body = urllib.urlencode(body_dict)
  27.         try:
  28.             f=urllib.urlopen(self.api_url,body)
  29.             ret = simplejson.loads(f.read())
  30.             f.close()
  31.             if ret[’status’]==u‘ok’:
  32.                 return True
  33.             else:
  34.                 return False
  35.         except:
  36.             return False
  37.  
  38.  
  39.  
  40. jaiku = JaikuInterface(user,key)
  41. last_date = time.mktime(time.gmtime())
  42. oldest = last_date
  43. time_fmt= "%Y-%m-%dT%H:%M:%S+00:00"
  44. striper = re.compile("^deepspawn: ")
  45. stripuser = lambda(x): striper.sub("",x)
  46. while True:
  47.     try:
  48.         identifeed=feedparser.parse(identica_rss)
  49.         for entry in identifeed.entries:
  50.             entry_date = time.strptime(entry.updated,time_fmt)
  51.             entry_date = time.mktime(entry_date)
  52.             if entry_date > last_date:
  53.                 oldest = max(entry_date,oldest)
  54.                 post = stripuser(entry.title)
  55.                 jaiku.post(post)
  56.         last_date=oldest
  57.     except:
  58.         pass
  59.     time.sleep(5*60)
  60.  

Well just replace IDENTICA_USER, JAIKU_USER and JAIKU_KEY with your values and that’s all.

It will poll every 5 minutes the rss and update jaiku with the new dents.

Well that’s all, it’s a small hack I hope someone find this interesting.

Concurso mejores trabajos de grado

Enlaces y noticias 1 Comment »

Hoy mi compañero Diego recibio este divertido correo desde la Dirección Nacional de Programas de Pregrado

Diego: Cuando la Universidad Nacional decidio abrir el abanico de modalidades para el Trabajo de Grado y quitar las menciones de Meritoria y laureada, no penso en lo que se venia luego: como incentivar y premiar a todas las variaciones de Trabajo de Grado. Como no es lo mismo hacer una pasantia y presentar un reporte a estar todo el semestre frente a un microscopio observando algo superespecial para el desarrollo de la humanidad, pues no se esta actuando con equidad pues el reporte de la pasantia no encaja en el formalismo del concurso mejores trabajos de Grado, asi le hayan puesto de nota 5 y haya tenido un desempeño sobresaliente… La UN debe pensar como premia a los excelentes en cada modalidad pero aun no lo ha hecho. El concurso premio hasta los trabajos de 2007. Falta 2008 pero ahora el enfasis esta en la reforma academica para implementar el acuerdo 033 en el primer semestre de 2009. Asi que solo hasta el 2009 se pensara en como hacer la seleccion y en ese tiempo se premiarian 2008 y 2009 y se haria difusion a lo que se concrete. Por ahora no. Feliz tarde,

Yo empezaré la discución sobre este tema, pero mi opinión personal extendida la dejo como un comentario.

Speeqe on Valkertown

Enlaces y noticias No Comments »
Speeqe is a tremendous idea to bring multi user chat(MUC) into the simplest possible web service you can think, if you want to invite your friends they all just have to follow an url you send and start chatting, things can be more complicated but it’s not required to start participating. Well now I have installed speeqe on my own server quite successfully, it wasn’t an easy task, yet it wasn’t that difficult.

If you want to try it check it here: Valkertown’s rooms you will need a Valkertown’s jabber account to test it, but I will solve this problem asap.

Here’s a list of some of the stuff I had to work around:

  • There’s still a lot of hardcoded strings in the js,css,templates with the speeqe url
  • The templates, js,css doesn’t prepend the djangos settings for MEDIA_ROOT, I wish I solved this nicely but all I did is set them
    manually.
  • Everything on my test server is server using an https connection that includes the http-bind. I figured how to solve this and it was not a big deal.
  • I had to do some minor modifications to the django/python client so it connects using https and to the ejabberd’s bosh module.

Here’s some of the stuff I disabled.

  • The demo stuff
  • The register stuff(I simply didn’t understand it) I tought it created a new xmpp account but it looks like it doesn’t, just an speeqe account, correct me if I’m wrong.
  • Virtual host, I’m not planning to do subdomain rooms.
  • Message search, I don’t like much this feature, I would like more a room search.
  • The static urls serve in the urls, I would activate it using some kind of flag, it’s just not good to see it there, I think it may lead to problems.

Here’s some of the stuff I modified:

  • I replaced virtual host to normal chat rooms urls, I would like and plan to setup shorter urls for local rooms without using dns
  • Templates to match my own domain where it made sense.

At last:

  • I’m missing the autologin feature, I’m guessing on how to deal with this but I want to keep the modifications I do to the code at a minimum.

DS1M12 usb osciloscope in linux and python

Enlaces y noticias No Comments »
Well, today in the afternoon I was given a task, make the Usb Instruments DS1M12 usb osciloscope in linux, it was quite a surprise
to find out it had some kind of support for Linux and I started my work with their sources.

I found it requires two downloads one from USB Instruments itself and another from a thirdparty driver

Well, those two comes with some .so files you need to link your programs so you need to make sure
they have proper names like libDS1M12.so, libftd2xx.so and they can be found in the LD_LIBRARY_PATH or something like that, this is important.

After you get this solved it’s pretty straightforward with the USB Instruments package comes a good example you can use to understand their library, this took a bit of time since we(called some one to help me pinpoint some problems) could get it working and seeing the data flow quite fast, yet, it took us some time to discover that the sample code enabled the testmode and instead of real sampling, after that we could see the two channels sampling also the signal generator send out the example signals.

After this we agreed that it would be good to have a python interface to this osciloscope and I started working with swig to generare a proper wrapper around the USB Instruments library, around an hour ago I finished what we could call the first release of the interface and I’m being able to plot some data using matlplot lib. It took me a bit to figure how to manage to wrap some of the functions yet in the end swig and numpy solved all my issues.

I’m not really sure If I can release everything at the moment, I think I’ll have to ask USB Instruments since I use one of their headers to build the swig wrapper and it requires some minor modifications to make it work nicely so I would have to publish the modified header. If i get permission or any idea how I should publish the repository, it will be here at valkertown Mercurial Repositories

For now you have to beleive me that now the use of this osciloscope it’s reduced to something like this

  1.  
  2. """
  3.   Author: Carlos Andres Perilla
  4.   Centro Internacional de Física, Bogotá-Colombia.
  5.  
  6.   This program is free software: you can redistribute it and/or
  7.   modify it under the terms of the GNU Affero General Public License
  8.   as published by the Free Software Foundation, either version 3 of
  9.   the License, or (at your option) any later version.
  10.  
  11.   This program is distributed in the hope that it will be useful, but
  12.   WITHOUT ANY WARRANTY; without even the implied warranty of
  13.   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  14.   Affero General Public License for more details.
  15.  
  16.   You should have received a copy of the GNU Affero General Public
  17.   License along with this program.  If not, see
  18.   <http://www.gnu.org/licenses/>.
  19.  
  20. """
  21.  
  22. from Osciloscope import UsbOsciloscope
  23. from pylab import *
  24. import time
  25.  
  26. o = UsbOsciloscope()
  27. # Load the firmare into the osciloscope FPGA, this the RFB that comes in the USBI pack.
  28. o.program()
  29. # Enables both channels for sampling
  30. o.set_channels()
  31.  
  32. while True:
  33.     # Start signal, it gets some other params like
  34.     # triggering configuration, port conf and a lot of other things
  35.     o.start_scan()
  36.     status = -1
  37.     while status != 0:
  38.         # Do the actual reading of a single frame
  39.         retval = o.get_data()
  40.         status = retval[0]
  41.         if status != 0:
  42.             # Since the buffers can be large and the according
  43.             # to the sampling rate we may need to wait a bit
  44.             time.sleep(0.01)
  45.         else:
  46.             # If we got the data successfully we can now plot what we got using
  47.             # matplot lib.
  48.             values = retval[5].dwNumValuesReturned
  49.             x_axis = arange(0,values,1)
  50.             plot(x_axis ,retval[2][0:values],‘r–’,x_axis,retval[3][0:values],‘bs’)
  51.             show()
  52.  

Testing an identi.ca badge, some new badges

Enlaces y noticias No Comments »
Well, here is it, I will keep an eye on it before I add it some where in the page, anyway I’m far more
active on identi.ca than on pownce or jaiku, also I support more the ideas that identi.ca represents.

Also I changed the badges at the right of the blog for some flash based ones, one for Pownce
one for Jaiku, they good look good.

We’ll see with time how it evolves.

Art is Cheap!

Enlaces y noticias No Comments »

I have just fell in love with this image I found at ImgFave, which is a laconi.ca based place. Check Identi.ca to see the original place.

Cheap Art Manifesto

From the signature it looks it was written the year I was born, it just make me feel more in love with the message.

Feel free to copy and share it with everyone you know since this is the way it was passed to me and after a quick google it looks like it’s the overall intention of this message.

Enjoy! Seriously !

Jance source release

Enlaces y noticias No Comments »

First take a look of the fancy xhtml formatted answers that Gajim + Jance can produce:

Gajim + Jance

It’s time to announce the public Releace of Jance repository, it’s released under the GPL V3.0
and you can give a look to it here:

Valkertown Public Mercurial Repositories

If you want to checkout the source of Jance bot:

hg clone http://hg.valkertown.org/jance.hg/

The whole process of coding this bot have been very interesting and been part of my current research on using xmpp as the foundation of some of the instrumentation systems I design and implement, it’s looking good. I have been measuring the traffic it generates client-server, bot-server and with proper configuration an xmpp bot can be useful in a high-latency low-quality network that are the rule on several of the systems I design.

Send patches and bug reports to pownceATvalkertown.org, those are always welcome.

Enjoy!

Jance a Jabber bot for Pownce

Enlaces y noticias 2 Comments »
Well I have just spent a couple of day writings a jabber bot that uses the Pownce api to interact with the site. It has been a fun experience, I will publish the mercurial repository of the repo as soon as I
solve this questions.

  • Should I publish the Pownce App key and secret along with the code?
  • If I do so, are rethere any security implications of doing that?
  • I haven’t checked, but Pownce Apps Terms could have something to say

In the mean while you can play with the one running at valkertown. Just add pownce@valkertown.org to any Jabber roster and type help.

The ongoing documentation is on my home page.

I wrote the bot using Python, Twisted for the Jabber stuff, Oauth to talk with Pownce, YAML to store user data and JSON(simplejson) to extract data from Pownce answers.

Hapy Powncing

Valkertown’s Jabber Server

Enlaces y noticias No Comments »

Well, from now on I’m going to open valkertown’s jabber server for public registration, will try to do my
best with this service but if it causes too much troubles I will close it again. It’s located at valkertown.org and you should use a jabber client to register the new account there

With time if it’s worth it I would set an public statistics page.

It features:

  • Ejabberd server
  • MSN transport
  • MUC Rooms
  • IRC transport (only to servers that runs on the standard irc port)

There’s a couple of conference rooms that are always there:

  • general@conference.valkertown.org
  • gclap@conference.valkertown.org.

While I have been runnign this server for some time now, I’m kinda new with open jabber servers so I would be happy to hear any tips or help to prevent abuse.

The server supports also http-bind (BOSH) method via https://www.valkertown.org/http-bind/

I’m trying to setup a good browser based http-bind client and host it here at valkertown but I think jwchat is horrible and haven’t been able to make webspark work with valkertown’s ejabberd. So if you know any good client that I could host here let me know.

I’m folllowing with great interest the people from chesspark and speeqe since they seem to have a great browser bosh client. So far they only have published the tools they created for the clients but those looks really promising.

EOP

Como prolongar la vida de las baterias de Ion-litio

Enlaces y noticias No Comments »

How to prolong lithium-based batteries

Básicamente estas baterias no pierden su capacidad de carga por los
ciclos de descarga sino por la temperatura y el tiempo desde que las
fabrican.

En el documento hay una tabla muy interesante que muestra como pierde
capacidad la bateria en relación con la temperatura y el tiempo,
considerando la tabla y las temperaturas que reporta el sistema es
posible que uno termine con una bateria del 60% de la capacidad cada 3
meses de tenerla
en el portatil esto refuerza la recomendacion de los fabricantes de
retirar la bateria del computador si se va a estar pegado a la red
electrica todo el tiempo para
evitar que el computador caliente la bateria, por otra parte el hecho
de tener la bateria constantemente cargada empeora el asunto del
deterioro.

Se supone que si va a guardar la bateria es mejor hacerla con un 40%
de la carga y es conveniente enfriar la bateria a 0ºC.

Otra de las recomendaciones que me parece interesante es la de
realizar una descarga completa cada 30 ciclos de descarga para que el
sistema de monitoreo de
la bateria pueda recalibrarse.

Del otro portatil que tengo puedo decir que despues de casi un año y
medio de utilizarlo casi todo el tiempo en bajo consumo donde el
sistema se mantiene en unos 40ºC la bateria
se encuentra en el 40% de capacidad de carga nominal.

La última recomendacion que veo importante es fijarse en la fecha de
fabricación de la bateria de reemplazo y no comprar el repuesto antes
de necesitarlo realmente.

Estuvo interesante la investigación.