Tuesday, July 27, 2010

Transfagarasan Alpine Road Trip


Transfagarasan Alpine Road Trip
(July 2010)

So, after several attempts and plans to start this journey, we finally did it !
Why so ? Because, being an alpine road, Transfagarasan is opened for public only 3 months a year and many of our weekends where fulfilled with other things.

Tranfagarasan = prefix "trans" + "Fagaras" - it is probably the most spectacular road from Romania; called also "drumul din nori" ("the clouds road"), it links the historical romanian regions of Muntenia and Transilvania, over the Fagaras Mountains, Meridional Carpathians.
With a total length of 151 km and denoted as DN7C road, the Transfagarasan road starts in Bascov locality (Arges county) and ends at Cartisoara locality (Sibiu county); the total length of road curves measures 91 km.
The Transfagarasan was build between 1970 - 1974 by Ceausescu, as a strategic road over Fagaras Mountains.

Road Map of Tranfagarasan

From South to North, the first segment of Transfagarasan starts with the Vidraru Hydropower from the Cetatuia massive. The massive takes this name ("Cetatuia" = citadel), because nearest the hydropower we may see the Poenari Citadel, built between the 13-th and 15-th centuries and finalized by prince Vlad Tepes. The access to Poenari Citadel is made via 1480 stairs way.

Cetatea Poenari (Poenari Citadel)

Then, Transfagarasan climbs via serpentines and viaducts to the Vidraru Dam which at the build time was the 8-th hydroenergetical dam from Europe.
Viaduct to Vidraru Dam


Way to Vidraru Dam

Vidraru Dam - View from bottom

Located between Fruntii mountains and the Ghisu massive, the lake formed by Vidraru Dam gathers the rivers of Capra, Buda, Doamnei, Cernat and Topolog and unifies them together with Arges river.

Vidraru Lake - View from Vidraru Dam

The total flow raises to 5.5 m3/s.

Vidraru Lake and Dam

Vidraru Dam - View from Dam

 
Vidraru Dam - View to the Bottom


Vidraru Dam - For your stamp collection

The total surface is approx 900 ha with a length of 10.5 km, a maximum width of 2.2 km and a circumference of 28 km.

Electricity Symbol of Vidraru Dam

The maximum depth is 155 m, near the dam which has a height of 166 m and a length of 310 m. A stop here is mandatory.

Then the way follows the Vidraru lake to the north and passes abundant forests.

 South part view of Fagaras Mountains

 
 South part view of Fagaras Mountains

South part view of Fagaras Mountains

South part view of Fagaras Mountains
South part view of Fagaras Mountains

The road starts to climb to the Capra Waterfall, located also in the south part of Transfagarasan.


 South part view of Transfagarasan


 South part view of Transfagarasan

 South part view of Transfagarasan

Side view of Capra Waterfall

Top view of Capra Waterfall


South view to top of Fagaras Mountains
 South view to top of Fagaras Mountains

The road passes the highest peaks of Fagaras Mountains via a 887 m tunnel that links the south and north parts of Transfagarasan.

View to the tunnel that links South and North of Transfagarasan

After the tunnel, it follows the "Golul Alpin" (Alpin Hole) reservation, near the glacial lake Balea, where another stop is mandatory.

North view to top of Fagaras Mountains

Balea glacial lake

Surroundings of Balea glacial lake

Surroundings of Balea glacial lake

Near Balea glacial lake you may see here spectacular images with the north part of Transfagarasan.

Spectacular north view of Transfagarasan

After wondering on these images, the fog and cold came down to Fagaras Mountains.

Fog over Transfagarasan

Fog over Balea glacial lake

So, we made plans to follow the north side of Transfagarasan road which downs to the Balea Waterfall which has a length of 68 m at an altitude of about 1230 m.

 
North part view of Transfagarasan

 
North part view of Transfagarasan

North part view of Transfagarasan

North part view of Transfagarasan

North part view of Transfagarasan

 
North part view of Transfagarasan

Top View of Balea Waterfall 


Small waterfall at the base of Balea Waterfall

Transfagarasan ends in serpentines at Cartisoara, where it  meets the E68 road, between Brasov and Sibiu cities.

All these resulted in an unforgetable trip.

Monday, July 12, 2010

Zend Server and Zend Studio Configuration for PHP Debugging

Zend Server and Zend Studio Configuration for PHP Debugging

Disclaimer: this article should be read as is; it exposes only my study case and is intended to give you some hints.

Prerequisites:
In order to take advantages of Zend PHP technology, you will need:
- an OS: Windows 32/64 bits, Linux, MacOS; for MacOS, Zend still have some integration problems; in our case, I'll use Windows 32bit;
- Zend Server Community Edition from here: http://www.zend.com/en/products/server-ce/downloads
- Eclipse PDT All-in-one from here: http://downloads.zend.com/pdt/all-in-one/helios/zend-eclipse-php-helios-win32-x86.zip

Notice:
The above Zend versions are intended for community use, so they are somehow limited, but you may still develop good code.
Nevertheless, Zend also offers fully distributable versions:
- Zend Server, from here: http://www.zend.com/en/products/server/downloads;
- Zend Studio, from here: http://www.zend.com/en/products/studio/downloads;
We will focus next on Community Editions, namely: "Zend Server Community Edition" and "Eclipse PDT All-in-one".

Zend Server Community Edition Quick Overview:
This is an PHP Application Server and implies use of:
1. a Business layer, represented by a Database container (Oracle, MySQL, DB2, mSQL, aso) and PHP libraries to link the Database container to PHP, as described in php.ini config file;
2. a Web layer, represented by a Web Server (Apache Coyote, Microsoft IIS) to which the PHP API is exposed;
3. the Zend Debugger will make use of the Web Server in order to ensure PHP projects debug;

Notice: As a difference regarding Zend Server, the Zend Server Community Edition does not include application monitoring, diagnostics and page caching.

Eclipse PDT All-in-one Quick Overview:
It is an IDE used for developing PHP applications.
It uses IBM's Eclipse as basic IDE, on which there is applied a Zend wrapper also known as Helios, to ensure the PHP specific development operations (editor, interpreter, debugger, internal web browser, aso).
You will have the full Eclipse capabilities in editing PHP, PHP, help, debug, aso.
Application debug will make use of the Zend Debugger, so a version of Zend Server should be installed to offer the required support (in our case, we will use "Zend Server Community Edition").

General Considerations
"Zend Server and Zend Studio Configuration for PHP Debugging" is an article written for both beginners and advanced PHP users, who haven't used Zend before.
In this sense, we will have from now 2 sections, namely "PHP Zend Debugger Configuration for Begginers" and "PHP Zend Debugger Configuration for Advanced Users".
I will assume that beginners haven't installed any of these components: Web Server (Apache Coyote), MySQL 5 DB, PHP CGI environment, Zend Server Community Edition, Eclipse PDT All-in-one.
I will also assume that advanced users haven't installed Zend Server Community Edition, Eclipse PDT All-in-one, but they have installed the Web Server (Apache Coyote), MySQL 5 DB and PHP CGI environment.

Notice: As you may have seen, I refer to Apache Coyote as the Web Server used to access PHP applications. Another Web Server that may be used is the IIS (Internet Information Service) from Microsoft, but I do not recommend this approach if you intend to deploy a PHP application on a Unix/Linux based server.

Installation Notes
After you downloaded "Zend Server Community Edition" and "Eclipse PDT All-in-one", you will have to follow these steps:
1. extract the content of "Eclipse PDT All-in-one" ("zend-eclipse-php-helios-win32-x86.zip") to C:\eclipse; optionally, make a shortcut to eclipse.exe on your desktop;
2. install "Zend Server Community Edition" ("ZendServer-CE-php-5.2.13-5.0.2-Windows_x86.exe", or current Zend version);
2a. You will be asked for a Web Server - choose "apache web server" new install and look if the port on which it will be started is occupied or not; by default, Zend proposes the "80" port, but it is usually occupied; if so, then choose other port and retain it; for example, I use "http://localhost:8880" (the port is 8880);
2b. the installer will propose a port for the Zend Server, by default it is set to "10081" - be sure you retained it; so the Zend Server will rule at "http://localhost:10081";
2c. install the database support: DB2, MySQL5, aso; provide the necessary configuartion for the database support; if you already have the database support installed, then the installer will only configure it to integrate with Zend Server;
2d. open Zend Server in browser ("http://localhost:10081") and set the access password;

PHP Zend Debugger Configuration for Begginers

Debug Configuration

