Posts by Pilati • 1,065 points
52 posts
-
7
votes2
answers185
viewsA: Add 1 day to a date
To catch the right day just call the getDate again, take a look: var data = new Date(); var dia = data.getDate(); data.setDate(dia + 1); console.log (data.getDate());…
-
0
votes5
answers835
viewsA: How to put the operation (sum, multiplication) within a variable
The best way to solve your case is by using a case switch...: var resultado = 0 switch (operacao){ case '+': resultado = n1 + n2 break case '-': resultado = n1 - n2 break case '*': resultado = n1 *…
-
0
votes2
answers58
viewsA: Javascript function being called too early
The event can be used change if it is a select, for other html fields you should look for an event that indicates that the user has just filled in the field, such as events blur in text fields. Try…
-
0
votes2
answers460
viewsA: Take the 2 position of a string in an array
The split splits your string into two parts, as you only need the second part it is better to apply a substring that way: var link = 'https://www.devs.com/produto/chave1' var pagina = '/produto/'…
javascriptanswered Pilati 1,065 -
1
votes2
answers707
viewsA: Catch Value of input number
This is a limitation of the input itself. If you enter a value that can be considered ex.: 123e12 the $("[type=number]").val(); will return the correct value. If a "nonsense" number is typed ex.:…
-
0
votes1
answer59
viewsA: Insert a character in a specific point of a String
The code below solves your problem: $string = 'Nome Empresa 145241'; $pattern = '/(\w+) (\d+)/i'; $replacement = '${1}; $2'; $out = preg_replace($pattern, $replacement, $string); echo $out;…
-
3
votes1
answer97
viewsA: Doubt with While
To explain what happened I’ll omit some parts of the code, let’s just focus on that part: public class Exercicios3 { public static void main(String[] args) { Scanner sc = new Scanner(System.in);…
-
1
votes1
answer92
viewsA: How to use the values of a PHP variable in an external javascript script
Put it in a javascript variable that can be accessed in your code: <script> var array = [ <?php echo implode(",", $array); ?> ] </script>
-
1
votes2
answers613
viewsA: Align icons and text in a list
For this you should leave all icons with the same size, from a look at this class: .icon{ display: block; width: 15px; float: left; } <html> <head> <link…
-
0
votes1
answer65
viewsA: Conditions in Query SQL
Hello, this query solves your problem: SELECT fd.id, fd.nome, fd.cpf, fd.cursos FROM funcionariosdoc AS fd WHERE fd.cursos LIKE '%NR-35%' AND NOT EXISTS (SELECT 1 FROM funcionarioscursospdf AS fc…
-
1
votes1
answer149
viewsQ: search object list in Entity [LINQ]
I have a list of objects and would like to search 2 properties of that list in the database. with a list of primitive types I would do so: (from n in db.Tabela where…
-
1
votes1
answer230
viewsQ: Bug using :Hover and click on Chrome
I’m fixing an issue that I was able to simulate only on Chrome. After clicking several times on the items, the menu closes for no reason. Follow the code: (I could not paste formatted because it…
-
2
votes3
answers345
viewsA: An array index error
Well, that means you’re trying to get the element that’s in the index "-1", but it doesn’t exist What’s going on: In this line Arrays.asList(vet).indexOf(menor); the indexOf is not finding the…
-
3
votes1
answer62
viewsA: Problems with dynamic matrix allocation
To solve the Warning compile change its function to be done this way: int **m_malloc(size_t rows, size_t columns){ int **mat = malloc(sizeof(int*)*rows); for(size_t i=0; i<rows; i++){…
-
4
votes0
answers61
viewsQ: Update problem of an Updatepanel
I have a page that contains several graphs. We use Google Maps to create them. The graphs are organized in dashboards. Page description: On the page contains a UpdatePanel responsible for dashboard…
-
1
votes1
answer28
viewsA: Discover executed event
Does not open twice the icon by double clicking? Try to change your functions to that way: var carregando = false; $("button[data-noPreload!='true'][type='submit']").click(openPreloading); function…
-
1
votes1
answer591
viewsQ: Horizontal sliding menu
I’m setting up an E-commerce where the main menu contains all the main product categories. When Admin registers many categories the menu is broken into two lines. The customer asked you to keep all…
-
2
votes2
answers74
viewsQ: Color adjustment of text on different themes
Work on maintaining a system that could only be displayed with the white background, and we recently adopted the possibility for the user to choose the dark background. Some text fields are saved…
-
1
votes1
answer137
viewsQ: Nhibernate Querysyntaxexception
I am trying to return the amount of objects that a query will return. If I execute the following command: query.ToList().Count The value is returned successfully, but I execute the following…
-
2
votes4
answers121
viewsA: Should I use two IF’s or an operator?
The two checks are valid, but if there is a need to divide an if into two the best is to abstract in a function. If the verification is simple: if( A< X || B < X ) instrução.... endif But if…
-
0
votes1
answer41
viewsQ: Effect appear without creating scroll bar
Is it possible to create the effect below without the browser creating scrollbars? (IE10 +) function trocaEfeito(){ document.querySelector('.efeito').classList.toggle('ativo') } *{ height: 100%;…
-
3
votes4
answers355
viewsQ: Edge at intersection between 2 elements - CSS
I am creating the following menu: but I’m not getting to create this edge: How can I create it with CSS? .m{ position: fixed; top: 0; left: 0; height: 100%; width: 100%; background: #aaa; } .a{…
-
1
votes2
answers318
viewsQ: "fixed" footer at the bottom of the page, but after the content
I currently have the following code: html, body, .content{ height:100%; } nav { height: 15%; background-color: red; } footer { position: fixed; bottom: 0; width: 100%; background-color:…
-
1
votes1
answer315
viewsQ: Optimization in SVG image loading
I’m creating a site that contains several SVG images. I’ve tried creating a Sprite with some images and embedding them directly into CSS (background-image). After searching for several days I could…
-
1
votes0
answers24
viewsQ: Storing values in Javascript elements - Good practices
I wonder if it is good practice to store values directly in the elements so you don’t need to calculate again. For example: function scrollfunc(e){ var el = e.currentTarget; var deltaY = (el.deltaY…
javascriptasked Pilati 1,065 -
0
votes1
answer58
viewsQ: Fade effect on text when scrolling page
I would like to apply an effect when scrolling the text of a div, similar to the effect below (which I stole from a website): PS: Run as fullscreen; body { background: #f8fafc; font-size: 20px;…
-
0
votes2
answers53
viewsA: Limit the number of uses of a function
One way to do it would be to limit the amount of attribute points a person can use, note the variable limiteAtributos in the code below: var personagem = new Object; personagem.carisma = 1;…
javascriptanswered Pilati 1,065 -
0
votes2
answers174
viewsQ: Smoothing animation in JS
I am creating an application based on Vue.js. This application should contain some elements that are animated according to the mouse. I created the animations in javascript and you can see that the…
-
4
votes1
answer48
viewsA: Code in C simply closes
Your code is returning one segmentation fault in the vector reading. Follow the function documentation: int scanf ( const char * format, ... ); Reads data from stdin and Stores them According to the…
-
2
votes1
answer71
viewsQ: Sprite in SVG for Internet explorer
I read an article that explained how to put several SVG images in a single file. The final file looked like this: <?xml version="1.0" encoding="UTF-8"?> <svg version="1.1"…
-
0
votes2
answers124
viewsQ: Point in CSS below image
I have an image carousel. Each image is a svg logo of fixed height and variable width. I need to place a point below each selected image, so I used the following code: CSS: footer…
-
2
votes1
answer687
views -
0
votes1
answer2444
viewsQ: Align elements horizontally - Bootstrap 4
I’m creating a responsive menu that contains 3 parts: company logo, links to large devices, menu icon for small devices. I would like mobile devices to align the logo in the center and the menu icon…
bootstrap-4asked Pilati 1,065 -
1
votes1
answer338
viewsQ: Scroll bar in incorrect position - Datagridview
I am trying to select the last line in a Datagridview after including a new item. For this I am running the following code: dgwVenda.ClearSelection() dgwVenda.Rows(dgwVenda.Rows.Count - 1).Selected…
-
-1
votes4
answers949
viewsA: Day and month comparison on SQL Server
We found that the problem was the day 29 February registered on the date of birth of some customers. As the year 1900 is not a leap year gave error when converting 29/02/1900 to date. So the filter…
-
1
votes4
answers949
viewsQ: Day and month comparison on SQL Server
I need to filter a query of every client who has a birthday between two informed dates. How can I make a comparison of dates disregarding the year registered with the client? The current…
-
1
votes4
answers95
viewsQ: Optimization in sql
Considering these two tables in the database: Product Table: | id | nome | |-----|-----------| | aaa | Produto A | | bbb | Produto B | | ccc | Produto C | Attributes Table: | id_produto | atributo |…
-
3
votes3
answers2181
views -
9
votes2
answers2251
viewsA: Sizeof() or strlen()?
sizeof() returns the number of bytes of the complete string. strlen() returns the number of characters of this string When executing the code below: #include <stdio.h> #include…
-
2
votes4
answers118
viewsA: select dinamico
Se eu entendi certo da para fazer por esse SQL: select * from tabela where ( nome_campo = 'campo_1' AND valor = 9 ) OR ( nome_campo = 'campo_2' AND valor = 10 );…
-
1
votes2
answers117
viewsA: How do I use free() and return the same content?
My opinion is that you should modify the function so you don’t need to use the free() Follow a suggestion on how to do this: char* MemCpyX(char *as_origem, char *ls_retorno, int an_inicio, int…
-
1
votes2
answers69
viewsA: How should these variables end correctly without having a chance of memory Leak?
Traverse the entire array by releasing memory for each active element. How is declaring a fixed size for the variable should be done more or less like this: int i; for(i=0; i<200; i++){…
-
3
votes1
answer1285
viewsA: Open files by passing variable as file name
I rebuilt it to read files the way I normally do. Follow the code below: #include <iostream> #include <fstream> using namespace std; int main () { ifstream myfile ("x.txt",…
-
6
votes1
answer71
viewsA: How to call an object within the creation of another object
It is possible to create the direct date in the command, according to the code below: Pessoa p = new Pessoa("Miguel", "Rua D. Maria", "7400604", new Data(0, 0, 0), "Solteiro"); Or create this date…
-
2
votes3
answers6206
viewsA: How to set a Struct as NULL in C?
Unable to set a struct with NULL as declared. Fila f = NUll; error: invalid initializer. If you want to assign NULL to a struct you must declare it as a pointer: Fila * PPFila = NULL, * AUTFila =…
-
2
votes1
answer274
viewsA: Update column with sort items
Hello, For this it is necessary to run the following sql: MERGE INTO user_log t2 using (select log_id, rownum n from user_log order by created_date) t1 on (t1.log_id = t2.log_id) WHEN MATCHED THEN…
-
6
votes3
answers154
viewsQ: Doubt Normalizer + Regex
Could someone explain me the code below? returnStr = Normalizer.normalize(returnStr, Normalizer.Form.NFD) .replaceAll("[^\\p{ASCII}]", ""); returnStr has as initial value a url.…
-
0
votes1
answer63
viewsQ: jquery prepend moving page
I have a div that contains several lists (uls) of a box, in each box has an image and a description. I am implementing an infinite bearing upward as follows: The user accesses a specific page (ex…
-
2
votes3
answers307
viewsA: Is there a difference in performance between "echo" content and HTML content?
About page loading: does not change, what changes is on the server. echo can slightly impact the rendering, as it will execute an instruction that it would not need (I don’t know how php treats it).…
-
5
votes2
answers181
viewsA: Why in PHP string can turn function?
the same works with variable variables, the name is kind of strange, but exists as in the example below: $vara = "c"; $varb = "vara"; echo $$varb; c This happens because one can use the value of a…