Posts by MarceloBoni • 6,385 points
228 posts
-
5
votes1
answer488
viewsA: Change the action of a form as per condition
The simplest way to get this result: function suaFuncao(option) { if (option) { document.getElementById("seu_form").action = "delete"; } else { document.getElementById("seu_form").action = "update";…
javascriptanswered MarceloBoni 6,385 -
1
votes3
answers1880
viewsA: Send data from an html table to php
There is a jQuery library that does the hard work (table-to-json), and from what I can see from the documentation, it’s quite customizable: $('#converter-tabela').click( function() { var table =…
-
2
votes2
answers373
viewsA: How do I search by date?
I believe that working with timestamp in this case would be ideal, the problem here would be to convert a list of dates that may be in n formats coming from the database to timestamp, and then check…
-
15
votes3
answers289
viewsQ: Condition Yoda, good reason to use?
Question mainly in PHP, in the Wordpress documentation exists an excerpt which explicitly speaks that it is interesting to use the famous Yoda conditions, although it does not give a good and real…
encoding-styleasked MarceloBoni 6,385 -
2
votes1
answer301
viewsA: Countdown jquery plugin effects
Practically everything was taken from the page, I just translated... To magic is done in function $(window).on('load', function() { $(window).on('load', function() { var labels = ['weeks', 'days',…
jqueryanswered MarceloBoni 6,385 -
1
votes1
answer364
viewsA: Replace HTML entities within a Div
It turns out that → in the browser will be rendered with its corresponding character, in case What you can do is take the content using innerHTML, make the change using replace and assign…
-
1
votes2
answers57
viewsA: How to make a select that returns the expected result
If you do not have a field in the video table of type criado_em that just saves the date that the video was inserted (which would be more correct), you can use MAX in the id_video (if we take into…
-
3
votes1
answer89
viewsQ: What is the keyword Debugger for in Javascript?
I was browsing through the documentation of Ecmascript and came across the session of Keywords reserved Follows: The following tokens are Ecmascript Keywords and may not be used as Identifiers in…
-
7
votes1
answer2762
viewsQ: Why in file and folder names, are some characters still not accepted?
Why files and folders still do not accept some different characters? I believe you must have some programmatic influence in order to make that decision. The Operating Systems had and/or still have…
-
1
votes1
answer73
viewsA: How to sort random array in PHP
I think this question is duplicate, as I did not find in the network... You seek the function shuffle $numbers = array(array(1),array(2),array(5),array(10),array(20),array(3),array(4),array(60));…
phpanswered MarceloBoni 6,385 -
12
votes4
answers763
viewsA: What would be a good way to apply events: onMouseOver and onMouseOut, for all img tags?
A solution using CSS only .aumentaFi:hover { width: 200px; height: 200px; } .aumentaFi { transition: all 0.1s; } <img src="https://sites.google.com/site/mplayerplugin/louvor/1.jpg" width="128px"…
-
4
votes1
answer556
viewsA: Using Angular WYSIWYG editor
I managed to solve using nicEdit var area; var app = angular.module('module', ['ngSanitize']); app.controller('controller', function($scope) { $scope.editar = function($event) { value =…
-
4
votes1
answer556
viewsQ: Using Angular WYSIWYG editor
To kind of starting now my studies with Angularjs. Well, I’m trying to add a WYSIWYG editor ("What You See Is What You Get"). to my script using angular 1.6.1 but am not getting the desired result.…
-
2
votes1
answer443
viewsQ: Render html from the database using angular 1.6.1
I have the following page using angular, jquery and bootstrap: var app = angular.module('tblModule', []); app.controller('tblController', function($scope) { $scope.testes = [ { "teste": 1, "oi": "O…
-
4
votes1
answer2272
viewsA: How to search for an element in XML using Javascript
Your problem is in break.... change to continue and be happy Code explained (with example) how break and continue in javascript here TagXML = function() { dados = "<doc>" dados = dados +…
-
1
votes3
answers2419
viewsA: How can I calculate elements in Javascript
I know that was not the main focus of the question, but I saw that will work with more than one field input, so will a version of how you could work: Fit. function calcular() { contador = 1;…
-
0
votes1
answer549
viewsA: Query with date and time in sql server
I’m not sure that’s what you’re looking for, but you can work that way: Schema test: CREATE TABLE teste ([HORA] VARCHAR(20)) ; INSERT INTO teste ([HORA]) VALUES ('24:00'), ('10:00'), ('5:20') ;…
-
1
votes1
answer835
viewsA: PHP Array for Json
I’m gonna take advantage of the fact that I got my hands full to explain to you. When you have an array in php in this format (by executing a var_dump($array) on the server): Object(stdClass)#6394…
-
1
votes2
answers1306
viewsA: How to create view password option typed in form
A simple code to hide and display the password: function mostrarSenha() { var tipo = document.getElementById("senha"); if(tipo.type == "password"){ tipo.type = "text"; }else{ tipo.type = "password";…
-
1
votes2
answers379
viewsQ: Is there a way to view native Javascript function code?
I recently realized that there is a way to rewrite the native code of certain functions in Javascript. For example: console.log(confirm); function confirm() { var a = "oi"; return a; } var a =…
javascriptasked MarceloBoni 6,385 -
0
votes1
answer1091
viewsA: Take Range button value and run function in real time
I changed the logic of your script a little bit, working with name to take the elements that are part of your set, and assigning a data-* to store the value of div. Solution 1: var inputvar =…
-
5
votes1
answer1062
viewsQ: Is there a way to create a parallel run using javascript?
I was wondering if there’s a way to use parallelism in javascript. For those who come from the world of java or of C is a well-known and widely used term, known as threads. Parallelism => is a…
-
4
votes1
answer7439
viewsA: Return a PDO query in an array
I’m not sure if it’s duplicate... You can do the following: // Cria conexão com o banco de dados $db = new PDO("mysql:host=".dbhost.";dbname=".dbschema.";charset=utf8;", dbuser, dbpassword); // Seta…
-
2
votes2
answers1054
viewsA: How to identify changed value in input
I’m assuming you’re looking for an answer that works with javascript pure or with jquery.... (are the tags referenced in the question) var ultimovalor = 8; function verifica_valor(element) { if…
-
0
votes1
answer413
viewsA: How to store multiple checkbox
For this example I used jQuery, but can do in javaScript pure with no problem, in case I need to help you. Decreases the number of test-only items, I changed the value of the elements to an element…
-
6
votes6
answers29816
viewsA: How to create space before or at the end of the text contained between html tags?
I don’t know if there’s anything right about this case, but you can use it Rendering a blank space. div{float:left;} <div>Texto 1</div><div> texto que quero um…
htmlanswered MarceloBoni 6,385 -
6
votes1
answer518
viewsQ: What is a Binary-safe function? And what are its applications?
I was browsing through the php.net when I came across the following note on the function str_replace: Note: This function is Binary-safe. I gave a researched here on the net and found nothing about.…
-
6
votes4
answers517
viewsA: Why Artificial Intelligence and Machine Learning are different subjects?
An addendum, perhaps this image is more explanatory: Image source: https://www.razorrobotics.com/artificial-intelligence Machine Learning can rather be considered a sub-item of Artificial…
-
3
votes3
answers326
viewsA: Script to change player (old Jquery game)
I would simplify logic, just create a global variable and check the same: var elem = "O"; $(document).ready(function() { $(".botao").click(function() { $(this).text(elem); if (elem == "X") { elem =…
jqueryanswered MarceloBoni 6,385 -
3
votes1
answer361
viewsA: PHP ERROR syntax error, Unexpected '>'
There are two syntax errors in your code. Line : 22, Error type : 4 Message : syntax error, Unexpected '>' This error was caused because on the line echo "<p>Sessão iniciada com…
phpanswered MarceloBoni 6,385 -
4
votes1
answer164
viewsA: Execution of jQuery Script
I did not understand the final objective of the question, there are two interpretations of what it needs 1) I would like it to be a progress bar for page content? If that’s right, you can use…
-
2
votes1
answer9356
viewsA: take value from a JS variable and put in an input value
The estate innerHTML serves to write or return the contents of an HTML element, in case the attribute you want to change is the value document.getElementById("resultado").value = count; See working…
javascriptanswered MarceloBoni 6,385 -
1
votes0
answers663
viewsQ: Login problems using facebook sdk
I use the default facebook login sdk, where the documentation can be accessed here. (function(d, s, id) { var js, fjs = d.getElementsByTagName(s)[0]; if (d.getElementById(id)) return; js =…
-
0
votes1
answer73
viewsA: Hash function in Arduino
It’s been a long time since I’ve dealt with Arduino, but I’ll take my chances if someone comes up with a different and correct solution, I erase the answer. Try to change the function randomico…
-
2
votes2
answers86
viewsQ: Problem with use in PHP
I am developing an application that sends an image to a Bucket on Amazon and I am using the sdk pure To send use the following code: function especifica(){ require…
-
1
votes1
answer617
viewsQ: Cropping image before uploading to server
It had a simple code that was just: <form action="upload.php" method="post" enctype="multipart/form-data"> <input type="text" name="description" /> <input type="file" name="file"…
-
8
votes2
answers4162
viewsA: Identify and retrieve PUT and DELETE variables
Unlike $_POST and $_GET the methods DELETE, PUT among others have no variables pseudo-globais which make it easier to recover them. Usually in a API RESTful, in the methods PUT and DELETE we work…
-
3
votes1
answer94
viewsA: Compare performance of two PHP scripts
Runtime I know answer, now if the performance (performance) is good, taking into account the runtime, I believe it depends more than your algorithm does, make an analysis of complexity and etc. At…
-
1
votes2
answers101
viewsQ: Set a random return to a function
I am creating a function that receives a return x from another function and wanted to test the possibilities to avoid errors. $array = [1,2]; $i = 0; foreach ($array as $value) { $retorno[$i] =…
phpasked MarceloBoni 6,385 -
6
votes4
answers2615
viewsA: Drawing with CSS
To assist the assembly I’m using: http://www.cssmatic.com/box-shadow div { background: rgba(119, 178, 0, 1); background: -moz-linear-gradient(left, rgba(119, 178, 0, 1) 0%, rgba(119, 178, 0, 1) 48%,…
-
1
votes2
answers49
viewsQ: Date passed as NULL to the database
I have this structure: //Dia atual + i meses $data_pagamento = "DATE_ADD(CURRENT_TIMESTAMP,INTERVAL ".$i." MONTH)"; $sql = "INSERT INTO pagamento(fk_1, fk_2, fk_3, fk_4, fk_5, preco,…
-
2
votes1
answer1358
viewsA: Form validation with jquery
There are several small errors in the code you sent, but can not fix exactly the way you should have imagined without more information how it should work. $(document).ready(function() {…
-
2
votes1
answer97
viewsA: Problem with function when trying to perform deletion
Two errors visible in your code, 1° a tag #frmDeleta refers to a name form, not to a id 2° I believe you wanted to use the function submit using the jquery, that I know of no such call…
-
0
votes1
answer510
viewsQ: Get name of all fields with the required tag
I want to get the name of all fields with the tag required and test one by one, if any of them are empty, enter the name in an array. This question resembles some things with this old question my,…
-
1
votes1
answer79
viewsQ: Create the same function in php
I have the following function in javaScript: function teste(ctrl) { var str = ctrl.value; var str = str.split(" "); if (str.every(isBigEnough) && str.length >= 2) { alert(true); } else {…
-
5
votes1
answer834
viewsQ: Problem with Curl, catch message body even with http != 200
I have a request on my API: $ch = curl_init(); curl_setopt( $ch, CURLOPT_URL, 'link da api'); curl_setopt( $ch, CURLOPT_FAILONERROR, true ); curl_setopt( $ch, CURLOPT_TIMEOUT, 10 ); curl_setopt(…
-
0
votes0
answers91
viewsQ: When giving transition rollback, reset id to the last id actually inserted
I want to avoid having jumps in the auto increment of id, in case there’s a mistake and I make it rollback in my transaction. And at the same time I want to make sure that no mistake happens if I…
-
1
votes1
answer1275
viewsQ: Allow null value in relationship field
I have a database MySQL with tables t1 and t2. One of the columns in the table t1 has a foreign key to t2. You need to allow the foreign key column to accept values null. Important data already…
-
0
votes0
answers23
viewsQ: PHP PDO, what is the practical difference in parameter sending?
I’m having a question using the pdo in the php, there is some practical difference in implementation using these two approaches? $db = new PDO("ok"); $sql = "INSERT INTO tabela (campo1, campo2)…
-
0
votes1
answer153
viewsQ: Problem using hashid.id library
I’m trying to implement the library hashids in my project, I am not using the composer My job is as simple as that: function generate_hash_id($id){ require("../libs/Hashids.php"); $hashids = new…
phpasked MarceloBoni 6,385