Posted on Leave a comment

Securing Contacts and Jobs

I just put a resume out on this one. Sounds fun!

Duties and Responsibilities:
– Assist in composing web pages and in creating special sections as assigned by the Site coordinator
– Work hands-on in the development of web applications (AJAX/HTML/Javascript)
– Competence creating table-free layouts
– Prototype, develop, and maintain new features and enhancements
– Operates as a leader/lead worker among other staff, shares knowledge or training with subordinates and/or colleagues to benefit the entire department
– Participate in workflow design and analyze existing production and implementation processes in order to insure the overall quality of the sites
– Maintenance and support of existing templates and content production processes
– Perform web development, template writing, testing debugging, documentation, and installation tasks for on-line processes in accordance with industry best practices and specific internal procedures and standards
– Partner with Web-ops to ensure that interactive techniques and technologies translate through to shipping products and services
[Source]

One of the challenges of working for yourself is you have to shoot at a lot of barns to hit some work. The problem is barns move pretty quick! Sometimes it is just plain difficult to find a barn. Then the barn’s owner looks at you and may not even give you permission to shoot at the barn in the first place much less give you the barn.

Playing low budget developer and sales person at the same time can lead to missed deadlines or living with very little sleep. Finishing a project, then turning on sales mode can lead to dry spells where you wonder how you’ll eat. Ideally, you should be working with a sales person!

Posted on Leave a comment

ColdFusion Event Gateway / Web Service Gave Me Trouble

My programming love is ColdFusion. I have been working with it since early 1998 with the release of version 3. Version 8 will release next year. A feature of CFMX7 that I have not had the opportunity to use is the Event Gateway to turn a CFC into a web service.

ColdFusion event gateways are ColdFusion MX elements that let ColdFusion MX react to or generate external events or messages in an asynchronous manner. Event gateways let a ColdFusion application handle information that does not come through an HTTP request. For example, you can use event gateways to handle instant messages, short messages from mobile devices, or messages sent to a TCP/IP port. [Source]

The Project

I have a project that uses XML feeds to update inventory status from a wholesaler to the reseller. Unfortunately, do to problems at the wholesaler end, one of the feeds is unavailable and will remain so. The solution is to use a query of the database to obtain IDs of the active products then use CFHTTP to get the information from the wholesaler’s website (site scraping). Since there are roughly 1500 active products at any one time, making 1500 CFHTTP calls at once causes timeouts as the browser gives up before the webserver can finish its task. Since this update will be done only occasionally, 1500 requests to the wholesaler is not a big deal.

The Solution

The solution to the problem is to implement the CFHTTP request as a CFC, create a gateway instance with a 5 minute timeout, and call the gateway instance with small groups of product ids from a .cfm page. The concept works beautifully since the Event Gateway is asynchronous and decoupled from the browser which initiated the instance.

The Problem

I choose the .cfm to manage grouping the product IDs so that there would only be one query instead of 150 queries (~1500 products in groups of 10) as would happen if the query were within the CFC. So the code builds a list of IDs within a structure (as required by the Event Gateway)

The onIncomingMessage method must take a CFEvent structure that contains input information in its Data field, and processes the contents of the Data field as needed. [Source]

The loop that calls the gateway instance builds the list, calls the instance, clears the list, builds the next list, calls the instance, and so forth. Apparently I am able to alter the datastructure so quickly that the second list replaces the first list before the gateway instance fires so the CFC ends up processing only the information from the latter lists. More simply, the CFC processes whatever data is in the structure at the time the gateway event fires from the queue not the state of the structure at the time the gateway event was called by the ColdFusion application. Set up a gateway instance and try the following code. This is the CFC to which the gateway instance will be associated.

test.cfc

<cfcomponent displayname="Test Gateway" hint="Logs the idlist passed into the CFEvent.Data structure.">
   <cffunction name="onIncomingMessage" access="remote">
      <cfargument name="CFEvent" type="struct" required="yes">
      <cflog
         text="Gateway test complete for ids #CFEvent.Data.idlist#."
         file="GatewayTest"
         type="Information"
         application="Yes">
   </cffunction>
