Delphi

Making Your Apps Work With Ethereum & Blockchain. Part 1

What is Blockchain? The best way to describe blockchain is a distributed database, and it is shared across many computer in a network. Block refers to the fact that data and state are stored in sequential batches or “blocks”. Chain refers to the fact that each block cryptographically references its parent. A block’s data cannot be changed without changing all subsequent blocks, which would require the consensus of the entire network. All computer on the network are known as Node. What is Ethereum? In the Ethereum universe, there is a single, canonical computer (called the Ethereum Virtual Machine, or EVM) whose state everyone on the Ethereum network agrees on. Everyone who participates in the Ethereum network (every Ethereum node) keeps a copy of the state of this computer. Additionally, any participant can broadcast a request for this computer to perform arbitrary computation. Whenever such a request is broadcast, other participants on the network verify, validate, and carry out (“execute”) the computation. This causes a state change in the EVM, which is committed and propagated throughout the entire network. Requests for computation are called transaction requests; the record of all transactions as well as the EVM’s present state is stored in the blockchain, which in turn is stored and agreed upon by all nodes. Cryptographic mechanisms ensure that once transactions are verified as valid and added to the blockchain, they can’t be tampered with later; the same mechanisms also ensure that all transactions are signed and executed with appropriate “permissions” (no one should be able to send digital assets from Alice’s account, except for Alice herself). You can read more here  What we can do using Delphi? Ethereum and its community embrace open source. You can find community projects – client implementations, APIs, development frameworks, testing tools – in a wide variety of languages. Fortunately, Delphi already has an open source project that can be used to create decentralized applications (dapps) that take advantage of the benefits of cryptocurrency and blockchain technology. Check https://github.com/svanas/delphereum Do you want sample code related to this? Please wait for my article in the second part.

Read More

Native thumbnail and preview functionality for your software: ShellBrowser Delphi Components

The pain of finding the right file Let’s be honest: Searching for files in the file explorer or on your desktop can be very annoying. Especially if you are looking for a certain picture of – let’s say – your last holiday trip to Italy. Luckily, previews are a thing for a while now! The busy software user expects your program to present him or her a little preview of the file content when selecting an item: Imagine users scrolling through a directory full of Excel files, for example. Do you expect them to open each one individually to check if it’s the right table they are looking for? No, not really. You want your users to feel more comfortable because your software offers a quick preview of document contents in the tiny window on the right side. Does this sound good to you? Comfort features are a must have for professional software, but easier said than done. Programming your own file preview feature can be very time consuming and expensive. Especially if you are running a smaller project and cannot rely on shared code. An alternative to building your own complex functionalities is reusing the native Windows functionalities used in the Windows file explorer. So, is there any way to go back to the native Windows functionalities? This is where our ShellBrowser comes in: We offer you developer components for creating file thumbnails and previews with an ease, enabling the use of native Windows functionality. Let us take a closer look! Thumbnails – what are those again? First, we should make clear the differences between a thumbnail and an icon. An icon is a pictogram – or to put it more simply: a tiny picture – that represents a data file in your file system or on the desktop. On Windows, most file types have their own icons alongside different file extensions. Let us give you an example: Examples for icons A thumbnail, on the other hand, represents files not by their file type but by their individual contents. Usually in modern software, image files are represented by a small version of the image itself and not by an icon. There is a trend towards showing documents like Office files or PDFs as thumbnails, too. Here’s an example: Examples for thumbnails How can ShellBrowser help? With ShellBrowser Delphi Components, we offer a variety of components that use the native “ThumbnailProvider” functionality of Windows. Embedded in RAD Studio, ShellBrowser lets you use thumbnails for image files in your software very easily. Depending on individual file or program configurations, you can also let previews of MS-Office documents, PDFs and many more be shown. Our ShellListView components help you to toggle the thumbnail view on and off: Toggle between icons and thumbnailsIf you only want to present thumbnails for a single file at a time, you may choose the TJamThumbnailImage. Another key benefit of using the ShellBrowser components is the asynchronous loading of thumbnails. Doing so, we ensure responsiveness and stability of your software – even if the loading process may take some time, especially when displaying thumbnails in very large folders, the usability of your software is not affected. Thumbnails even if the system can’t provide one Although thumbnails are an absolute standard for software usability nowadays, even the Windows Explorer […]

