Tuesday, November 2, 2010

Vietnam

Today was my fourth day in Vietnam and my best up to this point by far. Sleep deprivation, jet lag and overall culture shock has made almost all aspects of the trip a bit overwhelming until today. But last nights sleep got us about 12 hours in bed and at least 9 hours of sleep. I was very excited to wake up and have the sun shining.
We arrived in Hanoi Friday night, Oct. 19th after about 20 hours of travel. Our main flight from Seattle to Seoul was a bit over 12 hours and seemed to last days. We made the mistake of not bringing extra food or snacks with us and spent about half of the trip hungry. When we were finally fed, we found Vietnam Air cuisine mediocre at best. Shelby was able to sleep some, but I struggled, and planned to try to stay awake to help me sleep when we finally arrived in Hanoi. We watched multiple movies, played games on our phones, listened to music, walked around every few hours and tried to stretch our legs. Inside the plane, all the windows were closed and everyone tried to sleep, but opening a window would flood the whole cabin with bright light from outside. It was always a shock as you expected darkness outside.
When we finally landed in Seoul, we had plans to buy food for our 2nd leg of the journey to Hanoi, but we had to go through security and by the time we got through, we had to rush to our gate and quickly board our plane. This plane was not nearly as comfy and was a struggle to remain comfortable. Shelby managed to sleep again and I tried but only found myself in a daze of achey sleep and states of frustration. It was a rough 4.5 hour flight.
When we landed in Hanoi, we got through customs, got our stamps on our passports and exited... looking for our hotel driver who was waiting for us. When we finally found him in our confused tired state, he was a welcoming site. He was very friend and drove us calmly to our hotels - 45 minutes away into Hanoi's Old Quarter.
Our hotel was the Time Hotel in Hanoi. It was approaching midnight in Hanoi and everything was shutdown, we wanted food and our friendly host working the desk managed to get us some food and showed us two rooms of our choice. We chose the smaller one as it had a larger bed. We stretched our weary legs, ate our tasty beef and fried noodles, took showers and went to bed... but at this point we were both so overwhelmingly tired that we couldnt sleep. We both took half and Ambien and quickly passed out.
The next morning we awoke very early, took our first daylight look at Vietnam from our windows, got dressed and went to the top floor for our free breakfast. It was a charming layout, there was an enclosed and open section on the top floor that had tables to sit. We were happy to eat our western and vietnamese food in the sun, with great 360 views of the city.
My first thoughts of Hanoi was the architecture. I very much doubt that there are standards and codes here, and if there are, they are either not enforced or not very strict. Buildings are usually small in width, but go up several stories and they are stacked together in tight formations, usually with no space in between them. It seemed to me, that if you lived in Hanoi and owned one of these buildings, if you needed more space, you would simply just build another floor on top of the building. Also many of the buildings had nice little spaces on the roofs/top floors.
When we finally exited our hotel we were thrown immediately into the chaos that is Hanoi. The roads are trecherous. Even the little roads of Hanoi's Old Quarter are extremely intense. For every car there are probably 30 motor bikes. The rule of the road seems to be, do what you want, but dont STOP.... just keep going. I had read about this crazyness, but really nothing prepares you for it until you are walking in the middle of it. It is scary, intense and when mentally capable... often exciting. I found it very enjoyable... that is until I became too tired to deal with it...and during nights, I sometimes found it frightening as sleepyness made the lights all a blur.
This first day we started getting used to the Vietnamese Dong... 1 US Dollar = roughly 19000 VD. It is easier to round it to 20,000... so you keep track of it in your mind, 1 USD = 20k VD, or 5 USD = 100k VD.
Vietnam is cheap! Our first lunch in Hanoi was in an alley. A small space that was probably someones home during the night, turned kitchen during the day. They set out little plastic tables and chairs on the sidewalk/street. We ordered two bowls of Pho, totaly bill, 40,000 VD or $2 USD.
Communication in Vietname has been farely easy. Many people here speak at least some form of broken english. Otherwise a quick game of sherades can usually do the trick. Some of our best cherades so far, sleeping, puking (which we havent done yet), spiders, etc.
Our first day was exploring... walking walking walking. We did manage to get lost and totally turned around at one point, but quickly found that we were only a few blocks from our hotel, even though we were both convinced that we were nearly a mile away. Luckily, this only happened once.
We ended our first full day in Hanoi, eating at an extremely busy streetside spot, where they had probably 30-40 small plastic tables with seats. Seems the their best dish is roasted dove, but we chose chicken and beef instead.
Our second night we managed to fall asleep without phamiceutical assistence, but both of us were wide awake by 1am. We chatted for a while, checked emails, etc, then decided another half ambien was in order.
Jet lag has been a real struggle for us both. Good sleep has been hard to come by. You have moments of excitement and you feel pretty good, then a moment of sitting or relaxation can quickly put you in a state of frustration, agitation and extreme tiredness. We have both had moments of weakness where we could hardly speak. It is a day by day process as we slowly adjust.
Sunday morning we awoke, had our free breakfast on the pleasant terrace, hit the streets. We wanted to take it a bit easier this day and spent a couple hours on a rooftop coffeeshop. It was pleasant. We got our 2nd massage on the trip and got a 1 hour foot massage at a spa, total cost for both of us was around $20 USD.
Sunday night our hotel had got a driver for us to take us to the train station. We had an overnight train sleeper car booked for us to take us north to Lou Cai. Our final destination, Sapa.
The room in the train was small, 2 bunks on each side. We shared it with a nice couple from Austria who gave us extra earplugs... the train can be loud. I had a hard time stretching out in the bunks, but overall it was a comfy ride... though neither of us slept much. We arrived in Lou Cai at 5am. We had arranged a driver for us as apparently this is a location of many scams taking advantage of tired tourists. We had to wait for another train to arrive but finally our 45 minute ride to Sapa began. The views were amazing.
When we finally arrived in Sapa, we checked into our hotel, were shown our room which has an amazing view of the mountains.
I will try to write more tommorrow, as it is getting late, we need dinner and early bed. :)

