Marcos Placona on June 4, 2013

Reading time: 2 – 4 minutes

You will have noticed I deviated my blog posts quite a bit from CFML in the last couple of months. That doesn’t mean I don’t love it anymore, but just that I’ve been “putting my eggs on lots of other baskets” lately.

This blog is hosted on a VPS, and I haven’t really found it necessary to have any CFML engine running on it. I could allocate some memory to have a tiny instance of Railo running, but I’d prefer not having to deal with something else running, since it could easily crash, and take me months to actually realize it. This happened to my Langithub project the other day, and I simply didn’t notice until someone pinged me to let me know.

However, I do sometimes want to post working examples written in CFML, and I could simply use some of the few free services out there, but… I’d rather not.

So for a blog post I’ve been working on, I decided I’d give cloud hosting a go. I’ve been playing with AppFog for a few weeks now, and noticed it’s got a Java Application option listed on the application types it supports. I then went ahead and created one of them called railo.

AppFog Java App

This now gave me an empty Java Application.

Knowing the folks at Railo provide a download in war format, I went ahead and downloaded it

Railo .war download

I’ve put it on $ ~/marcos/railo, but you can put it anywhere you want.

Now within that folder from console, I issued:

This will do two things.

  1. Prompt you for your appfog login and password
  2. deploy the .war file to the railo project

You will then see a few other things will happen, as it will now be decompressing the war file, and starting your application.

If you now browse your application (using the URL provided by AppFog appending index.cfm to it), you will see Railo has been installed, and you can start rocking on the Cloud.

The example I used here can be seen on http://railo.eu01.aws.af.cm/index.cfm

Marcos Placona on May 17, 2013

Reading time: 2 – 3 minutes

No catches here, all you need to do to get a free e-copy of my new book

jQuery Drag-and-Drop Grids How-to (UK , US)

Is read the book, and then write a review of it on your blog.

And I’m not asking you to write a good (or biased) review either. I’m just asking for some feedback. I’ve had a couple of people already writing reviews on their blogs, Google+ and Amazon, but more the merrier. And I want to know what YOU think!

For those who haven’t seen my previous blog post about having published this book, this is my first ever book, and while I have written hundreds of technical articles, none of them have actually made this far on the “publishing chain”.

And this is why I want to have all the feedback I can get. Again, YOU are the sort of person who buys the sort of books I write, and it’s YOU I wanna hear from.

There are 5 free e-copies up for grabs,  and I’ll give it away to the first 5 people who show interest in reading and reviewing my book.

Well, that’s gotta save you some money eh?

So get in touch by leaving a comment to this post, or via contact form with your name and blog URL. I’ll then get you your free copy, and all I ask in return is to be notified when you’ve published your review.

Marcos Placona on April 18, 2013

Reading time: 3 – 5 minutes

So, I decided to take a punt at writing a NodeJS application. Not a big application, or anything that would get me slashdoted, but an application that would help me understand the language, and give me a taste of what it is so many people are talking a bout. I have worked with JavaScript for quite a while now, and NodeJS seems like one of those “just right” languages, that you pick up in an afternoon and come to love it after writing a few lines of code. I read a few tutorials on the subject. And then decided to dive straight into building a small application that uses GitHub’s API. There were three things I wanted to take out of it:

Installing everything was painless, but I have to admit getting NodeJS to build on a Raspberry PI wasn’t the most straight forward thing I’ve ever done. Not because it wouldn’t work, but because building it from source took forever. Just to clarify, I didn’t need to run it on a Raspberry PI, but just wanted to prove myself I could. This mini project had 5 elements to it:

Three from which you don’t even need to install (as they are npm modules). Just by adding them as dependencies on the package.js file, they get installed into your project, so deploying is made easier (in theory), as you don’t actually need to install anything other than NodeJS.

Now you might be asking yourself why I say “in theory” when taking about deployment. The fact is that deploying a NodeJS application is a pain, since all you end up doing is making [your preferred webserver here] proxy all the calls to your local application. Why? you may be asking…

The fact that each NodeJS application you create establishes its own server, means anything will clash with your already installed webserver, since you can only have one webserver per TCP port. So if you want to host all your applications as well as any new node project you come up with, then you will end up taking this route. It’s not terrible, but just means you now need to support yet another thing. There are tools out there to help you with such thing, but let’s not digress.

