In our job, everyday we learn something new, but sometimes the things you havent learned yet are the most interesting.
Ive been working with MySQL for many years. Recently i had to go to a customer and implement a MSSQL setup, working with views.
Today (after years, how silly), i started to wonder if i can make views in MySQL.
And it appears…. You can!
Check the MySQL Reference to see how you can do it!
I feel silly for not knowing this since 5.0 came out!!!
There are situations where you want to lowercase all files and directories due to normalisation!
Bash provides powerful tools to be able to do that, but can cause quite a pain to get it working.
I hope this script saves everybody some time…
Features:
- Performance in mind, only find stuff that actually has uppercase data
- From depth back to the highest level
- If target doesnt exist, move it
- If target does exists and its a directory, copy all files recursively into the target, then remove the old uppercase dir
- If target does exists and its a file, still move it
Here you see a example on how to do it:
#!/bin/bash
## Get all files and directory from depth back to top
## If its a file, move to new location
## If its a directory and it doesnt exist, also move
## If the directory exists, copy contents and remove old
find afbeeldingen -depth -regextype posix-extended -regex '.*[A-Z].*' | while read item
do
LCTARGET=`dirname "$item"`/`basename "$item" | tr '[A-Z]' '[a-z]'`
if [ "$item" != "$LCTARGET" ]
then
if [ ! -e "$LCTARGET" ]
then
echo "MOVING: $item - TO: $LCTARGET"
mv -f "$item" "$LCTARGET"
else
if [ -d "$LCTARGET" ]
then
echo "COPYING DIR: $item - INTO: $LCTARGET"
cp -R "$item"/* "$LCTARGET"/
echo "REMOVING OLD DIR: $item"
rm -rf "$item"
else
echo "TARGET FILE EXISTS: $LCTARGET - OVERWRITING WITH $item"
mv -f "$item" "$LCTARGET"
fi
fi
fi
done
Unit testing in combination with PHPUnit and modular based MVC applications can be hard to understand.
You will find a usefull example made by Akrabat, it uses PHPUnit together with Zend Framework:
http://akrabat.com/zend-framework/unit-testing-controller-actions-with-zend_test_phpunit_controllertestcase/
Akrabat is the author of the book “Zend Framework in Action”.
Neat!
If you want to integrate google translate into a Zend Framework project, heres how you do it:
Author: Michal “Techi” Vrchota
Zend Translations: Google