21 December 2008

Christmas Story

I've been reading the LDS Publisher blog for a while now. The author has some good general information about publishing, especially for self publishers or those trying to get published for the first time. About a month ago, a post appeared inviting everyone to submit Christmas stories for a little contest. I didn't think much of it, but on my walk home from work a story started forming in my head.

That night, I tried the story out on Candace. I just told her I wanted to tell her a story and then proceeded to try and tell my ideas as a coherant story. I think I was doing pretty good until I got to the end which I hadn't decided on yet. We talked about it for just a bit and then went to bed.

The next morning I started writing. I wrote the story from the top to the bottom. I read the story a few times correcting different inconsistencies and other little things. I gave the story to a friend who enjoys creative writting and had him read the story and give suggestions. I agreed with most of what he said, but never had the time to implement the changes before the submission date of the contest.

None of the above is real important, but it gives a little insight into the development of the story. I would like to have the story illustrated and published so that I could give it to my children one day. You can read my submission on the contest page or below.

Cricket's Gift

There would be no snow for Christmas this year. The winter was far too warm to allow it. Cricket sat alone outside his doorstep. He watched many animals scurrying back and forth on the roadside in front of his home.

Field Mouse must have been preparing a great feast. He was running in every direction scavenging any nuts and berries he could find that had been left by the late coming winter.

Snow Owl sat quietly in a bare tree over head. He was just waking as the sun set behind him. Cricket watched as Snow Owl left his perched position and flew high into the evening sky, his wings stretched out wide as he glided in front of the rising moon.

It was Christmas Eve and all the animals were rushing to finish their preparations for their Christmas celebrations. Cricket had no one to spend Christmas with this year. His preparations were very meager and so he sat and watched the bustle of others.

As he sat, Cricket began to play his favorite violin. He loved to play even though he never had an audience. On this night he played a beautiful medley of Christmas hymns. As he played he thought of the Christ Child. His feelings and his melody grew deep and strong. He played with all his feeling and the hymns floated through the still night.

Cricket put down his violin long after the last rays of sunlight had disappeared. The animals were still scurrying from place to place. No one seemed to notice his melody in the air. The night was now dark and cold. Cricket entered his home, stored away his violin and prepared for bed.

Before retiring, Cricket knelt by his bedside and prayed to the Lord. Cricket thanked the Lord for His goodness in sending the Christ Child. Cricket cried. In part for joy and in part for loneliness, for Cricket had no one to share his joy with this Christmas. In time, Cricket climbed into bed and fell asleep.

Cricket was still drowsy but he awoke to a voice calling his name. "Cricket," the voice called again. Cricket lifted his head and looked around his room. A man with a long white beard stood at the foot of his bed smiling at him.

"I am the Spirit of Christmas," he said. "I have come to deliver a gift to you. This is no ordinary gift. It has not been crafted by the hands of men, but instead is created in their hearts." He then beckoned to Cricket saying, "Come with me."

Cricket pulled on his night-coat as he crawled out of bed. Together they stepped out of his house and into the street. Walking with the Spirit, Cricket did not feel the cold chill in the air. They stopped at the home of Field Mouse and entered the house, but no one could see or hear them.

Field Mouse was singing merrily as he added finishing touches to many of the Christmas decorations around his home. Eventually, he was satisfied with all his preparations and sat down in a chair next to his lovely wife. His wife looked up at him as he quietly finished the melody of a beautiful Christmas hymn. She spoke softly, "I have never seen you so happy before and never singing so joyfully." Field Mouse looked thoughtful for a moment and then replied, "As I was out gathering the last preparations for Christmas, I heard the most beautiful music. A single violin echoed the voice of heaven as it filled the world with the hymns of Christmas. I guess I have been singing ever since."

The Spirit of Christmas beckoned and led Cricket from the home of Field Mouse. As they walked together Cricket said, "I didn't think anyone heard me play tonight." The Spirit smiled and said, "We never know what the hearts of others see and hear."

They continued on their journey to the home of Rabbit and his family. While at Rabbit's house Cricket learned that Rabbit had opened a window upon hearing the echo of a violin. He gathered his wife and children around him and told them the story of the birth of Jesus in Bethlehem. He told them how angels had filled the sky and sang to shepherds who tended their sheep in nearby fields. That night even the youngest children sat quietly and listened to the sounds of the nativity. Their hearts were full knowing that they were allowed to hear the heavens rejoice on this Christmas Eve.

The Spirit of Christmas led Cricket from home to home that night. Each residence held similar convictions. They all felt that they had been blessed to hear a heavenly melody ringing in the Christmas celebration.

Cricket returned home and cried again as the Spirit of Christmas left him. He knelt by his bedside and thanked the Lord for the vision he had been shown. He was no longer lonely, for he had hosts of people to serve and bless. Cricket still plays his violin each year to usher in the Christmas celebration. If you listen very closely this Christmas Eve you to may hear his heavenly melody playing in your heart.

30 November 2008

Rolls