Building the application was fairly painless, and using Jade was the big highlight for me. For a while now I had looked into templating engines, and really wanted to delve into it a little more. I had previously looked at jQuery Templates, Ext and Dust.js, but Jade is totally different, in a way that actually pleases the eyes (except when it doesn’t :-) ).

Did I become a NodeJs expert? No way!

Will I keep looking and building sexy applications with it? Heck yeah!

Enough about me though.

Have a look at the application I wrote here, and make sure to send me pull requests if you would like to improve it.

Marcos Placona on April 10, 2013

Reading time: 3 – 4 minutes

A few months ago I was contacted by Packt Publishing about a new project they had in mind and thought I’d be a good fit for.

The challenge was to write a book about one single topic that would enable readers to learn and become proficient on that topic in about an afternoon.

Anything with 200 pages would be too much, so I had to keep the book very lean while keeping the reader interested, and giving her enough ground to be able to build a final project just with the information contained on the book.

I had a pre-set topic as well, and had to stick to about 35 pages of content. If you remember, a while ago I wrote an article about how to do drag and drop with jQuery.

While the article was only about dragging and dropping DOM elements, I was asked to write a book on how to drag entire layouts on the screen, and allow users to fully customize their experience.

I set off by providing the publishers with a proposal of what I thought the structure of the book should be, and decided to use Gridster as the plugin for drag and drop.

If you haven’t heard about Gridster, it’s a very nifty jQuery plugin that allows you to do layout drag and dropping, and has lots of cool API functionalities embedded in it that allow you total control over your layout’s mobility, and immediate feedback on all your elements.

On the book, I take the reader through the whole process of downloading and adding the library to their website, until the point they can actually create a fully functional metro styled layout that allows users to drag and change positions on every item on the screen.

So without further ado, here’s my book…

Instant – jQuery Drag-and-Drop Grids How-to

jQuery Drag-and-Drop Grids How-to

jQuery Drag-and-Drop Grids How-to

It’s available on all major stores such as:

Amazon UK

Amazon.com

Safari Books Online and I hear B&N are also stocking it, but sadly it’s not yet available on their website.

Hope you enjoy it! ;-)

Marcos Placona on April 1, 2013

Reading time: 3 – 4 minutes

It’s no secret that on the UNIX world, dotfiles play a very important part when it comes to making your terminal look good. Be it on Linux, be it on a Mac. Dotfiles are there so you can configure your favourite software to look just the way you like it.

I especially use dotfiles to customize the look on my terminal, and to manage bundles I use with Vim. One thing that normally annoys me, is the fact that whenever I rebuild my machine (or build a new one) I need to copy over my dotfiles, and obviously make sure they are kept up-to-date on all my devices when I change something.

I’ve heard about people adding their dotfiles to GitHub, and even noticed GitHub themselves encourage you to do the same. I decided to give it a go, and will describe here what you need to do in order to have your dotfiles stored there, and most importantly, how to quickly load them up on any other computers boxes you may have.

Start by creating a folder called “dotfiles” on your home directory, and move all your dotfiles into it.

In the example above, I’m only covering my vim and bash dotfiles. You can cover as many as you like by simply moving your files into the dotfiles directory.

Now it’s time to create your install script also under our ~/dotfiles directory. You should use this script every time you want to install your dotfiles on a given machine. So let’s open vim (or your favourite text editor) and create the following file:

The file is pretty simple, as it contains a list of files which you want to have copied, and a loop to put them on the right location and create symlinks on your home directory.

Now, it’s really important that you name this file correctly, as you want to be able to execute it. And after having created it, we need to give it execute permissions, as we want to be able to run it

If you run this file now, you should see the following happening on your screen:

Good. We’re ready to push this to GitHub, so we never have to go through this process again.

Go ahead and create  a new repository on GitHub called dotfiles.

Now, back to your terminal and run the following commands:

From top to bottom we’ve done the following:

  1. navigated to our newly created directory
  2. turned it into a local git repository
  3. added all the files it contained into our local Git repository
  4. committed all the added files into the new local repository
  5. hooked up our local git repository with the GitHub repository
  6. pushed our files to the remote (GitHub) repository

If everything went OK, you should now be able to browse your remote repository (mine is https://github.com/mplacona/dotfiles) and see all your dotfiles (as well as your installer) listed there.

Now, the beauty of it, is the fact that whenever you want your dotfiles in any other box, you can simply do the following:

All your settings will be copied and applied.

As previously mentioned, my dotfiles are in https://github.com/mplacona/dotfiles, so fell free to fork it, modify and maybe even collaborate.