Monthly Archives: June 2006

Windows Media Player 11 continued…

Some things I really like about the new media player:

  • It is a LOT faster. I have at least 15,000 songs I’ve ripped from my large CD collection. WMP 10 took far too long enumerating albums and songs.
  • The instant search may become my primary way of finding specific music to listen to.
  • I like the tile view — it makes the experience of picking music to play sort of like browsing a physical array of CDs. I have so much music that I often don’t know what I want to listen to–browsing is essential.
  • Very intuitive–I figured out how to navigate among the new views very easily.
  • The shuffle/repeat options is much more prominent on the play-control bar. I switch shuffle on and off constantly.

Bose headphones

I received many wonderful gifts for my birthday, but these in particular have helped me at work in a way nothing else has.

I listen to music constantly as a program–it helps me concentrate and eliminates all other distractions. 

They really do work as well as I expected–maybe even better. I work in a pretty noisy environment–the hum of airconditioning, computers, and people is constant. These take it all away. I don’t get ear fatigue because the volume is lower than I usually had it, and the cuffs fit around the ears, not on them. The A/C sound is completely gone, and people sound like they’re far away, even if talking right next to me. I’ve heard things in many songs that I’ve never heard before, especially at the end of some tracks when the last vibrations of an instrument are fading out–you can hear every last bit, and it’s wonderful!

 

Riverdance

Leticia and I took in Riverdance over the weekend. I’d seen the video and listened to the music countless times, but seeing it live on stage is a completely different experience. If the tour ever comes to your area I highly recommend it. The foot work is simply out of this world and the music is a lot more fun live (isn’t it always?). I can’t say I have a favorite part–it was all incredible.

Getting the real view under a CPreviewView (MFC)

I had an interesting problem at work the other day. In this MFC application, there are a number of views that can be printed and we support the Print Preview function.

However, in one of these views we rely on getting the view from the frame window in order to handle command updates. This is accomplished with code like this:

 pWnd = reinterpret_cast< CBaseView*>(GetActiveView());

However, when you’re in print preview mode, GetActiveView() returns a CPreviewView, not the underlying view (CBaseView). If you look in the source of CPreviewView, you’ll notice that it has a protected member m_pOrigView, which is indeed the one I want. However, there is no way of accessing that value. (I briefly toyed with the idea of directly accessing the memory via its offset from the beginning of the object, but as this software has to run in unpredictable environments, and it’s a horrible idea anyway, I let that go…)

 If you try this:

pWnd=(CBaseView*)pWnd->GetDescendantWindow(MAP_WINDOW);

Where MAP_WINDOW is the ID of the real view that I want, it won’t work (it may work in the general case, but it doesn’t work in my case).

I had two options, just return NULL and tell the higher-level functions to not do those certain command updates when the returned view is NULL. This should be done anyway, so I implemented those checks.

However, it still bugged me that I couldn’t get access to the real view. At last I hit on the idea of going through the document (this uses the Doc/View framework).

 I used this code and it did exactly what I needed:

CDocument* pDoc = GetActiveDocument();
if (pDoc!=NULL) {
    
POSITION pos = pDoc->GetFirstViewPosition();
    
CView* pView = NULL;
    
do {
            
pView = pDoc->GetNextView(pos);
            
if (pView != NULL && pView->IsKindOf(RUNTIME_CLASS(CBaseView)))
                        
return (CBaseView*)pView;     } while (pos!=NULL);
}

 

Rhythmic Programming

Has anyone else ever had the experience of typing code in such a way that you build up an actual rhythm, patterns, a definable velocity punctuated by occasional flourishes? 

I found that happening today. I’m coding up a well-understood pattern in this application and so I can type quite a bit in long spurts. I find that I’m almost typing in “sentences” as I go…it’s very interesting…kind of odd…