Posts by Gabriel Rodrigues • 15,969 points
440 posts
-
0
votes2
answers50
viewsQ: How to sort array based on an object array
Problem: I’m trying to sort an array of boxes according to the tags so that the more compatible tags the more you’ll be in the first place. tags = ['new', 'tech']; boxes = [{ id: 1, name: 'tech…
javascriptasked Gabriel Rodrigues 15,969 -
1
votes1
answer239
viewsA: How do I stop leaving two radio buttons, one on the other using Angular and IONIC 3
To horizontal remove ion-list and try so: <ion-row radio-group> <ion-col> <ion-item> <ion-label>PF</ion-label> <ion-radio ></ion-radio> </ion-item>…
-
5
votes5
answers683
viewsA: How to take input readonly
Just fix your selector by putting simple quotes around input[name="funcionario]" and then fix the readyonly the correct is readonly read = read and only = only. $("#btnEditar").on('click',…
-
-3
votes1
answer6033
viewsQ: How to validate a CRM Medical Record?
I need to validate information to determine whether the user of my system is a doctor or a patient, in this case CRM, and I would like to know if there is any free API that validates or some…
-
3
votes2
answers205
viewsQ: How to return hexadecimal color randomly
I’m wanting to each build change the css of my application randomly. Example: $menu-color: #0097a7; // retonar apenas uma cor $menu-color: random(#0097a7,#FAFAFA,#7FB800); // retorna uma color…
-
3
votes1
answer100
viewsA: How to make animation occur multiple times
On the Github of daneden teaches how to do this using jQuery. Example: $.fn.extend({ animateCss: function(animationName) { var animationEnd = 'webkitAnimationEnd mozAnimationEnd MSAnimationEnd…
-
2
votes1
answer292
viewsQ: How do I create a shortcut on a website’s desktop when using Chrome?
I would suggest to the user when he enters my system create a site shortcut on his computer, this can be done manually by going to "Mais Ferramentas -> Adicionar a área de trabalho": How could I…
-
5
votes2
answers887
viewsQ: How to insert text at cursor position?
How can I insert text at the position of a cursor? the field is a contenteditable so it can contain in addition to normal html css text and images. I took the example in the plugin documentation:…
-
2
votes1
answer67
viewsQ: How to create optional parameters in Soapserver
I’m using the native class of PHP to create a Soap server. Example: class Bar { public function getDrink($age, $money, $name) { if ($age >= 18 && $money == 5): $drink = "Heineken"; else:…
-
3
votes2
answers531
viewsQ: How to Drag and Drop button in a textarea?
I am creating an email editor and it will have some macros, I made some examples of drag and drop using images, I wonder if it is possible, or even if it is interesting to use buttons to be…
-
12
votes2
answers1794
viewsQ: How to Thread a class method
I need to perform a parallel process using php, I installed the extension pthreads and I looked at some examples but didn’t see how I could implement it. Class: <?php class Negociacao{ /* Retorna…
-
2
votes2
answers108
viewsA: Replicate val() content in span
The normal would be to add the span selector and use the html() method to insert the text in this way: $("[name='email']").keyup(function() { var email = $(this).val();…
-
3
votes2
answers35
viewsQ: How to Catch Variable Macros in a String
How can I take macros from a string, so that they are just what you have between [...]. I tried this way, but it can be broken, has some way of doing using regular expressions? var texto =…
javascriptasked Gabriel Rodrigues 15,969 -
2
votes2
answers747
viewsA: How to prevent iframe from being redirected to the beginning
I made some modifications but the idea was this @Laerte. I left the default url and every time the person changes page is saved in the sessions, if the page is not found it redirects to the home…
-
3
votes4
answers345
viewsA: How to select an option with value comparison?
You can make a each in your options selector and check if the value matches your return, and after that add Selected option. Example: var valorEstado = 3; $("#estado option").each(function() { if…
-
2
votes2
answers2039
viewsA: File extension in Base64
Base 64 images comes with a standard: "data:image/gif;base64,.....", you can pick up from the first / until the first ;. Example: $imgBase64 =…
-
0
votes3
answers1100
viewsA: Change the iframe (embed bootstrap) according to the navigation bar button
Another way of doing: var iframe = $(".embed-responsive-item"); $("#menu li a").click(function() { iframe.attr('src', $(this).data('src')); }); <script…
-
0
votes4
answers2211
viewsA: JSON Object Object Object
If this is your standard Objeto -> Array you can do one for to grab the keys and the other for to scroll through the values of this array. var json = { "name": ["daniel", "dias"], "morada":…
-
7
votes3
answers2984
viewsA: Delete a specific row from an html table with jquery
To remove dynamically you can do: $(".excluir").click(function() { $(this).parents('tr').remove(); }); <script…
jqueryanswered Gabriel Rodrigues 15,969 -
1
votes3
answers1486
viewsA: Send form with ajax and return errors in a div
According to your return you can show success messages, attention, error or any other you wish. Example: var msg = function(alerta, texto) { var resposta = ''; $(".resposta").empty(); switch…
-
0
votes2
answers1846
viewsA: Open dynamic button modal pressed via ajax
Your problem is that the button was not loaded into the gift at the time you were creating the selector, so it does not exist yet, to get around this problem you can use the bootstrap documentation.…
ajaxanswered Gabriel Rodrigues 15,969 -
2
votes1
answer608
viewsQ: How to make persistent connection using Websocket and a Delphi Socket server?
I’m trying to create communication via Websocket with a Delphi socket server, 1st Step, readystate 0 - Server receives Websocket header. Step 2, readystate 3 - Go to disconnected. Javascript: var…
-
3
votes2
answers297
viewsA: select the same id with different numbering jQuery
If it is to make more dynamic with the same operation you can create an object with the key = page id and class value of the page and go through one by creating the li. and then perform the…
-
2
votes2
answers747
viewsQ: How to prevent iframe from being redirected to the beginning
I have an application that uses iframe to redirect pages without modifying the url. (I understand the consequences of doing this.) The problem is that when updating the page with F5 is redirected to…
-
3
votes2
answers700
viewsA: Call ajax inside another
You can create a promise, you can use the then to run the ajax prox. Example: function meuAjax() { return $.ajax({ type: "GET", url: 'https://httpbin.org/get', success: function(e) {…
-
3
votes1
answer2320
viewsQ: How to play fade effect in modal bootstrap to jquery ui dialog?
I am standardizing the modal visualization effects, in this project I have both bootstrap modal and dialog, it turns out that both have distinct effects. wanted to leave them only with fade in,…
-
6
votes2
answers16970
viewsQ: How to print A4 pages using CSS?
I currently use the mpdf library for reporting. However, in some reports I need to send more than 400 pdf pages and this ends up taking a long time and consuming many server resources. I even…
-
9
votes1
answer185
viewsA: Bug textarea with padding in Firefox
Actually, the padding all right bugle in Firefox. Once I also had a problem, but I opened a call on Bugzilla and was very fast the correction. If it is so important to use the padding, you can…
-
2
votes0
answers261
viewsQ: How to use scroll only in the table that is inside a modal?
I have a screen that has scroll, and on this screen access a search modal. This modal loads some information in table, so I use the shortcut keys to facilitate the navigation of it. The problem is…
-
1
votes2
answers2939
viewsA: Ajax/Jquery - How to know if a request has been completed?
You can also use the deferred methods to detect when you completed your request. These are executed after completion as a callback, using the same method chaining base in jquery. There are several…
-
1
votes1
answer197
viewsA: Tab system in jQuery with page Reload
Just add a switch in the click event, this must contain the id of the current tab, if it is the chosen the case performs some action. $(document).ready(function() {…
jqueryanswered Gabriel Rodrigues 15,969 -
3
votes1
answer53
viewsA: Include function to a field
You can use the input type as email, depending on the browser it will display the input as incorrect. most browsers already do so by default. but you can add a check by regex too, example: function…
-
5
votes1
answer2009
viewsA: Is there any way to validate an input in Angularjs without using form?
What you can do is use the directive ng-form. This way, it could stay like this: <div class="form-group" ng-form="nick"> <input name="nick" type="text" class="form-control"…
-
4
votes1
answer627
viewsQ: How to use Google Maps in Ionic to upload multiple locations
I’m using Ionic 1.3 and creating a Maps screen, this screen will feature a menu to select the specific destinations and another that is the maps with the location. Example of destination selection…
-
0
votes2
answers179
viewsA: Error generating pdf report (Jasper)
When I had to work with Jasper I had some problems with the path, even if I specified the correct path it couldn’t catch it, then I ended up using the root path of my project, which in this case is…
-
1
votes3
answers89
viewsA: SQL - Doubt in a query
I used with only to create a table and work with the select you have already defined, after that I only performed a group by Cod and a Count of the smallest records. with tabela as( select b.pront…
-
6
votes4
answers1229
viewsA: How do you know if a certain day is a weekend?
The mktime solves this problem, @Bacco already said the essential, I leave here just one more example: function finalDeSemana($aData) { $dia = substr($aData, 0, 2); $mes = substr($aData, 3, 2); $ano…
-
0
votes2
answers1572
viewsA: Hide modal by clicking the bootstrap "Close" button
You correctly used the data-dismiss="modal" but forgot to close style quotes and caused syntax error. To block the closing of the modal by clicking outside use the data-backdrop="static". Example:…
-
2
votes5
answers150
viewsA: Doubt with image positioning
It has the auxiliary bootstrap classes that do this, in this case the center-block. Bootstrap css images To center images that use the . img-Responsive class, use . center-block instead of .…
-
1
votes2
answers312
viewsA: How do I prevent my firebase application from being used on other websites?
The biggest issue at this point is to allow someone not authenticated to read/write the information in your database. by default Firebase blocks this. If you go on Menu -> DataBase -> Rules…
-
1
votes3
answers404
viewsA: Ajax Requests - Tips
Use compact methods Ajax is a very extensive method, you can use a more compact method that exists in the list of jQuery Ajax Shorthand Methods. List: jQuery.get() jQuery.getJSON() jQuery.get()…
-
4
votes1
answer928
viewsQ: Is it possible to restart the Nodejs server when a modification occurs automatically?
Every time I try to make some modification in my file app.js I have to close and start the server for the modifications to take effect, would there be any way to automatically restart after a…
-
0
votes1
answer140
viewsA: How to add text at specific position in String Array
You can use the Insert method by passing as the second parameter the position of the array to be inserted. Example: texto.insert(textoFixo[0], atIndex: 0); texto.insert(textoFixo[1], atIndex: 2);…
-
2
votes3
answers605
viewsA: How to get a String size correctly using UTF8?
Adding the small detail. In the documentation of replace Andreas Bur says: For UTF-8 character subsequence, I recommend mb_substr Example: <?php $string = "PAÇOCA"; echo strlen($string); echo…
phpanswered Gabriel Rodrigues 15,969 -
4
votes3
answers605
viewsQ: How to get a String size correctly using UTF8?
I’m doing some tests and I realized that when the string has special characters it is counted more than one in substr. Example: $string = "PAÇOCA"; echo strlen($string); echo substr($string, 0, 3);…
phpasked Gabriel Rodrigues 15,969 -
1
votes3
answers2364
viewsA: How to assign "Selected" to a dynamic option?
A good approach is to go through the for creating only one variable that will contain the entire option object to be inserted into html. this option has more performance because it is not accessing…
-
18
votes3
answers3574
viewsA: What are the functions of an ORM?
Introducing Object-Relational Mapping (ORM) is a technique that allows you to query and manipulate data from a database using an object-oriented paradigm. When talking about ORM, most people are…
ormanswered Gabriel Rodrigues 15,969 -
9
votes5
answers19859
viewsA: Is it possible to include a Javascript file within another Javascript file?
You can only include a script in an HTML page. knowing this you have some solutions to "simulate" the inclusion by javascript, as it would be? In my index.html file I have my scripts.js file, in it…
javascriptanswered Gabriel Rodrigues 15,969 -
2
votes3
answers270
viewsA: Simplifying an Array - PHP
You can do it like this: $foo = array(array(0 => 'Brasil', 1 => 'Franca', 2 => 'Italia'), array(0 => 'USA', 1 => 'Russia', 2 => 'China'));…
-
1
votes1
answer1003
viewsQ: How to create combobox in Swift?
I want to create a combobox to list all courses that my app offers but I did not find the corresponding component, alias found a similar and implemented Pickerview, but I would like to reproduce the…