Archive for October, 2006
Is mysql actually better?
By Justin Silverton
Mysql is the most popular open source database server right now. It is used by large enteprise level companies and small, single websites. There are countless numbers of books on the subject and many people claim it is better than the rest (microsoft, postgres)…but is it actually better? My goal here is to find out, based on Internet research, if mysql actually does outperform the other commercial and open source database systems.
Mysql 5.0 vs. Microsoft SQL 2005
Features
- Mysql 5.X now offers support for cursors, complete views, and stored procedures. However, Foreign Key support is still in its early stages.
- SQL 2005 has native support for xml, multi-dimensional data querying, and Visual Studio .net integration.
Cost
- Microsoft provides a free license for development use. $1400 for a commercial license.
- Mysql is free ($0) for commercial and non-commerical use. It is also possible to purchase a commerical license (to get around the GPL license) for $400.
Performance
- Mysql: MyISAM database table type uses less space and memory. Innodb and NDB clusters also now use 20% less space (new to 5.0).
- SQL 2005: needs more disk storage and memory requirements.
Replication
- Mysql: One way replication using a binary log, which can easily be replicated to multile machines.
- SQL 2005: Multiple forms of replication (snapshot,transactional, and merge), which are more complex and offers a greater degrees of flexibility.
Recovery
- SQL 2005: Very robust. There are multiple failsafes in place to prevent data loss. New features in this version also allow rapid restoration and data protection.
- Mysql: Falls very short in this respect. An unexpected shutdown of your server can cause data loss.
Reference: http://www.tometasoftware.com/MySQL-5-vs-Microsoft-SQL-Server-2005.asp
Mysql 5.x vs. Postgres 8.x
Postgres and mysql are both open source and supported by a community of users. Postgres is a little more difficult to find information about (most statistics are from older versions of postgres).
Postgres Advantages
- Stored procedures, Triggers, and a large set of built-in functions (including many functions for date manipulation) (many more features than mysql).
- Procedural language is pretty easy to learn if you know Oracle’s PL/SQL.
Postgres Disadvantages
- Even though it has more features, because it is not as popular or mainstreamed as mysql, postgres is at a disadvantage.
Some Links on the subject (some have comparisons with older versions of postgres/mysql):
- http://www.wlug.org.nz/PostgresVsMysql (chart detailing supported features)
- http://www.databasejournal.com/features/mysql/article.php/3288951
- http://www-css.fnal.gov/dsg/external/freeware/pgsql-vs-mysql.html
Conclusion
Even though many commercial databases have more features than mysql, I still feel that it is a viable solution for most web applications and sites. Most scalability issues can be solved using a caching soluton called memcached (http://www.danga.com/memcached/). Future versions of mysql should concentrate on improving Data protection and recovery.
Also, because of it’s large acceptance on the Internet and in many web communities, it makes it a more practical solution than other open source databases such as postgres.
14 commentsPHPbb SEO master Version 1.0 Released
PHPbb SEO Master Version 1.0 Released
Are you running a phpbb bulletin board? You may be missing out on important search engine traffic! phpbb SEO master will bring you more search engine hits than you ever had before
- Easy Install and works with your existing board
- Topic URLS are dynamically converted to SEO friendly addresses
- Forum URLS are dynamically converted to SEO friendly addresses
Writing good php docs
By Justin Silverton
Documentation is a very important part of development. It will not only allow you to come back to an application or piece of code in the future with ease, but also help future coders (in the open source community or at your job, etc) that may be utilizing your source code.
A great tool that can be used for this is called phpDocumentor (or phpdoc) available here.
Features
- output in HTML, PDF (directly), CHM (with windows help compiler), XML DocBook
- web and command-line interface
- fully customizable output with Smarty-based templates
- recognizes JavaDoc-style documentation with special tags customized for PHP 4
- generates a todo list from @todo tags in source
Installation
There are two different ways to install this. The first is to download the source directly and install it manually (found here). The second is to install it through the pear library. This can be done using the following command: “pear install PhpDocumentor”
To install phpDocumentor to use the web interface, you must first change one of PEAR’s configuration variables, data_dir, to be a sub-directory of your web server’s document root. The simplest way to do this is through PEAR’s command-line interface with the command: pear config-set data_dir /path/to/document_root/pear
Configuring this value through the web interface is also simple. Click on the configuration icon in the left-hand frame, and type in the path in the data_dir text box.
Usage
It’s fairly easy to start documenting your code. There are sample projects included that show some common usage (sample1.php, sample2.php, and sample3.php).
If you are using the command-line interface, run this command from the tutorials/sample directory:
phpdoc -o HTML:frames:earthli -f sample1.php -t docs (replace sample1.php with the file you want to process)
The rest of the available options can be found using: phpdoc -h
Full Docs can be found here
1 commentPHP currently #4 language
By Justin Silverton
Introduction
The TIOBE Programming Community index gives an indication of the popularity of programming languages. The index is updated once a month. The ratings are based on the world-wide availability of skilled engineers, courses and third party vendors. The popular search engines Google, MSN, and Yahoo! are used to calculate the ratings. Observe that the TPC index is not about the best programming language or the language in which most lines of code have been written.
Where PHP stands currently (In the month of october)
Position (Oct 2006): 4
Position (Oct 2005): 4
Ratings (Oct 2006): 9.863%
Delta (Oct 2005): +0.19%
Status: A
The status of A means it is a mainstream programming language language
The full list can be found here: http://www.tiobe.com/tpci.htm
Some more interesting facts about this list: Java, C, and C++ makeup #s 1-3. F#, a Beta microsoft programming language also made the list (#56). Paul Jenson had this to say about it:
“The first official beta of this Microsoft programming language has been released 3 months ago. This variant of C# with many functional aspects is already at position 56 of the TIOBE index. James Huddlestone (Apress) and Robert Pickering draw my attention to F# via e-mail. Later Ralf Herbrich from the X-box team of Microsoft wrote to me “After working with F# for the last 9 months, I firmly believe that F# has the potential to be the scientific computing language of the future.”
I wonder how many people are still using classic ASP?
2 commentsHow to use the facebook API
By Justin Silverton
The facebook API allows you to access profiles, friends, photos, and events. To access the API from an outside server, you need to go through the following steps:
- login to your Facebook Account
- get an account key: http://developers.facebook.com/account.php?action=add_key
- Get the client library: http://developers.facebook.com/documentation.php?doc=clients (I will be discussing the PHP API, but it is also available for c#, c++, java, perl, python, ruby, and visual basic.NET).
- The php 5 library can be found here: http://developers.facebook.com/clientlibs/php5_client.tar.gz (curl is required)
Getting started
Place the following in a file called “client.php”. Also, facebook_conf.php and facebookapi_php5_restlib.php need to both be in the same directory.
include_once ‘facebook_conf.php’;
include_once ‘facebookapi_php5_restlib.php’;
$rest_server = ‘api.facebook.com/restserver.php’;
$api_key = (Your api key from facebook);
$secret_key = (your secret key from facebook);
$session_key = md5(time());
Note: This is just a sample session key. This should be a unique key that can identify the current session user. It can also be placed in a cookie.
$client = new FacebookRestClient($rest_server, $api_key,$secret_key, $session_key, false);
$session_info = $client->auth_getSession($auth_token);
$client->session_key = $session_info[’session_key’];
$uid = $session_info[’uid’];
$session_info = $client->auth_getSession($auth_token);
//Here are some sample pieces of information that can be retrieved
$your_messages = $client->messages_getCount(); //get your total number of messages
$your_wall_count = $client->wall_getCount(); //get the number of posts on your wall
$p_albums = $client->photos_getAlbums($uid); //get list of photo albums
The facebook api can do much more than explained in these examples. For more information, go here: http://developers.facebook.com/documentation.php.
20 comments




