Saturday, July 23, 2011

Cascading select (drop-down) boxes in Grails

${remoteFunction(controller:'processParamAssign',action:'workCenterList',update:'workCenterCode',params:params)};
${remoteFunction(controller:'processParamAssign',action:'mfgAreaList',update:'mfgAreaLocDiv',params:params)};
${remoteFunction(controller:'processParamAssign',action:'operList',update:'operDiv',params:params)};


   def workCenterList={
        groovy.sql.Sql sql = new groovy.sql.Sql(dataSource)

        def tableNames = []
        sql.eachRow("select distinct(work_center_code) from wc_mfg_area_oper where work_center_code is not null union select 'ALL' from dual order by 1",{ row ->
                //println "Found " << row.work_center_code
                tableNames << row.work_center_code
            });
        if(!params.workCenterCode){
            render g.select(from:tableNames, name:"workCenterCode", onChange:"${remoteFunction(controller:'processParamAssign',action:'mfgAreaList',update:'mfgAreaLocDiv', params:'\'workCenterCode=\' + this.value')};${remoteFunction(controller:'processParamAssign',action:'operList',update:'operDiv', params:'\'mfgAreaLoc=\' + mfgAreaLoc.value')};")
        }else{
            render g.select(from:tableNames, name:"workCenterCode", value:params.workCenterCode , onChange:"${remoteFunction(controller:'processParamAssign',action:'mfgAreaList',update:'mfgAreaLocDiv', params:'\'workCenterCode=\' + this.value')};")
        }
    }

    def mfgAreaList={
        groovy.sql.Sql sql = new groovy.sql.Sql(dataSource)
        def tableNames = []
        String mfg = "";
        //println params
        if((params.workCenterCode=="ALL")||(!params.workCenterCode)){
            mfg="select distinct(mfg_area_loc) from wc_mfg_area_oper where mfg_area_loc is not null union select 'ALL' from dual order by 1";
        }else{
            mfg="select distinct(mfg_area_loc) from wc_mfg_area_oper where work_center_code = '${params.workCenterCode}' and mfg_area_loc is not null union select 'ALL' from dual order by 1";
        }
        //println mfg
        sql.eachRow(mfg,{ row ->tableNames << row.mfg_area_loc
            });
        if(!params.mfgAreaLoc){
            render g.select(from:tableNames, name:"mfgAreaLoc", onChange:"${remoteFunction(controller:'processParamAssign',action:'operList',update:'operDiv', params:'\'mfgAreaLoc=\' + this.value')};")
        }else{
            render g.select(from:tableNames, name:"mfgAreaLoc", value:params.mfgAreaLoc, onChange:"${remoteFunction(controller:'processParamAssign',action:'operList',update:'operDiv', params:'\'mfgAreaLoc=\' + this.value')};")
        }
    }

    def operList={
        groovy.sql.Sql sql = new groovy.sql.Sql(dataSource)
        def tableNames = []
        String oper = "";
        if(params.mfgAreaLoc=="ALL"){
            tableNames = tableNames+"ALL";
            oper="select distinct(oper) from wc_mfg_area_oper where oper is not null order by 1";
        }else{
            oper="select distinct(oper) from wc_mfg_area_oper where mfg_area_loc = '${params.mfgAreaLoc}' and mfg_area_loc is not null union select 'ALL' from dual order by 1";
        }
        sql.eachRow(oper,{ row ->
                //println "Found " << row.oper
                tableNames << row.oper
            });
        if(!params.oper){
            render g.select(from:tableNames, name:"oper")
        }else{
            render g.select(from:tableNames, name:"oper", value:params.oper)
        }
    }

DNS Benchmark

Domain Name Speed Benchmark
Are your DNS nameservers impeding your Internet experience?
divider
A unique, comprehensive, accurate & free Windows (and Linux/Wine) utility to determine the exact performance of local and remote DNS nameservers . . .
“You can't optimize it until you can measure it”
Now you CAN measure it!
DNSBench

Monday, July 18, 2011

Thursday, July 07, 2011

Navigon 5100 chargers

I have cherished my Navigon 5100 GPS and the perfect directions. It still shows me the correct way Smile But the pins original charger can easily stop working due to perpendicular angle or just by normal wear and tear. It is very difficult to get a charger that works!

The only Navigon after market charger that works is the one below :

 

Description

  • This sleek design ensures that the charger fits neatly and safely in your car cigarette lighter.
  • High quality craftsmanship design give this charger durability and longevity
  • Your device will not go in to PC or Sleep mode while being charge
  • Conveniently charges your devices this car charger
  • Comes with Intelligent Chip
  • IC Chip recognizes a full battery & automatically switches to saver mode
  • Prevents overcharging and overheating

Notice the red highlighted line. You can buy these chargers from kb_accessories: http://stores.ebay.com/kb-accessories-store?_trksid=p4340.l2563 or sm_wireless_store: http://stores.ebay.com/smwirelessaccessories


The following chargers failed the test. After connection all GPS switched to data mode and you cannot use GPS while charging

 

Product Details

USB chargers will also not work as it will put the GPS in data mode making it not usable while charging. I am guessing this is because they have interchanged the pins in the charger.