All posts by mkyong.

How to install a Vim color scheme

In this tutorial, we will show you how to install a Vim editor color scheme named “distinguished“. 1. Default Color Scheme Default syntax highlight in the “homebrew” profile terminal. 2. Install a new Vim Color Scheme 2.1 Download a new Vim color scheme – “distinguished“. Extracts and move the downloadedContinue Reading


Spring Security Hello World Annotation Example

In preview post, we are using XML files to configure the Spring Security in a Spring MVC environment. In this tutorial, we are going to show you how to convert the previous XML-base Spring Security project into a pure Spring annotation project. Technologies used : Spring 3.2.8.RELEASE Spring Security 3.2.3.RELEASEContinue Reading


Eclipse – SimpleTagSupport was not found on the Java Build Path

Here is the development environment Eclipse 4.3 Kepler Java 1.7 Spring 3.2, a MVC project using JSP view. 1. Problem Recently, Eclipse IDE is prompting following error message on top of all of the .tag file. The superclass "javax.servlet.jsp.tagext.SimpleTagSupport" was not found on the Java Build Path. See figure :Continue Reading


Java – Get nameservers of a website

In this tutorial, we will show you how to get the nameservers of a website using Java + dig command. 1. Using Dig Command 1.1 On Linux, we can use dig command to query a DNS lookup of a website, for example : $ dig any   //… Reading


jConsole – JMX remote access on Tomcat

In this tutorial, we will show you how to use jConsole to remote access a Tomcat instance, for JVM monitoring stuff. Tools and environment used : Ubuntu 13 + Tomcat 7 + Windows 8 + jConsole + 1. Tomcat + JMX To connect with jConsole, Tomcat need toContinue Reading


Eclipse + Tomcat – java.lang.OutOfMemoryError: Java heap space

In Eclipse IDE, run a Java web application with Tomcat server plugin, but the console prompts Exception in thread "x" java.lang.OutOfMemoryError: Java heap space 1. Solution – Increase Heap Size in Tomcat By default, Tomcat allocated a small amount of heap size. To solve it, you need to increase theContinue Reading


Grep for Windows – findstr example

I love grep command on Linux, it helped to search and filter strings easily, always wonder what is the equivalent tool on Windows, and found this findstr recently. In this article, I will share some of my favorite “grep” examples on Linux, and how to “port” it to Windows withContinue Reading


Find out your Java heap memory size

In this article, we will show you how to use the -XX:+PrintFlagsFinal to find out your heap size detail. In Java, the default and maximum heap size are allocated based on this – ergonomics algorithm. Heap sizes Initial heap size of 1/64 of physical memory up to 1Gbyte Maximum heapContinue Reading


Spring Data MongoDB – Auto Sequence ID example

In this tutorial, we will show you how to generate an auto-incrementing sequence id in MongoDB + Spring Data environment. Tools used in this project : Spring Data MongoDB 1.2.1.RELEASE MongoDB 2.4.5 Eclipse 4.2 Maven 3 At the end of this tutorial, if the collection name “hosting” is saved, aContinue Reading

TestNG + Spring

JSP – jsessionid appear in CSS and JS link

In Spring MVC + JSP view page environment. index.jsp <html> <head> <title>Welcome!</title>   <c:url var="assets" value="/resources/abc" /> <link href="${assets}/css/style.min.css" rel="stylesheet">   <script src="<c:url value="/resources/js/jquery.1.10.2.min.js" />"> </script>   </head> … </html> In the Spring config file, mapped a resource path, mvc-dispatcher-servlet.xml <beans … <context:component-scan base-package="com.mkyong.test" />   <mvc:resources mapping="/resources/**" location="/resources/" />Continue Reading


Java – Append values into an Object[] array

In this example, we will show you how to append values in Object[] and int[] array. Object[] obj = new Object[] { "a", "b", "c" }; ArrayList<Object> newObj = new ArrayList<Object>(Arrays.asList(obj)); newObj.add("new value"); newObj.add("new value 2"); 1. Object[] Array Example Example to append values with ArrayList : package com.mkyong.test;Continue Reading


Java – Convert int[] to Integer[] example

Examples show you how to convert between int[] and its’ wrapper class Integer[]. 1. Convert int[] to Integer[] public static Integer[] toObject(int[] intArray) {   Integer[] result = new Integer[intArray.length]; for (int i = 0; i < intArray.length; i++) { result[i] = Integer.valueOf(intArray[i]); } return result; } 2. Convert Integer[]Continue Reading


CloudFlare + WordPress admin, Cache issue

Below is my website environment : WordPress 3.8.1 CloudFlare Pro Plan 1. Problem I’m unable to login WordPress after changing my custom DNS to CloudFlare, below is the error message : ERROR: Cookies are blocked or not supported by your browser. You must enable cookies to use WordPress P.S TheContinue Reading

TestNG + Spring

TestNG + Spring Integration Example

In this tutorial, we will show you how to test Spring’s components with TestNG. Tools used : TestNG 6.8.7 Spring 3.2.2.RELEASE Maven 3 Eclipse IDE 1. Project Dependencies To integrate Spring with TestNG, you need spring-test.jar, add the following : pom.xml <properties> <spring.version>3.2.2.RELEASE</spring.version> <testng.version>6.8.7</testng.version> </properties>   <dependencies> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-core</artifactId>Continue Reading

testng tutorials

TestNG – Groups Test

In this tutorial, we will show you how to do the group testing in TestNG. 1. Groups on Methods Review a test group example. runSelenium() and runSelenium1() are belong to group selenium-test. testConnectOracle() and testConnectMsSQL() are belong to group database. runFinal() will be executed if groups selenium-test and database areContinue Reading

Page 1 of 9312345...102030...Last »