Archive for 9월, 2012

link – OpenStack Folsom Architecture

2012/09/25

OpenStack Folsom Architecture
http://ken.pepple.info/openstack/2012/09/25/openstack-folsom-architecture/


Sent from Zite personalized magazine iPhone app.
Available for free in the App Store.
www.zite.com

from mobile

Advertisements

[javascript] jqgrid auto refresh helper class

2012/09/25

jqgrid를 매 N초마다 자동으로 refresh하는 javascript class. ( .setup )
cf) 팝업이 떠있을 경우에는 refresh하지 않음.
cf) 검색버튼이 눌린 경우에도 refresh 주기를 초기화함. ( .wait)
cf) 주의사항 : jqgrid의 gridComplete 이나 loadComplete 안에 setup함수를 포함하지 말것..

// class definition

function GridRefresh(){
    this.bwait = false;
    this.timeoutID;
    this.setup= function(triggerId){
        if(typeof this.timeoutID == "number") {
            window.clearTimeout(this.timeoutID);
            delete this.timeoutID;
        }
        if($(":ui-dialog").length===0 && !this.bwait){ // jquery dialog not visible
            $(triggerId).trigger('reloadGrid');
        }
        this.bwait = false;
        var self = this;
        this.timeoutID = window.setTimeout( function() {self.setup(triggerId);}, 10000, "refresh"); // every 10 seconds
    };
    this.wait = function(){
        this.bwait = true;
    };
};

usage example

// global variable
var gridRefresh = new GridRefresh(); // create class instance
$("#GRID_ID").jqGrid({  ...
...
}).navGrid("#pager");
gridRefresh.setup("#GRID_ID"); // refresh start here!

$.fncSearch = function(){ // search function
....
$("#GRID_ID").setGridParam({url:url}).trigger("reloadGrid");
gridRefresh.wait(); // wait auto refresh ...
}

[groovy/grails] make grails web service client (using wslite)

2012/09/25

– prepare

install grails 2.1.1 ( or groovy-grails-tool-suite-3.1.0.M1-e4.2 )

1. install ws-lite plugin ( current 0.7.1)

grails install-plugin wslite

2. add wslite bean
edit conf/spring/resources.groovy

httpClient(wslite.http.HTTPClient){
 // ....
}
soapClient(wslite.soap.SOAPClient){
 serviceURL = "http://blah.com/wsdl.."
 httpClient = ref('httpClient')
} 

3. create ws client service class

class WSClientService{
def soapClient
     def submit(service, act, body){
         def action = "http://your-soap-namespace/${service}/${act}"
def writer = new StringWriter()
         def soap = new MarkupBuilder(writer)
         soap.mkp.xmlDeclaration(version:'1.0', encoding:'UTF-8')
         soap."soap-env:Envelope"(  ["xmlns:soap-env":"http://schemas.xmlsoap.org/soap/envelope",  "xmlns:tns" : "http://your-soap-namespace/${service}/"] ){
"soap-env:Header"([:], {} )  // set header
"soap-env:Body"([:]){  "tns:${action}"( body )   }

def sendstring = writer.toString()
def response = soapClient.send(SOAPAction: action, sendstring)
return response."*"."*" // extract real soap object root
}
}

5. create controller class

class WsController{
WSClientService wsClientService
def index(){
def parameter = { // this is closure
id( params.id)
}

def response = wsClientService.submit("ServiceName", "ActionName", parameter);
render response as XML
}

cf) if you use grails2.1.1, then you can’t use converters plugin. -> installation fail  ( so, you can’t use ” as XML” sentence )

link – srch engine : DuckDuckGo !Bang

2012/09/24

https://duckduckgo.com/bang.html

from mobile

link – Safer Contact Forms Without CAPTCHAs – jQuery Wiki

2012/09/24

http://docs.jquery.com/Tutorials:Safer_Contact_Forms_Without_CAPTCHAs

from mobile

link – comlang:groovy Gauryan Wiki

2012/09/15

http://gauryan.ivyro.net/wiki/doku.php?id=comlang:groovy

from mobile

link – Grails Interview Questions | Tomás Lin’s Programming Brain Dump

2012/09/15

http://fbflex.wordpress.com/2011/01/11/grails-interview-questions/#more-977

from mobile

link – Grails – Calling External WebServices

2012/09/07

http://grails.org/Calling+External+WebServices

from mobile

xss validation memo

2012/09/07

except : login password

http://www.troyhunt.com/2012/09/do-you-allow-xss-in-your-passwords-you.html

link – TiddlyWiki personal web notebook

2012/09/07

http://tiddlywiki.com/

from mobile