here are the good links i found about creating layout(theme) for website.
How to Create WordPress Themes from Scratch
Friday, December 25, 2009
Tuesday, December 22, 2009
Fatal error: Allowed memory size of 33554432 bytes exhaustsed
when follow the Jobeet tutorial to Day 9, functional test, got problem with the following test:
went further to teste the code one by one then found the fatal error:
went to /etc/php5/apache2 to edit php.ini to change the memory limit to 128M then restart apache it didn't help.
went to /etc/php5/cli to edit php.ini to change the memory limit to 128M then restart apache, it only pass 3 tests then threw Segmentation fault again...
added the following in front the test code
php symfony test:functional frontend categoryActionsTest..................................................dubious Test returned status 139 Failed tests: 0 jobActionsTest.......................................................dubious Test returned status 139 Failed tests: 0 Failed Test Stat Total Fail List of Failed ------------------------------------------------------------------ categoryActionsTest 139 1 1 0 jobActionsTest 139 1 1 0 Failed 2/2 test scripts, 0.00% okay. 2/0 subtests failed, 0.00% okay.
went further to teste the code one by one then found the fatal error:
php symfony test:functional frontend categoryActions > 1 - The category page > 1.1 - Categories on homepage are clickable # get / Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 30720 bytes) in /home/ddd/projects/jobeet/lib/vendor/symfony/lib/helper/PartialHelper.php on line 148
went to /etc/php5/apache2 to edit php.ini to change the memory limit to 128M then restart apache it didn't help.
went to /etc/php5/cli to edit php.ini to change the memory limit to 128M then restart apache, it only pass 3 tests then threw Segmentation fault again...
added the following in front the test code
$browser->with('response')->debug;and run test again, the response debug showed there were too many job records returned(about 30 jobs), that's why memory was running out?
Monday, December 21, 2009
drop down list/collection selection
I have a simple application just like blog tutorial in the book 'Agile Web Development with Rails', it has two models:
on the new.html.erb and edit.html.erb files for logs, I need to show all available products in a drop down list so user can choose the product and edit log for it. collection_selection is the one to do this.
in new.html.erb, it's easier,
here:
object: is the log model
method: is the log model's attribute: part_number_id
collection: log's part_number_id is choose from Product model
value_method: the value displayed in select & option tag is Product's id
text_method: the text valude displayed in select & option tag is Product's part number
options{:include_blank => 'Please Select'}: when no option is available, display 'Please select' in the select & option tag.
in edit.html.erb, not only do i need to show all available products in dropdown list, also I need to select the part number of that specified log:
in the options, we added one more, :selected => @selected_log, the variable @selected_log was defined in controller/logs_controller.rb
class Log < ActiveRecord::Base belongs_to :product end class Product < ActiveRecord::Base has_many :logs endProduct has a part_number_id column which Log reference to. Log was created using scaffold while Product was created using script/generate model.
on the new.html.erb and edit.html.erb files for logs, I need to show all available products in a drop down list so user can choose the product and edit log for it. collection_selection is the one to do this.
collection_select(object, method, collection, value_method, text_method, options = {}, html_options = {})
in new.html.erb, it's easier,
here:
object: is the log model
method: is the log model's attribute: part_number_id
collection: log's part_number_id is choose from Product model
value_method: the value displayed in select & option tag is Product's id
text_method: the text valude displayed in select & option tag is Product's part number
options{:include_blank => 'Please Select'}: when no option is available, display 'Please select' in the select & option tag.
in edit.html.erb, not only do i need to show all available products in dropdown list, also I need to select the part number of that specified log:
in the options, we added one more, :selected => @selected_log, the variable @selected_log was defined in controller/logs_controller.rb
# GET /logs/1/edit def edit @log = Log.find(params[:id]) @selected_log = Product.find(@log.part_number_id).id endit tells that the selected option is the one defined ass @selected_log.
Friday, December 18, 2009
checkbox
the model Log has a attribute :status which can be either true(valid) or false (invalid).
the view(edit.html.erb) has a form to show this model, want to use a checkbox to allow user to invalidate the log:
to populate the log's status to the check box:
if log's status is valid, the check box is not checked;
if log's status is invalid, the check box is checked;
to populate the check box's value back to log's status:
if user check the check box, the log's status will be set to false(invalid)
once the check box is checked, user is not allowed to uncheck it.
To Populate from Model to View
The tricky thing here is, the status of the check box is opposite to the log's status, so tried the following ways:
read the API again and googled around (kudos to rob-twf's reply at ruby on rails forum), here is the solution:
follow the API:
method: here is our :status attribute, it has nothing to do with the checkbox's status(checked or not), that's what confused me in the first place
options: html options, here is the place to specify the checkbox's status, checked or not
checked_value & unchecked_value: can safely ignore them in this case.
so in order to set the checkbox checked, we defined the condition in options as:
{:checked => :status ? 0:1}
if log's status is true, uncheck the checkbox, otherwise, check it.
To Populate from View to Model
after the modification from above, we can populate the log.status value correctly to the view(edit.html.erb). then we checked the checkbox to invalidate the log and click Update button, it shows 'Log was successfully updated', however if we go to the database we can see the status is still valid(1). what is wrong?
go to the script/server screen, we found the following statements for the Update click:
How could that be possible? I just checked the check box to invalidate the log's status, the 'status' should be set to 0. well, go back to read the API further:
the view(edit.html.erb) has a form to show this model, want to use a checkbox to allow user to invalidate the log:
to populate the log's status to the check box:
if log's status is valid, the check box is not checked;
if log's status is invalid, the check box is checked;
to populate the check box's value back to log's status:
if user check the check box, the log's status will be set to false(invalid)
once the check box is checked, user is not allowed to uncheck it.
To Populate from Model to View
The tricky thing here is, the status of the check box is opposite to the log's status, so tried the following ways:
<%= f.label 'Invalide?' %><%= f.check_box !(:status)%> or <%= f.label 'Invalide?' %><%= f.check_box (:status ? 0:1)%>those wont' work, it complained either 'undefined method 'false' or undefined 0.
read the API again and googled around (kudos to rob-twf's reply at ruby on rails forum), here is the solution:
<%= f.label 'Invalide?' %><%= f.check_box :status, {:checked => !f.object.status} %>
follow the API:
check_box(object_name, method, options = {}, checked_value = "1", unchecked_value = "0")object_name: here is our Log model,
method: here is our :status attribute, it has nothing to do with the checkbox's status(checked or not), that's what confused me in the first place
options: html options, here is the place to specify the checkbox's status, checked or not
checked_value & unchecked_value: can safely ignore them in this case.
so in order to set the checkbox checked, we defined the condition in options as:
{:checked => :status ? 0:1}
if log's status is true, uncheck the checkbox, otherwise, check it.
To Populate from View to Model
after the modification from above, we can populate the log.status value correctly to the view(edit.html.erb). then we checked the checkbox to invalidate the log and click Update button, it shows 'Log was successfully updated', however if we go to the database we can see the status is still valid(1). what is wrong?
go to the script/server screen, we found the following statements for the Update click:
Processing LogsController#update (for 127.0.0.1 at 2009-12-18 13:28:43) [PUT] Parameters: {"commit"=>"Update", "authenticity_token"=>"dQ3IIa6mI0IrJORrayVQjQa6RHn95AqfVvDahBglGMc=", "log"=>{"serial_number"=>"L-000099", "log"=>"Two zipper teeth are missing", "part_number_id"=>"4", "status"=>"1", "user"=>"Tom"}, "id"=>"3"} Log Columns (1.2ms) SHOW FIELDS FROM `logs` Log Load (0.1ms) SELECT * FROM `logs` WHERE (`logs`.`id` = 3) SQL (0.1ms) BEGIN SQL (0.1ms) COMMIT Redirected to http://localhost:3000/logs/3 Completed in 16ms (DB: 2) | 302 Found [http://localhost/logs/3] SQL (0.1ms) SET NAMES 'utf8' SQL (0.1ms) SET SQL_AUTO_IS_NULL=0see there is no SQL statements between the BEGIN and COMMIT, the reason is nothing is changed for that log record, so no update to it.
How could that be possible? I just checked the check box to invalidate the log's status, the 'status' should be set to 0. well, go back to read the API further:
check_box(object_name, method, options = {}, checked_value = "1", unchecked_value = "0")By default, if the the check box is checked, it's set to 1, otherwise, set to 0. that's the opposite to what I need here. so go back to edit.html.erb and update the code again:
<%= f.label 'Invalide?' %> <%= f.check_box :status, {:checked => :status ? 0:1}, checked_value = "0", unchecked_value = "1" %>now it's happy. without anymore change to the code, it can update the Log correctly.
Wednesday, December 16, 2009
ubuntu emacs php mode
to add PHP syntax highlighting to emacs on ubuntu, install php-mode:
sudo apt-get install php-mode
Tuesday, December 15, 2009
symfony: doctrine couldn't locate driver named mysql
followed the symfony's tutorial at chapter 3, when performed the command: php symfony doctrine:insert-sql, it complained:
go check php.ini file, pdo_mysql was enabled: extension=pdo_mysql.so
but when go into folder /etc/php5/conf.d/, only found: pdo.ini, xsl.ini and zend-framework.ini, so maybe pdo_mysql extension was actually not installed?
try to install pdo_mysql extension again:
searched around and found the solution here.
edit /etc/php5/cli and add the following to the end:
doctrine created tables successfully Couldn't locate driver named mysql
go check php.ini file, pdo_mysql was enabled: extension=pdo_mysql.so
but when go into folder /etc/php5/conf.d/, only found: pdo.ini, xsl.ini and zend-framework.ini, so maybe pdo_mysql extension was actually not installed?
try to install pdo_mysql extension again:
sudo pecl install pdo_mysql Ignoring installed package pecl/pdo_mysql Nothing to installuninstalled and reinstalled pecl/pdo_mysql wont' help.
searched around and found the solution here.
Odds are that your php.ini file for your CLI (often different from the apache php.ini) doesnt have pdo_mysql enabled. Enable it :)
edit /etc/php5/cli and add the following to the end:
extension=pdo.so extension=pdo_mysql.so extension=apc.sorestarted apache and it works!
Saturday, December 12, 2009
install symfone on ubuntu
Try to install symfony on ubuntu:
Follow the get-started tutorial on symfony's website at:http://www.symfony-project.org/getting-started/1_4/en/02-Prerequisites,
run check_configuration.php in the web browser: http://localhost/check_configuration.php and it threw the following result:
then got the following message:
and check the configuration again in the browser, boo! the first warning is gone! so far so cool :)
to fix the third warning, run:
now can go ahead to have fun with symfony!
Follow the get-started tutorial on symfony's website at:http://www.symfony-project.org/getting-started/1_4/en/02-Prerequisites,
run check_configuration.php in the web browser: http://localhost/check_configuration.php and it threw the following result:
******************************** * * * symfony requirements check * * * ******************************** php.ini used by PHP: /etc/php5/apache2/php.ini ** Mandatory requirements ** OK PHP version is at least 5.2.4 (5.2.6-3ubuntu4.2) ** Optional checks ** OK PDO is installed [[WARNING]] PDO has some drivers installed: : FAILED *** Install PDO drivers (mandatory for Propel and Doctrine) *** OK PHP-XML module is installed [[WARNING]] XSL module is installed: FAILED *** Install the XSL module (recommended for Propel) *** OK The token_get_all() function is available OK The mb_strlen() function is available OK The iconv() function is available OK The utf8_decode() is available [[WARNING]] A PHP accelerator is installed: FAILED *** Install a PHP accelerator like APC (highly recommended) *** OK php.ini has short_open_tag set to off OK php.ini has magic_quotes_gpc set to off OK php.ini has register_globals set to off OK php.ini has session.auto_start set to off OK PHP version is not 5.2.9To fix the first warning, install PDO package for PHP 5 on ubuntu:
sudo apt-get install libmysqlclient15-dev sudo pecl install pdo
then got the following message:
downloading PDO-1.0.3.tgz ... Starting to download PDO-1.0.3.tgz (52,613 bytes) .............done: 52,613 bytes 12 source files, building running: phpize sh: phpize: not found ERROR: `phpize' failedgoogled around and found out that need to install php5-dev version, so here we go:
sudo apt-get install php5-dev sudo pecl install pdoat the end of the installation, it displayed:
Build process completed successfully Installing '/usr/include/php/ext/pdo/php_pdo.h' Installing '/usr/include/php/ext/pdo/php_pdo_driver.h' Installing '/usr/lib/php5/20060613/pdo.so' install ok: channel://pecl.php.net/PDO-1.0.3 configuration option "php_ini" is not set to php.ini location You should add "extension=pdo.so" to php.ini
sudo pecl install pdo_mysqlat the end of installation, it displayed:
Build process completed successfully Installing '/usr/lib/php5/20060613/pdo_mysql.so' install ok: channel://pecl.php.net/PDO_MYSQL-1.0.2 configuration option "php_ini" is not set to php.ini location You should add "extension=pdo_mysql.so" to php.iniedit php.ini at /etc/php5/apache2/ to add the above 2 lines, restart apache: sudo /etc/init.d/apache2 restart
and check the configuration again in the browser, boo! the first warning is gone! so far so cool :)
sudo apt-get install php5-xsl sudo /etc/init.d/apache2 force-reloadthen rerun check configuration in browser, yeah, second warning is gone!!!!
to fix the third warning, run:
sudo pecl install apcand edit php.ini to add 'extension= apc.so', then restart apache2. check the configuration in browser, hola, it's all gone, all the warnings!!!
now can go ahead to have fun with symfony!
Thursday, November 12, 2009
Ext-GWT: The Mail application
Tools:
1. from eclipse, File->New->Web Application Project
Project name: Mail
Package: com.extjs.gxt.samples.mail
click 'Finish' button.
2. copy the downloaded Mail application source code into the project folder created from step 1, and remove default files created by gwt plugin.
3. copy the resource folder under gxt-2.0.1 to eclipse's Mail project, and rename it to gxt:
Mail -> war -> gxt
4. created lib folder in Mail project, and copy gxt.jar from gxt-2.0.1 to Mail/lib
5. in eclipse, right click Mail project, select Properties -> Java Build Path -> Libraries tab -> click 'Add External JARs' button -> in 'Edit JAR' window, select Mail -> lib->gxt.jar, then click 'OK' button.
6. from eclipse, File->New->Web Application Project
Project name: Resources
Package: com.extjs.gxt.samples.resources
click 'Finish' button.
7. copy the downloaded Resources application source code into the project Resources folder created from step 6, and remove other files created by gwt plugin.
8. created lib folder in Resources project, and copy gxt.jar from gxt-2.0.1 to Resources/lib
9. in eclipse, right click Resources project, select Properties -> Java Build Path -> Libraries tab -> click 'Add External JARs' button -> in 'Edit JAR' window, select Resources-> lib->gxt.jar, then click 'OK' button.
10. in eclipse, right click Mail project, select Properties -> Java Build Path -> Projects tab -> click 'Add' button -> in 'Required Project Selection' window, select 'Resources' project, click 'OK' button.
11. remove the Mail/war/Mail.html file, go to extjs's Mail demo site, right click mouse -> view page source, from the popup window, copy the file and save it to eclipse's Mail project as Mail -> war -> Mail.html.
12. remove the Mail/war/Mail.css file, go to extjs's Mail demo site, right click mouse -> view page source, from the popup window, you see the mail.html file which we just save to our project, read the first a few line:
13, continue from step 12, click the second hyperlink to resources.css,it will open up in the same popup window, copy the file and save it to Mail/war/resources.css
14. open up Mail/war/Mail.html in eclipse, change the second and third hyperlinks to the following:
15. save the project, click Mail, click the 'run' button, it will run the Mail demo application, however, still have problem with mailservice, but at least it show up in eclipse now....more to come later.
- eclipse 3.5 galileo
- gwt plugin for eclipse, v1.7.1, see installation instruction here
- download Ext GWT (including Mail application) source code from here, choose 'Ext GWT 2.0.1 SDK' to download all source code and documentation, unzip it, the folder named 'gxt-2.0.1'
1. from eclipse, File->New->Web Application Project
Project name: Mail
Package: com.extjs.gxt.samples.mail
click 'Finish' button.
2. copy the downloaded Mail application source code into the project folder created from step 1, and remove default files created by gwt plugin.
3. copy the resource folder under gxt-2.0.1 to eclipse's Mail project, and rename it to gxt:
Mail -> war -> gxt
4. created lib folder in Mail project, and copy gxt.jar from gxt-2.0.1 to Mail/lib
5. in eclipse, right click Mail project, select Properties -> Java Build Path -> Libraries tab -> click 'Add External JARs' button -> in 'Edit JAR' window, select Mail -> lib->gxt.jar, then click 'OK' button.
6. from eclipse, File->New->Web Application Project
Project name: Resources
Package: com.extjs.gxt.samples.resources
click 'Finish' button.
7. copy the downloaded Resources application source code into the project Resources folder created from step 6, and remove other files created by gwt plugin.
8. created lib folder in Resources project, and copy gxt.jar from gxt-2.0.1 to Resources/lib
9. in eclipse, right click Resources project, select Properties -> Java Build Path -> Libraries tab -> click 'Add External JARs' button -> in 'Edit JAR' window, select Resources-> lib->gxt.jar, then click 'OK' button.
10. in eclipse, right click Mail project, select Properties -> Java Build Path -> Projects tab -> click 'Add' button -> in 'Required Project Selection' window, select 'Resources' project, click 'OK' button.
11. remove the Mail/war/Mail.html file, go to extjs's Mail demo site, right click mouse -> view page source, from the popup window, copy the file and save it to eclipse's Mail project as Mail -> war -> Mail.html.
12. remove the Mail/war/Mail.css file, go to extjs's Mail demo site, right click mouse -> view page source, from the popup window, you see the mail.html file which we just save to our project, read the first a few line:
<html> <head> <title>Ext GWT 2.0.1 Mail Demotitle> <link rel="stylesheet" type="text/css" href="gxt/css/gxt-all.css" /> <link rel="stylesheet" type="text/css" href="samples/css/resources.css" /> <link rel="stylesheet" type="text/css" href="samples/css/mail.css" /> <style>
..click the third hyperlink to mail.css file, it will open up in the same popup window, copy the file and save it to Mail/war/Mail.css
13, continue from step 12, click the second hyperlink to resources.css,it will open up in the same popup window, copy the file and save it to Mail/war/resources.css
14. open up Mail/war/Mail.html in eclipse, change the second and third hyperlinks to the following:
<link rel="stylesheet" type="text/css" href="resources.css" /> <link rel="stylesheet" type="text/css" href="mail.css" />
15. save the project, click Mail, click the 'run' button, it will run the Mail demo application, however, still have problem with mailservice, but at least it show up in eclipse now....more to come later.
Thursday, November 5, 2009
install ZendFramework on ubuntu
1. download and unzip the latest version of ZendFramework to /home/dan/
2. add the zend framework's library to PHP's include path:
$cd /etc/php5/apache2
$sudo emacs php.ini
find the include_path in the php.ini file and edit it:
include_path = "/home/dan/ZendFramework/library:.:/usr/share/php"
3. restart apache2: $sudo /etc/init.d/apache2 restart
4. create project:
$zf.sh create project quickstart
Issue:
1. make sure the ZendFramework's library folder is not empty.
2. if install ZendFramework by: sudo apt-get zend-framework
remove it by: sudo apt-get remove zend-framework
it might tell you:
The following packages were automatically installed and are no longer required:
libzend-framework-php linux-headers-2.6.28-11-generic linux-headers-2.6.28-11
Use 'apt-get autoremove' to remove them.
then run: sudo apt-get autoremove
2. add the zend framework's library to PHP's include path:
$cd /etc/php5/apache2
$sudo emacs php.ini
find the include_path in the php.ini file and edit it:
include_path = "/home/dan/ZendFramework/library:.:/usr/share/php"
3. restart apache2: $sudo /etc/init.d/apache2 restart
4. create project:
$zf.sh create project quickstart
Issue:
1. make sure the ZendFramework's library folder is not empty.
2. if install ZendFramework by: sudo apt-get zend-framework
remove it by: sudo apt-get remove zend-framework
it might tell you:
The following packages were automatically installed and are no longer required:
libzend-framework-php linux-headers-2.6.28-11-generic linux-headers-2.6.28-11
Use 'apt-get autoremove' to remove them.
then run: sudo apt-get autoremove
Wednesday, October 28, 2009
ruby on rails installation on ubuntu 9.04
for god's sake, i have this serious problem with ruby on rails installation on ubuntu 9.04, i tried so many times with all possible ways to install and without exception it always failed! tried to loggin to their IRC to ask for help and got blamed by some arrogarant people saying that i was not good at following instruction! damn maybe i have problem with following instruction, but if RoR is stupid enough that only by following instruction step by step, why bother to use it anyway? however that's another story, let me focus on installing it first, all in all i still wanna try ruby on rails.
this time with help from others and the instruction from ruby on rails community:
1. install ruby:
2. install rubygems
3. install rails:
4. install MySQL:
5. install apache:
7. bring up firefox browser, point it to http://ror.myhost.com/, hola, it works! display ror welcom aboard page.
problem remains:
1. when restart apache2: it complains:
* Restarting web server apache2
apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName
[Wed Oct 28 16:05:12 2009] [warn] NameVirtualHost *:80 has no VirtualHosts
... waiting apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName
[Wed Oct 28 16:05:13 2009] [warn] NameVirtualHost *:80 has no VirtualHosts
[ OK ]
2. it's sth complaining about xmlsimple module, when create a new project using rails, it shows:
/usr/lib/ruby/1.8/xmlsimple.rb:275: warning: already initialized constant KNOWN_OPTIONS
/usr/lib/ruby/1.8/xmlsimple.rb:280: warning: already initialized constant DEF_KEY_ATTRIBUTES
/usr/lib/ruby/1.8/xmlsimple.rb:281: warning: already initialized constant DEF_ROOT_NAME
/usr/lib/ruby/1.8/xmlsimple.rb:282: warning: already initialized constant DEF_CONTENT_KEY
/usr/lib/ruby/1.8/xmlsimple.rb:283: warning: already initialized constant DEF_XML_DECLARATION
/usr/lib/ruby/1.8/xmlsimple.rb:284: warning: already initialized constant DEF_ANONYMOUS_TAG
/usr/lib/ruby/1.8/xmlsimple.rb:285: warning: already initialized constant DEF_FORCE_ARRAY
/usr/lib/ruby/1.8/xmlsimple.rb:286: warning: already initialized constant DEF_INDENTATION
/usr/lib/ruby/1.8/xmlsimple.rb:287: warning: already initialized constant DEF_KEY_TO_SYMBOL
-- To fix this one, reinstall rubygems and rails:
this time with help from others and the instruction from ruby on rails community:
1. install ruby:
sudo apt-get install ruby-full build-essential
2. install rubygems
sudo apt-get install rubygems1.8 sudo gem install rubygems-update
3. install rails:
sudo apt-get install rails
4. install MySQL:
sudo apt-get install mysql-server mysql-client sudo apt-get install libmysql-ruby libmysqlclient-dev sudo gem install mysql
5. install apache:
sudo gem install passenger sudo apt-get install apache2-threaded-dev libapr1-dev libaprutil1-dev sudo /var/lib/gems/1.8/bin/passenger-install-apache2-modulethen add the following to the apache configuration file:
LoadModule passenger_module /var/lib/gems/1.8/gems/passenger-2.2.5/ext/apache2/mod_passenger.so PassengerRoot /var/lib/gems/1.8/gems/passenger-2.2.5 PassengerRuby /usr/bin/ruby1.8
6. setup virtual host:
sudo emacs /etc/apache2/apache2.confadd the following:
NameVirtualHost *:80create file for ror.myhost.com:
susdo emacs /etc/apache2/sites-available/ror.myhost.comand add the following:
ServerName ror.myhost.com DocumentRoot /home/dan/Public/mynewapp/public
sudo emacs /etc/hostsand add:
127.0.0.1 ror.myhost.comthen restart apache2:
sudo a2enmod rewrite sudo a2ensite ror.myhost.com sudo /etc/init.d/apache2 restart
7. bring up firefox browser, point it to http://ror.myhost.com/, hola, it works! display ror welcom aboard page.
problem remains:
1. when restart apache2: it complains:
* Restarting web server apache2
apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName
[Wed Oct 28 16:05:12 2009] [warn] NameVirtualHost *:80 has no VirtualHosts
... waiting apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName
[Wed Oct 28 16:05:13 2009] [warn] NameVirtualHost *:80 has no VirtualHosts
[ OK ]
2. it's sth complaining about xmlsimple module, when create a new project using rails, it shows:
/usr/lib/ruby/1.8/xmlsimple.rb:275: warning: already initialized constant KNOWN_OPTIONS
/usr/lib/ruby/1.8/xmlsimple.rb:280: warning: already initialized constant DEF_KEY_ATTRIBUTES
/usr/lib/ruby/1.8/xmlsimple.rb:281: warning: already initialized constant DEF_ROOT_NAME
/usr/lib/ruby/1.8/xmlsimple.rb:282: warning: already initialized constant DEF_CONTENT_KEY
/usr/lib/ruby/1.8/xmlsimple.rb:283: warning: already initialized constant DEF_XML_DECLARATION
/usr/lib/ruby/1.8/xmlsimple.rb:284: warning: already initialized constant DEF_ANONYMOUS_TAG
/usr/lib/ruby/1.8/xmlsimple.rb:285: warning: already initialized constant DEF_FORCE_ARRAY
/usr/lib/ruby/1.8/xmlsimple.rb:286: warning: already initialized constant DEF_INDENTATION
/usr/lib/ruby/1.8/xmlsimple.rb:287: warning: already initialized constant DEF_KEY_TO_SYMBOL
-- To fix this one, reinstall rubygems and rails:
wget http://rubyforge.org/frs/download.php/57643/rubygems-1.3.5.tgz tar xvzf rubygems-1.3.5.tgz cd rubygems-1.3.5 sudo ruby setup.rbOnce it's done you can remove the .tgz file and erase the rubygems-1.3.4 directory too.then reinstall rubygems:
sudo gem install rails
Monday, October 26, 2009
Friday, October 23, 2009
PDT + Zend Debugger debugging
Debug as PHP script:
After installed PDT (using eclipse's update manager, not the all-in-one package) and Zend Server CE, tried to follow the PDT tutorial , section Getting Started->Basic Tutorials ->Working with the Debugger. however it threw me error message as:
“The debug session could not be started.
Please make sure that the debugger is properly configured as a php.ini directive”.
At first, thought it's Zend Server problem, tried to turn on Debugger in Zend Server, and added php.exe in the debug configuration tab in PDT, just wont' work. then thought it's php.ini's problem because no [Debugger] session ever found in php.ini under Zend folder or my local php folder at c:/php/.
Suspected that zend debugger was actually not installed in eclipse, from eclipse goto install new software tab, choose download site as 'http://downloads.zend.com/pdt' to download zend debugger. and tried debug code again, still failed with the same error message.
Googled around with no successful suggestion, got back to read PDT tutorial again, this time read section Tasks->Dubugging Files and Applications->Locally Debugging a PHP Script and found the first line looks interesting:
You must configure your PHP Executable through the PHP Executables Preferences page before you can debug locally.
Ok, went to PHP Excutables Preferences page.now i see what's wrong. went to eclispe, Window->Preferences->PHP->PHPExecutables, on the right side, selected 'PHP 5.2.10(CGI) (Workspace Default) | Zend Debugger | c:\Program Files\eclipse\plugins\org.zend.php.debug.debugger.win32.x86_5.2.26.v20090817....
debugged again, breeze, it worked!
Debug as PHP webpage:
Refer to PDT online tutorial, section 'Getting Started'->working with the Debugger:
Save both files and copy them to your server.
This one is tricky, it requires you to copy your php filed edited in PDT to your local web server doc foler, for apache2 it's htdocs folder, and make sure your apache server is up running. then you can locally debug the PHP web pages in PDT.
So PDT is independent of Zend Server CE or local php/apache settting up, it uses its own php/zend debuger plugin to do its local debugging, which arouse another question: what's the difference between WAMP server and Zend Server?
After installed PDT (using eclipse's update manager, not the all-in-one package) and Zend Server CE, tried to follow the PDT tutorial , section Getting Started->Basic Tutorials ->Working with the Debugger. however it threw me error message as:
“The debug session could not be started.
Please make sure that the debugger is properly configured as a php.ini directive”.
At first, thought it's Zend Server problem, tried to turn on Debugger in Zend Server, and added php.exe in the debug configuration tab in PDT, just wont' work. then thought it's php.ini's problem because no [Debugger] session ever found in php.ini under Zend folder or my local php folder at c:/php/.
Suspected that zend debugger was actually not installed in eclipse, from eclipse goto install new software tab, choose download site as 'http://downloads.zend.com/pdt' to download zend debugger. and tried debug code again, still failed with the same error message.
Googled around with no successful suggestion, got back to read PDT tutorial again, this time read section Tasks->Dubugging Files and Applications->Locally Debugging a PHP Script and found the first line looks interesting:
You must configure your PHP Executable through the PHP Executables Preferences page before you can debug locally.
Ok, went to PHP Excutables Preferences page.now i see what's wrong. went to eclispe, Window->Preferences->PHP->PHPExecutables, on the right side, selected 'PHP 5.2.10(CGI) (Workspace Default) | Zend Debugger | c:\Program Files\eclipse\plugins\org.zend.php.debug.debugger.win32.x86_5.2.26.v20090817....
debugged again, breeze, it worked!
Debug as PHP webpage:
Refer to PDT online tutorial, section 'Getting Started'->working with the Debugger:
Save both files and copy them to your server.
This one is tricky, it requires you to copy your php filed edited in PDT to your local web server doc foler, for apache2 it's htdocs folder, and make sure your apache server is up running. then you can locally debug the PHP web pages in PDT.
So PDT is independent of Zend Server CE or local php/apache settting up, it uses its own php/zend debuger plugin to do its local debugging, which arouse another question: what's the difference between WAMP server and Zend Server?
WA 2009 Day 2, Oct 9 - Olympic National Park
Took ferry from Edmonds to Kingston. First time to drive car to ferry, kind of excited. when we arrived at ferry, there were already long line of cars waiting at the ports. amazed how organized they were, no traffic, everyone followed the instructors: people get on the ferry first, then bikes and motors, then cars. it took times but moved smoothly.
WA reminds me of my city in many way, ferry is one of them, except that our ferry cross Yangzi River, theirs cross ocean. Hawaii also had SuperFerry, but before got the chance to take it, it stop operation. only remember all the fuzz it caused. Inside the ferry we found a sign saying:
New Tariff Begins: On Sunday, October 11, the newly-approved 2.5% far increase goes into effect. This saffects all fares.
Oct 11? that's the day we'll be in San Juan island...hmmm, not a good news. but at least it's not increased today.
arrived at Kingston, it's SR104, friend began driving, i got chance to relax and enjoy the view on the road. when bypassed a town, the colorful foliage impressed me, that's one of the reason i came during this season. The tree there are obviously more colorful than other places, so our guess is their residents choose them carefully to color their little town.
We missed the entrance to Hurricane Ridge twice, and finally got in. at some scenic piont we've already seen some nice view.
Hurricane Ridge is so different from Mount Rainier. the color is bright, and the ridge curve is so soft and gentle.
we had a simple lunch the Hurricane Ridge. the birds there were aggressive. friend bought chicken and chips and eating outside. birds just welcome themselves to the table, and without my friend's permission. took some chicken and flew away :)
next stop is Lake Cresent, that's the name of my friend's boss. it's just so big...., so blue and i guess so cold..
WA reminds me of my city in many way, ferry is one of them, except that our ferry cross Yangzi River, theirs cross ocean. Hawaii also had SuperFerry, but before got the chance to take it, it stop operation. only remember all the fuzz it caused. Inside the ferry we found a sign saying:
New Tariff Begins: On Sunday, October 11, the newly-approved 2.5% far increase goes into effect. This saffects all fares.
Oct 11? that's the day we'll be in San Juan island...hmmm, not a good news. but at least it's not increased today.
arrived at Kingston, it's SR104, friend began driving, i got chance to relax and enjoy the view on the road. when bypassed a town, the colorful foliage impressed me, that's one of the reason i came during this season. The tree there are obviously more colorful than other places, so our guess is their residents choose them carefully to color their little town.
We missed the entrance to Hurricane Ridge twice, and finally got in. at some scenic piont we've already seen some nice view.
Hurricane Ridge is so different from Mount Rainier. the color is bright, and the ridge curve is so soft and gentle.
next stop is Lake Cresent, that's the name of my friend's boss. it's just so big...., so blue and i guess so cold..
Thursday, October 22, 2009
Zend
have heard Zend for so long, and finally sit down to play around, here are some impression:
once installed, you can see the packages come with Zend: apache2, MySQL51, phpMyAdmin, ZendServer
once installed, you can see the packages come with Zend: apache2, MySQL51, phpMyAdmin, ZendServer
- so basically, it bundle apache, MySQL and phpMyAdmin together for you, then plus their own development, ZendServer. then they charge you for it! but apache, MySQL and phpMyAdmin all comes free. what if i need more tools, say MySQLQueryBrowser? i still have to install it on my own?
- also noticed that the php version is 5.2.10, but the latest version is 5.2.11. here is the quota from Zend server community edition's online help: If your PHP application is business-critical, you probably want to make sure that your PHP runtime environment is up to date. Zend Server Updater ensures that you have the latest versions of PHP, Zend Server Components and Extensions. This feature is available only in the commercial version of Zend Server. ...i think i know download PHP, just click the button.
- before install zend server, i already have apache installed, but now it's paused, in Apache Service Monitor i can see Apache2.2-Zend is running instead. also instead of the latest PHP 5.2.11 installed on c:\PHP, it used PHP in its own folder c:\Program Files\Zend\Server\bin. it doesn't even provide an option allow people to download PHP manually and point Zend to that php folder.
- one more thought, what if i want to use other webserver or other database, Zend would then get stuck.
Tuesday, October 20, 2009
WA 2009 Day 1, Oct 8 - Mt. Rainier
Picked up the car at enterprise, drove to Mt. Rainier.I didn't realize it's just such a long way. we left around 9:30am, only arrived there around 1pm. The whole driving is about 300 miles.
the national park is beautiful as i expected, love those tall and straight pines. there are so many nice spots to stop and take pictures, only that we didn't have enough time, still got some snapshot of some rivers, falls on the road. As driving along the winding road, we always got chance to see the Mt. Rainier, friend said that's the super model, the whole park is mainly about her, all wer were doing was just take picture of her from all different angle. hehe.
finally we arrived at Paradise(5400 ft). it's nice to see the different color of those trees. we had a short hike to get a closer look of Mt. Rainier. it says the plants are fragile, people are suggested to say on the trail. Though it's chilly, still saw a group of people wear shorts and shirts running down the trail. on our way we saw a mom deer and her baby enjoying their day at the meadow.
before we enter the park, we asked if Sunrise was still open, since it's usually closed during winter time. Lucky the answer was Yes. next stop is Sunrise(6400 ft). Bypassed lots of lookout, scenic point, we arrived at Sunrise at sunset. the information office was closed and raven flying around. not many cars there, we saw the sunset brush the mountains with her golden shine, everything was so peaceful. so cold out there. wish the hike finished soon so can go back to the warm car, but the same time wish this moment stop, frozen as the ice on the ground.
There were so many trails, friend took me to the one which is said to have a good view of a lake. but after couple of minutes' walking, friend realized it's a wrong trail, so we had to gave up, but got to see Rainier even closer. there was always clouds around Rainier like a wig. we waited hoping it went away so we can get a good shot of Rainier but failed. we ended up with Rainier with wig.
before went to WA, googled about Mt. Rainier Nation Park, there are four loops in the park, had planed a route to finish all routes, but only then realized how impossible it was. eventually we finished only one loop, the loop #1(147 miles).
driving back home was kind of scary, it's dark, it's so long. when got back to friends' place, could not believe i made it. this is definitely some experience don't get on hawaii island: driving for around 300 miles for about 9 hours.
Saturday, January 17, 2009
cannot send email from php
Problem:
setting editor used to work well, but all of sudden cannot sending emails...though no changes made to the files at all.....
Reason:
after some painful google, and finally remember this is not the first time met this problem. when setup editor on dyi, already got the problem.
here it goes:
go to php.ini file find the line
SMTP = localhost
in this situation , it's not localhost, we dont' run any mail server on local machine, we use a external mail server in our company.
Solution:
here is how to fix it:
to find out what mail server we actually use, go open outlook, from top menu, choose Tools->Options->Mail Setup(tab)->Data Files->E-mail(tab) on 'E-mail Accounts' window, find the entry on the table 'Miscrosoft Exchange Server', choose that entry then click 'Change' button on the top, it bring up 'Change Email Account' window, in that window it tells you what mail server you currently use. copy the mail server's name, and paste it back to php.ini file at the line 'SMTP = localhost', restart appache, then it works again!
setting editor used to work well, but all of sudden cannot sending emails...though no changes made to the files at all.....
Reason:
after some painful google, and finally remember this is not the first time met this problem. when setup editor on dyi, already got the problem.
here it goes:
go to php.ini file find the line
SMTP = localhost
in this situation , it's not localhost, we dont' run any mail server on local machine, we use a external mail server in our company.
Solution:
here is how to fix it:
to find out what mail server we actually use, go open outlook, from top menu, choose Tools->Options->Mail Setup(tab)->Data Files->E-mail(tab) on 'E-mail Accounts' window, find the entry on the table 'Miscrosoft Exchange Server', choose that entry then click 'Change' button on the top, it bring up 'Change Email Account' window, in that window it tells you what mail server you currently use. copy the mail server's name, and paste it back to php.ini file at the line 'SMTP = localhost', restart appache, then it works again!
cannot access apache on pc2 from pc1
Problem:
cannot access appache server on pc2 from pc1 though they are on the same network.
the appache server settings are the same on both pcs, but pc2 can access pc1 not the reverse.
Reason:
suspect it's the pc2's firewall making trouble, go to pc1's control panel->system firewall->exception, found 'appache' was included, then go to pc2's system firewall->exception, 'appache' was not included becuase pc2 was newly reinstalled.
Solution:
so go ahead added 'appache httpd' to the exception, make it available to anyone on the network, then it works!
cannot access appache server on pc2 from pc1 though they are on the same network.
the appache server settings are the same on both pcs, but pc2 can access pc1 not the reverse.
Reason:
suspect it's the pc2's firewall making trouble, go to pc1's control panel->system firewall->exception, found 'appache' was included, then go to pc2's system firewall->exception, 'appache' was not included becuase pc2 was newly reinstalled.
Solution:
so go ahead added 'appache httpd' to the exception, make it available to anyone on the network, then it works!
Saturday, January 10, 2009
isolation between web 2.0 techonologies
the problem i got is chart wont' work well in tab view when using gwt-ext. after some painful searching, found out gwt-ext actually use ext engine to deal with yui' chart library. yui already admit it's a bug but claim it's fixed in release 2.6.0. the yui library version used by gwt-ext is 2.4.1. that's the problem. tried to copy the 2.6.0 version of chart files from yui to gwt-ext wont' work. then notice gwt-ext only support ext 2.0.2 because of the license issue. went to ext js website and download the version 2.2 but found out it still use yui 2.4.1 version...there is no freeking way to fix that get rid of it in gwt-ext then......
have to admit web 2.0 has a cool concept, but just the techonologies to support web2.0 are all on their isolated island, wont' talk to each other friendly...maybe the best way is back to javascript+php.....
have to admit web 2.0 has a cool concept, but just the techonologies to support web2.0 are all on their isolated island, wont' talk to each other friendly...maybe the best way is back to javascript+php.....
Tuesday, January 6, 2009
gwt-ext/php/mysql
there are three ways to get data from mysql in gwt-ext:
1. requestion JSON using HTTP
http://code.google.com/docreader/#p=google-web-toolkit-doc-1-5&s=google-web-toolkit-doc-1-5&t=GettingStartedJSON
2. gwt-RPC, which you have create bouch of code, which looks so weird and ugly to me, to connect to MySQL server, create SQL query and return the data to gwt-ext to populat whatever widget you want;
http://code.google.com/docreader/#p=google-web-toolkit-doc-1-5&s=google-web-toolkit-doc-1-5&t=DevGuideHttpRequests
3. use php file, let php go connect to MySQL and return JSON data(or xml data).
obviously 3 is way more simpler and cleaner, but hard to get it work in gwt-ext. tried to put the php file in 'public/data' folder, and in java code, call the following:
new HttpProxy("data/getData.php");
it return php file itself instead of JSON data.... maybe should try the following:
new HttpProxy("data/getData.php", Connection.GET)
???
1. requestion JSON using HTTP
http://code.google.com/docreader/#p=google-web-toolkit-doc-1-5&s=google-web-toolkit-doc-1-5&t=GettingStartedJSON
2. gwt-RPC, which you have create bouch of code, which looks so weird and ugly to me, to connect to MySQL server, create SQL query and return the data to gwt-ext to populat whatever widget you want;
http://code.google.com/docreader/#p=google-web-toolkit-doc-1-5&s=google-web-toolkit-doc-1-5&t=DevGuideHttpRequests
3. use php file, let php go connect to MySQL and return JSON data(or xml data).
obviously 3 is way more simpler and cleaner, but hard to get it work in gwt-ext. tried to put the php file in 'public/data' folder, and in java code, call the following:
new HttpProxy("data/getData.php");
it return php file itself instead of JSON data.... maybe should try the following:
new HttpProxy("data/getData.php", Connection.GET)
???
Subscribe to:
Posts (Atom)