Friday, May 22, 2020

Your Quantum Reality

Your reality is created from within yourself. Everything you see on the outside in your life is a reflection of your thoughts, beliefs and emotions you hold inside.
One of the core principles of Quantum Physics is the idea that reality ( the photons that produce the light-illusion we all occupy ) exists in infinite possible states ( ie: the many-worlds scenario) until we observe it and thus collapse all potential versions of reality into the one single option we’ve chosen to live inside. It sounds radical, I know, but there’s hard science to back it up. And the implications, once you truly start to consider them, are incredibly profound.
Within the realm of logic and with enough time and effort, you can immerse your consciousness into any reality you want. But before you can enact this Godlike power, you must decide which action you will take, you must make a choice on which reality you want to ‘observe’ at the cost of becoming ‘blind’ to all other options. As soon as you select one and add momentum to that observed choice, suddenly the photons around you blur and shift as you pull yourself deeper into that reality; the options you didn’t select, however, now fade out of conscious thought, out of observation, and thus begin to experience a decay of quantum likelihood as you continually move away from them in pursuit of your selected reality.
But that option which you did select–well, its photons are now becoming more vivid, turning from an abstract imaginary choice into tangible forms you can interact with.
This is the power you have in every moment: to see all the possible futures you could take, and then pull yourself consciously into the one that seems most in line with your desired outcome. I ask that you always remember this when you feel trapped within the illusion of a job or a relationship or any other label. If something in your life has become a true source of pain and sadness for you, you have the power to change it. All you have to do is choose a different reality for your next moment.
The point is: anything we’re not actively perceiving does not truly exist. This is the modus operandi of the “Be Here Now” movement, which is largely rooted in eastern philosophies. They realized that you can only perceive one place at one moment, and therefore anything outside of that single snapshot of space-time doesn’t truly exist. Knowing this, then there becomes no reason to let your mind dwell and concern itself with realities you can’t actually prove are real, realities that–in that moment–have absolutely no impact on your life. And so the only option is to immerse yourself wholeheartedly into the current sensations that you can prove via subjective experience.
Creates New Physical Forms
If you do decide to escape the moment, however, you gain the power to envision a future of reality that doesn’t currently exist. And so rather than simply choosing from an already existing form in your vision you wish to engage with, you can instead create new photon-forms that never existed before and inject them into reality.
This is the absolutely incredible ability our species has called imagination: the ability to mentally envision a tool or concept and then summon it into reality. All things you see today: skyscrapers, cars, planes, tables, chairs, computers, even the clothes on your body–these are all physical items we can now choose to interact with even though they originally only existed as thought forms inside someone’s mind. They were all once inert pieces of quantum possibility floating in the abstract realm of human imagination until certain curious apes came along and had the means to choose to pursue their creation.
The result of a combination of external resources and internal understanding. You see, if we only made choices regarding the external world, we would still be operating as apes–animalistic forms simply attempting to survive as we react to our physic vessels needs ( sleep, warmth, hunger, etc ). But this unique ability to understand the physical and then internally imagine it in new ways gave us the inspiration necessary to create not only new inventions but also personalities and the image of Self. Thus we have the ability to look at all quantum possibilities for the roles we could play in society and what our personality could be, and then we can become that person. Combining this internal choice of desire with our external resources and manifestations, we unlock the true potential.

Wednesday, April 22, 2020

Blockchain Myths

Blockchain is not Bitcoin

Blockchain is a technology that allows peer-to-peer transactions to be recorded on a distributed ledger across the network. These transactions are stored in blocks and each block is linked to the previous one, creating a chain.

Bitcoin is a cryptocurrency that makes electronic payment possible directly between two people without going through a third party like a bank. Bitcoin was the first blockchian application which uses the blockchain as underlying technology to use it as a database ledger.


Blockchain is not a cryptocurrency

Blockchain is the platform which brings cryptocurrencies into play, it's mainly a database which holds transactions records and forms the network. This network creates the means for transacting and enables transferring of value and information.

Cryptocurrencies are the token used within these networks to send value and pay for these transactions. You can see them as a tool on blockchain.


Blockchain, Bitcoin and Distributed Ledgers are not the same thing

Let's clarify this point!

Bitcoin is a cryptocurrency that uses blockchain technology.
Blockchain is a type of distributed ledger.
Not all distributed ledgers are effectively blockchains.
(A distributed ledger is a database that is consensually shared and synchronized across multiple sites, institutions or geographies. It allows transactions to have public "witnesses", thereby making a cyberattack more difficult.)