Notice: Be sure you read also the "Setting the Web Server Deployable Content - A Study Case" section below, after you start to configure the debug following the steps below.
The Debug Configuration is made from "Eclipse PDT All-in-one".
So, open "Eclipse PDT All-in-one" from the shortcut you created on desktop;
1. Accept the workspace offered and close the "welcome" window;
2. Choose from the menu "File" -> "New" -> "PHP Project", type a name for the project (for example "MyProject"); leave "Create new project in workspace" radio checked; check "Use project specific settings" and set the project version to "PHP 4" or "PHP 5" - the PHP version you want to use further; check also "Enable JavaScript support for this project" which will help you use JavaScript in the future; then click Finish - the project was created;
3. With "MyProject" selected in "PHP Explorer", choose from the menu "File" -> "New" -> "PHP File"; set the File Name to "myFile.php"; click Finish;
4. Open "myFile.php" and enter this text:
<?
echo("Hello World");
?>
5. Save "myFile.php", then save the project;
6. With "MyProject" selected in "PHP Explorer", choose from the menu "Window" -> "Preferences", expand the "PHP" node, and set:
6a. "PHP Executables" -> select one from the list and click "Set Default;
6b. "PHP Interpreter" = choose the "PHP Version" to the PHP version you created the project;
6c. "PHP Servers" -> Choose "Default PHP Web Server", click "Edit" and set the Server URL to "http://localhost:8880" (or the Apache Web Server port you specified in Zend Server installation); Path Mapping -> click "Add" -> Path on Server="C:\Program Files\Zend\Apache2\htdocs\MyProject", Path in Workspace="/MyProject"; click "OK";
7. from the "Run" menu -> "Debug" -> right click on "PHP Web Page" -> "New"; a Debug Configuration form will appear; choose "Server Debugger": Zend Debugger; "PHP Server": Default PHP Web Server; click on "Test Debugger"; if the answer is "Success" then you successfully configured the Zend Debugger; to debug the "myFile.php", browse for it at "File", then hit Apply -> Debug;

Setting the Web Server Deployable Content - A Study Case
The above written "Debug Configuration" represents how it should be.
In reality, using the workspace provided by "Eclipse PDT All-in-one" implies that you create the project at that workspace specified location, which is by default "C:\Documents and Settings\[windows_user]\workspace", where "[windows_user]" represents the current user logged in windows.
The web browser (usually Apache) installed by the "Zend Server Community Edition" will rule at other location, usually: "C:\Program Files\Zend\Apache2".
Also, if you chosen to configure Microsoft IIS ("Internet Information Service"), the location where server will rule is usually: "C:\Inetpub".

When you configure debug you are asked for a "Path Mapping" of the server (see "Debug Configuration", step 6c), but this path is not helping you a lot, as your project is created at "C:\Documents and Settings\[windows_user]\workspace".
At this moment you should create a server deployment location, meaning that when starting to debug or run the project, the public project files will be copied from "C:\Documents and Settings\[windows_user]\workspace" to the "Mapping Path" - "C:\Program Files\Zend\Apache2\htdocs\MyProject".

You go to "Eclipse PDT All-in-one" menu -> "Window" -> "Show View" -> "Other" -> "Server" -> "Servers" and click OK. A new view "Server" will be opened below. On this view you notice there is no server, so you right click -> New -> Server and try to set the Apache Web Server installed by "Zend Server Community Edition" at location "C:\Program Files\Zend\Apache2". In case you cannot set this Server, as it happened to me, then you a big problem.
To avoid this problem, you actually will have to create your project at the web server projects container location, which is:
- for Apache: "C:\Program Files\Zend\Apache2\htdocs";
- for IIS: "C:\Inetpub\wwwroot";

Using Windows Explorer or other File Browser you go to "C:\Documents and Settings\[windows_user]\workspace" and delete the "MyProject" folder, as the project is not useful for debug from that location.
Then go to "C:\Program Files\Zend\Apache2\htdocs" and create there a new folder, namely "MyProject".
Now, I'll modify a little the "Debug Configuration" section.
Open "Eclipse PDT All-in-one" from the shortcut you created on desktop.
1. Accept the workspace offered and close the "welcome" window;
2. Choose from the menu "File" -> "New" -> "PHP Project", type "MyProject" as the name for the project; check "Create project at existing location" and browse for the project you creted with Windows Explorer ("C:\Program Files\Zend\Apache2\htdocs\MyProject"); check "Use project specific settings" and set the project version to "PHP 4" or "PHP 5" - the PHP version you want to use further; check also "Enable JavaScript support for this project" which will help you use JavaScript in the future; then click Finish - the project was created;

Next you follow the rest of the steps at "Debug Configuration" section.
You will see that debug will really work.


PHP Zend Debugger Configuration for Advanced Users
It is supposed that the PHP developer will have installed the Web Server (Apache Coyote), MySQL 5 DB and PHP CGI environment, where there is also set a PHP project on a given and required configuration.
The PHP developer however wants to install the "Zend Server Community Edition" and "Eclipse PDT All-in-one", but he also wants to use the existing Apache Web Server and PHP environment.
For example, I have already installed an Apache Coyote version 2.2.2 web server and in its "\conf\httpd.conf" I have a section where I configured the PHP like this:
<<
# PHP 5:
#LoadModule php5_module "c:/php5/php5apache2_2.dll"
#AddType application/x-httpd-php .php

