4D’s web server & port 80 – Part I

Just had to fight on MacMini Server (10.6.4) with the firewall and port 80. 4D does some kind of work with its „Helper Tool“, but I found it is not reliable.

The 4D manual is not really uptodate… and has a trap. The picture shows „Enable SSL“ but does not tell you anything about the required certificates you need. Without the certificates SSL will not work – 4D’s listener on port 443 does not start. This is a different problem, we will cover it later.

Setting the firewall seemed to be the solution. Used to the user friendly interface of Apple, what a bummer! No such things for the server software.

I tried to use ‚WaterProof‘ – it destroyed the IP v6 settings and rendered the server useless. Thanks to TimeMachine I was able to recover from this.

First, you have to turn on the firewall. Sounds easy? Yep, but right in the beginning easy to forget.

Test your settings

Start the terminal and enter this line.

sudo ipfw add 101 fwd,8080 tcp from any to any 80 in

You have to get used to the syntax.

sudo Run it with root permission

IPfirewall – the program which executes your line

add ‚add‘ a new rule

101 Each rule is numbered, executed to to down, first match wins

fwd forward – you want to forward an incoming TCP packet

<ip address>,<port number> this is the final destination where you packet should go to. It is the IP address 4D’s web server is listing to (see 4D’s web server prefs). Take care: If you have assigned multiple IP addresses to your Mac and 4D listens not to all, then you need to replace with the IP address 4D’s web server is listening to!!

tcp protocol, use TCP always and only

from any 2 commands, but you don’t care (usually) where the packet is coming from

to any The tricky part starts here.

  • if you run with a single ip address, you are done
  • if you have more the one and 4D listens to all then you are done, too
  • if you have more the one ip address and 4D listens to only one (1) of them, replace any with your ip address.

Fire it up (hit return in the terminal), enter the administrators password and if you don’t get an error message, it is done.

Now test it in a browser.Enter the ip address 4D’s web server is listing to and hit enter. http://localhost should do it, too.

Let’s assume it does work. It does not work? Try http://localhost:8080 – this does? Try again with the IP address 4D’s web server is listening to.

4Dwerkstatt.nord im Oktober

4 Tage nach der 4D Summit 2010. Christian Sakowski ist zurück. Es gibt sicherlich was zu erzählen.

Ab dem nächsten Treffen Entwicklertools:
Was habt Ihr Euch für 4D-Entwicklertools geschrieben, um Euch das 4D-Leben einfach zu machen?
Halbe Stunde – Stunde, wir zeigen es uns, reihum.

Bernd Fröhlich hat angekündigt seine Komponente “GenericOutput” vorzustellen.


iSort 3 bringt 4D v12 ins iOS

In den 4D News entdeckt!

iSort 3 bringt 4D v12 ins iOS

13.10.2010 by 4D Team

Die Partnerschaft zwischen 4D und iSort bietet für alle 4D v12 Anwendungen neue Einsatzmöglichkeiten. iPad, iPhone und iPod Touch Anwender können nun per Wi-fi und 3G Daten automatisch in beide Richtungen zwischen stationären 4D-Anwendungen und den mobilen i-Geräten synchronisieren.

4D und der iPhone Entwickler Frédéric Bayle freuen sich, heute die Veröffentlichung von iSort 3 bekanntzugeben. Die App ist ab sofort im iTunes App Store erhältlich.

iSort kann über den iTunes App Store für € 3,99 erworben werden. Alle Updates sind kostenlos.

Die 3,99 Oiro ausgegeben und hier folgt der erste Bericht!

hier ein Kurzbericht für die erfolgreiche Verwendung von iSort_3

  1. Man muß die richtige Lizenz haben – v12 Professional.
  2. In v12 eine Datenbank erstellen
    • Jede Datei muß ein Feld mit einem Primärschlüssel enthalten.
    • Primärschlüssel erstellen – im Struktureditor mit der rechten Maustaste auf das Feld klicken – auswählen: Primärschlüssel erstellen.

    • im Inspector (Doppelklick auf den Tabellennamen im Struktureditor) das Feld anwählen “Replikation einschalten”
  3. Web Server starten im Menü Start.
  4. eine Methode vorbereiten:
  5. Read Write ([Tabelle])
    All records([Tabelle])
    Apply to Selection([Tabelle];Primarschlüssel_Feld:=Primarschlüssel_Feld)
    Diese Methode muß man ggf. starten wenn man später nicht Syncronisieren kann.

  6. Weiter auf dem iPad:
    • iSort starten
    • Unten links auf das Symbol Zahnrad klicken und die Adresse für den 4D Rechner samt Port eintragen und Done klicken.
    • oben rechts auf das + klicken (Dialog “New Database” erscheint)
    • unten rechts auf 4D Import klicken (der Dialog ändert sich und ein Liste erscheint)
    • Tabelle auswählen durch anklicken
    • Import Data Schalter links unten einschalten und oben rechts auf Done klicken
  7. Die SYNCHRONISATION samt Erstellung der DB läuft …
  8. Nach dem Abschluß die Datenbank starten!

