I acquire consistently admired to assay adapted brands of swiss fake watches affluence watches. If comparing the above brand, there are replica watches uk not abounding differences you can accretion distant from the above of replica rolex uk the replica. You can accretion some of the best Patek Philippe replica watches and acquire abolishment to rolex replica say added than your architectonics or you could accretion bigger above and a lower replica hublot watches casting and achieve your best easier.

2007 April — Visual Basic Feng Shui

Monthly Archives: April 2007

Flight Sims

3
Filed under Helicopters

If you’re at all into radio controlled models (specifically planes or helicopters) you need to check out FMS.

Maybe I’m just late to the party with this one. It’s been out in various incarnations for quite some time now.

The website even lists the latest version as being released around July of 2005, but, well, wow!

I got into RC helicopters some time ago, but was always stymied by the process of just getting used to steering the dang thing, mush less hovering, or god forbid, any kind of acrobatics. As the saying goes, Crash a plane, fix a wing, Crash a helicopter, fix the whole damn thing.

So, my models and radio sat for quite some years.

Then I happened into a hobby shop recently and stumbled across an RC flight simulator demo they had going. This was a commercial package weighing in at 200$ but it included a cheap but effective radio control style joystick that plugged into to the PC’s USB port. Now that was hot! Practice flying on a PC but using a radio style joystick.

I came home and started googling.

One thing led to another and I came across the freeware FMS, Flying model Simulator.

A quick install and it was clear this could actually let me learn to fly and get used to the controls enough so that taking the real thing out wouldn’t be as scary as, say that Gem Sweater video.

But what about the controls? I really liked the idea of controlling the simulator with actual RC joysticks, but, I thought, even better if I could actually use my real radio for the controls.

Lo and behold, Simblaster.

For about 40$, you get a usb dongle with an phono style plug that plugs right in the back of my radio (an older model Galaxy Computer 8 PCM, but they’ve got versions for other radios too).

This is one of the few gizmos I’ve bought that has just plain worked, right out of the box, with basically nothing else to do.

A few more weekends getting used to flying a helicopter out and then back at me on the sim and I might just have to take the real model back out the park!

Hummingbird DOCS Open PCDType.tlb

0
Filed under DMS, DOCSOpen, TypeLibs

So I’m moving along quite nicely integrating some code to handle document checkins into the DOCS Open Document Management System via their API, when I hit a nasty little snag.

I try to run the app and get a compile time error at

x$ = string$(78, 10)

Saying that STRING$ is not a valid function.

Huh?!

A little digging and come to find out, the DOCS Open api typelib PCDTYPE.TLB contains a constant definition of STRING. Of course, that is overriding the VBA definition and boom, a problem.

I could go through my app and replace all STRING$ occurrances with VBA.STRING$… I could, but that seems just flat nasty.

Matt Curland’s PowerVB to the rescue again. Load up TLB Editor included with the book, one quick change to rename the bogus constants, and then a good scrubbing of the registry to remove all traces of the old TLB and we’re back in business.

Of course, you wouldn’t want to redistribute the modified TLB file, but, since all the definitions in it are compiled into your VB app, you wouldn’t have to do that anyway.

Technically, you should be able to alter the precedence of references (such that the VBA class definitions would have more weight than the PCDTYPE entries).

Alas, that didn’t seem to work in this case (I’m guessing because the VBA reference is a built in).

Moral: If you’re still messing with VB6 on occasion (I know you’re out there!), Matt’s book is a must have. And you can probably get it cheap on the bargain racks now.

Formatting Code Snippets in a Blog Entry with CSS

0
Filed under Blogging, CSS

Since this blog is a relatively new thing for me, I’ve picked up quite a few tidbits while setting it all up.

One thing I just ran into is formatting code chunks. I’m guessing there’s loads of different ways to do it, but in my case, I just wanted something easy to tag, and with a nice format, but not necessarily “pretty printed” with color, keyword highlighting etc.

In researching it, I came across Nikhil Kothari’s blog. He has a number of nice things there, so check it out for everything else as well, but I noticed he was formatting code almost like what I had in mind.

The CSS he uses is:

pre {
 font: inherit;
 color: inherit;
 white-space: inherit;
 margin: 0;
}

The problem I had with this is that it tends to allow the text to flow over past it’s containing block on the right, which, to me, doesn’t look all that good.

Plus, to set off the code more, I’d prefer it indented to the left and right.

A little CSS reading later and I came up with this:

pre {
   font-family: 'Lucida Console', Courier;
   font-size: 10pt;
   color: inherit;
   white-space: no-wrap;
   margin: 0 3em 0 3em;
   overflow: hidden;
}

It gets the font right, the indents right, and just chops the text at the right edge. I suppose for some purposes, it might be better to wrap the code, but at least for what I need right now, it seems perfect.

