donderdag 29 mei 2008

New Computer

I've just received and configured my new computer. I've decided to stick with XP 32 bit, because of the good quality and good experiences of that program. Vista and/or 64 bit Windows still have issues concerning Visual Studio 2008 and installing Visual Studio 2005 might be worse. It's just choosing between the pros and the cons of each side: 64 bit Vista vs 32 bit XP. 32 bit XP is the winner.

The following essentials have been installed:

1) Security and essential system software:
a. AVG Antivirus Free 8
b. Windows Defender
c. Internet Explorer 7
d. Auslogics Registry Defragment
e. Sysinternal's Page Defrag
f. Ccleaner
g. Acronis True Image 11 Home
h. update to sp3 for XP

2) Office:
a. 2.4 (good drawing program included)
b. MS Office 2007 Home and Student
c. MS Office 2007 Access

3) Development:
a. MS Visual Studio 2008 Professional
b. MS SQL Express 2005

4) Virtuialization:
a. Virtual PC 2007sp1

Because I've already two licensed copies of XP Pro I'll transfer both into virtual machines created by Virtual PC. One license of XP has already been transferred to such a virtual machine and there is still one license to do. Both XP instances get the same essentials except "Acronis Trua Image" because I create backups of the virtual PC directories.

Instance 1:

a. (yes, it has a nice drawing program I really need)
b. Office 2000 (except Outlook)
c. Visual Studio 2008 Express (just for doing some nice experiments)
d. Visual Studio 6 (yep, it's very old, but can be practical)

Instance 2:

a. (the nice vector drawing program! Bitmap painters are toys.. ;-)
b. Visual Studio 2005 Standard (for doing some heavier experiments)
c. Turbo Delphi Explorer (I'd like to experiment with Object Pascal and Lazarus still isn't out of Beta :-( )

vrijdag 2 mei 2008

Add-in libraries

I'm experimenting with add-ins to work like a library for VBA projects. This looks like a COM DLL written in Visual Basic.

Create a normal spreadsheet and write classes and or modules in it. This normal spreadsheet is just for testing and debugging. If there are no more bugs, you can remove everything on the worksheet. Unfortunately even this will be a library, it is required that there is at least 1 worksheet available. After this you can save your work as an add-in. So do so.
Now it is time to activate the add-in as a regular add-in like Analysis toolpack. Now you can create a normal spreadsheet and go to the VBA editor and add a reference to that add-in.


maandag 14 april 2008

Some wishes for Office and Visual Studio

If, but only if you have a licensed copy of Office (Excel, Word, Outlook) AND a licensed copy of Visual Studio Professional and up, you can create your own add-in libraries or you can extend your documents and templates using managed code at the expense of VBA or you can create a mixture from both worlds if you want to save that nicely-working VBA module!

I'd like to see such programmability for Access projects (.accdb databases or .adp projects) and I'd like to see the following:

1. There's a FREE Access 2007 runtime version just in order to run Access databases like applications. I'd like to see a FREE Excel 2007 runtime that can only run the underlying VBA code and only edit cells that are normal editable cells. Like the Access 2007 runtime the menus should be very very crippled just in order to execute that .xls spreadsheet as an application.
2. I'd like to be able to use an Access database or an Excel spreadsheet as a program library INSIDE my VB.NET program WITHOUT the need to 'load and execute' the whole whopping Access or Excel executable and its depending libraries. The .mdb (.accdb) or the .xls should be able to get treated like a normal .dll library.
3. I'd like to be able to re-use Office components in my own software. This should only be possible if the following is met: licensed version of Office AND a licensed version of Visual Studio.NET Professional just in order to bypass the necessity of 'loading and executing' the whole whopping Office application.

Think about an extended DAO/ADO.NET engine for Access databases that adds VBA possibilities to your database in order to create user-defined functions or a VBA version of stored-procedures to make the database more intelligent.
Think about an Excel Spreadsheet engine the cousin of Jet's database engine which is able to create full fledged .xls spreadsheets programmatically.
Think about a grid component for the sake of opening an Excel spreadsheet for data-entry or querying data resulted from calculation by formulas.
Deploying the application to customers should then be royalty-free and there should be some other licensing thoughts.

maandag 7 april 2008

Why VBA can be a P.I.T.A.

I'm maintaining an Excel spreadsheet also for Office 97 because of my work doesn't have the newest Excel. I'm also running that old Office 97 on a VMWare image running Windows'98 as the program. Reason to do is to ensure compatibility of older systems. I was busy with creating macros responding to clicks on userform buttons on the worksheet itself. I saved the bits 'n bytes and I ran the code, but the older code got used instead of the newly typed corrections. Using the debugger had lead Excel to a grinding halt: an invalid page fault occurred in the VBA32.DLL. I felt bad, since I've thought that I've ruined my project. I didn't panic or got ballistic, but I tried the "ruined" project on my other VMWare images running XP Pro sp2. Yes, I've two images: one running Office 2000 and the other Office 2007. Both Offices managed to convert a "ruined" project into a healthy one. I can debug and now the macros are using the corrected code. Then I've tried the "repaired" project back on the Windows 98/Office 97 image and now the problems were gone! It looks like that opening a potentially ruined Excel macro project can be repaired by using an Excel with higher version than the version in which bad things happen like errors in VBA32.DLL.

The best thing is acquiring both Office 2007 and Visual Studio 2008 and converting the VBA project into a managed one. But how you you do this:

1. Open Excel 2007 by clicking the project
2. Open the VBA window
3. Check the Object Inspector and export EVERYTHING to .bas or .cls files which are plain text files.
4. Close Excel
5. Open Visual Studio Professional
6. Create an empty Excel project and select your project
7. Create class-modules from your .cls files. They got suffixed .vb
8. Create module-modules from your .bas files. They got suffixed .vb
9. Correct all errors and please replace the clumsy ON ERROR instructions with TRY instructions and
your code will be very pleasant to read and to maintain!
10. If everything compiles well, you can try to run it.

Now you've got a managed .DLL that will never fail you!

woensdag 19 maart 2008

Another interesting small SQL engine

Whilst VistaDB is a nephew of SQL Server thanks to T-SQL syntax compatibility, so has Oracle a little nephew (SQL Persistent Stored Modules compatible syntax) called Advantage DB server version 9. You can grab a (trial) copy at but you might have to register before you can download anything. When I have time, I'll give this engine a nice try. I try the local server, since it doesn't expire. I still dislike software time-bombs..

zaterdag 15 maart 2008

Interesting move concerning Mono on Linux

MonoDevelop an open-sourced IDE for creating software using Mono has gone gold. Sounds interesting! It is more stable than before, but there are some caveats:

1. The documentation is far from complete!
2. To be able to create applications graphically is darn nice, but the GTK# implementation of Windows.Form namespace requires an awkward approach: I can't simply drop components on my form, but I have to create a layout before doing anything and I'm still waiting for a normal Visual Studio compatible layout manager.
3. Monodevelop and GTK are partly written in unmanaged C++. There are layouts present but I don't like all of them, since I can't control HOW I want to place the controls on my form.
I want to control the size and the position of the components, so I don't need those silly layout-managers. If I don't use such a layout, the component gets the size of the complete form and that's very undesired. Monodevelop calls this a feature, but I call it a design-flaw.

So be warned and be patient about testing Mono. It's going better with it, but I'm not very content yet.

The reason that I also blog about MonoDevelop is the fact that I'd like to run my desktop applications anywhere and it shouldn't matter whether the OS is Windows, Linux, MacOS or Solaris! Platform neutrality is my heart's wish!

donderdag 13 maart 2008

I'm faced with one problem

I'm faced with one problem, since I cannot find a way to upload small project zip files to this blog. I've to find a way to solve this problem. There are some requirements to be met to be able to use them:

1. Excel 2007 must be installed including .NET programmability
2. Visual Studio 2008 Professional or higher must be installed
3. A copy of VistaDB must be present. I prefer the Express Edition, but the normal edition is also perfect! Avoid using the trial version, because of its time-bomb function after 30 days.

I'm against time-bomb function in trial or evaluation software for several reasons:

1. The can be circumvented by clever power-programmers
2. There are better ways to distinguish between a licensed version or an evaluation copy

Are there examples? Yes there are:

a. Microsoft deploys non-expiring Express Editions of Visual Studio. There are limitations (add-ins inpossible), but evaluators can evaluate the product as their hearts' content and enjoy programming.
b. CodeGear/Borland deploys non-expiring Explorer Editions of the Turbo series of Delphi, C++ Builder. There are even more limitations compared with MS's Visual Studio Express, but the user can enjoy using the package!
c. Other vendors display 'nag-screens' with the statement that deploying is prohibited or they make a water-mark into the resulting executables or libraries. As long as the evaluator doesn't deploy anything, he or she is legally using the product for evaluating purposes.
d. Some deploy special Community or Free Editions with some limitations or none at all, but using the software under this license is forbidden for commercial usage.
e. A light-version of a piece of software only runs while the IDE is active or a nag-screen gets displayed.

By using these ways of deployment and (evaluation)licensing I think that counterfeiting will diminish. Time-bombing looks like the cause of counterfeiting and cracking.

maandag 10 maart 2008

I'll do an invoice project

Because some of my work is proprietary of my work, I cannot share you my thoughts about it. I however want to show you a similar project unrelated to my work's project: an invoicing system.

The front-end will be written in Excel 2007 and instead of the old-baken VBA, I'll link the template to a VS2008 project in order to gain speed. The underlying database won't be Jet/Access, but VistaDB Express, since it's both very tiny and very extended. At first the front-end will be simple and when time allows there will be an automatic page-transportation system. This is needed if an invoice is involved with a HUGE shopping-list and not everything could be printed on one A4 page of paper.

vrijdag 7 maart 2008

The reason for my setup hurdle

I was faced with a hurdle upon setup. I've received a read-error from DVD and I didn't like that. At first I could escape by cancel, but then the setup gets abandoned and that's not the desired action. I re-inserted the DVD into the same drive and I retried. From now I didn't get a single read-error anymore. Today I looked again at the DVD and I saw a good surface, but I detected some small dust particles. I cleaned the disc with air and a very soft cloth. Because my base OS is Linux I issued the following command as root in order to pinpoint the culprit. At the console I entered:

dd if=/dev/hdX of=~/tom.iso

where X means the number of the physical drive at the ATA port.

hd1 is the first
hd2 is the second
and so on

Neither of my three DVD drives gave a single criticism about the integrity of the disc and the hardware. Upon my setup hurdle I did get a kick on my butt (Dutch: oorvijg, billenkoek) by Linux saying that there were some read-errors. The culprit is just that stupid piece of dust. I also find on my Windows image's logs the same criticism about the disc. If it wasn't the piece of dust, I'd been faced a delay and a failed installation. (Dutch: gesjeesd voor mijn examen) Now I'm very happy and I will continue this blog

The first template project

I've an existing template. Sorry, but I can't share it to you, since it contains proprietary code, but I can tell you a global howto. The spreadsheet in question contains two macro's:

1. Upon startup it must set the data to that of tomorrow
2. Using Excel's menu an action needs to be inserted which has to do a number of things:
a. save the spreadsheet
b. mail it to the main office
c. protect it against writing at all
d. prepare a new spreadsheet for the next day
e. maintain a satellite spreadsheet containing ticket-numbers

There are two serious drawbacks against the current situation:

1. Sometimes you want set a date by yourself
2. Creating a menu entry for a macro is very tricky and may lead to subtle and hard to debug errors

The .NET way is very nice to do:

1. I now can put the two command-buttons into the spreadsheet, so I don't need the menu anymore.
2. I now can get rid of old-fashioned VBA and program in the .NEaT way.
3. The spreadsheet remains small, since the code resides now in a small .DLL file

I have to analyze the project's non-vb files in order to get information how the process goes. So I also have to test the system outside VS2008. But .NEaT has an XCOPY option, so deploying must be a sweet piece of a cake.

donderdag 6 maart 2008

Just peeking around

The action 'hxMergeAll' during installing MSDN libraries did last for more than a half on an hour, whilst installing all the files (and that's not a small one!) only lasts a mere 10 minutes!

Now I'm peeking around and installing some extra stuff like

1. VistaDB Express Edition (small but powerful database engine)
2. Visual Studio SDK (for creating extensions)
3. I like to install the trial of Chrome again and I've encountered a new version!

I've already done an interesting experiment:

I've created a small new project in the shape on an Excel 2007 template. This template won't be enabled for VBA, since I'd like to be freed from old-fashioned COM artifacts. After building the project I've received a small DLL instead of the VBA code.

Phase 2 completion

I've now just installed phase 2 of VS2008, the MSDN portion.

The files install only took a mere 10 (!) minutes, but the action HxMergeAll is a bitch of a wait for some half on an hour or longer! At this point Microsoft has failed in this portion of its installation program. The rest of the installation software has significantly enhanced regarding to performance and quality. I don't know the exact meaning of this itchy action.

First stage of install completed

I've just received my copy of Visual Studio 2008 Professional and before I installed it I've taken some preparations:

1. Temporarily disabled internel
2. Temporarily disabled antivirus

The install of Part I (Visual Studio except its help files) took only 45 minutes!

donderdag 28 februari 2008

Still awaiting my upgrade, but interesting freebee

I'm still waiting for my copy of VS 2008 Professional, but I've caught a very nice freebee from VistaDB. It's called VistaDB Express Edition and you can look at . It is a very interesting database engine because:

1. It's written in managed code
2. It's tiny (yes it's darn tiny)
3. It's powerful despite its tiny size
4. It's SQL language compatible with SQL Server Express
5. It get updated regularly
6. The databases created are also very tiny

There's one but: although its SQL Server compatibility, not everything works at this time like CURSOR and FETCH.

Despite of these small limitations this DB is far better than Jet/Access and even SQL Server CE!
You'll hear from me regarding this database!

You can download it at and give it a try

donderdag 21 februari 2008

Merging-cells nightmare and its solution

I've gone through a stupid nightmare merging (combining) a continuous series of cells into one cell.

Suppose there's an empty worksheet and the selected cell is A1

Do the following:

1. Type something into cell A1
2. Select the following cells A1, B1, C1 and D1
3. Locate the button Merge cells into one

Changes are great that absolutely nothing happens.

I've repeated this using the macro recorder in order to see what happens under water and I've learned my lesson:

The instruction 'Range("A1, B1, C1, D1").Select' gets generated when the CTRL key is pressed while selecting cells. The latests cell looks like to be in an edit state. This kind of selection fails the merge! You find a selection of loose cells separated with commas. Although consequent, Excel interprets this if it wasn't, since the merge function doesn't work.

The instruction 'Range("A1:D1").Select' gets generated when the SHIFT key is pressed whilst clicking the cell D1. The latest cell is like the first one normally selected. This kind of selection succeeds the merge! Watch the colon which means a consequent area of cells and the merge works like a charm!

Now I'd like to share you the ultimate solution for mistakes in merging cells. I've thought for a short time that there was a bug in Office 2007!! Happily this thought is false!
When selecting cells don't ever touch the CTRL key or nothing will be merged! The right steps for a successful merge are:

1. Select the first cell of the region to be merged into one cell
2. Whilst pressing the SHIFT key select the last cell of the region
3. Now there a valid consequent selection, locate the merge-cells-into-one-cell function on the ribbon and use it

zondag 17 februari 2008

The best way to install large software titles

I'd like to share you my experiences regarding installing large software packages like Office packages or development packages from Borland or Microsoft.

There are two situations possible:

1. You are running the operating system natively installed on a computer
2. You are running the operating system as an application under virtualization program like Vmware

Before installing a huge software package there are some preparations needed in order to gain better performance:

Ad 1. Disconnect the computer from internet and disable the antivirus package for this session only.
Ad 2. Disable internet and antivirus package for this session only.

Now it's time to install the package. I've had to install two big fat packages: Office 2007 Home and Student and Access 2007 upgrade. The performance of installing both packages was pretty good. Both large packages installed in a mere 30 minutes, because of the temporary absence of antivirus and disabled internet. After the installations are completed you cannot activate both packages yet, because in the first attempt there was no internet available for this time and you will surely fail the exam called "Product Activation".
Now installation is completed there are a few post-install actions required for activating the software if needed:

Ad 1. Connect the computer to internet and re-activate antivirus.
Ad 2. Enable internet and re-activate antivirus.

Now it's time to reboot the computer and wait for some updates to be applied over the newly installed software.

After this it's time to activate the software when needed. In my case with Office 2007 and Access 2007 it was necessary to activate and now I've passed that exam.

For large updates as known as service-packs it is advisable to treat them if they were huge installs. With internet and antivirus enabled the performance will be poor due to security checking. Temporary disabling internet and antivirus will also put security offside for a while, but this isn't harmful, since internet is also temporarily disconnected. I've had to wait a long time for running service pack 1 of Office 2007 because of the fact that both internet and antivirus were activated during update session. It's better to download an offline update version of the service-pack of Office 2007 or another application and manually apply it whilst internet and antivirus were disabled for that time.

maandag 11 februari 2008

Some important differences between VBA and a .NET language

I'd like to explain my objections against VBA and my advocacy for a .NET language by going through some points:

1. In VBA exception handling is not so clear. It's a pretty rough approach:

In this example there's no error handling. If this is a deployed piece of software, it will crash upon a division by zero. We can expect an upset customer, because the application has crashed!

Sub MyRout()
Dim i as single, f as single, g as single
f = 1.0
g = 0,0
i = f / g

End Sub

In this function we ignore the error at all. We don't care whether or not there's an error. If the program doesn't crash, it might be ok. NOT! Ignoring error will definitely lead to hard to find bugs! This is absolutely a deathsin!

Sub MyRout()
Dim i as single, f as single, g as single
f = 1.0
g = 0,0
On Error Resume Next
i = f / g
On Error GoTo 0
End Sub

Now I present you the best approach of trapping an error using the rough way, but the code look ugly because of labels and GoTo statements.

Sub MyRout()
Dim i as single, f as single, g as single
On Error GoTo FAILED
f = 1.0
g = 0,0
i = f / g
Exit Sub
MsgBox "We tried to divide by zero!"
End Sub

Consider there was a database update using code instead of SQL statements using DAO and we ignored any runtime errors at all, the customer might assume the database got correctly updated, because of no error message, but under water some terrible things have happened! The database didn't get updated! This is why "On Error Resume Next" without checking is so dangerous!

Now look at the next .NET right way to trap for errors:

Sub MyRout()
Dim i as single, f as single, g as single
f = 1.0
g = 0,0
i = f / g
catch (ex1 as DivideByZeroException)
MessageBox.Show("You tried to divide by zero!")
catch (ex2 as Exception)
MessageBox.Show("Unhandled exception. This shouldn't happen...")
'Doing some cleanup code whether or not an exception occurred
end try
end sub

This looks pretty! If you omit to protect your code, your application will crash, but the error message is pretty polite. During debugging time Exception this new way are a real blessing to find and slay bugs.

2. Programming properties

In VBA there are 3 statements to define properties:

Property Let/Set/Get

I'll give you an example:

class MyClass
dim mQuantity as integer

Property Let Quantity(value as integer)
mQuantity = value
End Property

Property Get Quantity as integer
Quantity = mQuantity
End Property

end class

There are two Property statements and they have to be semantically equal!

Now the .NEaT manner:

Class MyClass
private mQuantity as Integer
property Quantity
return mQuantity
end get
set(value as integer)
mQuantity = value
end set
end property
end class
End Class

This looks very pretty and pleasant! A property has a reader and a writer!

Why do I want to get rid of Visual Basic for Applications?

Visual Basic for Application is the macro (hum...) language of many Microsoft Office programs. It's not truly a macro language, but it's a real program language, but somewhat old-fashioned.

In my humble opinion VBA has some serious drawbacks:

1. It's based on ActiveX/Com which means it can clobber up the registry
2. Using On Error GoTo for dealing with exceptions can be a pain in the neck and it's ugly
3. It's a huge package
4. Especially with old Office systems like Office 2000 the help system might get damaged
5. Programming properties using VBA is not very elegant
6. It's based on Variant datatyping, which can cause headaches during debugging
7. Sometimes the code-completion doesn't work well despite using type-libraries of the Office objects.
8. The code is stored into the template or the document and if this stream is damaged, strange error do happen like unexpected failures.
9. VBA is known to be sensitive for serious security problems due to 'macro-viruses'.

In my opinion .NET (managed code) has the following advantages:

1. VB.NET is a true object oriented language
2. Exception handling is clear and easy to read and modify
3. It's managed code and usage of the registry is limited (sometimes it isn't needed at all!)
4. It's type-safe
5. The .NET system is far more secure than ActiveX/Com
6. Unhandled exceptions now lead to meaningful exception messages instead of blunt COM error codes. Yes error messages containing only a number are very insulting (crude) to users!
7. The help system never failed me yet!
8. Programming properties is pleasant to do due to a very pleasant syntax of any language you want.
9. The custom code gets compiled in a DLL instead of a stream into the document. This also means a better loading time of the document or template.

The very beginning

I've now installed a copy of Office 2007 Home and Student and a copy of Access 2007 upgrade. I'd like to get rid of Visual Basic for Applications and replace it with managed code from .NET 3.5 using VS 2008 Professional Edition. I'd also like to blog about Remobjects Chrome an implementation of Object Pascal somewhat different from Delphi.

There are some considerations which must be respected:

Don't advocate illegal software like warez, serials or cracks!
Don't post commercials!
No spamming!

Comments containing such content will be moderated by me and afterall:

Be respectful to everybody and his/her opinion!