Category Archives: General

Creating a background process in Lucee


Lately at work I have been using ColdFusion event gateways to accomplish a few very specific tasks. I thought it might be cool to see if I could leverage CFThread on Lucee do accomplish some of the same things.

The first step was writing a working demo with ColdFusion. A buddy was kind enough to point out that using an event gateway with a cfthread running inside of it was doing extra work for nothing. Event gateways were introduced before cfthread so I went ahead and just refactored it back as a regular ColdBox service. Everything was running smoothly in ColdFusion.

Next was trying to port the same code to Lucee since that is what I tend to run for personal projects. The one road block I did run up against is cfthread terminating at 50 seconds, the default request timeout for Lucee. It turns out there is a simple fix for it, but it made me scratch my head for a while since I didn’t run into it on ACF. The code with fix is below.

It was not a hard fix (setting the request timeout extremely large), but it did take a bit of google-fu to figure it out. Interestingly enough, setting the request timeout to zero did not work.

Advertisements

Goodbye 2015


It seems that 2015 is coming to a close and I thought it would be a good time to compose my fourth and final post of 2015. It has been a slow year blogging but that is not to say I have not been busy.

I have been working almost exclusively with ColdFusion almost 20 years now which is almost half of my life as scary as that is to say. This year has been focused on learning new methods and technologies. I spent quite a bit of time this year picking up the NodeJS stack. As a front end developer I have written a lot of jQuery interacting with the DOM. Using javascript to write a server just seemed plain awesome. Moving forward I have a feeling many of my personal projects will be built on top of NodeJS.

After my crash course on NodeJS the natural progression of things led me to AngularJS. I will have to say this one was a real pleasure. After so many years of using jQuery to modify the DOM after it was rendered it was refreshing to use javascript to actually render the DOM. I have been splitting my time between working with Angular 1.x branch and also trying to pick up Angular 2 since it is getting closer to a stable release.

Finally I have been working with GitHub’s Electron to build cross-platform desktop apps. Mostly this has been writing tools I can use for work since that would actually push me to learn Electron and Angular. Writing an application once and being able to build it for Mac/Windows/Linux is just awesome. My teammates at work have enjoyed the fruits of my labor.

Aside from that I have played a lot of games in 2015. I enjoyed Destiny for a while, but really my old standby is Diablo 3. I am excited to see what 2016 has to bring and I hope all of you have a happy and safe new year!

 

April update


It has been pretty quiet around here for a while so I thought I would go ahead and post a quick update and get my first post in for the year. There have been quite a few things keeping me busy lately and the day job keeps me busy more often than not so here is my current list in no particular order.

ColdBox 4
If I loved ColdBox any more I would probably have to get a room. I have been playing with CB4 since the bleeding edge releases but I have switched some of my 3.8 projects over to 4.0. A lot of hit has to do with compatibility since the core was cleaned up.

Google OAuth 2 Integration
Having to rewrite user authentication for every application seems a bit of a drag, especially when user authentication can be handled by somebody else. To that end, I am looking to have Google handle all my user authentication going forward. Ray had some code for hooking into Google’s OAuth2 implementation and I am working on getting that wired in to CB4.

Lucee Application Server
I have used Railo for years and I was sad to see it would have no more updates. Then Lucee was announced and I was cool again. I spent a few weeks tuning my installation process and moved away from the automated installers to custom installations. I have always been a bit of server geek so this was right up my alley.

Node.js/Socket.io
I have been wanting to get in to Node.js and Socket.io for ages, but time has always been a factor. However, lately I have been looking into ways to leverage websockets aside from a chat application (I wrote one of those too) so I finally sat down and learned just enough for me to be dangerous. It was pretty easy getting socket.io to talk to the ColdFusion server through API calls. Next will be figuring out how to get CF talking to node.

2014 in review


The WordPress.com stats helper monkeys prepared a 2014 annual report for this blog.

Here’s an excerpt:

The concert hall at the Sydney Opera House holds 2,700 people. This blog was viewed about 44,000 times in 2014. If it were a concert at Sydney Opera House, it would take about 16 sold-out performances for that many people to see it.

