Posts by abfurlan • 10,570 points
221 posts
- 
		1 votes3 answers1491 viewsA: ORDER BY ASC and DESC at the same timeAnother solution would be to repeat the CASE in the clause ORDER BY, example: SELECT mc.competencia, CASE WHEN (COALESCE(mc.valor_pago, 0.0) = COALESCE(mc.valor_devido, 0.0)) THEN 'success' WHEN… 
- 
		1 votes1 answer41 views
- 
		5 votes1 answer850 viewsA: How to put special characters with ::after?You need to use CSS Unicode character, example: h1::after{ content:"\00a9"; font-size: 14px; position: relative; top: -10px; left: -5px; } <h1> Empresa </h1> List of special characters… 
- 
		3 votes3 answers406 viewsA: Disable input sequence with jQueryIf you can change your html code and involve the inputs with a div for example, you can use the function siblings jquery for this, example: $(document).ready(function () { //classe do checkbox… 
- 
		2 votes1 answer1114 viewsA: How to decrypt records from an SQL column - QueryIt’s not about cryptography, your field is apparently the type VARBINARY, if yes just make a CAST for VARCHAR, example: SELECT CAST(Descricao AS VARCHAR(MAX)) as Descricao Sqlfiddle… 
- 
		2 votes2 answers2757 viewsA: Search a key array and return valueYou can use the function array_walk_recursive, example: $array = array('bio'=>array('info'=>array('cash'=>'50'))); function printFind($item, $key){ if($key == 'cash'){ echo $item; } }… 
- 
		1 votes2 answers249 viewsA: Leave autocomplete search in boldYou can use the method ._renderItem and capture the typed text, make a replace in return by adding for example the tag strong, example: $( function() { var availableTags = [ "ActionScript",… 
- 
		3 votes3 answers5506 viewsA: Format string or float for currencyIt would be better to use function Intl.Numberformat of the object Intl, it facilitates formatting numbers according to language, example: //Instanciando o objeto var formatter = new… 
- 
		4 votes4 answers5086 viewsA: How to add values of a column in the table?You can go through all the last cells of each row of the table body, example: var total = 0; //loop por total as últimas células de cada linha do corpo da tabela $('table tbody tr… 
- 
		5 votes3 answers2922 viewsA: Dynamic table with addition of rows and columnsYou will have some challenges to solve, such as correctly identifying the "radio Buttons" for each question, but I leave a code for suggestion. //Adiciona linhas $(".add-row").click(function () { if… 
- 
		3 votes4 answers4653 viewsA: Icone in input with bootstrapYou can also make the icon look inside the input positioning it on it and adding a padding-left in the input, example: .left-inner-addon { position: relative; } .left-inner-addon i { position:… 
- 
		3 votes3 answers10154 viewsA: How to align one element on top of another with css?You can center the text within the paragraph and place the property display:block in the element a, example: p.titulo{ text-align:center; } p.titulo a{ display:block; } <p class="titulo">… 
- 
		0 votes3 answers1188 viewsA: How to pick a specific element between several of the same class via jquery?Use the selector switch eq(), example: console.log($('.campos:eq(2)').val()); <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <input type =… 
- 
		4 votes2 answers228 viewsA: How to make a slider hour range with jquery?Here’s an example, comments on the code: $("#hora-range").slider({ range: true, min: 0, max: 1440,//1440 / 60 = 24 step: 15, slide: function(e, ui) { //Mínimo //calcula as horas, exemplo: 125 / 60 =… 
- 
		1 votes2 answers210 viewsA: SASS - Colour group for re-useAs a suggested implementation, use the function map-get(), example: $cores: ('cor-esporte' : #1b5e20, 'cor-vida': #f57f17, 'cor-regioes': #b71c1c ); $classes: cor-esporte cor-vida cor-regioes;… 
- 
		1 votes3 answers2679 viewsA: Convert number to dateDates in Excel are stored in number of days from 1 January 1900, so for dates after this period you can create an object DateTime and format the date for display, example: $n = 42873; $dateTime =… 
- 
		0 votes3 answers353 viewsA: Average time in secondsUse the function FROM_UNIXTIME to convert to date and to get the difference the function TIMESTAMPDIFF. SELECT DtBegin, DtEnd, TIMESTAMPDIFF(SECOND,FROM_UNIXTIME(DtBegin),FROM_UNIXTIME(DtEnd)) AS… 
- 
		1 votes1 answer53 viewsA: slideToggle(); for row in tablesYou are using id which is a unique identifier and only the first element found in the document is selected, try switching to class, example: $(document).ready(function(){… 
- 
		8 votes4 answers2076 viewsA: How to check if IP exists with batA suggestion is to perform the command ping and search for a string in the answer. For example: When the ping is successfully executed it is returned something like Resposta de 10.1.1.1: bytes=32… 
- 
		1 votes1 answer363 viewsA: HTML layout ratioAdd the following tag to the header of your html code to control the layout in mobile browsers. <meta name="viewport" content="width=device-width, initial-scale=1.0" /> Learn more about the… 
- 
		1 votes3 answers373 viewsA: Mount html structure with result of ajax array?You need to go through JSON and assemble the structure with the data of each product, see an example: var response =… 
- 
		0 votes4 answers66 viewsA: Help with PHP and MysqlTry to make the following query: select * from users where find_in_set (id, ( select clicks from links where id = 1 /*id do link que deseja consultar*/ ) ); SQL FIDDLE… 
- 
		4 votes3 answers2080 viewsA: avoid Ubmit of a form with barcode readerUsually the barcode reader sends a enter after reading, you can configure the reader not to perform enter, or you can detect action in the field and prevent the Submit action from being called using… 
- 
		19 votes3 answers1699 viewsA: Why doesn’t "= NULL" work?When you make the comparison cli.cpf = NULL the = is used to compare values, and NULL is not a value. NULL is a space reserved to indicate the absence of value, that is why in this case one should… 
- 
		2 votes4 answers1139 viewsA: Separating columns from a multidimensional arrayTry it like this: <?php /*EXEMPLO DO ARRAY DE INPUT*/ $input = array('INPUT_1'=>array(74,69),'INPUT_2'=>array(45,1)); print_r($input); $a = array();//Array que conterá os valores do índice… 
- 
		3 votes2 answers245 viewsA: Print more than one javascript copyNo, that’s not possible. But you can see it as a good thing. Imagine if it were possible and you accidentally or a malicious site sent a parameter to print a very high number of pages and an… javascriptanswered abfurlan 10,570
- 
		2 votes2 answers1661 viewsA: Alignment of Bootstrap gridYou need to add the classes col-md-4 col-sm-6 col-xs-12 in the columns and the class img-responsive in the images, I see an example: <link… 
- 
		6 votes1 answer147 viewsA: Scheduled tasks in PHPYou can create events in Mysql itself, you need to enable the option event_scheduler=1 in the My.ini, example: /*Executa de hora em hora*/ CREATE EVENT e_hourly_book ON SCHEDULE EVERY 1 HOUR COMMENT… 
- 
		5 votes3 answers78 viewsA: While PHP does not exceed countThere are some errors in your code, for example if($inis $finis), this condition is invalid, another error is the condition of the while where while($inis > $finis) { if start is receiving 7 and… 
- 
		1 votes4 answers188 viewsA: Increment in Javascript functionYou can change the logic a little, and instead of a counter you count the number of lines at the time of insertion, so you save a little code, example: var maximo = 5; (function($) { AddTableRow =… javascriptanswered abfurlan 10,570
- 
		3 votes2 answers42 viewsA: IN() order in mysqlJust as a curiosity, an alternative to FIELD(): SELECT * FROM pedidos WHERE id IN (1,3,4,2) ORDER BY id = 2, id = 4, id = 3, id = 1;… 
- 
		0 votes1 answer77 viewsA: How to block Scroll Javascript function on different screen widthsPut a if to check the screen size as per your criteria, example: $(function(){ var floatingChat = $("#floatingChat"); var floatingBar=$("#floatingBar"); var cart=$(".cart"); var… 
- 
		2 votes1 answer62 viewsA: doubts with sortable jqueryDefine the thead and tbody of your table, and define in CSS the class .ui-sortable-helper for display:table: .ui-sortable-helper { display: table; } $(document).ready(function () {… 
- 
		3 votes3 answers85 viewsA: How does variable p work in this code?See below the commented code: s = "um tigre, dois tigres, três tigres" p=0 #inicializa a variável com 0 while (p > -1): #enquanto o p for maior do que -1 #Se encontrar tigre na string retorna a… 
- 
		2 votes4 answers4373 viewsA: How to change Bootstrap 3 code?Yes you can although personally I do not recommend editing the bootstrap code directly, because if you need to update the version for example, you will have to change everything again, I recommend… 
- 
		2 votes1 answer356 viewsA: How to identify if a request uses HTTPS?As follows: if (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off') { //HTTPS } 
- 
		2 votes2 answers215 viewsA: Apply the CSS of a child of element A to another element BFor this you can use the plugin copyCss, example: (function($){ $.fn.getStyles = function(only, except) { // the map to return with requested styles and values as KVP var product = {}; // the style… 
- 
		1 votes2 answers336 viewsA: How to recover the value of an arrayYour string is shaped like JSON, first use the function json_decode to decode the string and convert to object, example: <?php $resultado =… 
- 
		0 votes2 answers147 viewsA: how to add class in a specific input text element?It is also possible to apply this effect with pure CSS using the selector :focus(learn more), example: form{ width: 200px; margin: 200px auto; } .row{ background-color: #999; } label{ width: 100%;… 
- 
		1 votes1 answer1588 viewsA: How do I dispose of the title over the - bootstrap image?You can position the text with position:relative, example: .gallery_product { margin-bottom: 30px; } .gallery_product .title{ color:#fff; margin: 0; position:relative; bottom:50px; left:10px; }… 
- 
		5 votes6 answers300 viewsA: How do I transform an array that is in a string for javascript array?Another option is to use Array.prototype.map() var a = "['aaaaa', 'bbbbb', 'ccccc', 'ddddd']"; var array = a.replace(/['\[\] ]/g,'').split(',').map(String); console.log(array); If you want to remove… 
- 
		0 votes2 answers1421 viewsA: How to change CSS in Ionic 1You need to put the background color in the element a child of the element .item, example: HTML <ion-item menu-close href="#/app/principal"> Principal </ion-item> When the framework… 
- 
		4 votes2 answers3834 viewsA: Change Text Color in JqueryYou can scroll through all cells of the table, compare the text and add a class, example: $(document).ready(function(){ $("#myTable tbody tr td").each(function(){ if($(this).text() == "LOW")… 
- 
		2 votes2 answers2100 viewsA: data type input only accept date greater than 18 yearsElements of the type <input date... accept the attribute max, however you will need to somehow calculate the minimum date of birth based on the current date to assign this value, example: Based… 
- 
		2 votes2 answers1488 viewsA: Print without losing cssIn this case you need to use the classes col-xs-* instead of col-md-* due to resolution at the time of printing, as col-md-* works for resolution ( 992px). Change <div… 
- 
		2 votes6 answers22962 viewsA: How to calculate percentage?Another way is by the multiplication factor, example: If a product increased by 30% then its multiplication factor is 1 + increment rate, this rate being 0.3. Therefore, its multiplication factor is… 
- 
		1 votes3 answers676 viewsA: Datatables highlight line with higher percentageYou can scroll through all rows of the table with the function fnRowCallback, store the values in an array, then filter the highest value and highlight the line, see the example below: //Array para… 
- 
		2 votes1 answer114 viewsA: PHP - Error in function preg_matchYou need to delimit your regular expression with inverted bars. Where is: if(!preg_match('\.([^\.]*$)', $this->file_src_name, $extension)){... Exchange for: if(!preg_match('/\.([^\.]*$)/',… 
- 
		7 votes1 answer825 viewsA: Return duplicated values in arraysYou can use the function array_intersect, example: $array1 = array(10, 50, 80, 40, 90); $array2 = array(10, 30, 10, 40, 20); $array3 = array(10, 60, 15, 40, 30); $array4 = array(20, 30, 40, 10, 50);… 
- 
		2 votes3 answers683 viewsA: Find elements of a class Eno jQuery and add a parameter to themYou can use the function toggleClass jQuery if you want to add or remove each click on the button, example: $("#btn").click(function(){ $(".mudar").toggleClass("tx-blue"); }); .tx-blue{ color:blue;…