Cookie Based Sessions in Current Rails

Posted by stoyan Thu, 22 Feb 2007 02:55:00 GMT

Seems Cookie Based Sessions are the New Default in Edge Rails : …Cookie-based sessions are just faster to retrieve and process than hitting the file-system on every request. Plus, I would imagine they scale considerably better as they’re persisted on the client side and have no server-side persistence requirements…

So I made a cookie-based sessions patch agains current Rails (actionpack-1.13.2). Usage (from inside your project):
rake rails:freeze:gems
cd vendor
wget http://bgjap.net/code/ruby/ror/session_store-1.13.2.patch
patch -p0 < session_store-1.13.2.patch

Posted in Programing, Ruby | no comments

MicroRails

Posted by stoyan Wed, 24 Jan 2007 08:06:00 GMT

minimal = KISS = i like it :)

  • Camping is a web framework which consistently stays at less than 4kb of code.
  • Mosquito is a simple test framework for why the lucky stiff’s Camping web library. It provides simple hooks and a few assertions for doing unit and functional tests on your Camping models and controllers.
  • MicroTest . see also Archive for the ’Ruby’ Category
  • ComatoseComatose is a micro CMS, implemented as a Rails plugin, that is designed to be easy to embed and extend.

Posted in Programing, Ruby | no comments

6th Kansai Rails meeting in Kobe

Posted by stoyan Wed, 24 Jan 2007 08:02:00 GMT

After small timeout I found a time to put some notes for the last Rails meeting in Kobe .

Sometimes StikiPad is down (specially when i need my notes ;) ), so like a work around will try to duplicate all notes on the self-hosted Junebug -powered wiki . For the related discussions there is a Beast -powered forum . Hahahah © Powered by RoR site a ;) The only missing part is maybe Mephisto for blogging. Or I can use my homemade Restolog when it’s ready.

Posted in Ruby, Personal | no comments

Webserver with Mongrel

Posted by stoyan Tue, 14 Nov 2006 05:49:00 GMT

After seen a small webservers in Perl and Ruby here is my try with using Mongrel :

Start an webserver on all interfaces (0.0.0.0), port 3002, serving static pages from ./html/ directory:
require 'mongrel'

config = Mongrel::Configurator.new :host => "0.0.0.0", :port => 3002 do
  listener { uri "/", :handler => Mongrel::DirHandler.new("html/") }
  trap("INT") { stop }
  run
end

config.join
And with adding some statistics (on http://.../status/ URL):
#!/usr/bin/env ruby
require 'rubygems'
require 'mongrel'
require 'yaml'

stats = Mongrel::StatisticsFilter.new(:sample_rate => 1)

config = Mongrel::Configurator.new :host => "0.0.0.0", :port => 3002 do
  listener do
    uri "/", :handler => Mongrel::DirHandler.new("html/")
    uri "/", :handler => stats
    uri "/status", :handler => Mongrel::StatusHandler.new(:stats_filter => stats)
  end

  trap("INT") { stop }
  run
end

puts "Mongrel running on 0.0.0.0:3002 with docroot ./html/" 
config.join

I’m using it for serving static pages, generated with Rote – pretty fast ;)

Posted in Programing, SysAdmin, Ruby | no comments

The tao of MOOOO

Posted by stoyan Fri, 15 Sep 2006 07:11:00 GMT

Just a copy from my old blog . I’m not using it anymore, but don’t want to lose this post:

I ‘saw’ several times people to welcome each other in #netbsd with ‘mooooooooooooo’. I wanted to know why? What is the meaning? What is relation between the cows and BSD? The answer from gilbert fernandes follows (thanks a lot for this, gilb):
11:08 < gilb> it all started on openbsd with monkeys
11:08 < gilb> monkeys is another name for some breed of hackers
11:08 < gilb> like dug song
11:08 < gilb> people that develop tools aimed at security/hacking and so on
11:08 < gilb> so for fun, people on openbsd started creating a bestiary
11:08 < gilb> the monkey is the advanced user of openbsd
11:09 < gilb> it’s not only a developer but someone that’s able to write programs to
                     enhance use of openbsd
11:09 < gilb> like dsniff for example ;)
11:09 < gilb> but the monkeys usually write programs fast and spread them,
                     it’s not always cute code
11:09 < gilb> there is an other breed: the cows
11:09 < gilb> the cows do things slowly but with care
11:09 < gilb> they chew code like real life cows chew grass
11:10 < gilb> code is written, written again and again, and has to pass all checks and so on
11:10 < gilb> cows are also considerated as meditative users
11:10 < gilb> they spend a lot of time reading and fixing code, porting code, writing docs :)
11:10 < gilb> the cows take things slowly to get farther
11:11 < gilb> while monkeys choose a target and fulfill it
11:11 < gilb> thus the cow has a wider scope and aims. that’s the tao of the cow
11:11 < gilb> then we got the weasels
11:11 < gilb> and dragons
11:11 < gilb> dragons = senior developer
11:12 < gilb> a weasel is an admin
11:12 < gilb> an openbsd admin is a weasel
11:12 < gilb> expert is making sure a server is up all the time, day and night
11:12 < gilb> the dragons are the keepers of thy code
11:12 < gilb> their lair contains a lot of ancient and rare machines
11:12 < gilb> and their pride is porting bsd code to those machines
11:12 < gilb> like VAX, old IBM servers and so on
11:13 < gilb> and they protect that lair like dragons protect their gold
11:13 < gilb> they are also called dragons because they usually burn people down in FLAMES
11:13 < gilb> :>
11:13 < gilb> like: “get a life, move away from BSD and don’t write on our mailing-list ever.
                     even if you reincarnate.”