Thanksgiving was wonderful. So much good food. We didn't have any family around but we did have some good friends come and enjoy all of the food. Turkey is wonderful! Potatoes and gravy are great! Pumpkin and apple pies with fresh apples from the apple tree are excellent! But what I think makes thanksgiving the best is rolls. Yes, wonderfully tasty bread rolls. Rolls with butter, rolls with jam, rolls with cranberry, rolls with gravy, rolls with turkey, rolls with...well just about anything. The following is my mother's roll recipe. I think they are the best rolls ever. I have tried quite a few different recipes, but I always come back to this one. It has taken a while to figure out the tricks to make them right, so I will try to share what I have learned to make the just right.

Ingredient List
4 1/2 tsp yeast (2 packages)
1/2 cup warm water
1 Tbsp sugar
2 cups of milk
1/2 cup butter (margarine will work, but butter is better)
1/2 cup sugar
1 tsp salt
2 eggs
8 cups of flour

Directions
Stir yeast and 1 Tbsp of sugar into 1/2 cup warm water. The water needs to be quite warm to make the yeast react, but not to hot to kill the yeast. This is a little hard to measure, but you should be able to get the water out of the tap. It should be hot to the touch, but not burning. They key is, about 10-15 minutes after you mix it, the mixture should become very foamy. I usually mix this in a 2 cup liquid measuring cup and the foam will almost fill the cup. Set this mixture aside.

I use a kitchen aid mixer for the rest of the ingredients. Heat milk to hot, but not quite boiling. I usually do this in the microwave. Pour the milk into the mixing bowl. Soften the butter and add it to the milk. Add sugar, salt, and eggs to the milk mixture. The yeast should be very foamy by now. Add the yeast mixture to the milk mixture. Mix in 7 cups of flour. The dough will be very sticky.

Spread about a cup of flour on the counter. Dump the dough onto the flour. Put some more flour on top of the dough and some on your hands. Knead the flour into the dough. Adding the last cup of flour this way allows the dough to pick up as much flour as it needs. The dough should be smooth and elastic. Don't knead the dough to long, just long enough so it no longer sticks to your hands. Spread some flour in the mixing bowl. Place the dough back in the bowl, cover it, place it in a warm place and allow it to rise for about a 1/2 hour to an hour or until it doubles in size.

Punch the dough down. Put some flour on your hands, do this as necessary so the dough does not stick to you. Make balls of dough, table tennis to golf ball sized. I do this by squeezing a ball of dough in between my first finger and thumb until the ball of dough pops loose. Place the balls of dough on a cookie sheet. It makes about to cookie sheets worth of rolls. Cover the rolls and let them rise for about half an hour. Bake them for about 15 minutes at 350 degrees.

As soon as you pull the rolls out of the oven, rub a cube of butter or margarine over the top of the rolls. The makes the top of the roll very sweet. Pull them off the cookie sheet and enjoy!

04 November 2008

A Memory

Wrestling is a genetic trait among Jones boys. Countless hours have be spent practicing, running, sweating, starving, aching, suffering. For some reason it was all counted as fun. Practice often included running sprints about 5:30 AM, running for lunch, 3-4 hours of actual practice time after school, and running in the evening.1 It was a bit grueling, but again, somehow it was all counted as fun.
On one particular night after a very hard match, which included the usual black eyes and split lips, I sat down in the recliner in the living room to rest. I don't remember why, but for some reason Mom volunteered to massage my feet. I gladly accepted. They hurt. In fact, everything hurt. Mom quietly and tenderly work out the tension and pain of my sore muscles. I probably fell asleep due to the relief...or the Ibuprofen.

The significance of this simple act of service was certainly not understood or appreciated as it should have been at the time. Years later though it has often brought to mind the simple act of the savior as he sat with those he loved most. “[Jesus] riseth from supper, and laid aside his garments; and took a towel, and girded himself. After that he poureth water into a bason, and began to wash the disciples’ feet, and to wipe them with the towel wherewith he was girded.” Mom understood what the Savior meant when he said, “If I then, your Lord and Master, have washed your feet; ye also ought to wash one another’s feet.” Countless hours of service. No visible reward.

I suppose the true significance of this act of service came into view as new little feet came into my own home. Each pair of feet needing special care and attention. I only hope that I can serve as thoughtfully as those who have left such great examples to look on.



1. Spitting is gross. Besides if you can spit, you aren't running enough or dieting right.

22 October 2008

The Prince

This weekend on our family vacation to Colorado I had some time and finished reading The Prince, by Niccolò Machiavelli. I appreciated Machiavelli's logical and straight forward approach to the subject of becoming and remaining a prince. His arguments were clear and concise which made the book very enjoyable to read.

As I read I could not help but thinking of Utopia, by Sir Thomas More. Machiavelli would argue that the Utopian society would not last long because a mercenary army would not suffice to keep the country safe for very long. This led me to wonder how their society would work if the people had to defend themselves. Their society would require a standing army. I think this would still work with the other principles of their society. I would expect they would require service in the military. They would focus on teaching their soldiers skills of physical strength and skill. Many of these skills could be utilized in their future professions. No one would remain in the military forever, but all would be available if needed. The older solders would teach the younger ones until their time to leave the military was at hand. In this way, their military supports society, but is not a profession in itself. This may not be the most efficient military, but it might suffice for their needs.