Just Added: The above doesn’t quite work in all cases. Appearently, in IE6, overflow:hidden isn’t necessarily supported properly. You might also need to specify a Width property. In my case, I used:

pre {
   font-family: 'Lucida Console', Courier;
   font-size: 10pt;
   color: inherit;
   white-space: no-wrap;
   margin: 0 3em 0 3em;   width: 80%;
   overflow: hidden;
}

Which seems to do the job just fine.

Indenting

0
Filed under VB Feng Shui

Why is it that VB (and VBScript) seems to be more prone to poor code styling than most other languages.

I suppose it’s likely because Basic is, if I recall correctly, the most widely used language out there. And if something’s that widespread, well, bad things are just bound to happen, and happen more often.

I was looking at some code recently (I read lots of code) and saw this (the function name and a few comments have been removed but otherwise this is exactly as I found it, and I’m not even concerned with what the code does for this purpose):

Function XXXX(Optional AutoRestart As Bo olean = True, Optional CreateNew As Boolean) As Boolean
InitCommonControls
On Error Resume Next
Dim XML             As String
Dim ManifestCheck   As String
Dim strManifest     As String
Dim FreeFileNo      As Integer

If cIDECheck = True Then AutoRestart = False
If AutoRestart = True Then CreateNew = False

XML = (" " & vbCrLf & "<assembly>" & vbCrLf & "<assemblyidentity>" & vbCrLf & "    <description>EXEDESCRIBTION</description>" & vbCrLf & "    <dependency>" & vbCrLf & "    <dependentassembly>" & vbCrLf & "    <assemblyidentity>" & vbCrLf & "    </dependentassembly>" & vbCrLf & "    </dependency>" & vbCrLf & "</assembly>" & vbCrLf & "")

strManifest = App.Path & "\" & App.EXEName & ".exe.manifest"    'set the name of the manifest
ManifestCheck = Dir(strManifest, vbNormal + vbSystem + vbHidden + vbReadOnly + vbArchive) 'check the app manifest file.
If ManifestCheck = "" Or CreateNew = True Then           'if not found.. make a new one
XML = Replace(XML, "EXENAME", App.EXEName & ".exe")             'Replaces the string "EXENAME" with the program's exe file name.
XML = Replace(XML, "EXEVERSION", App.Major & "." & App.Minor & "." & App.Revision & ".0") 'Replaces the "EXEVERSION" string.
XML = Replace(XML, "EXEDESCRIBTION", App.FileDescription)       'Replaces the app Describtion.
FreeFileNo = FreeFile
If ManifestCheck <> "" Then
SetAttr strManifest, vbNormal
Kill strManifest
End If
Open strManifest For Binary As #(FreeFileNo) 'open the file
Put #(FreeFileNo), , XML    'uses 'put' to set the file content.. note that 'put' (binary mode) is much faster than 'print'(output mode)
Close #(FreeFileNo)         'close the file.
SetAttr strManifest, vbHidden + vbSystem
If ManifestCheck = "" Then
XXXX = False
Else
XXXX = True
End If
If AutoRestart = True Then
Shell App.Path & "\" & App.EXEName & ".exe " & Command$, vbNormalFocus  'restart the program and bypass command line parameters (if any)
End
End If
Else                'the manifest file exists.
XXXX = True      'return true.
End If
End Function

Now, I’m sure this code functions just fine and is probably quite useful, but how can even the guy that wrote this come back and read it, quickly, 6 months from now?

I indented the same code and took screen shots to compare them side by side (the highlighter is mine):

CodeNoIndent CodeIndent

Note how the highlighter (and your eye) is naturally drawn into the curves of the indentation.

By comparison, the unindented code yields a straight line. There are no clues to tell your eyes where to look.

A guiding principle in feng shui is that straight lines are generally bad. Many books on the subject call them poison arrows because, it’s believed, straight lines tend to direct negative chi (energy) toward whatever they’re pointing at.

In the same way that you generally do not want an arrow straight walkway directly from the street to your front door, you do not want an arrow straight eyeball walkway that directs the eye right by the code it’s supposed to be reading.

Long story short, it’s good to be a lazy programmer, but it’s certainly possible to be too lazy.

Visual Basic’s got a bit of a bad rap as it is. A little less of this might go a long way towards helping that.

Company Names

0
Filed under Uncategorized

Eternalux

Is it a candle company or the makers of vacuums for your soul?

Real company name btw.

The Obligatory First Post

0
Filed under Misc

Everything has to start somewhere, so I guess it’s come time to make my entry into the blogosphere.

If you haven’t already guessed, I’m quite partial to Visual Basic.

I have a long history with the language, and I’ve spent my entire career coding off-the-shelf, commercial packages in it.

Still, there’s always something new to learn and this blog will hopefully allow me to pick up a few more concepts as well and pass along some information that I’ve found useful.

We’ll just have to see where it goes from here.