Invalidating Preferences Cache in Mavericks (OS X 10.9.x)

I recently set up a fresh install of Mavericks (OS X 10.9), and copied over some of preferences (plist) files from old installation to new box ( (~/Library/Preferences).

I noticed, applications failed to use (manually copied) preferences files, instead kept throwing errors (like one shown below):

cfprefsd[xxxx]: CFPreferences: error renaming file /Users/username/Library/Preferences/com.codeux.irc.textual.plist.bPsEnTV to /Users/username/Library/Preferences/com.codeux.irc.textual.plist

Unlike previous versions of OS X, Mavericks (OS X 10.9) caches preferences files. That means, if we edit or overwrite a preferences (plist) file, we need to invalidate the cache so that applications can see the changes, and start using this updated preferences file.

I didn’t want to set up everything from scratch, in this case all IRC servers, nodes and chatrooms. It is not fun editing binary plist files, even with the help of XCode :-)

To fix this problem, we need to run this from terminal:

defaults read ~/Library/Preferences/com.codeux.irc.textual

We also need to make sure preferences file has correct permission. In my case, permissions were messed up because I copied file from different disk (installation).

Permission should look like following (i.e. owner can at least read/write; umask 077):

-rw-------

I would suggest restarting the respective application, if it is already running.

Amazon Cloudfront – Video Streaming (rtmp) Issue?

Are you using Amazon Cloudfront for public/private video streaming over rtmp? Having trouble to figure out why some of your videos fail to stream (over rtmp) and throw ‘Stream not found’  flash/actionscript client side errors?

I have figured out:

  • Videos with invalid chapter markers would not stream over rtmp (Adobe Flash Media Server) or via Cloudfront.
  • Adobe’s FLVCheck utility suggests our videos have invalid chapter markers. I am not sure, if chapter markers in our videos are invalid or Adobe Media Server expect those to be in different format.
  • Same set of videos play fine with Quicktime/VLC player, Adobe Flash Player (over http progressive download) and html5 player (chrome or others which support H.264 videos)

I am disappointed with the fact – Adobe Media Server ceases to play (core feature) a video because of (optional feature?) chapter marker(s) which can be ignored if it is corrupt or invalid.

Thanks to AWS engineers who confirmed the case, and provided more details.

Update: Thanks to Justin Riley for sharing a solution (in comments below). He suggested to use ‘-map_chapters -1′ to get rid of this issue. It works for me.

We’re Hiring Developers!

We have been working on bunch of products (indiereign.com, and others) for sometime. To take these products to next level, quickly and elegantly, we have recently started expanding our team.

We are starting our new development centre in Noida. We want to connect, talk to and hire smart and passionate developers (hackers) who love to work on products in a small company or a startup (like ours).

We are looking for:

  • bright and smart guys
  • one who can fit in our (small team/company/startup) culture, and becomes a great team player
  • can learn, adapt and use cutting/bleeding edge technologies
  • can inspire and mentor others
  • importantly, loves building cool, useful and scalable products/services

Experience, we would like to see:

  • Application Developer
    • Proficiency with web standards and frontend (HTML5, CSS3, JavaScript, etc.) development
    • proficiency with one ore more languages (Python, Ruby, PHP, Scala, etc.)
    • proficiency with analytical approach to problem solving
    • has worked or very interested to work on other frameworks (Django, Rails, Symfony, etc.)
  • Mobile Application Developer (iOS or Android or both) - apps/games development;

Details description can be found at http://jobs.hasgeek.com/at/allies.co.in

We are not rigid about number of years (of experience). We think experience comes out of depth, challenges one has taken, and how many great problems one has solved over the time. If someone has all that, we are happy to talk to him/her.

If you are interested or know someone who is good fit; I would appreciate, if you can connect with me (aqabiz at allies.co.in) and share details.

Installing NumPy and SciPy on Mac OSX 10.8 (Mountain Lion)

I am playing with ExpEyes, which is awesome tool for anyone who wants to learn electronics (and physics).

