Usage of cursor and non-cursor in Oracle

Today I oddly found the different between using non-cursor and cursor in Oracle. Generally, using these two usages are same but kind of different memory usage and error handling.

Advantage and disadvantage Of Cursor

Using so many cursors in stored procedures, functions and views can be high memory usage in Server. Because every cursors take individual space in memory while creating and processing. If return value is NULL from this cursor, Oracle will not throw error message to application.

Example coding of using cursor

view plain print about
1CREATE OR REPLACE PROCEDURE PPS_TEST
2 (P_PERSON_ID IN NUMBER)
3IS
4 L_MENU VARCHAR2(50);
5 L_ERR_MSG VARCHAR2(200);
6
7 CURSOR C_PP (P_PERSON_ID NUMBER) IS
8 SELECT NAME FROM PERSON
9 WHERE PERSON_ID = P_PERSON_ID;
10
11BEGIN
12 OPEN C_PP(P_PERSON_ID);
13 FETCH C_PP INTO L_MENU;
14 CLOSE C_PP;
15EXCEPTION
16    WHEN OTHERS THEN
17     L_ERR_MSG := SQLERRM;
18        RAISE_APPLICATION_ERROR(-20000, L_ERR_MSG);
19END;

[More]

FileExists vs IsImage in Coldfusion

Today, I'm very clear to know how to use FileExists and IsImage in coldfusion. Before time, I though these two tags working in the same boat but once I used these two, both are very different but slightly same.

What's the slightly same? It's very simple that we're not using the full path of file like that.

view plain print about
1<!--- Checking image --->
2<cfif FileExists("image.jpg")>
3    Image exists.
4<cfelse>
5    Image doesn't exist.
6</cfif>
7
8<!--- Checking file --->
9<cfif FileExists("myfile.txt")>
10    File exists.
11<cfelse>
12    File doesn't exist.
13</cfif>

If we're using the full path of image/file, FileExists doesn't work at all. At that time, we need to use IsImage for checking image exist or not.

view plain print about
1<!--- Checking Image with full path --->
2<cfif IsImage("http://www.ppshein.net/images/ppshein_banner.jpg")>
3    Image exists.
4<cfelse>
5    Image doesn't exist.
6</cfif>

Because, FileExists can check the directory of image/file and cannot check the full path URL of image/file. In this case, we need to use IsImage for checking image exists or valid type of image.

Sorry, I really missed out IsImageFile function of coldfusion which can support to check whether an image file is valid. Thanks, Ray for commenting about that.

Funny usage of CFImage within CFTry/CFCatch

Last Friday, my boss told me that I need to cooperate my module into other team's huge project called HIS (Hospital Information System) about displaying patient's photograph. That's why I needed to review their existing coding and needed to know the image path (directory). In this coding, I've found the following funny usage about cfimage within cftry/cfcatch.

view plain print about
1<cftry>
2    <cfimage
3        action = "info"
4        source = "#image_dir_path##myimage#"
5        structname = "my_img">

6    <cfcatch>
7        <cfset error_msg = "#cfcatch.message#">
8    </cfcatch>
9</cftry>

If I'm not mistaken, the purpose of above coding is the error message will be shown if no image found. As my experience, don't need to use cfimage, cftry, cfcatch tags if we need to check whether the image is existed or not. Just simple to use FileExists. It's very useful and don't need to write that much coding like above.

Here is very simple and useful for checking file/image exists or not.

view plain print about
1<cfif NOT FileExists("#image_dir_path##myimage#")>
2    <cfset error_message = "Image file doesn't exist.">
3</cfif>

Change jQueryMobile default selected value in select box

Today what I've successfully done is I can change the color of default selected value in select box with jQueryMobile. Frankly, this feature is missing in jQueryMobile because nobody can obviously know whether any value is selected in select box or not. Because they missed out to let users know about it. That's why I need to add the customize function of myself.

First of all, we need to search the following coding in jquerymobile javascript.

view plain print about
1selectedIndex = select[0].selectedIndex == -1 ? 0 : select[0].selectedIndex,

Then, we need to add the following customize coding after that,

[More]

Change jQueryMobile Select Box active style color in iPad safari

Today, I'm very happy that I can change jQueryMobile select Box active style color in iPad safari. Because, current active style ".ui-btn-active" is 100% working for other inputs like text, radio and checkbox but for select box, it doesn't completely work in iPad safari. My boss told me that I need to change all of active input color to "dark blue" instead of default color. That's why I need to change and already played in existing jQueryMobile stylesheet file. But it doesn't work at all. That's why I think I need to hack jQueryMobile existing javascript. After 30 minutes, I found that there are three places I need to change in jQueryMobile existing stylesheet.

