4D Code-Schnipsel

How to set Automatic Font?

Keisuke Miyako on iNug

some developer use
$autofont:=OBJECT Get font(*;““)
$autofont:=_o_Font name(0)
also works.

but to set at runtime, I think it is better to
OBJECT SET STYLE SHEET(*;““;Automatic style sheet)
OBJECT SET STYLE SHEET(*;““;Automatic style sheet_additional)
OBJECT SET STYLE SHEET(*;““;Automatic style sheet_main)

Where is this IP from?

Sometimes, I want to know while parsing the webserver-logfiles. There is a helpful service for that at freegeoip.net. This line of code
$status_L:=HTTP Request(HTTP GET method;“http://freegeoip.net/json/“+$IP;$contents_T;$responce_O)
is all I need. The $responce_O is self-explanatory. One caveat: up to 15.000 request per hour.
See also this MaPagenda-post.

Fritzbox aha API mit 4D

Peter Vogel hat sich die AVM Fritz!DECT 200 intelligente Steckdose geholt und dazu die nötige 4D Methode geschrieben, um Temperatur, Leistung, Energie etc. abholen zu können. Er stellt die Methode zur Verfügung und hat sie in die4Dwerkstatt veröffentlicht.

Hex-String to Number

do you want to „unhex“ the string?
$code:=“<!–4dtext 0x“+$hex+“–>“
PROCESS 4D TAGS($code;$code)
Keisuke MIYAKO 15 Juli 2015, 4Dforum

Python-Code ausführen

$program:=“/usr/bin/python -“
$py:=“import os\nprint os.environ[‚ARG1‘]“
CONVERT FROM TEXT($py;“utf-8″;$stdIn)
LAUNCH EXTERNAL PROCESS($program;$stdIn;$stdOut;$stdErr)
ALERT(Convert to text($stdOut;“utf-8″))
Keisuke MIYAKO 25 Oct 2016, 4Dforum

We need help to by pass GateKeeper

The process is basically goes like this:
– Install „Xcode“ from App Store. It’s large, so be prepared.
– Launch it.
– Goto Preferences / Accounts

weiter – Keisuke Miyako, 27 Nov 2016, 4Dforum

and there is some advice concerning default.4dd