Archive for the 'Mac OS X' Category

Getting back sqlite3 to Mac OS X

For some reason, I lost my SQLite version from my Mac OS X 10.5 Leopard. I hardly suspect MonoFramework for the “damage” caused, as /usr/bin/sqlite3 has been replaced with a link to a non-existent file from MonoFramework Library.

A quick and dirty fix is to bring back the sqlite3 source and install it in the *nix fashion (configure, make, make install). For future reference, I am listing the full sequence of commands I’ve typed in Terminal:

curl http://www.sqlite.org/sqlite-3.6.14.tar.gz | tar zx
cd sqlite-3.6.14
autoconf
./configure --prefix=/usr/local
make
sudo make install
# check if SQLite is installed properly
sqlite3 --version
# 3.6.14
which sqlite3
# /usr/local/bin/sqlite3

Note the new path: prefix=/usr/local, so the CLI (command line interface) sqlite3 will be accessible via /usr/local/bin/sqlite3. As sqlite is part of the core Mac, I believe it is wise not to interfere with any of the original libraries (not only CLI).

Do you know a “cleaner”, Mac OS X like (.dmg) way to restore SQLite? Please comment.

Ruby on Rails application could not be started

This is the error message, on my local machine after I upgraded to rails 2.3.2. Well, it was not an instant error, but it appeared after a while, to be more exact after I rebooted my computer.

The error:

no such file to load -- application.rb (MissingSourceFile)

As the new rails renamed application.rb to application_controller.rb, I have immediately sensed the root of the problem, so I’ve tried to

./script/server

and it worked. That means it has something to do with the Phusion Passenger.

But what? I’ve updated all the gems, and passenger was updated too.

Well, yes, but not the apache module, and not the configuration…

This is to remember: Every time, after getting a new version of Phusion Passenger via sudo gem update, I have to:

sudo passenger-install-apache2-module

and go through the setup, than edit the httpd.conf file (in my case: /private/etc/apache2/httpd.conf) and replace the old passenger configuration lines with these new ones:

LoadModule passenger_module /Library/Ruby/Gems/1.8/gems/passenger-2.1.3/ext/apache2/mod_passenger.so
PassengerRoot /Library/Ruby/Gems/1.8/gems/passenger-2.1.3
PassengerRuby /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby

Last step is, of course, to restart the apache server:

sudo apachectl restart

Now we are set to go.

I have post this article as a reminder to myself in case something similar would happen in future, and as well I hope to be useful to the readers of my blog whom might struggle with the same type of issues.

For any other tips and comments, it would be a pleasure to see you replying to this post.

Coding is fun!

The Gimp-Reflection Plugin Screencast

The gimp-reflection plugin extends the lower section of an image as a reflection of the original image with a single click, similar effects to what you see on Apple’s website, iWeb, etc.

This screencast shows you how to download, install and use the gimp-reflection plugin. Enjoy!

Example:

The original image:
photo-19

The result, after the one-click reflection filter is applied:
photo-19-gr

Easy, isn’t it?

w2task Challenge

I would like to introduce my latest project w2task – a web application written in Rails.

w2task challenge

It is a task and time management web based software. At this point, a registered user can create its own business (company) and define a series of projects. Then, the user can record its own efforts and attach them to a particular project. The sidebar (Efforts Bar) gives a quick statistic regarding the number of efforts and total timing. Also, by clicking on a particular project you may get the timesheet of the particular month.

You may well give it a try, here is the link: http://w2task.com. Don’t hesitate to tell me your opinion about it, right here as a reply to this post. You may me as harsh as you want, it is constructive and ultimately this blog is moderated :) .

Be warned, this web app is still in its early, early development stages.

To better understand the philosophy behind this application, the strength and the weaknesses of the application, allow me to tell you in few points a bit of my history with Rails:

  • January 2008 – I’ve bought my first Rails book Agile Web Development with Rails, but I didn’t have enough time to practice it that Rails, turned 2.0 and broke the compatibility with 1.x versions. I remember the headaches regarding the scaffolding, so I abandoned my Rails path.
  • May 2008 – I’ve make up my mind and bought the third edition of the above book and start again with Rails at a low pace.
  • October 2008 – my friend Hossein asked me to join in a web project with a real estate portal. I thought it is the moment to put my knowledge into practice and this his how gistate.com got wind. Ok, the real estate market is down now (dec 2008 – jan 2009), but gistate.com shines ;) .
  • November 2008 – Dubai Hacking Night – where I meet again my heroes: the SpinBits guys which encouraged me to learn Rails. I have shown to Rida a sketch of w2task (a scaffold and some CSS files) – a Ruby on Rails practicing project and he asked me to promise that I will present it on DemoCamp 4, which should be in mid January 2009.
  • December 2008 – I have closely followed 37signals blog and read their book – Getting Real. Truly inspiring, and I am thinking to copy their business model.
  • 2009 – here we are.

Wow, getting long with this post. However, for the future, I have a lot to say and I hope it will be of interest for my blog readers, as I will fly along the Rails.

Changing the MAC Address on Mac OS X

All we need is to type this in Terminal

sudo ifconfig en0 lladdr 00:00:00:00:00:01

or

sudo ifconfig en0 ether 00:00:00:00:00:01

Just change 00:00:00:00:00:01 with the MAC address we need.

It seems that for older versions of Mac OS X (prior to Tiger – OS X 10.4) we will need this patch:  http://slagheap.net/etherspoof/ .

Show hidden files on a Mac

The main idea is to edit ~/Library/Preferences/com.apple.finder.plist with Property List Editor and add a new property AppleShowAllFiles (or edit it if it already exists), of class type: Boolean, and set it’s value to Yes.

Than you must relaunch Finder. How? Hold option key wilst you are clicking on Finder’s icon from the Dock and choose Relaunch from the contextual menu.

To switch back, follow same process, but this time, AppleShowAllFiles value should be set up to No.

For command line fans, type in Terminal to show all files:

defaults write com.apple.finder AppleShowAllFiles Yes
killall Finder

or

defaults write com.apple.finder AppleShowAllFiles No
killall Finder

to switch back to the original state (do not shoe hidden files).

BTW, in a UNIX like environment, hidden files are those which are starting with a . (dot).