Mavericks is for free!

I was pleasantly surprised when I realized Apple is releasing Mac OS 10.9 Mavericks for free. That is not the only good news, Apple will be releasing iLife and iWork for free for people buying new systems.

As I see it, Apple wants all it’s customers to use the latest version of the OS. I can break down the advantages into 3 categories.

Mac guys still dislike Microsoft!

Mac guys still dislike Microsoft!

Apple is diverging into different product markets. I don’t think Apple has the manpower at its disposal to work on all the products. This year there were news around, that Apple had moved developers from OS X team to work on iOS, so that iOS releases on time.

If all or most users migrated to a fixed version of OS Apple can reduce the size of development team needed to work on support activities for older version of OS like Snow Leopard (10.6), Lion (10.7) and Mountain Lion (10.8). This would free up developers to work on development of newer products.

Apple plans to use free OS updates to coax people to upgrade to newer version of the OS.

How will it affect Apple’s bottom-line?
It will end up working out well for an Apple. Apple is a unique PC maker in that they make both software and hardware. Apple is already releasing iOS updates for free and I think there are more benefits providing free updates and Apple can manage it.

How often have you written a piece of code in ifdef‘s because your application was meant to run multiple versions of the OS. At least I have had to write it quite frequently. Cocoa is a dynamically growing Framework. Every year a new version of Mac OS or Xcode releases new API’s are added and some older ones are deprecated. More often than not most companies prefer having single code base for an application for ease of development and support. This just leaves developers without much of an option, ifdef is the only option.

Just take look at the number of people using Windows XP (release date: August 24, 2001). There have been three major OS release since Windows XP and most companies still provide support for Windows XP.

Both Windows XP and Snow Leopard have sizable market share and any developer would not want to ignore the market.

End Users
Real winner is the end-user. Imagine getting new version of the OS every other year for free!

All in all I think it is a great move. Similar to Kid Rock charging 20$ for concert tickets.

Now the pressure will be on Microsoft and other proprietary OS maker to provide free upgrades to the user! But I don’t expect them to follow suite. Microsoft is not a hardware manufacturer and cannot afford to release either MS Office suite or Windows OS for free. Personally I believe, I deserved a free upgrade from Windows Vista to Windows 7.

Opinion Poll Link


Building Froyo on Snow Leopard- Stepwise guide

I had posted a blog for “Building Froyo on Snow Leopard” previously and at that time I didn’t face any problems building Froyo but it looks like few make files have changed now. So I am writing this post as an update to my previous post.

Before starting on this, I would like to thank Tomas Isdal and andferno.

So I will note down all the steps involved in building Froyo on Snow leopard. You can refer android get source page for information. I have referred it for few of the steps involved in building android.

Step 1
Create a new partition that is a case-sensitive partition if you’re using a case-insensitive primary partition. You can refer to this for more info.

Step 2
You would also have to install Xcode 3.2 and 10.4 SDK. Xcode can be found in the installation disc. It can also be downloaded from Apple developers connection. Refer the attached image.

Xcode installation Option

Step 3
Install Macports. There are two ways of doing so.
i. Download the source from this link and untar the file. Run the following commands
sudo make install

ii. My preferred method is to download the DMG from here. I used MacPorts-1.8.2-10.6-SnowLeopard.dmg from the list.

Step 4
Make sure that /opt/local/bin is in your path before /usr/bin by running

echo $PATH

If you don’t see /opt/local/bin, edit $HOME/.bash_profile and add the line
export PATH=/opt/local/bin:$PATH
(or the equivalent for other shells) after any other PATH-related lines. To verify that your path is now correct, open a new terminal and run echo $PATH again.

Step 5
Get the following packages from port:
POSIXLY_CORRECT=1 sudo port install libsdl git-core gnupg

NOTE: Restart the terminal

Step 6
Set an appropriate per-process file descriptor limit. To do this, add the following lines to your .bash_profile file:
# set the number of open files to be 1024
ulimit -S -n 1024

Step 7
Now check out the Froyo Source code to the case-sensitive partition created in step 1, please refer android get source page for more information.

Step 8
Snow leopard doesn’t have Java 1.5, it has Java 1.6. Since Leopard has Java 1.5 this step can be skipped on Leopard. On Snow Leopard we have two options.

i. Changing Android make file to build with Java 1.6.
Open “build/core/” and search for “grep ‘[ “]1\.5” and change that “5″ with a “6″. You will find it repeated two times. This trick was suggested to me by andferno.

ii. Install Java 1.5 on Snow Leopard.

curl -o java.1.5.0-leopard.tar.gz
tar -xvzf java.1.5.0-leopard.tar.gz
sudo mv 1.5.0 /System/Library/Frameworks/JavaVM.framework/Versions/1.5.0-leopard
cd /System/Library/Frameworks/JavaVM.framework/Versions/
sudo rm 1.5.0
sudo ln -s 1.5.0-leopard 1.5.0

