Wednesday, February 25, 2009

The Gmail Bug

Well after The Zune Media Player had a Bug in the Module which Calculates the Leap Year Correction
(more info here).It started a Blame Game in the Entire Set Up of Microsoft Zune Division.
The Recent Layoffs were attributed to this fiasco.
Now, its the turn of Google it seems.

This one seemed Quite Surprising When Google's Product Gmail Suffers from a Bug in the section which Records the Time Elapsed from the Time the Mail was Received in your Inbox.
I have a Screenshot to Illustrate this.




It Shows the Time here as -2 Minutes Which Essentially means that there is still 2 minutes left for me to receive this mail :P

After few Minutes it doesn't show any discrepancy.
Here is another Screenshot after few Minutes.


Well,The Weirdest thing about both of these Bugs are that both of them are related to the Date and Time which are often Regarded as Trivial Part but then Even nitd_developers had been plagued with such problems during LibTimeManager 1.0.(so no Blame games ..)

So the Most Interesting Part is how to catch this Bug.
1) Well Anticipate a Mail (either ask your friend to mail you or do self-mail ).
2) Open the Mail within like 20 seconds after receiving the mail (The most Crucial Part).
3) Now check the Timing to the right of the show Details Hyperlink.
4) It should be Negative if the Bug is Consistent.(I didnt Check in all Browsers or in all Platforms .)

I just Hope that Everyone does their Counting Right :P


Do Post Comments if you do find more such Bugs.

Friday, February 13, 2009

TLE :: Contest with a Difference

TLE, The Online Contest of IIIT - Hyderabad was a refreshing one for me.We had to solve the Questions with different constraints. One of the Questions that we managed to pull off well was this one:
In short, a code to draw the Penguin Image with shortest possible code.
The Actual Code we submitted was:


i,j,d,q;char*k[]={"4 1 1.1:8x1:1.","29 .16x.","28 :19x:.","27 .23x:","26 :25x:","26 26xX:","26 3x3:8x4:9x:","25 .2x:3 2:5x:5 :8x","25 :2x2 x.2 4x:2 2x.2 8x","25 :2x 3x2 4x: 4x2 :7x","25 '2x '2x2 4x:. 2x'2 8x","26 2x 6:2x5:.3 8x","26 2x5:.4:.7:8x","26 :x'4:'4:'5:':9x.","26 :2x.12:'3 10x","26 :2x: '8:'5 :10x.","25 .2x5 '4:'8 '10x.","23 .4x21 '9x.","21 .4x25 '9x.","19 .5x:26 10x.","18 .5x:'26 11x.","17 .6x3:.11 .7 2.3:_11x:.","16 .7x2'6 '3:2'12 2'2:12x.","16 6x12 :18 '2:12x","15 :4x:'12 :20 '12x:","14 .5x14 :21 2:12x","14 4x:'36 2:12x","14 4x15 .22 2:12x.","10 .:6x15 :22 2:12x2:","10 8x15 :22 2:13x:","10 8x15 :22 2:13x:","10 ':6x15 '22 2:12x:'","12 .:. 2x:.35 .:13x'","10 6:.'2x:.12 :18 .2: 11x':","2 .15:.'4x.28 4:'8x'3:.","2 18:.'5x26 5:.'.2x.'6:.","2 20:.'4x:.23 7:.2'9:","2 '21:.'2x:'21 .'20:2.","4 21:.'2x20 .2: 23:","2 .23:. 2x15 .2:4x 23:","2 25:.'3x2.8 .2:7x 20:'","2 '25: 23x 17:'","4 '23: 23x 15:'","8 '19:_6x2:3'2:10x '12:'","13 2':.10:'24 `._'6:2'"};main()
{for(;i<45;i++,puts("")){for(j=-1;q=k[i][++j];)if(isdigit(q))d=d*10+q-48;else{d=d?d:1;while(putchar(q),--d);}}}

However, I know the above code is really unreadable. So, I made it a point to Display the actual Code that was first used to come up with the actual one.

/*
* This is the code for Drawing the Penguin
*/
#include"iostream"
#include"string"
using namespace std;

int main() {
/*
* The Array of String below is the Actual Data about the Penguin
*/
string k[] = {"13 2'1:1.10:1'24 1`1.1_1'6:2'", "8 1'19:1_6x2:3'2:10x1 1'12:1'", "4 1'23:1 23x1 15:1'", "2 1'25:1 23x1 17:1'", "2 25:1.1'3x2.8 1.2:7x1 20:1'", "2 1.23:1.1 2x15 1.2:4x1 23:", "4 21:1.1'2x20 1.2:1 23:", "2 1'21:1.1'2x1:1'21 1.1'20:2.", "2 20:1.1'4x1:1.23 7:1.2'9:", "2 18:1.1'5x26 5:1.1'1.2x1.1'6:1.", "2 1.15:1.1'4x1.28 4:1'8x1'3:1.", "10 6:1.1'2x1:1.12 1:18 1.2:1 11x1'1:", "12 1.1:1.1 2x1:1.35 1.1:13x1'", "10 1'1:6x15 1'22 2:12x1:1'", "10 8x15 1:22 2:13x1:", "10 8x15 1:22 2:13x1:", "10 1.1:6x15 1:22 2:12x2:", "14 4x15 1.22 2:12x1.", "14 4x1:1'36 2:12x", "14 1.5x14 1:21 2:12x", "15 1:4x1:1'12 1:20 1'12x1:", "16 6x12 1:18 1'2:12x", "16 1.7x2'6 1'3:2'12 2'2:12x1.", "17 1.6x3:1.11 1.7 2.3:1_11x1:1.", "18 1.5x1:1'26 11x1.", "19 1.5x1:26 10x1.", "21 1.4x25 1'9x1.", "23 1.4x21 1'9x1.", "25 1.2x5 1'4:1'8 1'10x1.", "26 1:2x1:1 1'8:1'5 1:10x1.", "26 1:2x1.12:1'3 10x", "26 1:1x1'4:1'4:1'5:1'1:9x1.", "26 2x5:1.4:1.7:8x", "26 2x1 6:2x5:1.3 8x", "25 1'2x1 1'2x2 4x1:1.1 2x1'2 8x", "25 1:2x1 3x2 4x1:1 4x2 1:7x", "25 1:2x2 1x1.2 4x1:2 2x1.2 8x", "25 1.2x1:3 2:5x1:5 1:8x", "26 3x3:8x4:9x1:", "26 26x1X1:", "26 1:25x1:", "27 1.23x1:", "28 1:19x1:1.", "29 1.16x1.", "4 1 1.1:8x1:1."};

for (int i = 45; i >= 0; i--) {
for (int j = 0, count = 0; j < k[i].size(); j++) {
if (isdigit(k[i][j])) {
count = count * 10 + (k[i][j] - '0');
} else {
for (int l = 1; l <= count; l++)
cout << k[i][j];
count = 0; //reset the count
}
}
cout << endl;
}
return 0;
}




Well, The Code Itself is self-explanatory. Finally the Actual Figure of Penguin looks like This.



We ended 66th Overall and 5th Indian Team when the Contest ended. You can view all the solutions at the official website of TLE.
Looking forward to more such Events in the future.