New Employee Orientation at BNSF Railway

Today I completed day 2 of a three-day new employee orientation at BNSF. While that may seem excessive (it did to me), I now totally appreciate why they do it. I have developed a better grasp of the railroad culture and the history, specifically related to our 170 year old company, its roots in the very early fabric of this country, and how critical it is in current day. It is abundantly clear that they view their people as their most valuable asset. One way that is made clear is that fact the president and COO of a 22 billion dollar a year company comes and visits every new group of 50 employees (new hires, and those converting from scheduled/contract work), and spends an hour with no prepared material, but rather just answers any questions that we have. Or the other VPs who come to talk about their divisions, including one who made a point of going around the room and shaking hands and introducing himself to every person in the room. One common takeaway is how critical safety is, in what is a very unforgiving environment for many employees. This is underscored in everything they do, including safety briefings at the beginning of every meeting, whether you are in an office job or in the field. The other consistent theme is the fact that leadership is expected from every single employee. They don’t hire people that they don’t see as potential future leaders, and it’s not only viewed as an opportunity, but as somewhat of an obligation.

One part of today’s session was an art tour, viewing some of the 1000 pieces of fine art across the campus. I didn’t understand the significance of the collection until today, but much of it was commissioned art that was done in the early 1900s of the northwest (for Burlington Northern) and southwest (for the Santa Fe line) that was used in marketing to draw people out to the west. When viewed in that context, I found it pretty fascinating. In the corner of the visitor’s center is the very desk that John Hill sat at as he founded the Great Northern Railway, in the 1800s. There was also an old clock (pic below) which stood in the Santa Fe station. On regular intervals, telegrams were sent out with the time of that clock, and all sub stations had to set theirs to it. Then residents in all those towns would set their clocks to match those substations. It was the central source for an early ‘universal clock’ of sorts. Another thing that I found interesting on the tour was a hall that contained original framed land grant deeds from the 1800s, with several signed by presidents, including Ulysses S. Grant (pic below). When seeing all the history, and knowing how crucial the work is to our current society – around a 230,000 cars moved product on the BNSF line today – it would be hard to build some pride about your job.

Driving home today I took a different route up Hwy 156 which took me directly alongside a very busy BNSF line, upon which I saw a coal shipment come by, followed by another one with an intermodal (shipping container) load mixed with a ton of UPS truck trailers. It’s definitely a lot more meaningful to me today seeing the bright orange and black BNSF locomotives than it was for me a couple months ago.

Aquaponics update – First day of fish screw up and recovery!

On Sunday, after weeks of preparation of building, cycling water through my system and planting seeds, I brought home 23 tilapia from Frank’s Aquaponics.

I followed some great advice by Frank with regard to acclimating the fish to my system, and they appear to have adapted to the move perfectly.  And by perfectly, I mean that none are floating so far.  I watched pretty closely for a three or four hours and everything was going just great.  However… my day was not over.  Hopefully the following mistake will help some people avoid a similar problem.

I watched a video sometime back, while I was working out my design, where a guy’s drain got clogged and he accidentally dumped his entire system onto the ground overnight and lost a number of fish. Based on this, I created my system where there is no pump inside my fish tank. Essentially, it stays 100% full at all times with an overflow that exits into a recessed 55 gallon barrel (sump tank), and from there water is pumped out and up to the garden, where it eventually drains and returns back to the fish tank itself. That way, there is no reason the water in the fish tank should ever sit below the level of the overflow. It works really smoothly, and I was feeling pretty great about it. However, there was a small catch in making sure that I keep fish from draining from my overflow into the sump tank.  I thought a perfect solution was to cover the overflow with window screen material, and that seemed to work flawlessly about a week’s worth of testing. But… that was pre-fish!   Yesterday, after the fish being in the tank for a few hours, I noticed that some waste material was collecting on the screen, but water was still flowing. I left the house for a couple of hours to play volleyball last night, and when I returned I found that screen had become so clogged that it couldn’t keep up with the water coming back from the garden. Over a that 2 hours I dumped about 35 gallons of water out of the system, and when I took the lid off my sump tank, I found that my pump was danged close to running dry!

This left me with 2 significant things to solve in a hurry…
1) I can’t run my system until I fill it back up with water. I can’t just run a hose to it or I’ll kill my fish who had already had one traumatic experience that day just moving in.

2) What am I going to do about a screen?

I decided the screen was the most immediate thing to solve so I started there. Thankfully my wife is a scrapbooker and had decorative hole punches. So now my screen has now been modified with cute decorative star-pattern holes, which I am sure the fish will appreciate as the swim by. They are small enough that no fish should go through, but hopefully big enough that waste won’t collect as quickly until I find something more permanent.

