03 Apr 2010Webkit browsers (Safari and Chrome) have the -webkit-box-shadow
property defined to add shadows to elements. Shadow can either be outside the box, or inside it (using the inset parameter).
Unfortunatly, only the latest Webkit nightlies have the inset
parameter functionnal, Safari 4 does not.
Chrome does indeed have the inset parameter, but it also have a bug when used in conjunction with the -webkit-border-radius
property : the inset shadow is visible "behind" the element where the borders are rounded.
This bug does not occur on Mac, but as I have no way to target a certain OS when writing CSS rules, I decided to remove inset box-shadow
for webkit browsers on my actual projects, I may re-insert them later when both issues will be fixed.
02 Apr 2010Cake has a lot of wonderful tools in its console. One of them is the i18n extract
task that reads every file of your app, and extract strings that should be translated (used with __()
, __d()
, etc).
With cake 1.3 RC3 it even stored each domain string in its own .pot
file.
But, as far as I know (I've posted on the google group about that, maybe someone will show me where I'm wrong), the console task is limited when dealing with plugins.
Let's say I have a plugin in my app. I'm using __d('plugin_name', 'My plugin string')
in my plugin and __('My app string')
in the main app.
If I run the cake i18n extract
in my plugin directory, it will correctly generate the .pot
file in my plugin locale/
folder.
But if I run it in the main app, it will scan every plugin file and thus finding any plugin string and save them in the default.pot
or in its own plugin_name.pot
file (depending on the value of the merge option).
I don't need the plugin_name.pot
files in app/locale
, I already have them in app/plugins/plugin_name/locale
. I know it's no big deal, I just have to delete the useless files created every time I run the cake i18n extract
on the main app but it is kind of irritating.
So I updated the cake/console/libs/tasks
to add a new option to the task, named 'plugins
' (value : yes/no. Default to no).
If set to no, the extract task will skip every plugin directory when extracting files. This way, I have no more clutter, it only extract string that are in the app.
All I had to do was updating the execute()
method, and replacing the end of the method (from line 152) with this one :
$this->params['plugins'] = isset($this->params['plugins']) ? $this->params['plugins'] : 'no';
if (empty($this->__files)) {
if ($this->params['plugins']=='yes') {
$this->__searchFiles();
} else {
$this->__searchFilesExcludePlugins();
}
}
And then add this method to the class :
function __searchFilesExcludePlugins() {
foreach ($this->__paths as $path) {
$Folder = new Folder($path);
$filelist = $Folder->tree($path);
foreach($filelist[1] as &$file) {
// We discard plugins
if (strpos(str_replace($path, '', $file), DS.'plugins')===0) continue;
// We keep those that match the pattern
if (!preg_match('/^.*\.(php|ctp|thtml|inc|tpl)$/i', $file)) continue;
$this->__files[]= $file;
}
}
}
31 Mar 2010Wordpress made available a nice tool to generate fairly complicated strings, perfectly usable as salt value for all your password hashing process.
As I'm often heading to this page to generate new ones on new projects I thougt I may share the link with you :
https://api.wordpress.org/secret-key/1.1/bbpress/
29 Mar 2010I'm in the process of automating the backup of all the mysql databases of my clients' website. We never know what can happen, so having a backup of all this data is really really important.
MySQL data contains all the data added by the user, it means that unless you make regular backup of this data, you can't regenerate it.
I have multiple clients, with several websites each and an equivalent number of databases. I wanted to store a backup of all those on my local drive, to prevent any server crash problem.
I wanted a daily backup, and as my working station is on Windows XP I tried to find a simple software to do just that.
There is a little tool called mysqldump on linux that does just that : saving an entire database in a single file. Joined with some cron job and rotating the files it shouldn't be hard to implement.
But finding a software to do that on Windows is just terrible. I've been searching for them for more that 2 hours now and everything I find is horrible.
At first I found AutoBackup for Mysql but the software is written in something that even myself can't call English (and I know that my prose is not exactly Shakespeare). I had to click on some options to guess what it was supposed to do... I guess after some practice and once the tasks are scheduled it doesn't matter anymore but the trial version can't save more that 50 records per table and the price of the full version (~100$) is by far too expensive.
By continuing my quest, I ended up downloading this same software under different names.
Then I found DumpTimer and its brownish interface. It is also a great example of ergonomic errors : window too small forcing to scroll to reveal the options, nonsense message boxes popping, large amount of typo errors, limited choice of options.
But it does the job, in a very basic form, but it does it right. I could save my list of servers, check which databases and tables to save (well, all of them) and choose where to save them. There also was an option to copy them to another database, but I didn't tried that.
One of the main caveats was that it could only save the most recent backup, there was no way to save, say, the last 30 days.
25 Mar 2010It seems that Viddler changed something on their video API in the middle of January, and it broke utf8
support.
All the videos I've uploaded to their service from October 2009 until January 10th 2010 are working correctly.
But for every video uploaded after that (in fact, from January 24th as far as I can tell), the description text gets corrupted. All the special characters (like é or €) gets replaced by their un-encoded counterparts (like é).
It happens either when using their API from a distant server or using their homemade simple uploader.
Even "worse", when retrieving the video details from their API the description field gets "htmlspecialchared" and I end up dealing with é
Anyway, I send them an email about that. I've had to contact Viddler support in the past and they are quite responsive, so I'm sure they will correct this in no time, seing how trivial it is (in fact, the title field is not affected by this bug).
Update 29th March : Viddler support filed a ticket for the issue.