Ruby

Ruby

Creating Objects - Round 3

 

Ayende has been discussing the different ways of actually creating objects in .NET and the perf cost associated to each of them.  I thought I'd add to the mix one more method, using the DLR.  I've talked to several people who have identified concerns with the speed of the DLR so I found the results rather interesting.  The context is still the same, identify the time it takes to construct one million Created instances. The delegate:  delegate Created CreateInstance(int num, string name); The structure:    public class Created    {        public int Num;        public string Name;        public Created(int num,...

IronRuby Emerges

 

So John Lam annouced the alpha release of IronRuby, he mentions that they did a lot of work on string and arrays, unfortunately, with the current release .NET types aren't able to execute Ruby mixins. I was hoping to do something like the following: require 'mscorlib' require 'System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' list = System::Collections::ArrayList.new list.Add(5) list.Add(10) list.Add(15) list.extend Enumerable list.each {|i| puts i.to_i} The following code does execute: require 'mscorlib' require 'System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' require 'System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' require 'System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' Application = System::Windows::Forms::Application Form = System::Windows::Forms::Form Button = System::Windows::Forms::Button Point = System::Drawing::Point Size = System::Drawing::Size MessageBox = System::Windows::Forms::MessageBox window = Form.new window.text = 'Testing IronRuby'...

Fun with Ruby

 

Some of you may know that I like to play around with other programming languages, one of those being Ruby. I came across a t-shirt the other day and thought it was pretty funny. I modified it just a tad so you can run it from the console. Here it is: class Programmer def initialize(language) @language = language end def happy? @language =~ /ruby/ ? true : false end def make_happy! puts @language = 'Ruby' end end you = Programmer.new(gets) unless you.happy? you.make_happy! end

Use Ruby to Unit Test C#

 

As I mentioned earlier I would be posting an entry showing how to test your .NET code with Ruby. John Lam recently posted an example using Python.NET to test a C# class so I though I would use his C# example to show how you would do this with Ruby. First off, you will need the Ruby/.NET Bridge which is available here. Here is the C# class that we will be testing:   using System; namespace Calc { public class Calc { public int Add(int x, int y) { return x + y; } public int Divide(int x, int y) { return x / y; } } } Next, compile that...

Microsoft Visual C# MVP Award

 

I’ve been awarded the Visual C# MVP (Most Valuable Professional) award from Microsoft for 2005! I just received the email tonight with all the details regarding the program. This is a great honor, I was really delighted when I found out I had been selected. I am really looking forward to the MVP Global Summit; it will be a great chance to visit Seattle, friends and some family that live there. I know I had mentioned that my first post of the New Year would reflect using the .NET Framework from Ruby, but I am currently working on...

Linked on MSDN

 

The other day I was playing with Google and did a check to see who is linking to me (this can be done by typing link:[yoursitehere] in Google) and I noticed that MSDN is linking to my blog in their Visual C# Developer Center page! Wow, that’s was amazing, and then I noticed that a good friend and former coworker of mine noticed (okay, I told him about it) and has posted about it on his blog. I feel compelled to create a trackback. To add, for those of you that have followed my posts where I...