From the blog

Powerful PyDelphiWrapper To Wrap Your Delphi Objects To Python Objects Instantly With FireDAC Sample App

How about wrapping your Delphi Objects to Python Objects with a single line of code? Sounds Interesting? Yes, Python4Delphi has the flexibility to do that using a TPyDelphiWrapper component. This benefits Delphi Developers easily to wrap the existing or new Delphi Objects into Python Objects. This post will guide you on how to wrap a FireDAC TFDTable to a python Object and Manipulates with table data using python scripts. You can also use Python4Delphi with C++Builder. Python4Delphi Demo10_FireDAC Sample App shows how to wrap a Delphi Object(TFDTable, TFDQuery) to Python Object with some Examples as listed. You can find the Demo10_FireDAC source on GitHub. Prerequisites: Download and install the latest Python for your platform. Follow the Python4Delphi installation instructions mentioned here. Alternatively, you can check out this video Getting started with Python4Delphi. Components used in Python4Delphi Demo10_FireDAC App: TPythonEngine: A collection of relatively low-level routines for communicating with Python, creating Python types in Delphi, etc. It’s a singleton class. TPythonGUIInputOutput: Inherited from TPythonInputOutput (which works as a console for python outputs) Using this component Output property you can associate the Memo component to show the Output. TPythonModule: It’s inherited from TMethodsContainer class allows creating modules by providing a name. You can use routines AddMethod, AddMethodWithKW to add a method of type PyCFunction. You can create events using the Events property. TPyDelphiWrapper: Component that wraps the Delphi Object to Python Object inherited from TEngineClient. It has the capability to store Delphi class registration information, registration for Helper Types(not correspond to Delphi Classes), register python module functions, created event handlers. Wrap, WrapRecord, WrapInterface are the key methods to wrap Delphi Object, Record, and Interface respectively. TSynEdit: Syntax highlighting edit control, not based on the Windows common controls and supported on Windows. For some history check here. How to get and use SynEdit check here. TMemo: A multiline text editing control, providing text scrolling. The text in the memo control can be edited as a whole or line by line. Along with these components TFDConnection,TFDTable,TFDQuery, TDataSource were used. You can find the Python4Delphi Demo10_FireDAC sample project from the extracted GitHub repository ..Python4DelphiDemosDemo10_FireDAC.dproj. Open this project in RAD Studio 10.4.1 and run the application.- Implementation Details: PythonEngine component provides the connection to Python or rather the Python API. This project uses Python3.9 which can be seen in TPythonEngine DllName property. PythonGUIInputOutput component provides a conduit for routing input and output between the Graphical User Interface (GUI) and the currentlyexecuting Python script. PyDelphiWrapper component contains Module and Engine Property which is associated with PythonEngine and modDBFireDAC respectively. In Example 1, SynEditScript1 load the Python script file Example1.py and clicking Execute Button, connected to the database selected in the Combobox, and the script is executed. Example1.py imports the module modDBFireDAC, create an own TFDTable object, and manipulates the table values mentioned in the script. procedure TMain.btnExecuteExample1Click(Sender: TObject); var l_sConnName: String; begin l_sConnName := cobxConnSQLServer.Items[cobxConnSQLServer.ItemIndex]; if self.DBConnectionClosedCheck(l_sConnName) then begin with GetPythonEngine do begin ExecStrings( SynEditScript1.Lines ); end; end; end; procedure TMain.btnExecuteExample1Click(Sender: TObject); var l_sConnName: String; begin l_sConnName := cobxConnSQLServer.Items[cobxConnSQLServer.ItemIndex]; if self.DBConnectionClosedCheck(l_sConnName) then begin    with GetPythonEngine do begin      ExecStrings( SynEditScript1.Lines );    end; end; end; In Example 2, SynEditScript2 loads the Python script file Example2.py and clicking Execute Button, the script is executed. Example2.py imports the module modDBFireDAC shows you how to create a TFDTable object connected to an already created Delphi TFDTable (which may include calculated fields and the like). procedure TMain.btnExecuteExample2Click(Sender: TObject); […]

Read More

TMS FNC Planner Editing