I disagreed with at least one theme presented in the book. Machiavelli writes, "For a man who wants to make a profession of good in all regards must come to ruin among so many who are not good. Hence it is necessary to a prince, if he wants to maintain himself, to earn to be able not to be good, and to use this and not use it according to necessity." I can certainly see his point. If everyone around you is not good and you are to rule over them, you also must perform acts that are not good to gain control of them. You must, of course, do some of both so that you gain control while at the same time you gain their respect and servitude. While this line of reasoning is sound, I disagree in two regards. First, you should never disregard your principles because of the actions of others or because of circumstance. Second, I don't believe that the evil of the people is an immutable fact. Machiavelli did not have record of King Benjamin. The way King Benjamin dealt with the problem of wickedness was to convert all of his subjects to the gospel of Christ. This allowed him to rule without fear of the people.

Overall, I enjoyed the book a great deal. I learned a bit about the science of politics, which is an important thing at this election time. It allowed me to consider how our nation, as well as other contemporary nations, handle power and security.

01 October 2008

Pointing at myself

There has been lots of blame passed around about who is at fault for the current economic problems in America. There is one group that no one seems to be looking at. That group is the general citizenry. It seems that politicians won't point at the masses because they would no longer be politicians. The media won't point at the masses because people would quit listening to them. Economists won't even point at the masses.

As a people, we are too focused on having things, and having more of them. We are constantly wanting to buy more things, even if we don't have enough money for them. We want better and nicer things even though what we have would suffice just fine.  BusinessWeek has written a few articles that explain some of the problems with our over zealous consumerism. It is interesting to note that the last article I linked to was published about two years ago. Michael Mandel concluded in one of his articles by stating, "Americans attempted to maintain the growth rate of living standards after 2000, even after income growth slowed for many people and real wage growth turn negative." In other words, we continued to spend money as we always had even though we were making less. Lots of things contributed to the current economic problems, but I think much of the problem does lie with us.

Personally, I am glad the price of gas has sky rocketed and the price of homes has plummeted. I hope these things are a bit of a wake up call for us. I know it has given me a chance to look at my finances and reprioritize a few things. It has also helped me look at what I can do to be less wasteful. I think in general as a society we have been living at a level beyond our means and it is time to get back to reality. Greed, lust, pride, and envy have been leading this country too long. I think it is time to get back to caring and sharing. Perhaps the single best cure for the current state of the economy would be for everyone to take a little time and money and set them aside for those who are less fortunate. I think that would give everyone a little better perspective. This new perspective would in turn decrease our desire to have more things for the sake of having them, thus allowing us to bring ourselves out of the current, self created, debtors prison in which we all currently reside.

24 September 2008

Doing Something

I was reading in the Book of Mormon this morning where Alma the Younger is telling his son Helaman about his conversion. I had an interesting thought as I read and compared this experience to that of Paul in the New Testament and to my own life. I ofter hear in Sunday School classes people wonder at why someone so wicked would have the experience of seeing an angel while other more righteous people did not get that chance. I think the question though not stated is, "Why can't I see an angel. I am more righteous than Paul was."

My thoughts don't generally come to me in a linear format so it is hard to write them out in such a way, but I will do my best. The specific verse that triggered my thoughts was Alma 36:5, the end of which states, "but God has, by the mouth of his holy angel, made these things known unto me, not of any worthiness of myself." The first thing to note is that Alma recognizes that he did nothing to deserve his salvation. He received his salvation through the grace of Christ. I noted here that I receive salvation the same way. This means, that no matter how good or bad we are, we all receive salvation through the grace of Christ, and not by "any worthiness of [ourselves]."

This idea that we are all "unworthy creatures" put me on level ground with Saul and Alma before their conversion. This led me to wonder what it was that made both of these men such worthy candidates for direct correction. I think the main strength of these men was their diligence in doing what they thought was right. Their course was wrong but they went full force down the path they deemed appropriate. Paul even went to the extreme of rounding up the christian heretics so they could be executed.

These men were primed to do the work of God. They were very active in their governments and communities. They were very good and organizing and leading people. They were great at teaching and persuasion. They had every thing they needed except the truth and little direction. God was able to then very easily give that to them.

Many people of their day had the truth already, but they did very little with it. They were energized to get up and do something. I suspect that God had lots of reasons for choosing these great men to lead in His church, but perhaps on of them is that they were already leading. Perhaps it is easier to get an misguided but energized person to change course than it is to get a correctly focused slothful person to become energized.

This has made me think a lot recently about where I stand. I recall the words that John wrote to the Laodiceans, "I know thy works, that thou art neither cold nor hot: I would thou wert cold or hot. So then because thou art lukewarm, and neither cold nor hot, I will spue thee out of my mouth." It seams that the Lord would have us be "anxiously engaged." I have had to think a lot recently about what I am engaged in. There is a lot going on in the world right now. There is no shortage of good causes in which to help. I guess it is time to stop thinking and time to start doing.

04 September 2008

Two conventions and too much comentary

