Know if your Gmail account has been hacked



To check if your account has been targeted and hacked into without your knowledge, you need to log into your Gmail account using a desktop browser.Scroll down to the bottom right of your inbox and locate a link called “Details”. Click on it, a pop-up window will appear, and it will show you a detailed list of the last ten times you – or anyone else –has accessed your account. It will also show you not just when your account was accessed but also how it was viewed. You’ll know if the inbox was opened using an email app, browser, smartphone app and the IP address through which it was accessed.If you see a suspicious device or IP address, you may want to change your password as soon as possible.To strengthen the security on your Gmail account, you can even turn the two-factor authentication system on.

Stay safe!

Posted at at 5:07 PM on Sunday, December 8, 2013 by Posted by Ravindra Nikam | 0 comments   | Filed under: ,

maven help

clean install -Dmaven.test.skip=true New Jar project mvn archetype:generate -DgroupId=com.jpmc.ti -DartifactId=TIFileImportService -DarchetypeArtifactId=maven-archetype-quickstart -DinteractiveMode=false New Webapp mvn archetype:generate -DgroupId={project-packaging} -DartifactId={project-name} -DarchetypeArtifactId=maven-archetype-webapp -DinteractiveMode=false mvn install:install-file -Dfile=C:\vti-workspace\VTI\TI\code\ThirdpartyComponents\ti-core\dynax.jar -DgroupId=ti-core -DartifactId=dynax -Dversion=1.0 -Dpackaging=jar mvn install:install-file -Dfile=C:\vti-workspace\VTI\TI\code\ThirdpartyComponents\ti-core\dynax-db-ojb-1.0.rc4.jar -DgroupId=ti-core -DartifactId=dynax-db -Dversion=1.0.rc4 -Dpackaging=jar mvn install:install-file -Dfile=C:\vti-workspace\Jars\lib\com\jpmc\ti\geGmrd\1.0\IM.jar -DgroupId=com.jpmc.ti -DartifactId=gegmrd.im -Dversion=1.0 -Dpackaging=jar

Posted at at 12:52 PM on Saturday, March 16, 2013 by Posted by Ravindra Nikam | 0 comments   | Filed under:

Validating XML with XML schema (XSD)

Guys believe me today I struggled a lot trying to do a very simple thing: Validating an xml file with my XSD( XML Schema), using a SAX parser(apache). I tried simple standalone program and in one shot I got itworking and now I want it to inside my web application. I added it(XSD)to the resources(classpath) and deployed my app to the tomcat but unfortunately I started getting the error "cvc-elt.1: Cannot find the declaration of element 'Root'". So I started checking my input xml m the XSD and all. All is well formed and Root is there. Then question remains where I went wrong. After some observation I found that the parser(com.sun.org.apache.xerces.internal.parsers.SAXParser) not able to get the XSD itself :( . I checked my project structure and but all things are at place. So I started putting the XSD in possible locations where this guy will look. But no luck. By now I'm pretty sure that culprit is not the directory structure. After some internet search I found thatparser properties value should be URL but I didn't want the XSD to be publicly available. Unfortunately, I didn't find how to do that directly on the Internet. So after trying things ,I came to know that which I didn't knew earlier the simple thing I missed it is that JAVA can generate an URL pointing to a file residing in the classpath. so here's the code :

SAXBuilder builder = new SAXBuilder("com.sun.org.apache.xerces.internal.parsers.SAXParser",true);
builder.setFeature("http://xml.org/sax/features/validation", true);
builder.setFeature("http://apache.org/xml/features/validation/schema",true);
builder.setFeature("http://apache.org/xml/features/validation/schema-full-checking", true);
Properties properties = new Properties();
properties.load(getClass().getResourceAsStream("/my.properties"));
URL schemaUrl = getClass().getResource(properties.getProperty("my.xsd"));
builder.setProperty("http://apache.org/xml/properties/schema/external-noNamespaceSchemaLocation",schemaUrl);
builder.build(inXML);

I haven't used any ErrorHandler since just want to show the exact error message coming from XSD validation and halt. Good luck!!

Posted at at 6:24 AM on Friday, January 14, 2011 by Posted by Ravindra Nikam | 0 comments   | Filed under: ,

java.lang.NoClassDefFoundError: org/jaxen/JaxenException

If you see in my new project, there is going to be a lot of XML processing. So I was wondering what would be the better approach to parse the XML files with JAVA. After some R&D I came across a very nicely written API's for parsing the XML and you can go back and forth to get any node since each entity in xml file has been considered as object, so no more restrictions.Yes, I am talking about JDOM. It also comes with very good utility class to process xml using XPath. The static methods provided by class org.jdom.xpath.XPath are pretty straight forward and simple to use in one line :

Listlist = XPath.selectNodes(context, "//root"); 
Object obj = XPath.selectSingleNode(context, "//root"); 
This will return you the list/Element of matching node(s) as a object. So when I were trying this first time I just started with downloading JDOMv1.1.1.jar from the web.But unfortunately I got stuck with the this wierd exception
java.lang.NoClassDefFoundError: org/jaxen/JaxenException ... 
. So solution is: putting the jdom jar itself not resolve this problem.Since JDOM uses "Jaxen engine" for XPath processing you need to add one more jar called jaxen.jar along with it from here.

Posted at at 9:35 PM on Thursday, December 23, 2010 by Posted by Ravindra Nikam | 0 comments   | Filed under: , ,

first step with iBatis

Posted at at 10:10 AM on Friday, December 10, 2010 by Posted by Ravindra Nikam | 0 comments   | Filed under: , , ,

removing empty attributes

XSLT template to remove empty attributes from the xml.

<xsl:template match="/">
  <xsl:copy>
     <xsl:apply-templates>
       <xsl:for-each select="@*">
          <xsl:if test=".!=''">
             <xsl:copy-of select="." />
          </xsl:if>
       </xsl:for-each>
     </xsl:apply-templates>
   </xsl:copy> 
</xsl:template>

Posted at at 4:21 AM on Saturday, October 2, 2010 by Posted by Ravindra Nikam | 0 comments   | Filed under: , , ,

Sorting/Reordering elements using xslt

XSLT template to reorder the elements as per the position. The order option allows you to decide the order of sort. Depending on the select XPath query result data-type can be given.

<xsl:template match="*">
    <xsl:copy>
       <xsl:apply-templates>
          <xsl:sort select="position()"order="descending" data-type="number" />
       </xsl:apply-templates>
     </xsl:copy>
  </xsl:template>

Posted at at 6:03 AM on Friday, October 1, 2010 by Posted by Ravindra Nikam | 0 comments   | Filed under: , , ,

copy elements using xslt

XSLT template to just copy all elements without any condition from one file to another.

<xsl:template match="* | @*">
           <xsl:copy>
              <xsl:copy-of select="@*" />
              <xsl:apply-templates />
           </xsl:copy>
        </xsl:template>

Posted at at 5:57 AM on by Posted by Ravindra Nikam | 0 comments   | Filed under: , , ,

xml to xml conversion using xslt

As I am new to XSLT wanted to perform some xsl transformation on my xml file and generate the xml. But when I were looking for some example how to do it I was getting all example who teach you how to transform an xml to html. So here is the way I found after some web search. Look at the tag <xsl:output> and its method just set it to xml as below. The code snippet to just copy all the elements and attributes from one xml file to another. If you want to perform some operations or checks you are free to add new templates.

<xsl:stylesheet version='1.0' 
xmlns:xsl='http://www.w3.org/1999/XSL/Transform'> 

<xsl:output method='xml' indent='yes' /> 

<!-- copy all elements which don't match any template --> 
  <xsl:template match="* | @*"> 
    <xsl:copy> 
       <xsl:copy-of select="@*" /> 
       <xsl:apply-templates /> 
    </xsl:copy> 
  </xsl:template> 
</xsl:stylesheet>

Posted at at 6:19 AM on Thursday, September 30, 2010 by Posted by Ravindra Nikam | 0 comments   | Filed under: , , ,

Tools for java object to object mapping

There are few libraries out there:

Transmorph: Transmorph is a free java library used to convert a Java object of one type into an object of another type (with another signature, possibly parameterized).

EZMorph: EZMorph is simple java library for transforming an Object to another Object. It supports transformations for primitives and Objects, for multidimensional arrays and transformations with DynaBeans

Commons-BeanUtils: ConvertUtils -> Utility methods for converting String scalar values to objects of the specified Class, String arrays to arrays of the specified Class.

Commons-Lang: ArrayUtils -> Operations on arrays, primitive arrays (like int[]) and primitive wrapper arrays (like Integer[]).

Commons-Convert: Commons-Convert aims to provide a single library dedicated to the task of converting an object of one type to another. The first stage will focus on Object to String and String to Object conversions.

Morph: Morph is a Java framework that eases the internal interoperability of an application. As information flows through an application, it undergoes multiple transformations. Morph provides a standard way to implement these transformations.

•Lorentz: Lorentz is a generic object-to-object conversion framework. It provides a simple API to convert a Java objects of one type into an object of another type. (seems dead)

Spring framework: Spring has an excellent support for PropertyEditors, that can also be used to transform Objects to/from Strings.

Dozer: Dozer is a powerful, yet simple Java Bean to Java Bean mapper that recursively copies data from one object to another. Typically, these Java Beans will be of different complex types.

OTOM: With OTOM, you can copy any data from any object to any other object. The possibilities are endless. Welcome to "Autumn".

Smooks: The Smooks JavaBean Cartridge allows you to create and populate Java objects from your message data (i.e. bind data to) (suggested by superfilin in comments).

Transmorph (pretty recent), EZMorph, Dozer, OTOM are all serious candidates. Dozer seems to be the most active project though (and maybe the most advanced). I personally used Dozer and happy with it. (list from Pascal Thivent)

Posted at at 4:12 AM on Tuesday, August 3, 2010 by Posted by Ravindra Nikam | 0 comments   | Filed under: , , ,

Hibernate criteria join

Pasted from stackoverflow.com

Hello, We have two tables Family and Member, the relation between these two is Family has set of members in it but member don't have any family relationship within it.

I wanted get member using dob and family for that I am using Hibernate criteria API's but I am not getting how to write join query since members don't have Family instance with it. So not able to use FetchMode. Any other way to achieve this ?

Ans:

DetachedCriteria subquery = DetachedCriteria.forClass(Family.class, "family")
.add(Expression.eq("family.id", family.getId()));

subquery.createAlias("members", "members")
.add(Restrictions.eqProperty("members.id", "m.id"))
.add(Expression.eq("members.DOB",Date));

subquery.setProjection(Property.forName("members.id"));

Criteria crit = session.createCriteria(Member.class, "m")
.add(Subqueries.propertyIn("m.id", subquery));

results = crit.list();

Posted at at 1:35 AM on Friday, November 6, 2009 by Posted by Ravindra Nikam | 0 comments   | Filed under: , ,

Current opennings at SpiderLogic Pune

Hi all,
We currently have openings for :
• Senior Developers in Java and .net (4 -6 Yrs)
• Java and .Net Architects(7+ yrs)
• QA Architect.(7+yrs)
We are looking at people who are hands on development and really passionate about coding and technology. If you have any friends or ex colleagues who would be interested in working with us kindly send me their resumes at rnikamATspiderlogicDOTcom

website : www.spiderlogic.com

Posted at at 6:34 AM on Tuesday, September 22, 2009 by Posted by Ravindra Nikam | 0 comments   | Filed under: , ,

Unit testing ejb3 reference

To test ejb either we have to put test in ejb container or we can put container in test itself. following are few links to refer writing containers in test using openEJB.

How to unit test EJB
Build, deploy, and test EJB components in just a few seconds

Posted at at 6:35 AM on Thursday, August 20, 2009 by Posted by Ravindra Nikam | 0 comments   | Filed under: ,

Using regular expresions(regex, regexp)

Regular Expression Basic Syntax Reference

Posted at at 4:24 AM on Sunday, August 9, 2009 by Posted by Ravindra Nikam | 0 comments   | Filed under:

TestNG and JUnit in one project with maven surefire

This can be achieved using options such as using different profiles for both and another is by setting JUnit property true for surefire plug in.

Run "mvn test". Only the TestNG test will run since as soon as the maven founds the TestNG dependency in main profile it executes TestNG tests only. If you modify the pom to set the property "junit=true", only the JUnit test will run.


org.apache.maven.plugins
maven-surefire-plugin
2.4.2



junit
true



  

But personally my experience is it wont works with JUnit4.

Since it is the TestNG dependency that triggers surefire to use the TestNG runner to execute tests, We've to move this dependency out of the main project scope. In order to compile and run all JUnit tests, and needs to exclude the TestNG tests from the compiler and surefire plugins.

Then in a profile, add TestNG dependency and adjust the compiler and surefire plugins to include the TestNG tests but don't forget and override exclude if you are inheriting from main profile.


test



org.apache.maven.plugins
maven-compiler-plugin
2.0.2

1.5
1.5

**/testNGTests/**.java








testNG



org.apache.maven.plugins
maven-compiler-plugin
2.0.2

1.5
1.5

**/junitTests/**.java







org.testng
testng
5.8
test
jdk15





To run JUnit tests I use: mvn test
To run testNG tests I use: mvn test -P testNG

Posted at at 3:36 AM on Saturday, August 8, 2009 by Posted by Ravindra Nikam | 0 comments   | Filed under: , ,

Java Unit Testing : JUnit Vs TestNG

Just wanted share thought with you all about two very well accepted unit testing frameworks (JUnit and TestNG) in Java world, off course there are lots of differences in these two but I wanted to share the one I encountered today. I found built-in Parameterized runner is quite crude in Junit4 as compare to TestNG (I know each framework has its strengths but still).In JUnit we are not allowed to write more than one data providing methods with annotation @parameters . I encountered this problem while testing the valid and invalid behavior for functionality in same test class. So the first public, static annotated javascript:void(0)method that it finds will be used, but it may find them in any order. This causes us to write different classes unnecessarily. However TestNG provides clean way to provide different kind of data providers for each and every method. So we can test the same unit of code with valid and invalid way in same test class putting the valid/invalid data separately.
Examples:
JUnit4:

Here we can not specify value for @parameters so it will be only and even if we have multiple methods the runner will return one of them. So we can provide only one kind of data Valid or invalid.
TestNG:

@Test(dataProvider = "Data-Provider-Function")
public void parameterIntTest(Class clzz, String[] number) {
System.out.println("Parameterized Number is : " + number[0]);
System.out.println("Parameterized Number is : " + number[1]);
}

//This function will provide the patameter data or we can use xml as well
@DataProvider(name = "Data-Provider-Function")
public Object[][] parameterIntTestProvider() {
return new Object[][]{
{Vector.class, new String[] {"java.util.AbstractList", "java.util.AbstractCollection"}},
{String.class, new String[] {"1", "2"}},
{Integer.class, new String[] {"1", "2"}}
};
}


Here in this case we can create as many data provider functions as we can and associate with appropriate method using @dataprovider.

Posted at at 3:54 AM on Saturday, August 1, 2009 by Posted by Ravindra Nikam | 2 comments   | Filed under: , ,

Junit4 : expected=Exception not working with SPRING

Hello,

I'm trying to use the @Test(expected = RuntimeException.class) annotation in order to test for an expected exception. My code is as follows:

@Test(expected = RuntimeException.class)
public void testSaveThrowsRuntimeException(){

User user = domain.save(null);

}

and my save method simple like this :
public User save(User newUser) {
if(newUser == null) {
throw new RuntimeException();
}
//saving code goes here
}

after debugging the code I found that code throwing the exception as expected but its getting eaten somewhere in between in spring framework classes.

I tried the same with old way (try catch block) but still I am not able to catch that exception in test and test keeps throwing errors in runafter method of Junit :
org.springframework.transaction.UnexpectedRollbackException: JTA transaction unexpectedly rolled back (maybe due to a timeout); nested exception is javax.transaction.RollbackException
at org.springframework.transaction.jta.JtaTransactionManager.doCommit(JtaTransactionManager.java:1031)
at org.springframework.transaction.support.AbstractPlatformTransactionManager.processCommit(AbstractPlatformTransactionManager.java:709)
at org.springframework.transaction.support.AbstractPlatformTransactionManager.commit(AbstractPlatformTransactionManager.java:678)
at org.springframework.test.context.transaction.TransactionalTestExecutionListener$TransactionContext.endTransaction(TransactionalTestExecutionListener.java:504)
at org.springframework.test.context.transaction.TransactionalTestExecutionListener.endTransaction(TransactionalTestExecutionListener.java:277)
at org.springframework.test.context.transaction.TransactionalTestExecutionListener.afterTestMethod(TransactionalTestExecutionListener.java:170)
at org.springframework.test.context.TestContextManager.afterTestMethod(TestContextManager.java:344)
at org.springframework.test.context.junit4.SpringMethodRoadie.runAfters(SpringMethodRoadie.java:307)
at org.springframework.test.context.junit4.SpringMethodRoadie$RunBeforesThenTestThenAfters.run(SpringMethodRoadie.java:338)
at org.springframework.test.context.junit4.SpringMethodRoadie.runWithRepetitions(SpringMethodRoadie.java:217)
at org.springframework.test.context.junit4.SpringMethodRoadie.runTest(SpringMethodRoadie.java:197)
at org.springframework.test.context.junit4.SpringMethodRoadie.run(SpringMethodRoadie.java:143)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.invokeTestMethod(SpringJUnit4ClassRunner.java:142)
at org.junit.internal.runners.JUnit4ClassRunner.runMethods(JUnit4ClassRunner.java:51)
at org.junit.internal.runners.JUnit4ClassRunner$1.run(JUnit4ClassRunner.java:44)
at org.junit.internal.runners.ClassRoadie.runUnprotected(ClassRoadie.java:27)
at org.junit.internal.runners.ClassRoadie.runProtected(ClassRoadie.java:37)
at org.junit.internal.runners.JUnit4ClassRunner.run(JUnit4ClassRunner.java:42)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:45)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
Caused by: javax.transaction.RollbackException
at org.objectweb.jotm.TransactionImpl.commit(TransactionImpl.java:245)
at org.objectweb.jotm.Current.commit(Current.java:488)
at org.springframework.transaction.jta.JtaTransactionManager.doCommit(JtaTransactionManager.java:1028)
... 23 more

And I am sure this is because of that RuntimeException I am throwing in save but not able catch it or pass the test with expected clause.

anybody have any idea whats going wrong?

Thanks in advance,

Posted at at 2:26 AM on Friday, July 24, 2009 by Posted by Ravindra Nikam | 0 comments   | Filed under: ,

viewing firefox cache

Firefox has a nice way to view files that are in both your memory and file cache. In the Address Bar, type – about:cache. This will take you to a page that allows you to view a summary of your browser cache and also will allow you to browse the files stored in the cache.
Hit this link to change Firefox cache location.

Posted at at 2:26 AM on Tuesday, July 24, 2007 by Posted by Ravindra Nikam | 0 comments   | Filed under: ,

FTP command-line options

This is a list of the commands available when using the Microsoft Windows command-line FTP client :

Command-line options

As you're starting the program from a DOS prompt:
ftp [-v] [-d] [-i] [-n] [-g] [-s:filename] [-a] [-w:windowsize] [computer]
-v - Suppresses verbose display of remote server responses.
-n - Suppresses auto-login upon initial connection.
-i - Turns off interactive prompting during multiple file transfers.
-d - Enables debugging, displaying all ftp commands passed between the client and server.
-g - Disables filename globbing, which permits the use of wildcard chracters in local file and path names.
-s:filename - Specifies a text file containing ftp commands; the commands will automatically run after ftp starts. No spaces are allowed in this parameter. Use this switch instead of redirection (>).
-a - Use any local interface when binding data connection.
-w:windowsize - Overrides the default transfer buffer size of 4096.
computer - Specifies the computer name or IP address of the remote computer to connect to. The computer, if specified, must be the last parameter on the line.

Client commands

! - Runs the specified command on the local computer
? - Displays descriptions for ftp commands
append - Appends a local file to a file on the remote computer
ascii - Sets the file transfer type to ASCII, the default
bell - Toggles a bell to ring after each file transfer command is completed (default = OFF)
binary - Sets the file transfer type to binary
bye - Ends the FTP session and exits ftp
cd - Changes the working directory on the remote computer
close - Ends the FTP session and returns to the command interpreter
debug - Toggles debugging (default = OFF)
delete - Deletes a single file on a remote computer
dir - Displays a list of a remote directory's files and subdirectories
disconnect - Disconnects from the remote computer, retaining the ftp prompt
get - Copies a single remote file to the local computer
glob - Toggles filename globbing (wildcard characters) (default = ON)
hash - Toggles hash-sign (#) printing for each data block transferred (default = OFF)
help - Displays descriptions for ftp commands
lcd - Changes the working directory on the local computer
literal - Sends arguments, verbatim, to the remote FTP server
ls - Displays an abbreviated list of a remote directory's files and subdirectories
mdelete - Deletes one or more files on a remote computer
mdir - Displays a list of a remote directory's files and subdirectories
mget - Copies one or more remote files to the local computer
mkdir - Creates a remote directory
mls - Displays an abbreviated list of a remote directory's files and subdirectories
mput - Copies one or more local files to the remote computer
open - Connects to the specified FTP server
prompt - Toggles prompting (default = ON)
put - Copies a single local file to the remote computer
pwd - Displays the current directory on the remote computer (literally, "print working directory")
quit - Ends the FTP session with the remote computer and exits ftp (same as "bye")
quote - Sends arguments, verbatim, to the remote FTP server (same as "literal")
recv - Copies a remote file to the local computer
remotehelp - Displays help for remote commands
rename - Renames remote files
rmdir - Deletes a remote directory
send - Copies a local file to the remote computer (same as "put")
status - Displays the current status of FTP connections
trace - Toggles packet tracing (default = OFF)
type - Sets or displays the file transfer type (default = ASCII)
user - Specifes a user to the remote computer
verbose - Toggles verbose mode (default = ON)

For more : MSFTP

Posted at at 6:45 AM on Monday, February 12, 2007 by Posted by Ravindra Nikam | 0 comments   | Filed under: