Sunday, May 1, 2016

Prostitution as the job of future

What? Yes. The only profession you will find at the latter part of technology evolution is the world's oldest profession. Before explaining how that happens let's discuss about today and come to that later. This is a special day to start this blog with a new vision. Today is 1st of May, the day of laborers. This day is special as the majority working population has won some privileges like 8 hour working shift. This statement itself describes something laborers sacrifice for the master. That is time. Time is what we have in common irrespective of one's wealth. Poor spend most of their best time of life to provide themselves basic needs while rich spend a little time for surviving and more time enjoying the life. Here the rich people are the one's that solely dependent on investment while poorness is be dependent on the salary of a worker.

Whether we like to accept or not there is a game between rich (investors) and poor (work force). Rich like to pay least and earn most while poor like to get paid most for the least pain of labor. Here the assert the rich has is the capital while the assert poor has are the skills and time. This game had little effect with the time until the IT has come into the playground.

From the pre-historic time humans have developed technology to ease the stuff they had to do in a harder way. (e.g. Invention of wheel) Innovations have improved the living conditions of human beings from stone age to the modern human civilization. The purpose of innovation is always to

  1. reduce the work by humans
  2. reduce the time takes
  3. improve the quality of outcome and to
  4. increase the volume of the the outcome 

of a product or a service. With the advancement of technology the accumulated knowledge was passed from generation to generation and continuously improved the above four parameters of almost all the products and services we consume on today. But up to the information era this innovation was gradual. Machinery were developed but human involvement was essential in most cases. Automating machinery was very difficult to make, that needed a lot of mechanical knowledge and time to implement. And once automation is built with hardware it is almost unable to customize for improvements. All of these issues with automating machines kept the room for laborer to work and earn considerable amount of profit share, a company makes out of the products and services. But under the curtain the technology has saved a thousands of human hours to the employer (owner of capital) that would have needed for the same task otherwise. But as the quality of life increases the demand for advanced goods and services were demanded from the public which made the workers working for new demands. The new demand increased the profits of the capital owners but could not extract a huge amount of wealth from the mankind as the increase of price of good/service creates new competitors who has the same technology and attract the work force for much higher salaries.

With IT and Programmed Software


Ability to print complex logical statements into a piece of silicon wafer has changed the game between rich and poor while exponentially improving the above mentioned 4 parameters. Not only we can print to logic into silicon chips but make generic silicon chips that can execute programs generated as binary data. Mechanical programming and automation has changed to software driven motors and actuators that can rapidly improve the way a machine works without touching the hardware implementation by just programming a software. This has saved a millions of human hours worth of work improving the quality of mankind at the same time losing many many human jobs.

That is how the IT industry has improved providing higher salaries to programmers for losing many other types of jobs from the world. But with the programming technology is being developed, primary programming building blocks were given as boilerplate and programmers just has to run on top of it. This has also eliminated many many low level programming jobs but more complex requirements made the programmers busy and software industry still in need of more programmers.

But with the innovation of software, developing software will lose the developer jobs as well. But as Turing machines cannot perfectly understand another Turing machine an error free programming machine will never be innovated with current technology. (Quantum computers may change that game as well) Although the programming jobs cannot be perfectly automated with a software, jobs opportunities for programmers will be far less when many logical components are built into systems where programmers have a very little to do.

Who Can Save the Jobs?


Today almost every week you hear new technological stuff are getting innovated. One day it was Google Glasses then it was Google autonomous cars and later it was Oculus. In all of these innovations, the common innovative factor is software. Hardware technology was developed for thousands of years but now all the hardware have come into life with software. Compared to hardware innovations, software innovation has a very rapid growth rate due to its inherent features like object oriented programming paradigm. When software is used, the investors has more power over hardware innovations due to intellectual property rights. It is not easy to reverse engineer a software and reproduce a copy of it or improve it. Giant software like Google Search could hide their complete software technology by just providing their software as services. This has created the room for monopoly. Once a great software is built only the same company can develop further on it. And they can sell their product for the highest price a buyer is willing to buy which provides them a huge profit margin compared to a traditional hardware technology vendor. A software vendor can either copy a software binary and sell or just host the software and sell as a software as a service. The latter is becoming popular due to guaranteed IP rights, emerge of cloud technology and due to the emerge of low powered mobile technology.

