Lazy Loading in php with spl_autload

Posté le mar. 04 avril 2017 dans blog

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 …


Continuer à lire

nfsmount: rpc failed: 2

Posté le mar. 04 avril 2017 dans blog

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 …

Continuer à lire

Numeric arguments in emacs

Posté le mar. 04 avril 2017 dans blog

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 …


Continuer à lire

Pipe: Infix syntax for Python

Posté le mar. 04 avril 2017 dans blog

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 …

Continuer à lire

Post data lost on 301 Moved Permanently

Posté le mar. 04 avril 2017 dans blog

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 …

Continuer à lire

Python: Consulting PEPs from command line, while being offline

Posté le mar. 04 avril 2017 dans blog

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 …


Continuer à lire

Python: Introducing ppipe : Parallel Pipe

Posté le mar. 04 avril 2017 dans blog

/!\ 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 …


Continuer à lire

Searching and replacing in emacs

Posté le mar. 04 avril 2017 dans blog

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 …

Continuer à lire

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

Posté le mar. 04 avril 2017 dans blog

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 …


Continuer à lire

The art of Events

Posté le mar. 04 avril 2017 dans blog

The art of using events to build more independent classes. /* Found a better example */ Imagine you have a class A and a class B. A builds B, and B have to communicate with A (call methods ... ?) Some developers (Boooo (I've done it ... (Booo >> me))) will pass a reference of A …


Continuer à lire