Posts by Daniel Omine • 19,666 points
581 posts
-
2
votes1
answer167
viewsA: Blender 2.7 - Shortcut to running game engine
The shortcut continues in the P key. Make sure you are selected in "Blender Game". See screenshot: It’s version 2.69, but it’s the same look Also, the cursor (mouse) must be in the "Blender 3D View…
blenderanswered Daniel Omine 19,666 -
1
votes2
answers30
viewsA: Divergence between manual populated A Array and variable data
In the first you have an array with 2 indexes. In the second, it only generated an array with a single index because the array will not be auto-built from a string as parameter. If you wanted to…
phpanswered Daniel Omine 19,666 -
0
votes2
answers303
viewsA: Property of a method in another method
It is not feasible to try to correct the code you posted because OOP is conceptual and depends on how is the structure of the other codes of the system you are developing. In the code you posted…
-
11
votes2
answers2284
viewsA: TODO - What is, what is its utility and how to use it?
This term can be translated literally. It means "to do", "to do". It’s not something specific to programming languages. It is merely a reminder of things to do, usually a relevant correction or…
-
2
votes2
answers1019
viewsA: Use "anti_injection" in a MD5 password
There is no need to convert or remove anything unless your business rule requires you to create a password with limitations. This, personally I find horrible because the more complex the password,…
-
6
votes2
answers617
viewsA: addslashes is the basic for security?
The function addslashes() is used to escape backslashes, single quotes, among other characters. It is not enough to escape HTML, CSS or Javascript content. To escape HTML content, use functions such…
phpanswered Daniel Omine 19,666 -
3
votes2
answers2263
viewsA: How to make CSS reminders when passing mouse cursor?
.wrapper { text-transform: uppercase; background: #ececec; color: #555; cursor: help; font-family: "Gill Sans", Impact, sans-serif; font-size: 20px; margin: 100px 75px 10px 75px; padding: 15px 20px;…
cssanswered Daniel Omine 19,666 -
0
votes2
answers621
viewsA: How to pick up and count images with php?
Itere the array received from the global variable $_FILES // Obtém o tamanho do array, ou seja, a quantidade de imagens recebidas $count = count($_FILES['pic']['tmp_name']); // Faz a iteração for…
-
3
votes3
answers218
viewsA: Possibility to create 200 columns in a database
It seems kind of silly to post this, but a basic logical structure would be something like this: # Todas as perguntas tabela perguntas - id (único) - descricao # Todas as respostas, independente da…
-
2
votes3
answers434
viewsA: Is it correct to omit the html start tag in HTML5?
Not that it is correct or incorrect, but it is valid and even recommended for the purpose of reducing the amount of codes. You can omit even the tag <body>. But this is a controversial and…
html5answered Daniel Omine 19,666 -
-3
votes3
answers779
viewsA: Is there any way to make asynchronous PHP url requests?
An old routine I developed: class Background { /* $cmd -> A linha de comando a executar. $opt -> Opção de parâmetros para o ambiente onde executa o script. */ public static function Call($cmd,…
phpanswered Daniel Omine 19,666 -
1
votes2
answers1284
viewsA: How do I check whether the php_fileinfo.dll extension is active or not via php code?
Checking whether the extension has been loaded if (!extension_loaded('fileinfo')) { // a extensão fileinfo não está carregada } else { // a extensão fileinfo foi carregada }…
-
2
votes1
answer477
viewsA: To change the FROM parameter of sending email so that the sending server does not appear
In the fourth function parameter mail(), define the header. $to = $_POST['to']; $subject = $_POST['subject']; $message = $_POST['mensagem']; $headers = 'From: NOME DE QUEM ENVIA…
-
1
votes2
answers827
viewsA: What is the best way to persist data in an application?
Whenever you think "what’s best to do X or Y," change this question to "what’s the recommended means to do X under such and such a context". To say that X is better or Y is better is pretentious and…
phpanswered Daniel Omine 19,666 -
5
votes3
answers247
viewsA: What is "One Level of indentation"?
This is independent of language or environment. It’s just a good practice suggestion in code writing. And not to think that I just speak, I programmed in ASP (classic), before entering PHP, around…
terminologyanswered Daniel Omine 19,666 -
3
votes2
answers1310
viewsA: textarea with notebook lines style
A simple way is to define a background in a textaterea. textarea{ background-image: url("http://i.stack.imgur.com/yWNH7.png"); font-size:21px; } <textarea cols="20" rows="10">texto qualquer…
-
4
votes2
answers4807
viewsA: When should I use the class attribute in HTML elements?
In short, the class attribute is useful when you need to modify the style of an element and these styles will also be useful for other elements, without necessarily modifying the styles globally,…
htmlanswered Daniel Omine 19,666 -
2
votes2
answers1261
viewsA: Do not insert zeros to the left of a number
This regular expression replaces the excess characters. In your case, the left zeros. str = '0000.00'; str = str.replace(/^0+(?!\.|$)/, ''); console.log(str);
javascriptanswered Daniel Omine 19,666 -
5
votes3
answers6502
viewsA: How to install Composer globally on linux?
Aliases An alias could solve vi ~/.bashrc add alias nome_do_alias=comando example alias composer=/a/pasta/onde/estah/conposer.phar The alias feature varies according to the Linux distribution, but…
-
1
votes1
answer278
viewsA: How to know if the visitor is the Google bot, or Facebook bot
Google if (strstr(strtolower($_SERVER['HTTP_USER_AGENT']), "googlebot")) { // Provavelmente proveio do google. // Aqui você implementa as suas firulas. } Facebook: if (…
-
1
votes1
answer74
viewsA: Check if page comes from Google?
You can only check if it came from one of Google’s domains. A simple example with PHP is to read the global variable $_SERVER['HTTP_REFERER']. However, it is not possible to get the search terms…
-
2
votes3
answers2753
viewsA: Solution to scan documents by browser
Modern scanners have diverse capabilities and provide Apis. Unfortunately, Apis do not have a standard protocol because each manufacturer sets its own standard. To develop something as you want it…
-
2
votes1
answer609
viewsA: Template class, include header and footer
That stretch: public function set($file) { $path = './templates/' . DEFAULT_THEME . '/header.tpl.php'; $path = './templates/' . DEFAULT_THEME . '/' . $file . '.tpl.php'; $path = './templates/' .…
-
0
votes3
answers1281
viewsA: Url friendly to MVC
Rewrite rules in . htacess RewriteEngine on RewriteBase / # Redirect Trailing Slashes. RewriteRule ^(.*)/$ $1 [L,R=301] RewriteCond %{SCRIPT_FILENAME} !-f RewriteCond %{SCRIPT_FILENAME} !-d…
htaccessanswered Daniel Omine 19,666 -
1
votes2
answers229
viewsA: Unlink command is not working if enabled via include
If you want the file to auto delete, you can do so unlink(__FILE__); The constant __FILE__ returns the absolute path of the current file. However, there are factors that can affect the functioning…
phpanswered Daniel Omine 19,666 -
0
votes4
answers1429
viewsA: How to search for results in Mysql where a given field only has special characters?
Search for names that do not have alphanumeric characters. Example: SELECT `name` from `person` where `name` REGEXP "^[^[:alnum:]]+$" The advantage in the use of this expression: ^[^[:alnum:]]+$ is…
-
2
votes1
answer358
viewsA: What is the safest way to get errors in PHP?
There is no exact answer as it depends on the environment and circumstances. A simple setup that I recommend is Development environment <?php date_default_timezone_set('Asia/Tokyo');…
phpanswered Daniel Omine 19,666 -
1
votes1
answer499
viewsA: Ajax call webmethod with friendly URL
Create a rewrite rule where suffix . aspx can be hidden. Example (web.config): <rule name="Append .aspx"> <match url="^((.*\/)?[^/.]+)$" /> <action type="Rewrite" url="{R:1}.aspx"…
-
13
votes2
answers16859
viewsA: How can I get the lottery results?
An example using php-Curl to get the result of the latest Mega-Sena game, directly from the official website. The script retrieves the data from the official website where it is necessary to…
-
0
votes1
answer606
viewsA: I want to use php exceptions to ignore an error that ends up terminating the script
The function foreach() waits for an eternal object like a stdclass or a array. To avoid the Invalid argument supplied for foreach(), just create a consistent code by checking if the parameter is…
-
2
votes1
answer3022
viewsA: String PHP in Alert Javascript
Just concatenate, like this: echo 'alert("message successfully sent '.$nome.'");'; Just be careful with reserved Javascript character conflicts. Example, if the string comes from PHP has double…
-
0
votes1
answer166
viewsA: where to mount the table in a PHP MVC project with ajax?
The HTML code in this case should be in the View. There is general confusion also about what is model and view, such as using the controller. Read this recent topic: /a/116422/4793…
-
3
votes2
answers62
viewsA: How to include a js from another domain in html?
Specify the protocol A generic mode where it becomes compatible with https and http: <script src="//meudominio.com/arquivo.js" ></script> If you want a specific protocol <script…
-
2
votes4
answers4351
viewsA: How and why use MVC in PHP?
OOP and MVC are two separate things. MVC is a design standard where it basically separates the layers of responsibilities where M represents the business logic, C represents the controller and V…
-
1
votes2
answers22129
viewsA: Get current date in mysql
The guy datetime has the format Y-m-d H:i:s, that is, the date and time. To compare the date by ignoring the time, use the function DATE() Example: SELECT * FROM cad_clientes WHERE…
-
1
votes2
answers60
viewsA: Doubt Data with PHP and JS
Generic formatting with dynamic mask: function format_string(mask, str, ch) { ch = (typeof ch === "undefined") ? "#" : ch; var c = 0, r = "", l = mask.length; for (i = 0; i < l; i++) r +=…
-
3
votes1
answer778
viewsA: Convert a variable to STRING in the mysql query in PHP
The question is confusing. However, just observing the code, it should be only the lack of delimiters: $result = $conn->query("SELECT player, ip from gru WHERE ip = '".$line[0]."'");…
-
11
votes4
answers1072
viewsA: What is the practical use of bitwise operators in PHP?
For those who stayed floating, let’s go to a practical example in the real world Imagine you built a system where you need to implement several levels of access. Example, allow or deny a system…
-
2
votes1
answer76
viewsA: How to make 1 query and distribute the result spread by the code?
Assign the results to a variable. Usually in an array. With the data in a variable, simply snap them "wherever you want". Take an example: <?php $dummy_data = array('anuncio a', 'anuncio b',…
-
13
votes2
answers9932
viewsA: What is the difference between . prop() and . attr()?
Both perform the same functions. The difference is that the method .prop() is in the DOM and the method .attr() is in the HTML. An example, clearer and generic, is when you try to access an…
jqueryanswered Daniel Omine 19,666 -
2
votes2
answers1011
viewsA: How to Accumulate strings in a single variable?
If you want a suggestion, remove this variable as it is useless. $acumulaNome = ; Filenames are already in the variable $arquivo['name']. So to print out these names would just do something like…
-
1
votes2
answers70
viewsA: Links in javascript
On the page where you load the Ckeditor script, put this <script type="text/javascript"> ckeditor_global_url = <?php echo URL;?>; </script> Any other script that uses an equal name…
-
3
votes1
answer90
viewsA: Capture all ID with preg_match
$str = ' <div id="opcao1"></div> <div id="opcao1a"></div> '; $doc = new DOMDocument(); @$doc->loadHTML($str); // Aqui usamos o inibidor de erros `@` para evitar o disparo…
phpanswered Daniel Omine 19,666 -
2
votes2
answers66
viewsA: Numberformatter does not work MIN_FRACTION_DIGITS, 2
You are specifying minimum 2 digits for decimal place. Should specify maximum 2 digits $moeda1->setAttribute( NumberFormatter::MAX_FRACTION_DIGITS, 2); consult:…
-
1
votes1
answer207
viewsA: Value coding format (input)
Suggestion for correction: <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> <script type="text/javascript"> function update() { var html =…
-
3
votes5
answers6498
viewsA: Clear Browser Cache after Version Upgrade
No header combination is 100% guaranteed. The most guaranteed is to add a parameter as a url query. Example: /js/arquivo.js?20160227. This ensures that when modifying, the new version will always be…
-
1
votes4
answers1047
viewsA: How to invert words and count total characters
A multibyte character support version: $str = '日本語'; // teste essa palavra alienígena $str = 'Ação'; // ou será que essa palavra é alienígena? echo 'quantidade de letras: '.mb_strlen($str); echo…
phpanswered Daniel Omine 19,666 -
4
votes3
answers603
viewsA: Create/Use shortcodes in php
It’s not very clear whether this could be done with a PHP parser, but if it is, here’s a simple example. Example Filing cabinet php test. function CompileTemplate($file, $parse) { return…
-
0
votes1
answer139
viewsA: How to install an old version of JDK in windows 7?
Install the different versions of JDK in different folders. Just this.
-
2
votes3
answers2716
viewsA: How to add attributes to an element that was created with Javascript?
When attaching the new object <div />, just add the classes you want: Example 1 obj = $("<div />"); obj.addClass("placeholder"); obj.addClass("fg-red"); obj.appendTo(element); Example 2…