Web Images Videos Maps News Shopping Gmail more »
Recently Visited Groups | Help | Sign in
Google Groups Home
ANN: Second drop of RubyCLR bridge
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  8 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
John Lam  
View profile  
 More options Feb 20 2006, 8:42 pm
Newsgroups: comp.lang.ruby
From: "John Lam" <drjf...@gmail.com>
Date: Tue, 21 Feb 2006 10:42:32 +0900
Local: Mon, Feb 20 2006 8:42 pm
Subject: ANN: Second drop of RubyCLR bridge

This is a much more complete drop of the bridge:
http://www.iunknown.com/articles/2006/02/20/second-drop-of-rubyclr

To show off its features, I've built a non-trivial all-Ruby Windows Forms
2.0 RSS Reader application that's in the distribution. It's been tested with
the RTM bits of .NET FX 2.0, and Ruby 1.8.2.

Comments & questions more than welcome!

Cheers,
-John
http://www.iunknown.com


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Tanner Burson  
View profile  
 More options Feb 20 2006, 9:04 pm
Newsgroups: comp.lang.ruby
From: "Tanner Burson" <tanner.bur...@gmail.com>
Date: Tue, 21 Feb 2006 11:04:31 +0900
Local: Mon, Feb 20 2006 9:04 pm
Subject: Re: ANN: Second drop of RubyCLR bridge
On 2/20/06, John Lam <drjf...@gmail.com> wrote:

> This is a much more complete drop of the bridge:
> http://www.iunknown.com/articles/2006/02/20/second-drop-of-rubyclr

> To show off its features, I've built a non-trivial all-Ruby Windows Forms
> 2.0 RSS Reader application that's in the distribution. It's been tested with
> the RTM bits of .NET FX 2.0, and Ruby 1.8.2.

> Comments & questions more than welcome!

> Cheers,
> -John
> http://www.iunknown.com

Any idea if this will, or will be capable of working with mono?

--
===Tanner Burson===
tanner.bur...@gmail.com
http://tannerburson.com   <---Might even work one day...


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
John Lam  
View profile  
 More options Feb 20 2006, 9:08 pm
Newsgroups: comp.lang.ruby
From: "John Lam" <drjf...@gmail.com>
Date: Tue, 21 Feb 2006 11:08:49 +0900
Local: Mon, Feb 20 2006 9:08 pm
Subject: Re: ANN: Second drop of RubyCLR bridge

>> Any idea if this will, or will be capable of working with mono?

I haven't had any cycles to look at mono's implementation of the
DynamicMethod API. If they have feature parity there, then it shouldn't be
too hard. That said, that's a secondary goal at the moment, I really want to
get it to work first on .NET 2.0, and then do a port to mono. Side-by-side
dev would eat up more cycles than I have at the moment.

That said, anyone out there want to work in parallel on a mono port?

-John
http://www.iunknown.com


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Tanner Burson  
View profile  
 More options Feb 20 2006, 11:02 pm
Newsgroups: comp.lang.ruby
From: "Tanner Burson" <tanner.bur...@gmail.com>
Date: Tue, 21 Feb 2006 13:02:57 +0900
Local: Mon, Feb 20 2006 11:02 pm
Subject: Re: ANN: Second drop of RubyCLR bridge

On 2/20/06, John Lam <drjf...@gmail.com> wrote:

> >> Any idea if this will, or will be capable of working with mono?

> I haven't had any cycles to look at mono's implementation of the
> DynamicMethod API. If they have feature parity there, then it shouldn't be
> too hard. That said, that's a secondary goal at the moment, I really want
> to
> get it to work first on .NET 2.0, and then do a port to mono. Side-by-side
> dev would eat up more cycles than I have at the moment.

I don't know how far along mono's .NET 2.0 implementation has gotten, but it
would definitely be interesting to see in the long run.

That said, anyone out there want to work in parallel on a mono port?

I'd love to, I've just got about nine other projects I need to get done
first, so I can't volunteer just yet :)

-John

--
===Tanner Burson===
tanner.bur...@gmail.com
http://tannerburson.com   <---Might even work one day...

    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Matt T.  
View profile  
 More options Feb 21 2006, 12:30 am
Newsgroups: comp.lang.ruby
From: "Matt T." <magic...@gmail.com>
Date: 20 Feb 2006 21:30:56 -0800
Local: Tues, Feb 21 2006 12:30 am
Subject: Re: ANN: Second drop of RubyCLR bridge
Oh man, if this means we can finally write true-blue Windows GUI apps
in Ruby, I'm in heaven. I haven't used .NET yet, so I'm a little in the
dark about the whole deal, but just seeing the example on your page
gets me excited.

Keep it up, I'm definitely keeping an eye on this project.

-Matt T.


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
m4dc4p  
View profile  
 More options Feb 21 2006, 4:45 pm
Newsgroups: comp.lang.ruby
From: "m4dc4p" <jgbai...@gmail.com>
Date: 21 Feb 2006 13:45:17 -0800
Local: Tues, Feb 21 2006 4:45 pm
Subject: Re: ANN: Second drop of RubyCLR bridge
This is a great step forward. I've done a lot of Windows Forms work and
.NET has a really good UI layer for working with. What's more, it has
*fantastic* documentation. I tried to learn Tcl/Tk but the challenge of
translating from Perl and learning a new tool kit at the same time was
too much. This is just what I wanted to write Ruby GUI apps.

Anyways, I banged together a little 'Google Calculator' program that
uses Google's calcuator service for evaluating expressions. Sounds
trivial until you need to divide miles by fortnights or similar (try
it!).

