Others / Divers

Migration to Heroku

Hi, if you read those lines it means the DNS were updated and you’re looking at this blog hosted on Heroku.

It’s been a long time since I wanted to try Heroku for more than a little Sinatra test app, so I decided to try with this blog. We’ll see how it goes in the next weeks.

Published on Sat, 11 Jun 2011 12:20

Bad key bindings over ssh from a mac

I encountered, for some time now, problems when connecting over ssh from my mac to a linux machine.
These problems were related to backspace/delete key in both nano and zsh the solutions I found today are :

For zsh type :

echo "bindkey ^? backward-delete-char" >> ~/.zshrc
echo "bindkey ^[[3~ delete-char" >> ~/.zshrc

WARNING : you should type these commands not copy/paste them, ^? sequence is obtained using ctrl+v then [backspace key].

For nano type :

## Fix Backspace/Delete confusion problem.
echo "set rebinddelete" >> ~/.nanorc

All should works now.

Published on Sat, 23 Feb 2008 20:44

(t)csh and dircolors problem

I encountered a little problem today, I use macports version of coreutils which gives me access to gnu versions of some commands (for full list : sudo port contents coreutils | grep /bin). My problem is related to one of those I’m using in my bashrc to color my shell : dircolors (gdircolors in macports).

This little commands allows you to generate LS_COLORS values (as the name seems to imply, it’s used by ls command) from a config file (~/.dir_colors in my case). I confidently modified this file today and was welcomed by a nice csh: Unknown colorls variable `su'.
It turns out there are an incompatibility between LS_COLORS generated by current version of dircolors in coreutils and (t)csh : tcsh treat LS_COLORS as a magic environment variable, which means it is parsed for its own use in ls builtin command.

The culprits in my .dir_colors file was :

#SETUID 37;41 # file that is setuid (u+s)
#SETGID 30;43 # file that is setgid (g+s)
#STICKY_OTHER_WRITABLE 30;42 # dir that is sticky and other-writable (+t,o+w)
#OTHER_WRITABLE 34;42 # dir that is other-writable (o+w) and not sticky
#STICKY 37;44 # dir with the sticky bit set (+t) and not other-writable

As you can see a simple fix is to comment them out.

In fact I’m not sure why I see those errors poping up, as I’m using bash ans it’s now the default in MacOSX.

Published on Tue, 04 Sep 2007 15:10

[Windows reminder] Registry editor

Windows+r (shortcut to ‘Run’ window)


Published on Mon, 27 Aug 2007 11:09

[Windows reminder] IE default editor

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Internet Explorer\View Source Editor\Editor Name]

PS : I think this is the first post of a long list.

Published on Mon, 27 Aug 2007 11:03

Apache 2.0.x + Mongrel + mod_proxy + mod_rewrite configuration

When I decided to try the switch from fcgid to mod_proxy + mongrel for this blog (and now the majority of my projects at work), I discovered there was no example of such configuration or at least not all in one place.
This post will try to fill this lack of a complete example. The distro i’m using here is Debian, but the configuration should be easily ported to yours.

Thereafter I assume you already have a working configuration with :

- Apache 2.0.x - mod_proxy_http (thanks AMicky) - mod_proxy - mod_rewrite

mod_proxy configuration :

There’s not so much to change here, just allow proxying to anyone for local domains.


  <Proxy *>
     Order deny,allow
     # next line was Deny from all
     Allow from all

A sample vhost file

This configuration is intended to be used with a RubyOnRails application served by Mongrel and deployed with Capistrano.

So you should notice some nice things, like auto-disabling website with a personalized message when there’s a maintenance.html page found, serving static contents directly by apache (no uneeded hit on mongrel) and conserving access to cgi-bin directory (see my previous post about awstats).


<VirtualHost *>
    # Set the domain
    ServerName mydomain.tld
    # Set domain aliases
    ServerAlias www.mydomain.tld 
    ServerAlias web.mydomain.tld

    # Set the DocumentRoot, this is where apache will look for static files
    # This is the public directory of your rails application 
    # As previously stated, my app is deployed with Capistrano, so I set DocumentRoot to the current/public directory
    DocumentRoot /var/www/mydomain.tld/current/public/

    # Set where you want apache put its logs
    # note I use deflate as log format, this is because I use mod_deflate to compress all outputs
    CustomLog /var/www/mydomain.tld/logs/access.log deflate
    ErrorLog /var/www/mydomain.tld/logs/error.log
    # if you want to have server-wide statistics,
    # you can also tell apache to log in a common file shared by all your domains 
    CustomLog /var/log/apache2/access.log deflate
    ErrorLog /var/log/apache2/error.log

    # I use utf-8 for all my projects, so I force apache to send the good charset by default.
    # This is needed if you use page caching and want apache serves these with the good charset.
    AddDefaultCharset utf-8

    # Allow limited access to your public directory
    # dont allow user to list directories
    # allow apache to FollowSymlinks
    <Directory /var/www/mydomain.tld/current/public/>
      Options -Indexes FollowSymLinks

      AllowOverride All
      Order allow,deny
      Allow from all

    # Be sure mod_rewrite is activated for you vhost
    RewriteEngine On

    # If you use applications which resides in cgi-bin, like awstats
    # the following mod_rewrite RewriteRule will allow apache to know it should not proxy these request and the PT switch will allow the ScriptAlias directive to work
    RewriteRule "^/cgi-bin/.*" "$0" [QSA,PT,L]
    RewriteRule "^/awstatsicon/.*" "$0" [PT,L]

    # Set a ScriptAlias for /cgi-bin/ url
    # All url begining with /cgi-bin/ will be served from the specified cgi-bin deirectory
    ScriptAlias /cgi-bin/ /var/www/mydomain.tld/cgi-bin/  
    <Directory /var/www/mydomain.tld/cgi-bin/>
      AllowOverride All
      Options ExecCGI FollowSymLinks
      Order allow,deny
      Allow from all

   # Do not allow open proxying, allow only requests starting with a /
   <LocationMatch "^[^/]">
      Deny from all
   # Avoid open you server to proxying
   ProxyRequests Off

   # Let apache correctly rewrite redirect
   ProxyPassReverse / http://localhost:8001/

   # Let apache pass the original host not the ProxyPass one
   ProxyPreserveHost On

   # As I mentioned earlier, Capistrano disable_web task allows you to disable your application
   # In fact it only create a simple page named maintenance.html in the directory public/system/ of your application
   # The following mod_rewrite rules will tell apache to directly serve the maintenance.html pages if it find it out.
   RewriteCond %{DOCUMENT_ROOT}/system/maintenance.html -f
   RewriteCond %{SCRIPT_FILENAME} !maintenance.html
   RewriteRule ^.*$ /system/maintenance.html [L]
   # For static files it's good to avoid hitting your mongrel process
   # so let apache knows it should serve it directly
   # for a rails application it means, files in images / stylesheets / javascripts
   RewriteRule "^/(images|stylesheets|javascripts)/?(.*)" "$0" [L]
   # Try to match a cached pages
   RewriteRule ^([^.]+)$ $1.html [QSA]
   # if the cached page does not exists
   RewriteCond %{REQUEST_FILENAME} !-f
   # proxy requests to your mongrel instance
   RewriteRule "^/(.*)" "http://localhost:8001/$1" [P,QSA,L]
Published on Wed, 26 Jul 2006 23:28

RewriteRule for ScriptAlias with mod_proxy enabled

Since my switch to Apache2+mod_proxy+mongrel, I had some troubles figuring how to make urls defined by a ScriptAlias work.

As an example, take Awstats, tipically it’s configuration involve a ScriptAlias directive in you vhost configuration.

Something like :

ScriptAlias /awstats/ /var/www/your_site_dir/cgi-bin/awstats/
<Directory /var/www/your_site_dir/cgi-bin/awstats/>
   AllowOverride All
   Options ExecCGI FollowSymLinks
   Order allow,deny
   Allow from all

But when mod_proxy is enabled, all requests are proxied, ignoring your ScriptAlias directive.

A solution if you also use mod_rewrite is to write something like this :

RewriteRule "^/awstats/.*" "$0" [PT,L]

The magic switch is PT which enable rewrite rules to be shared between differents mods.

Published on Wed, 26 Jul 2006 17:22

Switch to Apache + mod_proxy + Mongrel

In my quest to find the best rails configuration, I decided to try a new alternative to Apache+FastCGI/Apache+FCGID/Lighttpd+FastCGI.

Everyone seems to be focused on Mongrel combined with Apache 2.2 + mod_proxy_balancer. It looks good but Apache 2.2 isn’t actually in Debian (not even in unstable), and as I choose to switch this blog from a Fedora Core 2 (ooch !) server to another server of mine powered by Debian, it really doesn’t fits my needs.

So I choosed to try a different approach and use Apache 2.0.x + mod_proxy + Mongrel. This solution, gives me the possibility to use mongrel_cluster for process management, even if actually I don’t have multiple mongrel instances, and add a load balancer (Pen/Balance/Pound) if needed.

This setup seems to be sufficient for this blog, which runs the latest Typo (3.99.3).

Let me know if you see any differences with the previous configuration.

Published on Sat, 15 Jul 2006 14:29

Ouverture / Opening

Bienvenue, j’ai enfin installé quelquechose sur ce nom de domaine qui trainait depuis trop longtemps.

Il y aura donc ici désormais ici un devlog, contenant mes liens et petites trouvailles concernant le développement web ( ROR, PHP, JavaScript) et Mac (Cocoa). De plus j’essayerais de discuter de temps à autre d’IHM(Interface Humain Machine) et d’accessibilité.

Pour la partie techno du site :

Welcome, I finally installed something on this too long sleeping domain.

From now on, there will be a devlog here, talking about web ( ROR, PHP, JavaScript) and Mac (Cocoa) development. Additionally, I will try to discuss HCI and accessibility from time to time.

Technically speaking, this site run on :

(The english part of this site will help me improve my english skills, which really need it. So feel free to correct me about erroneous sentences and terms)

Published on Tue, 17 Jan 2006 21:53