11:13 < gilb> well.. you know what a flame is :)
11:14 < gilb> the bestiary is just geek talk
11:15 < gilb> the newbies do not exist in the bestiary
11:15 < gilb> they are in the void
11:15 < gilb> casted into null pointers
11:15 < gilb> :)
11:15 < gilb> a cow is like a buddha-wanabee
11:16 < gilb> the tao of the cow explains there is no beginning
11:16 < gilb> it’s just a cycle
11:16 < gilb> the cow or monkeys end up being dragons someday, sometimes they don’t
11:16 < gilb> where all begin and ends: it doesn’t matter where you start and where you go
11:17 < gilb> what matters is what you are, and what the tao tells you : what you could become
11:17 < gilb> in fact, we are all already dragons wanabees
11:17 < gilb> we just need to find ourselves, though work and learning
11:17 < gilb> learning programming, unix lore, source code, hacking..
11:18 < gilb> and someday people all around see you shine differently and ask you for guidance

Posted in Fun | no comments

ruby-1.8.5

Posted by stoyan Fri, 25 Aug 2006 10:18:00 GMT

We have just released the latest stable version of Ruby. This is a bug fix release. There should be no big difference from 1.8.4. We hope 1.8.5 is more stable and reliable than its preceding versions.

—Yukihiro Matsumoto

And the change summary by Mauricio Fernandez

Posted in Programing, Ruby | no comments

nginx notes

Posted by stoyan Fri, 25 Aug 2006 09:59:00 GMT

I put some notes for nginx on my wiki .

The rails system administration is like waves – somebody found a new software and the community just fulfill it. Maybe there must be some name for this effect. Something like digg-effect but maybe Rails wave hahaha.

First there was lighttpd , now nginx comming. Maybe your piece of code will be the next. Are your ready? ;)

Posted in SysAdmin, Ruby | no comments

[ANN] Restolog-1.2 (beta1)

Posted by stoyan Thu, 24 Aug 2006 08:57:00 GMT

Created a first beta version of Restolog-1.2 . What’s new in it:
  • Textile markup for articles body (act_as_textiled plugin)
  • REST client (‘script/rester’)
  • New REST API calls added (mostly for articles and comments)
  • Some documentation (README, USAGE, CHANGELOG)
Download:
  • tarballs: restolog-1.2b1.tgz
  • SVN: svn checkout http://restolog.googlecode.com/svn/trunk/ restolog
Why it is still beta?
  • update via XML still do not work
  • authentication via keys inside the URL still not possible (Basic Authentication for now)

And by request from Benjamin there is pretty detailed Restolog USAGE file included. Enjoy

Posted in Ruby, Programing, REST | no comments

MapReduce for Ruby: Ridiculously Easy Distributed Programming

Posted by stoyan Mon, 21 Aug 2006 07:03:00 GMT

Google’s MapReduce is now available for Ruby (via gem install starfish ). MapReduce is the technique used by Google to do monstrous distributed programming over 30 terabyte files.

Here is the basic code that will get you up and running with MapReduce in Starfish .
    # item.rb
    ActiveRecord::Base.establish_connection(
      :adapter  => "mysql",
      :host     => "localhost",
      :username => "root",
      :password => "",
      :database => "some_database" 
    )

    class Item < ActiveRecord::Base; end

    server do |map_reduce|
      map_reduce.type = Item
    end

    client do |item|
      logger.info item.id
    end
Now just run:
    starfish item.rb
and Starfish takes care of the rest. The code above does the following:
  • The server grabs all the items via: Item.find(:all)
  • Each of the clients grab an item from the collection
  • When there are no more items to be grabbed, everything shuts down

Just add REST (and it’s come by default with the Edge Rails) and you’ll have your own S3 or GDrive for free ;)

Posted in Ruby | no comments

[ANN] Restolog - RESTful blog example

Posted by stoyan Fri, 11 Aug 2006 03:30:00 GMT

I modified a little the original Alisdair McDiarmid’s RestBlog sources and created very simple blog system. Made an announce to the Rails ML. The copy of it follows:

Very simple blog system based on REST/CRUD ideas. Sources (all credits going to the authors, i just combined their work):

The purpose is mostly proof of concept, not typo/mephisto etc. competition.

Read more...

Posted in Ruby, Programing, REST | 1 comment

Older posts: 1 2 3 ... 13

Powered
Ruby Blogs Directory
Performa
Box.net Refer