Posts by Marcelo Shiniti Uchimura • 3,302 points
208 posts
-
2
votes4
answers406
viewsA: Return the missing element from a list of integer numbers
See a program based on yours, with some changes: def faltantes(L): if L: # se L tem conteudo... elemento = L[0] # ...pego o primeiro elemento posicao = 1 # e aponto para o 2o elemento while posicao…
pythonanswered Marcelo Shiniti Uchimura 3,302 -
-2
votes3
answers137
viewsA: SQL Query - ORA-01795
Fool the Oracle. You can take every thousand and join the various Ins with Ors, since the Oracle does not let catch more than a thousand, const int qtde = 1000; var sql = "SELECT…
-
1
votes1
answer162
viewsA: SELECT Recursive (SQL)
Below is a proposal for consultation. The strategy in writing a recursive CTE is to start from an initial set of elements and, in the recursive step, to merge that initial set with the set of…
-
-2
votes1
answer71
viewsA: Group By select
Your table funcionario is not normalized because the field nome can repeat of value for different companies, for the same employee, nome | empresa Mário da Silva Sauro | Toaldo Túlio Ltda. Mário da…
-
-2
votes2
answers60
viewsA: Where are the syntax errors?
It’s not wrong, but there’s a difference between print out the answer and return the answer: print(destruir) return destruir The first command shows on the screen the contents of destruir and the…
-
0
votes1
answer37
viewsA: What is the difference between these string manipulations in C
The second excerpt won’t read blanks. Or rather, he will find that the blank space is the terminator of the scanf. If later on in the program there is one more scanf, what comes after the previous…
-
-1
votes1
answer115
viewsA: count amount of records in recent months
Try it like this: SELECT a.matricula FROM aeronave a JOIN aeronave_ocorrencia ao ON a.id_aeronave = ao.id_aeronave JOIN ocorrencia o ON ao.id_ocorrencia = o.id_ocorrencia WHERE o.data_utc >…
-
1
votes2
answers36
viewsA: Delete only if there is - in the word
Try it like this: DELETE FROM tabela WHERE CAST(data2 AS SIGNED) < 0 See the fiddle clicking here.…
-
-1
votes2
answers49
viewsA: Input cursor going to end of line with jQuery and propertychange
You were putting the event handler on id wrong. Instead of #form_cliente_id, should be #nomecliente: $(function () { $(document).on('change', '#nomecliente', function () { alert('Submitei o form com…
-
1
votes3
answers5809
viewsA: How to fix "Valueerror: invalid literal for int() with base 10: '' - Python?
In addition to the way suggested by @Imonferrari, you can operate on top of valorSaque, print(' ') print('-------------------------------------------------------------------------------------')…
-
0
votes1
answer148
viewsA: Inner Join returning duplicate lines
Relational databases return result set (resultsets) which, in turn, have tuples, which are ordered data in what is conventionally called lines or records. All lines have coordinates with origin and…
-
-2
votes2
answers74
viewsA: problem in sending php form data to Mysql database
Change this line: <button type="submit" name="SendCadCont">Enviar</button> for: <button type="submit" name="SendCadCont" value="1">Enviar</button>…
-
1
votes1
answer124
viewsA: How to take position 1 of the array and add?
On this line (which I will call line A.1), {breakfast.map((el, index) => <MenuButton onClick={()=>setOrder([...order,el[0],el[1]])} el={el} key={index}/>)} you are separating the product…
-
1
votes3
answers3023
viewsA: Compilation and execution error difference
Build error is the error that does not let you generate the executable or the library, so that you run/run it. Execution error is the one that, as the name says, only happens when the executable or…
-
-3
votes1
answer61
viewsA: Hello, good evening! I’m in need of help solving javascript array exercise. I’m Beginner, I appreciate all help
Why are you generating the matrix? It is not for the user to enter the matrices? (function () { function getValue(title) { return window.prompt(title); } function getMatrix(name, length,…
javascriptanswered Marcelo Shiniti Uchimura 3,302 -
-2
votes1
answer70
viewsA: Average between dates
WITH Consulta AS (SELECT PPT.prt_area AS "Área" , PPRO.cod_proposicao_tipo AS "ID do Subassunto" , PPRO.pro_processo AS "Número do Processo" ,…
sqlanswered Marcelo Shiniti Uchimura 3,302 -
-2
votes3
answers440
viewsA: Get the elements around a selected in the matrix
In order for the program to respect the example shown, in addition to sanitizing user inputs, the program can be done as follows: using System; using System.Collections.Generic; using System.Linq;…
-
-1
votes1
answer232
viewsA: Display input text inside a div
$(function() { var $exibirTexto = $("#exibir-texto"); $("#cores-texto").on("change", function () { var cor = $(this).children("option:selected").val(); …
-
0
votes2
answers36
viewsA: Consult related data without repetition
If you are concerned about repeating the CONTRACT lines, do so as follows: SELECT DISTINCT C.codigos, C.xyz, C.abc /*etc., com os campos de CONTRATO*/ FROM contrato C LEFT JOIN compromisso CP ON…
-
-3
votes1
answer48
viewsA: Query Problem C#/Postgres
Try putting the following in the Connection string: Encoding=UNICODE Vi here.…
-
-3
votes2
answers163
viewsA: Power in Java other than Excel
Try it like this: val result = Math.pow((1 + taxaDeJuros), 12.00) - 1
-
-2
votes1
answer92
viewsA: creating shopping affection using jquery
$('#cart button').on('click', function(e) { e.preventDefault(); let qtt = +$(this).siblings('.qtt').val(); let action = $(this).attr('data-action'); let…
-
-2
votes1
answer41
viewsA: Select works perfectly, but when it is passed as function returns error
Within count_rows(), at the beginning of the function, place: global $conn;
-
1
votes2
answers79
viewsA: SQL Do not display rows from a duplicate column
I don’t know exactly what you want to do with this query, because it’s not bringing duplicates but exactly what you typed in SQL. If you want to return only customers who have AT LEAST a contract…
-
0
votes2
answers227
viewsA: Remove "OR" condition from LINQ query
According to this source here, you can do LEFT OUTER Joins as follows: var ctx = new Context(); var query = from os in ctx.OrdensServico from c in ctx.TodosClientes.Where(w => os.CodigoCliente ==…
-
0
votes1
answer191
viewsA: Export from pandas to MS SQL using to_sql and sqlalchemy
Use locale: import locale locale.setlocale(locale.LC_ALL, str('en_US.UTF-8'))
-
3
votes1
answer247
viewsA: Convert SQL to LINQ
Check also on Ideone. using System; using System.Linq; namespace ConsoleApp1 { class Program { static void Main(string[] args) { var clientes = new[] { new { Id = 1, Email = "[email protected]", Nome…
-
1
votes1
answer387
viewsA: Bank Consuming all memory
Open SQL Management Studio, connect to the server that occupies all memory, with an administrator user. Right-click on the server in the Object Explorer window and select Properties. Adjust the…
-
1
votes1
answer114
viewsA: Relating distinct foreign keys in a column?
You have to have the following class organization: The Catalogobase class is ancestral to those you use as a foreign entity. It could have the following configuration: public class CatalogoBase {…
-
0
votes1
answer54
viewsA: How to use Join or Aggregate in SQL query
Why not do: numOrc = string.Join(";", t.numOrc) instead of: numOrc = t.numOrc.ToList().Aggregate((a, b) => a + ";" + b) ?
-
4
votes3
answers184
viewsA: Differences in the method call
These methods that apply an action to the object itself and return the modified object itself follow the project pattern called Builder. Example: // Podemos ter uma classe Pizza definida da seguinte…
c#answered Marcelo Shiniti Uchimura 3,302 -
2
votes2
answers96
viewsA: Readalltext returns Chinese characters
I don’t know how you extracted the text or in what format you used to parse the original file, but you can try to solve the problem by reading these "broken" files as binary reading files, removing…
c#answered Marcelo Shiniti Uchimura 3,302 -
2
votes2
answers117
viewsA: Help with SELECT for the Acuity exam
SELECT o.email, AVG(o.valor_total / o.quantidade_de_itens) ticket_medio FROM tbl_orders o JOIN tbl_itens_orders i ON i.id_pedido = o.id_pedido WHERE i.categoria = 'Sandália' AND o.data_compra =…
-
3
votes2
answers73
viewsA: Estimate variable of difficult isolation
Below is the algebra. razao2 = (razao1)^((idade2/idade1)^k) ln(razao2) = (idade2/idade1)^k * ln(razao1) ln(ln(razao2)) = k * ln(idade2/idade1) + ln(ln(razao1)) k = (ln(ln(razao2)) - ln(ln(razao1)))…
ranswered Marcelo Shiniti Uchimura 3,302 -
1
votes2
answers1212
viewsA: Add sold quantity of all SQL products
The field l.id_produto will appear for all rows of the result-set and, at the end, when the value of l.id_produto is null, the value of quant will be the general total. SELECT l.id_produto,…
-
5
votes3
answers931
viewsA: How to query with Count
See also on fiddle. SELECT nome_casa, COUNT(CASE WHEN resultado_final = 1 THEN 1 ELSE NULL END) / COUNT(*) AS percentual FROM Resultado WHERE nota_final BETWEEN 2.00 AND 2.20 GROUP BY nome_casa…
-
3
votes4
answers1423
viewsA: How to build custom queries using Entity Framework?
The .Where(this IEnumerable<T>, Predicate<T>) are loaded lazily, that is, they are not processed at the time of the declaration, but rather when the final consultation (the final result…
-
1
votes2
answers625
viewsA: Make Calculations in Sql Server Database
ALTER TABLE Produto ADD Lucro AS ((ValorVenda - ValorCompra) * Estoque);
sqlanswered Marcelo Shiniti Uchimura 3,302 -
1
votes1
answer128
viewsA: Do I want to show the birthday boy two days before or after the event?
This is Momesso, blz? See on fiddle. Switch down the date '2019-01-05' for now(). select q.id, q.niver from (select id, date(concat(year(now()), '/', month(aniversario), '/', day(aniversario))) as…
-
4
votes1
answer94
viewsA: Root with Indice - Javascript
Example below: var raizSetimaDe1_17 = Math.pow(1.17, 1.0 / 7); alert("O valor da raiz sétima de 1,17 é " + raizSetimaDe1_17);…
javascriptanswered Marcelo Shiniti Uchimura 3,302 -
1
votes1
answer50
viewsA: Lagrange interpolation - ERROR in [do while]
On the line int cont = 0; change to System.out.println("Digite o grau do polinômio"); int cont = sc.nextInt() + 1; int indice = 0; On the line System.out.println("Digite o valor de numero " + cont +…
javaanswered Marcelo Shiniti Uchimura 3,302 -
0
votes2
answers249
viewsA: Why does the window.open script not work with the "no" command?
As described here, just list the parameters to be enabled. That is, remove location and resizable.…
-
0
votes2
answers1131
viewsA: SQL QUERY using MAX function
Initial section of the consultation (common to the two excerpts below): SELECT ASS.Inscricao as numero_contrato, CONVERT (VARCHAR, ASS.data, 102) as data_contrato, ASS.grupo as id_tipo_contrato,…
-
2
votes2
answers67
viewsA: How to know if all Abels with numbers are filled
Based on @Vik’s reply, another possible LINQ to use: continuaWhile = !panel1.Controls .OfType<Label>() .All(label => label.BackColor == Color.Orange); and hence, in the while, will the…
c#answered Marcelo Shiniti Uchimura 3,302 -
-2
votes2
answers2210
viewsA: How to concatenate a char into a string?
Instead of strcpy(novo->simbolo, E); do: *novo->simbolo = E; *(novo->simbolo + 1) = 0;
-
1
votes2
answers58
viewsA: Doubt about the Context Class
In the case of an EF Database First, there is also a context, which is automatically generated and updated every time you update the EDMX template.
c#answered Marcelo Shiniti Uchimura 3,302 -
1
votes2
answers1495
viewsA: Take the values of all select options with jQuery
I gave an overview on his HTML, which was poorly formed: I was not closing the first <option/>, which is empty in your case. If it were not, it would be enough to delegate an attribute value…
-
1
votes1
answer29
viewsA: How to set a variable in the first call to a function, and keep this value in the second call on
You can create global variables curitiba and paranagua, as follows: curitiba = -1 paranagua = -1 def SetaConsulta(): #Essa consulta cria a lista dos processos com prazo e... .... Later on, before:…
-
1
votes2
answers113
viewsA: Split phone number that comes from an html file and split it in two
If landline and mobile phone numbers always come in the same order, the @Rafaelscheffer solution meets. If they come sometimes in mixed order, do so: public IEnumerable<string>…
c#answered Marcelo Shiniti Uchimura 3,302 -
1
votes1
answer241
viewsA: SQL Server - Monthly period comparison
SELECT q.*, CASE WHEN /*q.mes = 1 AND*/ q.valor >= 230.0 THEN 'ATIVO' WHEN /*q.mes = 3 AND*/ q.valor < 230.0 AND q.n_lojas = 1 THEN 'INATIVO' ELSE '-' END as status FROM ( SELECT nome,…
sql-serveranswered Marcelo Shiniti Uchimura 3,302