Small steps through software development

On my way to Slovakia

Hi there!

For the next month I will be in  Komarno, Slovakia with this CEEPUS scholarship and I want to write some impressions about it.

First, if you want to travel from Romania to Slovakia the cheapest way is by train. I took the train from Cluj Napoca and went to Budapest (7h), there I change it for Komarom (which is stil in Hungary), that will take another hour and a half.  Once you are in Komarom you just have to cross the bridge (the border) and you get yourself in Slovakia. The price of the ticket from Cluj to Komarno (one way) is around 35 eur.

For now is all what I can say because only yesterday I’ve arrived… so I am on my way to visit the town in order to say more about my experience in Slovakia.

Did you get one of the following errors when trying to start Apache from XAMPP control or using apache_start.bat?

(OS 10048)Only one usage of each socket address (protocol/network address/port) is normally permitted.  : make_sock: could not bind to address 0.0.0.0:443 no listening sockets available, shutting down
Unable to open logs

or

Only one usage of each socket address (protocol/network address/port) is normally permitted.  : make_sock: could not bind to address 0.0.0.0:80 no listening sockets available, shutting down
Unable to open logs

There are several ways to fix this. One option would be to change IIS port bindings, which I will cover in a future post.

Another option is to change the httpd.conf, under: <xampp_install_dir>\apache\conf. Look for a line that says Listen: 80. Replace 80 with any other available port (e.g. 8080).

Then, you may still get the complaint about port 443. If you look through the httpd.conf,  you won’t be able to find 443. But, you will find the following:

# Secure (SSL/TLS) connections
Include “conf/extra/httpd-ssl.conf”

Look in the httpd-ssl.conf file, and replace 443 with some other port.

Enjoy!

 

In this post I will show how to connect to a MySQL database from a PHP script.

Create a config.php file, where you will have the connection settings, with the content below:

<?php

          $dbhost = ‘localhost’;  // or name of your MySQL server
          $dbuser = ‘yourUser’; // default may be admin
          $dbpass = ‘yourPassword’;
          $dbname = ‘someDbYouWantToConnectTo’;

?>

Then, in the file you want to retrieve data or perform operations with your database (insert, update, delete),  include config.php

<?php

         include ‘config.php’;

         $conn = mysql_connect($dbhost, $dbuser, $dbpass) or die
                          (“Error connecting mysql”);
         mysql_select_db($dbname);

         $param1 = ‘some value’;

         $query  = “SELECT * FROM SomeTable  WHERE columnValue=’$param1′”;

         $result = mysql_query($query);

         if (!$result)
         {
                  die(‘Invalid query: ‘ . mysql_error());
         }

         // … do some more processing with the results.
?>

And, that should be it. Enjoy!

Get XAMPP from http://www.apachefriends.org/en/xampp-windows.html.

If you have also IIS 7 installed, you may have to configure it to run on some other port. To do so, please open IIS Manager, select the Default website, or what website you have running on port 80. Then, go to Bindings, and change the http port.

Restart xampp, and go to xampp control panel, to start apache as a service.

When you navigate to Tomcat examples, it may happen that you get error 503.

This is because Tomcat is not started. Open command prompt and go to <xampp_folder>\tomcat\bin and run startup.bat. It will complain about JAVA_HOME and JRE_HOME environment variables.

Go to start menu, right click on Computer, and choose Properties. Then, Advanced System Settings, and click on Environment variables.

Add JRE_HOME and path to be the location where you installed JRE, for example: <program_files_folder>\Java\jre<version>.

Don’t put bin folder path. It will look for bin/java.exe relative to JRE_HOME.

Also, don’t use catalina_start.bat

Enjoy using tomcat samples!

 

 

Orice ajutor e bine venit, motiv pentru care, daca planificati achizitia unui telefon, laptop, desktop sau alte electronice si electrocasnice, va recomand sa aruncati o privire si pe eMAG – Furnizorul solutiilor complete!.

Multumesc anticipat!

Ca in mai toate tutorialele / cartile despre limbaje de programare, voi incepe si eu cu Hello World. E primul post, e de acomodare, toate trebuie sa aiba un inceput simplu.