Anish Nath

Greenhorn
+ Follow
since Sep 21, 2011
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
(keep public parts private until JForum day)
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt
Moderation Tools

Recent posts by Anish Nath



The video covers the following topics
1. Create a self signed certificate.
2. start the Server
3. Test the server.
4. create a certificate for client
5. validate client certificate against the server

for demo is taken on OpenSSL
4 years ago


In Java programming, I/O has until recently been carried out using a stream metaphor. All I/O is viewed as the movement of single bytes, one at a time, through an object called a Stream. Stream I/O is used for contacting the outside world. It is also used internally, for turning objects into bytes and then back into objects.
NIO has the same role and purpose as original I/O, but it uses a different metaphor -- block I/O. As you will learn in this tutorial, block I/O can be a lot more efficient than stream I/O.
4 years ago
One line java program that throw "java.lang.OutOfMemoryError: Java heap space Analysis Eclipse MAT
4 years ago
Learn How Serialization works Internally with Java, This is called Object Serialization Protocol

4 years ago
The product compnay Interview pattern's, interview questions and answers on google,amazon,adobe,cisco and other product company tips

Cracking Interview
how to Solve Producer Consumer Problem


The producer–consumer problem (also known as the bounded-buffer problem) is a classic example of a multi-process synchronization problem. The problem describes two processes, the producer and the consumer, who share a common, fixed-size buffer used as a queue
package stack

/**
* Created by IntelliJ IDEA.
* User: aninath
* Date: 9/20/11
* Time: 3:40 PM
* To change this template use File | Settings | File Templates.
*/
class EmployeeDSL {

Employee root

List propchain = []

EmployeeDSL( Employee root ) {
this.root = root
}

def propertyMissing( String name ) {
// if name is 'add' and we have a chain of names
if( name == 'add' && propchain ) {
println("inside if--> "+name)
// add a new employee
root.empList << new EmployeeData( firstName:propchain.take( 1 ).join( ' ' ), lastName:propchain.drop( 1 ).join( ' ' ) )
// and reset the chain of names
propchain = []
}
else {
// add this name to the chain of names
println("inside else--> "+name)

propchain << name
this
}
}

static void main(args) {
Employee emp = new Employee( [] )

new EmployeeDSL( emp ).with {
anish.nath.add
//tim.yates.add
"4"."nath".add // this is the pont where exception throws
}

emp.empList.each {
println it.firstName
println it.lastName
}

}

}


class Employee {
List<EmployeeData> empList = []

Employee( List<EmployeeData> list ) {
empList = list
}
}
// #@groovy.transform.Canonical
class EmployeeData {
String firstName
String lastName
}



Exception in thread "main" groovy.lang.MissingPropertyException: No such property: nath for class: java.lang.String
at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.unwrap(ScriptBytecodeAdapter.java:50)
at org.codehaus.groovy.runtime.callsite.GetEffectivePojoPropertySite.getProperty(GetEffectivePojoPropertySite.java:63)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callGetProperty(AbstractCallSite.java:227)
at stack.EmployeeDSL$_main_closure1.doCall(EmployeeDSL.groovy:44)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:90)
at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:233)
at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:272)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:883)
at groovy.lang.Closure.call(Closure.java:410)
at groovy.lang.Closure.call(Closure.java:423)
at org.codehaus.groovy.runtime.DefaultGroovyMethods.with(DefaultGroovyMethods.java:194)
at org.codehaus.groovy.runtime.dgm$876.invoke(Unknown Source)
at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite$PogoMetaMethodSiteNoUnwrapNoCoerce.invoke(PogoMetaMethodSite.java:308)
at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite.call(PogoMetaMethodSite.java:64)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:42)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:108)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:116)
at stack.EmployeeDSL.main(EmployeeDSL.groovy:41)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:120)

Process finished with exit code 1


new EmployeeDSL( emp ).with {
anish.nath.add
//tim.yates.add
"4"."nath".add // this is the pont where exception throws if i comment this line my programe will be fine can any one suggest what code i have to change
}
6 years ago