20 October 2011

The Dark Side of Speed Dial Add-On (Firefox)

I'm using Firefox browser on my both Mac and Windows machines and get the significant slowness in address bar search (or address bar suggestions) for last few months. At first I thought it's because Places DB is too fragmented. But at some forum I found the advice to remove Speed Dial extensions. Hm, let's check. Wow! I was really amazed how quickly address bar has started to work without it.

So guys if you have problems with speed of address bar search, first check you aren't using Speed Dial add-on.

19 October 2011

Installing CouchDB and GeoCouch from Sources on Mac OS X

The installation of CouchDB and GeoCouch from sources are very simple. There are many options how to install it but here I will describe the simplest one and the most suitable for a single developer who need a local CouchDB installed (IMHO, of course).

Install HomeBrew

"Homebrew is the easiest and most flexible way to install the UNIX tools Apple didn't include with OS X." – tells us the HomeBrew homepage. It's just true :)
To install HomeBrew follow the steps from HomeBrew's Installation Guide. It's really simple.

Install CouchDB

Use the power of brew:
brew install couchdb

Now you can run couchdb manually with couchdb command.

If you need to run CouchDB automatically on login, run brew info couchdb and do what described.

If you need to run couchdb as daemon with it's own credentials, see CouchDB Installing on OSX.

Test installation

Run CouchDB.
Go to CouchDB's web UI (aka Futon), open "Test Suite" from "Tools" and run all tests.

Install GeoCouch

Get CouchDB Sources

Brew has downloaded the source bundle for us. Let's locate the bundle:
ls `brew --cache`/couch*

Create a directory and unpack source bundle to it:
mkdir couchdb-src
cd couchdb-src
tar --strip-components 1 -zxvf <couchdb-source-bundle-path>
cd ..


Get GeoCouch Sources

Find CouchDB version installed:
brew info couchdb

Checkout GeoCouch code from GitHub. It's important to checkout the right branch depending which CouchDB version you have. Most probably it's CouchDB 1.1.x so you need to checkout the couchdb1.1.x branch:
git clone -b couchdb1.1.x git://github.com/couchbase/geocouch.git
cd geocouch


Build and Install GeoCouch

Build GeoCouch:
export COUCH_SRC=<couch-src-path>/src/couchdb
make


Copy config file:
cp etc/couchdb/local.d/geocouch.ini /usr/local/etc/couchdb/local.d/

Copy test files (change CouchDB version number if needed):
cp share/www/script/test/* /usr/local/Cellar/couchdb/1.1.0/share/couchdb/www/script/test/

Register tests in /usr/local/Cellar/couchdb/1.1.0/share/couchdb/www/script/couch_tests.js (add somewhere in the end of file):
loadTest("spatial.js");
loadTest("list_spatial.js");
loadTest("etags_spatial.js");
loadTest("multiple_spatial_rows.js");
loadTest("spatial_compaction.js");
loadTest("spatial_design_docs.js");
loadTest("spatial_bugfixes.js");


Run CouchDB with GeoCouch

export ERL_FLAGS="-pa <geocouch-path>/build"
couchdb


If your CouchDB is started at login, add to your org.apache.couchdb.plist file (most probably it's inside ~/Library/LaunchAgents/) the following settings:
<key>EnvironmentVariables</key>
<dict>
...
<key>ERL_FLAGS</key>
<string>pa <geocouch-path>/build</string>

</dict>


Note that <geocouch-path> should be absolute and without using of '~'.

Test installation

Start CouchDB as described one step above. Don't forget to specify path to GeoCouch modules or CouchDB will fail on start.
Go to Futon, open "Test Suite" from "Tools" and run all tests or at least "Spatial" and following tests.

Read more about installing/using of GeoCouch.

15 October 2011

C++0x Is Here!

Finally, Xcode 4.2 brings C++0x to all of us. Yes, I know that there is C++11 already, but clang compiler shipped with Xcode supports only some (huge) part of C++11 so it's still a kind of C++0x :). This was a good news. The bad one is that the appropriate C++0x STL is available only for happy Lion users. They get the brand new LLVM's libc++ library with about 98% of C++11 supported. But sad Snow Leopard's users get the only error "clang: error: invalid deployment target for -stdlib=libc++ (requires Mac OS X 10.7 or later)".

The main joke is that clang from LLVM's trunk builds c++0x code with using libc++ library without this error. So I'm going to replace Xcode's clang with the LLVM's latest one. Probably it saves me from moving to Lion. Although, Lion becomes more and more interesting every day! :)