I do admit, yes, am rocking with MongoDB
The simple adapter:
https://github.com/xqpmjh/Trickle/blob/master/include/class.MongoAdapter.php
But also, find a bug : https://bugs.php.net/bug.php?id=60508
To be continue…
I do admit, yes, am rocking with MongoDB
The simple adapter:
https://github.com/xqpmjh/Trickle/blob/master/include/class.MongoAdapter.php
But also, find a bug : https://bugs.php.net/bug.php?id=60508
To be continue…
When using SVN in team coding, we need the unified end of file descriptor for all the repository files. Usually it’s LF(line-feed) which is the end of line char under linux.
SVN has supportted this feature as svn:eof-style option, making all as easy as below.
(1) Config file:
For Win (usually):
C:\Documents and Settings\Administrator\Application Data\Subversion\config :
For Linux (usually):
~/.subversion/config
(2) Add option list:
Sometimes, some person, somethings, you feel dispointed, feel down… anything can frighten or block me as a protector?
It’s the string cutting helper which deal with both UTF8 and others encodings. Also it remove html tags by default.
To create a cron job script in Zend Framework, we just need 3 steps :
1. Create a new directory called “scripts” which is the storage of all the scripts(.sh, .php, etc.).
2. Copy public/index.php into “scripts” and rename it to your cron job name, for example “cron.php”.
3. Modify the code. Instead running the application, we now only do the bootstrap:
“ZFDebug is a plugin for the Zend Framework for PHP5, providing useful debug information displayed in a small bar at the bottom of every page.”
We just need two steps to setup ZFDebug:
1. Download it from https://github.com/jokkedk/ZFDebug, place it inside library just next to Zend Framework
2. Modify application/Bootstrap.php to add initialized function:
And that’s all, now you should see a debug bar just at the bottom of your project like this:
When we try to generate the project by Zend_Tool by command line like this:
We get a standard structure which is recommended by Zend Framework:
It works very fine as “one” website project. But how about if we want to create multiple websites without rewriting too many code?
The main idea is to share as much as possible the libraries meanwhile keeping independence of each website, especially the designs/templates/publics.
Here is one simple way which makes the minimal modifications and satisfy our needs:
(1) Move the folder “library” out of the project.
(2) Modify /public/index.php as below to make sure the library/ is in include paths:
(3) Modify /application/config/application.ini :
Assume that we have project1, project2 and project3, all applied the same treatment. And finally the websites could like this:
In the picture above, assume that our global namespace is “Projlib”. We have a model class Projlib/Model/Foo.php
Then we can just put this configuration inside application/configs/application.ini to make it autoloaded:
And that’s all! Enjoy it.
Sometimes we need the string to only contain unaccented characters, for example urls, xml, filename etc.
Expecially before PHP6, You may think of function setlocale() and iconv(), but they are evil…
If you’re writing code for yourself, to be used on a server you control, locales could be made to work if your server has locales installed which support UTF-8. That would mean functions like strtolower behave correctly.
But this is no use if you’re writing applications which will be installed by third parties (like these for example) because it’s system specific (it’s not even just OS specific). If the default system locale does not support UTF-8, in theory your application could change the locale “on the fly” using setlocale but in practice that requires two things; that there is a locale available on the system which supports UTF-8 (not guaranteed) and that the correct locale identifier string can be found (there a definately differences between Windows and *Nix locale identifiers and even amongst the Unixes believe there are variations e.g. FreeBSD). What’s more, you can’t rely on users to be able to change the locale correctly to suit your applications needs – on a shared host they probably won’t be able to change the locale for the user that Apache is running with. Bottom line - locales are not the way to go for applications intended to be “write once, run anywhere”.
– http://www.phpwact.org/php/i18n/utf-8
Here is just the function to replace accented characters by normal english letters.
It contain a long list of characters matching table and use strstr() to replace accents.
It’s the htaccess configurations for multiple websites in sharehost. Cause sometimes you may not be able to modify apache vhosts.
Then for a user login url :