Monday, March 31, 2008

I'm no longer "Spam"

So, for some crazy reason my blog was flagged by Blogger as a "spam blog". I am not sure if that is because people were flagging it maliciously or what but after about a week of waiting (from the time I asked blogger to review) I received an email today telling me my blog is, in fact, NOT a spam blog. Hooray!

You may be wondering how I knew my blog was identified by blogger as a spam blog. Well, prior to today for about the past six months-year I have had to fill out a captcha just to post to my own blog. I had thought this captcha was just a side-effect to me demanding captcha's on all comments people leave on the blog because it seemed to appear pretty closely to when I turned on that feature. However, there was a little text link beside the captcha that said "why am I seeing this" which I have always ignored. Curiosity piqued the other day though and I clicked it and found out I was considered a spam blog. Fortunately it was an easy, albeit slow, process for getting my blog's name cleared.

Friday, March 28, 2008

Flock - I tried ye and ye failed

Well, I tried Flock again. I gave it a full week of dedicated usage and while I see a lot of potential it still isn't ready for me as my primary browser. Perhaps once Firefox 3 comes out and then Flock is based on it Flock will be able to live on my system - but until then it just can't hang. Why? Well, mostly because it slows my system down and that is unacceptable.


I have to retract this entire statement. I was wrong and, Flock, I'm sorry I disparaged you so! Please forgive me.




I have a lot of different accounts around the web; flicker, youtube, facebook, twitter, another youtube, gmailx4 and I think it is this abundance of accounts that is causing the problems. Basically, if I leave Flock running for a while my system processes become consumed by DPCs (Deferred Procedure Calls). Once it begins my computer becomes nearly unresponsive as the DPC's use a consistent 50% or more of the CPU.

I realize I don't need all those social accounts -heck I don't really use most of them - but I want to try to find the value in them. I still don't reall grok twitter (it seems like a waste of time) or facebook (which seems like a jumbled mess of information) but I figured I should give 'em a go.

So, for the time being I'm back to Firefox. The only social site I really want/need is Google Reader and there is a handy plugin for that - plus Gmail and I use the Gmail manager plugin for that. In fact, I think I'm going to go download the latest public Beta and give it a whirl. If the reports are true I might be willing to put up with it's bugs for it's performance enhancements.

Friday, March 21, 2008

Twittering Alone

Perhaps because I hardly know anyone I don't really get what use there is to "twitter" or any of the other "status" services out there. However, I have an account - my username is finalcut. I am hopeful someone can really explain the benefit of the service to me.

CFUnit and a Custom Tag

I'm not spending much time working in ColdFusion right now. However, on occasion I need to go back and do a little maintenance on a legacy product.  One of those had a pretty poorly written (by me) custom tag for figuring out the number of days in the month.  This is a custom tag that has been in use since 2000 and yet the bug with it wasn't noticed until this month.  It should have been noticed back in 2004 but it wasn't.  Heck it would have been noticed when I wrote it if it had some unit tests associated with it.  But it didn't so this month the customer came back upset that a report wasn't showing the right numbers because the data for the 29 of Feb. wasn't being shown.

Ok, so it was a stupid bug but those are the ones that slip by so easily if you don't have unit tests in place.  Fortunately, we now have nice frameworks like CFUnit that make writing unit tests easy.  However, I didn't really see any good documentation on writing tests for custom tags so this brief article is designed to show one simple example:

Just like with the rest of the CFUnit examples you need two files a CFC which contains the tests and a cfm page that invokes those tests. I'm just going to show you the CFC with the tests since invoking them is the same as every other CFUnit test.


<cfcomponent name="LastDayInMonth" extends="net.sourceforge.cfunit.framework.TestCase">
<cffunction name="setUp" returntype="void" access="public">
<cfimport taglib="/aemis/CustomTags/StandardCustomTags" prefix="standard" />
</cffunction>


<cffunction name="testFebruaryInLeapYear" returntype="void" access="public">
<cfset var output="" />

<standard:Days_In_Month month_id="2" year="2008" returnvariable="output">

