Tenerife – Teide National Park

23 04 2012

This was my big day. I planned to climb to the top of Spain’s highest mountain. If you want to go on the top of the Teide you need a permit which you can get online. But don’t wait to long. When I looked for the permit around 3 weeks before my holiday there were already a lot of slots totally booked out. The permit is for the chosen date and timeslot (2h). Therefore you must make sure that you are there at a specific time. Otherwise you can’t go up to the summit.

First I had to drive thru the National Park up to the place where my track, which should bring me to the top, starts. The drive thru the National Park was beautiful. I really liked to drive on this winding road all the way up to the National Park.

My start point was a small parking spot with a bus stop called Montana Blanca. I parked my car there and started my hike up to the top. Have a look at the GPS-Track of my little hike:

At the beginning it was a really easy walk. It was a very wide road. At some point a car came down the hill with a guy from the National Park Team. Therefore you can imagine how comfortable it was on this way.

But you can guess this was only the beginning of this track. Suddenly the track conditions changed. The track became smaller and smaller and steeper and steeper. I reached one point – I wasn’t sure where I need to go. There was only a little sign which pointed up the hill. From this point it starts to get more and more exhausting. It was steep and the way was that small that it was enough for a single person. At some points it was really hard to stay on the track because you couldn’t see the track clearly. At one point I must have missed a junction because I had to climb over a couple of stones until I found back on the track.

Some time later I reached the “Refugio de Altavista”. This is a small place where you can stay overnight. I had a short rest at this place and enjoyed the awesome view I had from this place. At this point I already hiked from 2342m to ~ 3300m.

After a short chat with a guy I met at this place I went on with my hike because I wasn’t sure how long I will need for the rest to the top and I wouldn’t miss my time slot for the summit.

The rest of the track till the cable car station was okay. The way was good to walk and the only problem was that you had to fight with the thin air. Which made this part a bit more exhausting. On the way to the cable car was a nice spot where you had a awesome view down the hill.

When I reached the cable-car station I had to pass a gate where some guys check your passport and that you have the permit to climb to the summit. From this point it started to get very exhausting. The steepest part of the hike started here. Having such a steep way would be exhausting enough, but steep and the thin air was VERY exhausting. I walk a couple of meters and had the feeling that I need to rest. On the last couple meters of altitude difference I need to pause a couple of time. It wasn’t possible to walk up this part without breaks for me.

Reaching the summit at 3718m rewarded me with an awesome view. I had really luck because the view was very good. I was able to see the complete island. At the north were many clouds. The rest was mostly clear. The view was that good that I was able to see La Gomera and La Palma the neighbor islands.

The Teide is a volcano. Standing at the summit at the corner of the crater you could smell the brimstone. There were a couple of places where hot steam came out of the crater. You can believe me this is such an awesome place. But to be honest it was a very exhausting climb especially with the thin air.

After a small break at the summit I start to climb down to the cable-car. I had the feeling that it was already enough for this day and I decided not to climb down the complete way. I took the cable-car down the hill. I had the luck that the bus drove off exactly at the moment when I reached the bus stop. The next would come 1h later. Therefore I decided to walk the 2.5km along the highway to my parking spot.

Because of the great views at the top of the mountain I have a lot of panorama pictures for you.

DSC_0096-DSC_0098

DSC_0302-DSC_0306

DSC_0312-DSC_0315

DSC_0325-DSC_0328

DSC_0344-DSC_0347

DSC_0357-DSC_0362

DSC_0372-DSC_0376

DSC_0386-DSC_0389

DSC_0400-DSC_0406

DSC_0454-DSC_0460

DSC_0485-DSC_0488

And here are a couple of pictures I took on this hike up to the Teide.

Cheers,

Daniel

Advertisements




Tenerife – Santa Cruz

21 04 2012

My plan for this Saturday was to drive to the north of Tenerife. I planned to visit Santa Cruz and do a little hike at the north of the island.

I jumped in the car and drove on the TF-1 to Santa Cruz. The first thing you see from Santa Cruz is the industrial area. This area is located close to the ocean.