Heres the code - just copy it into the same directory with the
rubyclr.rb file and the RbDynamicMethod.dll:

# RSS Reader sample application
# (C)Copyright 2006 John Lam

# BUG: crashes on dave winer's feed http://www.scripting.com/rss.xml -
bug in rss feed reader

require 'rubyclr'

RubyClr::reference 'System'
RubyClr::reference 'System.Drawing'
RubyClr::reference 'System.Windows.Forms'

include System::Drawing
include System::Drawing::Drawing2D
include System::Windows::Forms

require 'open-uri'
require 'cgi'

class GoogleCalc

  def self.calc(expr)
    open(("http://www.google.com/search?q=#{CGI.escape(expr.strip)}"))
do |f|
      if f.status.include? "200"
        begin
          matches = MATCH_EXP.match(f.read)
          return result_format(matches[2])
        rescue NoMethodError
         return "==> Expression not understood."
        rescue Exception
         return "==> Expression not understood. (#{$!.class.inspect},
#{$!.inspect})"
        end
      else
        return "==> Response error: #{f.status.inspect}"
      end
    end
  end

private

  MATCH_EXP = Regexp.new("<td><img
src=/images/calc_img.gif></td><td>&nbsp;</td><td nowrap>(.*?) =
(.*?)</b>")

  def self.result_format(s)
    s.gsub("<font size=-2>
</font>",",").gsub("&#215;","x").gsub("<sup>","^").gsub("</sup>", "")
  end

end

class MainForm
  attr_accessor :form

  def initialize
    form = Form.new
    form.FormBorderStyle =  FormBorderStyle::Sizable
    form.SizeGripStyle = SizeGripStyle::Show
    form.StartPosition = FormStartPosition::CenterScreen
    form.Text = "Google Calculator"
    form.Size = Size.new(220, 200)

    expressionGroupBox = GroupBox.new
    expressionGroupBox.Dock = DockStyle::Top
    expressionGroupBox.Width = 215
    expressionGroupBox.Height = 50
    expressionGroupBox.Text = "Expression"

    expressionTextBox = TextBox.new
    expressionTextBox.Location = Point.new(5, 20)
    expressionTextBox.Size = Size.new(125, 21)
    expressionTextBox.Anchor = AnchorStyles::Left | AnchorStyles::Top |
AnchorStyles::Right

    calcButton = Button.new
    calcButton.Size = Size.new(75, 23)
    calcButton.Location = Point.new(135, 19)
    calcButton.Text = "Calculate"
    calcButton.Anchor = AnchorStyles::Right | AnchorStyles::Top
    calcButton.Enabled = false

    expressionGroupBox.Controls.Add(expressionTextBox)
    expressionGroupBox.Controls.Add(calcButton)

    resultGroupBox = GroupBox.new
    resultGroupBox.Dock = DockStyle::Fill
    resultGroupBox.Text = "Results"
    resultGroupBox.Size = Size.new(100, 100)

    resultTextBox = TextBox.new
    resultTextBox.Location = Point.new(5, 20)
    resultTextBox.Size = Size.new(90, 75)
    resultTextBox.Anchor = AnchorStyles::Right | AnchorStyles::Top |
AnchorStyles::Left | AnchorStyles::Bottom
    resultTextBox.Multiline = true
    resultTextBox.ReadOnly = true
    # resultTextBox.BorderStyle = BorderStyle::None
    #resultTextBox.ForeColor = Color.Black
    #resultTextBox.BackColor = Color.White

    expressionTextBox.TextChanged do |sender, args|
      calcButton.Enabled = (expressionTextBox.Text.strip != "")
    end

    calcButton.Click do |sender, args|
      begin
        calcButton.Text = "Working ..."
        calcButton.Enabled = false
        resultTextBox.Text = GoogleCalc.calc(expressionTextBox.Text)
      rescue Exception
        resultTextBox.Text = "==> Error occurrred: $!.message"
      ensure
        calcButton.Text = "Calculate"
        calcButton.Enabled = true
      end
    end

    resultGroupBox.Controls.Add(resultTextBox)

    form.Controls.Add(resultGroupBox)
    form.Controls.Add(expressionGroupBox)
    form.PerformLayout
    @form = form
  end
end

Application.EnableVisualStyles
Application.SetCompatibleTextRenderingDefault false
Application.Run(MainForm.new.form)


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
yangfreec...@gmail.com  
View profile  
 More options Feb 22 2006, 2:03 am
Newsgroups: comp.lang.ruby
From: yangfreec...@gmail.com
Date: 21 Feb 2006 23:03:20 -0800
Local: Wed, Feb 22 2006 2:03 am
Subject: Re: ANN: Second drop of RubyCLR bridge
when i run it,it show follow errors:
dynamic constant assignment
MATCH_EXP=Regexp.new("<td><imgsrc=/images/calc_img.gif></td><td>&nbsp;</td> <td
nowrap>(.*?) = (.*?)</b>")

    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
John Lam  
View profile  
 More options Feb 22 2006, 7:27 am
Newsgroups: comp.lang.ruby
From: "John Lam" <drjf...@gmail.com>
Date: Wed, 22 Feb 2006 21:27:22 +0900
Local: Wed, Feb 22 2006 7:27 am
Subject: Re: ANN: Second drop of RubyCLR bridge

Watch out for the wrapping from the email. Just delete the carriage return
from the string.

-John

On 2/22/06, yangfreec...@gmail.com <yangfreec...@gmail.com> wrote:


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2009 Google