Read More

Are You Using The Secret Alternative To SQLite?

I know the best way to traumatize a software developer who has been using Delphi for some time. You just show them this image: The BDE Administration Manager. So many ‘happy’ hours trying to resolve “PDOXUSERS.NET is in use” messages and learning all about the purpose of arcane settings like SharedDir and NETDIR. Shudder. If you wanted to store a database accessed via the BDE on a network drive there was a whole bunch of things you’d have to do to make sure it didn’t get corrupted. Despite this, developers became experts at repairing Paradox database corruption. Things were pretty bleak, although it its defense this was a time when almost everything we have come to take for granted today was still in its nascent stages; dial-up was common (and erratic) and almost everyone had at least one AOL CD as a drinks coaster. Why did people use the BDE if it had so many problems? Well, the short answer was: it worked. In fact, once you got it configured it worked pretty well and was extremely easy to use. It allowed you to link to various databases like DBase and Paradox in a simple way. So simple that Paradox became a de facto non SQL database technology along with DBase which had problems of its own. SQLite the universal toolkit Along into that pre-Windows arena sidled SQLite. It was designed from its inception as a simple database which would allow SQL-like commands to be executed against a set of tables contained in a single ‘flat’ file. It had – and still has – limitations and quirks like AUTOINC columns not being the same as ROWID columns, or the fact it has no native DATETIME or BOOLEAN types. Oh, and like PostgreSQL, a name which still trips me up when I have to say it out loud, the SQLite name is annoying. Seequal light; shouldn’t it be pronounced “seequal ite”? Despite this it has become massively popular. What’s the secret native Delphi alternative to SQLite? Hiding in plain sight is a pretty impressive database system which almost completely replaces SQLite for desktop apps written in Delphi and C++ Builder. This database is Absolute Database from Technology Partner Component Ace. Why isn’t Absolute Database more well-known? For whatever reason Absolute Database hasn’t captured the imagination of Delphi developers in quite the same way as other systems. I’m not entirely sure why this is. In my ‘day job’ we use Absolute Database for a desktop product – which can also be multi-user and with the data stored on a network server. That desktop product has close to 10,000 individual installations. Like any flat file database people do crazy things like experience powercuts in the middle of data being written or some malicious malevolence called “Windows Updates” clobbers the server and reboots slightly less gracefully than the Windows API documentation would suggest is the case. On app start-up the Absolute Database database silently recovers and automatically repairs any damage, no user intervention required. It’s tried and tested for us. Out typical client profile for the desktop version of our products are small to medium-sized businesses and the ubiquitous ‘mom and pop shop’. We do have client-server products too which use full-blooded RDBMS like MySQL and PostgreSQL but the product line using Absolute Database […]

Read More

Developer Stories: Alexandr Anicimov Discusses “Laser Flash Method”

Alexandr Anicimov launched his first Delphi application in 2005. His application (Laser Flash Method) was a showcase entry at the Delphi 26th Showcase Challenge and we interviewed him for an insight of his programming adventure. Go over at the Laser Flash Method website to download the application. When did you start using RAD Studio Delphi and have long have you been using it? My first Delphi app was created in 2005. It was a local database. The text file (warehouse request) received by e-mail was processed using a local database and a warehouse invoice was created using the Rave 5 report generator. What was it like building software before you had RAD Studio Delphi? It was more time consuming. How did RAD Studio Delphi help you create your showcase application? My curiosity and desire to get acquainted with the possibilities of Delphi What made RAD Studio Delphi stand out from other options? It is ease of code creation and project structure. What made you happiest about working with RAD Studio Delphi? It is the ease of code creation and project structure. Creating an attractive application for the operator. What have you been able to achieve through using RAD Studio Delphi to create your showcase application? Controlling the operation of external devices What are some future plans for your showcase application? Show Delphi’s capabilities in physics experiment management and data processing. Thank you, Alexandr! Head on over to the link below to view his showcase entry. Showcase

