TimeLinux1

Saturday, March 7, 2015

API, Web Services, SOAP, REST, etc

API - A piece of code that permits App-to-App communication, without low level user interaction.
In short, APIs permit 'seamless' end user experience.
eg: A ecomm web (site) app communicates with a Credit card web (site) app to complete a transaction without user needing to do anything to facilitate the communication between those two apps (except username/password etc)

XML - is the standard language by which Applications communicate over the Internet.
In Web apps, API itself is a piece of code written as a series of XML messages.
The messages call functions of the remote app.

SDK - is a Superset of API.
SDKs comprise API, supplementary tools, documentation etc.
SDKs are released by Application developer companies.
The business goal of SDKs is to enhance application adoption by making the job of developers easier.

SOAP - encodes XML messages in APIs so any OS on any network protocol can understand it.
(simple object access protocol)
originally developed by microsoft; exclusively XML based. bulky & complex.
came in response to the needs of the web apps which needed more than the previosly binary based APIs like com, DCOM, ActiveX, corba etc.

REST - REST uses a simple URL instead of XML messages (as in SOAP) to simplify things.
REST uses 4 http verbs or methods - GET, POST, PUT, DELETE.
REST based web services can output in csv, Json, RSS etc; sometimes even images may be returned.

Eg: Geocoder REST API to GET location info is as simple as typing this in the URL:

http://rpc.geocoder.us/service/csv?address=1600+Pennsylvania+Ave,+Washington+DC

and this outputs a Json response.

Advantages/Disadvantages: SOAP vs REST
-SOAP advantages:
.REST requires http, SOAP is lang, OS, protocol indep (eg works with http, https, smtp etc)
.standardized
.built in error-handling
-REST advantages:
.smaller, simpler
.not fixed on XML complicacies
.multiformat output, works better with web technologies like Javascript

note: very few web services (like amazon) support both SOAP and REST. its usually either/or.
REST services are identified and accessed via an URL.
SOAP is identified and accessed via XML based WSDL (web services description lang).
note: stateless vs stateful:
.stateless - any two requests (even if the same request twice) have no knowledge of each other
-eg http, REST, nfs, ip
.stateful - a request is dependent on its predecessor, ie requires knowledge of prev req
-eg ftp, tcp, database connection
note: -GET method - http request query string is sent as part of the URL; can be cached, bookmarked and less secure
-POST method- http request query string is sent as part of the request body; cant be cached,bkmkd and is more sec.
-PUT method - http request that replaces a resorce (doc, file, page etc) if present or creates if not present.
-DELETE meth- http request that deletes a specified resorce.
note: -idempotence- the phenomenon in which result does not change if action is repeated.
-eg: i = 4; is idempotent (bec i will always be 4, whenever this statement is executed) but
i++; is not idempotent (value of i will change everytime the statement is executed)
-in context of the four http methods in REST, all (GET, PUT, DELETE) except POST are idempotent.
note: -Resources on the web are identified and located using one of the following mechanisms:
.URI - Uniform Resource Identifier - identifies/locates a resource by either name or by location
.URN - Uniform Resource Name - identifies a resource by a name
.URL - Uniform Resource Locator - identifies and locates a resource by name and its access method.
-Both URN and URL are types of URI. But URL is most common.
Examples:
.URI - http://www.timedigit.com/index.html#one     - Name of a certain element on the page
.URN - www.timedigit.com/index.html   - resource name but WITHOUT access method (http)
.URL - http://www.timedigit.com/index.html - resource name WITH access method (http)

Tuesday, December 30, 2014

Unsupported Version of Google Chrome after Ubuntu update

Recently ran the 'Software Update' utility on my laptop running Ubuntu Linux 14.04 OS and ever since, I have been graced by this (un)friendly sort of error every time I use gmail app on my google chrome browser:

This version of Chrome is no longer supported. Please upgrade to asupported browserDismiss

This error suggests that the gmail app is not very happy with my browser version (which was v36, the latest version out there being v39). Now If I use 'Software Update' utility again, it tries to update a laundry list of all packages in my OS to update totaling upto about 600 Mb; which would be ok if I wasnt short on time. So a better solution for me would be to simply upgrade Chrome only and nothing else. And here is what I tried.

First, I tried to upgrade Google chrome via the browser settings menu but it came back and said its already at the latest! well that wasnt much help.
So I then, tried my next option of upgrading only Google chrome via the apt-get utility (as shown in the screen shot).




And that did it. Once apt-get completed its work, I restarted my browser and it on checking its version, it showed that it was upgraded to the new version (v39). And yes the error no longer shows up either! Hooray!

So, if you have been through this error yourself and wondering what to do, then you could follow the simple method of upgrading only Google chrome & get rid of that pesky error.


Sunday, December 28, 2014

Installing Standalone Hadoop on Ubuntu 14.04


Today we discuss the process of Installing Standalone Hadoop on Ubuntu 14.04.

Here is the short of it.

Pre-requisites:

1- Java binaries  - Hadoop requires Java to run its process
2- Hadoop Tarball - Thats a no brainer, you need hadoop to run hadoop. :)
Note: For standalone hadoop (one node only), ssh is not mandatory.

To get Java, you can rely on the good old Open JDK (like I did myself) or you can get the 'official' java from https://www.oracle.com/java/index.html.
In my case, long time ago for some other work, I had installed openjdk (the un-official but opensource version of Java) version 7 (or java 1.7 as some like to say) according to the instructions from this page - http://openjdk.java.net/install/
We will come back to this in the configuration part later in the discussion.

As for Hadoop, you can simply download it from Apache site. I downloaded from http://www.apache.org/dyn/closer.cgi/hadoop/common/ and downloaded the (slightly older) version 1.2.1 tarball (hadoop-1.2.1.tar.gz).

The first thing to know is that you DONT need to be root to install ubuntu (as long as you have sudo).
So I was logged in as my own not-root user (mrinal)



Then I created a directory under my home directory where I moved the hadoop tarball I downloaded earlier from Apache mirror (see above) and unpacked it using the following command:

mrinal@ms-dell:~/hadoop$ mv  /home/mrinal/Downloads/hadoop-1.2.1.tar.gz   /home/mrinal/hadoop/
mrinal@ms-dell:~/hadoop$ tar xvzf hadoop-1.2.1.tar.gz

This creates a new directory in the same place and that becomes my hadoop install location.


Now, refering back to the java install process from above, in ubuntu, the java is installed by apt-get installer process under /usr/lib/jvm folder. Sometimes there may be previous older preinstalled versions of java present but you can ignore them--we are interested in the version 7.

Then I set my environment variables in my .bashrc file (for subsequent logins to be set properly). The .bashrc file resides in my home directory (in my case /home/mrinal) as follows

mrinal@ms-dell:~/hadoop$ vim ~/.bashrc 

and at the end of the file enter these lines:

Note: It is crucial that the PATH env variable includes the JAVA_HOME/bin & HADOOP_INSTALL/bin directories.

For Hadoop in distributed mode in a cluster, ssh service is required but in our case being a standalone mode, ssh is not mandatory. Nevertheless its good to know that in Ubuntu (and Linux in general) ssh is preinstalled.

The last thing before hadoop config checks is to set JAVA_HOME variable in the hadoop-env.sh file.
This file resides in the $HADOOP_INSTALL/conf directory (/home/mrinal/hadoop/hadoop-1.2.1/conf in my case). If you dont set this variable, you would get weird errors like "localhost: Error: JAVA_HOME is not set." when you try to start / stop / do anything with your hadoop.

Anyhow, once you are done with all the above steps, you should be able to do basic config checks to see if your hadoop is installed and functioning ok..

mrinal@ms-dell:~$ echo $JAVA_HOME 
/usr/lib/jvm/java-7-openjdk-amd64/
mrinal@ms-dell:~$ echo $HADOOP_INSTALL
/home/mrinal/hadoop/hadoop-1.2.1
mrinal@ms-dell:~$ java -version
java version "1.7.0_55"
OpenJDK Runtime Environment (IcedTea 2.4.7) (7u55-2.4.7-1ubuntu1)
OpenJDK 64-Bit Server VM (build 24.51-b03, mixed mode)
mrinal@ms-dell:~$ hadoop version
Hadoop 1.2.1
Subversion https://svn.apache.org/repos/asf/hadoop/common/branches/branch-1.2 -r 1503152
Compiled by mattf on Mon Jul 22 15:23:09 PDT 2013
From source with checksum 6923c86528809c4e7e6f493b6b413a9a
This command was run using /home/mrinal/hadoop/hadoop-1.2.1/hadoop-core-1.2.1.jar
mrinal@ms-dell:~$ start-dfs.sh 
starting namenode, logging to /home/mrinal/hadoop/hadoop-1.2.1/libexec/../logs/hadoop-mrinal-namenode-ms-dell.out
mrinal@localhost's password:
localhost: starting datanode, logging to /home/mrinal/hadoop/hadoop-1.2.1/libexec/../logs/hadoop-mrinal-datanode-ms-dell.out
mrinal@localhost's password:
localhost: starting secondarynamenode, logging to /home/mrinal/hadoop/hadoop-1.2.1/libexec/../logs/hadoop-mrinal-secondarynamenode-ms-dell.out
mrinal@ms-dell:~$ start-mapred.sh
starting jobtracker, logging to /home/mrinal/hadoop/hadoop-1.2.1/libexec/../logs/hadoop-mrinal-jobtracker-ms-dell.out
mrinal@localhost's password:
localhost: starting tasktracker, logging to /home/mrinal/hadoop/hadoop-1.2.1/libexec/../logs/hadoop-mrinal-tasktracker-ms-dell.out
mrinal@ms-dell:~$





