Monday, November 5, 2012

Sunset Software OS

After of making videos related with Linux, I decided that it is time to create a distro Linux which contains some software used on videos. I found a amazing site that allows to create own distro Linux.

I will not make tutorial how to create own distro!

The distro Linux created with help from SUSE Studio calls Sunset Software OS. This OS is destined for developer software, web developer software and systems administator. You can download a image ISO right here! Language and Keyboard Layout will be ask at first boot.

    There is two users:
  1. root (password: linux)
  2. user (password: peter)

Enjoy!

Wednesday, October 17, 2012

How to change timezone on Apache Webserver

My Apache Webserver had not timezone correct. If I wanted timezone correct, I had to do some configuration on Apache Webserver. But how to do this?

To change timezone on my Apache Webserver, I followed the next steps:
  1. Type sudo nano /etc/php5/apache2/php.ini;
  2. Search for "date.timezone" and modify to "date.timezone="Europe/London" or to your timezone;
  3. Save the file and exit using CTRL+X;
  4. Type sudo /etc/init.d/apache2 restart

To see what is your timezone, check this website

At the moment, my operating system was Ubuntu 11.10 and Apache Webserver was 2.2.20!

Tuesday, September 25, 2012

MySQL Tutorial - How to calculate time correctly

A database server has a database called "Cinema" which has a table called "Movies". This table has next fields:

  • ID
  • Name
  • Duration

Hereafter, you can see table 'movies':

movies_id movies_name movies_duration
1 Movie I 02:23:34
2 Movie II 01:44:56
3 Movie III 02:56:34

To calculate duration of all movies, we could write:

SELECT sum(movies_duration) FROM movies;

But it is wrong!

Result:

sum(movies_duration)
62424

To fix this problem, it is necessary convert time to seconds with next SQL statement:

SELECT time_to_sec(movies_duration) FROM movies;

Result:

time_to_sec(movies_duration)
8614
6296
10594

And next, use function SUM() to calculate duration of all movies

SELECT sum(time_to_sec(movies_duration)) FROM movies;

Result:

sum(time_to_sec(movies_duration))
25504

Finally, convert the sum (in seconds) to time using the next statement:

SELECT sec_to_time(sum(time_to_sec(movies_duration))) FROM movies;

Result:

sec_to_time(sum(time_to_sec(movies_duration)))
07:05:04

Thus you can calculate time correctly using three MySQL functions:

  1. TIME_TO_SEC(...)
  2. SUM(...)
  3. SEC_TO_TIME(...)

Saturday, September 1, 2012

JavaScript Tutorial - How to print a Web Page

I was working on my project called "Project Manager". And I was needing to create a link to print a web page. After I was researching on Web, I found a small code written in JavaScript.

<a href="javascript.window.print()">Print</a>

Clicking on link, it will show up a box dialog of printer.