Posts by Felipe Douradinho • 3,338 points
86 posts
- 
		14 votes4 answers24420 viewsA: Turning HTML into PDFYou can do it using jsPDF. HTML <div id="conteudo"> <h3>Olá, esta é uma tag H3</h3> <p>Um parágrafo.</p> </div> <div id="editor"></div> <button… 
- 
		2 votes2 answers13878 viewsA: PHP error: "Fatal error: Call to a Member Function prepare()"Connection object not saved in variable $db. Therefore, the function prepare does not exist in $db. This is because... ...you are not exploding the error, ie the try {} catch() is not stopping your… 
- 
		1 votes4 answers3989 viewsA: How to display 2 columns from 2 different tables in Mysql?Simple as that: SELECT `tabela1`.`Nome`, `tabela2`.`Apelido` FROM `tabela1`, `tabela2`; 
- 
		1 votes2 answers78 viewsA: Eclipse Future for Android DevelopmentBy the end of this year (2015), Google will maintain support for Eclipse. I would recommend beforehand to make the migration using the migration tool of them and believe me, it’s not hard. The… 
- 
		3 votes2 answers1416 viewsA: Break txt file into blocks, and each block into rowsEach of your blocks is separated by \n\r (\r\n -> CRLF), then you can explodir the blocks by \n\r. Each row of each block is separated by \n, then you can explodir each row of each block by new… 
- 
		5 votes2 answers5402 viewsA: Check if day x falls on a Saturday or SundayYou can use Calendar even. Demo (obviously half of the code can be removed as it is System.out.println...and also use SWITCH, finally...is only for demonstration purposes) Main.java import… 
- 
		2 votes2 answers4614 viewsA: Automatic update with JavascriptIt would be somewhat clumsy to convert the method .load() of JQuery that you are trying to use for the javascript pure. You can convert your need to 100% JQuery. Try: HTML <script… 
- 
		0 votes1 answer197 viewsA: Retrieve server data without refreshYou just need to save the setInterval a global variable. Right after, well before its function setInterval, you reset your interval with clearInterval(variavel_global);. Finally, overwrite the… 
- 
		21 votes3 answers24407 viewsA: What is the performance difference between BIGINT and INT in Mysql?What’s the difference between INT and BIGINT? Let’s go back to the manual first, at 10.2.1 Tipos Inteiros, we have the following: INT[(M)] [UNSIGNED] [ZEROFILL] An integer of normal size. The signed… 
- 
		6 votes1 answer175 viewsA: Java algorithm, age increase;It makes no sense to return 0 (zero) if the intention is only to set this.idade = x. In this case, use void in function. No need to use loop, just pick the difference between the current year and… 
- 
		4 votes4 answers791 viewsA: Taking data via ajaxYou are not using link on yourself <li>, so it’s impossible to get the attribute href. It is recommended that you assign the event click at the .menuLi in the ready of the document. For… 
- 
		2 votes5 answers26385 viewsA: What is the best practice to know if an Row exists in a SELECT in Mysql?You can try SELECT EXISTS(SELECT * FROM tabela WHERE usuario = 'exemplo') or SELECT EXISTS(SELECT 1 FROM tabela WHERE usuario = 'exemplo')… 
- 
		2 votes1 answer95 viewsA: Closure Compiler JS - CSS Transform into a Bulk ProcessWorking with repetitive tasks in scripts JS and CSS made it much easier with the coming of Grunt and of Gulp. I prefer the Gulp, It’s a lot easier. Both Gulp and Grunt will dispense with any… 
- 
		0 votes2 answers767 viewsA: How to create a subdirectory tree with an ArrayI wrote a recursive function scandir: dir_to_array.php <?php /** * Recebe uma pasta e escreve um array na mesma estrutura. * * @param $dir * @param array $final * @return array */ function… 
- 
		1 votes4 answers2949 viewsA: Fix div at the bottom of the pageFinally a solution tested in the 3 main browsers (Chrome, FireFox and Internet Explorer 8+) CSS <style type="text/css"> html, body,#wrap {margin:0; padding:0; height:100%;} #wrap… 
