Schurger.org

26 juillet 2010

Little refreshment for vertical gnome panel

Classé dans : Non classé — Jean Schurger @ 17:12

I like to use a vertical panel, because i more need to save place vertically than horizontally. Therefore, the notification area in the gnome panel have an inadequate behavior, it stacks very big icons vertically, following the gnome-panel width. In fact, it does the same thing for the applications launchers, but this can be fixed using the quick lounge applet. Alexander Kojevnikov’s blog have some patches, about using a gnome panel vertically, some are already integrated, but the one for the notification area needs some refreshment to be applied to the *current* gnome-panel (2.30.2).

Here is an update version of the patch: na-2.30.2.diff

9 juin 2010

Android 1.6 on GW620 (LG Eve)

Classé dans : Non classé — Jean Schurger @ 19:45

(with a title like this, i will have a lot of hits :p)

Well, i’ve just installed an custom Android 1.6 image on my LG GW620, thanks for Zacpod for his workl !!

But, this version dosn’t have the APN configuration tool to enter the parameter to let connect in 3G.

As this version seems to be based on a Korean image for the same phone, the only 3G provider filled in it is not very usefull,

and without the APN configuration tool, it’s not easy to edit the provider list.

Here is a method to make 3G works on the Roger network.

  • Install the Zacpod image
  • Freak about no APN configuration
  • Download the hacked Zacpod ADB (read it’s blog, it will be very usefull)
  • Run adb shell
  • Become superuser with su (and allow it on the phone screen)
  • Take a big breath
  • run sqlite3 /data/data/com.android.providers.telephony/databases/telephony.db
  • INSERT INTO carriers (name, numeric, mcc, mnc, apn, user, server, password, proxy, port, mmsproxy, mmsport, mmsc, type) VALUES (‘Roger’, ‘302720′, ‘302′, ‘720′, ‘internet.com’, ‘wapuser1′, ‘*’, ‘wap’,  »,  »,  »,  », ‘null’, ‘default’);

Reboot your phone, and it’s done :D

21 mai 2010

Google and Pacmac’s 30th birthday

Classé dans : Non classé — Jean Schurger @ 17:05

Tomorow will be Pacman’s 30th birthday !

It seems that Google is preparing something… and it just leaked onto my browser:

(and yes, it’s playable and doesn’t require flash)

Google Pacman

6 mai 2010

Bye bye Facebook.

Classé dans : Non classé — Jean Schurger @ 0:42

J’ai finalement conclus que je n’ai plus aucune raison de garder un compte sur facebook, j’avais pourtant réussi à prendre l’habitude de faire abstraction du 95% de contenu composé de niaiseries sans intérêt, et fini par croire que les 5% restants pouvaient être utiles, mais finalement non:

- Je préfère garder un carnet d’adresses privé
- Les gens qui prétendent participer à des évènement n’y vont pas
- Je côtoie à peine 20% de mes « amis facebook » dans la vrai vie, et n’ai cure des autres (et c’est probablement réciproque)
- Facebook use et abuse à son gré de toutes sortes d’informations personnelles et traces qu’on peut y laisser.
- Facebook est un logiciel propriétaire.

J’invite tous les gens qui trouvent agréable où utile de raconter leur vie et de suivre celle des autres sur internet à joindre le réseau social identi.ca (et éventuellement quitter facebook).

Je suis toujours joignable par mail ou XMPP: jean@schurger.org
où par téléphone: (1) 514 994 1045.

English version: ask me.

28 avril 2010

Les VOD de la salle Pleyel en RSS

Classé dans : Code, Concerts, Python — Jean Schurger @ 21:52

La salle Pleyel diffuse ses concerts en vidéo à la demande, et un tel contenu mérite vraiment le détour. Cependant, les concerts ne sont disponibles que pendant une certaine période, et le seul moyen de se tenir informé des nouveautés à voir et écouter est d'aller régulièrement consulter la liste des concerts. C'est plutôt rébarbatif, un flux RSS aurait été très pratique.

Le petit bout de script suivant permet de parser la page des concerts, et produit des données au format RSS sur sa sortie standard.

Il suffit simplement de l'invoquer à partir d'un agrégateur pour pouvoir savoir quand un nouveau concert apparaît.

#!/usr/bin/python
# -*- coding: utf-8 -*-