ExpEyes comes with software (written in python) for GNU/Linux and Windows. I intend to run it on Mac OSX, because it can (provided all dependencies are met).

It is generally easy to install python packages on OSX using easy_install or pip, however, installing NumPy and SciPy turned out to be pain on OSX (10.8.2, latest version the time of posting).

In my case, I am using python binary installed via homebrew, so I can’t take advantage of numpy (which comes installed with mountain-lion).

I have XCode 6 installed, which comes with gcc-4.2.1 (llvm build). I figured out, I can build numpy and scipy from source.

Following is what I did to build numpy and scipy. SciPy requires gfortran, so that has to be installed (I used homebrew to do that):

$ git clone https://github.com/numpy/numpy.git
$ git clone https://github.com/scipy/scipy.git
$ cd numpy
$ python setup.py build && python setup.py install
$ brew install gfortran
$ cd ../scipy
$ python setup.py build && python setup.py install

BTW! In case, you are wondering, why didn’t I use Scipy Superpack script, which indeed makes job easier?

I didn’t, because I want to install gnu/unix packages using homebrew, and I already have git and other things. Super Spicypack downloads (gfortran, etc.), builds and installs packages directly to system, making it harder to remove those later? Homebrew makes job easier.

Update: Whereabouts

Just in case, you still follow this blog and wondering about me? I thought, it would be fair to leave some details on that.

  • In Kanpur (my hometown)
  • spending most of time on (or around) IndieReign,
  • learning electronics and trying to build something,
  • yet to grow to team, because it is hard to find and get right ones :-)
  • still does ActionScript, mostly for fun stuff,
  • might start blogging again; got so much to talk about, and share.

Mac OSX (10.8) Mountain Lion: Fixing Apache, PHP, Subversion, User Sites, Virtual Hosts Directories

While Mountain Lion (OSX 10.8) has brought many enhancements and fixes (mostly performance), it has also caused frustration to old users.

You might have noticed following issues in Mountain Lion:

  1. Web Sharing Preferences Panel has been removed, i.e. you need to launch apache manually or write some launch-agent script or hack to bring web-sharing preferences panel back
  2. User Sites (per-user web directories) is disabled, i.e. http://localhost/~username doesn’t work by default, and you need to modify apache config file to enable it
  3. PHP extension for Apache is disabled by default i.e. you need to enable it by modified apache config (httpd.conf)
  4. Subversion is not installed by default, either you can install using homebrew or by install XCode command line tools

You can fix these issues (1-4) by following these two links:

Whenever I upgrade to newer version of OSX, I end up with broken development-setup i.e. custom permissions on directories are messed up, configuration files are overwritten/removed, etc.

I think, I have found a way to keep default directory permissions, so future upgrades don’t break things.

My development setup requires my virtual hosts to use directories within my home-directory (and outside of ~/Sites or /Library/WebServer/Documents directories).

