Monthly Archives: February 2008

Office File Formats Released

0
Filed under Uncategorized

Microsoft has just recently (as of Feb 15) released the full specs on the various Office file formats (including Word DOC files, Excel XLS files and Powerpoint PPT files, in particular).

The specs are available here.

If you’re a file format geek, or your job actually revolves around manipulating these types of files, this is surely a welcome addition to your arsenal.

Some of this information has been available, more or less, for quite some time. Most everyone who’s interested knows, for instance, that these files are actually OLE structured storage files, essentially entire “mini file systems” unto themselves.

But much of the detail has been sketchy at best, till now.

One word of warning though. Don’t expect these to be simple, cookbook recipes on rolling your own version of Word or Excel. The specs are huge and the formats unbelievably complex, having evolved over the course of 10 or more years. Further, these are not Web 2.0, nice, friendly XML/HTML/Text/human readable files by any stretch. They’re tangled, binary, pointer-ridden globs of structures that take a good deal of code just to render somewhat intelligible.

That said, official documentation is far better than none, and surely beats reverse-engineering the formats, as has been done up to this point.

I know I’ll be digging into this more in the coming weeks.

Happy hacking!

Implementing a Shell Context Menu Handler In VB6

0
Filed under Uncategorized

I won’t go over the details of doing this here. There is a excellent run through online at O’Reilly. Check here. Specifically, it’s chapter 4 of J.P. Hamilton’s book “Visual Basic Shell Programming”.

I suppose it’s so dated now that they’re making it available online free. Not sure whether that’s a good thing, or a bad indicator of the age of tools I’m using<g>.

At any rate, this is an excellent reference if you happen to be doing this.

Specifically, the part about modifying the VTable on the fly to handle some of the IContextMenu methods is very good.

But the part that really had me smacking my head was the “Restore the VTable during object termination” section.

Duh! No wonder I was having some weird, after my context menu handler had popped up and done it’s thing, Explorer would crash kind of moments.

This is one of those times when telecommuting can be a drag. Having a co-worker glance over my shoulder probably could have caught that kind of mistake much earlier than when I caught it.

Moral of the story: If you’re gonna manually jack up COM VTable pointers, always put ’em back they way you found ’em.

DVDs on your Tivo

0
Filed under Tivo

image At one point, a few months back, it struck me that it might be nice to watch DVDs via my Tivo.

Why on earth do that, you might ask?

  • You won’t have to jockey with discs (my 4 year old loves watching things a second time, or in the case of Mr Roger’s Neighborhood, Sesame Street and any movie with a princess in it, a third, forth, or x^nth time).
  • The Tivo has a pause even my 4 year old can use (which is very important when there’s the need for a potty break mid-Cinderella!)
  • Pause, rewind, etc just seem to work so much smoother on the Tivo. Plus, if you do have to pause your movie, the Tivo will preserve where you are, even if you bail out completely. My DVD player can’t do that.

What you need

  1. A DVD (that you want to convert to a Tivo-friendly movie)
  2. A DVD drive in a PC (preferably, a reasonably fast PC)
  3. A networked Tivo (not much point if it’s not networked)
  4. DVDFab HD Decryptor Freeware version – used to extract the main movie from a DVD
  5. VOB2MPG – used to convert the extracted VOB fileset into a single MP4 file
  6. Tivo Desktop installed on your PC – This is how you get the final MP4 movie transferred to the Tivo

A Word of Caution

A few of my DVD’s just couldn’t be converted this way. I’m guessing they’re of the sort that have the “mangled disc” copy protection, but I can’t swear to it. Maybe there’s a utility out there that could work around this, but, hell, if I want to watch those discs, I just use the disc itself and be done with it.

At any rate, your mileage may vary.

Extract the Main Movie VOB (Video Object)

Install DVDFab, and start it.

Insert your DVD and let it load in into DVDFab.

image

Select the Main Movie option, enter a Target Path (a scratch folder on a harddrive with at least 5-7gig free), and make sure the main movie chapter is highlighted (it’ll usually be the one with the longest Play Time).

Then click Start.

On my machine, it takes about 7 minutes to extract a typical DVD movie.

Convert the Main Movie VOB to an MPG file

Now install and run VOB2MPG

You should see this:

image

Click the folder button beside the “Folder Containing VOB sets” box, and select the Video_TS folder created by DVDFab during the conversion above.

The click the folder button beside the “Folder to write MPGs to” and just select some other scratch folder somewhere. This is where it’ll save the converted MPG file.

Make sure the target drive has plenty of free diskspace (another 5-7 gig should be fine).

And click Start.

This also takes about 5 minutes or so on my machine.

When it finishes, you’ll have a nice and tidy MPG movie file that you can transfer to your Tivo. At this point, you can get rid of the VOB files and folder created by DVDFab above; they are no longer necessary.

To figure out where to put the MPG file, just open the Tivo Desktop and click View – Published Video.

image

