soledad penadés
repeat 4[fd 100 rt 90]

Archive for the ‘mac os x’ Category

20080104 "example.php" is a script application which was downloaded from the Internet

Another Leopard annoyance

… Are you sure you want to open it?

Firefox.app downloaded this file today at 10:22

Yet another stupid change in Leopard. Each time I download a php/ruby/python/etc file (which is quite common) I get this dumb question being asked. Even if the file is inside a tgz/zip/tar/rar archive!!

I'm pretty sure there might be a hidden setting somewhere which needs to be modified by writing to some property file such as com.apple.stupid_questions but as I don't feel like digging into the intricacies of Leopard and I haven't found anything in the System Settings nor asking mighty Google, I wondered if any of you know a solution…

UPDATE: Henrik knows how to fix it! Thanks!!

20061210 Gran Paradiso: faster, nicer, better!

Just had a look at the first alpha from Firefox 3, codenamed Grand Paradiso. Yeah, Firefox THREE!

The Mac version has something that other platforms won't feature: a switch in the way browser elements (also known as widgets) are drawn. For Firefox 3, they will use the Cocoa widgets, which were used previously in the Camino project (another branch of Firefox aimed at having a real Mac OS X look and feel; I talked about Camino before).

Although the notes point at Cocoa widgets being slower than Carbon ones, I felt the performance being quite better in my tests. I tried with some pages that render slowly in Firefox 2, like Google Analytics or Google Mail. In Grand Paradiso, they are smooth, even with some nice deceleration when scrolling up or down.

I don't know how much of that performance increase has to be attributed to the new graphics rendering engine, Cairo. Although there are some rendering glitches, like some underlines which have 2 pixels instead of just 1, it looks better in general. For example, xplsv.tv, which has a small typeface (verdana 10px), now it's way more legible, when in Firefox 2 it looks a bit too crowded and excessively bold. Space between lines has been increased as well, so maybe people will have to reconsider their css if this is to be maintained in the final (and they are picky about it; in my opinion it looks better like that).

Unfortunately it still has those rendering bugs and none of the extensions were compatible. I could fix them to be compatible as I did with Firefox 2, but I'm not feeling like hacking today, so I'll stay with Firefox 2 until they release something a bit more stable. But it looks very very promising!

20061003 Find out the full referrer (with the shell)

Are you fed up with Google Analytics not showing the full referrer url and just showing something like http://www.example.com/forum/viewtopic.php? I also do, I love to know who's linking me (yeah I'm curious!).

My hosting compresses access_logs which reach a certain size, so when I downloaded the access logs files I get a bunch of .gz files which I'm not going to manually uncompress… So I went to the terminal and once in the folder where the log files are, I type

find . -name "*.gz" -exec gunzip {} \;

Now I have lots of files like access_log.20060929, access_log.20060930, etc. For searching let's say a referrer called example.com which I see in GA, I do:

cat * | grep example.com

and that will return you the apache log lines where the term appears.

For example:

81.39.91.97 - - [26/Sep/2006:11:27:47 +0000] "GET /index.php HTTP/1.1" 200 9562 "http://example.com/viewtopic.php?t=747" "Mozilla/5.0 (Windows; U; Windows NT 5.1; es-ES; rv:1.8.0.7) Gecko/20060909 Firefox/1.5.0.7"

It's a bit of brute force approach as it's searching in all the files (now that I realize it's even searching in the compressed files since I didn't remove they yet, haha!). But it's very fast even though!

With a bit more of love this could be a rudimentary stats script but I'm not that much into shell scripting (and I'm trying to force myself into really learning regular expressions to do that stats script with ruby instead).
Oh and I forgot to say this works for any decent shell - linux, mac… I think I also could do it with a windows box with unxutils installed (so that you get the funky stuff like grep, find, cat, etc).

20060923 You must be a linux expert

Yesterday after work was quite funny. Following british habits, almost everybody in the office went to a near pub for some drinks. That's quite interesting since that way you can learn what everybody else in the office is doing, or what do they do outside office hours, etc.

Then somebody asked me: You must be a linux expert, no?

Me? God, I wish I was! It seems that Ubuntu it's so easy that you look like an expert, hehe, that's really funny. Then I was asked why I was using it, if I wasn't really an expert on it, instead of using windows, and I must recognize it's quite complicated to explain.

In my previous jobs I could just use windows. It wasn't really a problem until I got my powerbook. Then I started feeling windows more and more clumsy - and annoying. But I still had to stick with it, since there was no opportunity to switch to mac or linux. One day I asked about installing ubuntu in one of the computers and there were two answers:

  1. linux is just for servers (and only red hat enterprise linux)
  2. how can someone install a linux distribution with such an ugly name? (ubuntu)

Obviously I got discouraged and just thought: ok, but you don't know what you're losing. Some time after we replaced a pirate copy of windows XP with ubuntu at our home server, and I quite liked that new version. I thought: if it wasn't because I have MacOsX… I would install linux in my powerbook!
And somehow on the other hand I got aware of the goodness of using open source products. Now this is really hard to explain, as it may sound like a divine message or something, but the main reason is the data:

One day you don't care about open source or anything and consider the same freeware and open source. Next day (after the message came) you realise that you want to keep your data with you - and for that, you need to use programs which only use standard file formats, or open source software. So that if you change your program, your data keeps being usable.

I somehow got the final nudge when I switched from Apple's Mail.app to Thunderbird. I don't know why, I started feeling bad about using Apple's Mail. I thought: and what if I bought another computer and it's not a mac and I want to copy my email data, what am I going to do? The horror!

I discovered that although Mail.app used an standard mbox format at the beginning, they changed it so that the files could be indexed by the Spotlight. So what happened? It was not standard anymore, and I was quite lucky that some good soul had written an script for converting between Mail 2 format and the standard mbox one.
Since then I got more and more interested in this kind of software. I know it may sound a bit ridiculous if you come from the commercial background that most of us live in, but the ubuntu philosophy -providing software freely- really hit me. The idea of not being tied to any company may sound quite utopical but I believe it's good to have utopies in mind.

And then (coming back to the topic) when new computers came to the office, they had a preinstalled windows XP. I asked if I could install linux on my computer and when they told of course! I was like W-O-H-!

Since then I've been using it continuously, and can't stop being surprised every day with the good achievements and goals it has reached. I also have become aware of how many money do companies spend stupidly in things like Microsoft Office, Microsoft Windows and all of that. I mean, companies could save lots of money if they could just buy bare computers with no operating system installed at all, and install only whatever they needed. Specially, computers for developers: I have a fully equipped computer for the price of 0. Just do some maths!

There are also other aspects even more complicated to explain, mainly that using free software is like making an payment to the developers. Paying with recognition, honours, and even bug reports, to be honest. I believe any decent programmer should be happy with people contributing to the software in any manner, as it means that they care about the product. So somehow there's like an spontaneous collaboration, which I personally find very interesting. (Let alone project donations, that I also have made, but that's another topic)

As you can see, the reasons for using linux are many and subjective, and most of them fall quite quickly in the personal beliefs area, being very easy to start evangelising and trying to force everybody to go linux. I do not think that it is the way, since as I said once, I got very dissapointed with linux zealots in the past. So when I have the opportunity to explain my opinions I do it happily, with the hope that it serves more people to understand this personal attitude (and maybe join it as well).

20060806 Wrong location of mysql.sock?

I was trying to run bake script (for cakephp!) and it started complaining about not finding /var/mysql/mysql.sock - but why this path? I already had problems with mysql socket and ruby on rails. In that time, I was using xampp for apache, php and mysql, so the mysql socket was inside xampp folder and I could solve it thanks to ccm (see the post if you feel curious).

But past week I decided I was fed up with xampp and not knowing where are the things, and more specially, not having a working version of Apache with mod_rewrite, so I went for the hard way and compiled and installed all from scratch (apache, php, mysql). Then what happened is that mysql socket is now in /tmp/mysql.sock but for some reason cake (and obviously php) is looking for the socket in /var/mysql/mysql.sock. Why, I don't know - since the application I'm developing works perfectly (I presume that's because it's running in a virtual host and thus php doesn't try to connect with localhost but with http, as it believes that it's not localhost actually).

In any case, it's just bake which fails.

Well, it was just bake which failed, since I decided to solve it all quickly. Did it want a socket in /var/mysql/mysql.sock?

There you go! Open a terminal and…

cd /var
sudo mkdir mysql (if a mysql directory doesn't exist there)
sudo ln -s /tmp/mysql.sock /var/mysql/mysql.sock

bye bye error! now enjoy bake!

This trick is maybe dirty but I'm fed up of running ./configure and friends. If you know why it failed before, you can leave a comment… and I'll appreciate it much :)