Posts

Showing posts from 2009

Owning my On Domain

Today I realized how much I love owning my own domain!!  Since 2002 (ish) I bought lonestarbandit.com and have been using ZoneEdit.com to forward my email addresses to yahoo.com account, but 2 weeks ago I bought a moto-droid and it beautifully syncronizes with gmail, so today I am making the switch to gmail.  And if I didn't own my domain, I would have to let everyone know about my mail switch (which would of been a nightmare).  But with zoneedit.com, I made a configuration change and whoola my mail is now at gmail.com How SWEET is that!!! Thanks ZoneEdit!!!

Worth Noting Android 2.0 Apps

While I usually try to keep my posts too dynamic web content, today i'll be posting about android apps... You might be wondering why, well I got the Motorola Droid on the Verizon network.  1.) Verizon Network - I know this isn't an app, but keeping with the largest 3g network while getting an iPhone like appliance is GREAT!! 2.) Music, Camera, Gallery, Maps, Browser, Messaging, Facebook  - I might have missed one, but the apps that are installed by default are awesome.  The maps is probably the best since now I have a GPS navigator in my phone.  Don't have to worry about carrying a GPS with me at all times.  And that goes with all the base installed apps, it reduces the number of electronics I carry.  Before the Droid, I felt like batman with a belt full of gadgets. The real list, I had trouble creating a priority, so this is in no particular order... There are so many GREAT apps. 3.) The Weather Channel, Accuweather or WeatherBug - They are all g...

Enhancing coldbox - adding core Environment Safe logic without touching the core

Background I know this is a no no, but our office uses subset of production data in our test system to have final sign off on new or changing applications. So when we decided to move to coldBox for a framework, I wasn't sure how environment safe coding was accomplished. I quickly learned about the interceptor EnvironmentControl, which was a great first start. But there wasn't any settings for plugin MailService to stop emails from being sent. So my first inclination (and coding attempt) was to change mailService.cfc directly. Well I learned that is a mistake. We are now moving from 3b1 to 3b3 and realizing it is a pain when you change the core. Enhancing Coldbox Now that I understand a lot more on how Coldbox is running, i realized that my solution can be handle by an interceptor.  Using the announcement of afterPluginCreation, I created a EnvironmentSafeMailService.cfc interceptor that inject methods and properties into MailService plugin.  THIS IS AWESOME! So h...

Being Thread Safe in Coldbox/Coldfusion

Thread safe never crossed my mind.  I never put CFC in the application scope to allow quicker execution (bypassing the createobject function).  But now that my office has implemented ColdBox, it cache's a lot for you, including its handlers - which are CFCs.  Well, we got bit by that evil words "THREAD SAFE".  Our code WASN'T... yes including my code. So what does that mean.  Well I'll try to do a quick explanation, thread safe is any variable that is dedicated to a SINGLE user will NOT be shared to other users.  For example, in a object a "private" variable is NOT thread safe.  So if many users use the same object (implementation of a class), then we must make sure the variables being passed around are LOCAL to that function.  Therefore, in a CFC (depending on language) you must force your function variables to be LOCAL to the function only. In CF8 use of the VAR keyword provides this <cfset var myLocalVar = "" /> In CF9 the use o...

CF 8 Scorpio Logo

Image
First I know I am way behind on times... I know CF9 just came out, but our office is a little slow. We are just now upgrading to CF8. And during the tests we realized on of our apps will NOT run on CF8. So we decided to run CF8 and CF7 side by side. That is not the interesting part. I needed to edit the CF7 settings, so I created a virtual directory in IIS to point to the CFIDE for CF7. But when I browsed to this cf administrator i got something unique. Below is the image, really kind of cool artwork.

The Performance Cost Of Throwing Exceptions (or Custom Exceptions) In ColdFusion

A couple months back, I read Ben Nadel's blog on The Performance Cost Of Throwing Exceptions In ColdFusion .  It made me curious how my custom validation exception would perform.  Using Ben's code, I ran a base test on my computer to have an apples to apples comparison. The ColdFusion cfthrow Test Throw Exception: false  Results: 63  Results: 63  Results: 47 Results: 62 Results: 62 Throw Exception: true Results: 890  Results: 718 Results: 672 Results: 672 Results: 1,219 Custom Exception for Validation Throw Exception: false  Results: 62 Results: 62  Results: 63 Results: 62 Results: 63 Throw Exception: true Results: 422 Results: 438 Results: 406 Results: 422 Results: 391  I'M BAFFLED!   I expected my custom exception to run slower than coldFusion's exception. My java code just inherits RuntimeException, and then I cfthrow object="javaObject".  I'm curious what cfthrow messa...

ColdFusion in an Enterprise Environment - Part 5 - Creating a Local development environment.

As a part of giving the developers power to move our office forward is to provide a coding environment where they don't need to worry about breaking someone else's momentum. So providing an environment where developers can code on their own machines is a must. Our office has implemented VMWare ESX, so when it came to pick local development we choose VMWare Server. Scott Lingle has posted a extra content of why we choose our of VMWare Server guest host. You can view his details here http://www.personal.psu.edu/sal21/blogs/stuff/2009/06/create-a-web-application-devel.html And Below is a snippet of his post on how to create our office's setup… Install virtual server on the machine you will be using for remote development. In my case it is my laptop. I'll refer to the machine where virtual server is installed as the 'VM host.' See, I told you that you'd have to be familiar with it. It'll get better from here. On the VM host c...

ColdFusion in an Enterprise Environment - Part 4 - Putting SVN/ColdBox/Unit testing together

Now the real reason I choose these 3 products, is how they work together! They provide a great code development management process. Ever since I started ColdFusion development over 10 years ago, I've been wanting a way to get better management into my development lifecycle. I've done many things over the years to make my development lifecylce better, but not perfect…. There has always been that unit separation in my websites. For example, developing a shopping cart I've always needed the rest of the website wrapped with it to code at all. Which usually required a lot of extra code to just code a shopping cart. How the 3 come together. 1.) Not only does SVN provide source control, SVN also provides a way to manage your unit structure and website structure without copying and pasting the files. The use of externals give the ability to separate your code into "projects", and then use tags and externals to keep your "instances", or environment...

ColdFusion in an Enterprise Environment - Part 3 - Choosing Unit Testing Framework

Choosing a Unit testing framework, was a pretty easy decision for me. My first question was does any integrate into Eclipse? And the answer when I did my research was yes, but only one…. MXUNIT. And at the time it provided all the same features as the rest of the CF unit frameworks. The other thing that helped myself decide on this framework, is that ColdBox added an integrated into MXUnit so you could setup unit tests against the coldbox framework to run your code. UPDATE: I am sure I made a good decision because MXUnit is still working at our needs today, but I am not sure my comments above are accurate anymore. I believe all the CF Unit frameworks are full of features, and work really well. Short and sweet version of an easy choice. Please Note: This post is conjuction with a series of blog posts about my findings in setting up an enterprise development environment. Please view the rest of the posts at Coldfusion in an Enterprise Overview

ColdFusion in an Enterprise Environment - Part 2 - Choosing ColdBox

There is many reasons I have picked coldbox over other CF frameworks, but I don't want this to get into why, should I, or you idiot you shouldn't of picked coldbox because -x- framework is better. Rather, I'd rather explain how I are using the framework to make development easier with an office of developers. The following are seven of the reasons I choose coldbox 1.) ColdBox.org provides a lot of great documentation, and almost overstates the amount of documentation. It does have a lot of great documentation, especially some of its competitors. But some of the documentation is not layed out well for someone jumping into a framework. But this is one of the reasons I choose coldbox. 2.) Provides MVC!!!! And it provides it by forcing you to code. Providing you the most powerful MVC capabilities, not wrapped into AOP, forcing a developer to design it out before he just starts coding and expecting the framework to do it for him/her. Sorry this was a little strong opi...

ColdFusion in an Enterprise Environment - Part 1 - Understanding how to use SubVersion (SVN)

Subversion can be used in many ways, so this isn't the holy grail of how you need to use subversion, but it does add application management to subversion. What does application management mean? Well, the definition for this article is how to control what gets released into production. This article is not going to go into how to setup version, or how to add an external to the repository tree. But how in concept to use SVN and an external to achieve application management. First of course you need a SVN repository, which for the purpose of this article our repository will be noted as "/". Second we need to know that will we still be using the concepts of trunk, tags, and branches, they just won't live in the root of the repository. The trunk is the current working copy of development, while the tag folder is to version releases (by tagging). Branches will be used when "new" development is going on and emergency coding is required on the existin...

mxunit and validation exceptions

WIthin my models I use "doValidate" functions that throw an exception of "validationExceptions", which you can read about here ,  I am now getting into unit testing with MXUnit!!  So, I wanted to unit test my validation exceptions, therefore, i needed away to capture the exception and compare the number of validation errors returned to how many i expected. The following is one of my mxunit test functions that trap the validationException error: <cffunction name="testValidateForPassword2" displayname="password and verified password do not match" access="public" returntype="void">     <cfscript>         oFpsGTW = createObject("component","fps.model.FpsGTW").init(fpsServerURL="#variables.instance.fpsURL#");                 oFpsDTO = setupGoodDTO();                 //SET check not equal passwords  ...

ColdFusion in an Enterprise Environment - Overview

Over the past 12 plus years, I have been Coldfusion programming. Early on I coded within Coldfusion very inefficiently, because of both Coldfusion being young, and because I was young. And since 2001 I have coded in a "object" methodology within Coldfusion . I started with CFObjects (url used to be cfobjects.com). And until late last year I really haven't expanded my object oriented capabilities. Over the past year, I had the opportunity to take a java class with a great instructor and I also had the opportunity to review all the Coldfusion frameworks. With learning the MVC concept and design patters I am now ready to take the endeavor of using MVC and design patterns in an enterprise. Good or bad I have chosen Coldbox to help implement MVC concept in our enterprise applications. The reason I'm blogging about it, I haven't seen to many explanations on how a group might use it for an enterprise application, or set of applications that work together. ...

finding multiple chars in password

I just interacted with an authentication system that one of it password rules is not to repeat a certain character 3 or more times.  So it mad me think of how I would accomplish this validation if I wrote the code. First thing that came to mind is a regular expressions (RE), i've tried and tried and couldn't figure out a RE that would solve any character repeated more than 3 times in a string.  I guess I'm not an expert in RE!  If anyone can figure this out, i'd appreciate knowing the RE. Therefore, i moved my logic to just loop within a loop.  Example below. <cfloop from="1" to="#len(variables.tmpPassword)#" index="pos">     <cfset curChar = Mid(variables.tmpPassword,pos,1)>     <cfset curCharCount = 0>         <cfset curPos = FindNoCase(curChar,variables.tmpPassword)>     <cfloop condition="#curPos# GT 0">         <cfset curPos =...

using application.cfc and webservices / ajax

I'm not going to blog about how to use the application.cfc file, because there are a lot of experts out there that already has.  And Ray Camden has posted a CF8 "template" for application.cfc .  But i haven't seen anyone answer the question about using onRequest method within the application.cfc while using ajax / webservices in the same directory. As most of you have already seen, the normal "template" for onRequest is as follows: <cffunction name="onRequest" returnType="void"> <cfargument name="thePage" type="string" required="true"> <cfinclude template="#arguments.thePage#"> </cffunction> But since ajax and webservices are actually CFC methodology this included code will break it. Now I am not sure if the following cures all scenarios, but it gave me the ability to do webservices / ajax. <cffunction name="onRequest">   <cfargument name = "tar...

Moving Databases

After reading on how to harden MSSQL 2005 installation, I realized the current directory structure doesn't lend itself for easy management of hardening the SQL installation, therefore, I am on a quest of moving the logical files in the database to a directory structure that makes it easier to lock down. To move a single database it is somewhat easy. ALTER DATABASE [name] SET SINGLE_USER WITH ROLLBACK IMMEDIATE ALTER DATABASE [name] SET OFFLINE [move physical files] [ don't forget each file {data/tLog/fulltext} ] ALTER DATABASE [name] MODIFY FILE (NAME = 'logicalname' , FILENAME =  'LogicalFilename' ALTER DATABASE [name] SET ONLINE ALTER DATABASE [name] SET MULTI_USER Moving all the databases wasn't that difficult either, it was just remembering to exec() the sql.  Also, using a script all databases had to be setup the same.  I had one database that had more than one data file - 2 for data, 2 for indexes.  I had to do that one manually. There is another way a...

Coldfusion jdbcURL Query

I was looking for a way to have coldfusion accept a jdbcURL and query the database.  Well I found it: http://cfsilence.com/blog/client/index.cfm/2007/11/7/DSNLess-CFQuery did a great job explaining it, and even wrapped it in a customTag called "query". Great Job. Here is the guts of the query.cfm file <cfif thisTag.ExecutionMode eq "start"> <!--- custom tag attributes ---> <cfparam name="attributes.jdbcURL" default="" /> <cfparam name="attributes.username" default="" /> <cfparam name="attributes.password" default="" /> <cfparam name="attributes.qName" default="" /> <cfelse> <cfset variables._queryString = thisTag.GeneratedContent> <cfset thisTag.GeneratedContent = "" /> <cfset _jSQL = createObject("java", "java.sql.DriverManager") /> <cfset _connectURL = attributes.jdbcURL /> <cfset _jSQL.s...

MSSQL 2005 - ORDER BY items must appear in the select list if SELECT DISTINCT is specified.

Today another error is appearing where the ORDER BY has a field in it where the SELECT DISTINCT list doesn't.  And SQL server is throwing an error.  How nice. Here is a code example that will cause an error: select distinct      datepart(dd,visitDate), fld2 from tbl order by visitDate Fix  : select distinct      datepart(dd,visitDate), fld2 from tbl order by datepart(dd,visitDate)

SQL Server 2005 The multi-part identifier "tblPrefix.columnName" could not be bound.

We just went into Production with MSSQL 2005, and even though I knew the change of interpreter where Union / Order by is processed a little different, i thought the error thrown would make sense.  For example, the below query in 2000 will run fine, but in 2005 will Error. select      a.aCol,      b.bCol from a inner join b on a.id = b.id union select      a.acol,      c.bcol form a inner join c on a.id = c.id order by b.bCol The known interpreter change gives a semi-cryptic error of " The multi-part identifier "tblPrefix.columnName" could not be bound."  This basically means that in the order by b.bCol doesn't exists in both union queries.  Therefore, the order by needs to drop the " b. " becoming " bCol ". Solution: select      a.aCol,      b.bCol from a inner join b on a.id = b.id union select      a.acol,      c...

CSS Styled Day View of a Calendar

I've helped make a css styled day-view calendar (or in our case the schedule of an event).  Here is what we developed.   But my question is has anyone out there created a similar thing that is better "accessible".  This layout looks great on screen when CSS is enabled, but have a screen reader read it and it doesn't go as well.  It still works, so I'm happy with that, but I would like it to read better instead of reading all the timeslots (7am 15,30,45, etc), then read all the actual sessions of the event.  It would be nice if there was a way it would read the time slots and if a session exists at that time slot it would read that session then.

MSSQL 2005 SSIS Packages - Mostly Data Flow

Lately, I've been learning the ins and outs of Visual Studio for Sql Server Intergration Services (SSIS).  And so far it is a much improved beast compared the DTS packages and its editor.  But I got to ask, why aren't the Flat File Connections using the FMT file that bulk inserts use.  Why not have one standard why of defining a file layout.  Why oh why??