Category Filtering: 'Java'

Remove Filter

Couchbase NoSQL Replication ColdFusion ORM

Posted by Luis Majano
31 Jul 2013 10:03 PM

We just published part II of our integrating Couchbase NoSQL with ColdFusion series which focuses on Couchbase replication, XDCR, failovers and an intro to secondary caches for Hibernate: Check it out:

Couchbase NoSQL For ColdFusion Series

Posted by Luis Majano
26 Jul 2013 07:26 PM

We have just started a cool new blogging series over at our Ortus Solutions blog about how to leverage Couchbase NoSQL Server in your ColdFusion applications.  If you are thinking or already implementing NoSQL databases in your infrastructure, these series are for you. Check it out:

What's your favorite Messaging Broker-Server?

Posted by Luis Majano
18 Dec 2010 05:49 PM
I have been doing a lot lately with Messaging with ActiveMQ and been loving it so far. However, I am very interested in other peoples experiences with other messaging brokers and servers like RabittMQ and more. What are your preferences, experiences and recommendations?

Regex Negative Lookahead, so powerful!

Posted by Luis Majano
11 May 2010 12:21 PM

I am a big fan of regular expressions.  They are so mysterious and elegant, I love them and hate them, cherish them and despise them.  In other words they are both beautiful and nasty, but they can really get the job done.  I was intrigued today when a colleague of mine was asking how to match a string but if it started with a specific sequence then do not match.  In my regex coolness I said “Sure, that’s easy man!”, whipped out QuickREx in Eclipse, wrote down a quick jolt of brilliance and BAMM!! I hit the brick wall at 90! Nothing I was trying would work, characters where matched not the word:

   1: ^([^search].*)dev\.domain

Basically match any incoming domain that ends with dev.domain but it should not be preceded by the word search.  I really thought I nailed it with that regex, but NOOO, it matches character classes not full words.  So I had to revert my humble ego and go back to the books and voila: Positive and Negative LookAhead!

Granted, some regex engines do not support look behinds, but thankfully java does.  Here is a cool definition:


Zero-width negative lookahead. Identical to positive lookahead, except that the overall match will only succeed if the regex inside the lookahead fails to match.

And finally and AHA!! moment.  I can use the lookahead:

   1: ^(?!search|training).*dev\.domain

AND BUYAAA!!!  I think this can help somebody out there. It helped me!

Checking if one array is a subset of another

Posted by Luis Majano
28 Apr 2010 11:13 AM
This is more of a reminder than anything else.  A co-worker needed to figure out if one array was contained as a subset of another and of course we go back to our good 'ol friend java for this and the collections interface:

isSubset = arrayA.containsAll( arrayB )

Simple and easy!  Here are the Java API Docs just in case you want to read some more!

Why Model with UML?

Posted by Luis Majano
18 Jun 2007 12:00 AM
As you all know by know, ColdFusion is an excellent OO platform for web development and as our systems grew in complexity and maintainability we need to plan REALLY WELL!! The best way we can is UML, the Unified Modeling Language. The purpose of the Unified Modeling Language is to provide a language-independent and platform independent modeling notation. UML tools are as versatile as the UML is foundational.

I am so used to modeling in UML now that it is a REQUIREMENT for any project, no matter how small or how big. In that sense, some of you may be beginning to see the benefits of object modeling and may wonder how in the world to start. Well, I found a great article in the NetBeans website that touches on why to use UML and provides some great samples. Although it is directed to the Java developer, I believe a ColdFusion developer can gain some benefit from it.

Why Model with UML?

Converting structures/arrays to their string representations!

Posted by Luis Majano
21 Apr 2007 12:00 AM
The following is a very useful JAVA tip for ColdFusion developers. Ever wanted to log a structure or array easily into a log file or use it as a string without actually looping and parsing to a string variable? Well, you always had the method right there lurking in the misterious but powerful Java world. The all ecompassing toString() method.

Actually all java.lang.Object inerit a toString() method as you can read in the java docs.

Below is the actual info:


public String toString()

Returns a string representation of the object. In general, the toString method returns a string that "textually represents" this object. The result should be a concise but informative representation that is easy for a person to read. It is recommended that all subclasses override this method.

