Noutați

Learn How To Build Decoupled Delphi Applications Quickly With Delphi Event Bus Framework

Modularity is very important in software architecture so that applications built can be easily extendable and maintainable. Consider your building an application with multiple components in it. If we decide to remove a component and replace it with another component it should not affect the application. This can be done by decoupling software architecture. Do you want to build such decoupled applications in Delphi? This post guide you to build using Delphi Event Bus Framework. EventBus: An event bus allows publish/subscribe-style communication between components without requiring the components to explicitly be aware of each other. Looks like Observer Pattern? No, there is a difference. In the observer pattern, the broadcast is performed directly from the observable to the observers, so they “know” each other. But when using a publish/subscribe pattern, there is a third component, called event bus, which is known by both the publisher and subscriber. It is Decoupled between Publisher and Subscriber. Delphi Event Bus allows you to decouple components that asynchronously receive and process events and or emit events. Consumers can subscribe to this event bus and declaratively specify which events they wish to consume. The event consumer a publisher is completely decoupled. Simplifies the communication between components. Delphi Event Bus Features: Easy and clean: DelphiEventBus is super easy to learn and use because it respects KISS and “Convention over configuration” design principles. By using default TEventBus instance, you can start immediately to delivery and receive events Designed to decouple different parts/layers of your application Event-Driven, Thread Safe, Unit Tested Attributes based API: Simply put the Subscribe attribute on your subscriber method you are able to receive a specific event Support different delivery modes: Specifying the TThreadMode in Subscribe attribute, you can choose to deliver the event in the Main Thread or in a Background one, regardless of where an event was posted. The EventBus will manage Thread synchronization. How it works : TEvent = class(TObject) // additional information here end; TEvent = class(TObject) // additional information here end; Prepare subscribers: Declaring your subscribing method: [Subscribe] procedure OnEvent(AEvent: TAnyTypeOfEvent); begin // manage the event end; [Subscribe] procedure OnEvent(AEvent: TAnyTypeOfEvent); begin   // manage the event end; Prepare subscribers: Register your subscriber: GlobalEventBus.RegisterSubscriber(self); GlobalEventBus.RegisterSubscriber(self); GlobalEventBus.post(LEvent); GlobalEventBus.post(LEvent); Check this below video for Demonstration of How the Delphi Event Bus Framework(DEB) works. Delphi Event Bus Demonstration Checkout the full source code for Delphi Event framework here.

Read More

Awesome Pascal Is A Curated List Of Awesome Open Source Delphi Pascal Frameworks, Libraries, Resources, And More

Developer Anton Frost has a curated listed of Awesome Delphi projects available over on GitHub. It offers a wide variety of projects across multimedia, game development, GUI, scripting, database, reporting, utilities, serial ports, memory management, and much more. Take A Look According to the project “only open-source projects are considered. Dead projects (not updated for 3 years or more) must be really awesome or unique to be included.“ You can submit your own projects to the list by creating a pull request to get projects included. This awesome collection is formatted and available on Delphi.ZEEF.com as well.

Read More

Learn Useful Hints For Working With Styles To Build Visually Stunning Windows Applications

