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

Archive for the ‘mac os x’ Category

20060513 A quick way to clean temporary files and caches on mac

Something very weird happened to me yesterday. I was viewing one movie with VLC player and suddenly an alert box appeared saying me "Your start-up disk is almost full". What? I had more than 8gb free, what is that?

Effectively, I had. Then I had just 400mb. 395, 380… Agghh! I just closed VLC and it continued doing that, so I thought: let's restart!

After restarting, fortunately no more space was consumed but, I still kept having just 300mb free. I presume VLC was storing too many frames in the cache or something (since it was the only program that I was using at that very moment) :D

I started looking at several folders where I thought that the temp files could be, but after finding some of them, and deleting old files, and taking the opportunity to delete old stuff I wasn't using, by the way, I still was with just 500 mb free.

Fortunately I found a program called Cache Out X, from NoNameScriptware, which magically cleaned all the unuseful stuff which was in the Library/Application Support folder. Suddenly I had 10gb free!

If you know a better way to do this, just leave a comment :)

20060501 My first application in Ruby On Rails

It's time to get serious with RoR! I finally decided that I would do some useful application to really learn how it works, and as I'm quite bored of doing applications for managing text (whether they are intranets, cms's, etc), I opted for recreating my old gallery script (which I did in php) in RoR. So I'm playing with images instead of just text.

This will give me the opportunity to test lots of extra functionalities of the framework, such as the famous integrated javascript effects, ajax, etc, as I want to improve my old gallery script, not simply redo it as it was in php.
So first thing I did was to make sure that I had a working updated version of ruby and rails. The best tutorial I have found which worked perfectly for me is this one: Building Ruby, Rails, LightTPD, and MySQL on Tiger, by Hivelogic. (Although I simply used it to update Ruby and Rails, but didn't build Lighttpd or Mysql).

With that I could be able to follow the recent tutorials and techniques, specially because I wanted to learn how to use a Login Generator, and there was something in the version of Ruby that I had which prevented me to install it (some lib error was thrown each time).

So my app has two parts, a public and an admin one (which was quite easy to anticipate). Once I managed to create the basic structure of controllers and models for the admin, I added the login functionality, as I don't want everybody to get into my app and modify pictures in there.

I used the Acts As Authenticated plugin, although I couldn't manage to get all the functionality that I expected so I took a look at the code of the Sudoku On Rails v5 tutorial at SobreRailes (sorry, spanish only!) and completed it with the missing functionality (basically, it was the activation stuff which was not generated, don't know why). It was sweet and smooth. If I had had to write it manually I would have spent at least three days.

Then I wanted to have support for uploading images. At all, this is about pictures! So after some researching I found a little plugin called FileColumn which allows to get picture uploads working quite quickly, including resizing and automatic deletion if the associated record gets deleted (no more orphan files in the filesystem because of a poor integration between the models and their associated data! hooray!). But for the resizing stuff and thumbnails generation, I needed to have RMagick installed in my system, which I didn't have. So I found a nice tutorial in the RMagick site, which explained how to compile and install RMagick and GraphicsMagick on mac os x, as well as all the libraries on which they depend, as RMagick is like a bridge between ruby and GraphicsMagick. This step took me a bit of time, specially the step of compiling ghostscript, but as I followed the instructions exactly as specified, I had everything working at the end and I could generate thumbnails and a resized version when uploading images. (Also I was also reading one of the supercool books about the tube that mr.doob gave me for my birthday so time flew fastly! :D )
If I had had to do this in php even using the best helpers that I could, I would have spent at least one week.

Then I prepared a draft version of the public interface. Now I can navigate between pictures and albums, using thumbnails and the big images as well, it shows the descriptions for the album or picture, where available. The code is so simple and beatiful that I could get it tattooed. Or maybe do a t-shirt with it, see an example for getting the data of one album:

def album
@album = Album.find(params[:id])
unless @album.nil?
@pictures = @album.pictures
end
end

No more embedded SQL in the middle of the code, no need for manually loading classes which abstract the DB information for the rest of the php code and try to provide a way of artificial modelization of the data, no need to spend time reinventing the wheel!! :D

As I specified in the models that one album has pictures (has_many : pictures), and that each picture belongs to one album (belongs_to :album), RoR is intelligent enough to deduct things from the database and save me that precious time (as it sees an album_id column in a picture row… it obviously is pointing to an album row!).

Unfortunately by the moment the front end is extremely basic, it's pure html with little css applied to it. In the next iteration I will do tasks such as find out how to redefine part of the behaviour of the FileColumn to make it update the associated images too if I upload another image when editing a picture, beautify the front end, and maybe start with those nice ajax capabilities which are supposedly quite easy to use with RoR. It will also be nice to learn how to do the fantastic unit tests with the support that this framework provides, so all in all this promises to be very exciting.

Conclussion: I absolutely love Ruby on Rails.

Stay tuned for a next release - as I already got a port for installing it on my host, it can be whenever I get a decent working version!.

UPDATE: As some people want to take a look (miguev ;) ) I have uploaded the relevant code of the current version. It just has the important things i.e. the models definition, etc. If you want to have a working application you will need to create it first with the usual rails name_of_your_app, configure the database, etc, and then use this code where appropiate. It won't work by itself :P This is just for showing how things are linked between them: cl1ck version 0.1

