Posts by Pedro Lorentz • 1,263 points
28 posts
-
0
votes1
answer69
viewsA: App Xamarin showing an hour in advance
I believe the problem may be the definition of the wrong Timezone on the devices. I’ve seen a similar problem in the past be solved with Timezone conversions. Can you test to see if it would solve…
-
0
votes1
answer588
viewsA: Send email to multiple people in php
If I’m not mistaken, I’d just put commas apart: $cabecalho .= " Bcc: [email protected], [email protected] n";
phpanswered Pedro Lorentz 1,263 -
2
votes3
answers2037
viewsA: Suspend function in Firebird
It seems to me, with a very quick Google search, suspend suspends the execution of a trial that is bringing a result table (result set) until the caller asks to bring the rest of the results.…
-
4
votes6
answers1170
viewsA: Why is it not possible to define an interface with static methods?
The interesting thing about interface is to be able to separate the implementation of the "contract" class that says what it has. That way, I can receive an object that I know implements the…
-
1
votes2
answers84
viewsA: Is there a LINQ method that returns a default value of my preference?
It is better to go through the enumeration only once: public static int? procurarIdPorCpf(string cpf) { using (Contexto context = new Contexto()) { var pessoa = context.pessoaFisica.FirstOrDefault(p…
-
8
votes2
answers10723
viewsA: Good practices when creating elements with jQuery
You should close the div: "To ensure cross-Platform Compatibility, the snippet must be well-Formed. Tags that can contain other Elements should be paired with a closing tag"…
jqueryanswered Pedro Lorentz 1,263 -
5
votes2
answers164
viewsA: What is the best type of column to record amount of time?
Hard to say a better one for all cases. If your event is guaranteed to last less than 24 hours you can use a column with the type time. If you can last longer, use timestamp. Postgresql has the…
-
1
votes2
answers306
viewsA: Foreign Key error when deleting a record
You can treat by error code, 574 in this case (by what I looked quickly here, test there): try { // seu comando... } catch (SqlException ex) { if (ex.Number == 574) { // Seu tratamento } throw; }…
-
7
votes1
answer1157
viewsA: ALTER TABLE causes auto_increment resequencing, Resulting in Duplicate entry '1' for key 'PRIMARY'
Are there any lines with a value of 0 or NULL in this field? If so, you will need to update them before to a value greater than zero. You can go back to 0 later if you want.
mysqlanswered Pedro Lorentz 1,263 -
4
votes3
answers43625
viewsA: Regular expression that accepts only numbers and/or letters in Java
Requiring at least one whole: Pattern p = Pattern.compile("^[A-Za-z0-9]*\d+[A-Za-z0-9]*$"); // ou ^[^\W_]*\d+[^\W_]*$ seguindo a ideia do mgibsonbr return p.matcher(textoDeTeste).matches(); You can…
-
1
votes1
answer39
viewsA: Change a relation between two mysql fields
I know from the comments that it is not what I wanted exactly, but I think the best solution is to run DROP and ADD manually. ALTER TABLE tbl_eventos DROP CONSTRAINT tbl_eventos_ibfk_3; ALTER TABLE…
-
1
votes1
answer375
viewsA: Help: Valuing a char vector of a struct within an if
If I am not mistaken, it is not possible to set the contents of an array directly like this, you have to set the contents of its positions. The function strcpy can help you: if…
-
1
votes2
answers1050
viewsA: Orphan records , checking in another table
That’s right. You don’t need the distinct, there is no reason to duplicate result (unless there is the possibility of having equal photos in this table with different ids, which is the problem of…
sql-serveranswered Pedro Lorentz 1,263 -
5
votes5
answers37379
viewsA: How to update with Oracle Inner Join
As far as I know there’s no Oracle, but you can do whatever you want with exists: UPDATE calculo_leituras_ucb SET calculo_leituras_ucb.idnaoleitura = 0 where exists ( select calculo_dados.iduc from…
-
2
votes1
answer89
viewsA: Service class layer BLL
Very extensive methods, in any layer, are bad. The best is to divide it into smaller, reusable methods, where each method is concerned with a specific part of the processing. The "submethods" need…
-
1
votes2
answers987
viewsA: Large database text or just a path to a txt(Mysql) file
It will depend a lot on what you need to do. A database can offer a number of services that can be useful, such as file content indexing, synchronized backup with other data from your application,…
-
3
votes1
answer276
viewsA: Conditional Excel formatting
You can make two separate conditional formatting rules: In your case, replace =$A$3<>1 and =$A$3=1 for =$D$4=$G$4 and =$D$4=$G$6…
excelanswered Pedro Lorentz 1,263 -
2
votes1
answer556
viewsA: How to sort by date when day, month and year are each in a column?
If the type of the columns is whole just make one ORDER BY ANO, MES, DIA. If it is in textual format, especially if you have mixed values with two or one digit, check the link that the user "lost"…
-
9
votes2
answers921
viewsA: What is the use of pointers?
One of the main uses of int **p is the construction of matrices. A pointer int *p can point to an array of integers (multiple integers at contiguous memory positions) and a "pointer to pointer" can…
c++answered Pedro Lorentz 1,263 -
5
votes2
answers1024
viewsA: Create links with a mysql table name and display its contents on another page. Is it possible?
There are some ways to get the table names, such as SHOW TABLES; or SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = 'NOME_DO_SCHEMA'; With this you can build a link like…
-
4
votes1
answer79
viewsA: How to set the input of a program in Windows?
The program to be executed must come first. < to redirect the default input stream (stdin) and > to redirect the output stream (stdout) (>> to add to the end of the file). To redirect…
windowsanswered Pedro Lorentz 1,263 -
1
votes2
answers234
viewsA: Input point location error in MYSQL
It may be the wrong version of the DLL or that you don’t think the correct version of it (maybe you have other reasons as well). Check out these two things. A dll is in c: windows system32?
mysqlanswered Pedro Lorentz 1,263 -
8
votes3
answers5650
viewsA: Regular expression to pick up the value after the comma
If what you want is simply to leave only the number in a capture group just take the comma out of the parentheses: ,([0-9]*) To ensure you have any number you can use the + instead of * (can use the…
regexanswered Pedro Lorentz 1,263 -
3
votes2
answers310
viewsA: Static Methods in Factory Method
Not being static you win in the "configuration" and the "exchange" of your factory. By setting, I mean you can change the value or call any method of the class SedanFactory before calling makeCar(),…
-
16
votes5
answers64148
viewsA: Difference between two dates in days, hours, minutes and seconds
DECLARE @antes DATETIME = '2013-11-29 11:30:40.157'; DECLARE @depois DATETIME = '2014-05-27 14:10:50.637'; SELECT CONVERT(VARCHAR, DATEDIFF(DAY, @antes, @depois)) + 'd ' + RIGHT('00' +…
-
0
votes5
answers6102
viewsA: How to create a view in mysql by taking data from 3 tables and repeating the different columns in the result?
Whereas he put "Mysql" as a tag for his question and spoke on "generate a single table by placing the columns with different names one next to the other, "you can use the natural joins that match…
-
0
votes2
answers375
viewsA: Join of SQL tables
You can put any condition for the junction to occur (in this case, the value of ITEM_REFNUM_QUAL_GID, in the ON of your LEFT JOIN: SELECT * FROM GTM_ITEM_CLASSIFICATION G LEFT JOIN ITEM_REFNUM R ON…
-
1
votes2
answers669
viewsA: Infinite Loop in Event
With infinite loop you mean that the Timer event is fired multiple times and you want it to be fired only one? In CheckTimeOut, it is defined that TimeOut.AutoReset = false; the Handler of Elapsed…