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:
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-module
then 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.conf
add the following:
NameVirtualHost *:80
create file for ror.myhost.com:
susdo emacs /etc/apache2/sites-available/ror.myhost.com
and add the following:

ServerName ror.myhost.com
DocumentRoot /home/dan/Public/mynewapp/public
sudo emacs /etc/hosts
and add:
127.0.0.1  ror.myhost.com
then 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.rb
Once 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

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?

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..



 

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
  • 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.