Jump to content


Popular Content

Showing content with the highest reputation since 06/30/21 in all areas

  1. Hello, good news is, that I just released a new version of DEC (Delphi Encryption Compendium): https://github.com/MHumm/DelphiEncry...eases/tag/V6.2 What's new? Fixed some regressions, among them some which hindered compilation with older Delphi versions (support for older compilers might be reduced in future versions!) Fixed bugs in the SCOP and SHARK cipher algorithms The unit test for the hash classes got improved by adding original test vectors to those algorithms which didn't already use original test vectors and where we could find those (for most we could) The SHA3 hash algorithm has been added for 224, 256, 384 and 512 bit including support for message lengths not being a multiple of whole bytes. Our implementation uses Eric Grange's optimizes permutation kernel ASM implementation on WIn32 and WIn64 (with his friendly permission of course!) A new demo got added: Hash Benchmark FMX Now have fun with this. The GetIt provided Lite version should follow within the next few days. TurboMagic
  2. Isn't fastest and using Delphi's own classes mutually exclusive? My personal recommendation goes to https://github.com/ahausladen/JsonDataObjects
  3. Idefix Pack: Sounds a little strange to me, at least in German, like to order the dog to grasp
  4. It needs some code to be added, but you can declare a const array[<enumeration>] of Integer with values 0 in all places where the enumeration is used in some way. const cCheckProjectType: array[TProjectType] of Integer = (0, 0, 0, 0); If you now extend TProjectType the compiler will stop at all places where such a declaration is present and you can inspect the code around for correct TProjectType usage. After that is done you extend the array values to make the compiler continue to the next problematic position.
  5. Alexander Sviridenkov

    Need suggestion on developing a custom component

    @wuwuxin Yes, code is quite simple in Delphi: uses htfontawesome, htdefscriptadapter. HTML: <style> body {background: white} table {background: #eeeeff; border-collapse: collapse} td {padding: 5px} .value {border: solid #ddd 1px; background: white; resize: horizontal} input {border: solid transparent 1px} .left {width: 10px; padding-top: 5px} .hidden {display: none} </style> <script type="passcript"> procedure Expand(Section); begin $('#'+Section).toggleClass('hidden'); this.toggleClass('fa-minus'); this.toggleClass('fa-plus'); end; </script> <table width="500"> <tr> <td class="left" ><i onclick="expand('1')" class="fas fa-minus"></i></td> <td class="title" colspan="2">ID Settings</td> </tr> <tr id="1"> <td class="left"></td> <td class="value" width="200">Name</td> <td class="value"><input type="text" value="Bill Smith"/></td> </tr> <tr id="1"> <td class="left"></td> <td class="value">Address</td> <td class="value"><input type="text" value=""/></td> </tr> <tr id="1"> <td class="left"></td> <td class="value">Birthday</td> <td class="value"><input type="date" value="01.01.1998"/></td> </tr> <tr> <td class="left" ><i onclick="expand('2')" class="fas fa-minus"></i></td> <td class="title" colspan="2">Marketing Settings</td> </tr> <tr id="2"> <td class="left"></td> <td class="value">Email</td> <td class="value"><input type="text" value="bill@gmail.com"/></td> </tr> <tr id="2"> <td class="left"></td> <td class="value">FrequentBuyer</td> <td class="value"><input type="checkbox"/></td> </tr> </table>
  6. Uwe Raabe

    Format uses clause

    You can define the group names per project in MMX Properties - Project options: A single identifier is treated as a group prefix which has to be followed by a dot (like System, VCL, FireDAC). You can also use wildcards like Rz* for all units from Raize Components (KSVC). Unit names not covered in one of the schemes above can be listet in brackets. This is the setting for MMX itself: (ToolsApi,DesignIntf,DCCStrs,DockForm,TabDock);Winapi;System.Win;System;Xml;Vcl;VirtualTrees*;Rz*;Tb*;Png*;MMX The settings are stored in the dproj file.
  7. vfbb

    [Android][Rio] How catch timeout REST error?

    If you set TRESTClient's SynchronizedEvents property to False, you can do this directly: // FRequest: TRESTRequest // FClient: TRESTClient // FCanRaiseException: Boolean = {$IFDEF DEBUG}True{$ELSE}False{$ENDIF} function TryRequest: Boolean begin FClient.SynchronizedEvents := False; FRequest.Client := FClient; try FRequest.Execute; except on E: ERESTException do begin if FCanRaiseException then Exception.RaiseOuterException(Exception.Create('Service or connection failed')) else Exit(False); end; end; Result := True; end; This code is blocking, so it must be executed in a task in the background, and communicating with the UI through a queue. Just a question, what rest api do you is integrating? You may be able to make this integration faster with the Refit library: viniciusfbb/ipub-refit: Simple way to consume REST services (github.com)
  8. ANN: StyleControls VCL v. 4.90 just released! http://www.almdev.com What's new: added: Windows 11 Fluent UI Blur background and frame support tested: all controls and components on Windows 11 system tested: working with System Theme and VCL Styles on Windows 11 system StyleControls VCL is a powerful, stable package of components, which uses Classic drawing, system Themes, GDI+ and VCL Styles. This package contains the unique solutions to extend standard VCL controls and also has many unique, advanced controls to create applications with UWP / Fluent UI design. Also with this package you can really improve applying and using of VCL Styles in your application.
  9. Adaptive Icon First of all, don’t uncheck the icons in deployment and don’t change the manifest. 1) Add your icons in .png format in Project Options normally. This is necessary to keep the compatibility with android 7.1 and oldest. 2) You need to create 3 files "ic_launcher.xml", "ic_launcher_background.xml" and "ic_launcher_foreground.xml" 3) ic_launcher.xml example: <?xml version="1.0" encoding="utf-8"?> <adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android"> <background android:drawable="@drawable/ic_launcher_background" /> <foreground android:drawable="@drawable/ic_launcher_foreground" /> </adaptive-icon> Add it in deployment with remote path "res\drawable-anydpi-v26" 4) ic_background.xml example: <vector xmlns:android="http://schemas.android.com/apk/res/android" android:width="108dp" android:height="108dp" android:viewportWidth="108.0" android:viewportHeight="108.0"> <path android:name="square" android:fillColor="#ff3657f4" android:pathData="M0,0 L108,0 L108,108 L0,108 z" /> </vector> Note that I fixed a solid color (#ff3657f4), but you can put gradients in this xml or an image in place the background (not recomended). Add it in deployment with remote path "res\drawable" 5) ic_foreground.xml example: <vector xmlns:android="http://schemas.android.com/apk/res/android" android:width="108dp" android:height="108dp" android:viewportWidth="108.0" android:viewportHeight="108.0"> <path android:name="square" android:fillColor="#ffffffff" android:pathData="M 53.91,32.73 C 54.35,32.75 54.49,33.06 54.75,33.39 54.75,33.39 56.18,35.17 56.18,35.17 56.18,35.17 62.30,42.80 62.30,42.80 62.30,42.80 65.32,46.57 65.32,46.57 67.71,49.56 69.15,51.35 69.99,55.19 70.19,56.06 70.35,56.97 70.35,57.86 70.35,60.63 70.34,61.92 69.39,64.60 67.61,69.60 63.19,73.48 58.06,74.76 56.05,75.26 54.85,75.23 52.81,75.20 51.89,75.19 50.64,74.92 49.74,74.70 44.14,73.29 39.76,68.84 38.20,63.31 37.95,62.41 37.66,60.97 37.65,60.04 37.62,57.15 37.69,55.37 38.79,52.61 39.86,49.91 41.15,48.49 42.92,46.27 42.92,46.27 48.17,39.73 48.17,39.73 48.17,39.73 51.98,34.98 51.98,34.98 52.41,34.44 53.40,33.04 53.91,32.73 Z M 46.57,58.86 C 46.57,58.86 43.70,58.86 43.70,58.86 43.70,58.86 43.70,59.45 43.70,59.45 43.70,63.37 46.54,66.93 50.04,68.42 50.88,68.79 51.80,69.02 52.71,69.13 53.27,69.20 53.36,69.10 54.00,69.26 54.00,69.26 54.00,66.29 54.00,66.29 52.87,66.29 51.97,66.13 50.93,65.66 48.53,64.57 46.57,61.94 46.57,59.25 46.57,59.25 46.57,58.86 46.57,58.86 Z" /> </vector> You can change the white color (#ffffffff) and the pathData. Note: this pathData is the same path data inside the .svg. If you have your icon in .svg, just open it in notepad and copy the "d" field inside the "path" to the pathData of xml (only if the svg has size 108x108). Add it in deployment with remote path "res\drawable" Result (the low quality is due to the gif format) Extra You can do the same with the splash screen (vector splash screen). The vector splash screen works in all android versions supported by Delphi.
  10. There is no need to uncheck those. Actually, those are still needed for supporting older Androids (unless you set minimum API to 26) Procedure would be - fill all icons you can through Project > Options > Application > Icons, then only add additional icons that cannot be set through Delphi. There is open issue requesting support for adaptive icons https://quality.embarcadero.com/browse/RSP-21335 and I attached zip with default icons resources created by Android Studio new project template. This makes it easier to see which icons need to be added manually and how they should look like.
  11. angusj

    Resource Hacker

    Resource Hacker A resource editor for 32bit and 64bit Windows applications. It's both a resource compiler and a decompiler - enabling viewing and editing of resources in executables (*.exe; *.dll; *.scr; etc) and compiled resource libraries (*.res, *.mui). Resource Hacker also provides many options for compiling and decompiling resources from the command-line. http://www.angusj.com/resourcehacker/ Download: http://www.angusj.com/resourcehacker/reshacker_setup.exe
  12. Christophe E.

    ANN: TECNativeMap 4.3

    This version brings the support of the Mapillary api version 4 (a kind of google street view) TECNativeMap is an equivalent of Google Map without any use of a WebBrowser because it is 100% Delphi. It is available in VCL and FMX versions on all platforms supported by Delphi Download the trial version for Delphi 10.4.x
  13. Compiler directives come to help. This is to ensure TEnum is starting from 1 (needed to loop through a string that contains chars for every item in enum) const EnumLiterals: array[TEnum] of Char = ('Q', 'W', 'E', 'R', 'T'); function SetToFixedStr(aSet: TSomeSet): string; var elem: TEnum; begin // check {$IF Ord(Low(TEnum)) <> 1} {$MESSAGE FATAL 'Must start from 1 (using as string index)'} {$IFEND} ... end Or, in every case that handles ALL values in enum: case item of enumItem1: ...; enumItemN: ...; {$IF Ord(High(TEnum)) <> 5} {$MESSAGE FATAL 'Implement it'} {$IFEND} end; // case This will catch addition to every place of enum. In case of enums starting from custom number, use Ord(High(TStatsType))-Ord(Low(TStatsType)) to get number of items. Btw, FPC catches switches that don't handle every item in an enum. Sometimes it helps, sometimes annoys 🙂
  14. dkounal

    Notifications in android

    I can confirm that with the help of Dave Nottage (DelphiWorlds) using API from Kastri, I can have notifications in android with a progress bar. Many many thanks for his time.
  15. Dave Nottage

    Android 11 Support in 10.4.2?

    To clarify: Android 11 is supported. The distinction is in the value for targetSdkVersion that ends up in AndroidManifest.xml (currently, the value is set to 29, as opposed to 30). A targetSdkVersion of 30 is yet to be fully supported, as it requires changes to the support of accessing external storage (and possibly other aspects of API 30). This is what is being referred to with a statement of: They really should make the distinction if they are saying it like that. Also, targeting an API level (via targetSdkVersion) and building against an API level are 2 completely different things, so downloading platform API level 30 and changing the SDK settings to suit is not the same as changing the target.
  16. Martin Wienold

    Physically reduce jpeg image size??

    We use WIC Image Scaling in one of our applications. Some information with examples https://weblogs.asp.net/bleroy/resizing-images-from-the-server-using-wpf-wic-instead-of-gdi And an MSDN article https://docs.microsoft.com/en-us/windows/win32/wic/-wic-bitmapsources-howto-scale
  17. ConstantGardener

    Physically reduce jpeg image size??

    function ResponseWithScaledJPG (const AFilename : string; var Response: TIdHTTPResponseInfo) : boolean; var JPEGImg : TJPEGImage; AStream : TStream; begin result:=false; if FileExists (AFilename) then begin AStream := TMemoryStream.Create; JPEGImg := TJpegImage.Create; try JPEGImg.LoadFromFile(AFilename); if JPEGImg.Width<500 then JPEGImg.Scale:=jsFullSize else if JPEGImg.Width<1000 then JPEGImg.Scale:=jsHalf else if JPEGImg.Width<2000 then JPEGImg.Scale:=jsQuarter else JPEGImg.Scale:=jsEighth; JPEGImg.SaveToStream(AStream); result:=true; finally JPEGImg.Free; Response.ContentType := mime.ImageJPeg; Response.ContentStream := AStream; end; end; end; ....use this as base for your own solution. This function is from a little INDY webserver for responding with scaled pic's to jpeg-requests for limiting the traffic payload.
  18. Cristian Peța

    need code to receive low memory warning

    Set an event handler: if TPlatformServices.Current.SupportsPlatformService(IFMXApplicationEventService, IInterface(AppEventService)) then AppeventService.SetApplicationEventHandler(My_ApplicationEventHandler); And in that event you will receive the warning: function TFormMain.My_ApplicationEventHandler(AAppEvent: TApplicationEvent; AContext: TObject): Boolean; begin case AAppEvent of TApplicationEvent.LowMemory: ; end; end;
  19. Roger Cigol

    Is this C++ builders new FORUM ???

    I think the original subject line for this thread is one where this is quite understandable (and not a bad thing). There is a role for a forum where "rambling discussions" are accommodated. If you look at many other threads here they are more "particular problem focused". Mind you I am completely with everyone here, agreeing that Embarcadero made a disasterous decision when they chose to close down their forum. If you are looking at a new development system in this modern age one of the first things to check is how active is the community on the forum..... As I've said before as well as losing community visibility and the huge volume of useful technical knowledge they also closed down a valuable source of customer feedback. So "Kind of ridiculous... very sad.".
  20. Assuming the Tag value of each checkbox can be set to the ordinal of it's enum, you could walk the enums and check if you find a checkbox under Filters for each of them. If you don't find it - you change the caption of "Filters: to "Filters is INCOMPLETE" or log it or whatever. But - it would be runtime, preferably in the debug code. Likewise, you could easily take a set of enum values to get or set the states of the check boxes. It is a little inconvenient to do this in Generics, since we don't have a constraint for enumerated types - which means we can't really use Low, High or Ord, but it is possible.
  21. Well thinking about it, it is doable without using RTTI type TMyEnum = (meOne, meTwo, meNine, meTen); procedure CheckTMyEnumValues; var I: TMyEnum; begin for I := Low(TMyEnum) to High(TMyEnum) do if not (I in [meOne, meTwo, meTen]) then raise Exception.Create('TMyEnum has been changed'); end; begin // initialization CheckTMyEnumValues; Your target is to break more things when things already and silently broken, so the above will do that, after any to TMyEnum, you will need to copy and paste all values in that if range.
  22. Der schöne Günther

    Delphi compatibility with Windows 11?

    Not saying that this site is not reliable, but I would always refrain from 3rd party magazines in that case. The official CPU support list from Microsoft can be found at http://aka.ms/CPUlist
  23. Dany Marmur

    How do I check for empty rows in a string grid?

    So fix the actual problem before asking/looking for a workaround. Asking us to help you by-pass problem that you created it not constructive. Oh, ah! Just realized i wrote an "heffernandic" post!
  24. Lars Fosdal

    Is this C++ builders new FORUM ???

    I do too, and I don't... There were those that abused that usability to spam threads, simply because it was so easy to do so. But yeah, the old newsgroups were underrated and should have survived and evolved.
  25. Lars Fosdal

    Organizing enums

    We mostly store the ordinal value of the enumerated type variable to an int in the database. Yes, it is fragile with regards to people changing the enumeration - but we have guidelines and unit tests to avoid that. type TPSDExpeditionType = (etRetailer,etWholesaler,etRetailerDairy,etWholesalerDairy); // Do not reorder or remove - add at end TLocation = class ExpeditionType: TPSDExpeditionType; We use RTTI to export the enums to a view in the database so that we can do logic in the SQL code using the same identifiers as we use in Delphi. T-SQL doesn't do constants per se, but selecting from a flat static view is optimized by the query engine and is extremely low cost. CREATE TABLE [dbo].[t_locations]( [Id] [int] IDENTITY(1,1) NOT NULL, [ExpeditionType] [int] NOT NULL -- CREATE VIEW [dbo].[v_psd_constants] AS SELECT 0 AS etRetailer, 1 AS etWholesaler, 2 AS etRetailerDairy, 3 AS etWholesalerDairy -- SELECT * FROM v_Locations loc WHERE loc.ExpeditionType = (SELECT TOP(1) etRetailerDairy FROM v_psd_constants) This means we can handle renames and additions - but not removals or reordering. From an SQL performance perspective, this runs circles around using strings.