Posts by Marcos Regis • 1,693 points
60 posts
-
0
votes1
answer35
viewsA: Empty json_array attribute when persisting in BD
For those who have the same problem. I realized that the conversion of Arraycollection for json_array did not work as I expected and then I changed the code so that the attribute was filled only…
-
1
votes3
answers437
viewsA: Postgresql 8 - Replace the first occurrence of a character in a string
Directly in SQL for POSTGRESQL 8.1+ Use the function REGEXP_REPLACE Example for your case SELECT REGEXP_REPLACE('ALGUMA COISA - OUTRA COISA', '^([^-]*)-(.*?)', E'\\2|\\1', 'g'); -- Retorna OUTRA…
postgresqlanswered Marcos Regis 1,693 -
0
votes1
answer35
viewsQ: Empty json_array attribute when persisting in BD
Boas Galeri. I have a curious problem using Doctrinefixturesbundle. I have a class Application of the kind Entity Class that maps to the table system. In this class there is an attribute called…
-
0
votes2
answers336
viewsA: Install Startbootstrap-SB-Admin using Yarn
I ended up discovering the problem of not working with the sequence I was using. The current version of Startbootstrap-SB-Admin is already using Bootstrap 4 while bootstrap-Sass is still being…
-
0
votes2
answers336
viewsQ: Install Startbootstrap-SB-Admin using Yarn
I am creating a skeleton base for my applications and I intend to use Symfony 4 and Startbootstrap-SB-Admin. I already have a skeleton design using Symfony 3 and SB-Admin-2 and another with Silex.…
-
3
votes3
answers16306
viewsA: Validate Credit Card Number
The Algorithm used to calculate the verification digit (Check Digit) of Credit Card Numbers is the Algorithm of Luhn, but it is not enough just to validate the information without taking into…
-
0
votes4
answers684
viewsA: Variable interpolation in shell script that returns the output of a function
To do what you want, simply place the contents of the string you want to be executed inside severe accents ` #!/bin/bash print_date="date +[%d/%m/%Y0\x20%H:%M:%S]" # \x20 evita problemas de quebra…
-
4
votes6
answers1481
viewsA: Log system losing data, how to use Threads?
From what I can understand, your system must be running on more than one computer simultaneously. In such cases, trying to write file for more than one process results in data loss due to file lock.…
-
9
votes2
answers27855
viewsA: What do Rewritecond and Rewriterule mean in a . htaccess file?
Are guidelines for the module MOD_REWRITE. http://httpd.apache.org/docs/2.2/pt-br/mod/mod_rewrite.html As the httpd manual itself says: Rewritecond: The directive Rewritecond sets a condition for a…
-
0
votes1
answer1509
viewsA: Insert without specifying columns
No. Cannot INSERT without defining columns. When you use INSERT INTO tabela VALUES(a, b, c) you are implicitly saying that you will use ALL columns in the order in which they were created. But you…
-
2
votes2
answers725
viewsA: Working with directories to make a require in PHP
If you’re using PHP on a webserver, surely there’s a variable that tells the root of the application (or the site) and it’s from that information that you should use your paths. $_SERVER contains…
-
7
votes2
answers64
viewsA: how do I return two times using the COUNT(*) function
If the field is of a DATE/TIME type you can use MIN and MAX to return the lowest and highest value of a result group. SELECT COUNT(*) AS contador, MIN(hora_efetivada) as primeiro_horario,…
-
2
votes2
answers3602
viewsA: Store credentials from a Git repository on Windows without SSH
If you are msysgit on Windows 7 and don’t worry about having your password open in a file use this method. Open a command prompt and run: setx HOME %USERPROFILE% The variable %HOME% will be created…
-
1
votes3
answers1244
viewsA: How to make a NOT IN SQL?
You need to dismember queries to achieve the optimal result First pick up All the pilots who never used route X Ex.: SELECT pl.id FROM Piloto pl WHERE pl.id NOT IN ( SELECT pl2.id FROM Piloto pl2,…
sqlanswered Marcos Regis 1,693 -
2
votes1
answer355
viewsA: Saving UTF-8 Files on the Server Side
For the case, it is best to modify the code, avoiding special characters. You can use a simple substitution function like this that I’ve adapted from somewhere I can’t remember anymore function…
-
5
votes3
answers1009
viewsA: Encryption security in php
Information security is a much more complex issue than choosing this or that model. Security is always something connected to us humans. Passwords, for example, only need to exist to prevent that…
-
11
votes3
answers481
viewsA: Difference between location and internationalization
Basically, Internationalization is the translation of the software or system as it is for speak other languages, not taking into account the characteristics of the places of origin of these…
-
0
votes2
answers319
viewsA: Field Size Error when running Insert in Postgresql in Delphi application
After a long time of testing and research I found out why the problem was happening. I blindly believed that using the methods of Bind of lib ZEOS was the same as in other objects of other…
-
2
votes2
answers319
viewsQ: Field Size Error when running Insert in Postgresql in Delphi application
I have a problem that could only be happening on a Friday #13. I have an application in Delphi that controls SEDEX submissions and use the Postgresql database. In a given column, called sdx_cepnet,…
-
0
votes3
answers253
viewsA: Is it possible to modify a field before performing a search? (PHP MYSQL)
For something similar to what you want, MYSQL supports a type of search called FULL TEXT SEARCH that does a very different search from the common comparison.…
-
0
votes1
answer393
viewsA: Spool task for the server
Your problem seems to be just understanding how the sqlplus and the job action. When we connect to a remote server and run some commands, they are running locally and not remotely. If the server is…
-
1
votes3
answers4269
viewsA: Detect browser language and redirect
There is a very good translation plugin for Wordpress called Transposh. With it is possible: Dynamically translate any page of the site using Google, Bing, Yandex among others use an existing page…
-
3
votes1
answer3351
viewsA: MACRO in Excel - printing with sequential numbers
By your explanation I believe that instead of wearing a bow tie For be more suitable using a loop While Try with this example. Sub PrintJobs() Dim i As Long, startnum As Long, lastnum As Long…
-
3
votes2
answers168
viewsA: java desktop "ajax" exists?
Use a Timer to redo queries and/or connection and/or your Jtables; Something like import javax.swing.Timer; // (...) Timer timer = new Timer(0, new ActionListener() { @Override public void…
-
12
votes8
answers5012
viewsA: Printing a String until a space is found
One of the many ways is this $nome = 'João da Silva'; echo preg_replace("#^([^\s]*)\s.*?$#", "$1", $nome); // Exibe João $nome = 'José'; echo preg_replace("#^([^\s]*)\s.*?$#", "$1", $nome); // Exibe…
-
1
votes5
answers1057
viewsA: Problem with in_array()
There is an easy way to recursively search for a value in a multidimensional array that works in all versions of PHP 5. /** * @param $needle * @param $haystack * @param bool $strict * Função…
-
3
votes1
answer1776
viewsA: Importing a very large . sql file
There are some ways to import data into Mysql. Due to its necessity, and since it apparently has access to execute commands on a client capable of connecting to the server, I believe the following…
-
2
votes2
answers96
viewsA: Server instance restuful in Tomcat
If you have cron access to your cloud, a very common way to do what you want is to use a script Watchdog. It consists of checking from time to time if a service or program is running and if no runs…
-
1
votes2
answers986
viewsA: regular expression replacement - reference followed by number
For the question of entering a NOTHING can do like this pattern : ((?:))(\|C405\|\d+)\|\d replace : $2\13 Note that I used 1 for replace instead of $1. The Empty Grouping worked on all REGEX Engins…
regexanswered Marcos Regis 1,693 -
3
votes1
answer957
viewsA: Merge Excel cells via Delphi code
The class used does not allow the use of MERGE cells because it generates an XLS in Excel 2.1 format that does not have this feature. To be able to have merged cells it is necessary that the XLS is…
-
5
votes1
answer957
viewsQ: Merge Excel cells via Delphi code
I am updating an old system made in Delphi that uses a class to create an Excel file without the need to use OLE objects or have Excel installed. Class works normally using the code that is just…
-
1
votes1
answer1263
viewsA: Search only files that match part of the name in a directory
I was able to do what I wanted using Tsearchrec as follows. procedure TFrm.... var search : TSearchRec; // Unit SysUtils filename, dirname : String; seq, i : Integer; Begin // (...) if not…
delphianswered Marcos Regis 1,693 -
2
votes2
answers2710
viewsA: Take random value mysql
MYSQL’s RAND() Method supports SEED that forces it to generate a different random number for each SEED which will cause it to have a different order for each of them, but the same order for the same…
-
2
votes1
answer1263
viewsQ: Search only files that match part of the name in a directory
I have the following problem In a given directory I will need to create files that meet the following criteria. DOCUMENTO_DDMM_SEQ.txt Where Document : Any number that may or may not be repeated…
delphiasked Marcos Regis 1,693 -
0
votes1
answer59
viewsA: Convert Datetime to unixtime
You can use it like this public Long getInstant() { Date date = new Date(); return date.getTime(); } Note the type of data returned which in the case of getTime is a Long representing a Timestamp.…
-
1
votes4
answers802
viewsA: Incompatible types: Pwidechar and Tcaption
Use like this var wc : array[0..1024] of WideChar; path : String; begin // (...) Outros codigos path := Edit5.Text + 'teste.dll'; StringToWideChar(path, wc, Length(path)); LoadLibrary(wc); end;…
delphianswered Marcos Regis 1,693 -
1
votes2
answers170
viewsA: Undefined Index with Oracle connection
In addition to the solution already presented, there are also these: Force the return of columns with NULL values by stating this in $mode of any oci_fetch_* oci_fetch_array($stid,…
-
1
votes1
answer78
viewsA: How do I return the highest and lowest value within a loop by using Twig?
Try it like this {% set maxValue = 0 %} {% for product in produtos %} {% set maxValue = max(product.valor, maxValue) %} {% endfor %} {{ maxValue }}
twiganswered Marcos Regis 1,693 -
10
votes2
answers809
viewsA: What will the new logic of quantum computer programming look like?
The difference will not occur (at least for a considerable amount of time) in the coding of deadly nodes programmers. As we live in a physical and non-quantum world, our applications are most often…
-
2
votes2
answers96
viewsA: Pass random values to Matrix
To generate the random numbers you can use libs Math or Random. I prefer, by several aspects to use Random. the nextInt(int Limit) method generates an integer between 0 and less than or equal to the…
-
0
votes1
answer612
viewsA: Edit specific XML data with LOOP using form in PHP file
Follows a Code that should work for what you want. NOTE: Do not use special characters in code, whether PHP or XML. Special characters only for text to be read, otherwise avoid. Change your XML to…
-
2
votes1
answer160
viewsA: Infinite loop with data stream in PHP
By the tests the problem is in the character + It is deleted in the final code because it is not correctly escaped. A code that works here in your case is this: $Start = microtime(true);…
-
0
votes1
answer96
viewsA: Save status and contents of last clicked tab
You can use cookies for this. With jQuery you can make use of the plugin JQUERY COOKIE Place an onclik event to store information by clicking the tab. ex: jQuery.cookie("ABA", "1"); In the onload…
jqueryanswered Marcos Regis 1,693 -
2
votes3
answers76
viewsA: How to get only strings containing the word "x"
Substitute //apenas verifica se o link nao tem a string "comprar/toyota" if(strpos($string, 'comprar/toyota') == 1){ //nadafaz; }else{ //verifica se o link tem a string "comprar/toyota"…
-
1
votes2
answers1317
viewsA: PHP - If there is no content on the line do not display
Use this code if you just don’t want to display the image when the field is empty. <?php $query = "SELECT * FROM techloja ORDER BY RAND(), id DESC LIMIT 12"; $dados = mysql_query($query, $con) or…
phpanswered Marcos Regis 1,693 -
3
votes2
answers1047
viewsA: Validation Numeric(12,2) Postgres
A very common mistake when working with the guy numeric(precisão, escala) is to think that precision indicates how many digits will fit in the whole part. In fact, precision will indicate how many…
-
1
votes2
answers153
viewsA: Is it possible to use between to filter searches with a Character field?
I think that settles it for you MYSQL SELECT campos FROM tabela WHERE CAST(REPLACE( LEFT(TRIM(`carlis_nome`), LOCATE(' ', TRIM(`carlis_nome `))), '.','') AS SIGNED) BETWEEN 400 AND 1400; POSTGRES…
-
9
votes3
answers833
viewsA: With the ninth digit on the phones, how can I solve the problem of displaying 8-digit phones?
You can use this instruction UPDATE telefone SET celular = Replace (celular , '(31)', '(31)9') WHERE celular REGEXP '\\(*31\\)*9[[:alnum:]]{3}-*[[:alnum:]]{4}$'; thus avoids updating phone numbers…
-
1
votes4
answers9913
viewsA: Difference between prepare() and query()?
Prepare just prepares an instruction and returns a Resource called Prepared Statement, i.e., a pre-compiled SQL statement object that waits only to be executed. Query executes an instruction and…
-
0
votes2
answers634
viewsA: How to mark/deselect checkboxes per column using Jquery
There are several possible solutions. Here’s one of them using the data you left in the code <?php $cols = 4; // Quantidade de unidades por bloco ou por andar $rows = array(); // Gerando dados…