Sunday, May 27, 2007

Rawlins Photos

I came back to Salt Lake to avoid the Memorial Day Madness that takes place in the mountains. Sadly, I did't get any good opportunities to take pictures on the trip. It rained on the day I set aside for photography. It is hard to plan things when you have a dog in tow. On the way home, I got some good shots of Rawlins, Wyoming after a rain.

Storm over RawlinsBank of the WestRawlins Depot

Wednesday, May 23, 2007

On the Road

Shooting StarI am in Denver sitting in a hotel as I ride out a storm. The picture to the right is a Shooting Star I found at Daniels Summit on US 40. The trip was a bit hurried, due to the weather.

I am traveling with Coco, and find myself tripling what I would usually spend on a trip to make sure the dog is happy. A bivy sack is good enough for a human, but I don't like having Coco wandering around at night barking at other campers; So, I've been staying in tents and hotels.

Staying in hotels brings up an puzzling issue. Every hotel I've stayed in the last several years has had a refrigerator. Both the cheap and expensive hotels are equipped with the fool things.

I've wondered why they do that. Refrigerators are expensive to operate and loud. My guess is that having a fridge in a room costs the hotel a buck a night. Add to that cost the taxes and need to maintain and clean the fridge. They probably charge me $2 for energy consumption I do not desire.

The reason I mention this is that a great deal of our individual energy consumption takes place beyound our personal choice. In this case, I have zero desire for a fridge (although I am paying for it). The energy consumption is built into the system.

It is the systemic energy consumption that really gets us.

Think of hundreds of thousands of fridges idling in empty hotel rooms. Our real problem is that we consume so much without thought. The challenge of our day is not in elimating luxury, but in finding a way to match the luxury with our desire.

Saturday, May 19, 2007

Parleys Crossing

For Coco's afternoon walk, I went over to Parleys Crossing and captured a few photos of the new pedestrian bridge. This bridge will be a boon for cyclists. It will connect Parleys Hollow to the Bonneville Shoreline Trail. This will be a nice, safe green corridor into Salt Lake City.

Here are a few websites related to the project. The Bonneville Shoreline Trail is a 72 mile trail that follows the benches carved by ancient Lake Bonneville. This new bridge connects the BST to the Parleys Pratt Trail. This trail will follow Parleys Creek and eventually cut over to Sugarhouse Park.

Currently the Parleys Hollow area is a favorite destination for Utah dog owners. It will be interesting to see what happens when the new bridge brings cycling traffic into the hollow. There are many people who would love to see dogs banned from the Parleys Hollow area. Here are more trail resources for Salt Lake City. Here are a few of the pictures I took during the walk:

Sego LilyNew BridgeGrandeur Peak ParkMouth of Parleys

Immigration: A One Way Valve?

Both Conservatives and Liberal pundits seem extremely unhappy with the current rounds of talks on immigration. The existence of unhappy pundits is sometimes a sign that legislation is going in the right direction. My primary concern in any legislation is simply that the people who are going through legal channels don't get pushed aside by those taking the underground route. Any reform that weighs the needs of the people in legal channels over those set on cheating the system is a success.

I think that the idea of forcing people to exit and re-enter is a waste of precious energy. You could accomplish the same thing with a symbolic exit and re-entry. Rather than wasting energy on plane flights, immigrants could go to the Taco Bell, err., I mean, to the local courthouse and have a symbolic entry to to US.

An angle that I have really not heard a lot of talk about is the migration needs of existing Americans. It seems to me that immigration liberalization in the United States should be discussed in a larger context of free migration of labor throughout the world. Our increasing the number of work permits and immigration slots should be made with a plea that other nations increase opportunities for Americans.

Unfortunately, the way our dysfunctional Congress goes about reform has the potential of creating a one way valve. Despite the faults of the American immigration law, our nation's laws are substantially more liberal than most other nations.

I don't know if we are creating a one way valve. People really don't notice such things when the flow of migration is toward the US.

The ideal of liberal immigration is the free migration of labor. If we were wise we would be using the current liberalization of American immigration laws to force greater liberalization of emigration throughout the world.

My personal experience: After college, I wanted to spend a year or two abroad to expand horizons and learn languages. I applied for a variety of work permits. Every permit was rejected. My friends who wanted to do the international thing had the same experience.

Americans aren't welcome abroad.

If the current immigration reform does not take into account the opportunities of Americans abroad, we will find that our taking on another 12 million people decreases the opportunities for individual Americans have to work abroad.

Friday, May 18, 2007

Quality Photo Blog

