www.dilella.org

“the only source of knowledge is experience” – Albert Einstein

Archive for September, 2009

If you get this error, than you have a problem with your python-multiprocessing package. There are two possibile ways to solve this problem. You can install the backport or you can patch the latest version of python-multiprocessing. Ive done last thing, so here we go:

// first remove the old version from your debian system
# apt-get remove python-multiprocessing

// get the latest version from svn
# svn checkout http://python-multiprocessing.googlecode.com/svn/trunk python-multiprocessing

// get the patch http://code.google.com/p/python-multiprocessing/issues/detail?id=18
# cd python-multiprocessing
# patch -p1 < 0002-Fix-logging-of-processName.patch

// install it
# python setup.py install

Now this should solve your problems. I hope that the guys behind python-multiprocessing will release soon a newer version of their package.

  • Share/Bookmark
  • 0 Comments
  • Filed under: Coding
  • Before I start I must confess, I love the mootools framework. It becomes my choice of js framework. Ok, lets start. For a cute project I will release soon, I convert many ajax post to a json posts and for that reason I needed a function that converts submit params directly to a JSON object. After some minutes Ive enhanced the Element class with a new function called toJSON. What does this do ? After traversing all html elements it creates a new array and return a JSON.encode object ready to be send to an url. Here is the function:

    Element.implement({
      toJSON: function() {
        var json = {};
        this.getElements(‘input, select, textarea’, true).each(function(el){
          if (!el.name || el.disabled || el.type == ‘submit’ || el.type == ‘reset’ || el.type == ‘file’) return;
          var value = (el.tagName.toLowerCase() == ‘select’) ? Element.getSelected(el).map(function(opt){
            return opt.value;
          }) : ((el.type == ‘radio’ || el.type == ‘checkbox’) && !el.checked) ? null : el.value;
          $splat(value).each(function(val){
            if (typeof val != ‘undefined’) json[el.name] = encodeURIComponent(val);
          });
        });
        return JSON.encode(json);
      }
    });

     

    • Share/Bookmark
  • 0 Comments
  • Filed under: Coding