Thursday, October 15, 2009

Real World Code


Well,This Post is about a Contest that is to start off from 19th October and ends on 25th October.The Contest is named "Real World Code" and rightly so since it would involve a Functional Specification or FS Provided and the Participants have to come up with the Code following all Processes and Standards so mentioned in the FS.

The Coolest part is that you get to work on FS Developed and designed by SDE's who themselves work as per the same standards following the processes.Not to forget about the Prize Money .. 5 Grands up for grabs.. so Hurry up and Participate.


PS: Contest is open only to students of my College.Do register in the Mail-Id provided with the Poster Image.

Thursday, July 23, 2009

Life is like Recursion

Spoiler Alert: This Post is a tad philosophical and uses a concept called Recursion which is a pre-requisite.

Well,let me tell you something, i feel completely randomized when i start off with some work,slowly the randomization increases just as the entropy of a system goes on increasing, till a certain point after which mostly,things start falling into place.Voila, it then clicked to me that Life is like Recursion you start off with many number of recursive calls and don't know what you will end up with,but still you work up all the possible steps but then finally something clicks aka the base case and then things start getting standardized instead of being randomized and then the steps that you thought were straying you off path were in fact leading to bigger things in life.

And the thought doesn't end there, smart people memoize the recursive calls i.e they tend to learn from their mistakes so the next time you take the call,you know the consequences exactly but then there are also people who try to re-invent the wheel and end up having lot of over heads in life not that they fail or jump off the well but then they take their own sweet time to get there or may be never.

There are various schools of thought over this topic and this Post is just a represenation of my thoughts which in no means is meant to influence any of the mortals.

PS : 1) Try Searching "Recursion" @ Google, that page is recursive as well, click on did you mean and then you would know.
2) Witty Line : How does M$ make saints out of Morons? Reply :What are the stats of the conversion Ratio ,must be way better than ours?
3) The Above PS was meant for a specific group/individual.If you don't get the joke, then well, it was intended to be so.

Saturday, July 11, 2009

Notes@Work

Here at work, I never shut down my system since there is something or other that is pending and so the stats are :
"System Up Time: 20 Days, 4 Hours, 54 Minutes, 52 Seconds"

I move my desktop physically a lot hence just 20 days; now that I have found a decent location which is stable.I expect this to be around 40 days till the end of this month.

Sticky Notes do "stick" well. Around 2 months and it is still there on the wall very unlike the one's I had tried to simulate back in college.

Pool.. still pathetic at it, trying to improve but then that will take time and don't expect any Pankaj Advani type play from me though. (I have set highest standards in terms of being a true mediocre).


As a Final Note, @All Final Year's : Final Year here we come.Every year I don't wait for the academic year to start. It seems there is something with 4, maybe all are expecting some kind of a LEAP  :) .


PS:
1) No comments on weekends and rightly so,since i am at work all 7 days a week for last 1.5 months.
2) Too much Final in the Last Para.. what do you think?

Tuesday, July 7, 2009

Witty Kid @ Office

Posting after really long time but this one is a must share.

During a Recent HR Event by my Company which was themed around "Bring your Child to Work Day".

A small kid probably around 4-5 years of age was interacting with all his Father's Directs..(his Dad is a People's Manager with a team of around 6-7 Members) then suddenly one of them questions the kid "what does Dad do at work?".

Kid Replies,"Dad... takes the Lunch Box and Laptop.. then reads mails,attends meetings then goes to lunch with other members and comes back.. "

PS
1)My Verdict : "Yeah I am Loving It!!!!!!! Fun to be a Manager it seems :D.".
2) Kid gave the 101 on Being a Good Manager..

Wednesday, June 17, 2009

Fun Questions

I found this Interesting Questionaire in some blog. I felt I should try answering them too.

1. When you looked at yourself in the mirror today, what was the first thing you thought?
Buck up lazy fella .. loads of work pending ;)

2. How much cash do you have in your wallet right now?
Around 394 odd Rupees.

3. What’s a word that rhymes with DOOR?
More,Bangalore,Floor...

4. Who is the 4th person on your missed call list on your cell phone?
Abhinav Krishnamoorthy.

5. What is your favorite ring tone on your phone?
Always on Silent 24X7.

6. What are you wearing right now?
Jeans and T-shirt.

7. Do you label yourself?
No.I have left that for others ;)

8. Name the brand of the shoes you’re currently own?
Sparx (hardly wear it),Sandals Unbranded.

9.Bright or Dark Room?
Bright.

