Tech

Exporting iPhone contacts on Mac

This seemed simple at first but wasn’t very obvious when I tried using iTunes. I had iCloud enabled which meant that I was not able to sync my iPhone contacts with my Mac Address Book. So, I switched off Contacts in the iCloud settings on the phone. Next I connected the iPhone, and via itunes, hit on Sync Contacts. This brought all the contacts into the Address Book.

Next, I exported all the contacts as a vCard file.

Then, logged into Gmail, and selected the ‘Contacts’ section. Used the import feature, supplied the file path, and saw that all contacts appeared.

Since I upgraded to an HTC Titan Windows Mango phone, logging into Gmail on it and syncing, automagically brought in all the contacts from Gmail into the new phone. And I was all set.

Took some time before I could figure all this out. iTunes+iCloud is not very straightforward when it comes to simple things.

Advertisements

Reactive Documents

Recently, I came across Bret Victor who wrote about an idea about Reactive documents – that is web articles that a reader may be able to interact with. An example would be a user being able to change the numbers and analyze an article about environmental effects of coal, if it contains statistics about the number of coal factories, the amount of pollution caused by them etc. One will be able to modify numbers inline in these documents, plot charts and be able to verify assumptions and results mentioned.

It seemed like a great idea to me where a reader is able to check whether the author has really put in the effort to bring in authentic arguments in the article. Basically, it will help the reader understand the material better, and challenge any assumptions made. Also this technology would help benefit students a lot as they usually read statistically oriented articles, and interacting with such stats comprehensively will enhance their understanding of the topic.

He also has written a Javascript library that a user may include on their site, and allow readers use the ideas mentioned above.

For more details, visit his project called Ten Brighter Ideas.

Innovation or Imitation

I have always thought that the Indian software industry must become more product-oriented rather than service, as going forward making stuff is going to help us stand on our own feet. Majority of our firms today do maintenance of products that have been created elsewhere and need looking-after for customers. I came across as article that talked about Indian entrepreneurs who have jumped into the product bandwagon and it seemed encouraging. The article Indian Product Entrepreneurs: Your Time Has Come mentions some products like Zoho that seem to be counterparts to products already present in the market, but are much cheaper. So it looks like people have made their own versions of existing products, with a few improvements and are able to sell them at lower prices largely because the development cost is lower in India. Some would say we are just ripping off existing products, but that argument might not hold good if we make those systems better, for example Facebook came after Orkut and MySpace but it was way better, thus it caught on. Having said that, more importantly we need to build things that are really innovative going forward, now that we have experienced professionals in our ranks too. We must use the price advantage, no doubt, but also think long term to create something disruptive.

Rails and Postgresql on Mac Snow Leopard, Heroku

I was looking to use Sphinx which is a search plugin for Rails but requires Postgresql as the database containing the data to search. Since I have been using Sqlite3 on my development setup, this meant making a shift into the Postgres world. Installing it was pretty straightforward on the Mac.

1. Install Mac ports. This utility is similar to ‘apt’ on Debian or ‘yum’ on RedHat. After installing, run ‘which port’ to see that it was successful.

$ which port
/opt/local/bin/port

2. Using Mac ports, install postgresql 8.4 using the following:

sudo port install postgresql84 postgresql84-server

3. Make a location for a default database

$ sudo mkdir -p /opt/local/var/db/postgresql84/defaultdb

4. Make its owner as user ‘postgres’

$ sudo chown postgres:postgres /opt/local/var/db/postgresql84/defaultdb

5. Run ‘initdb’ to initialize it once

$ sudo su postgres -c '/opt/local/lib/postgresql84/bin/initdb -D \
/opt/local/var/db/postgresql84/defaultdb'

6. To make it run always, enter

sudo launchctl load -w /Library/LaunchDaemons/org.macports.postgresql84-server.plist

7. Start the db server using:

sudo launchctl start org.macports.postgresql84-server

8. Create a user called ‘postgres’ using your system admin username:

createuser --superuser <admin_username> -U postgres

9. Now try creating and removing a db to test if everything worked:

createdb temp
psql temp - this should take you into a db sql prompt
dropdb temp

10. Now install the ‘pg’ gem which acts as an adapter between your Rails app and the postgres db. The best way to install is to include it in your Rails app’s Gemfile and run ‘bundle install’.

11. Next, create a new app temporarily in order to know the format of your new database.yml file for the postgresql db that will be created.

rails new temp_app -d postgresql

Open and view the ‘config/database.yml’ file. Take a back up of your sqlite3 database.yml and copy this newly created file to your Rails app into ‘config/’. Change the username and database names accordingly as it would be set to ‘temp_app’ and ‘temp_app_development’. Other values can stay the same.

12. Create the database with the name you set in the above database.yml file

createdb myapp_development

13. Now run ‘rake db:migrate’ to create the tables according to the schema.rb file. This will create the same tables as your sqlite3 database in the new postgres database.

14. If your sqlite3 db has data, get its dump using:

sqlite3 db/development.sqlite3 .dump > sqlite3-db.dump

15. I read somewhere that one should be able to import this dump into the postgres database but that did not work for me. A simple script should be able to run the ‘INSERT’ commands listed in the dump file into your new postgres db (psql into the db, run INSERT commands). Make sure that you use single quotes around any numbers that are present in the sqlite3 dump data, such as IDs. You might also have to make sure your IDs are unique.

16. Restart your app and now your new data should be getting inserted into the Postgres database.

17. If you use Heroku, then push in all the changes to the files. Then, run the following:

:myapp$ heroku rake db:migrate

Install the gem ‘taps’ that will allow pushing your local data to the Heroku server (which will now also use Postgresql!)

:myapp$ heroku db:push

Done!

PS: If you see a segmentation fault issue upon access to the Postgres database, then set the following env. variable:

export RUBYOPT='-r openssl'

Techcrunch Disrupt SF 2011

Nice bunch of companies pitched at TC Disrupt SF. Some that I really liked:

1. Trello – Great interface for a team to divide tasks and see who’s doing what. Reminds you of Google Wave, but a really simple easy to use interface, that can be used by non-software development teams as well. And its free!

2. Vocra – Always had this idea, and I’m glad to see it happen. Speak in the language you know and it speaks out in a language you would like to communicate in. What an awesome way to talk to people in a foreign country!