This was unexpected: Ann Torrence dropped a note on my Lake Blanche post. It is intimidating when an exceptional photographer drops a note on an amateur photographer's site. I follow both Ann Torrence's photo blog and check in on her galleries on a regular basis. She is one of those photographers who've elevated the craft beyond snapshots to true storytelling.

I admit, my photo site exists primarily for database design experiments. This blog exists simply because blogging is the in-thing-to-do.

Theoretically, the value of my type of mindfart blog is that it can help point out quality sites. I hope that this posts directs some traffic in Ms. Torrence's direction.

Wednesday, May 16, 2007

Lake Blanche

Shhhh! Don't tell Coco.

While Coco was on a trip with her owners, I took advantage of a free afternoon to hike up the Mill B South Fork Trail to Lake Blanche. The hike provides some killer views of Sundial and Dromedary Peaks. If you have a full day, you can hike to the tops of the peaks and see the other side. Being a good weboholic, I took my camera and shot photos. There's over a hundred pictures in this set that includes both wildflowers and scenic views. You can skip to the middle pages to get to the alpine scenes. The Cottonwood Ridge of the Wasatch is one of those areas that would be a national park if it were in any other state.

Wisely, the state does not allow dogs in the canyon.

The trail follows a little creek labeled Mill B. The name is a bit confusing as there is another Mill B Creek on the other side of Big Cottonwood Canyon. The literature refers to them as North and South Forks of Mill B Creek. This is even more confusing since both creeks drain directly into Big Cottonwood Creek. There are also creeks called Mill A, C and D.

The trail is relatively steep. It climbs 2700 feet in about three miles. I wore a shirt sleave shirt, no hat and no sunscreen. I was having a worse time with the high altitude sun than the steep grade. I ended up camping out in the shade of an SPF 40 pine tree to let my skin cool down. Because the air is cooler at high altitudes, people like me tend to forget that the sun is more intense.

Because I took a long siesta on the way up, I found I was pressed for time to invest walking around the lakes. I ended up walking the last mile of the trail back to the car in the dark. The tips for the trail: Bring a hat. Wear a long sleave shirt. Bring sun sreen. Don't bring a dog. Above every, be prepared to enjoy wildflowers and scenery.

White VioletDromedary PeakAlpine buttercupReflecting on Sundial PeakSouth Fork Mill B Drainage

Monday, May 14, 2007

Legislating Morality

The first shot at this post was too long and confusing. I had been listening to shows where people were going at each other on different topics. The first part of the post was trying to say that you can think something is wrong, but still think it should be legal.

The idea that you have to "legislate your morality" leads to ruin. In the classical liberal view, the government should be concerned with setting limits on behavior and not on defining its ideals. The limits of the law should be outside what you personally consider acceptable behavior.

The second part of the post was trying to put forward the argument that the converse is also a path to folly. Just because something is legal does not mean it is good. The game where you make the limits of acceptable behavior your ideal also ends up leading to folly.

The long post did not adequately convey that idea. For that matter, I didn't realize it was long. I had listened to two different controversies. The first is a religious group wants to excommunicate politicians for voting for abortion. The second was an ACLU case where they sued someone for reacting to a provocation.

Using these cases really didn't make the point I wanted about the difference between ideals and limits.

BTW, I need to watch out. Apparently I am capable of pounding out 4 pages of words in a short typing session while listening to podcasts.

Saturday, May 05, 2007

Register Globals

If you are wandering why the CommunityColor upgrade is taking so long; It is taking so long because I am having a bear of a time trying to figure out how to code with register globals off. In PHP 4, all of the GET and POST parameters magically appeared in each script as a variable. So, if you called a function as "page.php?a=1&b=hello," the web server would automatically turn a and b into variables. All form elements magically appeared as variables as well. This created a big security hole. If a programmer forgot to initialize their variables, they could create a security hole in their code. The PHP.net example of a hole is:

if (authenticated_user($user_nm, $password)) {
$authorized = 'yes';
}
if ($authorized == 'yes') {
showSecretInformation();
}


Since the coder forgot to initialize $authorized, a hacker could get at the super secret information by calling the function with "page.html?autorized=yes."

My way around this security hole was to put everything in functions. The parameter list would filter out noise thrown by hackers. The page doSomething.php might look like:

// define function
function doSomething($parm1, $parm2) {
// do something ...
}

// main program flow
doSomething($parm1, $parm2);


In PHP 4, the variables ($parm1 and $parm2) would magically appear in the code. I would pass them on to doSomething() as parameters.

In PHP 5, all the data comes in "super globals." The superglobal $_GET contains data appended to URL strings. The superglobal $_POST contains the data from HTML Forms.

My job as a programmer is to get the data from these super globals an into the code. I am having a hard time finding an elegant way of doing this. For that matter, I find myself wandering if I need to convert the data to variables at all.

