best cricut
Jan
22
2009
--

Useful PHP Tools

Smashing Magazine did it again, a good collection of php tools, 50 Extremely Useful PHP Tools Please comment on your faviourate ones.
Written by in: Web Development | Tags:
Jan
22
2009
4

Setting up wildcard virtual hosts for web development environment

We used to have dev site hosted under sub directories of localhost, e.g. http://localhost/project/abc/. When it comes to development and testing, we really want to keep the environment as close as possible to the production environment, so it would lot easier to deploy and maintain. Imagine you have to refer to /images/logo.png from a page like /we/have/got/a/test/page/index.html, you really want absolute path in this senario, however in order to work with sub folder based dev environment you either having awful relative links (which would be easily break down when you relate files), or different absolute path as if you would deploy that on the production server. Which is not very practical at all. To solve the problem, we thought about having separate virtual hosts for each project, ie. abc.localhost for abc project and so forth. There are several ways you could achieve this in apache configuration.
  1. With vhost_alias_module enabled
    <VirtualHost *:80>
        VirtualDocumentRoot c:/projects/%1/
    </VirtualHost>
    take abc.localhost for example, where %1 represents abc, and %2 would represent lcoalhost
  2. With mod_rewrite enabled
    <VirtualHost *:80>
        ServerAdmin root@localhost
        DocumentRoot "c:/projects/"
        ServerName localhost
        ServerAlias *.localhost
        RewriteEngine on
        RewriteCond %{HTTP_HOST} ^([^.]+)\.localhost$ [NC]
        RewriteRule  ^/(.*)$ /%1/$1
    </VirtualHost>
  3. With mod_rewrite and rewritemap
    <VirtualHost *:80>
        ServerAdmin root@localhost
        DocumentRoot "c:/projects/"
        ServerName localhost
        ServerAlias *.localhost
        RewriteEngine on
        RewriteMap   lowercase  int:tolower
        # define the map file
        RewriteMap   vhost      txt:vhosts.map
        # deal with aliases as above
        RewriteCond  ${lowercase:%{SERVER_NAME}}  ^(.+)$
        # this does the file-based remap
        RewriteCond  ${vhost:%1}                  ^(/.*)$
        RewriteRule  ^/(.*)$                      %1/$1
    </VirtualHost>
    Then create the vhosts.map file to contain the hosts to documentroot map, e.g. abc.localhost    c:/project_08/abc bcd.localhost    c:/project_09/bcd