Then came the water issue. Can I really treat 35 gallons of tap water effectively and dump it into the system without damaging the fish? Perhaps, but I have no confidence in that.  Then it hit me… I have lakes all around me! So about 10pm last night, I loaded up three five gallon buckets on the the golf cart and headed down the street to the boat ramp. Three trips later my system was full again and I flipped it back on, and left a nice fresh piece of lettuce on the surface as a token of apology to my fish.

This morning I was relieved to find that the fish apparently adapted fine as there were no floaters, and I could see that they had munched away on the lettuce leaf I had left them overnight. Whew…. crisis averted.

Getting started with my aquaponics garden

Over the past few years, I have become more drawn toward the ideas of self-sustainability.  As our society becomes ever more dependent on food delivery systems that are completely outside of our control, the idea of having some level of sustenance in my own back yard has seemed increasingly important to me, and having the kind of skills that would help in the even of some kind of disruption to food lines.  That notion has manifested itself in various ways over the years, but most recently this has resulted my creating an aquaponics garden.   Aquaponic gardens are a combination of aquaculture (raising fish) and hydroponics (growing plants in water instead of soil).   In aquaponics, the fish and plants develop a symbiotic relationship, in which the waste of the fish is provided to the plants as nitrates, and then the garden is responsible for feeding the fish and for helping to filter the water to keep the fish happy.  Ultimately, depending on your choice of fish, the fish then can also become food as the grow and multiply.  Lastly, given the recycling of the water through the system, aquaponics farming uses just a fraction of water that is used in traditional farming and gardening.

After studying countless videos on YouTube and attending a local aquaponics class at Frank’s Aquaponics with my son, I put together a system that consists of a 100 gallon fish tank, a 55 gallon sump tank and then various grow beds.  I have three horizontal 4″ PVC tubes that each support 8 plants.  I have one ebb & flow bed that supports 20-24 plants, and one raft bed that supports about 20 plants.

As of the time of this post, I have actually planted about 40 plants and have a school of 23 tilapia that are about 2-3″ long each.  I have recorded a couple of videos along the way though, so I figured I would post them now and do follow-ups with my progress.

Even looking at these videos now, I realize I have learned quite a bit over the past few weeks and have modified the design slightly, but they are still pretty accurate to where I sit today.

Initial construction of my aquaponics garden…

Cover for my fish tank…

The Unbridled 4th Branch of Government

In a follow-up to my post yesterday about redundancy of federal agencies such as the EPA, one point I didn’t make is that they must continually create new laws in order to justify their existence (which is the roll of the legislature, not the 4th branch of government which is bureaucracy). Their very existence will ensure that they continually restrict freedoms since that is the only way that can remain. Here is a perfect example. Starting in 2015, the federal government will now dictate what kind of wood burning stove you can have… for your health of course. I don’t care if you are liberal, conservative, libertarian or politically agnostic. This is a mockery of the ideals that this country was founded upon.

The fact that we have unaccountable federal agencies acting as a legislative branch of government, creating tens of thousands of binding laws each year, without no real control in the hands of the citizenry is madness. We are in a heap of trouble.

At what point are we collectively not going to be OK with this?

Why eliminating federal agencies is our Constitutional obligation

I have heard a couple of conversations lately that made me realize how many people just simply don’t understand this basic principle. For the casual bystander who hears recommendations to eliminate the EPA, Dept. of Eduction, and other federal agencies, it is almost understandable that they may recoil thinking “Don’t they care about our environment?” “Don’t they care about education?” if they don’t understand the Constitution and the idea of a federalist nation.

Eliminating those agencies has nothing whatsoever to do with those specific topics being vital or not vital in any way. The Tenth Amendment to the United States Constitution reads: “The powers not delegated to the United States by the Constitution, nor prohibited by it to the States, are reserved to the States respectively, or to the people.”

That means effectively ‘If it isn’t mentioned in the Constitution, it is up to the states to manage as they deem fit’, period. Education, or the environment, or countless other roles that are now grabbed by our federal leviathan government were never enumerated by the US Constitution, and therefor are the responsibilities of the states themselves.

If you take time to read The Federalist Papers or historical documents around the creation of this nation, you will understand that we were never intended to have this top-down one-size-fits-all blanket solutions applied across this country. States were given the responsibility to create and manage their needs. As we stand today, we have morphed into a system in which we are ruled from afar on the affairs that should be handled at the state level, by applying heavy handed blanket rules that make no distinction to the differences in regional needs. With a top-down approach, where federal rules that dictate everything down to the type of light bulb you are allowed to buy, what is the point of having individual states other than to have your own flag?

