L4N (Log4Nat) – a logging framework for Natural (by Software AG)

Along with NatUnit (a unit testing framework) we released L4N (or Log4Nat, or Log4Natural ;-)) on SourceForge today: L4N on SourceForge.

L4N offers basic logging functionality for Natural (by Software AG), including:

  • user- and module-specific logging
  • different log levels (e.g. debug, info, error)
  • combinable logging facilities (e.g. work file, INPUT, WRITE, database)

Using the framework is easy, as the following code shows:

  1. LOCAL USING L4NCONST /* some constants like log levels etc.
  2. LOCAL USING L4NPARAM /* the parameters (e.g. log text) for calling the actual logging
  3. * (optional) basic configuration of logging for the current module
  4. L4N-DEBUGUSER := ‘macke’
  8. * the actual logging
  9. COMPRESS ‘Current value:’ #VALUE INTO L4N-LOGTEXT

L4N is licensed under LGPL v3, so feel free to use it in your (commercial) applications or even help us further develop the framework.

NatUnit (former NUNIT) on SourceForge

We published NatUnit (former NUNIT) on SourceForge today: NatUnit on SourceForge.

Due to naming conflicts with the “real” NUnit, we decided to publish it as NatUnit. However, the internal name is still NUNIT, as Natural module names are restricted to a length of 8 characters which left us with only one character to distinguish between modules, if we used NATUNIT 😉

NatUnit is easy to use, as the following code (a simple test case) shows. The whole framework is written in Natural itself, so you don’t have to use external tools like NaturalONE.

  6. *
  7. NUTESTP.FIXTURE := ‘Example TestCase 1’
  8. *
  11. *
  13. *
  14. ********************************************************************************
  15. IF NUTESTP.TEST EQ ‘compare two equal numbers should pass’
  16. ********************************************************************************
  18. END-IF
  19. *
  21. *
  22. END

NatUnit is licensed under LGPL v3, so feel free to use it in your (commercial) applications or even help us further develop the framework.

FLOW3: Create a select box mapping to a list of objects in a Fluid view

FLOW3 rocks. However, the current documentation is… well… a bit short 🙂 The quickstart guide and the blog example show you the basics of working with FLOW3 and Fluid, its templating engine. But for explanations or examples of even the slightest more complex functionality you have to search the web for quite some time (or at least I had to ;-)).

Like today: I wanted to map an object of type Invoice to an object of type Client in a Fluid view. How do you do that, so that FLOW3 instantiates a real Client object and hands it over to the Invoice object upon its instantiation? It turns out, all you have to provide the framework to magically do that, is something like a select tag with the Client objects’ GUIDs like this:

  1. <select name="client">
  2.   <option value="80f870ee-931c-4706-8716-fb3e52bbe450">Client 1</option>
  3.   <option value="fb2cd21e-64e8-439b-bff2-be51948b8ff5">Client 2</option>

But how do you do that using Fluid? I found the solution (mainly by chance) here: FLOW3 – your first relation between to models.

  1. <f:form.select property="client" name="client" options="{clients}" optionLabelField="name" />

If you omit the attribute optionValueField on the view helper f:form (see Fluid ViewHelper Reference), the objects’ GUIDs are magically used for the values of the options in the HTML form and FLOW3 figures out that it has to instantiate Client objects.

Iterate over a possibly empty array in VBA (Excel)

When you try to iterate over an empty array in VBA like this, you will get a runtime error (index out of bounds):

  1. Sub ArrayTest()
  3. Dim testarray() As Integer
  4. Dim i As Integer
  6. For i = LBound(testarray) To UBound(testarray) ‘ <– error
  7.    Debug.Print testarray(i)
  8. Next i
  10. End Sub

Even if you check the return value of LBounds like this, it results in the same error:

  1. Sub ArrayTest()
  3. Dim testarray() As Integer
  4. Dim i As Integer
  6. If LBound(testarray) > 1 Then  ‘ <– error
  7.    For i = LBound(testarray) To UBound(testarray)
  8.         Debug.Print testarray(i)
  9.     Next i
  10. End If
  12. End Sub

However, to get rid of the error and to iterate over a possibly empty array, the following code works:

  1. Sub ArrayTest()
  3. Dim testarray() As Integer
  4. Dim i As Integer
  6. On Error Resume Next
  7. If LBound(testarray) > 1 Then
  8.     If Err.Number = 0 Then
  9.         For i = LBound(testarray) To UBound(testarray)
  10.             Debug.Print testarray(i)
  11.         Next i
  12.     End If
  13. End If
  15. End Sub

Visual Basic magic 😉

SVG-Dateien in LaTeX einbinden

Wenn man mit LaTeX arbeitet, ist es sinnvoll, die verwendeten Grafiken in einem skalierbaren Dateiformat einzubinden, damit sie beim Druck genauso scharf aussehen wie der Text. Viele Vektorgrafiken (gerade auch in der Wikipedia) liegen heutzutage im SVG-Format vor.

Diese Dateien direkt in LaTeX einzubinden ist nach meinen Recherchen aktuell anscheinend noch nicht möglich. Es wird immer der Weg der Konvertierung der SVG-Datei in EPS oder PDF empfohlen. Beides ist mit der freien Software InkScape sehr einfach möglich: SVG-Datei öffnen, Speichern unter, Dateiformat auswählen, fertig.

Die PDF-Datei kann dann mittels \includegraphics{Datei.pdf} in LaTeX eingebunden werden.

Interview mit mir zum Einsatz von Wikis in Unternehmen bei NDR Info

Heute Morgen war ich in einem kurzen Interview zum Einsatz von Wikis in Unternehmen bei NDR Info im Radio zu hören. Schon Anfang Dezember war Christoph Heinzle vom NDR bei uns im Unternehmen und hat eine Kollegin und mich zu dem Thema interviewt.

Unser Wiki gibt es nun bereits seit einigen Jahren und es hat sich eine stattliche Anzahl an Artikeln angesammelt. Im Durchschnitt hat jeder EDV-Mitarbeiter über 100 Artikel verfasst, ob Dokumentationen, Arbeitsanweisungen oder Tutorials.

Hier gibt es den Online-Artikel zum Radiobeitrag: Firmen konservieren Wissen mit Wiki.

Getting PL/SQL Developer on Windows 7 64bit to connect to an Oracle database

After I installed the latest version of PL/SQL Developer on my Windows 7 64bit machine today, I got the following error message when trying to connect to an Oracle database:

Initialization error
Could not initialize "D:\oracle\product\11.2.0\client_1\bin\oci.dll"
Make sure you have the 32 bits Oracle Client installed.
PL/SQL Developer Windows 7 64bit Oci Error

As I’ve found out, the solution is to install (actually, simply extracting the archive is enough) the latest 32bit version of the Oracle Instant Client and configure PL/SQL Developer to use it instead of the 64bit Oracle client under Tools – Preferences.

PL/SQL Developer Windows 7 64bit Settings

I found this solution here: Fix Initialization Error: LoadLibrary oci.dll returned 0 while trying to connect to Oracle using PL/SQL Developer.

However, PL/SQL Developer didn’t recognize my tnsnames.ora anymore after I switched to the 32bit Instant Client. The solution is pretty simple: just create the directory network\admin in the 32bit Instant Client’s directory and copy your tnsnames.ora from the real Oracle client’s directory there.

Installation of Microsoft Baseline Security Analyzer (MBSA) fails with error code 2738

When installing Microsoft Baseline Security Analyzer (MBSA) the installation on my Windows 7 64bit machine failed with error code 2738. However, I found the solution for this problem in the Chip forum:

  • Remove the registry key HKEY_CURRENT_USER\SOFTWARE\Classes\Wow6432Node\CLSID\.
  • Register vbscript.dll running regsvr32 C:\Windows\SysWOW64\vbscript.dll as Administrator.MBSAError2738RegisterDLL2

How to add a local calendar to the Android 2.2 Froyo emulator

After I had successfully added the calendar application to my Android emulator running Android 2.2 (Froyo), I soon realized that I wasn’t able to create events in it because I had no calendars. Android gave me this nice message: You have no calendars.

Android 2.2 Froyo: You have no calendars

Searching the web for this problem lead me to the need of creating a Google account that then could be synced with the emulator’s calendar. However, the sync did not work. After setting up the account under Settings - Accounts and sync - Add account - Google it didn’t show up in the sync settings and there was still no calendar created for it.

The Android documentation said that it would be possible to create a calendar in an application, so I tried that. Quite a few hours of trying and debugging later, I finally found this post on StackOverflow, that contains a list of all the needed fields and correct values for them: After adding an event to a user-created calendar in android,the event title doesn’t show up.

So here’s the final piece of code that adds a local calendar to the Android emulator:

  1. ContentValues vals = new ContentValues();
  2. vals.put("_id", 1);
  3. vals.put("_sync_account", account.name);
  4. vals.put("_sync_account_type", account.type);
  5. vals.put("name", account.name);
  6. vals.put("displayName", account.name);
  7. vals.put("color", 14417920);
  8. vals.put("access_level", 700);
  9. vals.put("selected", 1);
  10. vals.put("ownerAccount", account.name);
  11. vals.put("sync_events", 1);
  12. vals.put("timezone", "GMT");
  13. vals.put("hidden", 0);
  14. getContentResolver().insert(calUri, vals);

Where calUri is something like


and account is an android.accounts.Account.

I’ve put the code into a small application that reads the available accounts and creates a local calendar via a simple click on a button.


Attention: Your emulator has to run Google APIs (Google Inc.) – API Level 8 and not Android 2.2 – API Level 8.

Android Emulator running Google API 8