Thursday, October 15, 2009

ColdFusion Cascading Dropdown Menus

So far in this blog, I have not shared much about what I do for a living, which is to develop Web-based applications for a small hospital. I don't think posts about my work would be very interesting to most readers, but today I experienced a small programming triumph that I feel compelled to share because I don't think anybody else has figured it out, or if they have, they haven't posted it on the Internet anywhere that I could find it.

The programming issue I was working on involved two dropdown menus: one for a category and another for a subcategory. Ideally, the choices in the subcategory list would be contingent upon what was chosen in the category list instead of displaying every possible subcategory. For example, if you chose "Fruits" as the category in a list of food types that also included "Vegetables", the subcategory choices would be "Apple", "Peach", "Pear", "Plum", etc., without "Broccoli" and "Brussels Sprouts" also showing in the list.

Most of what I do involves ColdFusion programming. ColdFusion is a server-side programming environment that will manipulate variables only when programmed webpages are first loaded. There is no provision for "dynamic" variable manipulation as the user makes changes on a webpage, like filling out a form. For that, I normally use JavaScript, a client-side programming language. The big hurdle is that ColdFusion and JavaScript do not talk to each other very well. It is possible to pass a variable to JavaScript from ColdFusion using a "ToScript" routine, but what I needed was to pass a variable from JavaScript to ColdFusion, which is not possible.

After searching the Web extensively, I came upon a JavaScript script written by Ioannis Cherouvim that presented an HTML version of the solution I was looking for. I copied it and got it working, then customized it with ColdFusion-generated content. It worked!

Here is the complete code:

Section 1 code for ColdFusion cascading dropdown menus
Section 2 code for ColdFusion cascading dropdown menus
Section 3 code for ColdFusion cascading dropdown menus
I apologize that the code is in screenshot images but Blogger tried to parse the code when I pasted it in directly. I also apologize for all the white space, but that was necessary to keep Blogger from resizing the images. Click the images for full-size versions. Email me if you would like the text file.

A couple of notes:

  1. Obviously, in order to be useful, the table would need to be enclosed within a form that would post the category and subcategory choices.
  2. The queries are pulling from two different tables, one with just the categories and another with both the categories and the subcategories, with the appropriate category repeated for every associated subcategory. It might be simpler to use just the second table and to have the first query point to it with a "distinct" condition.

To see a live example, please click here: ColdFusion Cascading Dropdown Menus

UPDATE: I apologize that the link is no longer valid.

Wednesday, October 14, 2009

Home from Isla Mujeres

Scout is happy to be home even if it's for rent!Nan, Scout and I arrived home safely from Isla Mujeres over the weekend. On Saturday, we flew from Cancun, where it was in the high 90s with almost 100% humidity, to Denver, where it was in the mid-20s and dry--more than a 70-degree temperature difference! The delayed flight was smoother and Scout did better, with no apparent air sickness. We needed to keep him in his crate until we passed through customs, and he was a good boy--no whining, barking or fidgeting. There were no problems except one: we had brought a small amount of Mexican-made dog food with us to tide Scout over until we got home. The customs officer told us this was a no-no but he let us through with it.

We made it to an airport hotel by 11:00 PM, stayed the night, and then drove the five hours back to Grand Junction on Sunday, arriving in the mid-afternoon. As we pulled up to our home, we saw balloons and a sign announcing that our house was for rent! Our neighbors, Rich and Diane, who had been watering our outside flowers, love a good practical joke. The stinkers! When I checked my cell phone messages later, there was one from someone inquiring about the rental. I recognized Rich's voice and had a good second laugh.

Thursday, October 1, 2009

Expatriates on Isla Mujeres

Sunset from our deck in Isla MujeresIn the first few days we were here on Isla Mujeres, we met a few different sets of expatriates, mostly from the United States and Canada. Each expressed to us that they love it here so much that they were willing to leave behind their homes, families, friends and possessions to live here full time. None expressed any regrets, except maybe not having done it sooner.

