Category Archives: Programming/Web Design

Contains posts related to web development, design, and general software programming.

CSS: inline-block and overflow:hidden

When an element has a display value of inline-block and an overflow (or overflow-x) of hidden, its container gets a few px of extra height. Here’s an explanation of why… https://www.brunildo.org/test/inline-block.html. A fix, where applicable, is to add vertical-align: top to the element.

Strip trailing, or repeated, delimiters in a CF list

Found a helpful trick at http://stackoverflow.com/questions/182455/coldfusion-and-trailing-comma – if you want to clean up a list in ColdFusion, take advantage of the fact that CF list functions ignore empty elements. ListChangeDelims() consequently strips off that last “element”. var cleanList = ListChangeDelims(DirtyList, “,”, “,”); For example, I often need this when building an url or file path, […]

Accessing i18n message in Grails service

Seems (to me) like an obvious need – referencing a translatable message in a service in a Grails app. But you can’t just use g:message – well, I’ve seen some workarounds that let you access the g namespace, but that doesn’t really seem advisable. I just want message handling. I found several references to the […]

Grails beforeUpdate filter fails without log.info

Ok, I know I’m missing something here, but I don’t know what it is. At any rate, trial and error has taught me that my beforeUpdate (and probably beforeInsert too, just haven’t tested that yet) prevent the update (or insert?) from completing, unless I add some extra code to “jiggle” it. Sounds crazy, right? But […]

Reserved words in Grails?

So, I found this list of reserved words in Groovy, but a few times I’ve run into others that seem to be problematic. Not sure if they are actually “reserved”, or where the conflict is for each, but I know I had problems… alternate – so, I had a domain Course, and another domain CourseAlternate […]

Use “name” to add an “id” attribute to g:form (in Grails)

If you want to use the simple syntax <g:form action=’myaction’ />, adding id=”x” will result in a form post to /myaction/x – to get a post to /myaction with a form id attribute of “x”, use the name attribtue instead, as <g:form action=’dologin’ name=’x’ />, per this thread: https://jira.grails.org/browse/GRAILS-895 Alternately, you can use the syntax […]

In Rails, html_safe is an adjective, not a verb

Note that in Rails, string.html_safe means that string is known to be safe html, and should not be escaped; otherwise, all strings are escaped by default (for output). It does not mean that string should be escaped to become safe!

Comparing strings to potentially null values in Rails

I’m fairly new to Rails, and Ruby, for that matter, and not yet sure of some basic things. I’ve read a bunch about how to test for (and not test for) nil or empty, and also about how to avoid that need – for instance, see this very useful post on keenertech.com. But, I can’t seem […]

Regular Expression for extracting US Zip Codes

Extract a zip from a a single line extracted from a multi-line address or a single form field, which may or not be zip+4 format, and which maybe on its own, following a city and/or state, and maybe preceding a country