-
Content Count
293 -
Joined
-
Last visited
-
Days Won
2
Everything posted by Yaron
-
@Remy Lebeau I upgraded to a new server (Win2008 to Win2019) and now I'm getting the same issue (trying to send eMail via Amazon SES). This is inside an ISAPI 32bit dll that worked just fine when running under Windows 2008, but fails to send email when running under Windows 2019. I literally use the same code, same DLLs as the Win2008 machine, all DLLs (my DLL & SSL) are 32bit, everything else in the code works fine except for sending eMail using TLS (SSL). Inside IIS's application pool, the DLL is defined as 32bit, classic and "no managed code". When calling "smtp.send" (TIdSMTP), I get the following exception and additional info: 3/22/2020 10:00:49 AM [ 11854 ms] : SMTP Send Exception : SSL negotiation failed. 3/22/2020 10:00:49 AM [ 11854 ms] : Inner Exception : Could not load SSL library. 3/22/2020 10:00:49 AM [ 11855 ms] : WhichFailedToLoad : "Failed to load libeay32.dll." The DLLs are in the same folder as the ISAPI DLL, I also tried placing them in the Windows/System32 folder but it made no difference. Both "libeay32.dll" and "ssleay32.dll" are v1.0.2.19 and I'm using Delphi 10.3.3.
-
Using Delphi 10.3.3: My goal is to have a stable client/server remote control over TCP/IP that can automatically recover in cases where the network disconnects occasionally. I use a structure Remi suggested of creating a reading thread that tries to readln with a 1sec time out: FClient.OnDisconnected := OnDisconnect; FClient.IOHandler.ReadTimeout := 1000; // lets us exit the read operation after 1sec of inactivity While Terminated = False do Begin If FClient.Connected = True then Try FData := FClient.IOHandler.ReadLn(IndyTextEncoding_UTF8); Except // catch exception & update UI Try If FClient.Connected = True then FClient.Disconnect; except on E: Exception do Begin // Catch disconnect exception End; end; End; End; I have a client PC connected to a router via cable and the server PC connected to the same router via WiFi. After connecting the client to the server, I disconnect the server's wifi access and absolutely nothing happens (I waited over a minute). The OnDisconnected event isn't triggered, calling FClient.IOHandler.ReadLn doesn't return any exception and FClient.Connected remains True. If I then try to call FClient.IOHandler.WriteLn, within about 10 seconds a "Socket Error # 10054 - Connection reset by peer" exception is raised on the ReadLn code about (not on the WriteLn function). In that exception, I call "If FClient.Connected = True then FClient.Disconnect" which raises another "Socket Error # 10054 - Connection reset by peer" exception. Finally, my code loops to the beginning and then the same exception is triggered on the initial "If FClient.Connected = True" line. Obviously, I'm not handling things correctly, I wasn't expecting "If FClient.Connected" to raise exceptions and I was hoping the OnDisconnect event to trigger, but are there other pitfalls I might be missing?
-
I recently upgrade my main development machine from Windows 7 to Windows 10. The major thing I noticed is that executing my app under the debugger is slower and file access (on an SSD drive) also seems impacted even though benchmarks show that read/write/io speeds are identical to Windows 7. Is this something anyone else encountered and possibly found a solution?
-
I'm not using a VM.
-
I don't think so, my versions of Delphi & Windows already include the fixes for that issue. I'm starting to think it may be the real-time protection that I had disabled in Win7 and is more difficult to disable in Win10.
-
What is the best approach you would recommend for creating log files with output to multiple files and input coming from multiple threads (some threads writing into the same log file) with a volume that can reach 1000's of entries per second? Everything is running in a single process, so Critical section locks can be used and log entries must be flushed so they won't be lost in RAM if the process crashes.
-
Best approach to Multi-file, multi-thread debug logging
Yaron replied to Yaron's topic in General Help
Wouldn't inter-process communication severely lag this process? -
Firebird SQL return rows only if a sub-string exists within a specific column
Yaron posted a topic in Databases
I prepared to post a question on how I can do this, but I actually reached a solution on my own while contemplating on how to best phrase the question and code. Since I searched and couldn't find good documentation on how to do this, I decided to post my solution here: Imagine a table with columns: NAME , TAGS , etc ... The TAGS column contains a string with multiple unique identifiers, for example "tag0001|tag0002|tag0003|tag0004". I'm only getting rows with a TAGS column that contains a sub-string I'm looking for (a specific tag) : sTAGUID := 'tag0002'; dbQuery.SQL.Text := 'SELECT * FROM CARDS_TABLE WHERE (POSITION(:taguid,TAGS) > 0) ORDER BY LOWER(NAME) ASC;'; Try dbQuery.Prepare; dbQuery.ParamByName('taguid').AsString := sTAGUID; dbQuery.Open; If dbQuery.RecordCount > 0 then While dbQuery.Eof = False do Begin New(nEntry); ExtractCardQuery(dbQuery,nEntry^); cardList.Add(nEntry); dbQuery.Next; End; finally dbQuery.free end; -
I would like to integrate Ad support for my Delphi 7 desktop application (I also have Delphi 10.3.3 which I could possibly use to create a DLL which would integrate into the D7 app). Has anyone here ever create a Delphi desktop app that's supported by advertising? This model is very prevalent in the mobile world, but on the desktop, I haven't found a lot of information. I could easily integrate google ads, but I believe they do not allow ads within desktop applications. Microsoft seems to allow Ads (https://developer.microsoft.com/en-us/store/monetize/ads-in-apps), but the API is designed for UWP apps (am I mistaken?) and I'm not sure how to go about the integration process. Do you suggest other Ad networks that would integrate nicely with Delphi?
-
For some reason, even when setting the TListView's control to not show the "Details" section, the text within the control is cut at about 80% of the width. I have "ListView.ItemAppearanceObject.ItemObjects.Detail.Visible = False" and "ListView.ItemAppearanceObject.ItemEditObjects.Detail.Visible = False". And "ListView.ItemAppearance" set to "ListItem" (which adds a ">" at the end of the line for some reason).
-
And update on Android's TListView RTL text appearing in reversed order?
Yaron posted a topic in Cross-platform
On Android, RTL text (e.g. Hebrew) appears in reverse order (letter order is reversed). Using the same code, & input (YouTube DATA API 3) and the text appears correctly in windows. I searched the web and the only reference I was able to find is a post from five years ago that says RTL is not supported and there is no roadmap entry for future support: https://stackoverflow.com/questions/28494354/right-to-left-language-in-delphi-xe7-mobile-android Has anything changed since? -
I am sharing a video's URL from YouTube to my Android app. I do this using Android Intents by modifying the "AndroidManifest.template.xml", adding: <intent-filter> <action android:name="android.intent.action.SEND" /> <category android:name="android.intent.category.DEFAULT" /> <data android:mimeType="text/plain" /> </intent-filter> Then in my app's form OnCreate event, I use: if TPlatformServices.Current.SupportsPlatformService(IFMXApplicationEventService, AppEventService) then AppEventService.SetApplicationEventHandler(HandleAppEvent); MainActivity.registerIntentAction(TJIntent.JavaClass.ACTION_SEND); TMessageManager.DefaultManager.SubscribeToMessage(TMessageReceivedNotification, HandleActivityMessage); Then HandleAppEvent looks like this: function TMainForm.HandleAppEvent(AAppEvent: TApplicationEvent; AContext: TObject): Boolean; var StartupIntent: JIntent; begin Result := False; Case AAppEvent of TApplicationEvent.BecameActive: Begin clientAndroidBecameActive := True; If clientAndroidActivated = False then Begin clientAndroidActivated := True; StartupIntent := MainActivity.getIntent; if StartupIntent <> nil then Begin HandleIntentAction(StartupIntent); StartupIntent := nil; End; End; End; end; end; And HandleActivityMessage looks like: procedure TMainForm.HandleActivityMessage(const Sender: TObject; const M: TMessage); begin if M is TMessageReceivedNotification then HandleIntentAction(TMessageReceivedNotification(M).Value); end; And finally, HandleIntentAction: function TMainForm.HandleIntentAction(const Data: JIntent): Boolean; var Extras : JBundle; sURL : String; begin Result := False; if Data <> nil then begin Extras := Data.getExtras; if Extras <> nil then Begin sURL := JStringToString(Extras.getString(TJIntent.JavaClass.EXTRA_TEXT)); // Do something useful with the URL Extras := nil; End end end; My problem is there are occasions after sharing where an intent is duplicated, triggering once on the share and again when opening the app later on. Does anyone have experience with something similar?
-
Leaderboards and Game progress on Google Play Services
Yaron replied to Keda's topic in Cross-platform
There's this article: http://www.fmxexpress.com/leaderboards-and-achievements-with-google-play-game-services-in-delphi-xe5-xe6-xe7-firemonkey-on-android/ It's a bit outdated, but perhaps it would help.- 4 replies
-
- android
- google play services
-
(and 3 more)
Tagged with:
-
This happens on a particular project, Simply opening the project and clicking on "refactor" from the top menu causes the entire IDE to crash with "Embarcadero RAD Studio for Windows has stopped working, A problem caused the program to stop working correctly. Please close the program.". The same thing happens if I do "Run -> Step Over" from the top menu followed by clicking the "search" top menu entry. In both cases the top menu's pop-up doesn't show up before the crash. Doesn't happen if I open another project, but can be reliably reproduced on the problematic (larger) project every time. Anyone encountered anything like this before? I'm not even sure how to track down this issue.
-
Leaderboards and Game progress on Google Play Services
Yaron replied to Keda's topic in Cross-platform
I was facing a similar issue with leaderboards and for cross-compatibility, decided to write a very simple back-end server of my own to maintain the leaderboard: Wrote it in Delphi+MARS and you can find it here: https://github.com/bLightZP/marsGameServices- 4 replies
-
- android
- google play services
-
(and 3 more)
Tagged with:
-
I have a usage case where my application scrapes a screenshot (thumbnail) from multiple video files in background threads. I grab the screenshot using a third party library. The problem is sometimes, the third party library will stall, usually due to a corrupt/incomplete media file where it tries to analyze the entire file (which can take upto 30 seconds). I have no way to notify the third party library to cease operations. This stalling can prevent my application from closing (It's waiting for threads to finish so the exit is clean) or even make the UI appear semi-broken because no thumbnails show up. I'd like to hear what you may have done to handle such cases?
-
I can attest from experience that terminating threads can lead to random access violations, that's part of the reason I asked this question.
-
How to close Messages window automatically
Yaron replied to Silver Black's topic in Delphi IDE and APIs
Is it compatible with v10.3.3? Looks like last update was for 10.2 -
Why is my firebird database code unstable under load? (code included)
Yaron posted a topic in Databases
Using Delphi 10.3.3 I built a simple web server using MARS Curiosity (https://en.delphipraxis.net/forum/34-mars-curiosity-rest-library/) and FireBird DB v3.0.4. However, sometimes a simple refresh in the web browser (Ctrl+R) will trigger multiple different errors: Project GameServicesServerApplication.exe raised exception class EIdSocketError with message 'Socket Error # 10053 Software caused connection abort. Project GameServicesServerApplication.exe raised exception class $C0000005 with message 'access violation at 0x00730647: read of address 0x00000000'. Project GameServicesServerApplication.exe raised exception class EDatabaseError with message 'Field 'CONSUMERNAME' not found'. Project GameServicesServerApplication.exe raised exception class EArgumentOutOfRangeException with message 'Argument out of range'. Holding Ctrl+R in the web browser easily reproduces the issue within a few seconds (the more DB calls I preform in the MARS web server function, the easier it is to trigger the crash). The fault is not in MARS, I tested by disabling all DB calls and verifying the code doesn't crash (I even threw a Sleep(1000) in there to see if it may be related to the duration it takes the function to process). Am I doing something wrong? I use a connection pool to support multiple threads connecting at once, here is how I connect to the DB: dbParams := TStringList.Create; try dbParams.Add('Server=localhost'); dbParams.Add('Database=c:\DB\Database.FDB'); dbParams.Add('User_Name=SYSDBA'); dbParams.Add('Password=SomePassword'); dbParams.Add('CharacterSet=UTF8'); dbParams.Add('Pooled=True'); FDManager.AddConnectionDef(dbPoolName,'FB',dbParams); Try FDManager.Open; Except on E : Exception do {$IFDEF TRACEDEBUG}AddDebugEntry(debugFileSystem,'Exception connecting to DB : '+E.Message){$ENDIF}; End; finally dbParams.Free; end; Here's the MARS server definition: Type [Path('test')] TGalleryServicesResource = class protected public [GET , Path('/gallery'), Produces(TMediaType.TEXT_HTML)] function Gallery_From_External_Source([QueryParam] code : String) : String; end; Here is the function MARS triggers: function TGalleryServicesResource.Gallery_From_External_Source(code : String) : String; begin If GetGalleryCodeDetails(sDebugFile,code,nGalleryCode) = True then Begin End; end; And here is the database access: function GetGalleryCodeDetails(sDebugFile,sGalleryCode : String; var nGalleryCode : TGalleryCodeRecord) : Boolean; var dbQuery : TFDQuery; begin Result := False; dbQuery := TFDQuery.Create(nil); Try dbQuery.ConnectionName := dbPoolName; dbQuery.SQL.Text := 'SELECT * FROM GALLERY_CODES WHERE CODE_UID=:gallerycodeuid;'; Try dbQuery.Prepare; dbQuery.ParamByName('gallerycodeuid').AsString := sGalleryCode; dbQuery.Open; If dbQuery.RecordCount > 0 then Begin Result := True; With nGalleryCode do Begin gcUserName := dbQuery.FieldByName('CONSUMERNAME').AsString; gcUserEMail := dbQuery.FieldByName('CONSUMEREMAIL').AsString; gcCodeUID := dbQuery.FieldByName('CODE_UID').AsString; gcImageURL := dbQuery.FieldByName('IMAGEURL').AsString; gcCreateTimeStamp := dbQuery.FieldByName('CREATE_TIMESTAMP').AsFloat; gcOpenTimeStamp := dbQuery.FieldByName('OPEN_TIMESTAMP').AsFloat; gcUseTimeStamp := dbQuery.FieldByName('USE_TIMESTAMP').AsFloat; gcStatus := dbQuery.FieldByName('STATUS').AsInteger; End; End; Except on E : Exception do {$IFDEF TRACEDEBUG}AddDebugEntry(sDebugFile,'Exception : '+E.Message){$ENDIF}; End; Finally dbQuery.Free; End; end; -
How do I get the client's IP address in a Server.Resources function?
Yaron replied to Yaron's topic in MARS-Curiosity REST Library
If anyone else is wondering how it's done, you need to add "[Context] marsRequest: TWebRequest;" and then the client's IP is available in "marsRequest.RemoteIP". [Path('projectX')] TProjectXServicesResource = class protected [Context] marsRequest: TWebRequest; public [GET, Produces(TMediaType.TEXT_HTML)] function xHome([QueryParam] lang : String) : String; [POST, Consumes(TMediaType.MULTIPART_FORM_DATA), Produces(TMediaType.TEXT_HTML)] function xAction([FormParams] AParams: TArray<TFormParam>): String; end; function TProjectXServicesResource.xHome([QueryParam] lang : String) : String; begin ShowMessage(marsRequest.RemoteIP); end; function TProjectXServicesResource.xAction([FormParams] AParams: TArray<TFormParam>) : String; begin ShowMessage(marsRequest.RemoteIP); end; -
@David Heffernan It's not that the code freezes forever, it stalls. Here are real-world examples, 1. A 3rd party product called ODB Studios has a bug, it does not set a timestamp for it's audio stream, so when playing a video, the entire stream must be decoded to reach the seek point (the position where I take the thumbnail). This causes the (directshow) seek command to stall for upto 60 seconds. 2. A user starts to download a video file and then pauses/stops the download (so the file is no longer locked, I postpone thumbnail generation for locked files). The video's frame-index block did not download yet, so the (directshow) file parser then scans the entire media file to reconstruct the frame-index which can easily stall for 30-60 seconds on multi-GB files. There are other cases where this issue can happen, there is no way to avoid it since I can't know in advance every case for every audio/video format that may pop-up.
-
Why is my firebird database code unstable under load? (code included)
Yaron replied to Yaron's topic in Databases
Looks like this issue is somewhat complex, I've actually read this article: https://www.the-art-of-web.com/sql/counting-article-views/ In which they suggest creating a separate table just for view counting, with each row representing a view (sql INSERT) and every so often running aggregation code that converts the rows into actual pageview numbers to insert into the original table and erase the counted rows. Using this method means no deadlocks are possible when counting things, might even mean less DB overhead (they write that UPDATE is slower than INSERT, but it's not something I confirmed). -
Why is my firebird database code unstable under load? (code included)
Yaron replied to Yaron's topic in Databases
I'm a complete novice working with databases and like dany, I want to know how as well. I actually tried reading the documentation (https://firebirdsql.org/refdocs/langrefupd25-nextvaluefor.html) but it's pretty alien me at this point. -
Why is my firebird database code unstable under load? (code included)
Yaron replied to Yaron's topic in Databases
The view number is read earlier in the code, I actually replaced it with a more reliable SQL command to increase the value instead of setting it: procedure ClubHouseDB_IncCampaignViewCount(sDebugFile,sGalleryUID : String); var dbConn : TFDConnection; dbQuery : TFDQuery; deadLocked : Boolean; begin deadLocked := False; dbConn := TFDConnection.Create(nil); dbConn.ConnectionDefName := dbPoolName; dbQuery := TFDQuery.Create(nil); dbQuery.Connection := dbConn; Try dbQuery.SQL.Text := 'UPDATE GALLERY_TABLE SET VIEW_COUNT=VIEW_COUNT+1 WHERE GALLERY_UID=:galleryuid;'; Try dbQuery.Prepare; dbQuery.ParamByName('galleryuid').AsString := sGalleryUID; dbQuery.ExecSQL; Except on E : Exception do If Pos('deadlock',Lowercase(E.Message)) > 0 then deadLocked := True; End; Finally dbQuery.Free; dbConn.Free; End; If deadLocked = True then ClubHouseDB_IncCampaignViewCount(sDebugFile,sGalleryUID); end; As you can see from the updated code, I'm catching the deadlock by looking at the returned exception message, I'm not sure it's the best approach, but I haven't been able to find another way to identify the deadlock. I don't have a problem increase the deadlock timeout, but I couldn't find anything on how to do that, I'm not even sure if it's part of the Firebird SQL statement or if I need to specify it through the Firedac components. -
Why is my firebird database code unstable under load? (code included)
Yaron replied to Yaron's topic in Databases
I'm new to databases, is there any Delphi Firedac sample code that shows best practices when handles deadlocks? My deadlock is a simple integer page-view counter, here's the actual code: procedure SetCampaignViewCount(sDebugFile,sGalleryUID : String; nCount : Integer); var dbConn : TFDConnection; dbQuery : TFDQuery; begin dbConn := TFDConnection.Create(nil); dbConn.ConnectionDefName := dbPoolName; dbQuery := TFDQuery.Create(nil); dbQuery.Connection := dbConn; Try dbQuery.SQL.Text := 'UPDATE GALLERY_TABLE SET VIEW_COUNT=:viewcount WHERE GALLERY_UID=:galleryuid;'; Try dbQuery.Prepare; dbQuery.ParamByName('galleryuid').AsString := sGalleryUID; dbQuery.ParamByName('viewcount').AsInteger := nCount; dbQuery.ExecSQL; Except on E : Exception do Begin {$IFDEF TRACEDEBUG}AddDebugEntry(sDebugFile,'SetCampaignViewCount Exception : '+E.Message){$ENDIF}; End; End; Finally dbQuery.Free; dbConn.Free; End; end;