How Children Succeed?

This post is about my reflections on the book How Children Succeed which I recently read.

What matters most in a child’s development for them to succeed in life?

We mostly think that intelligent and smart people succeed, i.e success comes to those who score highest in school, college or competitive exams like SAT, GMAT etc. But in How Children Succeed, Paul Tough argues that the qualities that matter more for success are have to do with the character.

In a child’s development, what matters most is not how much information we can stuff into his/her brain in the first few years. But, instead is whether we are able to help him/her develop a very different set of qualities like persistence, self-control, curiosity, conscientiousness, grit, and self-confidence. Infact, possessing these qualities helps a child to get high scores in exams consistently than intelligence alone.

Economists refer to these as noncognitive skills, psychologists call them personality traits, and the rest of us sometimes think of them as character.


Continue reading...

Log4j - Separating log lines to multiple log files.

It’s generally good practise to partition the log lines of your java application into different log files based on functionality/module etc.

For eg. In a web application, we would want application log lines to be logged in to server.log, whereas information about remote user who made the requests to be logged into request.log.

This can be done by defining two appenders in log4j properties and configuring them to output to two different log files.

Here is the example log4j properties.

log4j.rootLogger=INFO,fileAppender

log4j.logger.requestLogger=INFO, requestAppender

##Don't propogate things logged to requestLogger to other appenders
log4j.additivity.requestLogger=false

log4j.appender.fileAppender=org.apache.log4j.RollingFileAppender
log4j.appender.fileAppender.MaxFileSize=500MB
log4j.appender.fileAppender.MaxBackupIndex=10
log4j.appender.fileAppender.Append=true
log4j.appender.fileAppender.File=server.log
log4j.appender.fileAppender.layout=org.apache.log4j.PatternLayout
log4j.appender.fileAppender.layout.ConversionPattern=%d [%t] %-5p (%c %M:%L) %x - %m%n

log4j.appender.requestAppender=org.apache.log4j.RollingFileAppender
log4j.appender.requestAppender.MaxFileSize=1024MB
log4j.appender.requestAppender.MaxBackupIndex=10
log4j.appender.requestAppender.Append=true
log4j.appender.requestAppender.File=requests.log
log4j.appender.requestAppender.layout=org.apache.log4j.PatternLayout
log4j.appender.requestAppender.layout.ConversionPattern=%d [%t] %-5p (%C %M:%L) %x - %m%n

We have defined two appenders, fileAppender to output to server.log and requestAppender to output to requests.log. Only fileAppender is added to rootLogger, so any Logger instances created by passing java class will be logged to server.log.

Example code snippets showing how to log to server.log.

public class RequestProcessor {

    private static final Logger logger = Logger.getLogger(RequestProcessor.class);
    
    private void handleRequest(HttpServletRequest request){
        //This message will be logged to server.log
        logger.info("Processing Request");
    }
}

To log to requests.log the Logger instance should be created passing requestLogger as logger name.

Example code snippets showing how to log to request.log.

public class RequestInterceptor {

    private static final Logger logger = Logger.getLogger("requestLogger"); //Should match name of logger 
    
    public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
        //This will be logged to requests.log
        logger.info("Received request from user: " + request.getRemoteUser());
        return true;
    }
}

Continue reading...

Generating Key, CSR and Certificates for SSL

If you want to run your application in HTTPS mode, you will need to get SSL certificates from a valid CA (Certificate Authority) like Verisign.

In this post I will provide steps for generating private key, CSR (Certificate Signing Request) and importing signed certificate back to private key store using java keytool utility


Continue reading...

Spring - Reading values from file and injecting to bean property using SPEL

Sometimes you would need to inject value for spring bean property by reading values from a file. Good use case for this would be injecting passwords into bean property by reading value from a file rather than hard coding password into application context xml.

This can be done by creating property file with values we want to inject and use spring util properties to read values into application context as properties. Then, this property value can be injected using Spring SpEL.

To demonstrate this, lets pick example of initializing Jetty SslContextFactory with keystore file and key store password.


Continue reading...

Turning Knowledge into Intelligence and Creativity

What is difference between Knowledge, Intelligence and Creativity?

Knowledge is facts, information, and skills acquired by a person through experience or education by perceiving, discovering or learning.

Intelligence is using that knowledge in different contexts to invent new thoughts, new ideas, etc.

Creativity is using intelligence to create new work, new inventions etc.

Why mere knowledge is not enough?

Our education system is mostly designed around providing and evaluating knowledge acquired and undermines intelligence and curiosity. if we just keep accumulating knowledge without applying, it will get lost. We need to make knowledge easily accessible to be able gain the intelligence out of it. Let’s think about how knowledge is stored in memory to find out how we can retain knowledge.

How knowledge is stored in memory?

The brain contains dynamic connection of neurons. Anything we retain in memory create new connections or change existing connections in the brain. The things we learn generally get stored in short-term working memory. But brain has only limited space in short-term memory. Most things get discarded out of short-term memory.

We mostly use repetition technique to make items in short-term memory stay long enough. But the biggest problem with memorization through repetition is that it frequetly puts the information on just one connection. The brain always seeks meaning, patterns with exiting information to make more connections. The more ways you have to find a piece of information, the easier it is to retrieve.

How to improve your intelligence?

Whatever you learn, associate it with a meaning, associate it with a different contexts, associate it with similar things - don’t learn anything in isolation. This will make it retain in long-term memory. Then knowledge will be easily retrievable when you want to apply it. This can help with generating new ideas.

How to improve your creativity?

Creativity is “just connecting things.” - Steve Jobs

Creativity is using imagination to connect, stretch and merge things in new ways. To improve creativity we need to further expand connections of information in our brain so that it can be easily combined, transformed to create new ideas. Curiosity can help expanding connections and is the essential element for becoming more creative.

Curiosity is a lens through which you view everything around you. Without it,there are no adventures to be had, With it, there are enough for a million times - **Sean Patrick , Awakening your inner genius **

Curiosity will persuade you to seek interesting things, discover new information, explore related things.

Summary

We acquire knowledge through learning and experiences. Whatever you learn, try to associate it with as many things you can. Always learn with curiosity to expand your knowledge, expand your ideas. You will able to create something new.

Further Reading

If you are reading this post with curiosity, you would be interested in further reading on this topic. Here are some useful resources.


Continue reading...