10. What do you think about the person who took this survey before you?
SOB .. didnot tag me :(

11. What does your watch look like?
I don't wear one..

12. What were you doing at midnight last night?
Slept..

13. What did your last text message you received on your cell say?
Airtel AV-Promo Message cannot be displayed

14. What's a word that you say a lot?
I want to Head AS* (Internal Confidential)

15. Who told you he/she loved you last?(please exclude spouse , family, children)
No one since Everybody decides that I am selfish after a while.

16. Last furry thing you touched?
Some Furry Toy on Bring your Child to Work Day @ Office.

17. Favourite age you have been so far?
Present.

18. What was the last thing you said to someone before doing this?
I will send across the details to him and CC you as well.

19.The last song you listened to?
Ana Free : Its Time && Nickelback : Rockstar

20. Where did you live in 1987?
No Idea

21. Are you jealous of anyone?
No one in Particular.

22. Is anyone jealous of you?
I feel so since they so want me dead :P

23. Name three things that you have on you at all times?
Mobile Phone,Wallet and a Pen.(Most of the times).

24. What’s your favourite town/city?
Mumbai.

25. When was the last time you wrote a letter to someone on paper and mailed it?
For some Freakin' Contest 12 years back.

26. Can you change the oil on a car?
No.

27. Your first love/big crush: what is the last thing you heard about him/her?
"Dude.. Change your Desktop. She looks Pathetic each passing day "

28. Does anything hurt on your body right now?
My Hands... I have been typing for a long time since Morning.

29.What is your current desktop picture?
Windows v/s Walls !!! :D

30. Have you been burnt by love?
No.


PS: I tag Ankit Prabhat,Roshan Singh and all other bloggers from my College.

Sunday, May 17, 2009

Department Results

Well, The Results for the Sixth Semester were declared and it has always been a practice for me to sort the results.
So,Here I am again. This Time I am sharing the Code so that People don't think I manually sort them ;).Also, I would like to congratulate all the dept guys/gals who have excelled as always and awaiting a cool Final Year ahead.





#include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;
struct stud
{
double cgpa;
double sgpa;
int roll;
};
struct sorter
{
bool operator () (const struct stud a, const struct stud b)
{
return a.cgpa>b.cgpa;
}
};
int main()
{
vectorvec;
ofstream out("res.txt");
ifstream in("in.txt");
struct stud a;
while(in>> a.roll >> a.sgpa >> a.cgpa)
vec.push_back(a);
sort(vec.begin(),vec.end(),sorter());
out<< "Roll\tSGPA\tCGPA\n" ;
for(int i=0;i<vec.size();i++){
out << vec[i].roll << "\t" << vec[i].sgpa << "\t" << vec[i].cgpa << endl;
}
out.close();
in.close();
return 0;
}


This Requires an Input File of the form :: Roll\tSGPA\tCGPA
and Output has the same Format which can be changed as well.

I would be coming out with more of code snippets.Till then Enjoy Life.

PS:

The Actual Cpp File is available at this Link :: Here
The Output File::

Roll SGPA CGPA
48 9.12 9.27
61 9.36 9.26
60 9.12 9.09
39 9.36 9.08
26 9.16 8.95
62 9.36 8.89
16 9.28 8.89
2 9.04 8.85
28 9.04 8.81
30 9.36 8.81
46 8.6 8.77
7 8.76 8.67
53 8.52 8.58
37 8.36 8.55
42 9 8.48
3 8.2 8.43
25 8.52 8.42
50 8.6 8.33
10 8.64 8.3
52 8.44 8.23
27 7.84 8.22
14 8.68 8.22
59 8.6 8.21
5 8.84 8.19
43 8.76 8.19
34 8.04 8.18
33 8.2 8.15
11 8.2 8.05
31 7.84 8.05
6 8.36 8.01
23 8.2 7.99
38 7.56 7.99
55 7.84 7.87
9 8.04 7.85
17 7.52 7.8
49 7.52 7.77
35 7.84 7.66
21 7.8 7.61
41 7.52 7.59
63 7.08 7.58
36 7.24 7.52
8 7.24 7.39
40 7.8 7.39
45 7.88 7.37
19 7.4 7.31
51 7.68 7.28
56 6.76 7.28
1 7.32 7.26
24 6.84 7.16
20 7 7.06
18 6.92 7.04
44 7.24 7.01
15 7.36 6.82
54 6.32 6.81
32 6.44 6.75
64 6.96 6.73
13 6.04 6.63
57 6.52 6.59
22 6 6.45
29 6.36 6.37
58 5.44 6.13
12 4.96 6.12
4 0 0
47 0 0

Saturday, April 25, 2009

Anagram Solver

First Things First : I am worse at solving Anagrams but a little bit better at writing a Code for solving them :D .

This Post is about a Code that I wrote for solving Anagrams.It all started with this bot friend in my friend list : games@gtalkbots.com.It is a bot that allows users to play anagram with other users.

I was(rather am) really pathetic at solving anagrams instantaneously.Instead of sulking, I thought I must do something about it. I could win each round if I could get an answer within 0.1 secs. (My own Heuristic).

So,The Best way is to write a C++ Code for the same.Then,after little brain storming (random thoughts actually), I just needed a Dictionary and a Data Structure to store it. Since Hashing was out of question for a Quick-Code,STL Set was the second Best with Insertion /Look up of Asymptotic Upper Bound of O(log(n)).So, I just had to check all Permutations of the Random String and look up the Dictionary and if Match is found then Output the Result.

Within first 2 results for Dictionary in Google, I found a US Dictionary List in txt format.
So, The C++ Code for the same ::


#include<iostream>
#include<string>
#include<cstdlib>
#include<set>
#include<fstream>
using namespace std;

// This is a Set that Stores the Dictionary Values.

set<string>s;

/*
* This Method is used to check whether the String matches the given Mask.
* Example : srinivas --i-i--s
*/

bool check(string a, string b) {
for (int i = 0; i < a.size(); i++)
if (isalpha(a[i]) && isalpha(b[i]) && a[i] != b[i])
return false;
return true;
}

/*
* This Method is used to find all Permutations of the String
*/

void perm(string pre, string suff) {

if (!suff.size())
cout << (s.find(pre) != s.end() ? pre + '\n' : "");
else
for (int i = 0; i < suff.size(); i++) {
perm(pre + suff[i], suff.substr(0, i) + suff.substr(i + 1, suff.size()));
}
}

int main() {

s.clear();
string a;
ifstream in;
in.open("US.dic");
while (in >> a)
s.insert(a);
in.close();
cout << s.size() << endl;
while (cin >> a) {
perm("", a);
cout << "----------------------\n";
}
return 0;
}



But then as Luck would have it, The Bot went offline after I wrote the Code. I guess both of them are somehow related. But then Next Time I find the bot online,you wouldn't wonder if you find my name as one of the Top-Scorer's.

Cheers!!!
Do Comment/Post about it.

Friday, April 24, 2009

EasyProb

This is one of the Problems that I did long time ago but then I came back to it today. I had a text file containing the Result that had been generated using the Code though the Code was missing.
So, I had to start everything from scratch and I have become a bit Rusty though got it working in some time.

The Code for the Same ::



#include <iostream>
#include <fstream>
using namespace std;
/*
* String Uses a Recursive Function to Achieve the Effect.
*/
string ret(int a) {

/*
* Base Cases
*/
if (a <= 0)
return "";
else if (a == 1)
return "2(0)";
else if (a == 2)
return "2";
/*
* Recursive Step Begins here.
*/

else {
string s = "";
int count = 1;
while (a > 0) {
if (a % 2 == 1)
//Magic Statement
s = (count <= 2 ? ret(count) : "2(" + ret(count - 1) + ")")+(s == "" ? "" : "+") + s;
count++;
a /= 2;
}
return s;
}
}

int main() {
int a;
while (cin >> a)
cout << a << "=" << ret(a) << endl;
return 0;
}



It feels good to get such Codes working in real quick time ;) .
PS :
1) The Output for all The Inputs in the Problem::

137=2(2(2)+2+2(0))+2(2+2(0))+2(0)
1315=2(2(2+2(0))+2)+2(2(2+2(0)))+2(2(2)+2(0))+2+2(0)
73=2(2(2)+2)+2(2+2(0))+2(0)
136=2(2(2)+2+2(0))+2(2+2(0))
255=2(2(2)+2+2(0))+2(2(2)+2)+2(2(2)+2(0))+2(2(2))+2(2+2(0))+2(2)+2+2(0)
1384=2(2(2+2(0))+2)+2(2(2+2(0)))+2(2(2)+2)+2(2(2)+2(0))+2(2+2(0))
16385=2(2(2+2(0))+2(2)+2)+2(0)

2) If you do have a code that is better than mine Please make it a point to post/Comment about it.

Friday, April 17, 2009

Addicted to Blogging

Well, This is a short Post Considering the fact that I have my Exams going on.
I took a short Online Test to check my addiction to Blogging.
The result is in form of a IMG.

62%How Addicted to Blogging Are You?



Cheers!!!!

Saturday, April 11, 2009

Google Ad-Sense Pdf's

This is about a series of Pdf's that I found on Google's UK Server which is about Case Studies of Ad-Sense Program.
I was reading about Configuring robots.txt File from this URL.

Then Began a Series of Re-Direction of URL's (http://google.co.in/robots.txt -->http://www.google.com/sitemaps_webmasters.xml-->http://www.google.co.uk/intl/en/adtoolkit/pdfs/pdf_sitemap.txt)until i reached out for a URL which contained a list of Pdf's.
I was too curious to find the Contents of all Pdf's in a single go.That is when i realized that I could download-them-all (No Pun Intended) real quick if I can use Shell scripts to semi-automate the download Process.