After passing this area I parked my car and started my walk inside the city. The first place which I really liked was the “Auditorio de Tenerife”. The design of this building was awesome and reminds me of Sydney’s opera house. Very close to the building is something like a little castle. At the waterfront, are a couple of big stones with painted faces of popular people. Some of the drawings looked pretty good.

On my way thru Santa Cruz I came across a couple of nice places. My first stop was the local market. They offered so many products there, unbelievable. On this market (Mercado de Nuestra Señora de Africa) were a couple of tourists but many local seem to buy their products there. Opposite was the TEA building (Tenerife Espacio de las Artes). A very nice an modern building. The library in side the building looked awesome. I really likes the minimal design there. After crossing the little river I came across a nice church. I walked on a road away from the church to the street were many shops are located. At a couple of side streets, on my way, I found many walls with nice street art. My last stop was the harbor of Santa Cruz which I reached after walking thru the botanical garden. At the harbor were only a couple of boats but I had luck and saw a very big one.

I spent a lot of time walking thru the city. To honest I was really surprised about the size of Santa Cruz. All cities of the canary islands I saw before are much smaller than Santa Cruz. It was already that late that I didn’t had enough time for a hike. Therefore I returned to the hotel.

Have a look at my panorama pictures…

DSC_0205-DSC_0212

DSC_0246-DSC_0250

DSC_0279-DSC_0281

… and the photos inside my album from Santa Cruz

Cheers,

Daniel





Tenerife – Montana Amarilla & Arguayo

20 04 2012

On my second day with the car I planed to visit Barranco del Infierno. Inside my travel guide is written that this is one of the highlights of Tenerife.

I drove to Adeje which is in the south of the island. The entry of Barranco del Infierno, which is a wildlife sanctuary, is located at the north of Adeje. This area is very steep. I was really happy that I had no oncoming traffic and don’t had to stop at this very steep road.

After I parked my car I walked the last meters to the entry. At the entry was a little ticket box where you normally can buy the ticket for the entry. Today the ticket box was closed. I saw a big sign saying that the track is closed because the risk of falling rocks is to high at the moment. I was very disappointed about this information.

Back at the car, I had to plan something new. Inside my travel guide was another short hike at the west of Tenerife which sounds interesting. My next stop was Arguayo. Inside this little town, close to the football stadium the track for this hike starts. Have a look at my GPS-Track from this little hike if you like.

When you stand at the beginning of the walk you can see two mountains. I followed the track until I reached the top of the left mountain. There I had an awesome view over the complete valley. The weather was good and I had the first time a nice view to La Gomera which is the neighbor island. On the way back I found the entry to the “official” hike which is described inside my travel book. This track will bring you around the right mountain. It’s not easy to find the entry. The track isn’t used very often therefore many parts are accrued by nature.

While hiking on this track I was able to see another part of the valley which was very nice, too. On the way back at the other side of the right mountain I must have left the official path (it wasn’t possible to see the official path). Later I had to climb over some rocks to reach the official path again. After finishing this walk I still had enough time for something else.

I decided to drive back to the south. Costa del Silencio was my next stop. This little holiday town is located near Montana Amarilla. This little mountain is located directly at the coast. It was a short walk up to the top with a nice view. I continued my walk along the coast line and found a place which looks a bit like Paisaje Lunar.

Costa del Silencio is located very close to the airport. I was able to see a couple of aircrafts landing. Near the airport is a little mountain which is colored red. I got some really nice shoots from this little mountain while walking along the coast line. Have a look at my GPS-Track where I walked around in this area.

As you could already see on my GPS-Track I walked a bit to the inland before I walked back to my car.

Can you guess what is coming now? Sure I have some panorama pictures for you.

DSC_0120-DSC_0123

DSC_0127-DSC_0130

DSC_0142-DSC_0147

There is another picture which I want to show to you, here you can see how fast the weather conditions can change at Tenerife. On the Arguayo walk I have taken a picture. 18 minutes later you weren’t able to see the Teide because the weather has changed that fast. Have a look at this picture of the Teide National Park.

