<?xml version="1.0" encoding="UTF-8"?>
<feed xml:lang="en-US" xmlns="http://www.w3.org/2005/Atom">
  <title>Notepad - Home</title>
  <id>tag:notepad.onghu.com,2008:mephisto/</id>
  <generator version="0.7.3" uri="http://mephistoblog.com">Mephisto Noh-Varr</generator>
  <link href="http://notepad.onghu.com/feed/atom.xml" rel="self" type="application/atom+xml"/>
  <link href="http://notepad.onghu.com/" rel="alternate" type="text/html"/>
  <updated>2008-01-02T17:07:22Z</updated>
  <entry xml:base="http://notepad.onghu.com/">
    <author>
      <name>mohits</name>
    </author>
    <id>tag:notepad.onghu.com,2008-01-02:125</id>
    <published>2008-01-02T17:00:00Z</published>
    <updated>2008-01-02T17:07:22Z</updated>
    <category term="Codegear Builder | Turbo C++"/>
    <category term="Ruby"/>
    <link href="http://notepad.onghu.com/2008/1/2/codegear-turbo-c-and-ruby" rel="alternate" type="text/html"/>
    <title>Codegear Turbo C++ and Ruby</title>
<content type="html">
            &lt;h1&gt;Embedding Ruby into a Turbo C++ (Borland C++ Builder) Application&lt;/h1&gt;


	&lt;p&gt;I&#8217;m currently looking at bringing together two of my favourite pieces of desktop software &#8211; Ruby and Codegear Turbo C++.  I&#8217;m still sorting my thoughts out, but here are the main links that will help in getting started.  I will write up more details about this once I&#8217;ve figured it all out.&lt;/p&gt;


	&lt;p&gt;&lt;strong&gt;The ongoing thread in Ruby-talk that is discussing this issue&lt;/strong&gt;&lt;/p&gt;


	&lt;p&gt;Link: &lt;a href='http://www.ruby-forum.com/topic/137241'&gt;http://www.ruby-forum.com/topic/137241&lt;/a&gt;&lt;/p&gt;


	&lt;p&gt;&lt;strong&gt;Specific to Borland Builder&lt;/strong&gt;&lt;/p&gt;


	&lt;p&gt;Old threads that seem to have a few good pointers and gotchas.  These are: &lt;a href='http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/73326'&gt;http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/73326&lt;/a&gt; and very importantly: &lt;a href='http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/73397'&gt;http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/73397&lt;/a&gt;&lt;/p&gt;


	&lt;p&gt;&lt;strong&gt;About generally embedding Ruby&lt;/strong&gt;&lt;/p&gt;


	&lt;p&gt;A thread that covers the idea and also links to the PickAxe online for this: &lt;a href='http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/71319'&gt;http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/71319&lt;/a&gt;&lt;/p&gt;


	&lt;p&gt;&lt;strong&gt;Ruby Embedded into C++&lt;/strong&gt;&lt;/p&gt;


	&lt;p&gt;A great tutorial that goes into a lot of detail about the whole process.  Link: &lt;a href='http://metaeditor.sourceforge.net/embed/'&gt;http://metaeditor.sourceforge.net/embed/&lt;/a&gt;&lt;/p&gt;


	&lt;p&gt;&lt;strong&gt;&lt;span class='caps'&gt;SWIG&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;


	&lt;p&gt;You could also use &lt;span class='caps'&gt;SWIG&lt;/span&gt; to connect up between a C/C++ program and Ruby.  Link: &lt;a href='http://www.swig.org/'&gt;http://www.swig.org/&lt;/a&gt;&lt;/p&gt;


	&lt;p&gt;As soon as I have the whole procedure worked out, I shall put up a post about the full procedure for integrating between the two of them.&lt;/p&gt;
          </content>  </entry>
  <entry xml:base="http://notepad.onghu.com/">
    <author>
      <name>mohits</name>
    </author>
    <id>tag:notepad.onghu.com,2007-10-27:124</id>
    <published>2007-10-27T04:22:00Z</published>
    <updated>2007-10-27T04:34:56Z</updated>
    <category term="Ruby"/>
    <category term="Ruby on Rails"/>
    <link href="http://notepad.onghu.com/2007/10/27/online-books-about-ruby-rails" rel="alternate" type="text/html"/>
    <title>Online books about Ruby/ Rails</title>
<content type="html">
            &lt;p&gt;Here&#8217;s a small list of online/ free books about Ruby/ Rails.  This is just to keep the references in one place.  Hope this helps someone else &#8211; it certainly helps me!&lt;/p&gt;


	&lt;h2&gt;The PickAxe Edition 1 (Programming Ruby)&lt;/h2&gt;


	&lt;p&gt;&lt;a href='http://www.rubycentral.com/pickaxe/'&gt;http://www.rubycentral.com/pickaxe/&lt;/a&gt;&lt;/p&gt;


	&lt;h2&gt;Why&#8217;s Poignant Guide about Ruby&lt;/h2&gt;


	&lt;p&gt;&lt;a href='http://poignantguide.net/ruby/'&gt;http://poignantguide.net/ruby/&lt;/a&gt;&lt;/p&gt;


	&lt;h2&gt;Mr. Neighborly&#8217;s Humble Little Ruby Book&lt;/h2&gt;


	&lt;p&gt;&lt;a href='http://www.humblelittlerubybook.com/'&gt;http://www.humblelittlerubybook.com/&lt;/a&gt;&lt;/p&gt;


	&lt;h2&gt; A Little Ruby, A Lot of Objects&lt;/h2&gt;


	&lt;p&gt;&lt;a href='http://www.visibleworkings.com/little-ruby/'&gt;http://www.visibleworkings.com/little-ruby/&lt;/a&gt;&lt;/p&gt;
          </content>  </entry>
  <entry xml:base="http://notepad.onghu.com/">
    <author>
      <name>mohits</name>
    </author>
    <id>tag:notepad.onghu.com,2007-09-10:122</id>
    <published>2007-09-10T14:28:00Z</published>
    <updated>2007-09-10T14:44:05Z</updated>
    <category term="Radiant CMS"/>
    <category term="Ruby on Rails"/>
    <link href="http://notepad.onghu.com/2007/9/10/radiant-cms-showing-the-date-of-articles" rel="alternate" type="text/html"/>
    <title>Radiant CMS - Showing the date of articles</title>