The fact is that those federal agencies are redundant, and serve as a drain on our systems, both financially and by ignoring local needs and making it more difficult for states to act in the ways that best fit them. Why are they redundant? I will speak directly about Texas, since that is what I know, but the same applies to every state in the union. Here we have the TCEQ (Texas Commission on Environmental Quality) who’s mission statement is “… to protect our state’s public health and natural resources consistent with sustainable economic development. Our goal is clean air, clean water, and the safe management of waste.”. If we already have state level agencies with goals of managing these things, then there is no need for an EPA. None. What in turn happens is that we end up sending a huge amount of our money out of state to the federal government to support these redundant systems, and allow far less to retain in our states where the management should be focused in the first place.

This is the same for many other agencies. If this is not a totally familiar concept to you, I would encourage you to remember these things as you hear politicians talking about eliminating programs and understand it for what it is, which is bringing us back closer to the federalist government that we were intended to be.

Parsing CSV files with Grails

One of the arguments that I often make for my use of CFML is how you can do so much with so little code. Seemingly every time I attempt to do something that I haven’t done previously with Grails, I find that argument holds less water than I thought, as I can often do it even easier in Grails.

For a current project, we have an occasionally updated CSV document that contains codes related to the customer’s industry. Given that this file will be changing with additional codes being added, while this app is in early development, we decided that we would just keep it in our application config directory and ensure that any new codes are added during the application bootstrap routine.  Here is what I came up with:


// Insert new codes
def csv = new File("grails-app/conf/code.list.csv")
def code
csv.splitEachLine(',') { row ->
   code = Code.findByLabel(row[1]) ?: new Code(
      code: row[0],
      label: row[1]
   ).save(failOnError: true, flush: true)
}

Essentially, the above is saying:

  • Read the CSV file
  • Loop each line, where each line is referred to as “row” in the closure.
  • Search in the database for codes with the same label
  • If the code does not yet exist in the system, create a new instance of Code passing in property values from the row in the CSV file.
  • Save the new code to the database.

As you see, I have added line breaks for readability, but I was able to get the result I was looking for in THREE lines of code! I figured I would share in case anyone is looking for a similar solution.

JRun wsconfig error- Security alert: attempt to connect to JRun server from host

I was experimenting with the Railo 3.3 installer, which includes an IIS connector to Tomcat, which works really well.   Too well in fact!  When I ran it, it actually unmapped all my existing IIS ISAPI mappings to JRun and was sending all requests to Tomcat.

I decided the quickest fix to this would be to simply open up /JRun4/bin/wsconfig.exe and remap the sites that were no longer connected.  However, when I did this, I received the following error:

Could not connect to JRun/ColdFusion servers on host localhost.

Knowing perfectly well that I had an instance of JRun running, I went to the terminal to look at the standard out and saw this:

Security alert: attempt to connect to JRun server from a 10.252.11.207 host

In case that is too hard to read, it says: “Security alert: attempt to connect to JRun server from a 10.252.11.207 host”.   I suspect that because I am attached to a WIFI connection with an IP Address on 192.168.*, and then VPN’d into my company with a second address of 10.252.*, JRun assumes that the connection attempt is coming from outside the subnet.

I went digging through files in JRun4/lib and came across security.properties.  In this file, there is a default setting:

jrun.subnet.restriction=255.255.255.0
jrun.trusted.hosts=
jrun.subnet.restriction.ipv6=[ffff:ffff:ffff:ffff:0:0:0:0]

I altered that restriction  setting from “255.255.255.0″ to “*” like this:

jrun.subnet.restriction=*
jrun.trusted.hosts=
jrun.subnet.restriction.ipv6=[ffff:ffff:ffff:ffff:0:0:0:0]

Once I did this and restarted the server, I was able to use wsconfig without issue.  And my ACF sites are pointed to JRun, my Railo sites are pointed to Tomcat, and all is right in the world again.

NOTE: DO NOT DO THIS ON A PRODUCTION MACHINE!   If you do, I strongly recommend that it is a very temporary change.

CFML wishlist: All collections should extend Iterator

Have you ever really given a second thought to the fact that in ColdFusion/CFML you have to loop queries, arrays, and structures in completely different ways?   For example, in each of these things, we are essentially doing the same thing:

<!--- looping our query --->
<cfloop query="myQuery">
	<cfset doStuff() />
</cfloop>
<!--- looping our array --->
<cfloop array="#myArray#" index="i">
	<cfset doStuff() />
</cfloop>
<!--- or --->
<cfloop from="1" to="#ArrayLen(myArray)#" index="i">
	<cfset doStuff() />
</cfloop>

<!--- looping our structure --->
<cfloop collection="#myStruct#" item="i">
	<cfset doStuff() />
</cfloop>

In each of these cases, we are essentially doing the same thing, that being looping a collection that contains multiple items and acting on each iteration.  I have always liked the fact that the ColdFusion array can be converted to a Java iterator like this:

<cfset iterator = myArray.iterator() />
<cfloop condition="#iterator.hasNext()#">
	<cfset thisIteration = iterator.next() />
	<cfset doStuff() />