Intro Since the first release, TMS FNC UI Pack has been constantly evolving. Version 3.2 added a lot of great new functionality and new components (https://tmssoftware.com/site/blog.asp?post=695). Today, we wanted to focus on a component that has been there since v1.0: TTMSFNCPlanner. The TTMSFNCPlanner is a scheduling component with various built-in time-axis options, i.e. a day, week, month, period, half-day period, timeline as well as custom time-axis mode where you can fully control the duration of each timeslot. The TTMSFNCPlanner supports single and multi resource views and can have the time-axis in horizontal or vertical orientation. Even when targeting mobile devices, the TTMSFNCPlanner will automatically use a touch-friendly approach. Today’s blog post focuses on a feature that is essential for an application that uses the maximum potential TTMSFNCPlanner has to offer: editing. Editing Editing is divided into 3 parts: Inplace editing Dialog editing Custom editing Inplace editing Inplace editing is enabled by default. Clicking in the planner item notes area will start the inplace editor. The default inplace editor is a TMemo, but can be configured to whatever inplace editor you want to use, with the OnGetInplaceEditor event. See the topic “Custom editing” below for an example. After the editor is started, text can be entered, and committed via the F2 key, or by clicking on another part of the planner. Cancelling is done via the Escape key. Changing the behavior of inplace editing can be done via one of the various properties under Interaction. Dialog editing Dialog editing can be enabled by changing the property Interaction.UpdateMode to pumDialog. When doing the same kind of interaction (selecting the item, clicking on the notes area), the dialog will be shown which can fully edit the item. Whereas inplace editing can only edit the notes, the dialog can edit title, notes, start & end time of the item. There is also support for a built-in recurrency editor dialog, which offers the same basic features as the default dialog, and extends this with recurrency options. This is typically used in combination with a dataset (see planner database demo included in the distribution). To use this dialog editor, you can drop an instance of TTMSFNCPlannerItemEditorRecurrency on the form, assign it to the ItemEditor property and click on the item to show the editor, as you would normally do after setting Interaction.UpdateMode to pumDialog. Custom editing For both of the above editing types, customization is possible. Let’s start with inplace editing. We want to create a custom editor that uses a TTMSFNCRichEditor and a TTMSFNCRichEditorFormatToolBar. We start by implementing a custom class wrapper that creates and holds a reference to a set of richeditor related classes for importing and exporting HTML as well as a toolbar and the richeditor itself. The planner item supports HTML and we need a way to convert the HTML coming from the item to the rich editor and vice versa. type TCustomInplaceEditor = class(TTMSFNCCustomControl) private FHTMLImport: TTMSFNCRichEditorHTMLIO; FRichEditor: TTMSFNCRichEditor; FRichEditorToolBar: TTMSFNCRichEditorFormatToolBar; FScrollBox: TScrollBox; public constructor Create(AOwner: TComponent); override; end; implementation { TCustomInplaceEditor } constructor TCustomInplaceEditor.Create(AOwner: TComponent); begin inherited; FScrollBox := TScrollBox.Create(Self); FScrollBox.Parent := Self; FScrollBox.Align := TAlignLayout.Client; FRichEditor := TTMSFNCRichEditor.Create(FScrollbox); FRichEditor.Parent := FScrollbox; FRichEditorToolBar := TTMSFNCRichEditorFormatToolBar.Create(FScrollbox); FRichEditorToolBar.RichEditor := FRichEditor; FRichEditorToolBar.Parent := FScrollbox; FRichEditor.Position.Y := FRichEditorToolBar.Height; FRichEditor.Width := FRichEditorToolBar.Width; FHTMLImport := TTMSFNCRichEditorHTMLIO.Create(Self); FHTMLImport.RichEditor := FRichEditor; end; To show the new inplace editor, […]

Read More

Introduction to Cyber Threat Intelligence

Published November 11, 2020 WRITTEN BY ED TITTEL. Ed Tittel is a long-time IT industry writer and consultant who specializes in matters of networking, security, and Web technologies. For a copy of his resume, a list of publications, his personal blog, and more, please visit www.edtittel.com or follow @EdTittel Simply put, threat intelligence – also known as cyber threat intelligence, or CTI – is information that is collected, analyzed, organized, and refined to provide insight, input, and advice about potential and current security threats or attacks that could pose potential or actual risks to an organization. CTI covers a wide range of information sources and can involve reports of attacks obtained from security telemetry in cybersecurity software, from researchers conducting experiments, and even from automated security testing tools (e.g. fuzzing) that automate repeated variations on accepted or expected inputs into systems and software. Threat intelligence feeds: free and open source Gathering and providing threat intelligence often occurs in the form of various “feeds.” These are continuous, ongoing streams of data about threats that incorporate information items about newly-discovered threats along with updates and amendments to information about known existing threats. Threat intelligence feeds are an important part of modern cybersecurity best practices, and may include information about countering or working around individual threats (often called “remediation advice”). In general, threat intelligence feeds fall into two broad categories. First and most widely consumed are those identified as free or open source security feed options. These are available to all interested parties and may be consumed without incurring costs for their uptake and use (though they are subject to licensing conditions about which prospective consumers should make themselves aware). Searching the Web for “best open source threat intelligence feeds” is a good way to identify such things, given that there are hundreds of such feeds from which cybersecurity service and software providers and interested organizations can choose. Here’s an example “Top 10 List” from D3 Security: Kiuwan draws much of its Open Source Security data from the NIST NVD (National Vulnerability Database), which is another widely-used and -respected free and open source security feed. Threat intelligence feeds: commercial options Working with free, open source intelligence feeds involves a wide-open, no-holds-barred outlook on converage, content, and quality. Working with such feeds requires a fair amount of work to separate the wheat from the chaff – that is, to filter out inputs and information that is not relevant to the exposures and vulnerabilities actually present in one particular organization or another. Commercial CTI feeds let customers – who can pay upwards of US$1,500 a month per feed for such access – establish and maintain filtering criteria to make sure they see only information of direct and immediate relevance to the hardware, software, and systems present in their organizations. According to Technology Comparison and Rating company CompariTech, the top 6 such producers  are as follows: The interesting thing about threat feed consumption is that most such feed come in multiple tiers – at progressively higher monthly costs – and really target enterprise-scale organizations and security service and software providers. Unless you have a team of security researchers and analysts (and a sizable budget to support their direct and indirect costs – including commercial security feeds) this will be more than most organizations are willing to […]

Read More

Quick Introduction To FireDAC And Its Features For Building Robust Delphi/C++ Builder Database Applications.

FireDAC is a powerful, yet easy-to-use access layer that supports, abstracts, and simplifies data access, providing all the features needed to build real-world high-load applications. FireDAC provides a common API for accessing different database back-ends, without giving up access to unique database-specific features and without compromising on performance. Use FireDAC in Android, iOS, Windows, and Mac OS X applications you are developing for PCs, tablets and smartphones. FireDAC Design Objectives and Architecture : FireDAC enables native high-speed direct access from Delphi and C++Builder.  Provides Universal Data Access i.e) Application built for a single data base can be used for other databases with very minimal changes at configuration. Highly configurable, using this you can fine tune your data access and it is important how your Software access with databases. Simple to deploy as no specific driver required, along with executable it is built. FireDAC local/embedded connectivity to certain local databases, including Microsoft Access database, SQLite database, InterBase ToGo / IBLite, InterBase on localhost, MySQL Embedded, MySQL Server on localhost, Advantage Database local engine, PostgreSQL on localhost, Firebird Embedded, and Firebird on localhost. Full source code provided, Developers can understand the underlying design and source code. Compatibility with the BDE means easy migration of legacy applications with reFind Utility. FireDAC Architecture Supported Database : InterBase, SQLite, MySQL, SQL Server, Oracle, PostgreSQL, IBM DB2, SQL Anywhere, Access, Firebird, Informix and more. Working With Database connections : Option 1: You can connect with any of the above listed Databases either from a Local Machine or Remote DBMS machine using the Data Explorer in the IDE. It is a tabbed pane that is located, along with the Projects Window and the Model View tabs, in the upper-right corner of the IDE window. Can use this, to create new connections, modifies, deletes, or renames your database connections.  The Data Explorer works for databases that use dbExpress or FireDAC connection types. The Data Explorer lets you browse database server-specific schema objects, including tables, fields, stored procedure definitions, stored functions, triggers, and indexes. FireDAC databases also display primary keys, foreign keys and generators. The Data Explorer presents a list of available database types (such as DATASNAP and MYSQL) that you can access and perform various actions on, using the context menus. With Data Explorer, you can easily create and manage database connections. Additionally, you can drag and drop data from a data source to a project to build your database application quickly. The commands available in the Data Explorer depend upon the object selected in the tree view. To display the associated context menu commands, right-click the following node types: You can also use Data Explorer to Obtain connection information, Check here. Option 2 : Create/Modify the connection via TFDconnection component by double clicking which will shows the editor same as Data explorer, where you can provide the DriverId, Username, Database name, Password etc. The connection string is stored in the TFDConnectionDefsparams and it is binded with application as hard-coded values. What if the database path changes after deployment of the application, you need to rebuild to avoid error in connection. To avoid such hard coded connection information, we can select the Connection Definition name in the TFDConnection editor, where Connection definition name need to be predefined and stored in the FDConnectiondefs.Ini file. The connection definitions for different databases are stored in the following fpath. C:UsersPublicDocumentsEmbarcaderoStudioFireDACFDConnectionDefs.ini To create TFDconnection with connection information, a clever way […]

