The Plague of the Old Program

I'm currently debugging a Flex program I wrote 18 months ago. My very first "big" Flex app. All the variables and functions are public. Data is passed around by tightly coupled components. The database is requeried CONSTANTLY. I went into this thing to make a text change a few weeks ago. While in there, I wanted to make some little efficiency upgrades and ended up rewriting half the thing. Going back to your own old code is actually more frustrating than picking up someone else's. It's fun to see how I've progressed as a Flex programmer in the last year and a half. But also very frustrating to weed through all the junky code I put in because I just didn't know better then.

Transfer: Yes or no?

A non-WoW related post? For realz?

I've been working on a Transfer/ColdSpring/ColdBox site. I've got one word for Transfer: voodoo magic. The powers-that-be for this project decided yesterday to abandon Transfer and go back to generating CFCs. I don't exactly know why it was abandoned, but it was cited that Transfer is causing more work arounds than its solving problems. Now I'm just a code monkey on this project. I pull down the files nightly, copy/paste what the other developer did, and change variable names until my portion of the work is done. So I don't have any problems with Transfer, I'm not involved in whatever hoops the other developer is jumping through to get stuff working. I can say I really liked Transfer for the short while I used it. It's shiny and new and from my perspective saves a lot of time.

Programmers + sun + no free wifi = ??

Joshua Cyr's done a sweet job setting up a CF/Flex/Air cruise!

http://www.riadventure.com/

I immediately couldn't help but imagine certain big names in the Adobeverse... in swim wear.

I then immediately bashed my head against the wall until I stopped.

FactionCapture! 12k records in 6 months

The other component to cf_armory, FactionCapture, is a mess!! A while ago I added the option to chose what factions to graph, and I just changed it to only store faction history for 6 months (filling up my database!), but the page is still so ugly. I'm thinking this is a good candidate for a Flex app. I love the idea of graphically seeing your faction values change over time, but the current conception of it that I have stinks.

So I played with some Flex and came up with this design mock up... The new mock up

UpgradeCentral gets JQuery Upgrade

After a year of ignoring it, I've finally gotten back to enhancing UpgradeCentral. I used JQuery to break up the data into tabs. Now you'll immediately notice the tabs are too much to fit on the screen, so go into a weird second line. That's because I don't know jack about JQuery ... yet.

Note, UpgradeCentral uses Armory to determine what is an upgrade, based on the character's current spec. And a lot of it is rubbish. It generally ignores items with a "chance on hit" sort of bonuses.

Next I need some check boxes to unselect locations. I don't care to see upgrades from Sunwell, Black Temple, or PVP with my hunter and nothing over Gruul's with my priest.

Autogenerated CFCs

Current setup...

I'm on MSSQL Server and autogenerate my bean, DAO, and Gateway with the wizard in Adobe's CF extensions. A lot of the code it generates is crap, but still it saves me a LOT of time and keeps some level of consistency to my code.

On an insert, the generated code puts a cftransaction around the insert, then immediately queries the record to get the autogenerated ID. With MSSQL I was able to toss something like the below immediately after the insert statement, in the same cfquery block, to get the auto ID (as queryName.AutoID).

[More]

Less than a week to CFUnited!

This time next week, I'll be sitting in the Adobe opening keynote at CFUnited. When my manager told me he was sending me again this year, I was excited and looking forward to it. Then my WoW guild announced plans for a BBQ in Toronto next weekend. That would have been even more fun, to meet the people I've been "hanging out with" for a year. But oh well! I've signed up for some great sessions at CFUnited. Lots of OO, ColdSpring and frameworks, unit testing, automation, and data security.

[More]

Display random image

I'm in the process of making some new banners for the top of the blog and want one to show up randomly. I did this on a site I made for the Anime Group at college. So I found that code first

[More]

WoW Head popups in blogCFC

I'm not completely happy with my solution, but it works. It goes through Blizzard's armory to search for the item and get the item number, then uses wowhead.com to help make the popup.

Like yesterday's post, add a code block to blog.cfc to look for {item ...} code fragments. This is where I'm not happy, I wanted [wowitem ...] to work.