Blockchain doesn't exist on the cloud

Many believe blockchain is a database that exists on the cloud. The truth is that Blockchain is a ledger distributed across a number of members computers.


Blockchain is not a product

Blockchain itself is not an app or a product.
Many Dapps(decentralized applications) are being based on blockchain but the blcokchain itself is not that application or a thing.
Blockchain's utility comes from an appropriate set of applications built on top of it.


All transactions using blockchain are not necessarily anonymous

Just because cryptos transactions allow a degree of anonymity to its users doesn't mean that all blockchain transactions work in the same manner.
Truth is, several blockchain networks adhere to KYC/AML regulations and offer great transparency.


Blockchain is not used only for powering cryptocurrencies

Cryptos and banking in general are not the only industry that could be transformed by blockchain technology.
Banking is just the beginning.
Blockchain can be used for fields as diverse as music to healthcare, to voting, to supply chain management...


There is not a single blockchain system for everything

Blockchain networks can take many forms.
It could be private, public or there are consortium blockchain networks(Consortium blockchain is a system that is 'semi-private' and has a controlled user group, but works across different organizations).


Blockchain records can be hacked or altered?

Blockchain is not invulnerable to outside attacks. No system or database is completely secure, but the larger and more distributed the network, the more secure it is believed to be.
Blockchain can provide to applications that are developed on top of them a way of catching unauthorised changes to records.

Thursday, April 16, 2020

Spring Annotations

Spring framework implements and promotes the principle of control inversion (IOC) or dependency injection (DI) and is in fact an IOC container.
Traditionally, Spring allows a developer to manage bean dependencies by using XML-based configuration.
There is an alternative way to define beans and their dependencies. This method is a Java-based configuration.
Unlike the XML approach, Java-based configuration allows you to manage bean components programmatically. That’s why Spring annotations were introduced.
This is a compilation of most commonly used Spring Annotations.

********Spring Framework annotations********

@ComponentScan - make Spring scan the package for the @Configuration classes.
@Configuration - mark a class as a source of bean definitions.
@Bean - indicates that a method produces a bean to be managed by the Spring container.
@Component - turns the class into a Spring bean at the auto-scan time.
@Service - specialization of the @Component, has no encapsulated state.
@Autowired - Spring’s dependency injection wires an appropriate bean into the marked class member.
@Lazy - makes @Bean or @Component be initialized on demand rather than eagerly.
@Qualifier - filters what beans should be used to @Autowire a field or parameter.
@Value - indicates a default value expression for the field or parameter, typically something like
“#{systemProperties.myProp}”
@Required - fail the configuration, if the dependency cannot be injected.



********Spring Boot and Web annotations********

@SpringBootApplication - uses @Configuration, @EnableAutoConfiguration and @ComponentScan.
@EnableAutoConfiguration - make Spring guess the configuration based on the classpath.
@Controller - marks the class as web controller, capable of handling the requests.
@RestController - a convenience annotation of a @Controller and @ResponseBody.
@ResponseBody - makes Spring bind method’s return value to the web response body.
@RequestMapping - specify on the method in the controller, to map a HTTP request to the URL to this method. @RequestMapping variants ---> @GetMapping
                                                                                                         @PostMapping
                                                                                                         @PutMapping
                                                                                                         @PatchMapping
                                                                                                         @DeleteMapping
@RequestParam - bind HTTP parameters into method arguments.
@PathVariable - binds placeholder from the URI to the method parameter.



********Spring Cloud annotations******** 

@EnableConfigServer - turns your application into a server other apps can get their configuration from.
Use spring.application.cloud.config.uri in the client @SpringBootApplication to point to the config server.
@EnableEurekaServer - makes your app an Eureka discovery service, other apps can locate services through it.
@EnableDiscoveryClient - makes your app register in the service discovery server and discover other services through it.
@EnableCircuitBreaker - configures Hystrix circuit breaker protocols.
@HystrixCommand(fallbackMethod = “fallbackMethodName”) - marks methods to fall back
to another method if they cannot succeed normally.

I have listed here most of the important annotations, but there are a lot more of them for specific tasks. If you are not clear with these quick definitions, you can find more detailed information on each of these annotations at https://dzone.com/articles/a-guide-to-spring-framework-annotations.

Friday, April 10, 2020

Streams API in Java 8 – Intermediate Operations