Read More

Robust Way to Find Leaks With Deleaker In Delphi and C++Builder Applications

It’s quite normal for a developer to forget to destroy or free the objects while developing, these small memory leaks over a period of time lead the application to crash with, out of memory error. Finding that memory leaks in small projects it is easy. How about finding the leaks in large enterprise applications? Tired of finding the leaks? Don’t worry. The Deleaker solves the problem for you in a robust way. Find all the memory leaks, It doesn’t matter what type of leaks are occurring, Deleaker will find them all: memory leaks (produced by the heap, virtual memory, or OLE allocators, etc.), GDI leaks, leaks of Windows USER objects, and handles. Deleaker detects leaks in Delphi and C++ Builder. It can work either as a standalone application or as a RAD Studio extension. Standalone is convenient, for example, if RAD Studio is not installed. If Deleaker works as an extension, a developer can search for leaks without leaving RAD Studio, which lets him move to the source of possible errors quicker. After installation, a new Deleaker item is added to the RAD Studio main menu: How to use the Deleaker : Install the Deleaker setup check here. While installing choose the options as standalone or integration with RAD studio. Create a sample windows VCL application and write a piece of code with some memory leaks in it. Run the application, perform the action to create memory leaks, and close the application. Deleaker will create a snapshot of memory leaks where you can navigate to the line of code from the snapshot window directly to IDE. It’s that simple identify the memory leaks. Check the samples and resources available here. Check this below video demonstration of Deleaker for Delphi and C++ builder.

