Jump to content

Yaron

Members
  • Content Count

    72
  • Joined

  • Last visited

  • Days Won

    1

Yaron last won the day on November 13 2018

Yaron had the most liked content!

Community Reputation

13 Good

Technical Information

  • Delphi-Version
    Delphi 10.3 Rio

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. I believe that I solved this issue, I was missing enctype="multipart/form-data" in the form's statement.
  2. I am trying to upload an image from an html form (see below) to a MARS server. Previously, I was able to get this working when the client was written in Delphi, but now the client is a standard browser and the code fails (LParam.isFile returns false). HTML form: <form method="post"> <input type="text" name="ImageName" required><br> <input type="file" accept="image/jpeg" name="ImageFile" required> </form> The code I used to get the image that doesn't seem to work in this case : var lParam : TFormParam; mStream : TMemoryStream; begin For lParam in aParams do Begin If (SameText(lParam.FieldName, 'ImageFile')) then Begin If (LParam.isFile) then Begin mStream := TMemoryStream.Create; mStream.Write(lParam.AsFile.Bytes,Length(lParam.AsFile.Bytes)); mStream.Position := 0; Try mStream.SaveToFile('d:\test.jpg'); Finally mStream.Free; End; End; End; end; Any ideas?
  3. Is there a way to shorten the URL required to access the MARS server? What I did so far was to modify FEngine.AddApplication('DefaultApp', '/v', [ 'Server.Resources.*']); in "Server.Ignition". Ideally, I would like to eliminate the "/rest" and application name entirely, so the entry point would be whatever I define in [Path('')].
  4. For reasons I don't understand, the issue in the screenshot occasionally shows up. Then, when an exception is raised or when I place breakpoints, it causes them to trigger/show on the wrong line of code. Any idea how to resolve this issue?
  5. Is there documentation on how to use MARS to embed data in a cookie and retrieve it on subsequent calls? And of course, any additional sample code would be a blessing.
  6. I am writing a server using MARS with the client being a web browser (e.g. firefox) sending form data to the server. I don't want every user to be able to access the form, so I need to implement a login/authentication system. The authentication demo code I've seen ('MARS-Repository\MARS\Demos\Authorization\') seems to require using MARS client-code, which I don't think is possible if the client is a web browser. Do I need to write my own authentication code or is there some way I can leverage MARS's authentication code for this purpose?
  7. Please ignore this post, the issue was a combination of a bug and the user's inability to find the output log.
  8. I am creating an Android application that scales images based on the device's fullscreen resolution. To enable fullscreen, I do: 1. In "Project Options / Application / Version Info" I set the theme to "No TitleBar". 2. Set "Form.Fullscreen" to enabled in the main form's "OnCreate" event. However, I'm having problems detecting when my App is finally fullscreen, I suspect there may be a rounding error in Delphi's function, here is the log: 05-17 03:56:36.660: I/info(15344): FMX: ZP Remote: ZPR_DBG: Screen Scale : 1.3125 05-17 03:56:36.666: I/info(15344): FMX: ZP Remote: ZPR_DBG: IFMXScreenService.GetScreenSize : 1280x736 (with screen scale) 05-17 03:56:36.666: I/info(15344): FMX: ZP Remote: ZPR_DBG: IFMXScreenService.GetScreenSize : 975x561 (original) 05-17 03:56:36.666: I/info(15344): FMX: ZP Remote: ZPR_DBG: Screen : 975x561 05-17 03:56:36.664: I/info(15344): FMX: ZP Remote: ZPR_DBG: Client : 975x537 05-17 03:56:36.724: I/info(15344): FMX: ZP Remote: ZPR_DBG: Client : 975x537 05-17 03:56:36.940: I/info(15344): FMX: ZP Remote: ZPR_DBG: Client : 975x562 The first 4 lines give system detail from IFMXScreenService.GetScreenScale, IFMXScreenService.GetScreenSize and Screen.Width/Screen.Height. Each "client" line shows the values of "ClientWidth/ClientHeight" on a FormResize event. As you can see, the ClientHeight value is higher than the Screen.Height value, which doesm't make sense.
  9. I was able to obtain some logcat/event, any idea what's going on? Logcat: 05-13 16:00:47.545 I/ActivityManager( 1383): START u0 {act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=com.inmatrix.ZP_Remote/com.embarcadero.firemonkey.FMXNativeActivity bnds=[37,1730][238,2028]} from uid 10015 05-13 16:00:47.636 I/ActivityManager( 1383): Start proc 14206:com.inmatrix.ZP_Remote/u0a227 for activity com.inmatrix.ZP_Remote/com.embarcadero.firemonkey.FMXNativeActivity 05-13 16:00:48.297 W/linker (14206): Warning: "/data/app/com.inmatrix.ZP_Remote-S-1zk8LZ5cw0Sxl-7bv-GA==/lib/arm/libZP_Remote.so" unused DT entry: DT_RPATH (type 0xf arg 0x145ae) (ignoring) 05-13 16:00:49.598 D/SurfaceFlinger( 814): duplicate layer name: changing SurfaceView - com.inmatrix.ZP_Remote/com.embarcadero.firemonkey.FMXNativeActivity to SurfaceView - com.inmatrix.ZP_Remote/com.embarcadero.firemonkey.FMXNativeActivity#1 05-13 16:00:49.599 D/SurfaceFlinger( 814): duplicate layer name: changing Background for -SurfaceView - com.inmatrix.ZP_Remote/com.embarcadero.firemonkey.FMXNativeActivity to Background for -SurfaceView - com.inmatrix.ZP_Remote/com.embarcadero.firemonkey.FMXNativeActivity#1 05-13 16:00:49.994 I/ActivityManager( 1383): Displayed com.inmatrix.ZP_Remote/com.embarcadero.firemonkey.FMXNativeActivity: +2s446ms 05-13 16:00:50.100 W/SurfaceFlinger( 814): Attempting to set client state on removed layer: Splash Screen com.inmatrix.ZP_Remote#0 05-13 16:00:50.100 W/SurfaceFlinger( 814): Attempting to destroy on removed layer: Splash Screen com.inmatrix.ZP_Remote#0 05-13 16:00:57.071 E/BufferQueueProducer( 814): [SurfaceView - com.inmatrix.ZP_Remote/com.embarcadero.firemonkey.FMXNativeActivity#1] disconnect: not connected (req=1) 05-13 16:00:58.326 W/InputDispatcher( 1383): channel '3be32e5 com.inmatrix.ZP_Remote/com.embarcadero.firemonkey.FMXNativeActivity (server)' ~ Consumer closed input channel or an error occurred. events=0x9 05-13 16:00:58.326 E/InputDispatcher( 1383): channel '3be32e5 com.inmatrix.ZP_Remote/com.embarcadero.firemonkey.FMXNativeActivity (server)' ~ Channel is unrecoverably broken and will be disposed! 05-13 16:00:58.329 I/ActivityManager( 1383): Process com.inmatrix.ZP_Remote (pid 14206) has died: cch CRE 05-13 16:00:58.329 I/WindowManager( 1383): WIN DEATH: Window{3be32e5 u0 com.inmatrix.ZP_Remote/com.embarcadero.firemonkey.FMXNativeActivity} 05-13 16:00:58.329 W/InputDispatcher( 1383): Attempted to unregister already unregistered input channel '3be32e5 com.inmatrix.ZP_Remote/com.embarcadero.firemonkey.FMXNativeActivity (server)' 05-13 16:00:58.349 W/SurfaceFlinger( 814): Attempting to destroy on removed layer: AppWindowToken{58e86aa token=Token{2ad595 ActivityRecord{e1ab14c u0 com.inmatrix.ZP_Remote/com.embarcadero.firemonkey.FMXNativeActivity t9944}}}#0 Events: 05-13 15:56:13.909 I/am_create_activity( 1383): [0,177586847,9925,com.inmatrix.ZP_Remote/com.embarcadero.firemonkey.FMXNativeActivity,android.intent.action.MAIN,NULL,NULL,270532608] 05-13 15:56:13.971 I/am_proc_start( 1383): [0,11738,10227,com.inmatrix.ZP_Remote,activity,com.inmatrix.ZP_Remote/com.embarcadero.firemonkey.FMXNativeActivity] 05-13 15:56:14.131 I/am_proc_bound( 1383): [0,11738,com.inmatrix.ZP_Remote] 05-13 15:56:14.143 I/am_restart_activity( 1383): [0,177586847,9925,com.inmatrix.ZP_Remote/com.embarcadero.firemonkey.FMXNativeActivity] 05-13 15:56:14.145 I/am_set_resumed_activity( 1383): [0,com.inmatrix.ZP_Remote/com.embarcadero.firemonkey.FMXNativeActivity,minimalResumeActivityLocked] 05-13 15:56:16.473 I/sysui_multi_action( 1383): [319,268,321,116,322,2583,325,94229,757,761,758,7,759,1,806,com.inmatrix.ZP_Remote,871,com.embarcadero.firemonkey.FMXNativeActivity,904,com.google.android.apps.nexuslauncher,905,0,945,247,1320,12,1321,1] 05-13 15:56:16.475 I/am_activity_launch_time( 1383): [0,177586847,com.inmatrix.ZP_Remote/com.embarcadero.firemonkey.FMXNativeActivity,2583] 05-13 15:56:22.553 I/am_finish_activity( 1383): [0,177586847,9925,com.inmatrix.ZP_Remote/com.embarcadero.firemonkey.FMXNativeActivity,app-request] 05-13 15:56:22.555 I/am_pause_activity( 1383): [0,177586847,com.inmatrix.ZP_Remote/com.embarcadero.firemonkey.FMXNativeActivity,userLeaving=false] 05-13 15:56:23.195 I/am_destroy_activity( 1383): [0,177586847,9925,com.inmatrix.ZP_Remote/com.embarcadero.firemonkey.FMXNativeActivity,finish-imm:activityIdleInternalLocked] 05-13 15:56:24.232 I/am_proc_died( 1383): [0,11738,com.inmatrix.ZP_Remote,900,17] 05-13 16:00:47.559 I/am_create_activity( 1383): [0,236630348,9944,com.inmatrix.ZP_Remote/com.embarcadero.firemonkey.FMXNativeActivity,android.intent.action.MAIN,NULL,NULL,270532608] 05-13 16:00:47.636 I/am_proc_start( 1383): [0,14206,10227,com.inmatrix.ZP_Remote,activity,com.inmatrix.ZP_Remote/com.embarcadero.firemonkey.FMXNativeActivity] 05-13 16:00:47.854 I/am_proc_bound( 1383): [0,14206,com.inmatrix.ZP_Remote] 05-13 16:00:47.865 I/am_restart_activity( 1383): [0,236630348,9944,com.inmatrix.ZP_Remote/com.embarcadero.firemonkey.FMXNativeActivity] 05-13 16:00:47.865 I/am_set_resumed_activity( 1383): [0,com.inmatrix.ZP_Remote/com.embarcadero.firemonkey.FMXNativeActivity,minimalResumeActivityLocked] 05-13 16:00:49.993 I/sysui_multi_action( 1383): [319,336,321,104,322,2446,325,94503,757,761,758,7,759,1,806,com.inmatrix.ZP_Remote,871,com.embarcadero.firemonkey.FMXNativeActivity,904,com.google.android.apps.nexuslauncher,905,0,945,311,1320,12,1321,1] 05-13 16:00:49.994 I/am_activity_launch_time( 1383): [0,236630348,com.inmatrix.ZP_Remote/com.embarcadero.firemonkey.FMXNativeActivity,2446] 05-13 16:00:56.363 I/am_finish_activity( 1383): [0,236630348,9944,com.inmatrix.ZP_Remote/com.embarcadero.firemonkey.FMXNativeActivity,app-request] 05-13 16:00:56.365 I/am_pause_activity( 1383): [0,236630348,com.inmatrix.ZP_Remote/com.embarcadero.firemonkey.FMXNativeActivity,userLeaving=false] 05-13 16:00:56.987 I/am_destroy_activity( 1383): [0,236630348,9944,com.inmatrix.ZP_Remote/com.embarcadero.firemonkey.FMXNativeActivity,finish-imm:activityIdleInternalLocked] 05-13 16:00:58.329 I/am_proc_died( 1383): [0,14206,com.inmatrix.ZP_Remote,900,17]
  10. I managed to get a logcat of my app not loading in Nox (this also happens with a blank app): I/ActivityManager( 2149): START u0 {act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=com.inmatrix.ZP_Remote/com.embarcadero.firemonkey.FMXNativeActivity bnds=[930,370][1189,525]} from uid 1000 on display 0 I/ActivityManager( 2149): Start proc 4473:com.inmatrix.ZP_Remote/u0a44 for activity com.inmatrix.ZP_Remote/com.embarcadero.firemonkey.FMXNativeActivity D/houdini ( 4473): [4473] Added shared library /data/app/com.inmatrix.ZP_Remote-1/lib/arm/libZP_Remote.so for ClassLoader by Native Bridge. F/DEBUG ( 4489): pid: 4473, tid: 4473, name: atrix.ZP_Remote >>> com.inmatrix.ZP_Remote <<< W/ActivityManager( 2149): Force finishing activity com.inmatrix.ZP_Remote/com.embarcadero.firemonkey.FMXNativeActivity I/WindowManager( 2149): Failed to capture screenshot of Token{1a08a1d ActivityRecord{48bc2f4 u0 com.inmatrix.ZP_Remote/com.embarcadero.firemonkey.FMXNativeActivity t7 f}} appWin=Window{3b58c89 u0 Starting com.inmatrix.ZP_Remote} drawState=4 I/ActivityManager( 2149): Process com.inmatrix.ZP_Remote (pid 4473) has died W/ActivityManager( 2149): Ignoring remove of inactive process: ProcessRecord{98f6a49 0:com.inmatrix.ZP_Remote/u0a44} I'm not proficient enough to understand the debug out, can anyone shed any light?
  11. I am developing a cross-platform remote control app for my Windows PC media player: https://play.google.com/store/apps/details?id=com.inmatrix.ZP_Remote However, I have a user running Android 9 that reports that right after the splash screen (delphi's built-in splash screen, no custom code), all they see is a gray screen. Since the user is on a rooted phone, I provided a debug APK with code that outputs progress to a log file, however the log file is never created. The only thing I can compare it to is trying to run the App on the Nox emulator running Android 7, which instantly crashes after the splash screen without reaching the first line of code on even a blank application (new multi-device application, with no additional code): Here is the pertinent code that should at least output one line of debug code (which works just fine on all devices I could test locally): program ZP_Remote; {$R *.dres} uses FMX.Forms, FMX.Types, misc_functions, System.IOUtils, System.SyncObjs, MainUnit in 'MainUnit.pas' {MainForm}, transunit in 'transunit.pas'; {$R *.res} begin csDebug := TCriticalSection.Create; clientStopWatch.Start; UserDataPath := System.IOUtils.TPath.GetHomePath+System.IOUtils.TPath.DirectorySeparatorChar+clientName+System.IOUtils.TPath.DirectorySeparatorChar; {$IFDEF TRACEDEBUG}AddDebugEntry('DPR:Start');{$ENDIF} FMX.Types.GlobalUseGPUCanvas := True; // 25->840fps! but messes with font rendering?!? Application.Initialize; {$IFDEF TRACEDEBUG}AddDebugEntry('DPR:Initialized');{$ENDIF} Application.FormFactor.Orientations := [TFormOrientation.Portrait]; {$IFDEF TRACEDEBUG}AddDebugEntry('DPR:Form orientation set');{$ENDIF} Application.CreateForm(TMainForm, MainForm); {$IFDEF TRACEDEBUG}AddDebugEntry('DPR:Form created, ready to run');{$ENDIF} Application.Run; {$IFDEF TRACEDEBUG}AddDebugEntry('DPR:Last line');{$ENDIF} end. And here is the code that writes the debug output: procedure AddDebugEntry(S : String); const UTF8BOM : Array[0..2] of Byte = ($EF,$BB,$BF); Var FileName : String; fStream : TFileStream; sAnsi : UTF8String; S1 : String; begin If csDebug <> nil then csDebug.Enter; Try if UserDataPath <> '' then Begin FileName := UserDataPath+clientDebugFile; If FileExists(FileName) = True then Begin Try fStream := TFileStream.Create(FileName,fmOpenWrite); Except fStream := nil; End; End else Begin Try fStream := TFileStream.Create(FileName,fmCreate); fStream.Write(UTF8BOM,3); Except fStream := nil; End; End; If fStream <> nil then Begin S1 := IntToStr(clientStopWatch.ElapsedMilliseconds); While Length(S1) < 12 do S1 := ' '+S1; S := {$IFDEF DEBUGDATE}DateToStr(Date)+' '+TimeToStr(Time)+' '+{$ENDIF}'['+S1+'] : '+S; sAnsi := UTF8Encode(S)+#13#10; fStream.Seek(0,soFromEnd); fStream.Write(sAnsi[Low(sAnsi)],Length(sAnsi)); fStream.Free; End; End; Finally If csDebug <> nil then csDebug.Leave; End; end; I welcome any advice on the best practices to diagnose and resolve such issues when access to the devices is severely limited.
  12. I don't think the AppBundle will become mandatory, but I wouldn't put it past google to down-grade your position in search results based on it.
  13. We all knew it would come this August, but now the Google Play store is showing warning notifications on new uploads: And to top it off, there's a new warning that I have no idea how to address (if it's even possible) with Delphi:
  14. Yaron

    Using Indy for cross-platform TCP/IP

    I am writing a remote control App that controls a PC. I am sending commands over TCP/IP each time a user clicks a UI button and at the same time, listening to responses to my commands. Presently, I am getting responses in the background "reading" thread and sending the command in the main thread. After reading your comments I realize my issue is further complicated, as your recommend not calling any TCP/IP function at all in my main thread, which means my Read function can't be blocking at all, otherwise the user will experience input-lag. Is it safe to call "IdTCPClient.IOHandler.WriteLn" in the main thread? If not, what is the best approach to check if there is data waiting without blocking?
×