Wednesday, February 17, 2010
CakePHP 1.2.6 New Release
It is stated in the cakephp.org that the new release of cakephp 1.2.6 is now available for download. This release includes more than 160 commits improving performance and fixing more than 75 related tickets. Visit cakephp.org for details.
Sunday, December 20, 2009
My First CakePhp Application
I finally managed to create my own application using the CakePhp. I had tried using CakePhp 1.3 but it gave me problem at the URL where it changed the parameter from 1 to id:1
With that, I tried using CakePhp 1.25, all problems had gone.
With that, I tried using CakePhp 1.25, all problems had gone.
Friday, December 18, 2009
My First Experience with CakePhp
I start with the installation process and then do the configuration.
1. Download CakePhp from http://www.cakephp.org and follow the "Download Now" link.
2. Unpack the contents of the Cake archive into /var/www/html however it depends on what web server you use. For example, if you use WAMP (I have been using it since working in ILP), you must unpack it into /wamp/www/
3. After you unpack you should have the following directories or files:
/cake_1_2
--->/app
--->/cake
--->/vendors
--->/.htaccess
--->/index.php
--->/README
4. Now, lets do the configuration processes.Nothing much steps involve except the mod_rewrite must be set up in the Apache configuration files.
First Kick-Off - CakePhp Initialization:
I got the following errors:
Deprecated: Assigning the return value of new by reference is deprecated in C:\wamp\www\cake_1.2.5\cake\libs\inflector.php on line 131
Deprecated: Assigning the return value of new by reference is deprecated in C:\wamp\www\cake_1.2.5\cake\libs\configure.php on line 136
Deprecated: Assigning the return value of new by reference is deprecated in C:\wamp\www\cake_1.2.5\cake\libs\configure.php on line 226
Deprecated: Assigning the return value of new by reference is deprecated in C:\wamp\www\cake_1.2.5\cake\libs\configure.php on line 906
Deprecated: Assigning the return value of new by reference is deprecated in C:\wamp\www\cake_1.2.5\cake\libs\configure.php on line 946
Now it is time to "Google" ing....keep it up map....
Ok now I know the solution after doing some googling..
Fist solution : Downgrade WAMP to its previous version
Second solution : Upgrade CakePhp from 1.2 to 1.3
So, I choose the second solution since I dont want to mess up with my other PHP Projects in current WAMP version.
1. Download CakePhp from http://www.cakephp.org and follow the "Download Now" link.
2. Unpack the contents of the Cake archive into /var/www/html however it depends on what web server you use. For example, if you use WAMP (I have been using it since working in ILP), you must unpack it into /wamp/www/
3. After you unpack you should have the following directories or files:
/cake_1_2
--->/app
--->/cake
--->/vendors
--->/.htaccess
--->/index.php
--->/README
4. Now, lets do the configuration processes.Nothing much steps involve except the mod_rewrite must be set up in the Apache configuration files.
First Kick-Off - CakePhp Initialization:
I got the following errors:
Deprecated: Assigning the return value of new by reference is deprecated in C:\wamp\www\cake_1.2.5\cake\libs\inflector.php on line 131
Deprecated: Assigning the return value of new by reference is deprecated in C:\wamp\www\cake_1.2.5\cake\libs\configure.php on line 136
Deprecated: Assigning the return value of new by reference is deprecated in C:\wamp\www\cake_1.2.5\cake\libs\configure.php on line 226
Deprecated: Assigning the return value of new by reference is deprecated in C:\wamp\www\cake_1.2.5\cake\libs\configure.php on line 906
Deprecated: Assigning the return value of new by reference is deprecated in C:\wamp\www\cake_1.2.5\cake\libs\configure.php on line 946
Now it is time to "Google" ing....keep it up map....
Ok now I know the solution after doing some googling..
Fist solution : Downgrade WAMP to its previous version
Second solution : Upgrade CakePhp from 1.2 to 1.3
So, I choose the second solution since I dont want to mess up with my other PHP Projects in current WAMP version.
Saturday, September 26, 2009
Source Code Editor
In the making of PHP coding, there are several Source Code Editor could be used espeacially free Source Code Editor:
BBEdit (Mac OS X)
Code Crusader IDE (Mac OS X, Linux)
Crimson Editor (Windows)
Eclipse
Emacs (Cross-platform, including Unix, Linux, Mac OS X, Windows)
EmEditor (Windows)
IntelliJ IDEA built-in editor (Windows, Linux, Mac OS X)
ISPF/PDF Edit (IBM MVS Mainframe, TRSDOS, DOS, Unix, AIX, Linux, OS/2, and Windows)
jEdit (Windows, Linux, Mac OS X)
Kate/KDevelop (KDE)
ActiveState Komodo Edit
Lazarus built-in editor (Windows, Linux, Mac OS X)
Microsoft Visual Studio built-in editor (Windows)
NEdit (Linux, Unix, Mac OS X)
Notepad++ (Windows)
Programmer's Notepad text/source code editor (Windows)
PSPad (Windows)
SciTE (Windows, Linux)
SlickEdit (Windows, Linux, Mac OS X)
Source Insight (Windows)
SubEthaEdit (Mac OS X)
TextMate (Mac OS X)
UltraEdit (Windows)
UNA (Windows, Linux, Mac OS X)
vi/Vim (Cross-platform, including Unix, Linux, Mac OS X, Windows)
I have tried using Notepad++ but it seems unstable in Vista environment.
I good comparison table for the editors are as follows:
http://en.wikipedia.org/wiki/Comparison_of_text_editors#Programming_features
BBEdit (Mac OS X)
Code Crusader IDE (Mac OS X, Linux)
Crimson Editor (Windows)
Eclipse
Emacs (Cross-platform, including Unix, Linux, Mac OS X, Windows)
EmEditor (Windows)
IntelliJ IDEA built-in editor (Windows, Linux, Mac OS X)
ISPF/PDF Edit (IBM MVS Mainframe, TRSDOS, DOS, Unix, AIX, Linux, OS/2, and Windows)
jEdit (Windows, Linux, Mac OS X)
Kate/KDevelop (KDE)
ActiveState Komodo Edit
Lazarus built-in editor (Windows, Linux, Mac OS X)
Microsoft Visual Studio built-in editor (Windows)
NEdit (Linux, Unix, Mac OS X)
Notepad++ (Windows)
Programmer's Notepad text/source code editor (Windows)
PSPad (Windows)
SciTE (Windows, Linux)
SlickEdit (Windows, Linux, Mac OS X)
Source Insight (Windows)
SubEthaEdit (Mac OS X)
TextMate (Mac OS X)
UltraEdit (Windows)
UNA (Windows, Linux, Mac OS X)
vi/Vim (Cross-platform, including Unix, Linux, Mac OS X, Windows)
I have tried using Notepad++ but it seems unstable in Vista environment.
I good comparison table for the editors are as follows:
http://en.wikipedia.org/wiki/Comparison_of_text_editors#Programming_features
CakePhp and Ruby On Rails.
A good site for a starter.
http://dunia-aturcara.blogspot.com/
CakePhp - I have no idea
Ruby On Rails - i have no idea
http://dunia-aturcara.blogspot.com/
CakePhp - I have no idea
Ruby On Rails - i have no idea
Monday, August 17, 2009
Custom "Who's Online," "Most Users Online" and "IP of Guest" blocks
This is a customization of the "Who's Online" block (it should help you to change whatever else you would like to change as well). This one just adds the total number of registered users in addition to telling who is online.
Drupal 4.7
$number = db_result(db_query('SELECT COUNT(uid) AS number FROM {users} WHERE status=1'));
if (user_access('access content')) {
// Count users with activity in the past defined period.
$time_period = variable_get('user_block_seconds_online', 900);
// Perform database queries to gather online user lists.
$guests = db_fetch_object(db_query('SELECT COUNT(sid) AS count FROM {sessions} WHERE timestamp >= %d AND uid = 0', time() - $time_period));
$users = db_query('SELECT uid, name, access FROM {users} WHERE access >= %d AND uid != 0 ORDER BY access DESC', time() - $time_period);
$total_users = db_num_rows($users);
// Format the output with proper grammar.
echo "Out of $number registered users ";
if ($total_users == 1 && $guests->count == 1) {
$output = t('%members and %visitors online.', array('%members' => format_plural($total_users, 'there is currently 1 user', 'there are currently %count users'), '%visitors' => format_plural($guests->count, '1 guest', '%count guests')));
}
else {
$output = t('there are currently %members and %visitors online.', array('%members' => format_plural($total_users, '1 user', '%count users'), '%visitors' => format_plural($guests->count, '1 guest', '%count guests')));
}
// Display a list of currently online users.
$max_users = variable_get('user_block_max_list_count', 10);
if ($total_users && $max_users) {
$items = array();
while ($max_users-- && $account = db_fetch_object($users)) {
$items[] = $account;
}
$output .= theme('user_list', $items, t('Online users'));
}
}
return $output;
?>
>Variation: Most Users Ever Online
Right before
}
return $output;
?>
add:
$total_users_online = $total_users + $guests->count;
if (variable_get('most_users_online_ever', '') < $total_users_online) {
variable_set('most_users_online_ever', $total_users_online);
variable_set('most_users_online_ever_time', time());
}
$output .= "Most users ever online was " . variable_get('most_users_online_ever', '');
$output .= " on " . format_date(variable_get('most_users_online_ever_time', ''), 'medium', '');
?>
It will print something like:
Most users ever online was 66 on 01/24/2008 - 02:00
Tested in Drupal 5.6.
You can change "<" to "<=" if you'd like to show the most recent date.
Variation - showing IP and domain of guest
This doesn't call on the theming functions, so it includes some html formatting that might need to be change.
$number = db_result(db_query('SELECT COUNT(uid) AS number FROM {users} WHERE status=1'));
if (user_access('access content')) {
// Count users with activity in the past defined period.
$time_period = variable_get('user_block_seconds_online', 900);
// Perform database queries to gather online user lists.
$guests = db_fetch_object(db_query('SELECT COUNT(sid) AS count FROM {sessions} WHERE timestamp >= %d AND uid = 0', time() - $time_period));
$guests_hostname = db_query('SELECT hostname FROM {sessions} WHERE timestamp >= %d AND uid = 0', time() - $time_period);
$total_guests = db_num_rows($guests_hostname);
$users = db_query('SELECT uid, name, access FROM {users} WHERE access >= %d AND uid != 0 ORDER BY access DESC', time() - $time_period);
$total_users = db_num_rows($users);
// Display a list of currently online users.
$max_users = variable_get('user_block_max_list_count', 10);
if ($total_users && $max_users) {
$items = array();
while ($max_users-- && $account = db_fetch_object($users)) {
$items[] = $account;
}
$output.="Users ";
$output .= theme('user_list', $items, NULL);
}
// Display a list of currently online guests.
if ($total_guests) {
$output.="Guests ";
}
}
return $output;
?>
which gives as result:
Who is online
Users
* administrator
Guests
* 192.168.0.50 Saturnus
of course the 192.. Ip will change to any guests IP looking at your site.
Drupal 4.7
$number = db_result(db_query('SELECT COUNT(uid) AS number FROM {users} WHERE status=1'));
if (user_access('access content')) {
// Count users with activity in the past defined period.
$time_period = variable_get('user_block_seconds_online', 900);
// Perform database queries to gather online user lists.
$guests = db_fetch_object(db_query('SELECT COUNT(sid) AS count FROM {sessions} WHERE timestamp >= %d AND uid = 0', time() - $time_period));
$users = db_query('SELECT uid, name, access FROM {users} WHERE access >= %d AND uid != 0 ORDER BY access DESC', time() - $time_period);
$total_users = db_num_rows($users);
// Format the output with proper grammar.
echo "Out of $number registered users ";
if ($total_users == 1 && $guests->count == 1) {
$output = t('%members and %visitors online.', array('%members' => format_plural($total_users, 'there is currently 1 user', 'there are currently %count users'), '%visitors' => format_plural($guests->count, '1 guest', '%count guests')));
}
else {
$output = t('there are currently %members and %visitors online.', array('%members' => format_plural($total_users, '1 user', '%count users'), '%visitors' => format_plural($guests->count, '1 guest', '%count guests')));
}
// Display a list of currently online users.
$max_users = variable_get('user_block_max_list_count', 10);
if ($total_users && $max_users) {
$items = array();
while ($max_users-- && $account = db_fetch_object($users)) {
$items[] = $account;
}
$output .= theme('user_list', $items, t('Online users'));
}
}
return $output;
?>
>Variation: Most Users Ever Online
Right before
}
return $output;
?>
add:
$total_users_online = $total_users + $guests->count;
if (variable_get('most_users_online_ever', '') < $total_users_online) {
variable_set('most_users_online_ever', $total_users_online);
variable_set('most_users_online_ever_time', time());
}
$output .= "Most users ever online was " . variable_get('most_users_online_ever', '');
$output .= " on " . format_date(variable_get('most_users_online_ever_time', ''), 'medium', '');
?>
It will print something like:
Most users ever online was 66 on 01/24/2008 - 02:00
Tested in Drupal 5.6.
You can change "<" to "<=" if you'd like to show the most recent date.
Variation - showing IP and domain of guest
This doesn't call on the theming functions, so it includes some html formatting that might need to be change.
$number = db_result(db_query('SELECT COUNT(uid) AS number FROM {users} WHERE status=1'));
if (user_access('access content')) {
// Count users with activity in the past defined period.
$time_period = variable_get('user_block_seconds_online', 900);
// Perform database queries to gather online user lists.
$guests = db_fetch_object(db_query('SELECT COUNT(sid) AS count FROM {sessions} WHERE timestamp >= %d AND uid = 0', time() - $time_period));
$guests_hostname = db_query('SELECT hostname FROM {sessions} WHERE timestamp >= %d AND uid = 0', time() - $time_period);
$total_guests = db_num_rows($guests_hostname);
$users = db_query('SELECT uid, name, access FROM {users} WHERE access >= %d AND uid != 0 ORDER BY access DESC', time() - $time_period);
$total_users = db_num_rows($users);
// Display a list of currently online users.
$max_users = variable_get('user_block_max_list_count', 10);
if ($total_users && $max_users) {
$items = array();
while ($max_users-- && $account = db_fetch_object($users)) {
$items[] = $account;
}
$output.="
$output .= theme('user_list', $items, NULL);
}
// Display a list of currently online guests.
if ($total_guests) {
$output.="
- hostname\">$account->hostname
hostname)."\">".gethostbyaddr($account->hostname)." ";
}
$output.="
$guestitems = array();
while ($guests-- && $account = db_fetch_object($guests_hostname)) {
$guestitems[] = $account->hostname;
$output.="
}
}
return $output;
?>
which gives as result:
Who is online
Users
* administrator
Guests
* 192.168.0.50 Saturnus
of course the 192.. Ip will change to any guests IP looking at your site.
Tuesday, June 9, 2009
Calls to Mysql
These are the number of calls for the Mysql from the Wikka Wikki files:
install.php 99 calls
wikka.class.php 26 calls
wikka.php 1 call
So far, install.php is having the greater number of calls to the PHP/Mysql. The smaller number of calls to the database is the most recommended in developing an Mysql based application as stated at http://www.webmasterworld.com/forum88/5922.htm
However, the install.php execution takes only once at the beginning of the installation of Wikka Wikki, so I think it will not takes too much computer processor and memory resources.
install.php 99 calls
wikka.class.php 26 calls
wikka.php 1 call
So far, install.php is having the greater number of calls to the PHP/Mysql. The smaller number of calls to the database is the most recommended in developing an Mysql based application as stated at http://www.webmasterworld.com/forum88/5922.htm
However, the install.php execution takes only once at the beginning of the installation of Wikka Wikki, so I think it will not takes too much computer processor and memory resources.
Subscribe to:
Posts (Atom)
