Posts by Diego Marques • 3,701 points
159 posts
-
3
votes1
answer210
viewsA: Doubt - Clear img function with javascript does not work
Probably your tag button is performing her default action in addition to the event onclick, which is probably the Submit in a form. To avoid this, you can specify the type of button: <button…
-
5
votes2
answers16823
viewsA: What is the logic for calculating the percentage of victory, draw and defeat?
To calculate the percentage in this case, with 3 elements, you calculate the difference of the item you are looking for in relation to the total sum. Ex: 3 victories 4 defeats 1 draw To know the %…
-
1
votes2
answers131
viewsA: How do I get compound domain names?
This is not possible in an easy, native or automated way because to create this type of algorithm you need to define patterns for the code to follow. And since it’s a given name, the amount of…
phpanswered Diego Marques 3,701 -
9
votes1
answer2872
viewsA: What does " :: " mean in PHP?
These four dots mean that you are calling a static method a class. A static method can be called without the need to instantiate a class object. Ex: Class teste() { public function…
-
1
votes1
answer709
viewsA: Validation of input type date dates with jquery
The object Date can be used with operators >, <, <= or >=. Already operators ==, != , === and !== require you to use date.getTime(). Follow your set code, and you can read more about the…
jqueryanswered Diego Marques 3,701 -
0
votes1
answer25
viewsA: First Child is not selected
The problem is that you add the class on the line: $('ul.slider li:first-child').addClass('slider-active'); But right away, you run Ajax and rebuild Slider’s html, thus replacing what you just did:…
-
1
votes1
answer45
viewsA: Javascript code
Here’s an example of how you can do this Javascript: var divs = document.querySelectorAll('.texto') for(var i=0; i<divs.length; i++) { divs[i].addEventListener('click', function() {…
javascriptanswered Diego Marques 3,701 -
0
votes2
answers1235
viewsA: Edit table elements
Using javascript only, it is possible to do and edit in the yes cell, follow an example: function saveNew() { var $tr = document.createElement('tr'); $tr.appendChild(createCell('nome'));…
-
1
votes2
answers248
viewsA: Hide and show using javascript
I believe that what you want to do is, when passing the mouse in the image is displayed the figcaption. For this, you can solve only with css encapsulating everything in the tag figure and putting a…
-
2
votes1
answer639
viewsA: Take the value of a table row
Answering your question, you can pick up the line yes, instead of searching for all inputs, looking for a common ancestor, in case the tr, and then search for inputs from this ancestor. It follows…
jqueryanswered Diego Marques 3,701 -
1
votes3
answers144
viewsA: How to get the name of the site?
Follow an example of regex in Javascript: var urls = [ 'https://www.google.com', 'https://www.facebook.com', 'https://www.youtube.com', 'https://www.twitter.com' ]; var $saida =…
phpanswered Diego Marques 3,701 -
2
votes1
answer1654
viewsA: Send null date if not filled in
You need to concatenate the quotes (') with the date, so that in the else can send null. Here’s an example based on your code: $data_saida = $this->post('data_saida'); //aqui pega a data se não…
-
1
votes2
answers263
viewsA: How to enter data with JSON and MVC5
Hello, By your question, your difficulty is in assembling this front-end, so follow an example below: $(document).ready(function () { $("#btnAddEmail").click(function () { $("#tblEmails…
-
4
votes1
answer1105
viewsA: Split array with comma?
In your case I believe the function implode of PHP already resolves: string implode ( string $glue , array $pieces ) Example: <?php $array = array('php', 'python', 'javascript');…
phpanswered Diego Marques 3,701 -
1
votes2
answers49
viewsA: Update table field with information from another column
Hello, Just do the update by referencing one column to another, example: UPDATE vendas SET dataPgto = dataVenda; Follow a fiddle with practical example:…
-
2
votes1
answer2019
viewsA: Automatic backup with Mysql
Hello, I did an automation of this by creating a file. bat with the commands and configuring the execution in the Windows Task Scheduler, follows below my bat file: @echo off cls REM Define o…
-
1
votes1
answer534
viewsA: How to take the current font size in css and increase
Hello, There are several ways to do this, one of them is using the pseudo-selector focus. Below are two examples, one increasing with scale and another with font-size: #bt-1:focus { transform:…
-
1
votes2
answers85
viewsA: Wordpress theme 'Minamaze' was not responsive when active
Hello, Analyzing the CSS of the page reported on the link, it doesn’t really seem to be ready for the responsive. I identified it in the file style.css theme, line 149 which has a statement that…
-
1
votes2
answers221
viewsA: Meter with percentage
If you want something fast just to display the information, you can use the Gauge Chart of Google Chart, which generates exactly this type of meter. Follow an example: google.charts.load('current',…
-
0
votes2
answers35
viewsA: Sending e-mail by Cdosysmail
It is really not recommended to put the from like any email, and servers generally only allow emails from the domain itself because of SPAM. But an alternative to this is the use of Reply-To. With…
-
1
votes1
answer67
viewsA: Using the setInterval
You can update the div with the innerHTML within the setInterval. Follow an example: setInterval(function() { document.getElementById("relogio").innerHTML = new Date(); }, 1000); <div…
javascriptanswered Diego Marques 3,701 -
1
votes2
answers1402
viewsA: What does ">" mean in CSS selectors?
This dial means: Select all elements with the class .user-panel, then select all direct children with the class .image, then select all direct children who are the tag img. That is to say:…
-
2
votes1
answer33
viewsA: In mysql it is possible to create an extra line if 2 or more lines are equal
Hello, You need to group the columns by the game title, in this case just use the GROUP BY together with the GROUP_CONCAT. Ex: SELECT titulo, GROUP_CONCAT(plataforma SEPARATOR ', ') AS plataforma,…
mysqlanswered Diego Marques 3,701 -
1
votes2
answers6724
viewsA: How to put Font-Awesome icon on a boot?
Hello, You can tag it if it’s a tag <button>, that has the same behavior as input. Ex: <button type="submit"><i class="fa fa-plus"></i> Cadastrar</button>…
htmlanswered Diego Marques 3,701 -
3
votes2
answers1065
viewsA: How to confirm that the request was made through the website securely
Hello, It is not possible to create a system that guarantees 100% that the request was made from a page of your site, because technically no request is made "from your site" while the user is…
-
1
votes3
answers4990
viewsA: Validate size, size and file type in Upload
Hello, For this validation there is a new W3C feature that is supported by modern browsers, which is the File API. This resource can be used for this purpose. Below is an example: function…
-
2
votes1
answer104
viewsA: Search in multiple tables
Hello, In this case you can use the clause UNION, that together two or more results in one, follows an example: SELECT * FROM ( SELECT 'animes' AS tabela, id, nome, url, imagem, status, null AS…
-
0
votes3
answers559
viewsA: Document protocol
Another approach using only the database, would be to look for the highest protocol value within the current year and add one more. Follow an example: INSERT tabela ( protocolo, ...campos... )…
-
2
votes1
answer60
viewsA: Display original text with line breaks inside <a> tag
The problem occurs that line breaks in the text are not rendered as line breaks in html, for this there is the tag <br>. What you need to do is convert the line breaks of the variable $value…
-
0
votes1
answer85
viewsA: HTML/JS text field for date does not work in Firefox
This function is not really compatible with Firefox. For this action, you can use the event.preventDefault() or simply return false to Function (return false). Your changed code: <html>…
-
1
votes0
answers54
viewsQ: Why (0.0015 * 3) == 0.0045 does not return true?
Hello, Because the comparison (0.0015 * 3) == 0.0045 in javascript does not return true? Ex.: var valor1 = 0.0015 * 3; var valor2 = 0.0045; if(valor1 == valor2) { console.log('Igual'); } else {…
javascriptasked Diego Marques 3,701 -
1
votes2
answers207
viewsA: Show a dialog with jQuery?
Hello, Every jQuery call returns a collection of objects, even if the search is for ID that must always return 1 element, it will return a collection of 1 jQuery element. Your first example…
-
0
votes6
answers2500
viewsA: Hover on DIV1 change DIV2 with CSS
Hello, Currently it is not possible to select the parent of an element via CSS. All selectors currently available are in specifications: CSS3 selectors CSS2 selectors For now, this behavior is only…
-
2
votes1
answer133
viewsA: Why is this replace wrong?
Hello, Probably some value is being passed that is not String, in this case, to prevent, convert the text parameter to string: var cleanText = String(text).replace("R$",""); So you guarantee it will…
javascriptanswered Diego Marques 3,701 -
1
votes1
answer34
viewsA: Javascript snippet does not work
Your JS function is without syntax flaws, so the problem is probably in the call. Analyzing by what you put above: Your code: onclick="guardaIdSplit({{$e->id.":".$e->name}})" Must render:…
-
1
votes2
answers74
viewsA: Checking column fill with CHECK
Hello, In your case, I know a solution with TRIGGER, follows below an example: CREATE TABLE foo ( FieldA INT, FieldB INT ); DELIMITER // CREATE TRIGGER InsertFieldABNotNull BEFORE INSERT ON foo FOR…
-
2
votes1
answer94
viewsA: Free tool for application wireframe
I really like Draw.IO very much: https://www.draw.io/ It is very generic and flexible, it is perfect for making wireframes and prototypes of apps, including creating several pages and including…
-
1
votes2
answers526
viewsA: Update balance with revenue and expense
In this case you can work with TRIGGERS, which are triggers configured in a table, which execute a query whenever a record is inserted, updated or deleted. Documentation:…
-
1
votes4
answers216
viewsA: Create links with tags registered in the database
If this field will always be in this pattern, you can do it in mysql with CONCAT and REPLACE, e.g.: SELECT -- Aqui você substitui o x.nomes pela sua tabela.campo CONCAT('<a href="#">' ,…
-
0
votes1
answer835
viewsA: How to show only a result of a specific column [MSSQL]
In this case, you need to use the GROUP BY clause, which groups the result by a parameterization The rules may change depending on your SGBP, but in general terms it would look like this: select…
sql-serveranswered Diego Marques 3,701 -
0
votes2
answers80
viewsA: Doubt select in two tables
Another solution, using CASE instead of sub-select: SELECT g.nome_gaveta, GROUP_CONCAT(( CASE o.nome_objeto WHEN 'Caneta' THEN CONCAT(o.nome_objeto, ' - Encontrado') ELSE o.nome_objeto END )…
-
2
votes1
answer416
viewsA: Show JSON result via Ajax
Hello, From what I’ve analyzed and what you put in the comment, your function is probably syntax-deficient. It seems that in the property "headers", the sub-property "content-type" and its value are…
-
2
votes2
answers501
viewsA: Calculate PHP hour percentage
One solution would be this: // Array com os horários $array = array('04:45', '01:30', '00:45'); // Array que será armazenado as porcentagens $porc = array(); // Total em mintuos $total = 0; // Varre…
phpanswered Diego Marques 3,701 -
1
votes1
answer935
viewsA: Import Excel to mysql in php
If the excel file is in the same php file folder, you can use: $caminho = dirname(__FILE__) . '/nome_do_arquivo.xslx'; If it is in another folder, just put the relative path inside the string. Ex:…
phpanswered Diego Marques 3,701 -
3
votes2
answers53
viewsA: js function to hide and show independent Ivs
Follows a solution with generic function and jQuery: $('[data-target]').on('click', function(e) { // Evitar o click padrão do botão (href) e.preventDefault(); // Esconde todos slides visíveis…
-
1
votes2
answers1027
viewsA: Change the body color with each click
Another idea would be to generate a totally random color: function mudarCor(){ document.getElementById('trocar').style.backgroundColor = '#'+Math.floor(Math.random()*16777215).toString(16); }…
javascriptanswered Diego Marques 3,701 -
0
votes3
answers671
viewsA: Select that respects all values in a list
I believe the solution you need is this: SELECT mp1.* FROM MRL_PRODUTOEMPRESA AS mp1 WHERE mp1.SEQPRODUTO = 30733 GROUP BY mp1.SEQPRODUTO HAVING COUNT(*) = ( SELECT COUNT(*) FROM MRL_PRODUTOEMPRESA…
-
0
votes3
answers110
viewsA: Javascript - How to make the date attribute of a li belong to another li
Here is an example of checking the response by searching for the value with comparison via regular expression due to the fact that it may contain several responses: // Monta o Select para checar a…
javascriptanswered Diego Marques 3,701 -
0
votes1
answer32
viewsA: Change a class search in jQuery to a word search
Hello, To search for string in attribute, you can use the Attribute = Value selector. Documentation: https://www.w3schools.com/cssref/sel_attribute_value.asp Example: var texto1 =…
-
0
votes3
answers895
viewsA: Return Id’s That Are Not in Database - MYSQL
Below is a solution in a query: SELECT y.id FROM ( SELECT @row := @row + 1 as id FROM (select 0 union all select 1 union all select 3 union all select 4 union all select 5 union all select 6 union…