How Did Browser Cookies Get Their Name?

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?”

Tutorial: PHP Replace Img Src From String

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.

So it was easy enough to go through, page by page, and update images/assets to make requests over HTTPS instead of HTTP. Things were going along just fine until I ran into a big problem.

The Problem

For this particular client, products of the website are not managed inside of Big Commerce. Instead, they are managed in a third party ERP (Enterprise Resource Planning) software. Which syncs changes with the Big Commerce product pages. So what was found is that the product pages are essentially managed in the ERP. Any products that included images inside of the Product Descriptions included it as HTTP. So here we are…potentially thousands of products, all of which I would be going in an manually editing each product description containing <img src="https://www..."> to <img src="https://www...">. Adding only an to http://.

Solving The Problem By Using PHP to Replace Img Src From A String

Doing some research, I found that the ERP had a hook in which you could introduce custom logic before the ERP would sync the data to Big Commerce. Because each product description is stored as a string of HTML, I figured, I could manipulate the product description directly and add HTTPS to all images inside of the content.

This is the code I used to solve this problem:

<?php

$productDesc = '<a href="https://ua1.us/">Text</a>';
$productDesc .= '<img src="https://ua1.us/media/media.jpg">';
$productDesc .= '<div class="test"></div>';
$productDesc .= '<img src="https://ua1.us/media/media1.jpg">';

preg_match_all('/<img[^>]+>/i', $productDesc, $images);
foreach ($images[0] as $image) {
    $secureImg = str_replace('http://', 'https://', $image);
    $productDesc = str_replace($image, $secureImg, $productDesc);
}
echo $productDesc;

In the code above, what we are doing is using the preg_match_all method in PHP to return all instances of <img> tags as an array of the original image tags. We then loop through each image tag and use the str_replace method to find the http:// and replace with the https://. This returns a string the represents a secured image request. We then repeat the find a replace. This time, we are looking to replace the original image with the secured one.

What Is A Progressive Web App?

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?”

Gifts For Programmers, Software Engineers, Coders, and Developers

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”

Tutorial: How To Convert an Image Into CMYK Using Gimp On Ubuntu

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”

Your Guide To Becoming A Freelance Web Developer and Making an Extra $2000 A Month

If you found this article, most likely you have become interested in the idea of making extra money as a freelance web developer. If you aren’t sure where to start in web development, you may find my article about becoming a web developer helpful. I know for me, 10 years ago I was looking to do just that. My ultimate goal was to own my own business. Web development had become my path achieving those goals. Much like you feel now, I had no clue where to start. I had several questions including even the most basic how do I get paid (do I collect a check, how do I process credit cards, etc). At that time, there were no guides I could follow. I simply had to keep forging ahead through all of my concerns and uncertainties. Becoming the freelance web developer I had envisioned was not an easy path. Mostly because I was going about it blindly. In this article, I will to provide you with that guide I didn’t have. Giving you all the tips and tricks I wish someone would have given me.

Continue reading “Your Guide To Becoming A Freelance Web Developer and Making an Extra $2000 A Month”

How To Become A Web Developer

I remember that first time I ever thought about becoming a web developer. I was stuck in a dead end office job working for a power company and hating every minute of it! You see, I chose a career based on the opportunities that had fallen into my lap. I didn’t choose my career based on my passion. Instead, I spend 7 years in a field just because it was the easiest way for me to get a high paying job out of college. It wasn’t a bad job, however, I just grew to despise the work because it wasn’t my passion. I knew I could do something more with my life. After 7 years of working for this power company, I entered a crossroads because I was let go from the company. This was the first time I ever felt completely lost. I wasn’t sure what I was going to do. Leading up to me being let go, I had dabbled in the idea of possibly switching careers and doing something completely different. I’ve always had several side hobbies and interests and web development was one of them. It was this crossroads in my life where I decided I was going to become a web developer. So, I though to myself, “how do I become a web developer?” Over the next several months and years I would learn just how to do that. I decided I was going to change my entire career and become a web developer.

Continue reading “How To Become A Web Developer”

Functional Programming Not The Next Great Software Programming Paradigm

Since the dawn of the computers, us software developers have been in pursuit of the holy grail of computer programming. We have long sought after the achievement of writing code in a way that is elegant and beautiful in design. Code that inspires tears from our peers who can appreciate the beauty of how you painstakingly woven together such a beautiful piece of art. In fact, at the beginning of each new software development project, as any developer will tell you, it is another opportunity not to screw up the code for this one. We all start off with a statement like “this time…this code will be the most elegant code ever written!” Going into each project with this state of mind, we are often let down by how awful our code turns out as we are thrown challenges like time/budget constraints and missed features. Often, we create tech depts and @todos to go back and fix our shortcomings in code. But never return as there is no time or money to do so.

Continue reading “Functional Programming Not The Next Great Software Programming Paradigm”

The History Behind The Windows Blue Screen Of Death T-Shirt

The Windows Blue Screen of Death (BSoD) has been a running joke in the world of computer enthusiasts since its introduction to Windows 95. To many of us, it seems to be ingrained into the culture as the Blue Screen of Death is as iconic as Windows itself. When we think about the BS0D, we are instantly taken back to those many times we are trying to use our computers, then all of a sudden, we are introduced to the most obnoxiously solid blue screen nature has ever created. This is a brief history of this iconic blue screen and the blue screen of death t-shirt we sell.

Continue reading “The History Behind The Windows Blue Screen Of Death T-Shirt”

Meltdown and Spectre Hacks Explained

It has been a heck of a week for the Intel Company. They have taken a beating over the past several days with regards to an issue exposed in the firmware that powers their processor chipsets. If you haven’t heard about this already, here is the short of it. Intel was contacted by several security research teams. All of which found a type of architectural deficiency that could be exploited to gain access to personal data at the processor level. When boiled down, the research teams involved found a total of two exploits. These two exploits could open up your personal data to applications and processes that do not have permission to do so. The exploits have become to be known as “Spectre” and “Meltdown.” Did I mention that these have been around for the past 20 years? The rest of this article is geared to provide a simple explanation of each of these exploits and how they work.

Continue reading “Meltdown and Spectre Hacks Explained”