Blog of Alexander Mamchenkov … mammoth cave …


CakePHP related

03.08.2011 · Posted in General, Technology

It’s been ages to post here (as usual), so I just thought of putting couple of things about CakePHP and stuff related.

First of all, if you are developing under windows, and the production server is running Linux, keep in mind that Linux file system is case-sensitive. So if you create an image linked to logo.jpg, while the file will be logo.JPG – it won’t work. CakePHP tries to locate file on filesystem and it will look only for logo.jpg and fail in case you put logo.JPG.

Second, if you need to have direct access to MySQL to run some queries using native PHP mysql_query methods, but you don’t want to specify DB settings twice, you can always extract current connection from CakePHP models as follows (assuming you are using some model called ‘User’ and it is available in the current class):

$dataSource = $this->User->getDataSource();
$db = $dataSource->connection;
$result = mysql_query("SELECT .... WHERE .... LIMIT 10,20",$db);

I use this when I need to work with huge tables to run some CakePHP shell scripts faster :)

jQuery datepicker, tabs, AJAX

10.12.2010 · Posted in Personal, Technology

The whole bloody day fighting with jQuery datepicker. Still no luck, so maybe you have something to tell. The setup is as follows:

- jQuery tabs with content being loaded via AJAX calls

- Inside tabs content there are forms with jQuery datepicker

The problem is that datepicker doesn’t work correctly. There are two possible results (except for those where everything is broken completely):

- Datepicker is displayed and popup is shown, but when selecting a date – it is not inserted in the input field (though it is send correctly when form is submitted)

- Datepicker is displayed and everything works (even when selecting a date it is correctly inserted into field), but after switching between tabs for 2-3 times, datepicker is disappearing from some fields and stays enabled on others.

I tried everything I could find. Working with jQuery live, jQuery livequery, setTimeouts (for proper delay on DOM updates). Tried accessing through classes and through IDs, tried generating random IDs just in case there is a collision or something else. Nothing works :(

Pissed off, experimenting further, but looks like I am running out of possibilities…

Custom RSS feeds

09.08.2010 · Posted in Site News, Technology

As per Tiamat‘s complain about Twitter updates on my blog creating mess in his google reader (or whatever he is using), here is a URL to RSS, where those posts are filtered away (by Yahoo!Pipes). Original pipe is here: http://pipes.yahoo.com/pipes/pipe.info?_id=5e7808dfc84475b6b4fc83df775e35bd

In addition, there is a russian category in my blog which is not shown on front page, nor it is included in default feed. You can always see posts here and RSS here. Alternatively, you can see all those posts on my LiveJournal account (and use LiveJournal RSS).