Archive for the ‘Programming’ Category

NetBeans 6.5 Imminent with PHP

Sunday, November 9th, 2008

At long last, the 6.5 version of NetBeans is due to arrive in 10 days time. It’s been a long 7 months since the last major release of the IDE and application platform. This one, like so many others before it, is worth the wait.

One of the more anticipated features for NetBeans 6.5 is the native PHP support. This will mark the first version that embraces the ever popular interpreted scripting language. It appears that PHP 5+ will be required and that it will support code completion/highlighting, debugging (via xdebug), stubbing out database code and more.

In a recent blog post to the community, the PHP for Netbeans Team wondered aloud what PHP framework support developers wold like to see made available within Netbeans. The question set off something of a firestorm on the NetBeans blogging site resulting in the most highly voted upon issue in NetBeans history. While the voting is still open until the release of 6.5, Symfony , with its 400+ votes, appears to be a shoe-in for eventual support in the IDE. This is great news as Symfony is the most Rails-like framework I’ve ever used for PHP.

Sadly, do not expect to see the arrival of Symfony support very soon. It likely will not make an appearance until the next release. As a consilation, Prado has early support in NetBeans as the Team begins to investigate fleshing out a way to add framework support in a modular manner.

TIBCO: The Power of Now … and Marketing

Wednesday, November 5th, 2008

I’ve spent a week’s time being trained as a TIBCO developer. This was a fairly intensive class covering many topics in all day cram sessions. Bring the pain.

TIBCO’s slogan (The Power of Now) speaks to its ‘real time’ process driven abilities. Truth be told it is near real time as TIBCO uses polling in some cases to identify changes and take action as a result. But, I split hairs here. Slogans are the language of marketing lingo, not a white paper spec sheet.

Just What Is TIBCO?

To begin with, TIBCO is a company not a piece of software. This company develops and sells a suite of products that is often collectively referred to as ‘TIBCO’. It might be easier to discuss what the TIBCO software suite is not then to define what it is. The suite is just about as all encompassing a Borg-like piece of middleware on the planet that I’ve ever experienced.

Wikipedia, the web’s premier source of accurate information …. puts it thusly:

According to the company website, TIBCO develops solutions for the following: Application Integration, B2B Integration, Business Activity Monitoring, Business Intelligence, Business Process Management, Complex Event Processing, Data Integration, Enterprise Service Bus, Mainframe Integration, Master Data Management, Messaging, Rich Internet Application, SOA, System Monitoring and Management.

Can I get some kitchen sink to go with that? It’s not altogether intuitive. After the 2nd day of training, a well-regarded Senior Developer on my team turned to me and said, “I’m still trying to figure out just what this thing is and how all the pieces work together.”

This isn’t to say that the software doesn’t work. Quite to the contrary. The software has been around and evolving since 1985 with the TIBCO moniker being attached in 1996. Customers include such household names as Delta Airlines, Cingular, Intuit, Reuters, Seagate, and on and on. TIBCO is currently hosting 14 video testimonials. That’s marketing muscle that can’t be bought and speaks to the product’s usefulness.

Training. Once More Into the Breach!

My training centered around the Enterprise Service Bus, SOA, Data Integration, and Business Process Management. But these are just terms; buzzwords thrown about all over the web. The actual products that encompass these gaudy terms are TIBCO ActiveMatrix BusinessWorks, TIBCO Adapters, TIBCO Monitoring Services, and TIBCO ActiveMatrix Service Bus.

The latter of these products is the foundation of TIBCO’s software suite. The Enterprise Messaging Service Bus is the TIBCO implementation of the Java Messaging Service. There is support for other (primarily legacy) protocols but JMS is defacto. The bus allows for messages to be sent between disparate systems and actions taken upon those messages. Adapters provide a means for systems (like databases, LDAPs, application servers, etc) to talk to the bus where the messages, JDBC for example, are converted to TIBCO XML messages so the bus logic can process them.

Where’d That Logic Come From?

Enter BusinessWorks Designer; a Java desktop application built upon the Eclipse Framework. BusinessWorks is the place where the logic is defined in a graphical interface to the extent of how events are detected and what actions will take place based upon those events. The sky is truly the limit in regard to what can be done. For example, detecting a table insert in a database table which causes a logfile to be written, an email sent and SSL enabled web service called with XYZ parameters. Or, an email is received triggering an FTP transfer, followed by a mainframe COBOL app being called all inside a transaction.

I’m really not doing the products justice with this cursory description. I’m scratching the surface of all the functionality BusinessWorks provides.

The Rise of SOA Over 3-Tier

