Cflayout

I didn't notice cflayout tag is just like DIV before. It's not much different between cflayout and DIV. Sometimes, it just like iframe. But, we should know this tag will be useful for future. Here is example for cflayout.

view plain print about
1function CF_RunContent(src)
2{
3    setTimeout(function(){
4        document.getElementById('Center').innerHTML = src;
5    },5);
6}

view plain print about
1<a href="#" onclick="ColdFusion.navigate('mybio.cfm', 1, 'Center');">Bio</a>
2<cflayout type="border" name="layoutborder">
3    <cflayoutarea name="Center" position="top" maxSize="200">
4        Welcome
5    </cflayoutarea>
6</cflayout>

Rounded Corner for IE

If you want to make rounded corner box for everything, you may use integrating with images and css. Unless, For firefox, you can set border-radius by prefixing "-moz" to the css property. And ofcource for webkit use "-webkit. For IE, border-radius doesn't work on it. That's why we need to integrate images and css for doing rounded corner. If you're sick of doing so, you can use following coding:

CSS

view plain print about
1.curved {
2    padding:4px 0px 0px 0px;
3    width:80px;
4    height:20px;
5    border:#666666 solid 1px;
6    color:#000000;
7    text-align:center;
8    -moz-border-radius:20px;
9    -webkit-border-radius:10px;
10    behavior:url(border-radius.htc);
11}

The HTML:

view plain print about
1<div class="curved">rouneded div</div>

Best Credit to : http://www.htmlremix.com/files/20080924-border-radius.zip

Javascript - Errors and Exceptions Handling

As we all know, javascript errors are kinda complicated to handle for every browsers. Before time, when we want to know which line is getting error and because of what, I always check viewsource of current page. Now, I don't need to do so. Because we can know which line number is getting errors and others by putting try and catch of javascript's functions.

view plain print about
1try {
2// Code to run
3[break;]
4} catch ( e ) {
5// Code to run if an exception occurs
6[break;]
7}[ finally {
8// Code that is always executed regardless of
9// an exception occurring
10}]

Reference : http://www.tutorialspoint.com/javascript/javascript_error_handling.htm

GetClientVariablesList

I've got GetClientVariableList in Coldfusion 8 function. It seems it's easy to output how many client variables are stored in your application. Oddly, it can't support to output the value of client variables. In this case, I prefer for displaying the value and the name of client variables in application.

view plain print about
1<cfoutput>#GetClientVariablesList()#</cfoutput>
2<!--- cfdump --->
3<cfdump var="#client#">

GetMetricData for Server Monitor

It's great that we can use GetMetricData to monitor the server performance within in CFML page. That's why we don't need to login into CFadministrator to monitor the server performance if we don't have enough permission to access in. In this post, I've shown that I've integrate GetMetricData and CFchart to monitor the server. It's static page. If you want to reload this page, manually press on F5 or put or something else.

view plain print about
1<cfset pmData = GetMetricData("PERF_MONITOR") />
2<cfchart chartheight="500" chartwidth="700" format="PNG" showlegend="yes">
3    <cfchartseries type="bar" seriescolor="##639526" paintstyle="light" colorlist="##ff8080,##ffff80,##80ff80,##0080ff,##ff80c0,##ff80ff,##ff8040,##008000,##0080c0,##808000">
4        <cfchartdata item="Page Hits" value="#pmData.PageHits#">
5        <cfchartdata item="Request Queued" value="#pmData.ReqQueued#">
6        <cfchartdata item="Database Hits" value="#pmData.DBHits#">
7        <cfchartdata item="Request Running" value="#pmData.ReqRunning#">
8        <cfchartdata item="Request TimedOut" value="#pmData.ReqTimedOut#">
9        <cfchartdata item="Bytes In" value="#pmData.BytesIn#">
10        <cfchartdata item="Bytes Out" value="#pmData.BytesOut#">
11        <cfchartdata item="Avg Queue Time" value="#pmData.AvgQueueTime#">
12        <cfchartdata item="Avg Request Time" value="#pmData.AvgReqTime#">
13        <cfchartdata item="Avg Database Time" value="#pmData.AvgDBTime#">
14    </cfchartseries>
15</cfchart>

Here is output :

Ajax submitForm

As you know, there are a lot of Ajax UI in CF8. Among them, I love to use Coldfusion.Ajax.submitForm function. When I was on cfmx7, I need to use classic ajax coding or jQuery coding for submitting form. Once I'm on cf8, adobe support me to develop ajax form submit function in just 5 mins. That's why I love CFML. Ok, let's go how to use : If you want to develop with Ajax function, you need to put cfajaximport tag at the top of your page.

index.cfm

view plain print about
1<html>
2 <head>
3 <cfajaximport>
4 <invalidTag type="text/javascript">
5            function submitForm() {
6            ColdFusion.Ajax.submitForm('myform', 'formAction.cfm', callback, errorHandler);
7            }
8            function callback(text) {
9            document.getElementById("divShowMsg").innerHTML = text;
10            }
11            function errorHandler(code, msg) { alert("Error " + code + ": " + msg); }
12        </script>
13 </head>
14 <body>
15 <div id="divShowMsg"></div>
16 <cfform name="myform">
17 Enter your email:
18 <br>
19 <cfinput name="txtEmail" />
20 <cfinput name="btnSubmit" value="Submit" type="button" onclick="submitForm()" />
21 </cfform>
22 </body>
23</html>

for callback function It's built-in function of ajaxformsubmit and which check whether your data has been successfully reach or not. If reach, you can show any message within this scope. It always return string value. formAction.cfm

view plain print about
1<cfif form.txtEmail NEQ "">
2 <cfoutput>
3 Your email(#form.txtEmail#) has been successfully subscribed.
4 </cfoutput>
5<cfelse>
6 Please enter email address.
7</cfif>

Trade Data Reporting Systems

Trade Data

Trade data, one of my reporting systems project make me proud. Because I could do what I want to use cool tools in this project. I've added Graph features and temp tables of CFMX7. Our client can view monthly reports, yearly report, comparison reports, by commodity reports, badget year reports, by country reports of Export and Import product. It's very good project for our client who is runing as Stock control Systems.

Systems : CFMX7, SQL 2005, Ajax and javascript.

Toggle Slide with jQuery

I'm now running on pre-sales Project. My job is to beautify existing codes and to change old-fashioned code to latest technology. A part of this project, my boss told me to integrate two slides into main frame with toggle features. I feel that I can do it with jQuery. That's why I was working on this portion for 3 hours. Finally, I found useful code in french blog of le informaticien français. But, I need to hack some coding of his javascript file to reuse into my project.

Merci à vous, Julien Chauvin.

Toggle

Best Credit : http://www.webinventif.fr/wslide-plugin

jQuery can enhance my javascript skill

jQuery, this guyshelp me a lot in these days. Because, I can create nice screen design with using jQuery and other plugins. First of all, jQuery is kinda complicated to manipulate but that time, you know how does he work it's so easy to manipulate.

Check it out :

CFChart with LightBox

CFChart

In these days, my client want me to integrate CFchart and Lightbox. I know, it's not easy doing and kinda complicated. That's why I was doing for that project around 3 hours. First of all, I need to show pop-up window when users click on each slide of CFchart. That's why I consider to use "URL" attribute of CFChart. After that, integrate with lightbox. There are so many lightbox features. Among them, I use GreyBox. It's simple and doesn't need embed javascript in CFML coding. It's kinda simple. :)

Top of Page