Handy Context Menu Stuff

0
Filed under Uncategorized

I put together a little REG script ages ago that added context menus for DLLs, and EXE’s for registering and unregistering them.

I use it all the time. So much easier than invoking regsvr32 manually all the time.

Anyway, I just stumbled upon Chris Sells’ version of this script, which one-up’s mine in that he uses REGTLIB.EXE, which comes with VS6, to also register and unregister TLB and OLB files. 

And who knew that utility even CAME with VS6? I somehow have completely missed it all these years.

Offline Web Apps

1
Filed under Uncategorized

Jim Rapoza writes an interesting article in the latest eWeek about the 5 things that Web 2.0 apps need to recognize to be successful. It’s called IT Planner – 5 Steps to Next Generation Web Apps

  • Build Rich web apps. Ok pretty general, but a good start, I suppose
  • Remain “Open” minded. Open with your data, open to open-source, etc 
  • Keep Data Dynamic. Basically, allow users to play with it locally instead of only processing on the server. Sounds good, if not a bit like the “open minded” idea above. 
  • Make it available offline. Sure.
  • Be Flexible. Allow your app to be “molded” which ever way a user might like. Interesting idea. Basically, “make it configurable, and easy to import and export data”. Hmm, sounds a lot like the 2’nd item also.

All pretty good ideas for…..wait…..what was that? “Available offline”?

Huh? A web app available for offline use. Why, that’s just scandalous. Not too mention soooo last decade.

So. If I’m to understand this properly, one of the next great things in web applications is…. drum roll…. the traditional fat client desktop app.

And the circle remains unbroken. <Sigh>

Syntactic Sugar

5
Filed under .NET, Rants, VB Feng Shui

What’s with this?

I’ve seen this term bandied about, usually referring to some new feature in VB, and usually in a disparaging way.

Why?

I thought pretty much everything about a 3 or 4GL was syntactic sugar. Without that sugar, we’d be coding in assembler or hex opcodes. I mean, an IF THEN ELSE construct is just syntactic sugar for a bunch of JNEs or JEQs, right? Hell, object oriented code is nothing but syntactic sugar for an array of type structures and function calls with an index as their first argument (the hidden ME pointer in all OO compiler code).

Sounds more like just so much L337ism to me.

I say bring it on. As long as it makes sense, expands the language in useful ways, and isn’t required to make use of the language, the more the merrier. My only concerns would be:

  • Any additional syntax that’s required in order to successfully use the language. That’s VB.NET’s biggest problem now, with respect to adoption by users of VB.
  • Compatibility breaking changes

Still, I think ANDALSO is a tad corny, nice, but corny. So shoot me.

Apophysis Tutorials

0
Filed under Apophysis

The Apophysis Wiki at Wikispaces.com has an excellent page devoted to tutorial resources that are available in different places.

Most are good, a few are excellent, especially:

These are all great techniques that are guaranteed to waste piles of your time, if you’re into this sort of thing!

KB938194, Beware!

2
Filed under Troubleshooting, Vista

This Vista Update, delivered 9/4/07 at about 3am (for one machine, anyways) has some serious issues, so beware.

Now, when I load Word 2007, if I immediately quit Word, it crashes. And if I attempt to load a document by dbl clicking on it, Word fails to load the document completely, just opens an empty window. Even odder though, is that I have a different machine that I pulled the update earlier for (it’s set to manual update) and it’s fine.

The only difference between the two that I can see, is that on the failed machine, Word was OPEN at the time of the upgrade.

Even worse, UNDOING the Patch caused the machine to fail to boot. It would start to boot up, then just shut down.

I had to use the “Boot to last known valid configuration” option, then use the System Restore Point function to rewind back to before the 3am patch.

Once I’d done that, everything ran fine again.

Ah the joys of automated updates.

Native or Psuedo-Code VB6?

2
Filed under Code Garage, VB Feng Shui

VB6 has the interesting capacity to compile to either native code or pseudo-code.

Native code is actual Intel machine code. Pseudo-Code is much like the .NET “Intermediate Language” or IL, although, I suspect, a little less refined<G>