</cfcomponent>

The calling CF application is show below

test.cfm

<cfscript>
   datarange = structNew();
   tmplist = "8,1008,1019,1020,1021,1022,1024,1025,1026,1027,1030";

   datarange.idlist = duplicate(tmplist);
   datarange.datasource = "adult";

   status = SendGatewayMessage("TestGateway", datarange);

   tmplist = "8,20,19,18,17,16";

   datarange.idlist = duplicate(tmplist);
   status = SendGatewayMessage("TestGateway", datarange);
</cfscript>

You would expect the log file to have two different lines.

Gateway test complete for ids 8,1008,1019,1020,1021,1022,1024,1025,1026,1027,1030
Gateway test complete for ids 8,20,19,18,17,16

but instead it has two identical lines.

Gateway test complete for ids 8,20,19,18,17,16
Gateway test complete for ids 8,20,19,18,17,16

The Solution

I have not tested the solution yet but I am betting that I either

  1. have to let the CFC call the gateway instance after it has processed a batch of ids thus making this a synchronous process to itself but still asynchronous to the browser or
  2. Create a unique structure for each group of IDs to be processed

I prefer the latter. Update: Testing is complete and solution #2 works great!

Other Resources

About event gateways
Abobe’s (fomerly Macromedia formerly Allaire) overview
Deploying an event gateway
Macrodobellaire’s livedocs for initial setup of an event gateway
Using the CFML event gateway for asynchronous CFCs
This was the most helpful livedoc with critical information non-chalantly hidden within such as "Using the CFML event gateway for asynchronous CFCs"
SendGateWayMessage
Livedocs for SendGatewayMessage
The Asynchronous CFML Gateway – A Real-World Example of a Great New Technology
Matthew Woodward comes through in this ColdFusion Developer’s Journal article
Understanding Asynchronous Processing by Ben Forta
It wouldn’t be ColdFusion unless Uncle Ben said something.
Concurrency Library
It is very difficult to mention asychronous CFML without someone mentioning Sean Corfield’s work.
XML Path Language (XPath)
XPath is a language for addressing parts of an XML document, designed to be used by both XSLT and XPointer.
XPath Axes
XML Lessons at W3Schools
Posted on Leave a comment

Can’t see the code for all the debugging

So I’m pulling my hair out and pulling my hair out trying to figure out why my code isn’t working. In the process I resolve a fairly significant logic flaw (which is a good thing) but still it doesn’t seem to work and nothing is changing in the results when I finally remember that I put maxrows="10" on the <cfoutput> for troubleshooting.

Long and short that means I couldn’t figure out why anything past the 10th record was not updating and the reason was because I told the code not to update anything past the 10th record.

Thank you for joining me for that moment of Geek Zen.

Posted on Leave a comment

Fake a Left Outer Join with ColdFusion’s Query of Query

Since a Query of Query only supports INNER JOIN syntax, many developers are left frustrated because the incredibly useful LEFT OUTER JOIN is unavailable. Alistair Davidson has come up with a solution using the support UNION syntax.

For those of you now asking "what is an inner join? What is a left outer join?" I have provided an explanation in pictures and words. (complete with a typo of the word "columns")

Posted on 1 Comment

Server Status

I disabled a few unessential services, like FTP, did a magic reboot taking a brief stop in Safe Mode, and CFMX 7 started working! CFMX 6.1 continues to not work.

Others have had this issue. I fail to see any clear resolution. Right now I am pondering uninstalling 6.1.

Now to apply the latest 7 hotfixes then get back to work.

Btw, this was done but may or may not have helped.

Posted on 6 Comments

Server troubleshooting continues

On trying to start the cfmx (6.1) service I get the following message:

Windows could not start the ColdFusion MX Server on Local Computer. For more information, review the System Event Log. If this is a non-Microsoft service, contact the service vendor, and refer to service-specific error code 1.

The event log shows (for Application):

The ColdFusion MX Application Server service could not be started. Check that server “default” exists. Check the server “default” log files for more information.

And for MX 7:

