Delphi

Quickly Consume The Firebase REST API With The Open Source Firebase4Delphi Library

procedure TFirebaseDatabase.SetBaseURI(const ABaseURI: string); begin   FBaseURI := ABaseURI; end; procedure TFirebaseDatabase.SetToken(const AToken: string); begin   FToken := AToken; end;   function TFirebaseDatabase.Get(const AParams: array of string;   AQueryParams: TDictionary<string, string> = nil): IFirebaseResponse; var   ARequest: IFirebaseRequest; begin   ARequest := TFirebaseRequest.Create(BaseURI, Token);   Result := ARequest.SendData(AParams, TFirebaseCommand.fcGet, nil,     AQueryParams); end;   function TFirebaseDatabase.Post(const AParams: array of string;   AData: TJSONValue = nil; AQueryParams: TDictionary<string, string> = nil;   ADataOwner: boolean = true): IFirebaseResponse; var   ARequest: IFirebaseRequest; begin   ARequest := TFirebaseRequest.Create(BaseURI, Token);   Result := ARequest.SendData(AParams, TFirebaseCommand.fcPost, AData,     AQueryParams, ADataOwner); end; function TFirebaseDatabase.Put(const AParams: array of string;   AData: TJSONValue = nil; AQueryParams: TDictionary<string, string> = nil;   ADataOwner: boolean = true): IFirebaseResponse; var   ARequest: IFirebaseRequest; begin   ARequest := TFirebaseRequest.Create(BaseURI, Token);   Result := ARequest.SendData(AParams, TFirebaseCommand.fcPut, AData,     AQueryParams, ADataOwner); end; function TFirebaseDatabase.Patch(const AParams: array of string;   AData: TJSONValue = nil; AQueryParams: TDictionary<string, string> = nil;   ADataOwner: boolean = true): IFirebaseResponse; var   ARequest: IFirebaseRequest; begin   ARequest := TFirebaseRequest.Create(BaseURI, Token);   Result := ARequest.SendData(AParams, TFirebaseCommand.fcPatch, AData,     AQueryParams, ADataOwner); end; function TFirebaseDatabase.Delete(const AParams: array of string;   AQueryParams: TDictionary<string, string> = nil): IFirebaseResponse; var   ARequest: IFirebaseRequest; begin   ARequest := TFirebaseRequest.Create(BaseURI, Token);   Result := ARequest.SendData(AParams, TFirebaseCommand.fcRemove, nil,     AQueryParams); end;

Read More

Free Cross-Platform Order Entry Point Of Sale App Template For Delphi

This industry-ready Order Entry Application template for busy small business owners. This project is to build a general template for the regular structure of the order entry application.       Specifics • Specifically we are working on something similar to general existing order entry applications. • The goal is to have a reusable template that a user can download and add their content to and create a professional-looking application. • The template will be delivered in a sample application that shows the power and flexibility of the template. And that is documented enough so that a user will understand how to customize it for their use. On the following slides, you will find screenshots and annotations Order Entry – tabs, rooms, and menu management Time Clock – employee clock in/out Manager – main manager settings Exit – exit from the application In a room view, it is possible to assign a table to a user and to start a new tab It is possible to move tables on the screen according to their real location It is possible to see the number of seats for each table On this screen, the user can pay for the order in different ways and leave tips You can download the Order Entry App from GetIt Package Manager Also, be sure to check out other amazing sample application here!

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

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

Flexible Multi-Tenancy REST Support Demo For RAD Server In Delphi

It requires InterBase to be installed on the machine or to connect to a remote server. Make sure that the server is running before you run the sample application. With Multi-Tenancy support, a single RAD Server instance with a single RAD Server database connection can support multiple isolated tenants. Each tenant has a unique set of RAD Server resources including Users, Groups, Installations, Edge Modules, and other data. All tenants have custom resources that are installed in the EMS Server. Also, as an administrator you can create new tenants, edit existing ones, add, edit, or delete details of your tenants, specify if the tenant is active, and delete the tenants that you do not need. Location You can find the RAD Server Overview Multi-tenant sample project at: Start | Programs | Embarcadero RAD Studio Sydney | Samples and then navigate to the following: Object PascalDataBaseEMSMulti-Tenancy Demo Subversion Repository: You can find Delphi code samples in GitHub Repositories. Search by name into the samples repositories according to your RAD Studio version. Overview This sample application demonstrates RAD Server’s Multi-Tenancy support. RAD Server Overview is a turn-key application foundation for rapidly building and deploying services based applications. 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. A single RAD Server Overview instance with a single RAD Server database connection can support multiple isolated tenants. This demo uses a chain of toy stores to highlight RAD Server’s multi-tenancy support where each store with its employees and goods is a tenant implementation. Using the RAD Server Multi-Tenant Application The sample application demonstrates a retail store deployment use case. Each store with its employees and goods is a tenant implementation. Employees There are two groups of users with different rights: Managers can add new store items, delete them, and edit the details of the existing ones while cashiers can only view the information about the existing goods. Neither employee can see the information about the other stores in the chain.   Description Now, let us have a look at the sample application. Store Log in Page To access store specific information, enter the following information on the Store Log in page: Toy Store: select a store from the list. Each store is a tenant implementation. Store password: enter the password. Tip: You can find credentials in the Readme.txt file provided with the sample application. Employee Log in Page On the Employee Log in page, each employee enters the following: Employee login Employee password Tip: You can find credentials in the Readme.txt file provided with the sample application. Store Items Page After logging in, each employee sees the store items screen. The screen is displayed in two different modes: edit or view only, and access depends on the employee’s position. This uses EMS groups (a feature of RAD Server) to define access rights. Managers can view, add, and delete the store items and edit the details. Cashiers can view the items’ details only. Please follow the link to the original post for more information: http://docwiki.embarcadero.com/CodeExamples/Sydney/en/EMS.Sample_RAD_Server_Multi-Tenant_Application Check out the full source code for the Multi-Tenancy REST Demo over on GitHub.

Read More

Modernize Your Multi-Device Fire Monkey App Easy To Use Card View Wizard Layout Template

User experience is the key thing to be considered while building a modern Multi-Device application. Lots of layout templates were available in GetIt Package Manager to design responsive, ultra-modern, cross-platform FireMonkey applications. This post helps to understand one of the FireMonkey Layout templates the Card View Wizard. Card View Layout Template is a Fire Monkey template that incorporates a number of card view pages that can be navigated forward and backward though one would use this as an in-app tutorial. How to install: You can easily install this IDE Plugin from GetIt Package Manager. The steps are as follows. Navigate In RAD Studio IDE->Tools->GetIt Package Manager->select Sample Projects in Categories-> Card View Wizard 1.0 by Embercadero Technologies and click Install Button. Read the license and Click Agree All. An Information dialog saying ‘Requires a restart of RAD studio at the end of the process. Do you want to proceed? Click yes and continue. It will download the plugin and installs it. Once installed Click Restart now. GetIt – Card View Wizard 1.0 Card View Wizard Sample App Implementation Details: Car View Wizard Sample app contains, a TTabControl with a list of TabItems in it. Each TabItem is placed with an instance of TFrameCard defined in uCardFrame.pas. TFrameCard can set CardTitle, CardText, and Configure card with CardLayout Text image. procedure TMainForm.FormCreate(Sender: TObject); begin {$IFDEF FIRSTSET} // first set FrameCard1.SetCardTitle(WIZARD_TITLE_1); FrameCard1.SetCardText(WIZARD_TEXT_1); FrameCard1.ConfigureCard(TCardButton.Inner, TCardBGImage.Inner, TCardLayout.TextImage); FrameCard2.SetCardTitle(WIZARD_TITLE_2); FrameCard2.SetCardText(WIZARD_TEXT_2); FrameCard2.ConfigureCard(TCardButton.Inner, TCardBGImage.Inner, TCardLayout.TextImage); FrameCard3.SetCardTitle(WIZARD_TITLE_3); FrameCard3.SetCardText(WIZARD_TEXT_3); FrameCard3.ConfigureCard(TCardButton.Inner, TCardBGImage.Inner, TCardLayout.TextImage); FrameCard4.SetCardTitle(WIZARD_TITLE_4); FrameCard4.SetCardText(WIZARD_TEXT_4); FrameCard4.SetNextButtonText(WIZARD_NEXT_BUTTON_4); FrameCard4.ConfigureCard(TCardButton.Inner, TCardBGImage.Inner, TCardLayout.TextImage); {$ENDIF} WizardTabControlChange(Sender); end; 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 procedure TMainForm.FormCreate(Sender: TObject); begin   {$IFDEF FIRSTSET}   // first set   FrameCard1.SetCardTitle(WIZARD_TITLE_1);   FrameCard1.SetCardText(WIZARD_TEXT_1);   FrameCard1.ConfigureCard(TCardButton.Inner, TCardBGImage.Inner, TCardLayout.TextImage);     FrameCard2.SetCardTitle(WIZARD_TITLE_2);   FrameCard2.SetCardText(WIZARD_TEXT_2);   FrameCard2.ConfigureCard(TCardButton.Inner, TCardBGImage.Inner, TCardLayout.TextImage);     FrameCard3.SetCardTitle(WIZARD_TITLE_3);   FrameCard3.SetCardText(WIZARD_TEXT_3);   FrameCard3.ConfigureCard(TCardButton.Inner, TCardBGImage.Inner, TCardLayout.TextImage);     FrameCard4.SetCardTitle(WIZARD_TITLE_4);   FrameCard4.SetCardText(WIZARD_TEXT_4);   FrameCard4.SetNextButtonText(WIZARD_NEXT_BUTTON_4);   FrameCard4.ConfigureCard(TCardButton.Inner, TCardBGImage.Inner, TCardLayout.TextImage); {$ENDIF}     WizardTabControlChange(Sender); end; When the WizardTabControlChange event occurs the respective card is displayed with title text and background image. procedure TMainForm.WizardTabControlChange(Sender: TObject); var I: Integer; begin for I := 0 to WizardTabControl.TabCount-1 do begin if TTabItem(WizardTabControl.Tabs[I]).TagObject is TRectangle then begin TButton(TTabItem(WizardTabControl.Tabs[I]).TagObject).Visible := False; end; end; if WizardTabControl.TabIndex>-1 then if WizardTabControl.ActiveTab.TagObject is TRectangle then begin TButton(WizardTabControl.ActiveTab.TagObject).Visible := True; end; end; 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 procedure TMainForm.WizardTabControlChange(Sender: TObject); var I: Integer; begin   for I := 0 to WizardTabControl.TabCount–1 do     begin       if TTabItem(WizardTabControl.Tabs[I]).TagObject is TRectangle then         begin           TButton(TTabItem(WizardTabControl.Tabs[I]).TagObject).Visible := False;         end;     end;   if WizardTabControl.TabIndex>–1 then     if WizardTabControl.ActiveTab.TagObject is TRectangle then       begin         TButton(WizardTabControl.ActiveTab.TagObject).Visible := True;       end; end; Card View Wizard 1.0 Demo Be sure to check out all the available sample applications here!

Read More

Learn How To Use Range Types On A PostgreSQL Database In Windows Using FireDAC With Delphi

 FireDAC represents a range type column as a ftADT field with 3 subfields: lbound – lower range bound. hbound – upper range bound. flags – range flags. Note: Columns of range type are read-only. This sample updates them using SQL commands. To get range column attributes, this sample uses the following code: var l: Xxxx; // … l := FDQuery1.FieldByName(‘.‘).AsXxxx; var l: Xxxx; // … l := FDQuery1.FieldByName(‘.‘).AsXxxx; Location You can find the Ranges project at: Start | Programs | Embarcadero RAD Studio Sydney | Samples and then navigate to: Object PascalDatabaseFireDACSamplesDBMS SpecificPostgreSQLRanges 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 PGRanges.dproj. Press F9 or choose Run > Run. Files File in Delphi Contains PGRanges.dprojPGRanges.dpr The project itself. fMain.pasfMain.fmx The main form. Implementation Before running the sample, the main components are configured at design time using the Object Inspector as follows: A TFDConnection object named FDConnection1. This is the FireDAC connection object that the sample uses to connect to a DBMS. The sample sets the ConnectionDefName property to PG_Demo. Note: You can change the ConnectionDefName property to connect to a different PostgreSQL server using a valid user name and password. A TFDQuery object named FDQuery1. This component implements a dataset capable of executing SQL queries. The sample sets: The Connection property to FDConnection1 in order to specify the FireDAC connection object. The SQL property with the following SQL SELECT statements that define different integer ranges: SELECT int4range(null,2000, ‘(]’) rng UNION ALL SELECT int4range(3000,4000, ‘[)’) rng UNION ALL SELECT int4range(5000,6000, ‘[]’) rng UNION ALL SELECT int4range(7000,null, ‘()’) rng UNION ALL SELECT int4range(20,20, ‘()’) rng SELECT int4range(null,2000, ‘(]’) rng UNION ALL SELECT int4range(3000,4000, ‘[)’) rng UNION ALL SELECT int4range(5000,6000, ‘[]’) rng UNION ALL SELECT int4range(7000,null, ‘()’) rng UNION ALL SELECT int4range(20,20, ‘()’) rng Notes: The parentheses or brackets of the third argument indicate whether the lower and upper bounds are exclusive or inclusive. “[” represents an inclusive lower bound while “(” represents an exclusive lower bound. The same way, “]” represents an inclusive upper bound while “)” represents an exclusive upper bound. If you omit the lower bound of a range, it means that all points less than the upper bound are included in the range. Likewise, if you omit the upper bound of the range, then all points greater than the lower bound are included in the range. If both lower and upper bounds are omitted, all values of the element type are considered to be in the range. A TDataSource object named DataSource1. This component provides an interface between a dataset component and data-aware controls on a form. In this sample, it is used to provide communication between the dataset and the grid where the dataset is displayed. To this end, the sample sets the following properties: The DataSet property of DataSource is set to FDQuery1. The DataSource property of DBGrid1 is set to DataSource1. When you run the application, you see: A TDBGrid that is used to display the different data ranges defined on the SQL command. Three TDBEdit components that are used to display the lbound,lbound and flags fields of the range type. Two TLabel components that are used to display the type of the range bounds. You can check the link below for more details about this sample: http://docwiki.embarcadero.com/CodeExamples/Sydney/en/FireDAC.PostgreSQL_Ranges_Sample Head over and check out the full source code for the PostgreSQL Ranges sample for Windows apps on GitHub or in your RAD Studio IDE samples section.

Read More