# PHP 4:
LoadModule php4_module "c:/php/php4apache2_2.dll"
AddType application/x-httpd-php .php

# configure the path to php.ini PHP 5
#PHPIniDir "C:/php5"

# configure the path to php.ini PHP 4
PHPIniDir "C:/php"
>>
This section tells Apache that it will use PHP4 and the "php.ini" (PHP configuration file) from a given location where I installed my PHP 4.
So, I want to use my configuration, but with the Zend capabilities.

In this case you should follow the steps described at "Installation Notes" to install the "Zend Server Community Edition" and "Eclipse PDT All-in-one".

Notice: after installation, you will practically have now 2 Apache Web Servers: the one installed before by you and the one installed by "Zend Server Community Edition".

It is important for you to know how these web servers are started. The new installed Apache is started as Windows Service, so you will have to stop it and use your own. Go to "Start" -> "Settings" -> "Control Panel" -> "Administrative Tools" and stop the new installed Apache Server (the service will appear as "Apache2.2-Zend"); right click the service -> properties -> choose "startup type" as "Manual" and click "stop" then "OK".

For example, my Apache is located at "C:\Program Files\Apache Software Foundation\Apache2.2", while the one installed by Zend is located at "C:\Program Files\Zend\Apache2".
I will refer to your own Apache path as "C:\[your_apache_path]".

Now, you'll have to configure your own Apache to be used by "Zend Server Community Edition".
1. You stop for the moment your own Apache server ("C:\[your_apache_path]") while you configure it.
2. You go with Windows Explorer to "C:\Program Files\Zend\Apache2\conf", copy "zend.conf" from there and paste it into "C:\[your_apache_path]\conf".
Then you open the "C:\[your_apache_path]\conf\httpd.conf" and do the next:
2a. uncomment the line "LoadModule rewrite_module modules/mod_rewrite.so" (delete "#" from the beginning of line), as this module is used by zend.conf;
2b. add the line "Include conf/zend.conf" at the end of "C:\[your_apache_path]\conf\httpd.conf";
3. start your Apache Server; it should not give any starting errors;

Next you may follow the "Debug Configuration" and "Setting the Web Server Deployable Content - A Study Case" sections, with a difference.
Instead:
<<
6. With "MyProject" selected in "PHP Explorer", choose from the menu "Window" -> "Preferences", expand the "PHP" node, and set:
6a. "PHP Executables" -> select one from the list and click "Set Default;
6b. "PHP Interpreter" = choose the "PHP Version" to the PHP version you created the project;
6c. "PHP Servers" -> Choose "Default PHP Web Server", click "Edit" and set the Server URL to "http://localhost:8880" (or the Apache Web Server port you specified in Zend Server installation); Path Mapping -> click "Add" -> Path on Server="C:\Program Files\Zend\Apache2\htdocs\MyProject", Path in Workspace="/MyProject"; click "OK";
7. from the "Run" menu -> "Debug" -> right click on "PHP Web Page" -> "New"; a Debug Configuration form will appear; choose "Server Debugger": Zend Debugger; "PHP Server": Default PHP Web Server; click on "Test Debugger"; if the answer is "Success" then you successfully configured the Zend Debugger; to debug the "myFile.php", browse for it at "File", then hit Apply -> Debug;
>>
you do this:
<<
6. With "MyProject" selected in "PHP Explorer", choose from the menu "Window" -> "Preferences", expand the "PHP" node, and set:
6a. "PHP Executables" -> add -> name="aphp4", executable path = "C:\PHP\php.exe", PHP ini file = "C:\WINDOWS\php.ini", SAPI=CGI, PHP Debugger = Zend Debugger;
6b. "PHP Interpreter" = choose the "PHP Version" to the PHP version you have it configured in "C:\[your_apache_path]\conf\httpd.conf";
6c. "PHP Servers" -> new -> SERVER Name="my_apache", SERVER URL="http://localhost:[port]" (instead of "[port]" you put exactly the port as you have configured in "C:\[your_apache_path]\conf\httpd.conf"), for example, I have SERVER URL="http://localhost:8001", Path Mapping -> Add -> Path on Server="C:\[your_apache_path]\htdocs\MyProject", Path in Workspace="/MyProject";
7. from the "Run" menu -> "Debug" -> right click on "PHP Web Page" -> "New"; a Debug Configuration form will appear; choose "Server Debugger": Zend Debugger; "PHP Server": my_apache; click on "Test Debugger"; if the answer is "Success" then you successfully configured the Zend Debugger; to debug the "myFile.php", browse for it at "File", then hit Apply -> Debug;
>>

That should be all.
If any questions, write here, I will try to answer'em in time.