import urllib2
from lxml import etree
from datetime import datetime
from PyRSS2Gen import RSSItem, RSS2
from md5 import md5

URL="http://www.sallepleyel.fr/francais/concerts/videos.aspx"
opener = urllib2.build_opener()
req =  urllib2.Request(URL)
html = etree.HTML(opener.open(req).read())
vodlist = filter(lambda ul: ul.attrib.get('class') == "vod",
                 html.findall(".//ul"))[0]
items = list()
for e in vodlist.findall(".//li"):
    a = e.findall(".//a")[1]
    title = a.find(".//strong").text
    link = a.attrib.get('onclick').split("'")[1]
    items.append(RSSItem(title = title,
                         link = link,
                         description=title,
                         guid=md5(link).hexdigest(),
                         pubDate=datetime.now()))
rss = RSS2(title = "Salle Pleyel en VOD",
           link = "http://www.sallepleyel.fr/francais/concerts/videos.aspx",
           description = "Concerts en vidéo à la demande (VOD)",
           lastBuildDate = datetime.now(),
           items = items)
print rss.to_xml()

Bonne écoute.

23 mars 2010

Bye bye MSN !

Classé dans : Code, MSN, Python — Jean Schurger @ 19:03

Ça y est, je me débarasse de MSN. Mais comme je suis conscient que certaines personnes ne connaissent que ça, voici un petit compromis, qui plus est: éducatif.
Il sagit d'un répondeur automatique à MSN écrit en python, utilisant papyon.

(This is an auto responder for MSN, written in the python language, and using the papyon library)

#!/usr/bin/env python
# -*- coding: utf-8 -*-

import signal
import papyon
import papyon.event
import gobject
import logging

logging.basicConfig(level=logging.ERROR)

USER = "user@hotmail.com"
PASSWORD = "p4ssW0rD"
LAYUS = u"""

English bellow.

Bonjour,

  Ceci est une réponse automatique vous expliquant que je ne veux
  plus discuter par MSN.

  En résumé, MSN est fermé, et fonctionne mal.
  Il y a beaucoup d'alternatives libres et efficaces.

  Pour la version longue, lire:
  - http://schurger.org/la-vie-est-possible-sans-msn.html

  Je serai ravi de discuter:
  - En le protocol XMPP (Jabber, Google talk,...).
    (Mon identifiant est jean@schurger.org)
  - Sur IRC, via le serveur irc.freenode.net, mon nickname est jeansch
  - En utilisant la fonction clavardage de Facebook

  Amicalement,

  Jean.

---
 
Hello,

  This is an automatic answer telling why i don't want to chat using MSN.

  Basicaly, the reasons are that MSN is closed and works badly.
  There is a lot of realy great open alternatives.

  For more details, read:
  - http://schurger.org/life-is-possible-without-msn.html

  I'll be happy to chat using:
  - The XMPP protocol (Jabber, Google talk,...)
    (My id is jean@schurger.org)
  - On IRC, on server irc.freenode.net, my nickname is jeansch
  - Using the chat Facebook feature

  Friendly,

  Jean.
"""

class ClientEvents(papyon.event.BaseEventInterface):
   
    def on_client_state_changed(self, state):
        if state == papyon.event.ClientState.CLOSED:
            self._client.quit()
        elif state == papyon.event.ClientState.OPEN:
            self._client.profile.display_name = "Jean Schurger"
            self._client.profile.presence = papyon.Presence.ONLINE
            self._client.profile.personal_message = "Boycott de MSN"

    def on_invite_conversation(self, conversation):
        conversation.send_typing_notification()
        conversation.send_text_message(papyon.ConversationMessage(LAYUS))
        conversation.leave()
       
class Client(papyon.Client):
    def __init__(self, account, quit, http_mode=False):
        server = ('messenger.hotmail.com', 1863)
        self.quit = quit
        self.account = (USER, PASSWORD)
        papyon.Client.__init__(self, server)
        self._event_handler = ClientEvents(self)
        gobject.idle_add(self._connect)

    def _connect(self):
        self.login(*self.account)
        return False

def main():
    mainloop = gobject.MainLoop(is_running=True)
   
    def quit():
        mainloop.quit()
       
    def sigterm_cb():
        gobject.idle_add(quit)

    signal.signal(signal.SIGTERM, sigterm_cb)
    c = Client((USER, PASSWORD), quit)

    while mainloop.is_running():
        try:
            mainloop.run()
        except KeyboardInterrupt:
            quit()

