Trans | 1 Apr 2008 01:34
Picon
Gravatar

Re: Suggest alternatives for Facets paramix?


On Mar 31, 6:27 pm, "Jacob Burkhart" <igoti... <at> gmail.com> wrote:
> I Can't seem to find any documentation or explanation as to why paramix has
> been forcibly deprecated from facets:http://facets.rubyforge.org/doc/changes.html
>
> And apparently that lack of documentation means not too many other people
> were making use of this cool tool.
>
> You see a similar technique used a lot in rails.  For example, you'll add
> the make_resourceful plugin and now all of your controller have the class
> method make_resourceful. (And that takes some arguments) And when you call
> it ends up including some module from the plugin that adds things to your
> controller. great.
>
> But all of that takes a fair amount of up-front class_eval to add the
> make_resourceful class method to everything.
>
> For simple add-ons I like to use paramix.
>
> For example, I have a simple module called SqlSearch, and I do
>
> include SqlSearch, :on => ['name', 'content']
>
> paramix gives me access to those hash parameters in my self.included(base)
> call in the module.  So much simpler and cleaner than declaring class method
> everywhere, and there's a clear and definite association here.  You KNOW to
> look for a SqlSearch module to find out what's going on  I could instead
> have defined the sql_search class method on ActiveRecord::Base...  but then
> I have to have require 'sql_search', I can't just have the const_missing
> SqlSearch trigger the load needed.... messiness?
(Continue reading)

Eric Hodel | 1 Apr 2008 01:36
Favicon
Gravatar

Re: RDoc 2 (Was: Improvements to RDoc (ideas for GSoC))

Please don't top-post.

On Mar 30, 2008, at 10:58 AM, Jeremy McAnally wrote:
> I'd written an RDoc alternative called DocR that used ERb, but I'm
> glad you switched to ERb.  Saves me a lot of effort and maintenance
> crap. :)
>
> I'm looking to make a small hook or DSL or something for extensions to
> the RDoc markup (see what Merb is doing with their markup or maybe
> YARD or whatever) to let people add interesting things (for example a
> public API might want to add the automatic appending of resource URLs
> to the docs or something).  I'll grab it out of trunk and look at it
> tonight.

It's easy to add "specials" to RDoc markup, depending upon how  
complicated you want them to be.  I wrote a small wiki using RDoc 2's  
markup here:

http://blog.segment7.net/articles/2008/02/14/an-rdoc-wiki

A WikiWord is handled like this:

class WikiHtml < RDoc::Markup::ToHtml
   def initialize
     super

      <at> markup.add_special(/\b(([A-Z][a-z]+){2,})\b/, :WIKIWORD)
   end

   def handle_special_WIKIWORD(special)
(Continue reading)

Eric Hodel | 1 Apr 2008 01:46
Favicon
Gravatar

Re: [ANN] RubyGems 1.1.0