Wednesday, July 21, 2010

Processing media:thumbnail in RSS feeds with php

Today I am creating a php file that will process various news RSS feeds.

The typical story RSS item looks like this:

<title>Mini-stroke care 'risking lives'</title>
<description>Many patients at high risk of stroke are not getting the specialist treatment they need, an audit finds.</description>
<link>http://www.bbc.co.uk/news/health-10713946</link>
<guid isPermaLink="false">http://www.bbc.co.uk/news/health-10713946</guid>
<pubDate>Wed, 21 Jul 2010 23:20:34 +0000</pubDate>
<media:thumbnail width="66" height="49" url="http://news.bbcimg.co.uk/media/images/48443000/jpg/_48443005_stroke1.jpg"/>
</item>


Problem here is trying to get the url attribute from media:thumbnail.

You can not simply call:
$item->media:thumbnail
or
$item['media:thumbnail']

The solution that I found works best simply loads the xml file as a string, then find and replace 'media:thumbnail' with a correctly formatted 'thumbnail' and lastly convert it back to xml with simplexml_load_string:


$xSource = 'http://feeds.bbci.co.uk/news/rss.xml';
$xsourcefile = file_get_contents( $xSource );

$xsourcefile = str_replace("media:thumbnail","thumbnail",$xsourcefile);
$xml = simplexml_load_string( $xsourcefile );
echo $row['xtitle'] . '<BR>';

foreach ($xml->channel->item as $item) {
echo ':' . $item->title . '<BR>';
echo ':' . $item->thumbnail['url'] . '<BR>';
}


Not nearly as easy as I could find but so far the best solution I could come up with. If anyone finds a better solution, please post it here.