Copying files larger than 2GB to a mounted Samba share on Linux

Today we had a problem copying a large file (>4GB) to a Samba share using Linux. The share was mounted via smbmount and worked perfectly for all other files. However, the large file was copied to the share only up to a size of 2GB and then the copying aborted.

The solution was to mount the share with the option lfs (apparently this is short for “large file system”), e.g. like this in /etc/fstab:

//server/share$ /local/path smbfs lfs,username=user,password=secret 0 0

FLOW3: Convert a date string from an input field of a view into a DateTime object

As I’ve mentioned earlier, the FLOW3 documentation is a bit weak at the moment. The initial example walks you through a very simple view where only strings (like “title”, “author”) are entered via the view’s form. But how do you enter a date and have it converted to a “real” \DateTime upon initializing the object that should contain it?

I found the solution (again, mainly by chance) here: How to use the DateTimeConverter in FLOW3. Apparently, you have to convert the user’s input to the needed objects in a method in the corresponding controller, that is (magically?) called before the method that expects the main object you want to create (that contains the date).

Here’s an example: If you have a Report object that has a dueDate attribute of type \DateTime, you have to convert the user input (a string) to a \DateTime object in the method initializeCreateAction() of class ReportController.

FLOW3 offers quite a few type converters, among which you can also find a DateTimeConverter. You can use it like this in initializeCreateAction():

  1. public function createAction(Report $report) { }
  3. public function initializeCreateAction() {
  4.   $this->arguments[‘report’]
  5.     ->getPropertyMappingConfiguration()
  6.     ->forProperty(‘dueDate’)
  7.     ->setTypeConverterOption(
  8.       ‘TYPO3\FLOW3\Property\TypeConverter\DateTimeConverter’,
  9.       \TYPO3\FLOW3\Property\TypeConverter\DateTimeConverter::CONFIGURATION_DATE_FORMAT,
  10.       ‘Y-m-d’);
  11. }

FLOW3 now converts the input string (format ‘Y-m-d’) into a “real” \DateTime object before passing it on to the newly created Report object, that gets passed to createAction().

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. < 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.