Read More

Quickly Learn To Use Delphi Classes To Create A New Python Type With Python4Delphi Sample App

import spam p = spam.CreatePoint(2, 5) print (p) p.OffsetBy( 3, 3 ) 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”) p = spam.CreatePoint(2, 5) try:   print (“raising an error of class EBadPoint”)   p.RaiseError() # it will raise spam.EBadPoint except spam.PointError as what: #it shows you 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)   # 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: #it shows you 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.CreatePoint(2, 5):   print (“Equal”) else:   print (“Not equal”)

Read More

Astral Heroes Is A Beautiful Multiplayer Collectible Card Game Built In Delphi

Developer Ivan Polyacov from Apus Software created Astral Heroes in Delphi. According to the site it is a collectible card game that’s simple to learn, exciting to play, and deep enough to challenge even the greatest strategists. It uses a truly fair Free-­to-­Play model that never hides the best content behind “pay walls” according to the developer. Some of the features of this beautiful game include: Fast-paced and simple core gameplay, 3 different game modes, Custom Decks: Construct and play a deck of your own personal design, Random Decks, Draft Tournament, a deep library of well­ balanced creatures and spells, A global Online League, Sophisticated and merciless AI opponents that will test your mettle, and a rich single ­player campaign. If you want to find out more about why Ivan selected Delphi and more about this development process check out this YouTube code review video. Website http://astralheroes.com/ Download https://store.steampowered.com/app/488910/Astral_Heroes/ Open Source Game Engine https://github.com/Cooler2/ApusGameEngine Screenshot Gallery

Read More

Delphi at the University – DelphiCon 2020

Are you a teacher, educator, or parent of a child interested in programming?  Are you looking for a simple but powerful language and student-friendly integrated development environment? With it’s combination of full-language features, simple syntax, and visual drag-and-drop development, Delphi rocks its competition. Still unsure? Let Victory Fernandes, a former mathematics and computer science professor at Brazil’s Unifacs University, walk you through the benefits of Delphi in education in his talk Delphi at the University – Insights for Students and Teachers. This presentation and Q&A session is free of charge and bundled with nine other talks and four panels by industry professionals.  Sign up now by clicking the “Save my seat” button at delphicon.embarcadero.com.

Read More

The Fastest And Easiest Way To Build Data-Driven Delphi And C++Builder Apps Using Enterprise Connectors

