Posts by Caputo • 5,583 points
123 posts
-
1
votes2
answers1609
viewsA: How to Use Displaytext/Displayformat Tstringfield clientdatset Delphi
One simple way to accomplish this is by using event onGetText of TField The signature of the method is procedure(Sender: TField; var Text: String; DisplayText: Boolean) then you can create a method…
-
1
votes1
answer210
viewsA: Magical Property- Insert properties into another component
I can’t guarantee you that’s what he does, but to add principles and methods to other components without inheritance, just use ClassHelpers (more information on this link) Obs: It adds more…
-
4
votes2
answers866
viewsA: Convert date format to Mysql
Perhaps better than formatting the date, is to use parameters in the query, thus avoiding security holes of type Sqlinjection So instead of concatenating the strings: "UPDATE Clientes SET…
-
1
votes2
answers578
viewsA: Radio stream with Phonegap
First, as the user needs to change the radio, we need a method setRadio $scope.setRadio = function (radio) { $scope.radioHost = radio.host; $scope.radioPort = radio.port; $scope.lastFMKey =…
-
3
votes2
answers329
viewsA: Domain-Driven Design and Requirements Survey
I believe that a good way to reconcile both definitions (Domain and Business Rules) or the use of DDD practices with BDD (Specification By Example). As we can see in the image below, they act on the…
-
6
votes3
answers2999
viewsA: What is the difference between for...of and for.. in?
Apparently the for .. of creates a loop to interact with the values of eternal objects (Arrays, Sets, Maps) by MDN documentation, as long as the for .. in interacts on the properties of objects…
-
7
votes1
answer54
viewsA: Why does a javascript array continue to the same size even when we use delete?
The delete only arrow the index value passed from the array to undefined. delete a[1]; console.log(a); //[1,undefined,3] To remove an index from the array you can use the Array.splice a.splice(1,1);…
javascriptanswered Caputo 5,583 -
5
votes2
answers2442
viewsA: Run a java Jar by Delphi
Assuming that your app jar be called meuApp.jar you can do it this way in Delphi vc executes the command with Winexec for example, or Shellexecute WinExec('java c:\path\para\meuApp.jar listar…
-
7
votes3
answers1729
viewsQ: Regex to find occurrences of one word before the other
I need to find in the system sources situations where Taction occur after Tdxbar. This will happen in different lines, but within the same file, for example: pnlVisao: TPanel; tbToolBar: TdxBar;…
-
3
votes2
answers2571
viewsA: How to improve clientdataset query performance with many records?
Use the property PacketRecords to determine how many records should be returned in each package by the previous. This way the data will be returned quickly but the whole information will take longer…
-
2
votes1
answer1215
viewsA: Edit records of a field clientdataset from a Join
Artur, this happens because for Dataset understands that all fields belong to the same table. To fix the problem, you must configure which fields are not table data fields, which key and which table…
-
2
votes2
answers1298
viewsA: How to recover a value within the setTimeout function with jquery?
Just set the value of the variable there within the scope of the function. The return of the setTimeout function is a number, representing the ID value of the timer that was set. PS.: In your case,…
javascriptanswered Caputo 5,583 -
8
votes3
answers23896
viewsA: Difference between type text and type varchar in SQL Server
Whereas VARCHAR(MAX) is almost the same thing as TEXT. The basic difference is that the TEXT type will always be stored in blob storage areas and varchar will always try to store the data directly…
-
1
votes2
answers1423
viewsA: How to Put a Word File in Windows Form C#
As can be seen in this post of the blog’s David Morton you can convert the Word document to HTML and display in an embembed Web Browser. using System; using System.Linq; using System.Windows.Forms;…
-
1
votes3
answers1579
viewsA: Select the two highest values of a tuple
I believe there is some more performative way, but with this set of cases it is possible to arrive at the result: Select Notas.ID, NOTAS_V1.MaiorV1, NOTAS_V1.MaiorV2 FROM Notas INNER JOIN (SELECT…
-
1
votes1
answer153
viewsA: Update query with select for Procedure
If your intention is to update all fields where records exist that meet such condition, you should use the operator EXISTS UPDATE sca_lotacao AS t0 SET t0.ativo = 0 WHERE NOT EXISTS( SELECT * FROM…
-
13
votes2
answers1238
viewsA: What is a "0" field in the SQL SELECT?
The use of constants in SQL predicts that the result of the field is always equal to constant. In this case, 0 AS parcelado You are bringing all parceled fields as 0. Assuming there are 4 records |…
-
1
votes1
answer46
viewsA: Total sum of values of all dates
You can use the operator HAVING SELECT c.data AS 'DataConsul.', SUM(c.valor) AS TotalDia FROM consulta c GROUP BY c.data HAVING TotalDia > 100; I am no Mysql environment to test, any error tell…
-
4
votes1
answer2899
viewsA: Calculation of dates in Firebird
Delphi does not have a native function that returns the "humanized" date difference as @Omni said in chat, but you can use Delphi’s Dateutils to generate this information: Note: In your case as a…
-
2
votes2
answers371
viewsA: Uses Unit - Out of memory
To get around this Voce has some alternatives. The most used is to declare both in the same Unit, using Foward Declaration TLog = class; TBaseModelo = class(TInterfacedPersistent) public property…
-
2
votes2
answers40
viewsA: Database normalization with 'parent services' and 'child services'
In addition to following @Rodrigo Rigotti’s recommendation, to leave the field cod_pai as Nullable, would also place a column Id if searching the categories via SQL is a common operation. This id…
-
3
votes1
answer1847
viewsA: Get the name of an object attribute
You can use the Delphi RTTI. If it is a version later than 2010 you can use the new RTTI. But let me give you an example with the old one that works on everyone since version 5 var oPropList:…
-
2
votes1
answer226
viewsA: How to run Node.JS on Openshift and Locally
To configure your application to run on different ports in Openshift and local, make use of the environment variables in Openshift with the configuration, as in: var port =…
-
2
votes2
answers3205
viewsA: Modeling database of a system of friends
In my opinion it is interesting to store the applicant and the requested in the following way Usuarios ---------------------------- id_usuario | Nome 1 | Joao 2 | Maria 3 | José Amigos…
-
1
votes2
answers1047
viewsA: Using timestamp in different fields
One of the ways to do this is to not use Dbware components, and use Dataset events AfterScroll and BeforePost to update your fields that are not Dbware. Considering the field DataHoraBanco you can…
-
5
votes1
answer137
viewsA: RFC6530 - Check if variable contains a well formatted PHP email address
I looked it up and I saw in this reply by Soen a same query and it presents this Regex to validate. By the Regextester site, both were validated: (?:(?:\r\n)?[ \t])*(?:(?:(?:[^()<>@,;:\\".\[\]…
-
7
votes5
answers2700
viewsA: Drawing strings from a weight array
Edit I hadn’t seen the @Joannis response when I wrote that she had given the same idea :( I’ll keep it just for example, but I’ve even voted for her answer! An idea would be to create a ticket…
-
1
votes1
answer487
views -
1
votes2
answers1682
viewsA: Consume Rest with Angularjs
Apparently the problem is in queryParameter: { method: 'GET', params: {query: '@nome'} , isArray: true,} The name parameter is not an array, so it should be queryParameter: { method: 'GET', params:…
-
2
votes2
answers1213
viewsA: What are the advantages and disadvantages of storing session variables in the database?
I’m not a web expert, but I believe I can contribute to the issue. Sessions in the database Perks Easy to scale Considering that it is not an application that uses database replication, it is…
-
2
votes2
answers1972
viewsA: Sending Link Information to a Modal
Add attributes of data-nome-do-atributo in the link as follows <a href="#my_modal" data-toggle="modal" data-id-pergunta="1234">Editar</a> and use bootstrap modal on show event…
-
3
votes4
answers2981
viewsA: SQL Query Joining 5 tables
Just use simple Joins between the tables next time, do as @Caffe said and add your attempts and show some effort, search the site, we have excellent questions about joins as for example, the @Bacco…
-
6
votes1
answer1111
viewsA: Android Sqlite data insertion
I don’t know much about Android itself, but considering database operations, the ideal would be to create the SQL of Insert with parameters like INSERT INTO Tabela (A, B, C) VALUES (:A, :B, :C);…
-
1
votes1
answer1173
viewsA: Openssl in Delphi 7
Translation of this answer of SO of shunty Here are some routines taken directly from some sources I’ve worked on. They use most of the encryption methods you mentioned. As mentioned in the…
-
7
votes3
answers1558
viewsA: Last folder of a directory
To avoid possible wrong results, I would do as follows program ConsoleTestApp; {$APPTYPE CONSOLE} {$R *.res} uses System.SysUtils; function ObterNomeUltimaPasta(path: string): string; var…
-
1
votes4
answers3097
viewsA: Path is file or directory (folder)
Following the @Bacco and @bfavaretto tip and taking advantage to pass a path to documentation, the correct would be the function: function isFolder(dir:string):boolean; begin Result :=…
-
7
votes2
answers511
viewsQ: Filters or Sort, which should be the first when creating an index in the database
Given, for example, the following Query: SELECT ClienteId, Nome, DataNascimento, Cidade, Estado, DataCadastro FROM Cliente WHERE Estado = :Estado AND Cidade = :Cidade ORDER BY DataCadastro,…
-
4
votes1
answer372
viewsA: Idhttp grab file size downloaded
You must request the HEAD operation with the file address var HttpClient: TIdHttp; FileSize: Int64; begin HttpClient := TIdHttp.Create(nil); try HttpClient.Head('http://somewhere.com/somefile.exe');…
-
1
votes2
answers60
viewsA: Illegal Loop + Expression in Valuator
Imagine that, so you declare the array: downloadedf : array of string; And then at that point, your array has Length 0 (Length(downloadedf) = 0) The function Length() is used to get the size, in a…
-
3
votes3
answers3133
viewsA: View Form with animation (gif) while a while runs
An easy way to make your form display the rotating image would be to use Sleep and ProcessMessages, otherwise would be through the use of Threads frmProgress.FormStyle := fsStayOnTop;…
-
14
votes1
answer4766
viewsA: What’s the difference in Refresh, Update, Repaint, Invalidate and Application.Processmessages methods?
Invalidate The method Invalidate only marks the component to be painted the next time the interface is updated. It does not re-draw the component at the time it was called. Update Method that…
-
3
votes1
answer876
viewsA: Encapsulate Tclientsocket connections in Multithreads
I will agree with @Pagenotfound that your question is very broad and awaiting a functional code. I can give you a few steps to guide. Follow an example using Generics, Annonymous Methods and an…
-
2
votes2
answers781
viewsA: How to perform more than one select for only two fields from another table
To bring only the fields you requested, you would stay SELECT CLI.Ficha, CLI.Snome FROM t_cadcontratos CON INNER JOIN t_cadclientes CLI ON CON.Ficha = CLI.Ficha WHERE CON.NumContrato = '$contrato'…
-
2
votes2
answers2519
viewsA: Thread containing connection components to the database generates an exception when they are released from memory
Sometimes objects they inherit from TComponent has a strange behavior if destroyed within Threads. To solve this type of problem, create a method to destroy the objects: procedure…
-
1
votes1
answer231
viewsA: Component or PDF Converter
Foxit provides a SDK for PDF editing and viewing as seen at this link This SDK allows, among other things, your requests Editing of PDF Documents Web rendering of Pdfs…
-
4
votes1
answer329
viewsA: What are the differences between sql commands?
There is a big difference between the commands you mentioned and there is no way to compare them. To help you understand each one, I will explain how they work. I will use these same entities with…
-
1
votes2
answers815
viewsQ: Can a worse cost query be a better performance query?
Context Here at the company we have a very complex query that encompasses several business rules, for presentation in a Workflow and for now I am evaluating it on Sqlserver. The performance of this…
-
4
votes2
answers1623
viewsA: What is the real concept and usefulness of POCO classes?
What is POCO? POCO (Plain Old CLR Object) as well as POJO (Plain Old Java Object) simply means an object that has no internal or external dependency. The term is used to identify an object as a…
-
1
votes3
answers2982
viewsA: Find out if a website is on or off
I’m no expert on the Web part, but I believe that if you run a Get at the address and return successfully, the address is "online" var urlValida = '/echo/html/'; var urlInvalida =…
-
11
votes6
answers1673
viewsA: Big job or small job?
I believe that function size is not the criterion, but rather an indicator. For example if we have a function ImprimeRelatorio for example that inside it rendenize, adjust the margins, read the user…