Want to style your Delphi/C++Builder applications with few steps? Want to view and choose your style before applying to your application? Don’t know how to do? This post will guide you. A style is a set of graphical details that define the look and feel of a VCL/FMX application. Similar to a theme in Windows. A style permits you to change the appearance of every part and state of a control.   Where are the styles on your computer? C:UsersPublicDocumentsEmbarcaderoStudio21.0Styles. Plenty of styles available under this folder, you can choose from here. Where can you get other styles from? Use Tools -> Get it Manager -> Styles -> Select one among them and install. After installing these styles can be found under this folder C:UsersPublicDocumentsEmbarcaderoStudio21.0Styles With folder names per platform like -> Android, iOS, macOS, Linux, and Win. Other these styles, we can get some third party Styles from DelphiStyles How to view your styles? Navigate to his folder, C:Program Files (x86)EmbarcaderoStudio21.0binVCLStyleViewer.exe and pass the parameter with the Style name with path. Similarly for FMX Styles use FMXStyleViewer.exe. Alternatively, you can open the style files, by right click-> open with ->Navigate to VCLStyleViewer.exe or FMXStyeViewer Accordingly. How to convert VCL-Styles to FMX- Styles? Open IDE->Tools->Bitmap Style Designer and open the existing VCL styles and then Save the file as FMX style with Option Save as type value “FireMonkey Style” How do I assign a style to the program? Place a TStyleBook component to the form. Double Click and open the style file from the location mentioned above. Save and close the Style Designer. Assign the Stylebook reference to Form StyleBook Property. Use TStyleBook.UseStyleManager property checked when more than one form created from the main form where StyleBook property is assigned. Note: For Dialogs in FMX the styles are not applied, we need to create custom dialogs. How do I assign a style per platform? On Double-clicking the TStyleBook -> Style designer contains the option Platform where you can choose your platforms. How to set styles for multi-platform in a single application? You can use style manager to set the styles at runtime, but we need to take care of checking the platform, and deployment as well. A Simple solution is to use different data modules for each platform and place TStyleBook in each platform, instantiate according to the platform. Check this full video of useful hints for working with styles. Check out the High DPI Styles and VCL Styling Per Control feature introduced in Latest RAD studio 10.4.1

Read More

Learn A Faster Way To Make A Python Module As A DLL Using Python4Delphi Sample App

Sometimes we may need to share the functionalities as DLL and we know, creating a DLL in Delphi is a simple task. We learned how to create Python Module and add methods to it in Delphi. How about making a python module as DLL using Python4Delphi and import this python module in another application? This post will guide you to do that. You can also use Python4Delphi with C++Builder. Python4Delphi Demo9 Sample App shows how to create a Module, add a routine to that module, Import the module in a python script, and access the added routine. You can find the Demo9 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 Demo9 App: No visual components were added to the library however the following class were instantiated by using PythonEngine.pas TPythonEngine: A collection of relatively low-level routines for communicating with Python, creating Python types in Delphi, etc. It’s a singleton class. 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. 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. You can find the Python4Delphi Demo9 sample project from the extracted GitHub repository ..Python4DelphiDemosDemo09.dproj. Open this project in RAD Studio 10.4.1 and run the application. Implementation Details: This Sample contains one library project(demodll) and a VCL application project(Demo09). Demodll contains a procedure PyInit_demodll which will create an instance of TPythonEngine and TPythonModule. PythonEngine loads the python DLL using the LoadDll procedure. PythonModule named ‘demodll’ will have a method to add 2 integers. See the code below. When building this project, demodll.pyd is created. function PyInit_demodll : PPyObject; begin Result := nil; try gEngine := TPythonEngine.Create(nil); gEngine.AutoFinalize := False; gEngine.UseLastKnownVersion := False; gEngine.RegVersion := ‘3.9’; //

Read More

Powerful Native File And Folder Comparison Tool Is Built In Delphi

Beyond Compare is a data management utility that allows users to compare and reconcile documents, files, folders, and even whole system drives quickly and easily. It’s a deeply useful resource, and it is built and powered by Delphi. According to the Beyond Compare website “You can compare entire drives and folders at high speed, checking just sizes and modified times. Or, thoroughly verify every file with byte-by-byte comparisons. FTP sites, cloud storage, and zip files are integrated seamlessly, and powerful filters allow you to limit what you see to only what you’re interested in.” Additionally, it offers three way merge which is explained as “Beyond Compare’s merge view allows you to combine changes from two versions of a file or folder into a single output. Its intelligent approach allows you to quickly accept most changes while carefully examining conflicts.” And it offers syncing folders which is described as “Beyond Compare’s intuitive Folder Sync interface lets you reconcile differences in your data automatically.” Website https://www.scootersoftware.com/ Screenshot Gallery

Read More

Learn How To Modernize And Integrate WinAPI, COM, ShellAPI, And WinRT Into Your Windows VCL Applications