We have to set Java preferences. You can either manually open “Java” or use terminal and type

open /Applications/Utilities/Java\

Change the preference to as shown in the image below. You would have to drag and drop different Java version to change the preference.

Setting Java Preferences

NOTE: Restart the terminal

Building the source and resolving errors
Build the source.

make -j2

You might face the following error first.

host C++: emulator-elff <= external/qemu/elff/
In file included from external/qemu/qemu-common.h:15,
from external/qemu/elff/elf.h:22,
from external/qemu/elff/elf_defs.h:20,
from external/qemu/elff/dwarf_defs.h:22,
from external/qemu/elff/dwarf_die.h:20,
from external/qemu/elff/elf_file.h:20,
from external/qemu/elff/
/Developer/SDKs/MacOSX10.4u.sdk/usr/include/stdarg.h:4:25: error: stdarg.h: No such file or directory
In file included from external/qemu/elff/dwarf_die.h:21,
from external/qemu/elff/elf_file.h:20,
from external/qemu/elff/
external/qemu/elff/elf_alloc.h: In static member function ‘static void* DwarfAllocBase::operator new(size_t)’:
external/qemu/elff/elf_alloc.h:156: warning: ‘operator new’ must not return NULL unless it is declared ‘throw()’ (or -fcheck-new is in effect)
make: *** [out/host/darwin-x86/obj/STATIC_LIBRARIES/emulator-elff_intermediates/elff/dwarf_cu.o] Error 1

To fix this error go to “external/qemu/” and open “” file and change the following line

iMY_CFLAGS += -mdynamic-no-pic


MY_CFLAGS += -mdynamic-no-pic -I /Developer/usr/lib/gcc/i686-apple-darwin10/4.0.1/include/

Continue with the build process again and you are likely to come across following errors

In file included from external/v8/src/macro-assembler.h:87,
from external/v8/src/jsregexp.h:31,
from external/v8/src/ast.h:33,
from external/v8/src/compiler.h:31,
from external/v8/src/
external/v8/src/arm/assembler-arm-inl.h: In constructor ‘v8::internal::Operand::Operand(const char*)’:
external/v8/src/arm/assembler-arm-inl.h:165: error: cast from ‘const char*’ to ‘int32_t’ loses precision
external/v8/src/arm/assembler-arm-inl.h: In constructor ‘v8::internal::Operand::Operand(const v8::internal::ExternalReference&)’:
external/v8/src/arm/assembler-arm-inl.h:172: error: cast from ‘v8::internal::byte*’ to ‘int32_t’ loses precision
In file included from external/v8/src/macro-assembler.h:87,
from external/v8/src/ic-inl.h:33,
from external/v8/src/
external/v8/src/arm/assembler-arm-inl.h: In constructor ‘v8::internal::Operand::Operand(const char*)’:
external/v8/src/arm/assembler-arm-inl.h:165: error: cast from ‘const char*’ to ‘int32_t’ loses precision
external/v8/src/arm/assembler-arm-inl.h: In constructor ‘v8::internal::Operand::Operand(const v8::internal::ExternalReference&)’:
external/v8/src/arm/assembler-arm-inl.h:172: error: cast from ‘v8::internal::byte*’ to ‘int32_t’ loses precision

This may not be the only precision error you may get. If you come across any errors like “error: cast from ‘abc’ to ‘xyz’ loses precision

Do the following. Open “build/core/” file and search for the following text.

PREBUILT_IS_PRESENT := $(if $(wildcard prebuilt/,true)

and replace the above text with following text.

PREBUILT_IS_PRESENT := $(if $(wildcard prebuilt/,true)

ifeq ($(HOST_OS),darwin)
HOST_GLOBAL_CFLAGS += -arch i386

Again continue the build process and you are likely to come across following error

host C: acp <= build/tools/acp/acp.c
host C++: libhost <= build/libs/host/pseudolocalize.cpp
host C: libhost <= build/libs/host/CopyFile.c
build/libs/host/CopyFile.c: In function ‘copyFileContents’:
build/libs/host/CopyFile.c:124: warning: format ‘%d’ expects type ‘int’, but argument 4 has type ‘ssize_t’
build/libs/host/CopyFile.c:124: warning: format ‘%d’ expects type ‘int’, but argument 5 has type ‘ssize_t’
host StaticLib: libhost (out/host/darwin-x86/obj/STATIC_LIBRARIES/libhost_intermediates/libhost.a)
ar crs out/host/darwin-x86/obj/STATIC_LIBRARIES/libhost_intermediates/libhost.a out/host/darwin-x86/obj/STATIC_LIBRARIES/libhost_intermediates/pseudolocalize.o out/host/darwin-x86/obj/STATIC_LIBRARIES/libhost_intermediates/CopyFile.o
host Executable: acp (out/host/darwin-x86/obj/EXECUTABLES/acp_intermediates/acp)
ld: warning: in out/host/darwin-x86/obj/EXECUTABLES/acp_intermediates/acp.o, file is not of required architecture
ld: warning: in out/host/darwin-x86/obj/STATIC_LIBRARIES/libhost_intermediates/libhost.a, file is not of required architecture
Undefined symbols:
"_main", referenced from:
start in crt1.10.6.o
ld: symbol(s) not found
collect2: ld returned 1 exit status
make: *** [out/host/darwin-x86/obj/EXECUTABLES/acp_intermediates/acp] Error 1

To fix this error open “” present in “build/core/combo/” and find the following strings.

-dynamiclib -single_module -read_only_relocs suppress \

and add the following strings after the above string.

) \

Find the following strings

-Wl,-dynamic -headerpad_max_install_names \
$(call normalize-target-libraries,$(PRIVATE_ALL_SHARED_LIBRARIES)) \

and add the following strings after the above string.

) \

