Posts by Costamilam • 9,556 points
509 posts
-
2
votes2
answers2191
viewsA: Is it possible to save <form> forms in localStorage with pure Javascript?
localStorage is very simple to use you use setItem() to store: localStorage.setItem("chave", "valor"); //Ou localStorage.chave = "valor"; And the getItem() to recover this value:…
-
0
votes1
answer282
viewsA: Click on the title bar and do not sort the column in the dataTables
You can disable sorting the first column with: $('#example').dataTable({ "columnDefs": [ { "orderable": false, "targets": 0 } ] }); From a look at documentation for more options…
answered Costamilam 9,556 -
1
votes1
answer1112
viewsA: execute a function when clicked on the button
Unable to run php code on the client side, you should use AJAX for this: In Javascript (Jquery): $('#input').on('click', function(){ $.ajax({ //Para aonde vai a requisição (um outro arquivo) url:…
-
1
votes1
answer854
viewsA: Timers on Node.js: their differences and their relationship to process.nextTick
According to the documentation: setTimeout() can be used to schedule code execution after a designated amount of milliseconds. This function is similar to window.setTimeout() of the browser’s…
-
1
votes3
answers209
viewsA: Pass value to variable
The @Lipespry example illustrates exactly what you need, but sucess and error are obsolete and have changed to done and fail: $(function(){ $('#estados').on('change', function(){ $.ajax({ url:…
phpanswered Costamilam 9,556 -
25
votes1
answer10213
viewsA: What is the Firebase?
Firebase is a product of Google, a set of technologies available in several languages: Java, Swift, Objective-C, Python, Javascript (including Node.js), Go, Unity and C++. Among its technologies,…
-
1
votes1
answer1814
viewsA: Take all data from an HTML table and insert it into the database
A simple way with Jquery: On the front end, you loop and assemble a two-dimensional array to send back-end <script…
-
0
votes1
answer815
viewsA: Call method with parameter of another method in Java?
The way it is is not possible You can change the metodoDois() and pass it by parameter to the method cadastrar(): Classea: Public void cadastrar (Cliente cliente){ System.out.println…
javaanswered Costamilam 9,556 -
2
votes1
answer342
viewsA: How to change text of an html table according to the result
You can use the .html() on the same selector: $(document).ready(function() { $("td.select:contains('1')").css("background", "red"); $("td.select:contains('0')").css("border-bottom", "1px solid…
-
1
votes2
answers106
viewsA: Percentage of vote in php within a while
You already have the amount of votes of each, now add these amounts to know the Toral and find out the percentage: $sql = mysql_query("SELECT * FROM candidatos ORDER BY nome_candidato"); $total = 0;…
-
1
votes1
answer42
viewsA: I want to know how to pass an object to Activity using the following code
In fact the MainActivity is already the controller so just instantiate your DAO class there and call the functions: //Importa a classe DAO (aqui é só um exemlpo) import examplo.mvc.PessoasDAO;…
-
3
votes1
answer67
viewsA: Activity without Toolbar
You can configure the Activity theme in the manifest: <manifest ... > <application ... > <activity android:theme="@android:style/Theme.Holo.Light.NoActionBar.Fullscreen" ... >…
androidanswered Costamilam 9,556 -
2
votes2
answers113
viewsA: Action using select
var select = document.getElementById('selecionar-aula'); select.addEventListener('change', function() { window.location = select.value; }) <select class="select-sala" id="selecionar-aula">…
-
-1
votes3
answers705
viewsA: Avoid duplicate records in a particular Mysql column
You can check in SQL if there is a bid with the same value using CASE: CASE WHEN ? IN (SELECT bidding_price FROM bid_account WHERE auction_id = ?) THEN INSERT ...…
-
1
votes1
answer294
viewsA: Insert XML into Mysql table
It is because the name of the film exceeds the limit set in the creation of the column (25) titulo varchar(25) not_null, "Murder on the Orient Express" has more than 25 characters…
-
1
votes1
answer27
viewsA: Mouse eventlistener does not work
className is not a function, the correct would be className = "dot" <!DOCTYPE html> <html> <body> <!-- Estilo do body, e da classe .dot--> <style> body { height: 200px;…
-
0
votes1
answer738
viewsA: Insert a value into the SQL table for each selected checkbox
You’re doing it right now add the name attribute as an array in the checkbox: <input name="adicional[]" class="uk-checkbox" type="checkbox" value="16.15"> Adicional 1 <input…
-
2
votes1
answer265
viewsA: How to make a Session
Just add a line here: if (mysql_num_rows($query) != 1) { // Mensagem de erro quando os dados são inválidos e/ou o usuário não foi encontrado echo "Login inválido!"; exit; } else { $resultado =…
-
0
votes1
answer225
viewsA: How to create a closer drive search with google api
You can use the Library of Google Places: var map; var service; var infowindow; function initialize() { var pyrmont = new google.maps.LatLng(-33.8665433,151.1956316); map = new…
-
1
votes1
answer94
viewsA: What is the best way to create an access report?
Analyzing what you want... Suggest recipes for the user There are several ways to do this: 1. Know which user accessed which recipe and how many times to store in the database and select recipes…
-
2
votes1
answer307
viewsQ: Commentary/legend in table rows
How can I add a comment/caption to table rows, similar to tag <abbr>? nome | idade | sexo <br> <abbr title="comentario/legenda 1"> Gui | 17…
-
1
votes1
answer57
viewsA: Site in a kind of app
This is called PWA (Progressive Web App), a set of techniques for developing Web applications that progressively add features that were previously only possible in native apps, it unites the best of…
html5answered Costamilam 9,556 -
1
votes2
answers1212
viewsA: Only catch the year of a column in Mysql
I believe the question has already been answered but another way to do it is by using the function DATE_FORMAT(): SELECT * FROM tabela WHERE DATE_FORMAT($data, "%Y%m%d") > DATE_FORMAT(NOW(),…
-
0
votes1
answer29
viewsA: Select a certain Input value
You can use the function substr(): $codigo = "01234567890123456789012345678901234567890123"; $nota = substr($codigo, 24, 9); The first parameter you pass the variable, in the second the initial…
-
-1
votes1
answer542
viewsQ: Error saving rules in firebase console
What errors can occur in the firebase Realtime database security rules console when defining my rules and what they are?
-
1
votes1
answer542
viewsA: Error saving rules in firebase console
Error while saving rules - Line n: syntax error As the name says, they are syntax errors like, use ||| or &&& instead of || or &&, for example: ".write": "data.exists()…
-
2
votes1
answer190
viewsA: How can I change my homepage URL in Wordpress?
Just put that stretch on .htaccess: <IfModule mod_rewrite.c> RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME}\.php -f RewriteRule ^([^/]+)/$ $1.php…
-
0
votes2
answers47
viewsA: How to update a database without the action from the customer?
An option would be to store this date in a column of the database and when it is necessary to know whether or not it has passed two days just check with a clause WHERE, for example: SELECT * FROM…
-
1
votes1
answer53
viewsQ: Unwanted delay effect
Problem: Desktop menu animation and soon lagged (+ or - 3s), but the mobile menu icon works as expected Attempts: transition-delay: 0s; transition-delay: none; animation-delay: 0s; animation-delay:…
-
1
votes1
answer41
viewsA: How to make only things with X status appear on the page?
In: SELECT * FROM noticias order by id DESC LIMIT $offset,$per_page Add a clause WHERE: SELECT * FROM noticias WHERE status = 1 order by id DESC LIMIT $offset,$per_page This will do a table search…
phpanswered Costamilam 9,556 -
6
votes7
answers20768
viewsA: How to protect source code?
The best way for you to protect your source code is not to make it available to the user. Host the source code on the server and provide access to resources only to authenticated users, a…
-
2
votes1
answer158
viewsA: ORDER BY RAND() in 2 columns
When using id ASC, RAND() means that he will order first by id and if it has two lines with the same value it will use the RAND() to sort. Only that will never happen because there will never be two…
-
1
votes1
answer75
viewsA: Turn 2 Select Simple into 1
I believe that solves: SELECT * FROM playlist WHERE CASE WHEN (SELECT COUNT(*) FROM playlist WHERE status = 1) = 0 THEN status = 0 ELSE status = 1 END If the count of playlist with status = 1 for 0…
-
5
votes1
answer759
viewsQ: PHP with DAO + mysqli
DAO necessarily needs to be a class? Or I could create methods within a file. php without encapsulation of a class? If not possible, what is the name of the classless DAO (name of some pattern equal…
-
1
votes2
answers490
viewsA: Organization of PHP code
To try to organize the project in the best way possible (more reuse of code in order to interfere as little as possible in the performance) divides the project into 4 parts: View (interface, divided…
-
-3
votes1
answer43
viewsA: Merge two sql commands
You can do it like this: SELECT * FROM (SELECT DATE_FORMAT(data_os, '%d/%m/%Y %H:%i') FROM tbos) as data, (SELECT * FROM tbos WHERE os = '') as tudo As the data are from the same table, so too:…
mysqlanswered Costamilam 9,556 -
1
votes2
answers146
viewsA: Materialize 1.0.0-beta (CSS Transitions)
actually you need to create a code that changes the classes, I made an example where click makes disappear and back 1 second later: var scale = document.getElementById('scale-demo') var b = true…
-
0
votes2
answers81
viewsA: php - upload multi images to same field
You can create an input with the name attribute as an array: <form action='' method='post'> <input name='imgs[]' type='file' multiple> </form> And in PHP: var_dump($_POST["imgs"]);…
phpanswered Costamilam 9,556 -
9
votes2
answers551
viewsQ: ". read" firebase security rules
I created the following security structure in Realtime Database: { "rules": { "receita": { "$chave": { ".write": "auth.uid === newData.child('usuario').val()", ".read": "auth.uid ===…
-
1
votes2
answers2005
viewsA: How not to lose the form fields, after validation with PHP
In PHP, if you already have CPF, direct redirect by php passing the data by get include "Conexao.class.php"; $dados = $_POST; if($dados['acao'] == 'inserir') { $conn = new Conexao();…
-
1
votes2
answers58
viewsA: Problem sending something to database
The first three errors mean that the path or name of the files are incorrect if you need more help to resolve this issue edit your question adding the folder structure of your project o 4° error…
-
0
votes2
answers757
viewsA: Create report displaying total and subtotal
You can do something like this (mysqli, without Codeigniter): Just to understand, first the value of the first group is saved and whenever it changes the table is closed, shows the total and opens a…
-
1
votes4
answers938
viewsQ: Private or protected class in PHP
You can create a private or protected class in PHP to allow access to its variables and functions only to other specific classes? Applying: I have a class where I create a connection with the…
-
1
votes1
answer464
viewsA: Pass data from Firebase Database to Intent and recover in another Activity
I’ll leave an example of how to eviar an object from one screen to another just implement by swapping the get set and class. Screen 1: btnOK.setOnClickListener(new View.OnClickListener() { @Override…
-
1
votes1
answer26
viewsA: Problem when trying to enter age alert in online store
As @Valdeirpsr said... On the line var home_principal = $$(".cms-index-index") Remove one of $, would look like this: var home_principal = $(".cms-index-index") In the innerHTML te 2 problems: 1- In…
-
-3
votes5
answers1659
viewsQ: What is the best way to pass data between php files
What is the best way to pass data between back-end and front-end, for example, send a form to the back-end, it executes an SQL script and returns an array of data that must be shown, what is the…
-
0
votes1
answer41
viewsA: Doubt about Mysql Query
Understand what your SQL is doing: SELECT * FROM postagens WHERE id = '$p_id' AND u_id = '$u_id'; Selects all table columns posts if the post id is equal to $p_id and the user id is equal to $u_id,…
-
-1
votes2
answers59
viewsA: Is there a type of Javascript that stores data from any file?
Yes just create a variable and assign it to it document.getElementById('input').files (array of selected files), if you want only one file use .files[0] Javascript has the object File, it has the…
-
2
votes2
answers40
viewsA: How to make two Select
Try this: SELECT SUM(likes), SUM(deslikes), id_post FROM statusposts GROUP BY id_post;
mysqlanswered Costamilam 9,556 -
3
votes3
answers99
viewsA: Best practices for setting up the IF condition
As already stated in the comments the second form is less performatic (the difference, in this case, is irrelevant) by having a variable being created before, exemplifying... In the first the…
phpanswered Costamilam 9,556