On Mar 31, 2008, at 14:58 PM, hemant wrote:
> On 3/29/08, Eric Hodel <drbrain <at> segment7.net> wrote:
>> = Announce: RubyGems Release 1.1.0
>>
>> Release 1.1.0 adds some new features and fixes some bugs.
>
> Eric, You marked this bug I reported as closed:
>
> http://rubyforge.org/tracker/?func=detail&atid=575&aid=17983&group_id=126
>
> and yet, today when I did:
>
> sudo gem update --system
>
> I got:
>
> gem --version
>
> 0.9.5
>
> I found that executable got installed in:
>
> /usr/local/lib/ruby/site_ruby/bin
>
> and when I try to execute 'gem' binary from that location, I get:
>
> ./gem:14: undefined method `ruby_version' for Gem:Module  
> (NoMethodError)
>
> And ideas?
(Continue reading)

yermej | 1 Apr 2008 01:55
Picon

Re: Make Soap Body tag self closing?

On Mar 31, 6:51 pm, yermej <yer... <at> gmail.com> wrote:
> On Mar 31, 4:12 pm, jammendolia <jammendo... <at> gmail.com> wrote:
>
>
>
> > > A hack: take the final XML and do a string substitution.
>
> > > final_xml.sub!( '<soap:Body></soap:Body>', '<soap:Body/>')
>
> > Thanks for the reply James!
>
> > I had thought of using this approach, and I'm completely open to it,
> > my problem is that I'm not sure where I can intercept the request to
> > make this change. I need to hook in somewhere after it's been
> > generated but before it's sent across the wire.
>
> > Any suggestions?
>
> > Thanks again,
>
> > Joe
>
> I'm not positive, but I think you could implement James's idea in
> SOAP::RPC::Proxy#marshal (in /usr/lib/ruby/1.8/soap/rpc/proxy.rb
> here).

Sorry. That should be SOAP::RPC::Proxy::Operation#marshal.

yermej | 1 Apr 2008 01:55
Picon

Re: Make Soap Body tag self closing?

On Mar 31, 4:12 pm, jammendolia <jammendo... <at> gmail.com> wrote:
> > A hack: take the final XML and do a string substitution.
>
> > final_xml.sub!( '<soap:Body></soap:Body>', '<soap:Body/>')
>
> Thanks for the reply James!
>
> I had thought of using this approach, and I'm completely open to it,
> my problem is that I'm not sure where I can intercept the request to
> make this change. I need to hook in somewhere after it's been
> generated but before it's sent across the wire.
>
> Any suggestions?
>
> Thanks again,
>
> Joe

I'm not positive, but I think you could implement James's idea in
SOAP::RPC::Proxy#marshal (in /usr/lib/ruby/1.8/soap/rpc/proxy.rb
here).

I haven't tested this, but I would save this:

module SOAP
module RPC

class Proxy
private
  class Operation
(Continue reading)

Michael Brooks | 1 Apr 2008 02:05
Picon
Favicon

Re: Create A Distributable Ruby Program With Minimal Install

Erik Veenstra wrote:
>> ... does anyone know if Erik still maintains it?
> 
> Yes, he still maintains it. Actually, there will probably be a new
> release in a couple of days (read: weeks).
> 
> gegroet,
> Erik V. - http://www.erikveen.dds.nl/
> 

Hello Erik:

Please pat yourself on the back for me.  I haven't used rubyscript2exe 
yet but I'm grateful that you've provided the option.

Michael

James Britt | 1 Apr 2008 02:15
Picon
Gravatar

Re: Create A Distributable Ruby Program With Minimal Install

eumario <at> gmail.com wrote:
> Hey Wesley,
> 
> There's currently two available out there, in which allows you to
> create a Self-Contained Application, each with different methods of
> doing it.

You can also use JRuby, then bundle up your app in a jar and use Java 
Web Start to deploy it.  Installation is a matter of clicking a link on 
a Web page.

Fellow Happy Camper Logan Barnett gave a demo of this at last weekend's 
MountainWest RubyConf.

--

-- 
James Britt

"Tear it up and start again."
  - Anonymous

Nikos Dimitrakopoulos | 1 Apr 2008 02:23
Picon
Gravatar

Re: This Week in Ruby

Antonio Cangiano wrote:
> Hi guys,
> 
> this morning I published a post entitled "This Week in Ruby" in which
> I outline some of the highlights from the Ruby and Rails communities
> throughout the past week. If people find it interesting, I plan to
> publish a new version approximatively each week (trying to stick to
> Mondays).
> 
> You can read it here: 
> http://antoniocangiano.com/2008/03/31/this-week-in-ruby-march-31-2008/
> 
> Cheers,
> Antonio

Wow, this is too much information for a monday morning (or for a late 
night monday night at the time being! :D

Nice article, i hope you manage to keep it on a regular basis...

-Nikos
--

-- 
Posted via http://www.ruby-forum.com/.

Trans | 1 Apr 2008 02:27
Picon
Gravatar

Re: Suggest alternatives for Facets paramix?


On Mar 31, 7:34 pm, Trans <transf... <at> gmail.com> wrote:
> I worked on it last night, but it's a tough nut.

Huh... it may have just a fallen into place. What do you think of:

  require 'facets/module/basename'
  require 'facets/module/modspace'

  module Paramix  # or PatrametricMixin ?

    def self.append_features(base)
      base.modspace.module_eval %{
        def #{base.basename.to_s}(parameters, &block)
          Delegator.new(#{base}, parameters, &block)
        end
      }
    end

    # It you want to define the module method by hand. You
    # can use Parmix.new instead of Parmix::Delegator.new.

    def self.new(delegate_module, parameters={}, &base_block)
      Delegator.new(delegate_module, parameters, &base_block)
    end

    #

    class Delegator < Module

(Continue reading)

Michael Brooks | 1 Apr 2008 03:00
Picon
Favicon

Re: Primes in P?

Charles Zheng wrote:
> There is an algorithm that tests primes with a polynomial running time:
> http://fatphil.org/maths/AKS/
> 
> Has anyone coded it in Ruby?

Hello Charles:

My head hurt trying to understand the wikipedia description for 
polynomial time so I stopped read it.  That aside, a cool algorithm was 
pointed out by Tim Pease in March of 2007.  It uses regular expressions 
to achieve, to a point, non-exponential solving times for prime numbers.

Here is an example of that algorithm demonstrated via a method which 
extends the Fixnum class.

class Fixnum
   def is_prime?
     ((("1" * self) =~ /^1$|^(11+?)\1+$/) == nil)
   end
end

irb(main):009:0> 2.is_prime?
=> true
irb(main):010:0> 113.is_prime?
=> true
irb(main):008:0> 123457.is_prime?
=> true

The turnaround time on solving is almost instantaneous for this 
(Continue reading)


Gmane