The ColdFusion MX 7 Application Server service could not be started within 240 seconds. Increase the server startup timeout value using C:\CFusionMX7\runtime\jrunsvc.exe -starttimeout <seconds> "ColdFusion MX 7 Application Server".

I wonder if this is related:

Source:WinMgmt Warning! "WMI ADAP was unable to process the PerfDisk performance library due to a time violation in the open function."

The event viewer shows nothing interesting for DNS Server, IExplore, or Security. System however shows a warning for source Browser:

The browser was unable to retrieve a list of servers fromthe browser master \\ROCKWELL on the network \Device\NetBT_Tcpip_{31C49F54-B9A1-4536-85E6-FCCF5D042F85}. The data is the error code. "Data: bytes: 0000: 35 00 00 00 5…"

That’s interesting because Rockwell is my development machine and should not be master of anything. Other server event warnings/errors:

Error: Source: Service Control Manager: The RMServer service terminated unexpectedly. It has done this 1 time(s). The following corrective action will be taken in 0 milliseconds. No action.
Error: Source: Service Control Manager: The RMServer service hung on starting.
Error: Source: Service Control Manager: The ColdFusion MX 7 Application Server service terminated with service-specific error 2.
Error: Source: Service Control Manager: The Windows Media Program Service service terminiated wtih service-specific error 16389.
Error: Source: The ColdFusion MX Application Server service terminated with service-specific error 1.
Warning: Time: 3:47 Source: BROWSER: The browser was unable to retrieve a list of servers from the browser master \\FREUD on the network \Device\NetBT_Tcpip_{31C49F54-B9A1-4536-85E6-FCCF5D042F85}. The data is the error code. Data: Bytes: 0000: 35 00 00 00 5…

Ok! What’s that?! \\FREUD is my wife’s computer and has no more business being a browser master than \\ROCKWELL. We were also fast asleep at that time.

Posted on 1 Comment

Update on yesterday’s challenges

Yesterday I hit the ground running at 2:30am and was taking names! Somewhere around 7am I had a problem with my server and productivity ground to a halt. I spent the entire day working the issue and still don’t have it working. My server is a development server accessible only to me and sports ColdFusion 4.5 and ColdFusion MX 6.1. It now also has ColdFusion 7 installed. CF 4.5 works fine. CFMX 6.1 and 7 both refuse to start as a service. The timing on this issue couldn’t be worse.

From the cf7 runtime/logs/coldfusion-event.log:

06/15 06:24:56 warning No sessionSecret has been specified in jrun.xml. Installing a self generated sessionSecret.
06/15 06:25:01 info No JDBC data sources have been configured for this server (see jrun-resources.xml)
06/15 06:25:02 info JRun Web Server listening on *:8501
06/15 06:25:02 info Deploying enterprise application “Macromedia ColdFusion MX” from: file:/C:/CFusionMX7/
06/15 06:25:07 info Deploying web application “Macromedia Coldfusion MX” from: file:/C:/CFusionMX7/
06/15 06:25:47 user JSPServlet: init
06/15 06:25:55 user CFMxmlServlet: init
06/15 06:25:55 user CFMxmlServlet: Macromedia Flex Build: 87315.134646
06/15 06:26:11 user ColdFusionStartUpServlet: init
06/15 06:26:11 user ColdFusionStartUpServlet: ColdFusion MX: Starting application services
06/15 06:26:11 user ColdFusionStartUpServlet: ColdFusion MX: VM version = 1.4.2_05-b04

and from coldfusion-out.txt:

Starting Macromedia JRun 4.0 (Build 92909), coldfusion server
06/15 06:24:39 warning Unable to open C:\CFusionMX7\runtime/lib/license.properties
06/15 06:24:54 info JRun Naming Service listening on *:2920
06/15 06:24:56 warning No sessionSecret has been specified in jrun.xml. Installing a self generated sessionSecret.
06/15 06:25:01 info No JDBC data sources have been configured for this server (see jrun-resources.xml)
06/15 06:25:02 info JRun Web Server listening on *:8501
06/15 06:25:02 info Deploying enterprise application “Macromedia ColdFusion MX” from: file:/C:/CFusionMX7/
06/15 06:25:07 info Deploying web application “Macromedia Coldfusion MX” from: file:/C:/CFusionMX7/
06/15 06:25:47 INFO License Service: Flex 1.5 CF Edition enabled
06/15 06:25:47 INFO Starting Flex 1.5 CF Edition
06/15 06:25:47 user JSPServlet: init
06/15 06:25:55 user CFMxmlServlet: init
06/15 06:25:55 user CFMxmlServlet: Macromedia Flex Build: 87315.134646
06/15 06:25:55 INFO Macromedia Flex Build: 87315.134646
06/15 06:26:11 user ColdFusionStartUpServlet: init
06/15 06:26:11 user ColdFusionStartUpServlet: ColdFusion MX: Starting application services
06/15 06:26:11 user ColdFusionStartUpServlet: ColdFusion MX: VM version = 1.4.2_05-b04
06/15 06:26:15 Information [main] – Starting logging…
06/15 06:26:15 Information [main] – Starting crypto…
06/15 06:26:26 Information [main] – Starting license…
06/15 06:26:26 Information [main] – Starting License server …
06/15 06:27:08 Information [main] – Starting scheduler…
06/15 06:27:08 Information [main] – Starting WatchService…
06/15 06:27:09 Information [main] – Starting debugging…
06/15 06:27:09 Information [main] – Starting sql…
06/15 06:27:10 Information [main] – Starting mail…
06/15 06:27:13 Information [main] – CORBA Configuration not enabled
06/15 06:27:13 Information [main] – Starting cron…
06/15 06:27:13 Information [main] – Starting registry…
06/15 06:27:15 Information [main] – Starting client…
06/15 06:27:17 Information [main] – Starting xmlrpc…
06/15 06:27:21 Information [main] – Starting graphing…
06/15 06:27:36 Information [main] – Starting verity…
06/15 06:27:36 Information [main] – Starting archive…
06/15 06:27:36 Information [main] – Starting document…

Update: I did receive an error message:

Could not start the ColdFusion MX 7 Application Server service on local computer.
Error 1053: The service did not respond to the start or control request in a timely fashion.

Posted on 4 Comments

Today’s Challenges

  1. CFMX6.1 from c:\CFusionMX\runtime\logs\default-out.log on Win2k server:

    JRun server “default” does not exist, the server root null was not found. Please verify that the C:\CFusionMX\runtime\lib\servers.xml file contains valid data for this server.

    Additional info from c:\CFusionMX\runtime\logs\default-err.log:

    jrunx.xml.XMLMetaData$CouldNotCreateDocumentException: Could not create document from location ‘file:/C:/CFusionMX/runtime/lib/servers.xml’
    at jrunx.xml.XMLMetaData.createDocument(XMLMetaData.java:1028)
    at jrunx.xml.XMLMetaData.importXML(XMLMetaData.java:200)
    at jrunx.xml.XMLMetaData.(XMLMetaData.java:122)
    at jrunx.server.metadata.ServersMetaData.(ServersMetaData.java:32)
    at jrunx.server.ServerManagement.refreshServersMetaData(ServerManagement.java:82)
    at jrunx.server.ServerManagement.getServerRootDirectory(ServerManagement.java:154)
    at jrunx.server.ServerManagement.getServerRootDirectoryFile(ServerManagement.java:171)
    at jrunx.kernel.JRun.startByNTService(JRun.java:410)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:324)
    at jrunx.kernel.JRun.invoke(JRun.java:180)
    at jrunx.kernel.JRun.main(JRun.java:168)

  2. My ftp client refuses to update a client site.
Posted on Leave a comment

Work Complete!

I just finished a fun piece of code for a client. In addition to web server logs, they have a prioprietary advertising campaign tracker. They needed data aggregated and queries optimized which was phase 1 and included some MS SQL stored procedure magic, queries of queries (ColdFusion), and manually creating query result sets.

