Scripting Language, JavaScript, AJAXMay 7, 2009 5:46 am

These three famous Javascript frameworks are certainly in the top list of every web developer. They are a proven help in developing dynamic and creative web portals. Without their birth, how in the earth “google” could produce a fanstatic portal such as “igoogle” ( hhmmmm have you thought of it? ).

Now, if you are just starting to explore the usage and advantages of either of these frameworks, let me give you a little hint of the best tool to use in your application (*wink).

Advantages …

1. AJAX Function

All of these frameworks enable you to deal with AJAX with ease and they are also cross-browser compliant. Besides simple requests, they also provide various ways to handle the response from the server, either through XML, JSON or plain text. My advise here, if you only need a way to use AJAX functions and customized UIs is not a concern, use the primitive framework – prototype. Prototype is the best tool to use as it is just a one file function compared to the other two customized, bulky in size frameworks, and if you are the type of developer who codes their way to customize, prototype is the most flexible.

Sample Code

new Ajax.Request('your_url’,
  {
    method:'get',
    onSuccess: function(transport){
      var response = transport.responseText || \"no response text\";
      alert(\"Success! \n\n\" + response);
    },
    onFailure: function(){ alert('Something went wrong...') }
  });

Expandable Code

new Ajax.Request('your_url’,
  {
    method:'get',
    onSuccess: transport,
    onFailure: doError
  });

Functions “transport” and “doError” must be declared somewhere in your code. This way, codes are more flexible and expandable. Do something like this

function transport (x) {
          loadXML( x.responseText );
         …
}

2. Widgets

Script.aculo.us and Dojo are add-on libraries to the Prototype framework primarily for visual effects and interface behaviors. Several widgets, DOM utilities, and animations can be found here. These are actually the highlights of the outset of prototype where group of individuals created and customized the prototype framework to produce dynamic and ready to use widgets.

You can find various component animations in Script.aculo.us such as different effect combination, draggable objects, movie effect and etc. Click here for more reference and see their DEMOs.

To date, DOJO seems to be most useful for corporate websites. It can cater large dataset to be turned into a displayable grid without performance penalty. It also has the most wanted charting utility for your reports. It is fully internationalized, DOJO comes with translations supporting over 100 languages, even scripts like Arabic and Hebrew.

The latest tools I have used in DOJO are the TAB enabled div, drag and drop, and the package loading. All these helped me developed the site I wanted. Here are some sample screenshots and codes.

dojotab

The code

<div  dojoType=\"dijit.layout.TabContainer\" refreshOnShow=\"true\" style=\"height:450px;\">
<div dojoType=\"dijit.layout.ContentPane\" title=\"Equipment Registration\">…</div>
<div dojoType=\"dijit.layout.ContentPane\" title=\"Equipment Update\"> … </div>
<div dojoType=\"dijit.layout.ContentPane\" title=\"Configure\"> … </div>
</div>
 

draggable

Refer to the official DOJO site for more codes and demos.

I hope this post helped you somehow.

Oracle, DatabaseFebruary 24, 2009 7:33 am

You can select list of tables from all the different schemas in your oracle database, here’s how

SELECT all_tables FROM all_tab_columns;

or get all the table details

SELECT * FROM all_tab_columns;
Oracle, DatabaseJanuary 21, 2009 3:07 am

Here are some helpful tips to remember when dealing with oracle.

I. Use the “flashback technology” when you accidentally commit a mistake with your production data.
(altering entire table contents, corrupted table data, or worst dropping unintended table).

- First thing to do is to enable flashback on your database.

ALTER DATABASE FLASHBACK ON;

- Restoring database to its good state.

FLASHBACK DATABASE TO RESTORE POINT bef_damage;

- Restoring dropped table.

FLASHBACK TABLE [TABLE_NAME] TO BEFORE DROP;

- Restoring table to its good state.

FLASHBACK TABLE [TABLE_NAME] TO TIMESTAMP TO_TIMESTAMP('[DATE_TIME]');

II. Manipulate date and time display
Aside from to_date and to_timestamp functions , you could also alter the date and time display in your database through the use of this code below.

ALTER SESSION SET NLS_DATE_FORMAT = '[DATE_FORMAT]'
Oracle, DatabaseJanuary 14, 2009 5:44 am

Split, Join and DateDiff are just few Oracle functions that can aid you in data manipulation.

Function Definition

Split - split a result by “character specified (by default, comma)”
into multiple results.

e.g. “A,B,C” –> results 3 records of “A”,”B”, and “C”.

Join - join multiple records into one result by
“character specified (by default, comma)”.

e.g. “1″,”2″,”3″ –> results 1 record of “1,2,3″.

DateDiff - Differentiate two dates.

Function Code

create or replace function split(
          p_list varchar2,
          p_del varchar2 := ','
) return split_tbl pipelined
           is
          l_idx    pls_integer;
          l_list   varchar2(32767) := p_list;
          l_value  varchar2(32767);
    begin
          loop
          l_idx := instr(l_list,p_del);
          if l_idx > 0 then
             pipe row(substr(l_list,1,l_idx-1));
             l_list := substr(l_list,l_idx+length(p_del));
          else
             pipe row(l_list);
             exit;
          end if;
        end loop;
     return;
 end split;
create or replace function join
 (
       p_cursor sys_refcursor,
       p_del varchar2 := ','
)  return varchar2
      is
          l_value   varchar2(32767);
          l_result  varchar2(32767);
     begin
        loop
             fetch p_cursor into l_value;
               exit when p_cursor%notfound;
           if l_result is not null then
                l_result := l_result || p_del;
           end if;
               l_result := l_result || l_value;
        end loop;
      return l_result;
end join;
create or replace function datediff( p_what in varchar2,
      p_d1   in date,
      p_d2   in date ) return number
   as
       l_result    number;
   begin
        select (p_d2-p_d1) * decode( upper(p_what),  'SS', 24*60*60, 'MI', 24*60, 'HH', 24, NULL )  into l_result from dual;
	
return l_result;
end;
* Note : To use the split and join function, you must execute this code.
create or replace type split_tbl as table of varchar2(32767)

UncategorizedJanuary 9, 2009 8:26 am

This blog is active again with a fresh start, after i had trashed my previous blog i had come to my senses to re-create, focusing on technical and educational post and not mixing any petty stuffs. I am hoping to aid knowledge seekers specially students who need guide to do their homework. I will basically post all my technical experiences in IT and i am welcome for inquiries if my posts are not sufficient and need further explanations.

I am not trying to be so diplomatic :) , in truth , i wish to keep my knowledge where i could access it online which will serve as a repertoire of all new and old techie things in IT. In turn it will refresh my memory every time i will visit my blog or if i need to re-use techniques, i do not have a good memory :) i admit :) .

Cheers for my blog! Keep blogging! :D

My RefuGe

↑ Grab this Headline Animator