Let’s say for example you have a simple forum on your site. When ever a new post is added, you want to associate a date/time with the post.

Using SQL and ColdFusion there are three ways to do this:

INSERT INTO
    Forum(body, dateTimeInserted)
VALUES(
    <cfqueryparam value="#form.body#" cfsqltype="cf_sql_longvarchar">,
    <cfqueryparam value="#now()#" cfsqltype="date">
)

OR

INSERT INTO
    Forum(body, dateTimeInserted)
VALUES(
    <cfqueryparam value="#form.body#" cfsqltype="cf_sql_longvarchar">,
    GETDATE()
)

OR

Set your default column value to ‘GETDATE()’ (in MSSQL)

INSERT INTO
    Forum(body)
VALUES(
    <cfqueryparam value="#form.body#" cfsqltype="cf_sql_longvarchar">
)

The third has always been the most recommended method. The reason being less network traffic and the SQL Server is the common denominator between the SQL Server and your application servers.

Now introduce ColdFusion ORM into the mix. The default value method still works when you set the property attribute of “insert” to false in your bean.

component persistent="true" table="Forum" {
    property name="ID" fieldType="id" generator="native";
    property name="body";
    property name="dateTimeInserted" insert="false";
}

However the case where it doesn’t work as needed is when you save the entity and load all the entities within the same ORM Session (ColdFusion request).

So let’s say our controller method looks like this in FW/1:

void function forum( required struct RC ) {
    if( structKeyExists( RC, "body" ) ) {
        getForumService().add( body = RC.body );
    }
    RC.forumEntities = getForumService().get();
}

Because the entity we just saved is still in the same ORM session, it doesn’t look at the database again for it. But because we rely upon SQL to add the timestamp, ORM doesn’t know about it yet. Thus it returns an empty string instead of the date and time it was added.

So we get something like this record set:

1|’Body 1’|’1/25/2014′
2|’Body 2’|’1/26/2014′
3|’Body 3’|”

This is of no use to me. I suppose I could loop through the array and if one has an empty date/time added value, then reload that entity, but that seems like overkill for my application.

So in the end, unless precise date/time stamps are needed, I’m going to use the application server’s date/time (now()) instead of SQL’s GETDATE() default.

void function add( required string body, required date dateTimeInserted ) {
    var forumEntity = entityNew('forum');
    forumEntity.setBody(arguments.body);
    forumEntity.setDateTimeInserted(arguments.dateTimeInserted);
    entitySave(forumEntity);
    ormFlush();
};

Portrait of an ISFP

Posted: February 20, 2014 in Uncategorized
Tags:

My sister had her family take this personality test and found it pretty dead on for results. Intrigued, and with a little push from her, I took this test.

Granted it cost me $5 and it’s a horrible, horrible website… the results where about 90% accurate. I’m not an animal lover (along with being allergic to many of them) and my creation of art is nil (unless coding is considered an art).

I suggest finding out more about yourself at https://www.personalitypage.com/html/indicate.html

Here’s mine: Introverted Sensing Feeling Perceiving

The Artist

As an ISFP, your primary mode of living is focused internally, where you deal with things according to how you feel about them, or how they fit into your value system. Your secondary mode is external, where you take things in via your five sense in a literal, concrete fashion.

ISFPs live in the world of sensation possibilities. They are keenly in tune with the way things look, taste, sound, feel and smell. They have a strong aesthetic appreciation for art, and are likely to be artists in some form, because they are unusually gifted at creating and composing things which will strongly affect the senses. They have a strong set of values, which they strive to consistently meet in their lives. They need to feel as if they’re living their lives in accordance with what they feel is right, and will rebel against anything which conflicts with that goal. They’re likely to choose jobs and careers which allow them the freedom of working towards the realization of their value-oriented personal goals.

ISFPs tend to be quiet and reserved, and difficult to get to know well. They hold back their ideas and opinions except from those who they are closest to. They are likely to be kind, gentle and sensitive in their dealings with others. They are interested in contributing to people’s sense of well-being and happiness, and will put a great deal of effort and energy into tasks which they believe in.

ISFPs have a strong affinity for aesthetics and beauty. They’re likely to be animal lovers, and to have a true appreciation for the beauties of nature. They’re original and independent, and need to have personal space. They value people who take the time to understand the ISFP, and who support the ISFP in pursuing their goals in their own, unique way. People who don’t know them well may see their unique way of life as a sign of carefree lightheartedness, but the ISFP actually takes life very seriously, constantly gathering specific information and shifting it through their value systems, in search for clarification and underlying meaning.

ISFPs are action-oriented individuals. They are “doers”, and are usually uncomfortable with theorizing concepts and ideas, unless they see a practical application. They learn best in a “hands-on” environment, and consequently may become easily bored with the traditional teaching methods, which emphasize abstract thinking. They do not like impersonal analysis, and are uncomfortable with the idea of making decisions based strictly on logic. Their strong value systems demand that decisions are evaluated against their subjective beliefs, rather than against some objective rules or laws.

ISFPs are extremely perceptive and aware of others. They constantly gather specific information about people, and seek to discover what it means. They are usually penetratingly accurate in their perceptions of others.

ISFPs are warm and sympathetic. They genuinely care about people, and are strongly service-oriented in their desire to please. They have an unusually deep well of caring for those who are close to them, and are likely to show their love through actions, rather than words.

ISFPs have no desire to lead or control others, just as they have no desire to be led or controlled by others. They need space and time alone to evaluate the circumstances of their life against their value system, and are likely to respect other people’s needs for the same.

The ISFP is likely to not give them-self enough credit for the things which they do extremely well. Their strong value systems can lead them to be intensely perfectionist, and cause them to judge themselves with unnecessary harshness.

The ISFP has many special gifts for the world, especially in the areas of creating artistic sensation, and selflessly serving others. Life is not likely to be extremely easy for the ISFP, because they take life so seriously, but they have the tools to make their lives and the lives of those close to them richly rewarding experiences.

Jungian functional preference ordering:

Dominant: Introverted Feeling
Auxiliary: Extraverted Sensing
Tertiary: Introverted Intuition
Inferior: Extraverted Thinking

I am trying to implement REST with ColdFusion FW/1. However I was always getting a 404 error. So I decided that URL Rewriting needed to be setup on the server to handle those type of requests.

I was able to find information on rewrites for Apache, but nothing for the IIS URL Rewrite module.

Here’s what I was able to come up with and it appears to work pretty good. (this is from web.config)

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <system.webServer>
        <rewrite>
            <rules>
                <rule name="RewriteUserFriendlyURL1" stopProcessing="true">
                    <match url="^(.*)$" />
                    <conditions>
                        <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
                        <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
                    </conditions>
                    <action type="Rewrite" url="/index.cfm/{R:1}" />
                </rule>
            </rules>
        </rewrite>
    </system.webServer>
</configuration>

and this is what should be in your Application.cfc:

component extends="org.corfield.framework" {

	variables.framework = {
		generateSES = true,
  		SESOmitIndex = true
	};

}

Speed

Posted: January 8, 2014 in Uncategorized

comichighlighting1

Image  —  Posted: October 4, 2013 in Uncategorized

Technical Debt and Messy Code

Posted: October 3, 2013 in Uncategorized

Today, I found a great meme that represents what my company has to deal with often: a client wanting to put in place a new feature on top of the duct taped code. While we’re happy to do make it happen, this is about what it’s like in many cases.

wrecked_house