Archive for May, 2009

Check the variable an integer

Check the variable is a integer or others.

#!/bin/bash

read Nau
if [ “${Nau//[^0-9]/}” == “$Nau” ]; then
echo “$Nau Is a number”;
else
echo “$Nau is not a number”
fi

,

No Comments

Install versioned_urls plugin

Install versioned_urls plugin via
script/plugin install http://svn.lingr.com/plugins/versioned_urls

Add appropriate rewriting and cache-header-pushing configuration to your web servers, e.g., for lightty:
url.rewrite-once = ( “^/(.*.(css|js|gif|png|jpg)).v[0-9.]+$” => “/$1” )
expire.url = ( “/stylesheets/” => “access 10 years” ,
“/javascripts/” => “access 10 years”,
“/images/” => “access 10 years” )

More details
http://blog.dannyburkes.com/2006/11/2/versioned-urls-for-rails/

, ,

No Comments

we are back

we are back, for some reason, the account is locked.
Earn more money, we can setup our own server.

my http://www.twitter.com/edyliu

make a backup firstly!

No Comments

Problem: Upgrading from a previous version

Problem:
Upgrading from a previous version of Rails to the latest 2.3.2, you get an error:

NameError: uninitialized constant ApplicationController

both in the web browser and in console.

Solution:
Since the introduction of Rails 2.3 the application.rb file has been renamed to application_controller.rb.
So in order to solve the problem just rename your file application.rb to application_controller.rb.

,

No Comments

I read the following book this weekend

I read the following book this weekend

and do the exam it mentions, but there is a problem.

Q: NoMethodError (undefined method `scaffold’ for AdminController:Class):
A: my rails version is 2.3.2
the “scaffold” method was removed in Rails 2.0.
in order to resolve it , just run the following commands in the app directory
script/plugin install scaffolding
script/plugin install svn://errtheblog.com/svn/plugins/will_paginate

when u want to practice with the examples, just install the lower version
gem install rails –version 1.2.6 –include-dependencies

,

No Comments

Install my wireless card driver

I have just install my wireless card driver ( bcm4312) on opensuse 11.1 (64bit)
my laptop is dell 1310

I use the most simple way
sudo zypper ar http://packman.mirrors.skynet.be/pub/packman/suse/11.1/ pack_man
sudo zypper install broadcom-wl
sudo reboot
the wireless card works.

install flash player x86_64 for firefox
http://labs.adobe.com/downloads/flashplayer10.html
sudo mkdir /usr/lib64/firefox/plugins
sudo cp libflashplayer.so /usr/lib64/firefox/plugins/

ref links
http://en.opensuse.org/HCL/Network_Adapters_(Wireless)/Broadcom_BCM43xx

, ,

1 Comment

I am sorry to mongrel !

I am sorry to mongrel ! What are we focuse on, Mongrel ?

Mongrel V.S. Passenger

just forget about Mongrel, and to know why ?
Read the rest of this entry »

,

No Comments

Besides the Mongrel_Rail for RoR app

Besides the Mongrel_Rail for RoR app, I found a new server modules:
Phusion Passenger
It is easy to deploy with Apache
http://www.modrails.com/

I have tried it, it works well, maybe more test on it in the future.

my ruby.conf for my app in Apache

“<"VirtualHost *:80">”
ServerName myip
DocumentRoot /path/to/app/public/ # the RoR app’s public directory

AddOutputFilterByType DEFLATE text/html text/plain text/xml application/xml application/xhtml+xml text/javascript text/css application/x-javascript
BrowserMatch ^Mozilla/4 gzip-only-text/html
BrowserMatch ^Mozilla/4.0[678] no-gzip
BrowserMatch bMSIE !no-gzip !gzip-only-text/html

ExpiresActive On
ExpiresByType image/gif A2592000
ExpiresByType application/x-javascript A2592000
ExpiresByType text/css A2592000
ExpiresByType text/html M604800
“<"/VirtualHost">“

, ,

No Comments

Install Ruby On Rails on MacOS as common user

Install Ruby On Rails on MacOS ( not as admin user )

1. install ruby

get the ruby sources from the ruby-lang.org, we take ruby-1.8.6-p368.tar.bz2 for e.g.
tar xvf ruby-1.8.6-p368.tar.bz2 && cd ruby-1.8.6-p368
./configure –prefix=/User/yourname/ruby && make && make install

2.set the enviorment
edit the ~/.bash_profile, change the PATH=/User/yourname/ruby/bin:$PATH
source ~/.bash_profile and u can check by command: ruby -v

3. install gems
get the gems from rubyforge.org , we take rubygems-1.3.3.tgz for e.g.
tar xvf rubygems-1.3.3.tgz && cd rubygems
ruby setup.rb
Read the rest of this entry »

,

No Comments

I will focus on Ruby on Rails this one week

I will focus on Ruby on Rails this one week or two …(server side of course)

get some links to remember:



http://haproxy.1wt.eu/
Rails Performance Testing Tools
http://blog.fiveruns.com/2008/10/30/benchmarking-rails

good articles to scaling the ruby apps.
http://poocs.net/2006/3/13/the-adventures-of-scaling-stage-1
http://poocs.net/articles/2006/03/20/the-adventures-of-scaling-stage-2
http://poocs.net/articles/2006/03/27/the-adventures-of-scaling-stage-3
http://poocs.net/articles/2006/04/03/the-adventures-of-scaling-stage-4

Memcached Integration in Rails
http://www.linuxjournal.com/article/10300

No Comments