Thursday, November 19, 2009

Analysis of Algorithms - Why you need this


Algorithms are really about solving problems.There could be many different ways to solve the same problem.So when you have so many solutions available , it's up to you to decide what is the best solution that suits your needs.

But how do you decide what's the best solution?Usually it's a matter of money - of resources.The cheaper something is - the better it is.(Like Chinese cell-phones :)

When you have a problem and there are many different computer programs that will give you the solution to your problem - you would want to pick the program that runs the fastest - the one that uses up the smallest amount of computer memory and is straight-forward to understand (in case you need to fix it or tweak something).

Consider this:

You have a list of numbers and you want to sort them in ascending order.There are lots of ways to do this.

Say you googled and found 4 different ways.Let's call them:
1)Bubble Sort
2)Insertion Sort
3)Selection Sort
4)Merge Sort

Now which one would you use?

Well, it depends doesn't it.It depends on stuff like
1)How many numbers you have to sort
2)Which of these ways is fastest
3)Whether you understand what's actually happening behind the scenes.(You want to make an informed decision,right?)

You may also have to think about how these different algorithms (I am going to stop calling them 'ways' now) behave when you have different amounts of numbers (or the 'size of the input')

Some algorithms may be super fast when they are dealing with say, 10 numbers.However,they could end up being really slow when you have an input of around 10000 numbers.

On the other hand, there could be some algorithms that are really complex and hard to implement and totally not worth the trouble for sorting just 10 numbers.However, if you need to sort ,say a million numbers - these may come in handy.

The process of figuring out the how an algorithm behaves in different situations is called "Analysis of Algorithms"

Friday, November 13, 2009

Good Documents

I just discovered this beautiful old site called "Good Documents".

"Good Documents" introduces itself as :

"A web-site that discusses how to create good business documents in the linked, on-screen environment of Intranets and the Internet."

Last modified: Tuesday, July 7, 1999

That's more than 10 years ago!

Back then the concept of a wiki was non-existent.In it's place they had a concept called "Intranet Documents".

These days, most companies have wikis - which is a way for co-workers to share information.In the company I work for, every time we introduce a new process or come up with a new discovery, we post it on the wiki - where it sits for everyone to read and comment about it.

Different kinds of people post different kinds of information.
For example
* Product Managers post information about their latest meeting with the customers.They discuss the feedback given - what could've been better and what we could do next

*Project Engineers post more technical information.Such as the latest addition to the build process or the steps to configure a new deployment environment for the product

*Release Managers post information about product life-cycle milestones

*Quality Managers post information about software test processes

So you see,a wiki is a very public document - read by people from various levels in the organization.Very often your writing may serve as reference material to others in your team.It is essential that your writing be clear and precise and convey your message effectively.

Although Good Documents is a fairly old website, the guidelines and tips it provides hold good even today.

Some of the suggestions that made a great deal of sense to me are:

Write links that don't have to be followed

Providing summary information at the link site can convey enough information to save the reader from following links they would otherwise have to follow just to find out a small amount of information.

Be concise

Write in a minimalist style, and be to the point.

Use typography and layout for skimming
Bold fonts, short paragraphs, and borders help the reader quickly find needed information.

Weaving paper soccer balls!

I came across this interesting video on how to make paper balls at the Instructables website.

http://www.instructables.com/id/How-To-Weave-A-Greek-Paper-Football/

Great tutorial.Easy to do and I had all the materials at hand.(i.e. I had some coloured paper, tape and a pair of scissors).

It doesn't take more than 15 min to make one of these things.

So here are my versions of the soccer balls.

My first attempt:









All together

I discovered a few minutes ago, that another (more complicated) version of this ball is used in a game called Sepak Takraw. This game is similar to soccer and is played in many South Asian countries such as Malaysia, Indonesia,Philippines, Laos and Cambodia.

The ball used in the game is made of rattan - which is a type of palm.Here is a picture of a Sepal Takraw ball.

Thursday, November 12, 2009

Steampunk


I had not come across the word "Steampunk" till I started reading some works by Phillip Pullman.

Phillip Pullman is the author of the "His Dark Materials" series as well as the "Sally Lockhart and Jim Taylor" novels.

Most of his works are set in Victorian England just before electricity became popular and machinery was still powered by steam.As I set out to learn more about this era, I found the word "steampunk" mentioned a few times.A few seconds of googling led me to this wikipaedia article http://en.wikipedia.org/wiki/Steampunk

The whole concept of Steampunk facinated me.I discovered it to be a mixture of Art, History, Technology, Science and more importantly Romance.It speaks of times when there where a lot of unknowns, of dangers and of adventures - much like Phillip Pullman's novels.

I found some more interesting link links related to Steampunk.I've listed them below.

http://steampunkworkshop.com/
This is a great place to see some excellent pieces of Steampunk art.Please check out Lyra's Lamp - it's a beautiful piece.

http://www.steampunkmagazine.com/

Go here to immerse yourself in Steampunk culture

http://www.steampunklab.com/
Another great link

Wednesday, November 11, 2009

How to download an entire website using wget

Sometimes you may want to download an entire website.If you are using a linux machine - this is an incredibly easy thing to do.

Just type in the following command into your terminal and hit Enter.

sudo wget -r --no-parent http://www.technicalinterviewquestions.net/

You will of course have to replace http://www.technicalinterviewquestions.net/
with the url of the website that you wish to download.




For those of you who want a more detailed understanding of the command - read on:

sudo wget -r --no-parent http://www.technicalinterviewquestions.net/

sudo allows a permitted user to execute a command as the superuser or another user, as specified in the sudoers file.

sudo wget -r --no-parent http://www.technicalinterviewquestions.net/

wget can follow links in HTML pages and create local versions of remote web sites, fully recreating the directory structure of the original site. This is sometimes referred to as ``recursive downloading.'' While doing that, wget respects the Robot Exclusion Standard (/robots.txt). wget can be instructed to convert the links in downloaded HTML files to the local files for offline viewing.

sudo wget -r --no-parent http://www.technicalinterviewquestions.net/

-r
--recursive
Turn on recursive retrieving.


sudo wget -r --no-parent http://www.technicalinterviewquestions.net/

--no-parent
Do not ever ascend to the parent directory when retrieving recursively. This is a useful option, since it guarantees that only the files below a certain hierarchy will be downloaded.


sudo wget -r --no-parent http://www.technicalinterviewquestions.net/

This is the url of the website which we wish to download.Since I wanted to download the entire site I gave the base url as the argument.However if I had just wanted to download only a particular section of the website (say, archives) then I would have entered the command as:

sudo wget -r --no-parent http://www.technicalinterviewquestions.net/archives/


More information about this command is available here:
http://linux.about.com/od/commands/l/blcmdl1_wget.htm