The Process I followed :
1) Copied the Contents of a txt file to a file on the system.

2)I just had to insert a Firefox before each URL.This was the Difficult Part since I was really awful at tweaking shell scripts to achieve that. Instead I wrote a Quick C++ Code to do the same with File Handling(It was guaranteed to work too ).
The C++ Code for the same ::




#include <iostream>
#include <fstream>
using namespace std;

int main() {
/*
* links.txt is the Original File that Contained the list of URL's.
*/
ifstream in("links.txt");
/*
* link.sh is the shell Script which was to automate the Process.
*/
ofstream out("link.sh");

string s = "";
while (getline(in, s)) {
// This line enabled the Insertion of firefox before each URL.
out << "firefox " << s << endl;
}
in.close();
out.close();
return 0;
}




3) I had disabled all Prompts for Download in the Preferences Tab. So, it would Download all of these pdfs without prompting me ;).After this, I just had to run the Script from the Terminal and Voila!! All Pdf's were downloaded within 1-2 minutes.

4) Later, I had to move the pdf's from default download directory to a different Directory.

5) Finally, using wc-l/Word Count for lines,I found out that I had downloaded around 167 pdf's (some of them being confidential :P ). Since it is accessible for public viewing .. it doesn't matter.

I did all these steps within a matter of around 4-5 minutes which is real-quick for me.
The Entire Process was real fun.. In case you had come across such quick-tweak then do post about it..

PS:
1) Advanced Shell Script Tweaking is a definite To Do Thing next Semester.

2) wget was a better option than Firefox :( .. I am on the learning Curve ... Trying to Grasp Few things..

Wednesday, April 8, 2009

W3C Validation for some Interesting Websites.

This is an Interesting Post considering that Most Websites with very high Network Traffic don't pass the W3C Validation.

The Only Website in my Test Space which passes the Validation is the Very Bankable Wikipedia.

Now The Microsoft Flagship Sites:
Microsoft Default Homepage ::
has 180 Errors, 32 warning(s) .
The Microsoft Search Site ::Live has 4 errors.

Google also has a fair share of this non-validation :
Indian Homepage for Google :: google.co.in has 58 Errors, 13 warning(s).

Amazon.com Homepage :: A2Z has 1587 Errors, 157 warning(s).

Indian Page for Amazon India Development Center :: Amazon India has 8 Errors, 5 warning(s).

Yahoo! Homepage :: Yahoo! has 34 Errors, 8 warning(s).

While Facebook site ::Facebook has 42 Errors, 8 warning(s).

Our Very own Indian Railways Site :: Indianrail has 240 Errors, 14 warning(s).

After these Results, I am compelled to think that whether W3C Validation mean much to us anyways? I mean we cannot stop using these sites just because they don't comply with certain standards.

PS: NIT Durgapur Homepage :: NIT DGP has 65 Errors, 6 warning(s).

Friday, April 3, 2009

Google Mail again

I now its kind of creepy but I have become an obsessive user of Google Mail/GMail of late so this post is again about GMail and the introduction of Support for Indian Languages in GMail.

The Google Transliteration Tool for Indian Language Rocks!!! :D and it has added more flexibility to the entire functioning of GMail as well.
You can Read more about this in the Official GMail Blog link here.
Plus There are a few Corrections regarding my Earlier Post about The GMail Bug : It isn't exactly a Bug since the GMail Interface uses Local System Time to show the Time Elapsed But According to me The Interface should be consistent with all GMail Users in India which means that the Time Reference to find the Time Elapsed should be according to the Google Server Time for India which can be found by searching for the String "current Time" on google.co.in !

Thanks to my friend Roshan Singh for pointing out the actual working of the Elapsed Time in GMail Interface though I had posted the Blog a lot earlier so didn't mind to change it.

Wednesday, March 18, 2009

Lakshya

I have always been baffled with this Question: " What am I going to do in my Life?" .I tried asking that Question to myself but could never manage any Decent Answers though.
Well.. all my friends around me have decided to either do MS@ US of A or go for MBA and some others are going to grab a job.
I thought I would review my chances for each of these Options :

1) MS/Post Grad:
I am really interested in Algorithms and Distributed & Parallel Computing.But Then I haven't began Preparing for GRE and Short-Listing Colleges.I have Personally seen that Short-Listing Colleges and getting an I-20(Acceptance Letter) is more Stressful than actually Preparing for GRE and after getting an Acceptance Scheduling an Interview in the Consulate is a more Daunting Task.I am more of the view that Having Work Experience works better (it is just my view ).

