Posts by Gabriel Rodrigues • 15,969 points
440 posts
-
2
votes8
answers14487
viewsA: How to create a copy of an object in Javascript?
Another way to create a copy would be by making use of Object.create(). Remembering that it is a new ES5 method, see Compatibility. Example: a = {}; b = Object.create(a); b.nome = 'Gabriel'; a.nome…
-
0
votes2
answers201
viewsA: Why does comparison using javascript not work?
The condition would be different values !== Example: var value = "a"; var anterior = "b"; if (value !== anterior) { document.write('diferente'); } else { document.write('igual'); }…
-
3
votes2
answers387
viewsA: How to clone an object in javascript?
With Object.create(): Example: a = {} b = Object.create(a); b.nome = 'Gabriel'; a.nome = 'Wallace'; document.write(JSON.stringify(a), JSON.stringify(b))…
-
1
votes1
answer73
viewsA: "unwrapping an Optional value" error in login screen transition
Your problem is divided into two parts. 1 - Optional Values. It may be that this problem is not in your job add It’s in your class, where you’re declaring your variables. Once you start a variable…
-
1
votes1
answer1939
viewsA: Searching and changing the value of the checkbox with javascript
Your function is working properly, what are you passing as parameter id ? has to be 'letrasMinusculas', in your This you can set checked = true if this is what you really need. Example: function…
-
10
votes2
answers781
viewsA: What functions are form tags in HTML5?
Working with patterns or not? Not only in html as in other languages of to solve certain types of problems of "n" different forms, but after all, it is advisable ? You can see in several "HTML5"…
-
15
votes3
answers619
viewsA: Timestamp limit January 19, 2038
This bug is caused by the use of 4bytes Signed integer used for quick accounts. The problem: There is no no universal solution to the problem of the year 2038, any change in the definition of time_t…
phpanswered Gabriel Rodrigues 15,969 -
3
votes2
answers1988
viewsA: CSS Reset or Normalize?
Reset A reset as its name says will reset all the preset settings of the browsers, this way you can define your own css, without using the features that each browser uses. Normalize Normalize as the…
-
23
votes3
answers11214
viewsQ: What is Code Smell?
I started to study swift and I stumbled across a widely used term called Code Smell from what I could understand in Wikipedia and on some other sites it is any symptom in the source code that…
terminologyasked Gabriel Rodrigues 15,969 -
13
votes5
answers11978
viewsQ: How to get the current file name
I recently had a problem identifying the current page. Was using __FILE__ to get the current file, and used substr() to retrieve the string after the last occurrence bar, it turns out that in some…
-
1
votes2
answers1084
viewsA: Read a "value" inside a "<select></select>"
You can do it like this: document.getElementById("cAtividades").addEventListener("change", function() { document.getElementById("campo").value = this.value; }); <select name="tAtividades"…
-
9
votes4
answers12892
viewsA: How to convert float number to spellnumber in PHP?
There is no native php function for this, even because it would need an i18n to be able to fully describe values from other languages, I believe the most advisable in this case is to use a class for…
phpanswered Gabriel Rodrigues 15,969 -
1
votes1
answer645
viewsA: How to serialize with input disable?
You could solve this problem by going through the elements disabled to catch the name e o value and finally concatenating with the serialized string to send to the server. Example: function…
-
0
votes1
answer628
viewsA: Phpmailer works with Gmail but not with Hotmail/Live
Activate the Debug: $mail->SMTPDebug = 2; Smtpsecure is not tsl. is yes tls': $mail->SMTPSecure = 'tls'; When I send to the hotel I need to change the door to 587: $mail->Port = 587;…
-
4
votes1
answer645
viewsQ: How to serialize with input disable?
In a reply to SOEN They pass an approach of temporarily disabling the camps: Example: var myform = $('#myform'); // Encontra os elementos e remove o atributo disable var disabled =…
-
29
votes4
answers16863
viewsA: Cross-browser way of copying text to the Clipboard (Clipboard)
Support from the Browsers The support of Document.ExecCommand ('copy') has grown, take a look at the list of supported: IE8+ Google Chrome 43+ Mozilla Firefox 40+ Opera 32+ IOS Safari 8.4+ Android…
-
1
votes2
answers865
viewsA: What is the purpose of $_REQUEST?
The $_REQUEST is the generic type of $_GET, $_POST,$_COOKIE for it doesn’t matter if your data is coming via $_GET or $_POST it rescues both, its use is little recommended. Why its use is not…
phpanswered Gabriel Rodrigues 15,969 -
3
votes3
answers523
viewsA: Get code from a li
If only to catch the li utilize .parentNode to be able to browse your tags. var inputElements = document.getElementsByClassName('ckeckVisitantes'); for (var i = 0; inputElements[i]; ++i) { if…
-
3
votes2
answers588
viewsQ: Automatically select text
I’m trying to create a function that traverses any text by selecting letter as the effect of you hovering your mouse by selecting text slowly. I used the select() but it selects all the text.…
-
1
votes3
answers155
viewsA: Why is 'getattribute()' not a function?
Try with attributes thus: document.querySelector('#svg-map').addEventListener('mouseover', function(){ var link = this.getElementsByTagName('a'); console.log(link[0].attributes['xlink:href'].value);…
javascriptanswered Gabriel Rodrigues 15,969 -
5
votes6
answers1100
viewsQ: Same number of characters in password after md5
I’m doing a process of opening a modal and registering a user. User password is modified to md5(); After this the password is with 32 caracteres. When user will load user data to make an update. If…
-
4
votes4
answers1938
viewsA: Show age in years in php
PHP >= 5.3 Example using date_create(), date_diff(): # Orientado a objetos $from = new DateTime('19910906'); $to = new DateTime('today'); echo 'Idade1 ' . $from->diff($to)->y . " anos."; #…
phpanswered Gabriel Rodrigues 15,969 -
0
votes3
answers4049
viewsA: How to check if my current time is in an hour interval?
Simple function using timestamp: // Função function intervaloEntreDatas($inicio, $fim, $agora) { $inicioTimestamp = strtotime($inicio); $fimTimestamp = strtotime($fim); $agoraTimestamp =…
phpanswered Gabriel Rodrigues 15,969 -
7
votes2
answers949
viewsA: How to find the height and width of window WITHOUT JQUERY?
You can use the window.inner...: var w = window.innerWidth; var h = window.innerHeight; document.write(w + ' width '); document.write(h + ' height');…
javascriptanswered Gabriel Rodrigues 15,969 -
0
votes3
answers99
viewsA: Conditions do not return expected values
Try it like this : if (count($_POST) > 0) The point is that the empty() is not checking correctly and returning that there is something in the array when it does not exist. See working :Ideone…
-
1
votes1
answer570
viewsA: Block events with jquery
Sometimes a simple one fleg can solve your problem. Example: $(document).ready(function() { var fleg = false; $('button:eq(0)').click(function() { $('div').html('click in second button during…
-
1
votes1
answer1395
viewsA: Send email using Cpanel and Phpmailer account
In my example you will have to leave the extension openssl habilitada, and port 465 should be open on your server. Example of sending to Gmail: <?php require_once("PHPMailerAutoload.php");…
-
17
votes2
answers4066
viewsQ: What are MIME types?
What are MIME types ? And what is its importance for correctly rendering pages/files? Its use is mandatory or depends on the browser ? If undeclared, browsers may assume a different behavior at the…
-
1
votes2
answers1319
viewsA: Laravel error in installation
In the xamp I was able to solve this problem like this: Open your .bash_profile: vim ~/.bash_profile And copy the following line at the end of the file: export…
-
0
votes2
answers40
viewsA: PHP variables with wrong values after string manipulation
Your problem was the tag <data-hora> you considered her at the time to do the strpos() and ended up taking her first position 0, I ended up making this mess, I made an example by removing…
phpanswered Gabriel Rodrigues 15,969 -
2
votes2
answers1792
viewsA: Json output with json_encode()
To solve the coding problem I went through the array by creating a new one and using utf8_encode() to leave everything with utf-8. $novo = array(); foreach ($result as $key => $value) { foreach…
-
1
votes2
answers525
viewsA: str_replace with php explodes
First thing, using only one point '.' will present various conflicts seen in your text has [Ref.] [.com.br] he would end up doing the substitution in a wrong place. As you just want to replace the…
phpanswered Gabriel Rodrigues 15,969 -
5
votes2
answers1792
viewsQ: Json output with json_encode()
json_encode() - Returns the JSON representation of a value If I do: $foo = array('a', 'b', 'c', 'd', 'e'); echo json_encode($foo); I’ll get: ["a","b","c","d","e"] So far so good, I’m taking an array…
-
2
votes2
answers378
viewsA: Form data does not send to email
The function mail() returns false if not send, use if to check if it was sent successfully. Example: if(mail($para,$assunto,$corpo,$header)){ // enviado com sucesso. faça algo }else{ echo "Não foi…
-
1
votes2
answers203
viewsA: Errors with C array manipulation
1° - You are declaring the variable jogo as char and using as string. 2° - You cannot use switch statement with strings. 3° - On line 27 should look like this: scanf("%c", &game); 4° - Cade the…
-
4
votes1
answer4614
viewsA: Use bootstrap style to generate pdf file with php
You can add css files to mpdf to solve this problem, but you should refer to the mpdf manual to see if it supports all bootstrap settings: mPdf Supported CSS include('mpdf.php'); $mpdf= new mPDF();…
-
0
votes1
answer972
viewsA: How to load javascript correctly dynamically
You can upload your file header.html as you already do in load() and when it is loaded you load your script with getScript, see the example: $("#resultado").load("header.html", function() { //…
-
1
votes1
answer129
viewsA: How to prevent jQuery’s close function from destroying my message container?
Let’s say I have an html like this: <div id="resposta"></div> I could solve this alert problem by removing everything with Empty() and then adding the alert string,in the following…
-
3
votes1
answer512
viewsQ: Ruler
In some editors we have an orientation rule in which we can perform some configurations such as the spacing between the text and the revelry. I need to produce something like: I currently use a text…
-
3
votes2
answers2573
viewsA: Detect browser and redirect user
You can use a regex to return true if it is Safari. Example: var isSafari = /^((?!chrome|android).)*safari/i.test(navigator.userAgent); console.log(isSafari);…
-
3
votes3
answers758
viewsA: Generate Single Check Serials
You can generate a hash "unique" like that: $serial = hash('sha512', mt_rand()); echo $serial; Exit:…
phpanswered Gabriel Rodrigues 15,969 -
0
votes2
answers43
viewsA: Bring select in a row with 2 references
You can make a INNER JOIN of the two tables taking the id_product of the ordered table and id of the products table to solve your problem: Example: SELECT PE.ID_PRODUTO ,PR.NOME FROM PEDIDOS AS PE…
-
5
votes5
answers1552
viewsA: Restriction of words in comments
It would be interesting besides having a lock serve-side have a lock cliente-side so that the user can make the appropriate corrections is to send the comment without any prohibited word. If you…
phpanswered Gabriel Rodrigues 15,969 -
1
votes1
answer261
viewsA: Load div only after clicking on specific ID
Good if you want to load a content instead of leaving it pre-defined in html you can use the click event to pick up href and give an append in the value you want. Example: var texto = 'texto do…
-
1
votes1
answer89
viewsQ: Macros in coordinates related to the textarea
I need to insert some macros in a text area, these macros can be inserted anywhere in the field, currently I only use one append that just puts the macro at the beginning. I’m thinking of getting…
-
4
votes1
answer636
viewsA: how to show and hide a div
You have several problems in your code if it’s even your complete code, To start you are not separating your javascript from html, you must use a <script></script> is since you use…
javascriptanswered Gabriel Rodrigues 15,969 -
1
votes1
answer6989
viewsQ: mb_convert_encoding vs utf8_encode()
I did an update on php on the server and identified that they were not being coded in the standard utf-8, the first thing I checked was the connection class I use, which in this case is adodb. In my…
-
2
votes2
answers1787
viewsA: Take multiple values from a multi select
You don’t have to put []. Working example: HTML <form method="POST" action="../../model/php/teste.php" > <select id="opcoes" name="opcoes[]" class="select" multiple="multiple" size="5"…
phpanswered Gabriel Rodrigues 15,969 -
8
votes2
answers720
viewsA: What Means Two Keys in Javascript
In this example: var a = {}; console.log(a); It is only used to initialize an object with no value in it. In his Example: mozL10n.get('page_of', {pageCount: pagesCount}, 'de {{pageCount}}'); It is…
-
0
votes4
answers814
viewsA: Repeat alphabet similar to excel columns
You can do it this way too : function numberToColumnName($number){ $abc = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; $abc_len = strlen($abc); $result = ""; $tmp = $number; while($number > $abc_len) {…