Tech Me More

To quench our thirst of sharing knowledge about our day to day experience & solution to techincal problems we face in our projects.

Advertise with us !
Send us an email at diehardtechy@gmail.com

Sunday, February 23, 2014

What you can expect after Facebook, Whatsapp deal.

After deal with Facebook what we can expect from Whatsapp.



  1. Hide your "last seen" status: If rumors are to be believed the updated version of Whats App may incorporate changes in one of the most demanded features of Whats app i.e. Last seen status.

    The latest functionality may also allow users to hide their 'last seen' status from bunch of contact, all their contacts or only from contacts in their phone book.

    This feature has been available to iOS users of Whats app for quite some time but as Android is the big market incorporating
     new feature in android version of application will affect more audience.
  2. Hide your profile picture and Status: In addition to the new feature, Whats App also released another change. This change will allow you to hide your profile picture and status from people who are not in your phone book. This feature will be available to android.
             The new version is not yet available on the Play Store. 

Monday, February 17, 2014

Singleton Classes

The purpose of Singleton classes in java is to control object creation, limiting the number to one but allowing the flexibility to create more objects if the situation changes.
Since there is only one Singleton object, any object fields of a Singleton will occur only once per class, just like static fields. 

Singletons often control access to resources such as database connections or sockets.
For example, if you have a license for only one connection for your database or your JDBC driver has trouble with multithreading, the Singleton makes sure that only one connection is made or that only one thread can access the connection at a time.

Implementing Singletons:
Example 1:
The easiest implementation consists of a private constructor and a field to hold its result, and a static accessor method with a name like getInstance().
The private field can be assigned from within a static initializer block or, more simply, using an initializer. The getInstance( ) method (which must be public) then simply returns this instance:
// File Name: Single.java
public class Single {
private static Single singleton = new Single( );
/* A private Constructor prevents any other * class from instantiating. */
private Single(){ }
/* Static ‘instance’ method */
public static Single getInstance( )
{
return singleton;
}
/* Other methods protected by singleton-ness */
protected static void demoMethod( ) {
System.out.println(“demoMethod for singleton”);
}
}
// File Name: SingletonDemo.java
public class SingletonDemo {
public static void main(String[] args) {
Single tmp = Single.getInstance( );
tmp.demoMethod( );
}
}
This would produce the following result:
demoMethod for singleton

OCJP practice question #3


D. The code compiles fine, so E is incorrect. However, a Thread object cannot be started twice, so line 18 throws an IllegalThreadStateException and D is the correct answer. 

OCJP practice Question



A is correct. Fabric does not correctly extend Thread because the run() method cannot be static. If run() was correctly implemented, then D, E, and F would have been correct. Thread names do NOT have to be sequentially assigned.

Keywords in Java

Java supports 50 basic keywords, in which 2 are not used. Keywords are the reserved word.Keywords have the special meaning in Java and can't be used as identifiers. 
  1. abstract
  2. assert
  3. boolean
  4. break
  5. byte
  6. case
  7. catch
  8. char
  9. class
  10. const
  11. continue
  12. default
  13. do
  14. double
  15. else
  16. enum
  17. extends
  18. final
  19. finally
  20. float
  21. for
  22. goto
  23. if
  24. implements
  25. import
  26. instanceof
  27. int
  28. interface
  29. long
  30. native
  31. new
  32. package
  33. private
  34. protected
  35. public
  36. return
  37. short
  38. static
  39. strictfp
  40. super
  41. switch
  42. synchronized
  43. this
  44. throw
  45. throws
  46. transient
  47. try
  48. void
  49. volatile
  50. while

Class/static variables in java

Class variables also known as static variables are declared with the static keyword in a class, but outside a method, constructor or a block.
 There would only be one copy of each class variable per class, regardless of how many objects are created from it.
 Static variables are rarely used other than being declared as constants. Constants are variables that are declared as public/private, final and static. Constant variables never change from their initial value.
 Static variables are stored in static memory. It is rare to use static variables other than declared final and used as either public or private constants.
 Static variables are created when the program starts and destroyed when the program stops.
 Visibility is similar to instance variables. However, most static variables are declared public since they must be available for users of the class.
 Default values are same as instance variables. For numbers, the default value is 0; for Booleans, it is false; and for object references, it is null. Values can be assigned during the declaration or within the constructor. Additionally values can be assigned in special static initializer blocks.
 Static variables can be accessed by calling with the class name . ClassName.VariableName.
 When declaring class variables as public static final, then variables names (constants) are all in upper case. If the static variables are not public and final the naming syntax is the same as instance and local variables.

New Features in Java

There are many new features that have been added in java. There are major enhancement made in Java5, Java6 and Java7 like auto-boxinggenericsvar-argsjava annotationsenumpremain method etc.
Most of the interviewers ask questions from this chapter.
J2SE 4 Features
  • Assertion (Java 4)
J2SE 5 Features
  • For-each loop (Java 5)
  • Varargs (Java 5)
  • Static Import (Java 5)
  • Autoboxing and Unboxing (Java 5)
  • Enum (Java 5)
  • Covariant Return Type (Java 5)
  • Annotation (Java 5)
  • Generics (Java 5)
JavaSE 6 Features
  • Instrumentation (premain method) (Java 6)
JavaSE 7 Features
  • Binary Literals (Java 7)
  • Underscores in Numeric Literals (Java 7)

The important feature of J2SE 4 is assertions. It is used for testing.
The important features of J2SE 5 are generics and assertions. Others are auto-boxing, enum, var-args, static import, for-each loop (enhanced for loop) etc.
The important feature of JavaSE 6 is premain method (also known as instrumentation).
The important features of JavaSE 7 are try with resource, catching multiple exceptions etc.

OCJP practice question


E. The code compiles fine, so C is incorrect. The used field initializes to false and the make field initializes to null for the new Vehicle v. Therefore, line 7 is false and line 10 executes. Because v.make is a null reference, attempting to invoke its length method results in a NullPointerException at runtime. Therefore, the answer is E. 

Cigniti technologies Limited hiring Test automation lead





Company name: Cigniti technologies Limited

Job title: Test Automation Lead ( Any Two automation tool)

Experience: 6 to 10 years of experience, at least 4 years of hands on experience in any two automation tool.

Job location: Hyderabad


Job Details: 



To apply send your resume to akashjainvitmgwl@gmail.com


NCR corporation hiring freshers


Company name: NCR corporation 


Job Title: SW Engineer (Associate II)

Experience required: 0-3 years

Job Category:  Applications

Job Type:  Regular

Primary Location:  INDIA-HYDERABAD

Employee Status:  Regular

Skill Set: C, C++, Java, OOPS, Unix, linux.

Description:

  •  Experience with relational databases and data mining/OLAP EEO Statement Integrated into our shared values is NCR's commitment to diversity. NCR is committed to being a globally inclusive company where all people are treated fairly, recognized for their individuality, promoted based on performance and encouraged to strive to reach their full potential.


Qualifications: Graduation/post graduation

Apply here:  

Saturday, February 15, 2014

CSC hiringh freshers as Programmer Analyst

Company name: CSC

Job Title: Programmer Analyst

Requisition ID:  1400299

Experience required: Freshers 

Job Category:  Applications


Job Type:  Regular

Primary Location:  INDIA-HYDERABAD

Employee Status:  Regular

Skill Set:

  1. SharePoint 2013
  2. Visual Studio 2012
  3. SQL Server 2012
Description:
  • Responsible for gathering requirements, analyzing requirements, designing and developing Sales catalog application. Because of the business criticality of application resource needs to strictly adhere to timely deliverable's and quality.

Qualifications: BE/Btech/MTECH/MCA

Apply here:  

Thomson reuters hiring Java developer

              

Company name: Thomson reuters

Experience : 2-4 years of java development experience
Location: Bangalore, IN
Title:Software Engineer

ID: JREQ012311

Required Skills:
  1. Core Java  Collections  Multi threading
  2. Spring Core  Data access  Transaction management 
  3. XML  Efficient parsing and serialization  Schema design and validation 
  4. JDBC  Explicit transaction handling  Connection pooling  Multithreaded database access 

Desirable skills: 
  1. Write efficient SQL queries using:  INNER, OUTER joins  GROUP BY  Aggregations  Oracle analytic functions  CLOB types and functions 
  2. Writing efficient PL/SQL procedures using:  Packages, procedures & functions  Cursors  User defined types  Collections  Bulk operations  LOB storage and manipulation  Error handling  PL/SQL debugging and tracing 
  3. Optimizing queries by:  Analysing execution plan  Creating indexes  Using Materialized Views 
Optional Skils:
  1.  Agile/Scrum Software development methodologies 
  2.  Agile project tracking with Jira/Greenhopper 
  3. Web services: REST, SOAP, WSDL 
  4. Configuration Management tools: Jira, Jenkins/Hudson, Maven experience 
  5. Search engines: Oracle Text, FAST, Solr 
  6. Secure hosting 
  7. Version Control: SVN, Git, Mercurial 
  8. Working with continuous integration environments 
  9. Eclipse IDE 
  10. Unix/Linux environments 
  11. BASH scripting 


Schedule: Full-time

Education Level: None

Job Type: Standard

Shift: Day Job

Job type: Technology Development Family Group

Apply here

Friday, February 14, 2014

How to use iterator in Map : java


Here is an example of how to use Iterator in Map. To use iterator in Map you need to Get a set of all the entries contained in the HashMap then Obtain an Iterator for the entries Set.

package java;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Set;
public class HashMapIterator {

public static void main(String[] args) {

// Create a HashMap and populate it with elements

HashMap hashMap = new HashMap();

hashMap.put("key_1","value_1");

hashMap.put("key_2","value_2");

hashMap.put("key_3","value_3");

// Get a set of all the entries (key - value pairs) contained in the HashMap

Set entrySet = hashMap.entrySet();

// Obtain an Iterator for the entries Set

Iterator it = entrySet.iterator();

// Iterate through HashMap entries

System.out.println("HashMap entries : ");

while(it.hasNext())

System.out.println(it.next());

}

}

Impetus hiring java developers


Location

:

Noida & Indore

QUALIFICATION

:

B.Tech/MCA

EXPERIENCE
:

2-3 yrs

TECHNOLOGY
:

Core Java, JSP

ROLE/SKILLS
:
    

  1. Experience in writing efficient algorithms and expertise in multithreaded,  network, data structures
  2. A background in Java/J2EE back-end programming
  3. Experience in Transaction / provisioning systems and Oracle
  4. Creating web services using Java
  5. Spring and Hibernate (desirable)
  6. Working on Unix as a development environment
  7. Socket (multithreading is an added advantage)
  8. Scripting skills. Knowledge of the shell/perl script will be an added advantage.


    Apply here : Java Developer

Thursday, February 13, 2014

Aptean hiring 2014 batch freshers



Company name: Aptean
Position: Associate Software Developer - 2014 Batch

Job Location : Bangalore

LAST DATE: 26th Feb 2014

Experience Required: Freshers, BE/ B.Tech - ( CS/ IT/ IS)/ MCA candidates from 2014 batch with an aggregate of 65% and above throughout academics 

Skills Required :

  • Knowledge in development environments, debugging tools, source control systems.
  • Working knowledge in one or more of C/C++, .Net/C#, Java or Databases is preferred.
  • Working knowledge in HTML, ASP/JSP, VBScript, JavaScript, COM, XML, Unix and Win32 is desirable.
  • Excellent oral and written communication skills.
  • Able to cultivate interpersonal Customer/Partner relationships and cohesive team interactions and communications.
  • Assertive self-starter with excellent organizational skills.

APPLY-MODE: Online

How TO Apply: Interested and eligible candidates can apply Here

SuccessFactors, an SAP Company hiring mobile developers


Company name: SuccessFactors, an SAP Company

Job type: Mobile Developer Job

Location: Bangalore, India



Roles and Responsibilities: 
  • Implement native online applications for iPhone and iPad
  • Serve as core contributor owning full life cycle product development
  • Work to architect and re-factor code and design for optimal maintainability, extensible and re-usability
  • Support new and existing customers using the Mobile Business Execution product by providing bug fixes in a timely manner
  • Build new features with a Test Driven Development methodology
  • Excel in a highly iterative development process
  • Take ownership and help test, release, and maintain your code
  • Typically reports to an engineering manager

Job Requirements:
  • 3 years of overall software development experience, 1+ years in iOS development
  • 1-2 years of experience building software and a proven track record of getting stuff done
  • B.S. Computer Science or related field
  • Direct professional experience with iPhone or iPad
  • Good understanding of object oriented design and various design patterns
  • Ability to understand and master new technologies quickly
  • Understanding of XML/JSON based RESTful APIs
  • Experience with C, C++, or Objective-C
  • Familiar with Blackberry, J2ME, or Android a plus
  • Strong focus on quality and generating results
  • Self-disciplined with strong attention to detail
  • Excellent written and oral communications

Good to have:
  • Experience building highly available, secure and scalable enterprise mobile applications
  • Experienced working in an Agile development environment, preferably SCRUM
  • SaaS delivery experience is highly desirable.
  • Experience with Java and JavaScript
  • Experience with Core Data or SQLite a plus

Job Segment: Developer, ERP, Social Media, Engineer, Cloud, Technology, Marketing, Engineering

To apply click here

How to terminate outer loop from the inner loop in Java ?

Most of you must be wondering how to terminate the outer loop in java, 
as using the break, continue keywords will always terminate the inner loop execution.

consider the following example:



Output:
1 1
1 2
2 1
2 2


in this example the break used inside inner loop will always terminate the inner for loop but not the outer loop.
To terminate the outer loop from the inner loop, java supports label concepts. 

How to use label?

if you want to terminate the outer loop from the inner loop,
Just use a label before loop.
Label can be any valid user defined name, there is no restriction in label naming.

Note:
1. Label name must be followed by colon ':'
2. If you don't use colon after label name the program will generate compile time error saying not a statement.

To terminate the loop just use label name just after break/continue keywords.
label name used after the break/continue keyword, will terminate the loop associated with that label name.

Here is the updated code with the use of labels,


Here the name java is a label name for outer loop and ocjp is the label name for inner loop, when the code at line #10 in executed , it terminates the outer loop, as java is the label name for outer loop.

Output:
1 1
1 2

Wednesday, February 12, 2014

WORD OF THE DAY !

LABYRINTH (bhool-bhulaiyaa): A maze of path bordered by high hedges.


Usage :
  • Labyrinth of caves to explore.
  • There is no royal road to guide us through its Labyrinths.
Memory Key : Humorous+ mysterious movie bhool bhulaiyaa can be call as

LABYRINTH. 




Java 1.7 Update: Try-With-Resources

Since JDK 1.7, a new "try-with-resources" approach is introduced. When a try block is end, it will close or release your opened file automatically.

Following is the example of the updated try block 

try(open file or resource here){

//...

}
//after try block, file will close automatically.

Example:



In JDK7, finally is no longer required. The file will be closed automatically after try block.

Handling multiple exceptions in a single catch block: Java 1.7 update


In Java SE 7 and later, a single catch block can handle more than one type of exception. This feature can reduce code duplication and lessen the temptation to catch an overly broad exception.

Consider the following example, which contains duplicate code in each of the catch blocks:

catch (IOException ex) {
logger.log(ex); 
 throw ex;
}
catch (SQLException ex) {
logger.log(ex);
throw ex;}

In releases prior to Java SE 7, it is difficult to create a common method to eliminate the duplicated code because the variable ex has different types.The following example, which is valid in Java SE 7 and later,eliminates the duplicated code:

catch (IOException|SQLException ex) {
logger.log(ex);
throw ex;
}


The catch clause specifies the types of exceptions that the block
can handle,and each exception type is separated with a vertical bar (|).

Note: If a catch block handles more than one exception type,then the catch parameter is implicitly final.

In this example, the catch parameter ex is final and therefore you

cannot assign any values to it within the catch block.

Advantage of this update: Byte code generated by compiling a catch block that handles multiple exception types will be smaller (and thus superior) than compiling many catch blocks that handle only one exception type each.

catch block that handles multiple exception types creates no duplication in the byte code generated by the compiler;the byte code has no replication of exception handlers.