Posts by Diego Marques • 3,701 points
159 posts
-
0
votes2
answers9964
viewsA: Pivot dynamic columns
It is really not possible in SQL Server to create a PIVOT with dynamic columns. DBMS needs columns to be set so you can transport rows to columns. The only solution would be to actually generate…
-
1
votes1
answer27
viewsA: How to send variables via upload form
The problem is that the Hidden inputs are only with the attribute "id", and for the values to be sent in the request it is necessary that they have the attribute "name". Something like that:…
-
4
votes2
answers140
viewsA: What are CSS default values for?
The standard exists and is available for two main reasons: If you apply a new style and need to return to the pattern for exceptions to this style, ex: div { display: flex; justify-content: center;…
cssanswered Diego Marques 3,701 -
2
votes1
answer157
viewsA: Mysql, SELECT according to the specialisation of the generic entity occurrence
It is possible, and there are some approaches that may vary depending on your DBMS. The most comprehensive would be something like this: SELECT user.id_user, user.type, ( CASE user.type WHEN 1 THEN…
-
2
votes2
answers334
viewsA: Perform a DELETE with Where being the result of a SELECT (MYSQL)
One solution is to include this first SELECT as a sub-select of the DELETE function. Ex.: $deletar_atividades = "DELETE FROM tbl_atividades WHERE TIPO_ATIVIDADE = '$tipo_atividade' AND COD = '$cod'…
-
1
votes2
answers31
viewsA: Is it a problem to remove class that an element does not have?
This is not a problem, trying to remove a class that does not exist in the element does not generate an exception or any error message. The only point of attention you need to have is whether this…
-
0
votes2
answers78
viewsA: I can’t use quotes on a function value"Uncaught Syntaxerror: Invalid or Unexpected token"
You can use " to print the double quotes: function muda(x){ document.getElementById('campo').innerHTML = x; } <button onclick="muda('"Marco"')">Clicar</button>…
-
1
votes2
answers107
viewsA: generate Json through txt (Position) file by php
The function you need is the substr, that returns part of a string. Then you could do: <?php $file = fopen('teste.txt', 'r'); while(!feof($file)){ $content = fgets ($file); $login =…
-
2
votes2
answers136
viewsA: Javascript declare variables outside the function
The problem is the Javascript execution sequence. In this your code, when the browser loads and processes your HTML, it puts on the screen the 2 inputs, and then processes the script tag and…
-
0
votes1
answer265
viewsA: Problem with punctuation and space when running CMD via C#
This occurs when there are spaces or special characters because the space creates a separation in the CMD parameters. Ex.: cmd.exe /C D:\FuncoesMySQL\mysqldump -uroot ... Is interpreted by being:…
-
1
votes1
answer45
viewsA: Problems with PHP Sessions and Ajax Requests
It is not possible to make HTTP calls on a website running on HTTPS because the browser blocks it. This is part of the HTTPS security policy. However, there are some alternatives. The first is to…
-
-1
votes2
answers211
viewsA: Insert problems in Asp classico (replace)
In this case you just need to first remove the dots, and then replace the commas by dots. Ex: entrada = Replace(Replace(Request.form("entrada"),".",""),",",".")
-
1
votes1
answer117
viewsA: create Linked in Mysql between different instances
A Mysql engine FEDERATED engine even has a functionality similar to SQL Server Linked Server, take a look to see if it helps you. Other than that, Mysql natively does not have this kind of…
-
1
votes3
answers650
viewsA: Change the CSS Display property to ALL elements of a page and leave Block only for some?
The problem is that the selector * selects ALL HTML elements (DOM), including tags HTML and BODY. So if you hide, for example, the BODY with display: none, any tag inside the BODY will be hidden. To…
-
1
votes1
answer42
viewsA: Shorten address of a group of elements with jQuery
If the label has an ID, and the ID must be unique in an HTML document, you can get it straight from the ID. Example: $("#consulta"); To get the text you can use the function "text()". Example:…
jqueryanswered Diego Marques 3,701 -
1
votes2
answers55
viewsA: Give an input in a table with information from two tables
You need to make a select by joining all the records and tables you will need, following the relationship, and then making a INSERT. Example: INSERT aluno_materia SELECT AT.ID_ALU, M.ID_MAT FROM…
-
2
votes2
answers416
viewsA: Concatenate CPF in Mysql
Here is a solution to apply the mask depending on the number of characters: Example in a select: SELECT cpfcgc, IF( LENGTH(cpfcgc) = 14, CONCAT(SUBSTRING(cpfcgc, 1,2), '.', SUBSTRING(cpfcgc,3,3),…
mysqlanswered Diego Marques 3,701 -
1
votes2
answers128
viewsQ: How to separate records into blocks for parallel processing?
I have a table in SQL Server that makes the control of messages to be sent and a routine in C#, configured in a Cron, which selects pending messages, sends and marks as sent. What I’m implementing…
-
-1
votes2
answers128
viewsA: How to separate records into blocks for parallel processing?
One approach that solves is to calculate the rest of the division between a single constant and the number of calls that will be made, thus generating an integer that groups the results. In the…
-
2
votes1
answer278
viewsA: How to access JSON return position with Javascript?
The access form of an object in this case is equivalent to an array: objeto[índice] In this your example: var obj = {error: false, installments: {}, error:false, installments:'', 0:{quantity: 1,…
javascriptanswered Diego Marques 3,701 -
2
votes3
answers81
viewsA: Simultaneous consultation and amendment
What you need is to work with transactions in the database. Implementation may vary depending on the DBMS you are using, but follow all the same ACID principles: Atomicity: All actions that make up…
-
4
votes1
answer117
viewsA: How to pick up part of the string from the size of a word?
Based on the reported standards, a regex that can be used is the /([^ ]{1,4} [^ ]{1,4} )([^(]+)( \([^)]+\))/g. Example: var text = [ 'ENF N1A METODOLOGIA DA PESQUISA CIENTÍFICA (MES)', 'ENF N1A…
-
1
votes2
answers1010
viewsA: Display rows from a table according to filters
The problem in this case was the search for all tags tr, which was including those of the header. You need to filter only those which are daughters of the tbody and thus will keep the header intact.…
-
0
votes1
answer46
viewsA: Set value in scrolltop
The scrollTop method works on all modern browsers: Scroll Top Example: Javascript Scroll Top Window: window.scrollY Scroll Top of an element: document.getElementsByTagName('div')[0].scrollTop jQuery…
-
1
votes1
answer111
viewsA: Change URL of all Mysql DBMS tables with PHP
You can use the information_schema.Columns table to extract the list of columns and tables and assemble the update instructions to run individually. Example: SELECT CONCAT('UPDATE ', table_name, '…
-
0
votes2
answers571
viewsA: Perfect centralization of elements using Transform:Translate <style>
It is not possible to use more than one id in an element, and by definition, an ID should not repeat itself in more and an element in every HTML document, it should be a unique identifier for that…
-
2
votes1
answer124
viewsA: Retractable menu that does not close
Hello, For this type of menu you can only with CSS, with the pseudo-class:Focus, because it applies to the element when it is clicked, and when we click outside or on another element, it loses the…
-
3
votes2
answers140
viewsA: Validate a string with Regex
Regex is almost the one you put in the question, but adding the "+" operator that indicates "one or more occurrences from the list". Example: /NWD[0-9]+ STANDARD -/ See here the example in action…
-
3
votes2
answers743
viewsA: How to control Scroll in JS / jQuery
For this you will have to analyze the scroll through the method $(element). scrollTop() of jQuery. Example: $(document).ready(function(){ let elements = $(".item-list"); let total = elements.length;…
jqueryanswered Diego Marques 3,701 -
1
votes1
answer1356
viewsA: Is it possible to hide parameters from the URL with PHP?
You cannot make changes to the browser via PHP, because PHP is processed on the server, not the client (browser). What you can do is run a javascript script in this view that does this, since…
-
4
votes2
answers476
viewsA: Save/Recover Files with PDF Extension
If you are saving as PDF, you cannot display with content-type image/jpeg. To display as image/jpeg, you first have to convert the PDF to jpeg.
-
0
votes1
answer56
viewsA: Store stylized text on your BD for a news site
What you need is a Wysiwyg editor. There are several free or open source editors. One of the best known is Tinymce, which you can download at: https://www.tinymce.com/download/ WYSIWYG is the…
-
2
votes4
answers1182
viewsA: Change placeholder by checking radio with jquery
Your logic makes sense, but there are some flaws in your code, come on: On the line $('#tipousuario').prop('checked', actually need to apply the event to the element to capture when the value is…
-
1
votes1
answer88
viewsA: Disabling check according to selected quantity
You can do this with a javascript control, calling an event each time the user clicks a check to verify the others. Example: var app = angular.module('dmExemploApp', []);…
-
3
votes1
answer35
viewsA: Database query between tables
You’ll need the clause JOIN, that makes precisely the junction of search results based on search criteria. In this case, the consultation would be: SELECT TB2.matricula, TB2.nome, TB1.escola,…
-
2
votes2
answers57
viewsA: Sort VARCHAR database records with semicolon
If the expected sorting is by numerical value, you can do the conversion only in the ORDER BY. Example: SELECT *, CAST(representantes_vendas.valor AS INT) FROM representantes_vendas INNER JOIN…
mysqlanswered Diego Marques 3,701 -
2
votes3
answers281
viewsA: Pick up reply email content
The problem in this case is that the responses are actually concatenated with the message, and who does this is the email client of the user who is responding. What you can do in this case is treat…
-
0
votes2
answers120
viewsA: Timeout for query execution
php does not have a timeout function, but next to that is the function sleep. The function sleep delays the execution of the script: int sleep ( int $seconds ) Example: $sql_em = " INSERT INTO…
phpanswered Diego Marques 3,701 -
3
votes2
answers47
viewsA: How to update a database without the action from the customer?
What you will need is to create a script, for example in PHP, that runs the business rules you need, and schedule this task in a Cron Job system. Cron Job is a type of Task Scheduler, where you will…
-
1
votes2
answers142
viewsA: How to add two li in a ul dynamically with jQuery?
You can use jQuery’s "after" method. Example: $(document).ready(function() { var $li = $('ul li').eq(1); $('button').click(function() { $li.after('<li>' + $('ul li').length + '</li>');…
-
1
votes1
answer1719
viewsA: How to sort varchar field with letters and numbers in sql server
If the column path always has this pattern, you can manipulate the varchar to convert the final numbers into integer and so the ordering is correct, follow below an example and note the ORDER BY:…
-
1
votes3
answers42
viewsA: Doubt about standard JS code
It is difficult to answer precisely because no developer is required to follow established or suggested patterns, and can create his own pattern. This is indeed essential for the growth and…
javascriptanswered Diego Marques 3,701 -
1
votes4
answers3601
viewsA: Check if input file is with file or not
If you add the attribute "required" to the input tag, the browser itself will already validate the mandatory field: <div class="form-group" id="inputOculto"> <input name="arquivo"…
-
1
votes1
answer90
viewsA: Insert column with mysql function
In a select statement you can use the GROUP BY command to group the values and then use the COUNT command to count the occurrences, example: SELECT ID, COUNT(ID) AS total FROM historico GROUP BY ID…
-
2
votes1
answer60
viewsA: Views and session variables available in sub domains
It is not possible to share the native PHP session because they are different domains. In this case you will have to use a session control via Database or other data source that is accessible in a…
-
1
votes1
answer299
viewsA: Generate table automatically with c# and mvc
To do this with Angularjs you can control events by being guided by the data of your model. Example: var app = angular.module("dmExample", []); app.controller('dmExampleCtrl', function($scope) {…
-
1
votes1
answer155
viewsA: How to remove#from Angularjs URL
This is not possible because the character "#" is part of the Angular routing mechanics. To "remove" this character, you will have to take the routing to the server side, either using a framework…
-
0
votes1
answer89
viewsA: How to create a real-time list with PHP and Ajax
The line of reasoning is simple. Its bank structure has two tables, one of which has a foreign key (FK) referencing the other in a 1->n relationship. To enter these records, you must follow the…
-
2
votes1
answer657
viewsQ: Run Function when the element appears in the gift
How to run a function where a particular item exists in the DOM? For example, I have a list with 4 elements, and whenever a new element appears I want to run a certain function. Example code below:…
-
0
votes3
answers144
viewsA: Help with select
In this case you can make one LEFT JOIN, which makes the result merge keeping the line if the join is not positive. And when selecting the field use the COALESCE to return a second value if the…