Start the build again and watch it fly. Feel free to revert back in-case of any queries.

Silly Me

There is something special about Monday mornings. For starters I don’t really feel like working and secondly I hardly remember any work I had done the previous week. Break of two days clears my mind.

Monday mornings are a new beginning forgetting the failures of the previous week and starting up new. I don’t like to keep any work pending over the weekend. But there are times when this can’t be done. The ghosts of my previous week come back to haunt me. What I am writing now was one of those experiences.

It was another lazy Monday morning and as usual I was late to office, I met my manager who assigned me work for the entire week and I came back to my cubicle to start-up with the assigned work.

I have two machines in my cubicle one is a Dell machine running Linux OS and the other a Mac mini running Macintosh(Snow Leopard). I know it sounds stupid “a Mac mini running Macintosh” but trust me when I say I have seen people using Windows XP on Mac book Pro and also I am sorry Apple fan boys, I don’t use my Macintosh machine a lot! I am currently hooked on to Linux(Ubuntu). I usually start my day by checking my mail on my Linux machine. So first think I did was to check my official mail and then I tried to open Gmail page and I got the following error.


A shocker


I saw the error code “sec_error_expired_certificate” which mean that the certificate has expired. This actually makes sense but I know you would agree with me when I say, it is very hard to believe that Google hasn’t renewed their certificate. Then I happen to read the description “The certificate will not be valid till until Friday 18 December 2009 05:30 AM”. Holy cow! that day was 23 August 2010! Add to that the error message and the error code were contradictory to each other. I have seen Windows XP display such contradictory messages but never expected Firefox to follow Microsoft’s lead.

Since I had worked a bit on internet security related stuff, the first thing I did was to check the certificate.


Tried to make some sense of the certificate


Firstly I have a confession to make, the private and the public keys don’t really make any sense to me! The only thing that made sense was the date which seemed alright. So my conclusion was that, there was no problem with the certificate and this entire issue had something to do with my system. Although I love using Linux I don’t trust the OS completely. After all it’s a software and all software’s have bugs!

And since I couldn’t think of anything, I switched on my mac mini and connected to the Gmail page using Firefox. The page loaded without any issues.

I stared at my monitor with my mouth open and it was at this moment I felt like being hit by a lightning. I checked my Linux machine and did a change and Gmail was up and running on my Linux machine.

Okay, now it’s time to unlock the mystery. The lightning was actually the moment I remembered that I had changed the time and date settings of my Linux machine last week for a silly reason.

The reason

My silly reason : I wanted to fake the modified time of a file, so that I could fool my colleague(I am not telling who it is.). As they say “I was impaled by my own sword”.

New Rupee Symbol of Indian – How to use it in Computers.

You can download the Rupee_Foradian font file from Rupee_Foradian.ttf

Installing and using on Linux

1. Copy Rupee_Foradian.ttf file to /home/Home_Name/ .fonts/ (create this directory, if not exists)
2. Open any word process applications (like open-office, Thunderbird etc), choose “Rupee Foradian” from the drop down box of fonts (If it was already open, restart the application).
3. Press the key just above the Tab button (with “~” symbol) to get the rupee symbol (`)

The button to press

Installing and using on Windows

1. Copy Rupee_Foradian.ttf file to OSDrive:/Windows/Fonts. Normally it would be “C:/Windows/Fonts”. When you paste the file to this location, OS would display say that it is installing the font.
2. Open your word processor and select the “Rupee_forindian” (If it was already open, restart the application).
3. Press the key just above the Tab button (with “~” symbol) to get the rupee symbol (`). Refer the previous image

