Posts by Diego Lopes Lima • 2,328 points
58 posts
-
4
votes2
answers259
viewsQ: Regular expression error in PHP
Could anyone tell me why this regular error expression in PHP? /:[^\/\\]*/ She’s being used this way: return '/' . preg_replace('/:[^\/\\]*/', '([^\/]*)', $value) . '/'; I am trying to "break" one…
-
8
votes2
answers390
viewsQ: How to implement A/B testing?
How can I implement A/B testing on a new system? I am developing a tool and would like to compare the results of each modification, but I have no practical knowledge of how to implement this type of…
testingasked Diego Lopes Lima 2,328 -
4
votes3
answers1661
viewsA: Identify Urls and create links
To accomplish this task, the technique is the same used for Bbcode. You need to use regular expressions to identify possible Urls and replace them with filled anchors. I created an expression to…
-
6
votes8
answers61967
viewsA: Should I use input type="Submit" or button type="Submit" in forms?
None is wrong, but input refers to a data input element, and a Submit button, unless it is useful to use its attribute value does not aim to wait for data entry. So by logic the most correct would…
htmlanswered Diego Lopes Lima 2,328 -
9
votes2
answers195
viewsA: Jquery display: name
The error is typing and usage. Replace with: <script> $(document).ready(function() { $('.logo').css('display', 'none'); }); </script> The method jQuery.fn.animate does not work for the…
jqueryanswered Diego Lopes Lima 2,328 -
8
votes3
answers1134
viewsQ: Retrieve statistics from a website
I would like to know how to retrieve Google Analytics statistics on my website in real time. The idea is to recover data such as how many visitors I have online at the time on a given page or how…
-
13
votes5
answers2054
viewsA: Why put Javascript, CSS, and images on another server?
It’s a technique called CDN. This technique consists of ordering the file from a widely used server. You can import for example a jQuery script from the Google server. But why? Well, if the user has…
-
0
votes2
answers2165
viewsA: Jquery css if color text condition
Your syntax is wrong, you should use a literal object in the function parameter jQuery.fn.css, so you can spend as many properties as you need. Take an example: $('#btnContactMob').css({…
-
2
votes3
answers16195
viewsA: How to replace src of an img tag?
You can change the property src using an identifier or something you can select from the image. Then you can retrieve the node from it with javascript and edit any attribute. Example: var //…
-
2
votes2
answers648
viewsA: Jquery validation in mvc fields
The jQuery Validate can help you. It is possible to validate a multitude of things very easily. If you have any difficulty leaving an Issue in the repository, I am the maintainer and can help you…
-
5
votes4
answers1502
viewsA: Divs floats in a container with height auto
You can use a technique known as clearfix, which consists of the next element or pseudo-element having display:block; and clear:both;, ensuring that it increases no matter how much content is…
-
3
votes1
answer5316
viewsA: Uncaught Syntaxerror: Unexpected token
Your syntax seems to be completely wrong, I think the correct is something like: $(document).ready(function() { $(".fancybox3").fancybox({ openEffect : 'none', closeEffect : 'none', helpers : {…
-
5
votes7
answers3901
viewsA: What does incrementing mean?
Increment is the term that defines the action of adding a new value to an existing one. In most languages by default the term defines the sum of an existing number with 1. Example in javascript: //…
terminologyanswered Diego Lopes Lima 2,328 -
11
votes2
answers141
viewsA: Uninstall browser by console
The command delete navigator; not "uninstall" the browser, the delete serves to delete variables and levels of literal objects for example. In your case you are trying to delete the native global…
-
4
votes3
answers261
viewsA: Capture click with Jquery and add css
Correct to: $(".produtosMenuItensDiplay").css("display", "block"); The first parameter is the property and the second is the value, but you can also pass a literal object to edit more than one…
-
1
votes4
answers43355
viewsA: Check if string has only numbers
You can test String with a regular expression: /^\d+$/.test('0'); // Retorna true. Whereas '0' is the number received in String. If you want to accept broken numbers she can be like this:…
-
5
votes1
answer370
viewsQ: Typescript syntax
I am studying Typescript but do not understand what this example means: interface Person { firstname: string; lastname: string; } function greeter(person : Person) { return "Hello, " +…
-
0
votes2
answers1613
viewsA: Simulate a keyboard key when losing focus
Cannot simulate a specific key, only an event. Perhaps if you could be more specific with your need there might be other solutions. If you want to fire a function either by pressing enter or by…
jqueryanswered Diego Lopes Lima 2,328 -
0
votes3
answers1358
viewsA: You can run the same site on different domains
The company that registered your domains probably has an administrative panel for you where it is possible to configure the functioning of these. Among the settings you can choose options, such as…
-
2
votes2
answers3494
viewsA: How to change the text of the OK button of Alert?
At the end of alert use the function confirm, she returns true if the user confirms the action, but the button text of both functions cannot be changed, it is relative to the browser used. Another…
-
1
votes2
answers374
viewsA: Joining Modal Bootstrap with HTML5 History API
Well, I think setting an example would take a long time, but I’ve done something like this and I can help you with logic. First you need any form of a server language, in the case of PHP you will…
-
2
votes1
answer212
viewsA: Integration test connected to an FTP
I shared my question and some fellow developers helped me with some dirt. I came to this link which is a page about Travis-ci Custom Deployment specifically:…
-
5
votes1
answer212
viewsQ: Integration test connected to an FTP
It is possible to-or if there is a tool that enables me to send certain purchases of a project to an FTP after it passes a continuous integration test (Travis-ci for example)? The idea is that after…
-
1
votes2
answers3697
viewsA: How to recover values of fields loaded with jQuery
This is because when delegating the event to the button, it does not yet exist in the DOM. For the event to work with an element that will still be loaded into the DOM, you can delegate the event to…
-
3
votes5
answers363
viewsA: What does ? and : within an expression?
It’s a tender squeeze of a check. The syntax is: conditional ? true : false. Or: "se isso retornar true" ? "retorne isso" : "se não, retorne isso". In your case, in the variable maior you are…
-
2
votes4
answers1002
viewsA: How to reset the hour and decrease a day of a DATETIME?
That takes care of: <?php echo date("Y-m-d", strtotime("2014-03-27" . " - 1 days")); ?> "2014-03-27" being its specific date. You can put static time on your custom "reset" date: "2014-03-27…
-
3
votes3
answers24782
viewsA: How to sort an array by values?
If the values are just numbers, something like this can solve: array.sort(function(a, b){ return a > b; }); In this case I am comparing each value in the Array with the next value, establishing a…
javascriptanswered Diego Lopes Lima 2,328 -
1
votes1
answer194
viewsA: Grid Sytem Bootstrap
Did you import the CSS files from Bootstrap? (I couldn’t find it in your example) Twitter Bootstrap works with a CSS that contains a collection of classes and mixins to aid development. If you still…
-
3
votes2
answers545
viewsA: With which files should you use the <link> tag with Bootstrap?
You can include only the bootstrap.min.css, the bootstrap-Theme.min.css is optional, in case you want to take advantage of some styles of a standard theme or in case you want to edit it and create a…
-
6
votes4
answers20028
viewsA: Detect if an element contains a class with pure Javascript
I believe this is the most compatible way with most browsers and situations, as well as allowing to check more than one class: Node.prototype.hasClass = function(value) { var has = true, names =…
javascriptanswered Diego Lopes Lima 2,328 -
2
votes1
answer54
viewsA: Why is triggerHandler only affecting the first on the list?
In fact I believe that you are not exactly wrong. What happens is that jQuery.fn.triggerHandler really only fires the event to the first node. In your case the use of jQuery.fn.trigger? Maybe…
jqueryanswered Diego Lopes Lima 2,328 -
4
votes5
answers141242
viewsA: How to get the current date and time without using the computer clock?
PHP takes the time from the server apache is running on. It is probably the same as your computer clock because it is running on a local server, but when the same script is run on a hosted server,…
-
1
votes7
answers3980
viewsA: How to check if there are numbers inside an input with Javascript?
I think the best solution is to check if the key being pressed corresponds to a number. Something like this should solve the problem: $('input').on('keypress', function(event) {…
javascriptanswered Diego Lopes Lima 2,328 -
7
votes2
answers405
viewsA: How to make a constant object in Javascript
I believe something like Object.freeze(object_teste); solve your problem. This function "freezes" the object, leaving it unchanged. I believe the script below helps with recursion in case you need…
-
2
votes2
answers3379
viewsA: How to avoid sending PHP requests in a row?
An efficient way to avoid multiple unnecessary requests followed is to use a captcha service, so the request is only made once and after the user sends the captcha, this avoids multiple requests and…
-
3
votes2
answers182
viewsQ: Animation namespaces in jQuery
For those who are already used to using jQuery, use the function jQuery.fn.stop is something simple and very common when we work with different animations in a common element. My doubt is focused on…
-
4
votes3
answers153
viewsA: Include link if first element
Maybe something like that: // Delega um evento de clique para a primeira âncora do menu mesmo que tenha sido criada após o primeiro carregamento do DOM. $(document).on('click', '#menu a:first',…
-
0
votes2
answers278
viewsA: Slow to load facebook like button
With the div, I’m not sure there’s a way. But if you use directly the generated iframe of the respective buttons you can delegate a load event normally to them as to a common window.
-
4
votes2
answers61
viewsA: How to remove automatic comments generated by Compass?
Change the settings in your config.Rb. You can set the variable output_style for :compressed for example. In the line comment of this variable, by default comes written other options, you can test…
-
1
votes4
answers4165
viewsA: How to pass parameters through the URL in Wordpress?
You can add something like this to your functions.php. <?php function add_my_var($public_query_vars) { $public_query_vars[] = "var_name"; return $public_query_vars; } add_filter("query_vars",…
-
3
votes4
answers6633
viewsA: How to make the browser "Back" button work on an AJAX site?
For this you need to authenticate the URL so that the browser really comes back. In the case of AJAX I know two ways, one is with URL comments, the famous hash (#) or another method that I find more…
-
0
votes2
answers205
viewsA: Problem generating content via Jquery
In your query try to use LIKE %%to the comparison, from what I understand, I believe it solves: "SELECT DISTINCT AnoDeAplicacao FROM planodeensino WHERE planodeensino.DepartamentoPorExtenso LIKE…
-
4
votes4
answers1759
viewsA: How do I make all items in a menu equal in size regardless of quantity?
Define display:table-cell; for li’s, so will behave as cedulas of tables and consequently fill all available space.
-
4
votes6
answers8117
viewsA: How to remove a "href" from a <a> tag with Jquery/Javascript?
If this is your case, you can also cancel the default anchor redirect event with the event itself: $('a[href]').on('click', function(event) { event.preventDefault(); });…
-
11
votes6
answers8117
viewsA: How to remove a "href" from a <a> tag with Jquery/Javascript?
Would just be that? $('a').removeAttr('href');
-
0
votes2
answers326
viewsA: How does the jQuery stack (stack) work?
It’s quite simple actually, the selection functions, return the element itself, so you can use the so-called chaining to give a natural continuity in the script. It’s like doing something like this:…
-
0
votes3
answers89
viewsA: Equations in module
Would that be all? Could you please be more clear? $('.elemento-1').height() - $('.elemento-2').height()
-
3
votes4
answers7395
viewsA: What’s different from jQuery’s find and filter?
The find seeks us within an element, while the filter filters selected nodes with another selector. $('div').find('p') looks for paragraphs within div’s, while $('div').filter('.a') selects only…
-
3
votes7
answers43303
viewsA: How do I know if a variable is of the Javascript Number type?
You refer to checking the type of the value or only if it is numerical? If you want to know if it is numerical you can check with a regular expression. The case below accepts the "float" format so…
-
3
votes5
answers76380
viewsA: How to pin a "horizontal menu" to the top of the window when scrolling the page?
You can check like this: $(window).on('scroll', function() { if($(this).scrollTop() >= $('.menu').offset().top) { $('.menu:not(.fixed)').addClass('fixed'); } else…