In this blog, lets learn to perform intermediate operations in Streams.You can understand about streams and learn to create streams in Part-I of the Streams API in Java 8 series. Now, let us learn the intermediate operations with examples.
filter()
sorted()
map()
limit()
flatMap()
concat()

filter()
filter() is an intermediate operation. The syntax is filter(Predicate predicate).It takes Predicate as parameter. You can use lambda or method references to implement Predicate.
The result of filter is a stream. so, a terminal operation is needed to get the result back. To start with we will use forEach() to get the result.
forEach() is an intermediate operation which takes Consumer as parameter.Let us use method references inside forEach() method.
Example:
Code snippet for filter() methodJava
List<String> list = Arrays.asList("Java","Maven","CSS","JUnit","HTML","JSP");
// convert list into stream
// filter the list based on the condition
// call forEach that is a terminal operation
list.stream()
.filter((str)->str.length()>3)
.forEach(System.out::println);
Output:
Java
Maven
JUnit
HTML

sorted()
sorted() is an intermediate operation. It returns a stream consisting of the elements, sorted according to natural order. It has one overloaded method that takes Comparator as parameter. The syntax is sort(Comparator compare).You can use lambda or method references to implement Comparator.
This can be used in case of a collection of objects. Here also we will use forEach() for terminal operation. I am using method chaining by adding methods
Example:
Code snippet for sorted() methodJava
// convert list into stream
// filter the list based on a condition
// call sorted on the stream
// call forEach that is a terminal operation
Arrays.asList("Java","Maven","CSS","JUnit","HTML","JSP")
.stream()
.filter((str)->str.length()>3)
.sorted()
.forEach(System.out::println);
Output:
HTML
JUnit
Java
Maven

map()
map() is an intermediate operation. It returns a stream that is a result of applying a function to all the elements in the stream.The syntax is map(Function mapper).You can use lambda or method references to implement Function. So it can be either map(String::toUpperCase) or map(str->str.toUpperCase()).
In case of String Stream pass the method of String inside map, in case of Integer Stream , pass the functionality of Integer inside map.
Here also we will use forEach() for terminal operation.
Example:
Code snippet for map() methodJava
// convert list into stream
// filter the list based on a condition
// call sorted on the stream
// convert each element to uppercase - uses method reference
// call forEach that is a terminal operation
Arrays.asList("Java","Maven","CSS","JUnit","HTML","JSP")
.stream()
.filter((str)->str.length()>3)
.sorted()
.map(String::toUpperCase)
.forEach(System.out::println);
// For integer Stream
Stream.of(new Integer[] {10,20,40})
.map(num->num.doubleValue())
.forEach(System.out::println);
Output:
10.0
20.0
40.0

limit()
limit() is an intermediate operation. It returns a stream that limits the size of the stream to the given length.The syntax is limit(int length). It throws IllegalArgumentException in case of negative length.
Here also we will use forEach() for terminal operation.
Example:
Code snippet for limit() methodJava
Arrays.asList("Java","Maven","CSS","JUnit","HTML","JSP")
.stream()
.filter((str)->str.length()>3)
.sorted()
.map(String::toUpperCase)
.limit(3)
.forEach(System.out::println);
output:
HTML
JAVA
JUNIT

skip()
skip() is an intermediate operation. It returns a stream after discarding the first n elements of the stream.If the stream has less elements than n, then an empty stream will be returned.The syntax is skip(int length).
Here also we will use forEach() for terminal operation.
Example:
code snippet for skip() methodJava
Arrays.asList("Java","Maven","CSS","JUnit","HTML","JSP")
.stream()
.map(x->x.toUpperCase())
.sorted()
.skip(2)
.forEach(System.out::println);
output:
JAVA
JSP
JUNIT
MAVEN

