Central Alabama ColdFusion User Group - 2012


Home Employment Why ColdFusion? Demonstrations Archives Tips Other Groups Local Sites

2012 2011 2010 2009 2008 2007 Beginnings

Employment

2 February Meeting

Arrays

For other programming languages, arrays are solid structures. When they are defined, all the cells in an N-dimensional matrix are defined. This is not the case for ColdFusion Markup Language (CFML) "arrays."

ColdFusion "arrays" are not arrays in the traditional sense. They do not consist of a list or lists of consecutively numbered cells. They are not spreadsheets or solid structures of (for example) X by Y by Z cells. They are not even nested lists.

The usual way of conceputalizing relationships is through a spreadsheet or cube arrangement. If you immerse a cube into liquid (representing server memory), it would displace X by Y by Z cells of volume, even though many of its cells aren't used.

The best three-dimensional analogy for a ColdFusion array may be berries on a bush that has many branches of varying lengths. Only the individual berries (cells) you have defined will exist, as far as ColdFusion is concerned. If you immmerse such a bush into liquid (representing server memory), it only displaces space for the cells you have defined, not for every cell in the matrix.

ColdFusion arrays conserve memory. No space is wasted on undefined cells, not even on pointers to them.

However, to use this advantage effectively, we have to understand that using ColdFusion arrays has to be a little different from using arrays defined by other languages.

Most familiar programming constructs to access arrays usually expect data to be stored as if it were in a spreadsheet or cube. That works fine when memory is reserved for every cell, even the unused ones.

However, this approach it fails with ColdFusion arrays. When code encounters an undefined cell (as it will very quickly), it dies with an error.

You could use the arrayset function to predefine all of the cells for a given dimension of an array in order to treat a large array as a big cube. That's one approach to handling this situation. However, it's wasteful. It would waste the space that ColdFusion is trying to conserve by default.

Almost as bad would be to use cfparam to hunt for data; it will fill a cell if it doesn't exist, but at least it won't fill an entire dimension at once.

The least wasteful way is to take typical code used to access an array and place that code inside a cftry-cfcatch block. This way, the code can be made to ignore the error that occurs when it tries to read an element that doesn't exist, and it works without wasting memory.

5 January Meeting

Business Structure

This may seem like a strange topic for a ColdFusion meeting. A variation on an old joke might say: "I'm not a doctor; I only play one on TV!" Advice on the subject of whether to set up a regular corporation or go for the Subchapter S option was the focus of discussion. Here's now things shook down. [Your mileage may vary!]

Subchapter S's Biggest Drawback - Hobby Loss

Subchapter S's Biggest Plus - Profit

Won’t Matter - Passive Income

Won’t Matter - Wages

Won’t Matter - Conference Expenses and Travel

Won’t Matter – Education (and associated travel)

How Does the Money Flow?