Entries:
Comments:
Posts:

Loading User Information from Channel 9

Something went wrong getting user information from Channel 9

Latest Achievement:

Loading User Information from MSDN

Something went wrong getting user information from MSDN

Visual Studio Achievements

Latest Achievement:

Loading Visual Studio Achievements

Something went wrong getting the Visual Studio Achievements

Int64

Int64 Int64

Niner since 2011

  • GoingNative 8: Introducing Casablanca - A Modern C++ API for Connected Computing

    @benjaminLindley: Ah, that makes sense. Looking at the interface, it appears the solution is to return a const ref to the underlying field map and/or element vector and use their find/at functions:

    auto& fields = jobject.fields();
    auto iter = fields.find("id");
    if (iter != fields.end())
        id = static_cast<int>(iter->second.as_double());

    The field map is implemented as stdext::hash_map - wonder why no std::unordered_map?

  • GoingNative 8: Introducing Casablanca - A Modern C++ API for Connected Computing

    This is a really nice library, something that I would love to see in the standard. The client code I wrote was really simple and clean. You really start to see the goodness of C++11 when you use a library like this.

    One comment - is there a reason why the field/key operators in the json::value class only return by reference and not by const reference as well?

    Something like this:

    void kung_foo(json::value const& jobject)
    {
        int id = static_cast<int>(jobject["id"].as_double());
    }

    won't compile.

  • Channel 9 now has a Windows 8 app!

    Another suggestion about horizontal scrolling that's bugging me. (not only in your app but others)

    1) On the main page, scroll right so that something like the "Shows" group is near the middle of the screen. The horizontal scrollbar position should be about 2/3rds of the way across now.

    2) Click on one of the items in the Shows group.

    3) Once the item is opened, click the Back button.

    When you return to the main page, the horizontal scrollbar is reset to the far left position when, in my opinion, it should be at the same place it was at the end of step 1.

  • Windows 8 Consumer Preview Demo

    , DeadX07 wrote

    Switching back and forth from Metro to Classic desktop takes almost 2-3 times as long to do the same old tasks, and is unproductive and intrusive in that regard.

    What is it specifically you're switching from/to? (which apps/services)

     

  • Ping 133: Googlighting, Lumia Bundle, Facebook & Bing, Visual Studio 11 Beta

    Moonlighting - hey, there's a modern show people can relate to.

    What's the future plan, to attack Apple using a Little House on the Prairie parody?

  • Writing modern C++ code: how C++ has evolved over the years

    Geddy Lee pushed to the back of a vector. Now I've seen everything...  Big Smile

    Is there a table anywhere that lists all the classes/algorithms/etc. that have been added to the std:: library?

  • C9 Lectures: Stephan T Lavavej - Advanced STL, 5 of n

    Something I just remembered - if you want a quick and easy way to start using boost, this site provides an installer for the headers and pre-built binaries: (VS2003-VS2010, 32-bit only)

    http://www.boostpro.com/download/

    , C64 wrote

    BTW: Does it work properly with Unicode characters? I see your code uses std::string, it would be good if we could safely use it with Unicode filenames. Or does Boost.Filesystem use UTF-8 as Unicode encoding instead of UTF-16, so std::string is OK in this case?

    Thanks for clarifying this.

    The path class supports multiple character types. So you can replace these:

    void free_function(std::string const& file_name);
    void free_function(std::wstring const& file_name);

    with this:

    void free_function(boost::filesystem::path const& file_name);

    One function instead of one for each string type you need to support.

    http://www.boost.org/doc/libs/1_46_1/libs/filesystem/v3/doc/reference.html#class-path

  • C9 Lectures: Stephan T Lavavej - Advanced STL, 5 of n

    Boost is truly great, not just from a content standpoint, but in how fast they release new versions/updates. I'm using it primary for TR1 support, but there's alot of other excellent stuff I've used:

    • String Algorithms/Format (boost::format is probably my most frequently used non-TR1 feature)
    • UUID
    • Exceptions/error_info
    • Serialization
    • noncopyable
    • Slots/Signals
    • Threads
    • checked_delete
    • FileSystem/path
    • Date/Time
    • IOStreams/zlib support
    • ASIO (networking)
    • Test (Although, I actually prefer UnitTest++ for unit testing)

    I'm off to try mapped files, something I can use that I wasn't aware of - thanks Thomas.

    , Deraynger wrote

    Some general questions:

    How would you return the vertices vector to an OpenGL function? What I do is (don't have it here, but somehow) something like:

    1
    2
    3
    4
    5
    6
    7
    inlineconst vector<vert3>& Verts( void ) const
    {
        return_vertices;
    }
     
    // Somewhere in loop code
    glDrawElements( someVal, someVal, someVal, &myObj->Verts()[0] );

    Why not just return the pointer?

    vert3 const* Foo::vertices_data() const
    {
        if (_vertices.empty())
            throw std::runtime_error("See Effective STL, item 16");
        return &_vertices[0];
    }
    
    ...
    
    Foo foo;
    vert3 const* data = foo.vertices_data();

  • Tony Goodhew: VC++ Developer Communication - Questions and Answers

    What I'd like to see is a stand-alone VC++ product like you had back in the 90s. (I think it was called VC++ Pro?) I never understood why you guys deviated from that - is it really fair that I have to pay for C#, VB and whatever other .Net language is in VS Pro when I have no use for them? It's like being forced to buy the Godfather boxset when all I want is I and II. (Clarification: I'm not saying C#/VB quality = Godfather III quality, I'm simply saying I don't use them)

     

    MFC - I think it's the best c++ option when you want an app that looks and feels like a Windows app. As others have said, the big problem is the code feels too non-standardish and outdated. I think even Qt suffers from this, but not quite to the same extent. It would be great to see std::containers, algorithms, etc. used in the MFC library, as well as some refactoring to use some of the current popular design patterns. (say, MVC)

     

    C++0x - My guess is that it will be a good 3+ years before you can write code that's truly transparent across the major platforms/compilers, and I don't really see the point in writing C++0x based code until then. (I can get by with current standard + boost for now)

     

    But, since you are looking for input, the items I prefer from the new standard are the ones that decrease verbosity - initializer lists, range-based for loops, constructors calling other constructors, data member initialization, etc. The less typing, the better IMO.