Zend Framework offers multiple adapters for translations. Among them is not an adapter for database translating. Here is how-to 🙂 I need to point out that there are other possibilities that offer much more flexibility than database and are designed to handle translations (one of them that is widely used and I recommend is Gettext […]
I was upgrading some old page with new CMS that supported nice and friendly URLs. I didn’t want to loose all those precious links to page content so I tried to make redirects with .htaccess. As I soon realized this is not so trivial as I thought. My old links were dynamic like “index.php?id=12”. If […]
I’ve to import 1GB MySql dump file today. It was the biggest MySql dump I’ve ever worked with and it gave me a bit of problems before I managed to imported it on my development platform. phpMyAdmin is unsuitable for this kind of tasks and other Windows GUI tools I have for dealing with MySql […]
I assume you know the difference between class and an object. If not, read this! A static method is basically the same as a non-static, but there is one difference: a static method is accessible without needing an instantiation of the class. Because you access a static element via a class and not an instance, […]
I use NLB (Nova Ljubljanska Banka) and I wanted to import data to Quicken. The problem was, that NLB only supports QIF or CVS export and Quicken only supports limited QIF import. When I looked more deeply I found out that the problem occurs because of the date format. NLB exports date as DD.MM.YYYY andQuicken […]
Zend offers different logging possibilities. I won’t present them all. The basic of logging possibilities is Zend_Log_Writer_Db which logs in database. By default there are timestamp, message, priority andpriorityName entries. If you want to log your own entry that is you want some custom fields to be logged you have to deal with event array. […]
PHP way PHP uses unix timestamps for all its date functionality. Functions to format and convert this timestamps are available. Timestamp is simply an unsigned integer – itâ€™s the number of seconds that have elapsed since midnight on January 1st 1970 (greenwich mean time). MySQL way MySQL has three date types for use in columns. […]
%inserts X to a custom position in list and returns BL
Bookies wants to take some bets and of course they want to make profit with it. All they have are latest results from friendly matches.Predicate win(Team1, Team2, Result) means that the first team won the match with the Result. Initial knowledge database
win(portugal, saudi_arabia, 3-0).
win(mexico, paraguay, 2-1).f
win(mexico, congo, 2-1).
win(argentina, portugal, 3-2).
win(mexico, gana, 1-0).
win(portugal, croatia, 2-0).
win(netherlands, ivory_coast, 3-1).
win(argentina, hungary, 2-1).
win(netherlands, ecuador, 1-0).
win(portugal, egypt, 2-0).
win(croatia, argentina, 3-2).
win(ivory_coast, slovenia, 3-0).
win(south_corea, mexico, 1-0).
win(netherlands, mexico, 2-1).
Predicate to return difference between points Write predicate gd(Team, GD) that returns […]
We plan a trip to Tokio. We have data about plane flights. For each flight we know duration of flight and distance between airports. Our data is being stored in predicates flight(StartAirport, DestinationAirport, Duration, Distance). On each airport we spent some time waiting (customs etc.) and this waiting time is different for each airport. Data […]