DSC_0112_126

And last but not least the picture album with some pictures of both walks.

Cheers,

Daniel





Tenerife – Hike from Vilaflor to Paisaje Lunar

19 04 2012

Today I collect my little car which should make me a bit more mobile for the next week. I received a little Kia Picanto at the car rental station. It’s really a nice, little car. I didn’t drove a Kia before but this car surprised me very positive.

My first challenge was to find from the rental station to the highway. Compared to Germany the road signs are very rare.

After I found the correct highway I drove directly to Vilaflor. Vilaflor is the highest-located city on Tenerife. It’s a very small town built into the mountains at 1420m above sea-level.

This city was the start point for my first hike at Tenerife. The track I choose should bring me from 1400m up to 1971m above sea-level. The highlight of this hike was Paisaje Lunar which is a white moon scape. It’s a very impressive view to see these mountains formed by nature.

On the hike I came across some old buildings which were also very nice and were a good motive for a picture.

When I reached Paisaje Lunar I thought it’s a good time to take a little rest and enjoy the great view there. I realized very soon that I’m surrounded by a couple of lizards. I had some apples inside my backpack and feed some of the lizards with some apple pieces. The came very close and I was able to take some very nice pictures.

After I returned from the hike I sat down for a moment next to the car. I was able to look very far down the hill. In less than 10 minutes the weather changed completely. The sight was reduced by the fog which reached Vilaflor. I was only able to see a couple of meters. It’s really unbelievable how fast the weather can change at Tenerife. It wasn’t the last time that I had such a weather change while I have been to Tenerife.

Afterwards I drove into the Teide National Park. The sight wasn’t that good and I wasn’t able to view very far. At one point I was still able to see the peak of the Teide which is the highest mountain in Spain (3718m).

Some pictures about the Teide National Park will follow in one of my next posts.

If you are interested in the hike I did, have a look at the following map. This displays the hike I did.

I have taken a little panorama shot on my way back.

DSC_0069-DSC_0071

And here you can find some of my pictures from the hike.

Cheers,

Daniel





Persisting and fetching DateTime values with MongoDB

28 03 2012

The C# driver for MongoDB serializes data by default from C# objects to a bson representation which is stored inside MongoDB. The DateTime type is a bit special which I want to demonstrate with the following test.


public abstract class RepositorySubjectwhere T : Repository
{
    public static T Subject { get; set; }

    public RepositorySubject()
    {
        var mongoDb = new MongoDB();
        Subject = (T)Activator.CreateInstance(typeof(T), mongoDb);
    }
}


public static class BlogRepositorySpecs
{
    [Subject(typeof(BlogRepository))]
    public class When_refetching_persisted_data : RepositorySubject
    {
        private static BlogPost blogEntry;

        private static BlogPost result;

        Establish context = () =>
        {
            blogEntry = new BlogPost()
            {
                Author = "Test Author",
                Comment = "My Comment",
                CreationDate = new DateTime(2012, 4, 12),
                Id = ObjectId.GenerateNewId()
            };
        };

        Because of = () =>
        {
            Subject.Save(blogEntry);
            result = Subject.FindById(blogEntry.Id.ToString());
        };

        Cleanup after = () => Subject.Drop();

        It should_have_the_correct_creationdate = () => {
           result.CreationDate.ShouldEqual(blogEntry.CreationDate);
        }

        It should_have_the_correct_author = () => {
            result.Author.ShouldEqual(blogEntry.Author);
        }

        It should_have_the_correct_comment = () => {
            result.Comment.ShouldEqual(blogEntry.Comment);
        }
    }
}

This simple test is written with mspec. What the tests does is create a BlogPost-object with a DateTime value and 2 string values. This object is persisted inside MongoDB. Afterwards the object is retrieved and the expected data is compared to the retrieved data.
The abstract RepositorySubject is a helper which can be used for different mspec tests which are written to test different repository functionality.
The Repository class by itself is an abstract class holding the most important CRUD-operations for the usage with MongoDB. BlogRepository is inherited from Repository. Additional implementations can be added here. Inside the MongoDB class the connection to the MongoDB database is established and the commands are executed.

