Posts by Gabriel Rodrigues • 15,969 points
440 posts
-
2
votes2
answers763
viewsA: Jquery consuming Web Service Rest
A solution made with jquery using the $.each to traverse the object. Example: var dados = [{ "id": 1, "nome": "Hospital Da Mulher", "cep": "60508090" }, { "id": 2, "nome": "Hospital Maria jose",…
-
0
votes1
answer550
viewsA: Generate Html second Json object
Your code has some errors like $.each syntax and the use of a jquery selector, let’s go to the following example, Let’s say you have a div with content id like this: <div…
-
11
votes3
answers207
viewsA: I need a function to add <br> under certain conditions
I wouldn’t particularly use js or php to do this, you could solve the line break just using word-wrap:break-word of css, thus: .post { background-color: #FFF; border: 1px solid #e1e8ed; padding:…
-
0
votes1
answer42
viewsA: is not checking whether a button is checked or not
If you put a alert() in the first if it will be fired, there must be something wrong with its piechart function(); Example: if (document.getElementById("circular_select").checked === true) {…
jqueryanswered Gabriel Rodrigues 15,969 -
2
votes1
answer522
viewsA: Login with Cookie or Session on PHP5
You can use only $_COOKIE. You can set the values in one $_COOKIE thus: setcookie("loginCredentials", $user, time() * 7200); // expira depois de 2 hours To depress you can just leave the cookie…
-
1
votes2
answers491
viewsA: I cannot create php class and use PDO connection
If this is your complete code, you may have forgotten to call the function pegaDataConta(), if you are already calling her, below the $pegaData->execute() make a…
-
0
votes3
answers283
viewsA: remove dynamic div with jQuery counter
Try it like this: $("#rmv").click(function{ $('.campos').remove(); }); Make sure that the div you want to remove has a class called fields. See working on: Jsfiddle…
-
2
votes6
answers886
viewsA: Regular expression to grab the background-image url
It can be done like this: console.log(verificaBg()); function verificaBg() { var arrayBg = []; $.each($('div'), function(key, val) { arrayBg[key] =…
-
10
votes3
answers14943
viewsA: A Base64 image loads faster than a url?
A Base64 image loads faster than a url? No, encoded images are 37% larger that the original ones, which will increase bandwidth usage. On the other hand including it in the file will remove another…
-
5
votes1
answer866
viewsA: How does the responsive utilities of Bootstrap work?
If you take a look at the bootstrap css you will notice the following code: @media (max-width: 767px) { .hidden-xs { display: none !important; } } @media (max-width: 767px) { .visible-xs { display:…
-
5
votes2
answers8546
viewsA: How to set and pick objects saved in Javascript session
sessionStorage does not directly accept an object because it is created by key/value, a way to insert and then read an object is to string it with the JSON.stringify() function, then you can take…
javascriptanswered Gabriel Rodrigues 15,969 -
2
votes3
answers94
viewsA: How to stick with just one part of the string?
You can also solve by taking the position of the delimiter '-' with strripos() and just cut what you need with substr(). Example: $palavra = 'idPergunta-18'; $posicaoDeCorte = strripos($palavra,…
-
5
votes2
answers386
viewsA: Assign numbers to PHP phrases
From what you specified in your question I can give you an idea of how to do this simply, use an array to store your sentences and have the function array_rand() resume an Indice random that will be…
-
1
votes1
answer2600
viewsA: How to open a new pop-up window by clicking anywhere on the page?
Put the function outside the window.onload that will work. Example: document.onclick = function( e ){ myFunction(); } function myFunction() { window.open("http://google.com", "_blank", "toolbar=yes,…
-
3
votes3
answers346
viewsA: .serialize() only lines marked with checkbox
You can use the parent() to access the tr of the selected checkbox and make a serialize of it, example: var tr = $('#form input:checkbox:checked').parent().parent(); tr.find(':input').serialize();…
-
4
votes5
answers3336
viewsA: How to mix an array in Javascript?
You can do it like this: function shuffle(o) { for (var j, x, i = o.length; i; j = Math.floor(Math.random() * i), x = o[--i], o[i] = o[j], o[j] = x); return o; } var myArray = ['1', '2', '3', '4',…
-
4
votes1
answer126
viewsA: Problem with Bootstrap menu
If you want to leave the bootstrap default settings for resolutions equal to and less than 767px you can use media query to use your custom css only at higher resolutions, example: @media screen and…
-
5
votes2
answers57301
viewsA: How to limit decimal places?
You can achieve the expected value using the function floorf(), thus: #include <iostream> #include <cmath> using namespace std; int main(){ float x = 2.958; cout << floorf(x * 100)…
-
0
votes2
answers10133
viewsA: Uncaught Referenceerror: Function is not defined
Ariel, your problem is the scope, the message you are sending is that the function you are calling is undefined, when trying to access a function/function method __startGame() calling for changep().…
javascriptanswered Gabriel Rodrigues 15,969 -
1
votes3
answers636
viewsA: How to deselect checkboxes when only one is selected?
You can solve it like this: $('input').click(function() { $('input').prop('checked', false); $(this).prop('checked', true); }); <script…
-
1
votes2
answers206
viewsA: Place ID inside a TITLE
you can use the attr() to access the title attribute and put the new value, and then use it to pick up again, example: $("div").click(function() { $("div").attr('title', 'Meu Título'); // coloca a…
htmlanswered Gabriel Rodrigues 15,969 -
3
votes1
answer547
viewsA: Collapse Bootstrap
You can solve it like this: Example 1: $("[data-target='#gestao']").click(function() { $("#governanca").removeClass('in'); }); $("[data-target='#governanca']").click(function() {…
-
1
votes3
answers105
viewsA: Automatic scroll to the right
I will put an example of how it could be done using pure javascript only, since the answers of the others is already done with jquery: document.addEventListener('DOMContentLoaded', function() { var…
-
0
votes3
answers749
viewsA: Animate Load by clicking
1 - How do I animate Load when loading? In my tests I tried to use only fadein() and it did not result in anything, I put an Hide() before and managed to make the transition effect. 2 - Is there any…
jqueryanswered Gabriel Rodrigues 15,969 -
2
votes4
answers356
viewsA: Two-dimensional Array
The syntax of your for this wrong, if you use ; and not ,, made an example that will return all values, inside the if just put the action if the chair is vacant: var cadeiras = [ [true, false,…
-
1
votes3
answers989
viewsA: Execute command with variable -JS
Instead of turning every jquery method into a string and saving it into a variable you can run straight by just passing as a property of an object: function embaralhar_efeito(o) { for (var j, x, i =…
-
1
votes3
answers76
viewsA: How to get only strings containing the word "x"
Only one detail to get 100%, your condition should be modified to: if (strpos($string, 'comprar-toyota')) and not: if (strpos($string, 'comprar/toyota') > 0) The problem is exactly in the return…
-
2
votes4
answers222
viewsA: Doubt in jQuery variable creation
The two forms work the same, it ends up being a matter of convention because some programmers like to create variables with the dollar at the beginning to identify that the variable has some jquery…
-
4
votes1
answer585
viewsA: Code operating at a given time
With Javascript ? It’s simple: I took only the hours and checked if it fits the quoted time, inside the if is just put the function you want to run. Example 1: var d = new Date(); var hora =…
javascriptanswered Gabriel Rodrigues 15,969 -
4
votes2
answers411
viewsQ: What are the differences between find() and eq() selectors?
I am conducting some tests to understand what is the difference of the simple use of a selector eq() and find(), to be able to select the first row of a table for example. Example 1: $('table tbody…
-
4
votes2
answers2678
viewsA: css files in Laravel 4
Put your css in the briefcase project/public/css/. To call in your template file Blade can be like this: <link href="{{ asset('css/app.css') }}" rel="stylesheet"> or {{ HTML::style(…
laravel-4answered Gabriel Rodrigues 15,969 -
0
votes4
answers842
viewsA: Write MYSQL data in en / UTF8 format
Try it like this: $pdo = new PDO( 'mysql:host=' . DB_HOST . ';dbname=' . DB_NAME, DB_USER, DB_PASS.':charset=utf8' ); or $pdo = new PDO("mysql:host=$host;dbname=$db", $user, $pass,…
-
0
votes3
answers4204
viewsA: Div exceeding Modal width limit
I rewrote the modal showing only how to solve the table problem that exceeds the modal size. It is not advisable to use css inline and repeat type Styles text-align:left. When you include bootstrap…
-
14
votes3
answers26056
viewsA: How to block special characters in the field
I did it this way, it will allow only letters and numbers: document.getElementById("teste").onkeypress = function(e) { var chr = String.fromCharCode(e.which); if…
-
0
votes2
answers190
viewsA: Closed JS open panel
Hitch, since you didn’t post the full code, I noticed you’re using the Bootstrap - Collapse If you need to leave all Collapse closed at the beginning is quite simple, just remove the class in in the…
-
17
votes1
answer975
viewsA: What is an SVG?
What is svg ? SVG is the abbreviation of Scalable Vector Graphics that can be translated from English as scalable vector graphics. It is an XML language for vector describing two-dimensional…
-
2
votes1
answer103
viewsA: Layout with 100% width and/or 10% height
To create a layout that is compatible with Iphone and Ipads is necessary to have the knowledge of Auto Layout. First thing to be defined in size class is the compatibility, in this image it would be…
-
3
votes2
answers730
viewsQ: Text Editor with RTF support
I need to find a text editor with RTF support. Goal: Write and format in html and save in RTF, then take RTF and edit in html. I searched the documentation of several publishers to see if there is…
-
1
votes4
answers447
viewsA: How to change the link in the mobile version?
You can use screen.width to check if it’s mobile or desktop. Example: console.log(screen.width); <- Shows the width size of your device. knowing this you can do something like: if (screen.width…
-
4
votes2
answers191
viewsA: Customization scroll bar
Define styles for scrollbar is a rarity, they are not part of the W3C standard for css, and therefore, most browsers simply ignore. But there are Webkits that allow customization, in my tests I…
-
2
votes3
answers14718
viewsA: How to put line breaking in a textarea?
you can concatenate your string with <textarea cols='60' rows='8'>Primeira Linha. Segunda Linha</textarea>
phpanswered Gabriel Rodrigues 15,969 -
0
votes3
answers1132
viewsA: Problem with vector in C
@user8470 When we’re trying to learn how to program we have a vision that everything we read will become code on the fly,it in parts to try to solve, in this way you minimize the difficulty and…
-
1
votes1
answer1406
viewsA: How to open another viewControler on Swift?
To open a new controller you need to write like this inside a button click event: self.performSegueWithIdentifier("SegundaViewController", sender:self) You can also do in visual form, which would be…
-
2
votes4
answers658
viewsA: How to test the condition on a vector?
Funny, your code compiled normally, the only thing I had to add to overwrite all first letters with * was an if checking if the first position is different from empty, so when the user type the…
-
4
votes2
answers3385
viewsA: How to test an application without registration?
If you download Xcode 7 Beta it already provides the option to test the application without the need to pay a 99$ license, and a tip, use Testflight, with it you can send your app to your friends to…
-
4
votes1
answer931
viewsQ: Layout Template and Routes
I’m working on a system that uses MVC as follows, View -> HTML,CSS Model -> PHP Controller -> JS Basically all system actions work by going through the following order: User triggers some…
-
1
votes2
answers506
viewsA: Autoload of Models in Laravel 5.1
You have to use use and the way to models ou controllers, example: File Productocontroller.php, I’m getting the model Product like this: use app\Produto;…
-
5
votes1
answer5964
viewsA: How to print the contents of a page with Bootstrap and Jquery?
If your goal is to have a button that uses the bootstrap classse and only usebtn btn-primary for example, and if you do not want to open in new open and only remove the target_blank, from what I…
-
2
votes2
answers107
viewsA: How to fix multiple errors in this code?
Solution implemented in C++: #include <iostream> using namespace std; int main(){ float n1[6],n2[6],mediaTurma = 0; int nrMatricula[6], maxCad = 2, mediaInferior = 0 ; for(int i = 0 ;i <…
-
2
votes2
answers13081
viewsA: Storing data from a form
Here is a full example of how you can save the files in txt and then read them. Save to an html file and test. function saveTextAsFile() { var textToWrite =…