Deterrent for doing MS :

* Choosing Field of Study and really good college.
* Scoring Higher in GRE is bigger factor.

2) MBA :
Management has never been my cup of Tea though I am not really Pathetic at Understanding Core Principles of Management. Plus I am well Versed with Concepts of Finance and the Financial Situation in India & Indian Stock Markets.Still Cracking the CAT/other exams is the single biggest factor while considering doing MBA in India.Applying in Foreign Universities deal with issues along the same lines as doing MS.

Deterrents for doing MBA :

* CAT/GMAT and other Entrance Exams.
* Is MBA the best Move for me ?

3)JOB:
Well.. the easiest of Choices so far.Still getting a Job Demands Clearing Writtens during On-Campus Recruitment which is again a Rat-Race.I love Programming and solving Complex Real-Life Problems with use of Technology.I am not really good at it though I am trying to Improve.But the Recession has reduced the Scope of Choice so getting into the Job Pond doesn't seem to be the best Option.Plus I still feel I am too childish to be owning Positions of Responsibility.

Deterrents for Joining Company :

* Other Options.
* Work Pressure and Corporate Life & Responsibility.

So,Finally after weighing all Options I am still in the same Position that I was long time ago. (World is Indeed Round... :P ) I guess I ll let my Instincts decide the Future Course of Action.

PS :I saw Lakshya for Inspiration but it didn't help much.

Sunday, March 1, 2009

CopyCat 1.0

This Post is about CopyCat 1.0 (StandAlone Application in Java) which has been developed by nitd_developers for the College Tech-fest.

We had been approached with the Requirement for a Stand-Alone Application which could generate a Random Path so that Each Team is assigned a slightly Different Path with similar Constraints like the No of Turns being fixed and the max of steps it can take in a particular Direction till the next turn is encountered. We also took it up as challenge as we had never worked on Random Path Generation before.

Things weren't coherent at the beginning as to what was required to be done so that the Random Path generated strictly adheres to the Constraints. Then Swapnil came up with a set of equations which Govern the no of steps to be taken before a turn is encountered and also constraining the equation with another variable which keeps note of the turns.

Now,using this Governing Equation we could come up with 2 different set of Paths which Different Constraints.

Then,as an addition to the Random Path Generation ,We Provided support for Team Registration and Assigning Randomly Generated Paths to each Team Beforehand and then Viewing the Path assigned at a later Stage.


Few Screenshots of CopyCat 1.0

1) Team Details Panel:





2) GridPanel:




Positives for nitd_developers from this Application:

- It was Fun as always and also Gained a fair Idea about Random Generation with Constraints.

- Code was More Readable this time and used a better IDE(NetBeans) this time.

- Avoided Mistakes that were Committed last time (especially Code Duplication).

- Avoided Database for Trivial Data Storage Instead Serialized the Objects.


Things that we need to Improve Upon:

- Firstly,It would be making the entire Design more Flexible.It is more a continuous Process and we are definitely moving a step forward in that front.

- Using Standard Layouts in GUI was Missing yet again.We would need to come up with some Solution for that.(Null Layout should have been avoided).

- Finally,We need to be better than atleast ourselves every time we take up a new Task.



PS: If you have any Suggestions/Queries then Feel Free to Contact nitd_developers at nitd_developers@googlegroups.com

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.

Saturday, January 31, 2009

Using Products Fresh from Google Labs

If you spend most of your time on Google,Gmail,Gtalk ,Orkut,Blogger or any other Google Product. Then this page is the most essential thing that you need to visit. "Google Labs" ,as it is called, is a PlayGround for Google Employees where they spend their Time apart from the Work@Google to think,innovate on some cool Products that can be a successful product later on.. This is the same channel through which Gmail came up which so  now has  so many users worldwide.

So talking about Google Labs.There are Few Products that caught my attention which I would like to share :

