Posts by Filipe Moraes • 8,737 points
259 posts
-
2
votes5
answers6498
viewsA: Clear Browser Cache after Version Upgrade
I believe that by adding Last-Modified the problem is solved. This will inform the browser which date the file was changed, which in your case would be the date the new version became available.…
-
2
votes2
answers655
viewsA: How to Add a Locksmith to the keypress event on all pure javascript inputs?
Follow the solution with comments. Add the code at the end of your HTML page. It’s good practice to add the code or link to the .js at the bottom of the page when this does not need to be executed…
javascriptanswered Filipe Moraes 8,737 -
2
votes1
answer35
viewsA: Protect other users' user options
Before, you have to check if the image belongs to the logged in user: Let’s remove the line $owner=$_REQUEST['o']; because the responsibility to inform who owns the image is not of the client but of…
phpanswered Filipe Moraes 8,737 -
2
votes1
answer442
viewsA: "Notice: Undefined index: matricula" error
When using the function mysqli_fetch_array, an array with the indices is generated with exactly the same name as the fields in your table. For example, your table carros has the field Matricula,…
phpanswered Filipe Moraes 8,737 -
2
votes1
answer38
viewsA: How do I connect to another database using the connection I already have
Your Return must be included within the try: //... try { $conn2 = new PDO('mysql:host='.HOST.';dbname='.BD.'', ''.USER.'', ''.PASS.''); $conn2->exec("SET NAMES 'utf8'"); return $conn2; }…
phpanswered Filipe Moraes 8,737 -
3
votes3
answers535
viewsA: how to perform calculations between 4 input, loading page or change value
Your HTML must be changed. Add property onkeyup to the fields encargos and desconto. Custo <input type='text' class='form_campos calc' $input_total id='total_pedido' name='total_pedido'…
-
6
votes2
answers31527
viewsA: How to round with 2 decimal places in javascript using a specific rule?
Use the function toFixed: var n1 = 2.34; var n2 = 2.35; console.log(n1.toFixed(1)); //2.3 console.log(n2.toFixed(1)); //2.4 If you need to do more operations with the result, you need to convert it…
-
2
votes1
answer506
viewsA: problem when sending css email by phpmailer
Besides the tag CSS, you will have to put the styles also inline so that it works in Gmail. Some tools can assist in conversion: http://templates.mailchimp.com/resources/inline-css/…
-
1
votes2
answers47
viewsA: How to pick the right date for the next event
In a procedural way, only with the information of the question: $intervalo = 2; //2 em 2 semanas $semanaAtual = array(0,0,1,0,0,0,0); //domingo, segunda, terça, quarta, quinta, sexta, sábado…
-
3
votes2
answers1019
viewsA: Repeat animation in css
Currently CSS Animation does not have the delay property after the end of the animation, the property exists only when starting the animation. However, by making some simple calculations, it is…
-
0
votes0
answers388
viewsQ: 2 different versions of PHP(cli) on Ubuntu 14.04LTS
I installed PHP 5.6 on Ubuntu 14.04LTS using the following commands: sudo add-apt-repository ppa:ondrej/php5-5.6 sudo apt-get update sudo apt-get install php5 But when executing the command php -v I…
-
0
votes1
answer1158
viewsQ: apache2 installation error
When executing the command sudo apt-get install apache2 the following error is returned: Os pacotes a seguir têm dependências não satisfeitas: apache2 : Depende: apache2-bin (= 2.4.7-1ubuntu4.9) mas…
-
7
votes1
answer14471
viewsQ: Remove PHP from Ubuntu 14
I used the following commands to remove PHP from Ubuntu: sudo apt-get purge php5 php5-cli libapache2-mod-php5 php5-mysql phpmyadmin sudo rm -rf /etc/php5 But when executing the command php -v at the…
-
6
votes1
answer457
viewsA: Syntax error php
Obsolete PHP code, but answering your question. At the beginning of the code you have <? swap for <?php. This is because all your remaining openings are utilizing <?php. Try it, put it all…
phpanswered Filipe Moraes 8,737 -
1
votes2
answers95
viewsA: Retrieving a json and turning it into html
That’s almost what you already have. The code would look like this: //Adiciona o elemento "ul" ao elemento "body". var ul = $('<ul>').appendTo('body'); var json = { items:…
javascriptanswered Filipe Moraes 8,737 -
0
votes1
answer112
viewsA: How to generate a li from this JSON
You can do a foreach to get the data: //... if (httpRequest.status == 200){ httpRequest.response.headDocument.content.forEach(function(o){ console.log("source: " + o.source);…
javascriptanswered Filipe Moraes 8,737 -
2
votes1
answer316
viewsA: When generating the thumbnail, the image goes to the whole black directory
Your problem is on the following line: $imagem = imagecreatefromjpeg($codificarFoto); See, the function (imagecreatefromjpeg) is to create (create) an image (image) from (from) a jpeg. The variable…
-
4
votes1
answer324
viewsA: PHP Mailer SMTP - Does not work
Missing indicate which host will send the message, I think for Gmail is "smtp.gmail.com": $Mail->Host = "smtp.gmail.com"; If it doesn’t work, enable debug mode: $Mail->SMTPDebug = 1; Also…
-
2
votes1
answer411
viewsA: Make price calculation with jQuery inside PHP loop
If you do it the way it is, all the "span" tags will have the same ID, ie "price". The ID is something that should be unique throughout your HTML as it represents a specific element. See, the…
-
2
votes2
answers241
viewsA: Playerprefs in Unity with Boolean variable?
According to the documentation, only float, int and string values can be saved. Since it is not possible to store booleans, you can store 0 or 1 and convert them, see the example below: using…
-
0
votes3
answers327
viewsA: Logo configuration when generating apk in Unity 5
In the build configuration (player Settings), you can choose the default orientation of the game (Landscape, Portrait, auto rotation, etc...). File -> Build Settings -> Player Settings ->…
-
1
votes1
answer154
viewsQ: Is it impossible to do trucate to a table with Foreign Keys even if it is empty?
Consider table "A" and "B". Table "B" has a Foreign Keys for table "A". Table "A" has no Foreign Keys. None of the tables have records. When trying to make a trucate to table "A", the following…
mysqlasked Filipe Moraes 8,737 -
0
votes0
answers27
viewsQ: How to split the module’s admin panel into two sections?
I have created a new payment module. The new payment method has two options and I would like to separate them into different sections, as in the image below: How to split the module’s admin panel…
magentoasked Filipe Moraes 8,737 -
1
votes0
answers18
viewsQ: Payment method with different data for each country
The site has the payment method by bank transfer. The problem is that if the customer resides in Brazil, then the bank data is from an account in Brazil, if the customer is from Europe, the bank…
magentoasked Filipe Moraes 8,737 -
3
votes0
answers132
viewsQ: Create custom freight module with settings table
I am creating a module to add a new delivery method in the store. I followed this tutorial (I won’t transcribe it, it’s big and it’s not necessary for the question ). The new method takes into…
-
1
votes1
answer427
viewsQ: "Ontriggerenter2d" function is executed even with "Is Trigger" disabled
I have Gameobject "player" with a box with "Is Trigger" unchecked, IE, is not a Rigger. In the script associated with the player there is the "Ontriggerenter2d": //... void OnTriggerEnter2D…
unity3dasked Filipe Moraes 8,737 -
0
votes1
answer105
viewsA: Problem with buttons when clicked on Angularjs
See if it works: Controller: .controller('ListaSeguidoresUser', function($scope, $http, sessionService) {…
-
5
votes1
answer907
viewsQ: How to recover deleted commit?
Consider the following story: In the local repository I commit A and B. I pushed to the repository on the server. I went back to the local repository and made changes. I removed commit B from the…
gitasked Filipe Moraes 8,737 -
5
votes2
answers5038
viewsA: What is the difference between "/*" and "/**" comments in PHP?
Comments with the second * can be used, for example, to generate documentation. All frameworks I know in PHP use the second * to later generate code documentation. A tool to generate PHP code…
phpanswered Filipe Moraes 8,737 -
1
votes1
answer30
viewsA: The stack property is not removed from the Error object when includeStack equals false
Setting errors in Loopback is done through 2 files: config.json and middleware.json. Adding the stack (detailed error description) to Loopback works as follows: The archive server/config.json: For…
-
3
votes2
answers55
viewsQ: Generate one array according to another without bottlenecks
I have the following object array: [ { id: "1", name: "ProdutoA", categorias: [ {idCat: 1, name: "CategoriaA"}, {idCat: 2, name: "CategoriaB"} ] }, { id: "2", name: "ProdutoB", categorias: [ {idCat:…
javascriptasked Filipe Moraes 8,737 -
1
votes1
answer30
viewsQ: The stack property is not removed from the Error object when includeStack equals false
The stack property is not removed from the Error object when includeStack is equal to false: "final:after": { "loopback#errorHandler": { "params": { "includeStack": false } } } Even with…
-
2
votes1
answer759
viewsA: Can you change the value of a querystring parameter in javascript?
To change the URL via javascript would be like this: var Url = window.location.host; document.location = Url + "?parametro=2"; //muda o valor de "parametro" para 2 However it is not possible to…
-
12
votes2
answers489
viewsQ: How to organize the code to be reused
Consider the following scenario: As you can see, Prefab (red) consists of 3 elements: The sprite (which is the ground, the brown squares and the green tube) The enemy (pink) which is another Prefab…
-
5
votes2
answers887
viewsQ: Calling a string equivalent method
Consider the following class: public class AnimationManager : MonoBehaviour { public GameObject[] Enemies; void OnTriggerEnter2D (Collider2D o) { if (o.tag == "Player") foreach(GameObject Enemy in…
-
1
votes1
answer291
viewsA: Gameobject changes position after play in Unity
Seems to be a bug from version 5.1.2 of Unity: http://answers.unity3d.com/questions/1028760/unity-randomly-resetting-gameobjects-position-to-w.html#comment-1028775 According to the user, it solved…
unity3danswered Filipe Moraes 8,737 -
4
votes1
answer460
viewsQ: Relationship between 3 entities
I have the following tables: +----------+ +----------------------+ +------------+ | Produtos | | ProdutosVsCategorias | | Categorias | +----------+ +----------------------+ +------------+ - ID - ID…
-
5
votes1
answer1337
viewsA: Taking the value of the table with ckeckbox and moving to the controller with Angularjs
Add the argument ng-click to your checkbox: <input type="checkbox" ng-click="PegaContrato(contrato.NUMERO_CONTRATO)"> Then change your function to receive the value: $scope.PegaContrato =…
-
1
votes1
answer2560
viewsA: Update multiple Ids at the same time
If you will update the field with the same value for all id’s, just use the example of Jéferson Bueno (in the comments): update tabela set campo = 'valor' where id in ('id1', 'id2', 'id3') If each…
-
3
votes1
answer108
viewsA: How does a mobile browser work?
Like you said, CSS and a way to make responsive layout. As long as it is programmed for this, the responsive layout automatically fits the user’s device (mobile, desktop, etc...), that is, the…
-
2
votes1
answer21
viewsA: Is there any way that I can change data from different columns but leave it in one variable?
You must be using the mysql_query, but accepts only one query. Try using mysqli::multi_query. An example; <?php $mysqli = new mysqli("localhost", "my_user", "my_password", "world"); /* verifica…
-
1
votes1
answer53
viewsA: AJAX sending html content in half
GET would not work, there are limits to the size of the sent string. Try to change that: var dataString =…
-
1
votes1
answer291
viewsQ: Gameobject changes position after play in Unity
I have the following scenario: The other objects were disabled only to demonstrate the problem. I think that disabling them does not influence the game, right? See what happens when you click on…
unity3dasked Filipe Moraes 8,737 -
2
votes2
answers225
viewsA: CSS does not work on pages generated with Errordocument
Change the links in your css to point to the server root, for example, if this is the case: <link rel="stylesheet" type="text/css" href="css/style.css"> Change and put like this: <link…
-
3
votes1
answer745
viewsQ: How to create the game floor with a random Prefab
To create the floor, I did it this way: I created a gameobject and then assigned an Sprite render, box Colider, rigidbody 2d and a script. I created a Prefab and dragged the gameobject that I set up…
unity3dasked Filipe Moraes 8,737 -
37
votes3
answers39504
viewsQ: How does the git rebase command work?
What happens when you rebase in the following situation: Branch master with 3 commits (A, B and C). After committing C, I created a new branch with the name design. I committed (D) to the design…
gitasked Filipe Moraes 8,737 -
0
votes1
answer260
viewsA: Add Prefab by code and not by inspector
The problem has been solved. Just create a folder with the name "Resources" inside the folder "Assets" and organize its resources, for example, I created the folder "Prefabs" inside the folder…
unity3danswered Filipe Moraes 8,737 -
1
votes1
answer260
viewsQ: Add Prefab by code and not by inspector
Currently my game has only one type of enemy and I want to add other 3 types of enemy. To add a type of enemy I did the following: I created an Empty Object and adding to that object a Collider 2d…
unity3dasked Filipe Moraes 8,737 -
2
votes0
answers700
viewsQ: Set up camera for 2D games for android
I made a test game for gadgets with Android. However when testing on a device, the game was all distorted, squeezed on the screen. On the computer, when testing the game I made a screen width print…
unity3dasked Filipe Moraes 8,737 -
2
votes2
answers83
viewsQ: Display None helps resolve slowness on an onepage site?
The site is onepage and is separated by the respective article and Section. When scrolling, elements that are not needed (article) continue on stage but outside the limits of the browser. Due to the…