The toString method for class Object returns a string consisting of the name of the class of which the object is an instance, the at-sign character `@', and the unsigned hexadecimal representation of the hash code of the object. In other words, this method returns a string equal to the value of:

getClass().getName() + '@' + Integer.toHexString(hashCode())


a string representation of the object.

As you can see, this method can be very useful. So how do I use it in Coldfusion? Very easily, jeje. look below:

//Create a structure

myStruct = structNew(); = now(); = "luis majano";

myStruct.url = "";

//Convert to string


And there you go ladies and gentleman!! Enjoy this quick tip!!

cfdirectory recurse emulation alternative: the Java Way (For BlueDragon, etc)

Posted by Luis Majano
14 Mar 2007 12:00 AM
As you know, ColdBox is now fully supported for BlueDragon and Railo. However, to port it was a bit tedious when it came to the auto-registration engine for handlers, since I need to traverse the handlers directory recursively and create an array of handlers. This is so easy in Adobe ColdFusion, but BlueDragon and Railo, does not support it (BD 6, railo 1). Here is the Adobe ColdFusion code:

That is awesome!! So easy!! Well, to do it the Java Way, takes some patience and well, some insight into recursion. The following example is using the CF/JAVA hybrid notation, but the end result is the same as above. And with some speed tests, the code actually compares, not that much of a slow down. So :)

Here is my call to the recursion, the entry point:

What I do is call my recurseListing method with the handlerArray I want the results in, the handlersPath into the initial directory and the working directory. Why do I send in the HandlerPath again? Well, I do it, to actually clean the path to show me the invocation paths, mumbo jumbo!! Give me the code!! Here it is:

Remember that this code is not to get the query like cfdirectory, it could, but you will have to do that, I am just showing how I solved my problem. This is a great exercise also.

//Init the oDirectory object with the initial working directory (Java File Object)

var oDirectory = CreateObject("java","").init(arguments.Directory);

//Get an array listing of the objects in the directory

var Files = oDirectory.list();

//My Index.

var i = 1;

//My temp File Object

var tempfile = "";

//My clean handler string.

var cleanHandler = "";

//Loop Through listing if any files found.

for ( i=1; i lte arrayLen(Files); i=i+1 ){

//get first File reference as a File Object

tempFile = CreateObject("java","").init(oDirectory,Files[i]);

//Directory Check for recursion, if directory, then recurse.

if ( tempFile.isDirectory() ){

//recurse, directory found, send in the new directory path.

arguments.fileArray = recurseListing(arguments.fileArray,tempFile.getPath(), arguments.HandlersPath);



//File found

//Filter only cfc's, I could have used a Filter Java object, but was lazy.

if ( listlast(tempFile.getName(),".") neq "cfc" )


//Clean entry by using Handler Path (For my specific purposes)

cleanHandler = replacenocase(tempFile.getAbsolutePath(),arguments.handlersPath,"","all");

//Clean OS separators accordingly

if ( getSetting("OSFileSeparator",1) eq "/")

cleanHandler = removeChars(replacenocase(cleanHandler,"/",".","all"),1,1);


cleanHandler = removeChars(replacenocase(cleanHandler,"\",".","all"),1,1);

//Clean Extension right off baby

cleanHandler = getPlugin("fileUtilities").ripExtension(cleanhandler);

//Add data to array, a cleaned Handler, thank you GOD, bless you.




//else return the empty array or filled array.

return arguments.fileArray;

There you go, you can follow the comments to tell you what I did. This is an awesome exercise and shows you how ColdFusion is really powerful by leveraging its Java backbone. When things like this just work, it just amazes me of how ColdFusion has evolved and how EASY it is to overcome problems by leveraging Java. Viva Java Mis Amigos!! Viva!! Viva!!

Hope you enjoy this little java/cf/recursion tutorial. This example shows potential of how you can build your own recursion methods.

Java 6 is out and its open source!!

Posted by Luis Majano
13 Dec 2006 12:00 AM
If you have not heard this, SUN just launched Java SE 6 and made it open source!!!


Open java Feature

Java SE 6

So please check it out.

Argo UML a great UML documentation Tool

Posted by Luis Majano
12 Sep 2006 12:00 AM
If you like documentation like me!! Well, I guess I am kinda in the dark here since not many people like documentation. This is the tool for you. I am now using it more and more. It is called ArgoUML and you can find it here:

It can be used either through Java Web Start or a full package download. Give it a try and please DOCUMENT!!!

If you want people to use your software to build software, then document. Make it easy!!

Site Updates

Entries Search