Enterprise connectors – Make Connecting to any application is easy as connecting to a database. Move, integrate, and analyze data with ease utilizing the FireDAC Enterprise Connectors, powered by CData. These unparalleled components allow you to integrate 180+ Enterprise applications, simplifying connectivity into a standard model using SQL. It allows you to integrate application services, like QuickBooks Desktop, MailChimp, Salesforce, YouTube, SugarCRM, Jira, SurveyMonkey, Amazon DynamoDB, Couchbase, PayPal, eBay, Google Sheets, Facebook, Twitter, Slack, and Dropbox. Features : Replication and Caching: Easily copy data to local and cloud data stores such as Oracle, SQL Server, Google Cloud SQL, etc. The replication commands allow for intelligent incremental updates to cached data. Functions Library: A library of over 50 string, date, and numeric SQL functions that can manipulate column values into the desired result. Popular examples include Regex, JSON, and XML processing functions. Client-Side Processing: Enhance the data source’s capabilities with additional client-side query processing to enable analytic summaries of data such as SUM, AVG, MAX, MIN, etc. Customizable: Customize the data model to add or remove tables/columns, change data types, etc. without requiring a new build. These customizations are supported at runtime using editable human-readable schema files. Secure Connectivity: Includes standard Enterprise-class security features such as TLS/ SSL data encryption for all client-server communications. Developer Friendly: Full Design-time support for data operations directly from RAD Studio. How to connect with Google Spread Sheet : Create a new VCL Forms Application. Drop a TFDPhysGoogleSheetsDriverLink and TFDConnection object onto the form. Double-click the TFDConnection object. The FireDAC Connection Editor is displayed. Select “CData.GoogleSheets” in the DriverId menu and configure the connection properties. You can connect to a spreadsheet by providing authentication to Google and then setting the Spreadsheet connection property to the name or feed link of the spreadsheet. If you want to view a list of information about the spreadsheets in your Google Drive, execute a query to the Spreadsheets view after you authenticate. Use the OAuth 2.0 authentication standard. To access Google APIs on behalf on individual users, you can use the embedded credentials or you can register your own OAuth app. OAuth also enables you to use a service account to connect on behalf of users in a Google Apps domain. To authenticate with a service account, you will need to register an application to obtain the OAuth JWT values. See the Getting Started chapter in the help documentation to connect to Google Sheets from different types of accounts: Google accounts, Google Apps accounts, and accounts using two-step verification. Watch this Video, how to connect to Google Spread sheet with powerful FireDAC enterprise connector components. Enterprise Connectors. Check out the full list of Applications supported and components available for Delphi/C++ Builder. Integrate faster with your applications using enterprise connectors.

Read More

Learn How To Use constexpr In Modern C++ With C++Builder For Windows Development

In this tutorial, you will learn how to utilize constexpr variables and constexpr functions. The principal idea is the performance enhancement of applications by doing calculations at compile time rather than run time. The purpose is to allocate time in the compilation and save time and run time. The constexpr keyword was introduced in C++11 and improved in C++14 and C++17. constexpr specifies that the value of an object or a function can be evaluated at compile-time and the expression can be used in other constant expressions. A compiler error is raised when any code tries to alter the value. Unlike const, constexpr can also be applied to functions and class constructors. constexpr symbolizes that the value or return value is constant and where possible is calculated at compile time. The primary difference between const and constexpr variables is that the initialization of a const variable can be deferred until run time. A constexpr variable must be initialized at compile time. Moreover, all declarations of a constexpr variable or function must have the constexpr specifier. constexpr float x = 42.0; constexpr float y{108}; constexpr float z = exp(5, 3); constexpr int i; // Error! Not initialized int j = 0; constexpr int k = j + 1; //Error! j not a constant expression constexpr float x = 42.0; constexpr float y{108}; constexpr float z = exp(5, 3); constexpr int i; // Error! Not initialized int j = 0; constexpr int k = j + 1; //Error! j not a constant expression With C++17, we can estimate conditional expressions at compile time. The compiler is then able to eliminate the false branch. template auto get_value(T t) { if constexpr (std::is_pointer_v) { return *t; } else { return t; } } templatetypename T> auto get_value(T t) {     if constexpr (std::is_pointer_vT>) {         return *t;     } else {         return t; } } You can do more amazing things with if constexpr. Be sure to check out these workshops: constexpr Functions A constexpr function is one whose return value is computable at compile time when consuming code requires it. A constexpr function or constructor is implicitly inline. constexpr int method_call(int a, int b) { return a * b; } constexpr int method_call(int a, int b) {     return a * b; } Example The following sample shows constexpr variables, functions and several use cases #ifdef _WIN32 #include #else typedef char _TCHAR; #define _tmain main #endif #include #include #include constexpr int method_call(int a, int b) { return a * b; } constexpr auto degrees_to_radians(const double degrees) { return degrees * (M_PI / 180.0); } constexpr int sum(int n) { if (n > 0) { return n + sum(n – 1); } return n; } template auto get_value(T t) { if constexpr (std::is_pointer_v) { return *t; } else { return t; } } int _tmain(int argc, _TCHAR* argv[]) { constexpr int i = 1 + 2; constexpr int j = method_call(5, 10); constexpr auto radians = degrees_to_radians(90); constexpr auto sum_one_to_ten = sum(10); int a = 5; int* pa = &a; int at = 5; int* pt = &at; auto value_a = get_value(a); auto value_pa = get_value(pa); std::cout 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 26 27 28 29 30 31 32 33 […]

Read More