Read More

Can This Powerful Secret Boost Your Business Bottom Line?

As a software development company owner, you always look for ways to increase revenue. With a healthy bottom line, you can create an emergency fund to help your business survive during tough situations. Also, it can help you to expand your business. However, there is a secret for boosting the bottom line that you must know about. In this post, you will find all the details. What is the secret of boosting your business bottom line? You might have spent 15 long years establishing your product. And the source code is your intellectual capital. You need a platform that has been constantly evolving without requiring you to get used to the major changes in the development environment. You don’t want to face a situation where you are forced to rewrite all the code of the past 15 years. It will cost you a lot of money and time. The secret of boosting your software business bottom line is using a platform that offers a safe future for your product. You need a platform that will continue to offer updates for years to come without making major changes to the version that you are using. So, your 15-years old source code will continue to compile and run flawlessly even after 20 years from now. But which platform offers the best safety for the future of your product? You can consider Delphi, which has been evolving since 1995. It has received numerous updates over the years. However, great care is taken to ensure backward compatibility of the language as it evolves and adds new functionality, efficiencies and features. The Delphi code you might have written in 1995 still runs today in the latest version with little – or in most cases – no changes. So, you don’t have to worry about the issues related to software modernization. How can Delphi help you with boosting your business bottom line? Enables You to Achieve High Productivity and the Greatest ROI: If you have advanced programmers in your team, Delphi is the right choice for you. It has been specifically built to boost the productivity of the top coders. By boosting their productivity, Delphi helps you to achieve the greatest Return on Investment (ROI). Streamline Maintenance by Involving Programmers of All Levels: Delphi code is extremely easy to read. Even those who haven’t used Delphi can easily comprehend the the meaning and intent of the program. This readability can help developers of all levels can maintain the source code created by more advanced coders. So, you will not have to worry about depending on a single advanced programmer. It’s fair to say anyone can write difficult to maintain and unreadable code in any language; even in Delphi! But, overall, the syntax and ethos behind the language does help promote a style which lends itself more readily to good comprehension and structure. Streamline the Development Process of Large Projects: Delphi is very easy to learn. Programmers who have experience with other programming languages can learn it easily. Also, they can create working prototypes quickly. That’s why some companies have a dedicated programming team for producing prototypes in Delphi. Also, Delphi makes it very easy to shift from a prototype to a market-specified language. The coders of other areas find it very easy to follow and translate […]

Read More

RAD Server CRUD Procedures – Part 1