This process drastically improves the wealth distribution among the society and this is how Microsoft owner has become the richest person on earth in his lifetime while Google and Apple and come to their respective positions. Only few technology giant companies acquire most of wealth of mankind which gives the capability to invest more into innovations and to pay high salaries for best brains of workforce. Small companies cannot afford either their cost of innovation or the salary payments which avoids any competitors entering into the market. Actually these giants are becoming the competitors for other industries. For example Google Loon is a threat for existing telecommunication industry while automated vehicles threaten the transportation companies and jobs for drivers. Amazon threatens the book publisher industry and music recording industry.

Now the questions is who can save the jobs which is our topic. Actually other than few of brilliant engineers working in these companies there will be no job left in theory.

Accountancy and paper related jobs have already taken away by IT. Food cultivation, maintaining farms can also be automated with robots. Services like medical services can be automated with AI based consultancy services. Even surgery may be possible with automated robots. Yeah, production, maintenance and repairing machinery can also be automated with intelligent robots. (i.e. Robots that can make robots by themselves) Construction industry, housekeeping, childcare all can be automated with robots. Legal system can also be automated with computer vision enabled camera driven software observers for crimes, robot police officers and robot armies and AI based judiciary. Entertaining industry can be replaced with music generating, singing and art drawing software, which are already in the experimental stage.

The only requirement humans cannot replaced by robots is when it comes to sex. Virtual reality sex or humanoid robots can fulfill human sexual needs but it is questionable all people would be really happy with the pseudo sex. Irrespective of the gender, the only job opportunity real humans will remain is prostitution. Be prepared for it. Either your child will have to work in Google or Microsoft becoming a genius engineer or he/she should be sexy enough to successful in the profession of prostitution. When you select your partner be selective how your child will survive in the future. Remember, your child should be either extremely genius or sexy.

Is There Any Hope?


All above things are possible when technology giant owners think like psychopaths and government becomes a puppet of these giants. The latter is possible as even now we can see that, but the previous assumption is far beyond the reality. When people gather a huge amount of money that cannot be spent during his lifetime they become more human. Although they may not stop innovating further they may be willing to distribute the wealth they have gathered to the poor people in the society. On the other hand if majority becomes poor and die with hunger there will be no customers to buy the products and services they produce. Most probably government taxes may become a way of distributing their excess wealth among the rest of people while most of their wealth will be distributed with charity. So at last, although the distribution of wealth among people are huge, most people will acquire better living standards than we have today. People will have nothing to do as jobs we do today, with pain and will be able to spend a comfortable life. If they want excess comfort, they will have to do a job which is either one of the 2 jobs available on those days.

Thursday, December 31, 2015

Bye to 2015

After less than 2 hours there will be a new calendar year, 2016 be started which will be a beginning of this blog in a new way with different type of content. Stay tuned for a new type of blogging culture. :)

Sunday, March 2, 2014

ESB Performance Round 7.5

WSO2 has carried out a performance testing of latest ESB release, WSO2 ESB 4.8.1. In WSO2 ESB Performance Round 7.5 it compares WSO2 ESB 4.8.1 with other competitive ESB products, Mule ESB 3.4.0, Talend-SE 5.3.1 and UltraESB 2.0.0.

Basic observations are as follows.



Tuesday, July 16, 2013

How to Build WSO2 Code

Although WSO2 is open source many people were having problem with checking out the WSO2 source code and building WSO2 products. Here are the simple steps to do it.
Note that at the moment ongoing development happens inside the trunk with version 4.2.0 SNAPSHOT. Last released WSO2 code is located in branch version 4.1.0 with Carbon platform version 4.1.2.

Build the trunk


  1. Checkout Orbit from https://svn.wso2.org/repos/wso2/carbon/orbit/trunk/
  2. Checkout Kernel from https://svn.wso2.org/repos/wso2/carbon/kernel/trunk/
  3. Checkout Platform from https://svn.wso2.org/repos/wso2/carbon/platform/trunk/
  4. Install Apache Maven 3 in your computer.
  5. Go to the checked out directories and build with Maven of orbit, kernel and platform code respectively. (Use command, mvn clean install)
  6. If any errors comes with tests use the command mvn clean install -Dmaven.test.skip=true
  7. If the build is properly building and you are fortunate you will get all the products as zip files in each product. For example WSO2 BAM will be there in platform/trunk/products/bam/modules/distribution/target directory.
  8. But most probably you will not be able to build all the products well at the same time and it will take much time as well. So you can build the product only you want as follows. Comment the products module in platform/trunk/pom.xml . Then after building all three orbit, kernel and platform, you can manually build the product/s you want. For example if you only want to build WSO2 BAM, go to platform/trunk/products/bam and build with command mvn clean install -Dmaven.test.skip=true

