Rip's Domain

IE7 + Bluecoat firewall no worky

Posted in Networking, TechSupport by rip747 on October 19, 2006

Quick note: If you’re using a Bluecoat firewall for your corporations firewall and just installed IE7, you’re in for a surprise: You will not be able to get out onto the internet. This is a problem with the Bluecoat firmware and at this time there is no update available. Keep checking Bluecoat’s site for an update

Advertisements

BaseCFC: sharing some code

Posted in ColdFusion by rip747 on October 18, 2006

Just my stupid little contribution.

During development you can retype alot of code creating classes. This is a little class file I created that I can extend to stop me from going crazy. Basically all it does it is automatically create the setters and getters methods for all variables that I setup in the constructor. Use it if you will and tell me what I can do to make it better.

Above have a good laugh at the way I code 😛
<!— BaseCFC.cfc —>
<cfcomponent hint=”Base CFC model that all cfcs should extend” output=”false”>

<!— settings up the base constructor —>
<cfset variables.instance = StructNew()>

<!— init —>
<cffunction name=”init” access=”public” returntype=”Any” output=”false”
hint=”default init method. Will return any. should be overloaded by the inheriting CFC”>
<cfreturn this>
</cffunction>

<!— getInstance —>
<cffunction name=”getInstance” access=”public” returntype=”struct” output=”false”
hint=”default method that will return all the variables in the constructor”>
<cfreturn variables.instance>
</cffunction>

<!— get —>
<cffunction name=”get” access=”public” returntype=”Any” output=”false”
hint=”gets the value from the constructor”>
<cfargument name=”key” type=”any” required=”true” hint=”the variable to get”>
<cfif ConstructorVarExists(arguments.key)>
<cfreturn variables.instance[arguments.key]>
</cfif>
<cfset Local.MetaData = GetMetaData(this)>
<cfthrow type=”Custom”
errorcode=”BaseCFC.Constructor.Get”
message=”the property does not exist inside the object (#Local.MetaData[‘name’]#).”
detail=”Can’t find the key ‘#arguments.key#’ in the property structure. Are you sure you spelled the key correctly? Valid keys are: #ListSort(StructKeyList(this.getInstance(), ‘, ‘), ‘textnocase’)#”>
</cffunction>

<!— set —>
<cffunction name=”set” access=”public” returntype=”void” output=”false”
hint=”sets the value in the constructor”>
<cfargument name=”key” type=”any” required=”true” hint=”the variable’s to set”>
<cfargument name=”value” type=”Any” required=”true” hint=”the value to set the variable to”>
<cfset var Local = StructNew()>
<cfif NOT ConstructorVarExists(arguments.key)>
<cfset Local.MetaData = GetMetaData(this)>
<cfthrow type=”Custom”
errorcode=”BaseCFC.Constructor.Set”
message=”the property does not exist inside the object (#Local.MetaData[‘name’]#).”
detail=”Can’t find the key ‘#arguments.key#’ in the property structure. Are you sure you spelled the key correctly? Valid keys are: #ListSort(StructKeyList(this.getInstance(), ‘, ‘), ‘textnocase’)#”>
</cfif>
<cfset variables.instance[arguments.key] = arguments.value>
</cffunction>

<!— ConstructorVarExists —>
<cffunction name=”ConstructorVarExists” access=”private” returntype=”boolean” output=”false”
hint=”tells whether the variable is part of the constructor variable.”>
<cfargument name=”key” type=”string” required=”true” hint=”the variable name to check”>
<cfreturn StructKeyExists(variables.instance, arguments.key)>
</cffunction>

</cfcomponent>

How to use:

<!— Event.cfc —>
<cfcomponent output=”false” extends=”BaseCFC”>

<cfset variables.instance.eventid = “”>
<cfset variables.instance.cancelled = “0”>
<cfset variables.instance.type = “T”>

</cfcomponent>

JQuery Magazine Released

Posted in ColdFusion, Jquery by rip747 on October 17, 2006

If you haven’t heard of JQuery yet, you’re living in a hole. I’m been using it for the last 3 months and I must say that I’m hooked. I’ve begun converting ever piece of Javascript I write into it. What makes JQuery stand out for me and choosen over Dojo, Prototype or Moo.fx? Documentation baby! There is so much documentation and support in the JQuery community that you can always find the answers you need. Plus the awesome way you can write plugins, I can go on and on. Anyway, there is now a JQuery magazine for your reveiwing pleasure.

Let me know if you use JQuery in your developement and if not, tell me what framework you use.

Don’t use SELECT when you mean SET

Posted in ColdFusion, SQL by rip747 on October 5, 2006

This is just a pet pev of mine that I’ve seen about 95% of people do when writing MSSQL stored procedures

CREATE PROCEDURE myproc
AS
SET NOCOUNT ON
DECLARE @i int
SELECT @i = DATEPART(hh,GETDATE())
RETURN @i
SET NOCOUNT OFF
GO

There is nothing wrong with the above SP, it will compile and run just fine. The problem I have with it is using the SELECT keyword to set a variable when the SET keyword will work just fine. Not only that, but you don’t have to remember to use SET NOCOUNT ON declaration. So here is the same SP using the SET keyword

CREATE PROCEDURE myproc
AS
DECLARE @i int
SET @i = DATEPART(hh,GETDATE())
RETURN @i
GO

A lot less typing, cleaner looking and easier to read if you ask me.

IsValid weirdness

Posted in ColdFusion by rip747 on October 1, 2006

Ok this has been stumping the crap out of me for quite some time and I’m wondering if anyone else has seen this problem.

It all has to do with IsValid() and using the “integer” validation. From my understanding an “integer” means a whole number and “numeric” means a float (has decimal places in it). With that said, I have an init() method that look like this:

<cffunction name=”init” access=”public” returntype=”ProgramAd” output=”false”>
<cfargument name=”id” type=”string” required=”true”>
<cfif IsValid(“integer”, arguments.id)>
<cfset ReadObj(arguments.id)>
</cfif>
<cfreturn this>
</cffunction>

Basically I pass in a string and if it’s a valid integer it will create the object and load the information in. If it isn’t, it just return a created object to me. Pretty basic stuff. Well here’s the kicker, when a pass in the value of “24” to the init() method from another CFC’s method, it won’t run the ReadObj() method. BUT if I change the IsValid() to “numeric” it works. Everything works cool if I try to create the object directly from a unit test template I have. I can’t figure this out and I’m wondering if anyone else has run into this. The real wacky thing is that I have this exact init() method in other CFCs and it works fine.

Anyone have an answer to this?

UPDATE:

I did some searching around the net and found a post by Ray which describes a bug found in IsValid() ‘s “integer” validation. The thing is, the post is from July 2005, so you think that this would be fixed by now. Thanks again Adobe.