Skip to main content

Posts

Showing posts from 2014

OPEC vs Shale

This picture is almost correct explanation for today's (29-November-2014) three years low oil prize i.e 72$ from 115$.
OPEC (Organization of the Petroleum Exporting Countries) is group of Oil producing countries and logically they includes Arab countries and some African countries. OPEC provides forum to oil producing countries to lower/increase oil production and oil prizes.In seventies it had dominance of foreign oil companies but later God given sense to Oil  producing countries government and now they have dominance(just to say). Though OPEC decides oil prizes and extraction , but it's acceptance depends on will of it's members.
               Now you will understand that in Seventies Oil Crisis had happened because OPEC countries had put oil supply limited in practical term it is called embargo.So all oil consuming countries mainly US at that time (now position is replaced by India,china) stumbled for oil and their economy had collapsed.In simple term their economy h…

Feast and famine

This article is directly copied from Economist and I like its content and hence I have added in my blog.

MAHARASHTRA, 2010. In a village 130km (80 miles) from Mumbai, the head of a nursery is weighing a child. Four years old, she is just 10kg (22lb), two-thirds of what she should be. More than half the nursery’s charges are below their proper weight (“wasted” in the jargon) or short for their age (“stunted”, a result of years of undernourishment). The children out in the fields are even worse off, the teacher says. And most of their mothers are anaemic. Yet this Indian state is not especially poor.

India has done a miserable job of improving its people’s nutrition—but so has most of the world. In 1974, Henry Kissinger, America’s secretary of state, told the first world food summit that no child would go to bed hungry within ten years. He was miles off. Figures calculated for a follow-up conference show that 162m children under five are stunted. The rate of child wasting has not budged…

Share data between Iframe and its Parent using JQuery

There could be requirement that you have to pass variables values to Iframe from parent or in other scenario you have to pass values from Iframe to its parent.I am going to show simple example of above situation with the help of JQuery.
           Support we have parent HTML page having iframe included like below

