Generate random birth date in MySQL table and get Age by select

Today I was solving generating of random data for testing and manipulation with the date of the birth.

Here are two simple SQL queries solving both:

Query for generate random date of birth in whole table

UPDATE

people

SET

date_of_birth=CONCAT_WS('-',(FLOOR( 1900 + RAND( ) *100)),(FLOOR( 1 + RAND( ) *12 )),(FLOOR( 1 + RAND( ) *28 )))

Query for selecting date of birth and calculation of age in MySQL:

SELECT
date_of_birth,
DATE_FORMAT(NOW(), '%Y') - DATE_FORMAT(date_of_birth, '%Y') - (DATE_FORMAT(NOW(), '00-%m-%d') < DATE_FORMAT(date_of_birth, '00-%m-%d')) AS age
FROM people

Posted in MySQL, PHP & MySQL | Leave a comment

Cisco VPN on Windows 7 64bit

I just got to project, which is hosted on server, where the developers has to connect via Cisco VPN to upload stuff or access SSH. Problem is, that Cisco is unable to create client, which would run with no troubles on Windows 7 64bit!!! Solution is quiet simple: Continue reading

Posted in General, Windows | 8 Comments

Joomla: get category ID in template

I just needed to specify special layout for the articles of selected categories. I was looking for some solution online, but none of them worked. Mostly you can find this:

JRequest::getInt('catid');

or

JRequest::getInt('catid', '', 'get');

Continue reading

Posted in Joomla | Tagged , , , , , | 4 Comments

Magento: Changing Tax class on all products

I was just asked to update tax classes on products in the catalogue. I found a easy and fast solution. Continue reading

Posted in Magento | Tagged , , , , , , , | Leave a comment

SOLVED: Magento keeps logging out from administration

I just spent couple of hours by finding out, why is my Magento administration logging me out after moving my Magento store to new server. I found many hacks, modification and setup tips on the Google, but anything helped to me. Continue reading

Posted in Magento | Tagged , , , , , , , , | 22 Comments

SOLVED: Firefox – list of opened tabs with thumbnails?

Previously I wrote about a hidden feature of Firefox, which I accidentally found while browsing some specific  web-pages (more here).

Today I found a solution how to enable this feature for any case. It is so simple :) Continue reading

Posted in Firefox, General | Tagged , , , | Leave a comment

Google Maps API & PHP+MySQL – working with radius and distance

I needed to find out how to work with Google Geo API in my last project and especially with calculating a radius and distance between two geo points. Another goal was to get a latitude and longtitude from the address typed in the register form (in the background). Finally it was quiet easy. Here is the solution: Continue reading

Posted in Google, PHP & MySQL, Tutorials & guides | Tagged , , , | 1 Comment

Hidden Firefox feature – list of opened tabs with thumbnails?

Today I accidentaly found, that firefox has probably hidden feature. I was always wondering for some feature in the Firefox, which would work similar like Switcher for Windows Aero enabled systems. I mean feature which will offer You list of opened tabs, and You can easily choose one of Your interest via thumbanil or via some letters typed in searchbox. Continue reading

Posted in Firefox, General, Windows | Tagged , , | 1 Comment

I am running on my own server!

Yes, it is true now, all my websites are running on my own server now. I was planning this step for a while already, but there were some troubles all the time.  Finally 2 weeks ago happened something what really forced me to make this step finally! Continue reading

Posted in General | Leave a comment

MySQL visual database design

I was looking for some nice freeware visual mysql database designer couple of weeks ago. I found two of them: DBDesigner 4 and MySQL Workbench. I must say, that both programs are really very similar, I mean from the view of the UI and menus structure. I gave a little user testing to both of them and designing database using these tools is very easy and fast… Continue reading

Posted in PHP & MySQL | Tagged , , | Leave a comment