</cfloop>

However, given the fact that <cfloop array=”#myArray#” index=”i”> is already an abstraction, it doesn’t make sense to use this in most cases.   But wouldn’t it be cool if you could call myQuery.iterator() or myStruct.iterator() and have the same functionality?  Or even better, why not have those collections all extend an iterator class so that it could be simplified even futher with myQuery.hasNext() or myStruct.hasNext().

Keep in mind, this discussion is only coming from the perspective of the programming interface itself, and I am not going to get into the differences behind the scenes of how a query result is actually a set of arrays of columns, or how an array differs from a struct.  My point is simply that if we have these abstractions, it sure would be cool if they were consistent, but we were still able to call specific functions on them like ArrayFind() , StructDelete(), etc.  If we had this ability, our loops in CFSCRIPT would be a lot more consistent as well.

With that said…. I will leave you with my wishful implementation for writing loops in CFML:

<cfloop condition="#myQuery.hasNext()#">
	<cfset thisRow = myQuery.next() />
	<cfset doStuff() />
</cfloop>

<cfloop condition="#myArray.hasNext()#">
	<cfset thisItem = myArray.next() />
	<cfset doStuff() />
</cfloop>

<cfloop condition="#myStruct.hasNext()#">
	<cfset thisItem = myStruct.next() />
	<cfset doStuff() />
</cfloop>

ColdFusion 9 catch() is not thread-safe!

I almost hate to admit this… no, I really hate to admit this.   For some reason, I was have always been under the impression that when you do a catch() in CFSCRIPT, that the variable you define as the catch is protected within the catch condition.   However, it hit me today that it is written to the variables scope by default.  Not only that, as I was testing it further, I believe that I have discovered that it is not thread-safe at all!   (edit: this problem applies to CFCATCH too. See notes at bottom and in comments)

Want to test this?  Open up a dummy CFM file and run the following:

(edit: I have modified this example since originally posting, putting the try/catch within a method so that it is consistent with the other examples)

WriteDump(ourFunction());	

public void function ourFunction()	{
	try	{
		local.a = b;
	}
	catch( any e )	{
		killE();
		WriteDump(e);
	}
}

public void function killE()	{
	StructDelete(variables,"e");
}

In case what we are doing isn’t abundantly obvious, we are creating a forced exception by referencing variable “b” which doesn’t exist.  In the catch(), we are saving the exception structure as variable “e”  so that we can handle however our business rules dictate.  In the case of our example, we are calling a method called killE(), and as you see it deletes “e” from the variables scope of the current template.  In the following line in catch() we are going to dump out exception details.  However, rather than a nice exception telling us that “b” wasn’t defined, we get the following:

ColdFusion exception

So, all we need to do is change “e” to “local.e” right and it will be thread-safe right?

WRONG!

This is apparently invalid syntax in Adobe ColdFusion (as of v.9).  Take this example:

WriteDump(ourFunction());	

public void function ourFunction()	{
	try	{
		local.a = b;
	}
	catch( any local.e )	{
		killE();
		WriteDump(local.e);
	}
}

public void function killE()	{
	StructDelete(variables,"e");
}

When we run this example, the following occurs:

What?!  So apparently we have to use the “var” scope to define our exception then, right?  So how about this attempt… this should do it, right?

WriteDump(ourFunction());	

public void function ourFunction()	{
	var e = "";

	try	{
		local.a = b;
	}
	catch( any e )	{
		killE();
		WriteDump(e);
	}
}

public void function killE()	{
	StructDelete(variables,"e");
}

WRONG!

If we take this approach, we receive the following:

My impression of this exception is that it is trying to write a variable into the variables scope that is already defined in the var scope and barking about it.

So then, what are we left with?

I am admittedly not the sharpest crayon in the box, but to me this indicates that catch() is 100% not thread-safe!   If anyone sees any problem with this diagnosis that I have made or has any thoughts, I am all ears.  If this is true, this throws huge wrenches into my work, and I am sure it does to others as well.

EDIT: As has been pointed out by Henry, this is an issue that Adobe was notified of this bug July of 2010 – almost 16 months!  It affects at least versions 8 and 9, and is not limited to CFSCRIPT.  It apparently affects CFCATCH as well.  I have looked through the tech notes of ColdFusion 9.0.1 Cumulative Hot Fix 1 and ColdFusion 9.0.1 Cumulative Hot Fix 2 and find no evidence that they have ever addressed it.

EDIT (again): I have tested this in both Railo and OpenBD.  OpenBD, due to the fact that it puts variables within methods in the var scope by default does not fail on the first test.  Railo, does fail.  However by using the variables scope like ColdFusion.  However, it allows you to do catch( any local.e ) and var scope e ahead.  So in a nutshell, ColdFusion is the only engine that does not give us any way to do thread-safe error handling.