Entries for month: May 2010

New ColdFusion 9 Feature: CFMAP

Posted by Naresh Patel on May 29, 2010
  0 comments

Hello Friends,

One of our projects had a requirement for displaying a google map on one the webpages.
There are three options for setting google map key for your application.

1) You can use the cfajaximport tag and specify the map API key in the params attribute as follows :

<cfajaximport params="#{googlemapkey='Your Google Map Key Here'}#"/>

2) You can set googleMapKey in Application.cfc as follows:

<cfset this.googlemapkey="Your Google Map Key Here">

3) You can use the Settings page in the ColdFusion Administrator. Specify the map API key in the Google Map Key field.

Now you know that how to get started using maps, you’re ready to see examples. I have set up the API key in the application.cfc file. To get started all you need to know the street address or a longitude and latitude. In the below given example we are using the address for iSummation Technologies Pvt. Ltd. 304, Shapath-3 Bodakdev, Ahmedabad.
The following two lines of code will produce the same result.

<cfmap centeraddress="iSummation Technologies Pvt. Ltd. 304, Shapath-3 Bodakdev, Ahmedabad"/>
<cfmap centerlatitude="23.04039" centerlongitude="72.51605" />
 
 
When the user clicks on the marker, Generally you want to display more information about the location.
You can display this information statically by using the markerwindowcontent attribute or dynamically by using the markerbind attribute.



<cfsavecontent variable="content">
<strong>iSummation Technologies Pvt. Ltd</strong><br/>
304, Shapath-3<br/>
Ahmedabad, Gujarat 380054 <br/>
079 2685 3054<br/><br/>
<a href="http://www.isummation.com">iSummation.com</a>
</cfsavecontent>
<cfmap name="CFMAP" 
centeraddress="iSummation Technologies Pvt. Ltd. 304, Shapath-3 Bodakdev, Ahmedabad" 
height="500" width="700"
hideborder="false" zoomlevel="12"
collapsible="true"
title="iSummation Technology" markerwindowContent="#content#"/>


Please refer below screen shot.

cfmap

More : Adobe Article




jQuery code and syntax guidelines for improved code performance

Posted by Nirav Patel on May 28, 2010
  0 comments

If you want to publish your jQuery plugins following jQuery core code writing guidelines is a good idea. Here is the some of the guidelines.

  • Do NOT append an element to the DOM in your loop.
  • Don't use string concatenation, instead use array's join() method for a very long strings.
  • Don't use "string".match() for RegExp, instead use .test() or .exec()
  • Local variables are declared and initialized on one line just below the function declaration with no extra line:
  • All strings are in double quotes " ", not single quotes ' ':
  • The last but not least, variable naming uses camelCase.

See more details




Popular Video Container Formats

Posted by Pradeep on May 28, 2010
  0 comments

There are several of video container formats used  on the web. Some of the most popular one's are;




jQuery new event! focusin and focusout

Posted by Bharat Patel on May 28, 2010
  0 comments

Hello Friends,

To delegate the "focus" and "blur" events you must use these new events, called "focusin" and "focusout". You can also use old events for handling focusing events in jQuery 14.

Syntax

jQuery(element).focusin(handler);
jQuery(element).focusout(handler);

Example

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
    <head>
        <script type="text/javascript" language="javascript" src="jquery-1.4.2.min.js"></script>
        <script>
            jQuery(function(){
                jQuery('#focus').focusin(function(){
                    jQuery(this).addClass('focused').val('Focus In');
                });
                jQuery('#focus').focusout(function(){
                    jQuery(this).removeClass('focused').val('Focus Out');
                });
            });    
        </script>
        <style>
            .focused{
                background-color : #00f0ff;
            }
        </style>
    </head>
    <body>
        <input type="text" name="focus" id="focus" />
    </body>
</html>

DEMO




Implicit Getters/Setters

Posted by Rahul on May 22, 2010
  0 comments

Adobe ColdFusion 9 Supports Implicit Setters/Getters for Components.




The Advantages of HTML5 over Flash

