Posts by Leandro Curioso • 2,430 points
40 posts
-
3
votes1
answer275
viewsA: Is it recommended to use a global variable for a PDO object?
Short answer: Not recommended and should be avoided to the maximum! Starting from the principle of unit tests, if you use this global variable you will never be able to mock your object. To achieve…
-
2
votes1
answer505
viewsA: Problem using json_decode() and json_encode()
This way you fix the charset and turn into json. $urldec = "data%5Bst_cartaodetalhes_recb%5D=TID%3A+000000%0ACart%E3o%3A+0000%2A%2A%2A%2A%2A%2A%2A%2A0000%0AAutoriza%E7%E3o%3A+0%0ABandeira%3A+";…
phpanswered Leandro Curioso 2,430 -
2
votes2
answers1078
viewsA: Increase timeout of dblib connection with PDO
Try this here $pdo->setAttribute(\PDO::SQLSRV_ATTR_QUERY_TIMEOUT, 5); OR You can also try adding in the string Connection $pdo = new \PDO("sqlsrv:Server=server;Database=dbname;LoginTimeout=5",…
-
0
votes1
answer137
viewsQ: Does the Curl request in php resolve a subdomain locally?
I have a server with Ubuntu 14.04 Trusty VPS and would like to know if using the Curl library solves DNS locally for a subdomain. I have 2 domains on the same server and 1 is a subdomain…
-
0
votes1
answer126
viewsA: Hash in url with JS plugin
If this parameter is in query string I use this function and works in IE, Chrome and Mozilla. function getQueryString(name) { name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]"); var regex =…
-
6
votes2
answers4809
viewsA: How to leave a text centered between two horizontal lines?
Almost everything about text between lines: /** * Horizontal Type Line Behind Text * Inspired by this discussion @ CSS-Tricks:…
-
1
votes1
answer102
viewsQ: How to keep a Javascript Function in the DOM even after a page load from another page?
As far as I know it is not possible to keep the state of the DOM even after the page load, there is some technique or some way out to keep the Function in cookie or Storage(local, Session) to give…
-
26
votes2
answers2693
viewsQ: What is the difference between charset and collation in a database?
Every time I create a database, I always come across these definitions and I don’t really know the difference. I understand what it is charset, but not collation.
-
15
votes1
answer167
viewsQ: What is the character function ? in the variable type in C#?
I see many third-party codes and I often see the use of the question mark on the type of the variable. Example: public bool? Status Could someone explain to me the difference between not having this…
-
3
votes2
answers1312
viewsQ: Retrieve cookie expiration time in javascript or jquery
Is there any way to recover the remaining time for expiration of a javascript or jquery cookie?
-
0
votes2
answers459
viewsQ: Access peripheral devices through the browser
I am developing a web system for financial control is necessary to print tax notes in thermal/tax printer. It would be possible to integrate this device through the browser or I will be required to…
-
3
votes1
answer1901
viewsQ: How to execute a javascript function in the browser closure?
I am developing a web application and need to perform a function when the client clicks on the browser X or simply closes it. To be more specific I need to execute an ajax call at this close. Is…
-
30
votes1
answer10018
viewsQ: What is the difference between Javabean and POJO?
I’m new to Java, and I have that question. I searched several places on the internet and asked several friends JAVA programmers but none could explain to me clearly what the difference between the…
-
-1
votes4
answers3185
viewsA: 301 https protocol redirect to http
Try this # Permanent URL redirect Redirect 301 /blog/tag/dengue-mata/ http://meudominio.com/blog/tag/dengue-mata/
-
34
votes7
answers87300
viewsQ: How to validate with regex a string containing only letters, whitespace and accented letters?
I’m looking to validate one input text for full name in order to accept only letters, blank spaces and accented letters. Valid formats: Leandro Moreira leandro moreira Kézia Maria kezia maria Cabaço…
-
2
votes3
answers394
viewsA: How to fill an Object value automatically in php?
Additionally I found a method that makes it follows below: function set_object_vars($object, array $vars) { $has = get_object_vars($object); foreach ($has as $name => $oldValue) {…
-
5
votes3
answers394
viewsQ: How to fill an Object value automatically in php?
I need a method to auto-fill my VO by receiving as parameter a mysql database result set and php’s PDO class. Example of VO class Pessoa{ public $nome; public $idade; } The idea is to incorporate…
-
2
votes3
answers8073
viewsA: Concatenate a link within a href attribute with a variable?
You can create an Hidden input and set a value something like: <input type="hidden" name="teste" id="name" value="qualquer-valor"/> Then you take value and concatenate in your link something…
-
3
votes2
answers1138
viewsA: Using select to open iframe
If you want to use jquery assign an id to your select $("#Exames").change(function(){ var url = $(this).val(); $("#abrir").attr("src",url); }); If you want pure javascript change to this…
-
1
votes2
answers8876
viewsA: Accents and Special Characters in Ajax jQuery
You need to change the encoding page to ISO-8859-1. Every encoding of your call application in general should have the same charset. I recommend using utf-8 as it is an international Unicode…
-
1
votes4
answers4106
viewsA: Instantiate class as another class’s Property
The most recommended thing in this situation is to create an inheritance of a person in a natural person. Something like: public class PessoaFisica : Pessoa But if you want to work without…
-
0
votes5
answers5718
viewsA: Popup with AJAX and jQuery
You need to return a json string from the server and parse it to become an object variable . //JQuery var objJson = $.parseJSON("string json"); //Javascript var objJson = JSON.parse("string json");…
jqueryanswered Leandro Curioso 2,430 -
1
votes2
answers6646
viewsA: Subtraction of dates and return the number of years, months and days
Below are the methods for you to recover the difference of years, months and days. //Diferença de anos function diferencaAnos(date1, date2) { var dateParts1 = date1.split('-') , dateParts2 =…
-
1
votes1
answer1287
viewsA: How to insert Json variable value into a href attribute?
You need to parse the json string to turn it into an object variable. //JQuery var objJson = $.parseJSON("string json"); //Javascript var objJson = JSON.parse("string json"); So you could use the…
-
6
votes3
answers25097
viewsA: How to validate jQuery Validator mobile and landline number?
From experience in web development it is very common to see that several forms that validate landline or mobile phone only contemplate the minimum and maximum number of characters, but in fact there…
-
11
votes3
answers25097
viewsQ: How to validate jQuery Validator mobile and landline number?
I need a method of validation of landline and mobile phone with the jQuery Validator plug-in. The differentiation of numbers from fixed to mobile is important to validate the sending of SMS.…
-
1
votes4
answers143
viewsA: Get date-img value
Use the selector switch $(this).attr("data-img") instead of $(this).data("img");
-
4
votes1
answer696
viewsA: Error trying to convert Portuguese date into datetime
function dataPT($data){ $date = DateTime::createFromFormat('Ymd', $data); $day = $date->format("l"); $daynum = $date->format("j"); $month = $date->format("F"); $year =…
-
1
votes1
answer353
viewsA: Falling cloud with 200 simultaneous accesses
Try adding/changing this in your . htaccess file <IfModule mpm_worker_module> ServerLimit 40 StartServers 2 MaxClients 1000 MinSpareThreads 25 MaxSpareThreads 75 ThreadsPerChild 25…
-
4
votes2
answers2320
viewsA: Two buttons to perform the same function?
Button id cannot be repeated only classes. Id is a unique identifier. What you can do is change the id of the 2 button to btn_pag2 and your jquery selector to do this…
javascriptanswered Leandro Curioso 2,430 -
5
votes3
answers15493
viewsA: How to add the results of an array brought from the PHP database?
You can handle this straight from your query SELECT SUM(nome_coluna) AS valor_soma FROM nome_tabela; You can even add other columns... SELECT SUM(nome_coluna1 + nome_coluna2) AS valor_total_soma…
-
1
votes2
answers5206
viewsA: File supposedly being used cannot be deleted
Check that your method that creates the log files is creating them with access permission and if when placing the pointer at the beginning of the file in the creation you also need to close.…
-
1
votes3
answers720
viewsA: How to find values in pascal
You need to create an array to retrieve these values by the array key. Imagine that you are old is weight. So basically you need to give an "id" to your array. Example. variável Pessoa = array[2];…
-
1
votes3
answers8309
viewsA: What Java byte serves
Several utilities, are at most 255 bits can also as you posted can be an array of bytes. It is widely used when you want to save an entire file within a database. (Byte array). Depending on the…
javaanswered Leandro Curioso 2,430 -
1
votes2
answers4223
viewsA: Dynamically create PHP class instance with Namespace
The syntax is correct. Check that the include path is correct if it is and it still doesn’t work add the Trim() function to your parse. $class = trim(ucfirst(strtolower($_GET['type']))) .…
-
5
votes7
answers30495
viewsA: How to differentiate phone types
Currently by Anatel only phone numbers that start with 6,7,8,9 are mobile numbers. You can make a regex to interpret this. Remembering that it is only the phone number not including ddd.…
-
5
votes3
answers2753
viewsQ: Create and read DLL in php?
It would be possible to create and open windows DLL libraries in php? I want to organize my php classes into dll so that they can be used in both php and C#, if there is an alternative also serves.…
-
0
votes1
answer204
viewsA: PHP page without background color in Internet Explorer
Try adding background-color style <table style="width:100%;height:100%;background-color:#4682B4;" bgcolor="#4682B4" border="0" cellpadding="0" cellspacing="0"> Something else... The div that…
-
31
votes2
answers1282
viewsQ: What does <<< EOH in PHP do?
I see it in several third-party classes. Remembering that the closure is usually the EOH, but without <<<
-
1
votes2
answers146
viewsQ: Text problem cut when creating text file
I need to create a file that contains PHP code. This code comes from a string like "<?php class foo{ } ?>" but when I give a echo she just cuts out the reserved words. How to turn the string…