Just what is the Service Oriented Architecture that all those marketers are touting? The idea is to avoid the classic 3-tier architecture (client, app server, database) and instead allow the Messaging Service Bus act as the intermediary between platforms. In that way, the bus can take advantage of transaction support, change in execution path based on events or BusinessWorks programming logic, and making rapid change to architecture without having to update each service individually but by changing settings on the bus. This decoupling will better enable architects to provide services to services area such as Finance, HR, Accounting, and Helpdesk. The bus is Master Control.

Alternatives

There are alternatives available to TIBCO’s suite of products. Commercially IBM, SAP and Oracle provide their own competing products. I expect they cost quite a bit themselves. On the Open Source front, have a look at Mule, RabbitMQ, and Sun’s OpenMQ, among others.

Master Control Says, “End Of Line”

The Enterprise Messaging Service Bus is telling me I have to wrap it up now. I’ll post more on TIBCO as I put it into use in our development group. Just don’t expect deadly discs..

Pulling External Content Into XSL Using ASP

Tuesday, November 4th, 2008

Problem: how to pull content into an XSL transformation process using ASP. ASP will give us the opportunity to make runtime decisions. In my case, determining what sort of template XHTML code to retrieve for inclusion into the final page render.

Let’s say we have an ASP file called ASPResources.asp that retrieves XHTML content from a webserver by passing a filename like such:

Sample ASP:

<%
Class ASPResources

‘ Returns string of HTML content based on filename
Public Function GetHttpContent(fileName)

Dim xml, url, strData
url = “http://localhost/templates/” + fileName + “.asp”
strData = “”

‘ Create an xmlhttp object
Set xml = Server.CreateObject(“Msxml2.ServerXMLHTTP.4.0″)

‘ Open the connection to the remote server.
xml.Open “GET”, url, False

‘ Send the request and returns the data:
xml.Send()

‘ Return content
GetHttpContent = xml.ResponseText

‘ Cleanup
Set xml = Nothing

End Function

End Class
%>

Pretty basic stuff. You’ll want to add error handling and so forth.

Now, to perform the transformation, we have another ASP file called XMLTransformer.asp. This file grabs our XSL and XML files. Then, we create an XSLT (transformation) object from these. The next part is crucial (and bolded below). Instantiate your custom ASP class and add it to the XSL Processor providing a URN, in this case asp-resources.

Sample ASP:

<%
‘ Declare locals
dim xslt
dim xslDoc
dim xslProc
dim xmlDoc

‘ Create XSLT and XSL objects
Set xslt = Server.CreateObject(“Msxml2.XSLTemplate”)
Set xslDoc = Server.CreateObject(“Msxml2.FreeThreadedDOMDocument”)

‘ Load XSL
xslDoc.async = false
xslDoc.resolveExternals = true
xslDoc.load Server.MapPath(pathToXsl)

‘ Set the XSL on the XSLT
Set xslt.stylesheet = xslDoc

‘ Load XML
Set xmlDoc = Server.CreateObject(“Msxml2.DOMDocument”)
xmlDoc.async = false
xmlDoc.resolveExternals = true
xmlDoc.preserveWhiteSpace = true
xmlDoc.load Server.MapPath(pathToXml)

‘ Set the XSLProcessor
Set xslProc = xslt.createProcessor
xslProc.input = xmlDoc

‘ Create our custom object
Set aspr = new ASPResources

‘ Add custom object to XSL template
call xslProc.addObject(aspr, “urn:asp-resources”)

‘ Transform the document
xslProc.transform()

‘ Send the result
Response.Write xslProc.output

‘ Clean up
Set xslt = Nothing
Set xslDoc = Nothing
Set xslProc = Nothing
Set xmlDoc = Nothing
Set aspr = Nothing

%>

At this point, our custom ASP code is now available to the XSL Processor. That’s a happy place to be. But, we’re not quite done yet. We still need to call the custom object from within our XSL. To do so, it is necessary to add the new URN to the list of XMLNS (XML Namespaces) in the XSL file:

<xsl:stylesheet version=”1.0″
xmlns:xsl=”http://www.w3.org/1999/XSL/Transform”
xmlns=”http://www.w3.org/1999/xhtml”
xmlns:aspr=”urn:asp-resources”>

Without this, the XSL transformation will complain about aspr not being a valid namespace. But, with it, we now have access to the custom ASP code and can call its methods elsewhere in our in the XSL code:

<xsl:value-of
select=”aspr:GetHttpContent(‘header’)”
disable-output-escaping=”yes” />

Don’t omit the disable-output-escaping=”yes” parameter. Doing so will cause the parser escape the < and > characters (among others) breaking your XHTML output.

Here we are sending “header” as our filename to the GetHttpContent method resulting in a call to header.asp. This file itself can execute ASP code or simply return XHTML code. The call to GetHttpContent can be done repeatedly in the XSL each time sending a different filename parameter as needed.


All works licensed under Creative Commons Attribution-Noncommercial-No Derivative Works 3.0 Unported License. And that's a mouthful!