We met Malcolm our first Sunday night when we went to Sancocho's to eat dinner and watch the Packers play the Bears in their home opener. It is off-season here and Sancocho's was the only bar showing the game. Malcolm is from Canada and has been on the island since they improved Internet access to a level that allows him to work remotely as a Web developer. Shortly after we were seated at a table adjoining Malcolm's, his friend Greg came in and sat down. We think Greg is from California because he mentioned that he had an engineering degree from Stanford. He is also doing remote development. Neither seemed to speak much Spanish, and they didn't show much patience with the waitresses. They struck me as single guys who were merely living in the island community rather than being a part of it, more like long-term tourists than new citizens. I doubted if they had many local friends other than expats like themselves.

Roger and Garnette retired here from government careers in Denver. They had vacationed in Cancun twelve years ago and taken a day trip to the island. They fell in love with it and relocated two years ago. They live frugally, renting a place in the La Gloria colonia (neighborhood), about two blocks from the English school where Nan is volunteering, and taking public transportation to get around. They speak adequate Spanish and are active in the community, helping with projects that aid chidren and the poor.

Greg and Natalie are the directors of the La Gloria school. Like Roger and Garnette, they are in their mid- to late fifties. They came here on a vacation two years ago and loved it so much that they closed on a furnished condo before they went back home to Bend, Oregon. They sold almost all of their possessions and moved here with just suitcases, though Greg confesses that he left nine boxes of stuff in storage that he has visiting friends bring one box at a time as checked luggage when they fly here. Of the three different sets of expats we have met, Greg and Natalie seem the most engaged. Through the school, they have come into contact with many local people and assisted them not only with learning English but also with handling personal issues. One evening we saw them on Av. Hidalgo with many bags of Crocs shoes hanging off the handlebars of their motos. They had purchased them in bulk to distribute to needy children. They are greeted warmly everywhere they go.

Tuesday, September 22, 2009

Busy Day on Isla Mujeres

Punta Sur, Temple to Ixchel and El Arco on Isla MujeresSunday was a busy day for us here on Isla Mujeres. In the morning, I took a boat ride with my old friend Ariel and his family. Ariel runs a fishing, snorkeling, whale shark watching and Isla Contoy tour operation with his 27-foot panga: arielsantizo@yahoo.com.mx or 011-521-998-165-6332. Ariel and his family in their panga on Isla MujeresWe motored all the way around the island while I took photos of familiar landmarks for the book I am working on. Nan didn't want to go so she stayed behind with Scout. It was a calm day, which made for easy photography. Ariel says that rounding Punta Sur can be terrible on days when the wind runs counter to the current. The first photo shows the Mayan ruins of the temple to Ixchel and El Arco, the arch under it, at the southernmost tip of the island.

Manolo playing with Scout while Juan and Paula get the mixer readyIn the afternoon, we took the golf cart down to our friend Juan's new house in Colonia Salina Grande. The house is much further along than when we saw it last October (Isla Mujeres, Mexico), but it is still not finished and may never be. There are no loans to be had, so construction is a pay-as-you-go proposition, and it has been tremendously slowed by the poor economy and lack of tourism.

Paula starting to frost her tres leches cakeThe book I am working on now is a collaboration with Juan's wife, Paula. We are writing a Mexican cookbook, Los Sabores de Isla Mujeres / Tastes of Isla Mujeres, based on Paula's traditional recipes. It will be in both Spanish and English, and there will be photos of her wonderful dishes and also of the island. The main purpose of our Sunday visit was to photograph Paula baking a tres leches (three milks) cake. Paula's tres leches cake is almost finishedIt was a three-hour affair, with time for a take-out lunch of chicken tacos and cervezas from the local tienda while the cake was in the oven. The finished cake was almost too beautiful to eat, but we all took a slice or two, and neighborhood kids came out of nowhere to help share it. There were big frosted smiles all around!

We have invited Juan and his family to our apartment at Color de Verano on Friday evening for a dinner of chicken enchiladas Nan-style. We hope to keep a back-and-forth dinner exchange going for as long as we are here. Of course, we also expect to enjoy as much of Paula's fabulous cooking as we can. We'll consider it research!

