I am in a tough spot. I am a technician, but I also am a design whore, so when I had to find a solution to one common problem (forgetting that your terminal tab is not on localhost), I couldn’t just solve the problem, but I had to find a good looking solution to that.
A #lazytweet only partially helped me, directing me to this useful post. I liked the approach, it was close, but not there.
I played with shell functions for a bit and came up with this:
The way it works is simple, it tells terminal to change it’s theme before ssh-ing and changes it back when ssh quits.
You might be wondering what Solarized Dark and Light are. It’s quite simple, they are two flavors of the best theme ever made.
If you’re still reading, a shameless plug: use my version of git-prompt for the best command prompt ever made
While working on our TTGPassport our valiant team hit a wall that most programmers hit sooner or later when working with iframes: cookies won’t work with Internet Explorer, and you will lose your session.
The internet is full or remedies for this unnerving problem, most of them revolving on pseudo-magically setting the P3P header. I don’t believe in pseudo-magic, so I kept googling for answers, until I found this informing post.
I diligently ran through the suggestions but we had random session losses, with no reasonable explanation. We were setting our P3P header in a before filter (Rails application), like this:
class ApplicationController < ActionController::Base before_filter :set_p3p def set_p3p response.headers["P3P"]='CP="NOI DSP LAW NID"' end end
Fearing Rails could be the culprit I changed our Apache configuration to set the header on every request, using the following directive:
Header set P3P "CP=\"NOI DSP LAW NID\""
Unfortunately even bypassing Rails didn’t help. I was even unsure of why sometimes it worked and sometimes it didn’t (basically when explorer shows the evil red eye on the bottom of the page it means it’s blocking your cookies).
I started playing around with Firebug to see what could be the problem, and finally a little lightbulb lit on top of my head: the pages that broke the session didn’t have the P3P header, and instead they had an ETag header. That means something was adding the ETag and that the browser recalled the content of the page from its cache, thus bypassing P3P and upsetting explorer. I disabled ETags in Apache:
Header unset ETag FileETag None
Guess what? It didn’t work. Something was still setting the ETag header and bypassing my beloved and much needed P3P. The only culprit could be Ruby on Rails. I googled some more but nothing really told me how to disable ETags so I had to resort to some monkey patching:
module ActionController class Request def etag_matches?(etag) false end end class Response def etag? true end end end
I asked our strong, silent project manager to test it because I was crossing my fingers too hard, and, finally, it worked, no ETags and our P3P header where we expected it.
I hope you are reading this article because you had the same problem we had, and I hope it will help you as it helped us!
Posted by Giovanni Intini | Filed under Programming
Here’s my slides.
I don’t usually like to post out of pride, but it’s always a nice feeling when your hard work is recognized by other people.
If you could give the 2009 Prize for Most Innovative Italian Company, you would give it to …? And why?
[...] I really like a Milano based company, Mikamai, a small team but very good, with lots of ideas, focused on people and they have a tech know-how that is frighteningly good.
Posted by Giovanni Intini | Filed under Random Stuff
Here’s the latest update to my vhgen script for apache2 vhost templating.
Since I started working in the web development business the release of Rails 3 has been the first time I really felt I had to understand what was going on because otherwise I would be left behind.
There were simpler times where just reading the feeds of the most important blogs allowed me to be up-to-date, but either I’m getting old or the information has become too fractioned, because this time the only reason for me (and everyone in MIKAMAI) to get started with Rails 3 was to resume a practice that unfortunately we left behind in the past year: the internal presentations.
Starting last thursday, and hopefully never stopping, thursday afternoons aren’t about working for others, but are about everyone sharing his knoweledge with the others.
Last thursday was obviously all about Rails 3, so a couple of us connected their macs to the big screen and demoed new features of Rails 3.
It was nice, interesting questions were asked during the demos, and the overall mood was pretty good. I look forward to the next session.
Last thursday MIKAMAI hosted a Ruby Social Club meeting. Here’s the slides for my presentation.
Last year I made some work on lighttpd support for wp-supercache. It instantly became very popular and basically anyone running wordpress on lighttpd uses it, even if it lacks support for wp-supercache newest features.
The amazing Jean Pierre Wenzel has recently released an updated version that adds a much needed mobile support.
You can check it out here.
Thanks Jean Pierre!
Here’s the slides for the presentation I gave at the latest Ruby Social Club in Milano.