strstr (a.k.a find sub string), is a useful function in string operation. You task is to implement this function. For a given source string and a target string, you should output the “first” index(from 0) of target string in source string. Continue reading
Author Archives: James
How to check if a radio button is checked using JQuery
It is easy to check if a radio button is checked using JQuery.
For Example:
1 2 3 4 |
<input type="radio" name="gender" value="Male" /> <input type="radio" name="gender" value="Female" /> |
How to display double or float data with 2 decimal places in Java?
There are multiple approaches to display double or float data with 2 decimal places in Java. The post presents a way using DecimalFormat. Continue reading
Proxy Pattern
The intent of Proxy Pattern is to provide a placeholder for an object to control access to it, and add a wrapper and delegation to protect the real component from undue complexity. Continue reading
Deny visitors by IP address using Apache .htaccess file
.htaccess is a configuration file for use on web servers running the Apache Web Server. Continue reading
Command Pattern
Command pattern encapsulates a request under an object as command, and passed to invoker object. It allows the parameterization of clients with different requests, queue or log requests. Continue reading
Java Properties File Processing
Java properties file (with extention .properties) is normally used to store the configurable parameters or strings for Internationalization and localization. In the file, each parameter is stored as a key/value pair of strings. Continue reading
Template Method Pattern
Template Method pattern defines the skeleton of an algorithm, and defer some steps to subclasses. Template Method lets subclasses redefine certain steps of an algorithm without changing the algorithm’s structure. Continue reading
Difference between String, StringBuffer and StringBuilder
In Java, String, StringBuffer and StringBuilder classes are widely used. In many scenarios, any of them can be used. However, there are minor differences between these classes. Continue reading
Difference between Session get and load in Hibernate
Hibernate Session provides two methods to retrieve object e.g. get() and load() both looked quite similar to each other but there are subtle difference between load and get method.
The major difference between two methods is: Continue reading