### CMake Project Setup Source: https://github.com/embarcadero/radstudio12demos/blob/main/CPP/CMake/fmx-demo/CMakeLists.txt Defines the minimum CMake version and project name. This is a standard starting point for any CMake project. ```cmake cmake_minimum_required(VERSION 3.30) project(CBuilderTestFMXDynamic) ``` -------------------------------- ### Installation Rules Source: https://github.com/embarcadero/radstudio12demos/blob/main/CPP/CMake/fmx-demo/CMakeLists.txt Defines installation rules for the 'Project2' target. It specifies where the runtime, archive, and library files should be placed on the installation destination. ```cmake install(TARGETS Project2 RUNTIME DESTINATION bin ARCHIVE DESTINATION lib LIBRARY DESTINATION lib ) ``` -------------------------------- ### Installation Rules Source: https://github.com/embarcadero/radstudio12demos/blob/main/CPP/CMake/console-demo/CMakeLists.txt Specifies the installation rules for the 'Project4' target, defining where the runtime, archive, and library files should be placed on the target system. ```cmake install(TARGETS Project4 RUNTIME DESTINATION bin ARCHIVE DESTINATION lib LIBRARY DESTINATION lib ) ``` -------------------------------- ### Android Service Start Command Source: https://github.com/embarcadero/radstudio12demos/blob/main/Object Pascal/Multi-Device Samples/Device Sensors and Services/AndroidNotificationServiceDemo/readme.md Handles the service start command, launches a notification, and configures the service to be sticky. ```Object Pascal function TNotificationServiceDM.AndroidServiceStartCommand(const Sender: TObject; const Intent: JIntent; Flags, StartId: Integer): Integer; begin LaunchNotification; //Calls the procedure that defines and presents the notification. JavaService.stopSelf; // The service stops itselfs after presenting the notification. Result := TJService.JavaClass.START_STICKY; //The '''OnStartCommand''' event is defined by default as START_NOT_STICKY, this line of code sets it to START_STICKY. end; ``` -------------------------------- ### Example URL for GetItem with Specific First Name (C++) Source: https://github.com/embarcadero/radstudio12demos/blob/main/CPP/Database/EMS/APIDocAttributes/readme.md This is an example of how to call the GetItem endpoint for the C++ resource, specifying 'Robert' as the FIRST_NAME to retrieve a particular employee record. ```http http://localhost:8080/sampleattributescpp/Robert ``` -------------------------------- ### Start Android Local Service Source: https://github.com/embarcadero/radstudio12demos/blob/main/Object Pascal/Multi-Device Samples/Device Sensors and Services/AndroidNotificationServiceDemo/readme.md Initiates a connection to and starts a specified Android local service. ```Object Pascal procedure TForm1.Button1Click(Sender: TObject); begin TLocalServiceConnection.StartService('NotificationService'); //Initialize the TLocalServiceConnection variable to a specific service, and starts it. end; ``` -------------------------------- ### Setup Column Mappings Source: https://github.com/embarcadero/radstudio12demos/blob/main/Object Pascal/Database/FireDAC/Samples/DApt Layer/MappingColumns/readme.md Configures mappings between source columns and destination columns. The format is 'SourceColumn', 'DestinationColumn', 'MappedColumn'. ```Object Pascal ColumnMappings.Add('id1', 'num', 'id2'); ColumnMappings.Add('name1', 'title', 'name2'); ``` -------------------------------- ### Start Android Local Service from Application Source: https://github.com/embarcadero/radstudio12demos/blob/main/Object Pascal/Multi-Device Samples/Device Sensors and Services/AndroidBeaconServiceDemo/readme.md Initiates a connection to and starts a specified Android Local Service. Use this when the application needs to communicate with a background service. ```objectpascal procedure TForm1.Button1Click(Sender: TObject); begin TLocalServiceConnection.StartService('BeaconService'); //Initialize the TLocalServiceConnection variable to a specific service, and starts it. end; ``` -------------------------------- ### Start Beacon Scanning in Android Service Source: https://github.com/embarcadero/radstudio12demos/blob/main/Object Pascal/Multi-Device Samples/Device Sensors and Services/AndroidBeaconServiceDemo/readme.md Enables the TBeacon component to start scanning for regions when the service begins. Sets the service to START_STICKY to encourage system recreation if killed. ```objectpascal function TBeaconServiceDM.AndroidServiceStartCommand(const Sender: TObject; const Intent: JIntent; Flags, StartId: Integer): Integer; begin Beacon1.Enabled := True; //Enables the TBeacon component to start scanning regions. Result := TJService.JavaClass.START_STICKY; //The '''OnStartCommand''' event is defined by default as START_NOT_STICKY, this line of code sets it to START_STICKY. end; ``` -------------------------------- ### Remove 'Origin = xxxx' lines from DFM files Source: https://github.com/embarcadero/radstudio12demos/blob/main/Object Pascal/Database/FireDAC/Tool/reFind/readme.txt This example shows how to remove lines starting with ' Origin = ' followed by any characters until the end of the line from Delphi Form (.dfm) files. This is useful for cleaning up DFM files during migration. The search is performed in a multi-line context. ```Shell refind *.dfm /L "/P:\n +Origin =.+$" "/R:" ``` -------------------------------- ### Initialize Sharing with Framework (C++) Source: https://github.com/embarcadero/radstudio12demos/blob/main/CPP/VCL/Windows 10 SharingContract/readme.md Launches the sharing process using the System.Win.ShareContract framework. This shows applications that can receive shared information. ```cpp void __fastcall TForm1::ButtonShareClick(TObject *Sender) { (...) // Launch Sharing process-> Shows applications that can receive our shared information-> FShareWrapper->InitSharing(); } ``` -------------------------------- ### Initialize Sharing with Framework (Delphi) Source: https://github.com/embarcadero/radstudio12demos/blob/main/CPP/VCL/Windows 10 SharingContract/readme.md Launches the sharing process using the System.Win.ShareContract framework. This shows applications that can receive shared information. ```delphi procedure TFormSharingContract.ButtonShareClick(Sender: TObject); begin (...) // Launch Sharing process. Shows applications that can receive our shared information. FShareWrapper.InitSharing; end; ``` -------------------------------- ### Get All Employees (C++) Source: https://github.com/embarcadero/radstudio12demos/blob/main/CPP/Database/EMS/APIDocAttributes/readme.md Retrieves all records from the employee table using the GET method for the C++ resource. ```APIDOC ## GET /sampleattributescpp ### Description Retrieves all records from the employee table for the C++ resource. The response is provided in JSON format. ### Method GET ### Endpoint `/sampleattributescpp` ### Response #### Success Response (200) - **FDBS** (object) - Contains database version and manager information. - **Version** (integer) - The database version. - **Manager** (object) - Database manager details. - **TableList** (array) - List of tables. - **Name** (string) - The name of the table. - **SourceName** (string) - The source name of the table. - **SourceID** (integer) - The source ID of the table. - **RowList** (array) - List of rows in the table. - **RowID** (integer) - The ID of the row. - **Original** (object) - The original data of the row. - **EMP_NO** (integer) - Employee number. - **FIRST_NAME** (string) - Employee's first name. - **LAST_NAME** (string) - Employee's last name. - **PHONE_EXT** (string) - Phone extension. - **HIRE_DATE** (string) - Hire date. - **DEPT_NO** (string) - Department number. - **JOB_CODE** (string) - Job code. - **JOB_GRADE** (integer) - Job grade. - **JOB_COUNTRY** (string) - Job country. - **FULL_NAME** (string) - Employee's full name. ### Response Example ```json { "FDBS": { "Version": 15, "Manager": { "TableList": [ { "class": "Table", "Name": "EmployeeTable", "SourceName": "EMPLOYEE", "SourceID": 1, "RowList": [ { "RowID": 0, "Original": { "EMP_NO": 2, "FIRST_NAME": "Robert", "LAST_NAME": "Nelson", "PHONE_EXT": "250", "HIRE_DATE": "20071229T000000", "DEPT_NO": "600", "JOB_CODE": "VP", "JOB_GRADE": 2, "JOB_COUNTRY": "USA", "FULL_NAME": "Nelson, Robert" } } ] } ] } } } ``` ``` -------------------------------- ### Get All Employees (Delphi) Source: https://github.com/embarcadero/radstudio12demos/blob/main/CPP/Database/EMS/APIDocAttributes/readme.md Retrieves all records from the employee table using the GET method for the Delphi resource. ```APIDOC ## GET /sampleattributesdelphi ### Description Retrieves all records from the employee table for the Delphi resource. The response is provided in JSON format. ### Method GET ### Endpoint `/sampleattributesdelphi` ### Response #### Success Response (200) - **FDBS** (object) - Contains database version and manager information. - **Version** (integer) - The database version. - **Manager** (object) - Database manager details. - **TableList** (array) - List of tables. - **Name** (string) - The name of the table. - **SourceName** (string) - The source name of the table. - **SourceID** (integer) - The source ID of the table. - **RowList** (array) - List of rows in the table. - **RowID** (integer) - The ID of the row. - **Original** (object) - The original data of the row. - **EMP_NO** (integer) - Employee number. - **FIRST_NAME** (string) - Employee's first name. - **LAST_NAME** (string) - Employee's last name. - **PHONE_EXT** (string) - Phone extension. - **HIRE_DATE** (string) - Hire date. - **DEPT_NO** (string) - Department number. - **JOB_CODE** (string) - Job code. - **JOB_GRADE** (integer) - Job grade. - **JOB_COUNTRY** (string) - Job country. - **FULL_NAME** (string) - Employee's full name. ### Response Example ```json { "FDBS": { "Version": 15, "Manager": { "TableList": [ { "class": "Table", "Name": "EmployeeTable", "SourceName": "EMPLOYEE", "SourceID": 1, "RowList": [ { "RowID": 0, "Original": { "EMP_NO": 2, "FIRST_NAME": "Robert", "LAST_NAME": "Nelson", "PHONE_EXT": "250", "HIRE_DATE": "20071229T000000", "DEPT_NO": "600", "JOB_CODE": "VP", "JOB_GRADE": 2, "JOB_COUNTRY": "USA", "FULL_NAME": "Nelson, Robert" } } ] } ] } } } ``` ``` -------------------------------- ### Create Connection Using Runtime Definition Source: https://github.com/embarcadero/radstudio12demos/blob/main/Object Pascal/Database/FireDAC/Samples/Phys Layer/IFDPhysConnection/CreateConnection/readme.md Creates a new connection definition named 'MyDefNew' on-the-fly by configuring its parameters at runtime. The connection is then established using this new definition. ```Object Pascal FDPhysManager.CreateConnection('MyDefNew', oConn); ``` -------------------------------- ### Get Employee by First Name (Delphi) Source: https://github.com/embarcadero/radstudio12demos/blob/main/Object Pascal/Database/EMS/APIDocAttributes/readme.md Retrieves a specific employee record by providing their first name using the GET method. ```APIDOC ## Get Employee by First Name (Delphi) ### Description Retrieves a specific employee record by providing their first name. ### Method GET ### Endpoint `http://localhost:8080/sampleattributesdelphi/{item}` ### Parameters #### Path Parameters - **item** (string) - Required - The first name of the employee to retrieve. ### Example `http://localhost:8080/sampleattributesdelphi/Robert` ### Response Example ```json { "FDBS": { "Version": 15, "Manager": { "TableList": [ { "class": "Table", "Name": "EmployeeTable", "SourceName": "EMPLOYEE", "SourceID": 1, "RowList": [ { "RowID": 0, "Original": { "EMP_NO": 2, "FIRST_NAME": "Robert", "LAST_NAME": "Nelson", "PHONE_EXT": "250", "HIRE_DATE": "20071229T000000", "DEPT_NO": "600", "JOB_CODE": "VP", "JOB_GRADE": 2, "JOB_COUNTRY": "USA", "SALARY": 105900, "FULL_NAME": "Nelson, Robert" } } ] } ] } } } ``` ``` -------------------------------- ### Get Specific Employee (C++) Source: https://github.com/embarcadero/radstudio12demos/blob/main/CPP/Database/EMS/APIDocAttributes/readme.md Retrieves a specific employee record by first name using the GET method for the C++ resource. ```APIDOC ## GET /sampleattributescpp/{item} ### Description Retrieves a specific employee record from the employee table based on the provided first name for the C++ resource. The `{item}` path parameter specifies the first name of the employee to retrieve. ### Method GET ### Endpoint `/sampleattributescpp/{item}` ### Parameters #### Path Parameters - **item** (string) - Required - The first name of the employee to retrieve. ### Response #### Success Response (200) - **FDBS** (object) - Contains database version and manager information. - **Version** (integer) - The database version. - **Manager** (object) - Database manager details. - **TableList** (array) - List of tables. - **Name** (string) - The name of the table. - **SourceName** (string) - The source name of the table. - **SourceID** (integer) - The source ID of the table. - **RowList** (array) - List of rows in the table. - **RowID** (integer) - The ID of the row. - **Original** (object) - The original data of the row. - **EMP_NO** (integer) - Employee number. - **FIRST_NAME** (string) - Employee's first name. - **LAST_NAME** (string) - Employee's last name. - **PHONE_EXT** (string) - Phone extension. - **HIRE_DATE** (string) - Hire date. - **DEPT_NO** (string) - Department number. - **JOB_CODE** (string) - Job code. - **JOB_GRADE** (integer) - Job grade. - **JOB_COUNTRY** (string) - Job country. - **FULL_NAME** (string) - Employee's full name. ### Request Example `http://localhost:8080/sampleattributescpp/Robert` ### Response Example ```json { "FDBS": { "Version": 15, "Manager": { "TableList": [ { "class": "Table", "Name": "EmployeeTable", "SourceName": "EMPLOYEE", "SourceID": 1, "RowList": [ { "RowID": 0, "Original": { "EMP_NO": 2, "FIRST_NAME": "Robert", "LAST_NAME": "Nelson", "PHONE_EXT": "250", "HIRE_DATE": "20071229T000000", "DEPT_NO": "600", "JOB_CODE": "VP", "JOB_GRADE": 2, "JOB_COUNTRY": "USA", "FULL_NAME": "Nelson, Robert" } } ] } ] } } } ``` ``` -------------------------------- ### Configure Select Command Source: https://github.com/embarcadero/radstudio12demos/blob/main/Object Pascal/Database/FireDAC/Samples/DApt Layer/Commands/readme.md Sets up the SQL command for selecting data and prepares the adapter to fetch records. The '{id FDQA_map1}' syntax is used for table mapping. ```Object Pascal with oAdapt do begin FConnIntf.CreateCommand(oComm); SelectCommand := oComm; SelectCommand.Prepare('select * from {id FDQA_map1}'); Define; Fetch; //... ``` -------------------------------- ### Get Specific Employee (Delphi) Source: https://github.com/embarcadero/radstudio12demos/blob/main/CPP/Database/EMS/APIDocAttributes/readme.md Retrieves a specific employee record by first name using the GET method for the Delphi resource. ```APIDOC ## GET /sampleattributesdelphi/{item} ### Description Retrieves a specific employee record from the employee table based on the provided first name for the Delphi resource. The `{item}` path parameter specifies the first name of the employee to retrieve. ### Method GET ### Endpoint `/sampleattributesdelphi/{item}` ### Parameters #### Path Parameters - **item** (string) - Required - The first name of the employee to retrieve. ### Response #### Success Response (200) - **FDBS** (object) - Contains database version and manager information. - **Version** (integer) - The database version. - **Manager** (object) - Database manager details. - **TableList** (array) - List of tables. - **Name** (string) - The name of the table. - **SourceName** (string) - The source name of the table. - **SourceID** (integer) - The source ID of the table. - **RowList** (array) - List of rows in the table. - **RowID** (integer) - The ID of the row. - **Original** (object) - The original data of the row. - **EMP_NO** (integer) - Employee number. - **FIRST_NAME** (string) - Employee's first name. - **LAST_NAME** (string) - Employee's last name. - **PHONE_EXT** (string) - Phone extension. - **HIRE_DATE** (string) - Hire date. - **DEPT_NO** (string) - Department number. - **JOB_CODE** (string) - Job code. - **JOB_GRADE** (integer) - Job grade. - **JOB_COUNTRY** (string) - Job country. - **FULL_NAME** (string) - Employee's full name. ### Request Example `http://localhost:8080/sampleattributesdelphi/Robert` ### Response Example ```json { "FDBS": { "Version": 15, "Manager": { "TableList": [ { "class": "Table", "Name": "EmployeeTable", "SourceName": "EMPLOYEE", "SourceID": 1, "RowList": [ { "RowID": 0, "Original": { "EMP_NO": 2, "FIRST_NAME": "Robert", "LAST_NAME": "Nelson", "PHONE_EXT": "250", "HIRE_DATE": "20071229T000000", "DEPT_NO": "600", "JOB_CODE": "VP", "JOB_GRADE": 2, "JOB_COUNTRY": "USA", "FULL_NAME": "Nelson, Robert" } } ] } ] } } } ``` ``` -------------------------------- ### Execute SQL Update Statement Source: https://github.com/embarcadero/radstudio12demos/blob/main/Object Pascal/Database/FireDAC/Samples/Getting Started/MySQL/readme.md Demonstrates how to update existing records in the Products table using the ExecSQL method with parameters. This example modifies UnitPrice based on provided values. ```objectpascal dbMain.ExecSQL('update Products set UnitPrice = UnitPrice * :P1 + :P2 ' + 'where ProductID < 3', [Random(5), Random(3)]); ``` -------------------------------- ### Starting a New Transaction Source: https://github.com/embarcadero/radstudio12demos/blob/main/Object Pascal/Database/FireDAC/Samples/Comp Layer/TFDConnection/Transactions/readme.md Starts a new DBMS transaction. Code within the try..except block will be part of this transaction. ```Object Pascal StartTransaction; try // execute simple command inside transaction ... ``` -------------------------------- ### Access Specific Resource API Documentation (C++, YAML) Source: https://github.com/embarcadero/radstudio12demos/blob/main/CPP/Database/EMS/APIDocAttributes/readme.md Access the API documentation for a specific C++ resource ('sampleattributescpp') in YAML format. This is useful for understanding the endpoints and data structures of a particular module. ```http http://localhost:8080/api/sampleattributescpp/apidoc.yaml ``` -------------------------------- ### Access Specific Resource API Documentation (C++, JSON) Source: https://github.com/embarcadero/radstudio12demos/blob/main/CPP/Database/EMS/APIDocAttributes/readme.md Access the API documentation for a specific C++ resource ('sampleattributescpp') in JSON format. This is useful for understanding the endpoints and data structures of a particular module. ```http http://localhost:8080/api/sampleattributescpp/apidoc.json ``` -------------------------------- ### Create Intent for Service Source: https://github.com/embarcadero/radstudio12demos/blob/main/Object Pascal/Multi-Device Samples/Device Sensors and Services/DownloadServiceDemo/readme.md Use this function to create an intent for starting a service, passing the service name, a code, and data. For remote services, the package name must be set explicitly. ```Object Pascal class function TIntentServiceHelper.Create(const AServiceName: string; Code: Integer; Data: string): TIntentServiceHelper; ``` -------------------------------- ### Example URL for GetItem with Specific First Name (Delphi) Source: https://github.com/embarcadero/radstudio12demos/blob/main/CPP/Database/EMS/APIDocAttributes/readme.md This is an example of how to call the GetItem endpoint for the Delphi resource, specifying 'Robert' as the FIRST_NAME to retrieve a particular employee record. ```http http://localhost:8080/sampleattributesdelphi/Robert ``` -------------------------------- ### Initialize Sharing with TSharingContract (C++) Source: https://github.com/embarcadero/radstudio12demos/blob/main/CPP/VCL/Windows 10 SharingContract/readme.md Launches the sharing process using the TSharingContract visual component. This shows applications that can receive shared information. ```cpp void __fastcall TFormSharingComponent::ButtonShareClick(TObject *Sender) { (...) // Launch Sharing process-> Shows applications that can receive our shared information-> SharingContract->InitSharing(); } ```