Build the Branch 4.1.0

  1. Checkout orbit from https://svn.wso2.org/repos/wso2/carbon/orbit/branches/4.1.0/
  2. Checkout kernel from https://svn.wso2.org/repos/wso2/carbon/kernel/branches/4.1.0/
  3. Checkout platform from https://svn.wso2.org/repos/wso2/carbon/platform/branches/4.1.0/
  4. Follow the exact steps 4, 5 and 6 mentioned under the topic, "Build the trunk".
  5. In 7th step, use the directory path, branches/4.1.0/products/bam/2.3.0/modules/distribution/target as the BAM pack location.
  6. Then follow the 8th step by commenting the product module in branches/4.1.0/pom.xml and building the BAM in location, branches/4.1.0/products/bam/2.3.0

Build a Tag

When already there is a released product, best way to build it, is by checking out the tag of the released version. The reason is that even the branch may be committed after the release by a mistake.
For this example lets continue with WSO2 BAM 2.3.0. It has orbit version 4.1.0, kernel version 4.1.0 and platform version 4.1.2. You can checkout these three from https://svn.wso2.org/repos/wso2/carbon/orbit/tags/4.1.0/ , https://svn.wso2.org/repos/wso2/carbon/kernel/tags/4.1.0/ and https://svn.wso2.org/repos/wso2/carbon/platform/tags/4.1.2/ . Then continue building in the same way as earlier.



Monday, January 7, 2013

Writing a Custom Mediator for WSO2 ESB - Part 3

This is the last part of blog post series about creating a WSO2 ESB mediator. Older parts are,
  1. Part 1
  2. Part 2
In this post I will explain the UI component of a ESB mediator using the BAM mediator (Carbon version 4.0.5). UI component (i.e.: org.wso2.carbon.mediator.bam.ui) is responsible for the BAM mediator specific UIs in the following UI.

Mediator UI



When BAM mediator is selected in the above mediator sequence (there is only the BAM mediator is available here anyway) the UI located under the sequence UI, is specified in the mediator UI component. Anyway not all the UI under it comes from the UI component. UI between the bar named Mediator and Update button comes from the UI component. Actually this is the edit-mediator.jsp JSP located in the resources package in org.wso2.carbon.mediator.bam.ui component.
After the changes are made on UI the user can click on the above mentioned Update button. This event will call the update-mediator.jsp JSP adjacent to the edit-mediator.jsp JSP.

When switch to source view is clicked the following source appears.


And you can return back to design view by clicking on switch to design view link. This toggling mechanism need the implementation of UI component. In simple terms this functionality need the implementation of,
  1. BamMediator UI class - similar to BamMediator class in backend component
  2. serialize method - similar to serializeSpecificMediator method in BamMediatorSerializer class in backend component
  3. build method - similar to createSpecificMediator method in BamMediatorFactory class in backend component

Abstract Mediator Class (UI)


The difference of UI component with backend component is, that both serialize method and build method are included in the BamMediator UI class. BamMediator UI class can be found in org.wso2.carbon.mediator.bam.ui package.
BamMediator class should inherit from org.wso2.carbon.mediator.service.ui.AbstractMediator.
And also it should implement getTagLocalName method, similar to getTagQName used in backend. And also the serialize and build methods as mentioned earlier should be implemented.

public class BamMediator extends AbstractMediator {

    public String getTagLocalName() {

    }

    public OMElement serialize(OMElement parent) {

    }

    public void build(OMElement omElement) {

    }

}

Abstract Mediator Service Class


Every mediator UI component should consists of a Mediator Service class. In this example BamMediatorService is the class which implements the required settings of the UI. Let's explain with the example.

public class BamMediatorService extends AbstractMediatorService {

    public String getTagLocalName() {
        return "bam";
    }

    public String getDisplayName() {
        return "BAM";
    }

    public String getLogicalName() {
        return "BamMediator";
    }

    public String getGroupName() {
        return "Agent";
    }

    public Mediator getMediator() {
        return new BamMediator();
    }

}

