Posts by Marcelo Aymone • 3,366 points
97 posts
-
1
votes1
answer132
viewsA: Server cache
For search word indexing cache it is interesting to use Elastic Search or Solar. They allow generating a key indexing that works as a cache, so searches are made on large amounts of textual data.…
-
1
votes1
answer312
viewsA: Lock on the mongoDB
It gives a "lock" only on the document of a collection being saved or edited. When there are many read/write operations, this operation takes place in memory, and "read" can be done even before…
mongodbanswered Marcelo Aymone 3,366 -
2
votes1
answer302
viewsA: When to use Exceptions in PHP?
I usually use whenever a data input error happens, or when something is expected to exist and this something does not exist, whenever your logic can be broken, then you make an exception. More…
-
2
votes1
answer702
viewsA: Table/Field for product price in Magento
Magento uses a data structure called EAV, Entity attribute value or entity attribute value. That is, you have an entity, which has an attribute that has a value. To find the price attribute, you…
-
0
votes1
answer50
viewsA: Find where heavy query is generated
It can be in several places but, by default, would be in the model with a name similar to the table, usually in the singular. A common call that could generate this sql would be:…
-
0
votes1
answer89
viewsQ: Insert multiple objects with Dbal Doctrine
I am using Silex in conjunction with Doctrine dbal 2.5. How do I insert multiple objects into the bank with dbal Doctrine? Reading the documentation I didn’t find anything that made it possible,…
-
1
votes1
answer322
viewsQ: Nesting keys of an array in a Javascript object
How to create a nested javascript object from a literal array? I have the following array: var x = ['a','b','c']; From the array 'x' I would like to generate the following object: var y =…
-
2
votes1
answer24
viewsQ: Contraindications in Iife’s
Is there any contraindication using IIFE’s within the context of an object? For example, in the properties begin and created i do the auto run function to set the properties at the time of variable…
-
0
votes2
answers543
viewsA: Zoom button and Street View do not appear in Modal Boostrap
1 - To work as in the examples, you need to load libraries or via CDN’s: code.jquery.com/jquery-1.10.1.js //jquery http://maps.google.com/maps/api/js?sensor=false //google maps…
-
6
votes1
answer1795
viewsA: PDO mysql php accentuation problem
Try applying the Character set directly to the DB call like this: $db = new db("mysql:host=127.0.0.1;port=8889;dbname=mydb", charset=UTF8, "dbuser", "dbpasswd"); $db->exec("SET CHARACTER SET…
-
2
votes1
answer467
viewsA: Dynamic Directives with Angularjs
I was able to solve it this way: //View aonde é renderizado os elementos: <fieldset> <section ng-repeat="field in preview.model.Field"> <field-builder…
-
1
votes1
answer467
viewsQ: Dynamic Directives with Angularjs
I’m building an application that needs to render a dynamic form. The form data comes from a json, and in it, I have the configuration of the fields. Following example: { "Fields": [ { "title":…
-
8
votes1
answer620
viewsQ: How to center a binary tree?
I need to correctly center this binary tree model. jQuery or JavaScript can be used. I’ll need to generate the code with PHP, then you have to have a certain logic in html. Another detail is that…
-
0
votes1
answer95
viewsQ: Prevent elements from breaking down within an overflow
How to leave a div with Divs daughters with overflow, without breaking the content? I’m setting up a binary tree viewer, and I need the Ivs to never break the line. In the code I’m working on, by…
-
3
votes1
answer2412
viewsQ: Select recursive in mysql data hierarchy
How to build a mysql function or recursive query to bring the last descending of a specific side of a binary tree? Satisfying a binary tree, each node can have only two branches, one left and one…
-
1
votes0
answers430
viewsQ: Render Iframe google Maps with Angularjs
I’m building a directive to render a google maps iframe inside my app. And I managed to do it this way: <google-iframe location="item.Location"></google-iframe> js directive. function…
-
5
votes2
answers5775
viewsQ: Dynamic array in Javascript
I’m trying to generate a array made up of others arrays dynamically. For example: check = function (title, filter) { if (checked.indexOf(title) !== -1) { checked[title].push(filter); } else {…
-
0
votes1
answer57
viewsQ: How to use Named Parameters in Angularjs $http?
Is there any way to use named parameters in the method $http angular? With ngResource it is possible to do this: var User = $resource('/path/to/user/:id'); $scope.user = User.get({id: 1}, function()…
-
6
votes1
answer34
viewsQ: Doubt with Revealing Pattern
It is possible to do this with Revealing Pattern? the console always returns Undefined function FlashService() { return{ get: get }; var _abc = 'teste'; function get() { console.log(_abc); return…
javascriptasked Marcelo Aymone 3,366 -
2
votes2
answers1523
viewsQ: Group keys from an array
How to group keys and identical values of an array? There may be N arrays inside the array, you cannot add equal keys. For example: [attributes] => Array ( [0] => Array ( [title] => Cor…
-
16
votes3
answers1755
viewsA: How does the Flux architecture work?
Flux is an architecture used to build client-side web applications, focusing on reusing code through component encapsulation, complementing the combinable components created with Reactjs, using a…
-
4
votes1
answer1002
viewsQ: Distribute content evenly in tables with php
I set up a php algorithm for popular 4 html tables in a uniform way. However, I am finding my code somewhat dirty and would like to check if there is a cleaner way to create this code. What it does:…
phpasked Marcelo Aymone 3,366 -
0
votes2
answers547
viewsA: PHP delete values from the form if successful
Dear Miguel, I think it is relevant to eliminate the logic of Html, separating into different things: <?php $imgName = isset($_POST['imgName']) ? $_POST['imgName'] : ""; $imgLink =…
-
7
votes1
answer2687
viewsA: What is simple association in object orientation?
In fact, all relationships are associations, what will differentiate one from the other is the participation of objects in the context of the application. For example: The fact that the wheel…
oopanswered Marcelo Aymone 3,366 -
1
votes1
answer359
viewsA: How to get the last query executed by Cakephp?
Try it like this: $data = $this->Ticket->find('all', array('conditions' => $conditions, 'order' => array('Ticket.id' => 'DESC'))); $this->query =…
-
4
votes3
answers1119
viewsA: PHP is not displaying array output
Use the json_decode with the second argument set in true: $d = json_decode($output, true); An associative array will return to you and you can use it.…
-
2
votes2
answers451
viewsA: How to avoid duplicate emails in the database?
Just set 2 rules in the email field. Inside your model, which has this field, is this way: public $validate = array( // Aqui vai o nome do campo 'email' => array( // O nome que você quiser dar na…
-
4
votes1
answer1275
viewsA: Restricting data access with REST
The answer to your question is: Yes, there are many ways to do this, from the most common with HTTP authentication or even generating certificates or tokens. Authentication/HTTP basic authorization:…
-
3
votes3
answers176
viewsQ: Syntactic Sugar in PHP
The foreach would be an implementation of Syntactic Sugar in PHP? foreach($array as $key=>$values) { //Faz algo com as chaves e valores. }
-
4
votes2
answers613
viewsA: Twitter bootstrap, button on panel title
Try to use a smaller button, what occurs is that the margins of the button are bursting the div of header of panel. <button class="btn btn-xs">Criar tópico</button> It turns out that the…
-
6
votes6
answers14461
viewsA: Convert month number to name
I know it’s been a while since you’ve been asked, and you have solutions based on locales, but as a second option, I’d like to put this approach as an example of a solution without logical testing.…
-
7
votes3
answers339
viewsA: Why is ':' used in queries?
This syntax is used by PDO to attach parameters to prepared statements through function bindParam(). It is very useful to implement security when using information coming from forms, or even by the…
-
1
votes4
answers912
viewsQ: Behavior of the function preg_match() for short names
I set up a function that takes a full name with X names and surnames and returns only the first and last names. If you have a connective (from, from, from, dos, etc.) before the last surname, it…
-
2
votes3
answers301
viewsQ: Css selector syntax to delete <td> element with jQuery
Some way to use jquery and selectors in a way similar to this? $("#tabela td").empty(); I need to delete only the lines tr containing td of a table like this, but not the rows tr which contain…
-
1
votes1
answer2034
viewsQ: Check if a user belongs to an LDAP+PHP group
I wonder if it is possible to check directly in AD, if a user belongs to a certain group, to validate it as admin or not. I’m doing it this way: /* * $this->status status da conexão *…
-
1
votes1
answer121
viewsA: Show data if it exists and Date Show Age
Try it like this: echo' <div class="tabla7"> <p><div class="titulo7">Nome</div><div class="titulo7">Data Nascimento</div><div…
phpanswered Marcelo Aymone 3,366 -
5
votes3
answers15283
viewsA: How to go to a part of a text on the same page by clicking on a link above
Is called link link Example with div: <div id="tips">Useful Tips Section</div> <!-- crie um ID para a div ou span --> Or with another link: <div id="tips">Useful Tips…
xhtmlanswered Marcelo Aymone 3,366 -
2
votes1
answer81
viewsQ: Doubt with dynamic layouts
I usually mount the views of the php applications I use with conditional operators. For example, not logged in user, Seto an initial variable in the session: $logado = FALSE; If the user is logged…
-
0
votes1
answer563
viewsQ: Doubt about the LDAP + php connection
I am creating a class for LDAP authentication to integrate with intranet apps, as protocol generator, etc. 1- After effecting the ldap_bind() and connect the user, is there any persistence of this…
-
1
votes1
answer123
viewsA: Bootstrap usage in legacy layout without Grid system adoption
Yes, quietly, in fact, you can customize the bootstrap to use only what you need, check this link: http://getbootstrap.com/customize/ Another interesting thing, when downloading the boostrap…
-
4
votes2
answers1134
viewsQ: Is there a performance gain when using View’s in SQL?
As View's are virtual tables resulting from consultations SQL, as in the example: CREATE VIEW view_name AS SELECT column_name(s) FROM table_name WHERE condition From this, we can update or delete a…
-
2
votes2
answers476
viewsQ: Doubt with method visibility and property in PHP
What is the purpose of declaring functions initiated with underline? Eventually I wonder why this. For example: protected function _exemplo() {} It is not enough to declare so? protected function…
-
3
votes4
answers129
viewsA: Sort H tags within a page
Yes, it is important to use only one tag <h1>, because this tag indicates the main subject addressed on your page, the main focus of the page in question. The other Heading tags as…
-
16
votes1
answer4185
viewsQ: What is the difference between the Data Mapper and Active Record Patterns?
I would like to know the main differences between these two Patterns design. I have this question because when I heard the news about Cakephp 3.0 I saw the change of the Pattern design used by the…
-
5
votes2
answers773
viewsA: Is it possible to use two frameworks in php?
Differences between frameworks are not just personal not imprint, just access this link below and see that there are yes, technical differences between them, differences, which can bring more…
-
1
votes1
answer45
viewsA: preg_replace_callback does not return values
Example of the function (Since the user has not posted the whole context of the question): public function replace_variables( $subject, $otherVars ) { $linkPatterns = array( '/(<a…
-
12
votes4
answers955
viewsA: How does Current function work?
Because there is no need to pass it by reference, the only thing this function does, is to return the contents of the current pointer of the array, and this will not modify the array, it is not…
-
4
votes1
answer365
viewsQ: What is the benefit and in what cases use closures in PHP?
Ex.: Why use a closure for this function: We could do the same thing without a closure, but why use this class? public function getTotal($tax) { $total = 0.00; $callback = function ($quantity,…
-
2
votes1
answer939
viewsA: Update in the Marker Coordinates database
I’ll just give you the way of the thing, the question is too wide. To make markers draggable: Source:https://developers.google.com/maps/documentation/javascript/examples/directions-draggable var…
-
9
votes1
answer15796
viewsA: Mapping and getting mileage between two points
Using the API V3 from google maps, you can use this example if you only need a north. Javascript + Html <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head>…