In this RAD Server CRUD Procedures – Part 1 post, we will discuss the the default generated CRUD procedure implementations from the RAD Server Package Wizard. In the RAD Server CRUD Procedures – Part 2 post, we will discuss modifying the default generated CRUD procedure implementations from the RAD Server Package Wizard using both Delphi and C++ Builder, to show possible ways to implement Get, GetItem, Post, Put and Delete, including Delphi and C++ Builder clients to call the CRUD procedures. Create, retrieve, update and delete (CRUD) refers to the four major functions implemented in database applications. The CRUD functions are the user interfaces to databases, as they permit users to create, view, modify and alter data. CRUD works on entities in databases and manipulates these entities. These four methods create, retrieve, update and delete are re-used across all types of objects. So, for example, you can create new Employees, read Employees, update Employees, and delete Employees. These four CRUD methods are also reflected in the way HTTP functions with these four methods; GET, POST, PUT, and DELETE. The HTTP methods POST, GET, PUT and Delete are typically translated as CREATE, READ, UPDATE, and DELETE, respectfully. This offers us the uniform interface that’s required as part of a REST application, as the well understood CRUD pattern. In order to transfer data to and from a REST Service, JSON – JavaScript Object Notation, is typically used as the transfer encoding. The Embarcadero RAD Server (also known as EMS – Enterprise Mobility Server) uses the industry standards of REST, and you can build any client front-end that you want for your RAD Server application. And any tool that can consume JSON via HTTP can be used to build a RAD Server client, such as Delphi and/or C++ Builder VCL or FMX application, PHP, Javascript, Angular, C#, whatever – it doesn’t matter. As the graphic below shows, you can leverage almost anything to consume a RAD Server (EMS) service: Let’s now take a look at implementing CRUD procedures using RAD Studio, Delphi and/or C++ Builder in a RAD Server EMS Resource Module. Specifically, we’ll look at how to create and implement the RAD Server Endpoints for GET, POST, PUT and DELETE. For this implementation, I’m using the Delphi 10.4.2 IDE. For the Employee Table, I’m using the InterBase Employee database, located at:localhost:C:UsersPublicDocumentsEmbarcaderoStudio21.0Samplesdataemployee.gdb Steps:1. File | New | Other | Delphi Projects | RAD Server (EMS) | RAD Server Package 2. This gives us the RAD Server Package Wizard, allowing me to (1) Create empty package, or (2) Create package with resource. The option (1) Create empty package, creates an empty package allowing you to add resources later. Or option (2) Create package with resource, creates for me a package with an existing resource. This option (2) lets the IDE do some of the work for me, by creating a template resource for me. So we will select this Option (2) ) Create package with resource. 3. Click Next. Here, we see an entry for Resource name. In RAD Server the terminology of a Resource is a Collection. So, for example, we can have a RAD Server resource defined as http://localhost:8080/employees For this example, http://localhost:8080/employees we will get a Collection of Employee records from the Employees database. The table employee in the Employees database […]

Read More

5 Ways To Use Computer Vision In Your Windows Apps

What is Computer Vision? According to Ballard and Brown in 1982, Computer Vision is an interdisciplinary scientific field that deals with how computers can gain high-level understanding from digital images or videos. From the perspective of engineering, it seeks to understand and automate tasks that the human visual system can do. At 19th CERN School of Computing, T. S. Huang states that Computer Vision has a dual goal. From the biological science point of view, Computer Vision aims to come up with computational models of the human visual system. From the engineering point of view, computer vision aims to build autonomous systems which could perform some of the tasks which the human visual system can perform (and even surpass it in many cases). These two goals are intimately related. The properties and characteristics of the human visual system often give inspiration to engineers who are designing Computer Vision systems. Conversely, Computer Vision algorithms can offer insights into how the human visual system works. Sub-domains of Computer Vision include scene reconstruction, object detection, event detection, video tracking, object recognition, 3D pose estimation, learning, indexing, motion estimation, visual servoing, 3D scene modeling, and image restoration (Morris, 2004). Why use Python for Computer Vision? Easy to use Open source Python has become the language of scientific computing Easy for visualization and debugging It can be directly integrated with web frameworks (as well as GUIs) Delphi adds Powerful GUI Features and Functionalities to Python In this tutorial, we’ll build Windows Apps with extensive Computer Vision capabilities by integrating Python’s Computer Vision libraries with Embarcadero’s Delphi, using Python4Delphi (P4D). A small disclaimer: we have used some publicly-available images for the fair-use purposes of education so we can teach you how face recognition works. The copyright of the images remains with the owner and we acknowledge the source and their ownership. P4D empowers Python users with Delphi’s award-winning VCL functionalities for Windows which enables us to build native Windows apps 5x faster. This integration enables us to create a modern GUI with Windows 10 looks and responsive controls for our Python Computer Vision applications. Python4Delphi also comes with an extensive range of demos, use cases, and tutorials. We’re going to cover the following… How to use OpenCV, Mahotas, Face Recognition, EasyOCR, and Keras Python libraries to perform Computer Vision tasks All of them would be integrated with Python4Delphi to create Windows Apps with Computer Vision capabilities. Prerequisites Before we begin to work, download and install the latest Python for your platform. Follow the Python4Delphi installation instructions mentioned here. Alternatively, you can check out the easy instructions found in the Getting Started With Python4Delphi video by Jim McKeeth. Time to get Started! First, open and run our Python GUI using project Demo1 from Python4Delphi with RAD Studio. Then insert the script into the lower Memo, click the Execute button, and get the result in the upper Memo. You can find the Demo1 source on GitHub. The behind the scene details of how Delphi manages to run your Python code in this amazing Python GUI can be found at this link. Open Demo01.dproj. How do I perform Computer Vision with OpenCV on Windows? OpenCV (Open Source Computer Vision Library) is an open-source Computer Vision and Machine Learning software library. OpenCV was built to provide a common infrastructure for […]

Read More

Developer Stories: Frits F.M. de Mul On ALGOL, Neutron Physics & His Montcarl App Suite

Frits F.M. de Mul started programming with ALGOL in 1965. He submitted his showcase entry (Montcarl Application Suite) for the Delphi 26th Showcase Challenge and we had a talk with him about his many years of programming experience. Take a look at his website for more information about the applications and software. When did you start using RAD Studio Delphi and have long have you been using it? I started with ALGOL, DELPHI’s predecessor, during my M.Sc.-project in 1965/66 on neutron physics, where I got a lot of measurement data. The University’s first computer was a Telefunken TR4 mainframe, to be fed with paper tape an (later) punch cards.  This was one of the very first computers in the country, and I had account nr. 10. For my Ph.D.-work in early 70’s I shifted to FORTRAN, which was more convenient (faster) at that time, although functions and procedures were hard to handle, and the output was cumbersome. No plotters were present in those days. In late 70’s I switched to Pascal, later Turbo Pascal, on writing a lot of (stand-alone) programs; part of those are mentioned on my site (see above). And now, with DELPHI, since I am retired, I also use TMS Web Core for web applications. What was it like building software before you had RAD Studio Delphi? ALGOL and FORTRAN were limited in possibilities and cumbersome to handle. First, I had to use punched taper tape and later punch cards. When you had to made corrections, it was possible to manually make extra holes, and even repair holes, but you had to learn and use the 8-bit codes for all characters. Then the tapes or cards had to be delivered manually to the computer building, and a few days later you got your results (provided you did not make punch-typing or syntactic errors). But frequently the computer got stalled…. Nevertheless, all that punchwork made excellent confetti! How did RAD Studio Delphi help you create your showcase application? Viewing the history, DELPHI – as successor to TURBO PASCAL – offered lots of improvements; most important of course was it built-in logic and Object Programming. Since I always make Computational-Physics programs, DELPHI offers many possibilities. I tried to use PYTHON, but I found Delphi much more attractive, due to its simple but adequate logical structure and lack of superfluidal options. For instance, the PYTHON world has gone much too far in incorporating a lot of options for arrays. These look nice at first sight, but normally programmers will use a limited set of convenient options only, and the rest is discarded. With DELPHI you can easily make all those options offered by other platforms yourself, in case you need those. What made RAD Studio Delphi stand out from other options? As mentioned above, DELPHI remains THE most logical language, with great backward compatibility. There are many built-in options, but no superfluidal ones. Its syntax has a complete WYSIWYG structure. This is a great advantage compared with C++ or PYTHON, which at first sight look handy, but you have to learn what is behind a lot of statements. Therefore my wish to developers: keep it simple and staightforward! What made you happiest about working with RAD Studio Delphi? The most happy – I think – is working with Forms, and […]

Read More

Managing Delphi Expressions via a Bindings List component

After looking to binding expressions and how they can link to components, let’s move to the component aimed for managing binding expressions. In recent blog posts I covered Delphi’s RTL core expression engine and components binding. Now we can make an additional step and look into a key component for the entire bindings architecture, called BindingsList. A binding list is a collection of different types of bindings expressions, managed in the designers. In other words, the expressions and component bindings I defined in source code in the last blog post, can be fully defined in the designers (and wizards) of the BindingsList component. Just drop a component of this type to a form plus a few visual components (in my example two edits, a spin edit and a progress bar — see image below). The BindingsList component has a designer which allows to define a collection of bindings. Each binding can be picked using one of the many available options (way too many to explore in this article and primarily focused on data source and data field bindings). The two basic options I’m going to use here are TBindExpression and TBindExprItems. After you select one of those bindings, let’s say a TBindExpression, you need to interact with two different design surfaces to work on the expression: on one side you can configure the expression properties in the Object Inspector, like the SourceComponent and the ControlComponent (the term use to refer to the target control) and the related expressions; on the other by double clicking on the expression in the BindingList editor you can open us a special expression designer, which in turn has additional items editors and viewers: In the image above, you can see that I connected the expression to a source and target control, but I still haven’t defined an expression. This can be as simple as a single property name or a more complex combination of values and expressions and can be configured in the Object Inspector expressions properties for the binding or on the special designer displayed above. The designer also offers the option to evaluate and inspect different expressions. Going back to the expressions, we can simply use Value and Position for the Spin Edit and the Progress Bar, respectively. Notice the binding expression has a direction (by default, source to control) that can be reversed or can also be bi-directional. I’ve used a bidirectional expression for the two edit boxes, so that typing in any of them copies the content to the other. In this second example, I’ve used a TBindExprItems binding (but a regular expression would have been enough). This is a more complex binding, in which you specify source and control (as above) but define a collection of clear and format expressions, which can involve multiple properties of the controls. In this example, the mapping is Text to Text (bidirectional) as you can see below: With all of this, the only Delphi code that’s needed in the application is a call to re-evaluate the bindings when the value of the source changes. This is easily done by handling the OnChange events of the various controls and triggering a general update of the bindings for the current control (the Sender): TBindings.Notify(Sender, ”); TBindings.Notify(Sender, ”); This is the very simple application in action: Now you might be wondering where all of this configuration settings end up… but […]

Read More

Websockets WebRTC In Real-Time – Do You Know How To Do It?

Web is basically operational using HTTP requests and responses. In this mechanism, the client always initiates the connection. There is a timeout period after which the server discards the connection. Once discarded, the client must initiate a new connection. This is OK with normal web applications but for real time communication this is not enough. A system called HTTP long polling was developed to try and overcome this problem. With this implementation, the server keeps the connection open until new data arrives. This is used in GMail chat. But in this case, server resources are blocked through the connection. What are WebSockets? Websockets solve the above problem by allowing the server and client to send messages at any time. With Websockets the communication begins a HTTP request and then upgrades to connection to Websockets using the TCP protocol connection for communication. What is WebRTC? Unlike Websockets, WebRTC doesn’t relay data through a server. It sends data between browsers or devices. It supports sending and receiving video, audio and generic data. It’s a real-time communication method. It’s a part of the HTML5 specification which is supported by most modern web-browsers. How do I find easy to use WebRTC components for Delphi? ESEGECE offers an easy to use component set for Websockets and all of its other protocols including WebRTC. You can get these components from this link: https://www.esegece.com/websockets/download How do I setup a WebRTC server using SGC components? You can easily setup a WebRTC server using these components. Step 1: Add a new “TsgcWebSocketServer” component and open bindings. Add new binding and set the server IP and the port (For Eg: IP: 127.0.0.1 / Port: 80). Step 2: Add a new “TsgcWSPServer_WebRTC” and set the server as the “TsgcWebSocketServer” component we added earlier. Step 3: Activate the “TsgcWebSocketServer” server component and you have a WebRTC server. Now you can open your web-browser, then open the server IP, and there you should find your WebRTC client. Where can I find Delphi Websockets demos? The ESEGECE Delphi WebSockets Components come with many demo applications for different protocols including the WebRTC. Inside the demo folder you can find the “WebRTC_Protocol” the which is a WebRTC implemented video chat demo application. Also you can access their web demos from this link: https://www.esegece.com:2053/webrtc The fun isn’t all reserved for Delphi developers – ESEGECE Websocket components are also available for RAD Studio C++ Builder. Why not download a copy of RAD Studio and try the websocket demos for yourself?

Read More