All to common of a conversation.
SHOCM
Open Source, Cloud, Development, Scotch, Baseball, and Family
Category Archives: Development
‘report_activate_error’: RubyGem version error
So from time to time I will post small things to my blog that I just want to keep track of or remember how I did something. This is one of those post. I should prefix this post to anyone who happens to come across it and read it, I am by no means a “Rails Developer” and as a matter of fact, I ran into this problem working through a “How to” books.
The issue
I am running OSX 10.6.2 and although I had Ruby on Rails working on it at one time, some how, some where it broke. Now there is nothing more frustrating to a n00b who is trying to work through a tutorial on how to learn a new programming language and not being able to get past the first chapter because something about the base install of the programming language that you don’t know anything about and you’re trying to learn, wont work.
The Actual Error
When I try to create my first controller this is what happens
ruby script/generate controller main welcome
And this is what the system kicked out to me
/Library/Ruby/Gems/1.8/gems/rails-2.3.5/lib/initializer.rb:271:in `require_frameworks’: RubyGem version error: rack(1.0.0 not ~> 1.0.1) (RuntimeError)
from /Library/Ruby/Gems/1.8/gems/rails-2.3.5/lib/initializer.rb:134:in `process’
from /Library/Ruby/Gems/1.8/gems/rails-2.3.5/lib/initializer.rb:113:in `send’
from /Library/Ruby/Gems/1.8/gems/rails-2.3.5/lib/initializer.rb:113:in `run’
from /Users/eric/Dropbox/Code/Rails/r4music1/config/environment.rb:9
from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `gem_original_require’
from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `require’
from /Library/Ruby/Gems/1.8/gems/rails-2.3.5/lib/commands/generate.rb:1
from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `gem_original_require’
from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `require’
from script/generate:3
sudo gem uninstall rack
sudo gem uninstall rackRemove executables:rackupin addition to the gem? [Yn] YRemoving rackupYou have requested to uninstall the gem:rack-1.0.0actionpack-2.3.3 depends on [rack (~> 1.0.0)]actionpack-2.3.5 depends on [rack (~> 1.0.0)]If you remove this gems, one or more dependencies will not be met.Continue with Uninstall? [Yn] Y
sudo rm -rf /Library/Ruby/Gems/1.8/gems/rack-1.0.1/
sudo gem install -v=2.3.5 railssudo gem install rack
Posted via web from shocm
Microsoft and Zend
More for my geek friends. This is old news but if you haven’t heard.
Microsoft and Zend Technologies Announce Technical Collaboration to Improve Interoperability of PHP on the Windows Server Platform / 10 / 2006 / Announcements / Zend News / Company / Zend.com
REDMOND, Wash., and CUPERTINO, Calif. — Oct. 31, 2006 — Microsoft Corp. and Zend Technologies Inc. today announced a technical collaboration to enhance the experience of running the PHP scripting language on Windows Server® 2003. The parties expect to extend the collaboration to the next version of Windows Server, code-named “Longhorn.†The resulting technology enhancements and ongoing interaction with the PHP community is expected to enable customers to take advantage of the Windows Server platform. The cooperative effort seeks to provide customers with richer functionality and better integration, resulting in improved performance and increased reliability.
Vi for programmers
This is a great article that shows you how to really harness some of the power of VIM. I snagged it from Builder.com.
It was a multiple part article so this is going to be kind of long but really filled with a lot of great information.
If you’re a developer working on a UNIX/Linux platform, you’ve already encountered vi. Vi users fall into one of two categories: those who hate it and continually curse its finger-twisting key combinations and hard-to-remember commands, and those who love the flexibility and power it offers. For a long time, I was in the former category. However, continuous usage has led to a gradual appreciation for the speed and power under the cryptic interface, and I’ve since learnt a bunch of shortcuts and key combinations that ease the task of writing code in the editor. This article discusses my personal top ten features. Before proceeding, ensure that you have a copy of ViM (that’s Vi iMproved) installed and working on your system. You can download both binaries and sources from vim.org.
Backing Up and Restoring Your MySQL Database
Do you need to change your web host or switch your database server? This is probably the only time when you really think of backing up your MySQL data. If you’ve got a website with a database or your custom database running for your applications, it is imperative that you make regular backups of the database. In this article, I will outline two easy ways of backing up and restoring databases in MySQL.
The easiest way to backup your database would be to telnet to the your database server machine and use the mysqldump command to dump your whole database to a backup file. If you do not have telnet or shell access to your server, don’t worry about it; I shall outline a method of doing so using the PHPMyAdmin web interface, which you can setup on any web server which executes PHP scripts.
Playing with mysqldump
If you have either a shell or telnet access to your database server, you can backup the database using mysqldump. By default, the output of the command will dump the contents of the database in SQL statements to your console. This output can then be piped or redirected to any location you want. If you plan to backup your database, you can pipe the output to a sql file, which will contain the SQL statements to recreate and populate the database tables when you wish to restore your database. There are more adventurous ways to use the output of mysqldump.
A Simple Database Backup:
You can use mysqldump to create a simple backup of your database using the following syntax.
mysqldump -u [username] -p [password] [databasename]> [backupfile.sql]
[username] – this is your database username
[password] – this is the password for your database
[databasename] – the name of your database
[backupfile.sql] – the file to which the backup should be written.
The resultant dump file will contain all the SQL statements needed to create the table and populate the table in a new database server. To backup your database ‘Customers’ with the username ‘sadmin’ and password ‘pass21′ to a file custback.sql, you would issue the command:
mysqldump -u sadmin -p pass21 Customers> custback.sql
Configuring Apache to use a .htaccess file
Just a good step by step on how to configure Apache to use a .htaccess file. I rarely ever use this method except in testing so I always forget.
First, get your web administrator to enable your use of .htaccess files. This requires a stanza in ServerRoot/conf/access.conf like this:
AllowOverride AuthConfig
where /home/webber is replaced by your home directory. Without this, the usual default is AllowOverride None, which means that .htaccess files are ignored. The above stanza allows .htaccess control in all subdirectories of the specified Directory.
Set up a reasonably secure directory for the password (and optionally the group) files. This directory should not be in the web document tree! If it is, someone who can learn or guess the URL of the password file can fetch it and try to crack the passwords. (This refers to visitors from elsewhere on the Internet. There is no simple way to prevent users with accounts on the web server host itself from snooping in the password file, so we will have to settle for security by obscurity and trust them not to try too hard.)
Let us name this directory http-etc by analogy to the Unix /etc directory where the system passwd and group files reside. Place it in your home directory (not in public_html) so that it is outside URL space. Give it permission 701 = rwx—–x meaning you the owner can do anything, and the web server, running as the ordinary user apache, can access the directory but cannot list it (so it must know the file names in advance).1
Backup files with tar
[NOTE]
I don’t remember where I got this article from but it is full of some good information
[/NOTE]
TAR is the Unix Tape ARchive utility. It can be used to either store data on a streaming tape device like a DAT drive, or store files in what is commonly called a tarball file- somewhat like a pkzip file, only compression is optional.
[The basics]
In these examples, I will use the following file structure: a top level directory called DIR1 containing the files picture.jpg, document.doc and database.db.
DIR1/
DIR1/picture.jpg
DIR1/document.doc
DIR1/database.db
[Creating a tarball]
If we were in the directory DIR1 and wanted to backup all the files to a tarball called backup.tar, we could issue this command:
$ tar cvf backup.tar .
./
picture.jpg
doucment.doc
database.db
tar: backup.tar is the archive; not dumped
Note:
c=create (an archive)
v=verbose (just because)
f=filename (the name of our tarball)
.=current directory (what’s going to be backed up)
Also worth mentioning is that by default tar is recursive- meaning it will back up all files and subdirectories recursively unless you otherwise specify with the n flag (non-recursive)
[Displaying the Contents of a Tarball]
The current directory will now contain a file called backup.tar. To display the contents of the tarball file, we could issue this command:
$ tar tvf backup.tar
drwxr-xr-x root/gci 0 Jun 29 10:10 ./
-rw-r–r– root/gci 1 Jun 29 10:10 picture.jpg
-rw-r–r– root/gci 1 Jun 29 10:10 document.doc
-rw-r–r– root/gci 1 Jun 29 10:10 databse.db
Get the whole story
Learning to Use Regular Expressions by Example
This site I’m working on relies heavily on user input through forms, and all that data needs to be checked before being sent a database. I knew PHP3′s regular expression functions should solve my problem, but I didn’t know how to form the regular expressions in the first place. What I needed were some sample strings–obviously the first places I looked were the PHP3 manual and the POSIX 1002.3 specification, but they don’t help much in the way of exemplifying.
Adding to that, I had a really hard time finding good literature on the Web about the subject. I eventually got to know how to do it, mostly through experimenting, and seeing there wasn’t much to it, I decided to write down this straight-out introduction to the syntax and a step-by-step on building regular expressions to validate money and e-mail address strings. I just hope it manages to clear the fog around the subject for all you fellow programmers.