In this webinar, learn how to access all the APIs on Windows 10 from RAD Studio, Delphi, and C++Builder. Overview Traditional Core APIs Shell Integration WinRT and more Windows API Evolution Over Time Classic API 1985 (Win1) Win16 -> Win32 -> Win32(w/Unicode) -> Win64 COM, OLE Automation, Shell, etc WinRT Classic Windows API Kernel, User, GDI Delphi bindings for the Windows API (C language API) Load time linking vs. dynamic invocation vs. delay loading Message handling TWinControl Delphi TWinControl Wraps Windows handles, CreateWindows, API calls Used for platform controls and custom controls Used for form The entire VCL library wraps Windows APIs, plus some native concepts Component inheritance, actions, visual form inheritance, frames, styling, component messages, delayed creation, handle re-creation Be sure to check out the whole session to learn about COM, Interfaces, Shell integration concepts, and modern WinRT. Moreover, TaskBar and JumpList components in action.  Learn more about the Delphi VCL and Windows development in the Embarcadero DocWiki.

Read More

Installing Component Packages Manually

Sometimes you need to install components manually. Maybe the installer wasn’t updated for your version of Delphi, or it is an open-source library without an installer. Whatever the reason, here is a short guide in addition to what is found in the DocWiki on the topic. I’m going to write this guide around installing the Radiant Shapes Pack available via GetIt. I’m guessing it wasn’t updated to install in 10.4 yet, and while R&D is working on that this is a great opportunity to learn how to install it manually. After installing from GetIt, you will not find it in the IDE, and it is missing from the packages list, which you access from Component 🡆 Install Packages while no project is open This is where all the BPL Packages are listed. Click the Add button and browse to find the BPL C:Program Files (x86)RaizeRadiantShapes1.4BinRadiantShapesFmx_Design270.bpl (If you don’t have that BPL or path for Radiant Shapes, then make sure you installed from GetIt and you can run the installer manually from C:UsersPublicDocumentsEmbarcaderoStudio21.0CatalogRepositoryRadiantShapes-270-1.2InstallerRadiantShapes.exe ) or whatever design-time package you need. This will install the components into the IDE. Many projects have both design time and runtime packages. A design-time package contains the information necessary to install in the IDE, and any special designers, while RunTime packages only contain the code necessary for use during RunTime. You can optionally even ship these packages with your binary to link them at runtime. Next, you need to tell the IDE where to find the DCUs and optionally source files. What if you only have source files? No problem, open and build all the packages at least in Release Mode on each platform the library suports. Then head to Tools 🡆 Options then Language 🡆 Delphi 🡆 Library. Then complete the details for each platform you built and want to support: Selected Platform – Specifies which platform you are providing details for below: Linux 64-bit, iOS 64-bit, Win 32-bit, Win 64-bit, macOS 64-bit, Android 32-bit, Android 64-bit, and/or iOS Simulator. Library Path – This is the path to the Release DCUs. Some people point to their PAS files here, which works, but then you end up recompiling the library more than necessary. Radiant Shapes includes all the DCUs in subfolders off the path C:Program Files (x86)RaizeRadiantShapes1.4Lib Tip: Paste the new path into the edit box before clicking the browse button if you need to browse to a subfolder. Then be sure to click [Add] when you are done. Library Paths Dialog Location of platform specific DCU folders for Radiant ShapesC:Program Files (x86)RaizeRadiantShapes1.4Lib Browsing Path is where you optionally add a path to the source PAS files. This lets you browse out to those source files from the IDE with the Find Declaration context menu item. For Radiant Shapes, the source is found in C:Program Files (x86)RaizeRadiantShapes1.4Source Debug DCU Path allows you to optionally point to the debug version of the DCUs. This is useful if the debug version has additional information or different behaviors. Radiant Shapes doesn’t have special debug DCUs so we don’t need to add anything here. Once you’ve completed these settings for each platform you are good to go! Happy installing!

Read More

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