Installing and using on Macintosh

1. Copy Rupee_Foradian.ttf file to /System/Library/Fonts if all the users need to use it and for a single user it should be /Users/Home_Name/Library/Fonts
2. Open your word processor and select the “Rupee_forindian” (If it was already open, restart the application).
3. Press the key just above the Tab button (with “~” symbol) to get the rupee symbol (`). Refer the previous image

NOTE: Since it is a true type font am not sure whether it will work on Tiger(10.4) version of Macintosh. There shouldn’t be any problems in Leopard(10.5) and Snow Leopard(10.6) version of Macintosh.

It's working!

The images and Windows OS installation is thanks to Joanne Debrass and Linux OS installation is thanks to Satheesh Prabu.

NAN (Not a number)

This post basically deals with C++ and NaN. NaN(Not a Number) is a value of numeric data type representing an undefined or unrepresentable value, especially in floating-point calculations.

I picked this list up from the wiki page.
Different representation of NAN


I have come across NaN and NaN% on Macintosh. I had seen NaN% on 10.4(Tiger) when I had my calculation go bad and ended up dividing a number by zero. That code was written in C++. Recently I saw NAN while debugging a piece of code written in JavaScript, this was on 10.6(Snow Leopard). So most probably representation of NAN has something to do with the operation performed or may be Apple has changed the representation of NAN in Snow Leopard

I had spent few days working on an interface to Web-kit. Where in I was receiving data provided by the java-scripts running on web-kit. I came across the NAN problem.

The code :

var valueInField= parseInt(document.getElementById(“field”).value);
var value = set(valueInField);

Now if the input value to “field” is a string and “parseInt” would convert the value into NAN. Although Nan stands for Not a Number it is represented as floating point number, so my checks went for a toss.

While looking for fix I came across a method defined in math.h for NAN checks.


This function is part of C99, it may not be available everywhere.

According to the IEEE standard, NaN values have the odd property that comparisons involving them are always false. That is, for a float f, f != f will be true only if f is NaN.

So I wrote a piece of code

if (float_val != float_val)

I didn’t have to use this check extensively, but if it has to be done many times it would be good to use it as an inline method

inline bool isnan(double x)
return x != x;

Viusal C++ does not provide neither std::isnan nor std::tr1::isnan, but it provides an extension function defined as _isnan().

On Xcode(Macintosh) it is a little confusing, it not only provides std::isnan but also provides __inline_isnand()(on Intel machines) and __isnand()(on Power PC). Read these post for more clarifications post 1 and post 2.

On Arjun’s request:

I have attached the image showing Nan. The code was debugged using Firebug plug-in for Firefox web browser.

Building Froyo on Snow Leopard

There have been few changes in Froyo source code since this article was posted. Please Refer to this page for issues and solutions related to building Froyo on Snow Leopard.

My efforts of building Froyo on my Snow Leopard turned out to be a bit of anti-climax. I anticipated lots of errors but mercifully Android team has pulled up its socks, there weren’t any error. Bharat did the building on Linux and he had no issues either.

But I do have a complain, Froyo uses java 1.5 and not java 1.6. Android should move on to newer version of java. Anyway complains apart let me put down the steps.

I would like you to read my previous blog on building Building Eclair on Snow Leopard. There are 13 steps in that blog. Follow all the steps other than step number 4.

Once you have done that type
. build/
make -j2 sdk
and watch it fly.

I have attached few of the snap shots.

Up and Running


Oops camera crashed!!!!!

The camera crashed on both Linux and Macintosh. I have been told by a friend that it was crashing on the sdk released earlier.

Wow!!! Hindi, can't wait for other Indian languages to make it

Language : Hindi. But we still need Hindi strings for it.

I hope somebody puts in Hindi strings for Settings applications. I can’t tell much about performance since I was using the emulator.

Hopefully next release moves to Java 1.6 and we would actually have full pledged support for Hindi and other Indian languages.

Snow Leopard Finder error 1407

I got this funny error yesterday. I had a zipped file of size 2.89 GB and the unzipped version of the file which was 9.3 GB.

I tried deleting the both file and each time I got the same error. I have attached the image below

Error on deletion

I tried deleting one of the file from Terminal and fortunately I was able to delete the file. I checked the forums for any reason for this issue but couldn’t find any valid reason.

In my case I restarted the machine and things were back to normal. But even after restart if you are not able to delete files try using Disk Utility to repair permission on the partition.

If you are in some kind of hurry Terminal should be good enough. Just do


(You can just drag and drop the folder on to the terminal after typing “rm -rf “)

The similarities between all the issues I found on web(related to this) were that it occurs on driver not formatted in “HFS+ Case-insensitive”. My file system was “HFS+ Case-sensitive”, it looks like apple has a bug to fix.