1) Google Translation : This one is the biggest thing because it may help you talk with some Russian or Polish acquaintances in near future on Gtalk or mailing them by merely typing things in English. Google as Always would do the Translation for you from English to Russian/Polish and translate back the replies from Russian or any other Language to English .

2)Google Transliteration: This one does Transliteration work. which means if you know to speak some Language like Hindi,Malayam or some other Language but dont know to Read or Write then this Tool would be an asset for you. Using Transliteration you can type words in English but meaning them in Hindi like "Mera Bharat Mahan " --> "मेरा भारत महान" and so on . You can check this Tool on this URL This Transliteration Tool support For Indian Languages has been done in India : Google,Banglore. So this is the product to watch out for.

3)Google Audio Indexing/ GAUDI: This Audio Indexing Indexes Audio for certain Videos so that we can Search the exact Context or Wordings that may be used  in Speeches and  so on . The Google Search is moving a Step  Forward it seems. This Product though at intial Stages has indexed American Politicians Speeches (great thinking when it was time for US Presidential Elections :P ) 

URL for this Tool is : http://labs.google.com/gaudi 

There are many more Tools however These seemed Really Promising and Interesting given India as an Emerging Market Online. These Tools provide API so that Developers can develop Applications using these Tools. So,if next time you have a webpage that needs support for many Languages ,Simply using Google Translation API you have multilingual support without any extra Effort or Support Required. Just Reuse Google API's.

Now, there are few Ideas that I tinkered upon. But the Lack of Time and Experience is a big hinderance. Next Semester though, I might have a new Application Developed that would use these API's to the fullest.

So if I do get Time , you would see this Blog having Multi-Lingual Support for sure.. :) 

Do Comment about what Cool Products that you came across and do let me know if anyone is interested in developing Applications too.. 

Till then Enjoy Life.. 

Friday, January 16, 2009

Hazaaron Khawish Aisi ... v/s Slumdog Millionaire

Starts are often Misleading.. and the title of this one is no exception.. well it has nothing to do with the comparison between the 2 movies but the connection i felt with both of them .. the connection which i still have to decipher entirely though...

Hazaaron is one of the movies that i had seen a really long time ago ..way back during the first year and couldnt sit through the entire movie.. i found it dull and lame.. at that moment.. but then i was bored enough this time though to give it another try .. Hazaaron has a really good plot and you need a patient mind to get into the finer details that Sudhir Mishra has infused into it ..
The movie begins with the 3 College Students (Siddharth,Geeta and Vikram) in the midst of Rock & Roll Culture and the Volatile Situation in India... Siddharth, a true blue Communist wants to end the Social Unjustice in the country and wants the oppressed to fight out the Unjust and revolt against them .. while Geeta is in love with Siddharth and Vikram wants to find a way in while others are trying to find a way out .. wants to earn Big Money ... and doesnt care about the means...

Then the College Life ends and Siddharth migrates to some obscure village in Bihar .. trying to mobilise people while Vikram makes a big deal only to find out Geeta is married to an IAS Officer who has everything she needs. but then there is twist in the plot and she ends up being with Siddharth again ... and Vikram always has to pay the price for his love....
Finally though the ending is the most beautiful part wherein Vikram is still madly in love with Geeta even after being Brain Dead.. and Siddharth sheds off his Communist tag to pursue his ambitions to become a Doctor ..

There are brief moments in the movie that make you think and shudder .. The song Baawra is definitely the first of those and then When the 3 meet up near the River bank discussing their lives and Finally when Vikram is nearly killed by the Cops.

Now moving onto Slumdog Millionaire .. well for a start it has 3 central characters Latika , Jamal and his brother Salim. jamal is playing the show 'Who wants to be the Millionaire' and it always seems that the Show Host Anil Kapoor might run away from the show any time with the prize money given his Looks and the stubble.. though he resists his temptation to deliver a better performance... Every Question has some Story or a Reason for an Answer.. except for the last one which makes the Plot of the Story Questionable.. though .. At the end of the movie .. you tend to think what would have happened if he had guessed the Last Question wrongly.. though full credits to Boyle for depicting the Harsh Facts of Life without an iota of cynicism .. which makes the Entire movie experience enjoyable.. and also A R Rehman rocks with his Sound Track ..definitely worth the Golden Globe Prize..

The Connection isnt apparent though but The 3 Characters play a pivotal role.. in both the movies.. and both of them dont have any frills or unneccessary information ... and the plot is slow and smooth .. and there are many more reasons but i cant think of them now.. lets see.. if i can find them out or not...

Though after all this .. i somehow am reminded of Kukonoor's Teen Deewarien ..
and if you have watched all three of them . you would also be thinking on the sames lines.. ......
If you do feel there is some Connection Feel Free to post your Comments...