Most VB6 programmers I’ve known tend to compile to Native code although pseudo-code can be quite handy in some circumstances. First, it compiles much faster. Second, the generated EXE’s or DLL’s are typically much smaller than Native code EXE’s or DLL’s.

But what if you want, or need, to tell the difference at run time?

You could write up a conditionally compiled constant, but then you have to remember to switch the condition when appropriate. Still, that’s probably the ideal way to go.

But, that’s not really  a runtime solution, now, is it.

I happened upon the solution ages ago when I was researching an article I wrote for VBPJ about implementing TRY CATCH exceptions in VB6.

Essentially, you grab the first byte pointed to by a function pointer and check it. If it’s an &HA1, you’re in the IDE running pseudo-code.

If it’s &HBA, you’re running as compiled pseudo-code.

Anything else means you’re running compiled native code.

As far as I can tell, this technique works regardless of optimization settings, etc.

Yeah, it’s probably a little overkill, but that’s what hacking is all about. Plus, knowing whether you’re in the IDE without scrambling the state of the ERR variable is quite handy in some circumstances. I created a separate function for that purpose.

Private Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" (lpvDest As Any, lpvSource As Any, ByVal cbCopy As Long)

Private Function pGetAddr(addr As Long) As Long
   '---- utility function for IsNative and IsIDE

   pGetAddr = addr
End Function


Public Function IsNative() As Boolean
   '---- determine whether we're running
   '     a Native code EXE, or a PsuedoCode exe
   '     Also can determine whether we're in
   '     IDE or not
   '
   '     Now this is HardCode!
   '
   Static Inited As Boolean
   Static bIsNative As Boolean
   Dim b As Byte

   If Not Inited Then
      CopyMemory b, ByVal pGetAddr(AddressOf pGetAddr), 1
      Select Case b
         Case &HA1
            '---- In IDE
            bIsNative = False
         Case &HBA
            '---- Psuedocode compiled
            bIsNative = False
         Case Else
            '---- native code Compiled
            '     the actual byte might be any number of things
            '     because of optimizations in use
            '     but will generally be either &H55, &HC7 or &H83
            bIsNative = True
      End Select
   End If
   IsNative = bIsNative
End Function


Public Function IsIDE() As Boolean
   '---- determine if we're running in environment
   Static Inited As Boolean
   Static bIsIDE As Boolean
   Dim b As Byte

   If Not Inited Then
      CopyMemory b, ByVal pGetAddr(AddressOf pGetAddr), 1
      '---- &HA1 means we're in the IDE, else we're not
      bIsIDE = (b = &HA1)
   End If
   IsIDE = bIsIDE
End Function

Stuff you didn’t know you had

0
Filed under Uncategorized

When I switched to Vista, at least one of the pieces of software I used occasionally got fragged, ReadIris OCR.

It was the free one that came with my OfficeJet G85, but hey, it worked quite well for what I needed, when I’ve needed it.

Anyway, it sort of installs under Vista but then complains about not being able to load FMTSAM.DLL and barfs. And they don’t even give you a proper uninstall for that package. Gah!

So after hacking through Borneo the registry and Program Files to remove the aborted ReadIris install, I went looking for OCR packages, and came across a mention of Microsoft Office Document Imaging.

Sure enough, this is a little “Office Tool” that was bundled beginning with Office 2003, so you very well might already have it on your machine.

It does several things, but the most interesting for me (at least right now), is the OCR capability.

Point it at a multi-page TIFF file (yes, it only recognizes TIFF files, and same wacky proprietary MS format), click the “Send to Word” button and presto-chango, you have text from an image (or scan or whatever).

What, you say, you don’t have your stuff in TIFF format?

Load up Word, paste your images in, select Print and choose the Microsoft Document Office Image Writer printer (at least, in Word 2007, not sure about 2003 for this one):

image 

It’ll generate a multi-page TIFF file as the printout of your document, that you can feed directly into Document Imaging.

And the best part, it seems to actually to a decent OCR.

Colonel Sanders and Willie Nelson’s Love Child a Geek Demigod

0
Filed under Uncategorized

