Blog - .NET, ASP.NET, AJAX, Ruby and more
  • Google Banner

Major Ruby OData Update v0.1.0

OData_logo_MS_small_thumb7It’s here! I’m happy to announce a major release of ruby_odata, v0.1.0. There are many enhancements found in this release so let’s dig in and see what’s new.

There is one thing that we need to get out of the way first, a breaking change. In v0.0.10 and below, queries and some instances of calls to save_changes would return a single entity if there was only one returned. This was confusing and could lead to errors. As a consumer of the gem, you wouldn’t know if a call to the Service’s execute method was a single object or an enumerable. Instead of you having to guess, those calls now return enumerables all the time. This applies to calls to execute and save_change additions. Updates, deletes, and add_link calls (we’ll get to those in a minute), as well as batch saves all return Booleans, but single save_change add calls will return an enumerable because those results are parsed similar to execute calls.

Now that that’s out of the way, let’s look at the new features.

Read More »

Posted in OData, Ruby, ruby_odata, WCF Data Services | Tagged , , | Comments closed

Ruby OData Update v0.0.10

OData_logo_MS_smallI’m happy to announce that today, ruby_odata has continued to move forward by adding additional features and fixing bugs.

I skipped an update for v0.0.9, so let’s revisit what was added/fixed back then. The major change was support for self-signed SSL certificates. That addition was courtesy of J.D Mullin. I’m sure you remember his contributions back in v0.0.8 when he added Basic HTTP Authentication. Aside from J.D.’s contributions, the library was refactored to only make one call to the service for building classes and collections. Finally, a few bug fixes wrapped up the release.

Now onto v0.0.10. A lot of changes were implemented in this release that ended up allowing for wider support for ruby_odata. Thanks to input from Michael Koegel (@konfusius), Alvaro Tejada (@Blag), Ingo Sauerzapf (@IngoS11), and Juergen Schmerder (@schmerdy) (I apologize if I missed anyone!), ruby_odata now supports (at least basic functionality) for SAP NetWeaver GateWay.

Another big change is the initial support for feed customizations. Properties may not be represented within the <m:properties> collection of an entity. Currently ruby_odata supports SyndicationTitle and SyndicationSummary, but adding the other syndication options should be easy to support. If you can supply me with the metadata and a copy of the output that includes the additional feed customizations, I will be happy to add them (or feel free to fork the project and add them yourself).

Here’s are the complete list of changes for v0.0.10:

  • New Features
    • Added the ability to pass additional parameters that are appended to the query string for requests
    • Added initial support for feed customizations (SyndicationTitle and SyndicationSummary)
    • Enhanced ruby_odata’s awareness of classes based on the metadata instead of relying on results that are returned
  • Bug Fixes
    • Fixed issues with nested collections (eager loading)
    • Handled ArgumentError on the Time.parse for older versions of Ruby; used DateTime.parse instead if Time.parse fails
    • Removed the camelize method call when building the root URL for collections (reported by mkoegel, issue #3 on github)
    • Handled building results (classes) where the category element is missing but there is a title element instead (reported by mkoegel, issue #3 on github in the comments)
  • Other
    • Change HTTP port to 8989 since 8888 conflicts with the Intel AppStore
    • Refactored service step for HTTP calls where the service address is defined within the step making it easier to make changes in the future

For the next release, I hope to continue to fix issues, finally add support for inheritance, add the ability to call a custom WebGet methods added to the service, and hopefully namespacing of entities to limit collisions. Do you have other requests? Add them to the issues list on GitHub. The previous Lighthouse site for issues has been closed in favor of using GitHub.

Posted in OData, Ruby, ruby_odata, WCF Data Services | Tagged , , | Comments closed

Silverlight 4 Multi-Binding Converter Enhancement

We have been using Colin Eberhardt’s MultiBinding Converter for Silverlight for quite a while now. It was great until we realized a problem.  When the MultiBinding Converter was off screen (hidden), it would throw a binding error stating that it couldn’t convert null to whatever (in our case it was an integer in one converter and FontWeight in another).

The Solution

The solution is rather easy.  Add a property called TargetNullValue to MultiBinding.cs in Colin’s source.  There’s no “magic” in this name, you can call it whatever you want.  TargetNullValue seems to make the most sense for its purpose in this case, and is the name of the property on the actual Silverlight Binding that we’ll be setting in the next step.

/// <summary>
/// Gets or sets the target null value.
/// </summary>
public object TargetNullValue { get; set; }


Then, hop over to MulitBindings.cs and change the binding (line 110) to utilize the TargetNullValue property on the binding for the ConvertedValue like so:

// bind the ConvertedValue of our MultiBinding instance to the target property
// of our targetElement
Binding binding = new Binding("ConvertedValue")
{
  Source = relay,
  Mode = relay.Mode,
  TargetNullValue = relay.TargetNullValue
};


Now, when you use the MultiBinding, just fill in the TargetNullValue property,  for example:

<TextBlock ...>
    <multi:BindingUtil.MultiBindings>
        <multi:MultiBindings>
            <multi:MultiBinding TargetProperty="FontWeight" TargetNullValue="Normal" Converter=...>
                <multi:MultiBinding.Bindings>
                    <multi:BindingCollection>
                        ...
                    </multi:BindingCollection>
                </multi:MultiBinding.Bindings>
            </multi:MultiBinding>
        </multi:MultiBindings>
    </multi:BindingUtil.MultiBindings>
</TextBlock>


Now my Debug Output window isn’t filled with needless binding errors!

Posted in .NET, C#, Silverlight | Tagged | Comments closed

Silverlight 4 Drop-Down Problems in Popup

Are you running Silverlight and using a Popup and a “drop-down” control like a ComboBox (or DatePicker, TimePicker, etc) as a child? You may be seeing some odd behavior when you expand the ComboBox. The “drop-down bit” ends up positioned from the left of your screen, not where it is supposed to be positioned.  Hmmm.

Turns out the solution is easy, but not easy to find. I’m hoping this post will help someone else out and prevent others from beating their heads against a wall.  Ready?

Turn off the DropShadowEffect on the Popup.

This solution is thanks to Rjacobs’s reply on the Silverlight forums. Also, vote for the issue on the Microsoft Connect site.

Posted in .NET, Silverlight | Tagged | Comments closed

Introducing a Ruby Wrapper for Google Books API

Books.  Personally, I own a ton of them.  Add in my wife’s collection, and phew.  A few years ago, I decided to get my collection under control.  I have bookcases upon bookcases all over the place and I would lose track of my books.  I wanted to catalog my collection, so I built a site to do just that.

The time has come to rebuild the project.  It’s pretty old, is missing a lot of features, has spun off into another site as well, and, and, and…  That’s for another post.  Anyway, back to the matter at hand.

For the past couple of years, I used to get my book information from Amazon’s Product Advertising API for Affiliates. Well, times change, and thanks to the State of Connecticut, I’m no longer an Amazon affiliate.  I told you that story to tell you this one…

Read More »

Posted in google_books, Ruby, Ruby on Rails | Tagged , | Comments closed