Posts by Renato Gama • 1,405 points
24 posts
-
0
votes1
answer28
viewsA: Mongodb on air at AWS
You need to start Mongo with the flag --fork. The Fork flag requires another flag to indicate where the logs will be registered (since it will no longer be in the console itself). Example: mongod…
-
8
votes1
answer4198
viewsA: How to call a file in Node.js
For you to call your.js file you need to do so; In file.js module.exports = 'olá mundo'; //Você pode exportar qualquer coisa (não apenas uma string) module is a global variable injected into all…
-
1
votes1
answer396
viewsA: How to edit page after rendered with Node.js?
According to the express source code you can pass a callback to the function res.render, if you don’t pass a callback you may notice that the express itself provides a default callback that invokes…
-
9
votes2
answers2109
viewsA: How to advertise server IP on the network?
Peter, in fact searching the network for the service/device is unviable, especially if you can’t use something like nmap (with some Binding for the nodejs) on the client device. My suggestion is…
-
3
votes1
answer153
viewsA: How to discover the actions an element has when clicked?
John, there is! I use the Visual Event 2 which is a bookmarklet that you rotate on the page and it gives a visual reference to which elements in the DOM have events tied. The result is this: When…
-
6
votes3
answers736
viewsA: What kind of treatment can be performed in this case?
I will answer your questions by first making an analogy with real life, then commenting on the three points you raised: Imagine that you are an employee of an industry and your direct boss asks you…
-
6
votes1
answer8726
viewsA: How to get the value of a list of ckeckboxes with jquery?
You should wear it like this: var chk01 = $('#chk01').is(':checked'); var chk02 = $('#chk02').is(':checked'); var chk03 = $('#chk03').is(':checked'); Try: function teste() { var chklista =…
-
6
votes4
answers542
viewsA: Subsequent Calls in Ajax
I would do using async since Voce is willing to use an external library $(function() { async.eachSeries($('td.usuario').toArray(), function(td, cb) { var $td = $(td); $.ajax({ url: 'suaUrl',…
-
2
votes1
answer84
viewsA: Check compatibility with browsers
The polyfills are a way to use modern code in ancient browsers, but knowing exactly what should be treated is very difficult there Mozilla created Polyfill as a Service. It basically works like…
browseranswered Renato Gama 1,405 -
1
votes1
answer112
viewsA: Consult information from a website
CORS is a mechanism that allows a server’s resources to be accessed from a page in a domain other than the original domain. This happens to prevent just what you are trying to do and preserve server…
javascriptanswered Renato Gama 1,405 -
2
votes1
answer63
viewsA: Label with mouse cursor
You need to add a callback to the event mousemove, try it: window.onload = function() { document.addEventListener('mousemove', function(e) { var x = e.clientX, y = e.clientY; var info_souris =…
javascriptanswered Renato Gama 1,405 -
7
votes2
answers863
viewsA: How to include a indent when using the tab key in a textarea?
You just intercept the keydown when the keyCode === 9 $('textarea').bind('keydown', function(e) { if(e.keyCode === 9) { e.preventDefault(); var inicioDaSelecao = this.selectionStart, fimDaSelecao =…
-
2
votes1
answer1107
viewsA: How to handle Ajax requests with business error?
Not, this is not the best way. You should return an error 400. HTTP is an application protocol and therefore if you return 2xx code the client can assume that your request has been accepted…
-
9
votes1
answer3619
viewsA: Get the previous URL with javascript
document.referrer According to the MDN in my own translation; Returns the URI of the page that made the link. Returns an empty string if the user navigated to the page directly (not through a link,…
javascriptanswered Renato Gama 1,405 -
4
votes1
answer859
viewsQ: Is this a good way to keep my API safe?
My application consists of an API nodejs on backend but I’m also creating the reference implementation of a Javascript client, which is a SPAen made with Backbone. First: the API accepts only HTTPS…
-
5
votes2
answers4210
viewsA: how to represent a monetary field with semicolons in javascript jquery
Javascript has rounding problems, so any solution that includes the function .toFixed is not a good option. I recommend using libraries already tested. I I like to use two libraries together, which…
-
2
votes1
answer1561
viewsA: Upload only with jQuery.ajax and PHP
It is possible yes, using the HTML5 File API you can do it here; OBS.: Example with progress bar var percentageSent = 0; $.ajax({ type: 'PUT', //ou POST se for seu caso crossDomain: true, //true ou…
-
5
votes1
answer131
viewsA: How to allow typing only "yes" or "no" with Regexp in an input?
The regular expression that checks whether a string is "yes" or "no" is /^(yes|no)$/. But I believe that conceptually you are using the wrong component for this task. Solution:…
-
4
votes1
answer78
viewsQ: Is it possible to reduce this conditional expression?
In my project I constantly come across this kind of conditional expression: if(cliente && cliente.id) { return cliente.id; } else { return ''; } That is to say, "if there is a client and…
javascriptasked Renato Gama 1,405 -
9
votes1
answer78
viewsA: Is it possible to reduce this conditional expression?
Yes, To reduce this expression we must take into account that Javascript evaluates a conditional expression by returning the last value of the expression, which in turn is evaluated as falsy [1] or…
javascriptanswered Renato Gama 1,405 -
11
votes1
answer3845
viewsA: Slow datatables
James, the way you’re doing what happens is this; You make a request on the server You search all 5k records in the database You render a gigantic HTML with all the thousands of records The browser…
jqueryanswered Renato Gama 1,405 -
3
votes3
answers424
viewsA: How to check if a value starts with a bar followed by a message?
Test it out here; /^\/\{mensagem\}$/.test('/{mensagem}') //true or /^\/\{.*\}$/.test('/{aqui vem a mensagem do seu usuário}') //true If this message can be anywhere inside a larger string then…
-
2
votes2
answers122
viewsA: Heirs attributes with prototype do not appear in Javascript Reflection
You need to summon the animal builder in the rabbit builder. I corrected your example (and adjusted the convection of the functions in minuscule letter) here; http://jsbin.com/dikebekafa/2/edit…
-
1
votes2
answers670
viewsA: What is the difference of loading javascript in <script> or external file?
As Guilherme said, when you point to a Javascript file the browser necessarily makes one more request on the server, whether in the same domain or not. This incurs network latency, that is, a longer…
javascriptanswered Renato Gama 1,405