Click here to see the complete report.

Sublime Text not refreshing the sidebar


As much as I love Sublime Text one issue that has really buggered me is that occasionally when deleting a file the sidebar will not update. Also, when creating a new file it won’t necessarily show up in the sidebar either. Admittedly, my project structure is pretty wild and spans about six mapped drives, but it is annoying none the less.

Today I finally snapped and did some google-fu and found a solution. It looks like it annoyed someone else and they wrote a plugin to fill that gap call syncedSideBar. You can easily install through package manager or find it here: https://github.com/sobstel/SyncedSideBar

I am posting this here as a reminder to myself but I thought someone else may find it helpful. A big hat tip to the author.

2013 in review


The WordPress.com stats helper monkeys prepared a 2013 annual report for this blog.

Here’s an excerpt:

The concert hall at the Sydney Opera House holds 2,700 people. This blog was viewed about 51,000 times in 2013. If it were a concert at Sydney Opera House, it would take about 19 sold-out performances for that many people to see it.

Click here to see the complete report.

Nginx/Railo connector for SSL-enabled sites


I was asked if I could provide my Nginx configuration for SSL-enabled sites yesterday so I thought I would write up a quick post. This is very similar to creating a standard site container with the addition of another server block that will be listening on port 443. Also, any traffic that comes in on port 80 will automatically be redirected over to the secure site. Nginx will handle the secure portion of the connection so there are no settings to modify on Tomcat. It should “Just Work” ™.

I will be referencing the additional configuration files that are outlined in My Final Nginx/Railo Connector post. Below is the template I use for SSL-enabled sites:

The important differences here are the ssl keys: ssl, ssl_certificate and finally ssl_certificate_key. Now I need to generate the certificate and certificate key that I am going to use. For clarity, here is the excellent post explaining how to generate the SSL keys. Although this is outlined on older versions of Ubuntu it should still work just fine.

Once the new keys have been generated and put in the proper place (/etc/ssl/certs and /etc/ssl/private) it is only a matter of restarting Nginx and enjoying the SSL goodness.

Chat demo ColdBox application pushed to GitHub


Back in June I ported a simple chat application so that it would work with the Coldbox framework. Brad Wood suggested making the entire application freely available on GitHub instead of posting the individual components as Gists. Well, I finally got around to doing that and you may find my entire demo site here:

http://github.com/robertz/Demos

As long as your server supports SES URLs you should be in business. I do use submodules with my git projects so you will have to ensure that the coldbox-platform submodule is initialized.

I also have been playing around with Vagrant so I can easily spin up a virtual machine that matches my production environment. I have a box setup with Railo using Nginx as a proxy that I am currently using for development and if anyone is interested I may make that available for download. It is great to start working on a new project and just typing “vagrant up” to spin up the dev server without having to worry about doing a server config. Vagrant is just awesome.

Coldbox files for chat demo


I was asked if I could provide the files for the latest chat demo I came up with that was rewritten in Coldbox. I do not have this zipped up as a package, but here are the core files.

Enjoy!

ChatService.cfc

endpointChat.cfc (API endpoint handler)

chatdemo.js

Simple CF Chat updated to work with ColdBox


Over the long weekend I had a chance to really dig in to ColdBox. We use ColdBox pretty exclusively at work and digging into the framework and getting to the nuts and bolts of things just made sense. My first “hello world” application was porting my old CFChat application over to ColdBox and get it up and running using routes, services and handlers.

The code was pretty ugly when I first posted it up. I went ahead and rewrote the whole thing from the ground up and fixed some of the glaring issues that bothered me since I first “released” it. I also threw out the old javascript file and rewrote that from scratch. 

This was pretty much a dead end project as I could probably implement something much better as a web service, but it did introduce me to a lot of core concepts in ColdBox and that is what it was all about anyway, really.

If you are interested in checking out the shiny new stuff you can check it out here: http://demos.kisdigital.com/demos/chat.