<content type="html">
            &lt;p&gt;One of my sites (&lt;a href='http://tec.onghu.com/'&gt;http://tec.onghu.com/&lt;/a&gt;) is powered by the Radiant &lt;span class='caps'&gt;CMS&lt;/span&gt;.  As I continue to build that site, I shall put up some information about how simple things are done in Radiant.&lt;/p&gt;


	&lt;p&gt;One of the things that I have is a running list of articles that have been published on different dates.  I wanted a simple way to print out the date next to the articles.&lt;/p&gt;


	&lt;p&gt;Here&#8217;s what you need to do for that:&lt;/p&gt;


&lt;pre&gt;&lt;code&gt;

&amp;lt;ul&amp;gt;
&amp;lt;r:find url=&quot;articles&quot;&amp;gt;
&amp;lt;r:children:each order=&quot;desc&quot; status=&quot;published&quot;&amp;gt;
   &amp;lt;r:unless_content part=&quot;no_menu&quot;&amp;gt;&amp;lt;li&amp;gt;&amp;lt;r:link /&amp;gt; [&amp;lt;r:date format=&quot;%b %d, %Y&quot; /&amp;gt;] 
&amp;lt;/r:unless_content&amp;gt;&amp;lt;/r:children:each&amp;gt;
&amp;lt;/r:find&amp;gt;
&amp;lt;/ul&amp;gt;

&lt;/code&gt;&lt;/pre&gt;

	&lt;p&gt;Notice 2 interesting things in the code sample above.&lt;/p&gt;


&lt;ol&gt;
&lt;li&gt;r:date format &#8211; this expects a formatting string similar to what strftime in Ruby/ Rails expects.&lt;/li&gt;
&lt;li&gt;r:unless_content part=&#8221;no_menu&#8221; &#8211; this tag is a bit that excludes some pages from being shown in the listing.  Any page that has a part called &#8216;no_menu&#8217; will not be listed.  This is a common way to prevent &lt;span class='caps'&gt;CSS&lt;/span&gt; files from showing in the list.&lt;/li&gt;
&lt;/ol&gt;

	&lt;p&gt;That&#8217;s all there is to it.  Leave a comment if you want any bit above clarified.&lt;/p&gt;
          </content>  </entry>
  <entry xml:base="http://notepad.onghu.com/">
    <author>
      <name>mohits</name>
    </author>
    <id>tag:notepad.onghu.com,2007-05-26:19</id>
    <published>2007-05-26T05:55:00Z</published>
    <updated>2007-09-07T05:46:46Z</updated>
    <category term="Radiant CMS"/>
    <category term="Ruby on Rails"/>
    <link href="http://notepad.onghu.com/2007/5/26/hello-world-using-radiant-cms" rel="alternate" type="text/html"/>
    <title>"Hello World" using Radiant CMS</title>
<content type="html">
            &lt;p&gt;If you&#8217;re as slow at getting started as I can be at 2:45AM and still insist on trying out Radiant &lt;span class='caps'&gt;CMS&lt;/span&gt; at exactly that time, this small entry may help you getting around to making your first page with Radiant show up.&lt;/p&gt;


	&lt;h2&gt;Pre-requisites&lt;/h2&gt;


	&lt;p&gt;1. Install Radiant as per &lt;a href='http://dev.radiantcms.org/radiant/wiki/Installation'&gt;the instructions&lt;/a&gt;&lt;/p&gt;


	&lt;p&gt;2. Create one project for any of the blog types (this is where we shall steal from) &#8211; remember to create the database and adjust the database properties in the &lt;code&gt;database.yml&lt;/code&gt;&lt;/p&gt;


	&lt;p&gt;3. Create your &#8216;empty project&#8217; &#8211; remember to create the database and adjust the database properties in the &lt;code&gt;database.yml&lt;/code&gt;&lt;/p&gt;


	&lt;p&gt;If there&#8217;s a need, I could elaborate the first 3 steps further but I think it should be quite easy to follow those steps through.&lt;/p&gt;


	&lt;h2&gt;Adding to the Empty Project&lt;/h2&gt;


	&lt;p&gt;Now, let&#8217;s go through the rest.  If you read the &lt;a href='http://dev.radiantcms.org/radiant/wiki/UsingRadiant'&gt;Radiant mini handbook&lt;/a&gt; you will see that it mentions that if you are starting with an empty project, every thing needs to be created &#8211; right from the first few layouts, the snippets and of course, the pages.  The &#8216;empty project&#8217; is just that: empty.&lt;/p&gt;


	&lt;p&gt;Since it took me a while to figure out how to create the first Radiant page, I decided to document that process here for reference.&lt;/p&gt;


	&lt;p&gt;If you have created a Radiant site, run the bootstrap rake script, started the server, and are logged in, we&#8217;re ready to roll.&lt;/p&gt;


	&lt;h3&gt;Step 1: Create a new layout&lt;/h3&gt;


	&lt;p&gt;Click on the &#8220;Layouts&#8221; tab.  This brings up an empty list of layouts.&lt;/p&gt;


	&lt;p&gt;Then, click on &#8220;New Layout&#8221;.  Give your new layout a name such as &#8220;page_style&#8221; and fill in stuff that you can copy from a standard &lt;span class='caps'&gt;HTML&lt;/span&gt; web page.  Ideally, you should also use some Radius tags in the creation.  To cut short the guesswork at this point, I basically stole from the Blog Radiant project that I had installed.  This is the cut down code that I copied from there.&lt;/p&gt;


&lt;pre&gt;&lt;code&gt;
&amp;lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML 1.1//EN&quot; 
  &quot;http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd&quot;&amp;gt;
&amp;lt;html&amp;gt;
  &amp;lt;head&amp;gt;
    &amp;lt;title&amp;gt;&amp;lt;r:title /&amp;gt;&amp;lt;/title&amp;gt;
    &amp;lt;link href=&quot;/rss/&quot; rel=&quot;alternate&quot; title=&quot;RSS&quot; type=&quot;application/rss+xml&quot; /&amp;gt;
    &amp;lt;link rel=&quot;stylesheet&quot; type=&quot;text/css&quot; href=&quot;/styles.css&quot; /&amp;gt;
  &amp;lt;/head&amp;gt;
  &amp;lt;body&amp;gt;
    &amp;lt;div id=&quot;page&quot;&amp;gt;
      &amp;lt;div id=&quot;main&quot;&amp;gt;
        &amp;lt;div id=&quot;content-wrapper&quot;&amp;gt;
          &amp;lt;div id=&quot;content&quot;&amp;gt;
            &amp;lt;r:unless_url matches=&quot;^/$&quot;&amp;gt;&amp;lt;h1&amp;gt;&amp;lt;r:title /&amp;gt;&amp;lt;/h1&amp;gt;&amp;lt;/r:unless_url&amp;gt;
            &amp;lt;r:content /&amp;gt;
            &amp;lt;r:if_content part=&quot;extended&quot;&amp;gt;
            &amp;lt;div id=&quot;extended&quot;&amp;gt;
              &amp;lt;r:content part=&quot;extended&quot; /&amp;gt;
            &amp;lt;/div&amp;gt;
            &amp;lt;/r:if_content&amp;gt;
            &amp;lt;r:if_url matches=&quot;^/articles/\d{4}/\d{2}/\d{2}/.+&quot;&amp;gt;&amp;lt;r:unless_url matches=&quot;-archives/$&quot;&amp;gt;&amp;lt;p class=&quot;info&quot;&amp;gt;Posted by &amp;lt;r:author /&amp;gt; on &amp;lt;r:date /&amp;gt;&amp;lt;/p&amp;gt;&amp;lt;/r:unless_url&amp;gt;&amp;lt;/r:if_url&amp;gt;
          &amp;lt;/div&amp;gt;
        &amp;lt;/div&amp;gt;
      &amp;lt;/div&amp;gt;
    &amp;lt;/div&amp;gt;
  &amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

	&lt;p&gt;You could also use Snippets, but we&#8217;re not going to go there yet.  Click on &#8220;Create Layout&#8221; to, err, create the layout.  It should now show the &#8220;page_style&#8221; layout in the list of layouts.&lt;/p&gt;


	&lt;h3&gt;Step 2: Create a layout for the stylesheet&lt;/h3&gt;


	&lt;p&gt;Click on &#8220;New Layout&#8221; and give it a name such as &#8220;stylesheet&#8221;.  Then, click on the &#8220;More&#8221; link below the Name field and enter &lt;code&gt;text/css&lt;/code&gt; in the Content-type field there.  In the Body of the layout, simply enter the following which means that the content of the file that uses this layout is passed up.&lt;/p&gt;


&lt;pre&gt;&lt;code&gt;
&amp;lt;r:content /&amp;gt;
&lt;/pre&gt;&lt;/code&gt;

	&lt;p&gt;After you click on &#8220;Create Layout&#8221; it will be saved and will be shown in the list.&lt;/p&gt;


	&lt;h3&gt;Step 3: Add the main page&lt;/h3&gt;


	&lt;p&gt;You already have a layout that can be used as the base layout for pages in your site.  Go to the &#8220;Pages&#8221; tab of your admin site and click on &#8220;New homepage&#8221; to create the first page.  Give the page a title, something like &#8220;Hello, World&#8221; and then fill out things that will be rendered as the page.  I have set the formatting filter to &#8220;Textile&#8221; and added some text as below&lt;/p&gt;


&lt;pre&gt;
&lt;code&gt;
h1. Hello!

This is the first page in the sample site.  
It uses Radiant and uses @Textile@ for the markup.

h2. Creating a List

Using @Textile@, a list is easily created.  I'd like to say Hello to

 * My family
 * My friends
 * My world

h1. Another Level 1 heading

&lt;/code&gt;
&lt;/pre&gt;

	&lt;p&gt;Now, in the bottom bar, select the Layout as &#8220;page_style&#8221;, the Page Type as &#8220;&amp;lt;normal&gt;&#8221; and the Status as &#8220;Published&#8221;.  With that done, you can click in the top right corner to &#8220;View Site&#8221; &#8211; it will bring up a simple page that shows that things are working!  The formatting will look like the default formatting that your web browser applies to the various headings and body.&lt;/p&gt;


	&lt;h3&gt;Step 5: Add a style sheet&lt;/h3&gt;


	&lt;p&gt;In modern web design, it is essential to format the pages with styles.  So, that&#8217;s a step that we must also look at.  There&#8217;s only one more thing that needs to be done.&lt;/p&gt;


	&lt;p&gt;In the &#8220;pages&#8221; view, we need to create a page that will be the stylesheet for the site.  If you look at the layout that we created, there is a line that says:&lt;/p&gt;


&lt;pre&gt;&lt;code&gt;
    &amp;lt;link rel=&quot;stylesheet&quot; type=&quot;text/css&quot; href=&quot;/styles.css&quot; /&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

	&lt;p&gt;That means the page is already set up to serve up a stylesheet called styles.css which should be applied to the page.  Only, we haven&#8217;t created it yet.&lt;/p&gt;


	&lt;p&gt;In the &#8220;pages&#8221; view, click on the &#8220;Add Child&#8221; item of the &#8220;Hello World&#8221; page to create a new page.  This will be the stylesheet.  Give it the name &#8220;Styles&#8221; and click on &#8220;More&#8221; below the text field for the name to show the other properties.  Very importantly, change the Slug to &lt;code&gt;styles.css&lt;/code&gt; &#8211; this is the name that it will be served up as.  Use no filter, set the layout to &#8220;stylesheet&#8221; and the status to &#8220;published&#8221;.  Click on the &#8220;extended&#8221; tab and then on the &#8221;-&#8221; sign in the right hand corner to delete that tab.  Put the following styling code into the body.  To keep it simple, I just added the styling for the headings since we have a few in our default page.&lt;/p&gt;


&lt;pre&gt;&lt;code&gt;
p {margin: 0px 0px 0.5em 0px; padding: 0px; line-height: 1.3em; font-family: arial, sans serif; font-size: 120%; color: rgb(88,144,168)}
h1 {margin: 1.0em 0px 0.5em 0px; font-weight: bold; font-size: 160%;color: rgb(64,64,255)}
h2 {margin: 1.0em 0px 0.5em 0px; font-weight: bold; font-size: 150%;color: rgb(128,128,255)}
&lt;/pre&gt;&lt;/code&gt;

	&lt;p&gt;Click on &#8220;Create Page&#8221; to save the stylesheet.&lt;/p&gt;


	&lt;p&gt;Now, we are done.  Click on the &#8220;View Site&#8221; button to see your site in color!!  You might need to refresh the page in your browser just in case it&#8217;s being cached.  I know it doesn&#8217;t look fantastic but it gives you a feeling on how to go on from here.  Hope this helps you!&lt;/p&gt;
          </content>  </entry>
  <entry xml:base="http://notepad.onghu.com/">
    <author>
      <name>mohits</name>
    </author>
    <id>tag:notepad.onghu.com,2007-04-30:18</id>
    <published>2007-04-30T10:38:00Z</published>
    <updated>2007-04-30T11:04:52Z</updated>
    <category term="SubVersion"/>
    <link href="http://notepad.onghu.com/2007/4/30/backing-up-a-subversion-repository" rel="alternate" type="text/html"/>
    <title>Backing up a Subversion Repository</title>
<content type="html">
            &lt;p&gt;The simplest way to back up a Subversion repository is to make a full backup of it.  If your repository is very large, then this may be a bit of a slow process and there are other ways which can be used.  However, if you are just looking for the simplest way to ensure that you have a simple backup of your precious repository, then the instructions are very simple!&lt;/p&gt;


	&lt;h2&gt;Backing up&lt;/h2&gt;


	&lt;p&gt;Especially if you use the &lt;span class='caps'&gt;BDB&lt;/span&gt; backend, it is important that you do not access or copy the repository directly.  If someone accesses the repository for anything at this time, your backup will be corrupted and quite useless.  Therefore, you need to use &lt;code&gt;hotcopy&lt;/code&gt; option of the svnadmin command.  This ensures that you get a proper comprehensive snapshot irrespective of people accessing the repository at the same time.&lt;/p&gt;


	&lt;p&gt;More importantly, though, there is a simple Python script called hot-backup that takes as inputs the path of the repository and the path of the backup directory and does the rest.  If you have Python installed, this is the easiest way.&lt;/p&gt;


	&lt;ol&gt;
	&lt;li&gt;&lt;a href='http://svn.collab.net/repos/svn/trunk/tools/backup/hot-backup.py.in'&gt;Download&lt;/a&gt; the script&lt;/li&gt;
		&lt;li&gt;Change the name to hot-backup.py&lt;/li&gt;
		&lt;li&gt;Open it in a text editor and change the first line to the directory where Python is installed.  In my case, this is &lt;code&gt;#!C:\Python24&lt;/code&gt;&lt;/li&gt;
		&lt;li&gt;Update the paths to &#8216;svnlook&#8217; and &#8216;svnadmin&#8217; further down in the script.  In my case, these were changed to: &lt;code&gt; svnlook = &quot;C:/DevSupport/Subversion/bin/svnlook&quot;&lt;/code&gt; and &lt;code&gt;svnadmin = &quot;C:/DevSupport/Subversion/bin/svnadmin&quot;&lt;/code&gt;.&lt;/li&gt;
		&lt;li&gt;Save the script to a directory of your choice.  I saved it to: &lt;/code&gt;c:\DevSupport\SubVersion\tools\backup&lt;/code&gt;&lt;/li&gt;
		&lt;li&gt;Run it from the command line giving it the repository and backup paths.&lt;/li&gt;
	&lt;/ol&gt;


&lt;pre&gt;
 D:\Repository&amp;gt;c:\DevSupport\Subversion\tools\backup\hot-backup.py D:\Repository\svn\Project D:\Repository\backup
 &lt;/pre&gt;

	&lt;p&gt;After you run this, in the backup directory, you will see a new directory created having the same name and revision number as the project name and version it backed up.  For example, you may get something like &lt;code&gt;Project00-4&lt;/code&gt; which means that this is revision &lt;code&gt;4&lt;/code&gt; of &lt;code&gt;Project00&lt;/code&gt;.&lt;/p&gt;


	&lt;h2&gt;Restoring&lt;/h2&gt;


	&lt;p&gt;The copy that is made is a copy of the entire repository and is actually a fully working repository and can be used just like any other repository.  There is no special procedure to restore a backup.&lt;/p&gt;


	&lt;h2&gt;Links&lt;/h2&gt;


	&lt;p&gt;This topic has been written about quite a bit and you will find quite a bit if you search Google.&lt;/p&gt;


	&lt;ul&gt;
	&lt;li&gt;Refer to &lt;a href='http://svnbook.red-bean.com/en/1.1/ch05s03.html'&gt;Repository Management&lt;/a&gt; in the &#8216;official&#8217; &lt;span class='caps'&gt;SVN&lt;/span&gt; book for more details.&lt;/li&gt;
		&lt;li&gt;&lt;a href='http://www.benr75.com/articles/2007/04/24/backing-up-subversion-using-hot-backup-py'&gt;This article&lt;/a&gt; helped me get started (I just made minor modifications to get it working on Windows)&lt;/li&gt;
		&lt;li&gt;Finally, &lt;a href='http://www.falafel.com/community/blogs/techbits/archive/2006/01/11/A-Simple-Way-to-Backup-and-Restore-a-Subversion-Repository.aspx'&gt;this article&lt;/a&gt; talks about the dump and load commands that can also be used for backing up, migrating and restoring repositories.&lt;/li&gt;
	&lt;/ul&gt;
          </content>  </entry>
  <entry xml:base="http://notepad.onghu.com/">
    <author>
      <name>mohits</name>
    </author>
    <id>tag:notepad.onghu.com,2007-04-30:17</id>
    <published>2007-04-30T10:25:00Z</published>
    <updated>2007-04-30T10:26:05Z</updated>
    <category term="SubVersion"/>
    <link href="http://notepad.onghu.com/2007/4/30/running-svnserve-as-a-windows-service" rel="alternate" type="text/html"/>
    <title>Running svnserve as a Windows Service</title>
<content type="html">
            &lt;p&gt;It took me a while to assemble this information about what needs to be done to run svnserve as a Windows service and since I shall need this information in another few days when I set it up on a different server, it made sense to link it here.&lt;/p&gt;


	&lt;h2&gt;Background&lt;/h2&gt;


	&lt;p&gt;svnserve allows you to connect remotely to an &lt;span class='caps'&gt;SVN&lt;/span&gt; repository over a network.  In these cases, the repository names are something like &#8220;svn://server/project&#8221; and this is regarded as one of the easiest ways to connect over a network.  This method is usually recommended for corporate LANs where you are confident that your communication is safe from snooping.  There are other ways such as ssh + svn which can offer greater security, but I digress.&lt;/p&gt;


	&lt;p&gt;If you decide that svnserve will work for you and you have svn running on a Windows computer, then you may want to run it as a service.  That way, it can be made to start up automatically when the computer restarts (as it will every now and then if it has just installed a bunch of updates automatically) and is generally easier to manage.&lt;/p&gt;


	&lt;h2&gt;What needs to be done?&lt;/h2&gt;


Basically, the latest svnserve already has everything that is needed to run it as a service.  All you need to do is install it as service by passing it the correct options.  Let&#8217;s assume that you have the following settings:
	&lt;ul&gt;
	&lt;li&gt;Subversion Installation: &lt;code&gt;C:\DevSupport\Subversion&lt;/code&gt;&lt;/li&gt;
		&lt;li&gt;Repository: &lt;code&gt;D:\Repository&lt;/code&gt;&lt;/li&gt;
	&lt;/ul&gt;


	&lt;p&gt;If this is the case, you need to go to a Command Window (Start Key&amp;gt; Run&amp;gt; cmd [enter] &amp;gt;) and run the command SC.exe to interact with the service manager.  You could type &lt;code&gt;sc.exe&lt;/code&gt; to see how it works and what it expects from you.&lt;/p&gt;


	&lt;p&gt;For the impatient, this is what you need to type in at the command prompt to register svnserve as a service.&lt;/p&gt;


&lt;code&gt;
C:\&amp;gt;sc create svn_repos binpath= &quot;C:\DevSupport\Subversion\bin\svnserve.exe --service --root D:\Repository&quot; displayname= &quot;Subversion Repository&quot; depend= Tcpip
&lt;/code&gt;

	&lt;p&gt;&lt;br&gt;There a few things to note here:&lt;/p&gt;


	&lt;ol&gt;
	&lt;li&gt;Options to &lt;code&gt;sc create&lt;/code&gt; must have the equal-to sign stuck to the option name (it&#8217;s part of the option name) and there must be one space after it.  So, &lt;code&gt;depend= Tcpip&lt;/code&gt; is correct and &lt;code&gt;depend = Tcpip&lt;/code&gt;, &lt;code&gt;depend=Tcpip&lt;/code&gt; and &lt;code&gt;depend =Tcpip&lt;/code&gt; are all wrong.&lt;/li&gt;
		&lt;li&gt;The display name is what it will show up as in the Service Manager.  You can set it to whatever you like.&lt;/li&gt;
		&lt;li&gt;The binpath is the actual command line that will be called.  Note that the option to run it as a service is &lt;strong&gt;&lt;code&gt;--service&lt;/code&gt;&lt;/strong&gt; and no other option works.  It &lt;strong&gt;must&lt;/strong&gt; be &lt;code&gt;--service&lt;/code&gt; if it is to work.&lt;/li&gt;
	&lt;/ol&gt;


	&lt;h2&gt;Do I need one service for each repository?&lt;/h2&gt;


	&lt;p&gt;In short, No.  The command line option to svnserve only identifies a root directory which will be served up.  The repository can be in any directory below it.&lt;/p&gt;


	&lt;p&gt;Suppose that your repository looks something like this:&lt;/p&gt;


&lt;pre&gt;
D:\Repository
  |
  |- Project 1
  |
  |- Project 2
  |
  |- Project 3
&lt;/pre&gt;

	&lt;p&gt;and you use the above to serve it up, then the URLs for accessing the 3 projects from a Subversion client will be:&lt;/p&gt;


&lt;pre&gt;
Project1 - svn://server/Project1
Project2 - svn://server/Project2
Project3 - svn://server/Project3
&lt;/pre&gt;

	&lt;p&gt;So, basically, if the individual project repositories are under the same root directory, you do not need a separate service.  You will need a separate service for each root directory because I don&#8217;t think that a single svnserve service can handle multiple root directories.&lt;/p&gt;


	&lt;h2&gt;How do I make it automatically start upon reboot?&lt;/h2&gt;


	&lt;p&gt;The steps above will only ensure that the service is installed.  If you want the service to start, you need to do a couple of other things.&lt;/p&gt;


	&lt;ol&gt;
	&lt;li&gt;Go to the Service Manager (Start Button&amp;gt; Run&amp;gt; services.msc [enter])&lt;/li&gt;
		&lt;li&gt;Find the service you just installed (if you called it Subversion Repository, then that will be the service name)&lt;/li&gt;
		&lt;li&gt;Right-click on the name of the service and select properties.&lt;/li&gt;
		&lt;li&gt;If the service is not running, start it by clicking on &#8216;Start&#8217;&lt;/li&gt;
		&lt;li&gt;Change the start-up type to &#8216;Automatic&#8217;&lt;/li&gt;
		&lt;li&gt;Click on &#8216;Apply&#8217; or &#8216;OK&#8217; and exit the page.&lt;/li&gt;
	&lt;/ol&gt;


	&lt;p&gt;The service is now running and will be automatically started every time Windows is restarted.&lt;/p&gt;


	&lt;p&gt;Refer to &lt;a href='http://svn.collab.net/repos/svn/trunk/notes/windows-service.txt'&gt;this note&lt;/a&gt; for all the gory details.&lt;/p&gt;
          </content>  </entry>
  <entry xml:base="http://notepad.onghu.com/">
    <author>
      <name>mohits</name>
    </author>
    <id>tag:notepad.onghu.com,2007-04-30:16</id>
    <published>2007-04-30T09:22:00Z</published>
    <updated>2007-04-30T09:23:18Z</updated>
    <category term="Codegear Builder | Turbo C++"/>
    <category term="SubVersion"/>
    <link href="http://notepad.onghu.com/2007/4/30/svn-ignore-for-visual-studio-and-codegear-turbo-c" rel="alternate" type="text/html"/>
    <title>svn:ignore for Visual Studio and Codegear Turbo C++</title>
<content type="html">
            &lt;p&gt;I have just gone through setting up Subversion and was looking at which directories and files need to be ignored by the client when it uploads the project.  I expect that I shall need to set these properties for every project that I work with, so I decided to put up the list here so that it&#8217;s easy to find it the next time I need it.  If it helps you, that&#8217;s a bonus :)&lt;/p&gt;


	&lt;p&gt;If you are using TortoiseSVN, you can set these properties by right clicking on the name of your project sandbox directory and then following the TortoiseSVN&amp;gt;Properties.  In the form that pops up, click on &#8220;Add&#8221; and for property name, select &#8220;svn:ignore&#8221; from the drop down list.  Then, in the memo field, just copy and paste the set of files to ignore.  Check &#8220;Apply property recursively&#8221; to apply it to all directories.&lt;/p&gt;


	&lt;h3&gt;Visual Studio 2005&lt;/h3&gt;


&lt;code&gt; *.obj *.exe *.pdb *.ncb *.res *.pch *.idb&lt;/code&gt;

	&lt;p&gt;In addition, you can also ask it to ignore the directories in which it creates the executable code.  Since I&#8217;m using Visual Studio for Windows Mobile development, this will usually be a directory such as &#8220;Pocket &lt;span class='caps'&gt;PC 2003&lt;/span&gt; (ARMV4)&#8221; which will have files that are created during the build process.  When you do your first &#8220;Commit&#8221; with these directories there, just right click on each of the directory names in the TortoiseSVN list and ask it to ignore it.&lt;/p&gt;


	&lt;h3&gt;Turbo C++ Professional&lt;/h3&gt;


&lt;code&gt;  *.obj *.~* *.dsk *.d *.local *.bcc32pch *.res *.tds *.exe *.bbc *.bbd *.bbl *.bbp&lt;/code&gt;

	&lt;p&gt;In addition, you can also ask it to ignore the directories in which it creates the executable code.  Since I&#8217;m using Turbo C++ for Windows PC development, this will usually be a directory such as &#8220;Debug_build&#8221; and &#8220;Release_build&#8221; which will have files that are created during the build process.  Also, you can ask it to ignore the &#8220;__history&#8221; directory if you don&#8217;t care about the revisions that Turbo C++ maintains.  When you do your first &#8220;Commit&#8221; with these directories there, just right click on each of these directory names in the TortoiseSVN list and ask it to ignore it.&lt;/p&gt;
          </content>  </entry>
  <entry xml:base="http://notepad.onghu.com/">
    <author>
      <name>mohits</name>
    </author>
    <id>tag:notepad.onghu.com,2007-04-15:9</id>
    <published>2007-04-15T06:44:00Z</published>
    <updated>2007-04-15T07:03:24Z</updated>
    <category term="T-Engine/ T-Kernel"/>
    <link href="http://notepad.onghu.com/2007/4/15/announcing-te-onghu-developer-forum-bbs-tebbs" rel="alternate" type="text/html"/>
    <title>Announcing: TE@Onghu Developer Forum/ BBS (TEBBS)</title>
<content type="html">
            &lt;p&gt;TE@Onghu is proud to publicly announce the TE@Onghu Developer Forum/ &lt;span class='caps'&gt;BBS&lt;/span&gt; (TEBBS).  The Developer Forum/ &lt;span class='caps'&gt;BBS&lt;/span&gt; is open to everyone and is a great place to ask questions about Embedded Systems, T-Engine/ T-Kernel Programming, Porting Issues, T-Engine Hardware or just about any related topic.  New threads will be added in as necessary. You can use it to tap into the knowledge of experts across the world, or register and help newbies who are just getting started.&lt;/p&gt;


	&lt;p&gt;&lt;span class='caps'&gt;TEBBS&lt;/span&gt; has been in usability testing since February 2007 and currently has 16 members.  There are almost 100 posts in more than 20 topics &#8211; already, some interesting topics have been discussed.&lt;/p&gt;


	&lt;p&gt;&lt;span class='caps'&gt;TEBBS&lt;/span&gt; is online at &lt;a href='http://www.onghu.com/tebbs/'&gt;http://www.onghu.com/tebbs/&lt;/a&gt;&lt;/p&gt;


	&lt;p&gt;Anyone can browse through the &lt;span class='caps'&gt;TEBBS&lt;/span&gt; topics online. However, you will need to sign up to post new questions and to get access to other special features such as receiving notifications when queries of interest receive new posts. Also, there is an internal messaging system that you can use to contact other &lt;span class='caps'&gt;TEBBS&lt;/span&gt; members.&lt;/p&gt;


	&lt;p&gt;Register now to get started: &lt;a href='http://onghu.com/tebbs/YaBB.pl?action=register'&gt;http://onghu.com/tebbs/YaBB.pl?action=register&lt;/a&gt;&lt;/p&gt;
          </content>  </entry>
  <entry xml:base="http://notepad.onghu.com/">
    <author>
      <name>mohits</name>
    </author>
    <id>tag:notepad.onghu.com,2007-04-09:4</id>
    <published>2007-04-09T09:47:00Z</published>
    <updated>2007-04-09T09:56:09Z</updated>
    <category term="T-Engine/ T-Kernel"/>
    <link href="http://notepad.onghu.com/2007/4/9/te-onghu-t-engine-information-festival" rel="alternate" type="text/html"/>
    <title>TE@Onghu T-Engine Information Festival</title>
<content type="html">
            &lt;p&gt;&lt;a href='http://www.onghu.com/te'&gt;TE@Onghu&lt;/a&gt; (provider of T-Engine/ T-Kernel information in English) is now 2 years old.  To celebrate 2 years of TE@Onghu and its supporting company (&lt;a href='http://www.viometrix.com'&gt;Viometrix&lt;/a&gt;), we have organized a special information festival online.  From April 9th (today!), we will upload one new article on every working day for two weeks (a total of 10 new articles).&lt;/p&gt;


	&lt;p&gt;Also, on 15th April, we will be announcing a new feature of the TE@Onghu website that should be of great interest to other developers using the T-Engine, and will provide yet another source of support for the T-Engine community.&lt;/p&gt;


	&lt;p&gt;The festival is now online at &lt;a href='http://www.onghu.com/te/'&gt;http://www.onghu.com/te/&lt;/a&gt; and the first article called &#8220;Future Directions with the T-Kernel&#8221; is already online at: &lt;a href='http://www.onghu.com/te/html/future_directions_with_the_tke.html'&gt;http://www.onghu.com/te/html/future_directions_with_the_tke.html&lt;/a&gt;&lt;/p&gt;
          </content>  </entry>
  <entry xml:base="http://notepad.onghu.com/">
    <author>
      <name>mohits</name>
    </author>
    <id>tag:notepad.onghu.com,2007-03-28:3</id>
    <published>2007-03-28T18:50:00Z</published>
    <updated>2007-07-28T04:55:38Z</updated>
    <category term="Ruby on Rails"/>
    <link href="http://notepad.onghu.com/2007/3/28/using-textile-editor-plugin-and-acts_as_textiled" rel="alternate" type="text/html"/>
    <title>Using Textile Editor Helper and acts_as_textiled</title>
<content type="html">
            &lt;p&gt;One of the ways to allow lean markup for text is to use &lt;a href='http://www.textism.com/tools/textile/'&gt;Textile&lt;/a&gt; for the text fields.  Using &lt;a href='http://errtheblog.com/post/14'&gt;acts_as_textiled&lt;/a&gt; can make this process even easier.  The only thing that was missing was to have a way to allow users to enter Textile-formatted text with greater ease&#8230; until now, that is!&lt;/p&gt;


	&lt;p&gt;Enter the &lt;a href='http://slateinfo.blogs.wvu.edu/plugins/textile_editor_helper'&gt;Textile Editor Helper&lt;/a&gt; to ease this step.  This article just takes you step-by-step to show you how to get a Textile-enabled field working in your Rails app.&lt;/p&gt;


	&lt;h2&gt;Install RedCloth if needed&lt;/h2&gt;


	&lt;p&gt;To use Textile, you must install the RedCloth gem first.&lt;/p&gt;


&lt;pre&gt;&lt;code&gt;
&lt;table class='CodeRay'&gt;&lt;tr&gt;
  &lt;td title='click to toggle' class='line_numbers'&gt;&lt;pre&gt;1&lt;tt&gt;
&lt;/tt&gt;2&lt;tt&gt;
&lt;/tt&gt;3&lt;tt&gt;
&lt;/tt&gt;4&lt;tt&gt;
&lt;/tt&gt;&lt;strong&gt;5&lt;/strong&gt;&lt;tt&gt;
&lt;/tt&gt;6&lt;tt&gt;
&lt;/tt&gt;&lt;/pre&gt;&lt;/td&gt;
  &lt;td class='code'&gt;&lt;pre&gt;rails_apps&amp;gt;gem install &lt;span class='co'&gt;RedCloth&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;span class='co'&gt;Attempting&lt;/span&gt; local installation of &lt;span class='s'&gt;&lt;span class='dl'&gt;'&lt;/span&gt;&lt;span class='k'&gt;RedCloth&lt;/span&gt;&lt;span class='dl'&gt;'&lt;/span&gt;&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;span class='co'&gt;Local&lt;/span&gt; gem file &lt;span class='r'&gt;not&lt;/span&gt; found: &lt;span class='co'&gt;RedCloth&lt;/span&gt;*.gem&lt;tt&gt;
&lt;/tt&gt;&lt;span class='co'&gt;Attempting&lt;/span&gt; remote installation of &lt;span class='s'&gt;&lt;span class='dl'&gt;'&lt;/span&gt;&lt;span class='k'&gt;RedCloth&lt;/span&gt;&lt;span class='dl'&gt;'&lt;/span&gt;&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;span class='co'&gt;Updating&lt;/span&gt; &lt;span class='co'&gt;Gem&lt;/span&gt; source index &lt;span class='r'&gt;for&lt;/span&gt;: http&lt;span class='sy'&gt;:/&lt;/span&gt;/gems.rubyforge.org&lt;tt&gt;
&lt;/tt&gt;&lt;span class='co'&gt;Successfully&lt;/span&gt; installed &lt;span class='co'&gt;RedCloth&lt;/span&gt;&lt;span class='fl'&gt;-3.0&lt;/span&gt;.&lt;span class='i'&gt;4&lt;/span&gt;&lt;/pre&gt;&lt;/td&gt;
&lt;/tr&gt;&lt;/table&gt;

&lt;/code&gt;&lt;/pre&gt;

	&lt;h2&gt;Create a new Rails app&lt;/h2&gt;


	&lt;p&gt;I want to assume nothing, so I&#8217;ll just start from scratch here.  Create a new Rails app by using the usual way.&lt;/p&gt;


&lt;pre&gt;&lt;code&gt;
&lt;table class='CodeRay'&gt;&lt;tr&gt;
  &lt;td title='click to toggle' class='line_numbers'&gt;&lt;pre&gt;1&lt;tt&gt;
&lt;/tt&gt;2&lt;tt&gt;
&lt;/tt&gt;3&lt;tt&gt;
&lt;/tt&gt;4&lt;tt&gt;
&lt;/tt&gt;&lt;/pre&gt;&lt;/td&gt;
  &lt;td class='code'&gt;&lt;pre&gt;rails_apps&amp;gt;rails ted_sample&lt;tt&gt;
&lt;/tt&gt;      create&lt;tt&gt;
&lt;/tt&gt;      create  app/controllers&lt;tt&gt;
&lt;/tt&gt;      ... &lt;/pre&gt;&lt;/td&gt;
&lt;/tr&gt;&lt;/table&gt;

&lt;/code&gt;&lt;/pre&gt;

	&lt;h2&gt;Create the database for it&lt;/h2&gt;


	&lt;p&gt;Using whatever method you prefer, create a database (command line, phpMyAdmin, etc.) for the application.  In my case, I added a database called &#8216;sample&#8217; to MySQL running on my localhost.&lt;/p&gt;


	&lt;h2&gt;Adjust the connection properties&lt;/h2&gt;


	&lt;p&gt;Go to &lt;pre&gt;rails_app\ted_sample\config&lt;/pre&gt; and edit &lt;pre&gt;database.yml&lt;/pre&gt; to point to the actual database.  I&#8217;m using development mode only (this application has a life of 10 minutes) and the database properties need to be set as above.&lt;/p&gt;


&lt;pre&gt;&lt;code&gt;
&lt;table class='CodeRay'&gt;&lt;tr&gt;
  &lt;td title='click to toggle' class='line_numbers'&gt;&lt;pre&gt;1&lt;tt&gt;
&lt;/tt&gt;2&lt;tt&gt;
&lt;/tt&gt;3&lt;tt&gt;
&lt;/tt&gt;4&lt;tt&gt;
&lt;/tt&gt;&lt;strong&gt;5&lt;/strong&gt;&lt;tt&gt;
&lt;/tt&gt;6&lt;tt&gt;
&lt;/tt&gt;&lt;/pre&gt;&lt;/td&gt;
  &lt;td class='code'&gt;&lt;pre&gt;development:&lt;tt&gt;
&lt;/tt&gt;  adapter: mysql&lt;tt&gt;
&lt;/tt&gt;  database: sample&lt;tt&gt;
&lt;/tt&gt;  username: &amp;lt;put db user name&amp;gt;&lt;tt&gt;
&lt;/tt&gt;  password: &amp;lt;put password&amp;gt;&lt;tt&gt;
&lt;/tt&gt;  host: localhost&lt;/pre&gt;&lt;/td&gt;
&lt;/tr&gt;&lt;/table&gt;

&lt;/code&gt;&lt;/pre&gt;

	&lt;h2&gt;Install the plugin &#8211; acts_as_textiled&lt;/h2&gt;


	&lt;p&gt;You can get the details to install the &lt;pre&gt;acts_as_textiled&lt;/pre&gt; plugin from the link above.  But, it&#8217;s quite simple to do.&lt;/p&gt;


&lt;pre&gt;&lt;code&gt;
&lt;table class='CodeRay'&gt;&lt;tr&gt;
  &lt;td title='click to toggle' class='line_numbers'&gt;&lt;pre&gt;1&lt;tt&gt;
&lt;/tt&gt;2&lt;tt&gt;
&lt;/tt&gt;3&lt;tt&gt;
&lt;/tt&gt;4&lt;tt&gt;
&lt;/tt&gt;&lt;strong&gt;5&lt;/strong&gt;&lt;tt&gt;
&lt;/tt&gt;6&lt;tt&gt;
&lt;/tt&gt;&lt;/pre&gt;&lt;/td&gt;
  &lt;td class='code'&gt;&lt;pre&gt;rails_apps&lt;span class='er'&gt;\&lt;/span&gt;ted_sample&amp;gt;ruby script/plugin install svn&lt;span class='sy'&gt;:/&lt;/span&gt;/errtheblog.com/svn/plugins/acts_as_textiled&lt;tt&gt;
&lt;/tt&gt;&lt;span class='co'&gt;A&lt;/span&gt;    &lt;span class='co'&gt;E&lt;/span&gt;:&lt;span class='er'&gt;\&lt;/span&gt;&lt;span class='co'&gt;InstantRails&lt;/span&gt;&lt;span class='er'&gt;\&lt;/span&gt;rails_apps&lt;span class='er'&gt;\&lt;/span&gt;ted_sample&lt;span class='er'&gt;\&lt;/span&gt;vendor&lt;span class='er'&gt;\&lt;/span&gt;plugins&lt;span class='er'&gt;\&lt;/span&gt;acts_as_textiled&lt;tt&gt;
&lt;/tt&gt;&lt;span class='co'&gt;A&lt;/span&gt;    &lt;span class='co'&gt;E&lt;/span&gt;:&lt;span class='er'&gt;\&lt;/span&gt;&lt;span class='co'&gt;InstantRails&lt;/span&gt;&lt;span class='er'&gt;\&lt;/span&gt;rails_apps&lt;span class='er'&gt;\&lt;/span&gt;ted_sample&lt;span class='er'&gt;\&lt;/span&gt;vendor&lt;span class='er'&gt;\&lt;/span&gt;plugins&lt;span class='er'&gt;\&lt;/span&gt;acts_as_textiled&lt;span class='er'&gt;\&lt;/span&gt;test&lt;tt&gt;
&lt;/tt&gt;&lt;span class='co'&gt;A&lt;/span&gt;    &lt;span class='co'&gt;E&lt;/span&gt;:&lt;span class='er'&gt;\&lt;/span&gt;&lt;span class='co'&gt;InstantRails&lt;/span&gt;&lt;span class='er'&gt;\&lt;/span&gt;rails_apps&lt;span class='er'&gt;\&lt;/span&gt;ted_sample&lt;span class='er'&gt;\&lt;/span&gt;vendor&lt;span class='er'&gt;\&lt;/span&gt;plugins&lt;span class='er'&gt;\&lt;/span&gt;acts_as_textiled&lt;span class='er'&gt;\&lt;/span&gt;test&lt;span class='er'&gt;\&lt;/span&gt;memory_test_fix.rb&lt;tt&gt;
&lt;/tt&gt;&lt;span class='co'&gt;A&lt;/span&gt;    &lt;span class='co'&gt;E&lt;/span&gt;:&lt;span class='er'&gt;\&lt;/span&gt;&lt;span class='co'&gt;InstantRails&lt;/span&gt;&lt;span class='er'&gt;\&lt;/span&gt;rails_apps&lt;span class='er'&gt;\&lt;/span&gt;ted_sample&lt;span class='er'&gt;\&lt;/span&gt;vendor&lt;span class='er'&gt;\&lt;/span&gt;plugins&lt;span class='er'&gt;\&lt;/span&gt;acts_as_textiled&lt;span class='er'&gt;\&lt;/span&gt;test&lt;span class='er'&gt;\&lt;/span&gt;setup_test.rb&lt;tt&gt;
&lt;/tt&gt;...&lt;/pre&gt;&lt;/td&gt;
&lt;/tr&gt;&lt;/table&gt;

&lt;/code&gt;&lt;/pre&gt;

	&lt;p&gt;That prepares you to do the first bit.  But while we are at it, let&#8217;s also put in the Textile Editor Plugin, shall we?&lt;/p&gt;


	&lt;h2&gt;Install the plugin &#8211; Textile Editor Helper&lt;/h2&gt;


	&lt;p&gt;This one is equally simple.  From the root directory of your Rails app, just run the following:&lt;/p&gt;


&lt;pre&gt;&lt;code&gt;
&lt;table class='CodeRay'&gt;&lt;tr&gt;
  &lt;td title='click to toggle' class='line_numbers'&gt;&lt;pre&gt;1&lt;tt&gt;
&lt;/tt&gt;2&lt;tt&gt;
&lt;/tt&gt;3&lt;tt&gt;
&lt;/tt&gt;4&lt;tt&gt;
&lt;/tt&gt;&lt;strong&gt;5&lt;/strong&gt;&lt;tt&gt;
&lt;/tt&gt;6&lt;tt&gt;
&lt;/tt&gt;7&lt;tt&gt;
&lt;/tt&gt;&lt;/pre&gt;&lt;/td&gt;
  &lt;td class='code'&gt;&lt;pre&gt;rails_apps&lt;span class='er'&gt;\&lt;/span&gt;ted_sample&amp;gt;script/plugin install http&lt;span class='sy'&gt;:/&lt;/span&gt;/svn.webtest.wvu.edu/repos/rails/plugins/textile_editor_helper/&lt;tt&gt;
&lt;/tt&gt;+ ./textile_editor_helper/&lt;span class='co'&gt;MIT&lt;/span&gt;-&lt;span class='co'&gt;LICENSE&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;+ ./textile_editor_helper/&lt;span class='co'&gt;README&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;+ ./textile_editor_helper/&lt;span class='co'&gt;Rakefile&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;+ ./textile_editor_helper/assets/images/textile-editor/background.png&lt;tt&gt;
&lt;/tt&gt;+ ./textile_editor_helper/assets/images/textile-editor/blockquote.png&lt;tt&gt;
&lt;/tt&gt;...&lt;/pre&gt;&lt;/td&gt;
&lt;/tr&gt;&lt;/table&gt;

&lt;/code&gt;&lt;/pre&gt;

	&lt;p&gt;Now, run the install script for it.&lt;/p&gt;


&lt;pre&gt;&lt;code&gt;
&lt;table class='CodeRay'&gt;&lt;tr&gt;
  &lt;td title='click to toggle' class='line_numbers'&gt;&lt;pre&gt;1&lt;tt&gt;
&lt;/tt&gt;2&lt;tt&gt;
&lt;/tt&gt;3&lt;tt&gt;
&lt;/tt&gt;4&lt;tt&gt;
&lt;/tt&gt;&lt;strong&gt;5&lt;/strong&gt;&lt;tt&gt;
&lt;/tt&gt;6&lt;tt&gt;
&lt;/tt&gt;7&lt;tt&gt;
&lt;/tt&gt;&lt;/pre&gt;&lt;/td&gt;
  &lt;td class='code'&gt;&lt;pre&gt;rails_apps&lt;span class='er'&gt;\&lt;/span&gt;ted_sample&amp;gt;rake textile_editor_helper&lt;span class='sy'&gt;:install&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;(&lt;span class='r'&gt;in&lt;/span&gt; rails_apps/ted_sample)&lt;tt&gt;
&lt;/tt&gt; * &lt;span class='co'&gt;Copying&lt;/span&gt; &lt;span class='rx'&gt;&lt;span class='dl'&gt;/&lt;/span&gt;&lt;span class='k'&gt;assets&lt;/span&gt;&lt;span class='dl'&gt;/&lt;/span&gt;&lt;span class='mod'&gt;im&lt;/span&gt;&lt;/span&gt;ages/textile-editor/background.png       to &lt;span class='rx'&gt;&lt;span class='dl'&gt;/&lt;/span&gt;&lt;span class='k'&gt;public&lt;/span&gt;&lt;span class='dl'&gt;/&lt;/span&gt;&lt;span class='mod'&gt;im&lt;/span&gt;&lt;/span&gt;ages/textile-editor/backg&lt;tt&gt;
&lt;/tt&gt;round.png&lt;tt&gt;
&lt;/tt&gt; * &lt;span class='co'&gt;Copying&lt;/span&gt; &lt;span class='rx'&gt;&lt;span class='dl'&gt;/&lt;/span&gt;&lt;span class='k'&gt;assets&lt;/span&gt;&lt;span class='dl'&gt;/&lt;/span&gt;&lt;span class='mod'&gt;im&lt;/span&gt;&lt;/span&gt;ages/textile-editor/blockquote.png       to &lt;span class='rx'&gt;&lt;span class='dl'&gt;/&lt;/span&gt;&lt;span class='k'&gt;public&lt;/span&gt;&lt;span class='dl'&gt;/&lt;/span&gt;&lt;span class='mod'&gt;im&lt;/span&gt;&lt;/span&gt;ages/textile-editor/block&lt;tt&gt;
&lt;/tt&gt;quote.png&lt;tt&gt;
&lt;/tt&gt;...&lt;/pre&gt;&lt;/td&gt;
&lt;/tr&gt;&lt;/table&gt;

&lt;/code&gt;&lt;/pre&gt;

	&lt;h2&gt;Create the first model&lt;/h2&gt;


	&lt;p&gt;OK, from the root directory of your Rails application and generate the first model&lt;/p&gt;


&lt;pre&gt;&lt;code&gt;
&lt;table class='CodeRay'&gt;&lt;tr&gt;
  &lt;td title='click to toggle' class='line_numbers'&gt;&lt;pre&gt;1&lt;tt&gt;
&lt;/tt&gt;2&lt;tt&gt;
&lt;/tt&gt;3&lt;tt&gt;
&lt;/tt&gt;4&lt;tt&gt;
&lt;/tt&gt;&lt;strong&gt;5&lt;/strong&gt;&lt;tt&gt;
&lt;/tt&gt;6&lt;tt&gt;
&lt;/tt&gt;7&lt;tt&gt;
&lt;/tt&gt;8&lt;tt&gt;
&lt;/tt&gt;9&lt;tt&gt;
&lt;/tt&gt;&lt;/pre&gt;&lt;/td&gt;
  &lt;td class='code'&gt;&lt;pre&gt;rails_apps&lt;span class='er'&gt;\&lt;/span&gt;ted_sample&amp;gt;ruby script&lt;span class='er'&gt;\&lt;/span&gt;generate model item&lt;tt&gt;
&lt;/tt&gt;      exists  app/models/&lt;tt&gt;
&lt;/tt&gt;      exists  test/unit/&lt;tt&gt;
&lt;/tt&gt;      exists  test/fixtures/&lt;tt&gt;
&lt;/tt&gt;      create  app/models/item.rb&lt;tt&gt;
&lt;/tt&gt;      create  test/unit/item_test.rb&lt;tt&gt;
&lt;/tt&gt;      create  test/fixtures/items.yml&lt;tt&gt;
&lt;/tt&gt;      create  db/migrate&lt;tt&gt;
&lt;/tt&gt;      create  db/migrate/&lt;span class='i'&gt;001&lt;/span&gt;_create_items.rb&lt;/pre&gt;&lt;/td&gt;
&lt;/tr&gt;&lt;/table&gt;

&lt;/code&gt;&lt;/pre&gt;

	&lt;h2&gt;Edit the migration file&lt;/h2&gt;


	&lt;p&gt;The next step is to add in the details about the model into the migration file.  Open up &lt;pre&gt;db/migrate/001_create_items.rb&lt;/pre&gt; and modify it so it looks something like this.&lt;/p&gt;


&lt;pre&gt;&lt;code&gt;
&lt;table class='CodeRay'&gt;&lt;tr&gt;
  &lt;td title='click to toggle' class='line_numbers'&gt;&lt;pre&gt;1&lt;tt&gt;
&lt;/tt&gt;2&lt;tt&gt;
&lt;/tt&gt;3&lt;tt&gt;
&lt;/tt&gt;4&lt;tt&gt;
&lt;/tt&gt;&lt;strong&gt;5&lt;/strong&gt;&lt;tt&gt;
&lt;/tt&gt;6&lt;tt&gt;
&lt;/tt&gt;7&lt;tt&gt;
&lt;/tt&gt;8&lt;tt&gt;
&lt;/tt&gt;9&lt;tt&gt;
&lt;/tt&gt;&lt;strong&gt;10&lt;/strong&gt;&lt;tt&gt;
&lt;/tt&gt;11&lt;tt&gt;
&lt;/tt&gt;12&lt;tt&gt;
&lt;/tt&gt;&lt;/pre&gt;&lt;/td&gt;
  &lt;td class='code'&gt;&lt;pre&gt;&lt;span class='r'&gt;class&lt;/span&gt; &lt;span class='cl'&gt;CreateItems&lt;/span&gt; &amp;lt; &lt;span class='co'&gt;ActiveRecord&lt;/span&gt;::&lt;span class='co'&gt;Migration&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;  &lt;span class='r'&gt;def&lt;/span&gt; &lt;span class='pc'&gt;self&lt;/span&gt;.up&lt;tt&gt;
&lt;/tt&gt;    create_table &lt;span class='sy'&gt;:items&lt;/span&gt; &lt;span class='r'&gt;do&lt;/span&gt; |t|&lt;tt&gt;
&lt;/tt&gt;      t.column &lt;span class='sy'&gt;:name&lt;/span&gt;, &lt;span class='sy'&gt;:string&lt;/span&gt;, &lt;span class='sy'&gt;:null&lt;/span&gt; =&amp;gt; &lt;span class='pc'&gt;false&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;      t.column &lt;span class='sy'&gt;:descr&lt;/span&gt;, &lt;span class='sy'&gt;:text&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;    &lt;span class='r'&gt;end&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;  &lt;span class='r'&gt;end&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;tt&gt;
&lt;/tt&gt;  &lt;span class='r'&gt;def&lt;/span&gt; &lt;span class='pc'&gt;self&lt;/span&gt;.down&lt;tt&gt;
&lt;/tt&gt;    drop_table &lt;span class='sy'&gt;:items&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;  &lt;span class='r'&gt;end&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;span class='r'&gt;end&lt;/span&gt;&lt;/pre&gt;&lt;/td&gt;
&lt;/tr&gt;&lt;/table&gt;

&lt;/code&gt;&lt;/pre&gt;

	&lt;p&gt;And apply the migration as always.&lt;/p&gt;


&lt;pre&gt;&lt;code&gt;
&lt;table class='CodeRay'&gt;&lt;tr&gt;
  &lt;td title='click to toggle' class='line_numbers'&gt;&lt;pre&gt;1&lt;tt&gt;
&lt;/tt&gt;2&lt;tt&gt;
&lt;/tt&gt;3&lt;tt&gt;
&lt;/tt&gt;4&lt;tt&gt;
&lt;/tt&gt;&lt;strong&gt;5&lt;/strong&gt;&lt;tt&gt;
&lt;/tt&gt;6&lt;tt&gt;
&lt;/tt&gt;&lt;/pre&gt;&lt;/td&gt;
  &lt;td class='code'&gt;&lt;pre&gt;rails_apps&lt;span class='er'&gt;\&lt;/span&gt;ted_sample&amp;gt;rake db&lt;span class='sy'&gt;:migrate&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;(&lt;span class='r'&gt;in&lt;/span&gt; rails_apps/ted_sample)&lt;tt&gt;
&lt;/tt&gt;== &lt;span class='co'&gt;CreateItems&lt;/span&gt;: migrating =====================================================&lt;tt&gt;
&lt;/tt&gt;-- create_table(&lt;span class='sy'&gt;:items&lt;/span&gt;)&lt;tt&gt;
&lt;/tt&gt;   -&amp;gt; &lt;span class='fl'&gt;0.0900&lt;/span&gt;s&lt;tt&gt;
&lt;/tt&gt;== &lt;span class='co'&gt;CreateItems&lt;/span&gt;: migrated (&lt;span class='fl'&gt;0.0900&lt;/span&gt;s) ============================================&lt;/pre&gt;&lt;/td&gt;
&lt;/tr&gt;&lt;/table&gt;

&lt;/code&gt;&lt;/pre&gt;

	&lt;p&gt;OK, time to go to the application now and actually use the plugins.&lt;/p&gt;


	&lt;h2&gt;Identify the field for Textiled data&lt;/h2&gt;


	&lt;p&gt;Open your model file &lt;pre&gt;apps\models\item.rb&lt;/pre&gt; in an editor and change it to something like the one shown below, marking &lt;pre&gt;descr&lt;/pre&gt; as the textiled field.&lt;/p&gt;


&lt;pre&gt;&lt;code&gt;
&lt;table class='CodeRay'&gt;&lt;tr&gt;
  &lt;td title='click to toggle' class='line_numbers'&gt;&lt;pre&gt;1&lt;tt&gt;
&lt;/tt&gt;2&lt;tt&gt;
&lt;/tt&gt;3&lt;tt&gt;
&lt;/tt&gt;&lt;/pre&gt;&lt;/td&gt;
  &lt;td class='code'&gt;&lt;pre&gt;&lt;span class='r'&gt;class&lt;/span&gt; &lt;span class='cl'&gt;Item&lt;/span&gt; &amp;lt; &lt;span class='co'&gt;ActiveRecord&lt;/span&gt;::&lt;span class='co'&gt;Base&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;    acts_as_textiled &lt;span class='sy'&gt;:descr&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;span class='r'&gt;end&lt;/span&gt;&lt;/pre&gt;&lt;/td&gt;
&lt;/tr&gt;&lt;/table&gt;

&lt;/code&gt;&lt;/pre&gt;

	&lt;h2&gt;Create the controller and view for the model&lt;/h2&gt;


	&lt;p&gt;OK, I&#8217;m going to cheat here and just use a scaffold to get this done faster.&lt;/p&gt;


&lt;pre&gt;&lt;code&gt;
&lt;table class='CodeRay'&gt;&lt;tr&gt;
  &lt;td title='click to toggle' class='line_numbers'&gt;&lt;pre&gt;1&lt;tt&gt;
&lt;/tt&gt;2&lt;tt&gt;
&lt;/tt&gt;3&lt;tt&gt;
&lt;/tt&gt;4&lt;tt&gt;
&lt;/tt&gt;&lt;strong&gt;5&lt;/strong&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;/pre&gt;&lt;/td&gt;
  &lt;td class='code'&gt;&lt;pre&gt;rails_apps&lt;span class='er'&gt;\&lt;/span&gt;ted_sample&amp;gt;ruby script&lt;span class='er'&gt;\&lt;/span&gt;generate scaffold item&lt;tt&gt;
&lt;/tt&gt;      exists  app/controllers/&lt;tt&gt;
&lt;/tt&gt;      exists  app/helpers/&lt;tt&gt;
&lt;/tt&gt;      create  app/views/items&lt;tt&gt;
&lt;/tt&gt;      ...&lt;/pre&gt;&lt;/td&gt;
&lt;/tr&gt;&lt;/table&gt;

&lt;/code&gt;&lt;/pre&gt;

	&lt;h2&gt;Include prototype.js&lt;/h2&gt;


	&lt;p&gt;The Textile Editor Helper relies on &lt;pre&gt;prototype.js&lt;/pre&gt; for some features.  So, you need to ensure that it is included in the final page that is rendered.  One of the easiest ways (for this sample) is to include it in the layout for the &lt;pre&gt;item&lt;/pre&gt; class.  Edit &lt;pre&gt;ted_sample\app\views\layouts\items.rhtml&lt;/pre&gt; to include a call to &lt;pre&gt;javascript_include_tag&lt;/pre&gt; in the header part of the file.&lt;/p&gt;


&lt;pre&gt;&lt;code&gt;
&lt;table class='CodeRay'&gt;&lt;tr&gt;
  &lt;td title='click to toggle' class='line_numbers'&gt;&lt;pre&gt;1&lt;tt&gt;
&lt;/tt&gt;2&lt;tt&gt;
&lt;/tt&gt;3&lt;tt&gt;
&lt;/tt&gt;4&lt;tt&gt;
&lt;/tt&gt;&lt;strong&gt;5&lt;/strong&gt;&lt;tt&gt;
&lt;/tt&gt;6&lt;tt&gt;
&lt;/tt&gt;7&lt;tt&gt;
&lt;/tt&gt;8&lt;tt&gt;
&lt;/tt&gt;&lt;/pre&gt;&lt;/td&gt;
  &lt;td class='code'&gt;&lt;pre&gt;...&lt;tt&gt;
&lt;/tt&gt;&amp;lt;head&amp;gt;&lt;tt&gt;
&lt;/tt&gt;  &amp;lt;meta http-equiv=&lt;span class='s'&gt;&lt;span class='dl'&gt;&amp;quot;&lt;/span&gt;&lt;span class='k'&gt;content-type&lt;/span&gt;&lt;span class='dl'&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt; content=&lt;span class='s'&gt;&lt;span class='dl'&gt;&amp;quot;&lt;/span&gt;&lt;span class='k'&gt;text/html;charset=UTF-8&lt;/span&gt;&lt;span class='dl'&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt; /&amp;gt;&lt;tt&gt;
&lt;/tt&gt;  &amp;lt;title&amp;gt;&lt;span class='co'&gt;Items&lt;/span&gt;: &amp;lt;%= controller.action_name &lt;span class='s'&gt;&lt;span class='dl'&gt;%&amp;gt;&lt;/span&gt;&lt;span class='k'&gt;&amp;lt;/title&lt;/span&gt;&lt;span class='dl'&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;  &amp;lt;%= stylesheet_link_tag &lt;span class='s'&gt;&lt;span class='dl'&gt;'&lt;/span&gt;&lt;span class='k'&gt;scaffold&lt;/span&gt;&lt;span class='dl'&gt;'&lt;/span&gt;&lt;/span&gt; &lt;span class='s'&gt;&lt;span class='dl'&gt;%&amp;gt;&lt;/span&gt;&lt;span class='k'&gt;&lt;tt&gt;
&lt;/tt&gt;  &amp;lt;%= javascript_include_tag 'prototype' %&lt;/span&gt;&lt;span class='dl'&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;&amp;lt;&lt;span class='rx'&gt;&lt;span class='dl'&gt;/&lt;/span&gt;&lt;span class='k'&gt;head&amp;gt;&lt;tt&gt;
&lt;/tt&gt;...&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;/td&gt;
&lt;/tr&gt;&lt;/table&gt;

&lt;/code&gt;&lt;/pre&gt;

	&lt;h2&gt;Modify the form to use the Textile Editor Helper&lt;/h2&gt;


	&lt;p&gt;(This information is direct from the Textile Editor Helper website)&lt;/p&gt;


	&lt;p&gt;Navigate to the &lt;pre&gt;app\views\items\_form.rhtml&lt;/pre&gt; so that we can add in the code for the helper.&lt;/p&gt;


	&lt;p&gt;Replace the text area tag with &lt;code&gt;&amp;lt;%= textile_editor 'object', 'field' -%&amp;gt;&lt;/code&gt; 
This accepts the same options as the regular text area tag.  Also, at the end of the form, put in the following code: &lt;code&gt;&amp;lt;%= textile_editor_initialize -%&amp;gt;&lt;/code&gt;&lt;/p&gt;


	&lt;p&gt;Once this is done, the &lt;pre&gt;app\views\items\_form.rhtml&lt;/pre&gt; file will look something like this.&lt;/p&gt;


&lt;pre&gt;&lt;code&gt;
&lt;table class='CodeRay'&gt;&lt;tr&gt;
  &lt;td title='click to toggle' class='line_numbers'&gt;&lt;pre&gt;1&lt;tt&gt;
&lt;/tt&gt;2&lt;tt&gt;
&lt;/tt&gt;3&lt;tt&gt;
&lt;/tt&gt;4&lt;tt&gt;
&lt;/tt&gt;&lt;strong&gt;5&lt;/strong&gt;&lt;tt&gt;
&lt;/tt&gt;6&lt;tt&gt;
&lt;/tt&gt;7&lt;tt&gt;
&lt;/tt&gt;8&lt;tt&gt;
&lt;/tt&gt;9&lt;tt&gt;
&lt;/tt&gt;&lt;strong&gt;10&lt;/strong&gt;&lt;tt&gt;
&lt;/tt&gt;11&lt;tt&gt;
&lt;/tt&gt;&lt;/pre&gt;&lt;/td&gt;
  &lt;td class='code'&gt;&lt;pre&gt;&amp;lt;%= error_messages_for &lt;span class='s'&gt;&lt;span class='dl'&gt;'&lt;/span&gt;&lt;span class='k'&gt;item&lt;/span&gt;&lt;span class='dl'&gt;'&lt;/span&gt;&lt;/span&gt; &lt;span class='s'&gt;&lt;span class='dl'&gt;%&amp;gt;&lt;/span&gt;&lt;span class='k'&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;tt&gt;
&lt;/tt&gt;&amp;lt;!--[form:item]--&lt;/span&gt;&lt;span class='dl'&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;&amp;lt;p&amp;gt;&amp;lt;label &lt;span class='r'&gt;for&lt;/span&gt;=&lt;span class='s'&gt;&lt;span class='dl'&gt;&amp;quot;&lt;/span&gt;&lt;span class='k'&gt;item_name&lt;/span&gt;&lt;span class='dl'&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;&amp;gt;&lt;span class='co'&gt;Name&lt;/span&gt;&amp;lt;&lt;span class='rx'&gt;&lt;span class='dl'&gt;/&lt;/span&gt;&lt;span class='k'&gt;label&amp;gt;&amp;lt;br&lt;/span&gt;&lt;span class='dl'&gt;/&lt;/span&gt;&lt;/span&gt;&amp;gt;&lt;tt&gt;
&lt;/tt&gt;&amp;lt;%= text_field &lt;span class='s'&gt;&lt;span class='dl'&gt;'&lt;/span&gt;&lt;span class='k'&gt;item&lt;/span&gt;&lt;span class='dl'&gt;'&lt;/span&gt;&lt;/span&gt;, &lt;span class='s'&gt;&lt;span class='dl'&gt;'&lt;/span&gt;&lt;span class='k'&gt;name&lt;/span&gt;&lt;span class='dl'&gt;'&lt;/span&gt;&lt;/span&gt;  &lt;span class='s'&gt;&lt;span class='dl'&gt;%&amp;gt;&lt;/span&gt;&lt;span class='k'&gt;&amp;lt;/p&lt;/span&gt;&lt;span class='dl'&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;tt&gt;
&lt;/tt&gt;&amp;lt;p&amp;gt;&amp;lt;label &lt;span class='r'&gt;for&lt;/span&gt;=&lt;span class='s'&gt;&lt;span class='dl'&gt;&amp;quot;&lt;/span&gt;&lt;span class='k'&gt;item_descr&lt;/span&gt;&lt;span class='dl'&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;&amp;gt;&lt;span class='co'&gt;Descr&lt;/span&gt;&amp;lt;&lt;span class='rx'&gt;&lt;span class='dl'&gt;/&lt;/span&gt;&lt;span class='k'&gt;label&amp;gt;&amp;lt;br&lt;/span&gt;&lt;span class='dl'&gt;/&lt;/span&gt;&lt;/span&gt;&amp;gt;&lt;tt&gt;
&lt;/tt&gt;&amp;lt;%= textile_editor &lt;span class='s'&gt;&lt;span class='dl'&gt;'&lt;/span&gt;&lt;span class='k'&gt;item&lt;/span&gt;&lt;span class='dl'&gt;'&lt;/span&gt;&lt;/span&gt;, &lt;span class='s'&gt;&lt;span class='dl'&gt;'&lt;/span&gt;&lt;span class='k'&gt;descr&lt;/span&gt;&lt;span class='dl'&gt;'&lt;/span&gt;&lt;/span&gt; -&lt;span class='s'&gt;&lt;span class='dl'&gt;%&amp;gt;&lt;/span&gt;&lt;span class='k'&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;tt&gt;
&lt;/tt&gt;&amp;lt;!--[eoform:item]--&lt;/span&gt;&lt;span class='dl'&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;&amp;lt;%= textile_editor_initialize -&lt;span class='s'&gt;&lt;span class='dl'&gt;%&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;/td&gt;
&lt;/tr&gt;&lt;/table&gt;

&lt;/code&gt;&lt;/pre&gt;

	&lt;h2&gt;One small change&lt;/h2&gt;


	&lt;p&gt;Since we are using the scaffold, it escapes all the data when it outputs it.  What this means is that if you use it as it is, the textiled fields will display the actual &lt;span class='caps'&gt;HTML&lt;/span&gt; code rather than rendering it.  So, we can change the show.rhtml and list.rhtml files to render the actual text.  I&#8217;m changing just the &lt;pre&gt;app/views/items/show.rhtml&lt;/pre&gt; file to the code below &#8211; you can change the other one if you want.&lt;/p&gt;


&lt;pre&gt;&lt;code&gt;
&lt;table class='CodeRay'&gt;&lt;tr&gt;
  &lt;td title='click to toggle' class='line_numbers'&gt;&lt;pre&gt;1&lt;tt&gt;
&lt;/tt&gt;2&lt;tt&gt;
&lt;/tt&gt;3&lt;tt&gt;
&lt;/tt&gt;4&lt;tt&gt;
&lt;/tt&gt;&lt;strong&gt;5&lt;/strong&gt;&lt;tt&gt;
&lt;/tt&gt;6&lt;tt&gt;
&lt;/tt&gt;&lt;/pre&gt;&lt;/td&gt;
  &lt;td class='code'&gt;&lt;pre&gt;&amp;lt;p&amp;gt;&amp;lt;b&amp;gt;&lt;span class='co'&gt;Name&lt;/span&gt;&lt;span class='sy'&gt;:&amp;lt;&lt;/span&gt;/b&amp;gt; &amp;lt;%=h &lt;span class='iv'&gt;@item&lt;/span&gt;.name &lt;span class='s'&gt;&lt;span class='dl'&gt;%&amp;gt;&lt;/span&gt;&lt;span class='k'&gt;&amp;lt;/p&lt;/span&gt;&lt;span class='dl'&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;&amp;lt;p&amp;gt;&amp;lt;b&amp;gt;&lt;span class='co'&gt;Description&lt;/span&gt;&lt;span class='sy'&gt;:&amp;lt;&lt;/span&gt;/b&amp;gt;&amp;lt;&lt;span class='rx'&gt;&lt;span class='dl'&gt;/&lt;/span&gt;&lt;span class='k'&gt;p&amp;gt; &lt;tt&gt;
&lt;/tt&gt;&amp;lt;%= @item.descr %&amp;gt;&amp;lt;&lt;/span&gt;&lt;span class='dl'&gt;/&lt;/span&gt;&lt;/span&gt;p&amp;gt;&lt;tt&gt;
&lt;/tt&gt;&lt;tt&gt;
&lt;/tt&gt;&amp;lt;%= link_to &lt;span class='s'&gt;&lt;span class='dl'&gt;'&lt;/span&gt;&lt;span class='k'&gt;Edit&lt;/span&gt;&lt;span class='dl'&gt;'&lt;/span&gt;&lt;/span&gt;, &lt;span class='sy'&gt;:action&lt;/span&gt; =&amp;gt; &lt;span class='s'&gt;&lt;span class='dl'&gt;'&lt;/span&gt;&lt;span class='k'&gt;edit&lt;/span&gt;&lt;span class='dl'&gt;'&lt;/span&gt;&lt;/span&gt;, &lt;span class='sy'&gt;:id&lt;/span&gt; =&amp;gt; &lt;span class='iv'&gt;@item&lt;/span&gt; &lt;span class='s'&gt;&lt;span class='dl'&gt;%&amp;gt;&lt;/span&gt;&lt;span class='k'&gt; |&lt;tt&gt;
&lt;/tt&gt;&amp;lt;%= link_to 'Back', :action =&lt;/span&gt;&lt;span class='dl'&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt; &lt;span class='s'&gt;&lt;span class='dl'&gt;'&lt;/span&gt;&lt;span class='k'&gt;list&lt;/span&gt;&lt;span class='dl'&gt;'&lt;/span&gt;&lt;/span&gt; &lt;span class='s'&gt;&lt;span class='dl'&gt;%&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;/td&gt;
&lt;/tr&gt;&lt;/table&gt;

&lt;/code&gt;&lt;/pre&gt;

	&lt;h2&gt;Start the Server&lt;/h2&gt;


&lt;pre&gt;&lt;code&gt;
&lt;table class='CodeRay'&gt;&lt;tr&gt;
  &lt;td title='click to toggle' class='line_numbers'&gt;&lt;pre&gt;1&lt;tt&gt;
&lt;/tt&gt;2&lt;tt&gt;
&lt;/tt&gt;3&lt;tt&gt;
&lt;/tt&gt;4&lt;tt&gt;
&lt;/tt&gt;&lt;/pre&gt;&lt;/td&gt;
  &lt;td class='code'&gt;&lt;pre&gt;rails_apps&lt;span class='er'&gt;\&lt;/span&gt;ted_sample&amp;gt;ruby script&lt;span class='er'&gt;\&lt;/span&gt;server&lt;tt&gt;
&lt;/tt&gt;=&amp;gt; &lt;span class='co'&gt;Booting&lt;/span&gt; &lt;span class='co'&gt;Mongrel&lt;/span&gt; (use &lt;span class='s'&gt;&lt;span class='dl'&gt;'&lt;/span&gt;&lt;span class='k'&gt;script/server webrick&lt;/span&gt;&lt;span class='dl'&gt;'&lt;/span&gt;&lt;/span&gt; to force &lt;span class='co'&gt;WEBrick&lt;/span&gt;)&lt;tt&gt;
&lt;/tt&gt;=&amp;gt; &lt;span class='co'&gt;Rails&lt;/span&gt; application starting on http&lt;span class='sy'&gt;:/&lt;/span&gt;/&lt;span class='fl'&gt;0.0&lt;/span&gt;.&lt;span class='fl'&gt;0.0&lt;/span&gt;:&lt;span class='i'&gt;3000&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;...&lt;/pre&gt;&lt;/td&gt;
&lt;/tr&gt;&lt;/table&gt;

&lt;/code&gt;&lt;/pre&gt;

	&lt;p&gt;Go to http://localhost:3000/items/ to see how it works.&lt;/p&gt;
          </content>  </entry>
  <entry xml:base="http://notepad.onghu.com/">
    <author>
      <name>mohits</name>
    </author>
    <id>tag:notepad.onghu.com,2007-03-26:2</id>
    <published>2007-03-26T06:17:00Z</published>
    <updated>2007-03-27T08:40:56Z</updated>
    <category term="Ruby"/>
    <link href="http://notepad.onghu.com/2007/3/26/sending-email-with-ruby" rel="alternate" type="text/html"/>
    <title>Sending Email with Ruby</title>
<content type="html">
            &lt;p&gt;I know that there are a number of guides online that provide the basic source for sending email using Ruby but I found that the basic sample code was lacking in one major respect &#8211; it did not set the date on the outgoing email.  That meant that there was no specific &#8220;sent time&#8221; for the email and its treatment would depend on the email client.  For example, Thunderbird would mark it with the date/ time at which it was downloaded.&lt;/p&gt;


	&lt;p&gt;The solution to this problem is really quite simple &#8211; you just need to format and print the date into the message as shown below.&lt;/p&gt;


&lt;pre&gt;&lt;code&gt;
&lt;table class='CodeRay'&gt;&lt;tr&gt;
  &lt;td title='click to toggle' class='line_numbers'&gt;&lt;pre&gt;1&lt;tt&gt;
&lt;/tt&gt;2&lt;tt&gt;
&lt;/tt&gt;3&lt;tt&gt;
&lt;/tt&gt;4&lt;tt&gt;
&lt;/tt&gt;&lt;strong&gt;5&lt;/strong&gt;&lt;tt&gt;
&lt;/tt&gt;6&lt;tt&gt;
&lt;/tt&gt;7&lt;tt&gt;
&lt;/tt&gt;8&lt;tt&gt;
&lt;/tt&gt;9&lt;tt&gt;
&lt;/tt&gt;&lt;strong&gt;10&lt;/strong&gt;&lt;tt&gt;
&lt;/tt&gt;11&lt;tt&gt;
&lt;/tt&gt;12&lt;tt&gt;
&lt;/tt&gt;13&lt;tt&gt;
&lt;/tt&gt;14&lt;tt&gt;
&lt;/tt&gt;&lt;strong&gt;15&lt;/strong&gt;&lt;tt&gt;
&lt;/tt&gt;16&lt;tt&gt;
&lt;/tt&gt;17&lt;tt&gt;
&lt;/tt&gt;18&lt;tt&gt;
&lt;/tt&gt;19&lt;tt&gt;
&lt;/tt&gt;&lt;strong&gt;20&lt;/strong&gt;&lt;tt&gt;
&lt;/tt&gt;21&lt;tt&gt;
&lt;/tt&gt;22&lt;tt&gt;
&lt;/tt&gt;23&lt;tt&gt;
&lt;/tt&gt;24&lt;tt&gt;
&lt;/tt&gt;&lt;strong&gt;25&lt;/strong&gt;&lt;tt&gt;
&lt;/tt&gt;26&lt;tt&gt;
&lt;/tt&gt;27&lt;tt&gt;
&lt;/tt&gt;28&lt;tt&gt;
&lt;/tt&gt;29&lt;tt&gt;
&lt;/tt&gt;&lt;strong&gt;30&lt;/strong&gt;&lt;tt&gt;
&lt;/tt&gt;31&lt;tt&gt;
&lt;/tt&gt;32&lt;tt&gt;
&lt;/tt&gt;33&lt;tt&gt;
&lt;/tt&gt;34&lt;tt&gt;
&lt;/tt&gt;&lt;strong&gt;35&lt;/strong&gt;&lt;tt&gt;
&lt;/tt&gt;36&lt;tt&gt;
&lt;/tt&gt;&lt;/pre&gt;&lt;/td&gt;
  &lt;td class='code'&gt;&lt;pre&gt;require &lt;span class='s'&gt;&lt;span class='dl'&gt;'&lt;/span&gt;&lt;span class='k'&gt;net/smtp&lt;/span&gt;&lt;span class='dl'&gt;'&lt;/span&gt;&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;span class='c'&gt;#Senders and Recipients&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;from_name = &lt;span class='s'&gt;&lt;span class='dl'&gt;'&lt;/span&gt;&lt;span class='k'&gt;My Name&lt;/span&gt;&lt;span class='dl'&gt;'&lt;/span&gt;&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;from_mail = &lt;span class='s'&gt;&lt;span class='dl'&gt;'&lt;/span&gt;&lt;span class='k'&gt;me@mydomain.com&lt;/span&gt;&lt;span class='dl'&gt;'&lt;/span&gt;&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;to_name = &lt;span class='s'&gt;&lt;span class='dl'&gt;'&lt;/span&gt;&lt;span class='k'&gt;My Friend&lt;/span&gt;&lt;span class='dl'&gt;'&lt;/span&gt;&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;to_mail = &lt;span class='s'&gt;&lt;span class='dl'&gt;'&lt;/span&gt;&lt;span class='k'&gt;them@theirdomain.com&lt;/span&gt;&lt;span class='dl'&gt;'&lt;/span&gt;&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;span class='c'&gt;#Servers and Authentication&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;smtp_host   = &lt;span class='s'&gt;&lt;span class='dl'&gt;'&lt;/span&gt;&lt;span class='k'&gt;mail.mydomain.com&lt;/span&gt;&lt;span class='dl'&gt;'&lt;/span&gt;&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;smtp_port   = &lt;span class='i'&gt;25&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;smtp_domain = &lt;span class='s'&gt;&lt;span class='dl'&gt;'&lt;/span&gt;&lt;span class='k'&gt;mydomain.com&lt;/span&gt;&lt;span class='dl'&gt;'&lt;/span&gt;&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;smtp_user   = &lt;span class='s'&gt;&lt;span class='dl'&gt;'&lt;/span&gt;&lt;span class='k'&gt;user@mydomain.com&lt;/span&gt;&lt;span class='dl'&gt;'&lt;/span&gt;&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;smtp_pwd    = &lt;span class='s'&gt;&lt;span class='dl'&gt;'&lt;/span&gt;&lt;span class='k'&gt;secure_password&lt;/span&gt;&lt;span class='dl'&gt;'&lt;/span&gt;&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;span class='c'&gt;#The subject and the message&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;t = &lt;span class='co'&gt;Time&lt;/span&gt;.now&lt;tt&gt;
&lt;/tt&gt;subj = &lt;span class='s'&gt;&lt;span class='dl'&gt;'&lt;/span&gt;&lt;span class='k'&gt;Sending Email with Ruby&lt;/span&gt;&lt;span class='dl'&gt;'&lt;/span&gt;&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;msg_body = &lt;span class='s'&gt;&lt;span class='dl'&gt;&amp;quot;&lt;/span&gt;&lt;span class='k'&gt;Check out the instructions on how to send mail using Ruby.&lt;/span&gt;&lt;span class='ch'&gt;\n&lt;/span&gt;&lt;span class='dl'&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;span class='c'&gt;#The date/time should look something like: Thu, 03 Jan 2006 12:33:22 -0700&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;msg_date = t.strftime(&lt;span class='s'&gt;&lt;span class='dl'&gt;&amp;quot;&lt;/span&gt;&lt;span class='k'&gt;%a, %d %b %Y %H:%M:%S +0800&lt;/span&gt;&lt;span class='dl'&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;)&lt;tt&gt;
&lt;/tt&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;span class='c'&gt;#Compose the message for the email&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;msg = &lt;span class='s'&gt;&lt;span class='dl'&gt;&amp;lt;&amp;lt;END_OF_MESSAGE&lt;/span&gt;&lt;/span&gt;&lt;span class='s'&gt;&lt;span class='k'&gt;&lt;tt&gt;
&lt;/tt&gt;Date: &lt;/span&gt;&lt;span class='il'&gt;&lt;span class='dl'&gt;#{&lt;/span&gt;msg_date&lt;span class='dl'&gt;}&lt;/span&gt;&lt;/span&gt;&lt;span class='k'&gt;&lt;tt&gt;
&lt;/tt&gt;From: &lt;/span&gt;&lt;span class='il'&gt;&lt;span class='dl'&gt;#{&lt;/span&gt;from_name&lt;span class='dl'&gt;}&lt;/span&gt;&lt;/span&gt;&lt;span class='k'&gt; &amp;lt;&lt;/span&gt;&lt;span class='il'&gt;&lt;span class='dl'&gt;#{&lt;/span&gt;from_mail&lt;span class='dl'&gt;}&lt;/span&gt;&lt;/span&gt;&lt;span class='k'&gt;&amp;gt;&lt;tt&gt;
&lt;/tt&gt;To: &lt;/span&gt;&lt;span class='il'&gt;&lt;span class='dl'&gt;#{&lt;/span&gt;to_name&lt;span class='dl'&gt;}&lt;/span&gt;&lt;/span&gt;&lt;span class='k'&gt; &amp;lt;&lt;/span&gt;&lt;span class='il'&gt;&lt;span class='dl'&gt;#{&lt;/span&gt;to_mail&lt;span class='dl'&gt;}&lt;/span&gt;&lt;/span&gt;&lt;span class='k'&gt;&amp;gt;&lt;tt&gt;
&lt;/tt&gt;Subject: &lt;/span&gt;&lt;span class='il'&gt;&lt;span class='dl'&gt;#{&lt;/span&gt;subj&lt;span class='dl'&gt;}&lt;/span&gt;&lt;/span&gt;&lt;span class='k'&gt;&lt;tt&gt;
&lt;/tt&gt;  &lt;tt&gt;
&lt;/tt&gt;&lt;/span&gt;&lt;span class='il'&gt;&lt;span class='dl'&gt;#{&lt;/span&gt;msg_body&lt;span class='dl'&gt;}&lt;/span&gt;&lt;/span&gt;&lt;span class='dl'&gt;&lt;tt&gt;
&lt;/tt&gt;END_OF_MESSAGE&lt;/span&gt;&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;span class='co'&gt;Net&lt;/span&gt;::&lt;span class='co'&gt;SMTP&lt;/span&gt;.start(smtp_host, smtp_port, smtp_domain, smtp_user, smtp_pwd, &lt;span class='sy'&gt;:plain&lt;/span&gt;) &lt;span class='r'&gt;do&lt;/span&gt; |smtp|&lt;tt&gt;
&lt;/tt&gt;  smtp.send_message msg, smtp_user, to_mail&lt;tt&gt;
&lt;/tt&gt;&lt;span class='r'&gt;end&lt;/span&gt;&lt;/pre&gt;&lt;/td&gt;
&lt;/tr&gt;&lt;/table&gt;

&lt;/code&gt;&lt;/pre&gt;

	&lt;p&gt;And that&#8217;s all there is to it!&lt;/p&gt;


	&lt;p&gt;&lt;span class='caps'&gt;TODO&lt;/span&gt;: Need to make the time printing more generic &#8211; right now, it&#8217;s kinda hard-coded to my time zone.&lt;/p&gt;
          </content>  </entry>
  <entry xml:base="http://notepad.onghu.com/">
    <author>
      <name>mohits</name>
    </author>
    <id>tag:notepad.onghu.com,2007-03-25:1</id>
    <published>2007-03-25T15:54:00Z</published>
    <updated>2007-03-25T16:23:55Z</updated>
    <link href="http://notepad.onghu.com/2007/3/25/what-s-the-notepad-about" rel="alternate" type="text/html"/>
    <title>What's the Notepad about?</title>
<content type="html">
            The Notepad is simply a collection of technical information, links, code segments, tips and tricks related to the technologies that I work with on a regular basis.  This includes the following
	&lt;ul&gt;
	&lt;li&gt;Embedded Systems&lt;/li&gt;
		&lt;li&gt;Biometrics&lt;/li&gt;
		&lt;li&gt;T-Engine&lt;/li&gt;
		&lt;li&gt;C/C++&lt;/li&gt;
		&lt;li&gt;Borland Builder &#38; CodeGear Turbo C++&lt;/li&gt;
		&lt;li&gt;Ruby&lt;/li&gt;
		&lt;li&gt;Ruby on Rails&lt;/li&gt;
		&lt;li&gt;SubVersion&lt;/li&gt;
	&lt;/ul&gt;


	&lt;p&gt;It&#8217;s not been created specifically for public consumption, but is aimed as being an online collection of things that I have found useful &#8211; with the idea being that I have a ready reference for myself when I need it!  So, you may not find very detailed or useful explanations for all the things that are here.  But, hopefully, you can use at least some of it to point you in the correct direction.&lt;/p&gt;
          </content>  </entry>
</feed>
