Posts by Daniel Omine • 19,666 points
581 posts
-
2
votes1
answer2235
viewsA: How do I resolve the "git clone problem with the ssl CA cert" error?
Applying a bypass You can try a bypass, that is, disable the verification of ssl in the settings or at runtime. Globally modifies via command line git config http.sslVerify false Modifies at…
-
12
votes7
answers2649
viewsA: Should people’s names be stored in two or just one column?
It depends on the local business model and culture. In a general summary there is no right. There is that which is most suitable. The decision of how to model strongly depends on the following…
-
2
votes3
answers63
viewsA: Page not printing the results
It is not very clear what you ask, but at first, looking superficially we perceive basic mistakes. Below, I will quote the most visible. But it doesn’t necessarily mean that they are the cause of…
phpanswered Daniel Omine 19,666 -
2
votes3
answers611
viewsA: Variable variable in php
Answering more of the same, could only delimit with keys. Example: $str1 = 'a'; $str2 = 'b'; ${$str1.$str2} = 'c'; echo $ab; Something more specific to the question code: $i = '1'; ${'vertical'.$i}…
-
3
votes1
answer1036
viewsA: Generating unique identifier using time()
What you can say about the code presented is that every century the chances of collision will be greater because it is cutting the first two numbers for the year. The function date() format the date…
-
8
votes2
answers54475
viewsA: Place Javascript function inside onclick
Using anonymous function <input type="button" value="anonymous function" onclick="(function(){ console.log('ok'); console.log('ok2'); })()"> In this snippet I just wanted to show that it is…
-
2
votes1
answer1145
viewsA: Phpmailer too slow to send emails
It is a very high time even for an authenticated email. Normally 1 to 4 seconds is reasonable but still uncomfortable. In the meantime the user is annoying and impatient. It has to update the page,…
-
0
votes1
answer1439
viewsA: PHP Read TXT, delete lines, create new file
$base = __DIR__.DIRECTORY_SEPARATOR; // Diretório onde estão os arquivos txt. $files = glob($base.'*.txt'); // Pega todos os arquivos que terminam com .txt $search = 'silva'; // a…
-
2
votes2
answers103
viewsA: data conversion problems with php
I took the liberty of "tweaking" the code pattern and removing redundancies. But I kept the structure so it wasn’t too invasive. An interesting point is that from the PHP7 the stretch with } elseif…
-
2
votes1
answer7011
viewsA: How to remove or clear value from input file?
Example of how to clear the value of an input type=file (actually a trick): $().ready(function() { list = $("[class^=f_clear_]"); if (list.length > 0) { $.each (list, function(key, row) { var arr…
-
1
votes1
answer62
viewsA: Doubt in . htacess
Briefly the URL rewriting rule says that all requests should go to the index.php file receiving the requests by the parameter path. In this file index.php will have something like $_GET['path'] or…
-
2
votes2
answers229
viewsA: What does the PHP "new" actually do when instantiating a class?
In PHP classes have no type definition or visibility. For example, there is no such thing: static class Foo{ } This is only in the methods and properties. class Foo { puclic static $bar; public…
-
1
votes1
answer647
viewsA: Decode JSON return faster
From Javascript the connection is given via client-side, ie by the browser. A URL, once accessed, has the content cached on the user’s computer. In server-side this cache is not saved automatically…
phpanswered Daniel Omine 19,666 -
6
votes2
answers202
viewsA: Which is faster to read and edit, a database or a . txt?
According to what you described, there will be hundreds of simultaneous connections. Each connection increases a value and when it reaches 5, it returns to 1. With txt file this can be a problem as…
-
5
votes1
answer1828
viewsA: How to present the correct accent on the return of cmd?
Use the command chcp to change the charset of the cmd. For UTF-8 the code is 65001 The command to execute: chcp 65001 I’m not sure where I could perform within those functions you’ve presented. You…
-
1
votes1
answer518
viewsA: PHP - Create . TXT file with Visitors' IP log
A scope for how you can implement: The txt file for testing is like this 123.456.789.00 - 1 321.543.765.99 - 2 543.210.456.22 - 3 435.647.533.33 - 4 This is the routine: <?php $ip =…
phpanswered Daniel Omine 19,666 -
5
votes3
answers89
viewsA: How to parse a string array for a multidimensional array?
In this example, I kept the same object. Original indexes are removed as they are "converted" $arr = array( 'a: 1', 'b: 4', 'c: 2', ); print_r($arr); foreach ($arr as $k => $v) { $a =…
phpanswered Daniel Omine 19,666 -
1
votes1
answer36
viewsA: How do you add a get without replacing what you already have?
Shortly after the form, add an Hidden field <form method="GET" class="form-inline"> <input type="hidden" name="id" value="<?php echo $idArea;?>"> The rest continues as it is.…
-
1
votes2
answers696
viewsA: Replace an input value and keep the previous value
The simplest way is to use CSS -webkit-text-security You can use the values none, square, circle or disc. Example below using circle: function Foo() { frm = document.getElementById("frm");…
-
2
votes1
answer1609
viewsA: Run an Laravel Schedule every minute?
Log into the server with user permissions to create schedules. For this you can use SSH (console) or use resources of management tools of websites like Plesk, Cpnel, etc. Via console (SSH), after…
-
4
votes2
answers1340
viewsA: Smart Query with Mysql
For simple cases, the SOUNDEX() function can help SELECT title, SOUNDEX(title) FROM soundex_test WHERE SOUNDEX(title) like SOUNDEX('%Farmácia%'); Of course you must make some adaptations because…
-
7
votes1
answer358
viewsA: What is the amount of $_POST records of a dynamic input form?
Check the directive max_input_vars. If you are really sure that there are even more than 300 fields in the form and always arrive as 166 limit, the most likely hypothesis is limitation in the…
-
0
votes1
answer115
viewsA: How do I know if there is a CRON working on the PHP 5.3 (Centos) garbage collector?
Some *Nix distributions, mainly those based on Debian, the directive session.gc_maxlifetime is ignored when set at runtime. This is because such linux distributions disable the PHP setando garbage…
-
0
votes2
answers454
viewsA: Is there a way to know which file a piece of html is in?
In text editors like Notepad++ you have option to search multiple files recursively in subfolders. This may be the easiest way for cases like the one described in the question. *Whereas none of…
-
2
votes3
answers4527
viewsA: Remove currency formatting and take only the PHP number
The conversion can be done simply like this: $str = '99.999,99'; $str = str_replace('.', '', $str); // remove o ponto echo str_replace(',', '.', $str); // troca a vírgula por ponto // resulta em…
-
4
votes1
answer2121
viewsA: How to take variable value within a Function in one Class to another Function?
Could only declare a new property for the class. Can be declared private. A generic example: class Test{ private $foo; public function A() { $this->foo = 'bar'; } public function B() { return…
-
0
votes2
answers58
viewsA: How do apps validate login on a remote server?
Communication is usually via webservice (API). Database access data, Mysql for example, is on the server and not on the client. Do not confuse a system user’s authentication data with the server’s…
-
11
votes2
answers1270
viewsA: Why is the NAN constant evaluated as True when testing it with is_numeric?
Summary Briefly, the function of is_number() checks type only. Since NAN is a constant with type defined as float, it is returned to true. The function is_float() returns true by checking the type…
-
2
votes2
answers560
viewsA: Save reports to a table or run a database query?
Saving the results is a good option to optimize because it is common to consult several times the same condition. For example, consulting the entire month is obvious and common. This saves a lot of…
-
0
votes4
answers239
viewsA: Empty character exiting HTML
On the way out there’s this [carriage return][space][space]string(2) "OK"[space] The ASCII codes [carriage return] 13 [space] 32 From the Chrome view-source Carriage Return does not break the line,…
phpanswered Daniel Omine 19,666 -
12
votes1
answer3066
viewsA: Is Ionic development for Ios in a windows or linux environment possible?
Not possible because you need Macos and Xcode features like the iOS SDK environment to build iOS apps. The closest options would be: Cloud These are cloud app compilation services. In this case, any…
-
1
votes1
answer463
viewsA: Error adding APP build on iTunes Connect
The app uses access features to the user’s image library and camera. This app Attempts to access Privacy-sensitive data without a Usage Description. The app’s Info.plist must contain an…
-
0
votes2
answers729
viewsA: PHP json_encode with Boolean and decimal values
I did a test to demonstrate that there is no difficulty with decimals or booleans when converting to json format. <?php $x = array(9.9, 0); $j = json_encode($x); ?> <script> v =…
-
2
votes2
answers105
viewsA: Check if the same value is in one of the two fields
That’s the way it’s done. There’s no shortcut. But I suggest delimiting in parentheses to avoid inconsistency: DBRead('usuarios', "WHERE (usuario = '$user' OR email ='$user') AND senha =…
mysqlanswered Daniel Omine 19,666 -
2
votes1
answer311
viewsA: How do I enable my iPhone to use in tests by Xcode?
Please update Xcode by installing the latest version as 7.x does not support iOS10. There are ways to use it but it is not recommended. If you don’t have a specific reason to continue with Xcode 7,…
xcodeanswered Daniel Omine 19,666 -
2
votes2
answers2019
viewsA: Write to txt file with PHP
Test script /* Esse array simula a relação entre os códigos dos pedidos e os nomes */ $orders = array( '205537' => 'FULANO 1', '203885' => 'FULANO 2' ); /* Dados para teste */ $data =…
-
2
votes3
answers849
viewsA: Remote server/local server in PHP
Hosting servers offer the environment already configured. No need to install Apache, PHP, Mysql, among others. Check with your hosting provider for the features offered. As each company has its own…
-
1
votes4
answers381
viewsA: Transform Multiple arrays into an array only
Example of how you can do it: $arr = array( 0 => array(1, 2, 3), 1 => array(4, 5, 6) ); $rs = array(); foreach ($arr as $v) { $rs = array_merge($rs, array_values($v)); } unset($arr);…
-
2
votes3
answers894
viewsA: What is the difference between foreach uses in php?
Complementing the existing responses and to avoid talking more of it, within this context also enters the code patterns. Standards widely accepted by PHP communities worldwide. *It does not mean…
-
3
votes2
answers289
viewsA: Replace table content with table content?
It is unclear if you only want to know the SQL commands or if you want to create the connection with a PHP script. Therefore, in a general way, First delete existing data: DELETE FROM TAB2; Then run…
-
5
votes7
answers16899
viewsA: How to create a <select> with images in the options?
function CustomSelect() { var container = ".custom_select", selected_selector = ".custom_select_selected", obj = $(container); if (obj.length) { var selected = obj.find(selected_selector); var…
-
2
votes2
answers4217
viewsA: Roadblock on Apache Gate 80
Open the command prompt in administrative mode and run: netstat -np TCP | find ":80" The Ips on the left is your local IP. The above command will return tens or hundreds of results if you are…
-
1
votes1
answer283
viewsA: Error Object of class daoMaterias could not be converted to string in daoMaterias.php on line 33
The error message indicates that you are assigning an object as a string. Example simulating the error: <?php $x = (object)array(); // objeto para teste //echo $x; //provoca o erro $y = 'foo'.$x;…
-
2
votes2
answers240
viewsA: Keep Data Equal
Prioritize saving data locally instead of saving it to an external server. The reasons are in the question itself. If there is no internet connection, you won’t even be able to add a new contact or…
androidanswered Daniel Omine 19,666 -
2
votes2
answers475
viewsA: Create arrays inside while
A multidimensional array? Could be just that: $totalArray[] = $contentLoop;
-
1
votes3
answers950
viewsA: Local communication through online application
I decided to post something simple after observing the comments. Now I could have more confidence about which solution to present. I always think of simple solutions so let’s go to a really simple…
-
2
votes5
answers200
viewsA: Error when redirecting after sending form
On top there’s this: header('Content-Type: text/html; charset=utf-8'); This line writes information in the header. At the end there is another header that serves to redirect to another page. header…
phpanswered Daniel Omine 19,666 -
3
votes3
answers1056
viewsA: What is "with" for in Javascript?
Javascript is controversial. A few years ago, mozila showed how deprecated in the documentation, around 2010. Later it was removed from this condition placed only a warning to avoid use. It is still…
-
1
votes2
answers687
viewsA: How do I know if a class implements an interface?
To know which interfaces a class implements, just use the function SPL class_implements() Scope array class_implements ( mixed $class [, bool $autoload = true ] ) From PHP 5.1 you can set the class…
-
2
votes3
answers2879
viewsA: How to know how many Sundays have php mysql months
One more <?php $week_day = 1; // The desired week day (sunday: 1, monday:2 .... saturday: 0) $year = '2016'; // Year, 4 digits $rs = array(); $month = 1; while ($month <= 12) { $day = 1; $date…