Sunday, January 11, 2009

LibTimeManager 1.0 : The Journey






Yes,Last Sem this was the most productive thing that was done by me.. with more of active help from Swapnil aka Nawab.. it was actually his idea that we take up this project. As the Name suggests the Stand Alone Application is for a Library which is being used to Monitor Activities of Employees and stores the corresponding records. At First it seemed really easy given the Customer Requirement Specification but then all Hell Broke Loose.. more so because i was quite inexperienced in implementation in Java that too with a GUI front end.
(as an afterthought even Text based Front end would have been really difficult to achieve..) .. so i took the task at hand.. with the work being cut out for each of us we began individually. Initial Stages were tough given that i had just started out with Java and OOP.Also the fact that everything from OOAD,DB Design,Implementation,Testing,Delivery everything had to be done by us.

So I took a book called HeadFirst Java and began with the basic Concepts but that was insufficient because the Gravity of the Project demanded better Implementation Skills and along the same time Class Diagrams,Use Case Diagrams and Database Design were being done.Everything was in a mess because the Design was changed everyday for atleast 4 days until our thought-process failed to find any faults. However the Customer Req.Spec Changed during that course and there were more changes to the Design that added more to the Complexity.

After nearly a week of BrainStorming,the Design was finalized and we began Implementing the Class Diagrams and Creating Tables in Database.
We however could find Faults during Implementation rather clearly which we missed because of lack of experience in Implementation . With more changes we had a rough GUI layout of all the Frames and Panels ready in 5-6 days.It was then we realized that GUI was the most Trivial part in the Application and it was the backend Computation that shouldnt fail for all cases. GUI work was almost done by Swapnil and i chipped in with Repetitive work of copying Code and then Modifying. It was at that point i realized the importance of Following Coding Standards and making the code readable .(I mean within a week of learning Java i could Implement a GUI panel :).. gr8 for a start).

We were almost 4 days from the Initial Deadline and almost most parts of the Application werent Functional.Now both of us were getting used to working together and reading each other codes (At the Last Stage of the Project this helped when both of us were mentally exhausted and we began coding together .. and it was like few lines were done by me and next few were done by him :P ). Most of BackEnd work were functional the day before the deadline but there were major flaws in the design as a whole which lead to major problems at this point of time.

I clearly remember the Night before the Deadline we were working minus our brains .. rather mechanically which is when we incorporated the WORST UNREADABLE and DUPLICATED code. The Deadline was though Extended. given the Inability of both of us and more so the inability of the Software to deliver the reqd specs .

Then we came back to College which is when the real Task began. In the Train however we had refined the code and Followed some naming Conventions that werent done earlier.
So with a much readable code base of about 2500 lines the work at coll began. Some Flaws in DB design and Class Diagrams were corrected and reflected in the Code. Then i guess we worked for 2 weeks on the stretch day in and day out working on the code set and adding new features and rectifying the earlier mistakes and quickly the code base grew to 8000 lines and more than 60 .java Files.However we knew each file inside out .. name of each variable and each method (which was a surprise :) though).

Finally the App was ready for Deployement 2 days after diwali .We had hardly worked for a month to roll out something that is after all a Practical Application and not that has something to do with Numbers,Bit Fiddling,String Manipulation for a change.

Then we began with our next assignment for QuizInc called QuizBuilder 1.0 which we worked upon in 5 days and came up with a manageable application. Though it was Beta Tested for a Quiz .. it turned out to be a damp squib.

Finally we rested for a few days after so much work and the End Semester Exams were nearing.After the Exams, we did Extensive Testing and tried to make the App Break and Stress out .. and fortunately or Unfortunately it did and we rectified each time until the software was finally tested OK.


The Application is now being used in the Library from 1st Jan 2009.. however we heard that there was some problems with the Firewalls or the Operating System.. we will soon Rectify that.. But as a whole the entire experience was an enriching one .. it enhanced my capability to think Logically and also improved my Implementation Skills tremendously.

I ll keep you updated till then Enjoy Life.

Wednesday, January 7, 2009

2009 is here but where is the NEWS

Where is the News

2008, the year that has ended, was very interesting in  terms of the news that the news channels had to offer. As an obsessed news channel viewer, I made a note of few things that never escaped the 'Always News Hungry -- News Channel's' Attention.

World Economic Slowdown and the  Recession 

 (3.5/5  : Hotness of the news )