You should see the above screen. Click the highlighted “Where is this Folder” link to open an Explorer window right to the proper place.

Copy your MPG file here (be sure to name it something nice and readable).

Then go to your Tivo and follow the instructions on the above screen.

Downloading the MPG file from your PC to your Tivo may take a while, depending on how you’ve got your Tivo networked, but eventually it should get there and be ready for your viewing pleasure!

And a final note

Before people start whacking me, yes, I’m sure there are plenty of low cost apps out there that’ll do this entire process more-or-less automatically (heck, some might even handle the few discs I ran into that didn’t work because of bad sectors).

For that matter the paid version of DVDFab looks like it’d do it.

If you know of a good app for this, by all means let me know!

It’s just that I only have a 320GB Tivo<g> and even if I could, I’m just not interested in filling it with ALL my DVD’s. Just the ones that might get watched repeatedly.

I guess I’m just pragmatic that way.

Now, where’d I put those 120$ industrial arcade trackballs?

Quicken Online?

0
Filed under Misc, Rants, Security

I can see doing a lot of things “online”.

Email? GMail is pretty dang slick, with a spam filter that’s second to none.

Stock Portfolio and watchlists? Sure.

Craig’s List Searches? Right there on my homepage.

Word Processing? Spreadsheets? Hmmm. Google apps is definitely interesting, although I tend to want to keep my files close at hand.

Personal finance information? Huhwhaaaa?

Call me old fashioned, but the thought of putting access info to my entire checkbook/credit card/bank account/investment accounts online just seems a little, uh, risky?

Hell, it’s probably all already out there, but is it really a good idea to put concentrate all that in one place, online, in the ether on someone else’s server?

Hmm, looks like somebody already has. But wait, this is great. Check out the bold restriction in their terms of use. Why oh why would anyone put private info on some company’s server when said company says up front not to put financial info there. Damn, I hope they have a good E&O policy!

I suppose SalesForce.com asks their customers to do it every day (after all, isn’t your company’s client list a bit like your ledger?) and nobody has much of a problem with it.

So maybe I am old fashioned.

Then I saw this (from the QuickenOnline.com website):

Build your whole financial picture for up to 5 years.
Most banks keep your online data for only 60 to 90 days. 
With Quicken Online, you build your whole financial picture 
from the day you start. We keep active customer's data for up to 5 years.

5 whole years! How generous! And I guess after five years, all that data would be useless to me?

Um. I don’t think so.

Guess I’ll stick to the tried and true for now.

A Grousing About Properties in .NET

0
Filed under .NET, Rants, VB Feng Shui

I’ve started playing more and more with .NET lately. There’s a lot to like, a lot to dislike, and a few things that left me scratching my head.

One is this new fascination with moving regional (or class scoped variables) up to right on top of the properties that are wrapping them.

You’ve no doubt seen the pattern.

In old school VB6, you’d have something like this:

    {top of class}
    Private _MyPropVar As Boolean

    {lots of code here}

    Public Property Get MyProp() As Boolean
        Return _MyPropVar
    End Get

    Public Property Let MyProp(Byval NewValue as Boolean)
       _MyPropVar = value
    End Set
    {code continues}

And in the New Order, you have this:

    {other code}

    Private Shared _MyPropVar As Boolean = True
    Public Shared Property MyProp() As Boolean
        Get
            Return _MyPropVar
        End Get
        Set(ByVal value As Boolean)
            _MyPropVar = value
        End Set
    End Property

    {code continues}

Now, the pundits out there claim that the ability to move the definition of the variable that stores the property value down in the code to where the property is actually defined is a good thing.

And it very well might be.

But if that variable is used elsewhere in the class (it is, after all, visible to the entire class), then it makes more sense to me for it to be grouped with other such class scoped variables at the top of the class, and not buried within the class.

What’s most frustrating about this, though, is that the language designers had the perfect opportunity to solve this problem elegantly, and didn’t.

The simple introduction of a property scope would have done the trick. Then for those variables that are ONLY used to track the contents of a property, you’d have this (note the _MyPropVar definition has moved to INSIDE the property declaration):

    {other code}

    Public Shared Property MyProp() As Boolean
        Private _MyPropVar As Boolean = True
        Get
            Return _MyPropVar
        End Get
        Set(ByVal value As Boolean)
            _MyPropVar = value
        End Set
    End Property

    {code continues}

Now there may be significant ramifications involved that prevented this change, and I’m certainly no expert at compiler design or implementation (though I have implemented a pseudo-code compiler scripting language used in a commercial product).

But this just doesn’t seem like all that big a deal to have implemented and would have cleanly resolved where to put variables of both persuasions (ie those that are used by ONLY a single property, and those that are truly class scoped and used my multiple properties/methods).

Personally, I think this was a bit of a “good enough” decision.

Practically, I think I’ll stick with locating truly class-scoped variables at the top of the class, and ONLY bury variables that really are only accessed by a single method/property.