Posts by Lucas • 1,952 points
57 posts
- 
		1 votes2 answers32 viewsA: Regex in javascriptYou can do it like this: var data1 = "Data de inicio: 29/08/2016"; var data2 = data1.replace(/[^0-9/]/g, ''); document.write(data2);… 
- 
		6 votes2 answers11884 viewsA: Add value of an arrayYou have a multidimensional array, so array_sum does not work. Its function is almost correct, just add the key valorPagamento: $sum = 0; foreach ($total as $key => $value){ $sum +=… 
- 
		1 votes2 answers378 viewsA: I can’t get a form field to be sent to the email with phpmailerYou are not concatenating $Games in $Vai. Just do it like this: $Vai = "Nome: $Nome\n\nE-mail: $Email\n\nNicknamer: $Nickname\n\nGame: $Games\n\nMensagem: $Mensagem\n";… 
- 
		4 votes1 answer2343 viewsA: Internet Explorer in Intranet Site Compatibility Mode - How to Force to Always Render as Edge?Put the following meta tag, shortly after the tag <title>: <meta http-equiv="X-UA-Compatible" content="IE=Edge" /> Source… 
- 
		2 votes1 answer151 viewsA: How to Drag an Image without jQueryI made a simple implementation using the events mouse*, to detect click, drag and when you release the image. In this last event, the position image is updated with the position of the mouse. It can… 
- 
		2 votes2 answers3400 viewsA: How do I use @Font-face with an arbitrary font?You can do it two ways: 1 - Own the source locally Do the download source, save to your project and reference in CSS: @font-face { font-family: "Open Sans"; src: url("OpenSans.woff"); } And use the… 
- 
		2 votes3 answers268 viewsA: Use reference in MYSQL query conditionOf documentation: You can use aliases in GROUP BY, ORDER BY, or HAVING clauses to reference the column That is, it is not possible to use WHERE. But you can do with HAVING: SELECT mov.Codigo, ( SUM(… 
- 
		1 votes1 answer85 viewsA: Problem with Javascript buttonThe problem is that when loading the page, no element in the list is in the class sliderActive and, as the slider logic works through this class, this problem occurs the first time, because in the… javascriptanswered Lucas 1,952
- 
		3 votes3 answers140 viewsA: Search results in 3 tables with the date of the last 5 daysAnother alternative, making LEFT JOIN and checking which returned null: SELECT u.nome FROM tbl_utilizadores AS u LEFT JOIN tbl_recursos AS r ON r.id_user = u.id AND r.data > DATE_SUB(CURDATE(),… 
- 
		1 votes1 answer1007 viewsA: Populate multiple input fields with values from other fieldsThere are several ways to implement this. My solution is the following: Add a class linhaX in each input, where X is the line number. Add a button on each row identified with a class repeat. The… 
- 
		2 votes1 answer113 viewsA: Error in variable valueThe problem is in format. A value float has its decimal part separated by point and the thousand part has no separation. Its value is 4.200,00. You exchange comma for dot getting 4.200.00. Since… 
- 
		2 votes2 answers1640 viewsA: jQuery - Picking up content from a <link> tagYou can make an AJAX request using $.get: $.get('../css/screen.css', function(data){ console.log(data); }); 
- 
		1 votes2 answers57 viewsA: Center label on a dynamic divYou can remove the position: absolute and add a display: block: //************create div************ var div = document.createElement("div"); div.id="div"; div.style.width = "300px";… javascriptanswered Lucas 1,952
- 
		4 votes1 answer1327 viewsA: How to "preg_match" only numbers?The preg_match PHP returns 1 if the expression matched, 0 if it did not match and false if an error has occurred. In your case, it’s returning 1 because it’s matching. But as you want the value… 
- 
		1 votes1 answer96 viewsA: Error This table does not contain a Unique columnThis table does not contain a single column. You need to define a primary key (column differentiating one row from the other). When you use the interface buttons, phpMyAdmin performs the changes via… 
- 
		2 votes2 answers95 viewsA: How to change filename with variableThe problem is in concatenation. You are not closing single quotes to concatenate the variable and double quotes are unnecessary. Do so: include_once '../inc/saudacao_' . $rp_lang . '.php';… 
- 
		2 votes2 answers753 viewsA: Put date in file generated by mysqldumpBy expanding the command date: base_diversos_$(date +%d_%m_%Y).sql In the man page of date (man date) has the list of possible formats.… 
- 
		4 votes1 answer158 viewsQ: How to receive input data from a C program from a file?I have a program in C. Let’s assume that its name compiled is a.out (pattern). When I use the following command to execute it... ./a.out < arquivo.txt ...how do I read the content of arquivo.txt… 
- 
		0 votes1 answer170 viewsA: Url Friendly . htaccess problemFlag missing [L], being like this: RewriteRule editor /editor/index.php [L] This flag means "last" (last). It means that if the rule matches, it will not check the others. Apache processes these… 
- 
		3 votes1 answer4072 viewsA: Send Javascript confirmation messageYou are mixing things. PHP runs on the server while JS runs on the client (browser). Writing JS via PHP is possible but not a good practice. To resolve this issue, remove the header and include… 
- 
		1 votes2 answers696 viewsA: fwrite in a certain PHP lineComplementing @Adir Kuhn’s reply, if you need to insert in the middle and not replace, you can do so: $arquivo = '/dir/ate/arquivo.ext'; $numero_linha = 17; $conteudo_linha = 'teste'; $linhas =… 
- 
		2 votes1 answer149 viewsA: LEFT JOIN mysql Filter non-existent records NOT INThis image can help. Our case is the second from left, from top to bottom. Try the following: SELECT maquinas.codigo, maquinas.codnovo FROM maquinas LEFT JOIN leituras ON maquinas.Codigo =… 
- 
		2 votes1 answer136 viewsA: Ckeditor problem with PHP PDOIt’s probably coming from the database like this. Is escaping the quotes to not cause problems with SQL syntax and/or help prevent SQL Injection. Usa stripslashes: Removes inverted bars from a… 
- 
		0 votes1 answer73 viewsA: Broken textsFirst corrects spam with "m" to span with "n". Add property word-wrap worthwhile break-word: .block .bottom span, .block .bottom label { max-width: 80px; overflow: hidden; word-wrap: break-word; }… 
- 
		1 votes1 answer432 viewsA: Fullcalendar duplicating record inserted into databaseThe problem is the fact that the event submit be inside the event select. So it will create multiple calls as you click on the calendar. Remove all the $("#eventForm").on('submit',function() { ...… 
- 
		2 votes2 answers2017 viewsA: Check if $_GET exists within the viewPut a else function and mount the default array: private function SetImageAndColor($client_id) { if (isset($_GET['color']) AND isset($_GET['image'])) { $dados['client'] [$client_id] ['image'] =… 
- 
		2 votes1 answer50 viewsA: Cookie between controllersI believe the problem is path (fourth parameter). By default, the cookie is set in the current directory: /localidade. You’d have to set him up for the whole domain: /, thus: $cookie = new… 
- 
		1 votes1 answer1361 views
- 
		3 votes1 answer87 viewsA: Insert, upload and Update in the same processThe problem is here: $diretorio = '../img/$lastId/'; $filepath = '$diretorio' . $filename; Look at the quotes. Either you switch to double quotes or concatenate: $diretorio = '../img/' . $lastId .… 
- 
		0 votes2 answers648 viewsA: Back to top button in scroll to topYeah, you can do it two ways: 1- Using the attribute delta of the event of scroll: $('body').bind('mousewheel DOMMouseScroll', function(e){ if (e.originalEvent.wheelDelta) { var delta =… 
- 
		1 votes1 answer68 viewsA: Formatting for mobile devicesNo, because smartphones and tablets stay in Landscape when rotated. So it is good to specify also the limits in "px". At this link has media queries standards for devices. But each layout is a… 
- 
		1 votes1 answer32 viewsQ: Errorcontroller for each module in ZF1I have a project that uses Zend Framework 1. It has 2 modules: default and admin. When a mistake occurs or Exception, Zend directs to Errorcontroller. The problem is this: when an error occurs… 
- 
		1 votes1 answer173 viewsA: Switching from mysql to mysqliThe problem must be in the creation of Sessions, who is still using mysql_result: $_SESSION['usuario_id'] = mysql_result($result,0,'id'); $_SESSION['usuario_nome'] = mysql_result($result,0,'nome');… 
- 
		2 votes2 answers231 viewsA: Add fadein effect to this jquery codePuts a display: none; in the element #resultado and exchange that: document.getElementById('resultado').innerHTML = data; therefore: $('#resultado').html(data).fadeIn();… 
- 
		2 votes1 answer1094 viewsA: Music playlist with Pause and playPretty quiet to do with JS. Here has the complete list of attributes and methods for audio and video elements. HTML <button type="button" id="play">Play</button> JS var player =… 
- 
		3 votes1 answer60 viewsA: Is it possible to apply an external and internal shadow effect to a box in css3?Yeah, just use a comma: div { width: 100px; height: 100px; box-shadow: 5px 5px 5px #000, inset 0 0 10px #000; } <div></div>… 
- 
		2 votes1 answer448 viewsA: $this->_forward() and Zend FrameworkThe functioning of _forward() that’s right. It redirects to another controller or action after receiving the request. The URL remains the same because it does not create a request new, just like the… 
- 
		7 votes3 answers269 viewsA: Solve logic errorI found 2 errors in your code: 1- The meter cont has to be reset every iteration of the first for: for(i=1;i<=num;i++) { cont = 0; for (j=1; j<=i; j++) 2- In the second for, you check whether… 
- 
		1 votes1 answer69 viewsA: Error trying to join 3 tablesI found 2 errors in SQL: missing ON us INNTER JOIN and there’s a alias not necessary in c.NIVEL as c.NICHAR. Follow the correct SQL: SELECT a.ID as IDPROP, a.LICITI, a.NOME, a.NIVEL as NIPROP, b.ID… 
- 
		1 votes1 answer188 viewsA: Zend_session and Zend_pagination with search formI have already solved this problem of filters in paging without Session, just passing parameters. Follows the solution: Controller Get the list and assemble the Paginator: $paginator =… 
- 
		0 votes1 answer304 viewsA: How to make the keyframe stop at 100%/stay static after animation?Adds the following attribute in CSS: animation-fill-mode: forwards. To work in all browsers: -webkit-animation-fill-mode: forwards; -moz-animation-fill-mode: forwards; animation-fill-mode: forwards;… 
- 
		6 votes1 answer2069 viewsA: How to get a file back into an input type file field?Is not possible set the value of a input type="file" for security reasons. Of W3schools: Note: This Property is read-only, because of security reasons. An alternative is to put a link to the file… 
- 
		1 votes1 answer429 viewsA: Image positioning in div with drag and dropI found this plugin in jQuery, very light and easy to use (needs jQuery UI because of drag). You can initialize it like this: $('#img').imagedrag({ input: "#position" // output da position position:… 
- 
		0 votes2 answers1029 viewsA: Schedule page loading through CRONGo to cPanel. Select the period and put it in the command: php /home/diretorio/ate/arquivo.php 
- 
		5 votes2 answers212 viewsA: How to make the A click active for all LIRemoves the width and the padding-left of .subMenu li and passes these properties to the link, also adding a display: block: .subMenu li a { display: block; width: 200px; padding-left: 25px; } Thus… 
- 
		1 votes1 answer333 viewsA: How to style the general scroll bar of the site?On the site in question, the plugin was used Nicescroll (jQuery). Summarizing the operation: it puts a overflow: hidden on the tag html to disappear the browser bars and create a "fake" scroll bar;… 
- 
		3 votes3 answers806 viewsA: Exchange array value when nullIterate through the array by checking and exchanging values: foreach ($jsonObj as $k1 => $row) { foreach ($row as $k2 => $value) { if ($value === null) { $jsonObj[$k1]->$k2 = ""; } } }… 
- 
		3 votes1 answer290 viewsA: How to mark next checkboxYou can do with next(). Add at the end of if: $(this).next().prop('checked', true).prop('disabled', false); Thus remaining: if($(this).is(':checked')){ $inputs.not(this).prop('disabled',true); //… 
- 
		4 votes1 answer328 viewsA: Using confirm() javascript with checkboxTheoretically, an ID should only belong to 1 element. You have several elements with id="idAprovacao". The command document.getElementById returns only 1 element, the first one he finds. Therefore,… 
- 
		0 votes2 answers1870 viewsA: How to redirect www.subdominio.dominio.com to http://subdominio.dominio.com?On your DNS provider, add a www.subdominio.com CNAME to Domain.ub.com