Posts by rodrigoum • 1,313 points
31 posts
-
0
votes0
answers15
viewsQ: Plugin to build java objects automatically in Vscode or Intellij
Imagine the following situation: You have a Java class using lombok with @Builder This class has attributes with types referring to another class It is a class with many attributes Is there a plugin…
-
0
votes0
answers23
viewsQ: Bonus for better performance in massively updated records search using a secondary table with Laravel
I am using the Laravel framework in a project and in it there is the model Product. On this system, I also have an API where one of the endpoints gets a date and should return the changed or removed…
-
0
votes0
answers22
viewsQ: Make a square image
I’m trying to perform the face Rop of a photo but I still can’t find a mathematical formula that will help me to make Crop square. The information I have is: Photo Photo faces position (width,…
-
1
votes1
answer557
viewsA: Dynamic routes for Laravel pages
Position your route at the end of the file. Route::get('{page}', 'PagesController@getPage'); In the PageController@getPage, check which page is and if it has a view for example and if you do not…
-
0
votes1
answer2336
viewsQ: Sending a file via CURL using PHP
How to translate the following CURL command to PHP? curl -F file=@/home/user/picture.jpg https://api.dominio.com/pictures I tried a few ways but the ones I found were all sent with some key (e.g.,…
-
1
votes0
answers215
viewsQ: www and without www for a folder and any other subdomain for another folder
I have a domain configured in Nginx as follows: server { listen 80 default_server; listen [::]:80 default_server; server_name .dominio.com.br ~^(www\.)?(?<domain>.+)$; root…
-
0
votes1
answer183
viewsQ: get_role('Administrator') returning null
In a project using wordpress has a plugin that is giving error in a function call get_role. $admin = get_role( 'administrator' ); This returns null and then in $admin->add_cap('regra') of a fatal…
-
1
votes0
answers67
viewsQ: Wrong mimetype when sending image to S3 with Laravel
I’m using Laravel 5.3 and sending images to Amazon S3. I have already put the rules in Bucket so that it is public and I am sending the image as follows:…
-
0
votes2
answers236
viewsA: Regex for different system subdomains or domain
I found the solution with the following regular expression: ^(?!(sistema\.com\.br|app\.sistema\.com\.br|local\.dev|app\.local\.dev)).*$
-
2
votes2
answers236
viewsQ: Regex for different system subdomains or domain
I am developing a system where each user will have their subdomain according to their login but I will also allow them to configure their own domain. As I am developing locally, I have also added…
-
0
votes1
answer104
viewsA: Remove return json relationship from Laravel’s Datatables package
To solve this problem just give a removeColumn in the name of the relationship. In my case on the model Product had the following method to make the relationship: public function enterprise(){…
-
0
votes1
answer104
viewsQ: Remove return json relationship from Laravel’s Datatables package
I have the following code snippet using Standard and the Datatables package $products = Product::with('enterprise') ->select(['id', 'enterprise_id', 'name']) ->whereIn('enterprise_id', [1,…
-
6
votes3
answers604
viewsQ: Working with tags in Mysql
In a system I would like to categorize some users with tags. However there are groups of tags (for example, UF tag group, Interests). I’m trying to do a query where I can answer some questions like:…
-
1
votes2
answers186
viewsQ: How do I display total records in a Manytomany relationship when I use HAVING?
I have the tables below: Articles tags article_tag (pivot table with the columns article_id and tag_id) In the query below I can recover the articles that have the two tags (with id 1 and 3). In the…
-
3
votes1
answer386
viewsQ: Using Elasticsearch to do complex searches and then get the Ids for Mysql query
I’m thinking of the following idea: Use Elasticsearch features to make complex searches instead of making direct queries to Mysql using many where. If I were to use MYSQL I would have to create many…
-
0
votes2
answers3071
viewsQ: www pointing to an ip and any subdomain to another ip
I have an application that works with DNS wildcard. So any subdomain is valid. For example: test.dominio.com.br other domain.com.br Any of the above links go to a particular IP. I happen to want to…
-
23
votes1
answer2914
viewsQ: Indexes in Mysql queries
Using indexes in mysql queries really makes the result come quickly for some large queries or tables. For example in the query below: SELECT * FROM table WHERE status = 1; For a table with 1 million…
-
-1
votes1
answer542
viewsQ: Nginx wildcard DNS, with www, without www and with subdomain
I have an Ngnix server with the following configuration: server { listen 80; server_name .dominio.com.br; root /home/dominio.com.br/public; index index.html index.htm index.php; charset utf-8;…
-
1
votes1
answer1218
viewsQ: Searching for the next record and the previous record using two columns for sorting different tables
I have the following database structure: ___ Table: modules___ id int(10) name varchar(50) position int(10) ___ Table: lessons ___ id int(10) module_id int(10) FK position int(10) name varchar(50)…
-
10
votes2
answers2431
viewsQ: Working with Git on a day-to-day basis with two different computers
I have two workplaces where I work on a project where I use GIT version control. In my studies I’ve learned a few things about GIT using Bitbucket. Let’s think about the following scenario: My…
-
1
votes1
answer312
viewsA: How do I check if it was an INSERT or UPDATE in Cakephp’s save method?
As I needed in the controller I ended up putting in the model the callback afterSave() as follows. class Model extends AppModel { public $sqlType = false; public function afterSave($created){ if…
-
1
votes1
answer312
viewsQ: How do I check if it was an INSERT or UPDATE in Cakephp’s save method?
Hello, I have a script that gets an ID by a POST notification along with other data. It turns out that the ID is from a transaction created on another system (Ids are not generated by…
-
2
votes1
answer65
viewsA: Using a Component inside a Shell Console in Cakephp
I found the solution here Before your class Shell add App::uses('ComponentCollection', 'Controller'); App::uses('MeuComponentComponent', 'Controller/Component'); class WorkerShell extends AppShell {…
-
2
votes1
answer65
viewsQ: Using a Component inside a Shell Console in Cakephp
Can anyone tell me how to use a Component I created in cakephp within a cake console script? I tried using App::import but could not. For example in a normal controller I can use my Component as…
-
1
votes1
answer853
viewsQ: Remove access to a particular feature in Wordpress
I am trying to limit access in a finished wordpress feature for users in the administrative area. I’ve found several ways to remove the "Posts" menu from the panel menu but I haven’t found a…
-
1
votes1
answer365
viewsA: Cakephp loses SESSION after a redirect
How nice it is to explain your question. I just got an idea as soon as I asked the question. Facebook SDK tries to create a session_id. Since in Cakephp’s structure it is probably called first, it…
-
3
votes1
answer365
viewsQ: Cakephp loses SESSION after a redirect
I’m doing an integration with Facebook Login. When the user clicks to log in using Facebook and accepts the application he is redirected to a method that creates a SESSION and redirects. The problem…
-
10
votes3
answers269
viewsQ: How to prevent a method from printing data when calling a third-party API?
I’m using an API and in some cases a feature of it prints on the screen when there are errors (api errors, not PHP). I happen to call this API via AJAX and it breaks my code since the request ends…
-
36
votes8
answers7830
viewsQ: Is giving a "SELECT" before an "INSERT" a safe way of not having duplicate records?
I have a table with a column codigo. I cannot set as primary key. In a system it receives many notifications before it checks with a SELECT to see if that code already exists in the table. If it…
-
5
votes3
answers837
viewsA: Disable Auto Redirect after logging into Cakephp 2.4
With the tips I did the following and what I wanted was solved: In the AppController.php added an array with the links I want to disable auto redirect. public $cfg = array(…
-
8
votes3
answers837
viewsQ: Disable Auto Redirect after logging into Cakephp 2.4
I’m using Cakephp’s Auth 2.4 and if I try to access a link that needs login it redirects to the login form. For example: I try to access: /projects/Edit/34 without being logged in. Cakephp then…