Posts

ColdFusion Issue: Resource interpreted as stylesheet but transferred with MIME type text/html

Image
Got an issue after setting up the local site, images are not displaying properly in the UI. The reason is the style sheets are interpreted as HTML doc.  These are steps to fix the same. Start>Run>appwiz.cpl>Click Turn Windows Feature on >Check static content under Common HTTP features

ColdFusion code to get current Domain

Below simple function can be used to find the current domain, by calling this wherever required. <cffunction name="GetCurrentDomain" access="public" output="false" returntype="string"        hint="Get Current Domain">                  <cfset domain="" />          <cfset proto ="http" />          <cfif CompareNoCase(CGI.HTTPS , 'on') EQ 0>               <cfset proto = "https" />          </cfif>          <cfset domain = proto&'://'&CGI.server_name&'/' />         <cfreturn domain /> /cffunction>

How to remove password from a PDF Document

Well, this is something which help you in usual days. If you want to save a PDF document which is password protected, you can try this simple steps. You just need Google Chrome browser in your system for this. 1. Open the PDF document by giving the password in Chrome. For this Open the Chrome browser first and open the PDF in it by pressing CTRL+O . 2. After the PDF is opened, you can just give print option by pressing CTRL+P 3. In the print page, just click on the change button on the left hand side. 4. When the new window comes, just select Save as PDF option and now you can save it anywhere and can be opened without password anymore.

Jquery: replace character of select drop down values with other

below code snippet can be used to replace "-"  of select drop down values with ",". JQuery('#sel_test option:contains ("-")).each function(index,option)    {       var sval = JQuery(option).val().replace(/\-/g,",");       JQuery(option).val(sval);       JQuery(option).html(sval);     }

Jquery: how to validate time format HH:MM

There are many ways to validate HH:MM format. Below function also can be used to validate HH:MM format. function ValidateTime(value) {   var timepattern = /^([0-9]|0[0-9]|1[0-9]|2[0-3]):[0-5][0-9]$/;   if (value.match(timepattern ))     {        return true;     }  return false; }

how to validate UUID or transaction number format in ColdFusion

Below code can be used to validate a UUID format or a transaction number format in ColdFusion <cfset test=ReMatchNoCase('[a-z0-9{8}-[a-z0-9]{4}-[a-z0-9]{4}-[a-z0-9]{12}',value) />

ColdFusion isvalid for dd/mm/yyyy format

below isvalid code can be used for validating date with dd/mm/yyyy format <cfoutput>#isvalid("regex"," 02/28/2015","^(0[1-9]|[12][0- 9]|3[01])[- /.](0[1-9]|1[012])[- /.](19|20)\d\d$")#</cfoutput>