Monday, September 14, 2009

Greetings from Isla Mujeres!

Scout on the beach at Isla MujeresNan, Scout and I arrived here safely on Saturday afternoon. The flight from Denver was bumpy and the landing a bit rough, so we were not surprised to see that Scout had puked a little when he came around on the baggage carousel at the Cancun airport. He seemed fine otherwise and was happy to get out of his crate. Clearing him in through customs and immigration was more difficult than we expected. In addition to the four different vaccinations Scout was given before we left, they were expecting to see proof of inoculation for internal and external parasites on his official Health Certificate. None of the information we had read as we prepared for our trip indicated that this was necessary. Fortunately, Nan had a copy of the receipt from our visit to the veterinarian, which showed that we had purchased flea and tick medication and heartworm pills, and they accepted that as adequate proof, but it still took more than an hour to process his entry permit. On the plus side, the officials were kind and did not charge us the normal $15 USD fee for the permit.

On Sunday morning, we took a walk around the north end of the island. Scout was timid about the breaking waves, but he eventually waded in and out of the water. We have been keeping him on a retractable leash for safety, and this helped greatly in our encounters with the feral dog "gangs" that cruise the beaches. In the afternoon, we set up beach chairs in the shade of some palm trees on the beach across the street from our apartment. Scout quickly lost his fear of the waves as he dove over them to fetch a tennis ball I threw for him. He even swam confidently when the water was too deep for wading. Sunday is a big family day on Isla Mujeres, so there were lots of kids playing in the water. They were afraid of Scout at first since he is much larger than the native dogs, but they warmed up to him when they saw how friendly he is and how much fun it is to throw the ball for him.

Scout retrieving a tennis ball from the water at Isla MujeresScout has been a big hit everywhere we go with him. People seem pleasantly surprised to see American tourists with their dog, and they greet him warmly. Kids point and say "Perrito!" because with his short haircut, he does look like a puppy. Late in the afternoon, we rented a golf cart, one of the primary means of transportation on the island, and went to find the La Gloria school where Nan will be volunteering. Scout sat on the floorboard and watched the sights whiz by, at one point sitting on the gas pedal when I had my foot on the brake. No harm was done but we did burn a little rubber.

Monday, August 31, 2009

Raising Charlie is on Amazon.com!

Charlie and me on Whidbey Island in August 2008There is no actual book yet that you could hold in your hands, but Raising Charlie is now available for purchase at Amazon.com. A representative from the publisher called me this morning to confirm a few details and within an hour, the book was available online.

The thrill of seeing the book in an Amazon.com listing will not match the thrill of seeing the actual book, but after more than a year of work, it feels like a pretty big deal. I have already sold a few advance copies through my RaisingCharlie.com website, so the first books I receive will go to fill those orders.

Now it's time to undertake some creative marketing to get the word out and get the sales rolling. Away we go!

Saturday, August 29, 2009

A change in plans

Our sailing plans for next spring have changed. Instead of sailing exclusively in the waters off Panama, we're going to be sailing from Panama to Key West, Florida. When John Kretschmer contacted me last week with updates for his website (http://www.yayablues.com), the number of berths available for the "Caribbean Circumnavigation Leg 3" had increased from one to three. This was the trip I had been hoping to go on originally, so I asked if he would consider a "two-fer" as part of our trade arrangement. He agreed. So next year, from May 1 to 15, we will join John and the rest of his crew on Quetzal, his Kaufman 47, to sail from Bocas del Toro, Panama to Key West by way of Nicaragua, the Bay Islands of Honduras, the reef and offshore atolls of Belize, and one of our favorite places, Isla Mujeres, a small island off the Yucatan peninsula across from Cancun.

