Java SE7 Features

-Binary literals, (using prefix 0b or oB)
-Underscores in numeric literals
-string in switch statements
-type inference for Generic instance creation
Map<String, List<String>> myMap = new HashMap<String, List<String>>();
In Java SE 7, you can substitute the parameterized type of the constructor with an empty set of type parameters (<>):
Map<String, List<String>> myMap = new HashMap<>();
-Caching Multiple exception
-Rethrowing exception with improved type checking
-try with resources statements
try(FileInputStream input = new FileInputStream(“file.txt”)) close automatically input stream, using AutoClosable interface
using multiple resources
try( FileInputStream input = new FileInputStream(“file.txt”);
BufferedInputStream bufferedInput = new BufferedInputStream(input)
) {}

ref:

http://docs.oracle.com/javase/7/docs/technotes/guides/language/enhancements.html#javase7

http://tutorials.jenkov.com/java-exception-handling/try-with-resources.html

 

 

stack vs heap

Stack [ local variable]

-Variable like int, char, float are store in stack.(Complex structures also array,struct)

-What is – stack is special region in computer memory, its stores temporary variables created by each function, stack is FILO (first in last out)

-Every time a function declare a new variable it pushed into stack, when function exits pushed elements are freed(pop), once stack variables are freed , that region of memory available for other stack variable

-Memory managed (Allocation and free) by CPU efficiently, also read and write stack is very fast

-Keep in mind the stack memory region also limited by varies on OS,

Heap [Global Variable]

-Heap region memory not managed by CPU, it is free floating region of memory (larger), in ‘C language’ use malloc, calloc to allocate memory,realloc to reallocate the memory, once we allocated we need to free up if not used then only other process takes the memory when not in use, if we fail to  do this memory leak problem occur

When to use

-if u need large block of memory, and access variable globally by any function then use Heap

 

 

Ref: http://gribblelab.org/CBootcamp/7_Memory_Stack_vs_Heap.html

Let’s salute the Nation on Republic Day

Few facts about our Motherland India ,,,,,,,,,

Saffron – Strength and Courage.
The white middle band –  for Peace and Truth.
The Green – for Fertility, Growth and Auspiciousness.
The Sanskrit name for India is – Bharat
India is derived from River Indus (Sindhu) where Aryans Settled.
Aryabhatta invented Zero
Oldest University in the world was Takshila( 700 BC) – 10,500 students from all over world learnt 60 subjects
Nalanda University still exists (4th Century)
Ayurveda is the earliest known school of medicine. Its father Charaka, consolidated Ayurveda 2500 years ago.
Art of Navigation and Navigating was first born in river Sindhu. The word Navigation is derived from Sanskrit word Navagatih.
In 5th Century Bhaskracharya rightly calculated the time taken by the earth to complete orbit – 365.258756484
My India , My Pride – Vande Mataram
Let’s salute the Nation on Republic Day

Src : https://plus.google.com/u/0/103435799818457589333

Direct link to add specific google calendar event?

Direct link to add specific google calendar event

https://calendar.google.com/calendar/render?action=TEMPLATE&pli=1&sf=true&output=xml&amp; text=[Event_Title]& details=[Event_Details]&location=[Event_Location]& dates=[From_Date_Time]/[To_Date_time]

for e.g

https://calendar.google.com/calendar/render?action=TEMPLATE&pli=1&sf=true&output=xml&text=Sample Event&details=Sample Events Details &location=Location&dates=20151208T180000Z/20151208T191500Z

Dates are given YYYYMMDDTHHMMSSZ format, use GMT time, google automatically convert into your calendar default one

 

google-add-events-link

Spring inject value into a static field

using org.springframework.beans.factory.config.MethodInvokingFactoryBean to invoke a static setter.

e.g
public Class ClassName{
private static Object fieldName;
public static void setFieldName(final Object fieldName)
{
ClassName.fieldName = fieldName;
}
}

Spring Injection:

<bean class="org.springframework.beans.factory.config.MethodInvokingFactoryBean">
<property name="staticMethod" value="package.ClassName.setFieldName" />
<property name="arguments">
<list>
<ref bean="refObject" />
</list>
</property>
</bean>

Ref:

delete multiple files and files in windows using command prompt in less time

Take too much to delete too many files folder in window explorer.

Using following simple steps to delete files using command prompt with less time

use rmdir to delete the files and subfolder,

rmdir /s/q MyFolderPath
However, it is significantly faster, especially when you have a lot of subfolders in your structure to use del before the rmdir, like this:

del /f/s/q MyFolderPath > nul
rmdir /s/q MyFolderPath