tag:blogger.com,1999:blog-26702492913446435912024-03-19T02:23:16.653-07:00ashishlive!...all that fascinates and inspires!ashishhttp://www.blogger.com/profile/16607235147529676866noreply@blogger.comBlogger16125tag:blogger.com,1999:blog-2670249291344643591.post-73309482778945222592014-09-30T11:23:00.001-07:002014-09-30T11:23:50.395-07:00Hacking Patience<div dir="ltr" style="text-align: left;" trbidi="on">
<br />
Being patient is one of the toughest things I deal with. I can't keep calm.<br />
Now I'm not sure if it's just me or if it's really a social side-effect of being a programmer.<br />
<br />
Programming is one of the jobs where you see results for your actions in near-real-time. I can't think of any other job which reflects upon your action any faster.<br />
<br />
We act, and we expect results. We expect them soon enough. Hell, we demand results.<br />
<br />
This vicious cycle in our daily lives is making us a little more impatient daily. The real problem is that this sense of being impatient towards things and events makes way into our real lives. It gives birth to all sorts of problems.<br />
<br />
You are more anxious, and can't calm down unless you witness the outcome. You fail to respect that other person needs his/her own space and time to sort out matters which involve you. You get frustrated/irritated more easily when you don't see immediate results, which will often be the case really.<br />
<br />
Truth is, most of the times I know I am being impatient, but I find it logically unacceptable that why shouldn't I be impatient. I can't accept my actions not giving me results soon enough.<br />
<br />
So, I developed a life-hack to overcome impatience.<br />
<br />
<br />
<blockquote class="tr_bq">
Change the expectations/outcome of your actions from "Ultimate Result" to "Immediate Result". Once you reward yourself with an immediate result, you will no longer be impatient.</blockquote>
<blockquote>
<br />Tell yourself, "You're getting there!" </blockquote>
<br />
<div style="text-align: left;">
</div>
<ul style="text-align: left;">
<li>When you click that download link, your expectation should not be that you get the file. It should be download to begin.</li>
<li>Don't wait for that call impatiently. Your actions won you a call, it will come when it has to come. You've done your part.</li>
<li>After you propose or apologise, your immediate result is that the other person is giving it a thought. A yes or no is not what you should be looking for as an immediate result.</li>
</ul>
<br />
<div style="text-align: left;">
<br /></div>
I think the hack works for me.<br />
<br />
Sometimes, I've to think really hard to figure out the immediate outcome as a result of some action, but I eventually figure it out.<br />
<br />
Life is far more satisfying and patient now !<br />
<br />
<br />
<br />
<br /></div>
ashishhttp://www.blogger.com/profile/16607235147529676866noreply@blogger.com0tag:blogger.com,1999:blog-2670249291344643591.post-35153255024439165652013-09-19T07:07:00.001-07:002013-09-19T07:10:16.051-07:00The little thing that makes me hate Android<div dir="ltr" style="text-align: left;" trbidi="on">
Android is awesome.<br />
We found love in a hopeless place.<br />
It's the unix of mobile phones.<br />
<br />
But it is so fricking annoying when:<br />
<br />
<b>It vibrates on shutdown</b><br />
<br />
Why?<br />
Why does it have to vibrate on shutdown??<br />
<br />
My phone battery definitely dies everyday because battery-life sucks and I suck more since I am too lazy to keep my phone charged. Now, when battery gives up, phone shuts down silently and in the end it vibrates. I pull the phone out of my pocket to see what the vibration was about, click the Power Button and it starts booting up, just to shutdown again!<br />
<br />
You may call it a dark pattern/(insert a mumbo-jumbo here), I call it wtf.<br />
<br />
wtf.<br />
<br /></div>
ashishhttp://www.blogger.com/profile/16607235147529676866noreply@blogger.com0tag:blogger.com,1999:blog-2670249291344643591.post-49012579621911477222013-04-17T10:13:00.000-07:002013-04-17T10:13:29.735-07:00Work, Life, and Balance<div dir="ltr" style="text-align: left;" trbidi="on">
<br />
A lot has been said and done about Work-Life Balance lately, and in the past as well. I will keep this short, I have no patience and time to go on blabbering for pages and pages of philosophical crap.<br />
<br />
To begin with, I have had day jobs just like you, definitely not perfect, and where work can be so demanding at times that you feel like hating it all. But, I have been appropriately satisfied with my life definitely (if not so much with my work). I think its partly also because I don't give a damn about my work after a point of time, but never-mind.<br />
<br />
Admit it, you hate your work routine. It's ruining your life. You don't find time for yourselves, or your friends, family, your favorite sport or to learn new ninja skills.<br />
<br />
But at same time, understand that your company won't help this sort out for you. It's really your problem and you need to kick some ass to fix it. Take charge, and nail it.<br />
<br />
Here are a few things I apply sub-consciously:<br />
<br />
<h3>
<b><span style="font-size: large;">Find the passion in your work</span></b></h3>
You can't balance apples against oranges. You need to be as involved/concerned about your work as you are about rest of your life. You might not be perfectly satisfied with your job, but hey, nobody is. Find things you truly love in your work space. Don't let work kill your passion about your dream work. Hang around with the coolest people around your desk. If you can find a little corner of your heart for your work, things will automatically become a lot easier. You won't mind the occasional extra hours, you'll be more productive, and you'll come home with a smile and energy to really have a fulfilling life.<br />
<br />
<br />
<h3>
<b><span style="font-size: large;">Do at least couple of those n things daily</span></b></h3>
Make a hit-list of what you really want your life to look like: hitting the gym, writing a blog/book, learning new stuff, reading a book, picking up your kids from school, preparing for your Oscar Award's speech, whatever it is. Find some time to do at least one of them each day. I do not trust you if you tell me you can't find time for it. Make some time for it, this is what you are working for. If you still think your work comes your way, take a deep breath, close your eyes, and say this loud inside 'Fuck It', and go ahead and do it. Your work can wait, trust me, it can (all that project management shit will take care of it!).<br />
<br />
<h3>
<b><span style="font-size: large;">Little Hacks</span></b></h3>
Hack around to make more time by keeping things organized like cutting through commute time by starting early for office, procrastinate stuff that can be put off, order your groceries online instead of wasting time standing in queues in malls, fight in project management meetings to get extra time buffers (you are smart enough to know how to do this), automate stuff, and so on.<br />
<br />
<br />
Long post already, I would like to close this here on this note:<br />
<blockquote class="tr_bq">
<i>Prioritize your life alongside your work, not ahead, not behind, alongside.</i></blockquote>
<blockquote>
<i>Keep your work fun, so that it doesn't haunts you all the time.</i></blockquote>
<blockquote class="tr_bq">
<i>Hack it all.</i></blockquote>
<br />
Cheers!<br />
</div>
ashishhttp://www.blogger.com/profile/16607235147529676866noreply@blogger.com0Bangalore, Karnataka, India12.9715987 77.59456269999998312.4764147 76.949115699999979 13.4667827 78.240009699999987tag:blogger.com,1999:blog-2670249291344643591.post-9093949921831460022013-03-02T04:18:00.002-08:002013-03-02T04:24:44.184-08:00C++: Why can't I sort like a normal human being<div dir="ltr" style="text-align: left;" trbidi="on">
<div dir="ltr" style="text-align: left;" trbidi="on">
Before I begin, C++ is awesome.<br />
It's exactly the right kind of balance between low and high level languages. When you need C++, you need C++.<br />
<br />
But it comes with it's own sets of problems.<br />
The Standard Template Library (STL) shipped with C++ is quite great, but at the same time it's excruciating verbose and is very counter intuitive.<br />
<br />
For instance, std::sort sorts C++ the elements in a container in place. Sounds good enough.<br />
Now you would expect to sort like this:<br />
<br />
<span style="font-family: 'Courier New', Courier, monospace;"> vector<int> a;</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"> a.push_back(1);</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"> a.push_back(2);</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"> std::sort(a);
</span></div>
<br />
<span style="font-family: 'Courier New', Courier, monospace;"><int><br /></int></span>
But, NO.<br />
std::sort would only sort over a range of elements over a container, so you must write:<br />
<br />
<span style="font-family: 'Courier New', Courier, monospace;"> std::sort(a.begin(), a.end());</span><br />
<br />
This really irritates me.<br />
std::sort(a) would have been brilliant, easy to use, and intuitive.<br />
I tried to pull up a simple overload and worked like a charm:<br />
<br />
<span style="font-family: 'Courier New', Courier, monospace;"> template<typename t=""></typename></span><br />
<span style="font-family: 'Courier New', Courier, monospace;"> void sort(T& t)</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"> {</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"> return std::sort(t.begin(), t.end());</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"> }</span><br />
<br />
Its one of the things that bug me as a C++ developer and HCI enthusiast.<br />
Not overloading enough to provide simpler interfaces to your end users is simply evil and mean.<br />
<br />
<br /></div>
ashishhttp://www.blogger.com/profile/16607235147529676866noreply@blogger.com2tag:blogger.com,1999:blog-2670249291344643591.post-32474829961078782732013-02-03T02:48:00.001-08:002013-02-03T02:48:41.302-08:00Alarm Clock Myth - How to wake up early<div dir="ltr" style="text-align: left;" trbidi="on">
Everyone wants to wake up early, and make good use of those extra early morning hours. But we fail all the time, even if we succeed, its one-off times.<br />
<br />
<br />
<br />
I thought its a good opportunity to seize and fix this problem with the existing alarm clocks. I started exploring the existing solutions out there and found there are quite many interesting stuff:<br />
<br />
<ul style="text-align: left;">
<li>A whole breed of biologically sync'd clocks who wake you up when you are least in sleep</li>
<li>Hard to snooze alarm clocks which ask you to solve a difficult puzzle to snooze an annoying alarm tone</li>
<li>Motivational messages to wake you up</li>
</ul>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiIKpgl2V595mpsQE4vmgLmDK-R-7Wt_LHSw1P3tg0QT66fN6xthnz_uY3i4XE8uf2krSJ9T7xwDz3DRy4v8RkcYXJs8bAcM6vbx58LAzBSVfKN-2njeFwE8EF62VlxCLnurCiAEmDxQhKm/s1600/alarm_clock_10.gif" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="320" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiIKpgl2V595mpsQE4vmgLmDK-R-7Wt_LHSw1P3tg0QT66fN6xthnz_uY3i4XE8uf2krSJ9T7xwDz3DRy4v8RkcYXJs8bAcM6vbx58LAzBSVfKN-2njeFwE8EF62VlxCLnurCiAEmDxQhKm/s320/alarm_clock_10.gif" width="284" /></a></div>
<br />
I gave all the existing products a lot of thought and why they don't quite work. Here is my conclusion:<br />
<blockquote class="tr_bq">
<i><span style="font-family: 'Trebuchet MS', sans-serif;">People don't really understand the real purpose of alarm clocks</span>.</i> </blockquote>
Here's the deal: Alarm clocks are not meant to wake you up. Yes, you read it right.<br />
<br />
Alarm clocks really are the mission-control, last resort plan to wake you up at the deadline time.<br />
You are supposed to get up on your own, through your own magical body clock. How many times have this happened that you woke up half an hour before you were supposed to, you looked up your clock, and went back to sleep? If you answer is: ''Every Effing Morning'', then you sir are a victim of Alarm Clock Myth.<br />
<br />
So, i followed the following regime:<br />
<br />
<ol style="text-align: left;">
<li>Set my normal alarm clock to a time which is the drop-dead time i must get up at, which in my case is 6:30 AM.</li>
<li>As soon as I open my eyes in the morning to grab the clock to see the time, instead i just get up and turn off the alarm proactively. Believe me, you don't really need those extra minutes to sleep, you are fine to start the day.</li>
<li>If I did't get up on my own, the alarm clock would alarm me at the deadline time which is 6:30 AM at which time I get up.</li>
</ol>
<div>
This has worked out for me beautifully and i am in my best body clock schedule. Alarm clocks don't irritate me every morning, instead I beat them every morning.</div>
<div>
<br /></div>
<div>
It takes some time to get into this regime, but believe me its more amazing to get up on your own than getting woken up by an annoying alarm clock.</div>
<div>
<br /></div>
<div>
Cheers, Happy Mornings!</div>
</div>
ashishhttp://www.blogger.com/profile/16607235147529676866noreply@blogger.com18tag:blogger.com,1999:blog-2670249291344643591.post-83873613593819328492010-11-28T07:58:00.000-08:002010-11-28T10:44:58.901-08:00Usability issue with Youtube and MS OutlookI am no usability expert, nor a PhD in HCI. I am just another tech savvy, maybe a more concerned one. This post is a rant against two most popular and religiously used applications: Youtube and Outlook. I am so frustrated of the usability bugs in these applications, that i am writing this post hoping to get some relief and a fix from these bugs soon.<div><br /></div><div><b>Youtube: Smart Resolution</b></div><div>Present your user with minimal number of options and make decisions for them wherever possible. This seems like a magic usability-voodoo that works most of the times, but sadly not for Youtube. It goes something like this for Youtube: I click on a video, and it opens up nice with a 360px resolution (atleast with my browser and connection). I am watching this 1 hour video which has almost buffered completely and i decide to go full screen. Whoa! Youtube decides for you that the video resolution must be changed to 480px or more for a better video experience. I loose all my buffered video, and at times when my internet speed just sucks, it is freaking frustrating and i click on the 360px option again to buffer it all over again. This just sucks.</div><div><br /></div><div>There might be some advanced option to fix it if i login into Youtube which i never feel like doing, nor i have done it. But this doesn't work for me and i am guessing it doesn't works for most of the users.</div><div><br /></div><div>If the video buffered seamlessly, this would have been charming, but it isn't. This certainly needs a fix. I would suggest a different buffer to buffer the high resolution video and when the video is available to play, just switch to the high res video. This might seem like a bit of over engineered usability, but thats how i think it should be.</div><div><br /></div><div><b>Outlook: Don't mess with the usuals</b></div><div>This is again one of the things which can possibly be fixed but is very irritating. This one is about messing with the hotkeys. I am reading an old mail (a long one) and i need to find something in that mail and i go Ctrl-F. To the utter surprise, Ctrl-F doesn't brings up a find-window, it forwards my mail. That is so against the rules of usability and intuition. If you use Outlook, you must have encountered this at some point of time, and unlike many i cant make my mind with this. Hotkeys and controls should work the way they work in all other applications, maintaining the usability and intuitions. </div><div><br /></div><div>Lessons to carry away:</div><div>1. If you make decisions on behalf of your users for a better user-experience, make sure you test it well with various real-time scenarios your users use your application in. </div><div>2. Keep things intuitive.</div><div><br /></div><div>Would love to have you comments, feedback, and a fix if you are working on these products.</div><div><br /></div>ashishhttp://www.blogger.com/profile/16607235147529676866noreply@blogger.com1tag:blogger.com,1999:blog-2670249291344643591.post-84403786249412765902010-11-22T09:39:00.000-08:002010-11-22T09:44:09.104-08:00@facebook.com release next year?So i was mailing somebody at facebook @facebook.com and got the following autoreply mail from Facebook:<div><div><br /></div><div><span class="Apple-style-span" style="font-size: small;"><span class="Apple-style-span" ><b>Sub: </b>Please use @fb.com for Facebook Corporate email</span></span></div><div><span class="Apple-style-span" style="font-family: arial, sans-serif; font-size: 11px; border-collapse: collapse; ">Dear Sender:<br /><br />Facebook has changed its corporate email address domain from @<a href="http://facebook.com/" target="_blank" style="color: rgb(0, 0, 204); ">facebook.com</a> to @<a href="http://fb.com/" target="_blank" style="color: rgb(0, 0, 204); ">fb.com</a>.<br /><br />Your message has been delivered to the intended recipient, but please update your contact details with <address>@<a href="http://fb.com/" target="_blank" style="color: rgb(0, 0, 204); ">fb.com</a> for future correspondence. You will not receive this message again if you utilize <address>@<a href="http://fb.com/" target="_blank" style="color: rgb(0, 0, 204); ">fb.com</a>. We will not be forwarding any email sent to @<a href="http://facebook.com/" target="_blank" style="color: rgb(0, 0, 204); ">facebook.com</a> corporate email addresses past January 5th, 2011.<br /><br />Regards,<br />Facebook</span></div><div><span class="Apple-style-span" style="font-family: arial, sans-serif; font-size: 11px; border-collapse: collapse; "><br /></span></div><div><span class="Apple-style-span" ><span class="Apple-style-span" style="border-collapse: collapse; font-size: 11px;"><span class="Apple-style-span" style="border-collapse: separate; font-family: Georgia, serif; font-size: 14px; ">I was hoping to get @facebook.com much earlier, like by Christmas or something. Sad.</span></span></span></div></div>ashishhttp://www.blogger.com/profile/16607235147529676866noreply@blogger.com0tag:blogger.com,1999:blog-2670249291344643591.post-8510554014726557352010-11-20T06:32:00.000-08:002010-11-20T07:35:27.853-08:00[Puzzle] Poisoned wine: Fun with bases<b>Puzzle: Poisoned Wine</b><div><span class="Apple-style-span" style="font-family: verdana, arial, geneva, sans-serif; font-size: medium; ">You have 240 barrels of wine, one of which has been poisoned. After drinking the poisoned wine, one dies within 24 hours. You have 5 slaves whom you are willing to sacrifice in order to determine which barrel contains the poisoned wine. How do you achieve this in 48 hours?</span></div><div><span class="Apple-style-span" style="font-family: verdana, arial, geneva, sans-serif; font-size: medium; "><br /></span></div><div><span class="Apple-style-span" style="font-family: verdana, arial, geneva, sans-serif; font-size: medium; ">(Please try the puzzle before you skip to the solution mentioned at the bottom of this page.)</span></div><div><span class="Apple-style-span" style="font-family: verdana, arial, geneva, sans-serif; font-size: medium; "><br /></span></div><div><span class="Apple-style-span" style="font-family: verdana, arial, geneva, sans-serif; font-size: medium; "><br /></span></div><div><span class="Apple-style-span" style="font-family: verdana, arial, geneva, sans-serif; font-size: medium; "><br /></span></div><div><span class="Apple-style-span" style="font-family: verdana, arial, geneva, sans-serif; font-size: medium; "><br /></span></div><div><span class="Apple-style-span" style="font-family: verdana, arial, geneva, sans-serif; font-size: medium; "><br /></span></div><div><span class="Apple-style-span" style="font-family: verdana, arial, geneva, sans-serif; font-size: medium; "><br /></span></div><div><span class="Apple-style-span" style="font-family: verdana, arial, geneva, sans-serif; font-size: medium; "><br /></span></div><div><span class="Apple-style-span" style="font-family: verdana, arial, geneva, sans-serif; font-size: medium; "><br /></span></div><div><span class="Apple-style-span" style="font-family: verdana, arial, geneva, sans-serif; font-size: medium; "><br /></span></div><div><span class="Apple-style-span" style="font-family: verdana, arial, geneva, sans-serif; font-size: medium; "><br /></span></div><div><span class="Apple-style-span" style="font-family: verdana, arial, geneva, sans-serif; font-size: medium; "><br /></span></div><div><span class="Apple-style-span" style="font-family: verdana, arial, geneva, sans-serif; font-size: medium; "><br /></span></div><div><span class="Apple-style-span" style="font-family: verdana, arial, geneva, sans-serif; font-size: medium; "><br /></span></div><div><span class="Apple-style-span" style="font-family: verdana, arial, geneva, sans-serif; font-size: medium; "><br /></span></div><div><span class="Apple-style-span" style="font-family: verdana, arial, geneva, sans-serif; font-size: medium; "><br /></span></div><div><span class="Apple-style-span" style="font-family: verdana, arial, geneva, sans-serif; font-size: medium; "><br /></span></div><div><span class="Apple-style-span" style="font-family: verdana, arial, geneva, sans-serif; font-size: medium; "><br /></span></div><div><span class="Apple-style-span" style="font-family: verdana, arial, geneva, sans-serif; font-size: medium; "><br /></span></div><div><span class="Apple-style-span" style="font-family: verdana, arial, geneva, sans-serif; font-size: medium; "><br /></span></div><div><span class="Apple-style-span" style="font-family: verdana, arial, geneva, sans-serif; font-size: medium; "><br /></span></div><div><span class="Apple-style-span" style="font-family: verdana, arial, geneva, sans-serif; font-size: medium; "><br /></span></div><div><span class="Apple-style-span" style="font-family: verdana, arial, geneva, sans-serif; font-size: medium; "><br /></span></div><div><span class="Apple-style-span" style="font-family: verdana, arial, geneva, sans-serif; font-size: medium; "><br /></span></div><div><span class="Apple-style-span" style="font-family: verdana, arial, geneva, sans-serif; font-size: medium; "><br /></span></div><div><span class="Apple-style-span" style="font-family: verdana, arial, geneva, sans-serif; font-size: medium; "><br /></span></div><div><span class="Apple-style-span" style="font-family: verdana, arial, geneva, sans-serif; font-size: medium; "><br /></span></div><div><span class="Apple-style-span" style="font-family: verdana, arial, geneva, sans-serif; font-size: medium; "><br /></span></div><div><span class="Apple-style-span" style="font-family: verdana, arial, geneva, sans-serif; font-size: medium; "><b>Solution:</b></span></div><div><span class="Apple-style-span"><span class="Apple-style-span" style="font-size: medium;">We are gonna play with number bases this time. Hope you are familiar with them, or else you will not understand a bit after this sentence (Apologies. Thanks.).</span></span></div><div><span class="Apple-style-span"><span class="Apple-style-span" style="font-size: medium;"><br /></span></span></div><div><span class="Apple-style-span"><span class="Apple-style-span" style="font-size: medium;">So, we have 5 slaves. Lets just forget about number of barrels and also assume that we have only 1 day. One day and five slaves, thats it. Can we determine how many barrels can we solve with our new constraints? Yes, we can. Lets see how:</span></span></div><div><span class="Apple-style-span" style="font-size: medium;">Five slaves and one chance. They must drink in a fashion that covers all the barrels and drink in a unique way i.e each barrel must be drank by a unique set of slaves, so that when some slaves die, we can determine which barrel went down their bloods.</span></div><div><span class="Apple-style-span" style="font-size: medium;">Now, any slave either drinks a barrel or doesn't. Only two options. This reminds of binary systems, and we treat each slave as a binary bit. 5 slaves (read bits) means a total of 2^5=32 numbers. Thats our answer, 5 slaves can only drink 32 barrels in a completely unique way (just like 5 bits can represent 32 numbers uniquely). So here's how we would have solved the problem with 32 barrels:</span></div><div><span class="Apple-style-span" style="font-size: medium;">Represent the barrels index number in binary (zero-indexed). So,</span></div><div><span class="Apple-style-span" style="font-size: medium;">Barrel-0: 00000</span></div><div><span class="Apple-style-span" style="font-size: medium;">Barrel-1: 00001</span></div><div><span class="Apple-style-span" style="font-size: medium;">Barrel-2: 00010</span></div><div><span class="Apple-style-span" style="font-size: medium;">.</span></div><div><span class="Apple-style-span" style="font-size: medium;">.</span></div><div><span class="Apple-style-span" style="font-size: medium;">Barrel-31: 11111</span></div><div><span class="Apple-style-span" style="font-size: medium;"><br /></span></div><div><span class="Apple-style-span" style="font-size: medium;">Also, lets assume five slaves namely a,b,c,d, and e. Lets say e is the least significant bit slave. So slave-e will drink whenever the LSB is set to 1. Similarly slave-d drinks whenever 2nd bit from right is set to 1 and so on.</span></div><div><span class="Apple-style-span" style="font-size: medium;">So, no one drinks Barrel-0.</span></div><div><span class="Apple-style-span" style="font-size: medium;">Barrel-1 is drank by Slave-1</span></div><div><span class="Apple-style-span" style="font-size: medium;">Barrel-2 is drank by Slave-2</span></div><div><span class="Apple-style-span" style="font-size: medium;">.</span></div><div><span class="Apple-style-span" style="font-size: medium;">.</span></div><div><span class="Apple-style-span" style="font-size: medium;">Barrel-31 is drank by all.</span></div><div><span class="Apple-style-span" style="font-size: medium;"><br /></span></div><div><span class="Apple-style-span" style="font-size: medium;">Now, just let everyone drink according to the logic decided above. At end of day, we can determine the corrupted barrel by seeing who all died and since the drinking-sets were unique we know the answer pretty easily. We bring back the 5-bit number terminology we used for numbering the barrels and set the bits with value as 0, if the slave did not died and 1, if died. For eg. if slave-c and slave-e dies, then we have:</span></div><div><span class="Apple-style-span" style="font-size: medium;"> a b c d e -Slaves</span></div><div><span class="Apple-style-span" style="font-size: medium;"> 0 0 1 0 1 - Died or not</span></div><div><span class="Apple-style-span" style="font-size: medium;">which is the number 5 (00101b)</span></div><div><span class="Apple-style-span" style="font-size: medium;">Hence, barrel-5 is the corrupt barrel.</span></div><div><span class="Apple-style-span" style="font-size: medium;"><br /></span></div><div><span class="Apple-style-span" style="font-size: medium;"><br /></span></div><div><span class="Apple-style-span" style="font-size: medium;">So far, if you have understood the solution to our sliced-puzzle, you are good to go.</span></div><div><span class="Apple-style-span" style="font-size: medium;"><br /></span></div><div><span class="Apple-style-span" style="font-size: medium;">Ok, so now, 5 slaves, 2 days/chances and 240 barrels. Thats huge numbers.</span></div><div><span class="Apple-style-span" style="font-size: medium;"><br /></span></div><div><span class="Apple-style-span" style="font-size: medium;">We stick to our approach and try to scale it up. </span></div><div><span class="Apple-style-span" style="font-size: medium;">We still have 5 slaves, so the number of bits cant scale up definitely. </span></div><div><span class="Apple-style-span" style="font-size: medium;">We have 2 chances, one more than we had in our sliced-puzzle. So, now either a slave doesn't drink the wine at all, drinks it the first day OR, OR... drinks it the next day (if he is lucky enough to see the next day).</span></div><div><span class="Apple-style-span" style="font-size: medium;"><br /></span></div><div><span class="Apple-style-span" style="font-size: medium;">Time to scale up the base now. So we have base-3 now. Slaves have states 0,1 or 2 (0: Never drinks, 1: drink on day-1, 2: drink on day-2). And we can solve 3^5=243 barrels with this!!! Lets just number up the barrels again in the new base now:</span></div><div><span class="Apple-style-span" style="font-size: medium;">Barrel-0: 00000</span></div><div><span class="Apple-style-span" style="font-size: medium;">Barrel-1: 00001</span></div><div><span class="Apple-style-span" style="font-size: medium;">Barrel-2: 00002</span></div><div><span class="Apple-style-span" style="font-size: medium;">Barrel-3: 00021</span></div><div><span class="Apple-style-span" style="font-size: medium;">.</span></div><div><span class="Apple-style-span" style="font-size: medium;">.</span></div><div><span class="Apple-style-span" style="font-size: medium;">Barrel-243: 22222 (We wont be needing the last 3 barrel numbers as we have just 240 barrels in hand)</span></div><div><span class="Apple-style-span"><span class="Apple-style-span" style="font-size: medium;"><br /></span></span></div><div><span class="Apple-style-span"><span class="Apple-style-span" style="font-size: medium;">Now let all slaves drink the wines as per the new logic.</span></span></div><div><span class="Apple-style-span"><span class="Apple-style-span" style="font-size: medium;"><span class="Apple-style-span" style="font-size: 14px; "><div><span class="Apple-style-span" style="font-size: medium; ">So, no one drinks Barrel-0.</span></div><div><span class="Apple-style-span" style="font-size: medium; ">Barrel-1 is drank by Slave-1</span></div><div><span class="Apple-style-span" style="font-size: medium; ">Barrel-2 is drank by Slave-1 on second day</span></div><div><span class="Apple-style-span" style="font-size: medium; ">.</span></div><div><span class="Apple-style-span" style="font-size: medium; ">.</span></div><div><span class="Apple-style-span" style="font-size: medium; ">Barrel-243 is drank by all on second day. (This does not exist as per puzzle, meant just for illustration)</span></div><div><span class="Apple-style-span" style="font-size: medium; "><br /></span></div><div><span class="Apple-style-span" style="font-size: medium; ">Also if anyone dies on day-1, and was supposed to drink some barrel the next day but has died already, you can ignore them (for eg. everyone must drink barrel-243 next day, but it is quite possible that some slaves already died.)</span></div><div><span class="Apple-style-span" style="font-size: medium; ">So, all slaves drinks two days and then we fill up our table with who died when (0: Did not died; 1: Died on day-1; 2: Died on day-2)</span></div><div><span class="Apple-style-span" style="font-size: medium; ">So if slave-a died on 2nd day and no one dies on day 1 either, we have:</span></div><div><span class="Apple-style-span" style="font-size: medium; "> a b c d e - Slaves</span></div><div><span class="Apple-style-span" style="font-size: medium; "> 0 0 0 0 2 - Day when died</span></div><div><span class="Apple-style-span" style="font-size: medium; ">which is number-3 and hence the Barrel-3 is corrupted.</span></div><div><span class="Apple-style-span" style="font-size: medium; "><br /></span></div><div><span class="Apple-style-span" style="font-size: medium; ">The solution was presented in such a level of detail, so that the readers can appreciate the beauty of the solution and extend/scale it further to various other puzzles/daily-problems!</span></div></span></span></span></div>ashishhttp://www.blogger.com/profile/16607235147529676866noreply@blogger.com0tag:blogger.com,1999:blog-2670249291344643591.post-32006781533705258842010-07-20T01:26:00.000-07:002010-07-20T02:47:50.784-07:00Mobile Sites and Usability: An unlocked phenomena<div style="text-align: center;"><br /></div><div style="text-align: left;">Everyone knows how iPod/iPhone revolutionized the user experiences of handheld devices. Its a device more usable than anything before of its kind</div><div style="text-align: left;"><br /></div><div style="text-align: left;"><img src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiIQofStfiA7BucW4rByhN4te4AwtdRhfr_wqH4k6NiUxtg2ttR2iHsrhMUrDarct1_l2xWfOS5EBPd0xQRhi3b_CmD2okc8SayK0DXWCrg3SqPwL2zw-hcerFJ0ZjRI9bNjpGQwOdhXsk/s320/iphone-ui-2.jpg" style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 320px; height: 247px;" border="0" alt="" id="BLOGGER_PHOTO_ID_5495911322311631522" /></div><div><br /></div><div>Lets hold our thoughts here, think for sometime and figure out the awesomeness behind this great user-experience. The two very basic points their UI revolved around were:<div style="text-align: center;"><br /></div><div>1. Make the Action-Points in the UI easily reachable. Since iPod was a touchscreen device, they used big sized buttons to achieve this, and a highly calibrated keyboard made typing a smoothie. Those big buttons really made accessing those action points easily. You never feel like using a stylus with iPod/iPhone, thats ease of access.</div><div><br /></div><div>2. Minimal Scrolling: Use multiple screens instead of one big list, go deeper levels or flip that screen but stay on a single page. iPod had reasonably categorized menus at as many places as possible and the very intuitive "back" buttons sure showed the way out to the main application.</div><div><br /></div><div>If you look closely at one of those apps you love to use, you will find the above two ideas stuck into their genes.</div><div><br /></div><div>But, somehow, and sadly, web din't adapted this phenomenal user experience. Still there are underlined anchors, default terrible buttons and long wap-pages on mobile-versions of web sites. I believe there is a tremendous potential in this UI which is yet to be uncovered as far as mobile websites are concerned.</div><div><br /></div><div>I tried to check it out on a very lame Google search page, results not being so pretty but definitely way more usable (Sorry i am a little bad at CSS thingies):</div><div><br /></div><div><img src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhGyPETHwJE9S7nSQKVniuPmuhh1XuX6S0mrIqgX4csDFeEC35QZWFP8RvBXh1qlQfgVqO0mYK_ilSt_OfztZkMh3XlSuTGTGCUTqfYlF24v-i1JLvTVarTJRwJpGz7hy3je1364aCjcZ8/s320/google.png" style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;" border="0" alt="" id="BLOGGER_PHOTO_ID_5495907615457941506" /></div><div><br /></div><div>Which one do you prefer? (do let me know in comments!)</div><div><br /></div><div>We have got to unlock this phenomenal UI into our web coding guidelines. The way wap sites are designed must take a leap and jump into the awesomeness of this user experience.</div><div><br /></div><div>I suggest sticking to the following points when developing a mobile version for your site:</div><div><br /></div><div>1. Use <b>block styled</b> anchors or block styled anchored lists for your navigation and other links.</div><div><br /></div><div>2. Major Action Points in your site must have those big <b>huge buttons</b> to seek attention and improve the usability and user-experience of your site.</div><div><br /></div><div>3. Try to be very specific and manage the whole content <b>within a page</b> or two at max. Lets break those never ending longer than Wall of China websites. We really dont need them, come on, we are heading to 4G now. Its the experience that would matter down the line and not the number of lines in your site.</div><div><br /></div><div>4. Make sure you have a good amount of <b>margin</b> between your elements otherwise it gets really messed up on a touchscreen device and users end up clicking unwanted things.</div><div><br /></div><div>5. Keep it <b>clean</b>, use shorter and straight words, and more visual and iconic displays rather than texts. Users are getting smarter, lets make smart sites now.</div><div><br /></div><div>Lets make web better, together!</div><div><br /></div></div>ashishhttp://www.blogger.com/profile/16607235147529676866noreply@blogger.com3tag:blogger.com,1999:blog-2670249291344643591.post-69148720398257756372010-07-18T07:36:00.001-07:002010-07-18T07:39:52.963-07:00Dear Facebook, Please keep your UI semantics sensibleDear Facebook,<br /><br />I have noticed that clicking on the "Top News" link changes the top news everytime. The top news doesn't seems like top news anymore. I understand you might be looking forward to engaging more users by doing so, but it is pissing off many of us.<br /><br />You being the big daddy of the social network, we expect a stable and sensible browsing experience from you.<br /><br />Regards,<br />FB User!ashishhttp://www.blogger.com/profile/16607235147529676866noreply@blogger.com0tag:blogger.com,1999:blog-2670249291344643591.post-24562566387695818092010-07-10T11:49:00.001-07:002010-07-10T13:33:07.493-07:00Intelligent PasswordsI attempt and dare to solve the problem of password-stealing which occur primarily due to Social Engineering Hacks. Also, this adds another layer of protection over passwords and make passwords more secure and usable!<br /><br />The method exploits the fact that given a word to type, different people will type the word in different fashions. The speed of typing will be different and the typing-accent will vary. We now attach this typing-accent attribute to the password and make them more secure i.e. even if you tell your password to a third-person, he wont be able to authenticate himself as you.<br /><br />Also, this improves the usability of passwords. As pointed by Jakob Nielsen, un-masking the password would provide better usability. Passwords can now be unmasked as this method tries to cover for the social engineering hacks which are the clear threats to unmasking passwords.<br /><br />As a proof of concept, i provide a demo <a href="http://ashishlivedemo.appspot.com/pwd.html" target=_blank>here</a>. The demo is Javascript based, where you can set your password and then attempt to enter it again. Try different accents in typing like typing the first three characters very fast and then rest very slow. If you have people around you, please experiment with them by asking to enter the same password!<br /><br />Feedbacks/Comments Requested!!ashishhttp://www.blogger.com/profile/16607235147529676866noreply@blogger.com5tag:blogger.com,1999:blog-2670249291344643591.post-35571988451521846762010-06-18T12:29:00.000-07:002010-06-18T12:35:02.046-07:00Setting Brightness right on UbuntuWell, i accept it. I tried everything available on Google and nothing seems to work for me to control my Lenovo laptop's screen's brightness.<br />So i wrote a little script to get my work done.<br /><br />.setbright.sh:<br />#!/bin/sh<br /><br />if [ $# -ne 1 ]<br />then<br /> echo "Usage: bright 50"<br /> exit<br />fi<br /><br />x=$((($1*254)/100))<br />n=$(echo "ibase=10;obase=16;$x" | bc)<br /><br />sudo setpci -s 00:02.0 F4.B="$n"<br /><br />#End of setbright.sh<br /><br /><br /><br />Then modfied my .bashrc as:<br /><br />alias bright=$HOME/.setbright.sh<br />bright 50 #Set Brightness to 50%<br /><br /><br />Now use on command line as:<br />bright 60<br /><br /><br />Am happy as of now with this!!ashishhttp://www.blogger.com/profile/16607235147529676866noreply@blogger.com0tag:blogger.com,1999:blog-2670249291344643591.post-44372332562662687202009-05-02T05:37:00.000-07:002009-05-02T06:35:45.040-07:00Baye's Theorem: Cut it out!There is this big crowd of people who are desperately trying to to be a part of community that knows the answer to: "Why did that Bayesian traveler didn't crossed the road?"<br /><br />To them it looks like the world is divide into two parts: Smart-ass people who knows what Bayes is all about; and they themselves!<br /><br />To all my friends on the other side, here's a chance to grasp Bayes in most intuitive way (I assume you know basic probability stuff)!<br /><br /><span style="font-weight:bold;">The Problem:</span><br /><span style="font-style:italic;">(Courtesy: http://yudkowsky.net/rational/bayes)</span><br /><br /><blockquote>1% of women at age forty who participate in routine screening have breast cancer. 80% of women with breast cancer will get positive mammographies. 9.6% of women without breast cancer will also get positive mammographies. A woman in this age group had a positive mammography in a routine screening. What is the probability that she actually has breast cancer?</blockquote><br /><br /><span style="font-weight:bold;">Variables:</span><br /><br />Lets assign the good old variables to the events we have in the problem:<br />A: People with cancer<br />B: People with positive mamographies<br /><br />Just to make the conventions clear:<br />P(A): Probability that a person has cancer<br />P(B): Probability that person will get a positive mamography<br /><br />Note: P(A|B) in general means probability of A, given that B happens!<br />So,<br />P(A|B): Probability that a person has cancer, given he got a positive mamography<br />P(B|A): Probability that person gets a positive mamography, given he has cancer (i feel sad for him though)<br /><br />That's a lot of dumb variables!!!<br />Lets move to interesting things now...<br /><br /><span style="font-weight:bold;">What we know from the problem:</span><br /><br /><blockquote>P(A) = 1%<br />P(B) = ??<br />P(B|A) = 80%<br />P(A|B) = ?? (This the real QUESTION)</blockquote><br /><br />Check-Point: <span style="font-style:italic;">If you are clear with everything till now, i guarantee you will understand Bayes theorem in just some minutes from now!!!</span><br /><br /><span style="font-weight:bold;">Breaking it down:</span><br /><br />Finding P(B) (persons with positive mamographies is not difficult).<br />P(B) = Cancerians with positive mamographies + Non-Cancerians with positive mamographies<br /><br />So, P(B) = 1%*80% + 9.6%*(1-1%) = 0.10304<br /><br /><span style="font-weight:bold;">Bayes in Action:</span><br />A person got positive mamography and we need to find the probability he actually has cancer. This would be simple:<br /><br />Required Probability = People with cancer and positive mamography/People with positive mamography<br /><br />Denominator is P(B). We already know that!<br /><br />On to the numerator:<br />P(A)% (1%) people have cancer<br />Out of these P(B|A)% (0.10304*) people have positive mamographies<br /><br />So,<br />People with cancer AND positive mamography = (Any Guesses???)<br />Yes, its 1% * 0.10304%!<br />=P(A)*P(B|A)<br /><br />SO.<br /><br />P(A|B) = P(A)*P(B|A)/P(B)<br /><br />As simple as that!<br />That's what Bayes was trying to tell you...<br />I bet you did'nt knew it was this simple!!! :)ashishhttp://www.blogger.com/profile/16607235147529676866noreply@blogger.com0tag:blogger.com,1999:blog-2670249291344643591.post-72828054215018538212009-03-05T07:08:00.000-08:002009-03-05T08:01:32.097-08:00Efficient CaptchasThere is a whole lot of buzz in the internet about alternatives to captchas (i mean alternatives to image captchas). Its not mainly because captchas are not secure against bots, but because they aren't convenient!!!<br />People are getting bugged because of highly illegible captcha strings (http://tinyurl.com/5bvk7c).<br /><br />But i really feel, captchas, if done properly are the best form of human recognition technique. Its simple, fast, and sufficiently secure. People are used to image captchas, and it just works! I get more bugged when I'm asked silly questions, or to solve a mathematical equation or when i have to select kittens out of 9 pictures of animals!!!<br /><br />I put up some points here on how to create usable and convenient captchas:<br /><br />1. Use a light background. I'll prefer a plain white background. Backgrounds do provide some security but having a regular background for all captchas does not helps as an average captcha solving algo will adapt itself to it.<br /><br />So, its always better to present your captcha in white background, so that its easier to read.<br /><br />2. Dont just use random words, instead use a phonetic generator to generate your captcha strings. This helps a lot in terms of captcha usability. Also, a phonetic generator does not poses much threat to your captcha getting hacked. Sure, it increases the threat but it provides more usability than threat.<br /><br />3. DO NOT use a straight baseline and loosely couples letters. While writing any captcha hacking program, the most difficult operation is Segmentation. You can captivate on this weakness of captcha hackers by keeping wavy baselines and keeping letters coupled in random fashion.<br /><br />4. Use single color for your captcha (better user experience and readability). A captcha bot can easily convert your captcha to grayscale for hacking.<br /><br />5. Use letter warping, instead of image warping for the whole captcha. Warped letters are difficult to segment and recognize.<br /><br />6. Differnt length captcha strings everytime for more security.<br /><br />I hope it helps the community and eventually the end users, the humans!!!ashishhttp://www.blogger.com/profile/16607235147529676866noreply@blogger.com0tag:blogger.com,1999:blog-2670249291344643591.post-6052620632343168632008-09-11T10:22:00.001-07:002008-09-11T10:22:55.740-07:00Shortest* Javascript Code that prints its own Code!This is one of the challenging tasks for any programming language:<br />Write a code that prints itself on the terminal!<br />To make it more interesting… code it short!<br /><br /><br />I took a shot at javascript and came up with the following code. If you can come up with shorter code, DO POST AS COMMENT!<br /><br />Lets see who’s short&smart!<br /><br />The Code (177 chars, tested on FF3):<br /><br />var dq='"';var q="'";var s='document.write("var dq="+q+dq+q+";var q="+dq+q+dq+";var s="+q+s+q+";"+s);';document.write("var dq="+q+dq+q+";var q="+dq+q+dq+";var s="+q+s+q+";"+s);<br /><br />Your turn now… I’m waiting!ashishhttp://www.blogger.com/profile/16607235147529676866noreply@blogger.com1tag:blogger.com,1999:blog-2670249291344643591.post-82717367149390315332008-09-08T09:40:00.000-07:002008-09-08T09:44:05.230-07:00Coolest Programming Convention Ever!!!<p class="MsoNormal" style="margin-left: 21pt;"><span style=";font-family:Arial;font-size:100%;" ><span style="line-height: 150%;font-family:Arial;" >Really don’t know how many of you actually heard of this...<o:p></o:p></span></span></p> <p class="MsoNormal" style="margin-left: 21pt;"><span style=";font-family:Arial;font-size:100%;" ><span style="line-height: 150%;font-family:Arial;" >This coding convention is really cool:<o:p></o:p></span></span></p> <p class="MsoNormal" style="margin-left: 21pt;"><span style=";font-family:Arial;font-size:100%;" ><span style="line-height: 150%;font-family:Arial;" ><o:p> </o:p></span></span></p> <p class="MsoNormal" style="margin-left: 21pt;"><span style=";font-family:Arial;font-size:100%;" ><span style="line-height: 150%;font-family:Arial;" >It goes like this: For equivalence statements, keep the constant on the left side.<o:p></o:p></span></span></p> <p class="MsoNormal" style="margin-left: 21pt;"><span style=";font-family:Arial;font-size:100%;" ><span style="line-height: 150%;font-family:Arial;" ><o:p> </o:p></span></span></p> <p class="MsoNormal" style="margin-left: 21pt;"><span style=";font-family:Arial;font-size:100%;" ><span style="line-height: 150%;font-family:Arial;" >Eg. a == 3; //Not Good<o:p></o:p></span></span></p> <p class="MsoNormal" style="margin-left: 21pt;"><span style=";font-family:Arial;font-size:100%;" ><span style="line-height: 150%;font-family:Arial;" > 3 == a; //Gr8!<o:p></o:p></span></span></p> <p class="MsoNormal" style="margin-left: 21pt;"><span style=";font-family:Arial;font-size:100%;" ><span style="line-height: 150%;font-family:Arial;" ><o:p> </o:p></span></span></p> <p class="MsoNormal" style="margin-left: 21pt;"><span style=";font-family:Arial;font-size:100%;" ><span style="line-height: 150%;font-family:Arial;" >How it helps???? It will help you in situations where you "mistakingly" used a "=" inplace of"==".<o:p></o:p></span></span></p> <p class="MsoNormal" style="margin-left: 21pt;"><span style=";font-family:Arial;font-size:100%;" ><span style="line-height: 150%;font-family:Arial;" >a = 3 compiles to true<o:p></o:p></span></span></p> <p class="MsoNormal" style="margin-left: 21pt;"><span style=";font-family:Arial;font-size:100%;" ><span style="line-height: 150%;font-family:Arial;" >While, 3 = a generates a compile time error!!!<o:p></o:p></span></span></p> <p class="MsoNormal" style="margin-left: 21pt;"><span style=";font-family:Arial;font-size:100%;" ><span style="line-height: 150%;font-family:Arial;" ><o:p> </o:p></span></span></p> <span style=";font-family:Arial;font-size:100%;" ><span style="line-height: 150%;font-family:Arial;" >Wow!! Isn’t it!</span></span>ashishhttp://www.blogger.com/profile/16607235147529676866noreply@blogger.com2