Posts by Beterraba • 2,265 points
33 posts
-
1
votes1
answer605
viewsA: How to get back data from a Angularjs post request
The problem is that the http call is asynchronous. One way to solve it would be to rewrite its function get_notas so that it performs a callback function: $scope.get_notas = function(callback) {…
-
0
votes1
answer30
viewsA: sublime plugins
If you have Package Manager: Ctrl+Shift+P $> Package Control: Remove Package Select the package you want to remove and confirm.…
sublime-text-2answered Beterraba 2,265 -
2
votes2
answers1216
viewsA: Make div daughter have same size as fixed parent
I’m not sure I understand the problem correctly, but you believe it solves your problem: .boxinterface{ max-width: 500px; margin:0 auto; height: 600px; box-shadow: 0px 1px 1px 1px rgba(51, 50, 50,…
-
3
votes1
answer34
viewsA: Allow value repetition in JS
You just need to check if the number being entered is 0: if ( (v_vet.indexOf(w_valor) == -1 && w_valor != "") || w_valor === 0) { v_vet[w_Cont_Qtde] = w_valor; w_Cont_Qtde = w_Cont_Qtde + 1;…
javascriptanswered Beterraba 2,265 -
1
votes2
answers2218
viewsA: Adding values with Angularjs
You can use the $watchCollection inside your controller. $scope.$watchCollection('items',function() { // Função disparada sempre que o objeto $scope.items sofrer alterações $scope.total = 0;…
-
2
votes2
answers275
viewsA: Multi-level in an OL
A possible solution: body { counter-reset: chapter; /* contador de capitulos */ } ol { list-style-type: none; } .chapter > li:before { counter-increment: chapter; content: counter(chapter)"."; }…
-
21
votes2
answers2610
viewsA: When to use prototype (JS)
The difference is best explained with an example: var Person = function(name) { this.name = name; } Person.sayHello = function() { console.log("Hello " + this.name); } Person.prototype.sayHi =…
javascriptanswered Beterraba 2,265 -
0
votes5
answers25953
viewsA: <input type="image" ...> with LINK and HOVER
To use the property background-image, you must explicitly set the element size. I think it’s best to use the tag button, in your case: <button class="button"></button> .button {…
-
2
votes3
answers1130
viewsA: Access negative index from an array
Javascript arrays have no negative indexes. What happens here is that you are creating a new property in the object Array, by the name "-3". The same thing happens if you use a word. For example:…
-
2
votes2
answers144
viewsA: Javascript object return syntax
Complementing the @Sergio response, it is necessary to put in the same line because the semicolon, in Javascript, is optional. When you do: return { prop: "some value" }; The interpreter understands…
-
0
votes3
answers1701
viewsA: Return of SQL SELECT
You can do it in many ways: select id from usuarios where login = '$LOGIN'; select count(*) from usuarios where login = '$LOGIN' limit 1; Sqlfiddle…
-
1
votes1
answer32
viewsA: How to add class when adding file
The problem with your code is that it doesn’t add any class to the p, it only rotates once during page loading. You need to watch the element change. Your Javascript should be something like this:…
javascriptanswered Beterraba 2,265 -
0
votes3
answers1434
viewsA: Mouseover effect with jQuery
You must use the method Hover() together with the keyword this. $(".classeDoLink").hover( function() { // Função executada no hover in // O this, aqui, é o elemento que recebeu o hover.…
-
1
votes2
answers24
viewsA: Place first result with greater margin than the others
Use an external div: <div id="contato-texto"> <div>Nome:</div> <div>Nome:</div> <div>Nome:</div> <div>Nome:</div> </div> And in the CSS:…
-
5
votes2
answers1258
viewsA: Word filter
You can use Regexp: var arr = ['teste', 'teste1', 'oteste2']; var f = document.querySelector('div').textContent; arr.forEach(function(el, index, arr) { var regexp = new RegExp("\\b(" + el + ")\\b",…
javascriptanswered Beterraba 2,265 -
2
votes4
answers425
viewsA: Query BD and show all results except the first
You can do a sub-discharge: SELECT * FROM tbl_galeira, (SELECT id as fId FROM tbl_galeira ORDER BY id ASC limit 1) f WHERE id > f.fId
-
7
votes5
answers2054
viewsA: Why put Javascript, CSS, and images on another server?
Images and CSS Browsers are recommended, in the HTTP/1.1 specification, to make at most 2 parallel downloads per host. If you have 4 images hosted on the same host, they will be downloaded two by…
-
4
votes2
answers1168
viewsA: Positioning scripts and css links in an html document
The tag <script> The reason to put the scripts at the end <body> is simple: Downloading scripts blocks parallel downloads. The HTTP/1.1 specification suggests that browsers do not…
-
2
votes2
answers9803
viewsA: Sending form via jquery ajax
In the documentation of $.submit() is written: Bind an Event Handler to the "Submit" Javascript Event, or Trigger that Event on an element. That is, assigns an Handler to the Submit OU event…
-
56
votes3
answers1321
viewsA: Why is it not recommended to use "_" (underscore) in HTML/CSS?
The 1996 CSS1 specification did not allow underscore in class names or IDS, unless they were "escaped" p.#minha\_id { color: #fff; } CSS2 (published 1998) banned the use of the underscore. A later…
-
6
votes2
answers2037
viewsA: How to set print options via javascript?
It is possible using CSS, via media type print Suppose you want to hide the tag header when prompted to print: <header> <h1> Preciso sumir na impressão</h1> <header>…
-
2
votes2
answers2008
viewsA: How to pre-process a text for the application in the Weka classification algorithms in Java?
WEKA reads a file in format ARFF. To create an arff file, you must define the following headers: Declaration of Relationship A name for the relation, defined in the first line of the file. It is…
-
18
votes2
answers17329
viewsA: What does "!" (exclamation) mean before a code snippet?
! is the negation operator. It returns the opposite of the resolution of the operation which it precedes. That is to say: !true == false !false == true !(2 == 2) == false !(2 == 1) == true…
-
3
votes3
answers28540
viewsA: Create an array with objects in Javascript
This happens pq vc is inserting the same object into the vector. By changing the field value, it changes the references in the vector. One way to settle this would be clone the object. Another way,…
-
5
votes5
answers41336
viewsA: Number formatting (PHP)
Use the function number_format: <?php $number = 1234.56; // Notação Inglesa (padrão) $english_format_number = number_format($number); // 1,234 // Notação Francesa $nombre_format_francais =…
-
5
votes2
answers97
viewsA: Remove banner depending on window size
You can use the @media @media screen and (max-width: 600px) { #getFixed { display: none; } } Fiddle…
-
2
votes1
answer1444
viewsA: Call Method in Routes in Angularjs
You can do the following: Create a second controller, specific for product details angular.module('myApp', ['$routeProvider', function($routeProvider) { $routeProvider…
-
2
votes3
answers1752
viewsA: How to take the current position of a div by his class?
You can select the elements via jQuery. The array will be in the order that these appear in the DOM. $(".position").each(function(index, el) { $(this).text("Pos: " + index); }); Fiddle…
-
11
votes3
answers4980
viewsA: What is the usefulness of the til operator in CSS?
Would be the "general brother". It looks like the adjacent brother operator (+), differing at the point that the element being selected need not immediately succeed the first, but anywhere after.…
-
16
votes2
answers622
viewsA: What is the /** code for in the java language?
To insert comments into the source code, in Java, you can use one of two ways: // Comentário em uma única linha /* Comentário que se divide em várias linhas */ When writing comments of the form…
-
1
votes4
answers6021
viewsA: Exchange text by clicking on it to display/hide an element
In addition to the option given by @Cesarmiguel, if you want to use Javascript only, you can do so: function blocking(nr, click) { var elementStyle = document.getElementById(nr).style.display; var…
-
10
votes3
answers9800
viewsA: How to keep a server nodejs running permanently?
You can use the nohup: $ nohup node server.js > output.log & This way, you can drop and the server will remain active. To run "forever", I recommend using the Forever. $ npm install forever $…
-
0
votes5
answers213
viewsA: CSS Child selectors on IE8?
You can use the IE9.js. Only include: <!--[if lt IE 9]> <script src="http://ie7-js.googlecode.com/svn/version/2.1(beta4)/IE9.js"></script> <![endif]-->…