Decode JSON object with an array value:
1 2 3 4 5 6 7 8 9 10 11 12 |
$jsonobj = '{"dataset":[{"field1":"hello","field2":0,"field3":1},{"field1":"hola","field2":2,"field3":3}]}'; $obj = json_decode($jsonobj); // it returns object $array_dataset = $obj->dataset; for ($i = 0; $i < count($array_dataset); $i++) { $singoloArray = $array_dataset[$i]; foreach($singoloArray as $field => $value) { echo $field . " => " . $value . "<br>"; } } |
Decode array of JSON object:
1 2 3 4 5 6 7 8 9 10 |
$jsonobj = '[{"field1":"hello","field2":0,"field3":1},{"field1":"hola","field2":2,"field3":3}]'; $obj = json_decode($jsonobj, true); // it returns array for ($i = 0; $i < count($obj); $i++) { $singoloArray = $obj[$i]; foreach($singoloArray as $field => $value) { echo $field . " => " . $value . "<br>"; } } |
Try this on https://3v4l.org/
Easy HTML editor with instant preview into TWebBrowser Component to use: – TSynedit – TSynHTMLSyn – TWebBrowser – TTimer (set Interval 1000) – TSplitter (set Align alLeft) Here the code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
procedure TForm1.SynEdit1KeyPress(Sender: TObject; var Key: Char); begin Timer1.Enabled := True; end; procedure TForm1.Timer1Timer(Sender: TObject); var Doc: Variant; begin Timer1.Enabled := False; if not Assigned(WebBrowser1.Document) then WebBrowser1.Navigate('about:blank'); Doc := WebBrowser1.Document; Doc.Clear; Doc.Write(SynEdit1.Lines.Text); Doc.Close; end; |
What is FMX for Linux? FireMonkey for Linux, also known as FMXLinux, is an add-on component provided to Delphi and RAD Studio Enterprise and Architect edition customers via an exclusive OEM agreement with FMXLinux. FMXLinux provides capabilities for building GUI applications for Linux, extending RAD Studio’s (Delphi Edition) FireMonkey cross-platform framework. Starting with 10.3.1, the FireMonkey…
Leggi tutto
Add class to checkbox
1 2 3 4 5 6 7 |
<div id="checkboxList"> <div><input type="checkbox" value="1" class="myChk"> Value 1</div> <div><input type="checkbox" value="2" class="myChk"> Value 2</div> <div><input type="checkbox" value="3" class="myChk"> Value 3</div> <div><input type="checkbox" value="4" class="myChk"> Value 4</div> <div><input type="checkbox" value="5" class="myChk"> Value 5</div> <div> |
Create a function to return a JSON string
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
function arrayChk(){ var arrAn = []; var m = $('.myChk'); var arrLen = $('.myChk').length; for ( var i= 0; i < arrLen ; i++){ var w = m[i]; if (w.checked){ arrAn.push( { "myVal" : w.value } ); console.log(w.value ); } } var myJsonString = JSON.stringify(arrAn); //convert javascript array to JSON string console.log( 'result' + myJsonString); alert(myJsonString); return myJsonString; } |
Here an example https://jsfiddle.net/a3owjh85/1/
Using the JPackageInfo class is simple to retrive the version of your Android application. This class is already wrapped by Embarcadero in the following unit: Androidapi.JNI.GraphicsContentViewText {code} {$IFDEF ANDROID} var PackageManager: JPackageManager; PackageInfo: JPackageInfo; begin PackageManager := SharedActivityContext.getPackageManager; PackageInfo := PackageManager.getPackageInfo (SharedActivityContext.getPackageName, 0); result := JStringToString(PackageInfo.versionName); End; {$ENDIF}
L’obiettivo era quello di connettersi a livello programmatico ad una specifica WiFi da qui è sorta l’esigenza di gestire in modo completo la classe Java WifiManager. Nei tre metodi principali riportati di seguito avremo: riconoscimento dell’IP Address assegnato alla porta wifi Elenco delle Wifi disponibili (quelle che il dispositivo riconosce) Elenco delle configurazioni WiFi salvate…
Leggi tutto