Posts by Gustavo Piucco • 2,401 points
55 posts
-
1
votes1
answer288
viewsQ: Run an UPDATE on Mysql only when the number of Rows is 1
How to make a UPDATE only run when the number of Rows returned is 1 in a single query with SQL syntax only using the example below? Example: SELECT count(*) AS rows FROM exemplo WHERE id_usuario =…
-
1
votes0
answers217
viewsQ: Send email via SMTP server or local (Sendmail, Postfix)?
I’m using Amazon SES in my project to send transactional emails. Until then I configured the framework to connect directly via SMTP using my Amazon SES credentials, but I saw that it is not a good…
-
0
votes1
answer1811
viewsQ: Correct way to return the number of results using Codeigniter
I wrote 2 possibilities to return the number of results using Codeigniter, follows: public function get_num_indicados($id_usuario) { $query = $this->db->query("SELECT count(id_patrocinador) as…
-
2
votes3
answers6345
viewsQ: In PHP, what is the best way to print a variable through a function?
Let’s say I have the following function: private function teste() { return 'teste'; } For me to print on the screen, I could just use: echo $this->teste(); But in some cases I see that first…
-
3
votes1
answer259
viewsQ: Testing data integrity using Mysql Transactions
I’m using an Ecommerce system that uses Mysql Transactions to maintain data integrity, for example in the simultaneous purchase of multiple customers of the same product where the system needs to…
-
1
votes1
answer408
viewsQ: Prevent scrolling while Modal Bootstrap is open
How to avoid scrolling while Bootstrap’s Modal Dialog is open? <!-- Modal --> <div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"> <div…
-
1
votes0
answers426
viewsQ: Best way to work with hierarchical data in Mysql for a system with constant register in the hierarchy
I have a table where I store user registration where each user was indicated by another user, so I keep a column ID and a column PARENT_ID. There are 2 ways to work with hierarchy in Mysql, are…
-
10
votes5
answers26385
viewsQ: What is the best practice to know if an Row exists in a SELECT in Mysql?
For example, when we check if a user is already registered in the table, we do not need any data return by query, just check if the number of Rows is greater than 0 (num_rows > 0). Us scripts and…
-
4
votes2
answers174
viewsQ: How to send queries simultaneously to test Transactions efficiency in Mysql?
I have a table Innodb in Mysql where I store a user’s account balance. To give a UPDATE on the balance I use Transactions to prevent two or more queries from trying to give UPDATE simultaneously and…
-
1
votes1
answer1285
viewsQ: Capitalize the first letter of every word in a string with PHP
Function-based ucfirst, but instead of converting only the first letter of the first word, how to do it, using PHP, so that the first letter of all words in a string are capitalized? Thus, following…
phpasked Gustavo Piucco 2,401 -
2
votes1
answer376
viewsQ: Align CSS tree vertically
I’m developing a project where I need to show a family tree. The closest I found was through of this topic. But it’s displaying horizontally. How to change to show vertically? *, *:before, *:after {…
-
10
votes3
answers10155
viewsQ: Uppercase in the first letter of every word in a column in Mysql
How do I get first letter of all words in a specific column be converted to capital letter using Mysql pure? Example: gustavo silva Guilherme souza joão Silva maria souza To: Gustavo Silva Guilherme…
mysqlasked Gustavo Piucco 2,401 -
6
votes1
answer609
viewsQ: Mysql JOIN with or without Foreign key?
What’s the difference between relating 2 tables using and not using a Foreign key? With regard to performance, it is recommended to use Foreign key to make the relationship? In which situation would…
-
2
votes1
answer55
viewsQ: Routes with wildcard (:any) ignoring other controllers
In the archive Routes.php I defined the following route: $route['(:any)'] = 'reference/check/$1'; I need it because the first parameter in the URL after the domain is the username…
-
7
votes1
answer251
viewsQ: Customizing CSRF Protection error messages in Codeigniter
In the CodeIgniter, if I give a Reload F5 on a form page, the error is returned The action you have requested is not allowed. A protection against CSRF. How do I customize the HTML of that error…
-
3
votes1
answer60
viewsQ: How to make a RDS instance via Inbound Rules/Securitygroups receive access from an EC2 instance?
For my RDS instance to receive access only from my EC2 instance via Security Group, i create Mysql permission on Inbound Rules and use the Private IP of the EC2 instance or the CIDR of my Subnet?…
-
1
votes1
answer45
viewsQ: Performance for multiple domains on a single server
I have 2 domains pointed to the same server(Amazon EC2) using the VirtualHost of Apache. This practice interferes in performance and security or what will influence will be basically the number of…
-
2
votes2
answers1489
viewsQ: Difference between two PHP dates in 31, 28 and 29 day months
I have a bonus system that only releases the bonus after 30 days of exact user registration. To compare the current date with the date of the user’s registration so that I get how many days to…
-
2
votes1
answer624
viewsQ: Simple contact form sending email via Amazon SES with PHP
For a simple contact form I intend to use Amazon SES with PHP. Basically PHP will send an email to myself with the email of the user who contacted me to give an answer. Researching, I came across…
-
0
votes0
answers331
viewsQ: How do PHP mail() send via Amazon SES?
How to make the function mail() of PHP use my credentials on Amazon SES to send transactional emails without using lib Phpmailer or having to install and configure the postfix/sendmail for that…
-
0
votes1
answer515
viewsQ: Amazon EC2 Linux Server without postfix sending email localhost
I set up a Linux instance on Amazon EC2, installed the basics to run a PHP application (Apache + PHP + Mysql). What surprised me was when I did a test using the function mail() PHP, I received in my…
-
4
votes1
answer4082
viewsQ: Remove Mysql root after creating another user with all privileges
In this tutorial: https://www.digitalocean.com/community/tutorials/how-to-secure-mysql-and-mariadb-databases-in-a-linux-vps After creating a new user with the privileges I need, they recommend that…
mysqlasked Gustavo Piucco 2,401 -
2
votes2
answers5335
viewsQ: Iframe does not really fit with 100% height
According to the following code, <iframe> does not fit vertically even when setting the attribute height like 100%. <div class="container"> <div class="panel panel-default">…
-
0
votes3
answers1139
viewsA: How to use the preventDefault function in an event click in an iframe?
To solve the problem, if the iframe is from the same domain as the parent page, you need to add the event .ready() to iframe, as it must be fully loaded before applying the event .click(). Being as…
-
2
votes3
answers1139
viewsQ: How to use the preventDefault function in an event click in an iframe?
I manipulate the iframe DOM as follows: (http://api.jquery.com/contents/) $('iframe').contents().find('a').função(); We usually use the preventDefault function like this: $( "a" ).click(function(…
-
2
votes1
answer1190
viewsQ: Access denied edit files via SFTP on Ubuntu after upload via Wordpress
I have an Ubuntu VPS (LAMP) and manage PHP files from the folder www via SFTP. I use Wordpress on my server, with it I upload folders and files and I can also delete them. Via Wordpress when I…
-
3
votes1
answer1018
viewsQ: Assigning a key and a value to an object
I assign the result of an SQL query using PDO (PDO::FETCH_OBJ) a variable, and with this variable I access the values of the query as if it were an object. Example of an array as an object: <?php…
-
4
votes1
answer499
viewsQ: How to adapt APP that uses TCP protocol to 3g connection?
I am developing an APP for Android and used direct TCP connection and also HTTP requests. For the perfect functioning of my application being connected on a 3g network instead of Wifi, I need to…
-
2
votes1
answer405
viewsQ: How to capture errors and exceptions to send to BD with PHP?
How can we capture all errors and exceptions generated at runtime in PHP, sending to the database to later make an organized log page? Currently I redirect all requests to index.php, treating the…
-
3
votes2
answers495
viewsQ: How to use Wordpress Media Upload on multiple buttons?
Follow the HTML code of the button and text field: <div class="meta-container"> <div class="label col-2 left"> <label class="squeeze-label">Imagem Logo:</label> </div>…
-
15
votes3
answers1122
viewsQ: Is it possible to manipulate PHP errors via code?
As you all know, PHP returns runtime syntax errors in the browser, such as fatal errors and exceptions. It is possible to handle these errors via code so that I can save to the database in a table…
-
7
votes4
answers2028
viewsQ: Identifying common snippets in two PHP strings
I need to compare non-standard strings in PHP. I have 2 strings as below: $primeira = 'asdasdasdTESTEasdasdasdasd'; $segunda = 'lkijlikjTESTEilkjik'; How do I dynamically know if the first and…
-
2
votes1
answer136
viewsQ: PHP Mailer or postfix redirecting to gmail?
I have an Ubuntu (LAMP) server and I need to send emails via PHP, but using my gmail account, I don’t want to have an email server of my own. I need to define one of the two ways below to do this:…
-
4
votes1
answer196
viewsQ: What is the right way to use DNS wildcard?
I need my server’s Apache virtualhost to meet the following rule: 1- If it’s.com or www.domain.com, then display the content in /var/www/domain.com/home 2- If for blog.domain.com, then display the…
-
1
votes2
answers1870
viewsQ: How to redirect www.subdominio.dominio.com to http://subdominio.dominio.com?
In order to allow my domain/hosting to use dynamic subdomains, I had to create a DNS wildcard (domain.Sub.com). The problem is that some people usually access using the prefix 'www' before the…
-
0
votes1
answer177
viewsQ: How do I redirect a domain to a subdomain?
I have a site that generates sites in real time, each site created is generated a subdomain to access it, example the functioning of wordpress with., staying that way:…
-
4
votes1
answer4489
viewsQ: Ways to check if there is any screen capture software running with C#
I am developing a software written in C# of exhibition of paid videos and need to create protections to avoid as much as possible that buyers distribute the videos irregularly. For now I need to…
-
18
votes3
answers6637
viewsQ: Run PHP function asynchronously
Using PHP, it is possible to run a function asynchronously? Example: The client(browser) makes a request to the server, in this request PHP executes an asynchronous function that may take a few…
-
8
votes1
answer1660
viewsQ: Pooling Connection management by PDO
We often see in the applications multithreaded using connection to a database, the use of a Connection Polling, where you keep an open "pool" of connections, thus increasing performance so that you…
-
2
votes1
answer77
viewsQ: HTML5 2D game webgl?
I am aware that a lot of the 3D game engines for HTML5 use Webgl technology, but I had a question when it comes to 2D. Some 2D game engines for HTML5 reference the functions gl_xxx, IE, use GPU…
-
17
votes5
answers1347
viewsQ: Singleton or class and statics?
I was researching some projects in .Net and Java and from what I understand of the benefits of Singleton, I found it unnecessary to use it. For example: in a project it was used to instantiate…
pattern-designasked Gustavo Piucco 2,401 -
5
votes1
answer243
viewsQ: Javascript-controlled page layout using REST for dynamic content
I was thinking of a different standard to develop my application via browser. As it is an ERP, I need a quick interface that does not need to download the HTML from the server at all times to print…
-
0
votes1
answer234
viewsQ: C# Mysql Connection thread-safe
I have a server that receives hundreds of asynchronous connections and I need to implement Mysql access from different threads. In fact, how I use the Async Socket Begin/End standard. Net, there is…
-
5
votes2
answers188
viewsQ: C# Difference between Beginaccept and Acceptasync
What is the difference between the two asynchronous forms? Which has better performance handling sockets and handling thousands of connection simultaneously? Example for Beginxxx:…
-
3
votes1
answer5312
viewsQ: C# Socket Refusing Public Connection
I am using the server and client example below to make a TCP connection via internet and in the client returns the following message: Additional information: No connection could be made because the…
-
1
votes1
answer119
viewsQ: C# Manualresetevent
What good is the code below the Manualresetevent connectDone? If I use it, when running the main thread hangs, as I am using this code within the Unity3d(game engine) it hangs the entire process and…
-
7
votes1
answer326
viewsQ: C#. Net blocking or non-blocking?
Do the System.Net.Sockets library, using asynchronous operations such as Beginreceive(), Beginread() and Beginsend() work in blocking or non-blocking ways? If I have 100 connections, it will be 100…
-
1
votes1
answer58
viewsQ: C# Stream.Beginsend
As you can see in the link below, the Streamreceiver method uses the Beginread method to read asynchronously, whereas the Senddata method does not use asynchronous writing, which is the logic to…
-
20
votes3
answers4785
viewsQ: PHP and Mysql, how are thousands of connections processed at the same time?
Using PHP and Mysql as an example, let’s assume that there are 1000 connections (clients) accessing the site and using functions that open connection to Mysql and make queries. How PHP and Mysql…
-
1
votes1
answer7006
viewsQ: How to capture the membership list of a private or secret Facebook group using the GRAPH API?
I have a group on Facebook as open and use the following method to return an array with all members of the group: $group_members = $this->facebook->api("/id_do_grupo/members"); When I change…