I was able to watch some of the democratic and the republican national conventions over the last few weeks. I found all of the speeches I heard quite interesting. I also found the commentaries very useless and annoying. I wasn't sure if I was about to hear our government officials speak, or if a daytime soap opera was up next, or if I was watching a Super Bowl pregame show. Due to the difficulty of wading through all of this tiresome blathering, I have consolidated videos of the actual speeches given by the candidates at their conventions.

There will be a series of debates coming up soon allowing us an even better glimpse into the ideas and strengths of the current presidential hopefuls. The first official presidential debate will be September 26. The first official vice presidential debate will be held on October 2. You can find more details at the You Decide 2008 website.

Many thanks to CNN for making these videos available.

Joe Biden's Speech


Barak Obama's Speech (Part 1)


Barak Obama's Speech (Part 2)


Sarah Palin's Speech


John McCain's Speech (Part 1)


John McCain's Speech (Part 2)

12 August 2008

Mt Nebo Hike

I made it to the top of Nebo! I went with Nate and Matt, who are friends from work. It was a very fun hike. I was out of shape and it turned out to be a bit painful as well. For the last few days it has been very hard to get down stairs. I feel like I have been given a large series of shots all in my thighs. In other words, I am very sore. But that is OK. Candace has been very good to take care of me. I have been saying lately that Bianca is learning about consequences, now Candace is telling me that Daddy is learning about consequences. But enough of that business, on to the hike.




Nebo has 3-4 peaks depending on how you define it. There is the north peak, the center peak (which is the tallest), and south peak. Between the south peak and the center peak is another peak that stands just about a hundred feet shorter than south peak. For lack of a better name, I called this peak the "almost south peak."

We hiked up the north peak trail and reached the top of Nebo in a little over 2 hours. The trail is beautiful though pretty much straight up. Much of the trail has nice cover from the fir trees. The picture to the left is of Nate and I on the north peak trail. The trail leads up the ridge you can see behind us in the picture. It then moves behind the north peak and continues up to the summit.

From the summit our plan was to traverse the ridge from the top of Nebo to the south peak. This is the part of the trail that was not really a trail at all. There was no maps saying it was possible, but we had read of people doing it. So, that was our plan. Get up there, figure out how to get across and then come down the other side of the mountain following the south peak trail.

As you can see from the remaining pictures this turned out to be a little more technically challenging than we expected. The ridge in places was literally less than a foot wide and a few hundred feet down on both sides. It was a very fun hike, but with my fear of heights, I spent most of the climb on both my hands and feet moving quite slowly. The approximately one mile between peaks took us a little over two hours to traverse. This included about a half hour of deliberation on whether we should continue on or turn back. At one point the trail went straight down for about 100 feet and was covered in loose shale. Of course one can easily sit down and slide to the bottom, but it was unclear whether we could get back up the other side of the trail or not. From where we sat, it looked very steep and nearly impassable. Finally Nate decided the only way to know was to go look. So down the trail he went. In a few minutes he yells back that the trail look fairly easy to climb. So down we go. The impassable trail was relatively easy to cover. In another half hour or so we were on the top of the south peak.

By this time my legs were killing me. I was dead tired. I no longer wanted to climb anything. My lack of preparation through out the summer was shining through. I didn't even want to stand up for a photo op. I just sat on a rock and rested...hoping my body would forgive me for torturing it. I am writing this four days after the hike. My thighs are still killing me.

The trail down the south side of Nebo was nice. The were lots of wild flowers and other plants that lined the trail. It was fairly steep and about twice as long as the trail up the north side. Going up the north side and down the south side was definitely the right way to go.  By the time we got down I just wanted to sit down, but my legs hurt so bad that it was hard to do.

After an hour drive home, a warm shower, and dinner, I spent the night...hiking. Grandpa and Grandma were in town and we had free tickets to see the Thanksgiving Point Gardens. So we all went and walked around some very beautiful gardens for the evening. It was wonderful, but I sure slept well that night.

I learned a lot of things from this hike. I learned about consequences and preparation. But I think the most poignant thing that I learned was about perspective. The pictures you see give a glimpse of what we saw as we hiked, but they lack perspective. It is hard to tell from the pictures what the mountain was really like. Each hike I go on I notice that things change dramatically based on where I am at on the trail. The same mountain or the same valley may look completely different from a different point on the trail. As we sat and wondered if the trail to the south peak was passable or not the trail looked very steep and dangerous. As we drew nearer to the actual place we had to climb it became simple. I think in life we need to take the time to look at things from different perspectives. We need to see things from different angles before we pass judgment. Before we decide to turn back, before we decide to avoid a challenge, we need to move in close and find out what is really before us.

You can find more pictures of the hike in Matt's picassa web album.

31 July 2008

Many to Many Join with Propel

In my symfony application I have many images. Each of those images has lots of tags. Each tag might be associated with many different images. Yes, the classic many to many relationship. Now, using propel I would like to get all of my images, with their associated tags. Seems simple enough... except that "there is no magical support for many-to-many relationships in Propel." Propel is not very good at many to many relationships.