if __name__ == '__main__':
    main()

10 mars 2010

Je vais à Confoo

Classé dans : Non classé — Jean Schurger @ 2:01

confoo.ca Web Techno Conference

Classé dans : Code, Gnome, Python — Jean Schurger @ 1:59

Tired of typing your #freenode password when ERC is connecting ? You don't want to write you passwords as clear text in your .emacs files ?

Lets see how to store, passwords in the Gnome Keyring, and access it from Emacs. It only needs Pymacs and gnome-keyring python bindings.

  • Write a little module to read and write passwords. This module will be loaded my pymacs and its functions will be available from emacs-lisp. You may name your module 'gnome-keyring.py' and store it somewhere like '~/.emacs.d/pymacs/'
def get_password(name):
    import gnomekeyring as gk
    try:
        items = gk.find_items_sync(gk.ITEM_GENERIC_SECRET,
                                   dict(variable_name=name))
    except gk.NoMatchError:
        return None
    return items[0].secret
get_password.interaction = ""

def set_password(name, password):
    import gnomekeyring as gk
    gk.item_create_sync(gk.get_default_keyring_sync(),
                        gk.ITEM_GENERIC_SECRET,
                        "Emacs password", dict(variable_name=name),
                        password, True),
set_password.interaction = ""

  • Load the module using pymacs
(require 'pymacs)
(add-to-list '
pymacs-load-path "~/.emacs.d/pymacs/")
(pymacs-load "gnome-keyring" "gnome-keyring-")

  • Trying from the interactive emacs lisp mode (M-x ielm)
ELISP> (gnome-keyring-set-password "my-password" "p4$$w0rD")
nil
ELISP> (gnome-keyring-get-password "my-password")
"p4$$w0rD"

  • And now, an example for ERC
(setq erc-password (gnome-keyring-get-password "my-password"))
(setq erc-prompt-for-password nil)

Too easy ! :D

9 décembre 2009

Unit tests with Pylons and its XMLRPCController

Classé dans : Python — Jean Schurger @ 1:37

Now that you have implemented a nice XMLRPCController in your pylons application, it's time to write unit tests covering it. The problem is that the xmlrpclib will try to make a real http connection to an address, but the TestApp used in your TestController is not a real server, and don't listen to any address.

Here is a quick way to enable the coverage of your XMLRPCController. Inspired by Kumar McMillan on this thread.

from StringIO import StringIO
import xmlrpclib
from xmlrpclib import ServerProxy
from mygreatapp.tests import TestController

# a fake httplib.HTTP using 'app' (see TestController.__init__())
class WSGILikeHTTP():
        def __init__(self, host, app):
                self.app = app
                self.headers = {}
                self.content = StringIO()
       
        def putrequest(self, method, handler):
                self.method = method
                self.handler = handler
       
        def putheader(self, key, value):
                self.headers[key] = value
       
        def endheaders(self):
                pass
       
        def send(self, body):
                self.body = body
       
        def getfile(self):
                return self.content

        def getreply(self):
                if self.method == "POST":
                        r = self.app.post(self.handler,
                                      headers=self.headers,
                                      params=self.body)
                        self.content = StringIO(r.response)
                return (200, None, None)

class WSGIAppTransport(xmlrpclib.Transport):
        # Only here to pass the 'app'
        def __init__(self, app):
                xmlrpclib.Transport.__init__(self)
                self.app = app

        # return the fake httplib.HTTP(host)
        def make_connection(self, host):
                host, extra_headers, x509 = self.get_host_info(host)
                return WSGILikeHTTP(host, self.app)

class TestApiController(TestController):
        def test_super_function(self):
                # URL _MUST_ starts with 'http' or 'https' (see xmlrpclib.py)
                server = ServerProxy('http://dummy/api',
                                     transport=WSGIAppTransport(self.app))
                server.super_function("Foo", "Bla", 42)

7 décembre 2009

Apologies and gpr400

Classé dans : Non classé — Jean Schurger @ 23:59

It seems that i have forgotten to mention the authors of the different gpr400 driver implementations or patches when i began to work on it.

Thanks to:

- Pierrick Hascoet

- Henry Plötz

- Jaiger

Powered by WordPress