Docker: Automatically Restarting Containers

As a Docker beginner, I always wondered, how to automatically restart container os or system boot?

Thankfully, Docker 1.2 introduced restart policies (which makes sure even linked containers are started in expected order).  The --restart=always flag/value can be passed to ensure automatic restart of containers.

docker run --restart=always redis

Read more about Docker Restart Policies, or other methods.

Github: Forking and Contributing Workflow

I stick to following workflow while contributing to open-source projects on Github:

  1. Fork <user>/<repo> to abdul/<repo>
  2. git clone git@github.com:abdul/<repo>.git
  3. git remote add upstream git@github.com:<user>/<repo>.git
  4. git checkout -b <topic_branch>
  5. Fix, Add or Change things (code, documentation, etc.)
  6. git add <files>
  7. git commit -m <commit-message>
  8. Repeat #5 , #6 & #7
  9. git pull --rebase upstream master
  10. Resolve any conflicts, if required
  11. Squash Commits, e.g. squashing last three commits:
    • git rebase -i HEAD~3
  12. git push origin <topic_branch>
  13. Go to github.com/abdul/<repo>
  14. Create a Pull Request [Github is smart enough to detect a change in forked repo, and offer you to compare and create pull-request]
  15. Discuss changes in PR, and Fix things in branch as required.

The Psychology of Doing Nothing

I ended up on YouTube, via hacker-news or somewhere else, to watch a lecture which made me realise what I have been going through.

Please watch the following lecture on \”The Psychology of Doing Nothing\” by Professor Helga Drummond. You can also read the transcript if you don’t want to watch whole video.

Toptal

I recently came to know about Toptal. I am impressed and happy to see that some of the top developers of world are contributing and making difference through Toptal’s platform. I want to be among them for only one reason:

  • I want to work on (and contribute to some of) the best, useful and challenging projects with possibility to collaborate with some of the top/best developers/designers of the world.

NodeSchool

NodeSchool is a fully community driven effort and is 100% open source. This means that anyone can use the NodeSchool materials and/or host an event.

I have set up NodeSchool Kanpur chapter, and I hope to organise (with help of like minded people) a couple of workshops on Node.js (and web-development ecosystem around it).

I am looking for mentors and co-organisers, if you are interested, let’s have a conversion.

Data Visualisation

Infographics have become things of everyday. Data is more meaningful when it’s visually displayed.

Some links, you might find useful:

Please share links (in comments) to any interesting and inspiring articles or videos or apps. I would put those in above list.

Netflix in India?

Netflix is not accessible in India due to licensing and other reasons.

A lot of people (including expats) want to access Netflix, Hulu and other services in India (or other geo-blocked or geo-fenced territories).

Thanks to Unotelly for their DNS/VPN service which enables watching/consuming geo-blocked content including Netflix’s.

I have used Unotelly for couple of years. Trust me, it is convenient and better use of time to go for Unotelly when you really want to watch some shows and films.

Wondering, why couldn’t I build my own system to do that?

Just so you know, as a geek, I have successfully set up and run my own VPS (with SNI/non-SNI DNS Proxy and VPN), but not everyone can or prefers to do that. The goal was to watch some shows and films, but I got drifted away while building my own system, and ended up spending a lot of time (and money – vps fee) in setting things up than watching shows/films.

I think, Netflix would be officially launched in India in couple of years. For those who can’t wait, why not use Unotelly?

Phabricator

Phabricator (pronounced like the word fabricator) is a suite of web applications which make it easier to build software, particularly when working with teams. Phabricator is largely based on Facebook’s internal tools.

It has been more than three years since I have been using Phabricator (self-hosted) at work. It is one of the open-source projects which has inspired me a lot. I have seen it grow over these years; every day it gets better. Thanks to hundreds of open-source developers for their contribution.

Want to see how to develop elegant and sophisticated software, even with a poor programming languages like PHP? Look at Phabricator’s source-code and tools (built using PHP), you would be awestruck.

Want to play with Phabricator without installing? Have a look at PhorePlay (Phabricator hosting service), which offers free Phabricator hosting (with multiple instances) up to five users.  I think, that’s good enough for most of us (small teams).

