Friday, 15 November 2019

Effort And Understanding

There is no meaningful effort without an understanding
There is no understanding without a meaningful effort 
We achieve meaningful effort only by failing and trying again

Effort teaches you to be practical
Understanding will bring trust and patience

Understanding is needed to examine WHY and WHAT
Effort is needed to achieve WHAT by doing HOW in accordance with WHY

Focusing only on effort leads to rituals as mind enjoys choosing and making single sided decisions
It will make you a machine which has only a fixed purpose
The Goal is almost forgotten and The Path becomes everything

Focusing only on knowledge of understanding lead towards hallucination and laziness as mind enjoys the imagination, you will become a pundit, a scholar.
You will excel in debates, logic, philosophy but you will fail to experience life with full potential
The Path is almost forgotten, The Goal becomes the only desire 

Most of the times, the time spent in doing the effort and gaining understanding are not equal in proportion

You might have to take many meaningful steps before you arrive at certain understanding
You must do not an extra effort outside your understanding unless needed
The key here is not to identify yourself with either effort or understanding

The more directed effort you make towards your optimum subjective path to realisation less time spent in failure
If someone who already walked the path is available, Always seek an understanding
But never directly adopt the understanding, seek the method to arrive at it on your own

People who have higher understanding tend to ignore effort they made to get there
It is why they give advice of adopting the understanding directly than to preach a method to arrive at it
They should focus on both, especially a method

Effort and Understanding must embrace each other to achieve the realisation, the ultimate understanding.
After realisation, action is needed but becomes effortless.
So the balance HAPPENS it cannot be brought. It happens when you are open to both effort and understanding.

It is applicable to any area of your life, personal, corporate, social and especially spiritual.

Monday, 4 November 2019

Avoiding Change



Why human beings have not that energy to bring about a radical change in themselves. ?

They have energy, any amount of it – to quarrel, to battle, to kill each other, to divide the world, to fight, to go to the moon. They’ve got energy, but apparently they have not the energy to change themselves radically. So we are asking why – why haven’t we as human beings, have this tremendous energy? I wonder, when you ask, when such a question is put to you, what your response is.

We said man has enough energy. He does everything with great energy – when he hates, he hates; when there is a war he battles, kills; when he wants to escape from what is actually, he has the energy to run away from it – through ideas, through amusement, through gods, through drink. When he wants pleasure, sexual or otherwise, he pursues it with great energy. He has the intelligence to overcome outward environment. He has the energy to go down to the… live at the bottom of the sea or live in the skies. He has got vital energy, but apparently he has not this energy to change, even the smallest habit. Why?

We haven’t the energy to change because we dissipate that energy in conflict within ourselves. Please listen to this a little bit. We are not trying to persuade you of anything, we are not doing propaganda, we are not replacing old ideas with new ideas, but we are trying to discover, understand. You see, we realize that we must change. So there is – let us take as an example violence, brutality – that is a fact. Human beings are brutal, violent and they have built a society which is violent, in spite of all the religious nonsense about loving your neighbour, loving God and all that, just ideas, they have no value whatsoever, because man remains brutal, violent, selfish – that’s a fact. And being violent he invents its opposite, which is not to be violent.

Please watch, go into this yourself with me a little bit. There is violence and he has the opposite of it, which is non-violence, not to be violent. And he is trying all the time to become non-violent. So there is conflict between ‘what is’, which is violence, and ‘what should be’, which is non-violence. There is conflict between the two. And that is the very essence of the wastage of energy. Right? As long as there is a duality between ‘what is’ and ‘what should be’, man trying to become, or trying, making an effort to achieve ‘what should be’, that conflict is wastage of energy. Right? That is the very essence of wastage. As long as there is conflict between the opposites, the duality, man has not enough energy to change.

So, why should I have the opposite at all, as non-violence, as the ideal? The ideal is non-real, it has no meaning, it only leads to various forms of hypocrisy. Being violent, pretending not to be violent has no meaning. Or to say, ‘Well, I am an idealist. I will eventually become peaceful.’ That is a great pretension, an excuse. For he’ll take many years or perhaps never be without violence. Therefore he becomes a hypocrite, and in the meantime he’s being violent. So if we could, not in abstraction but actually put aside completely all ideals and only deal with facts. That is, violence. Then there is no wastage of energy. Please, this is really very important to understand. It isn’t a peculiar theory of the Speaker. Don’t say, ‘Well, he brings some oriental philosophy’ – he doesn’t. As long as man lives in the corridor of opposites, he must waste energy and therefore he can never change.

So with one breath you’ve wiped away all ideologies – right? – all opposites. Please do understand this. If you go into it, it is really quite extraordinary what takes place. A man who is angry, to pretend, or try to become non-angry, not to be angry, in that there is conflict going on all the time. But if he says, ‘I’ll observe what anger is, go into it, not try to escape from it, rationalize it.’ Then you have… then there is energy to understand and put an end to anger.

- Jiddu Krishnamurti

Wednesday, 22 May 2013

Memoization using jHighFun

