• Savage Beast Forum Installation

    Thursday, February 05, 2009

    The Savage beast forum is very nice and useful. sample is on the web - http://forums.pragprog.com/ . It should be very easy to install as rails plugin. however, there is compatibility over rails version 2.0.2, 2.1.0 and 2.2. Here is my successful story.

    rails -d mysql forums
    cd forums

    /* Install Restful Authentication */


    ruby script/plugin install restful_authentication
    ruby script/generate authenticated user sessions --include-activation
    svn export http://elitists.textdriven.com/svn/plugins/acts_as_state_machine/trunk vendor/plugins/acts_as_state_machine

    add these line in "config/routes.rb"
    map.activate '/activate/:activation_code', :controller => 'users', :action => 'activate', :activation_code => nil
    map.signup '/signup', :controller => 'users', :action => 'new'
    map.login '/login', :controller => 'sessions', :action => 'new'
    map.logout '/logout', :controller => 'sessions', :action => 'destroy'
    map.resources :users, :member => { :suspend   => :put,
                                         :unsuspend => :put,
                                         :purge     => :delete }

    add in "config/environment.rb"
    config.active_record.observers = :user_observer

    remove "include AuthenticatedSystem"  from "app/controllers/sessions_controller.rb" and "app/controllers/uers_controller.rb"

    add in "app/controllers/application.rb"
    include AuthenticatedSystem

    script/generate controller home index

    in "app/views/home/index.html.erb"

    <h1>Welcome</h1>
    <% if logged_in? %>
       <p><strong>You are logged in as <%=h current_user.login %></strong></p>
       <p><%= link_to 'Logout', logout_path %></p>
    <% else %>
       <p><strong>You are currently not logged in.</strong></p>
       <p>
         <%= link_to 'Login', login_path %> or
         <%= link_to 'Sign Up', signup_path %>
       </p>
    <% end %>

    in "config/routes.rb"
    map.root :controller => "home"

    rake db:create
    rake db:migrate

    ruby script/server

    (You should able to view/Login/Logout/Signup)

    Picture 7

    /* Install Savage Beast Forum */

    There is a version that work for Rails 2.1.0 from - http://github.com/aenima/aep_beast/tree/master

    ruby script/plugin install git://github.com/lazyatom/engines.git
    git clone git://github.com/aenima/aep_beast.git vendor/plugins/aep_beast
    rm -rf vendor/plugins/aep_beast/tested_plugins/engines/
    cp -R  vendor/plugins/aep_beast/tested_plugins vendor/plugins/

    gem install RedCloth
    gem install gettext

    You don’t need to install following plugins

    (ignore) ./script/plugin install white_list
    (ignore)./script/plugin install white_list_formatted_content
    (ignore)./script/plugin install git://github.com/rails/acts_as_list.git
    (ignore)./script/plugin install git://github.com/brett/gibberish.git
    (ignore)./script/plugin install git://github.com/mislav/will_paginate.git

    on Rails 2.2.0 You have to change in vendor/plugins/aep_beast/init.rb
    "Dependencies" -> "ActiveSupport::Dependencies"

    in "config/environment.rb" line 12 right after ..'boot')
    require File.join(File.dirname(__FILE__), '../vendor/plugins/engines/boot')

    ruby script/generate plugin_migration
    rake db:migrate

    in "config/routes.rb" (put on the top)
    map.from_plugin :savage_beast

    in app/models/user.rb:
    include SavageBeast::UserInit
    def display_name
        login
    end
    def admin?
        true
    end
    def currently_online
        false
    end

    in app/controllers/application.rb
    def admin?
        logged_in?
    end

    Picture 10

    /* ERRORS */


    /Library/Ruby/Gems/1.8/gems/activesupport-2.2.2/lib/active_support/core_ext/module/aliasing.rb:33:in `alias_method': undefined method `initialize_schema_information' for module `ActiveRecord::ConnectionAdapters::SchemaStatements' (NameError)

    fix by:
    ruby script/plugin discover
    ruby script/plugin install engines --force

    /Library/Ruby/Gems/1.8/gems/activesupport-2.2.2/lib/active_support/dependencies.rb:102:in `const_missing': uninitialized constant Rails::Plugin::Dependencies (NameError)
        from /Users/Jirapong/ror/forums/vendor/plugins/savage_beast/init.rb:7:in `evaluate_init_rb'
    fix by:
    ruby script/plugin dependencies

    From the Blog Blog. | Filed under | 0 comments »
  • Learning Expression Tree: Hello World

    Wednesday, January 21, 2009
    After read several of tutorial about Expression Tree,  I am getting more exciting about it.  so, my first ET program. “Hello World”.  As basic Computing operation, there are three components: Input – Call ReadLine() method to get user input Processing Output – Call WriteLine() method to display output Output - Display 1: using System; 2: using System.Linq; 3: using System.Linq.Expressions; 4: using System.Reflection; 5:  6: namespace ExpressionTree 7: { 8: class Program 9: { 10: static void Main(string[] args) 11: { 12: MethodInfo writeLine = typeof(System.Console).GetMethod("WriteLine", new Type[] { typeof(string) }); 13:  14: ConstantExpression param = Expression.Constant("Hello World, ET", typeof(string));
    From the Blog Blog. | Filed under | 1 comment »
  • Build IronRuby from GitHub

    Tuesday, January 13, 2009
    There is a great post about how to build IronRuby from Ben Hall. and I don’t want to repeat his blog, however I found myself running into difference problem after get my WinXP on Parallels Desktop formatted.  Here is what i did. Download Git from http://msysgit.googlecode.com/files/Git-1.6.1-preview20081227.exe Download Ruby 1.8.6 from http://rubyforge.org/frs/download.php/29263/ruby186-26.exe After install everything, I am ready to follow Ben’s instruction. so I open Git’s Bash. to clone IronRuby with http Oops! with command “git clone http://github.com/ironruby/ironruby.git” Got an error: error: Unable to find ab4a387b1048044312d013e7910ae818e420a503 under http://github.com/ironruby/ironruby.git Cannot obtain needed tree ab4a387b1048044312d013e7910ae818e420a503 while processing commit 01fcae7ef653f0423afb1024b3015e0c631d7f99. fatal: Fetch failed. I
    From the Blog Blog. | Filed under | 3 comments »
  • Easiest way to get IronRuby

    Monday, January 05, 2009
    Do you wonder how to get IronRuby without building from source code?
    Me too, before i found that DLR binary give me the ir.exe !! Here is how to get it
    1. Download it from CodePlex
    [Update - now you can get it from Nightly Builds at http://nightlybuilds.cloudapp.net/Project.aspx?project=dlr]
    2. Unzip
    3. Run ir.exe

    Enjoy!
    screenshot IronRuby from DLR Update: If you want to build from GitHub see this - http://www.bananacoding.com/oxite.aspx/Blog/Build-IronRuby-from-GitHub (1/23/2009) Note: .NET Framework 3.5 is required.
    From the Blog Blog. | Filed under | 0 comments »
  • Compile IronRuby on Mac

    Wednesday, December 31, 2008

    Today, I give a try of IronRuby on Mac

    What you need?
    • Mono Framework - I use Mono 2.2 RC1 - http://mono.ximian.com/monobuild/preview/download-preview/
    • Ruby 1.8.2

    First of all, I follow instruction from IronRuby.net - http://www.ironruby.net/index.php?title=Frequently_Asked_Questions/How_do_I_compile_the_code_under_Mono%3F with r180.
    It gave me frustration message:

    Exception caught by the compiler while compiling:
    Block that caused the problem begin at: Ast/LambdaExpression.cs(121,38):
    Block being compiled: [Ast/LambdaExpression.cs(121,72):,Ast/LambdaExpression.cs(123,9):]
    System.NullReferenceException: Object reference not set to an instance of an object
    Internal compiler error at Ast/LambdaExpression.cs(121,38):: exception caught while emitting MethodBuilder [Expression`1::Accept]

    Unhandled Exception: System.NullReferenceException: Object reference not set to an instance of an object at Mono.CSharp.TypeInferenceContext.FixIndependentTypeArguments (System.Type[] methodParameters, System.Boolean& fixed_any) [0x00000] at Mono.CSharp.TypeInferenceV3.InferInPhases (Mono.CSharp.EmitContext ec, Mono.CSharp.TypeInferenceContext tic, Mono.CSharp.AParametersCollection methodParameters) [0x00000] at Mono.CSharp.TypeInferenceV3.InferMethodArguments (Mono.CSharp.EmitContext ec, System.Reflection.MethodBase method) [0x00000] at Mono.CSharp.TypeManager.InferTypeArguments (Mono.CSharp.EmitContext ec, System.Collections.ArrayList arguments, System.Reflection.MethodBase& method) [0x00000] at Mono.CSharp.MethodGroupExpr.IsApplicable (Mono.CSharp.EmitContext ec, System.Collections.ArrayList arguments, Int32 arg_count, System.Reflection.MethodBase& method, System.Boolean& params_expanded_form) [0x00000] at Mono.CSharp.MethodGroupExpr.OverloadResolve (Mono.CSharp.EmitContext ec, System.Collections.ArrayList& Arguments, Boolean may_fail, Location loc) [0x00000] at Mono.CSharp.Invocation.DoResolveOverload (Mono.CSharp.EmitContext ec) [0x00000] at Mono.CSharp.Invocation.DoResolve (Mono.CSharp.EmitContext ec) [0x00000] at Mono.CSharp.Expression.Resolve (Mono.CSharp.EmitContext ec, ResolveFlags flags) [0x00000] at Mono.CSharp.Expression.Resolve (Mono.CSharp.EmitContext ec) [0x00000] at Mono.CSharp.Return.DoResolve (Mono.CSharp.EmitContext ec) [0x00000] at Mono.CSharp.ExitStatement.Resolve (Mono.CSharp.EmitContext ec) [0x00000] at Mono.CSharp.Block.Resolve (Mono.CSharp.EmitContext ec) [0x00000] at Mono.CSharp.ExplicitBlock.Resolve (Mono.CSharp.EmitContext ec) [0x00000] at Mono.CSharp.EmitContext.ResolveTopBlock (Mono.CSharp.EmitContext anonymous_method_host, Mono.CSharp.ToplevelBlock block, Mono.CSharp.Parameters ip, IMethodData md, System.Boolean& unreachable) [0x00000] rake aborted!

    run by IronRuby Mailing Group to solve the problem, with support from Ivan Porto Carrero and Michael Letterle


    the following instruction are correct way to able to build IronRuby on your Mac.
    • install Mono Framework 2.2 RC1
    • Check out IronRuby from Ivan's git
    • git clone git://github.com/casualjim/ironruby.git
      cd ironruby
      git checkout -b mono
      git pull origin mono
      cd merlin/main/Languages/Ruby
    • set merlin_root to source code folder by
    • rake compile mono=1
    Success!!!

    Run a sample program

    back to folder /merlin/main/bin/mono_debug/ , looking for ir.exe , It is similar to irb . run it by
    > mono ir.exe
    IronRuby 1.0.0.0 on .NET 2.0.50727.1433
    Copyright (c) Microsoft Corporation. All rights reserved.

    Note that local variables do not work today in the console.
    As a workaround, use globals instead (eg $x = 42 instead of x = 42).

    >>> 10.downto(1){ puts 'hello ironruby' }
    hello ironruby
    hello ironruby
    hello ironruby
    hello ironruby
    hello ironruby
    hello ironruby
    hello ironruby
    hello ironruby
    hello ironruby
    hello ironruby

    Update: found same resource at http://rubydoes.net/2008/12/30/building-ironruby-with-mono/
    From the Blog Blog. | Filed under | 0 comments »
  • Deploy Oxite to Web Hosting

    Tuesday, December 23, 2008
    For those who came across ASP.NET MVC BlogEngine named "Oxite", you most likely to deploy it to your web hosting just like me!. Result! as you see now :-) I mostly ignore other people tutorial and give it kick out myself. Here are what i did.
    1. Get Oxite source code from http://www.collab.net/downloads/subversion/svn
    2. Open Oxite.sln win VS.NET 2008, Publish to local folder
    3. Install database with sqlcmd.exe command-line
    4. Submit ticket to Web Hosting company to make extension-less url
    From the Blog Blog. | 0 comments »