Tag: Speed

Is Managed Code Slower Than Unmanaged Code?

What’s you gut answer right now; without reading the rest of this post?

In my (seemingly) never-ending quest along the path of Uncapacitated Facility Location problems, I found myself thinking if I would be better of write some core functions in C (unmanaged) and calling them in my VB.net project? I thought that it probably would be, but decided to check first. Here’s the link, you can skip to the conclusion at the end for the low-down:
http://www.grimes.demon.co.uk/dotnet/man_unman.htm

MIE Cal Tool Beta

I’ve had this done for a while but was hoping to get a bit of testing done on it – thats not gone so well, but I want to get it out there. This then is “Beta” which in this case means don’t even think about blaming me for anything! Having said that I don’t believe it should cause an major issues – I’ve only found one issue that i have not addressed yet as it occurs in very odd situations.

The download .zip has a install .exe in it. Run that and it will give you a standard installation experience.

Apart form the UI the bulk of the code is from Charles Williams of DecisionModels.com. Also look at his fab article here

Once installed I’ve stuck a button on the Menu bar (sorry, you can change the code if you like, the pw for the VBA project is “methodsinexcel”)

ToolBar1.PNG

The main screen is where all the action takes place. I hope it’s fairly straight forward, if not post any questions in the comments:

MainForm1.PNG

Clicking the About link explains what each part actually does, it also shows the uninstall button.

HelpForm1.PNG

So heres the download, enjoy.
M.I.E Cal Tool1.zip

Securing VBA code in Office

Most of us know that .dll’s are the only real option if security is a genuine issue, but I think the following might be a possible (bodge) solutions for those who many not have VB, and need better security for their VBA code. Anyway, I was looking at this site:

Tech Net – Office 2000/Visual Basic Programmer’s Guide

Chapter 17 deals with security. My lighting fast brain crawled in to action and I thought I’d try something.

Now according to this info:

In Access, you can save an .mdb or .adp file as a file type that contains only compiled VBA code without the source code.

These files are called .mde file and most of us will have worked with these before, or at least heard of them. I didn’t know the code was compiled though. Doing a little bit of goggling it seems that decompiling is available, but that the VBA code remains compiled, i.e. forms and report are easy to decompile, but the VBA remains compiled good news.

See where we are heading? You can call this .mde code from you Excel/Word etc VBA, and your more sensitive VBA code can be kept in a complied- harder to get at – .mde file. In theory it’s a bit like putting your code in a proper .dll it’s compiled code. Which kinda begs the question, why can you do this with all our VBA?

Here is an example I’ve put it into a UDF, and it runs in such a way as to be dog slow, but it could be implemented better, or if the situations was different the performance hit would be less noticeable I’m sure you’ll get the idea. I’ve inculed the orginal mdb, and you can do all the other passwording etc to this mde before making it a mde. I’ve also chnaged the file extention to change the icon, whcih is of little importance.

So, it’s Heath Robison, it’s far from ideal but it might be useful to someone; oneday! A nice little idea I though”¦Â