Technology Intro and Pricing

I’ve used Rdio for the past half-year and thought I’d explain how it works. I also had Spotify for a similar amount of time before switching to Rdio. They are very similar; I liked Rdio more.

You rent music from Rdio for about $10/month (I’m paying $18 for my wife and me plus another $5 for my son). We each get unlimited music and downloads. We each have separate accounts. Really! You can download thousands of songs to your iPhone, iTouch, or other smart phones. Obviously, you can only download limited by storage capacity. I do that for music I listen to regularly so it keeps working while I’m on the subway. If music is not already stored on my device it is streamed so you can always listen to more music.
When you stop paying you lose access to the music.
You can download an app for you Mac — for some reason I tend to prefer desktop apps. Probably some outdated notion that desktop apps are more capable then a web based interface — not so true given the number of people that use web based interfaces.

Screenshot 5 16 13 11 22 PM

The web interface is pretty similar to the app. It’s nice because you can use it without installing any software so it’s much easier to use a work.

Screenshot 5 19 13 9 26 PM


Passing extra arguments to output operator

I usually implement the output operator for a class, operator<<().
I find it useful for debugging and regression testing purposes.
Occasionally when defining a class hierarchy with polymorphism in mind
I’ll instead define a virtual print() method.

Base  base;
std::cout << "base = " << base << std::endl;

Here’s the typical implementation:

class Base {
// ...
    /// print Base with flags indicating hw much extra to include
    virtual void print (std::ostream &out, int flags);
std::ostream &
operator<< (std::ostream &out, const Base &base)
    base.print (out, 0);

So everything is great except… I now want to pass that extra
argument. I could write the following ugly code:

std::cout << "base = ";
base.print (std::cout, 1);
std::cout << std::endl;

Instead, I’m going to follow the example from <iomanip> and define a struct
that saves the arguments and then define an output operator for that
struct. The following code makes it so you can write the above as:

std::cout << "base = " << printstream (base, 1) << std::endl;

Here is the implementation of that. This expects the class to implement a method print() that takes a std::ostream and a second argument. It’s pretty easy to extend this to a print() that takes a third argument.

namespace printstream_impl {
struct PrintStream1
    const ObjectType &  m_object;
    const Arg1Type &    m_arg1;
    PrintStream1 (const ObjectType &object, const Arg1Type &arg1)
        : m_object (object),
          m_arg1 (arg1)
    std::ostream &print (std::ostream &out) const
        m_object.print (out, m_arg1);
        return out;
std::ostream &operator<<(std::ostream &out, const PrintStream1 &ps)
    ps.print (out);
    return out;
} // End namespace printstream
printstream (const ObjectType &object,
             const Arg1Type &arg1)
    return printstream_impl::PrintStream1 (object, arg1);