I’ve got nothing but love and respect for Whitfield Diffie, and I’ve known the name for ages (after all, you don’t invent public key encryption and NOT become famous in geek circles)!

There’s a short interview with him in the latest ComputerWorld, and now, I gotta say, I have even more respect for the guy.

He’s a fellow at Sun, full-on genius, and pulls off the Colonel’s beard with a good ol’ Willie haircut.

image

Ya gotta respect that!

Office Desk

0
Filed under Uncategorized

I finally finished out my dream desk. Actually, I finished it out a while back, but just thought about posting here. Maybe it’ll inspire other cabinetry-hackers like myself.

I started with an electrically height-adjustable corner lab bench. Used office supply place, about 100$. This allows the entire desk to lift up to standing height, for those long conference calls where I have to walk around some.

Removed the top. It’s now a workbench in a corner of my dad’s shop.

Welded up a support frame from an old bed rail. You can see that in a pic of the underside of the finished desk here:

image

Built up the table top from 3/4″ MDF, oak baseboards, oak 1x4s and green/gold slate tiles. Here’s a pic of the MDF base, plus the border and edging. The tiles are set in the center area, about 1/4″ below the surface of the border boards. The notch is for the adjustable keyboard/mouse tray.

image

Biscuit joined oak 1x4s with pecan trim to make an adjustable keyboard tray. This was the mockup:

image

Filled the tile area with about 3 gallons of epoxy (to give it that super wet, super thick, bar countertop look, and to fill it up to the same level as the border). Stained everything a custom red mahogany.

And bolted it all together to get this (I left the keyboard in place to give a sense of scale, ignore the office, it’s in its normal state of disarray). The most nerve wracking part of the whole build was having the entire piece completely built, stained, with the tiles glued and mortared in place, and then mixing 3 gallons of epoxy to pour over it. Screw that up and the whole thing would have had to go on the trash.

image

This shot gives a little better look at the keyboard tray and overall desk, and it shows off the gloss of the epoxy top:

image

and this one shows off the tiles:

image

Now, granted, it’s not quite as cool as David Barry’s Tie Fighter Desk, but it works a little better for video conferences<g>

image

However, I don’t have drawers. Maybe I could do a Jawa Sandcrawler filing cabinet…

Any other cool/practical desk hacking out there?

I fixed that, Dammit!

3
Filed under Uncategorized

If you’re trying to validate an installation in InstallShield (version 11.5, in case that matters), here’s a little something to be aware of.

First, some background.

InstallShield sucks.

Ok, now that that’s out of the way, if you have to use it, you may find yourself needing to perform a validation on your install. I did when a customer called up telling me that they couldn’t deploy my install using Active Directory Group Policy because when they tried, AD GPO gave them an error that the install wasn’t valid.

Which it most certainly was, because tons of people have used it to install over that past 2 years.

Anyway, the customer happened to have WISE, so they ran a validation on it and got quite a few errors flagged.

So, I run InstallShield validation on it and I see quite a few errors too. Oops.

Well, to be honest, installs aren’t job one, and if the damn thing installs and uninstalls properly under all the test scenarios that we’ve cooked up, why would I even think to validate it?

None-the-less, it had issues. So I start investigating. Come to find out, the errors are things like “Foreign key not found in table blah” and such forth.

Whah?! You mean, InstallShield will actually build an install that contains patently incorrect or missing foreign keys between tables. Hey, if I was using ORCA to build installs, I could see this, but isn’t that what spending all that dough on InstallShield is supposed to buy you?

Fine, so I fix the foreign keys and revalidate. Same damn errors! Not one thing is gone from the validation errors list. WTF!

I puzzle over it for 15 minutes or so and then give ’em a call.

Ah. You have to rebuild your entire installation before rerunning the validation! Oh. That makes sense. And, um, exactly why doesn’t IS simply pop up a msgbox telling me I need to rebuild, or better yet offering to rebuild. It knows I just ran a validation. It knows I just made a few changes. Shouldn’t it know I’m not going to get valid results if I just run the validation without rebuilding?

This just seems like UI 101 to me, not Advanced AI 5.