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! :)

21 August 2011

Ё-моё! / Where is my Ё?

Как вы поняли, на американском MacBook'е нет буквы "Ё" =)
Чтобы ее добавить я слегка изменил в программе Ukelele существующую русскую раскладку, которую я взял в <ukelele_dir>/System Keyboards/Cyrillic/Russian.keylayout. Итоговую раскладку и иконку к ней можно взять тут:
Скачанные файлы надо кинуть в /Library/Keyboard Layouts и перезагрузить компьютер. После этого откройте System Preferences | Language & Text | Input Sources и добавьте новую раскладку, которая называется "Russian With Yo On Tilda", в набор используемых раскладок.
Всё, наслаждайтесь великим и могучим на полную катушку!

The above is Russian specific problem.The US MacBook's Russian keyboard layout has no letter "Ё" which is loved by my =)
To solve the problem I've used application Ukelele what allows to create custom keyboard layouts. You can download my layout and its icon using the links:
Put downloaded files into /Library/Keyboard Layouts and restart the computer. After it open System Preferences | Language & Text | Input Sources and add new layout named "Russian With Yo On Tilda" to active layouts set and release all the power of Russian! ;)

The AppStore freezes forever during the application installation

I had the following problem: when I click the "Install" button (for any app) in AppStore the AppStore freezes forever. The solution was to enable the Spotlight itself (that was disabled by me in the very first days of using MacBook) and then restart AppStore. If the solution doesn't help, check that primary HDD is not excluded from Spotlight index (check it via System Preferences | Spotlight | Privacy).
Thanks to this article for saving hours in troubleshooting.

15 August 2011

Unresolved: How to enable WiFi channels above 11 on US MacBook Pro

The next (still) unsolved issue for me is how to enable channels 12-13 on my US MacBook Pro (early 2011 model) with Snow Leopard 10.6.8. The problem is because I bought my MacBook in US where the WiFi channels above 11 are banned but now I'm living in Russia where the channels 12 and 13 are allowed and (thanks God not very widely) used. I've googled for several evenings but can't find the solution. Damn it. It's double strange because my US iPad works just fine in Russia so I couldn't imagine the ability of any problems with WiFi on more expensive and mature device like MacBook. I'm still in research.

14 August 2011

How to Reininstall Xcode on Snow Leopard?

I am (mostly happy) Mac OS X 10.6 aka Snow Leopard user. Several days ago I've decided to reinstall Xcode 4.0.1 because the AppStore shows me that the update is available but updating has failed every time with message "You have updates available for other accounts. Bla-bla-bla" (It was my first "Sorry, what?"). Of course, my account is correct and couldn't be "other": I use only one account for a year both for iPad and MacOS. So from my Windows experience I've decided that reinstalling of Xcode will give me the update and solves the problem with "other" account.

The second "Sorry, what?" was when I can't find the "Uninstall" button in AppStore. OK, thanks Google, I got the receipt:
sudo /Developer/Library/uninstall-devtools --mode=all

The program has done its work and I go to AppStore and find that Xcode is still installed. WTF!? I reboot the MacBook but nothing changed. OMG! Let's continue.

Google is my friend. There are a lot of people with the same problem. And so many solutions. One worked for me:
  • sudo rm /var/db/receipts/*Xcode*
  • Remove /Applications/Install Xcode.app completely (Zip it for backup purposes, because due to periodical AppStore problems it can became impossible to download Xcode) and remove the original).
  • Restart the AppStore.
After this I can successfully install the newest Xcode.

UPDATE: Apple team had fixed the problem very well. I've updated Xcode 2 or 3 times more and get no one problem with it. Thank you guys!