The first part is I need to add new class name for active select box in stylesheet.

view plain print about
1.ui-select-active {color:#0000a0; text-shadow: 0 -1px 1px #ffffff;}

[More]

How to make square shape button in jQueryMobile

As I mentioned in my older posts, I'm really on web-based mobile tablet project for our existing project. Honestly, this web-based mobile tablet project is our first mobile project for our company. That's why all of requirements are so high and trying to got impressive from our clients. Among them, they urged me to create square shape button in jQueryMobile instead of existing them. As we all know, the existing stylesheet coding of jQueryMobile is very unit, thick and complex and if you change something in it, the impact will be so high. That's why I don't want to change anything in it except theme creating but they want square shape so no choice.

So, I've changed the following coding like that.

view plain print about
1<!--- line 1413 --->
2
3.ui-btn-inner {
4    padding: 2em;
5    display: block;
6    height: 100%;
7    text-overflow: ellipsis;
8    overflow: hidden;
9    white-space: nowrap;
10    position: relative;
11}

After changing it so and rendered it, I've got the odd outcome. Please see the image. Because it changes to all of input like drop down, checkbox and radio.

[More]

Useful Tools, Template and Design for iPad and iPhone

In these days, I'm on developing web based Mobile Tablet project for especially iPad. That's why I need more information about iPad such as framework, template and Design for coming out nice GUI design. For actually development, I've used jQueryMobile of course because it's kinda flexiable and reliable. But I gotta know which other else framework and template are avaliable for web mobile development. For that case, I've found this website http://webdesignledger.com has a lot of information for iPhone and iPad development articles. Among them, I'd love to read the following three articles for iPad development.

http://webdesignledger.com/freebies/11-ui-kits-for-iphone-and-ipad-development

http://webdesignledger.com/tools/10-best-ipad-apps-for-web-designers

http://webdesignledger.com/inspiration/30-inspiring-ipad-app-websites

Hope above three articles will be useful for someone who is trying to implement Web Tablet Development like me.

Simple jQueryMobile Keypad

Currently, I'm on web based mobile project for our current project. That's why I've developed this project with jQueryMobile framework because it's very simple and reliable to use for developers like us. In jQueryMobile, almost features are cool like calendar plugin, date plugin, etc. For me, keypad plugin is missing and I feel isn't not urgently needed because we can use mobile phone keypad as well. Unfortunately, my senior urged me to add KeyPad feature in our project. That's why I'm about to develop it by my own.

First of all, I need to write following coding in index.cfm.

view plain print about
1<label>Enter Phone Number</label>
2<!--- store current DOM --->
3<input type="hidden" name="currentDOM" id="currentDOM">
4<input type="text" name="phone" data-inline="true" id="phone" maxlength="8" /></td>
5<a href="keypad.html"
6    data-role="button"
7    onclick="setFocus('phone')"
8    data-iconpos="notext"
9    data-inline="true"
10    data-rel="dialog"
11    data-transition="pop"
12    data-icon="gear">
&nbsp;</a>

[More]

Increase the width of select box in jQueryMobile

Currently, I'm on web based mobile project by using jQueryMobile framework. As I already mentioned in my previous posts, jQueryMobile is really awesome and very simple to develop web based mobile project for even user-level developers. But, we cannot easily change the built-in theme of their existing style. Because all of infrastructure of existing styles are transformed by javascript coding of jQuery and styling with CSS a little after.

Today, I was on trouble about the width and display style of select box in jQueryMobile. Oddly, the width is neither 100% nor 50% and seems display style is Block type. That's why I cannot put horizontally two select boxes within in the same DIV. That's why I feel I need to change any coding in stylesheet of jQueryMobile. So open jQueryMobile stylesheet and changed the following two coding for the sake of my project.

[More]

Create List String in Oracle

Create list string in Coldfusion is very simple. We just use ValueList function of Coldfusion. What we can do it in Oracle? As we all know, there are a lot of built-in functions in Oracle and new more functions are including whenever upgrading Oracle version. Being not DBA (database administrator), I cannot know how many built-in functions are in Oracle and how many new functions are added into each version.

Today, I need to create list string in Oracle. My first though, I would search built-in function like ValueList in Oracle. As my though, I've search again and again but have no result at all. That's why, I decided myself to create new function for creating list string as follow:

[More]

More Entries

Top of Page