So, rather than fixing my broken sites. I've been wasting days doing all sorts of experiments with ways of getting data out of the super globals.

It is strange how one change in the foundation has ramifications throughout a system. The change even affects the overall thinking about programs.

In the case of this register globals change, I am going through a great deal of brain damage on a problem that I had (at least theoretically) solved in the way I was doing my coding.

If I just turned register globals on. All of my programs would work.

With it off, I find I have to figure out where and how to pull the data from the super globals. I am even left wondering if I should pull the data out as variables.

The PHP manual suggested that I do the following to create variables.

$var = (array_key_exists('var',$_POST))? $_POST['var'] : '';


I would have to write that code for every single variable. It turns out that the code is very slow. I would rather deal with all the variables at once.

I would rather deal with the variables all at once. In the next section of code, I create an area with the different variables I might see in the code. The foreach line loops through all of the variables from $_POST The sample code would produce variables called $a, $b, or $c.

$type=array('a'=>'int','b'=>'str','c'=>'int');

foreach($_POST AS $key => $value) {
if ($type[$key] == 'int') {
${$key} = (int) $value;
} elseif ($type[$key] == 'str') {
${$key} = strip_tags($value);
}
}


The above code is essentially a filter that leaves only the variables I list in varType.

The question of where to process the variables is more problematic.

I could place the foreach code at the top of each page. This is essentially the same as having register globals on. I gain a little security as a I place the variables through two filters (the code and the function list).

There is also the possibility of putting the variable translation code in each of the functions. This eliminates the need for creating functions with large variable lists. It also breaks some of the coding rules that I have developed over the years. For example, I believe in using an n-tiered approach to database development. IMHO, the objects that encapsulate a database should know nothing about the source of the data. The objects should know nothing beyond what is given to them as parameters. Taking data directly from $_POST violates this mantra.

Of course, if I am going so far as to break my rules on n-tiered structure; why not go all the way and simply feed the $_POST data directly into the database? Why waste precious computer cycles translating things into interim variables. For example, it would be possible to fill a database with the command:

$sql="UPDATE My_Table 
SET fname='".validStr($_POST['fname'])."',
lname='".validStr($_POST['lname'])."',
children='".intval($_POST['children'])."',
hometown'".validStr($_POST['hometown'])."'
WHERE user_id='".intval($_POST['user_id'])."';"


(FYI, The jab at local culture was intended to be humorous).

Folding the data directly into SQL statements is the absolutely fastest way to move data from a web page into the database. Of course, I become 100% dependent on my little validation programs (validateStr(), intval() and floatval()) to keep the hackers at bay. Of course, even with the other methods I've experiment with, I am dependent on the integrity of validation programs to keep the data safe from hackers.

Anyway, my poor little brain is filled to capacity as I think through of all the ramifications of one minor change in a PHP revision.

Thursday, May 03, 2007

Iris in the Rain

I just discovered that there is a program called "Microsoft Picture Manager" on this computer I bought last year. This program has a preset button that will reduce pictures to 800x600. I think I will start making the pictures on my gallery 800x600px. The old picture have a leading edge of 640px. It looks like this new editing program will be less onerous than my old editing program. I can now easily process pictures in groups of one or two. Here are a few garden shots: (My favorite is the bundle of cacti)

Flowering CactusIris in the RainPoppies in the Rain

Wednesday, May 02, 2007

Wouldn't it be great ...

Wouldn't it be great if they actually talked?

Yahoo is running a news story (Bush, Democrats begin search for Iraq compromise) that suggests that Bush and the Democrats might actually talk about compromise on the war funding bill.

Back in January, I put forward the statement that the troop surge was a great idea since it provided a better framework for a debate on the future of Iraq than the post election blues that saw defeat and retreat as the only solution.

Unfortunately, the debate I hoped would happen in January never materialized. Both Democrats and Republicans simply entrenched. Rather than debating the troop surge, Bush just did it. Democrats responded by passing bills that were guaranteed to result in a veto.

Quite frankly, I think the problems of Iraq are a direct result of our inability to engage in real dialogue. In 2003, I felt that if we really looked at world threats, we would not have invaded Iraq. In 2003, Hussein was politically isolated. Sudan was a greater humanitarian crisis and Iran a greater strategic threat.

If we had engaged in the apropriate dialogue in 2003, I doubt we would have invaded Iraq.

This inability to engage in dialogue is not simply the result of Bush. It is result of the modern way of thinking. The neocons, after all, are people who use the techniques perfected by the left for causes of the right.