20060214 Interesting and more or less useless software for mac

Today at lunch time I was commenting with luy about some of the latest releases of mac software, and I thought it may be interesting to point out some programs that I find interesting. They are not as mainstream as the ones we mentioned (i.e. Apple's Aperture, iLife'06, etc…) but they can be as useful or useless as the other ones, depending on the hands they fall on. So there we go, let's have a look at my Applications folder!

  • AdiumX. A gaim based instant messaging application. Can connect with MSN, yahoo!, gtalk and all of those other networks I can't remember now. It's quite nice and leaving aside the fact that it still can't work with a webcam (specially because I don't have a webcam), it's very very good. Highly recommended! (Stop using that MSN Messenger crap)
  • Azureus. Best BitTorrent application I have ever tried. Runs under java in fact but in this case it doesn't hurt that much. (You have used this one under windows too)
  • Bricksmith. A lego simulation software. Not really useful but very entertaining.
  • Camino. The native-mac-os-interfaced browser with the gecko engine. Now in their 1.0 release!
  • Chicken of the VNC. A simple program for connecting to VNC servers. Very handy if you want to control all the computers from your chair…
  • ClamXAV. Mac version of ClamAV. I installed it just for making sure there weren't infected files in the folders I copied from my old pc, and for cleaning possible malware html pages (specially in the form of evil spam mail messages).
  • CocoModX. A module player with a Cocoa interface! If you can't stop listening to your favourite tracked music even in your mac, this is the perfect solution. Comes with fmod, bass and mikmod libraries integrated, so as to make sure each module is played with the best and most accurate player. The icon (a 3.5" disk with headphones and an amiga bouncing ball) is lovely!
  • Colloquy. For your oldskool IRC chats. Can connect to multiple servers, etc. Like mIRC but without the pop up with the author's picture ;)
  • Cyberduck. Simple [S]FTP client. Allows for online editing as well. It's often updated, and they say they are now using universal binaries, so they should work on your brand new mac-intels.
  • Firefox. The one and only.
  • iEatBrainz. This application will look through your iTunes collection and find out which songs do not have tags. Then it can proceed to analyse them and look for their right tags in an online database of songs.
  • iFeedPod. Read your favourite rss feeds on your ipod! (obviously, it's useless if you have an ipod shuffle).
  • Jomic. Simple Java based application for reading scanned/electronic comic books.
  • LameBrain. A powerful all-in-one Lame interface. It can rip cd's, encode them, convert between formats, etc…
  • Linotype Font Explorer-X. Nice font manager.
  • Locomotive. Superhelper for developing ruby on rails applications. A must have.
  • NeoOffice. The Mac flavour of openoffice. Stop pirating Microsoft Office and start using OpenOffice!
  • Paparazzi. This creates screenshots of a whole page (no matter how much it needs to scroll). Now you can create a png with the contents of your front page, even if you have a very long blogroll on it! ;)
  • Pixen. A very funny pixel art program. Latest version, even if it's a bit buggy, has nice features.
  • Schism Tracker. The definitive replacement to Impulse tracker.
  • Skype. For those neverending phone calls. It doesn't support video yet but who cares?
  • svnX. A subversion client for MacOsX.
  • TextMate. My favourite editor by the moment. It doesn't annoy you when it tries to help, it's fast, mac os native, etc.
  • UnRarX. For all those folks which keep compressing things in rar, well, we now can open that stuff with this little program.
  • VLC player. Usually, it plays more videos and better than quicktime. Honest! Audio sucks a bit, anyway.
  • xnntp. A news reader (nntp). For extreme boredom cases…

So you have a lot of things to procrastinate with now!! I'm so evil…! Most of these programs are free or very cheap, if you were wondering about that…

20060207 Blue Tuesday final version

Blue Tuesday

We have finished this demonstration a year and some months late but… who cares? Now featuring Mac Os X version (as well as the win32 one), as well as a new scene and lots of improvements here and there. Grab Blue Tuesday final version!

If you just can't see it, try the video version :) (Quicktime file, H264 compression, 400×300 pixels) - although nothing compares with the 1024×768 pixels size of the realtime version. Should you have a decent opengl card, go for the first one…

I hope you have a very great and blue tuesday :)

20060128 Show all files in Finder

(this is kind of mental note for myself but maybe you can find it useful)

open a terminal and write this:

defaults write com.apple.Finder AppleShowAllFiles true 

restart the finder just to be sure (click on the Apple button on top left… choose "Force Quit" then select Finder, click "relaunch"