Both method 1 and 2 would wildcard map *.localhost to c:/projects/*, and method 3 will allow you to specify documentroot of each domain in the vhosts.map file. With extra virtualhost you don't need to alter httpd.conf any more, all you need to do is create the subdomain and create the project folder in appropirate location. Since the hosts file doesn't support wildcard entry, for each of the subdomain of localhost you may need to create a separate entry, however it should only take few seconds, and nothing needs to be restart to take effect, which is easy and good enough. Alternatively if you have access to your DNS server, you may setup wildcard on the localhost zone, so everyone in the dev team will have access to *.localhost without alter anything in the local hosts file. Hope whis will in a way help web developers to deliver project faster.
Written by in: Web Development | Tags:
Jan
20
2009
--

45 Useful and Fancy jQuery Techniques

Please check out this post on Smashing Magazine, 45+ New jQuery Techniques For Good User Experience really good collection of jQuery tricks for web development.
Written by in: Web Development | Tags:
Jan
20
2009
--

Install Ruby on Rails (RoR) on Windows (zlib.dll error)

Although Orite has been focusing on PHP development for quite few years now, we are open to new web technologies and always exploring new tools and learning new skills. I still remember when we first heard Ruby on Rails few years back, we were quite amazed about the raid development framework, and the simplicity of the Ruby syntax (which is really OO and human readable). After the recent PHP framework research, we still not 100% happy with any framework in the PHP world. So we decide to take a look at RoR again and try to get some inspiration, and if someday when RoR rules the world we would not be too far behind hopefully. After digging the net, there's no one RoR package that's up to date and easy to install for windows, I guess that's because most the developers are on Macs and Linux. Although we have Linux as testing servers and Mac as graphic stations, all our web developer are happy windows users. We were trying to follow the instructions on RoR wiki, however the One-Click Installer is bit out dated (since official RoR website recommends Ruby 1.8.7). So here's our own instruction of getting RoR on Windows,
  1. Download the binary package from official Ruby download page
  2. Unzip and put in to a folder, say c:\ruby
  3. Add c:\ruby\bin into the environment path (if you don't know how, here's the official Microsoft How To Manage Environment Variables help)
  4. Get the latest RubyGems from RubyForge, and unzip it into a folder
  5. Now launch CMD and goto the RubyGems folder, then type >ruby setup.rb to setup RubyGems
  6. Here comes the problem, when we try to install rails by issuing the command >gem install rails Window alerts an error about missing zlib.dll, and ruby only comes with the zlib.so file under the lib\i386-mswin32 directory. To fix it you need the zlib.dll file under ruby\bin\ folder, if you have apache for windows installed, simply grab the zlib.dll from apache\bin folder, which should work. Otherwise you need to download zlib.dll from any of the dll hosts by search on Google.
  7. The the >gem install rails command should work
  8. And you may install mongrel, the http server for RoR application by >gem install mongrel
Then the RoR is ready to go, you may follow instructions on http://rubyonrails.org to start coding in Ruby for web development. If we don't get too busy with PHP dev work or too bored with RoR, we will post back any interesting findings in RoR from the perspective of PHP developers.
Jan
19
2009
1

Converting MySQL Database to UTF-8

When we were building a WordPress website for a Chinese community we found even the configuration in WordPress defined default charset as 'UTF-8', becase the datbase tables/fields are by default not in 'utf8_unicode_ci', it won't allow users to post in Chinese the characters all come up as ? marks.

So we decide to alter all the tables and fields for WordPress to UTF-8, which would fix the problem. However it's not easy to change all the fields one by one from one charset and collation to another. Then we have written the following php script to help converting the tables and all text fields to UTF-8.


To set the MySQL default charset and collation to UTF-8, so the tables created later without any charset or collation specification would be default to UTF-8, please add these two lines to your my.cnf file under [mysqld],

character-set-server=utf8
default-collation=utf8_unicode_ci
Written by in: Web Development | Tags: ,
Jan
17
2009
10

PHP Frameworks Comparison Test

We have done enough reading and digging on the net just to see how others test and compare PHP frameworks, however there are hardly anything recent and convincing. Most of the test are on throughput of a simple 'Hello World' page, which we don't think reflect the real performance of a framework, simply because no Database interaction was involved, hence Model as in MVC is not tested at all. So we decide to conduct our own test with a more real world case, which would require MVC work together intensively to get up the result.

The Test

We have each programmer picked a popular PHP framework, and the task is to setup the framework and create MVC for the benchmark, which involves,
  • 1000 database insertion
  • 1000 database update
  • query 1000 records (all fields), and display in a list
  • each record size is about 2kb
We then put all the coded project onto one work station which has the following configuration,
  • Pentium 4, 4.3GHz
  • 2GB RAM
  • Windows XP, SP3
  • XAMPP 1.7.0 (patched to work with PDO)
  • APC enabled (Zend Optimizer disabled)
  • All programs turned off, including Anti-Virus and Firewall
We use a PHP batch script under CMD to make queries to each framework 10 times, and reports on the average response time and memory usage.

The Result

Framework Database Engine Avg. Response Time Avg. Memory Usage
Pure PHP mysqli 5.28s
 
0.14MB
 
oModel* adodb mysql 7.13s
 
6.88MB
 
Yii Framework
(yiilite)
pdo_mysql 7.41s
 
8.38MB
 
Yii Framework pdo_mysql 7.7s
 
9.44MB
 
Kohana mysqli 7.68s
 
11.22MB#
 
Zend Framework pdo_mysql 8.37s
 
7.99MB
 
Zend Framework mysqli 11.28s
 
7.88MB
 
Akelos mysqli 12.98s
 
10.93MB
 
* The Orite in-house lightweight MVC framework
# With <benchmark> parameter turned off in the database config file, it only uses 1.5MB memory, and takes about 7.8s. Thanks Jeremy Bush for the advice. (updated 24/07/2009)

The Verdicts

Framework Pro. Con.
oModel Fastest framework, light file structure, highly flexible, real short learning curve Not as comprehensive, not well documented, no community support, need high skill set to work on for large-scale project
Yii Framework Fast, comprehensive, simple and secure file structure, strictly php5 OO, well documented, code generation Farely new, still building community awareness
Kohana Flexibility, Easy start Big memory footprint, DB feature incomplete
Zend Framework Great library set, flexible, best community support Long learning curve, code generation problem*
Akelos Great RoR port, database migration Slow, php4
* We have try to run Zend-Tool on two workstations, all failed to run

The Conclusion

We understand this benchmark comparison is still bit off the real world, as it has too much emphasis on the database operation, where as in real web scenario the result can vary on different server deployment. Also, we didn't test cache mechanisms under each framework, which would play a real important role in the production environment, when server gets lot of hits on dynamic content, the result can be really different depend on project nature. Hopefully Orite will further test  real web project taken most the core features of frameworks in consideration. If we were after speed, we would stick with oModel which had been the backbone of lots of recent Orite projects. After testing the frameworks, our team had picked both Zend Framework which has the most supportive community and feature set, and Yii Framework the good combination of comprehensive feature, ease of use and performance. We will start few project based on Yii Framework and continuously keep eyes and hands on Zend. Interesting findings regarding this topic will be posted after we have dived into these frameworks a bit more.
Jan
16
2009
5

Australian Postcodes with Geocoding (updated 12 Jan 2009)

Orite has been involving in quite few projects that requires the Australian postcode database, and some even requires Geocoding (GPS coordinates) for mapping purpose. So we have written code to read data from the official AusPost Postcode Datafile and use GoogleMap API to find the coordinates and save to a csv file with 5 fields consists the suburb name, state, postcode, latitude, longtitude. We have recently updated this database accroding to the 12 Jan 2009 datafile released by AusPost, which are available for download in 7Zip compressed file, Australian Postcodes with Geocoding (183KB) If you found anything incorrect in this datafile, please post to let us know.
Jan
16
2009
4

XAMPP 1.7.0 for Windows Problem

We recently updated our XAMPP on developers work stations to 1.7.0, since it incorporates the latest MySQL 5.1 and PHP 5.2.8 releases. However we dicovered an issue with the mysql libraries which prevents PDO from running properly. Come with the package there are two versions of mysql libraries, if you check xampp/php and xampp/apache/bin you will find one is named libmysql_5.0.51a on the files, the other is just libmysql.dll, all we did to fix the problem is replacing the library files with the 5.051a files in the directories mentioned before. Also in xampp/php/ext there're php_mysqli.dll and php_mysql.dll needs replacing too. Please make sure you stop Apache before replacing file under xampp/apache/bin This should fix the problem with PDO.
Written by in: Web Development | Tags: , , , ,
Jan
16
2009
--

Searching for The PHP Framework

Orite dev team have been working on our own MVC PHP dev framework for quite few years, which we utilize Adodb for database abstraction and TemplatePower for View template, and we have the handy oModel (Orite Model) to create all database tables as class objects, so all the database operations are nicely layed out in 3 layers. However we write our own Control, which consists of lots of inclusions (of classes and libraries) and dirty (not very readable) procedure logic etc. It's not too much of a hassle to develop on the Orite MVC framework, since the simplicity of it's structure and logic. However in order to do tricks like Ajax, URL rewriting, it requires all the knowledge about PHP MySQL HTML Javascript and Apache, and sometime because the different deployment environment one has to learn different platforms, we have been deploy on Linux (various distro), Windows (different versions) and Solaris. Although the Orite MVC framework performed for years, we decided to go something else. Since for the new year we are proposing few large-scale community portal sites, which would require more collabrative dev and constant maintenance. Here we set out the feature request for the framework we looking for which must have,
  • MVC pattern, since its what we familiar and happy with
  • No non-sense folder structure, not too flexible or too restricted
  • Solid and performance database abstraction layer, support transactions
  • Good error handling and reporting
  • URL management, routing and filtering
  • Layered theme, layout, view
  • Code generation
  • Strict PHP5 implementation
  • Good community support and active development
  • Easy learning and start
  • Performance and security
Would be bonus to have,
  • Templating
  • Ajax
  • Caching
  • Built-in useful libraries (validation, emailing, etc)
  • Shell support for cron jobs
  • I18n
  • Database migration
We know it's not an easy task to find THE right PHP framework to use and stick with, since there are quite few available on the market and all have quite good reputation. Also because the evolving of the technology and vary of our project scope. So we decide to firstly pick a few popular ones and do our own testing and benchmarking, that's the only way to choose properly. We'll follow up with the results... If you are using a PHP framework and think that's the best, please feel free to post a comment below.
Written by in: Web Development | Tags: , ,
Jan
16
2009
140

Hello World!

Welcome to Orite Official Blog At the beginning of 2009,  we finally decided to trash our News & Events section on the Orite website and replace it with a wordpress blog, so it would no longer be out of maintenance, and all the Orite team members would have a place to post thoughts and ideas to share with the world. We were so focused on our web dev work and didn't bother blogging, the blog idea came back few days ago when the team is doing some major research work, we thought it'll be really useful to collect our thoughts via a blog, which not only records it in a written form but also highly accessible. As being an open source development team for quite few years, we were collecting others idea, now we'd like to share our own too. Hope this blog would be a good start. We'll be constantly posting official updates to our projects and work, and post any findings from our development team to discuss and share. Look forward to seeing you here soon.
Written by in: Announcement |

Copyright Orite Group Pty Ltd | Powered by WordPress | Theme: Aeros 2.0

https://www.runthemusic.com/