Author Archives: admin

Wow… I can’t believe it!

That guy is still alive.
Been awfully quiet around here.

Sorry folks, quite busy, working hard, treadmill, you know the works…

Anyhow, I do have something new!

Remember the good old times when you could print a structure?
Well, I do.
Sadly that option has gone the way of the Dodo some versions ago.
Yes, I know, there are a few solutions out there. Some usable, some not, some an eyesore, some quite elegant.
So, well, you know me, had to roll my own!

And here we go:

AC_StructToPicture

I admit not the most imaginative of names but it does what’s on the box!
And is fully configurable at that!

Also, it does not use a single table/field and not even one process or interprocess variable!

In my quite humble opinion, it is a nice example of using the new interface techniques working through the Form command.

All you need is to download it (it’s V17R5 so beware!), launch it and point it to an XML dump of your favorite structure.
For those who do not find my interfaces intuitive:

You can save and load presets, that’s collections of settings you make, so you only have to select Comic Sans once and can then use it on all your pictures…
Import Structure reads an XML structure dump, save structure stores it wherever you want as JSON, so you do not need to reparse it. And Load Structure obviously loads a stored JSON structure

All changes you make to settings are displayed in a preview for a table you select from the listbox, make the change and you will see it right away.

There is a second page for settings relating to relations:

I am not going to explain all of that, play around and see what happens.

The stuff concerning relations can only be seen once you render the structure using the Draw structure button.

It then show a new window with your structure, you can export the picture from there

Ok, that’s it,
Have fun, play around with it, maybe learn from it and if you find errors (there certainly are) either keep them or send me a message.

Usual disclaimer: now warranty, no support, no nothing and its uncompiled.

So long folks

Oh…

The download…

https://nextcloud.spostel.com/index.php/s/wSWgtWq4Qb9ydY2

Made a small correction that would lead to funny results on systems that use the “.” as decimal separator….
Thanks Cannon

CUrly Mail Fun

Oh no…

Not ANOTHER E-Mail component.
Can’t someone create something fun for a change?
A Plugin to use excess client computing power to mine Bitcoin or something useful like that?

Well, sadly yes!
Yours truly is delivering to you yet another E-Mail component to add to your growing toolchest of more or less useless code.

And mine is bigger and much more powerful, also it’s by me, Alex, so it obviously immediately climbs to the top of your choices. Doesn’t it?

Oh get over it already, say what you want to say and be done with it!

Continue reading

I can grab your Listbox

Admitted, a cheesy title line if I ever saw one…

It’s been a bit quiet in here lately, could be because I exchanged my keyboard and desk for this during most of October:


That’s Indonesia, at the beginning of the rainy season.

But now to matters at hand:

Exporting Listbox content!

Continue reading

Holy IMAP folder Batman!

Ok, anyone around here ever had to deal with IMAP folder names?
Outside the US?
For non – US client?

You might have noticed, that the array of folder names returned by IMAP_ListMBs may contain funny stuff like

INBOX.Gel&APY-schte Elemente

or

INBOX.batman&ZeVnLIqe-.&U,BTFw-robin

never seen those?
never cared?
what’s IMAP?
use english words, dumdum!

otherwise: read on Continue reading

To backup or not to backup?

UPDATED to HF1 on 2017-06-09 go to downloads

We have all been there and done that:

You will know the value of backup when you don’t have one

4D has given us a powerful backup system with a lot of features users of other systems envy us for.

What man do not realize, is that you can modify all parameters of a backup from you code, making changes on the fly and averting user errors.

Modifying the Backup.xml file allows you to set the schedule, files to be included, how to handle failures, basically everything that you can set in the backup settings panel of the database preferences.

Now I know that working with XML files is a bit tedious and not always very straightforward, also all the possible settings are a drag to keep track of.

Thus I have again come to the rescue and hereby publish my latest component:

AC_BackupTools

Continue reading

Fun with colors

It has become increasingly difficult to sell customers on the idea of amber text on a blackish screen, everybody expects brilliant, dazzling colors in Kodachrome…

Now 4D does work with colors and when defining colors you have the choice between using catchy names like light sable, dead otter or bami-goreng backwards and using a nomenclature that is a little bit like web colors, just replace the hash with 0x00 and you are set, easy as pie.

Now, out there, there are a lot of different color systems and (surprisingly) none is the one 4D uses!
There is RGB, CMYK, HSL, HSV and probably a few more I cannot be bothered with right now.

Now the interesting question:

How to convert between these systems and what about finding other information, like :

  • What’s the brightness of my color, useful for determining if text on it should be white or black
  • What does my color look like if its a tad darker
  • What do 50 shades of my color look like?

Well, do not despair, I obviously have the solution to the problem you never knew you had:

AC_ColorTools! Continue reading

SOUNDEX shmockdex

Back in 1918, in the US, a patent was given to whatever passed as nerds back then, who invented an algorithm for finding similar sounding names and words, such as John and  Jon or Schmitt and Schmidt.
Back in the days and only working with the names common in the US at the time (thing was made for the census) the SOUNDEX algorithm has aged a bit and certainly not transported well to foreign languages.
In some countries, other nerds found new ways of doing it (Kölner Phonetic in Germany for example) but many of those were geared towards the specific target market.

Nowadays, with the percentage of people with migratory background rising everywhere, it has become more difficult to perform this task.
To the rescue : Phonet and it’s posh sibling Phonet2.

As a quick look into the 4D documentation will tell you, there is no such thing in 4D, so we need to roll our own.

Another quick google further and we find the algorithm definition and pseudo code for it…
Nah…
Too complicated!
Well, challenge accepted!

Continue reading

View Log Files, not only local ones!

I have some fairly complex stuff going on in my database and there are some operations that users can log into the logs folder, so if there are any problems I can try to figure out what went wrong.
Now most of my customers work on Client-Server, some on Citrix or even Terminal Server.
This means they have no easy way of accessing the required folder (for example:  /Users/AppData/4D/Roaming/Local/MyDatabase_10_123_221_17/logs), and even if they do, users nowadays are not what they used to be, they have no clue what to do…
So I needed another solution to retrieve and view log files from other clients.

This is where my wonderful new component AC_LogViewer comes to the rescue! Continue reading

A quick one : Epoch & Unix Timestamp Conversion

Found this useful for making date and time calculations, as you can add or subtract any number of seconds to or from a given date and time.

Base for this ist the Unix Timestamp or Epoch: basically just the seconds since midnight 1970-01-01.

Below you will find 2 methods to convert a date and time into Epoch (a longint) and to convert Epoch back into an ISO date-time string that can easily be used with the Date(string) and Time(string) 4D commands.

Continue reading

DebugLogFile Analysis for fun and profit

Has anyone here ever used the 4D Debug log that can be created by switching on

SET DATABASE PARAMETER(Debug log recording;x)

No? Yes? How useful was it?
Until recently i never even looked at it, too much data too little visible information.
That changed once I saw a nice little piece of code written by Justin Carr from Australia. Called DebugLogReader it does just what’s advertised on the box: It reads your log files and displays the data in a meaningful way.

As I was just tasked to optimize some code from a database I had not written (well not initially) I put it to the test and after some fiddling I was able to shave roughly 12 seconds off opening a product record. 12 Seconds is an eternity for users, especially when browsing through a selection!

That’s when I decided to extend this wonderful tool and with Justins kind permission I hereby present:

DebugLogReader 1.01

Continue reading