This was one piece of Hot Cake for them. Everyday there were reports of people being served Pink Slips and then Banks and Investment Firms getting closed. I guess all the News overflow started with the Lehmann Bros Collapse. and the Company filing for Bankruptcy and then other scores of banks WorldWide showing Capital Scarcity. All this while in India... The Crude Prices were rising ... the Inflation Rate was Scoring better than our  College Topper's CGPA..  as news of Banks Collapses spread.. News Channels showed Reports of these Crisis affecting India.. though Position of India was sound in Domestic  Market .. the Investors Pressed Panic Button quite uneccesarily.. and all things turned upside down .. the Sensex & Nifty tumbling to new lows..  and the Dollar Price Appreciation .. and RBI cutting Repo Rates and CRR.. 

 Job Cuts,Layoffs and Pink Slips

(3/5  : Hotness of the news )


Well News Channels made these terms popular..  Employees all over India Suddenly turning more Efficient.. hehe .. and then Jet Airways issuing  Pink  Slip in Mumbai .. made the Fear a Near Reality .. however Management Succumbed to the Media Glare.. or Employee Demand or Political Intervention .... dunno wat? but the Sacked employees were Reinstated.. and enjoyed a very good Lunch at a Five Star Hotel.. i mean  the entire Episode somehow favoured the Employees..  and then there were reports of IT/ITes Cos.. cutting Bench Employees and UnderPerforming .. ones...  and there were unconfirmed Reports of Even MS removing around 10% of their employees..

 Raj Thackeray and his MNS 

(2/5  : Hotness of the news )


This made Headlines .. all over India.. and News Channels were more than happy to debate about this Topic...  Marathi Manoos versus the Bhaiyaas in Maharashtra.. the Chaat Puja and the Haat Puja.. and all of these ended when Gag orders were issued against Thackeray .. and he being sent  to Jail Multiple Times albeit for a few hours each time .
And the high point was the Dramatic Encounter of incidentally a person named Raj in a BEST Bus ..  who had  a motive  to kill Thackeray .. 

Mumbai Terror Attacks

(4/5  : Hotness of the news )

This Incident was an Unfortunate one .. for Media too.. even The Media was made to sign a Emergency Protocol Agreement . so that they didnt telecast Sensitive Information that could hamper the Combing Operations or the Bloody Images of the dead and the Injured.. 
Apart from the Media.. it did terrorise the people all over India .. exposing  to people that how vulernable they were to such Insane Attacks... 

The Attacks kept Mumbai under siege for more than 60 hours.. and around 200 people dead 
and more of them injured.. leading to the resignation of the 2 Patils and Deshmukh... and then our Finance Minister becoming the Home Minister.. and sending Terror Dosseirs to all Countries.. and India  launching a diplomatic Offensive and Pakistan resigning to Denial Mode..

Obama's Election Campaign

(  3/5 : Hotness of the news )
 Obama and the Change he Believed in campaign . sure made him the President of the United States of America.. but he is marred with more problems of late.. Recession .. Auto Companies .. Banks. On brink of Collapse..  Most US Cos Declaring a Negative Growth and Skewed Profit Margins.. Job Layoffs and Crumbling  Internal and  Foriegn Policies..  as well News Channels had reports of his GrandParents somewhere in Africa. .and him Holidaying in  Honolulu... which were quite Irrevelant ... 


As a review ..  News Channels.. didnt do their jobs well in 2008.. so it might be the Media .that may have Layoffs.. now :P .. and News Channels made Amir Ajmal Kasab.. the Lone Terrorist caught alive in Mumbai Terror Attacks .. gain More Coverage than Barack Hussein Obama.. 
Also there were 2 blasts in Guhawati (i could never get that spelling .. rite )  which were never reported in the manner it was to be ..  and then Minority Affairs Minister trying to get a  slice of Media Coverage.. by questioning the Death of The  Late ATS chief  Karkare.. and then Major Unnikrishnan's parents visit to NDA was telecasted live for no apparent Sane Reason .. Cash for Money Scam.. was in and out of News.. and So was the Indian Cricket Team..  and then Olympic Medals was some Respite..  Abhinav Bindra  got all the Attention while the Boxers were Confined to their rings ..  (there were more unreported news.. i couldnt think of them all.. )



All this for Some Money .. Honey... sure they would Register More Profits.. this year..
lets See if  in 2009  whether good Competitive Journalism  prevails  or the Plain Old Media Aggression /Sensationalisation that  does the job.. 

only Time will tell.. 


 Cheers ..

PS :
1) List of Bomb Blasts in India 

even that list doesnt have the Recent Guhawati one .. 

2) There are Many News Channels in India..
 even Wiki couldnt List them in a single Page..