Tuesday, October 14, 2014

Internet Broadband and Prepaid Mobile at Delhi Airport -- Tips for Travelers to India



If you have traveled to India in the past, you probably have faced the situation of trying to scurry for a decent mobile phone and Internet connection from the get go. I have been to the UK and some EU countries and like them India has adopted the GSM cellular technology. And you can get a phone over the counter without much ado there ('Welcome to Lebara Mobile'--that British accent female voice is unmistakable..:) )Plus the phones are not locked to the carriers like in the USA. I personally feel, the consumers in USA are fleeced by the 'locked phone' culture. How ironical, in the 'land of the Free'..Funny how Businesses work in USA.

Anyhow, back to India. I used to have a difficult time finding a temporary cellular phone (without having to activate 'Roaming' on my USA phone). Plus Internet connections were always a hassle because most of the services were specifically compatible to Windows OS only (I have been an exclusive Linux-phile for about 15 years now) and I would always have to struggle to find that would work with my Linux laptop.
But that was then. And here's my story of 2014 about the same in India. And I was pleasantly surprised.
As a visitor to India, here are some tips you can find useful to get --

  • Prepaid mobile connection 
  • Broadband Internet connection that would work with Linux OS.


1) Carry a Xerox copy of your Passport from your home country
2) Carry two Passport size photos from your home country
Note: Well, if you dont have the two above, dont despair, the folks here can help you get that at the airport itself; but its easier if you have the two things handy before you come.

3) After you finish your Customs formalities and get your baggage BUT just before you exit the Airport terminal (T3 for Delhi Indira Gandhi International Airport aka IGI Airport), look for kiosks that advertise Cellular and Internet services--there are many. The one that is most popular is called 'AirTel'--it is India's #1 Telecom provider.

4) Once you arrive at the Airtel (or Vodafone or Reliance kiosk)--I prefer Airtel--ask the person for A) Prepaid Mobile Sim Card B) 3G Internet Broadband connection (4G LTE is expected sometime early 2015).

5) The person will ask for the passport copy, pictures and your Address of stay in India--you can use your hotel address if you want.

Note: If you have an unlocked phone (like me) then you dont have to pay for the phone device (for the Prepaid sim card). They do have the 'Micro-sim' that my Sony Xperia Z1 Compact uses. If you DON'T have an unlocked phone you can buy one at the counter/IGI Airport for less than USD 50.

6) The Service itself is quite in-expensive compare to USA. It cost me about Rs 3000 (which is about 50 USD) for BOTH the Prepaid Cell connection and the 3G USB Internet dongle.

7) It takes about 15 minutes to get paperwork completed and you to get going to your hotel.

8) You may want to ask the contact # of the Airtel representative at the counter, just in case.

9) In my case, I specifically asked if the Internet connection would work with my Linux OS and his answer was 'Yes' and that was good for me. Also the service was functional within 2 hours. Just enough time for me to reach my destination and relax a bit.

10) Quality of service -- I was pleasantly surprised that the Internet speed is comparable to the USA -- upto 21Mbps down and 2Mbps up. ( I got about 15Mbps--see pic below). The customer service is prompt if you call 59059 from your cell for any reason.

11) Yes, again the Mobile Broadband works with Linux. I have Ubuntu 14.04 LTS and it seamlessly detects the USB dongle with the Broadband sim soon after you plug it in.

Wednesday, October 1, 2014

Sony Android Phone Not working 100% with Ubuntu


Those of you who care to read what I write would note that I have no liking for Microsoft or Apple products. I have been using FOSS specially Linux OS as my laptop/desktp OS since year 2000 and also as the OS for my smartphone (as Android incarnation) since 2010.
Currently I use Ubuntu 14.04 LTS (Trusty Tahr) as desktop OS and Android 4.4.2 (KitKat) as smartphone OS. The hardware for the same is Dell XPS 13 and Sony Xperia Z1 Compact. Occasionally I do use Fedora (on Sony Vaio S laptop) as my 2nd laptop and Amazon Kindle HD running Amazon's derivative of Android (called Silk) as tablet. But truly that is rare. My laptop and my smartphone are my primary devices..
But why am I telling you all this?
Well there is a precise reason for that. If you noticed all of the above OS (be it laptop/smartphone/tablet) are based on the GNU/Linux Kernel. Right?
So you would expect they would get along well together, Right? Wrong..