According to this new think, Pelosi, Reid and the left wing of the Democrats have a great deal to gain if they can keep dialogue from happening. The best path to the Democrats getting a full house (the Presidency and both Houses of Congress in 2008) is to keep Bush in a corner.

Keeping tensions high also will stifle the threat that the Blue Dog Democrats would pull the party toward the center.

On the Republican side, Bush and the neocons might be so entrenched in their notions of Machiavellian virtue that they might be incapable of dialogue. Their thick little skulls might be clinging to the illusion that the best way to win the 2008 election is for the Democrats to continue their swing to the left.

Political strategies aside, I think that our inability to engage in discourse is likely to lead to poor results.

As I stated in January, a proposal of troop surge was a great start for a debate. The fact that we did not debate the surge increased the likelihood of its failure. Since debate did not happen, we created a situation where the people pushed out of the debate were actively looking for ways to call the surge a failure. Quite frankly, I believe that our disunity feeds our opponents.

The way you reach unity is by talking. It would be wonderful if the parties actually started talking.

Tuesday, May 01, 2007

Strategic Bio Fuels Reserve

Fidel Castro and Hugo Chavez have been on a major international campaign against the use of ethanol and other forms of bio fuels.

I agree that massive Federal subsidies for ethanol production will likely run astray. Federal subsidies have a history of creating false economies. Subsidies tend to concentrate wealth in the hands of a few politically connected people. Subsidies also tend to mask market signals. In other words, like most big government programs, subsidies lead to a false economy where a very small number of extremely rich people make questionable decisions based on bad information.

In such a world, it is highly likely that the government program would divert food resources from the mouths of babes into the belly of the machine.

Although it is likely that the proposed ethanol subsidies will be little more than an expensive boondoggle, I believe it is possible for the government to support ethanol production without messing up the market. It is even possible that for a government to support ethanol without hurting the food supply.

The challenge with the food supply is that the food supply is controlled by the weather. In years of famine, there is insufficient supply of food. Prices rise, and the amount of food stored decreases. Interestingly, the years of abundance are often worse for farmers than years of famine. In years of abundance, the market is flooded with food, and prices drop as farmers try to unload perishables in a crowded market.

To help even out this unpredictable market ruled by feast or famine, the United States government has all sorts of subsidies, price controls and tariffs in place.

Rather than creating a new ethanol subsidy, the US government could spur development of ethanol by replacing several of the existing farm subsidies with a strategic bio-fuel purchasing program. This program would purchase excessive corn in years of abundance and convert the excess into bio-fuels. This program would only purchase grain in times of abundance. The program would then sell fuel from the reserves on a gradual basis (helping offset the cost of the reserves.)

By coordinating the purchase of bio mass for bio fuels with climatic cycles, the government would actually end up enhancing the food supply by stabilizing the food market. They would encourage the development of the ethanol market by creating a stable source of ethanol.

By developing a strategic reserve that concentrates solely on buying excess production during years of abundance, the government would effectively create a bio fuels subsidy that enhances both the fuel and food production cycles. Such a system would work within the existing market, and would allow the government to answer strategic security needs of providing fuel and food with a minimum of direct interference in the market.

May Day Struggles

A happy May Day to the citizens of the Peoples Republic of Amerika! Our glorious leaders, Comrade Pelosi and Comrade Reid, have joined the international peoples struggle by signing the "Wars Funding Bill," in defiance of the imperial dog George W. Bush. The oppressed undocumented workers, who've been forced from their native lands to toil in the fields of imperial America, have taken to the streets.

On the local front, the paper announced that the peoples have made a major advance in the peoples struggle against vouchers, by having an anti-vouchers resolution on the ballot. (I find this news odd. The people who asked me to sign the intiative said that the ballot initiative was for vouchers, not against vouchers. Of course in a peoples struggle you say what is effective.)

On the international front, Comrade Chavez has seized control and nationalized the Orinoco oil fields. Meanwhile the peoples armies of Al Qaeda and Hezbollah continue the people's struggle against Zionism and the Imperial West.

On this glorious May Day 2007, the world stands united against peoples enemy: the imperial dog George Bush.

The only sad note is that the peoples hero Fidel Castro was not able to attend May Day Celebrations in Cuba. While the glorious leader was not able to attend May Day celebrations, the glorious leader did issue the proclamation of a people's struggle against the use of ethanol in vehicles.

I've been wondering if it is true that the use of bio-diesel and ethanol will necessarily take food away from the starving peoples. So, now that my obligatory post on the state of the May Day Struggles is through, I think I will pen a quick essay on my thoughts on ethanol ... to come soon.

I sincerely hope that the readers of this blog are never the focus of a peoples struggle. Nien Cheng wrote an interesting story about being on the wrong side of a peoples struggle.