<!--- Check for wowitem blocks --->
<cfif findNoCase("{item ",arguments.string) and findNoCase("}",arguments.string)>
   <cfset armoryCFC=CreateObject("component","sandbox.wow.armory")>
   <cfset counter = findNoCase("{item ",arguments.string)>
   <cfloop condition="counter gte 1">
      <cfset codeblock = reFindNoCase("(?s)(.*)(\{item )(.*)(\})(.*)",arguments.string,1,1)>
      <cfif arrayLen(codeblock.len) gte 6>
         <cfset codeportion = mid(arguments.string, codeblock.pos[4], codeblock.len[4])>
         
         <cfset result = armoryCFC.getItemLinkFromName(codeportion)>
         <cfset newbody = mid(arguments.string, 1, codeblock.len[2]) & result & mid(arguments.string,codeblock.pos[6],codeblock.len[6])>

         <cfset arguments.string = newbody>
         <cfset counter = findNoCase("{item ",arguments.string,counter)>
      <cfelse>
         <cfset counter = 0>
      </cfif>
   </cfloop>
</cfif>

This references armory.cfc, so make it and add these two functions...

getItemLinkFromName

<cffunction name="getItemLinkFromName" access="remote" returntype="string">
   <cfargument name="itemName" default="War-Feathered Loop">
   <cfargument name="baseURL" required="false" default="http://armory.worldofwarcraft.com/">

   <cfset var url = arguments.baseURL
         & "search.xml?searchQuery=" & URLEncodedFormat(arguments.itemName)
         & "&searchType=Items">

   <cfset var itemsheet = makeHTTPCall(url)>
   <!--- initialize variables to be used --->
   <cfset var items = "">
   <cfset var ret = "">
            
   <cfif left(itemsheet.statuscode,3) neq "200">
      <cfreturn arguments.itemName/>
   </cfif>
   
   <cfset items = XMLParse(itemsheet.fileContent).page.armorySearch.searchResults.items>
   
   <cfif ArrayLen(items.XMLChildren) eq 0>
      <cfreturn arguments.itemName/>
   </cfif>
   
   <cfset ret = "<a href='http://www.wowhead.com/?item=#items.XMLChildren[1].XMLAttributes.id#'>#arguments.itemName#</a>">

   <cfreturn ret>   
</cffunction>

makeHTTPCall

<cffunction name="makeHTTPCall" returntype="struct">
   <cfargument name="url" required="true">
   <!---
   Store the user agent that I am using with my browser
   --->

   <cfset var strUserAgent = (
            "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; " &
            "rv:1.8.1.3) Gecko/20070309 Firefox/2.0.0.3"
            ) />

            
   <cfhttp
      url="#arguments.url#"
      method="GET"
      result="armoryXML"
      useragent="#strUserAgent#"
      />

   
   <cfreturn armoryXML>
</cffunction>

Then add somewhere in your page, a script block for WOW Head ...

The magic in that script will add the popup to all links to wowhead.com, woo! If the item isn't found in the armory, it will just print the name of the item. Problem though, is if more than one item is found, it'll make a link to the first item. This is needed though. Boots of the Crimson Hawk is made from Pattern: Boots of the Crimson Hawk. Doing a search for the boots returns the pattern as well. I'm guessing armory returns items in alphabetical order.

So what happened with making a [wowitem ...]? It was fine when there was only one in the post, but could wrap the first "[wowitem" with the final "]" if there was more than one. If someone with better regex knowledge than I can solve this, please share!

blogCFC mod for easy WOWWiki linking!

If you use Ray Camden's blogCFC, you can add this block to make WoW item/boss/whatever linking easier. In blog.cfc, around line 2088, renderEntry, is some code to format a code entry. Add a block after that to render a different sort of code.

<cfif findNoCase("[wow ",arguments.string) and findNoCase("]",arguments.string)>
   <cfset counter = findNoCase("[wow ",arguments.string)>
   <cfloop condition="counter gte 1">
<cfset codeblock = reFindNoCase("(?s)(.*)(\[wow )(.*)(\])(.*)",arguments.string,1,1)>
      <cfif arrayLen(codeblock.len) gte 6>
<cfset codeportion = mid(arguments.string, codeblock.pos[4], codeblock.len[4])>
         
         <cfset result = "<a href='http://www.wowwiki.com/#codeportion#' target='_blank'>#codeportion#</a>">
         <cfset newbody = mid(arguments.string, 1, codeblock.len[2]) & result & mid(arguments.string,codeblock.pos[6],codeblock.len[6])>

<cfset arguments.string = newbody>
         <cfset counter = findNoCase("[wow ",arguments.string,counter)>
      <cfelse>
         <cfset counter = 0>
      </cfif>
   </cfloop>
</cfif>

Now when making a blog post, I can type

[wow Light Feather]

and it will render as

Light Feather

Woo! Time savings, ftw

More Entries

BlogCFC was created by Raymond Camden. This blog is running version 5.9.002. Contact Blog Owner