Phase II was to minimize the amount of text presented, show results in graphs, and create a way for an advertising client to view only their data. Fortunately, ColdFusion comes through with a fancy tag called CFChart and after the server configuration was debugged, graphs appeared. Then text on the screen was hidden using CSS (and I’m really starting to use and enjoy the cascading aspect of css) and made to appear through JavaScript.

Since some charts show way too much data, a form was added to filter the data and only show lines on the graphs that are relevant to the end user’s needs.

Posted on 1 Comment

CFChart problem solved!

I changed multiple variables at once so all of this may not be necessary. The final solution to the CFChart doesn’t work / won’t display / is blank problem is to add a virtual directory in IIS under the website wanting to use CFChart for "CFIDE" and another virtual directory for "JRunScripts". The last post in this thread helped me realize that having virtual directories for CFIDE and JRunScripts in the webroot was not sufficient.

Allan – CFUG Spain 5 Dec 2004 21:16:55 [ permanent link ]
What you have do is:

  1. Create the file GraphData.cfm in the CFIDE directory. (As a file can’t be empty stick a comment in there )
  2. Make sure the IIS website entry has a virtual directory to CFIDE (C:\Inetpub\wwwroot\CFIDE)
  3. Make sure the IIS website entry has a virtual directory to JRunScripts (C:\CFusionMX\runtime\lib\wsconfig\1)

Then restart CFMX server and Bob should be your uncle.

Allan

Update: Insult to injury. 6.5 hours ago, someone online recommended I confirm my mappings for CFIDE and scripts. I misinterpretted their question and blew it! Time to self-deprecate.

Posted on 1 Comment

Time to regroup – CFChart or not CFChart

So I’ve spent most of the day working on this issue. To recount, I’m trying to use CFChart to plot some data but the webpage returns blank. What we know:

The zero byte file reference was interesting. For people having trouble with CFChart or RDS you may need to know:

Some ColdFusion Administrator functions, as well as RDS and cfchart functionality, rely on two ColdFusion templates. However, these templates do not exist by default. You will need to create the following zero-byte files, since IIS will check for them during processing.

  1. Open Windows Explorer.
  2. Navigate to the web_root/CFIDE directory, typically located at \inetpub\wwwroot\CFIDE.
  3. Create a blank file named GraphData.cfm.
  4. Create a directory called main.
  5. Navigate to the new directory at web_root/CFIDE/main.
  6. Create a blank file titled ide.cfm.
  7. Repeat steps B-F for any additional instances of web_root/CFIDE.

At this point I’m running out of time. Can I do this with a different solution?

Posted on 3 Comments

Simple is never simple

So I take on two quickie low cost, fast turn around projects and they are eating me alive!

The first is a ColdFusion reporting project that is simply supposed to take the existing statistics report and produce a chart using CFChart. Works fine on my CFMX6.1 development server but apparently IIS6 and CF7.1 don’t play nice when it comes to CFChart. The problem is with IIS but Adobmedillare has been kind enough to release a hot fix that doesn’t work. "This hot fix explicitly generates HTTP headers before the chart data."

The second simple project is a PHP COTS shopping system (x-cart) that needs some customization. Only, it’s not using PHP per se. The customizations are all done using SMARTY. The challenge with programming, particularly web application programming, is constantly having to learn new languages/frameworks/methodoligies and being able to turn work like its old hack.

Using this simple CFChart example works in CF6.1 and fails in CF7.01 even after the hot fix.

<cfchart>
   <cfchartseries type="pie">
      <cfchartdata item="New car sales" value="50000">
      <cfchartdata item="Used car sales" value="25000">
      <cfchartdata item="Leasing" value="30000">
      <cfchartdata item="Service" value="40000">
   </cfchartseries>
</cfchart>

Anyone have extra tickets for CFUnited? I’d love to go this year but can’t justify the cost of the event.

UPDATE: Just tried the ColdFusion MX 7.0.1 Cumulative Hot Fix 2 with no luck. Note the hot fix advises:

Any individual hot fixes previously installed that are now contained in this cumulative hot fix should be removed.

we recommend always using the latest version of the cumulative hot fix

In short, remove any previous *.jars and only install the latest fix.