Posts by Wallace Maxters • 102,340 points
1,984 posts
-
1
votes1
answer87
viewsA: How to make an Extract within a function without the variables colliding with the parameter variables?
You can solve this by using the function either captures the arguments passed to a function, regardless of the variable name. Those functions are: func_get_args and func_get_arg Behold: function…
phpanswered Wallace Maxters 102,340 -
3
votes2
answers75
viewsQ: What do increment operators do in arrays?
Accidentally I was creating a PHP script and unintentionally put an increment operator in a variable whose type is array. To my surprise, no error was shown by PHP. I did some tests and found that…
-
3
votes1
answer649
viewsQ: Difference between Father. __init(self) and super(Father, self). __init__()
I have a little doubt about the issue of inheritance in python. In the following test, I hoped that quack prints the same value for the two classes I created: class A(object): a,b = (None, None) def…
pythonasked Wallace Maxters 102,340 -
1
votes1
answer188
viewsQ: Performance of call_user_func_array . Why do libraries only use it with 5 arguments or more?
Let’s discuss: These days I took a look at the source code of a Zendframework2 class. There was an implementation of the magic method __call. In that method there was something that caught my…
phpasked Wallace Maxters 102,340 -
7
votes1
answer592
viewsQ: Can Hard Drive Defragmentation help my server perform?
I always hear that it is necessary to "defragment the hard disk". But I never specifically knew the internal processes involving that operation. A doubt for example is: How software can perform this…
-
5
votes8
answers5012
viewsA: Printing a String until a space is found
Then she might get hurt :'( Forgot to mention the function (not so well known) strtok. Check it out: $nome = 'Wallace de Souza Vizerra'; echo strtok($nome, ' ') The exit will be: "Wallace" Another…
-
1
votes1
answer1225
viewsA: About key command (lua script)
On the platform for creating games called Love 2d it is possible to do this. Example: function love.keypressed(key) print(string.format("você apertou a letra '%s'", key) end Reference:…
-
6
votes2
answers509
viewsQ: How does the Table declaration instance work in Lua?
In object orientation, the class is usually created first and then the same. PHP example: class Test{ public function __construct() { // inicia as parada aqui } } $test = new Test; But in the Lua it…
-
5
votes3
answers1527
viewsQ: How to find the negative of a color in hexadecimal?
I would like to know what calculation I can use in language like javascript, php or python to discover the negative of a cor hexadecimal. Example: If the white negative is black, then I: `#FFFFFF…
hexadecimalasked Wallace Maxters 102,340 -
6
votes4
answers696
viewsQ: How to create hexadecimal colors randomly?
How can I create color code in hexadecimal randomly with PHP? For example, from #000000 at the #FFFFFF, to generate something like this: <div style="color: <?= rand_color()?>"> Estou…
-
9
votes4
answers696
viewsA: How to create hexadecimal colors randomly?
In php you can make it very simple: sprintf('#%06X', mt_rand(0, 0XFFFFFF)); Explaining: # is the initial character used for hexadecimal colors in HTML %06 means that the random values will be filled…
-
12
votes5
answers1943
viewsQ: Is it possible to program to web with Lua?
I see many tutorials on the Internet that assimilate the use of language Lua to the development of games. But I’d like to know the following: It is possible to develop for web using the language…
-
11
votes1
answer30199
viewsQ: What is the difference between x-www-form-urlencoded and form-data?
Is there any relevant difference between content-type x-www-form-urlencoded and form-data? I always have doubts when I should use between one or the other, because I don’t know if there is any…
-
3
votes1
answer442
viewsA: background-image css clickable. Is there a way?
Maybe you’re talking about adding this to css: cursor:pointer If you need to add an action only when the click is executed, then use :active .element:active{} Example: .clicavel{ height: 150px;…
-
6
votes1
answer177
viewsQ: What is the "behavior" attribute in CSS for?
I’ve seen in some CSS codes made to work on most esteemed navigator Internet Explorer the following attribute: img { behavior: url(ie_png.htc); } What is the purpose of this behavior? Only works for…
-
4
votes1
answer111
viewsQ: How to iterate with a table in Lua?
How to iterate with a table in Lua? Example: dados = { nome = 'Wallace', idade = 25 }
-
3
votes2
answers738
viewsA: Make a change to a div by checking a checkbox
That’s what you want? $(function() { $('.checkbox').change(function() { var $that = $(this), $div = $that.closest('.bg-yellow'); if ($that.is(':checked')) { $div.css('background-color', 'yellow'); }…
-
7
votes3
answers795
viewsA: PHP database text for html
If you want to take out those quotes then you’ll have to do so: trim(nl2br($texto)); Unless at the time you are printing the variable you have done so: <div> <?php echo nl2br($texto); ?>…
-
1
votes1
answer872
viewsQ: How to read a file with moon?
What function do I use to read data from a file in Lua? For example: lua_folder/ .... config.json .... main.lua I want to open this file config.json through the Lua.…
luaasked Wallace Maxters 102,340 -
4
votes1
answer261
viewsQ: How to read JSON with moon?
I wonder how to read this JSON down through language Lua. json = '{"nome" : "Wallace de Souza"}'
luaasked Wallace Maxters 102,340 -
3
votes3
answers825
viewsA: getJSON PHP shows no result
You can only display the data with json_encode outside the while, my friend. while ($campos = mysqli_fetch_array($rs)) { extract($campos); $Array[] = Array( "nome" => "$nome", "email" =>…
-
6
votes2
answers1720
viewsA: Which is faster, access data in file or database?
The fastest is not always the best for your application. Generally, when it comes to data recovery, it is recommended to use the database. In a database you can select the record you want to read,…
-
2
votes1
answer3245
viewsA: Validate if input is actually CNPJ
PHP Library for Validation A good library to validate is the Respect\Validation. Javascript validation Another option is to use the function generated by the Gerador de CNPJ. Just that it’s in…
phpanswered Wallace Maxters 102,340 -
5
votes4
answers1023
viewsA: Send more than one parameter in GET request
If you continue with this concatenation there in your code, it would be preferable to use the function $.param jQuery. var dados = { estado: $('#estados').val() } var url = 'cidades.php?' +…
-
2
votes3
answers229
viewsA: How to add new jquery inputs through a number of a text box, but add only those that are missing
In that case, my friend, you’ll have to change the logic of yours for. You need the variable i has the value "static". That is, the variable i will always have the last value inserted. And the…
jqueryanswered Wallace Maxters 102,340 -
0
votes1
answer626
viewsA: Upload image to AJAX server serialize and PHP
The function serialize for forms is only able to serialize data other than the type file To upload the image, you’ll need to get around this by changing the way the function $.ajax treats the data:…
-
5
votes2
answers689
viewsA: Add inputs in jquery, but without deleting existing ones
Utilize append instead of html $divForm.append(html); The append is used to add elements or text at the end of the target content. If you want to do otherwise, that is, put at the beginning of the…
-
14
votes2
answers1691
viewsQ: What is the advantage of using languages you compile for other languages?
We were discussing in Stackoverflow’s chat about languages like Moonscript and Coffeescript. They are two languages that compile into other languages. Moonscript for Lua and Coffescript for…
-
6
votes2
answers213
viewsQ: Difference between ":" and "." in the methods of a Lua table
I came across two different statements that left me confused. obj = {} function obj.Create(name) end function obj:GoGoGo(name) end What is the difference between the declared function and the .…
-
4
votes2
answers212
viewsQ: What is the # (fence) in the Lua language for?
I’m watching this one tutorial about creating a game and came across something I didn’t understand about the language Lua. There is an excerpt from the code where there is the following expression:…
-
0
votes1
answer2193
viewsQ: How to install the moon via terminal in Ubuntu?
How to install the moon via terminal in Ubuntu? When I try apt-get install lua is returned O pacote lua é um pacote virtual fornecido por: lua5.1 5.1.5-5ubuntu0.1 lua50 5.0.3-7 lua5.2 5.2.3-1…
-
24
votes3
answers23953
viewsA: Which content-type is suitable for files like: . doc, . docx, . xls
Based on a configuration file from Laravel 3, see the list of the most common mimes used: https://github.com/tectonic/laravel-3/blob/master/application/config/mimes.php To make it easier to read the…
mime-typeanswered Wallace Maxters 102,340 -
1
votes3
answers978
viewsQ: What is this <Buffer> in reading files in NODEJS?
I’m learning a little bit about NodeJS. The last thing I learned was reading a file. The question that left me doubtful is the following. When I use the function readFile with the second parameter…
node.jsasked Wallace Maxters 102,340 -
2
votes2
answers934
viewsA: Detect or block redirect with ajax?
I went to find a source to see if I can solve not only my problem. All redirect, usually back as response code 301 and 302. When the answer returns correct the status is 200. I’m telling you to…
-
10
votes2
answers934
viewsQ: Detect or block redirect with ajax?
I’m trying a problem with an ajax requisition I’m doing. The requested url is a url x, however, when I do the request, it redirects me to a url y. I’m using the function $.ajax jQuery. I would like…
-
6
votes2
answers1694
viewsA: What is the ">" CSS operator for?
To take the immediate child element, and not any one child. For example: .avo { background-color:red; height:50px; } .avo > .pai > .filho { color:red; background-color:yellow; height:20px; }…
cssanswered Wallace Maxters 102,340 -
2
votes2
answers433
viewsQ: How to make a form submission without form?
The question may seem strange. But on a certain page I would like to make a submit, as a form, when clicking a button, but without the form presence in HTML. Is there any way to simulate the…
-
2
votes2
answers433
viewsA: How to make a form submission without form?
Yes, there is a way. You can do the same way you use to submit a form via javascript, but you will only use what is created by document.createElement Thus: var fake_form =…
-
1
votes1
answer137
viewsA: Store PHP script output in "compressed" HTML
You can use an alternative form of compaction: function sanitize_output($buffer) { $search = array( '/\>[^\S ]+/s', // strip whitespaces after tags, except space '/[^\S ]+\</s', // strip…
phpanswered Wallace Maxters 102,340 -
4
votes1
answer6257
viewsQ: How to see all modules installed in nodejs?
I’m taking a look at the nodejs and would like to know how do I list all the modules I installed. How can I do that?
node.jsasked Wallace Maxters 102,340 -
0
votes2
answers104
viewsA: Could not acess file: Array e syntax error, Unexpected '$name' (T_VARIABLE)
Mucap, this will happen even if you use a Multiple in your input:file If you have more than one file, the treatment will be different. Probably, your form is like this: <input name="file[]"…
-
79
votes4
answers6695
viewsQ: Is it possible to make a tooltip with pure CSS?
Is it possible to make a tooltip with pure CSS? That is, without jQuery, without Javascript, but only with CSS. For example, I want to do this based on the following element: <a href="#"…
-
41
votes4
answers6695
viewsA: Is it possible to make a tooltip with pure CSS?
Yes, it is possible! We can use the attribute :after for this, see: .wm-tooltip{ position:relative; } .wm-tooltip:after { background-color:rgba(0, 0, 0, .6); color: white; box-sizing:border-box;…
-
6
votes2
answers796
viewsQ: Is it possible to instantiate a class without calling the constructor in PHP?
It is possible to instantiate a PHP class without the class calling the method __construct? Example: class Test { public $chamado = false; public function __construct() { $this->chamado = true; }…
phpasked Wallace Maxters 102,340 -
4
votes2
answers796
viewsA: Is it possible to instantiate a class without calling the constructor in PHP?
Through the class of class reflection ReflectionClass can yes do this in php. Example: $reflect = new ReflectionClass('Test') $test = $reflect->newInstanceWithoutConstructor();…
phpanswered Wallace Maxters 102,340 -
7
votes2
answers300
viewsA: How to Resolve Fatal Catchable Error While Trying to Show Messages
The problem of the line 84 is the print, trying to convert the object to string before printing it. PHP objects cannot be converted to string unless they implement the magic method itself…
phpanswered Wallace Maxters 102,340 -
3
votes4
answers5013
viewsA: What’s the content of the Github?
Issues is translated by Problemas. Issueson github is a great way to keep track of tasks, improvements and bugs for your projects. They look like an email, except they can be shared and discussed…
githubanswered Wallace Maxters 102,340 -
16
votes4
answers5013
viewsQ: What’s the content of the Github?
In the Github I realized that there is an option called issue. I’ve asked questions there, but I realized that there are some specific tags for a issue (that do not seem to be only for question).…
githubasked Wallace Maxters 102,340 -
28
votes1
answer3003
viewsQ: How does the Repository standard work?
I was doing a study on a framework in PHP called Symfony. When I was studying about the database research, I realized that there are some differences in relation to the searches, as in frameworks as…
-
7
votes4
answers352
viewsQ: What is the second parameter of array_keys for?
I was stirring the sublime text and I came across something I didn’t expect when I went to type the function array_keys array_keys(arg, search_value, strict); I did the test and really the second…
phpasked Wallace Maxters 102,340