I was on a recent PHP project and found the need to get the domain name of the app I was building for. When I did some research I found that the main method I was using could become unreliable based on how a server is configured.
As it turns out
$_SERVER['HTTP_HOST'] might not be set. Since I’m building an application that has the requirement to run on many different servers, I had to make sure that I had a fallback if
$_SERVER['HTTP_HOST'] was not set.
To solve for this problem, we need to provide a fallback method. So the solution for the application I’m building ended up turning out like this.
$requestDomain = ($_SERVER['HTTP_HOST'])
There are many commands in MySQL that web developers will use on a frequent basis. However, they do not use them often enough to have to commit them to memory. This is a list of MySQL commands I find myself using quite often.
Continue reading “MySQL Cheat Sheet: Helpful MySQL Commands For Handling Databases, Users, and Privileges”
Recently, I came across an issue when installing
mysql-server on Ubuntu 18.04. What I found is that after I installed
mysql-server using my standard approach of
sudo apt install mysql-server, and after running
mysql_secure_installation, my root user was denied access to MySql when trying to access with
mysql -u root -p. I would always get the following error:
ERROR 1698 (28000): Access denied for user 'root'@'localhost'
Continue reading “Tutorial – After Installing MySQL on Ubutnu 18.04, Fix “Access denied for user ‘root’@’localhost’” Error”
As a web developer, it can become frustrating sometimes to deal with 301 redirects when developing website. For example, when using localhost, some of your projects might force SSL. In most cases, when forcing SSL, web servers will send a 301 response along with the redirect headers to point the browser back to https:// requests.
Continue reading “Tutorial: Remove 301 Redirect from Browser Cache”
I was recently working on a project and found that I had to merge two very complex objects using PHP. I went to search for a solution and of course found
array_merge_recursively(). So naturally, I thought I would start out by converting my objects into arrays and using array_merge_recursively.
Continue reading “Tutorial: How to Recursively Merge Two Objects In PHP”
One thing software developers do very well is name things. Typically, after an engineer gets done developing a piece of software or a concept, they look around for a name. Quite literally, they look around at objects that are sitting near them and adopt that as the name for their new widget. If you’ve been developing anything recently, you will see many funny names. For example, I had no clue this actually existed, but I searched for “bananajs” and guess what!? Github hosts a project called BananaJS. You get my point? We know that there are many funny names for libraries, but I’ve always been intrigued by that text file the browser uses to store data about your session, the Browser Cookie! How did browser cookies get their name?
Continue reading “How Did Browser Cookies Get Their Name?”
Recently, I had to figure out how to change <img> tag src using only PHP. I had to change the request from HTTP to HTTPS. I was given the task to convert a site over to HTTPS. The website is managed on Big Commerce. As we already know, when you are changing a site over to HTTPS, you have to hunt down all of the images/assets of the site and convert them to request HTTPS as well. Otherwise, you will end up with the dreaded, mixed-content error and your site is deemed as unsecured by the browser you are visiting your site from.
Continue reading “Tutorial: PHP Replace Img Src From String”
It was more than 10 years ago that the iPhone was first revealed. I’ll never forget learning about the ability to create apps for the iPhone while watching the 2007 WWDC Keynote. Steve Jobs talked at length about how developers would be able to contribute to the iPhone ecosphere with apps they created. Never once, however, was it mentioned that apps were to exist natively on the iPhone. Instead, Steve Jobs talked about how apps could be created for Safari (the mobile web browser bundled with the iPhone). Since then, native apps have taken over the mobile ecosystem. Web Apps never really took off like they were intended. Now, we are starting to see a decline in developers cranking out native apps. Instead developers are looking for alternative solutions to building great mobile experiences. Native apps are slowly being replaced by another type of web app, the Progressive Web App (PWA). What is a Progressive Web App you ask? Keep reading, as the intention of this article is to get you up to speed on the latest technology developers are looking at to create mobile apps.
Continue reading “What Is A Progressive Web App?”
It’s that time of year again! You need to find a gift for that programmer, software engineer, or coder in your life! You might be looking for those perfect gadgets for computer programmers, the best gifts for coders, or even funny gifts for software engineers. You’ve found the right spot! I’ve put together a collection of unique gifts for programmers that I’m sure will help you find the right gift.
Continue reading “Gifts For Programmers, Software Engineers, Coders, and Developers”
Gimp is a powerful image manipulation tool. It is very similar to Photoshop! If you have been using Gimp for any amount of time, you will already know its power. It an do most things that Photoshop is capable of. Compared to Photoshop, however, Gimp lacks some features that makes life so easy when you are creating beautiful images. For example, Gimp lacks native support for converting a standard RGB images to CMYK. It becomes more of a process with Gimp! In this tutorial, I will show you how to convert standard RGB images to CMYK.
Continue reading “Tutorial: How To Convert an Image Into CMYK Using Gimp On Ubuntu”