Alan Gunn

About Alan Gunn

Alan is one of the developers on the Fifth Element team and has been dedicated to his core clients for the past eight years. Outside of Matrix, Alan enjoys spending time with his wife and chocolate lab Rubi. They are often found cottaging, camping or boating. Alan and his family reside in Halifax, Nova Scotia, Canada. In his dream job he would be a sport fishing captain in the Florida Keys.

Tracking To Do Items In CF Comment Code using CFEclipse TODO

CFEclipse TODO tasks and custom tasks

While developing applications I’m always dumping code to the screen in order to troubleshoot, and CFEclipse TODO makes this more convenient for me.

The TODO feature allows you to track items on your “to-do list” in the comments of your code.

Example of CF comment code

In the task-list view, you can track and view any comment that contains the string TODO:. From the task view you can double-click on the task, and the relevant file will open up in the editor.

CF Task list

Another powerful feature with CFEclipse tasks is the ability to create custom tasks. I’ve created a custom task, CFDUMP:, with a high priority (Note the red exclamation point in above task list).

As in the case of TODO:, you can track and view in the task-list view any comment that contains the string CFDUMP:.

CF Comment string

Now I can keep track of all the code dumps I have in my code, which lets me remove them before an application is passed off to the client for review.

I hope this quick review makes it easier for you to start creating and tracking your tasks.

Search Results Pagination Look Odd? Try Pagination with Sortable Headers

I recently came across some client reports that, when initially run with search criteria, looked correct and displayed properly. However, that all changed once a user selected pagination. book turning pages

The search results soon began to look like nothing I’d searched for, and after a few clicks of Next and Back I could produce errors. When I drilled into the code, I found that the results were ordered by date, but the pagination used the ID of the record. Using the record ID would have been fine if we were only displaying a dump of the data and ordering it by ID, but to have a functioning useful report, this did not work.

I needed a way to order by any report column header, and for the pagination to keep intact the ordered by results as a user moved between the pages. After some quick research I came across the SQL Server function ROW_NUMBER(), used in conjunction with OVER(). This was exactly what was needed to accomplish the report column sorting and the pagination honoring the order throughout the pages.

The result: Users were now able to paginate results, as well as sort by column heading, making for a logical display.

Have you found any tips or tricks for search results?

Getting the Most Out of Solr

Solr homepage

Solr, a free, open-source search platform from the Apache Lucene project, is great search engine, but you can use it for much more than that. In addition to its amazingly customizable, high-performance search capabilities, one can use it as a  content management system (CMS) engine to display public-facing web pages, much the same way that Drupal does some of its content management on its public side.

Some content management systems are custom-built. Others are like the well-known WordPress and Drupal:  frameworks that have their own way of displaying CMS content to the public using a variety of APIs and methods. Often, these APIs can be complicated, requiring a fair degree of programming or coding skill. Solr, on the other hand, provides a very intuitive way to extract content from a database and display it to the public.

One of Solr’s many capabilities is its data import handler (DIH). This capability allows one to configure Solr to read almost any database and index its content.  This in itself is not terribly remarkable; however, it gives a very simple way to extract content just as one would search for things on the internet using search engines like Google, Bing, etc.

Solr can be used to retrieve content by searching for certain taxonomies or tags, which is a function of most content management systems on the public side. The difference here is that a person doesn’t need specific coding skills in any particular language to be able to retrieve desired content and display anywhere they like in a page. Once a few simple tools have been built by a developer – in particular, providing a simple API whose input is a search pattern and whose result is a set of search results – Solr provides everything that a non-developer would need to display content.

An excellent case study is the Carnegie Endowment for International Peace, a private, nonpartisan, nonprofit organization dedicated to advancing international cooperation and promoting active US engagement across the globe. Their in-house web development team worked with Matrix Group to use a combo of Solr and a simple API to generate content by simply providing search queries and then displaying the results of those queries on their site.

The advantage here is that their team doesn’t have to understand the particulars of the site’s CMS but only has to come up with the right query to extract the right results. This freedom allows them to easily construct new web pages with no developer assistance whatsoever. Not only is this a cost-saving convenience but it also yields performance gains. Because Solr has advanced caching abilities, queries that generate content often outperform traditional SQL-based retrieval methods. In addition, by using Solr a security gain is realized; a Solr query is not vulnerable to SQL Injection attacks.

Solr, when used as a content generator, provides an intuitive, non-technical integration with almost any SQL-based CMS. This middle-ware approach is easily scalable, affordable, and often boosts performance in the rendering of web pages.

Have you used Solr in this way? What did you think?

CodeAcademy: Free online learning resource

Want to learn to code but just don’t know where to start? CodeAcademy

Codecademy offers a great online interactive resource to begin learning a multitude of coding languages, including:

  • Javascript
  • Web Fundamentals (HTML, CSS)
  • Python
  • Ruby
  • jQuery

Each interactive course is broken down into individual exercises where you use the built-in editor to write your code and output it in the interpreter.  At the completion of the course exercises, you can complete a project that will tie all the elements learned in the individual exercises together.

Helpful features, such as a Q & A Forum, help you along the way.  If you’re stumped or need a refresher of what a term means there is a Glossary for each programming language. And if you want a break from lessons to experiment with the code and concepts you are learning you can use the “Scratch Pad” which is a blank editor and interpreter to play around with.

To make things more entertaining you earn points for the number of exercises you complete and badges for completing courses, streaks for the number of days you did exercises, etc.

If you want to tie multiple code, concepts, and or languages together there are lessons to build projects and APIs.

It’s a great learning tool and best of all, it’s FREE!

What other great online learning tools have you discovered/used?