Wednesday, February 5, 2020

What happened to mobile phones?

What happened to regular-sized, lightweight phones with batteries that used to last a week? Where did they disappear altogether?

I mean mobile phones today are one of the best technologies a common person has access to. Please don't get me wrong. It runs on multi-core processors, has a camera that can rival many DSLRs on the market, a screen big enough to enjoy a movie together, a gadget you can make payments with, run console-quality games, connect to GPS satellites, connect to the internet 24-7, run AI simulations? The last one is maybe probably, I don't know. And yes, you can make a phone call too. I love all the hardware that power today's smartphones and the capabilities that come with it.

Great! But then, why am I having a hard time getting a new phone?

Let's start with the screen size. I have a problem with large screen sizes of today's phones. But then people are buying phones with huge screens like anything. So maybe people do like huge screens. Or maybe they are being conditioned into liking it. Imagine a kid born in the last decade (2010 folks). She would have grown up seeing everyone (including celebrities) carry phones with huge screens. I guess she would naturally expect her phone to have a big screen too.

On a memory trip, if you remember, the first iPhone came out in 2008. It had a 3.5-inch screen. Such a beauty it was, sigh! I still miss it. It's not even 12 years as of this writing. And screen sizes have almost doubled in these years.

Anyway, back to my rant. So, where was I? Yes, screens. Humongous screens. Maybe it is just me but I don't want to walk around carrying phones with such huge screens. It's just inconvenient for me. I can't carry it in my pockets anymore! In fact, if it was me, I would love to shrink screen sizes. Do something google glass style. Maybe something a little less nerdy looking. Maybe project the display on the eye's natural lens. I don't know. Do something smart. Anything but keep increasing screen sizes. I know I'm getting all fantasy. But hey, what's fantasy today is gonna be a reality someday.

The next complaint I got is with today's phone batteries. I understand that you need huge batteries to power those large screens. And they are bound to get bigger. And yet, today's phone lasts a day or a day and a half if you're lucky. Compare that to the 5-day battery of the Nokia phones from the early 2000-s. I mean, given the technological advancements we've had, shouldn't we have had a month-long battery on phones by now? How about 2 weeks? Too much I ask you say? How about we settle for just a week-long battery then?

Also, the bigger batteries mean that the phones are getting heavier too. I mean it's bound to. But this one I don't mind so much if you can give me a small-sized phone with all the things I said before.

Finally, what happened to aesthetics? The camera bulge on the backside, really? Also, I don't need 4 cameras on the backside of my phone guys. Just one is good enough, thank you very much. If anything, make the flashlight ten times more powerful. And the current ongoing saga with the selfie camera design - the notch, the eyedrop the punch hole and the pop-up camera is just too much for me. If you wanna get hi-tech, how about just embedding the camera under the touchscreen? How about that? Dreaming again, huh? You may say I'm a dreamer ...

One might say that given enough money, anything is available. So no, please don't make me break the bank buying a new phone. Have you noticed the price tags for some of the high-end phones in the market today? A price like that is just not gonna cut it for me. I'm just a common person. With a common man's bank account. So I would not buy a phone if I'd have to sell a kidney to get one.

Anyway, enough for today. Let me wrap this post with a call for help to all the mobile giants out there - Apple, Google, Samsung, Huawei, Xiaomi, BBK electronics. And also a challenge if I may throw one. I hope you'll help me to find a smartphone that I like. Not just force me to choose one reluctantly. Ciao!

Monday, April 14, 2014

Managing gmail using filters and labels

If one is like me who finds it difficult to manage work emails then this post might be helpful.

First of all, a bit of context. This post is for project related emails. Now one might have subscribed to bunch of other mailing groups which are non project related. For example office email group, developer community, tester community, etc. This post is not to manage them. Because, for me, my biggest worry is missing out on work related emails. Also this should apply to a developer role mostly. However, I'm sure, with little tweaking, the same concept can be applied to any other role also. Last thing to mention is that this post is for organizing your inbox in gmail. If you use a different email, it might be possible to apply the flow described is this post for your email service. But you might have to tweak your email client a bit to get the same results.