Phabricator’s core team is working to launch Phacility (Phabricator Hosting). I think, it has potential to become something like Github (useful and essential service) one day.

Delegate Carefully

While running a business or teams, we delegate a lot of responsibilities to individuals in our company. Over delegation can be counter productive and stressful if not managed carefully.

While management gurus suggest to delegate almost everything, I differ and don’t recommend that to technical entrepreneurs/leaders. We need to be in shape (technology, hands on skills) by doing tech stuff while we have to wear another hats (management, operations, etc.)

I delegate enough to empower my team to do things better than I can. I never delegate everything; I try to be an active participant instead of one on sidelines reading only mails/reports.

What I am up to?

This is how my 2014 passed, or what I am up to:

  • riding my motorcycle a lot
  • hacking electronics and IoT using OSHW
  • dockerising things (apps, services)
  • playing with Apache Mesos, and ecosystem around it
  • hacking projects using Javascript (framework, toolchain, node.js, ES6 way of doing things) and web-standards (HTML5, CSS3, components, etc)
  • got Google’s Widevine certification (as required in one of projects). Personally, I like non DRM’d content :-)
  • built a Chromecast app using dash.js, modular Widevine DRM with node.js based proxy service for licensing, and Java for content encryption and packaging
  • been reading a lot of stuff through hackernews
  • helped and built stuff: QRizq, Diziana, 99doodles, IndieReign and other projects
  • not having meetings (waste of time)
  • not interviewing candidates who are not worth anyone’s time. [should do another post: sad and bad state of technical education in India]
  • bunch of other things I can’t recall

Did you notice that I have been mostly playing (or having fun)? On other side of it, I have also been thinking what’s nex; I think, I have figured that out.

At present, I am still involved with couple of projects mentioned above. I have also taken up a couple of interesting consulting assignments around technologies mentioned above along-with my old love (flash/actionscript).

MOOCs: Massive Open Online Courses

MOOC is known to everyone these days. I am enrolled in some of the courses on Coursera, Edx, Udacity, Stanford, and others most of the time. I sometimes look at Khan Academy’s lessons/courses as well. We are living in a time which has made learning things so much easier compared to what we have a decade back or earlier.

Anyway this post of mine is not about reiterating facts and benefits of MOOCs. I rather want to talk about an idea which I found in my notes written many years back.

Yesterday, I found an old note (written during Feb/Mar 2006) on my Yahoo! Notepad. I think, I wanted to present this idea in an upcoming BarCamp Bangalore. I couldn’t give my talk because I fell sick on the day BarCamp happened.

Following is what I found:

While I was sleeping, I dreamt about my school days and I woke up suddenly in the middle of night. I started thinking, how cool those days were.

Since I was also thinking about some idea for BarCamp before sleeping, something struck my mind…
How podcasting/videocasting can be used in education (school, colleges, training institutes etc) combined with the philosophy of open-source, knowledge-sharing.

For example, in a school a teacher is teaching Maths/Physics…if the entire session is recorded (audio/video) and uploaded to some site (like Yahoo! Podcasts, Odeo, YouTube etc)…Not only students from the same class, who were present or absent but also students from other schools, students from remote villages/small-towns with decent internet connectivity can benefit…

This requires, schools to be more open and willing to share the knowledge and adopt the technology in this fashion. Technically, it is quite feasible, my prototype requires following:-

* Broadband connection
* Account on YouTube!, Y! Podcast or on Odeo account
* An high-res webcam and a microphone..
* A web application written in Macromedia Flash/Flash Media server to do the entire recording, locally…

What I expect that someone comes with a Web 2.0 app like Odeo, where you can do publishing with their API in real-time as well as should be able to upload pre-recorded content. At present, Odeo, Y! Podcast etc lack publishing API…which is I think is important…

I like the idea of Odeo channels, if it’s little more improved it can be like a TV channel…

I think, such things have great importance and we should really start thinking that how can we improve society, education and system with the best use of technology….

HTML5 and CSS3 Resources

It is an age of information overload, it is very hard to keep myself focused while searching and learning about anything. I am often lost in jungle of thousands of links/pages talking about same thing.

Following is a list, which I refer when I am reading about HTML5/CSS3:

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.