Running the Test

When we run the test on a machine where the current time is set to something else than UTC time the test will fail. Why will the test fail? DateTime values are stored as UTC time inside the database. When we retrieve the data from the database the DateTime value is fetched as a UTC DateTime value. Therefore we compare a local DateTime with a UTC DateTime value.

Set Serialization Options for DateTimes

What can we do to fix this problem? We can register a serialization option for the DateTime value. With this option we can specify that the value will be converted to the local DateTime when we retrieve the object from the database. The following code snippet shows how to transfer the CreationDate from UTC to the local DateTime value.


public class RegisterSerializer
{
    public void Setup()
    {
        BsonClassMap.RegisterClassMap(cm => {
            cm.AutoMap();
            cm.GetMemberMap(c => c.CreationDate).SetSerializationOptions(
                    new DateTimeSerializationOptions(DateTimeKind.Local));
        });
     }
 }

After adding this class we only need to call the method which can be done inside the RepositorySubject by adding the following 2 lines of code.


var registerSerializer = new RegisterSerializer();
registerSerializer.Setup();

Now we can run the tests again. The result should be as expected – green.





Thoughts about Replica Set configuration with MongoDB

2 03 2012

In my last post I provided you with a setup script which can be used to get a simple replica set configuration up and running. Now I want to talk about some details of the script and why I have created the script like it is.

Why should I use the option notablescan?

In my opinion this is a flag which should be set on every development environment. When you write new functionality inside your data access it can happen that you forget to update the indices on the database. This will result in bad performance on queries. Especially on applications with a lot of traffic, this will result in big performance issues.

To avoid this problem enable the notablescan option on your development environment. Every time when a query has to run over the complete table to fetch data (because of a missing index) you will receive an exception similar to the following:

image

When you set this option on your development environment the risk to deploy code to your live systems, without a correct index, is reduced to a minimum.

Priority for Replica Set nodes

While setting up a replica set, you can provide every node with a priority thru the configuration. The priority is used to rate a single node as the primary. A higher priority will result in a higher chance to be rated as primary. The priority of 0 excludes a node from becoming a primary. This is useful to exclude nodes with bad performance to be rated as primary. With version 2.0.2 of MongoDB (Windows) you can specify a priority from 0.0 to 100.0; inside the script I want to achieve that the node with the smallest port number will be the primary. The configuration for the first node starts with the priority of 100. Every node receives a priority which is decreased by 1. Therefore we make sure that the node with the smallest port number has the highest priority and will be rated as primary. For the reason the first node fail to start, the node with the second highest priority will take over.

Reinstallation of Replica Sets; but what happened to my data?

As I mentioned in my last post about the setup script we remove the old service (if some exists with the same name) and install everything new. For the reason we want to keep the data inside the database we need to do some things to achieve this.

If we used the script to install the replica set and created a database called “MyTestDb”, we should have a folder structure on the file system which should look like in the following picture.

image

Now we want to reinstall the instance with another configuration and keep all the existing data. On every node, expect the node with the smallest port number; we make sure that none of the data folders hold any data or folders. In this case the “replSet2” and the “arbiter” folder are emptied completely. We need to do this because when installing a replica set it’s not allowed to have data inside any node except form the node where you initiate the configuration.

Inside the “replSet1” folder we only need to delete the content of the local folder. The content of the “MyTestDb” folder isn’t touched. Why do we need to do this? The configuration of the replica set is stored inside the local database. If we don’t delete content of the local folder, we can’t run the initiate method; we can only use the reconfigure options. To avoid a differentiation between a new installation and a reinstall, I decided to implement the script to use a remove with a completely new initiation process.

After the new installation the replica set should come up with the new configuration. On the startup the replica set will start to sync all data from the “replSet1” folder to all other nodes. All data from the “MyTestDb” folder are synced. When the replication process is finished, you have a completely new configured replica set with the complete content from the old configuration.