The propel documentation gives an example of how to retrieve objects for this type of situation. There are two major problems with the example. First, it only works if every image has a tag because the joins are inner joins instead of left joins. Second, it runs 1+n querys against the database which is terrible if you are retrieving a lot of images at once. For a lot of cases the example may be sufficient, but it did not work in my case.

The first step to making this work the way I needed was to construct a query using left joins retrieving all the needed data. I did this by creating a new method inside my ImagePeer class. I chose this place because my real goal is to get a list of images, I just want to do it efficiently.
public static function doSelectWithTags(Criteria $c, $con = null){
  $c = clone $c;
  $c->setDbName(self::DATABASE_NAME);
  
  $c->addJoin(ImagePeer::ID, ImageTagPeer::IMAGE_ID, Criteria::LEFT_JOIN);
  $c->addJoin(ImageTagPeer::TAG_ID, TagPeer::ID, Criteria::LEFT_JOIN);
  
  ImagePeer::addSelectColumns($c);  
  ImageTagPeer::addSelectColumns($c);
  TagPeer::addSelectColumns($c);
  

  $first_image_tag_col = (ImagePeer::NUM_COLUMNS - ImagePeer::NUM_LAZY_LOAD_COLUMNS) + 1;
  $first_tag_col = $first_image_tag_col + (ImageTagPeer::NUM_COLUMNS - ImageTagPeer::NUM_LAZY_LOAD_COLUMNS);
  
  $rs = BasePeer::doSelect($c, $con);
The next step was to hydrate all of the objects. This is fairly complex, but much of the code is taken straight from other methods in the ImageTagPeer class.
$images = array();
  $tags = array();
  
  while($rs->next()) {
    $image_id = $rs->getInt(1);

    if(array_key_exists($image_id, $images)){
      $image = $images[$image_id];
    }else{
      $omClass = ImagePeer::getOMClass();
      $cls = Propel::import($omClass);
      $image = new $cls();
      $image->hydrate($rs);
      $images[$image_id] = $image;
      $image->initImageTags();   
    }

    $tag_id = $rs->getInt($first_tag_col);
    if($tag_id > 0){
      $omClass = ImageTagPeer::getOMClass();
      $cls = Propel::import($omClass);
      $image_tag = new $cls();
      $image_tag->hydrate($rs, $first_image_tag_col);
    
      if(array_key_exists($tag_id, $tags)){
        $tag = $tags[$tag_id];
      }else{
        $omClass = TagPeer::getOMClass();
        $cls = Propel::import($omClass);
        $tag = new $cls();
        $tag->hydrate($rs, $first_tag_col);
        $tags[$tag_id] = $tag;
        $tag->initImageTags();
      }
      $image->addImageTag($image_tag);
      $tag->addImageTag($image_tag);
    }
  }
  return array_values($images);  
}
The last thing that I had to figure out was how to work around propel's query caching system. I never found a very elegant way to solve this problem, but I did find a way. Even though I set up all the object connections between images and tags, propel doesn't understand how it was done and will try to rebuild the connections. When the call getImageTags is made the empty criteria passed in does not match the left join criteria that was used to find the ImageTag objects. Therefore, propel refetches the ImageTags to make sure it has all the right ones. This is usually the desired functionality, but there is no nice way to get around it. In my Image class I added the method getImageTags to override the parent functionality. It can be passed a flag that says "just use what ever you have."
public function getImageTags($criteria = null, $con = null, $check_cleanliness = true){
  if($check_cleanliness){
    return parent::getImageTags($criteria, $con);
  }else{
    return $this->collImageTags ? $this->collImageTags : array();
  }
}
Not the most pretty code, but very functional. I can now get a list of images with all of the associated tags in a single query across three database tables.

24 July 2008

for, find, and whitespace

I recently wrote a short bash script to create thumbnails of all of my images and place them into a single directory. Basically I needed a bunch of images that I could do some testing with. It seemed like a simple enough task, but then I ran into the dreaded bash whitespace problem. This seems to be an issue for a lot of people but it still took a long time to find a solution that would work in my case.

Here is an illustration of the problem I had.
for FILE in `find`
do
  echo $FILE
done
In this example if a file or directory has the name "My File", the for loop will iterate once for the word "My" and once for the word "File". By default bash parses the string and splits it on tabs, spaces, and newlines. You can fix this a few different ways. The best way I determined was to change what bash considers to be whitespace. You do that by changing the value of IFS.
export IFS=$'\n'
for FILE in `find`
do
  echo $FILE
done
After figuring that out the rest of the script was pretty easy. The complete script is below for anyone who might like to do the same thing. This was a quick hack to work for my situation and you will certainly need to adjust things for what you need.
export IFS=$'\n'
for PATH in `find /Users/username/Pictures/ -type f -name '*.jpg' \
        -o -name '*.gif' -o -name '*.jpeg' \
        -o -name '*.tif' -o -name '*.png'`
