Author Archives: admin

HyperTerminal and Vista

0
Filed under Uncategorized

Ok. Yet one more reason to dislike Vista.

Granted, I don’t regularly use HyperTerminal, but when you need to hack at some AT commands, well, it sure was handy to have around.

And it’s been there ever since, what, Windows -1?

But alas, no more.

So, off on the hunt I go. Now, I’ve known about puTTY for quite some time, but I always thought it was a telnet/TTY client. But much to my surprise, it just relatively recently got an upgrade with direct serial access under Windows.

image

I gotta say, for dinking around with your typical modem setup, this new puTTY honestly seems to work far smoother than HyperTerminal ever did.

C’est la vie, HyperTerminal. May you rest in peace.

FEBE to go

0
Filed under Utilities

If you use FireFox (and if not, what’s up with that), you need to check out Chuck Baker’s FireFox Environment Backup Utility (FEBE).

Slick little tool for saving all your FireFox goodness for that day when, suddenly, you realize you’ll be paving your machine and having to dig through your subconscious to come up with all those bookmarks, RSS feeds and FireFox extensions that you use everyday but couldn’t name to save your ass.

One Big Control or Lots of Little Ones (redux)

0
Filed under .NET, ASP, Rants, VB Feng Shui

Some time ago, (or here in the wonderfully virtual web world), I questioned the whole aspect of all this pile of controls in ASP.NET. Of course, you’ve got the grids and listviews, and you also have all the radio buttons, checkboxes. But then you’ve got a separate validator for each kind of validation you want to use, and even validators to let you combine other validators in “AND” and “OR” logical relations.

My thoughts were “Jeez. this is madness.”

Wouldn’t a single control that you could adapt to different display behaviors, validation rules etc be much easier to work with and create a more maintainable solution?

Well, apparently someone at Microsoft had the same bright idea, at least with the new ListView control in ASP.NET 3.5.

Take a read of Fritz Onion’s article in the latest MSDN magazine.

He describes the new ListView as a control that can “literally replace all other databinding controls in ASP.NET. That’s right. Every last one.”

Now, if they’d do the same for that validation nonsense, we might be getting somewhere!

Quick Find in VS2008, Not So Much

0
Filed under Uncategorized

It looks like I’m not the only person experiencing absolutely terrible performance in VS 2008 when performing what is ostensibly known as a “Quick Find”

image

This is the dialog you normally get when you do a Quick Find (Ctrl-F).

Note that I typically have it set for Entire Solution, Hidden Text and Use Wildcards.

With things set up this way, on a Core 2 Dual Core machine, I typically see a 2-4 second delay when I click the Find Next button. Pressing F3 to continue the find yields similar times.

And this is when the next occurrence is on the same line of code as the current occurrence!

Not much of a “Quick Find” in my book.

I tried all the various options, and nothing has any effect EXCEPT for the “Look In” option. If I change it from Entire Solution, to, well, anything else, the finds are then instantaneous.

If anyone knows of the cause or solution, I’d love to hear about it. So far, I’ve turned up bupcus on this one.

Till then, the Find In Files (Ctrl-Shift-F) option seems to be the best alternative.

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.

Dynamically Enabling Access to the VBA Object Model in Office Apps

1
Filed under Uncategorized

Writing addins and macros for Office apps (specifically Word, but this includes Excel and Powerpoint) can be difficult enough as it is.

But when you throw security gotchas into the mix, things can get interesting quickly.

One thing that often hangs people up are the security settings.

There are several different security levels for macros, of course. And there’s also security that controls access to the internal VBA object model.

But what’s the “VBA Object Model”?

Essentially, it’s an object model (not unlike the Word object model that starts at the Word.Application object) that allows macro code (and COM add-in code as well) full access to all the macros written in VBA and stored within the actual document (or template) file.

For instance, you can actually print out all the VBA macro code in a document with a code snippet similar to the following:

For i = 1 to WordDoc.VBProject.VBComponents.Count
   Set vbcode = WordDoc.VBProject.VBComponents(i)

   C = vbcode.CodeModule.CountOfLines

   '---- retrieve the entire code block
   If C > 0 Then
      code$ = vbcode.CodeModule.Lines(1, vbcode.CodeModule.CountOfLines)
      Debug.print code$
   End if
Next

Depending on what you need to do with your code, this can be very very useful.

But…

It doesn’t work at all unless the user checks the “Trust Access to the VBA project object model” on the Macro Security screen (shown here from Word 2007, it’s essentially the same in Word 2000-2003).

image

Now, you might think that, hey, a potentially powerful security hole like that would be something that ONLY a user would be able to change. In other words, the setting wouldn’t be readily available directly through the operating system.

And you’d be right, and wrong.

That setting can be found, quite simply, in the HKEY CURRENT USER registry hive.

For Excel:

image

For PowerPoint:

image

and for Word:

image

However, that’s not the end of the story.

It is true that the setting is a PER USER setting, which means that your application would have to alter this setting for each user that logged onto a machine. But the current user generally has FULL RIGHTS to HKEY CURRENT USER hive, so why put a security setting like this there?

Because it’s not the only place you set it.

There are also keys like these (note the version of Office):

HKEY_LOCAL_MACHINE\Software\Microsoft\Office\12.0\Word\Security
HKEY_LOCAL_MACHINE\Software\Microsoft\Office\12.0\Excel\Security
HKEY_LOCAL_MACHINE\Software\Microsoft\Office\12.0\Powerpoint\Security

Each potentially contains a value named AccessVBOM as well.

If this value is defined and has a value of 0, the value in HKCU is essentially ignored, and the user cannot grant access to the VBOM, even if they manually enter a 1 for the value under the HKCU.

If the HKLM value doesn’t exist at all, or has a value of 1, then the user can set the HKCU value, or change the Trust Access checkbox manually in the application.

And since write access the HKLM is often restricted to local admins, this gives admins a way to lock down this setting on machines, which is a good thing.

Another important point; changing these settings while the Office app is already loaded, will not cause said app to change its behavior dynamically. Put another way, Word, Excel and Powerpoint appear to read these settings once, at load time, and then never read what’s in the registry again until all instances are unloaded and the app is loaded again.

Practically, this means that you can’t change these settings from within a true Office Addin (ie a COM addin or a VBA Macro).

But you CAN change them quite easily from other code. At least, it’s easy to change the HKCU value, and the HKLM value can be changed during your MSI based installation.

Now comes the ethical dilemma.

Your application won’t run (or won’t run in entirety) if access to the VBOM is not granted, and many people would find it difficult to change that setting, even through the UI. But that’s not the kind of setting that you want to change automatically  or surreptitiously without letting the user know you’re doing so. Or is it? Would typical users know what it meant anyway? And most Office macro viruses would be caught via other means now, right?

As a final note, googling “AccessVBOM” turns up plenty of pages describing these keys in various levels of detail, but interestingly, searching the Microsoft.com site comes up with very little on the topic.