Archive for the ‘Random Stuff’ Category
Change your terminal theme when you ssh into a server
Posted by Giovanni Intini | Filed under Apple, Mac, Productivity, Programming, Random Stuff
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
Cookies in iFrames: how bashing my head on the table made them work in Internet Explorer
Posted by Giovanni Intini | Filed under Rails, Random Stuff, Ruby
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!
Vhgen 1.1
Posted by Giovanni Intini | Filed under Random Stuff
Here’s the latest update to my vhgen script for apache2 vhost templating.
Stacktrace and FB Garage
Posted by Giovanni Intini | Filed under Random Stuff
For those of you who understand Italian, Stacktrace has published one article of mine, regarding the planning of FB Garage Milano.
It was a fun event both to plan, execute and attend, I hope the article transmits the action that happened behind the lines.
Betrayed by Xerox
Posted by Giovanni Intini | Filed under Random Stuff
I seldom post complaints on my blog (maybe this is the first time), but I’ve never been treated so bad by a name company like Xerox.
Last year in Mikamai we needed a printer. I made my research on the net for a color laser printer and we ended up choosing Xerox, after all you can’t go wrong with Xerox, right? We were so wrong.
Our Xerox Phaser 6110MFP started malfunctioning almost immediately, getting paper jams every second page we printed. After a while it completely stopped working and we had to call tech support (Xerox Italy), and that’s where the pain started.
The first time they sent a technician quite soon, and he said he fixed the printer, then he went away. Obviously he didn’t do anything that really fixed it since after half a day it started malfunctioning again.
We called again the tech support and when the technician came again he said we had to buy a new printer, because we “used up” this one. I almost a year we printed less than 1000 pages. How’s that too much?
We kept calling tech support and the guy didn’t even come anymore. After calling support every day for a week he came again, and said the printer is no more covered by warranty and as long as it’s able to print one page it’s fine for him. He strongly suggested again to buy a new printer.
We followed his suggestions, and bought a Samsung printer, this time spending less than 15% of what we spent for the Xerox one.
I hope this post will go around the net, as a warning to customers. Don’t buy Xerox.
This is an English rewrite of an Italian article posted on the Mikamai blog: “problemi con stampanti xerox“
Update: Xerox contacted us and solved the problem.
GiovanniStyle, high readability for your Terminal.app
Posted by Giovanni Intini | Filed under Random Stuff
Soon after Leopard came out I read an article on Slashdot about color contrast. There was a comment that struck me that explained how there were two types of contrast and that you had to maximize both the achieve maximum readabilty. That comment suggested light yellow on dark blue as the best color scheme for terminals.
I made some experimentations with Terminal.app and was pleasantly surprised the commenter was right. I added Consolas to the mix to get the best possible Terminal experience.
After a while my friends and coworkers started to notice my terminal and kept asking me for my .terminal file. Soon after that even customers started asking for it, so I did what the cool guys do and put it on GitHub.
You can find it here: http://github.com/intinig/giovanni_style/tree/master
Let me know what you think
Update: here’s a screenshot of the default style and GiovanniStyle side by side. It doesn’t do it any justice, so please try it and remember you have to have Consolas installed.

How I worked with thirty amazing people and lived to tell: Stacktrace
Posted by Giovanni Intini | Filed under Italy, Programming, Python, Random Stuff, Ruby, Ruby on Rails, Stacktrace
I’ve had the pleasure of working with thirty brilliant techies for the launch of Stacktrace, an Italian website about technology in its various forms.
Stacktrace was and idea of Antonio Cangiano. He felt that Italy missed an authoritative and original technology reference, and contacted about thirty of the best Italy has to offer, people I am very proud I could work with, to prepare the lightning quick launch of a wonderful site, full of original, well written and interesting content.
If you can understand Italian, even a bit of it, I strongly suggest you check Stacktrace. You’ll be glad you did.
The Chuck Norris Ruby Class
Posted by Giovanni Intini | Filed under Chuck Norris, Fun, Programming, Random Stuff, Ruby
Yesterday morning I didn’t feel like doing any real work, so I coded a Chuck Norris Ruby Class. Please feel free to edit the wiki and add features/bugfixes to it
Projects
Posted by Giovanni Intini | Filed under Random Stuff
Here’s a summary of the open source projects I’ve been working on lately:
- Anacropolis, an anagrams search engine.
- The Ruby Mine, the Italian Ruby and Ruby on Rails resource.
- Tuziro, the Web Dragon, you gotta see it, it’s a social del.icio.us aggregator.
- RGestPay, ruby ecommerce library.
- Numeri.rb, numbers to words for Italians.
- Language Redirect Extension, an extension for Radiant CMS.
- Planet Nimboo, Nimboo certified feed aggregator, now with less bduf(tm).
- ICCFriends.net, repository for Nintendo Friend Codes.
Hack Day Badge
Posted by Giovanni Intini | Filed under Random Stuff
As you probably know I’m going to the Hack Day in June. That means I’m entitled to use one of these badges.
Go me!