<cfinvoke method="assertEquals">
<cfinvokeargument name="expected" value="29" />
<cfinvokeargument name="actual" value="#output#" />
</cfinvoke>

</cffunction>

<cffunction name="testThirtyOneDayMonth" returntype="void" access="public">
<cfset var output="" />

<standard:Days_In_Month month_id="5" year="2008" returnvariable="output">

<cfinvoke method="assertEquals">
<cfinvokeargument name="expected" value="31" />
<cfinvokeargument name="actual" value="#output#" />
</cfinvoke>

</cffunction>

<cffunction name="testThirtyDayMonth" returntype="void" access="public">
<cfset var output="" />

<standard:Days_In_Month month_id="4" year="2008" returnvariable="output">

<cfinvoke method="assertEquals">
<cfinvokeargument name="expected" value="30" />
<cfinvokeargument name="actual" value="#output#" />
</cfinvoke>

</cffunction>

<cffunction name="testFebruaryInNonLeapYear" returntype="void" access="public">
<cfset var output="" />

<standard:Days_In_Month month_id="2" year="2007" returnvariable="output">

<cfinvoke method="assertEquals">
<cfinvokeargument name="expected" value="28" />
<cfinvokeargument name="actual" value="#output#" />
</cfinvoke>

</cffunction>

<cffunction name="testLastMonthOfYear" returntype="void" access="public">
<cfset var output="" />

<standard:Days_In_Month month_id="12" year="2008" returnvariable="output">

<cfinvoke method="assertEquals">
<cfinvokeargument name="expected" value="31" />
<cfinvokeargument name="actual" value="#output#" />
</cfinvoke>

</cffunction>


</cfcomponent>



This is pretty straight forward based on the code I think. I basically just import the customtag library using the setUp method and then test the specific tag I'm interested in here. Now this custom tag just happens to have a returnVariable. However, your custom tag might just output stuff directly. If that is the case use the <cfsavecontent> tag to capture the output and then run your assertions against the output like so



<cffunction name="testPrintLastMonthOfYear" returntype="void" access="public">
<cfset var output="" />

<cfsavecontent variable="output>
<standard:Print_Days_In_Month month_id="12" year="2008">
</cfsavecontent>
<cfinvoke method="assertEquals">
<cfinvokeargument name="expected" value="31" />
<cfinvokeargument name="actual" value="#output#" />
</cfinvoke>

</cffunction>

Wednesday, March 12, 2008

Fit at Last, Fit at Last, Thank God Almight I'm Fit At Last

Sorry MLK for the poor rip off of your famous quote but I'm pretty happy to have some FIT tests running in Eclipse. If you haven't seen what FIT tests are I encourage anyone concerned with software quality to give them a look. You can do A LOT more than just simple tabular tests.

Anyway, it took me a lot of time to get things running in Eclipse but I ended up settling on Agilifier (the least documented tool of them all) but it is working. I have put up a simple tutorial and some downloadable resources on my other blog to help anyone else out who is trying to use FIT within Eclipse.

Tuesday, March 11, 2008

FIT testing is giving me Fits

Maybe I'm just too stupid to figure this stuff out on my own - or maybe the total lack of documentation is just too big of a hurdle for me but I can't seem to get any of the available eclipse FIT plugins working quite the way I need to.

FitRunner was the first one I tried - and it worked but it ended up causing heap problems and eventually couldn't be run anymore. So I removed it.

FitPro looked very promising but never seemed to actually run the simple test I created.

Agilifier is being used by a colleague in Hong Kong but our timezones are so off - and the documentation for it is truly nill, so I'd like to find a different solution.

AntFit hates me. It refuses to execute saying that the class fit/WikiRunner can't be found. I have fit.jar in my classpath, I have the antfit task defined as necessary - and I've even set the attribute useWiki="false" (as well as fork="true") but all to no avail. If anyone has gotten AntFit to work with useWiki="false" I could really use some pointers.

AntFit is the one I really want to get working simply so we can include it in our automated builds; but so far no luck. Hopefully someone out there has used this task and can help me out.