As the example says every Mediator Service should inherit the org.wso2.carbon.mediator.service.AbstractMediatorService class.
Note how the name BAM is used as the sequence editor under the sub menu item named Agent. See how the getMediator method is used to execute the BamMediator UI class which we have discussed earlier.

Bundle Activator Class


Unlike other Carbon bundles where Bundle Activator is defined in the backend bundle, in a mediator class, the Bundle Activator is defined in the  UI bundle. In this example it is BamMediatorActivator class.

Basically the Bundle Activator should inherit the org.osgi.framework.BundleActivator class and should implement start and stop methods. For further information read this article.

Properties props = new Properties();

bundleContext.registerService(MediatorService.class.getName(), new BamMediatorService(), props);

Note how the BamMediatorService class is used.

Congratulations, you have finished the post series of how to write a custom mediator with WSO2 ESB. If you could not understand this well, most probably that is because you are not familiar with WSO2 Carbon platform. If you search more you will be able to catch them.

Friday, January 4, 2013

Writing a Custom Mediator for WSO2 ESB - Part 2

Let's continue from the previous post, Part 1. As there were several changes and fixes happened to BAM mediator, there we are taking the example of two latest components,
  1. org.wso2.carbon.mediator.bam version 4.0.5 - backend component
  2. org.wso2.carbon.mediator.bam.ui version 4.0.5 - UI component
As you can see, there is no services.xml file exists in the backend component. There are two files namely org.apache.synapse.config.xml.MediatorFactory and org.apache.synapse.config.xml.MediatorSerializer containing the class names (with package name) of Mediator Factory and Mediator Serializer. Let's discuss the usage of these 2 classes.

Mediator Factory


In WSO2 ESB, each mediator is created using the Factory design pattern. When the ESB starts each mediator is created using a Mediator Factory. The programmer is given the opportunity to write the Mediator Factory as a single class. In this example, the factory class is org.wso2.carbon.mediator.bam.xml.BamMediatorFactory that contains all the instantiating code relevant to the mediator. Factory class is the code that generates the mediator based on the mediator XML (XML specification of the mediator in the ESB sequence). In this factory the configuration information should be extracted from the XML and should create a mediator based on that configuration.

public Mediator createSpecificMediator(OMElement omElement, Properties properties) {

}

This method should be implemented which takes the XML as an OMElement and returns the Mediator to be produced. Here it is an instance of the BamMediator class we have defined in the parent package.
And also in this method it can access the secondary storage (e.g.: Registry) as the method is not performance critical. (This method will run only at the creation stage of a mediator.)

public QName getTagQName() {

}

This method should also be implemented to return the QName of the XML of the specific mediator. In BAM mediator it has the name "bam".

Mediator Serializer

Mediator Serializer does the reverse of the Mediator Factory. It creates the XML, related to the mediator, back from the Mediator class. (Here it is from BamMediator)

public OMElement serializeSpecificMediator(Mediator mediator) {

}

This method should implement which does the above said conversion. (serialization) It takes the Mediator and returns the generated XML, related to the mediator.

public String getMediatorClassName() {

}

And also this should be implemented to return the Mediator's class name.

Now let's start discuss about the most important class, the Mediator class, here the BamMediator class.

Mediator Class

This is the class used while the ESB is running for the purpose of mediation. As this class is executed in run time it should be designed with care avoiding unnecessary performance degrading actions. And also because this class is executed in parallel threads, should be careful on concurrency issues and make them thread safe.
Mediator class should always extend the AbstractMediator class.

public boolean isContentAware() {
    return true;
}


The above method must be included in the Mediator class if the mediator is intended to interact with the MessageContext.
mediate is the most important method that should be implemented.


public boolean mediate(MessageContext messageContext) {

}

mediate method is given the MessageContext of the message, which is unique to an each request passing through the mediation sequence. The return boolean value should be true if the mediator was successfully executed and false if not.

Note that global variables in the Mediator class may cause race condition as different threads of the mediation sequence may access the same global variable. It can be prevented by one of the following techniques.
  1. Using local variables inside the method
  2. Storing variables in the MessageContext as Properties
  3. Using thread local variables
Best way to handle this issue is possible with first technique if the mediator is not that complex. And the third technique should be used with care if want to use due to the risk of memory leaks.

Let's discuss about the UI package in the next part (Part 3).