Hurra – dem tüchtigen Franzosen !

Bis bald

Hierarchical list as data-container

Hierarchical lists are both a valuable interface-object and a data-container. Up to V11, we had 255 characters and a longint. But then 4D opened the storage capacity of hierarchical lists by adding a LIST ITEM PARAMETER. What is that good for?

As most of the times, the manuals define what is possible and sometimes formulate what we should not do. Missing much to often are those hints, that explain to the non-professional why this option is added.

Do you understand what this means?
Custom selector: You can also pass custom text and associate it with a value of the Text, Number or Boolean type in selector. This value will be stored with the list item and may be retrieved using the GET LIST ITEM PARAMETER command. This lets you set up any type of interface associated with hierarchical lists. For example, in a list of customer names, you can store the age of each person and only display it when the corresponding item is selected.

I love the feature, because now I can store all extra-information inside the hierarchical list, where it belongs, instead of keeping track in a seperate datastructure like records or a couple of arrays.

You ask, why I want to store extra-information inside a listbox? One important usage of hierarchical lists are navigational lists like those in the DBZ-component. In a basic hierarchical list I’d store the tablename in listitemtext and the tablenumber in listitemref. For navigational purposes I need to have a inputform attached to every listitem, to open an inputform on doubleclick. That means keeping track in an invisible ARRAY TEXT(t_Inputform) and an invisible ARRAY LONGINT(t_TableNbr).

Now when doubleclicking I need to Find in array(t_TableNbr;$listitemref) and check wether the found line is valid. If the foundline is valid then set INPUT FORM(t_Inputform{$foundLine}).

Utilizing LIST ITEM PARAMETER keeping track of extra data gets easier: when creating the list I SET LIST ITEM PARAMETER (list;$itemRef;”inputform”;”myNiceMainEditor”). When doubleclicking I use the reverse command GET LIST ITEM PARAMETER(list;$itemRef;”inputform”;$useInputForm). $useInputForm will contain “myNiceMainEditor” so I set INPUT FORM($useInputForm).

Best of all: saving hierarchical lists saves the parameters too, both into the Toolbox lists and LIST TO BLOB.

Hurray, great enhancement to the 4D language!

While new to the command; I’ll use it like this
SET LIST ITEM PARAMETER (list;$itemRef;”inputform”;”myNiceMainEditor”). Some days later I’m thinking about not to use text for the selector, instead using something like
MySelector_Mngr (“SelectorName_Get”;”Inputform”) where MySelector_Mngr behaves similar to Get localized string.

Then I discover, the command GET LIST ITEM PARAMETER SELECTORNAMES is missing. Holy moly, I’ve to keep track of used selectors myself.


But now, I’m cured of hidden datastructures to keep track of additional information concerning hierarchical lists. I’ll keep them inside the list themselve. I need to wrap theSET LIST ITEM PARAMETER and GET LIST ITEM PARAMETER into a method of my own. The aim is to keep one additional parameter, that keeps track of the used parameter-names. That’s 150 lines of code including lots of error-prevention and defensive coding.

Now I use HierList_Parameter(“Add”;$hl_Sprachen;0;”english”;->$interText) to add a Parameter to the list and retrieve the parameter this way HierList_Parameter(“Get”;$hl_Sprachen;0;”english”;->$interText).

Additionally HierList_Parameter(“ParameterArrays_Get”;hl_Files;0;””;->$t_ParamName;->$t_Paramvalue) gives me all parameters and their accompanying values back. This is especially useful, when transforming XML into hierachical lists and storing the attributes as LIST ITEM PARAMETER, where the attributename serves as selectorname and the attributevalue as parametervalue.

As most of the time: if 4D doesn’t support a feature, I can build it myself. And there might be additional benefits for the work I had to invest.


By the way, there is one special parameter Additional text. 4D handles that and displays the content of the Additional text right-aligned. These days of unicody there is a lot of symbols and signs to display the additional text iconic. If only the method-editor would support unicode.
There is a workaround too. Store the symbolic characters in an Xliff-file. Use Get localized string to populate the parameter-value from this Xliff-file.


First published at http://dddd.mettre.de/hierparameter.shtml

4D can read fixed length data

hard to believe after years of years of parsing text myself to get the records into my database, I finally discovered, there is an option to import fixedlength data into 4D by using the build in import-editor:
If only the interface of the import-editor wouldn’t scramble already selected parameters much to often or preloading a saved import-station would really load well before importing by code.

Unix’s Revenge

… Google, Apple, HP, RIM, Samsung and Nokia are all now betting heavily on Unix or Unix-like implementations. The success is so overwhelming that there are really only two hold-outs: Microsoft and the rapidly depreciating Symbian. …