Noutați

Learn how to Sort, Filter, and Group Data with JavaScript and the Ext JS Grid

A much-used term, Data Manipulation is the process of querying modifying data. It refers to the technique of adjusting data to make it more organized and easier to read. While many consider data manipulation difficult and complex, it does not need to be. With the Ext JS Grid, you can easily group, sort, and filter data using JavaScript. In this tutorial, you will find all the details. What is the Ext JS Grid? The “Grid” is one of the centerpieces of Sencha Ext JS. With it, you can easily fetch, sort, and filter a large amount of data. To make this possible, the Ext JS grid consists of two main components – an Ext Data Store full of data and a set of columns to render. How to Group Data with the Ext JS Grid Sorting Data in Multiple Columns Let’s say that you are building a flight booking web application. As a part of the app, you want your users to be able to sort multiple columns including Date, Airline, and Schedule, to help them find the best flights. Take a look at the illustration below: To implement the sort functionality to your web app using Ext JS, simply add the following code: Ext.define(‘MyApp.view.Main’, { extend: ‘Ext.grid.Grid’, title: ‘Reykjavik Flight Departures’,   multiColumnSort: true,   store: {       // Two property sort via store configuration     sorters: [{         property: ‘airline’     }, {         property: ‘destination’     }],       type: ‘store’,     autoLoad: true,     fields: [{name: ‘date’,type: ‘date’,dateFormat: ‘j. M’}],     proxy: {type: ‘ajax’,url: ‘departures.json’,reader: {rootProperty: ‘results’}} },   columns: [{     xtype: ‘datecolumn’,     text: ‘Date’,     dataIndex: ‘date’,     format: ‘M j’,     width: 60 }, {     xtype: ‘column’, // This is the default column xtype     text: ‘Airline’,     dataIndex: ‘airline’ }, {     text: ‘To’,     dataIndex: ‘to’ }, {     text: ‘Scheduled’,     dataIndex: ‘plannedDeparture’,     align: ‘center’ }, {     text: ‘Status’,     dataIndex: ‘realDeparture’,     flex: 1 }],   }); Ext.application({ name: ‘MyApp’, mainView: ‘MyApp.view.Main’ }); Once you understand the basics, you can experiment with the code using Sencha Fiddle. How can I sort Data in a Single Column? Now that you have the multiple column sort down pat, let’s look at another use case. Say that you want your users to find their flights by clicking the SORT ON DESTINATION text and sort the destination data into just a single column: To do it, you have to use the following code: Ext.define(‘MyApp.view.Main’, { extend: ‘Ext.grid.Grid’, title: ‘Reykjavik Flight Departures’, items: [{     docked: ‘top’,     xtype: ‘toolbar’,     items: [{         text: ‘Sort on destination’,         handler: function(button){             // Sort under program control             button.up(‘grid’).getStore().sort(‘to’);         }     }] }], store: {       // Sort via store configuration     sorters: [{         property: ‘airline’     }],       type: ‘store’,     autoLoad: true,     fields: [{name: ‘date’,type: ‘date’,dateFormat: ‘j. M’}],     proxy: {type: ‘ajax’,url: ‘departures.json’,reader: {rootProperty: ‘results’}} },   columns: [{     xtype: ‘datecolumn’,     text: ‘Date’,     dataIndex: ‘date’,     format: ‘M j’,     width: 60 }, {     xtype: ‘column’, // This is the default column xtype     text: ‘Airline’,     dataIndex: ‘airline’ }, {     text: ‘To’,     dataIndex: ‘to’ }, {     text: ‘Scheduled’,     dataIndex: ‘plannedDeparture’,     align: ‘center’ […]

Read More

Managing API Security for AI Programming

Published May 06, 2021 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 The best tool for securing use of application programming interfaces (APIs) – including those employed for AI programming – may be AI itself. Artificial intelligence is extraordinarily adept at modeling how APIs get used. This means that AI models can continuously examine and analyze API activity. This provides an opportunity to address oversights and issues that policy-based API coverage cannot handle. The timing on this technology is fortuitous, because Gartner predicts that API abuses will represent the most frequent attack vector that results in data breaches within enterprise web-based applications. These days, says InfoWorld, enterprises make use of authentication, authorization and throttling capabilities to manage APIs. Such tools are vital in controlling who accesses APIs within an enterprise IT environment. But these approaches do not address attacks that survive such filtering and scrutiny because of clever attacks embedded within apparently legitimate API calls and uses. Nowhere is this as apt as for AI programming itself, which represents a substantial and increasing share of programming activity within enterprises nowadays. Within an organization, it’s typical to use API gateways as the primary way to call and use APIs. Such gateways can enforce API policies by checking inbound requests against rules and policies that relate to security, throttling, rate limits, value checks, and more. In this kind of environment, both static and dynamic security checks can be helpful, and improve security within the applications they serve. Static Security Checks and Policies Static policy checks work well for quick simple analyses because they do not change with request volume or previous request data. Static security scans work well to protect against SQL injection attacks, cohesive parsing attacks, schema poisoning attacks, entity expansion attacks, and other attacks that depend on clever manipulation of APIs inputs. Static policy checks work when scanning incoming packet headers and payloads, and can match against already-known access patterns associated with attacks. This permits, for example, JSON payloads to be validated against predefined JSON schemas, and can screen against injection attempts of various kinds. An API gateway can also enforce element count, size, and text pattern limits or filters to forestall attempted buffer overflow or illegal command injections. Dynamic Security Checks and Policies Dynamic security checks, as the name implies, work against inputs and behaviors that can change. Typically, this means that inputs must be validating against some notion of state or status, as defined by previous inputs and data associated with them. Most often dynamic checks reflect the volume or frequency of API traffic and requests at the gateway. For example, throttling techniques depend on tracking previous activity volume to limit access when the number of prior API requests exceeds some predetermined (but adjustable) threshold. Rate limiting works in similar fashion – by curbing concurrent access allowed for some particular service or resource. While techniques based on authorization, authentication, throttling and rate limiting can be helpful, they do not address all the ways in which APIs might be attacked. Because API gateways typically serve numerous web services, their attendant APIs may […]

Read More

Detect Real-World Places Of Interest With A Super-Easy API

How cool would it be for your Windows or mobile app to allow travelers to take random pictures at interesting places and retrieve instant useful information about the location they are visiting and the landmarks they can see? In this article we will see how to easily do just that using RAD Studio and Delphi with only few lines of code! Google API – harnessing super computing power the Delphi way Google may be a great search engine but behind all of the search hits and map directions there is a massive stack of super-computing power driving it all. A search on a location in Google Maps quite often shows not only a detailed map and even a street-level view of the area but also, frequently, a series of additional information about the locale such as points of interest, local landmarks and other items about the selected place. Google allows us to tap into that rich enhanced intelligence and apply it not just to maps but to objects and places in images we have taken or have in our data. This is done via the Google Cloud Vision API. Google’s Cloud Vision API – using machine learning to ‘understand’ our images Google Cloud’s Vision API offers powerful pre-trained machine learning models that you can easily use on your desktop and mobile applications through REST or RPC API methods calls. Lets say you want your application to detect objects, locations, activities, animal species, products, or maybe you want not only to detect faces but also their emotions, or you may have the need to read printed or handwritten text, this and much more is possible to be done for free (up to first 1000 units/month per feature) or at very affordable prices and scalable to the use you make with no upfront commitments. Detecting landmarks The option to “Detect Landmarks” is part of the Vision API that we can use to detect and extract information about entities in an image n order to identify a landmark and retrieve its GPS coordinates. We can use RAD Studio and Delphi to easily setup its REST client library to take advantage of Google Cloud’s Vision API to empower our desktop and mobile applications and if the request is successful, the server returns a 200 OK HTTP status code and the response in JSON format. Our RAD Studio and Delphi applications will be able to either call the API and perform the detection on a local image file by sending the contents of the image file as a base64 encoded string in the body of the request or rather use an image file located in Google Cloud Storage or on the Web without the need to send the contents of the image file in the body of your request. How do I set up the Google Cloud Vision Landmark Detection API? Make sure you refer to Google Cloud Vision API documentation in the “Detect Landmark” section – https://cloud.google.com/vision/docs/detecting-landmarks – generally, this is what you need to do on Google’s side: Visit https://cloud.google.com/vision and login with your Gmail account Create or select a Google Cloud Platform (GCP) project Enable the Vision API for that project Enable the Billing for that project Create a API Key credential AI vision, in your apps! Lets say one good friend […]

Read More

Developer Stories: Manuel Lopez Talks About Fotomorsaicos

Manuel Lopez has working with Delphi since 1995. His software (Fotomorsaicos) was one of the showcase entries for the Delphi 26th Showcase Challenge and we had a conversation with him about his experience with Delphi through the years. Download the software through the FotoMorsaicos sourceforge page. When did you start using RAD Studio/Delphi and have long have you been using it? I started using Delphi from version 1, which came out in 1995 and was announced at the Borland Conference that year. From there I used versions 1, 23, 3, 4, 5, 6 and 7, the latter being the most stable and the best. Later new versions came out but I no longer worked with them. However, for an academic project, I acquired the Delphi RAD Seattle academic license a couple of years ago. What was it like building software before you had RAD Studio/Delphi? Before you had to do a lot of work manually. The idea of components (visual and non-visual), was undoubtedly an advance in the way of programming. I think the programming paradigm changed with the arrival of Delphi, making Windows applications really easy to create. Turbo Pascal already had some possibilities thanks to the enormous amount of source code available (even from Borland), but the idea of components simplified many of the previous difficulties in programming. How did RAD Studio/Delphi help you create your showcase application? The manipulation of graphics, images and the methods of the corresponding components made writing a program like the photomosaics really much easier. In fact, the idea of the “canvas”, with its corresponding methods, makes the problems to solve much easier. I think that a photomosaic system without the help of these components would be much more difficult to program. What made RAD Studio/Delphi stand out from other options? I never really thought of another option, as I had previously used Turbo Pascal and Delphi is finally Pascal on Windows. Also, the speed of the compiler is unmatched comparing with other development tools. What made you happiest about working with RAD Studio/Delphi? Easy to program, great debugger, stable code, powerful language and rich in expressiveness. All of this shows up clearly in the Delphi compilers over time. It seems to me that programming with all these facilities is of great help. What have you been able to achieve through using RAD Studio/Delphi to create your showcase application? The creation of the photomosaic program had some results that made me happy. For example, the fact that creating a photomosaic could be done in a couple of minutes. Considering the amount of calculations that must be done (about 500 thousand square roots), the speed of the code is very, very acceptable. What are some future plans for your showcase application? Some ideas for the photomosaic app is to create images with photographs that are not necessarily rectangular. Also improve the possibility of avoiding repetitions and combining different image libraries to have more attractive mosaics. Showcase

Read More

Natural Language Processing: 5 Ways To Use NLP In Your Windows Apps

How do I start using Natural Language Processing in Windows? Natural language processing (NLP) is a subfield of Linguistics, Computer Science, and Artificial Intelligence which concerned with the interactions between computers and human language, in particular, how to program computers to process and analyze large amounts of natural language data, or teaching machines how to understand human languages and extract meaning from text. The common tasks in NLP include Text Mining, Text Classification, Text Analysis, Sentiment Analysis, Word Sequencing, Speech Recognition & Generation, Machine Translation, and Dialog Systems, to name a few. Since NLP relies on advanced computational skills and tools, developers need the best available tools to help them to make the most of NLP approaches and algorithms for creating services that can handle natural languages. We can build Windows apps with Natural Language Processing capabilities using Embarcadero’s Python4Delphi (P4D). 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 Natural Language Processing applications. Python4Delphi makes it very easy to use Python as a scripting language for Delphi applications. It also comes with an extensive range of demos and tutorials. With Python4Delphi, you can integrate any Python features, functionalities, and libraries with Delphi to create a nice GUI for your Natural Language Processing applications in Windows. In this tutorial, we will discuss the following: How to use these 5 Python libraries with different Natural Language Processing capabilities to perform Natural Language Processing in Windows Apps: NLTK, FlashText, Gensim, TextBlob, and spaCy. All of them would be integrated with Python4Delphi to create Windows Apps with Natural Language Processing 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. 1. How do I enable NLTK for NLP inside Python4Delphi in Windows? NLTK is a leading platform for building Python programs to work with human language data. Natural Language Processing or NLP for short — in a wide sense, to cover any kind of computer manipulation of natural language. NLP is a field in Machine Learning with the ability of a computer to understand, analyze, manipulate, and potentially generate human language. NLTK provides easy-to-use interfaces to over 50 corpora and lexical resources such as WordNet, along with a suite of text processing libraries for classification, tokenization, stemming, tagging, parsing, and semantic reasoning, wrappers for industrial-strength NLP libraries, and an active discussion forum. Do you want to perform Natural Language Processing tasks like predicting text, analyzing & visualizing sentence structure, Sentiment Analysis, gender classification, etc. in the Windows GUI app? You can easily solve these tasks by […]

Read More

Working with OpenAI’s GPT-3

The webinar was a huge hit. Planning future follow-up webinars on the topic. Blog post: OpenAI’s Introduction to the API with sign-up for the waiting list Academic Paper: Language Models are Few-Shot Learners Documentation: OpenAI API Personally curated YouTube playlist providing a  Slides for today’s webinar (subject to change)

Read More

Developer Stories: Dmitry Sidorkin Elaborates More About CST CAD Navigator

Dmitry Sidorkin started programming with Delphi in 1995. His application (CST CAD Navigator) was one of the submissions for the Delphi 26th Showcase Challenge and we interviewed him for some insights toward his accumulated Delphi knowledge throughout the years. More information about the application at the CST CAD Navigator website. When did you start using RAD Studio/Delphi and have long have you been using it? I started development in Delphi back in 1995, so I have been using it for more than 25 years. We started the development of ABViewer, our first CAD viewer, in Delphi 7 which was the latest version at that time. And now CST CAD Navigator is created with RAD Studio 10. What was it like building software before you had RAD Studio/Delphi? Before Delphi, I developed in Turbo Pascal, using Turbo Vision and Borland Pascal with the OWL library for Windows. My main programming language was Pascal and I sometimes used C/C++, that’s why when Delphi appeared, my choice was obvious. At least for me, there was no viable alternative. How did RAD Studio/Delphi help you create your showcase application? The support for cross-platform applications allowed us to create CST CAD Navigator, a CAD viewer that works on Windows, Linux and Mac. We started working on it from scratch. Without Delphi, we wouldn’t have been able to develop it so quickly. What made RAD Studio/Delphi stand out from other options? It is a single IDE, a single tool for different platforms that makes Delphi especially convenient. In this respect, there are no other options that can be alternatives to Pascal. Without any additional efforts, we created CST CAD Navigator for Windows, Linux and Mac. What made you happiest about working with RAD Studio/Delphi? Delphi is loved by lots of developers. I know that for sure because we often communicate with other Delphi developers who contact us about CAD VCL, our CAD library for Delphi supporting DXF, DWG and a wide range of other formats. But for me personally, the best thing about RAD Studio is being able to create software compatible with different platforms. Our team also appreciates the technical support provided by Embarcadero. What have you been able to achieve through using RAD Studio/Delphi to create your showcase application? With Delphi, CST CAD Navigator can work on several operation systems, which became possible thanks to Delphi. It is also easy to transfer code between projects, thus using our own developments several times. What are some future plans for your showcase application? We are working hard on a version of CST CAD Navigator for mobile platforms – Android and iOS. After that, we plan to add support for new formats. At the moment CST CAD Navigator supports more than 50 different formats including DXF, DWG, STP, IGS, STL and lots of other ones. Our customers expect our viewer to be able to open any drawings, so we do our best to meet their expectations. We plan to add support for Autodesk Revit® formats, Catia files and improve our own parametric 3D core in Pascal. By the way, CADSoftTools is quite unique in using Pascal for such mathematical problems and having tens of thousands of customers all over the world proves the high quality our solutions. Thank you, Dmitry! You may view his showcase entry through the link below. Showcase

Read More

Quickly Build Powerful Native Cryptocurrency Charting Solutions For Windows

Coins, wallets and the tale of very big numbers It’s hard to miss the tidal wave of stories about cryptocurrency. The inexorable rise of BitCoin, Ethereum and a whole stable of others and the volatility where fortunes are made – and lost – has ensured it is the hot technical topic of the day. You can even apparently soon pay for a Tesla with cryptocurrency. In this article we’re going to visualize that volatility and plot the ups and downs of various virtual cryptocurrencies against good old hard cash. It’s surprisingly easy to do! Charts, graphs and bars In this article we are going to use Steema TeeChart for the charting functions. The RAD Studio Delphi VCL framework comes with built-in TeeChart Std. It doesn’t have some of the additional bells and whistles of the TeeChart Pro version but it’s enough to produce some really functional examples. For other platforms such as Firemonkey TeeChart Lite is provided but it has a few features that aren’t included which we would for our purposes. To overcome this you can install Teechart Pro trial version from https://www.steema.com. The trial versions are fully functional with the only limitation that a small nag screen appears when you first run them. Where are we going to get the cryptocurrency data from? We’re going to use the TFDMemTable ExchangeMemTable components to provide the data to the charts. This table contains three fields: USD_BTC (USD for one Bitcoin) USD_ETH (USD for one Ethereum) At runtime, we can retrieve actual data from the Web, or load it from some predefined files. At design time, the table comes with 12 records – last year per month. More details about the table filling see below. Creating our cryptocurrency chart Create a blank VCL form and drop TDBChart on it: Click with your right mouse and select “Edit Chart”: On “Series”, select “Add” Now select “Bar” and press “OK” We have a sample chart! A sample TeeChart bar appears. Now, expand “Series”, select “Series1”, choose “Data Source” and select “Dataset” Select ExchangeMemTable, Date for X, USD_BTC for Bar. Press the “Apply” button. Our 12-month data appears. Tidying some loose ends For this task, probably, we do not need Legend. Uncheck Visible for it: Probably, we do not need also marks, left axis is enough. Uncheck “Visible” for them: Trying out other charts We can easily select another chart style for the same data. Press “Change” for Series1: Now, select “Line” Adding additional cryptocurrencies to our VCL chart example Now, let us add another cryptocurrency. In “Series”, press Add: Choose “Line”. For Series2, select “Dataset” – ExchangeMemTable, Date for X, USD_ETH for Y and then press “Apply” to make the chart sprint into life. Adjusting for cryptocurrency variations on the example VCL chart Ethereum (ETH) values are significantly smaller than BitCoin (BTC). To improve the scaling and provide a better comparison let’s expand “ETH” to a full chart size. Let us give ETH a separate axis on the right side: How to fetch live cryptocurrency data into our VCL chart example To fill the ExchangeMemTable with actual rates from the currency exchange, you should get a free key from https://coinlayer.com/. Enter this key in the editor field. Select an appropriate time period (last year, last month, last week) and step (month, week, number […]

Read More

Delphi Empowers: Wagamama’s Stunning Mobile App

For good food fans in the gorgeous island of Cyprus Delphi is the power behind Wagamama Cyprus’ mouth-watering mobile ordering app. The Wagamama mobile ordering app from developer Dafera Ltd makes it a delight for the eyes and the tastebuds by powering Cypriots to have the opportunity to enjoy their favorite delicious Wagamama delivered fresh and ready at the office, at home or anywhere they wish. Firemonkey Power – Android and iOS with almost no code changes Dafera, based in sunny Nicosia, really make the app shine through their clever use of the best RAD Studio Delphi’s Firemonkey FMX cross-platform features so that the same app can be delivered on Android and iOS with virtually no changes to the code. Firemonkey and RAD Studio do the heavy-lifting. Coupled with simply stunning photography and skillful direct integration into Wagamama’s order management workflow users are treated to a seamless, trouble-free ordering and delivery experience. Great work by the Dafera team! Website wagamama Google Play wagamama Apple App Store wagamama Screenshot Gallery If you’re looking to create a professional, top quality mobile or desktop app like Wagamama Cyprus- RAD Studio has the answers and the power to make it happen – just bring your imagination! What do you want to create?

Read More

Easily Build Powerful Personalized Dashboards With Javascript

  The Dashboard is the first screen that a user wants to see in an application. There will be the most important information for the strategy of the company. There are charts and some lists with summary data to explain the current status of the business. Today we are going to create our Dashboard with a personalized design using the power of Sass based on this example and using best practices. How to Create an Ext JS Application Using Sencha CMD based on Templates Let’s start installing and configuring Sencha CMD and then create our application from the admin template. Starting with Sencha CMD If you still don’t have Sencha CMD, you can download it for free here. Once you have it installed make sure it was installed and configured properly, running this command on terminal/shell: If it returns sencha cmd version, you are good to go. Here are more details on how to install, configure and use Sencha CMD, but this article will show all the important details. Creating the application The first thing you have to do is download the template by clicking here. The next thing to do is create your project structure and Sencha CMD can do it for you easily, just by running this command: sencha -sd /Users/fabio/sencha-sdks/ext-7.3.1 generate app -s extjs-admin-dashboard-template-master DashboardExtJS ./dashboard-extjs /Users/fabio/sencha-sdks/ext-7.3.1/ is where your Ext JS SDK folder is. extjs-admin-dashboard-template-master is the template downloaded. DashboardExtJS is the name of our application that will be our namespace for our classes. ./dashboard-extjs is the path where it will create our project structure with the needed files. Make sure when you run this command there is no error on the output. If everything was running correctly, it created your project structure. Let’s run our application with the initial structure. First navigate to your project folder: Then, run the command that will up the server on a specific port: The output of this command will show you the URL where your app will be available. For our case, it is available on http://localhost:1841/. Open it on your browser and you will see the initial app created: Why use a template? The benefits of using templates is a lot, mainly this admin dashboard template where you have the base classes and screen that you will need for your application. Project Structure Let’s understand a bit about the project structure generated, here are the important folder on our project: app is the directory where we will have our classes used on both devices (desktop and mobile). Here we can have base classes and no visual classes like Models, Stores, and some views that we will be able to reuse. classic is our directory where we have our classes used for the app running on the desktop. modern is where we save our classes that will be working to run the app through the phone. sass is where some of our important rules were defined to change the design of the app. The Dashboard In this post, we will focus only on our Dashboard and dive into some components and how it is working to make some actions. Important components to put on a dashboard are charts and lists, so let’s focus on these two kind of components. How can I Create a Line Chart with Javascript Ext […]

Read More