flatMap()
flatMap() is an intermediate operation. Flatmap is used when the stream itself is of type List, Set or an Array, that is Stream<List<String>>or Stream<Set<String>> or Stream<String[]> or Stream<List<Object>>.
It is used to convert a Stream of Collection or array into a Stream of single elements of that particular datatype. It returns a stream after applying the provided mapping function to each element. The syntax is flatMap(Function mapper).
using flatMap() methodJava
Stream<String[]>      -> flatMap -> Stream<String>
Stream<Set<String>>   -> flatMap -> Stream<String>
Stream<List<String>>  -> flatMap -> Stream<String>
Stream<List<Object>>  -> flatMap ->     Stream<Object>
Stream<String[]>      -> flatMap -> Stream<String>
Stream<Set<String>>   -> flatMap -> Stream<String>
Stream<List<String>>  -> flatMap -> Stream<String>
Stream<List<Object>>  -> flatMap ->     Stream<Object>
Example:
code snippet for flatMap() methodJava
String[][] arrTwo = new String[][]
{ { "Rama", "Janani","Rohan" },
{ "Akash", "Rahul", "Kumaran" } };
//converting a TwoD array to stream of oneDimensional array
Stream<String[]> onestream = Arrays.stream(arrTwo);
//stream of oneDimensional array to Stream of String elements
Stream<String> strStream =
onestream.flatMap((row)->Arrays.stream(row))
.filter((x)->x.startsWith("R"));
strStream.forEach(System.out::println);
// As method chaining
String[][] arrTwo = new String[][]
{ { "Rama", "Janani","Rohan" },{ "Akash", "Rahul", "Kumaran" } };
Arrays.stream(arrTwo)
.flatMap((row)->Arrays.stream(row))
.filter((x)->x.startsWith("R"))
.forEach(System.out::println);
output:
Rama
Rohan
Rahul
                String[][] arrTwo = new String[][]
 { { "Rama", "Janani","Rohan" },
   { "Akash", "Rahul", "Kumaran" } };
 //converting a TwoD array to stream of oneDimensional array
 Stream<String[]> onestream = Arrays.stream(arrTwo);
 //stream of oneDimensional array to Stream of String elements
 Stream<String> strStream =
 onestream.flatMap((row)->Arrays.stream(row))
 .filter((x)->x.startsWith("R"));
 strStream.forEach(System.out::println);
// As method chaining
String[][] arrTwo = new String[][]
 { { "Rama", "Janani","Rohan" },{ "Akash", "Rahul", "Kumaran" } };
Arrays.stream(arrTwo)
      .flatMap((row)->Arrays.stream(row))
      .filter((x)->x.startsWith("R"))
      .forEach(System.out::println);
Output:
Rama
Rohan
Rahul

concat()
concat() is an intermediate operation. It returns a concatenated stream with all the elements of the first stream followed by all the elements of the second stream. The syntax is stream(Stream a, Stream b).
Here also we will use forEach() for terminal operation.
Example:
Code snippet for concat() methodJava
Stream.concat(Stream.of("Apple","Orange"),Stream.of("Kiwi","Papaya"))
.forEach(System.out::println);
output:
Apple
Orange
Kiwi
Papaya

Monday, December 9, 2019

Writing, A super human ability!

robot.walk() makes a robot walk now! I remember writing DDRB = 0b11111111; PORTB = 0xFF; to move a limb of the robot back then. There is a human written code at any abstraction level. The compiler itself is nothing more than a set of instructions. It’s all code written in different forms and with different syntax. The super ability of homo-sapiens is that we write.

We wouldn’t have progressed to our present state if we hadn’t started writing. What does it takes for monkeys to start writing? Or at least to start making shapes? Well, we all know the answer to be raise in the consciousness. But what triggered the raised consciousness of the sapiens?

It might be considered that we were god-gifted with this ability in primitive form in the beginning. And we progressed as we write. The early humans used to make shapes and symbols in stones. A wide leap was taken as symbolism advanced to scripts and hence the beginning of the alphabets. Gradually we advanced to the point where we can write everything that we can think of.

Now, as humans have advanced with technology to this point, writing is not only limited to communication, expressing feelings, emotions or describing things. We have started a new way of writing that doesn’t necessarily involve pen and paper. We now write electronically by pressing keys. We write and program devices to perform tasks beyond our capabilities. We have started writing codes that the machine understands. Writing rocket.lauch() in the appropriate line launches the rocket and begins the process of placing a satellite in it’s desired orbit in the space.

For a complex task like launching a satellite, we write complex mathematical equations to aid the algorithmic processes. We write sub-routines for various interrupts that may possibly occur. We write artificial intelligence to cope up with the internal and external factors. 

So, I would like to conclude that unless we write it’s only talk. We have to start writing to create an impact. It’s only about being wise enough to choose what to write. Being wise enough to choose the abstraction level. If there was no written form of intelligence in existence what would we read? 

There’s a saying that we first learn to read then we read to learn. But what if there was no predecessor who wrote. The process of learning is accompanied and validated by writing. So just include the libraries you predecessors wrote and startWriting();

Your Quantum Reality

Your reality is created from within yourself. Everything you see on the outside in your life is a reflection of your thoughts, beliefs an...