I am using following technique to setup my virtual-hosts:

  • Enable User Sites  (i.e. fix #2 problem above)
  • Create symbolic-links(symlinks) of your project folder(s) inside ~/Sites directory
  • Enable FollowSymLinks and SymLinksIfOwnerMatch options in virtual-host configuration.

In my case, I have a project inside ~/projects/myproject . I create a symlink of this directory inside ~/Sites, like this using Terminal (command-prompt)

$ ln -s ~/projects/myproject ~/Sites/myproject

I have following virtual-host configuration for this project:

<VirtualHost *:80>
 DocumentRoot "/Users/myusername/Sites/myproject/trunk/web"
 ServerName  myproject
 ServerAdmin myusername@localhost
 Options Indexes MultiViews Includes +FollowSymlinks +SymLinksIfOwnerMatch
 CustomLog "/private/var/log/apache2/myproject_access.log" common
 ErrorLog "/private/var/log/apache2/myproject_error.log"
</VirtualHost>

I use it on my development machine (i.e. my laptop), so I don’t really bother about security at Apache level, and I take care of security at firewall/other levels.

If you are going to use above technique/configuration, please understand everything (by reading documentation) before you use it.

This set up works for me and solves some problems for me – I don’t have to change default directory permissions, and I don’t have to keep my projects within ~/Sites or /Library/WebServer/Documents directory.

RIP, Kenneth Gonsalves “KG” (1953 — 2012)

Kenneth Gonsalves(Image Courtesy: Linux Bangalore (foss.in))

Kenneth Gonsalves, a champion in Indian (NRC)FOSS, Python and Django community passed away on August 3, 2012. Kenneth’s presence would be hugely missed in the community.

In 2008, Tarun Dua introduced me to Kenneth. I interacted with him at various occasions about NRCFOSS and general stuff. I was very inspired to see his contributions, specially some of his open-source projects.

While checking out NRCFOSS website today, I came to know about this sad news.

May his soul rest in peace.

RIP Dennis Ritchie (DMR), 1941 — 2011

Dennis Ritchie - Creator of C programming-language, and co-inventor of UNIX(Image Courtesy: WikiMedia)

Dennis Ritchie passed away couple of days back (on October 8, 2011).

As Tim Bray has written summerised, this world would have been different, if Dennis Ritchie had not created ‘C’ and helped inventing UNIX.

I don’t know, if I would be what I am today without ‘C’ programming-language — the first programming language I learnt, used to solve problems, and wrote programs.

These days, I don’t write pure’C’ code except when I am debugging something or in need to write some utility executables. But UNIX (in some-form) is part of my day to day life.

Thanks to you, Dennis Ritchie Sir. May your soul rest in peace.

I regret for not thanking you when you were alive. Why we don’t do that when people are alive?

Steve Jobs, 1955 – 2011


Image Courtesy: WikiMedia

When I woke up earlier today, my wife told me about Steve Jobs‘ death (on October 5, 2011). I was speechless and really didn’t know what just happened. I am still thinking about Steve Jobs, and whatever he has said (quotes) I remember.

Steve Jobs’ influence and contribution is not limited to Apple Computers and competitors, it goes beyond — design, technology, product development and many other communities/disciplines.

He showed a different way to design and build products.

He has inspired me everyday of my life since I came to know him, probably some years before I started using Apple computers. I have repeatadly read and watched him talking/saying/presenting.

I have told his story to many folks over the years, and every-time I was motivated (by just talking about him).

Steve Jobs is an idea. He would always be with us.

Thank You

This post is dedicated to people and companies, who allowed me to work with them. They hired me when I was nothing.

I messed up so many times, yet they kept supporting me. I was not up to the mark, yet they were optimistic. They told me the truth and helped me grow to what I am today.

In last one decade, hundreds of people influenced and inspired me. It would take days to write their names, I would probably do that one day. Thanks to every one of them

I can’t imagine, if I would be what I am today without their trust and support.

Here is list of companies and people (managers, leaders, mentors), who trusted me and allowed me to work with them. I am very thankful to them for everything they did.

Tata Interactive Systems
  • Vivek Kashyap
  • Pavan Kota
  • Anubhuti Kashyap
  • Ashutosh Pathak
  • Nimpee Kaul
  • Nikhil Puri
  • Rohit Sharma
  • Albert Lewis
  • Vikas Dwivedi
Macromedia
  • I. V. Nagendra
  • Victor Grigorieff
  • Vidya Murti
  • Lauren Park
  • Ramanarayanan Krishnaiyer
  • Susan Lally
  • Kari White
  • William Taylor
  • Manish Jethani
Yahoo! Bangalore
  • Vijay Ramachandran
  • Sapna Chandiramani
  • Raghuram BK
  • Hemang
Mixercast
  • Adarbad Master
Allies
  • Abdul Qaiyoom (friend, mentor and brother)

I need X to do Y — Syndrome

Most of us have or have had this syndrome “I need X to do Y”.

  • I need to join X course to learn Y
  • I need to X training to start doing Y project
  • I need a Laptop to start programming Python; Desktop doesn’t make me productive
  • I need an iPhone to start learning iOS programming; Simulator doesn’t make it feel real
  • I need to join Gym to workout; Workout at home doesn’t work :-)