In fact, Nan and I are getting ready to spend a month on Isla Mujeres starting September 12. We'll be staying in the same penthouse apartment we stayed in last October, and the owners are letting our dog, Scout, stay there with us. It will be Scout's first flight, and we're hoping it goes well because there could be many similar trips in his future. We have already gotten him a "puppy cut" to keep him cool and paid a visit to the veterinarian to get his rabies and bordetella boosters. In addition, he'll need vaccinations for hepatitis, pip and leptospirosis, which we will get on the Thursday before we leave since we will also need to get a health certificate signed by the veterinarian not more than 72 hours before we enter Mexico. There is a permit to purchase when we get there but no required quarantine period. When he gets off the plane, Scout will be just another happy tourist.

While we're on Isla Mujeres, we'll be volunteering at an English school, tutoring children four days a week. This should help us with our Spanish, but we'll also be getting tutored ourselves three days a week. Nan came up with the idea to help our friends on the island, Juan and Paula, to write a cookbook, something like Tastes of Isla Mujeres, so we'll be working on that as well. By the end of our four weeks there, we will have a good idea of what it's like to live in a foreign country, which should be useful to us in our future adventures.

Sunday, August 16, 2009

Obama's Town Hall Meeting in Grand Junction

Protesters square off at President Obama's town hall meeting in Grand Junction, ColoradoPresident Obama came to Grand Junction yesterday, his first visit here since his campaign stop last September (Obama in Grand Junction). Last time, he was trying to win a close election. This time, he was trying to secure healthcare for all Americans.

Nan and I entered our names in the raffle for tickets to the event, but we didn't win any. Apparently, whoever makes those choices does not cross-reference the donors database or we would have been in the stands at Central High School, "Home of the Warriors," with all the other Obama supporters.

Instead, Nan convinced me that we should go and participate in the protests outside the event. When we took a left onto Warrior Way, it was immediately apparent that the pro-Obama faction was on the left side of the street and the anti-Obama faction was on the right. How could it be otherwise? We followed the cars in front of us and turned left. A young man in a reflective vest had me roll down the window to inform me that parking on that side was for pro-healthcare reform people. I guess he thought we looked like an old conservative couple. Nan and I replied in unison, "We are for healthcare reform!" He waved us in.

View from 'the left' of the tea baggers at President Obama's town hall meeting in Grand Junction, ColoradoI have to hand it to the pro-Obama people: they are well organized. They had a flatbed trailer for people to stand on, a sound system playing happy rock-and-roll songs, plenty of pre-made protest signs, and a contingent of young people handing out water and reminding people to "Stay Positive!"

The other side of the street was not so well organized, but they did have "Don't Tread on Me" flags and a bull horn. One of their chants was, "We want our country back!" Like a smartass, I yelled back, "Where did it go?"

It is obvious to anyone paying attention these days that the root of the controversy over healthcare is more about our African-American president than it is about the healthcare issue. The "birther" and "deather" conspiracies clearly demonstrate that there are people who are unwilling to accept that things have changed. We saw a sign that was a parody of the Obama campaign "Change" signs. It said, "Rewind Change." I thought, "Sure, let's replay the previous administration's disastrous eight years. Is that what you want?" Me, I'm overjoyed that we now have an administration that cares about all of the people, not just the wealthy and the white.

Monday, August 10, 2009

Sailing in Panama, Spring 2010

My gig maintaining John Kretschmer's website (http://www.yayablues.com/) is easily the best trade arrangement I have ever made. So far, it has allowed Nan and me to sail in the Spanish Virgin Islands this past April (see this blog's six-part series, "Sailing the Spanish Virgin Islands"). Next spring, it might allow us to sail in Panama.

When John and I first started emailing back and forth with sailing ideas for next year, I suggested that if he had extra berths available for his May 1-15 trip, "Caribbean Circumnavigation Leg 3 - Bocas del Toro, Panama to Key West, via Nicaragua, Bay Islands of Honduras, inside the Belize reef and offshore atolls, Isla Mujeres", maybe that would work to satisfy the trade. He came back with the suggestion of a "two-fer," one berth in trade and one paid. That sounded good to me since we would be taking berths away from paying customers, but it would be dependent on availability. He would try to fill all the berths before offering them to us.

