Pages

Sunday, December 23, 2012

Contributing to ubuntu {The Basics} - 1

It is a good idea to contribute to ubuntu development teams for the benefit of FOSS and your own learning. Althogh, they provide a very good documentation on the websites, at first we get lost in the series of links they provide. So, i decided to write all the major steps to follow on this blog for others to benefit...

First up is some basic teminology you must be aware of already, but it is good to review them again at one place:

GNU :  stands for "GNU is Not Unix" . GNU project started by Richard Stallman in 1983 for "free software" development. GNU is unix-like operating system which uses GNU-Hurd Kernel, but no stable release of this kernel yet exists. The Hurd is a collection of servers that run on top of a microkernel (such as Mach) to implement different features. The Hurd is free software produced by the GNU Project.

Linux:  This is the OS Kernel developed by Linus Torvalds in 1991.

GNU/Linux: The GNU free software combined with the Linux Kernel form the GNU/Linux based operating system.

Distros: Add apps to the GNU/Linux system and you get a distribution like ubuntu.

Dedian: Debian is a free operating system developed under the Debian project. It comes with about 29000 packages. (http://www.debian.org/intro/about)

Ubuntu: a popular GNU/Linux distro. Ubuntu is an ancient African word meaning 'humanity to others'. It also means 'I am what I am because of who we all are'. The Ubuntu operating system brings the spirit of Ubuntu to the world of computers.

Ubuntu is based on Debian? : Ubuntu is built upon debian`s architecture. Debian is an open source project that builds the free operating system. Ubuntu has a different community with more consistent user interfaces and frequent releases.
More on this here: http://www.ubuntu.com/project/about-ubuntu/ubuntu-and-debian.

Canonical: It is a trade mark company which provides premium support to ubuntu services.

Ubuntu releases: Stable versions released every 6 months.

LTS release: (Long term support) Every 4th release issued on a 2 year basis is a long term release.

GNOME: It is the desktop environment and the GUI. It has many free softwares including everything from playing media and editing photos to system administration like banshee media player, shotwell, browser etc. The user interface for the GNOME 3 is called the GNOME Shell and it is really cool, try it!
Ubuntu is GNOME based. (released forst in 1997)

KDE:  Another desktop environment. (plasma desktop). This is based on the Qt framework. (1996)

Kubuntu: ubuntu based on the KDE desktop environment.


 { To be updated as and when needed}

Free as in Freedom. The FOSS {revolution yet to come}

When the GNU project was initiated by Richard Stallman at MIT in 1983, it was seen as a few children playing with toys by the likes of Microsoft and Apple, who at that time did`nt believe in making software free of cost. Who knew that it will, some day, be seen as a threat to Windows and the iOS. The aim of GNU project was, simply put, to make  useful software free for everyone in the universe, with $0 cost. Moreover, the source code should be available free for use, you can change it and publish it as your own software, but under the same GNU General Public License, so it prevents commercial selling of such software. Commercial softwares, like Microsoft Windows, provide only the compiled code available and doing reverse engineering to get the real code is too tough. Richard Stallman and his group were seen as crazies, at that time, afterall, what was the market opportunity in selling free software? They developed many useful free softwares such as the GCC compiler, many of the commands you use on your terminal like wget, grep etc. (the list is here: http://www.gnu.org/software/ ). What they lacked was an OS kernel. The year 1991 was special not only because i was born that year, but because the first version of the Linux kernel was released by Linus Torvalds that year (official http://www.linuxfoundation.org/). The Linux kernel and the GNU free software were combined to build the complete operating system, called as the GNU/Linux, popularly known as just Linux. Add apps to the GNU/Linux, and you get a distribution (distro) like ubuntu, fedora, red-hat etc.

What is remarkable about Linux is the pace with which it is made and improved, that the source code is available, that it is developed by volunteers around the world and it is free. It provides a great learning opportunity to work with the community to improve/develop linux and various distributions.

So, what is the power of open source software today and why is it useful?

  • The popular distributions such as ubuntu, fedora provide a free alternative to OS like windows and iOS. Also, it can be tailored easily for specific machines and needs.
  • Android, a mobile device platform gaining mass popularity is also Linux based.
  •  Facebook, twitter and many popular sites are hosted on Apache servers, use MySQL etc (all open source)
  • It provides opportunity for good ideas , tools to come into spotlight. It prevents the monopoly of big players in the software industry like the ones of Microsoft.
  • There is a wide support service available free, online through the community.
  • The right to modify the software for your good and redistribute it.
  • There is better reporting of bugs in the software. To share the source code means sharing the bogs.
  • There is a possibility of forking the code.
Ubuntu (GNU/Linux OS), the most popular distro is FLOSS, the term stands for Free/Libre Open Source Software or FOSS as popularly known.

FOSS is a revolution. It is changing the software industry very fast. It is like what we were taught when young at school, to share your food with others, it is what things should be like in an ideal setting for the benefit of everybody. When you share the knowledge, it benefits you more ,than the others.

Friday, October 19, 2012

Nice Solution for detecting String anagrams (Algorithm)

Problem

Given two strings s1 and s2, we need to identify if s1 is an anagram of s2.
A string s1 is anagram of s2 if s1 is re-arrangement of the characters in s2.
e.g : s1="I am Lord Voldemort"
        s2="Tom Marvolo Riddle"
        are anagrams. 

Assumptions: 1. strings are made only of english characters and space.
                      2. space is ignored in the re arrangement (and in the original string)
                      3. case is ignored (lower and upper cases are same)

|s| denotes the length of string s.


Nice Solution: 

 Assign prime numbers to a to z characters. e.g- 3 for a, 5 for b, 7 for c etc.

Take product for prime numbers of string s1.
Take product for prime numbers of string s2.

Now, if the products are equal, the strings are anagrams.

Beauty of prime factorization. :-)

Algorithm will run in O( |s1| + |s2| ) 

Feel free to point out any flaws.