The power of cflock

view plain print about
1<cfset application.ds = "myDNS">
2<cfset application.un = "myUN">
3<cfset application.pw = "myPW">

Normally, I put following lines into application.cfm file for adding following variables into application value. If I do so, following three variables have been added into those same data whenever every request occur. It can be loaded to our application performance and push Coldfusion to use server memory even it's not needed. Ok, it's time to cflock in application.cfm to enclose those three lines with cflock.

[More]

Create gradient button with CSS

It's great that we can create gradient button with only CSS. We don't need any background image for creating gradient button anymore.

view plain print about
1/* it's just to create gradient button */
2
3.button {
4 display: inline-block;
5 outline: none;
6 cursor: pointer;
7 text-align: center;
8 text-decoration: none;
9 font: 14px/100% Arial, Helvetica, sans-serif;
10 padding: .5em 2em .55em;
11 text-shadow: 0 1px 1px rgba(0,0,0,.3);
12 -webkit-border-radius: .5em;
13 -moz-border-radius: .5em;
14 border-radius: .5em;
15 -webkit-box-shadow: 0 1px 2px rgba(0,0,0,.2);
16 -moz-box-shadow: 0 1px 2px rgba(0,0,0,.2);
17 box-shadow: 0 1px 2px rgba(0,0,0,.2);
18}
19.button:hover {
20 text-decoration: none;
21}
22.button:active {
23 position: relative;
24 top: 1px;
25}
view plain print about
1/* it's just to create color manipluation */
2
3.orange {
4 color: #fef4e9;
5 border: solid 1px #da7c0c;
6 background: #f78d1d;
7 background: -webkit-gradient(linear, left top, left bottom, from(#faa51a), to(#f47a20));
8 background: -moz-linear-gradient(top, #faa51a, #f47a20);
9 filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#faa51a', endColorstr='#f47a20');
10}
11.orange:hover {
12 background: #f47c20;
13 background: -webkit-gradient(linear, left top, left bottom, from(#f88e11), to(#f06015));
14 background: -moz-linear-gradient(top, #f88e11, #f06015);
15 filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#f88e11', endColorstr='#f06015');
16}
17.orange:active {
18 color: #fcd3a5;
19 background: -webkit-gradient(linear, left top, left bottom, from(#f47a20), to(#faa51a));
20 background: -moz-linear-gradient(top, #f47a20, #faa51a);
21 filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#f47a20', endColorstr='#faa51a');
22}

view plain print about
1<!--- usage --->
2<input class="button pink" type="button" value="Submit" />

Very thanks to : http://www.webdesignerwall.com/tutorials/css3-gradient-buttons/

Difference between implicit and explicit cursors in Oracle

Today, I need to develop simple function in Oracle about data retrieving. As I mention in previous post, I'm very new to Oracle and don't know much of Oracle command and attributes. That's why I seek some information and develop simple function for it. In some information, I found two way to insert query data into variable as follow:

first one

view plain print about
1DECLARE
2 myvar varchar2(50);
3BEGIN
4 SELECT fieldone into myvar FROM tbl_one WHERE id = 1;
5END;

second one

view plain print about
1DECLARE
2 myvar varchar2(50);
3 CURSOR L1 IS
4 SELECT fieldone FROM tbl_one WHERE id = 1;
5BEGIN
6 OPEN L1;
7 FETCH L1 INTO myvar;
8 CLOSE L1;
9END;

[More]

Create Android Apps with Eclipse

Today, I feel like myself to create Android apps for mobile touching. Honestly, I'm very very new to mobile apps especially Android. That's why I don't know how to create andriod app and which IDE is suitable for it either. Well, I've already installed Eclipse in my pc and wanna know whether I can create Android apps with Eclipse or not. Well, I got some information about creating Android apps with Eclipse. For me, it's kinda complicated and have tried two times to complete installation. Ok, i'll mention simple ways to create Android apps with Eclipse.

1) Download Android SDK under following link

http://developer.android.com/sdk/index.html

[More]

Deploy Coldfusion Project in Google App Engine with OpenBD

This post is what I forgot to show how to deploy CFM project in Google App Engine with OpenBD. It's very simple to deploy but it would be touchy if you don't know the keypoint of using eclipse. The easiest way to deploy is using eclipse. That's why you need to download eclipse first. I don't know who using which type of eclipse version. But, I used Europa type of versing with J2EE. Please keep in mind that  Google App Engine only supports eclipse J2EE version.

Download Here http://www.eclipse.org/downloads/moreinfo/jee.php

[More]

Create Function in Oracle

I'm very new to Oracle because I'm start using Oracle when I reach here. When I was in Myanmar, our RDBMS is Microsoft SQL. In MsSQL, GUI is very simple and for example: if you need your ID as auto increment, set identity to true/yes in Ms.SQL properties. In Oracle, we need to create trigger for auto increment. Today, I feel like myself to create Function in Oracle for convert number format to Ordinal Format which I already created in CF UDF. Why I created the same Function in Orcale is because I want to generate report by using cfreport tag.

Here is my simple Function

view plain print about
1CREATE OR REPLACE Function ConvertOrdinal
2 --Input parameter from outside
3 ( cycle IN varchar2 )
4 RETURN varchar2
5IS
6 --Output parameter from function
7 ordinalformat varchar2(5);
8BEGIN
9 if ((mod(cycle,10) = 1) AND (mod(cycle,100) = 1))then
10 ordinalformat := 'st';
11 elsif
12 ((mod(cycle,10) = 2) AND (mod(cycle,100) = 2))then
13 ordinalformat := 'nd';
14 elsif
15 ((mod(cycle,10) = 3) AND (mod(cycle,100) = 3))then
16 ordinalformat := 'rd';
17 else
18 ordinalformat := 'th';
19 end if;
20RETURN cycle || ' ' || ordinalformat;
21
22EXCEPTION
23WHEN OTHERS THEN
24 raise_application_error(-20001,'An error was encountered - '||SQLCODE||' -ERROR- '||SQLERRM);
25END;

Execute this function in PL/SQL

view plain print about
1SELECT ConvertOrdinal('1') CO FROM DUAL
Output will display as follow
view plain print about
1CO
2====
31 st

Cursor attributes in Oracle

We need to know how cursor attributes work in Oracle when we gonna create Functions, Views and Procedures in Oracle. Cursor attributes in Oracle doesn't like MsSQL and it's quite different. There are four types of cursor attributes which are %ISOPEN, %FOUND, %NOTFOUND and %ROWCOUNT. Except %ROWCOUNT, the rest of three's return values are boolean (true/false) type.

%ISOPEN stands for whethere the cursor is open or not. If open then will return True. Unless it's False.

%FOUND stands for whether the records is found after being executed or not.

%NOTFOUND is opposite of %FOUND.

%ROWCOUNT stands for the number of records fetched.

Internationalized in CFMX with Cffunction

It's, creating internationalize in CFMX with cffunction.

common.cfm

view plain print about
1<cffunction name="udf_Translate" output="Yes" returntype="string" hint="reads and parses UTF-8 resource bundle per locale">
2    <cfargument name="Name" required="Yes" type="string" />
3    <cfargument name="Filename" required="Yes" type="string" />
4    <cfargument name="Section" required="No" type="string" />
5    <cfset currentPath = getCurrentTemplatePath() />
6    <cfset currentDirectory = getDirectoryFromPath(currentPath) />
7    <cfset local_file = currentDirectory &amp; Filename />
8    <cfset flag = 0 /> <cfset i = 0 />
9    <cfif FileExists(local_file)>
10        <cffile action="read" file="#local_file#" variable="resourceBundleFile" charset="utf-8">
11        <cfset Transalated = ArrayNew(2) />
12            <cfloop index="rbIndx" list="#resourceBundleFile#" delimiters="#chr(10)#">
13                <cfset i = i + 1 />
14                <cfset Orginal_word = listFirst(rbIndx,"=") />
15                <cfset Transalted_word = listRest(rbIndx,"=") />
16                <cfset Transalated[i][1] = Orginal_word />
17                <cfset Transalated[i][2] = Transalted_word />
18                <cfif ASC(Transalted_word) NEQ 13>
19     <cfset Transalated[i][2] = Transalted_word />
20                <cfelse>
21                    <cfset Transalated[i][2] = Transalated[i][1] />
22                </cfif>
23                <cfif Transalated[i][1] EQ Name>
24                    <cfset flag = 1 />
25                    <cfreturn Transalated[i][2] />
26                </cfif>
27            </cfloop>
28    </cfif>
29    <cfif flag EQ 0>
30        <cfreturn Name />
31    </cfif>
32</cffunction>

index.cfm

view plain print about
1<cfoutput>#udf_Translate("Sex", "INPATIENT_EL.properties", "")#</cfoutput>

Set radio value to parent form

Here is setting radio value from pop-up form to parent form.

JS script

view plain print about
1function getCheckedValue(radioObj) {
2    if(!radioObj) return "";
3    var radioLength = radioObj.length;
4    if(radioLength == undefined)
5        if(radioObj.checked)
6            window.opener.document.parent_form.txtRemark.value = radioObj.value;                 
7        else
8        return "";
9        
10        for(var i = 0; i < radioLength; i++) {
11            if(radioObj[i].checked) {
12                window.opener.document.parent_form.txtRemark.value = radioObj[i].value;
13                }
14            }
15    window.close();
16    return "";
17}

HTML

view plain print about
1<form name="myform"> <input type="Radio" name="myradio" value="1"> 1<br> <input type="Radio" name="myradio" value="2"> 2<br> <input type="Radio" name="myradio" value="3"> 3<br> <input type="Button" name="btnSelect" value="Select" onclick="getCheckedValue(document.forms['myform'].elements['myradio'])"></form>

Dynamically Create Rounded Button

My boss wants me to create rounded button with dynamically color generated by database. At that time, I was dilemma because I know, I couldn't crop rounded corner images with different color. Because, as I told above, these colors will come from database. So, I consider other ways and how to solve this problem. Eventually, I gotcha. Here is as follow:

StyleSheet

view plain print about
1<style>
2    span.left
3    {
4        background:#999999 url("rd_images/rounded_left.gif");
5        width:8px;
6        height:25px;
7    }
8    
9    span.center
10    {
11        background:#999999;
12        height:25px;
13        border-top:1px #000000 solid;
14        border-bottom:1px #000000 solid;
15        color:#ffffff;
16        text-align:center;
17        font-weight:bold;
18        font-family:arial;
19        padding:2px 0px 0px 0px;
20    }
21    
22    span.right
23    {
24        background:#999999 url("rd_images/rounded_right1.gif");
25        width:8px;
26        height:25px;
27    }
28</style>
HTML

view plain print about
1<span class="left"><span class="center">Caption<span class="right">

OUTPUT

output

Download rounded images : rounded_left rounded_right1

More Entries

Top of Page