<html> <body> <input id="parentValue" type="text" value="I am from Parent !" /> <iframe src="domainurl/relativepath" id="iframe"></iframe> <script> $(document).ready(function() { //code to take value from child iframe var childValue = $("#iframe").contents().find("#childValue").val(); alert(childValue); }); </script> </body> </html> 
        and we have frame code like below
<html> <body> <input id="childValue" type="text" value="I …

Byte Stream Vs Character Stream in Java

While doing I/O operations in Java , you may come across word like streams or bytes or characters or encoding. Don't be confuse with this word because they are all point to conman cause that is Data transfer form memory to disk or vice-versa.

When we talk about system/programing language, they are always talks in bits (binary data). When we group 8 bits we get bytes and when we group 16 bits we get the characters.

Before arrival of multiple language that is before internationalization, we have only ASCII Charset.Till that time, all was fine. Everything could be done by Byte Streams because every character was represented by one byte.

After internationalization , we have Unicode charset. In that character may be represented by two or mote bytes. It is not enough to represent character by reading one byte at a time. Hence we have to introduce Character stream to support unicode. It reads character y character.

If you are working with raw/binary data such as images, music files , th…

Java Exception Simplified

After scolding multiple time about not to do things, man commits mistakes. To handle that consequences we have Exception Handling. There are such mistakes whose consequences can be handle and there are other whose consequences can not be handle. They are totally depends upon gods fate.
 In technical term , exception that are checked at compile time are Checked Exceptions
and others are Unchecked Exceptions.This two types are present in Java but not in C++ (other OOP Language). In C++ , all exceptions are unchecked and compile does not force to handled them.

In Java they are categorized as follows


Point to consider is that Error are related to hardware failure and ultimately you can not control them from software.
There are many well-know exceptions are present and they are all categorized among Exception, RuntimeException and Error.


Why all exceptions extends Throwable?
            It has very simple and one word explanation that Java supports only Single Inheritance.

Why we need exc…

Java JDBC Connection and JSP

Today we will create JSP page which will show records in table fetched from MySQL database using JDBC Connection.
It is not best practice to do coding in scriptlet.Major disadvantages of coding in scriptlet are
Reusability: you can't reuse scriptlets.
Replaceability: you can't make scriptlets abstract.
OO-ability: you can't make use of inheritance/composition.
Debuggability: if scriptlet throws an exception halfway, all you get is a blank page.
Testability: scriptlets are not unit-testable.
Maintainability: more time is needed to maintain mingled/cluttered/duplicated code logic.

     TRY TO AVOID CODING IN SCRIPTLET. USE JSTL OR EXPRESSION LANGUAGE.

But we will do it here just for demo purpose and to built up coding confidence.
We will not waste time and let's start coding part.

Step 1 : create Dynamic Web Project in Eclipse
New --->  Dynamic Web Project
Create web.xml file and add it  in WEB-INF folder of project.
   WebContent ---> WEB-INF  ---> web.xml
It will …

Pipe Dream

When you demarcate the territory blindly to unknown people without understanding their history and society ,then you must have to face consequences and that territory will become Pipe Dream to all of them.

What British had done with their Asian colonies in 1947,till date India, Pakistan and china are facing territorial disputes.Each one claims their territory without consent with others.

Here we are speaking the Pipe dreams of territories which also known as Jammu Kashmir and Arunachal Pradesh regions


This Map present the Current Boundaries for understanding. If we are sitting in country which is not India, Pakistan or China,this image will not beset us.Not at all.

This Map present the China's 
 Official claim.So what ?If you are Indian and residing in Arunachal Pradesh, then may not know this at all. You don't need passport to travel China.Because Chinese official will understand that you are Chinese citizen and from South Tibet part. Oops, Oh my God,I don't know this…

Things You Should Know About Israel

Things You should know about Israel, the 100th smallest country, with less than 1/1000th of the world's population, can lay claim to the following:

1. The cell phone was developed in Israel by Israelis working in the Israeli branch of Motorola, which has its largest development center in Israel.
2. Most of the Windows NT and XP operating systems were developed by Microsoft-Israel.
3. Both the Pentium-4 microprocessor and the Centrino processor were entirely designed, developed and produced in Israel.
4. Voice mail technology was developed in Israel.
5. Both Microsoft and Cisco built their only R&D facilities outside the US in Israel.
6. Israel has the fourth largest air force in the world (after the U.S., Russia and China).
7. Israel has the highest percentage in the world of home computers per capita.
9. Israel produces more scientific papers per capita than any other nation as well as one of the highest per capita rates of patents filed.
9. Israel has the largest num…

What is object-oriented programming (OOP) ?

This is exerts from Steve Jobs interview,who explains what object-oriented programming is?

Interviewer :
Would you explain, in simple terms, exactly what object-oriented software is ?

Jobs : 
Objects are like people. They're living, breathing things that have knowledge inside them about how to do things and have memory inside them so they can remember things. And rather than interacting with them at a very low level, you interact with them at a very high level of abstraction, like we're doing right here.

Here's an example: If I'm your laundry object, you can give me your dirty clothes and send me a message that says, "Can you get my clothes laundered, please." I happen to know where the best laundry place in San Francisco is. And I speak English, and I have dollars in my pockets. So I go out and hail a taxicab and tell the driver to take me to this place in San Francisco. I go get your clothes laundered, I jump back in the cab, I get back here. I give you your c…

Best Practice of URL Redirection in Spring Controllers

Example :

XYZ Class is a Controller and has URL mapping = "parent"
Controller XYZ has method-1 with URL mapping = "first"
Controller XYZ has method-2 with URL mapping = "second"

if you want to redirect from method-1 to method-2, normally we write redirect URL as

return"redirect:second";

Here UrlBasedViewResolver does the redirection "relative to current servlet context". It works fine in INTRA calling between methods of controller.But it may surprise when INTER calling between methods of other controllers.

But if you redirect like below

return"redirect:/parent/second";

Here  URL that starts with a slash(/) will be interpreted as relative to the web application root, i.e. the context path will be pre-appended to the URL.It is default behavior in UrlBasedViewResolver.

Benefit of this is that INTER calling between methods of other controllers becomes easier.


http://docs.spring.io/spring/docs/3.0.x/javadoc-api/org/springframewo…

Central Bank's Terms

Repo Rate/Repurchase Rate (RT) -

It is the rate at which bank borrows funds from RBI with the help of securities to meet demand they are facing for loans.
It injects liquidity in economy

Reverse Repo Rate/Repurchase Rate (RRT) -

It is the rate at which RBI borrows fund from Bank to reduce money floating in banking system.
It absorbs liquidity from economy.

Cash Reserve Ratio (CRR) -

It refers to amount of deposits banks have to maintain in RBI.

Statutory Liquidity Ratio (SLR) -

It refer to amount that banks require to maintain in form of GOLD or goverment approved securities(bond/shares).
RBI always determines the percentage of SLR.

Bank Rate (BR) -

It is rate of interest at which RBI lends money to banks.

Call Rate/Overnight Rate (Cl/OR) -

It rate at which bank lends or borrows money from each other for daily basis or short-term requirment in overnight market.

Source-

http://flame.org.in/KnowledgeCenter/WhatisCRRrepoandreversereporate.aspx

http://iasmentor.wordpress.com/2008/02/11/repo-re…

Understanding The Union Budget : Part-I

What is Union Budget?  It is nothing but the Annual Financial Statement presented by Central government in Parliament. It shows receipt and expenditure of government in financial year(1 April-31 March).
How can government get Money for Budget? Government too have its account.We can describe it in three parts.
1. Consolidated Fund - - revenue received by taxation and other
- loan raised by government
- recoveries of load granted by government
- expenditure incurred from this fund
- parliamentary authorization required

 2. Contingency Fund -  
- emergency or unexpected or unforeseen or urgent outflows such as economic crisis,disaster
- held by the finance secretary on behalf of the president of India

3.  Public Account -
- money received from transactions such as money raised from government schemes e.g Provident Fund,Saving Scheme
- government acts as banker
- government authorization not required
- in layman's term, money received from public is kept in this account and respective …

Quote : Technology

  When people talks about “technology” 
                                  They really mean “everything that doesn’t work yet”;
                Once technologies work
                                 They simply become computers,televisions,phones and the like.


                                                                               - Danny Hill
                                                                                 Computer Scientist and entrepreneur

Get Browser Name and Version in Javascript

JQuery stopped providing $.browser function after 1.9 release.So you have to write your own code to get know browser and its version.There is not standard procedure or code to achieve this.
But I will show you to get browser name and version of  IE > 6, Google Chrome And FF.

Here we have AGENT to rescue.Every browser has navigation object available in its script.In this object userAgent field contains current browser information.

So you can ask me What is User-Agent?How will it help us?
          As I said earlier it contain browser information.There is not standard to show each information but almost every browser support it.
    There is complicated history behind user-agent variable.But in simple sense we can say that user-agent is used by server side component to get information of client-side browser and its compatibility to page it will going to rendered.So we conclude that this user-agent information is little bit 50% same in all browser.

Why is it(user-agent) 50% s…

Bhagwati Vs Sen : Arvind Panagariya

The ongoing 'Bhagwati versus Sen' debate has generated more heat than light, necessitating correction. As an equal co-author of India's Tryst with Destiny, which defines the Bhagwati position, my stake in the debate is second to none.

Two extreme characterisations of the positions of the two sides have emerged. The first has it that the differences between them are minimal with each side expressing the same ideas in a different language. The second depicts Bhagwati as advocating solely growth and Sen solely social spending. Both characterisations are plain wrong.

Begin with the point on which the two sides agree. We have no disagreement with Sen on the objective. He would like to see poverty, illiteracy, ill health and other deprivations eliminated. We whole-heartedly accept this goal. Indeed, as India's first prime minister Jawaharlal Nehru wrote in The Discovery of India, the 1938 planning committee of the Congress had adopted this very goal for development planning …

Database on which WWW's biggest sites runs

Do you have question in mind that the big site specially social networking sites,where they stores our information?

They stores information in servers in which databases are hosted.Databases are nothing but the tools used to store information in structured form so that it can be analysed.

  Here  the list of big sites along with databases they are using:

facebook.com     -      Hive,Cassandra linkedn.com        -      Mysql,Oracle microsoft.com    -      SQL Server twitter.com          -      Mysql,Cassandra google.com         -      BigTable wikipeda.com     -      Mysql yahoo.com          -      Postgre SQL  





references:-
http://stackoverflow.com/questions/1113381/what-databases-do-the-world-wide-webs-biggest-sites-run-on

Enhancement for JAVA Enhanced for loop

If you are coding in Java many time you had met well Known Exception while using enhanced for each loop.

Null Pointer Exception is unavoidable if you use Enhanced For Each Loop without checking NULL condition for your collection.

Example:

List<Object> objectList=null; for (Object object :objectList) { //operation on Object }
Every time we have to check for Collection not to be Null.

To remove this ugly practice design utility method to check for NULL.
Like


publicstatic<T> List<T> safe( List<T> list ){return list ==null? Collections.EMPTY_LIST: list;}
Note that Collections.EMPTY_LIST will avoid allocating an extra object.It is immutable Object that can not be modified.

By using utility method you can avoid Null Pointer Exception .


List<Object> objectList=null;for(Object object : safe(objectList)){//operation on Object }


Thank you.


Design Pattern : Reusable OO Design

What is meant by design Pattern?

From Wiki Definition , in software engineering, a design pattern is a general reusable solution to a commonly occurring problem
within a given context in software design.

What is meant by that?

Suppose there is a team of four to five people working on ABC project for their client X.
After successful delivery Client wants some changes to project.
Some changes not a Big Deal.While incorporating that changes team stuck to many problems such as changing some Model Diagram Structure,Some interface,Moving methods of Class,Object creation.
After thinking so much, they have designed Specific template to solve this problem and incorporate it in project.

Then there is another team working on XYZ project for client A.But this team member knows that ABC project team have specific template.With the help of that design this team understood that in futer we may stuck with same problem that earlie team had stuck.
Hence they incorporated the changes.After successful de…