- 
		3 votes3 answers441 viewsA: How to make simple include script in htmlLet’s say the dominance with the JavaScript with the login form is seusite.com. Create a javascript file: seusite.com/formulario.js function loginMeuSite() { var divLoginSite =… 
- 
		1 votes3 answers107 viewsA: Doubt about class inheritance in JavaInstead of: Ebook ebook = new Ebook() { ebook.setNome("Bla bla bla"); } Use without { and }: Ebook ebook = new Ebook(autor); ebook.setNome("Bla bla bla"); You forgot to create a new author and pass… 
- 
		2 votes1 answer402 viewsA: What is the best way to develop a video player from scratch?I once had the task at work of creating a video player from scratch C#. In reality, the Framework would take care of the worst part of the work, so I would only have to "implement" and put the… 
- 
		2 votes1 answer238 viewsA: Error inserting JDBC dataYour problem is simple: when trying to insert your record into the table despesa, you are trying to insert into the field idViagem a value that THERE IS NO on the table viagem. Your foreign key… 
- 
		5 votes2 answers958 viewsA: preg_split to separate words, but ignoring someSuccess, but there is no way to remove the first item from array resulting from preg_split using the function itself and not even another function inline, therefore, array_shift was used (could also… 
- 
		3 votes2 answers469 viewsA: How to get 40px X 40px of the entire image?Use the property CSS clip: clip: rect(topo, direita, rodape, esquerda); Before Afterward <style type="text/css"> #minhaImagem { position: absolute;; clip: rect(0px,20px,20px,0px); }… cssanswered Felipe Douradinho 3,338
- 
		1 votes1 answer180 viewsA: Searching for names inside a textI made a feature that goes through the list of names and gives a preg_match in the name, where $nome has its spaces replaced by pattern (.*?). procura_nome.php <?php /** * Pesquisa por nomes em… 
- 
		2 votes1 answer1124 viewsA: Advantages/Disadvantages Magento x Opencart x Other Open eCommerceThe advantages of Magento are numerous, including virtually unlimited control over the way your shopping cart will look (design) and how the user will interact with it. Excellent SEO control with… 
- 
		1 votes2 answers194 viewsA: Convert PHP TIME() to Datetime with JavascriptUse the Date to do this: <script type="text/javascript"> var data = new Date(<?php echo time(); ?> * 1000); data = ""+data.getFullYear()+"-"+(data.getMonth() + 1)+"-"+data.getDate()+"… 
- 
		1 votes1 answer130 viewsA: Multiple terms in regular expressionDanilo, the best solution in regex for multiple words (strings, etc) is Quantificador Progressivo (Possessive Quantifiers), in other words, the [^"]*. IMPORTANT The pattern below is ALL occurrences.… regexanswered Felipe Douradinho 3,338
- 
		3 votes2 answers917 viewsA: Mysql: Windows or Linux?There’s advantages in using the Linux for this purpose, as others may say, but from a point of view on performance, for many applications you won’t see much difference. While Linux would be my… 
- 
		1 votes3 answers7203 viewsA: Pass Javascript parameter to PHPIs not possible, unless you are trying to requisition HTTP (ajax, forms, etc). This is why Javascript runs client side (browser) while PHP runs server side (server) and the only path to JavaScript… 
- 
		23 votes2 answers7005 viewsA: What are the differences between die, Exit and __halt_compiler?About die and exit Amid die and exit, there is no difference, they are the same according to the manual. One is nickname for the other. Manual PHP to Exit: Note: This language Construct is… 
- 
		2 votes1 answer1137 viewsA: How to make post/likes requests/share profiles on facebookOmaths, come on: Is missing ; semicolon at the end: $token="Aqui_Fica_o_Token" In file("https://graph.facebook.com/".$url."/friends? access_token=, note that there is a gap between friends?… 
- 
		2 votes2 answers711 viewsA: How to persist the String of an Enumerator in the Database?James, the ideal would really be: public enum ETipoCasa { Propria, Alugada, Financiada, Cedida; } public class Casa { @Enumerated(EnumType.STRING) @Column(name = "tipo_casa") private ETipoCasa… 
- 
		1 votes2 answers328 viewsA: Commit using PHPWelguri, the ideal would be to use transaction which implicitly disables autocommit until it is committed and is super simple and safe: <?php try { // Primeiro de tudo, vamos começar a transação… 
- 
		0 votes3 answers1096 viewsA: Send mail with form dataBruno, the ideal is for you to use the PHPMailer (in PHP). It’s famous, quite discussed here at Stackoverflow and super simple to implement. Just create a file (e.g..: phpmailer_enviar.php) and… 
- 
		1 votes1 answer598 viewsA: How to make a lightbox with CSS and jQuery?Matheus, you can use Bootstrap: HTML <div class="container"> <div class="row"> <a class="btn btn-primary" data-toggle="modal" href="#meuLoginModal" >Login</a> <div… 
- 
		4 votes1 answer2486 viewsA: Laravel and the MVC concept - where do I put my classes/functions?Joseph, in Laravel, create a file helpers.php in your briefcase app and automatically load it by editing the composer.json: "autoload": { "classmap": [ ... ], "psr-4": { "App\\": "app/" }, "files":… 
- 
		0 votes2 answers116 viewsA: What is the appropriate http code to respond to the contents of an image?In fact, for image, I’ve never seen use any! The code in this case is implicitly 200, so it would be redundant to insert 200. The most important is the header you are already inserting.… 
- 
		0 votes2 answers54 viewsA: Apply css to form only in one domainSkyirn, just do the same way they are today, using if where you want to insert the CSS: <textarea (...) <?php if(lang('abbr') == 'pt'){ echo 'style="font-size: 10px;"'; } ?>… 
- 
		5 votes2 answers2449 viewsA: How to change character encoding in phpmailerHelio, use: <?php // Inclui o arquivo class.phpmailer.php localizado na pasta phpmailer require_once("phpmailer/class.phpmailer.php"); // Inicia a classe PHPMailer $mail = new PHPMailer(); //… 
- 
		41 votes1 answer48265 viewsA: What character encoding (Collation) should I use in Mysql?Both serve: latin1_swedish_ci or utf8_general_ci. To change the CHARSET and COLLATION of an existing bank: ALTER DATABASE `sua_base` CHARSET = Latin1 COLLATE = latin1_swedish_ci; or ALTER DATABASE… 
- 
		0 votes1 answer65 viewsA: show table data between two chosen dates (dates are in varchar)Jerry, try: SELECT * FROM minhaTabela WHERE status=2 AND nomePessoa='Jose Silva' AND DATE_FORMAT(str_to_date(data_enviado, '%d/%m/%Y'), '%Y-%m-%d') BETWEEN DATE_FORMAT(str_to_date('01/05/2015',… 
- 
		2 votes1 answer188 viewsA: Crawler to make paginationMaking a post request and getting feedback, help? HttpURLConnectionExample.java package com.meupacote.app; import java.io.BufferedReader; import java.io.DataOutputStream; import… javaanswered Felipe Douradinho 3,338
- 
		1 votes2 answers501 viewsA: PHP function on an html pageAlysson, The variables $conexao and $cliente must be imported into the function as a whole: function mostrarCliente() { global $cliente, $conexao; $cliente = $conexao->selectCliente("_ID=10"); //… 
- 
		1 votes2 answers602 viewsA: Does Eclipse Logcat for Android display Log messages?You can find in Eclipse in: Window -> Show View -> Other… -> Android -> LogCat Make sure you’re not with any FILTER log in Eclipse. Alternative If the LogCat is empty, the emulador is… 
- 
		1 votes2 answers1476 viewsA: How to pin a footer to the bottom even with a lot of contentAlternative #1 HTML Veja o rodapé <div id="footer"><span>Rodapé fixo</span></div> CSS /* IE 6 */ * html #footer { position:absolute;… 
- 
		0 votes2 answers267 viewsA: Lock F5 key in the applicationLeticia, javascript version: document.onkeydown = fkey; document.onkeypress = fkey document.onkeyup = fkey; var foiPressionado = false; function fkey(e){ e = e || window.event; if( foiPressionado )… 
- 
		3 votes2 answers513 viewsA: MYSQL - Column order and performancegiordanolima, your question is NOT silly. Column order can have yes GREAT impact on performance in some DBMS such as SQL Server, Oracle and MySQL. This post can serve as a guide for future… 
- 
		3 votes2 answers1499 viewsA: Form being sent twice in a rowDiego, you are probably forgetting to prevent the pattern (event.preventDefault()). Problem The button is sending (because it is of the type submit) and the bind is intercepting, duplicating the… 
- 
		2 votes1 answer349 viewsA: Save user message to text file or database?Bruno, you are probably already working with database. In this case, the ideal is to keep everything in the database. In HTML, you can include the predefined list (with radiobox) of motives and also… 
- 
		17 votes6 answers2843 viewsA: What is the correct term to call someone who makes HTML code?Although it is a great version, the ideal would be to call it Web Developer (Web developer) If you are more design oriented, you are then a Web Designer. If you’re more about programming (besides… 
- 
		10 votes2 answers28630 viewsA: Convert Mysql data dd/mm/yyyy to yyyy-mm-ddCristiano, here what you need: UPDATE tbl_data SET data = DATE_FORMAT(STR_TO_DATE(data, '%d/%m/%Y'), '%Y-%m-%d') WHERE data LIKE '__/__/____' Before 23/11/1987 Afterward 1987-11-23… 
- 
		1 votes1 answer82 viewsA: GIT command to delete the last log without affecting the current versionIvan, 1. Make a backup (as a precaution) Now, to reverse the last commit but keep the changes (your case): git reset HEAD~ If you don’t want the last commit changes to stay: git reset --hard HEAD~…