Posted by Pradeep on May 22, 2010
  0 comments

Hello, in this article I will explain to you the advantages of HTML5 over flash. As everyone knows, flash is owned by Abode and is freely available. HTML5 is a new open source platform created by many developers. Apple seems to be in favor of HTML5 since it runs better on their computers and mobile devices. Will other companies soon follow?




Virtual Fix Table Header JQuery

Posted by Bharat Patel on May 15, 2010
  0 comments

Hello Friends,

There are so many ways to fix table header. We can fix table header row and rest of content of table will have overflow scroll css set  so that a scroll bar appears if page content is higher than page size. We have developed virtual fix table header jQuery plugins. It will copy table header automatically. The TABLE TR ,for which we want to fix position,should have an id specified. Have a look at the code for better understanding. I hope you may like it.

<table>
    <tr id="fixHeader">
        <td>No</td>
        <td>Name</td>
        ................
    </tr>
    <tr>
        <td>No</td>
        <td>Name</td>
        ................
    </tr>
    <tr>
        <td>No</td>
        <td>Name</td>
        ................
    </tr>
    ................
</table>

After creating table you need to call jVirtualFixHeader plugin on jquery onload function. The code looks like this;

jQuery(function(){
    jQuery('#fixHeader').jVirtualFixHeader();
});

Demo Download




Loop Over A Structure Using CFScript

Posted by Rahul on May 14, 2010
  0 comments

Loop Over A Structure Using CFScript




Temporary Table and Table Variables in SQL Server

Posted by Nirav Patel on May 11, 2010
  0 comments

Temporary Table

    The following code demonstrates how to create a temporary table.
    Syntax :  

            CREATE TABLE #TempEmployee
            (
                employeeID int,
                employeeName varchar(100)
            );
        

  • This table is automatically dropped when the connection session is closed.

  • Foreign key relations cannot be applied to temp tables.

  • Optionally you may drop the table at the end of its use. It is a good practice to drop any temporary table after use.

  • When you create a temporary table it will be created in tempdb. At the time of table creation the tempdb is locked and hence there is some overhead involved using this.

 

Table Variables

       In SQL Server 2000 or higher, one can take advantage of the new TABLE variable type. These are similar to temporary tables except with more flexibility and they always stay in memory.
    The syntax to define a table variable is as follows:

    Syntax :     

           DECLARE TABLE @TempEmployee
            (
                employeeID int,
                employeeName varchar(100)
            );
        

  • Querying table variables is very fast as there are no disk reads needed.

  • Table variables cannot be dropped as they are automatically removed when they are out of scope

  • All the data in table variables is stored in server’s memory. So if there is huge data then it is not recommended to use table variables to avoid memory overhead.

      Note : If you have less than 100 rows generally use a table variable. Otherwise use a temporary table. This is because SQL Server won’t create statistics on table variables.

      More :
      MDSN blog article: http://blogs.msdn.com/sqlserverstorageengine/archive/2008/03/30/sql-server-table-variable-vs-local-temporary-table.aspx




ColdFusion wrapper for jQuery autocomplete.

Posted by Pritesh on May 08, 2010
  0 comments

For one of my project I required autocomplete box. I know coldfusion has its own autocomplete but has lots of limitation. I wanted autocomplete to work like select box of html, display lable of product in list but in backend it will return ID for that product and as usual I just stop at jQuery-ui Autocomplete (I just love jquery) which allow good customization.
This coldfusion wrapper allow you to use jqury autocomplete with coldfusion query variables or loading data remotely.

Example:

<cf_autocomplete
textFieldName="productName" textFieldValue="" textFieldBind="PRODUCTNAME"
idFieldName="productId" idFieldBind = "PRODUCTID"
datasource="/cfc/products.cfc?method=getActiveProduct&returnFormat=JSON"
fieldList="PRODUCTID,PRODUCTNAME,PRICE"
queryParam="product" 
displayTemplate="<div><img src=""/images/{PRODUCTID}.gif"">{PRODUCTNAME}&nbsp;: {PRICE}" 
minlength=2 />