Posts by Cleber Griff • 668 points
35 posts
-
1
votes2
answers246
viewsA: How to read Mysql data with Python?
As Paul said, you will use the function rows = cursor.fetchall(), and from there just sweep the array rows as follows: for row in rows: print(row["id"])…
-
2
votes1
answer43
viewsQ: Problem with running order of endpoints in Express with conflicting paths
I have this question about endpoints express bred. In this first section, the endpoint /anuncios/:search must search in the fields descricao and nome by the text reported. Therefore, a call…
-
0
votes1
answer758
viewsA: IDHTTP with Delphi - HTTP request failed 401 HTTP/1.1 401 Unauthorized
Good morning, Marcelo! I saw that in the PHP call, you pass the token as parameter in the URL: /products/123?".http_build_query($params); On the Delphi call, you do not pass the Token in the URL.…
-
1
votes2
answers518
viewsA: Research Tmemo Delphi
The Memo.Lines.Text for such: if Pos('Nome', Memo1.Lines.Text) > 0 then ShowMessage('Achou') else ShowMessage('Não achou'); If you need to know the line number: var i: Integer; begin for i := 0…
delphianswered Cleber Griff 668 -
1
votes1
answer578
viewsA: ORDER BY or LIMIT. What is processed first in SQL Select?
In order to order and limit, SELECT will first need to know all the records, then order them and only then apply LIMIT. It would be impossible to apply a LIMIT with ORDER BY without first having the…
-
0
votes1
answer677
viewsA: How to Do Basic Type Authentication with Delphi XE8
Answering the main question, to send a BASIC authentication using Indy, can be used a function similar to the one below (example of GET): function Comunicar(url, token: String): Boolean; var…
-
1
votes1
answer2046
viewsA: Create bat to finish Service
Missed the p in the httpdPHP5 do . bat (is as httdPHP5)
-
4
votes2
answers947
viewsA: Counting weeks between two dates
It would be the function below? (published in the SO in English) SELECT FLOOR(DATEDIFF('2018-05-20', '2018-04-30'))/7; To get the rounded value, as requested in the comments: SELECT…
mysqlanswered Cleber Griff 668 -
1
votes2
answers668
viewsA: Assign values to a variable
In its main function, the argc represents the number of arguments being passed, while the argv is an array with each argument. In your example, by invoking ./exemplo 1 2, would be 3 arguments (argc…
-
1
votes1
answer774
viewsA: Print coil style on Rlreport
When I had to do that, I used this tip. Replicating: First go to Configure Page. (File > Page Settings) Select the Other Options tab (Other Options) Now check the option "Page Height Without End"…
-
2
votes2
answers1212
viewsA: Only catch the year of a column in Mysql
If you want to check individual, you can use WHERE YEAR(bidpack_buy_date) => YEAR(NOW()) or WHERE MONTH(bidpack_buy_date) => MONTH(NOW()) To check the date without the time, then: WHERE…
-
1
votes2
answers1204
viewsA: Problem with installing libraries in Delphi XE8
This error usually occurs when there are problems with installing Delphi. Check the Library Path (Tools > Options > Delphi Options > Library) to see if it has the default paths (they are in…
-
1
votes2
answers838
viewsA: Delphi herring values
I believe I can use the function System.Math.Setroundmode. According to the documentation, he can assume rmNearest, rmDown, rmUp or rmTruncate. The documentation gives an example here.…
-
2
votes1
answer799
viewsA: Read JSON with Delphi 6
You can use the json4delphi, that has the routines for Delphi 6 or higher. In the Github link there is an example of use, but I will replicate it here: var Json: TJson; Str: String begin Json :=…
-
3
votes1
answer2324
viewsQ: Popular Clientdataset with JSON truncates the data in 255 characters
I am trying to pass a JSON to a Tclientdataset using the following function: procedure JsonToDataset(aDataset : TDataSet; aJSON : string); var JObj: TJSONObject; JArr: TJSONArray; vConv :…
-
1
votes2
answers142
viewsA: Delphi does not write to txt file
Avoid creating empty Try-excepts. Problem information will probably appear if you change the except for: except on E: Exception do ShowMessage(E.Message); end; As for the problem, you may not be…
delphianswered Cleber Griff 668 -
2
votes1
answer88
viewsQ: Different variable value in sub-select
I have the following query: SET @VAR = 'N'; SELECT 'TESTE1','OI',@VAR := 'S' AS T UNION ALL SELECT 'TESTE2','OI',@VAR AS T UNION ALL SELECT * FROM ( SELECT 'TESTE3','OI',@VAR AS T ) AS TAB UNION ALL…
mysqlasked Cleber Griff 668 -
0
votes1
answer72
viewsA: mysqldump: Got error: 1054
I think the problem is that you did not specify the table in the command. mysqldump -u root -p senha -hlocalhost --opt -t [NOME_DA_TABELA] --where codemp=1 database > emp01.sql…
-
1
votes4
answers3002
viewsA: How to store Memo content in variable string in Delphi?
I usually use Memo1.Lines.Text
delphianswered Cleber Griff 668 -
1
votes1
answer336
viewsA: Mysql Auto-increment conditional on a table column
You cannot have an AUTOINCREMENT field with two equal values. A solution would be a query to get the next id of that tag SELECT MAX(codigo)+1 AS proximo_codigo WHERE marca = :IDMARCA…
-
0
votes2
answers391
viewsA: Error "1241 - Operand should contain 1 column" in Trigger that checks duplicities
You cannot make a nested SELECT with two columns. You must separate it into two SELECT: one for A.id_data and one for A.re. It’s like this: IF (NEW.id_dados and NEW.referente_obs) not in ( select…
-
2
votes2
answers259
viewsA: Consume web service
The webservice Viacep is what you seek. Example called by passing the zip code in the parameter: https://viacep.com.br/ws/88111500/json/ Answer: { "cep": "88111-500", "logradouro": "Rua Otto Júlio…
javaanswered Cleber Griff 668 -
1
votes1
answer1051
viewsA: Mysql error - phpmyadmin: Access denied!
I found a similar mistake in Stackoverflow in English He suggests changing localhost for 127.0.0.1 in the config.inc.php file (in XAMPP, this file must be in xampp/phpmyadmin/config.inc.php).…
-
0
votes2
answers672
viewsA: Allocation overflows memory in recursive function in C
Try the following code, taken from a response in Stackoverflow: main() { int Mb = 0; while ( malloc(1<<20)) ++Mb; printf("Allocated %d Mb total\n", Mb); } (Declare stdio and stdlib for this…
-
4
votes2
answers170
viewsA: Avoid duplication in Mysql
To avoid duplication, you must set the key you do not want to be duplicated as PRIMARY KEY. That is, if you don’t want two repeated id’s, the column id must be a PRIMARY KEY. This way, when you try…
-
1
votes2
answers282
viewsA: Almost prime numbers
Your problem is that in the first if condition is (controle == 2). Soon, he’ll always go in there and never get into the else if (controle == 2 && controle*controle == num) because if the…
-
1
votes0
answers51
viewsQ: How to copy the contents of a code Parameter hint?
In Delphi, when we press the combination CTRL+SHIFT+ESPAÇO after the parentheses of a function, the IDE brings a code Parameter hint, telling the fields that must be informed for that function. I…
-
0
votes1
answer1660
viewsA: How can I display a PDF from Delphi?
Acropdf (Acrobat Reader PDF Activex) allows this, but requires Acrobat Reader installed. In your case, the Free JPDF Pascal can help. Take a look at the Synopse PDF Engine and in the Gnostice…
-
3
votes1
answer65
viewsA: Free access to materials by subscribing to Youtube
According to this post of stackoverflow: Use the method subscriptions#list with the variable mine = true and the channel ID you want to check on forChannelId. If the logged-in user is not subscribed…
-
0
votes1
answer60
viewsA: select two tables using Where
The error presented: Warning: mysqli_fetch_array() expects Parameter 1 to be mysqli_result, Boolean Given Indicates some problem with the query. It may be a field with wrong name, or the id is being…
-
1
votes1
answer69
viewsA: Change date to business date (Mysql)
I think this might help your case: SELECT (SELECT IF ((DAY(CURDATE()) < 26), (SELECT STR_TO_DATE(CONCAT('26', '/', MONTH(DATE_SUB(CURDATE(), INTERVAL 1 MONTH)), '/', YEAR(DATE_SUB(CURDATE(),…
-
0
votes3
answers122
viewsA: Is authenticating users through a form with database connection safe with crackers?
It is a method that can be used, as long as you do not let the password traffic in full text through the network, or save it in the database. Ideally, when capturing the user’s password, encrypt it…
-
0
votes1
answer765
viewsA: Update in two MYSQL tables
You must make the INNER JOIN through the user ID, and make the changes you want. In the example below, I gave the nickname u to the table users, and i to the table users_info: UPDATE users u INNER…
-
0
votes1
answer2430
viewsA: Consume Webservice in SOAP with HTTPRIO in DELPHI
In my VTEX integration, I use as follows: var objProduto: ProductInsertUpdate; begin objProduto := ProductInsertUpdate.Create; objProduto.productVO := ProductDTO2.Create; with objProduto.productVO…
-
1
votes5
answers2275
viewsA: How to reduce the search time in a table with more than 200,000 records?
In addition to the suggestions of colleagues, there is a software that can assist in the analysis. The Neorprofile is free and helps me see all queries that pass to the database (like a tunneling).…