Memoization in computer science is about memorizing the method calls along with input parameter(s) and result object in order to avoid the next invocation and returning the result from cache for given input parameter(s).

It helps achieve
  • Faster method execution response
  • Avoid the use of system resource(s) such as CPU cycles, external system calls if any etc. which in general method requires to complete execution
Any kind of software application written down into smaller re-usable modules would be able to benefit from memoization as probability of invocation of such modules and services they provide are higher.





Monday, 11 March 2013

Multithreaded Higher Order Function Library for Java

jHighFun

If someone asked to switch back to Java after the experience in functional programming language such as Scala, the obvious answer would be "why? I am feeling quite ok here!"

I agree too. Functional programming languages are on boom because of the flexibility and many more  in built feature which if you want to achieve in Java will eventually lead to lots of boiler plate code and it  looks messier !

Out of the many features available, I found Higher Order Functions  amiable as they facilitate modular way of coding when it comes to define a logic on any sort of collections. Every time i code in Java, i miss them so much, so i made my mind to create a simple  and small library for Higher Order Function which will also have in built concurrent execution capabilities.

Use of Higher Order Functions have following advantages

•  Parameterizable parallelism
•  Improved program modularity
•  Scalable programming
•  Recursion
•  Zero run-time cost in most cases
•  Expressiveness of a visual syntax

So lets get started.

You can download library from here.

This library lets you use following functions.

Just do static import org.highfun.util.FunctionUtil into your java file start using them, be careful while using the overloaded methods which accepts "noOfThreads" as last argument and tries to execute function concurrently.

If you want to use your own custom thread pool, then mention it as value of Java system property "org.highfun.threadpool". The value of this property would be JNDI look up reference for Thread Pool(which implements ExecutorService) which can be managed outside this library. If not mentioned a default unbounded thread pool will be used.

The Github repo:-

https://github.com/corporatepiyush/jHighFun


Saturday, 9 February 2013

Rich yet Simple business task framework for Java

RichBiz

This framework focuses on writing any kind of business logic to make it more maintainable, testable, reusable and real time. It essentially focuses on following points and promotes developer to adopt the same while writing the business logic of any kind of use case, preferably which executes at server side. 
  • Task Oriented Programming
  • Fork and Join
  • Asynchronous  Execution
  • Memoization
  • Intelligent Statistics

This framework will greatly simplify business logic code by java's custom annotation feature. I have applied all the standard practices which i have used in my experience as java developer 

Everyone is talking about web application performance, scalability, exposing responsive services and mighty tech talks on clustering and its adoption to achieve these things. But most of us could not observe the fact that “Scaling the application” is different than “Scaling the Code” and these two aspects have to work in association to achieve true scalability.

One could think of “Scaling the Application” by having multiple instances on same as well as different nodes. This will help you facilitate the execution of number of requests from different users. What about execution of single request? Does it get scaled when we add more nodes or CPU’s? No, it does not!  big NO !

When we add more nodes so to our cluster, we are making it respond to more number of request from user but then due to large network infrastructure and increasing complexity several unwanted delays get added to total response time for processing the end user request. One should expect that the execution time of a particular use case on cluster environment to be greater than execution time on development environment where almost everything is on local machine. This is due to old linear programming practices which assume single threaded execution of given code.

If someone really wants to scale the code, then he/she better focus on how can the underlying CPU cores could be utilized to produce maximum throughput. This is where concurrent programming practices such as fork-join comes into practice which suggests division of business use case into smaller meaningful independent task units and executing them concurrently. More the number of processor more is the concurrent execution of task which ultimately results in optimum use of production system hardware and better response time to end user.

Task Oriented Programming
Like in OOP it is recommended practice to have single responsibility to a class, in TOP it is recommended that a single Task should represent a meaningful undividable execution unit if it does not represent a Job itself.
Job or complex task in TOP is collection of tasks or other Jobs along with the precedence execution rule.
TOP focuses on breaking down big fat business logic into smaller, reusable Tasks and arranging them to construct a business logic flow which in turn could be reusable as a Job.

Fork and Join
This particular algorithm from concurrent programming practices helps execute two or more independent Tasks concurrently to reduce the execution time which in general is addition of execution time of each Task.

Asynchronous Execution
Not every Task or unit of code is necessary to execute immediately to produce meaningful outcome; hence execution of such Task can be delayed which drastically reduces the total execution time of Job.

Memoization
Memoization is an technique of memorizing the function calls with the given arguments so that memorized result will be returned  on next function invocation with same arguments instead of executing a function again which is computationally  or system resource intensive act.
Memory cache or Disk cache can be used according to the requirement. This technique acts a steroid for any sort of application when performance is key factor.

Intelligent Statistics
To promote continuous re-factoring of code base for optimal performance, it is good practice to record a code execution statistics. Execution statistics calculation and information should be saved asynchronously which ensures that there is no non-functional logic execution overhead.
Statistics can be used to produce Management Information Reports which is essential to business. Reports may reflect certain meaningful information such as the consumption of various business services during the specific time period.