I tend to focus on development topics of late. Specifically ColdFusion/Railo, Coldbox Framework, SQL Server and Eclipse.
Monday, March 16, 2009
SQL Server Error: Dynamic SQL and 'you must declare scalar variable @whatever'
So here's a fun one for today.
I had to modify an MSSQL stored procedure to pass an already defined parameter to another proc. That inner proc helps build dynamic SQL. So I [roughly] modified the WHERE clause setup of the query like so:
SET @dSQL = @dSQL + ' AND PersonId = @PersonId'
Drove me crazy trying to find out why it kept telling me to declare the variable. After about 20 minutes of digging, I realized my mistake.
When the dynamic SQL runs, @PersonId is no longer defined! Seems obvious now that I mention it, but, well...you had to be there. The correct syntax is:
SET @dSQL = @dSQL + ' AND PersonId = ' + @PersonId
Again...it might seem obvious now that you're reading it, but trust me...it wasn't at all obvious when I was trying to debug it.
- Will Belden
March 16, 2009
Wednesday, February 11, 2009
Trillian Astra -- Awesome hidden feature
So I've been on the Trillian Astra (multi-service instant messenger program) beta for some time now. I totally love it and can't wait for it to go to production so I can pay these guys for their great work.
I just discovered a nifty feature today by accident and wanted to share. Typically, I use the custom hotkeys to show and hide the contact list, then double click the contact I want to IM with.
You can, however, drag individual names or entire groups out of the contact list and drop it, and it will create an always-on-top mini list. I tend to only IM about three people most of the time, so it fits quite nicely hovering in the corner!
Way to go Trillian!
Monday, November 17, 2008
Implementing Transfer Observers across all your decorators, the easy way!
For this system, we have a record (media) that represents each user upload of images. For example, we allow multiple profile images to be uploaded, and you can select your current profile image from the "gallery" of your previous uploads. In addition, however, you can delete these images. If you're familiar with transfer, you know it's as easy to delete the database record as saying oMedia.delete(). That removes the object from the database and from Transfer's cache. In this case, however, we also need to remove the actual files from the webserver.
One possible solution was to create a manager service, and make sure that all media deletions go through it. However, this removes some of the intuitive nature of Transfer providing a delete() function for you to use. With Transfer Observers (or "Transfer Event Model"), you can easily extend your decorators to do this on the normal delete() call.
After my initial creation of a mediaObserver.cfc, which I register with Transfer as an observer, I realized I was going down the wrong path. The problem with this is that all observers registered with Transfer get called on each of these seven events:
observerAfterNew,
observerBeforeCreate,
observerAfterCreate,
observerBeforeUpdate,
observerAfterUpdate,
observerBeforeDelete,
observerAfterDelete
The problem with that? Naming my file MediaObserver has nothing to do with my Media records. The events in the observer get called for any object that is getting ready to be created, updated, deleted, etc. So the first thing I did was to rename the file as TransferObserver.cfc. This is a more generic name, obviously, and reflects more accurately what the file is.
So...the question remains at this point: How do I get it to fire an event specifically for my Media records being deleted? Each of the functions you place in the observer receive a single argument when called: transfer.com.events.TransferEvent
From that event, you can do:
arguments.event.getTransferObject()
This gives you the actual Transfer object being modified for this event. That still doesn't tell us this is the Media object, though. But we can do this:
arguments.event.getTransferObject().getClassName()
That returns, in my case, "media.Media". Now I know that this is the object I want rather than, say, an invoice, product or customer object. So I could now write:
<cfif arguments.event.getTransferObject().getClassName() IS "media.Media">
<cfset arguments.event.getTransferObject().deleteMyFiles()/>
</cfif>
After writing this, though, it occurred to me that every time I wanted to have a decorator respond to a Transfer event, I would have to modify my TransferObserver.cfc to respond to a new class name. It seemed that I could perhaps do this in such a way that I could just add a function, with a specific naming convention, to each decorator, as needed, and it would just work. And you can. Here is the format now for every function I added to the TransferObserver.
<cffunction name="actionBeforeDeleteTransferEvent" returntype="void" access="public" output="false" hint="I am called BEFORE a Transfer object has been deleted from the database.">
<cfargument name="event" type="transfer.com.events.TransferEvent" hint="The event object" required="true" />
<cfset var stLocal = structNew() />
<cfif structKeyExists(arguments.event.getTransferObject(), "observerBeforeDelete")>
<cfset arguments.event.getTransferObject().observerBeforeDelete() />
</cfif>
</cffunction>
What is this? The Transfer observer looks to see if there is a function named "observerBeforeDelete" in the Transfer object (or the decorated Transfer object, since this function naming convention is not part of Transfer's generated file format). If the function exists, it calls it. It's that simple, really.
If you'd like to download the entire TransferObserver file, along with a portion of the Coldspring file showing how to set it up. I've linked it here on my site as a tiny zip file (1.2K). Enjoy!
Just a note: Performing a structKeyExists() on a Coldfusion component, as in structKeyExists(object, "functionName") is not a guaranteed way of ensuring that "functionName" is indeed a function. If you have certain property types (like object.propertyName = true), then that "propertyName" is also a structure key. The correct way is to use the getMetaData() function, then you can ascertain for sure that what you are looking for is actually a function. However, the getMetaData() is a slow performing method and would decrease performance significantly to implement. The structKeyExists() should work just find, because you probably won't have a property of the object using this naming convention. And you can actually use a different decorator naming convention for these event-related functions, too. The cffunction names in the TransferObserver.cfc must, however, remain as in my example.
- Will Belden
November 17, 2008
Tuesday, November 11, 2008
How to reintegrate SVN branch back to trunk using Tortoise
Now, these steps below do not include manually merging any changes. I was fortunate enough in this first exercise to have auto-merge ability for my changes to shared files and all my other files were new.
(Be sure you have any files saved and closed, like edits in Eclipse.)
1. Commit your branch back to the repo.
2. IMPORTANT! Export your branch for backup. Quick way: Make sure you can see your desktop, open a window that shows your root branched folder (in my case, "wwwroot"), right-drag it to your desktop, choose "Export here". Ignore this new export folder from here, unless you have problems.)
3. Right click on your branched folder ("wwwroot" again for me), choose "Merge" from the Tortoise submenu.
4. On the Merge screen that comes up, choose the first option: "Merge a range of revisions". Click "Next".
5. Change the "URL to merge from" to the trunk path. Leave the "Revision range to merge" field empty to bring the HEAD changes to you. (This example is assuming that the trunk has received commits after you branched and committed changes to your branch.) Click "Next" (or test merge to see what will happen).
6. Resolve any conflicts you might have, if this applies to your example.
7. You have now brought the latest trunk changes, and integrated them into your branch, bringing your branch up to date. Your branch now contains the most current commits to the trunk, as well as your branch's deviated changes.
8. Now, with the branch containing trunk changes, you need to re-commit your branch to SVN. Do this now.
9. Now, do an update on your branch, just to be sure. You should receive no updates, but this will ensure the metadata is up to date.
10. Next, do a "switch" on your folder, back to the trunk counterpart. This is in in the Tortoise submenu after right-clicking your branched folder. This allows you to merge the changes from your branch into your working copy of trunk, so that you can commit the branch-to-trunk merge back to SVN. (Earlier you brought the latest trunk changes to your branch, the opposite.)
11. After the switch is complete, go ahead and do an update.
12. Right click on your [trunk] folder, choose Merge from the submenu.
13. Choose "Reintegrate a branch" then click "Next".
14. Change, if needed, the "From URL:" dropdown to the branch SVN location.
Tuesday, November 04, 2008
FancyBox, jQuery and z-index
Anyway...so I wrote a small jQuery-based javascript to determine the highest z-index value of all the elements within the page. After some research into the jQuery selectors, I find what I need. Unfortunately, as I return the .css("zIndex") value back from each object, compare it to a running max, I find that in the end the value "auto" is the highest. That's not helpful. I end up finding a simple isNumeric() function I can include, but it only checks the characters in the value against numbers and the decimal point. So I find that, with my routine, 2000 > 100000. Um...that's not right. That lets me know, though, that it's not comparing numbers to numbers, but rather numbers and character values. The parseInt() function solves this.
In the end, here's the basic function I came up with, how to determine the greatest z-index on the page, using jQuery:
<script>
var zmax = 0 ;
function buildZMax() {
$('*').each(function() {
var cur = parseInt($(this).css('zIndex'));
zmax = cur > zmax ? $(this).css('zIndex') : zmax;
});
}
</script>
With this, you can now call buildZMax() and the var zmax will hold the highest value. Now, that's not all I set out to do. Getting the highest z-index value was the prelude to modifying my FancyBox setups to make sure the FancyBox is on top of everything.
Here's how it ended up looking, though we will modify more today to actually incorporate this functionality directly into the FancyBox code, submit it to the author, and perhaps he'll include it in his next version. But this will get you by:
<script>
var zmax = 0 ;
function buildZMax() {
$('*').each(function() {
var cur = parseInt($(this).css('zIndex'));
zmax = cur > zmax ? $(this).css('zIndex') : zmax;
});
}
function goFancy() {
buildZMax();
// Get all the outermost fancy_wrap id'ed objects built by the FancyBox calls
// ...then bump the z-index to whatever the highest we found, plus 1
$('#fancy_wrap').each(function() {
zmax = zmax + 1 ;
$(this).css("z-index", zmax);
// Get the overlay children in each iteration of the outer
// ...fancy_wrap, bump it's z-index up.
$(this).children("div#fancy_overlay").each(function() {
zmax = zmax + 1 ;
$(this).css("z-index", zmax);
});
// And again for another major child div
zmax = zmax + 1 ;
$(this).children("div#fancy_outer").each(function() {
zmax = zmax + 1 ;
$(this).css("z-index", zmax);
});
});
});
$(document).ready(function(){
$("a#myFancyLink").fancybox({
'frameWidth': 600,
'frameHeight': 600,
'overlayShow': true
});
// Call our z-index fixer.
goFancy() ;
});
</script>
Now, something a bit important to note here. You very likely, if you're a jQuery user, have other scripts that might be creating objects, etc. as you go along. It might be beneficial to put your goFancy() call near the end of your document.ready() code to ensure this ends up where you need it. But the buildZMax() function might very well come in handy for other things you might develop with.
Also, while the selectors in jQuery are screaming fast, if you know that you never, ever put z-index on anything but, say, <div> tags, then replace the "*" in the line:
$('*').each(function() {
... with "div" or whatever you apply your z-index'es to. This will make the whole function run faster, obviously.
Post a comment if you're interested in our incorporation to Fancybox code directly.
- Will Belden
Tuesday, November 4, 2008
Wednesday, June 18, 2008
Losing my mind with a form...
Unfortunately, while my save operation worked just fine, the search wouldn't run again. I didn't understand. My form variables existed in the form scope, but they were always blank. I had added the search criteria to hidden variables within the
It took me twenty minutes to figure out the problem. I had copied and edited these from
Maybe this post will save someone 5-10 minutes of their life. Clearly, I'm never getting those 20 minutes back for mine!
- Will Belden
June 18, 2008
Tuesday, March 25, 2008
Eclipse and getting .htm and .html files to open in CFEclipse...
However, with my current "company-provided" Eclipse setup, .htm* files opened in the regular text editor. I finally figured out how to change it, instead of right clicking on each file in the navigator and selecting "Open With...CFML Editor".
Select the Window menu, then choose Preferences. Under General, Editors select File Associations. Then, scroll down in the list to .htm and .html. Click on the first, ".htm". In the bottom section, called "Associated Editors", depending on your configuration, you might see multiple options. These, apparently, are the choices you have when you right click the specific file. But highlight "CFML Editor", then click the "Default" button to the right. Do this again for .html in the top list, and you'll be set!
- Will Belden
Tuesday, April 25, 2008
Thursday, March 20, 2008
ColdBox Framework, Filename Incorrect error I keep getting...
Application Execution Exception
Error Type: java.io.IOException : [N/A]
Error Messages: The filename, directory name, or volume label syntax is incorrect
ID: CFINCLUDE
Line: 107
Template: C:\[your root]\html\coldbox\system\plugins\renderer.cfc
Well, here's what it is, so you can quit banging your head. You've set the view in your handler, but you included the .cfm at the end, like thus:
<cfset Event.setView("tester/testDumper.cfm") />
Since I've already hit this error many times, and cannot seem to learn from my mistakes, I'm hoping like crazy that actually blogging about it might help me remember for next time!
- Will Belden
Thursday, March 20, 2008
Friday, December 28, 2007
SQL, WHERE clause vs. JOIN clause conditions...
Here's an approximation of the original SQL:
SELECT A.id_a, B.id_B
FROM apple A
LEFT JOIN banana B ON B.id_a = A.id_a
WHERE GetDate() BETWEEN B.start_date AND B.end_date
The idea here is to obviously only get the records where the current date falls in the range provided by the Banana table record. This worked great in all my scenarios where I had a Banana record. When I went to try it on a set of Apple records that did not have corresponding Banana record, I got no results at all.
So I took the WHERE clause (or the line containing the date check) and placed it on the LEFT JOIN clause, like so:
SELECT A.id_a, B.id_B
FROM apple A
LEFT JOIN banana B ON B.id_a = A.id_a AND GetDate() BETWEEN B.start_date AND B.end_date
Now it only applies to excluding out of range records in the JOIN only, rather than applying to the result set as a whole. In the initial flavor of the SQL statement, the date comparison would be made against two NULL values for the date fields. The Banana record requires those date values if it exists, but I want Apple records even if there is no corresponding Banana record, and do no date comparison at all. Only exclude the Banana record if the dates are out of range.
Just a gotcha to keep an eye out for!
- Will Belden
Friday, December 28, 2007
Wednesday, October 03, 2007
Apache and Local vs. Remote on the same network...
Don't ask why, but I had to reinstall Apache on my laptop. My laptop is better than my desktop, so I use it as my local development server. I do all my browsing, Eclipse, graphics, etc. on the desktop, though, because of the bigger screen, keyboard, etc.
So I reinstall Apache and all of a sudden, I can't get to the site anymore. (http://local.site.com). Been doing this for months. I haven't changed webroot paths, IPs, nothing but the reinstall. So I'm going crazy and I'm asking all my buddies what could cause this.
One of them suggests the firewall, but I never use it on my laptop since I'm always behind the router. So I sweat and sweat some more, about an hour of this. Finally, I use my old test that I did for testing SMTP servers. From a command line you can run:
telnet www.google.com 80
You get a blank screen, hit enter, escape, whatever and you'll get a bunch of HTML and be returned to the command prompt. So I tried it with local.site.com and got nothing...but "Connecting to....." until it times out. So...clearly port 80 is blocked on either the desktop or the laptop.
On a whim, I pull up the Windows Firewall configuration. Somehow, it got turned on! I never turn it on, therefore never thought to check it.
So, thanks, Tom. Who would of thought! You, obviously.
- Will Belden
October 3, 2007
Friday, September 14, 2007
Network Solutions, Nameservers and DNS work...
All this having been said, Network Solutions really angered me today. I quit using them for personal (or side business) stuff several years ago. GoDaddy rocks, in my opinion, whereas Network Solutions charges an arm and a leg for less services, less quality.
Now, even though *I* don't use them anymore, the company I work for does have several domain names registered with NetSol. That's fine...I'm not sweating it. But this week I needed to setup a new dedicated server (which I did at CrystalTech because they also rock) but didn't want to go through the hassle of having our current hosting company do DNS work, when we'll just be leaving them. And I wanted the control over the DNS records that I'm qualified to have.
So I finally got access and I see that they offer DNS management, much like GoDaddy does, so I'm thinking "Okay...I can do this." So I do.
First problem: I couldn't setup new DNS entries under the NetSol system unless I went ahead and confirmed that the nameservers would be switched. Why can't I set it all up, then make the nameserver change when I'm ready. Makes more sense...but noooooo.
Second problem: This is the one that really lit me up. I've done this a million times. I get the DNS concepts. I understand DNS propagation takes time. For those of you who might be reading and don't understand, here's a brief explanation.
- Zog wants to go to the website for www.foobar.com
- Zog asks the Internets to take him there.
- Zog's ISP says "foobar.com?" Wuzzat?
- Zog's ISP goes to "the almighty root servers" and asks "Where do I find foobar.com?"
- The root servers say "Check with Network Solutions".
- Zog's ISP asks NetSol, "Where's foobar.com?"
- Netsol says, "I know the answer, you want the www? Go to IP 266.266.266.5" (Yeah, yeah).
- Zog's Firefox says "Okay...I know that www.foobar.com is 266.266.266.5" and goes there.
The point is that NetSol's "worldnic" nameservers should immediately know the answer to "where's the www IP?" Once you (or an ISP) starts looking there, it should know the answer. Propagation is about all the ISP's getting the right information. Propagation is NOT about their own nameservers not knowing how to answer the questions.
Using DNSStuff.com, another great site, tells me whats' going on. First, it says that I have "lame nameservers". Other than the obvious pun there, it means that the nameservers associated with my domain name do not answer authoritatively. What? Why don't they? Another test on the DNSStuff site tells me that the root servers say "Check NetSol nameserver A". Nameserver A says "No...check back with the root servers." The root servers say "Okay...check Nameserver B, then." Nameserver B says "Check back with the root servers." Being round-robin, the root servers tell us again, "look at Nameserver A". You can see where I'm going with this. DNSStuff.com says it stops automatically after 20 rounds of this crap.
I didn't expect to bring down the site, email, etc. today. But I did. And it's not my fault. I did everything right, but Network Solutions decided to screw it up. And then their technical support tries to tell me this is normal. Lies. Period. I've done this same thing with GoDaddy enough to know that once you change the nameservers, it should say SOMETHING. Maybe not what you set in the last five minutes, but something.
How long will the site be down? I don't know. The nice tech support man said that it could be 2 to 3 hours before it has the right information. And that I should expect this. Made me angry, but I was polite. Now I have a batch file running an ipconfig /flushdns and ping www.foobar.com loop running. It's been running the whole time I've been writing this, and for an hour and a half before. Let's call it about one hour and 45 minutes. And it's still not working.
As soon as I get this straightened out, I'm moving the domain name to GoDaddy, where domain names belong.
- Will Belden
September 14, 2007
Monday, September 10, 2007
Illudium PU-36 Code Generator and Matching table and column names...
I will readily admit that I may not have the latest version. Once you start editing those xslt files, you kinda want to stick with it. But I ran into this issue today, and it took me a bit to figure it out. Here's the error:
Bean creation exception in com.model.vendorTypeA.vendorTypeAService
Cannot declare local variable vendorTypeA twice.:Local variables cannot
have the same names as parameters or other local variables.:
Line: -1
Obviously a line number of -1 isn't helping. It did tell me, though, that the object can't be created. This error, technically, is thrown by Coldspring, but has nothing to do with it.
The issue here is that I have a table called "vendorTypeA". It has a field called "vendorTypeA". This is bad. Here's the code portion, and it seems obvious, once you've been through this.
<cffunction name="createVendorTypeA" access="public" output="false" returntype="com.model.vendorTypeA.vendorTypeA">
<cfargument name="vendorTypeID_A" type="numeric" required="true" />
<cfargument name="vendorTypeA" type="string" required="false" />
<cfargument name="isActive" type="boolean" required="false" />
<cfset var vendorTypeA = createObject("component","com.model.vendorTypeA.vendorTypeA").init(argumentCollection=arguments) />
<cfreturn vendorTypeA />
</cffunction>
Note the two portions in bold, red. I have an argument of "vendorTypeA" and I'm trying to create a local variable of the same name. One is the field, the other is the object, which uses the table name as the object name. The easy solution here is to simply add "_obj" to the last two lines, as in:
<cfset var vendorTypeA_obj= createObject("component","com.model.vendorTypeA.vendorTypeA").init(argumentCollection=arguments) />
<cfreturn vendorTypeA_obj />
Problem solved. Now the object can be created, either "manually" or through Coldspring.
- Will Belden
September 10, 2007
Tuesday, September 04, 2007
SQL Server 2005, Views, Optimizing and UNION
Well, I needed a view. It was a three table UNION'ed join and....I just needed it simpler than putting all that nasty SQL in my ColdFusion objects. However, my modeling tool, PowerDesigner (PD), isn't always great with views that have computed columns. This particular view was performing too slowly, so I set about to add some indexes to it. Because of the PD problem, the indexes couldn't be built through the modeler. So I'd have to write the index code manually. As I began looking for the code samples, I found this page:
Improving Performance with SQL Server 2005 Indexed Views
One of the things I found was that if you do a UNION'ed view, and you use the same table names again, you should use different table identifiers. For example:
BAD:
SELECT * FROM Table T WHERE T.type="A"
UNION
SELECT * FROM Table T WHERE T.type="B"
GOOD:
SELECT * FROM Table Ta WHERE Ta.type="A"
UNION
SELECT * FROM Table Tb WHERE Tb.type="B"
When I changed my view's code to have this style, the speed on it more than doubled. And I hadn't even done the indexes that I was planning. I will, though...you just watch!
- Will Belden
September 4, 2007
Monday, October 23, 2006
Server Mechanic game...
http://digg.com/playable_web_games/Server_Mechanic/
Digg it, if you like it!
- Will Belden
October 23, 2006
Sunday, October 01, 2006
ColdFusion MX 7, VMWare, VM Shared Folders, Win2003 and Model Glue: Unity
Initially, I was simply doing an "upload" via Eclipse to the "server", but the Deployer plugin I use for Eclipse only allows a single file upload, no folders per round. I often modify four or more files at a time and quickly tired of picking each file, right clicking, choosing Upload, and hitting the spacebar to push the OK button on the "Overwrite...?" dialog. Times 4. Wore me out. ( I have never been able to get the builtin FTP of Eclipse to be my friend.)
So my next option was to see if I could use the Shared Folders feature to have the website setup in IIS point to that shared folder as the site. Then I could simply save the file after editing within Eclipse and click Refresh/Reload in the browser.
( I should note that the "shared folder" of which I speak is on the host machine. I wanted the VM "server" to see that folder on my real machine, as all my development code is on an external USB drive connected to my network. - WB)
Let me say this...the right combo can be a bit tricky. I think, honestly, more so because I didn't want the ColdSpring, Reactor and ModelGlue folders in the root, which means adding CF Mappings. (I wish there was another way to do this without adding mappings for the WHOLE server!!!)
Here was the solution that I came up with after much trial and error. (I had to reinstall the VM setup this morning and had to trial-and-error it until I got it right again because I didn't have my earlier successful attempt as a reference. (Blogging here means *I* can find it again if I need it...)
With the VM Workstation or higher, a "network share" looks like this:
\\.host\Shared Folders\MySite
Now you can map these to a drive letter, but don't even try it. Works fine for Windows in general, but not for IIS and CF mappings.
I buried the Reactor, ColdSpring and ModelGlue folders within [siteroot]\_system\, which meant adding those pesky mappings.
In the VM's IIS config, you set the Home Directory of the site to:
\\.host\Shared Folders\NewDevSite
...assuming your site is "NewDevSite", which I'm sure it isn't. You have to make sure that you have the radio button "A share located on another computer" checked first.
That allows IIS find the site itself. Then you have the ColdSpring globalConfig rootPath mapping in the ColdSpring.xml file:
And finally...the CF mappings:
\\.host\Shared Folders\NewDevSite\_system\ModelGlue
The problem was that I had [mis]remembered being able to use a mapped drive in IIS, but you cannot do this, at least I wasn't able to to that. I tried and tried, but to no avail.
Hope that helps someone out there!
- Will Belden
October 1, 2007
Saturday, September 02, 2006
ColdFusion ColdSpring - Evaluate variables in ColdSpring.xml
As part of my new implementation of ModelGlue:Unity, I found that I have to place the values of different things in many different places. In this situation, that was the applications datasource name, user ID and password. I dislike having more than one or two places to have to place values, in the event they need to change. (A good security policy for databases is to change those passwords every so often.)
In my ColdSpring's XML config file, I had attempted to place the following:
However, this only resulted in a query error along the lines of a datasource not being found with a name of "#APPLICATION.dbName#".<bean id="oDatabase" class="com.oDatabase" >
<constructor-arg name="dbDatasource">
<value>#APPLICATION.dbName#</value>
</constructor-arg>
<constructor-arg name="dbUser">
<value>#APPLICATION.dbUser#</value>
</constructor-arg>
<constructor-arg name="dbPass">
<value>#APPLICATION.dbPass#</value>
</constructor-arg>
</bean>
Perhaps my solution to my need is not the best way, since I modified ColdSpring files directly. Perhaps there is even another way, but a couple hours of searching did not reveal the answer to me. I thought "there has to be a way to tell CS to evaluate the XML value entry instead of just seeing it as a literal string."
I opened DefaultXMLBeanFactory.cfc in the /coldspring/beans/ directory and modified the "constructBean" function. There are two places you'll find this line, one in a regular bean function setup, I believe, and the other specifically for init() functions.<cfinvokeargument name="#argDefs[arg].getArgumentName()#" value="#argDefs[arg].getValue()#"/>I replaced that line with this block:
<cfset VARIABLES.csTempEval = argDefs[arg].getValue() />In my ColdSpring XML config file, I changed the section above to look like this:
<cfif FindNoCase("~~~", VARIABLES.csTempEval) GT 0>
<cfset VARIABLES.csTempEval = mid(VARIABLES.csTempEval, 4, 999999) />
<cfset VARIABLES.csTempEval = Evaluate(VARIABLES.csTempEval) />
</cfif>
<cfinvokeargument name="#argDefs[arg].getArgumentName()#" value="#VARIABLES.csTempEval#"/>
<bean id="oDatabase" class="com.oDatabase" >Voila! Now my ColdSpring dynamically evaluates APPLICATION.dbName instead of trying to use it as a literal. It will only do this is the tag has the three tildes (~~~) at the front. Obviously, you can modify it to do it with any character combination you find more appealing. I would avoid anything too crazy, or anything you might actually want as a true value down the road. I considered having the changes look for anything beginning and ending with "#" characters but that would eliminate the ability for more complex combinations, if needed, such as "myTest_v#APPLICATION.version#" where it evaluates to "myTest_v01" or similar.
<constructor-arg name="dbDatasource">
<value>~~~#APPLICATION.dbName#</value>
</constructor-arg>
<constructor-arg name="dbUser">
<value>~~~#APPLICATION.dbUser#</value>
</constructor-arg>
<constructor-arg name="dbPass">
<value>~~~#APPLICATION.dbPass#</value>
</constructor-arg>
</bean>
If anyone out there knows of a more ColdSpring acceptable way (that I was unable to find), please let me know. Of course, I made a backup of the original CFC in the event that someone brings it to my attention!
September 9, 2006
Friday, September 01, 2006
ColdFusion - Crazy Error
"The system has attempted to use an undefined value, which usually indicates a programming error, either in your code or some system code. Null Pointers are another name for undefined values."After my initial bafflement, it occurred to me that the problem wasn't where it was saying it was, in a call to the CFC, but rather in the CFC function itself. I had specified a function returntype of "numeric", but had neglected to setup to return anything at all. Even when I modified the call to the function to not accept a return, as in:
myFunctionCall(parm1=value1, parm2=value2) ;
instead of
myRetVal = myFunctionCall(parm1=value1, parm2=value2) ;
... it still didn't work and threw the same error.
Hopefully, if you're having this problem, and search on some of that text, you'll end up here with a search and save yourself some headache!
Will Belden
September 1st, 2006
Wednesday, February 22, 2006
Not your Personal Conveyance
This...irritates...me...to...no...end. I can understand needing to purchase groceries. I can understand not having a vehicle. I can even fathom being too weak to carry everything you need. But I cannot comprehend, condone or even conceive of "stealing" a shopping cart to take your purchased goods back to your dwelling.
Why do people do this? Pure laziness, in my opinion. If you don't have a car, then when you walk to and from the grocery store you need to buy less. Certainly no more than you can carry from point A to point B, whether that distance covers a quarter of a mile or three miles.
That shopping cart does not belong to you! It's not yours. That store paid good money for that cart and has to maintain it, clean it, repair it and replace it when it goes missing. What makes you think you can just run off with it?
Now, to my detractors who think to holler about "poor" and "indigent" or whatever words you want to synonimize with "lazy" -- don't, okay? I have been without transportation in the past and I have never STOLEN a grocery cart. And to be honest, I wouldn't have as much a problem with this concept if it was returned to the store! I'm not above borrowing, but you've got to return the thing. Now its missing from the store so that when I make a 5:00 pm run to the store to pick up a handful of things and the store is crowded -- I have nothing to use. Leaving it at a hotel parking lot, the entrance to your apartment complex or beside the road is an unsightly blot on my view. It makes everyone who lives in that area look like trailer trash.
Don't buy more than you can carry, get someone to give you a ride back home, grow your own food, whatever. Quit stealing the shopping carts! It's NOT your personal conveyance.
Will Belden
February 22, 2006
Thursday, November 10, 2005
Customer Service Apologies -- UGH!
We are taught as kids that it's not good enough to say "I'm sorry", but rather the apology needs to be indicative of admitting a wrong doing, with the intention of not doing it again. When a customer service representative says, over and over, "I apologize for that, Mr. Belden" they are not indicating that they are truly sorry. After all, this particular individual probably had nothing to do with the problem that I'm calling about. Secondly, they aren't making that implied promise of handling the situation better in the future. How can they? They aren't a decision-making individual within their company.
I think I would find it more satisfactory if they just said "I can understand your frustration, Mr. Belden." This would make far more sense, imply an empathy (that of course they don't possess) and save me the grief of having to say, after their tenth apology, "Please stop apologizing and let's just get it corrected." To which I typically expect them to say, "I'm sorry for all the apologies, Mr. Belden."
I'm sure all this is laid out in the "Vendor's Guide to Handling Customer Complaints" or whatever little green book that they give all the $4.00/hr customer service call center employees. I think one of the difficulties I have is that I don't care much for following other people's guidelines, but rather feel I am appropriately intelligent to handle the situation well without a script to follow. (Hence I never joined the military!)
Anyway...a short rant about why I despise calling any customer service center. I also would rather pull my fingernails out than call because I'm pretty sure, from the moment I dial the phone, that whatever I have to be calling about probably won't be fixed anyway. My typical pessimism at work, mind you!
Will Belden
November 10, 2005
Tuesday, August 09, 2005
The Beauty of Irfanview...
Here are some of the reasons I love this program so much:
- It's free.
- It can open almost ANY image, including Photoshop, Illustrator, .gif, .jpg, .png, etc. (Be sure to get the plugins...)
- It can open almost ANY video files, including .mpg, .avi, etc...
- You can do basic operations such as pasting in a screenshot and saving. You can crop, resize, resample, reduce colors or go to grayscale (I often do this when pasting a screenshot into email to minimize message size and bandwidth usage.)
- It has support for basic effects, but also lets you use Adobe .8BF filters, too!
- Did I mention it's free? If not, it's free!
- It's updated frequently. I had v3.95 on my machine when I started this, but found that v3.97 was available. (I updated immediately...!)
- It can whip out thumbnails for a whole directory for quick viewing super fast. Very useful to find a file you seek quickly.
- You can defined an external editor per file type. I have my image files (all types) associated with Irfanview. When I double click a .psd file, it opens there and shows me if it's the file I think it is. Then I can hit SHIFT+E and it opens in Adobe. But I was able to determine if it was the file I was looking for without having to actually load Photoshop.
If you haven't ever used this little program I highly recommend downloading it and trying it. You have nothing to lose, but you might find you'll wonder how you ever lived without it!
- Will Belden
August 9, 2005