I hope this information help some of you. If you have any questions about this or the setup script just let me know.

Cheers,

Daniel





Setup MongoDB as a service with Powershell

27 02 2012

I have written a small Powershell script to setup a MongoDB instance as a single node or in a replicaset configuration. I want to share the script here and hope this is useful for some of you (feedback is welcome). To run the script you need admin rights; otherwise the service can’t be created. The main purpose of the script is to get MongoDB up and running on a Windows PC for local development.

In this post I want to talk about how the script works. In a further post I will provide some information regarding the setup and configuration.

I have separated the script into 3 files. MongoDbSetup.ps1, WebClient.ps1 and Zip.ps1. The MongoDbSetup-file is the main script and responsible for the installation. WebClient and Zip are only small helpers. WebClient.ps1 is used to download a file and display a progress bar (while downloading). The file Zip.ps1 is used to unzip a zip-file to a specified destination folder (used to unpack MongoDB after download).

What the MongoDB setup script do

The following picture shows a simplified process what the script does.

image

I want to provide you with a bit more details about the script execution. The first thing we do is to setup the folder structure we expect inside the script. We have a download folder where the downloaded binaries from MongoDB are stored (zip-files). Every installed instance has his own folder in this case “MongoDB ReplicaSet”. Inside the “MongoDB ReplicaSet” directory we have 3 folders. “Bin” for storing the unzipped MongoDB binaries, “data” for the database files and “log” for all log messages.

image

The location and name where the folders get stored can be defined as a parameter while calling the script. Before we start to download the zip-file holding the MongoDB binaries we want to make sure there is no service running with the same name like the service we want to create. Therefore the script shuts down existing services to allow replacing the service thru the script. This can be handy for the reason you want to update an existing instance (for example you want to update the MongoDB version). Then the download of the zip-file with the binaries starts. The download will fetch the Windows 64-bit version of the binaries for the specified MongoDB version (tested with version 2.0.2 and 1.8.5). If the format of the filename on the MongoDB server will change you need to update the script. If you install a second node the download won’t fetch the file from the server as long you have the zip file inside the download folder (which is created thru the installation process).

The next step is to unzip and copy the executables to the bin folder for the new instance. The fact that we have a bin folder for every instance, made it possible to run different MongoDB versions on the different instances.

Now all preparation is done. We can start with the installation of the single node or the replicaset. I will describe the process of the replicaset installation because it’s much more interesting. The single node installation is a sub-part of the replicaset configuration.

For the reason we want to make changes on an existing replicaset with the script, we need to remove the existing instances with the same name. Afterwards we can setup the number of nodes. The amount of nodes is provided thru a parameter when calling the script. After the setup of the nodes another node is installed as arbiter, if you didn’t change the default configuration. Now we have all nodes installed and need to start the services.

The last step is to configure of the replicaset. We create a file which holds the configuration for all nodes. After creating the file we can run mongo.exe and provide the file as parameter to run and initiate the replicaset configuration. The replicaset needs a bit of time till it is up and running. Connect to your newly created instance and check the replicaset status by calling rs.status(). Then you are done.

As I mentioned above there are a couple of parameters you can set by calling the script to override the default values. In the following table you can find a list with these parameters.

Parameter Default Usage
version 2.0.2 Specify the version of the MongoDB binaries we want to use for the new instance.
Mode ReplicaSet Options are ReplicaSet and SingleMode. Depends on the instance you want to install.
portNumber 30000 Start the port number at the given port. On nodes for a replicaset the port is increased for every node.
numberNodes 2 Number of nodes (without arbiter)
useArbiter True Create and use an arbiter
destinationPath c:\mongodb\ Path where the installation stores the data
serviceName MongoDB ReplicaSet Name of the service which is created. When creating a replicaset a number is attached to the name.

I have uploaded the scripts on GitHub; use it on your own risk 🙂
The repository is located at: https://github.com/danielweberonline/MongoDB-Setup

Cheers,

Daniel