dimanche 31 mars 2013

python 3.3 pyvenv distribute pip hackish fix

Python3.3 includes an official virtualenv helper called pyvenv. Small detail though, it's not a swap-in replacement, you need to install distribute and pip by hand (at least for now) as said in the documentation. See the Note paragraph here http://docs.python.org/dev/library/venv.html#creating-virtual-environments.

Warning: you need to re-source the venv after `easy_install pip` !
Here's a complete session:

dummy@x60s_GPT ~/dev/python3.pyvenv % pyvenv venv

dummy@x60s_GPT ~/dev/python3.pyvenv % source venv/bin

(venv)
dummy@x60s_GPT ~/dev/python3.pyvenv % curl -O http://python-distribute.org/distribute_setup.py && \python distribute_setup.py && easy_install pip

# At that point, pip won't work, re-source venv/bin/activate

(venv)
dummy@x60s_GPT ~/dev/python3.pyvenv % source venv/bin/activate


# From now on pip will work


dummy@x60s_GPT ~/dev/python3.pyvenv % pip install requests

Downloading/unpacking requests
  Running setup.py egg_info for package requests
   
Installing collected packages: requests
  Running setup.py install for requests
   
Successfully installed requests
Cleaning up...
(venv)
dummy@x60s_GPT ~/dev/python3.pyvenv % echo $?

0

samedi 30 mars 2013

1998 Emacs article serie "Emacsulation" from slim[e] (common lisp) author Eric Marsden.

After Luke Gorrie's talk about SLIME origins and features, I dug for Eric Marsen (author of SLIME proto-prototype). According to http://edward.oconnor.cx/2006/01/emacsulation did an article series about Emacs around 1998. Links are dead redirection so here's the web.archive~proxy list:
  1. on jka-compr (AKA auto-compression-mode
  2. on networking, ange-ftp, w3, and crypt++
  3. an introduction to ediff
  4. on gnuserv
  5. on customizing Emacs, including material on Custom
  6. on abbrev, dabbrev, and completion
ps : Eric's webpage link section is full of things.

John Wiegley induced emacs [past]discovery of the day - edebug

EmacsConf is taking place today. John Wiegley speaks about elisp environment, including elp (profiler), edebug, and many other things. So I went to read the edebug manual a bit more (as usual I read a few pages but stopped too early).
I enjoyed the trace buffer combined with [fast]trace execution mode.

Enable the trace buffer with : `M-:` (setq edebug-trace t)

Now, let's say I have this in *scratch* (.|. being the caret)

(defun fact (n)
  (cond
   ((equal n 0) 1)
   ((* n (fact (- n 1))))))

.|.(fact 10)

`M-x` edebug-defun enters the elisp debugger

`T` will step through the s-exps in fast trace mode (automatically evaluate the next s-exp every N ms) and the *edebug-trace* buffer will trace the whole process nicely, resulting in this:

{ edebug-anon0 args: nil
:{ fact args: (10)
::{ fact args: (9)
:::{ fact args: (8)
::::{ fact args: (7)
:::::{ fact args: (6)
::::::{ fact args: (5)
:::::::{ fact args: (4)
::::::::{ fact args: (3)
:::::::::{ fact args: (2)
::::::::::{ fact args: (1)
:::::::::::{ fact args: (0)
:::::::::::} fact result: 1
::::::::::} fact result: 1
:::::::::} fact result: 2
::::::::} fact result: 6
:::::::} fact result: 24
::::::} fact result: 120
:::::} fact result: 720
::::} fact result: 5040
:::} fact result: 40320
::} fact result: 362880
:} fact result: 3628800
} edebug-anon0 result: 3628800

Kawaii, isn't it ?

mercredi 27 mars 2013

Coursera proglang epilog

Done with proglang. Lost many points because of I'm an unorganized idiot who can't recall a deadline. Unlike the scala course, proglang rules are stricter, 50% penalty right away. Anyway, got new insights and good understandings on all assignments. Both courses seems to be 2nd year college level. It's time for graduate level courses on programming. I'm revisiting old courses I took but failed (either in concept understanding or grades or both), and also starring at brown CS1730, idu C311, ...

There are initiatives for study groups about SICP, or advanced interpretation/compilation from coursera.proglang forum. Interesting, but I don't know how it's gonna be organized.

I also need 2nd-3rd year level classes in physics, chemistry, ee. And I want to take MIT classes about advanced data structures lead by E.Demaine.

That's for long term future. Short term is job hunting season opening. And right now I'm kinda blue. I liked the #coursera-pl @ freenode irc channel. All the guys here were cool (from the old timers gurus to the youngsters). I don't like to part.

Also, the sourceforge migration of some ocaml lib to github, pitched by xtrmz_ from #coursera-pl. A little push for the ocaml ecosystem, which some past teachers are so fond of.

-

jeudi 7 mars 2013

transcode to dvd using ffmpeg dvdauthor and growisofs




* transcode

  ffmpeg -i input.asf -target pal-dvd output.mpg
                                                                                                                                     
* Now you can use this file to make a DVD:


  export VIDEO_FORMAT=NTSC # NTSC or PAL
  dvdauthor -t -o youroutputdirectory -f output.mpg

  dvdauthor -o youroutputdirectory                                      
  mkisofs -dvd-video -o dvdimage.iso youroutputdirectory

  growisofs -speed=4 -dvd-compat -Z /dev/dvd=dvdimage.iso
                                                                                                             
* Verify by comparing MD5SUM


  md5sum dvdimage.iso 
  ISOSIZE=$(( $(ls -l dvdimage.iso | awk '{ print $5 }') / 2048 ))
  dd if=/dev/dvd bs=2048 count=${ISOSIZE} | md5sum

from http://ubuntuforums.org/showthread.php?t=1123447