Installing mysql gem with MAMP already installed on Mac Os
export ARCHFLAGS=”-arch i386 -arch x86_64″ ;sudo gem install –no-rdoc –no-ri -v=2.7 mysql — –with-mysql-dir=/Applications/MAMP/Library/bin/mysql –with-mysql-config=/Applications/MAMP/Library/bin/mysql_config
Install NetBeans on Ubuntu 8.10
- Setup the Source Repository
- deb http://za.archive.ubuntu.com/ubuntu/ intrepid universe
- deb-src http://za.archive.ubuntu.com/ubuntu/ intrepid universe
- deb http://za.archive.ubuntu.com/ubuntu/ intrepid-updates universe
- deb-src http://za.archive.ubuntu.com/ubuntu/ intrepid-updates universe
- deb http://za.archive.ubuntu.com/ubuntu/ intrepid multiverse
- deb-src http://za.archive.ubuntu.com/ubuntu/ intrepid multiverse
- deb http://za.archive.ubuntu.com/ubuntu/ intrepid-updates multiverse
- deb-src http://za.archive.ubuntu.com/ubuntu/ intrepid-updates multiverse
- Install Required Software
- Install Netbeans IDE
To install NetBeans via the Ubuntu Package Manager, ensure that the correct repository is listed in the source listing file. NetBeans is found inf the universe repository and Java is found in the multiverse repository.
Code:
sudo gedit /etc/apt/sources.list |
Ensure that the following sources are added to the configuration file:
After the configuration file is updated, the package repository needs to updated with the following command:
Code:
sudo apt-get update |
To install Java version 6, the following command needs to be executed:
Code:
sudo apt-get install sun-java6-jdk sun-java6-plugin |
To install NetBeans, the following command needs to be executed. The package manager does not necessarily install the latest version of NetBeans. The package manager will install the latest NetBeans that is supported by Ubuntu.
Code:
sudo apt-get install netbeans
Source : http://www.javadesign.info/SystemsHardware/OS/Ubuntu/install-netbeans-on-ubuntu
sudo apt-get install netbeans
|
Installing readline for ruby – for ubuntu
apt-get install libreadline5 libreadline5-dev apt-get install libncurses5 libncurses5-dev cd /usr/src/ruby-1.8.6-p368/ext/readline/ ruby extconf.rb sudo make sudo make install done..
Configuring Syslog for Rails
I was working on a Rails application recently that required the logs to be sent to remote log server. This blog is just a summary of the steps to get it working. I used Rails 2.0 and the development was done on Ubuntu.
The first thing was to get syslog-ng. Its more advanced than syslogd.
sudo apt-get install syslog-ng
The next step was to get the SysLogLogger tool to send the logs to syslog instead of a file. Go to the vendor directory of your application and get SysLogLogger using the following command.
curl http://rubyforge.org/frs/download.php/20520/SyslogLogger-1.4.0.tgz
-L | tar -zxvv
Assuming that you are working in the development environment , add this to the start of the development.rb file in the configuration directory
$:.unshift File.join(RAILS_ROOT, "vendor", "SyslogLogger-1.4.0", "lib")
require 'syslog_logger'
RAILS_DEFAULT_LOGGER = SyslogLogger.new(program_name = 'my-application')
config.logger = RAILS_DEFAULT_LOGGER
Locate the syslog.conf file in the etc directory and add these lines.
!my-rails-application
user.* /var/log/development.log
What this does is gets the logs that are sent to syslog from the rails application and writes it to the development.log file in /var/log/ dir
To get the changes working, restart the syslog service on Ubuntu by running the following command
sudo /etc/init.d/sysklogd restart
To send the logs to a remote log server instead of the log file use this in the syslog.conf file instead
user.* @address of remote log server
The log server should be configured to accept logs from remote systems. The syslogd file in the remote log server needs to be changed to show the following for this purpose
SYSLOGD="-r"
The syslogd file is located in the etc/default dir in Ubuntu. Since I had the log server configured already, I did not need to change the configuration. Please add comments on this post in case something is missing.
The log files can be rotated on a periodic basis (or depending on size) by configuring the logrotate.conf file in the etc dir.
See man logrotate for details.
Installing Openssl on Ubuntu
If you have tried to install Mechanize or any gem that requires openssl on Ubuntu or Debian, you may have encountered the following error…
LoadError: no such file to load—openssl
despite the fact that you have installed openssl with “gem install libopenssl-ruby”.
Thanks to this thread, I found out that in order to install openssl, you have to tell ruby how to compile the openssl extension, like this…
cd /ruby-1.8.4/ext/openssl
ruby extconf.rb
make
Source: http://www.jessirae.com/blog/articles/2007/03/11/installing-openssl-on-ubuntu
make install
Remote Resolution of Git Conflicts
You are attempting to push when you experience a conflict:
[ksedgwic@lap2 bonsai-wiki]$ git push To ssh://ikiwiki@git.bonsai.com/~/public_git/bonsai-wiki.git ! [rejected] master -> master (non-fast forward) error: failed to push some refs to 'ssh://ikiwiki@git.bonsai.com/~/public_git/bonsai-wiki.git'
First, see if the conflict can be automatically resolved:
[ksedgwic@lap2 bonsai-wiki]$ git pull remote: Counting objects: 9, done. remote: Compressing objects: 100% (5/5), done. remote: Total 5 (delta 3), reused 0 (delta 0) Unpacking objects: 100% (5/5), done. From ssh://ikiwiki@git.bonsai.com/~/public_git/bonsai-wiki fe30702..b52b62c master -> origin/master Auto-merged howtos/vcs/git_conflict.mdwn CONFLICT (content): Merge conflict in howtos/vcs/git_conflict.mdwn Automatic merge failed; fix conflicts and then commit the result.
Git status shows that your state is conflicted:
[ksedgwic@lap2 bonsai-wiki]$ git status howtos/vcs/git_conflict.mdwn: needs merge # On branch master # Your branch and 'origin/master' have diverged, # and have 1 and 1 different commit(s) each, respectively. # # Changed but not updated: # (use "git add ..." to update what will be committed) # # unmerged: howtos/vcs/git_conflict.mdwn # no changes added to commit (use "git add" and/or "git commit -a")
IMPORTANT – If you can resolve the conflict do so (normal procedure), this procedure presumes you wish to write the conflicting updates to a branch.
Reset your tree to just your unmerged updates:
[ksedgwic@lap2 vcs]$ git reset --hard HEAD HEAD is now at e1497e3 Changed title.
Create a branch, use a name which suggests a conflict:
[ksedgwic@lap2 vcs]$ git branch master-conflict-20090125 [ksedgwic@lap2 vcs]$ git branch * master master-conflict-20090125
Reset your tree to the prior revision:
[ksedgwic@lap2 vcs]$ git reset --hard HEAD^ HEAD is now at fe30702 started test for creating dual headed branches upon push
Pull the other persons changes:
[ksedgwic@lap2 vcs]$ git pull
Switch back to your branch:
[ksedgwic@lap2 vcs]$ git checkout master-conflict-20090125 Switched to branch "master-conflict-20090125"
Push your conflict branch back to the repoistory:
[ksedgwic@lap2 vcs]$ git push origin master-conflict-20090125 Counting objects: 9, done. Compressing objects: 100% (5/5), done. Writing objects: 100% (5/5), 406 bytes, done. Total 5 (delta 3), reused 0 (delta 0) To ssh://ikiwiki@git.bonsai.com/~/public_git/bonsai-wiki.git * [new branch] master-conflict-20090125 -> master-conflict-20090125 remote: Counting objects: 9, done. remote: Compressing objects: 100% (5/5), done. remote: Total 5 (delta 3), reused 0 (delta 0) From /home/ikiwiki/public_git/bonsai-wiki * [new branch] master-conflict-20090125 -> origin/master-conflict-20090125
complete reference : http://www.bonsai.com/wiki/howtos/vcs/git_remote_resolve/
Ruby on Rails simple tutorials
Dave Matthews Band
Simple CSS Menu
This is just for future reference ;=)
<html>
<head>
<title>CSS based drop-down menu</title>
<style type="text/css">
ul {
font-family: Arial, Verdana;
font-size: 14px;
margin: 0;
padding: 0;
list-style: none;
}
ul li {
display: block;
position: relative;
float: left;
}
li ul { display: none; }
ul li a {
display: block;
text-decoration: none;
color: #ffffff;
border-top: 1px solid #ffffff;
padding: 5px 15px 5px 15px;
background: #2C5463;
margin-left: 1px;
white-space: nowrap;
}
ul li a:hover { background: #617F8A; }
li:hover ul {
display: block;
position: absolute;
}
li:hover li {
float: none;
font-size: 11px;
}
li:hover a { background: #617F8A; }
li:hover li a:hover { background: #95A9B1; }
</style>
</head>
<body>
<ul id="menu">
<li><a href="">Home</a></li>
<li><a href="">About</a>
<ul>
<li><a href="">The Team</a></li>
<li><a href="">History</a></li>
<li><a href="">Vision</a></li>
</ul>
</li>
<li><a href="">Products</a>
<ul>
<li><a href="">Cozy Couch</a></li>
<li><a href="">Great Table</a></li>
<li><a href="">Small Chair</a></li>
<li><a href="">Shiny Shelf</a></li>
<li><a href="">Invisible Nothing</a></li>
</ul>
</li>
<li><a href="">Contact</a>
<ul>
<li><a href="">Online</a></li>
<li><a href="">Right Here</a></li>
<li><a href="">Somewhere Else</a></li>
</ul>
</li>
</ul>
</body>
</html>
https://www.servage.net/blog/2009/03/20/create-a-cool-css-based-drop-down-menu/
enjoy :-p
How To Deploy Your Rails Application With Phusion Passenger at Site5.com
With the addition of Phusion Passenger to all our servers, deploying Ruby on Rails applications is now much easier. Phusion Passenger is now the preferred way to use Rails at Site5, but FastCGI is still provided. For most users, adding Phusion is as simple as creating a blank .htaccess file in your application “public” directory with the following lines:
PassengerEnabled on PassengerAppRoot /path/to/your/application/directory
As an example, if your application root directory is located at “/home/username/my_apps/forum” then your PassengerAppRoot line would look like this:
PassengerAppRoot /home/username/my_apps/forum
It is very important that you put the path to your application root directory, not the path to the “public” directory within your application directory.
If you were recently using FastCGI, it is important that you remove the previous FastCGI mod_rewrite lines in your .htaccess file as they will interfere with the Passenger configuration. The FastCGI lines will look something like this:
RewriteRule ^$ index.html [QSA]
RewriteRule ^([^.]+)$ $1.html [QSA]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ dispatch.cgi [QSA,L]
Deploying To A Sub Directory With Phusion Passenger
NOTICE: The section below involving modifications to the environment.rb file are not needed if you are deploying to a subdomain (rails.domain.tld) or a main domain (domain.tld). It is only needed if you are deploying to a sub-directory (domain.tld/subdirectory/).
You will need to add one line to the environment.rb file for your application (if you have not already). This file is found in the “config” directory in your application directory. Here is the line you need to add:
config.action_controller.relative_url_root = "/approot"
The “approot” line should be the name of the root of your application directory. This line must be added within the config block or it will not work correctly. The start of the config block will look like this:
Rails::Initializer.run do |config|
The “approot” part would be what you want to use as the root URL of your application. For example, let’s say your application resides in “/home/user/mygreatapp/” and you want it to be accessible via http://yourdomain.tld/approot/.
You would then make a symbolic link in your public_html directory (/home/user/public_html/) called “approot” that would point to the “public” directory in your application. The symbolic link creation would look like this:
ln -s /home/user/mygreatapp/public /home/user/public_html/approot
So, now that you have added the necessary lines to your .htaccess file and modified your application accordingly, you should now be up and running with Phusion Passenger.
Routing Errors & 404 Code
If you receive a 404 “page doesn’t exist” error when accessing your application, this is most likely due to your routes not being configured properly (config/routes.rb file). The Rails log file is usually very informative and will tell you why your application is not working correctly. Check the log file in the “log” directory for more information. The routing error will probably look something like this:ActionController::RoutingError (No route matches "/approot/" with {:method=>:get}):If you receive an error similar to that, you will need to adjust your routes accordingly to
accommodate the base URL. You can get a good overview of your routes by running “rake routes”
from anywhere within your application directory.
Restarting Your Application
Since adding Phusion, we have received quite a few requests regarding the best way to restart
a Rails application. Phusion has provided a very simple mechanism for accomplishing this.
All you need to do is create or modify a “restart.txt” file within the “tmp” directory of your
application. If your application is located at “/home/user/mygreatapp/” you would simply run:touch /home/user/mygreatapp/tmp/restart.txtSource: http://wiki.site5.com/Scripting_and_Development_Guide#Ruby_on_Rails

Recent Comments