Julien Palard

Python Developer and Trainer

Articles in the blog category

Lazy Loading in php with spl_autload

Today, a very short post about the lazy loading in PHP: spl_autoload. I'll not expose everything about it here, cause it's already done here: http://php.net/autoload.

Basically, a Lazy Loading allow you to predifine some paths where PHP should seek for classes to include, this allow you to …

nfsmount: rpc failed: 2

For those, here on the internet, asking themselves what is this fscking rpc failed: 2 while mounting an NFS, it's possible that the response is here: Your NFS client trying to mount the NFS share will use RPC to communicate with the serveur, il will go like:

> PORTMAP GETPORT(Program …

Numeric arguments in emacs

I'm starting an 'emacs trick of the day' sequence with:

  • Function name: universal-argument
  • Typical Key binding: C-u
  • How to get help: C-h f universal-argument
  • Usage: C-u

Receive a numeric argument that is given to the next called function, when no numeric argument is typed, the value defaults to 4. So …

Pipe: Infix syntax for Python

Pipe is a Python module enabling infix syntax in Python. For those asking "Why ?" let's take an example: Compare the readability of the classical prefix syntax:

sum(select(where(take_while(fib(), lambda x: x < 1000000) lambda x: x % 2), lambda x: x * x))

And the infix syntax:

fib() | take_while(lambda …

Post data lost on 301 Moved Permanently

What the hell with 301 Moved Permanently HTTP header!? I'll take an exemple to explain my ugly problem, take, a (very ugly cause it's PHP) index.php, it could be retrieved by using:

  • http://example.com/directory/index.php Got the page, 200 OK or
  • http://example.com/directory/ Got …

Python: Consulting PEPs from command line, while being offline

One day I wished I could read PEPs in the tube on my laptop... so I searched for a convenient way to do so, and I didn't found ... So I wrote a very simple shell script you can found here : https://github.com/julienpalard/pep I'm currently packaging it for …

Python coroutines with async and await

This is a short introduction of the basic vocabulary and knowledge needed to start with async and await, we'll go from "scratch", but not from the whole "let's use generators" era, when everything started, but from a contemporary (Python 3.5) point of view with natives coroutines, async, await.

Coroutine …

Python: Introducing ppipe : Parallel Pipe

/!\ this was highly experimental code written in 2011. Today you should NOT use it, just look at it if the subject amuses you. Better take a look at asyncio if you want this kind of tools.

I'll speak about my pipe python module so if you didn't know it, you …

Searching and replacing in emacs

Day two of my serie about emacs, about searching and replacing.

  • Function name: isearch-forward
  • Typical Key binding: C-s
  • How to get help: C-h f isearch-forward

isearch-forward let you type a string to be searched incrementally in the current buffer, successive following C-s will jump to the next match.

  • Function name …

squid: (101) Network is unreachable when DNS returns IPv6

If you have a Squid proxy configured on a machine that have no IPv6 connectivity, and try to reach an IPv6 compatible site, you squid will try to reach the site using IPv6 (I use squid 3.1.6 from Debian Squeeze) and will fail without even trying IPv4, displaying …