Posts by Marcelo Shiniti Uchimura • 3,302 points
208 posts
-
0
votes2
answers861
viewsA: Program in C, how to print the word without the character?
#include <stdio.h> #include <stdlib.h> int primeiraOcorrencia = 0; char* f; char* p; char* m; char* copiaF; char frase[160]; char…
-
1
votes2
answers45
viewsA: Print subtrings recursively
#include <stdio.h> #include <stdlib.h> char* substr(char* stringOriginal) { char *p; char *s; p = stringOriginal + 1; if (!*stringOriginal ||…
-
0
votes2
answers251
viewsA: Python code using HMAC library
If I’m right, this is how it works: # Comentários na linha de cima à linha comentada. import hashlib import hmac from math import ceil # As palavras vão ter 32 bytes. hash_len = 32 # Define um…
-
0
votes3
answers407
viewsA: Check if a string is composed of digits
int isDigit(char *string) { char *p; int firstDigit = 0; // A princípio, nenhum dígito foi encontrado. int lastDigit = 0; // A princípio, nenhum dígito foi encontrado. int result = 1; // A…
canswered Marcelo Shiniti Uchimura 3,302 -
4
votes1
answer61
viewsA: Capture with regex certain part of the string
Regex ^\/comprar\/([^\/]+)\/([^\/]+)\/\d+$. Then take the first and the second group. Tire ^ and $ if not just one occurrence per line.
regexanswered Marcelo Shiniti Uchimura 3,302 -
0
votes2
answers276
viewsA: Using a select with UNION or other mysql parameter
For Mysql versions >= 8.0, WITH RECURSIVE Q (rowid, data, fornecedor, credito, debito, saldo) AS ( SELECT C.id, C.data, C.fornecedor, HCRED.valor_pago as credito, HDEB.valor_pago as debito,…
-
1
votes1
answer276
viewsA: Invalid Date and Time on signature using A3 digital certificate in C#
Remember to add reference to System.Security: using System.IO; using System.Security.Cryptography.Pkcs; using System.Security.Cryptography.X509Certificates; namespace ConsoleApplication { class…
-
-2
votes2
answers220
viewsA: Standard implementations in C#interface
Classic: public interface IAnimal { double Peso { get; } double MaiorEstatura { get; } double Engorda(double ganhoDePeso); double Emagrece(double perdaDePeso); string EmissaoTipicaDeSom(); bool…
-
2
votes2
answers203
viewsA: Find the most frequent character in a text
#include <stdio.h> #include <stdlib.h> #include <string.h> int main(int argc, char* argv[]) { char texto[82]; char *p; int frequencia[256]; // São 256 caracteres ASCII. char…
canswered Marcelo Shiniti Uchimura 3,302 -
1
votes6
answers8998
viewsA: Sum of multiples of 3 or 5
The sum of multiple numbers of n is a sum of arithmetic progression with a ratio equal to n. One way to reduce complexity from O(n) to O(1) is to use a formula for this sum, soma_de_pa =…
javaanswered Marcelo Shiniti Uchimura 3,302 -
4
votes2
answers73
viewsA: Creating an array from two
In Java 8 on: import java.util.*; import java.util.stream.*; public class HelloWorld{ public static void main(String []args){ int[] a = new int[] { 1, 2, 3 }; int[] b = new int[] { 40, 50, 60 };…
-
0
votes1
answer27
viewsA: Class php mode extends
$p1 has nothing to do with $sis, because they are different objects, although they have hierarchy of classes. If you want the same number on $sis, shall allocate by means of cpf(), $sis = new manda;…
phpanswered Marcelo Shiniti Uchimura 3,302 -
0
votes1
answer60
viewsA: Compress a file saved in Database
From . NET Framework 4.5 Beta, it is possible to manipulate ZIP files. Example based in this: using System; using System.IO; using System.IO.Compression; using System.IO.Compression.FileSystem;…
-
4
votes1
answer106
viewsA: Only positive numbers in SUM aggregation
.... , SUM(CASE WHEN quota_re_mes1 > 0 THEN quota_re_mes1 ELSE 0 END) AS NO_MES ....
sql-serveranswered Marcelo Shiniti Uchimura 3,302 -
1
votes1
answer27
viewsA: Update div only when data is changed
var t; function temporiza() { t = setTimeout(function () { // Atualiza o DIV // Caso queira que o ciclo de temporização recomece, descomente abaixo. //temporiza(); }, 1000 /* aguarda 1000 ms */); }…
jqueryanswered Marcelo Shiniti Uchimura 3,302 -
0
votes2
answers167
viewsA: What’s wrong with this mysql data entry code?
In <form action="" method="POST" name="form"> fill in the value of action with the name of your PHP program; if your program is called php program., do <form action="programa.php"…
-
1
votes3
answers66
viewsA: By which means one can remove the dynamic cell inserted in the HTML table
delete is null is a clue; it may be that the id being passed on to removerLinha does not exist in the document, or is misspelled. See also that removerLinhas does not check whether what is being…
-
0
votes1
answer61
viewsA: Repeat interval
You don’t need so many clearInterval(verificar). It is sufficient that the iniciarVerificacao() never be called, or be called late, var verificar; (function iniciarVerificacao() { verificar =…
javascriptanswered Marcelo Shiniti Uchimura 3,302 -
1
votes1
answer577
viewsA: Query mysql with subquery Join
Just a little different from what you’ve done, SELECT v.cod_venda, COALESCE(notas.qnt_notas, 0) qnt_notas FROM vendas v LEFT JOIN (SELECT COUNT(num_nfe) qnt_notas, cod_venda FROM nfe WHERE status IN…
mysqlanswered Marcelo Shiniti Uchimura 3,302 -
2
votes1
answer375
viewsA: Hangman game problem in c
In the scope of main(), declare a variable that signals hit, int main(int argc, char* argv[]) { ... char acertouRodada = 0; ... } In this section, change: if (resposta[i] == letra) { printf("\nLetra…
canswered Marcelo Shiniti Uchimura 3,302 -
0
votes1
answer43
viewsA: Problems with SQL and cursor
Missing a semicolon in OPEN c_cursor; Take an example here.…
sqlanswered Marcelo Shiniti Uchimura 3,302 -
0
votes1
answer48
viewsA: Javascript array
If you want to add background-images in a vector that has colors, can do as follows: $.each(arrDados, function (i, o) { switch (o.color) { case '#fe4400': o['background-image'] =…
-
0
votes3
answers4692
viewsA: Unable to start Activity Componentinfo
Set default values in EditTexts. 0 is a good value. The moment you go parse the whole, do: a = Integer.parseInt("0" + edtA.getText().toString()); b = Integer.parseInt("0" +…
-
1
votes1
answer63
viewsA: Length and width calculation
If it’s a color image, I = imread("minhaImagem.png"); img = I(1); [width, height, colorDepth] = size(img); disp(width); disp(height) If it’s a monochromatic image, I = imread("minhaImagem.bmp"); img…
-
0
votes2
answers485
viewsA: Create a temporary table or run a 4 table Join with some more fields than others
Try this (it’s not even LEFT JOIN, it’s (INNER) JOIN): SELECT cis.tipoci, i.id, cis.numci, i.id_user, i.destino, i.assunto, i.dataci, i.intercambista, i.dataintercambio, i.turno, NULL AS…
mysqlanswered Marcelo Shiniti Uchimura 3,302 -
1
votes1
answer66
viewsA: Some test that this code does not pass
Why not use an ASCII-phone mapping table? int i; char lookup[256]; char linha[300]; // Inicializa lookup. for (i = 0; i < 256; ++i) { lookup[i] = 0; } // Inicializa os valores possíveis de…
-
1
votes1
answer45
viewsA: 2 calls to the same table in Sqlite (output different than expected)
If your database is Mysql, try the following: SELECT autor FROM sugestoes MINUS SELECT s.autor FROM sugestoes AS s INNER JOIN vertices AS v ON v.id_node_pai = s.id
-
1
votes1
answer64
viewsA: Read and split C files
Try this way: void lerFicheiroInput(){ struct informacaoFicheiroInput informacao[4]; FILE* file; file = fopen("input.txt","r"); if(file == NULL){ printf("Não foi possivel abrir o arquivo.\n"); }…
canswered Marcelo Shiniti Uchimura 3,302 -
-1
votes1
answer186
viewsA: What is a specific C function for?
Functions are key elements of the C language. This is what allows the language to be modular. Each function is composed of enunciation lines, which perform various operations or declare data…
-
0
votes1
answer145
viewsA: Unfold lines in a date range
WITH q (data_inicio, data_fim, data) AS ( SELECT a.data_inicio, a.data_fim, a.data_inicio AS data FROM CLI_INTERNAMENTOS_UTENTES a UNION ALL SELECT a.data_inicio, a.data_fim, DATEADD(day, 1, q.data)…
-
0
votes1
answer123
viewsA: Problem with socket C
As I had commented on the Stack Overflow in English, you have to put a Listener in the client, also, using another thread, #include <pthread.h> ... // protótipos int requisitaArq(); int…
-
0
votes2
answers183
viewsA: Instantiated object does not appear in function
If you declare class MinhaClasse { public void MinhaOperacao(int meuParametro) { if (meuParametro % 2 == 0) { JTextPane PEQuestion = new JTextPane(); } PEQuestion.setText("teste 1"); } } it will…
-
1
votes2
answers965
viewsA: WCF ERROR: Failed to add a service. Service Metadata may not be accessible. Make sure your service is running and exposing Metadata
What is the file name . svc? ServiceConfFisica.svc? You’re trying to open up http://localhost:xxxxx/Service.svc!
-
0
votes1
answer470
viewsA: Viewbag, passing controller value to Razor page
How about trying the following: var viewDataVariavel = ViewBag.idHorario; EDIT: I saw that you updated with JS, but I still have a question (sorry), $.ajax({ ... , success: function (data) { if…
-
1
votes6
answers12886
viewsA: Doubt about logical operators && e || in Java
https://en.wikipedia.org/wiki/De_Morgan's_laws If you observe, the block else harbors a message saying that Name cannot be empty. Soon, the block if should harbor a case that be the negation of the…
-
1
votes2
answers38
viewsA: Program with Warning and does not perform what was requested
inicializa would have to initialize; it’s not what you’re doing there! void inicializa(int* v) { int i; for (i = 0; i < 7; ++i) { v[i] = -1; } } Afterward, exibe would have to show the vector…
-
3
votes3
answers10868
viewsA: What is a racing condition?
When the defect occurs on the server, but it does not occur on the developer’s machine, or vice versa, and the environment settings are "equal" - of course, this is debatable - in both cases, this…
-
0
votes2
answers40
viewsA: Error executing function passed via parameter in javascript
The on() jQuery accumulates event handlers, that is, each time it is called to modalConfirmacao(), it will turn on the event handler again on click of the OK button. You would have to change the…
-
0
votes2
answers134
viewsA: REGEX - Small details that don’t match
Why don’t you facilitate the code by mounting more of a regular, simpler expression? To capture the question items, Dim patternQuestao = "[a-z]\)(.+?)\<br\s+\/\>" To capture the issue’s title,…
regexanswered Marcelo Shiniti Uchimura 3,302 -
1
votes1
answer1197
viewsA: How to do searches in txt files in C?
Maybe you wanted to use fwrite and fread to write and recover file data respectively. For example, to write data to file, which will now be binary, Register employees.dat: FUNCIONARIO…
canswered Marcelo Shiniti Uchimura 3,302 -
2
votes1
answer61
viewsA: How to improve this sql code?
You can use a CASE WHEN expression [boolean expression] THEN [express] END in the ORDER BY clause, to remove Ifs... Elses:…
-
0
votes1
answer32
viewsA: Basic report through SQL
I imagine that each row of this table has an answer to a question for one person (all 1:1:1), and that it is denormalized to (ID_PERGUNTA, QUESTION). If this is the case, your SQL query should look…
-
0
votes3
answers44
viewsA: Insert text from text boxes and read only after |
To write in the archive: System.IO.File.WriteAllLines("arquivo.txt", new string[] { string.Format("{0}|{1}", textbox1.ID, textbox1.Text), string.Format("{0}|{1}", textbox2.ID, textbox2.Text), }); To…
-
2
votes1
answer1364
viewsA: How to check if two vectors have equal values quickly
You can try to create a vector hash, for example char hash[0x7FFFFFFF]; if any positive integers are possible. Initialize the vector, for (int i = 0; i < 0x7FFFFFFF; ++i) { hash[i] = 0; } Itere…
-
1
votes3
answers120
viewsA: Property defined in constructor only returns zero value
In addition to the way @Virgilionovic demonstrated, there is another: the passing of the cost price per constructor with parameter, public Produto(double precoCusto) { PrecoCusto = precoCusto;…
-
0
votes1
answer997
viewsA: Method for harmonic media calculation!
The mean (arithmetic) is calculated as follows:, float media = 0.0; for (int i = 0; i < qtd; ++i) { media += historico[i]; } media /= qtd; For a count novaqtd = qtd + 1 and an earlier average…
-
0
votes2
answers255
viewsA: My program only runs the first if?
The case in which x, y and z are not part of a triangle: int func(float x, float y, float z) { int retorno = 0; // zero é o caso em que não é triângulo float somaxy = x + y; float somaxz = x + z;…
-
0
votes1
answer342
viewsA: How to read a positive n number in ascending and hexadecimal order?
In painel_quantidade_n(int), where it is painel_quantidade_n(n);, do return painel_quantidade_n(n);. Preferably, change the function signature to int painel_quantidade_n(void) In ordem_crescente(),…
canswered Marcelo Shiniti Uchimura 3,302 -
0
votes2
answers1330
viewsA: How to show the number that most appears in a vector in the C language?
Try this way: #include <stdio.h> #include <stdlib.h> int main(int argc, char* argv[]) { int balde[100]; //int* amostra; int x; int n; int i; int maiorBalde; // Esvazia os baldes. for (i…
canswered Marcelo Shiniti Uchimura 3,302 -
-2
votes5
answers1252
viewsA: What are the advantages and disadvantages of using pagination and infinite scroll on websites?
Using infinite scroll implies assuming that the client side has enough RAM and graphics card, which is not true if it is a mobile device. What I’ve seen from Facebook crashing on my Android is not…