[Microsoft and Apple sauce fans: desist from saying "switch to us". No wont, you are not Free. I may be a bit uncomfortable but I'm Free..So dont even start..]
Anyway I digress..

It so happened that I recently switched to my new Sony Xperia Z1 Compact (from my previous HTC Evo LTE). The reason for the switch was upgrade to a new, powerful, goodlooking, waterproof, feature packed phone. To make the best of the phone's 20.7 megapixel camera, I got it loaded with a SD card to store all my pics. And then I gleefully went on clicking pics.
After a while, I wanted to transfer my picture files to my Ubuntu 14.04 laptop. Just like I used to do with my old (HTC) phone simply by connecting with a USB cable. But this is where my horrors start.
To my surprise, Sony Xperia detects the USB connection and immediately prompts you to install an file transfer software (called ominously 'PC companion') that works only with (hold your breath) Microsoft Windows or Apple (s)Mackintosh. What?? Why?? Arent you Android Sony Xperia OS? And if so arent you a derivative of Linux OS? So isnt it logical for you to work seamlessly with any Linux OS (in this case Ubuntu) using an open standard USB? Well apparently not. The developers and designers at Sony didnt have the foresight and vision to think beyond Windows and sMacintosh eventhough they are themselves based on a Linux OS. What a shame.
After a bit of twiddling, I do see a link under 'Settings > Storage' that prompts me to transfer files from 'Internal storage'(here, builtin phone storage) to 'External storage' (here the SD card). And I accept this option thinking that its only fair--I can transfer the files and then plug the SD card to my laptop directly (ie without the phone via USB). But another goof up on the software designers. They very conveniently forgot to mention that the 'Transfer' is actually a 'move' not a 'copy' (ie after transfering the files it will wipe out the original files. Who designed this? Can they at least warn the End user before doing such a one way transfer? Poor thinking Sony!!
Anyhow, I transfer the files and try to connect the SD card directly onto my laptop but as if all the prior misery was not enough, now the SD card is not recognized by Ubuntu OS because the SD card was formatted by the Phone OS (in this case unbelievably a Linux derivative called Android) in a format which is understood only by Windows and NOT by Linux. Why? This never was a problem with the previous Android phone (from HTC).

So what to do now?
I had to jump through these hoops to finally be able to transfer the files:

0- Put the SD card from my Sony to my older HTC phone (while my Sony phone sat useless like a plastic POS)
1- Transfer ALL files (including pics, songs, etc) from SD card in the HTC phone to the Laptop
2- After Transfer Format the SD card (while its in the HTC phone) so that the format is now recognizable to Linux (Remember, Sony formatted in a way only to be understood by Windows - the evil proprietary "extFAT" while HTC formats it into a universal Linux readable "vFAT" format)
3- After Format, put the SD card back into my Sony phone
4- Connect the Sony phone back to the laptop
5- Copy back the files from the laptop to the SD card that I did NOT want to transfer originally(like songs etc)

So as you see it was 6 step hassle. Why?
Because some genius in Sony decided that it was a wonderful idea to totally ignore Linux compatibility eventhough the phone OS in use (Android) is itself a Linux derivative and as such should talk the same language and be seamless..But no.. Great Sony!! (puns intended)

Sony here's the lesson for you. You are great hardware maker. No doubt. I have long been your fan. So have millions of others like me. But you are losing the smartphone battle to Samsung and iOS. Arent you? Do you want to keep losing market or do you want to win back again? If you want to win back then...Dont be stupid and restrictive. Dont be anti end user comfort. Only those companies who give utmost importance to End-user convenience succeed and are actually succeeding as we speak. Dont you see? If a savvy end-user like myself had to go through so many hoops to get something as simple as file transfer from phone to laptop then think of Grandma or Aunt Tilly. You have already scared them and lost their business. Come on Sony give us a better deal and DONT ignore Linux. Period.


Saturday, September 13, 2014

My First Year with Dell Ubuntu Linux XPS 13 Laptop

Today I wanted to share my experience of my recently completed 12 months with Dell Linux Laptop.
If you are wondering what is a Dell Linux Laptop then go here on Dell's website. I hope Dell doesnt change the URL anytime soon. But let me begin by saying that on a scale of 1-10 about my overall satisfaction with this laptop I would give it a high 9.5 or 10/10.
Now if you have followed my previous posts about Linux Laptops on Sony or Asus Bamboo Laptop you will notice that I'm a hardcore Linux OS person & that I cant stand Windowwws (aka Microsoft) or osxxx (aka Apple sauce ;-)). So there is a slight chance that I may be a little more critical any OS other than Linux but I believe with what other OSes do to End-User Freedom, its all well to be a little unfriendly to them...

I must say in my eyes, Dell is the only major hardware vendor who has in the last decade had the guts to take to the market with a Factory installed Linux laptop. The key word is 'major'. Other little hardware assemblers and VARs have been doing it for a while but they are not anywhere in the graph. In the hardware landscape if you are not in the top 10 you are really not there..Anyhow I digress. Dell had first come out with their first version of Dell Factory installed Linux Laptops in the form of the Inspiron 14 Ubuntu laptops back in 2007. And I remember I had immediately scooped one up eventhough it was a bit pricey at about $1500 then. Although it was not the top notch contender but hey you must recognize Dells effort and guts to do something other than what the cattle crowd of hardware players does for Microsoft. I had liked that incarnation for a while -- I still have it in my array of laptop collections and it does work still albeit slowly. But this second version of Dell XPS 13 preloaded with Ubuntu 12.04 that Dell came out with in 2012 was a kicker. Eversince I heard about it I was very eager to get one and finally in May-June of 2013 I did. Let me go a bit into its specs first...

What I wanted from my next laptop was:
1- Lightweight & less than 3lbs  (this one was advertized as 2.96 lbs & I believe .69 inches thick). So check..
2- Hi Speed at 3GHz or more (this one has Intel i7 Quad core at around 3GHz & 8 GB RAM) so good on that front.
3- Low Heat and Fan noise (It is markedly cool and silent thanks to its Carbon Fiber Base and efficient circuitry-- I can barely hear the fan even when running videos and it is in quite in contrast to my frustration with the Sony vaio running linux. So we are good on that front..
4- SSD Hard Drive (this one has 256 GB of solid state disks) No more spinning spindles and cranking disks that also add to the weight besides being failure prone after prolonged usage..So check
5- Backlit Keyboard (very important for me because I work in the dark often like early mornings/late nights and without disturbing others--also good for airplanes when they turn off lights--you can keep working)
6- HD Graphics (this one has full 1080p HD screen with Intel IvyBridge Graphics card) so movies are a thrill..
7- Long Battery life of minimum 5 hours (this one gives 6 hours with lots of programs and about 7 hours when only surfing/browsing). Again much better than the Sony Vaio experience
8- Small form factor - this is where it really does good. Due to the edge to edge screen using Gorilla Glass Dell has been able to squeeze in a 13 inch in a 11 inch form factor..How cool is that?
9- Compact Power Adapter - I have had ugly bricks for power adapters in the past. This one is sleek, tiny and small like a cigarette case and puts the apple sauce people to notice. Not to forget the cool LED light on the connector is a useful innovation especially when you are trying to grope for the DC power port when working in the dark like me..
10 - Linux OS - Last but not at all least - How can we forget this. I have sworn to never buy a windows and or apple. So this one is all set..

And as you see, the laptop holds good in each of my wants. Infact the package is so cool that I have had several people in several countries/places stop and ask me about which laptop is it? where I got it from? how much I paid  and that it really is a great looking beautiful lapto  etc, etc..One guy thought this was a tablet..But nope this is a full featured laptop that holds the punch.

Now how much did I pay for it? About USD 1550 all inclusive. Granted its not the cheapest in its segment but Do you really  want a cheap laptop and cut corners in your style statement? I dont. Plus look at it this way, its a fully loaded Ferrari of a laptop. Do you want to compare it to a Camry?
BTW, one thing I must say that the Ubuntu folks didnt do 100% on was the suspend mode. In 12.04 LTS (the default with this laptop) throws the following onscreen messages when you suspend the laptop or wake it up:
[12656.501533]PM:Device 00:07 failed to resume: error -19
[12658.420216][drm:gen6_sanitize_pm]*Error* Power management discrepancy: GEN6_RP_INTERRUPT_LIMITS expected 18000000, was 12060000
legacy_resume():pnp_bus_resume*0x0/0x70 returns -19

But suspend still works--only the above ugly cryptic errors show up. I believe it is something to do with the Power management routines that are called when suspend function is invoked in the kernel. Anyhow I chose to ignore it for a year and when in July of this year (2014), Ubuntu came up with the 14.04 LTS with bug fixes I upgraded to it promptly and now those errors are gone & I dont see them. This was the only reason I gave it 9.5/10 when 12.04 was running. But now with 14.04 LTS on and the error gone, I can give it 10/10. In other words in my first year with the laptop I have been extremely satisfied with the Dell XPS 13 runing Ubuntu. And for someone who changes laptops every 12-18 months, I think this one will hold for a long time to come who knows may be I will be surprising myself using the same laptop from 2013 in 2018 and yet not compromising on anything..who knows..
So next time you are faced with the decision to buy a laptop for yourself or loved ones, dont overlook the incredible quality, features and value of the Dell XPS 13. Put on a Tux sticker from Zazzle on the lid like I did and you will be very satisfied with your purchase, make a statement and also turn heads..

=====

Oh yes one more point..
I have never been a fan of Ubuntu's Unity Interface. So one of the first things I did to customize it to my taste (besides installing Chrome Browser) was to install gnome using the following command..
$ sudo apt-get install gnome-shell
You can find several tutorials to guide you through the process like this one here.


Monday, December 16, 2013

Software Licensing Terms and Meanings

Free Open Source Software Licensing Terms and Meanings.

Note: The following discussion is based on my personal software industry experience and observation. This is not a legal advice. Any comments/corrections/suggestions for improvements are welcome.

In context of Computer Software:

Copyright = Owner has Exclusive ownership of work. No one else does. Copyright is automatic--ie, if you write an original software program, create an original art, write a new book, etc, you are automatically the default Copyright owner of the that work. You dont have to apply for your Copyright (unlike Patents). You can do whatever with it. You can patent it (and make it exclusive) or you can free it by allowing others to freely copy/replicate your work (this is what Copyleft attempts to do--see below).
Patent = Superset of Copyright in terms of restrictions. It disallows even 'similar' works attempted by others. You have to apply for it with the Patents office for it. It gives you exclusive rights over your work. You can legally sue anyone who tries to copy it or steal it.
Public Domain =  No copyright. No one person owns it. Everyone collectively owns it. No cost. (Think of a public road or park).
Free s/w = Source Code + Binary. NOT no cost. Although it can be granted for no money..(IF the software Copyright owner so desires).
Note: Software in Public Domain is essentially Free s/w. It can also be made closed.
Note: this is because NOone owns Public Domain s/w. It is 'use it as you like'.

Copyleft = Copyright + Copyright owner Frees it (ie source code + binary) using a Free software license (like GPL, Apache, etc) + All Derivatives required to be Free (ie source + binary)
Note: FSF and GNU encourage Copylefting. They dont encourage Public Domain s/w. This is because Public Domain s/w can potentially be turned closed (use it as you like) where as Copyleft s/w can NOT be closed.

Note: NOT all Free s/w (in Public Domain) is Copyleft. Copyleft is Free s/w with that cannot be closed. (eg X Windows is Free but not Copyleft). infact, many Free s/w licenses like Apache, Mozilla, MIT, LGPL etc are NOT Copyleft. This means that s/w (or their derivatives) under such licenses can be turned into closed. This is what Android and ZFS are.

Specific Cases:
GNU GPL v2 and GNU GPL v3 are BOTH Copyleft Licenses.
GPLv3 is more restrictive in that it forbids only a certain version of Copyleft s/w to be run on a certain h/w.
In other words, GPLv3 says, end user can run any version of a Copyleft s/w on a certain h/w.
This is in response to DVR maker TiVo who allowed ONLY a certain version of their Copyleft s/w to run on their h/w. Under GPLv2, this would be ok--because GPLv2 only mandates s/w being Free+Copyleft--it doesnt talk of what hardware it should or should not be run on.
GPLv3 is designed to prevent DRMs.

DRM = short for Digital Rights Management.
DRM comprises of  Digital signatures placed in h/w &/or s/w (Free or Closed) to restrict what h/w a s/w can run on.
DRM is used by hardware vendors to control what software runs on their hardware.
DRM is used by software vendors to control what hardware their software runs on.
DRM is essentially not CopyLeft. It is extreme CopyRight.

Tuesday, December 3, 2013

Business Legal Musings - 1



Some commonly used Business Terms regarding Intellectual Property:

Invention = Any new Idea or Creative work or improvement in existing product/idea.
   eg: A new recipe for Ketchup.

Intellectual Property = An Invention legally owned by Inventor.
   eg: Inventors copy of the recipe for the Ketchup with legal evidence to show ownership.

Patent = Exclusive legal right to own and use an Invention.
   eg: Legal Evidence & Acknowledgement by Patent Office to the Inventor of the Ketchup's Recipe.
Note: Patents Expire. Usually granted for 15-20 years.
Note: Patents are usually for Design/Technical/Science related IP. 
Note: The equivalent term for Patents For Artistic IP (eg Music, Literature or Recipe) is Copyright. Like Patents, Copyrights too expire after certain time but usually after longer time(70-100+ years).
Note: The concept of Patents is a superset of Copyright in terms of legal rights.
   eg: whereas copyright will protect against verbatim copy of the Ketchup Recipe (ie Plagiarism) it wont protect if there is minor differences in the wording of two recipes. 
   Patent will actually prevent anyone but the IP owner to even attempt to make a similar Ketchup Recipe.
   This is especially true in case of Computer Software Patents.

Innovation = Popularizing an Invention usually through Marketing, Sales & PR.
   eg: Mass production and sale of the new Ketchup.

Trademark = A Symbol for an Innovation (for exclusive use by someone).
   eg: a logo for the Ketchup.

Royalty = Fee paid to the Inventor or Innovator for sharing their Intellectual Property.
   eg: Fee paid to the Inventor or Innovator to gain access to their Ketchup Recipe.

Public Domain = Public property; Allowing Unrestricted Access to an Invention/Innovation.
   eg: Once the Ketchup Recipe Patent (or rather Copyright) expires, the Recipe becomes Public Property; i.e., Royalties no longer need be paid for using the Recipe.

Sunday, December 1, 2013

Pointer Refresher in C Language:

Here is a short Pointer Refresher in C Language:

-pointers: variables that hold the 'memory address' of another variable
-They are declared using '*' operator and initialized using '&' operator.
-eg:
$ cat -n ptr0.c 
    1 #include <stdio.h>
      2
      3 int main()
      4 {
      5 int num;
      6 int *pnum; /* pointer declaration */
      7 pnum=&num; /* pointer initialization */
      8 num=57;
      9 printf("\n Value of variable num = %d.", num);
    10 *pnum=23; /* indirect invocation of value of variable num via pointer */
    11 printf("\n New value of variable num = %d.", num);
    12 printf("\n The first value was direct invocation of variable.");
    13 printf("\n The second value was an indirect invocation of variable, using a pointer.");
    14 printf("\n Good bye.\n");
    15 return 0;
    16 }

-advantages of Pointers:
.allow dynamic allocation of mem /* see '*pum=23;' in above code */
.allow functions to modify calling argument

-void pointer:
.is defined as 'void *pointervar'
.its type is unknown and can thus receive a parameter that receive any type of pointer argument
.in other words, during value assignment, no explicit cast is required.
-see below code for void pointer illustration:
$ cat -n voidptr.c 
      1 #include <stdio.h>
      2
      3 int main()
      4 {
      5 int i=5;
      6 char ch='M';
      7 void *ptr; /* declaring a void pointer */
      8
      9 ptr=&i; /* initialize ptr with an integer var addr */
    10 printf("\n Pointer ptr now points to an integer %d.", *(int *)ptr);
    11 ptr=&ch; /* initialize ptr with an character var addr */
    12 printf("\n Pointer ptr now points to a char %c.", *(char *)ptr);
    13 printf("\n The same pointer was used to point to an integer and then to a char.");
    14 printf("\n This was possible only due to a void pointer.");
    15 printf("\n Good bye.");
    16
    17 return 0;
    18 }
    19

Wednesday, October 2, 2013

Linux Howto: Missing curses/ncurses Library Ubuntu 12.04

So I tried this simple program to test a Text-screen based program on my Ubuntu 12.04:

mrinal@ms-dell:~/C_Progs$ cat screen1.c 
#include <unistd.h>
#include <stdlib.h>
#include <curses.h>

int main()
{
initscr();
move(5,15);
printw("%s","Hello World");
refresh();
sleep(5);
endwin();
exit(EXIT_SUCCESS);
}

When I try to compile it using the Text-screen library system curses, I get the following error:

mrinal@ms-dell:~/C_Progs$ gcc screen1.c -o ans -lcurses
screen1.c:3:20: fatal error: curses.h: No such file or directory
compilation terminated.

Turns out I dont have the curses.h header file (nor the new ncurses.h)
mrinal@ms-dell:~/C_Progs$ ls -l /usr/include/*curs*
ls: cannot access *curs*: No such file or directory

This means the packages for curses (and/or ncurses) library are missing. To fix this, I did this:

mrinal@ms-dell:~/C_Progs$ sudo apt-get install libncurses5-dev libncursesw5-dev
[sudo] password for mrinal:
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages were automatically installed and are no longer required:
 ...
After this operation, 2,971 kB of additional disk space will be used.
Do you want to continue [Y/n]? y
Get:1 http://archive.ubuntu.com/ubuntu/ precise/main libtinfo-dev amd64 5.9-4 [103 kB]
Get:2 http://archive.ubuntu.com/ubuntu/ precise/main libncurses5-dev amd64 5.9-4 [222 kB]
Get:3 http://archive.ubuntu.com/ubuntu/ precise/main libncursesw5-dev amd64 5.9-4 [255 kB]
Fetched 581 kB in 9s (64.0 kB/s)                                                                                                                  
...
Setting up libtinfo-dev (5.9-4) ...
Setting up libncurses5-dev (5.9-4) ...
Setting up libncursesw5-dev (5.9-4) ...
mrinal@ms-dell:~/C_Progs$ 

After this, the curses header file is now available in my /usr/include directory:

mrinal@ms-dell:~/C_Progs$ ls -l /usr/include/*cur*
-rw-r--r-- 1 root root  6582 Nov 18  2011 /usr/include/cursesapp.h
-rw-r--r-- 1 root root 27630 Nov 18  2011 /usr/include/cursesf.h
-rw-r--r-- 1 root root 76291 Nov 18  2011 /usr/include/curses.h
...
-rw-r--r-- 1 root root  7304 Nov 18  2011 /usr/include/cursslk.h
-rw-r--r-- 1 root root  3925 Nov 18  2011 /usr/include/ncurses_dll.h
lrwxrwxrwx 1 root root     8 Nov 18  2011 /usr/include/ncurses.h -> curses.h

/usr/include/ncursesw:
total 352
-rw-r--r-- 1 root root  6591 Nov 18  2011 cursesapp.h
-rw-r--r-- 1 root root 27648 Nov 18  2011 cursesf.h
-rw-r--r-- 1 root root 93685 Nov 18  2011 curses.h
-rw-r--r-- 1 root root 19522 Nov 18  2011 cursesm.h
... 
-rw-r--r-- 1 root root 40299 Nov 18  2011 term.h
-rw-r--r-- 1 root root 12534 Nov 18  2011 tic.h

-rw-r--r-- 1 root root  3108 Nov 18  2011 unctrl.h

And the program compiles successfully:

mrinal@ms-dell:~/C_Progs$ gcc screen1.c -o ans -lcurses

And executes successfully too.

mrinal@ms-dell:~/C_Progs$ ./ans


Sunday, September 8, 2013

How to do Group Video Meeting on Google Hangout

With Google Hangout we can do a Group Video Meeting of upto 10 users for FREE.
Heres how:

Pre-requisites for Video Meeting on Google Hangout:

1- a Google Gmail account
2- a computer/device with video camera, mike and speakers*
3- high speed Internet (at least 1Mbps is recommended)

*If using external camera, mike and speakers, make sure they are the default in Google (see below)

How to use:

1- Login to your Gmail account -- make sure you are not logged into any other video service like Skype as it can interfere with Google when it tries to access your camera, mike or speaker.

2- Click Contact -- On the left side of your Gmail screen, you have all your contacts. Click the contact name you want to video with. A new window will pop up--this is the Hangout window.

3- Settings -- On the top right of the Hangout window, click the 'Settings' icon -- it looks like a gear.
3a- When you click the Settings, you will see your default camera, mike and speakers -- make sure they are are listed and are the correct device. For eg, if your computer has an integrated camera and you are using another USB camera, then choose which camera Google should use.

4- Invite -- To add more people to the meeting, click the 'Invite People' on the left side of the hangout window.

5- Meet -- Once they accept the invite everyone would be in the same Hangout video meeting and would be able to see each other.

6- To End -- To end the meeting, click the icon on the 'Exit' button on the top right (Telephone receiver with a downward pointing arrow)

Note: When doing video meetings, the recommendation is that same person who starts the hangout meeting, adds the remaining invitees. If everyone tries to invite everyone else, Google gets confused.

Wednesday, May 8, 2013

Linux - Compiling a kernel steps:


[root@redhat4 ~]# cd /tmp
[root@redhat4 tmp]# mkdir mskernel
[root@redhat4 tmp]# cd mskernel
[root@redhat4 mskernel]# uname -a
Linux redhat4 2.6.32-220.el6.x86_64 #1 SMP Wed Nov 9 08:03:13 EST 2011 x86_64 x86_64 x86_64 GNU/Linux

[root@redhat4 mskernel]# wget https://www.kernel.org/pub/linux/kernel/v3.x/linux-3.8.12.tar.xz

--2013-05-08 09:56:32--  https://www.kernel.org/pub/linux/kernel/v3.x/linux-3.8.12.tar.xz
Resolving www.kernel.org... 198.145.20.140, 149.20.4.69
Connecting to www.kernel.org|198.145.20.140|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 71001428 (68M) [application/x-xz]
Saving to: “linux-3.8.12.tar.xz”

100%[===========================================================================>] 71,001,428  5.21M/s   in 12s  

2013-05-08 09:56:44 (5.70 MB/s) - “linux-3.8.12.tar.xz” saved [71001428/71001428]


[root@redhat4 mskernel]# tar xvJf linux-3.8.12.tar.xz 
linux-3.8.12/
linux-3.8.12/.gitignore
linux-3.8.12/.mailmap
linux-3.8.12/COPYING
linux-3.8.12/CREDITS
linux-3.8.12/Documentation/
linux-3.8.12/Documentation/.gitignore
linux-3.8.12/Documentation/00-INDEX
linux-3.8.12/Documentation/ABI/
linux-3.8.12/Documentation/ABI/README
linux-3.8.12/Documentation/ABI/obsolete/
linux-3.8.12/Documentation/ABI/obsolete/proc-sys-vm-nr_pdflush_threads
linux-3.8.12/Documentation/ABI/obsolete/sysfs-bus-usb
linux-3.8.12/Documentation/ABI/obsolete/sysfs-class-rfkill
linux-3.8.12/Documentation/ABI/obsolete/sysfs-driver-hid-roccat-koneplus
linux-3.8.12/Documentation/ABI/obsolete/sysfs-driver-hid-roccat-kovaplus
linux-3.8.12/Documentation/ABI/obsolete/sysfs-driver-hid-roccat-pyra
linux-3.8.12/Documentation/ABI/removed/
linux-3.8.12/Documentation/ABI/removed/devfs
linux-3.8.12/Documentation/ABI/removed/dv1394
linux-3.8.12/Documentation/ABI/removed/ip_queue
linux-3.8.12/Documentation/ABI/removed/o2cb
linux-3.8.12/Documentation/ABI/removed/raw1394
linux-3.8.12/Documentation/ABI/removed/video1394
.....



[root@redhat4 linux-3.8.12]# make menuconfig
  HOSTCC  scripts/basic/fixdep
  HOSTCC  scripts/kconfig/conf.o
 *** Unable to find the ncurses libraries or the
 *** required header files.
 *** 'make menuconfig' requires the ncurses libraries.
 ***
 *** Install ncurses (ncurses-devel) and try again.
 ***
make[1]: *** [scripts/kconfig/dochecklxdialog] Error 1
make: *** [menuconfig] Error 2

To overcome this error, I ran -
[root@redhat4 linux-3.8.12]# yum install ncurses-devel -y
This installed the missing packages and then re-ran menuconfig (see below):


[root@redhat4 linux-3.8.12]# make menuconfig
  HOSTCC  scripts/kconfig/conf.o
  HOSTCC  scripts/kconfig/lxdialog/checklist.o
  HOSTCC  scripts/kconfig/lxdialog/inputbox.o
  HOSTCC  scripts/kconfig/lxdialog/menubox.o
  HOSTCC  scripts/kconfig/lxdialog/textbox.o
  HOSTCC  scripts/kconfig/lxdialog/util.o
  HOSTCC  scripts/kconfig/lxdialog/yesno.o
  HOSTCC  scripts/kconfig/mconf.o
  SHIPPED scripts/kconfig/zconf.tab.c
  SHIPPED scripts/kconfig/zconf.lex.c
  SHIPPED scripts/kconfig/zconf.hash.c
  HOSTCC  scripts/kconfig/zconf.tab.o
  HOSTLD  scripts/kconfig/mconf
scripts/kconfig/mconf Kconfig
#
# using defaults found in /boot/config-2.6.32-220.el6.x86_64
#
/boot/config-2.6.32-220.el6.x86_64:555:warning: symbol value 'm' invalid for PCCARD_NONSTATIC
/boot/config-2.6.32-220.el6.x86_64:2567:warning: symbol value 'm' invalid for MFD_WM8400
/boot/config-2.6.32-220.el6.x86_64:2568:warning: symbol value 'm' invalid for MFD_WM831X
/boot/config-2.6.32-220.el6.x86_64:2569:warning: symbol value 'm' invalid for MFD_WM8350
/boot/config-2.6.32-220.el6.x86_64:2582:warning: symbol value 'm' invalid for MFD_WM8350_I2C
/boot/config-2.6.32-220.el6.x86_64:2584:warning: symbol value 'm' invalid for AB3100_CORE
/boot/config-2.6.32-220.el6.x86_64:3502:warning: symbol value 'm' invalid for MMC_RICOH_MMC

The menuconfig option allows gui based kernel configuration (see sample config menus here)

...
Once satisfied, save changes

...

#
# configuration written to .config
#

*** End of the configuration.
*** Execute 'make' to start the build or try 'make help'.


Then run make..
[root@redhat4 linux-3.8.12]# make
  HOSTLD  scripts/kconfig/conf
scripts/kconfig/conf --silentoldconfig Kconfig
  SYSHDR  arch/x86/syscalls/../include/generated/uapi/asm/unistd_32.h
  SYSHDR  arch/x86/syscalls/../include/generated/uapi/asm/unistd_64.h
  SYSHDR  arch/x86/syscalls/../include/generated/uapi/asm/unistd_x32.h
  SYSTBL  arch/x86/syscalls/../include/generated/asm/syscalls_32.h
  SYSHDR  arch/x86/syscalls/../include/generated/asm/unistd_32_ia32.h
  SYSHDR  arch/x86/syscalls/../include/generated/asm/unistd_64_x32.h
  SYSTBL  arch/x86/syscalls/../include/generated/asm/syscalls_64.h
  HOSTCC  arch/x86/tools/relocs
  WRAP    arch/x86/include/generated/asm/clkdev.h
  CHK     include/generated/uapi/linux/version.h
  UPD     include/generated/uapi/linux/version.h
  CHK     include/generated/utsrelease.h
  UPD     include/generated/utsrelease.h
  CC      kernel/bounds.s
  GEN     include/generated/bounds.h
  CC      arch/x86/kernel/asm-offsets.s
  GEN     include/generated/asm-offsets.h
  CALL    scripts/checksyscalls.sh
  HOSTCC  scripts/genksyms/genksyms.o

.....
after about 2 hours...
.....

 IHEX    firmware/mts_gsm.fw
  IHEX    firmware/mts_edge.fw
  H16TOFW firmware/edgeport/boot.fw
  H16TOFW firmware/edgeport/boot2.fw
  H16TOFW firmware/edgeport/down.fw
  H16TOFW firmware/edgeport/down2.fw
  IHEX    firmware/edgeport/down3.bin
  IHEX2FW firmware/whiteheat_loader.fw
  IHEX2FW firmware/whiteheat.fw
  IHEX2FW firmware/keyspan_pda/keyspan_pda.fw
  IHEX2FW firmware/keyspan_pda/xircom_pgs.fw
[root@redhat4 linux-3.8.12]#

[root@redhat4 linux-3.8.12]# make modules_install
  INSTALL Documentation/connector/cn_test.ko
  INSTALL Documentation/filesystems/configfs/configfs_example_explicit.ko
  INSTALL Documentation/filesystems/configfs/configfs_example_macros.ko
  INSTALL arch/x86/crypto/ablk_helper.ko
  INSTALL arch/x86/crypto/aes-x86_64.ko
  INSTALL arch/x86/crypto/aesni-intel.ko
  INSTALL arch/x86/crypto/crc32c-intel.ko
  INSTALL arch/x86/crypto/ghash-clmulni-intel.ko
  INSTALL arch/x86/crypto/salsa20-x86_64.ko
  INSTALL arch/x86/crypto/twofish-x86_64.ko
  INSTALL arch/x86/kernel/cpu/mcheck/mce-inject.ko
  INSTALL arch/x86/kernel/microcode.ko
  INSTALL arch/x86/kernel/test_nx.ko
  INSTALL arch/x86/kvm/kvm-amd.ko
  INSTALL arch/x86/kvm/kvm-intel.ko
  INSTALL arch/x86/kvm/kvm.ko
  INSTALL arch/x86/oprofile/oprofile.ko
  INSTALL crypto/ansi_cprng.ko
  INSTALL crypto/anubis.ko
  INSTALL crypto/arc4.ko
  INSTALL crypto/async_tx/async_memcpy.ko
  INSTALL crypto/async_tx/async_pq.ko
  INSTALL crypto/async_tx/async_raid6_recov.ko
.....
  INSTALL /lib/firmware/ti_3410.fw
  INSTALL /lib/firmware/ti_5052.fw
  INSTALL /lib/firmware/mts_cdma.fw
  INSTALL /lib/firmware/mts_gsm.fw
  INSTALL /lib/firmware/mts_edge.fw
  INSTALL /lib/firmware/edgeport/boot.fw
  INSTALL /lib/firmware/edgeport/boot2.fw
  INSTALL /lib/firmware/edgeport/down.fw
  INSTALL /lib/firmware/edgeport/down2.fw
  INSTALL /lib/firmware/edgeport/down3.bin
  INSTALL /lib/firmware/whiteheat_loader.fw
  INSTALL /lib/firmware/whiteheat.fw
  INSTALL /lib/firmware/keyspan_pda/keyspan_pda.fw
  INSTALL /lib/firmware/keyspan_pda/xircom_pgs.fw
  DEPMOD  3.8.12
[root@redhat4 linux-3.8.12]# 

[root@redhat4 linux-3.8.12]# make install
sh /tmp/mskernel/linux-3.8.12/arch/x86/boot/install.sh 3.8.12 arch/x86/boot/bzImage \
System.map "/boot"
[root@redhat4 grub]# 

Then you can cd to /boot dir and verify the new kernel is present there..
[root@redhat4 boot]# cd /boot
[root@redhat4 boot]# ls -lart
total 45631
-rw-r--r--.  1 root root      166 Nov  9  2011 .vmlinuz-2.6.32-220.el6.x86_64.hmac
-rw-r--r--.  1 root root  2312369 Nov  9  2011 System.map-2.6.32-220.el6.x86_64
-rw-r--r--.  1 root root   100943 Nov  9  2011 config-2.6.32-220.el6.x86_64
-rwxr-xr-x.  1 root root  3938800 Nov  9  2011 vmlinuz-2.6.32-220.el6.x86_64
-rw-r--r--.  1 root root   171087 Nov  9  2011 symvers-2.6.32-220.el6.x86_64.gz
drwx------.  2 root root    12288 Jun 19  2012 lost+found
drwxr-xr-x.  3 root root     1024 Jun 19  2012 efi
-rw-r--r--.  1 root root 15558855 Jun 19  2012 initramfs-2.6.32-220.el6.x86_64.img
-rw-------.  1 root root  4301773 Jun 19  2012 initrd-2.6.32-220.el6.x86_64kdump.img
dr-xr-xr-x. 25 root root     4096 Mar  5 08:56 ..
-rw-r--r--.  1 root root  4272784 May  8 11:36 vmlinuz-3.8.12
lrwxrwxrwx.  1 root root       20 May  8 11:36 vmlinuz -> /boot/vmlinuz-3.8.12
-rw-r--r--.  1 root root  2621147 May  8 11:36 System.map-3.8.12
lrwxrwxrwx.  1 root root       23 May  8 11:36 System.map -> /boot/System.map-3.8.12
dr-xr-xr-x.  5 root root     1024 May  8 11:37 .
-rw-r--r--.  1 root root 13406914 May  8 11:37 initramfs-3.8.12.img
drwxr-xr-x.  2 root root     1024 May  8 11:37 grub

[root@redhat4 grub]# cd /boot/grub
[root@redhat4 grub]# ls -lart
total 279
-rw-r--r--. 1 root root   1341 May  6  2010 splash.xpm.gz
-rw-r--r--. 1 root root  13964 Jun 19  2012 xfs_stage1_5
-rw-r--r--. 1 root root  11364 Jun 19  2012 vstafs_stage1_5
-rw-r--r--. 1 root root  12024 Jun 19  2012 ufs2_stage1_5
-rw-r--r--. 1 root root    512 Jun 19  2012 stage1
-rw-r--r--. 1 root root  14412 Jun 19  2012 reiserfs_stage1_5
-rw-r--r--. 1 root root  11956 Jun 19  2012 minix_stage1_5
lrwxrwxrwx. 1 root root     11 Jun 19  2012 menu.lst -> ./grub.conf
-rw-r--r--. 1 root root  13268 Jun 19  2012 jfs_stage1_5
-rw-r--r--. 1 root root  11756 Jun 19  2012 iso9660_stage1_5
-rw-r--r--. 1 root root  11748 Jun 19  2012 ffs_stage1_5
-rw-r--r--. 1 root root  12620 Jun 19  2012 fat_stage1_5
-rw-r--r--. 1 root root  13380 Jun 19  2012 e2fs_stage1_5
-rw-r--r--. 1 root root     63 Jun 19  2012 device.map
-rw-r--r--. 1 root root 125976 Jun 19  2012 stage2
dr-xr-xr-x. 5 root root   1024 May  8 11:37 ..
-rw-------. 1 root root   1172 May  8 11:37 grub.conf
drwxr-xr-x. 2 root root   1024 May  8 11:37 .
[root@redhat4 grub]# 

You can verify that the new kernel is now in the grub.conf:
[root@redhat4 grub]# vim grub.conf
# grub.conf generated by anaconda
#
# Note that you do not have to rerun grub after making changes to this file
# NOTICE:  You have a /boot partition.  This means that
#          all kernel and initrd paths are relative to /boot/, eg.
#          root (hd0,0)
#          kernel /vmlinuz-version ro root=/dev/mapper/VolGroup-lv_root
#          initrd /initrd-[generic-]version.img
#boot=/dev/sda
default=1
timeout=5
splashimage=(hd0,0)/grub/splash.xpm.gz
hiddenmenu
title Red Hat Enterprise Linux Server (3.8.12)
        root (hd0,0)
        kernel /vmlinuz-3.8.12 ro root=/dev/mapper/VolGroup-lv_root rd_NO_LUKS LANG=en_US.UTF-8 rd_NO_MD rd_LVM_LV=VolGroup/lv_swap SYSFONT=latarcyrheb-sun16 rhgb crashkernel=auto quiet rd_LVM_LV=VolGroup/lv_root  KEYBOARDTYPE=pc KEYTABLE=us rd_NO_DM
        initrd /initramfs-3.8.12.img
title Red Hat Enterprise Linux (2.6.32-220.el6.x86_64)
        root (hd0,0)
        kernel /vmlinuz-2.6.32-220.el6.x86_64 ro root=/dev/mapper/VolGroup-lv_root rd_NO_LUKS LANG=en_US.UTF-8 rd_NO_MD rd_LVM_LV=VolGroup/lv_swap SYSFONT=latarcyrheb-sun16 rhgb crashkernel=auto quiet rd_LVM_LV=VolGroup/lv_root  KEYBOARDTYPE=pc KEYTABLE=us rd_NO_DM
        initrd /initramfs-2.6.32-220.el6.x86_64.img
~                                                


And thats it.
There is tons of useful links on the net eg: this one at wikihow





Tuesday, May 7, 2013

Linux - Installing packages from source tarballs:

Installing a package using - tar.gz, configure, make, make install steps:

1- Download the tarball:

[root@redhat2 linux-2.6.39]# wget http://www.sqlite.org/sqlite-autoconf-3070603.tar.gz
--2013-05-07 15:48:52--  http://www.sqlite.org/sqlite-autoconf-3070603.tar.gz
Resolving www.sqlite.org... 67.18.92.124, 2600:3c00::f03c:91ff:fe96:b959
Connecting to www.sqlite.org|67.18.92.124|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 1720314 (1.6M) [application/x-gzip]
Saving to: “sqlite-autoconf-3070603.tar.gz”

100%[==========================================================================================>] 1,720,314    802K/s   in 2.1s  

2013-05-07 15:48:54 (802 KB/s) - “sqlite-autoconf-3070603.tar.gz” saved [1720314/1720314]

2- Extract the tarball:

root@redhat2 linux-2.6.39]# tar xvfz sqlite-autoconf-3070603.tar.gz 
sqlite-autoconf-3070603/
sqlite-autoconf-3070603/tea/
sqlite-autoconf-3070603/tea/doc/
sqlite-autoconf-3070603/tea/doc/sqlite3.n
sqlite-autoconf-3070603/tea/win/
sqlite-autoconf-3070603/tea/win/rules.vc
sqlite-autoconf-3070603/tea/win/makefile.vc
sqlite-autoconf-3070603/tea/win/nmakehlp.c
sqlite-autoconf-3070603/tea/aclocal.m4
sqlite-autoconf-3070603/tea/README
sqlite-autoconf-3070603/tea/configure
sqlite-autoconf-3070603/tea/configure.in
sqlite-autoconf-3070603/tea/tclconfig/
sqlite-autoconf-3070603/tea/tclconfig/install-sh
sqlite-autoconf-3070603/tea/tclconfig/tcl.m4
sqlite-autoconf-3070603/tea/generic/
sqlite-autoconf-3070603/tea/generic/tclsqlite3.c
sqlite-autoconf-3070603/tea/Makefile.in
sqlite-autoconf-3070603/tea/license.terms
sqlite-autoconf-3070603/tea/pkgIndex.tcl.in
sqlite-autoconf-3070603/depcomp
sqlite-autoconf-3070603/sqlite3.pc
sqlite-autoconf-3070603/aclocal.m4
sqlite-autoconf-3070603/README
sqlite-autoconf-3070603/ltmain.sh
sqlite-autoconf-3070603/configure
sqlite-autoconf-3070603/shell.c
sqlite-autoconf-3070603/configure.ac
sqlite-autoconf-3070603/config.guess
sqlite-autoconf-3070603/install-sh
sqlite-autoconf-3070603/config.sub
sqlite-autoconf-3070603/missing
sqlite-autoconf-3070603/sqlite3.1
sqlite-autoconf-3070603/sqlite3.c
sqlite-autoconf-3070603/sqlite3.h
sqlite-autoconf-3070603/Makefile.am
sqlite-autoconf-3070603/Makefile.in
sqlite-autoconf-3070603/sqlite3ext.h
sqlite-autoconf-3070603/INSTALL
sqlite-autoconf-3070603/sqlite3.pc.in
[root@redhat2 linux-2.6.39]# cd sqlite-autoconf-3070603
[root@redhat2 sqlite-autoconf-3070603]# ls
aclocal.m4    config.sub  configure.ac  INSTALL     ltmain.sh    Makefile.in  README   sqlite3.1  sqlite3ext.h  sqlite3.pc     tea
config.guess  configure   depcomp       install-sh  Makefile.am  missing      shell.c  sqlite3.c  sqlite3.h     sqlite3.pc.in

3- Configure the source:

[root@redhat2 sqlite-autoconf-3070603]# ./configure
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking for style of include used by make... GNU
checking for gcc... gcc
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables...
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking dependency style of gcc... gcc3
checking for special C compiler options needed for large files... no
checking for _FILE_OFFSET_BITS value needed for large files... no
checking for gcc... (cached) gcc
checking whether we are using the GNU C compiler... (cached) yes
checking whether gcc accepts -g... (cached) yes
checking for gcc option to accept ISO C89... (cached) none needed
checking dependency style of gcc... (cached) gcc3
checking for ranlib... ranlib
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking for a sed that does not truncate output... /bin/sed
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for ld used by gcc... /usr/bin/ld
checking if the linker (/usr/bin/ld) is GNU ld... yes
checking for /usr/bin/ld option to reload object files... -r
checking for BSD-compatible nm... /usr/bin/nm -B
checking whether ln -s works... yes
checking how to recognise dependent libraries... pass_all
checking how to run the C preprocessor... gcc -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking dlfcn.h usability... yes
checking dlfcn.h presence... yes
checking for dlfcn.h... yes
checking for g++... no
checking for c++... no
checking for gpp... no
checking for aCC... no
checking for CC... no
checking for cxx... no
checking for cc++... no
checking for cl.exe... no
checking for FCC... no
checking for KCC... no
checking for RCC... no
checking for xlC_r... no
checking for xlC... no
checking whether we are using the GNU C++ compiler... no
checking whether g++ accepts -g... no
checking dependency style of g++... none
checking for g77... no
checking for xlf... no
checking for f77... no
checking for frt... no
checking for pgf77... no
checking for cf77... no
checking for fort77... no
checking for fl32... no
checking for af77... no
checking for xlf90... no
checking for f90... no
checking for pgf90... no
checking for pghpf... no
checking for epcf90... no
checking for gfortran... no
checking for g95... no
checking for xlf95... no
checking for f95... no
checking for fort... no
checking for ifort... no
checking for ifc... no
checking for efc... no
checking for pgf95... no
checking for lf95... no
checking for ftn... no
checking whether we are using the GNU Fortran 77 compiler... no
checking whether  accepts -g... no
checking the maximum length of command line arguments... 32768
checking command to parse /usr/bin/nm -B output from gcc object... ok
checking for objdir... .libs
checking for ar... ar
checking for ranlib... (cached) ranlib
checking for strip... strip
checking if gcc supports -fno-rtti -fno-exceptions... no
checking for gcc option to produce PIC... -fPIC
checking if gcc PIC flag -fPIC works... yes
checking if gcc static flag -static works... no
checking if gcc supports -c -o file.o... yes
checking whether the gcc linker (/usr/bin/ld -m elf_x86_64) supports shared libraries... yes
checking whether -lc should be explicitly linked in... no
checking dynamic linker characteristics... GNU/Linux ld.so
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... yes
configure: creating libtool
appending configuration tag "CXX" to libtool
appending configuration tag "F77" to libtool
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for fdatasync... yes
checking for usleep... yes
checking for fullfsync... no
checking for localtime_r... yes
checking for gmtime_r... yes
checking whether strerror_r is declared... yes
checking for strerror_r... yes
checking whether strerror_r returns char *... no
checking for library containing tgetent... no
checking for library containing readline... no
checking for readline... no
checking for library containing pthread_create... -lpthread
checking for library containing dlopen... -ldl
checking for whether to support dynamic extensions... yes
checking for posix_fallocate... yes
configure: creating ./config.status
config.status: creating Makefile
config.status: creating sqlite3.pc
config.status: executing depfiles commands
[root@redhat2 sqlite-autoconf-3070603]# ls
aclocal.m4    config.status  configure.ac  install-sh  Makefile     missing  sqlite3.1     sqlite3.h      tea
config.guess  config.sub     depcomp       libtool     Makefile.am  README   sqlite3.c     sqlite3.pc
config.log    configure      INSTALL       ltmain.sh   Makefile.in  shell.c  sqlite3ext.h  sqlite3.pc.in

4- Compile the source:

[root@redhat2 sqlite-autoconf-3070603]# make
if /bin/sh ./libtool --tag=CC --mode=compile gcc -DPACKAGE_NAME=\"sqlite\" -DPACKAGE_TARNAME=\"sqlite\" -DPACKAGE_VERSION=\"3.7.6.3\" -DPACKAGE_STRING=\"sqlite\ 3.7.6.3\" -DPACKAGE_BUGREPORT=\"http://www.sqlite.org\" -DPACKAGE=\"sqlite\" -DVERSION=\"3.7.6.3\" -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_DLFCN_H=1 -DHAVE_FDATASYNC=1 -DHAVE_USLEEP=1 -DHAVE_LOCALTIME_R=1 -DHAVE_GMTIME_R=1 -DHAVE_DECL_STRERROR_R=1 -DHAVE_STRERROR_R=1 -DHAVE_POSIX_FALLOCATE=1 -I. -I.    -D_REENTRANT=1 -DSQLITE_THREADSAFE=1  -DSQLITE_ENABLE_FTS3 -DSQLITE_ENABLE_RTREE -g -O2 -MT sqlite3.lo -MD -MP -MF ".deps/sqlite3.Tpo" -c -o sqlite3.lo sqlite3.c; \
then mv -f ".deps/sqlite3.Tpo" ".deps/sqlite3.Plo"; else rm -f ".deps/sqlite3.Tpo"; exit 1; fi
mkdir .libs
 gcc -DPACKAGE_NAME=\"sqlite\" -DPACKAGE_TARNAME=\"sqlite\" -DPACKAGE_VERSION=\"3.7.6.3\" "-DPACKAGE_STRING=\"sqlite 3.7.6.3\"" -DPACKAGE_BUGREPORT=\"http://www.sqlite.org\" -DPACKAGE=\"sqlite\" -DVERSION=\"3.7.6.3\" -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_DLFCN_H=1 -DHAVE_FDATASYNC=1 -DHAVE_USLEEP=1 -DHAVE_LOCALTIME_R=1 -DHAVE_GMTIME_R=1 -DHAVE_DECL_STRERROR_R=1 -DHAVE_STRERROR_R=1 -DHAVE_POSIX_FALLOCATE=1 -I. -I. -D_REENTRANT=1 -DSQLITE_THREADSAFE=1 -DSQLITE_ENABLE_FTS3 -DSQLITE_ENABLE_RTREE -g -O2 -MT sqlite3.lo -MD -MP -MF .deps/sqlite3.Tpo -c sqlite3.c  -fPIC -DPIC -o .libs/sqlite3.o
 gcc -DPACKAGE_NAME=\"sqlite\" -DPACKAGE_TARNAME=\"sqlite\" -DPACKAGE_VERSION=\"3.7.6.3\" "-DPACKAGE_STRING=\"sqlite 3.7.6.3\"" -DPACKAGE_BUGREPORT=\"http://www.sqlite.org\" -DPACKAGE=\"sqlite\" -DVERSION=\"3.7.6.3\" -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_DLFCN_H=1 -DHAVE_FDATASYNC=1 -DHAVE_USLEEP=1 -DHAVE_LOCALTIME_R=1 -DHAVE_GMTIME_R=1 -DHAVE_DECL_STRERROR_R=1 -DHAVE_STRERROR_R=1 -DHAVE_POSIX_FALLOCATE=1 -I. -I. -D_REENTRANT=1 -DSQLITE_THREADSAFE=1 -DSQLITE_ENABLE_FTS3 -DSQLITE_ENABLE_RTREE -g -O2 -MT sqlite3.lo -MD -MP -MF .deps/sqlite3.Tpo -c sqlite3.c -o sqlite3.o >/dev/null 2>&1
/bin/sh ./libtool --tag=CC --mode=link gcc -D_REENTRANT=1 -DSQLITE_THREADSAFE=1  -DSQLITE_ENABLE_FTS3 -DSQLITE_ENABLE_RTREE -g -O2   -o libsqlite3.la -rpath /usr/local/lib -no-undefined -version-info 8:6:8 sqlite3.lo  -ldl -lpthread 
gcc -shared  .libs/sqlite3.o  -ldl -lpthread  -Wl,-soname -Wl,libsqlite3.so.0 -o .libs/libsqlite3.so.0.8.6
(cd .libs && rm -f libsqlite3.so.0 && ln -s libsqlite3.so.0.8.6 libsqlite3.so.0)
(cd .libs && rm -f libsqlite3.so && ln -s libsqlite3.so.0.8.6 libsqlite3.so)
ar cru .libs/libsqlite3.a  sqlite3.o
ranlib .libs/libsqlite3.a
creating libsqlite3.la
(cd .libs && rm -f libsqlite3.la && ln -s ../libsqlite3.la libsqlite3.la)
if gcc -DPACKAGE_NAME=\"sqlite\" -DPACKAGE_TARNAME=\"sqlite\" -DPACKAGE_VERSION=\"3.7.6.3\" -DPACKAGE_STRING=\"sqlite\ 3.7.6.3\" -DPACKAGE_BUGREPORT=\"http://www.sqlite.org\" -DPACKAGE=\"sqlite\" -DVERSION=\"3.7.6.3\" -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_DLFCN_H=1 -DHAVE_FDATASYNC=1 -DHAVE_USLEEP=1 -DHAVE_LOCALTIME_R=1 -DHAVE_GMTIME_R=1 -DHAVE_DECL_STRERROR_R=1 -DHAVE_STRERROR_R=1 -DHAVE_POSIX_FALLOCATE=1 -I. -I.    -D_REENTRANT=1 -DSQLITE_THREADSAFE=1  -DSQLITE_ENABLE_FTS3 -DSQLITE_ENABLE_RTREE -g -O2 -MT shell.o -MD -MP -MF ".deps/shell.Tpo" -c -o shell.o shell.c; \
then mv -f ".deps/shell.Tpo" ".deps/shell.Po"; else rm -f ".deps/shell.Tpo"; exit 1; fi
/bin/sh ./libtool --tag=CC --mode=link gcc -D_REENTRANT=1 -DSQLITE_THREADSAFE=1  -DSQLITE_ENABLE_FTS3 -DSQLITE_ENABLE_RTREE -g -O2   -o sqlite3  shell.o ./libsqlite3.la  -ldl -lpthread 
gcc -D_REENTRANT=1 -DSQLITE_THREADSAFE=1 -DSQLITE_ENABLE_FTS3 -DSQLITE_ENABLE_RTREE -g -O2 -o .libs/sqlite3 shell.o  ./.libs/libsqlite3.so -ldl -lpthread  -Wl,--rpath -Wl,/usr/local/lib
creating sqlite3
[root@redhat2 sqlite-autoconf-3070603]# 

5- Install the source:

[root@redhat2 sqlite-autoconf-3070603]# make install
make[1]: Entering directory `/tmp/Django-1.5.1/linux-2.6.39/sqlite-autoconf-3070603'
test -z "/usr/local/lib" || mkdir -p -- "/usr/local/lib"
 /bin/sh ./libtool --mode=install /usr/bin/install -c  'libsqlite3.la' '/usr/local/lib/libsqlite3.la'
/usr/bin/install -c .libs/libsqlite3.so.0.8.6 /usr/local/lib/libsqlite3.so.0.8.6
(cd /usr/local/lib && { ln -s -f libsqlite3.so.0.8.6 libsqlite3.so.0 || { rm -f libsqlite3.so.0 && ln -s libsqlite3.so.0.8.6 libsqlite3.so.0; }; })
(cd /usr/local/lib && { ln -s -f libsqlite3.so.0.8.6 libsqlite3.so || { rm -f libsqlite3.so && ln -s libsqlite3.so.0.8.6 libsqlite3.so; }; })
/usr/bin/install -c .libs/libsqlite3.lai /usr/local/lib/libsqlite3.la
/usr/bin/install -c .libs/libsqlite3.a /usr/local/lib/libsqlite3.a
chmod 644 /usr/local/lib/libsqlite3.a
ranlib /usr/local/lib/libsqlite3.a
PATH="$PATH:/sbin" ldconfig -n /usr/local/lib
----------------------------------------------------------------------
Libraries have been installed in:
   /usr/local/lib

If you ever happen to want to link against installed libraries
in a given directory, LIBDIR, you must either use libtool, and
specify the full pathname of the library, or use the `-LLIBDIR'
flag during linking and do at least one of the following:
   - add LIBDIR to the `LD_LIBRARY_PATH' environment variable
     during execution
   - add LIBDIR to the `LD_RUN_PATH' environment variable
     during linking
   - use the `-Wl,--rpath -Wl,LIBDIR' linker flag
   - have your system administrator add LIBDIR to `/etc/ld.so.conf'

See any operating system documentation about shared libraries for
more information, such as the ld(1) and ld.so(8) manual pages.
----------------------------------------------------------------------
test -z "/usr/local/bin" || mkdir -p -- "/usr/local/bin"
  /bin/sh ./libtool --mode=install /usr/bin/install -c 'sqlite3' '/usr/local/bin/sqlite3'
/usr/bin/install -c .libs/sqlite3 /usr/local/bin/sqlite3
test -z "/usr/local/include" || mkdir -p -- "/usr/local/include"
 /usr/bin/install -c -m 644 'sqlite3.h' '/usr/local/include/sqlite3.h'
 /usr/bin/install -c -m 644 'sqlite3ext.h' '/usr/local/include/sqlite3ext.h'
test -z "/usr/local/share/man/man1" || mkdir -p -- "/usr/local/share/man/man1"
 /usr/bin/install -c -m 644 './sqlite3.1' '/usr/local/share/man/man1/sqlite3.1'
test -z "/usr/local/lib/pkgconfig" || mkdir -p -- "/usr/local/lib/pkgconfig"
 /usr/bin/install -c -m 644 'sqlite3.pc' '/usr/local/lib/pkgconfig/sqlite3.pc'
make[1]: Leaving directory `/tmp/Django-1.5.1/linux-2.6.39/sqlite-autoconf-3070603'
[root@redhat2 sqlite-autoconf-3070603]# 

-Test it out-

[root@redhat2 sqlite-autoconf-3070603]# sqlite3 mrinal.db
SQLite version 3.7.6.3
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
sqlite> create table mrinal (id integer, name varchar(20));
sqlite> insert into mrinal values(1,'MS');
sqlite> select * from mrinal;
1|MS
sqlite> insert into mrinal values(1,'MS');
sqlite> insert into mrinal values(1,'MS');
sqlite> insert into mrinal values(1,'MS');
sqlite> insert into mrinal values(1,'MS');
sqlite> select * from mrinal;
1|MS
1|MS
1|MS
1|MS
1|MS
sqlite>