Showing posts from October, 2013

Spring 3 Scheduler

Basic Schduler in spring 3


<task:scheduler id="Scheduler" pool-size="10" />
 <task:executor id="TaskExecutor" pool-size="10"/>
 <task:annotation-driven executor="TaskExecutor" scheduler="Scheduler"/>

 <bean id="schedulerService" class="com.operation.service.SchedulerService"

 * @author jjhangu
public class SchedulerService {
 @Scheduled(fixedDelay = 5000)
 public void doSomething() {
  final long time = System.currentTimeMillis();
  final SimpleDateFormat dayTime = new SimpleDateFormat("yyyy-mm-dd hh:mm:ss");
  final String str = dayTime.format(new Date(time));

Let me make replaceAll in Javascript

There is no replaceAll in javascript

if you use replace

ex) var orgStr = "welcome to my blog to have a fun";
     orgStr = orgStr.replace('to', 'ha');
     output = "welcome ha my blog to have a fun"

It mean only first String will be replaced but otheres not,

So this is good solution

var orgStr = "welcome to my blog to have a fun";
     orgStr = orgStr.split('to').join('ha');
     output = "welcome ha my blog ha have a fun"

Javascript get Max Width of element in childnode

this function will return that the max width of element from tag element to inner element 

var mainDiv = document.getElementById('mainDiv');
  contentWidth = document.getElementById('contentScroller').offsetWidth;
   var maxVal = getMax (mainDiv, contentWidth);

function getMax (tag, val){
  if(typeof tag.offsetWidth != "undefined"){
   if(val < tag.offsetWidth){
    val = tag.offsetWidth;

   var i=0;
   for (i=0;i<tag.children.length;i++){
    var childVal = getMax(tag.children[i], val);
    if(val < childVal){
     val = childVal;
  return val;

Search Tag in Iframe from out of Iframe

this is Just example

document.getElementById('main_iframe').onload = function(){

var frameHtml = document.getElementById("main_iframe").contentWindow.document.body.innerHTML;
if(frameHtml.indexOf("loginForm") != -1){
location.href = '/neo/m4/home/login.mvc';



<iframe src="" id="main_iframe" width="100%" height="100%" marginheight="0" marginwidth="0" frameborder="0" scrolling="no"></iframe>

Call to Parent Function in Iframe

There are two ways call parent function in iframe



This is only in my opinion, I would prefer to use

because parent is not working well in sometime.

DOMWindow.js this is kind of popup in html

you can try example from below site