In order to generate Captcha with Zend Framework the php needs to be compiled with the option freetype. But the php shiped by snow leopard is compiled without this option. To solve this problem I have to compile the PHP myself. But there is always problem when PHP is compiled with the option iconv. After [...]
Archives for programming languages
all about programming language
Enable dojo for a zend project
To enable dojo in your zend framework project is quit easy by using application resource. What you need to do is just add the following code into your application.ini resources.layout.layoutPath = APPLICATION_PATH “/layouts/scripts” resources.layout.layout = “layout” resources.dojo.enable = true resources.dojo.djConfig.parseOnLoad = 1 resources.dojo.localPath= “/js/dojo/dojo.js” resources.dojo.registerdojostylesheet = true resources.dojo.requireModule[] = “dojo.io.script” resources.view.encoding = “UTF-8″ resources.view.basePath = [...]
TDD improves your code design
What makes Unit Test so difficult the revolution from global variable to singleton to registry to dependency injection. “One of the hallmarks of testability is a loose coupling of classes, allowing you to isolate a single class and test it completely” —- http://code.google.com/p/google-singleton-detector/wiki/WhySingletonsAreControversial * unit test could prevent writing code with too many dependencies, in [...]
Netbeans 折叠代码
最近在修改公司老早之前的代码,里面的function大多长达一百多行,看起来超级痛苦。如果可以吧方法里的一些部分折叠起来会看的清楚些。netbeans 默认是可以折叠(folding) function的,如果需要自定义的折叠一部分代码可以在代码里写入下面的标签 //<editor-fold desc=” read report info from database”> … 这里是需要折叠隐藏的代码 //</editor-fold> 如此,就可以把当前不需要特别注意的代码折叠起来了。
zend framework中的Request 对象 的
Request是zend framework中很重要的一个对象。 getParam 可以取得客户传来的参数,取数据的顺序为 1. GET 2. POST 3. COOKIE 4. SERVER 5. ENV
exception in zend_db_table
I just met the following exception, when i was trying to implement a model: Message: SQLSTATE[HY093]: Invalid parameter number: no parameters were bound It is because the refcolumns doesn’t exists ( i made this by a typo) , see the following code: protected $_referenceMap = array ( ‘Institute’ => array( ‘columns’ => array(“exchange_institution_id”), ‘refTableClass’ => [...]
命令行查看PHP的参数
phpinfo()是个经常用来查看php配置的命令。每次查看都要创建一个PHP的文件,再在里面呼叫这个方法。 今天发现了一个PHP的命令行参数 -i ,通过输入这个参数就可以在命令行里看当前的php的配置了。 在命令行里输入: php -i |less 看看你的php的参数是什么
Linux 下 Java GUI程序乱码
ThinkRock 之类的程序,在linux下会出现中文显示不出来的问题(显示的都是小方块)。解决的办法是给jre添加字体。方法是: 在 jre/lib/fonts/ 下建立一个fallback的目录,再把中文字体拷贝到这个目录里。再此打开你的java程序,中文就可以显示出来了。fallback的意思,估计是找不到合适的字体就用在fallback里的
using php interactive shell
php has a interactive shell. Just input php -a in your shell. $ php -a Interactive shell php > $a=array(“name”=>”ting”); php > $a[]=3; php > print_r($a); Array ( [name] => ting [0] => 3 ) php > Another way to try your script is using: php -f yourPHP.php $name = “ting”; if($name == “ting){ print [...]
在fpdf中输入欧元的符号 €
用eclipse编辑的时候,文档的编码是utf8的,可以输入€。但是pdf输出确是乱码。 解决的方法是: define(‘EURO’, chr(128)); $ust = $summer * 0.19.EURO;