Nan and I like to plan our trips well in advance, so the uncertainty of this deal was a concern. A few weeks later, John suggested that we sail in Panama instead. His sailboat, Quetzal, would already be there, in Bocas del Toro, the stopping point for "Caribbean Circumnavigation Leg 2". My immediate thought was that it would be fun to sail through the San Blas Islands and visit with the indigenous Kuni people, but then I looked at Google Maps and noticed that Bocas del Toro is more than 250 miles from the San Blas Islands. Under perfect conditions, that's at least two full days of sailing each way. Another look at Google Maps showed that Costa Rica, a country I've wanted to visit, is just 30 miles in the other direction. Maybe we could sail up the coast to Puerto Limón and Parismina, which is close to Parque Nacional Tortuguero.

If for some reason a trip with John does not pan out, I would be ready to do another charter in the British Virgin Islands. I read recently that the charter companies are allowing travel to Anegada these days, which would add a whole new perspective to the experience. We'll see...

Monday, August 3, 2009

Rafting the Colorado River

Charlie MacArthur and his students at the 'Little D' rapids in Westwater CanyonYesterday I joined my friend Kurt Beereboom and the staff and students of the Aspen Kayak Academy (AspenKayakAcademy.com) for a trip down the Colorado River from Westwater to Cisco in eastern Utah, northeast of Moab. Kurt and I manned his sixteen-foot inflatable raft while everybody else paddled high-performance kayaks, except Andy, who paddled the entire distance standing upright on a paddle board.

Kurt Beereboom and his whitewater raft in the eddy at 'Little D' rapids in Westwater CanyonThis was my first-ever rafting experience so I didn't know what to expect. I had done canoe trips in the Boy Scouts, but the rapids we negotiated then were ripples compared to what I imagined we would be encountering. I wasn't wrong. There were about twelve sections of rapids, and each was at least a Class III on the whitewater rapid classification scale, which goes from Class I to Class VI. The names say it all: "Staircase," "Funnel," "The Wall," "Sock-It-To-Me," "Last Chance."

Aspen Kayak Academy student in the standing wave at 'Little D' rapids in Westwater CanyonOne of the principles I live by is to not participate in activities where a single mistake could kill you. So I don't paraglide, rock climb or kayak. I have known people who died doing each of those activities. Whitewater rafting is borderline. At a certain level, it's just a complicated way to drown. I would never sign up for a commercial rafting trip, but Kurt invited me to join him on his raft, with which he has several years of experience, on a stretch of river that he has done a few times before, with just the two of us on board. It sounded almost safe.

Charlie MacArthur doing 'Skull' rapids the hard wayThe first photo shows Charlie MacArthur, owner of the Aspen Kayak Academy, taking a turn on Andy's paddle board, along with three of his teenage kayaking students, at the first of the Westwater Canyon rapids, "Little Delores." There is a standing wave there that Charlie and his students took turns "surfing" in their kayaks. On his first pass, Charlie did a jaw-dropping kayak move: at the point where the water dropped into the hole in front of the standing wave, he flipped the kayak over its bow in a cartwheel that landed him in the hole facing back upriver. He followed this with moves where he balanced on the crest and spun the kayak around in circles. When he tired of that, he flipped backward off the crest and came up facing downriver. Unbelievable. The third photo shows one of the students using excellent form to hold himself in the trough of the standing wave, which is flowing left to right. Click the photos for full-size views.

Charlie MacArthur at the entrance to the 'Room of Doom' after negotiating 'Skull' rapidsThe highlight of the day was the "Skull" rapids, an insane Class IV stretch that requires perfect maneuvering to avoid disaster. After passing the large rock on the left that marks the entrance, a boater must row strongly to the left to avoid a dangerously deep hole and then stay left to avoid being sucked into the "Room of Doom," a small natural cove with a perpetual whirlpool that makes it almost impossible to escape in a raft. The fourth photo shows Charlie going the hard way, to the right of the deep hole and perilously close to the sheer rock wall. The final photo shows Charlie at the entrance to the Room of Doom, from which he successfully escaped. Of course.

So how did I fare? I laughed like a soaking wet idiot through every rapid. It was a hoot!