Entries for month: July 2008
Classic Programming Mistakes
Posted by [Justice] in on July 22, 2008
I saw a link posted this morning to Steve McConnell's blog about common programming mistakes, and many of them were very applicable to a project I am working on currently. Programmers being typically helpful people, and wanting to please their customers, I think we often get ourselves into trouble trying to stand up to un-realistic goals and ideals, simply because we dont want to disappoint anyone. This list really puts into words some of the no-no's to remember when you are gearing up for a large coding project. Just because the customer wants it in X timeframe does not always mean that it can be done in that time. I think most of my customers would have rather had a realistic estimate than a 'can do' on the front end, and a pushed deadline near the end!
So check it out: www.stevemcconnel.com - Classic Mistakes Enumerated (from 1996 no less!)
Let me know what you think, I believe he hit the idea's square on the head.
Writing code to write code (metacode, love it)
Posted by [Justice] in on July 21, 2008
I got detoured off my large project to do a quick financial report, something that pulls in tons of values from a few other reports, has some manually added data, and of course has to match some funky bank-format Excel spreadsheet (I just LOVE those). So, I have a nice list of about 50 fields that have to be populated with data, all according to varying formulas. Well, I hate creating getters / setters and form code, so I whipped something together to loop through the list of field names and generate em both for me. For anyone who has never done anything like this, check out some samples.
This code generates my get/set pairs for a simple form bean:
<cfloop list=<span class='cc_value'><span class='cc_value'>"#list#"</span></span> index=<span class='cc_value'><span class='cc_value'>"i"</span></span>>
<br />
&lt;cffunction name=<span class='cc_value'><span class='cc_value'>"set#trim(i)#"</span></span> access=<span class='cc_value'><span class='cc_value'>"public"</span></span> returntype=<span class='cc_value'><span class='cc_value'>"void"</span></span>&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&lt;cfargument name=<span class='cc_value'><span class='cc_value'>"#trim(i)#"</span></span> type=<span class='cc_value'><span class='cc_value'>"numeric"</span></span> required=<span class='cc_value'><span class='cc_value'>"yes"</span></span> /&gt;<br />
<br />
&nbsp;&nbsp;&nbsp;&nbsp;&lt;cfset variables.values.#trim(i)# = arguments.#trim(i)# /&gt;<br />
&lt;/cffunction&gt;<br />
<br />
&lt;cffunction name=<span class='cc_value'><span class='cc_value'>"get#trim(i)#"</span></span> access=<span class='cc_value'><span class='cc_value'>"public"</span></span> returntype=<span class='cc_value'><span class='cc_value'>"any"</span></span>&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&lt;cfreturn variables.values.#trim(i)# /&gt;<br />
&lt;/cffunction&gt;<br />
<br />
</cfloop></code>
</cfoutput>
and this code generates my simple form based on thise field names (tweaking will have to be done of course, but this gets it together very quickly):
<cfloop list=<span class='cc_value'><span class='cc_value'>"#list#"</span></span> index=<span class='cc_value'><span class='cc_value'>"i"</span></span>>
<br />
&lt;label&gt;#trim(i)#<br />
&nbsp;&nbsp;&nbsp;&nbsp;<span class='cc_html_basic'><span class='cc_html_basic'>&lt;span class=<span class='cc_value'><span class='cc_value'>"small"</span></span>&gt;</span></span>Set #trim(i)#<span class='cc_html_basic'><span class='cc_html_basic'>&lt;/span&gt;</span></span><br />
&lt;/label&gt;<br />
<span class='cc_html_form'><span class='cc_html_form'>&lt;input type=<span class='cc_value'><span class='cc_value'>"text"</span></span> name=<span class='cc_value'><span class='cc_value'>"#trim(i)#"</span></span> id=<span class='cc_value'><span class='cc_value'>"#trim(i)#"</span></span> value=<span class='cc_value'><span class='cc_value'>"##formBean.get#trim(i)#()##"</span></span> 0&gt;</span></span>disabled = <span class='cc_value'><span class='cc_value'>"disabled"</span></span>&lt;/cfif&gt; /»<br />
<br />
</cfloop></code></cfoutput>
Ack, where is all the content!
Posted by [Justice] in Site News on July 14, 2008
I have migrated to a virtual server (yah for full control over the server!) I was having a heck of a time converting all my data from MySQL into MS SQL, then I had plugin issues with Mango after copying my web root via FTP onto the new server, so I nuked it! This is a clean install of Mango on MS SQL. I will try and get my data imported from the old database, but until then the world will have to suffer the (minimal) loss of my prior blog posts.
Recent Comments