Wednesday, June 19, 2013

Program to purify beer.

Fresh batch just joined the prestigious institute of technology. Budding engineers were dreaming big, aiming high.

Our Peddgunda also had enrolled into the CS department.

After a month of studying programming languages, He attempted a tough problem which was given as an exercise.

Question: Write a program to purify beer.

Here was his solution.

//Write a program to purify beer.
#include <iostream>
#include <string>

using std::cout ;
using std::endl ;
using std::string ;

int main()
{
    string drink("beer");
    drink[0] += 12;
    cout << drink << endl;
    return 0;
}

Well, no comments on that...

Thursday, February 18, 2010

Google Buzz: My views.

Though there is nothing technical discussed here in this post, I'd take this opportunity to blog about a product from Google. Their recent one.

Since a week or so, people all over the world who use gmail have been provided with a new feature right within their mail. Its kinda like social networking, more specifically to say, its sorta copied what twitter does; with some new features and some modifications to the existing ones.

You can update your status, just like you do it on twitter, facebook, orkut and what-so-ever social networking site. Share the links you liked, share your pics from wherever you are (coz it also has mobile support).You can also watch the updates from your friends, follow unknown people whose updates you find interesting.

Not that these are totally new features which google has brought up. All of them were done in some roundabout method previously. Buzz is just like one stop where you can do it all in a simpler way now under one roof.

If you know Google Reader and have been using it for quite sometime, buzz makes no surprize to you at all. So, for all those who are extensively using reader, you find that buzz is just one more interface for your shared items. In other words, its like developing a new UI for your command line tools.

Why did Google start buzz? Here is what Kevin Rose had to say. I agree with him too.

Okay... It got released. People who werent using twitter but used gmail liked it very much. First two days of buzz went on overflow. Everybody buzzed every single update from them. Followed everyone in their contact list.

What next? From the next day, people were outa topic to update. Most of the new products go this way. Same applies to Google Wave. Twitter was filled with status updates asking everyone to send a wave invite if they had any. Same happened in case of Google's go language. Never heard a thing about Go since the first week of its release.

I'm not saying that buzz will also join the flop list. Those who use reader, continue to use buzz. Added advantage to them is that their passive friends (passive in the sense, those who don't use reader) follow them on buzz. One good thing is that you can add more sites you're active onto your buzz. You can link twitter, picasa, flickr, even blogger to buzz, which is quite a good feature.

These are just updates since a week or so. Who knows? Buzz might catch up soon and become a hit. Base of buzz, gmail is pretty wide inspite of threats from Facebook planning to start its own 'Gmail killer'.

I wish buzz its best luck for its future. Post your views.

Labels: ,

Friday, October 30, 2009

Google vs. Bing... Whose the Winner?

You might have seen a hell lotsa blog posts on this topic or atleast something related to it. Why you? I've seen lotsa them. You can check some on my links blog. Before writing in detail, let me give an intro for the dummies.

Google: A search engine by a company with the same name, established by Larry Page and Sergie Brin (Stanford passouts) in 1998, whose major revenue comes outa ads in search result pages as well as other sites like blogger, reader et al. They are plunging into more domains as days pass on. The word 'Google' is derived from the term googol in math which some argue to be 1 followed by 99 zeroes while other say its 1 followed by 100 zeroes... Nevermind...

Big heads: Larry Page, Sergie Brin, Marissa Mayer, Eric Schmidt...

Bing: A search engine by Microsoft, company by Bill Gates Jr along with his mate Paul Allen in 1975, Major revenue from OSes developed by Microsoft (MS for short). Windows 95, Windows XP being the major revenue generators along with their office suites. Also revenue from royalties for development frameworks like .net, COM, COM+, MFC etc... Also into producing gadgets like Zune, Surface computing.

Big heads: Bill Gates, Steve Ballmer...

Enough of the introduction. Lets dive in.

Let me make these points clear first:

1. I'm not criticising one company holding up the other.

2. My conclusions are based on the experiements i conduct hereby...

3. To help us out, searching both these search engines (bing might claim itself to be decision engine, still) we have a site which gives us results of both engines side by side... Here is the link. I've checked it on both sites as well as this site to get identical results (Foolish experiment though)

Given a pen, you would write your name first. Atleast this is what a survey says as what I've read somewhere. Likewise, given a search engine, I would search myself. Call me a narcissist, I don't care!

So, let me search myself... Here is what I got.


Well, look at that! Bing shows the link of a site which I hardly use. Also, there are no links related to google's site. My blog is on blogger which belongs to google, we can see that bing supresses contents from google. I've seen it many a times.

You can also check out the number of matches found as result. Google has more results as it caches more.

Lets move further. The narcissist inside me is hurt. To satisfy him, lets search a different name. dabbanannmaga is my twitter login name. Lets find what both the sites have got to offer me on that.

Here we go...


Aah! a bit of relief here now. But before the deal between MS and twitter (as well as Google and twitter on social media search), bing was showing me enidhi's twitter page as the top result. Things have started working my way atleast for this search.

Enough of me, lets search for bing. The newer of the search engines. Lets check how both of them treat each other.


Well, Google is generous enough to provide is results with 10 times those found on bing itself...

Finally, lets search Google on both. Here we go for the final search.


Look at that! How generous Google is and how stingy bing is... just one single result for google? Grow up MS...

Even you may try on these lines... Please do let me know about your views commenting here. You may also try searching common rivals/allys to both these companies like apple and twitter respectively...

Before we conclude, let me cough out a speculative thought running in my mind since the release of bing... Mind you, this is just a speculation. What would have made MS to name their decision engine bing of all the rest? Some ideas I get are

1. bing, a kinda sound you get when an idea flashes.

2. bing, look out the g at the end, 'g' symbolizing google? so, is bing an acronym which contains google?

3. bing, again, the g factor comes into play but it might not be an acronym. might be a secret code. bing, bang? bin google, ban google? of course, the intentions of MS in creating bing is to dethrone google as the world leader in web search. literally throw google in the bin. This might be the scenario well this is the strong speculation running in my mind.

Now to conclusions.

Lets list out the merits and demerits of both engines.

Google:

Merits:

1. Numero Uno in web search, hit by bing slightly since 4-5 months.

2. Caches more number of pages than any search engine.

3. Page Rank, helps people write more specifically making searches better.


Demerits:

1. Can provide related suggestions as in bing. [Might have such feature but I'm unaware of, Of course, it suggests as you type, thats one]

2. Can provide a short list of search history as in bing.


Bing:

Merits:

1. Claims itself a decision engine, giving the best possible page first with less number of searches and in less time. [I'm quite doubtful of the latter though]

2. Has tiny helpful features like suggestions, search history.

3. Initially was blocking sites with adult content from getting searched. I liked this feature.

Demerits:

1. Caches less number of pages.Search bandwidth shrinked.

2. Has to be a bit generous in pages giving results related to rivals.

3. Net neutrality isnt quite evident.

Finally, There have been many companies which came to limelight just for a few weeks probably for a few months which claimed themselves as google killer. But they commited suicide in no time.

Bing has been giving strong competition though it has its own demerits. Will it kill google? Only time has the answer but for it to do that, it has to undergo large changes along with the small ones I've suggested in this post.

Signing off... Once again, pour in your comments.

Labels: , ,

Tuesday, September 08, 2009

64 = 65??

Guess you had also got a mail with this subject. It partitions a 8X8 square into 4 pieces and re-arranges it in such a way that it forms a rectangle of dimensions 5X13 and try to prove that

8X8 = 5X13
==>64 = 65!!!!!!!!

This video might help you visualise it. Check out the comments for possible errors or solutions.

This problem was first pointed by one of the mathematician Charles Lutwidge Dodgeson who also penned Alice in the Wonderland with the pen name Lewis Caroll.

Okay! Lemme tell you. That video or the mail you saw assumes that the slopes of all the cut pieces to be the same which in reality is not. They have different slopes across their slant edges. You may try it out on a graph sheet to get confirmed.

Okay I'll post what I did on my graphic editor here.

First of all, we have a 8X8 square. Let us cut them into 4 pieces as seen in the video.


Lets try arranging these four pieces into a 5X13 rectangle. Here is what we get.


You can notice that as the slopes of the slant efges of all the four pieces vary, there is a gap between them. In face it is a parellogram with the area 1 square unit which is exactly the difference between 64 and 65 (8X8 and 5X13).

Let us try another similar problem. Let us take a square with side 5 units and divide it into 4 parts as given before and try it to arrange inside a 3X8 rectangle. If those who didnt knew, they would equate 24 to 25 as done for the previous problem.

Here again, the slopes vary, but now, instead of leaving a gap at the centre, pieces overlap , which exactly explains why we cannot equate 24 to 25. In fact, the area covered by the overlapped pieces equates to 1 square unit.

One can't tweak math so easily, aint it?

If one diggs more into this, they'll find a pattern in the sequence. Lets try to find it.

In the first problem, the lengths considered were these numbers. 3, 5, 8, and 13.

Similarly in the second one, the lengths considered were 2,3,5,8.

didn't you notice that these are fibonacci numbers in order?

Forget the first number in both the examples, we have 8 square = (5 X 13) - 1 ,

Similarly, 5 square = (3 X 8) + 1

We have the fibonacci sequence as

0,1,1,2,3,5,8,13,21,34,55,89..... ==> F0, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11......

Writing the above equations in F form, we have

F6 X F6 = F5 * F7 - 1
F5 X F5 = F4 * F6 + 1

In general, Fibonacci sequences have the property,

Fn X Fn = Fn-1 * Fn+1 + (-1)^n

This problem is just a specific version of the above property of fibonacci numbers.

This is just one small property of the innumerous of fibonacci numbers...

Just came to know about this fact yesterday from a book that I'm reading since a week. Thought of sharing it with you guys.

Interested to know more about such properties, read that book...

Alfred S. Posamentier and Ingmar Lehmann, The (Fabulous) Fibonacci Numbers,

Thank you...

Labels:

Tuesday, June 09, 2009

Fedora 11 - Leonidas, Released.

Hey all!

Just thought of tell you all that a new version of Fedora has been released. Downloading the image. Hopefully its just as good as its previous versions. =)

Check it out here.

Labels: ,

Sunday, April 12, 2009

Actual Size of a DVD

A month ago, was tryin to burn a DVD to its maximum extent. Had a Sony DVD which claims its capacity to be 4.7GB. But when I tried burning data worth 4.7GB it said, please insert a disk with 4.7GB of capacity.

I kept on reducing it by 100 MB i.e., 4.6GB, 4.5GB but in vain.even 4.4 GB didnt work. Also, it was giving me confused error messages about DVD+R and DVD-R formats.

After a bit of googling, I found that the 4.7 GB of a DVD disk is actually 4.7 * 10^30. That boils down to 4.3 * 2^30 i.e., 4.3 GiB. When i reduced it to 4.3GB, everything went well. Just thought of sharing this info so that you don't face it further. =)

Labels:

Wednesday, February 04, 2009

Problem of the day - I

Will be posting problems I'm working on under this topic regularly (As regular as possible).

Currently working on placing chess pawns on a standard chessboard. Problem description goes as follows. Hope I come up with a solution asap.

There exists certain number of chess pawns ( pawns here do not mean only soldiers, it can be any chess pawn). Given the initial placement, one will be given pawns sequentially which he needs to place it on the board in such a way that it doesnt hit any of the existing pawns.

Try it out... Good exercise though! Happy solvin... =)

Labels: