REFinding your voice

I've lost mine, and am trying to find it again. I loved when I was blogging regularly, and being an active part of a thriving community. Over the last few years, that has slipped away from me. I haven't made a blog post in ages, and don't feel like I'm much a part of any community at all.

I'm going to make an effort to get back into that community. I'm going to try to blog more regularly, get back on the social networks where you guys are hanging out, and generally be a part of the conversation. I need to feel like this is something that I can still enjoy (programming, problem solving, and camaraderie with a great group of developers).

So here's to hoping that I can kick it up a notch, and find the voice I've lost.

0 comments | Posted by Daniel Short on Sep 30, 2013 at 12:57 PM | Categories: Blog Development - ColdFusion - Rambling -

Easy Thread Throttling in ColdFusion

I do a lot of large processing tasks at LandsofAmerica, and in order to get these scheduled operations to complete in any reasonable amount of time I use the <cfthread> tag to spin off multiple processing threads at a time. Unfortunately, some of these threads take longer to complete than it does to spin up another 5,000 threads in the queue. Once you break that thread limit, ColdFusion to stop accepting new threads and will throw an exception. So I use the method below to make sure that I don't spin up too many threads at one time.

So the trick is to create each thread with a unique name, keep track of those names, and wait for each batch of threads to finish before starting the next batch. And here's your sample code:

/*
	We need to keep track of the names of our threads
	in order to make sure that we limit our processing
	appropriately.
*/
listingThreadNames = "";

/*
	And just for fun, we'll create a variable to keep
	track of how many threads we want to spin off at any
	one time.
*/
numberOfThreads = 10;

/* Loop and start creating threads */
for(i = 1; i LTE 100; i++){
	/*
	Create a thread name that we'll use to create
	the thread and keep track of it. Make sure that
	this is unique, or you'll get errors with duplicate
	thread names
	*/
	threadName = "MyThread_#i#";
	listingThreadNames = ListAppend(listingThreadNames, threadName);

	thread
		name = threadName
		action = "run"
		id = i {
			//Do some amazing stuff here
			sleep(5000);
		}

	/* If we've reached the number of defined threads, wait until they all finish. */
	if(
		listingThreadNames NEQ ""
		AND ListLen(listingThreadNames) EQ numberofThreads
	){
		writeOutput("Waiting on the following threads to finish: #listingThreadNames#<hr />");
		/* Join up the threads, which will cause a pause until all the threads are done */
		thread
			action="join"
			name="#listingThreadNames#";

		/* Clear out the thread names for use in the next iteration of the loop */
		listingThreadNames = "";
	}

}

2 comments | Posted by Daniel Short on May 10, 2013 at 9:55 AM | Categories: ColdFusion -

Meet me at cf.Objective()

Today I posted on Twitter that I would need to re-evaluate my friendship with anyone who couldn’t make it to cf.Objective(). But alright alright… I’ll still be your friend, even if you don’t make it to cf.Objective. But you should… I just finished working up my schedule, and I’m once again excited to attend a conference. I’ve been “meaning to attend MAX again” for years, but the last few times I’ve been it’s seemed more a social event, and less an “inspire me to build great things” event. But I still remember hanging out with Jared, Sean, Simeon, and “the rest of the gang” after the first cf.Objective() conference I attended.

After that first cf.Objective() conference is when I first started digging deep into OO development, and when I feel I really started becoming a “programmer” and not just a “developer”. The last few years have been very stagnant for me, since I’ve spent almost all of my time maintaining and attempting to improve or refactor legacy applications. Well it’s time to throw my hat back in the ring and go get some smarts.

So here’s a list of everything I’m currently set to attend at cf.Objective(). If you’re able to make it, please find me and say hello.

At the time that I’m writing this there are still 8 sessions still listed as TBA, so things may change. However, you can already see that there is an extremely diverse range of topics, from unit testing, to JavaScript frameworks, and automated deployment.

Check out the schedule and then register to get your own heavy dose of awesomeness.

Looking forward to seeing you there!

0 comments | Posted by Daniel Short on Mar 15, 2011 at 3:33 PM | Categories: ColdFusion -