Get over with it this syndrome:

  • Start learning/doing as soon as you get curious about anything, we don’t have to wait to do X to start doing Y by ourself.
  • We can always do X, but who is stopping us from starting with Y?
  • Wouldn’t it be better to get our hands dirty and try to learn more about Y by ourselves?

Eventually we have to do it by ourselves, doesn’t matter if we do X or not. It is more fun and engaging when we do Y by ourself; it is also a litmus test, if we really want to do Y.

Discipline and Passion matters. I wish, I had more of these in me.

Illusory Superiority

Illusory superiority is a topic of psychology, and it is considered to be one of many positive illusions relating to self.

I am not a psychologist. This blog post is based on my observations about this topic in context of coginitive tasks and something highlighted by Dunning-Kruger effect  (Research - PDF).

In my experience, if the culture of place, we live or work doesn’t provide enough challenges and competiton (validations), it’s so easy to get dilusional about our actual competence and  have illusory superiority.

In my own experience, we stop learning and improving once we get to a certain level (in an organisation). We think, we know what we are supposed to. We think, we are great or good enough for tasks in hand or in job?  I believe, these are symptoms when we start living with “Illusory Superiority” or “Distorted Reality” or “Cognitive Bias”.

One of many ways, I avoid to have this distorted view of reality or illusory superiority or coginitive bias is by looking beyond the boundaries of my organisation/city/country. I look up to great people in community at large, places (great companies) and practices. I try hard to follow the gurus and be like them.

Another way is to think like, ‘I am a software-developer/technologist and I work at X place/company’ NOT ‘I am a software-developer/technologist in X place/company’.

The difference between these two statements is, former makes me live in actual reality, and look beyond and place myself in larger community). Latter might make me live with distorted/percieved reality, and place myself in a smaller community (organisation, place, country).

As a leader/mentor, we need to challenge and help our team so that they keep living in reality. We have to do it, carefully, without affecting their self-confidence.

Installing Riak on Mac OSX

I am evaluating various nosql solutions for our existing/new projects. Bluesmoon recommended about Riak which is an awesome nosql datastore/database (and lot more).  I couldn’t wait to check it out.

As usual, I relied on Homebrew – the best package manage for OSX – to install applications/libraries. While installing, I got an error:

$ brew install riak
$ ...
$ Error: Failed executing: make all rel

After searching for a while, I figured out that there are known issues. With the help of Adam‘s comment on github, I was able to install Riak finally.

We make brew ignore Riak’s dependencies while building it.

Following commands should build and install Riak:

$ brew update
$ brew install erlang
$ brew install --HEAD --ignore-dependencies riak -v

Creating and Customising Amazon EC2 AMI

Do you want to create/customize an EC2 AMI?

Check out this tutorial by Rohan.

Briefly, steps are:

  • Find a suitable base AMI. You can use EC2 Console to search
  • Launch an instance from command-line using ami-id or EC2 Console
  • Copy(scp) your private (ssh) key, ec2 key-pair and certificate from your machine to instance’s /mnt directory
  • SSH to instance
    • Install/customize tools and configuration
    • Test if things work
    • Install amazon-ami-tools
    • Bundle image (from current running instance):
      ec2-bundle-vol -d /mnt -k /mnt/pk-STRINGOFTHIRTYTWOLETTERSORDIGITS.pem -c /mnt/cert-STRINGOFTHIRTYTWOLETTERSORDIGITS.pem -u XXXXXXXXXXXX

      XXXXXXXXXXXX is your Amazon account number without dashes.

    • Deploy/copy AMI files to S3:
      ec2-upload-bundle -b [your-s3-bucket] -m /mnt/image.manifest.xml -a [aws-access-key-id] -s [aws-secret-access-key]

Before bundling the image, do test customised settings and configuration; it’s pain to repeat above steps again, in order to change anything post-deployment.

Tip: Don’t shutdown/terminate the instance, you used to create AMI, until you have tested instances (based on new AMI). If anything goes wrong with new instances, you can come back to this instance (based on base-ami), change, bundle and redeploy.