Noutați

Ultra-Fast Way To Wrap Delphi Objects To Python Objects With Python4Delphi Sample App

import spam   class MyPoint(spam.Point):   def Foo(Self, v):     Self.OffsetBy(v, v)   p = spam.Point(2, 5) print (p, type(p)) p.OffsetBy( 3, 3 ) print (p.x, p.y) print (“Name =”, p.Name) p.Name = ‘Hello world!’ print (“Name =”, p.Name)   p = spam.Point(2, 5) print (p, type(p)) p.OffsetBy( 3, 3 ) print (p.x, p.y)   # create a subtype instance p = MyPoint(2, 5) print (p, type(p)) p.OffsetBy( 3, 3 ) print (p.x, p.y) p.Foo( 4 ) print (p.x, p.y) print (dir(spam)) print (spam.Point) print (“p = “, p, ”  –> “,) if type(p) is spam.Point:   print (“p is a Point”) else:   print (“p is not a point”) p = 2 print (“p = “, p, ”  –> “,) if type(p) is spam.Point:   print (“p is a Point”) else:   print (“p is not a point”)   # You can raise errors from a Python script too ! print (“——————————————————————“) print (“Errors in a Python script”) try:   raise spam.EBadPoint(“this is a test !”) except:   pass   try:   err = spam.EBadPoint()   err.a = 1   err.b = 2   err.c = 3   raise err except spam.PointError as what: # this shows that you can intercept a parent class   print (“Caught an error derived from PointError”)   print (“Error class = “, what.__class__, ”     a =”, what.a, ”   b =”, what.b, ”   c =”, what.c)   if p == spam.Point(2, 5):   print (“Equal”) else:   print (“Not equal”)

Read More

Learn How To Use C++ Raw String Literals For Windows Apps In C++ Builder

There are escape characters in C++ like “n” or “t”. When we try to print the escape characters, it will not display on the output. To show the escape characters on the output screen we use a raw string literal by using R”(String with escape characters)”. After using R in the front of the string the escape character will be displayed on the output. From C++ 11, basically a raw string literal is a string in which the escape characters (like n t or ” ) of C++ are not processed. A raw string literal starts with R”( and ends in )”, let’s see an in an example the difference between a normal string and a raw string in C++: #include #include using namespace std; int main() { string normal_str=”First line.nSecond line.nEnd of message.n”; string raw_str=R”(First line.nSecond line.nEnd of message.n)”; cout #include #include    using namespace std; int main() {     string normal_str=“First line.nSecond line.nEnd of message.n”;     string raw_str=R“(First line.nSecond line.nEnd of message.n)”;     cout<<normal_str<<endl;     cout<<raw_str<<endl;     return(0); } The variable normal_str will be processed at compilation time so you will see three lines of text and an empty line. In the case of the variable raw_str which is a raw string literal, the compiler will not process the escape characters, so you will see a single line of text with a content identical with what you have in the C++ source code. A first application of the concept of a raw string is in simplifying the syntax of the regular expressions. Take as an example the regular expression used in the regex tutorial for checking if the user input is an integer number. Without raw strings this is how the code should look: regex integer(“(+|-)?[[:digit:]]+”); regex integer(“(+|-)?[[:digit:]]+”); Using a raw string we can simplify the above piece of code, we can get rid of the escaping characters: regex integer(R”((+|-)?[[:digit:]]+)”); regex integer(R“((+|-)?[[:digit:]]+)”); Head over and get more information about C++ raw string literals in the Embarcadero DocWiki.

Read More

Easily Build Master-Detail Relationships Between Datasets In Delphi Windows Apps

The sample demonstrates how to use the TFDQuery component in order to set up master-detail relationships between datasets. It uses the master-detail relationship to automatically filter a detail dataset based on a current master dataset record. In this sample, the master dataset has “Order” records, and the detail dataset shows only lines for the current order. Moreover, you can modify in run time the Cache property of TFDFetchOptions to control the data allocation in cache memory. Location You can find the MasterDetail sample project at: Start | Programs | Embarcadero RAD Studio Sydney | Samples and then navigate to: Object PascalDatabaseFireDACSamplesComp LayerTFDQueryMasterDetail Subversion Repository: You can find Delphi code samples in GitHub Repositories. Search by name into the samples repositories according to your RAD Studio version. How to Use the Sample Navigate to the location given above and open Qry_MasterDetail.dproj. Press F9 or choose Run > Run. Files File in Delphi Contains Qry_MasterDetail.dprojQry_MasterDetail.dpr The project itself. fQueryMasterDetail.pasfQueryMasterDetail.fmx The main form. Implementation To set up a master-detail relationship, this sample uses the Object Inspector to configure the following components at design time as follows: Two TFDQuery objects named qryOrders and qryOrderDetails. These components are used to implement a dataset capable of executing SQL queries. The following setup is needed: Configure the Connection property of both components to specify the FireDAC connection object that is used to connect to a DBMS. In order to set up a master-detail relationship, the SQL properties of both components have to be set up using the Object Inspector at design time as follows: The SQL property of qryOrders is set to select * from {id Orders} in order to select “Order” records. The SQL property of qryOrderDetails is set to select * from {id Order Details} where OrderID = :OrderID in order to select “Order Details” records. Finally, both objects are linked in a master-detail relationship, where qryOrders is the master dataset and qryOrderDetails is the detail dataset. To this end, you have to set up the following properties of qryOrderDetails: MasterFields is set to ORDERID. IndexFieldNames is set to ORDERID. MasterSource is set to dsOrders. Two TDataSource objects named dsOrders and dsOrdDetails. These components provide an interface between a dataset component and data-aware controls on a form. In this sample, it is used to provide communication between the datasets and the grids where the datasets are displayed. To this end, the following properties are set up at design time using the Object Inspector: The DataSet property of dsOrders is set to qryOrders and the DataSource property of DBGrid2 is set to dsOrder. The DataSet property of dsOrderDetails is set to qryOrderDetails and the DataSource property of DBGrid1 is set to dsOrderDetails. The Cache details check box includes fiDetails into the FetchOptions.Cache property of qryOrderDetails if the check box is checked. It means that if it is checked, the associated detail record will not be discarded from the memory after changing a master dataset record. The Refresh master button uses the Refresh method to re-fetch the master data from the database. The Refresh details button uses the Refresh method to re-fetch the detail data from the database. Please refer to the link below for more information about the sample: http://docwiki.embarcadero.com/CodeExamples/Sydney/en/FireDAC.TFDQuery.MasterDetail_Sample Head over and check out the full source code for the master detail Windows sample app on GitHub.

Read More

Impressive Native Windows PHP Code Editor And IDE Is Built In Delphi

Rapid PHP is a lightweight native code editor and IDE for PHP on Windows and it is built in Delphi. According to their site, “Rapid PHP editor is a faster and more powerful PHP code editor for Windows combining features of a fully-packed PHP IDE with the speed of the Notepad. Rapid PHP is the most complete all-in-one software for coding PHP, HTML, CSS, JavaScript and other web development languages with tools for debugging, validating, reusing, navigating and formatting your code.” It offers 6 different localization languages for the interface and a truly massive amount of features. In addition to PHP it has extensive Javascript and CSS capabilities to create a rounded development platform for building web apps in PHP. Notable productivity features include things like “Edit/save directly on FTP/SFTP/FTPS server or quickly publish all changed files”, “SVN and Git integration”, and “PHP debugger (xDebug)”. Website https://www.rapidphpeditor.com/ Screenshot Gallery Reduce development time and get to market faster with RAD Studio, Delphi, or C++Builder. Design. Code. Compile. Deploy.Start Free Trial   Upgrade Today    Free Delphi Community Edition   Free C++Builder Community Edition Webinar: Massively Boost C++Builder Compile Speed Up To 50x with TwineCompile

Read More

RAD Server and the included Data Storage for RAD Server Users

Embarcadero’s RAD Server Enterprise Mobility Server (EMS) is a turn-key application foundation for rapidly building and deploying services based applications. RAD Server’s core offerings include automated Delphi and C++ REST/JSON API publishing and management, Enterprise database integration middleware, IoT Edgeware and an array of application services such as User Directory and Authentication services, Push Notifications, Indoor/Outdoor Geolocation and JSON data storage. RAD Server enables developers to quickly build new application back-ends or migrate existing Delphi or C++ client/server business logic to a modern services based architecture that is open, stateless, secure and scalable. RAD Server is easy to develop, deploy and operate making it ideally suited for ISVs and OEMs building re-deployable solutions. Two important and useful features included with RAD Server are: 1. It’s important to note that a RAD Server single site license (included in Enterprise Edition) still allows you to deploy a solution based on multiple instances of the RAD Server engine, on multiple physical or virtual servers, for fail-over and load balancing, as long as they are backed by a single instance of the RAD Server database (the included InterBase database instance) which manages the RAD Server license itself. 2. It’s also important to note that Data Storage for Users in the form of JSON name/value pairs is part of the core RAD Server offering. But the use of the included RAD Server InterBase database as a relational DB is subject to a separate license (and also the installation of a separate InterBase server instance). This post focuses on how to use RAD Server to add JSON data storage, to create some Custom Fields to store additional JSON name-value information for your RAD Server Users. The included RAD Server InterBase database creates a USERS table. The RAD Server USERS Table allows you to manage the RAD Server Users data that are stored in your RAD Server Engine (EMS Server). The USERS Table stores information about RAD Server Users in the RAD Server Engine (EMS Server): The RAD Server USERS table columns are listed here: /* Table: USERS, Owner: SYSDBA */ CREATE TABLE USERS ( UID INTEGER NOT NULL, TID INTEGER NOT NULL, USERID CHAR(36) NOT NULL, USERNAME VARCHAR(32) NOT NULL, HPASSWORD CHAR(32), SALT CHAR(6), SESSIONID CHAR(32), SESSIONTIME TIMESTAMP, ISACTIVE BOOLEAN DEFAULT TRUE, CREATED TIMESTAMP, LASTMODIFIED TIMESTAMP, CREATOR CHAR(36), UNIQUE (USERID), PRIMARY KEY (UID), CONSTRAINT USERS_UNIQ UNIQUE (USERNAME, TID) ); ALTER TABLE USERS ADD CONSTRAINT TUSERS FOREIGN KEY (TID) REFERENCES TENANTS (TID); /* Meta data descriptions. This syntax requires InterBase 2020 or higher. Some tables require ODS18 and higher */ 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 /* Table: USERS, Owner: SYSDBA */ CREATE TABLE USERS (         UID INTEGER NOT NULL,         TID INTEGER NOT NULL,         USERID CHAR(36) NOT NULL,         USERNAME VARCHAR(32) NOT NULL,         HPASSWORD CHAR(32),         SALT CHAR(6),         SESSIONID CHAR(32),         SESSIONTIME TIMESTAMP,         ISACTIVE BOOLEAN DEFAULT TRUE,         CREATED TIMESTAMP,         LASTMODIFIED TIMESTAMP,         CREATOR CHAR(36), UNIQUE (USERID), PRIMARY KEY (UID), CONSTRAINT USERS_UNIQ UNIQUE (USERNAME, TID) ); ALTER TABLE USERS ADD CONSTRAINT TUSERS FOREIGN KEY (TID) REFERENCES TENANTS (TID); /* Meta data descriptions.   This syntax requires InterBase 2020 or higher.   Some tables require ODS18 and higher */ The UID is the USERID is a Unique identifier of a RAD Server User (UserID) in the RAD Server […]

Read More

We welcome Abatic, consulting partner for Spanish TMS/Delphi users

We are proud to announce a new collaboration with the team from Abatic in Spain to assist users of Delphi in combination with TMS products. From today, Abatic is our consulting partner for Spanish speaking software developers and software development companies in Spain and Colombia. With our partners we aim to have experts nearby, in the same timezone and speaking the native language of our customers to help with consulting services. This can range from assisting with: designing software architectures choosing the best components for a task developing projects or parts of projects or adding resources to help with developing projects offering training in specific TMS products We are glad to start this partnership with Abatic as we are convinced their high expertise will offer excellent services for you. The team consists of 6 professionals including two Embarcadero MVP’s: Emilio Pérez and Jhonny Suárez. Emilio Pérez Jhonny Suárez Abatic is also an early adaptor of TMS WEB Core and in particular TMS WEB Core for Visual Studio Code and is even offering a training course and an ebook for it: Among the broad expertise of the Abatic team are: Delphi Developer Certified 2 Embarcadero MVP consultants in team WEB Core web applications VCL Windows applications FMX cross-platform applications Multi-tier database development XData REST server + Aurelius ORM On-site training / WEB Core training course MySQL developer Certified PostgreSQL DBA Certified RAD Server We are convinced this will strengthen the adoption of Delphi, of our components and will lead to better, richer and more sophisticated Delphi applications with TMS compoonents or web applications based on the TMS WEB Core framework. With the Abatic team closely in touch with Spanish speaking developers, our team will have the opportunity to closely listen to the feedback and wishes of the Spanish speaking community and steer our developments according to these needs. If you are not Spanish speaking, don’t worry, our consulting partner network is growing and feel free to have a look at the partner directory and get in touch and have a chat how they can help you. At the same time, we would like to take the opportunity to mention that we still wish to extend our consulting partner network, foremost in the Asia area, Australia, Canada, South Africa. If you are Delphi developer with TMS component expertise and offering consulting services, get in touch and we will be happy to discuss how we can move forward!

Read More

TMS FNC Maps: Small update with big improvements

Intro With the release of TMS WEB Core v1.6 beta yesterday (https://tmssoftware.com/site/blog.asp?post=717), we bring a whole set of new and exciting compiler features such as generics, attributes and many more. Please read the blog and start exploring the new features. The beta of TMS WEB Core v1.6 is available as a download on the My Products page. Today, we released all of our FNC products with some core improvements, ready to be used in combination with TMS WEB Core v1.6. On top of that, TMS FNC Maps has been released with 3 new features. Tile Layers TTMSFNCOpenLayers now supports adding tile layers in the XYZ format. To demonstrate this, we generated a free API key from the following service: https://www.thunderforest.com. This service offers a great set of high quality layers that can be used in combination with our TTMSFNCOpenLayers implementation. To add a layer we used the following code: procedure TForm1.AddLayer; begin TMSFNCOpenLayers1.AddTileLayer(‘https://{a-c}.tile.thunderforest.com/cycle/{z}/{x}/{y}.png?apikey=[INSERT API KEY]’); end; With the following result: Save coordinate data to GPX The update also brings a way to save your coordinate data to a GPX file. To implement this, use one of the following overloads procedure SaveToGPXStream(ACoordinates: TTMSFNCMapsCoordinateRecArray; AStream: TStream); procedure SaveToGPXStream(ACoordinates: TTMSFNCMapsCoordinateRecArray; AStream: TStream; AMetaData: TTMSFNCMapsGPXMetaData); procedure SaveToGPXFile(ACoordinates: TTMSFNCMapsCoordinateRecArray; AFileName: string); procedure SaveToGPXFile(ACoordinates: TTMSFNCMapsCoordinateRecArray; AFileName: string; AMetaData: TTMSFNCMapsGPXMetaData); function SaveToGPXText(ACoordinates: TTMSFNCMapsCoordinateRecArray): string; function SaveToGPXText(ACoordinates: TTMSFNCMapsCoordinateRecArray; AMetaData: TTMSFNCMapsGPXMetaData): string;; The TTMSFNCMapsGPXMetaData record currently allows specifying the following GPX attributes AuthorName AuthorLink TrackName TrackType Plus Codes Plus Codes are like street addresses for people or places that don’t have one. Instead of addresses with street names and numbers, Plus Codes are based on latitude and longitude, and displayed as numbers and letters. With a Plus Code, people can receive deliveries, access emergency and social services, or just help other people find them. source: https://maps.google.com/pluscodes/ TMS FNC Maps supports Plus Codes encoding & decoding with the TTMSFNCMapsPlusCode class (available in the *.TMSFNCMapsCommonTypes unit). To get started, and convert an existing coordinate to a Plus Code, use the following code: procedure TForm1.EncodeCoordinate; var p: string; begin p := TTMSFNCMapsPlusCode.Encode(CreateCoordinate(40.689188, -74.044562)); //p = ’87G7MXQ4+M5′ end; To decode a Plus Code to a coordinate bounds, which defines the area corresponding to the code, the Decode function can be used: procedure TForm1.DecodePlusCode; var c: TTMSFNCMapsBoundsRec; begin c := TTMSFNCMapsPlusCode.Decode(’87G7MXQ4+M5′); end; Update Now! Update now to get all the latest and greatest FNC updates and get started exploring the new features of TMS WEB Core 1.6!

Read More

C Header Translator Tool For Delphi Lets You Parse C Header Files Using The Clang Compiler

Since Chet uses an actual compiler, you will need to have a (minimal) C develop environment installed, as well as LLVM with Clang. Clang needs to be able to find the system headers for the development environment. These will usually be available if you have some version of Visual Studio with Visual C++ installed. The free (community) edition of Visual Studio suffices. As said in the readme on Github, unlike some other header translators, Chet uses the Clang compiler to parse header files, resulting in more accurate translations that require fewer manual adjustments. Please check out the awesome features Chet lists: Translates C data types such as structs, union, enums, typedefs, procedural types and opaque types. Translates C functions to Delphi procedures or functions. Tries to translate #define declarations to constants where possible. Generates a single .pas file for an entire directory of .h files. This reduces issues due to dependencies between header files. Generates output for multiple platforms (Windows, macOS, Linux, iOS and Android) if desired. You can customize the Clang parsing process by supplying command line arguments to the compiler. You can customize the output of some conversion operations. Retains any Doxygen style documentation comments if desired, or converts them to XmlDoc comments or PasDoc comments. Provides a GUI for configuring the conversion process, and allows you to save the conversion settings to a .chet project file for reuse. Although Chet has amazing features, there are some limitations that the user has to pay attention on: Chet only works with C header files, not with C++ header files. All non-inlined functions in the header files are translated and assumed to be available in the static or dynamic library for the project. This does not have to be the case. (Inlined functions are never translated since they are never available in the library.) Since Clang is used to parse the header files, this means that Clangs preprocessor is run as well to perform conditional parsing (guided by #ifdef directives). This is both good and bad. It is good because it improves conversion accuracy. But it can be bad because it uses the system that Chet runs on to determine some conditional paths. For example, because Chet runs on Windows, it will parse code in #ifdef _WIN32 sections but skip any code in sections for other platforms. You can run Chet first to check for any errors related to missing dependencies. If you get any dependency errors when running the translator, then you can download the dependencies here: LLVM with Clang (Clang for Windows (64-bit) is recommended); Visual Studio IDE (the free Community edition suffices; be sure to install C++ support). You can use the pre-compiled 64-bit Windows Chet application in the Bin directory. If you want to compile Chet yourself, then you also need libclang for Delphi and make sure the Delphi IDE can find it (the Chet project will find it automatically if the Neslib.Clang directory is at the same level as the Chet directory). Chet is licensed under the Simplified BSD License. From the Github article we understand that Chet is pretty straightforward. In many cases, you only need to provide a directory with header files, the name of the output .pas file and select “Run Header Translator (F9)”. For more control over the conversion process, you can specify various options, described below. The screenshot from GitHub for the project is below: This […]

Read More

Powerful LockBox3 Cryptography Library Available For Delphi And C++Builder

LockBox3 is a Delphi library for cryptography. It provides support for AES, DES, 3DES, Blowfish, Twofish, SHA, MD5, a variety of chaining modes, RSA digital signature and verification. This is a source-only release of TurboPack LockBox3. It includes designtime and runtime packages for Delphi and C++Builder and supports VCL, FMX, Win32, Win64, macOS, iOS, and Android. Reading the information from http://lockbox.seanbdurkin.id.au/HomePage, “the user interface shall be clean and simple. For Ciphers and Hashes, two styles shall be provided: A component and an interface pointer. IV, salting of ciphers and signaling of IV’s shall be managed and hidden from the developer-client. The main encryption functions shall be implemented in 100% native Delphi code. (TOpenSSL_Signatory component is the exception to the rule).“ That is to say it shall not rely on links to third party libraries (at least as far as the core functionality is concerned). LockBox 3 is has easy traceability to standards. Developers should be able to open cipher standards and open the respective implementing source code; put them side-by-side, and very quickly observer that one implements the other. implementing source should borrow the style and symbols and the specifiying cipher standard.It shall be as easy as it can be to extend the library with new hashes and block ciphers. The selection, implementation and usage of ciphers shall be divorced from the chaining mode. LockBox3CR.bpl (C++Builder Runtime) and LockBox3CD.bpl (C++Builder Designtime). TurboPack LockBox3 is available via the GetIt Package Manager where you can quickly and easily install and uninstall it. To manually install TurboPack LockBox3 into your IDE, take the following steps: Unzip the release files into a directory (e.g., d:lockBox3); Start RAD Studio; Add the source directory (e.g. d:lockBox3run and all the subdirectories) to the IDE’s library path. For C++Builder, add the hpp subdirectory (e.g., d:lockBox3sourcehppWin32Release) to the IDE’s system include path; Open & install the designtime package specific to the IDE being used. The IDE should notify you the components have been installed; I can tell for sure that this is the best choice for cryptography library ! If you want to download this package via GitHub, please refer to the link below: https://github.com/TurboPack/LockBox3 Or find out more about TurboPack LockBox3 and download it via Embarcadero GetIt.

Read More