do
 FILE=${PATH##*/}
 /usr/local/bin/convert -size 180x180 $PATH -thumbnail 90x90 images/$FILE
done

22 July 2008

Testing Propel Models in Symfony 1.1

I have been struggling for many hours trying to figure out how write unit tests to test my propel models in symfony. The documentation discussing how to test propel models has not been updated for symfony 1.1. There is one key thing that must be done to initialize the propel classes so that you can test your models. The key is that you must create a sfDatabaseManager object. The following is a complete test.
include(dirname(__FILE__).'/../bootstrap/unit.php');
require_once(dirname(__FILE__).'/../../config/ProjectConfiguration.class.php');
$configuration = new ProjectConfiguration(realpath($_test_dir.'/..'));

$databaseManager = new sfDatabaseManager(
$configuration->getApplicationConfiguration('frontend', 'dev', true)
);

$t = new lime_test(1, new lime_output_color());
$model = MyModelPeer::retrieveByPK(1);
$t->is($model->getName(), 'Test', 'Name retrieved correctly');
All the credit for this information goes to pentium133 for his post on the symfony forum that contained the solution.

27 June 2008

Big Baldy Hike

I made it to the top of big baldy this morning. I started at the trail head at 6:00 AM and made it to the summit at 8:15. Wow am I sore! The trail I took was only about 3.5 miles but it was straight up. No switch backs, no flat spots. Just straight up, and on the way back it was straight down. It was beautiful though. Big Baldy sits right below Mt. Timpanogos on the East side. When the trail curves around to the back side of Big Baldy you find yourself in a beautiful valley. Tempanogos towers above you on one side and Big Baldy stretches up on the other. I would have taken pictures, but I can't find our camera.

There was a lot of wildlife out this morning as well. I ran into all sorts of different birds, including something that looked like a mix between a pheasant and a turkey. It looked like a pheasant except it's tail fanned out when it took off. There was a blue jay on the very top of the the very tallest tree. Lots of insects were buzzing around by the time I got to the top. I met a black snake. I think we scared each other. I think it was just a garter snake, but I have never seen a black one before. I saw quite a few ground squirrels. I saw a large deer jump across the trail abut 100 yards in front of me. Then there was all the things I couldn't see. I could hear things moving around in the brush from time to time, but it wouldn't come out for me.

I have been looking at Big Baldy for the last six months. Ever since we moved here, I wake up each morning and look out our bedroom window at Big Baldy. Circumstances being as they have been I have not been able to make the climb until now. Well, that is not entirely true. I have started up the trail twice now, but have not had enough time to finish. I like to go hiking early in the morning before work, but that means I only have a few hours to hike.

Here is a map of the trail I took. You might have to zoom in a little bit to see the terrain better.

View Larger Map

28 May 2008

Omniture Web Analytics and Blogger

I moved recently. Both my blog and my person. One of the side effects of moving to a new home was that my little Pentium II webserver in my basement had to retire. I no longer have my own IP address. So I had to find a new place to host my blog. Blogger or Blogspot worked out well for me because I could keep my own domain name.

One thing I have struggled with, switching from my own install of webpress to blogger, is trying to get Omniture's javascript code to work with my blog. I tried fruitlessly to get the code mixed into a template. I could never get it to render correctly. Maybe someone with more Blogger template experience could get it to work, but I could not. But I finally figured out an easy way to go about it. You can add a HTML/JavaScript page element to the layout of the blog.

Blogger has lots of different types of page elements you can add, such as polls, slideshows, or a blog archive. They also have a page element labeled HTML/JavaScript. This page element allows you to add any third-party JavaScript functionality to your blog. I can't believe it took me this long to find it.

Now knowing where I could place JavaScript code it was pretty easy to deploy. The one catch was that I had to make a small change to the Omniture code. The Omniture code comes in two parts. There is the base code and the configuration code. Generally the configuration code includes the base code. I hade no where to save a javascript file for the configuration code to include. Therefore I removed the link to include the code and just pasted the code above the configuration code. This required that I add <script type='text/javascript'></script> tags around the code, but other than that it was a fairly painless process.

Yes, this means that I am now collecting statistics about you as you read this. It is fun to see where people are coming from and what pages they look at. It looks like Google collects stats about everyone using blogger already too. Thanks for visiting. Come back soon.

19 May 2008

Elantris

I have had a little downtime for the last few days and thought I would read a good book while I couldn't do anything else.  Candace has suggested that Elantris is the best fantasy book that she has read, so I picked it up and read it over the last two days.

Elantris is Brandon Sanderson's debut novel.  For an initial novel I think he did very well.  The story was intriguing and well thought out.  I appreciated it's originality.  I am not a big fantasy reader, but the world that he created seemed realistic and original.  

The novel is written, not from the first-person, but from a limited third-person who focused on three main characters.  This was a different style that took me a while to get used to.  Each chapter switched scenes and main characters.  This abrupt change bothered me until the climax of the book neared.

The characters were developed very slowly.  New perspective into the world and the characters was added until the very last page of the book.  There is no way to guess the end because you don't know enough to guess it until you're there.  That was just fine though.  Nothing was added that was out of line with a very possible reality which made it feel like the characters were real, and reacting to real situations. 

The author created an extreme amount of names that I could not even begin to pronounce.  I just skipped over them connecting that certain set of letters with the character or place described.  This is OK I suppose, it is a whole new world and I was reading to myself, but it was a bit distracting.

There were quite a few one-liners.  Sentences that put forward philosophical or otherwise interesting statements intending to suggest a real world bit of truth.  They seemed a little bit out of place at times but I appreciated them none the less.  If a story doesn't teach you something it's not really worth reading.  Beyond the one-liners there was a good fight between truth, lies and when we should use each.  There was also good discussion on the role of religion in one's life.

Overall, Elantris was an excellent book.  I would definitely recommend reading it if you enjoy fantasy novels. Brandon Sanderson has other novels that he has written now which have also been highly recommended to me.  You can learn more about them on his website.  Brandon is also doing some interesting things with immediate eBook publishing.

18 May 2008

The Brothers Karamazov

I finally finished it.  It has taken almost three years, but I finished it.  The book: The Brothers Karamozov, by Fyodor Dostoevsky.  It took so long to read mainly because I have not had much time to read.  The other reason it took so long is because the book is not meant to be read fast.  There is very little plot.  The plot is there mainly to create situations to more fully develop the characters. This is not a novel like most you find today.  The plot does not keep you reading, the ideas do. 

The Brothers Karamozov is a novel exploring humanity, truth and the meaning of life.  Perhaps what I liked best, and found very refreshing, was the authors ability to be objective.  He put forward both sides of almost every point of view.  I can't say the author was actually objective though, he was biased towards both sides.  As Ivan forcefully tried to deny God, it seemed as though the author agreed.  As Father Zossima and Alyosha explained their faith in God, you could feel the author's faith as well.  This is perhaps the best written piece of literature I have ever read from that regard.

The abstract on the back cover of my copy of the book put forward an interesting statement that I wanted to discuss briefly.  "Rebellion and The Grand Inquisitor present what many have considered the strongest arguments ever formulated against the existence of God."  The two chapters mentioned are very interesting.  The first questions how God can exist with all of the atrocities which are committed against the innocent.  The second is a wonderful story where Christ appears to the Grand Inquisitor.  The Grand Inquisitor puts Him to death because He is not helping to bring peace to the world.  Christ taught freedom of faith.  The Grand Inquisitor was forcing peace through forceful unification of faith.  These ideas are brought out as Ivan, the scientific brother, talks with Alyosha, the believing brother.  It is Ivan's voice through most of the two chapters but in the end you are left with a lot to think about, not the author's agenda.

I found the quote on the back of the book interesting because when I was done reading both chapters I was left thinking that Ivan had some serious questions to which he did not have any answers, but if he understood God and his plan for his children better they would no longer be questions.  I did not find the chapters to be arguments against the existence of God, rather I found them to be arguments revealing the ignorance of man.

The entire book was wonderful.  Every chapter held a series of gems to ponder on. If you have a lot of time I would highly recommend The Brothers Karamazov.   You will need to set aside time to read as well as ponder over the nature of God, the devil, and especially, man.

09 May 2008

Big Bang

I read a poem a few days ago that really got me thinking. I didn't realize how influenced I had been by the educational system, and the current thinking of the time. The poem is from the children's book, Science Verse, by Jon Scieszka, illustrated by Lane Smith. It is titled, 'Twas The Night.

'Twas the night before Any Thing, and all through deep space,
Nothing existed-time, matter, or place.
No stockings, no chimneys. It was hotter than hot.
Everything was compressed in one very dense dot.

When out of the nothing there appeared with a clatter
A fat guy with reindeer and something the matter.
His nose was all runny. He gave a sick hack.
"Oh, Dasher! Oh, Dancer! I can't hold it back!"

He huffled and snuffled and sneezed one AH-CHOO!
Then like ten jillion volcanoes, the universe blew.
That dense dot exploded, spewing out starts,
Earth, Venus, Jupiter, Uranus, and Mars,

Helium, hydrogen, the mountains and seas,
The chicken, the egg, the birds and the bees,
Yesterday's newspaper, tomorrow's burnt toast,
Protons and neutrons, your grandma's pork roast.

The universe expanded. The guy said with a wheeze,
"Who will ever believe the world started by sneeze?
So let's call it something much grander, all right?
Merry BIG BANG to all! And to all-Gesundheit!"

I thought this a very funny poem when I first read it. The irony was clear. A sneeze triggering the creation of the universe. Then I thought a little further. The irony was that I believed that the universe started as a tiny speck and is expanding due to the release of infinite mass and energy from an infinitely small point. As I thought even more, what I found to be most interesting was the fact the because the Big Bang is the best model that has been presented thus far, it is accepted as absolute truth by the masses, those who are not astrophysicists.

Is the universe expanding? There is a good chance. Is it certain? No. Could it be that the universe is orbiting, like everything else in the universe, and that we are moving away from the center right now in an elliptical movement. Maybe. I suspect this would give the appearance of expansion from a single point, given the extremely large orbit and our extremely small ability to observe. Perhaps the universe is expanding because a creator at the center is creating more. Maybe we don't understand what we are observing. It wouldn't be the first time. I suspect there are all sorts of other theories out in the world right now. Some much more extreme than what I just said, some much less extreme. My point being, lets not close our mind because we can not understand everything. Maybe everything did explode into existence, but we will never know the truth unless we keep our minds open and explore all possibilities.

Alexis de Toqueville stated, "I am unacquainted with [God's] designs, but I shall not cease to believe in them because I cannot fathom them, and I had rather mistrust my own capacity than His justice." I love this quote. I know God exists. I don't understand how He does everything, but that does not change the fact that He exists and is doing things that I don't understand. Not understanding why and how God does things seems like a poor reason not to believe in Him.

Well, just some random musings. I hope they almost make sense to someone. I know I exist. I know God exists. I know the universe exists. I think it was always here and is just being reorganize.

18 April 2008

Six Steps to Maximize your Disneyland Trip (for those who have never been and don't want to go)

I did not go as a child. I did not want to go as an adult. The whole thought of taking my children there and listening to them complain as we waited in long lines for very short thrills all the while having people try to sell me noisy, cheap, plastic replicas of things did not sound appealing at all. Candace had very fond memories of going to Disneyland as a child and as a teenager. Candace has been planning a Disneyland trip for quite a few years and I have been reluctantly agreeing to go...sometime.

The time finally came. I could not prevent it any longer. I am writing this as Candace drives the current leg of our 12 hour drive back home from a great week at Disneyland. It took quite a while (years) for me to overcome my prejudice. I never got to the point where I really wanted to go to Disneyland, but I did decide not to hate the trip before I went. Not quite a open mind, but not completely closed. Here is my first step for maximizing your Disneyland trip. Keep and open mind. It might be fun.

FastPass, ChildPass, Disneyland guide books, planning schedules, hours of the day, days of the week, months of the year. You can find all sorts of statistical analysis determining the most effective way to traverse the paths leading from one ride to another. Decrease walking, Increase riding. As far as I could tell from talking to everyone that had already been to Disneyland, that was the key to having fun at Disneyland. I beg to differ. We walked all over Disneyland, saw all sorts of things, rode most of the rides (most only once). We just walked from place to place. Not in a hurry at all. Most of the rides were not too busy anyway. We didn't wait over 15-20 minutes for any rides. If it was too long a line we might get a FastPass, or we might just go to a different ride or play area. There is lots to see. We were there for three days and probably did not see a quarter of the park. Since the point is not to see everything and do everything, it is to have fun together as a family, we didn't even try to see everything. We just had fun where ever we were. So this is my second step to maximize your Disneyland trip. Don't try to see everything or do everything. Just move at the speed your family can have fun going.

Annmarie's favorite ride was the bus. She loved riding the bus to and from Disneyland. She cried when she saw the bus drive away one morning before we were ready to go. As we tried to hurry to get ready so we would not miss the bus, everything went crazy. Everyone started yelling at each other to call the elevator up, and to get their shoes, and to comb the last head of hair. The tension increased dramatically in a matter of moments. Instead of continuing this we all stopped, came back in the room, slowed down, and finished getting the ready at our own speed. This is the point that the bus drove off and our youngest started crying because we missed the bus ride. Here is my third hint on maximizing your Disneyland trip. The buses come every 30 minutes or so. Don't run to their schedule. Catch the one that is available after you are ready to go. The waiting time is less than many of the rides. If you are really that concerned about it though, rent a hotel in the park.

The best ride I went on was the Buzz Lightyear Astro Blasters ride. On this ride to sit in a little tea cup that spins around with the pull of a joy stick. There are also two laser guns that you use to shoot at the evil Zurg's minions. If I had been alone on this ride it would not have been that great, but I rode this with Christian. Seeing his wide eyes and excitement at shooting the bad guys made this the best ride ever. Christian was too small to enjoy most of the rides, but this was just his thing and he reveled in it. Yes, we even bought him his own cheep plastic astro blaster that lights up and makes noise. My fourth step to maximize your Disneyland trip is to enjoy your children. Even if Disneyland is not that exciting to you, your children can be.

I learned one very important thing on this trip. While we were having breakfast one morning our waiter brought us some Orange Juice. He brought cups with lids for the children. Then the magic happened. He grabbed a straw and pulled off one end of the wrapper then stabbed the straw into the cup. Cannon promptly told him that he left half of the straw wrapper on the straw. It was great! Now I know how to easily get the wrapper off of a straw. The fifth point...you can enjoy things that are not in the park as well.

Now for the sixth and last point. Disneyland is a business. It is going to take a lot of your money. Expect it. Accept it. It is OK to spend a lot of money very quickly every once in a while. The tickets cost $60 per person. Each meal in the park is going to cost $6-7 per person. There is also the cost of travel and lodging. In the end it is going to cost a few thousand dollars to make a trip to Disneyland. Don't begrudge the cost or it will ruin the entire trip. Disneyland is providing a service that you are paying for. You may be paying an excessive price, but you made the decision to do it and it is OK. Have fun at Disneyland!

The trip really was fun. It was a little stressful trying to keep track of the kids all the time with so much going on in every direction. There was a fair amount of whining from the kids...and the adults. But overall it was very fun.  Here is a slideshow of our trip.