2014年1月22日 星期三

Centos 6.X upgrade php 5.3 to 5.5

Please read
http://www.aliencoders.com/content/how-fix-rpmfusion-nonfree-repo-error-centos-64

then
http://www.webtatic.com/packages/php55/


2014年1月6日 星期一

搵HK Freelance

話時話, 香港要搵IT Freelance programmer, 要求都一d都唔低. 冇返門强項真係未必搵到. 搵到都未必夠有肉食. 以我所知JAVA/ASPX/Object C 需求好大, PHP 都唔少, 當然還需要配合(backend) database (e.g. mysql, sql server, nosql ...), 以及frontend 即html5, javascript, css.

其實有些很穏陣又快又强的framework 可以用的. 我最愛用PHP, framework 包括Yii, codeigniter(deprecated). javascript 可以用jquery, zapto, 介面可以用twitter bootstrap.

現時手機 app 好流行, mobile development framework 都好多. 如果只係web developer 又唔係太識Java / iOS, 或者唔想學太難既language, 可以試一試用 intel app frameworkCordova (phonegap).

不過搵freelance programmer, 真係一d 都唔易. 最怕就係收左錢走左去. 不過我相信香港人唔係咁差的!!!

咁點會月以上的問題或project 爛尾? 其實有好多可能既...
1. 俾job 你果位咩都唔識, 成日話要加野或改, 又唔加錢
2. 佢低估了這project 的複雜性, 出錢太低, 時間太短
3. 你高估了這project 的複雜性, 唔夠時間做
4. 你 d 程式未test 過, (唔係就咁試一試果種), 點知有bug, 客係咁狂打給你, 你唔彩佢.


如果係programmer 的技術問題, 有咩好方法呢?
針對第4點, 你可以用TDD (Test-Driven Development).
有機會再談~

2014年1月4日 星期六

Yii remove the index.php

1. create a file .htaccess and put it in your project root folder
.htaccess
-------------------------------------------------
RewriteEngine On
RewriteBase /project123                    //change this to your folder e.g. localhost/project123
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)\?*$ index.php/$1 [L,QSA]

config/main.php

//urlManager rules
'urlManager'=>array(
'urlFormat'=>'path',
'showScriptName'=>false,
'caseSensitive'=>false,
'rules'=>array( // customize rules for your application
//'<controller:\w+>/<id:\d+>'=>'<controller>/view',    // comment this
//'<controller:\w+>/<action:\w+>/<id:\d+>'=>'<controller>/<action>',
//'<controller:\w+>/<action:\w+>'=>'<controller>/<action>',    // comment this
),
),

Example:

for further examples please read
http://www.yiiframework.com/doc/blog/1.1/en/final.url





開電腦公司

小弟自家制電腦程式公司, 專門做PHP, javascript 相關的程式. 我這類人, 巿場多的是. 要突圍而出, 真係唔易.

現在分享我一年幾的心得:
1. 先有門專業技能 (Java/C++/ASPX/PHP/javascript/Ruby/Django/Sql server/mysql/Oracle...)
2. 要識點樣去test 你的程式. 否則你的生涯很快會完!
3. 做好第一份JOB. 記住係要做好!!!
4. 開頭唔好同客咁計交. 之後自然會你識計
5. 識多D朋友

當你能做好以上5點, 際遇很奇妙地降到你身上!

之後, 你就會面對究竟自己做同打工有咩分別. 原因係你個客會成日搵你. 你會長期做佢生意.
你計一計邊數, 其實你在做什麼?!

好多人話, home office 正啦~. 其實唔係大家想像中咁.
1. 工作時間 同打工唔同, 放假同打工有時分唔開, 反之亦然
2. 一個人又未必敢接得多project. 事實接到幾多個呢?!
3. 個客一叫你俾個budget, 你左計又計, 又怕叫得貴, 冇左個客, 又怕叫得低, 冇肉食. 問佢budget, 佢又話睇你.
4. 一定會遇到收唔到錢的情況. 拖數客最多.
5. 為將來的發展摸不著頭腦.

創業的路真係唔容易. 特別係我呢D凡夫俗子.

PHP Codeigniter and Yii

According to www.codeigniter.com, there is an article written on 9th July 2013 and the title is "EllisLab Seeking New Owner for CodeIgniter". WHAT! well, I can totally comprehend you feeling. I wrote a code generation (CRUD) based on codeigniter. What should I do? Should I switch to another framework?

The dilemma is that if you keep on using codeigniter, there are not more support, bug fix, improvements on the framework. If you switch to another framework, you have to learn and development your tools again which might take you some time~

For me, I switched to Yii. The reason is as follows:
1. Yii has Gii (code generator)
2. The structure is very similar to Codeigniter
3. Yii has more support and the developer community is large!
4. It is better that Codeigniter as well like namespace, cms, performance and Yii is unit-tested~

Yii keeps up-to-date development on the latest php version. Start Yii today and u won't experience this dilemma twice!


Eclipse php copy to htdocs folder

1. create build.xml, put it in the project root folder

build.xml
---------------------------------------------
<?xml version="1.0" encoding = "UTF-8" ?>
<project name="project" default="deploy" basedir=".">
<property file="build.properties"></property>
<target name="deploy">
<delete dir="${full.deploy.path}"></delete>
<copy todir="${full.deploy.path}">
<fileset dir=".">
<exclude name="**/test/**"></exclude>
</fileset>
</copy>
</target>
</project>


2. create build.properities file, put it in the project root folder

build.properities
--------------------------------------------
apache.htdocs.dir=C:/Program Files (x86)/Apache Software Foundation/Apache2.2/htdocs/
web.root.dir=product_catalog
full.deploy.path=${apache.htdocs.dir}/${web.root.dir}


3. Right click your project > properties > Builder > New > Ant Builder
    choose the build.xml you have just created > Apply
   
4. press Alt + F6 to build your project. Eclipse will output the project to htdocs folder

Yea~

Drawbacks:
1. deletes the htdocs and then copy from the source every time you build the project -> takes time!
2. htdocs/* cannot update the source (backward update)

If you have been using Netbeans, you don;t need the above scripts as there is an option "copy from the source to another folder" checkbox~