Posted by Rahul on June 12, 2010 |
|
This may not be the perfect code for logging data to a custom file in coldfusion.
Any views/suggestions will be welcomed.
<!--- String List Of Variables --->
<cfparam name="attributes.var" default="" type="string">
<cfparam name="attributes.fileName" default="log.html">
<cfparam name="attributes.fileAction" default="write">
<cfparam name="attributes.unique" default="1">
<!--- Use Thread If Set To 1 --->
<cfparam name="attributes.thread" default="1">
<cfparam name="logDir" default="PathToLogDirectory" />
<cfif thisTag.ExecutionMode is 'start'>
<cfif val(attributes.thread)>
<cfthread action="run" name="mythread#randrange(1,1000)#" priority="NORMAL" attrcollection="#attributes#" >
<cfscript>
LogDetails(attrcollection);
</cfscript>
</cfthread>
<cfelse>
<cfscript>
LogDetails(attributes);
</cfscript>
</cfif>
</cfif>
<cffunction name="LogDetails" access="private" returntype="void">
<cfargument name="attrCollection" />
<cfset var dumpOutput="" />
<cfset var ts="" />
<cfsavecontent variable="dumpOutput">
<cfloop list="#attrCollection.var#" index="varName">
<cftry>
<cfdump var="#caller[varname]#" label="#varName#" />
<cfcatch type="any">
<cfoutput><br>Variable #varName# Not Found In Caller</cfoutput>
</cfcatch>
</cftry>
</cfloop>
</cfsavecontent>
<cfif val(attrCollection.unique)>
<cfscript>
ts = dateFormat(now(),'YYYYMMDD') & "-" & timeFormat(now(),'HHMMSS');
fName = ts & "-" & attrCollection.fileName;
</cfscript>
<cfelse>
<cfscript>fName = attrCollection.fileName;</cfscript>
</cfif>
<cfif listFindNoCase("write,append",attrCollection.fileAction)>
<cftry>
<cffile action="#attrCollection.fileAction#" file="#logDir##fName#" output="#dumpOutput#">
<cfcatch type="any">
<!--- File I/O Failed --->
</cfcatch>
</cftry>
</cfif>
</cffunction><cf_log var="a" filename="test.html" thread="1" />
Posted by Bharat Patel on June 11, 2010 |
|
Hello Friends,
Today, I wanted to list down all table from column name in sql server. Sql server stores all table, column, database or etc in it's own system table. So it's easy to fetch record from it. I have given example below how to list down table list from field name. Copy and paste below code and just pass column name in this query. I hope it is helpful for you and you may like it.
select sys.tables.name from sys.objects inner join sys.tables on sys.objects.object_id = sys.tables.object_id and sys.tables.type = 'U' inner join sys.columns on sys.tables.object_id = sys.columns.object_id where sys.columns.name = 'XYZ' order by sys.tables.name
Posted by Nirav Patel on June 08, 2010 |
|
If you do not want that someone links your web site within a frame, the following javascript code will enable you to prevent your web site from being framed.
Add the following code to your <body> tag:
<body onLoad="if (self != top) top.location = self.location">
Posted by Pradeep on June 05, 2010 |
|
An image is an array, or a matrix, of square pixels (picture elements) arranged in columns and rows.
In a (8-bit) grayscale image each picture element has an assigned intensity that ranges from 0 to 255. A grey scale image is what people normally call a black and white image, but the name emphasizes that such an image will also include many shades of grey.
A normal grayscale image has 8 bit color depth = 256 grayscales. A "true color" image has 24 bit color depth = 8 x 8 x 8 bits = 256 x 256 x 256 colors = ~16 million colors.
Some grayscale images have more grayscales, for instance 16 bit = 65536 grayscales. In principle three grayscale images can be combined to form an image with 281,474,976,710,656 grayscales.
There are two general groups of 'images': vector graphics (or line art) and bitmaps (pixel-based or 'images'). Some of the most common file formats are:
* GIF - an 8-bit (256 color), non-destructively compressed bitmap format. Mostly used for web. Have several sub-standards one of which is the animated GIF.
* JPEG - a very efficient (i.e. much information per byte) destructively compressed 24 bit (16 million colors’) bitmap format. Widely used, especially for web and Internet (bandwidth-limited).
* TIFF - the standard 24 bit publication bitmap format. Compresses non-destructively with, for instance, Lempel-Ziv-Welch (LZW) compression.
* PS - Postscript, a standard vector format. Has numerous sub-standards and can be difficult to transport across platforms and operating systems.
* PSD - a dedicated Photoshop format that keeps all the information in an image including all the layers.
Posted by Bharat Patel on June 02, 2010 |
|
Hello Friends,
jQuery supports adding attributes to collection of elements with Attr function. Previously if we wanted to add stylesheet then we had to apply CSS function similar to event handling. But jQuery 1.4 introduced new method for adding attributes, stylesheet, event handling , etc. There is no need to add attr, css, bind or etc function for handling the element. We can write directly with element. We can use old method also. Please refer below example for better understanding. I hope you may like this one. This one is shorthand method for adding attributes. You need to add jQuery 1.4 js in your page.
jQuery 1.4 New method for passing attributes
jQuery('body').append(
jQuery('<a />',{
id : 'first',
href : '#',
rel : 'external',
text : 'click here',
css:{
'text-decoration' : 'none',
'font-weight':'bold',
'font-size':'14px',
'color':'red'
},
click : function(){
window.location='http://www.isummation.com';
}
}));
Recent Comments