If you are receiving an Error with title "You have attempted to dereference a scalar variable of type class java.lang.String as a structure with members." then make sure that your struct variable is structure everywhere.
An easy way to test your variable's datatype is that you put #IsStruct(VariableName)# in few places above and below the error line to check if your variable is consistently a structure. It is possible that you have re-declared your variable somewhere else.
whizCOMPUTING
Thursday, December 16, 2010
ColdFusion: Function to create HMAC-SHA1 encrypted string
<cffunction name="hmacEncrypt" returntype="binary" access="public" output="false">
<cfargument name="signKey" type="string" required="true" /> <cfargument name="signMessage" type="string" required="true" />
<cfset var jMsg = JavaCast("string",arguments.signMessage).getBytes("ASCII") /> <cfset var jKey = JavaCast("string",arguments.signKey).getBytes("ASCII") />
<cfset var key = createObject("java","javax.crypto.spec.SecretKeySpec") /> <cfset var mac = createObject("java","javax.crypto.Mac") />
<cfset key = key.init(jKey,"HmacSHA1") />
<cfset mac = mac.getInstance(key.getAlgorithm()) /> <cfset mac.init(key) /> <cfset mac.update(jMsg) />
<cfreturn mac.doFinal() /> </cffunction>
ColdFusion: QueryString to Struct Converter
This function converts QueryString to Struct Data Type.
<cffunction name="QueryStringToStruct" output="false">
<cfargument name="QueryString" required="yes" type="string">
<cfset myStruct = StructNew()>
<cfloop list="#QueryString#" delimiters="&" index="i">
<cfset QueryStringParts = ListToArray(i, "=")>
<cfset structInsert(myStruct, Trim(QueryStringParts[1]),Trim(QueryStringParts[2]))>
</cfloop>
<cfreturn myStruct />
</cffunction>
<cffunction name="QueryStringToStruct" output="false">
<cfargument name="QueryString" required="yes" type="string">
<cfset myStruct = StructNew()>
<cfloop list="#QueryString#" delimiters="&" index="i">
<cfset QueryStringParts = ListToArray(i, "=")>
<cfset structInsert(myStruct, Trim(QueryStringParts[1]),Trim(QueryStringParts[2]))>
</cfloop>
<cfreturn myStruct />
</cffunction>
Monday, August 17, 2009
FileZilla: Can't parse "FileZilla.xml", the file may be corrupt
Note: deleting FileZilla will also delete all the saved sites from Site Manager.
Blogger: Wider Rounder Template
The Rounder Template for Blogger is very elegant looking and easy to modify. But many peoples like me thinks that width of template is not enough. To help myself and others, I designed 4 rounder templates with different widths.
- template-745px(500px).xml - Actual Width 745px, Post Area: 500px
- template-845px(600px).xml- Actual Width 845px, Post Area: 600px
- template-945px(700px).xml - Actual Width 945px, Post Area: 700px
- template-980px(725px).xml - Actual Width 980px, Post Area: 725px
Saturday, August 15, 2009
Modified version of FreeSans Font
Recently I designed a custom font which is actually a modified version of FreeSans. In this font characters are appearing white out of black with some extra glyphs. Here is the sample of that font.
You can download this font from here. You are free to use and distribute but don't forget to acknowledge :-)
ColdFusion - Check version of CF
To check which version of ColdFusion you have, following code can be used. This code is highly helpful when you have limited access to Control Panel or your hosting company do not reveals the version details.
<cfscript>
versinfo = arraynew(1);
versinfo[1] = structnew();
versinfo[1].name = "the base version, with no updater";
versinfo[1].number = 48097;
versinfo[2] = structnew();
versinfo[2].name = "Updater 1";
versinfo[2].number = 52311;
versinfo[3] = structnew();
versinfo[3].name = "Updater 2";
versinfo[3].number = 55693;
versinfo[4] = structnew();
versinfo[4].name = "Updater 3";
versinfo[4].number = 58500;
curversion = listlast(Server.ColdFusion.ProductVersion);
</cfscript>
<cfoutput>
<p>This server is running <b>#Server.ColdFusion.ProductName#, #server.coldfusion.ProductLevel#</b> <br />
#Server.ColdFusion.ProductVersion#
<br/>
<cfif left(Server.ColdFusion.ProductVersion,5) is "6,0,0">
<p>Which means it?s running with
<cfif server.coldfusion.appserver is "j2ee" and curversion is 58096>
Updater 3 on ColdFusion MX for J2EE.
<cfelse>
<cfloop from="1" to="#arraylen(versinfo)#" index="i">
<cfif curversion eq versinfo[i].number>
<b>#versinfo[i].name#</b>.
<cfbreak>
<cfelseif curversion lt versinfo[i].number>
<b>patches not yet up to the final release of
#versinfo[i].name#</b>
<cfbreak>
<cfelseif i is arraylen(versinfo)>
a version <b>greater than the final release of
#versinfo[arraylen(versinfo)].name#</b>.
This tool has not been updated yet to recognise that
version number.
</cfif>
</cfloop>
</cfif>
<cfelse>
</cfif>
</cfoutput>
<cfscript>
versinfo = arraynew(1);
versinfo[1] = structnew();
versinfo[1].name = "the base version, with no updater";
versinfo[1].number = 48097;
versinfo[2] = structnew();
versinfo[2].name = "Updater 1";
versinfo[2].number = 52311;
versinfo[3] = structnew();
versinfo[3].name = "Updater 2";
versinfo[3].number = 55693;
versinfo[4] = structnew();
versinfo[4].name = "Updater 3";
versinfo[4].number = 58500;
curversion = listlast(Server.ColdFusion.ProductVersion);
</cfscript>
<cfoutput>
<p>This server is running <b>#Server.ColdFusion.ProductName#, #server.coldfusion.ProductLevel#</b> <br />
#Server.ColdFusion.ProductVersion#
<br/>
<cfif left(Server.ColdFusion.ProductVersion,5) is "6,0,0">
<p>Which means it?s running with
<cfif server.coldfusion.appserver is "j2ee" and curversion is 58096>
Updater 3 on ColdFusion MX for J2EE.
<cfelse>
<cfloop from="1" to="#arraylen(versinfo)#" index="i">
<cfif curversion eq versinfo[i].number>
<b>#versinfo[i].name#</b>.
<cfbreak>
<cfelseif curversion lt versinfo[i].number>
<b>patches not yet up to the final release of
#versinfo[i].name#</b>
<cfbreak>
<cfelseif i is arraylen(versinfo)>
a version <b>greater than the final release of
#versinfo[arraylen(versinfo)].name#</b>.
This tool has not been updated yet to recognise that
version number.
</cfif>
</cfloop>
</cfif>
<cfelse>
</cfif>
</cfoutput>
Subscribe to:
Posts (Atom)