Carrying water during urban travel

Bottled water is not only expensive but is harmful to the environment. Therefore, I try to reuse the same bottle while traveling. I used to carry a hard-plastic bottle while traveling and then one day at an airport, I saw another traveler carrying a flexible bottle, it looks like a pouch. Compared to a standard 500mL hard plastic round bottle it is slim and hence a good fit for a travel jacket. That鈥檚 why I fell in love with one and quickly added it to my traveling gear. ...

Choosing a Travel Backpack

Choosing a travel backpack is a topic of several online debates. Here are some of my learnings. The final decision depends on your preferences. Size First, start with the size, usual sizes are around 25L, 45L, 65L. The 25L is OK for a day or two, and you can stretch it for a few days. It is almost what a good office backpack looks like. 45L can last for a few week-long urban trips. Of course, it cannot contain things like sleeping bag etc. Both of these are good choices for urban travel or travel not involving sleeping outdoors. For travel involving carrying sleeping bags or tents, a 65L backpack is unavoidable. But here is the flip-side. Not only, it is bulky but also, you cannot carry it in most airlines. You have to do a check-in which even if free, can be time-consuming. Here are some images from Google illustrating the sizes. ...

Floating point in user-facing strings

%f in user-facing strings is dangerous. Depending on the architecture, programming language involved, version of that language and compiler optimization flags, results can vary slightly. And if there are multiple languages involved in the serving stack, it is almost impossible to argue with the outcome. If those variations are immaterial, then use %.1f or %.2f to get one or two digits of precision after the decimal point, respectively. Otherwise, don鈥檛 use %f at all. ...

Startup valuations

In 2001, Amazon鈥檚 share price crashed from 100$ to 6$, they had to do a 15% layoff. But it was Jeff Bezos鈥檚 perseverance, tenacity and grit because of which Amazon survived. As several startups from the Bay area to Bangalore get a mark-down of their valuations, the question about how many will survive and eventually produce a [positive] return for their investors is being asked. Between what a startup鈥檚 real value is and how viable is its business model, the real question to ask is how committed are the founder(s) to make things works. In the longer run, only that will matter. ...

Voice Interfaces: The Missing User Interaction Element

Apple Siri, Google Now, Amazon Echo, and Microsoft Cortana have garnered a lot of press lately. But one thing which is still missing out is voice-native user experience. Let me illustrate that with the evolution of user experience on touchscreens. When they first came out, there was a stylus, and that鈥檚 it. It was an inferior version of the mouse-keyboard-monitor trio. Then some fantastic interactions were invented. Interactions like double tap to zoom, multi-finger rotation, swipe to like/dislike, pull down to refresh, long-press for options, and a Swype keyboard. All of these were native to a touchscreen-based environment. Porting them back to a mouse-keyboard-monitor trio was of limited utility at based and useless at worst.

Cruelty to animals

What鈥檚 not cruel Burning bee hives (homes) of billions of bees for extracting the honey they spent their life gathering Raising hens, in millions, solely for their eggs & meat Slitting throats of millions of animals and let them bleed to death ( halal) Skinning millions of cows for their leather Impregnating millions of cows repeatedly for milk Selective breeding of millions of Turkeys, so that, they provide more meat but are too heavy to survive Neutering thousands of dogs and cats, so that, they can be used as pets Boiling shrimps alive for food Killing deer and bears in the name of population control during the hunting season What鈥檚 cruel Whatever happened at the Tiger Temple

Tabs vs spaces for code indentation

One argument which some people might give in favor of using tabs is that it allows the viewer to decide how the code should appear to them. And hence, it separates the logic (indentation) from its appearance. The biggest flaw in that argument is that it renders the concept of line length limits meaningless. Line length limits and the associated rules of wrapping bring a good structure to the code. Someone looking at a piece of code with 3-levels of nesting and tab-length set to 8 will see a very different line length from someone using a tab-length of 2. Always expand tabs. ...

File size should always be of "long" type

Java 1 2 3 int getTextFileSize(String fileName) { return (int) (new File(BASE_DIR, fileName).length(); // WRONG } A 32-bit signed int can deal with ~2GB worth of data. And if your code is not going to deal with files larger than 2GB, why worry? But what if someone wants to use the same code for a video file some day? Or What if someone writes another code to iterate over all the files in the BASE_DIR directory? Most likely they will be inclined to use int for the final sum as well. Adding integers in most languages results in int and automatic overflows into a negative number (and even worse, back to a positive number). The caller code might think that BASE_DIR does not exist. Therefore, the best future-proofing is to never have file size stored as an integer. Even, Android platform got it wrong with StatFs#getBlockSize and corrected it by adding StatFs#getBlockSizeLong. ...

Google I/O 2016: Android notes

General Multitasking - multi-window mode and picture-in-picture mode. This includes the ability to launch window in adjacent activity, and drag and drop between activities. Notifications - Custom quick settings tile for an activity Multi-locale - users can specify locale beyond their primary locale ScopedDirectoryAccess for the shared storage New file-level encryption mode (as opposed to block-level encryption) and the corresponding Direct Boot Java 8, Jack, and ndk support in Gradle GCC deprecated in favor of Clang TechTalk on Image size/compression PNG - Get image down to 256-bit palette (if possible) or compress them using Zopfli. Test the difference with butteraugli Convert PNG to Vector drawable using Potrace. Vector drawable are natively supported on Android 5.0 and above. Use compat to use them on the older versions. Or generate PNG for the older versions (not recommended) WebP is another option (Note: Speaker failed to mention that WebP is natively supported only on Android). Avoid JPEGs. They are usually larger in size.

Great By Choice by Jim Collins

Book summary: Great By Choice by Jim Collins

The book compares a set of 10 pairs of companies over a timeframe of over 20 years to demonstrate what choices the same companies make to become great. The great ones (10Xers) were not led by visionaries, they were not more innovative, they did not try to move too fast, and they were not luckier ones either.