This blog is moved to webonrails.com

Greetings

I have moved this blog to http://webonrails.com . I will continue posting at http://webonrails.com, not on http://webonrails.wordpress.com.

Kindly update your book marks to http://webonrails.com

and http://webonrails.com/feed .

I am really very sorry for inconvenience.

December 2, 2006 at 7:15 pm 6 comments

Ajax based drag drop and sortable tree for Rails

My friend sur wrote and shares his code for Ajax based drag drop sortable tree for rails. He is also trying to pluginize this, and soon it will be publicly available. Find more detail here.

November 25, 2006 at 1:06 pm 5 comments

Uploading files using AJAX

There is no way to upload files using AJAX. How Gmail does it then? Well, the answer is using <iframe>. Here is a post that describe this technique in detail. Infact we are using this technique from months, obviously inspired by Gmail. ;-)

update: Technically speaking, it’s not Ajax. Just an iframe hack. You are absolutly right Pratik.

November 20, 2006 at 6:26 pm 8 comments

Cheat Sheet

  • Capistrano1.2.0 cheat sheet here.
  • REST cheat sheet here.
  • Rails cheat sheet here.
  • Rails testing cheat sheet here.

November 10, 2006 at 7:13 pm Leave a comment

Deprecated Method in ActionView::Helpers::PrototypeHelper

Prototype helper method update_element_function is deprecated now, Please use RJS instead.

November 9, 2006 at 1:40 pm Leave a comment

Installing subversion from pre-compiled packages or source code

What is subversion(svn):

Subversion is an open source version control system used for keep track of change to source code. Subversion manages files and directories over time an increments revision made to the file system. A tree of file is placed into a central repository. The repository is much like an ordinary file server, except that it remembers every change ever made to your files and directories. This allows you to recover older version of your date or examine the history of how your data changed.

Subversion can access its repository across networks, which allows it to be used by people on different computers. At some level, the ability for various people to modify and manage the same set of data from their respective locations fosters collaboration.

Installation:

There are two types of installation:

  1. Installation from pre-compiled packages
  2. Installation from source code

Installation from packages:

For RedHat Linux(or other Linux distributions which supports RPM) download subversion RPM package and install. See manual of rpm utility for installation.

For Debian Linux issue apt-get install subversion and by confirming the installation you are done. I also recommend to install subversion-tools by issuing apt-get install subversion-tools.

Installation from source:

Installation from source code is slightly tricky. First of all download latest version of subversion code from http://subversion.tigris.org.

Now extract source to your preferred directory (lets assume /home/testuser/svncode/), and issue the following command in sequence after switching to svncode directory:



  • ./configure
  • make
  • make install

./configure will create Makefile

make makes Subversion form the just-created Makefile
make install install Subversion if make is successfullyAnd you are done….

Issue svnadmin create /home/testuser/repository to create a new repository, this should create a directory structure like:

drwxrwxrwx   7 root root 4096 2006-11-07 17:18 .
drwxrwxrwx  14 root root 4096 2006-11-07 17:18 ..
drwxrwxrwx   2 root root 4096 2006-11-07 17:18 con drwxrwxrwx   2 root root 4096 2006-11-07 17:18 dav drwxrwxrwx   2 root root 4096 2006-11-07 17:18 db
-rwxrwxrwx   1 root root    2 2006-11-07 17:18 format
drwxrwxrwx   2 root root 4096 2006-11-07 17:18 hooks
drwxrwxrwx   2 root root 4096 2006-11-07 17:18 locks
-rwxrwxrwx   1 root root  379 2006-11-07 17:18 README.txt

Now we need to allow remote access to it so that users can import their files. By editing conf/svnserve.conf we can set user accounts, permissions.

Initially svnserve.conf looks like:

### This file controls the configuration of the svnserve daemon, if you
### use it to allow access to this repository.  (If you only allow
### access through http: and/or file: URLs, then this file is
### irrelevant.)
### Visit http://subversion.tigris.org/ for more information.
### [general]
### These options control access to the repository for unauthenticated
### and authenticated users.  Valid values are "write", "read",
### and "none".  The sample settings below are the defaults.
### anon-access = write
### auth-access = write
### The password-db option controls the location of the password
### database file.  Unless you specify a path starting with a /,
### the file's location is relative to the conf directory.
### The format of the password database is similar to this file.
### It contains one section labelled [users]. The name and
### password for each user follow, one account per line. The
### format is
### USERNAME = PASSWORD
### Please note that both the user name and password are case
### sensitive. There is no default for the password file.
### password-db = passwd ### This option specifies the authentication realm of the repository. ### If two repositories have the same authentication realm, they should ### have the same password database, and vice versa.  The default realm ### is repository's uuid.
### realm = My First Repository

Uncomment line containing [general], anon-access, auth-access and password-db with suitable permissions. Also add file named passwd parallel to svnserve.conf containing

[users]SVNUSERNAME = SVNUSERPASSOWRD

You can add as many users you want. Now you are done with user accounts and permissions.

Next you have to start the svnserver by issuing svnserve -d -r /home/testuser/repository.

Now you are ready with your subversion server, you can access your repository from svn://yourdomain.com/repository/

On some systems (like Debian GNU/Linux) this requires to write an init script so that the server starts up every time the system is rebooted. This could be done by creating a file called svnserve in the /etc/init.d directory, and then editing it to look like the following example file:

#! /bin/sh
PATH=/sbin:/bin:/usr/sbin:/usr/bin
DAEMON=/usr/bin/svnserve NAME=svnserve DESC="SVN Repository Server Daemon"
test -x $DAEMON || exit 0
OPTIONS="-d -r /cvs/src"
# Get lsb functions
#. /lib/lsb/init-functions
. /etc/default/rcS start() {        echo "Starting $DESC... "
       #       echo "Starting $DESC: "
       if ! start-stop-daemon --start --quiet --oknodo --exec $DAEMON -- $OPTIONS
>/dev/null 2>&1; then
               status=$?
               echo $status
               return $status
       fi        log_end_msg 0
       return 0
}
case "$1" in
 start)
       start
       ;;
 stop)
       echo "Stopping $DESC: "
       start-stop-daemon --stop --quiet --oknodo --exec $DAEMON
       echo $?
       ;;
 restart|force-reload)
       $0 stop
       sleep 1
       start
       #echo "$NAME."
       ;;
 *)
       N=/etc/init.d/$NAME
       echo "Usage: $N {start|stop|restart|force-reload}" >&2
       exit 1
       ;;
esac exit 0

This script also allows to manually start and stop the svnserver service whenever needed. Note: be sure and change the OPTIONS line to reflect the location of your repository; in our previous example this location was /home/testuser/repository. Once this file is created and edited to look like the previous example, you need to chmod the script to be executable by issuing chmod +x /etc/init.d/svnserve and also set it to startup at boot time by issuing update-rc.d svnserve defaults

Now simply start/stop the service by issuing:

/etc/init.d/svnserve start/stop

Please refer Subversion book for more help and usage.

November 7, 2006 at 9:11 pm 1 comment

Deprecated FormTagHelpers

Following FormTagHelpers are deprecated and will be removed in Rails 1.2

  • start_form_tag (use form_tag instead)
  • end_form_tag (use </form> instead)

technorati tags: , , rubyonrails

November 4, 2006 at 10:53 am Leave a comment

Older Posts


Important Notice…

I have moved this blog to http://webonrails.com . I will continue posting at http://webonrails.com, not on http://webonrails.wordpress.com.

Kindly update your book marks to http://webonrails.com

and http://webonrails.com/feed .

I am really very sorry for inconvenience.

Comming Soon….

Domain for Sale

TheRailsHosting.com


(Contact me)

Recent Posts

Calender

December 2014
M T W T F S S
« Dec    
1234567
891011121314
15161718192021
22232425262728
293031  

Subscribe

  • Add to Google
  • Subscribe in NewsGator Online
  • Subscribe with Bloglines
  • WebOnRails on feedburner
  • technorati

del.icio.us

Feeds

Flickr Photos

paz - peace - paix - frieden - pace

Capercaillie

Isolation

More Photos

Visitor’s Location

Blog Stats

  • 17,124 hits

Follow

Get every new post delivered to your Inbox.