Posts

Delphi - equation solver library

Image
I have decided to write a library that solves equations and the source code is available in my GitHub profile under the name of TEquation. It works under VCL, FMX and Lazarus . If you look at the homepage of the repository you'll find the instructions and how to use it. You can download the source files or install a simple component I have written. Feel free to write in the comments if you have suggestions or, even better, contribute in that repo to help me!

Delphi - TLanguage localizaton tool

Image
There are many translation tools around for Delphi: they can be free or not and of course each one has pros and cons. I have decided to write my localization tool called TLanguages which is a component that is compatible with VCL and FMX! This component is very easy to use and it is useful in small projects where you have some strings to localize. I have written this for myself where I don't need a lot of lines of text to be localized but I want to share it with you in case you'll ever need it. The usage is pretty easy: Open the Editior. If you already have a file, then just open it! Otherwise, write in the box the path in which you want the new file to be created.  Now add some words. The Default language cannot be deleted and it will be used (surprise) as default language. Click Save Edits and open the Delphi IDE. Create a new project (just as test) and the click Project -> Resources and Images -> Add... -> load the json file containing the translatio

Delphi - monetize Android/iOS applications step-by-step

Image
Delphi is a great friend when you have to develop an Android/iOS app easily and quickly; once you have created an application you can distribute it using the Play Store (Android) or the Play Store (iOS). A very efficient tactic to gain money using your application is placing it in the stores at a low price or, better, place your app for free and put advertisement on it. Of course we can do it easily with Delphi. Let's do it step by step! AdMob (by Google) is a mobile advertising company that works for Android and iOS apps; we are going to use this. First of all visit the official website and click Sign up on the top. You need to have a valid gmail account. AdMob requires: AdWords: if you already have an account you're fine, otherwise a new one will be created for you. AdSense: this is used to show advertisements ( ads ) on websites (Google ad banners come from here) and on mobile devices. You need an active account. If you don't already have an AdSens

Delphi - plot math function

Image
I have seen many times people asking for a working solution about the function plot and now I am showing you a very easy step-by-step guide! :) First of all I need to say that this method is able to plot any kind of function f(x) for example f(x) = x^2 - 2x - 1 . Let's see what we need: Create a new project and drop a container. It can be what you prefer, for example a TPanel or a TRectangle. I am going to use the latter but it's your choice, the important thing is that you can use the OnPaint event. It is optional that you have a function parser (Parser10 or tbcParser) to parse a function. It is not needed but without this you'll have to hard code the function every time. Later we'll discuss about this. I'll create an example with a new Firemonkey HD From (File > New > Multi-Device Application). Drop a TRectangle and align it to client; in the object inspector on the left expand the Fill property and change the Color to white. Add the following cod

Delphi - Linux load apache module

Image
Delphi Tokyo 10.2 has an awesome feature: Linux support! From now we are able to deploy our applications into a linux server. A very nice set-up guide for the linux environment can he found here ; instead if you want to be able to use firemonkey and target a linux dekstop client (Ubuntu 16.04 LTS for example) check the FmxLinux project. With Delphi 10.2 we can create a REST Server (or simply a WebServer based on Indy) and export it as stand-alone console app or as apache module . For example, let's create a basic webserver: Go on File > New > Other > WebBroker > WebBroker Application. Select Linux and then Apache module. In the last page we are asked to input the module name, which is very important. We want to keep things very easy, so I won't focus on the WebModule (with Actions) and other things, you can find a lot of information on the doc . First of all start your linux server (hosted on Ubunutu, Virtualbox or whatever) and run the PAServer. Select Linux

Delphi - Android full screen splash

Image
Making Delphi apps with firemonkey is really awesome. I am going to show you a little step-by-step guide that will explain you how to create a fullscreen splash intro on Firemonkey. Please note that s plash screens are supported only on Android, iOS doesn't need them. Let's get started! Create a new Firemonkey application (File > New > Multi-Device App) or load a project that you already have. Select Andorid as Target Platform Go under Project > Options and then Application and you are going to see this: Using Gimp, Photoshop, Paint or whatever you need to create some png icons with the given sizes or, if you don't care, just leave the default ones. The splash screen is a different story. Create a new file with 2 pixel less than the needed one. For example you won't have to create a 426x320 but a 424x318 and then open this file with draw9patch . It is located at {delphi_install_folder}\Embarcadero\Studio\19.0\PlatformSDKs\android-sdk-windows\too