Posts by mercador • 2,786 points
91 posts
-
1
votes3
answers1019
viewsA: Return Notfound() Web Api c#
You can use this: return Content(HttpStatusCode.BadRequest, "Qualquer objeto");
-
4
votes3
answers11136
viewsA: Store data inside a Python loop array
Utilize range, together with the repeat loop for, to create a sequence within the range [0,4] and feed your list. Add an item at the end of the list by calling the method append. Use the repeat loop…
-
4
votes1
answer2152
viewsA: Call another class method
The class body may contain only statements by class members, such as fields interfaces methods instance initializers static initializers manufacturer’s declarations for the class To call some class…
-
1
votes3
answers68
viewsA: Shell: download and unpack in a row
You can use wget [link] && tar xvzf [nome_arquivo].tar.gz && rm [nome_arquivo].tar.gz
-
2
votes1
answer19
viewsA: Renaming a string in a structure vector
Use the function strcmp. Additionally, you need to use the function strcpy to make the assignment of the value GM. Both are defined in the header string.h for (j = 0; j < qtd; j++) { if…
-
3
votes2
answers1038
viewsA: How to omit parameters in the actual parameter passage?
The value default a parameter must appear in the function statement, since the statement is the only thing the caller sees. For example, if you put the statement in a header file, and the setting in…
-
3
votes1
answer42
viewsA: Check and change the first 3 characters of a string?
Use the method replace: final String telefone = "+5531984892883"; final String outroTelefone = "31984892883"; System.out.println("Telefone :" + telefone); System.out.println("Telefone sem o codigo…
-
2
votes1
answer249
viewsA: Expression to remove URL links from twitter tweet
Do this: import re linha = raw_input("Entre com o tweet: ") URLless_string = re.sub(r"http\S+", "", str(linha)) print(str(URLless_string)) http box with literal characters \S+ box with all…
-
1
votes1
answer442
viewsA: Structs vector for function
Modify the signature of your function to receive a vector of structures: int busca(struct cadastro evento[], int valor, int tamanho) Then modify the call of this function so that a vector of…
-
1
votes2
answers2300
viewsA: How to use command line parameters
Make use of the arguments argv and argc. argv and argc are how command line arguments are passed to main() in C and C++. argc will be the number of strings pointed out by argv. In practice, this…
-
5
votes4
answers362
viewsA: How do I skip the "Finally" block, in C#, when the exception is generated?
Quoting the MSDN Usually the instructions of a block finally are executed when the control leaves an instruction try. The transfer of control can occur as a result of the normal execution, of the…
-
0
votes1
answer367
viewsA: Grab file names and put in char array
The structure dirent is definite in dirent.h as struct dirent { long d_ino; /* Sempre zero. */ unsigned short d_reclen; /* Sempre sizeof struct dirent. */ unsigned short d_namlen; /* Tamanho do nome…
-
1
votes1
answer963
viewsA: Angular 2 - Changing Component Variable by Service Variable
Your component template uses the property step0, referencing the property of the same name of its component. In avancarStep1() in its component, do step0 receive the return of the method proxStep1()…
-
3
votes6
answers1851
viewsA: Interlink two strings into one vector
Some problems I noticed The comparison s3[i]%2 == 0 is wrong. To know if the position of the resulting string is even or odd do i % 2 == 0 s1[i] and s2[i] shouldn’t use i as an index. i is…
-
0
votes2
answers940
viewsA: Change command prompt properties in c
You can use color codes: #include <stdio.h> #define RED "\x1B[31m" #define GRN "\x1B[32m" #define YEL "\x1B[33m" #define BLU "\x1B[34m" #define MAG "\x1B[35m" #define CYN "\x1B[36m" #define…
-
2
votes4
answers4690
viewsA: Caesar cipher - problem with letters and spaces
You should write your parole differently if(frase[i] == 'x') frase[i] = 'A'; else if(frase[i] == 'y') frase[i] = 'B'; else if(frase[i] == 'z') frase[i] = 'C'; else frase[i] = frase[i] + 3; This way…
-
3
votes1
answer2788
viewsA: How to properly use memcpy?
You can use memcpy thus char vetor_copia[20] = { 0 }; // Inicializa o vetor com terminador null memcpy(vetor_copia, &vetor_origem[posicao_inicial], quantidade); // Copia os caracteres…
-
3
votes3
answers6393
viewsA: How do I make icone font awesome change the color to indicate the current page?
Since they are just fonts, you can style them as fonts: .fa-cog.corrente { color: white; } <link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css"…
-
7
votes2
answers145
viewsA: Long click with Javascript
You can use setTimeout() javascript. var timer; $("td").mouseup(function(){ clearTimeout(timer); // Limpa o timeout return false; }).mousedown(function(){ var elemento = this; // Seta o timeout…
-
1
votes1
answer32
viewsA: Can’t it be used as a function?
The error you are getting is due to the fact that you are using trocar as a function. Every time you open keys {}, you define a new local scope, where you can reset the symbols that exist in a…
-
0
votes1
answer58
viewsA: Set the Angular 2 component/app in the <body> tag
Define body as the root component selector of your application. Something like import { Component } from '@angular/core'; @Component({ selector: 'body', template: '<h1>{{mensagem}}</h1>'…
-
2
votes3
answers5789
viewsA: Check whether a date is valid in C or not?
For example, if the user enters the following value : Input : 20/03/2009 How can I break for you to stay, 20/, 03/ and 2009 separated so I can check? Function Use the functions below. strtok -…
-
2
votes1
answer70
viewsA: Arraylist does not display correctly
All Java objects have a method toString(), that is invoked when you try to print the object. System.out.println(a); // invoca a.toString() This method is defined in the class Object (the superclass…
-
1
votes1
answer39
viewsA: Can I give new in one class within another’s builder?
Yes, you can. The problem is that you are not specifying the type of data you want to allocate memory to. Assuming Trajetoi pedaco[7]; Supplement your code with the following pedaco[0] = new…
-
0
votes1
answer340
viewsA: Error using Python function input method
His method carregaTweets() returns a string list. Therefore, separa_palavras(tweet) receives a list of strings per parameter. You are trying to call split in the whole list, being that you can not…
-
0
votes1
answer99
viewsA: How to make variable receive function argument value?
When you try to access the member x of the struct p compiler needs to know what this struct looks like (for example, to check if there really is a member x in it). How did you not put the definition…
-
1
votes3
answers1705
viewsA: Insert video into HTML after 10 seconds using Javascript
Use the method setTimeout. function mostrar() { document.getElementById("newvideo").style.visibility = "visible"; }; setTimeout("mostrar()", 5000); // Depois de 5 segundos <div id="newvideo"…
-
5
votes1
answer77
viewsA: Basic doubt in Linkedlist - Java
Not. The method add has the signature public void add(int index, E element) where index is the index where the element will be inserted and element is the element to be inserted. Such a method casts…
-
1
votes3
answers351
views -
2
votes1
answer834
viewsA: how to reduce the size of the zip created with php
The algorithm zip is fixed. You cannot have a higher compression because the compression ratio depends mainly on the type of data being compressed. For example, you will have a very good compression…
-
1
votes4
answers1118
viewsA: Select input with a certain class within a form
Give a read on delegation of events, more specifically about event propagation, in official documentation from the jQuery library. Briefly: The delegation of events refers to the process of using…
-
1
votes2
answers630
viewsA: Remove double quotes in codeigniter query Builder
Use this line before your query (documentation here): $this->db->_protect_identifiers = false; For a global parameter in the file ./application/config/database.php (database configuration…
-
4
votes1
answer101
viewsA: Pass by reference printing garbage in the vector
void aumentar(int *vetor, int tam) In this capacity, int *vetor is a pointer passed by copy, and not by reference. It only receives the previously allocated memory value. This means that vetor in…
-
5
votes1
answer10220
viewsA: Generate random numbers in C?
See the function documentation srand() (in English). An example would be like this: #include <time.h> #include <stdlib.h> srand(time(NULL)); // Só deve ser chamada uma única vez int r =…
-
-1
votes1
answer393
viewsA: How to access an object attribute within a stack of Objects
You could do something like this: public void RemoveVeiculosAnoFabriMaior1999() { while (topo > 0) { Veiculo veiculo = (Veiculo) memo[topo]; if (veiculo.getAnoFabri() < 2000) break;…
-
0
votes2
answers880
viewsA: select name in bank with C#
Consultar expects a parameter of type DadosPessoa, being that you’re passing nome which is a string.
-
2
votes2
answers1382
viewsA: Options to generate API documentation in Laravel
Laravel API Documentation Generator: https://github.com/mpociot/laravel-apidoc-generator The repository on Github includes installation, how to use and possible settings that you might find…
-
1
votes1
answer298
viewsA: How to isolate CSS from a component?
One of the solutions proposed by the React documentation is the use of inline styles. Em React, inline styles are defined as an object JavaScript, whereas: To key is the version in camelCase of the…
-
2
votes2
answers239
viewsA: Changing Cell Color according to IF condition in C# WPF source code
Create an extension. For example, DataGridExtensions.cs: public static class DataGridExtensions { public static DataGridCell GetCell(this DataGrid grid, DataGridRow linha, int indiceColuna = 0) { if…
-
2
votes1
answer791
viewsA: Bootstrap-Notification does not open when clicking the bell
Add the class open the tag concerning the bell. <li class="dropdown dropdown-notifications open"> Next, it would be interesting to use Javascript to add and remove this class in the click…
-
2
votes1
answer244
viewsA: How to keep a fixed value within a recursive function?
It is not necessary to store the value passed for the first time. Instead, use a control variable to decide whether or not to print the first value. def fatorial(n, imprima=False): if imprima:…