To start with, gmail has the option of arranging your emails into multiple tabs (like Primary, Social, Promotions, etc). Which I use for my personal email. But for work email I have disabled it. Because I don't want to remember to go to another tab to read my other emails. Also, I don't want to keep dragging emails from one tab to another because gmail categorized it incorrectly. So essentially all my emails are in the same place.

Now, the immediate problem with getting rid of the tabs is that there are too many emails. And without filters and labels it is very inconvenient for me to go through them efficiently. So I've setup filters and labels. Now, since I have worked on quite a few projects, I have namespaced filters. What I mean by that is something better explained with an example. Suppose my company is doing a project with Google. Then I would first create a sub-label called google inside my projects label. Then I would create three further sub-labels nested inside google:
  • project-team-email
  • domain
  • environments

So the labels hierarchy looks like:

projects
      |- google
              |- project-team-email
              |- domain
              |- environments

The first one is the most important. I would pick a color for that label based on the color of the client (in this case google). Now I have another global label called 'to-me' for which I have the color red.

So how do these labels work?

That brings me to filters in gmail. I would already have a filter for 'to me' filter. That is any email sent to me should apply the label 'to-me'. Don't forget to add email aliases also for the filter associated with 'to-me' label if you use them. Note that this filter needs to be setup only once. Not on a per project basis. That way I'm bound to notice any email which is directly sent to me. Also the bright red color of the email makes it difficult to miss.

Attaching an image from my filters for to-me label.


Now for the project-team-email label. I would create a filter for any mail sent to the project team email group to apply the label 'project-team-email'. Again, remember to add team email aliases if there are any.

Attaching an image below for the project-team-email label.


Rest of the labels do not have any filter associated with them. I just apply them based on whether its something important related to domain or environments. Have as many labels as you would like but try not to have any color associated with them. Just makes going through important emails a lot easier.

One thing I would like to point out is that when both the labels project-team-email and to-me appear on an email it could mean that either my attention is being called for or I might have replied to the email thread earlier. In other words I should definitely look at that email. Attaching an image below to give you an idea.


Finally attaching an image of my inbox.



Hope this helps to manage your inbox better.



Saturday, July 13, 2013

Is javascript empty array true or false

Not to be accused of plagiarism I would like to point out this stackoverflow link first.

Now, coming to the topic, let me start by asking two questions. In Javascript, what do you think the output will be for the following two code snippets?

1. First code snippet

2. Second code snippet

Before looking at the solutions, take 10 seconds to think what the output might be. Or even better, try them out in the javascript console in your browser (if it is enabled that is).

If you have tried them out, you know the answers. For others, they are below:

1. It would print "empty array is truthy"
2. It would print "empty array == false is true"!!!

That was very confusing to me when I first came to know of it. Then on digging deeper, here's what I found out. Basically, there are two concepts.

First, "if" in javascript would check if the enclosed condition/object is one of the following:
  • false (the false object itself, not just if it is == false, look at the example below)
  • undefined
  • null
  • 0
  • NaN
  • (empty string)
To understand the first bulleted point, a Boolean false object (that is new Boolean(false)) will also evaluate to true in an if condition. Try out the following code: 

For an expression within the "if" condition, remember that the expression will return a value (even if undefined). And "if" operator would work according to that value. If that value is any one in the list above, it would skip the curly brackets code.

Getting back to the first example, an empty array is none of the items in the list above. So it is true. And so javascript would go ahead to evaluate the curly brackets code.

Secondly, the == operator. That would try to convert the array to its string representation by calling the toString method. Why? Take a look at Mozilla javascript reference for comparison opertators.

So, [].toString will evaluate to "" (empty string). Which is equal to false as per the non-strict comparator (==) that we are using. And so in the second example also the code in the curly brackets will be evaluated.

Hope that helps to clarify an empty array seems to act mysteriously.

References: