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

Archive for the ‘mac os x’ Category

20080530 Mental note on Safari, cookies and underscores

In short: do not use underscores for your local domains.

Apparently, Safari decided to be kind of very strict, which means it will show a website whose domain name contains underscores, but will dutifully ignore every request to set cookies on it.

It's very funny because if they really wanted to be strict they should not show the website at all, instead of making me peek into odd pages trying to find out why oh why it worked on opera and firefox but not in Safari.

And it seems it also can lead to the same problem in IE, which makes me kind of agree with Mr.doob's lemma: Safari is the new IE!

Luckily underscores are not allowed when registering a domain (I just checked that). Otherwise we would have heard a ton of complaints from customers who ordered a website and then couldn't login at their own website because the domain contained an underscore.

Extra bonus: you can use this snippet of code for checking that cookies are working. Save it as 'cookie-test.php' or something that you fancy and reload reload reload. It should show "X is 0", "X is 1", "X is 2", etc.

If it doesn't work, it'll always show "X is 0";

<?php

if(isset($_COOKIE['x']))
{
        $x = $_COOKIE['x'];
}
else
{
        $x = 0;
}

setcookie('x', $x+1);

echo "X is $x";

?>

20080519 Lua universal binary

Add this post, this one and this comment and you get a Lua universal build for your mac in Leopard - which works for Tiger too! Assuming you uncompressed the source code onto a folder called lua

In lua/Makefile, add a new target, macosx_ub, to the PLATS definition. It should look like this:

# Convenience platforms targets.
PLATS= aix ansi bsd freebsd generic linux macosx macosx_ub mingw posix solaris

and in lua/src/Makefile add this

macosx_ub:
$(MAKE) all MYCFLAGS="-DLUA_USE_MACOSX -isysroot /Developer/SDKs/MacOSX10.4u.sdk -mmacosx-version-min=10.4 -arch ppc -arch i386" "MYLDFLAGS=-Wl,-syslibroot,/Developer/SDKs/MacOSX10.4u.sdk -arch ppc -arch i386 -mmacosx-version-min=10.4"

Then instead of typing make macosx, type make macosx_ub et voilà! You have a universal Lua! :-)

20080421 Building a universal library in Mac OS X

If you need to use a library in a universal binary you'll need to use a universal library too.

Let's use FMOD as an example; libfmod.a is the PPC compiled version, libfmodx86.a is the intel version.

For combining both into a universal library:

lipo -create libfmodx86.a libfmod.a -output libfmod-universal.a
ranlib libfmod-universal.a

In the case of FMOD they provide you the with precompiled static libraries (the .a files). But if you build libraries from source code, there's a magic compiler option called -arch which will help you in this. Unfortunately I don't have an example handy right now. I'll put it whenever I find it again, but it roughly goes on the lines of -arch i386 -arch ppc :-)

I'm not sure that naming a library with something as *-universal.a is a good idea, specially if you have code which uses -Llibraryname for linking libraries — I guess you might need to change that parameter. I am explicitly adding the libraries to the project in XCode so it's working fine for me.

Suggestions and better practices are welcome!

20080122 Truly irritating: "Your Wireless network has been compromised"

Believe it or not, here's yet another stupid feature of Leopard! Whenever it decides it's a good moment to stop your workflow, a little window will pop up and tell you that because your wireless network has been compromised, it will be disabled for a minute.

What it doesn't tell is that it won't connect by itself automatically when that ghostly compromising menace disappears, even if the network password is stored in the keychain. So if you were doing something which depended on the wireless connection, it will never finish unless you're there and make sure you manually connect again to the network.

There are lots of speculative solutions such as changing the encryption method in the router from WPA to WPA2 and whatever… but why should I change anything only because Leopard's wifi support is defective and can't distinguish between failure and attack?

So far, these are Leopard's good points:

  • better VNC support
  • tabbed terminal
  • some tools are preinstalled (svn, ruby… although it's nothing one couldn't get done dedicating a few hours)
  • nicer XCode

And these are its annoyances/weaknesses/useless features, plus some more that I can't remember right now or have been fixed in system updates (such as file uploading in the flash plug-in, which was broken from day 0):

  • "Your wireless network has been compromised" - and it has just happened again while I wrote this! OH YEAH!
  • continuous errors with firewire disks such as my ipod mini
  • intrusively inquiring about what do I want to do with what I download
  • absurd behaviour after returning from stand-by: on my mac mini left click acts as a right click until I do a control+tab and switch to a different application, on my powerbook the trackpad works like at a 0.00001% of the normal speed and accelerates progressively until it reaches normal speed - even after a completely clean reinstall
  • horrible wireless performance. How come the signal strength is only 20% when another computer, side by side, has 100%?
  • no more decent mp3 preview - if you switch to a different application while previewing it will stop. It sometimes does not work at all, instead. And there's no way of going back to the previous interface.
  • amazingly it still hasn't a decent image viewer which can operate fullscreen
  • super ugly folder icons

I wonder if this can be considered a defective product… by all standards it looks like that: these errors are recurrent and I'm experiencing them every single day.

I'm tempted of going back to Tiger but I'm just not willing to spend a single minute of my life re-installing software for the n-th time.

Instead, I hereby demand an immediate fix for these bugs!! I wonder if there's an open case in petitiononline for this…

20080107 ZigVersion crashing all the time?

… just delete/rename ~/Library/Application Support/ZigVersion/UrlList.plist

I had been experiencing continuous crashes with ZigVersion for probably a month or so, so at the end I just managed my svn stuff from the command line. It is a bit tedious sometimes so I thought it would be nice to find a fix!

The side effect of this is that you'll lose the recent servers list, but I think that's part of the problem: I had so many working copies in the list that I guess ZigVersion just confused itself (specially because I had done nasty things such as putting working copies inside folders which weren't checked in but were inside another working copy, etc).