Categories
Create A Blog Software Engineering

SUCCESS! Old WordPress Articles Are on the New WordPress Blog!

Just as the title describes I managed to import all of the old WordPress articles in to the new WordPress blog! This is great news because Google had been annoying me with emails about how I was missing the articles. They must have been really popular!

How Did I Do It ???

All I had from the previous blog was a MySQL dump of the database. This made it a little difficult because I couldn’t see a visual reference of the old blog. I ended up importing the old database dump in to a new database on the same MySQL database server.

After that I wrote a custom PHP script which connected to the old database (made from the dump) that then selected any published posts and looped through to gather their categories and tags then inserted them in to the new blog’s database. I think it went pretty well!

If I get some requests for it I can post my PHP script on Github but I think there are probably more useful tools out there for backing up and exporting a WordPress blog it was just quick and easy for me to make a script. I highly recommend using the explicit Export and Import feature already built in to WordPress

Categories
Create A Blog

WordPress Themes – Testing New Themes & Pardon the Mess

As part of moving this blog and setting it up again I’m testing various WordPress themes. Please pardon the mess and the visual intensity as I adjust a few things.

Review of PopularFX Website Templates WordPress Themes

I initially started with the base selection offered by default to a new Bluehost hosting account and selected a very nice WordPress theme and from the “PopularFX Website Templates” plugin.

The PopularFX Website Templates does have some very nice WordPress themes and a lot of them are structured to fit specific small business or small website verticals and that could be really helpful for a lot of people. I also enjoyed how those themes used some really nice improvements on the content blocks for things like the WordPress index page.

The WordPress theme I chose also prompted me to download some temporary stock photos to fill out the design and it has some warnings about the licensing of the images it wanted to download. I didn’t want those images so I chose not to download the stock photos and images. The theme I chose looked *really* nice in the sample but ended up being very plain when I tested it and applied it to my website. That was a little disappointing that it did not look as good with fake stock graphics.

I also got in to the Theme Files editor for that particular PopularFX Website Template WordPress theme and I found that the PopularFX Website Templates theme files themselves were laid out in a very straightforward and clear file structure. The files themselves had simple naming convections and followed most of the best practices and common file locations. The more complex PHP functions and methods, including things like content tags, were easily found and edited and the code itself was concise.

I Didn’t Try Pagelayer

The new Bluehost WordPress hosting came bundled with a plugin called “Pagelayer” which I have not yet tried 🙁 Sorry Pagelayer. As a software engineer I prefer a more hands on approach to complex layouts for blog articles and pages so that I can control the HTML, Javascript, and CSS. I disabled the Pagelayer plugin.

I eventually wanted a more simple WordPress theme and started activating and deactivating the themes.

Activating, Deactivating, Changing or Switching WordPress Themes

It is very easy to change or switch themes in WordPress, go to “Appearance” and then click on “Themes”. Hover over any theme and click “Activate”.

Default WordPress Theme Review

I tried a number of different themes looking for something that would easily & tastefully fit a few of the existing WordPress posts I already have. I tried all of the default WordPress themes from “Twenty Fifteen” all the way up to “Twenty Twenty Three”

As of the time of writing this article I disabled PopularFX Website Templates and I have currently chosen the default WordPress theme of “Twenty Twenty” because I like the look of the <hr> and I also like how the <code> tag style looks inline. I am not a fan of how that style looks when broken up in blocks. The previous iteration of this blog used WordPress 2015 (yikes!) so I also have had good experience with the longevity of the built-in WordPress themes. Once I pick a permanent WordPress theme for this blog I probably will not want to change it for many years.

WordPress Themes and Better Styling of Code Blocks

I will probably be looking for a better CSS solution for WordPress themes with multi-line code blocks.

The Internet’s Original Under Construction GIF

If you are looking for the original “Under Construction” GIF from the early days of the Internet in the 1990’s here it is. The Original Under Construction GIF From the early Internet in the (the GIF of a person shoveling on a yellow sign):

Original Under Construction GIF, Animated Image ofRoad Sign of Person Shoveling

Categories
Software Engineering

Apache + Ubuntu + CORS + Multiple Subdomains + PHP Session Cookies + XHR Credentials

Overview:

I recently had to do a little hunting around for an issue related to everything you see in the title.

It was frustrating because I wanted to allow * domains to be able to send requests and the Stack Overflow comments are mostly about IIS servers or the ones with Apache directives as examples don’t seem to work or don’t handle full wildcard.

I should mention that allowing full wildcard Access-Control-Allow-Origin with XHR credentials enabled can be a security risk.

Here’s how to get a CORS request working with Ubuntu Apache and PHP across multiple subdomains and have the PHP session ID cookie send correctly on every request and how to handle some of the errors you may encounter.

Situation:

I was making an AJAX request from one subdomain (https://subdomain1.example.com) to a different subdomain on the same root domain (https://subdomain2.example.com).

I had already called a PHP session_start(); for the user on a page on the subdomain I was making the request to. This means the user has an active PHP $_SESSION on https://subdomain2.example.com.

I had set the PHP $_SESSION to use cookies at the root domain.

I had Header set Access-Control-Allow-Origin "*" in my .htaccess file.

I was using the following setup for calling session_start() on top of the PHP defaults. Be careful setting cookies at your root domain, they will be sent along with *all* futures requests to *all* subdomains:

ini_set('session.use_cookies', 'On');
ini_set('session.use_trans_sid', 'Off');
ini_set('session.cookie_domain', '.example.com');
session_set_cookie_params(0, '/', '.example.com');
session_name('example_session');
session_start();


Expected:

When making an AJAX CORS request the cookies, (and therefore the PHP $_SESSION session_id() being passed as a cookie) the should be sent along correctly with the HTTP request.

Actual:

All cookies, including the PHP $_SESSION session_id(), are not being passed along as part of the request.


Errors:

You may see this situation manifest as number of errors in your Javascript Developer Console.


Error:  The 'Access-Control-Allow-Origin' header contains multiple values , but only one is allowed.

Reason: You are trying to set more than 1 value for Access-Control-Allow-Origin

Solution: Use a series of Apache statements in your .htaccess file that dynamically assigns the Access-Control-Allow-Origin to whatever the incoming request is. (If you would like to use wildcard domains please see the solution further down the page for wildcards.)

Code:

<IfModule mod_headers.c>
SetEnvIf Origin ^(https?://.+\.example\.com(?::\d{1,5})?)$ CORS_ALLOW_ORIGIN=$1

Header append Access-Control-Allow-Origin %{CORS_ALLOW_ORIGIN}e env=CORS_ALLOW_ORIGIN

Header merge Vary "Origin"
</IfModule mod_headers.c>


Error:  The 'Access-Control-Allow-Origin' header has a value that is not equal to the supplied origin.

Reason: You are already setting a Access-Control-Allow-Origin or you are setting it incorrectly. You may be making multiple Header set Access-Control-Allow-Origin statements (because there can only be one domain set the last one overwrites any previous set commands.)

Solution: Use a series of Apache statements in your .htaccess file that dynamically assigns the Access-Control-Allow-Origin to whatever the incoming request is. (If you would like to use wildcard domains please see the solution further down the page for wildcards.)

Code:

<IfModule mod_headers.c>
SetEnvIf Origin ^(https?://.+\.example\.com(?::\d{1,5})?)$ CORS_ALLOW_ORIGIN=$1

Header append Access-Control-Allow-Origin %{CORS_ALLOW_ORIGIN}e env=CORS_ALLOW_ORIGIN

Header merge Vary "Origin"
</IfModule mod_headers.c>


Error:  The value of the 'Access-Control-Allow-Origin' header in the response must not be the wildcard '*' when the request's credentials mode is 'include'. The credentials mode of requests initiated by the XMLHttpRequest is controlled by the withCredentials attribute.

Reason: You are trying to set "*" for your Access-Control-Allow-Origin but when you are using credentials you can only set it to 1 specific subdomain.

Solution: If you want to use a full wildcard style entry to accept requests from any origin and let them send in cookies then use a series of Apache statements in your .htaccess file that dynamically assigns the Access-Control-Allow-Origin to whatever the incoming request origin is. The first SetEnv handles the root domain wildcard and the second SetEnv handles the wildcard subdomains.

Code:

<IfModule mod_headers.c>
SetEnvIf Origin ^(https?://.+\..+(?::\d{1,5})?)$ CORS_ALLOW_ORIGIN=$1
SetEnvIf Origin ^(https?://.+\..+\..+(?::\d{1,5})?)$ CORS_ALLOW_ORIGIN=$1

Header append Access-Control-Allow-Origin %{CORS_ALLOW_ORIGIN}e env=CORS_ALLOW_ORIGIN

Header merge Vary "Origin"
</IfModule mod_headers.c>


Error:  The value of the 'Access-Control-Allow-Credentials' header in the response is '' which must be 'true' when the request's credentials mode is 'include'. The credentials mode of requests initiated by the XMLHttpRequest is controlled by the withCredentials attribute.

Reason: You are trying to send along the cookies as part of the AJAX request but your server is not current accepting the incoming cookies from the origin domain using Access-Control-Allow-Credentials

Solution: Use an Apache statement in your .htaccess file to always accept incoming credentials (aka cookies)

Code:

<IfModule mod_headers.c>
Header always set Access-Control-Allow-Credentials true
</IfModule mod_headers.c>


Error:  The PHP $_SESSION cookie is not being passed correctly to the server. It is not available in $_COOKIE and new calls to session_start() create a session with a new ID.

Reason: You are not correctly sending along the cookies with the AJAX request.

Solution: Use jquery AJAX and set the xhrFields to have withCredentials set to true

Code:

$.ajax({
xhrFields: {
withCredentials: true
}
});

Categories
Create A Blog

Hello World 2: The Continuation

This is a reboot of the old blog at this URL, but the old blog posts haven’t been transferred over yet!

The old blog was very old & it was time to move it to a newer location to make the hosting and use of WordPress a little less cumbersome.

If you are looking for some of the programming help articles, or any of the other help articles from this site’s old blog, please be patient! Hopefully the old posts can be revived at the new location shortly.

Categories
Create A Blog

Hello world!

Welcome to WordPress. This is your first post. Edit or delete it, then start writing!

DamnDanielRemix.com – Back At It Again With Them Random Websites, Damn Daniel Remix

It is Impossible to Resist the Damn Daniel Remix so Try DamnDanielRemix.com

Listen to the Damn Daniel Remix. I don’t know why I’m obsessed with getting in on the weird Internet shit that goes down but I decided to to an entire .com about the #DamnDanielRemix phenomenon. I went around collecting some of the best Damn Daniel Remixes around and put the all on one site at DamnDanielRemix.com. There’s the original amazing club banger I looped while I was making the site and then some other versions as well: rap, trap, dubstep, and tons of genres.

Why Damn Daniel? What is Damn Daniel

Seriously? If you don’t know about Damn Daniel you don’t know anything about the Internet. Its pretty much going down as one of the most major viral sensations on the Internet in 2016. You can see the original on the site. For some reason I’ve been saying it endlessly, I’ve been playing the remix endlessly, and I wore white Vans in the skateboard marathon last so young Daniel really speaks to me. I was obsessed, now I’m over it, but I had to make the Damn Daniel Remix website first to quench my thirst. Stay thirsty my friends.

Did You Not Click Yet? Find the Best Damn Daniel Remix at DamnDanielRemix.com #DamnDaniel!

The Domain Tool Onslaught Continues With a Typo Generator!

Typo Generators Are Fun Algorithms and Good Times

Oh yeah, its true, Domain Check just launched a brand new Typo Generator on their site to make sure you can get every single misspelling and typo error of any word you could possible think of… as a domain. It won’t be long before this Typo Generator is in the WordPress plugin as well and will be able to do domain checks and typo domain name lookups. Its common to generate typo domain name for big brands and typo tools are a fun game of string manipulation and algorithms. In the end the results are kinda fun to look at but when you realized the number of possible typos for longer words you can see its pretty expensive for brands with longer domains.

Want to Get Technical With Typographical Errors?

Because that’s what going on here and over at the Domain Check Typo Generator. Using the Damerau–Levenshtein distance, the computer science algorithm that basically says you have fat fingers, this set of typos is over 80% of all known typos. Anything outside of this boundary of typos are unusual or edge cases. Even Google search doesn’t do a good job covering those and will often prompt for unusual things or other suggestions. Speaking of Google suggestions on typos, the Google suggestions which relies heavily on the Damerau–Levenshtein distance to prompt correct answers for misspelled search results likely had a major impact on traffic to sites relying on organic typos. Whomp whomp. In fact the real place this method of typo detection is proving itself useful is in form field validation. Detecting typos in email addresses and domain names on sign up forms, or correcting for common misspellings on known data like states and countries.

Typos have funny effects. If you like puns and Dad jokes then the ultimate typo is for you: there is a technical term for when a typo turns the original word in to another word. That’s called an atomic typo!!! One of the reasons typos are so common has only recently been brought to light through Internet urban legends, widely shared email chains, and now virally shared social media posts. This is the curious case of Typoglycemia: you’re able to correctly read a sentence composed of nothing but typographical errors just fine as long as all the letters for each word are there. Typoglycemia is essentially autocorrect in the human mind.

I cdn’uolt blveiee taht I cluod aulaclty uesdnatnrd waht I was rdanieg

Atomic typos will be seen by the human eye and mind because they are a complete word. Science has no word for when the typo makes a word nonsensical but creates a new, sometimes unintentional or vulgar word within the outer or nonsensical word. We’re calling them subatomic typos. When a typo creates a word within another word the human mind sees the word in the middle, that is a subatomic typo. While there is no scientific study on subatomic typos yet, they do occur. When a typo generates a new word in a word it causes the human eye and mind to focus on the recognized word within the middle of the word. Instead of reading the whole word via typoglycemia the inner word is recognized because the pattern of a correctly spelled word trumps the outer typoglycemic word. The inner word will always be shorter in character length than the outer word, making it more easily recognized than a longer word. This effect is also noticeable without typos when either compounding words or truncating two words and combining them. Subatomic typos are only slight less atomic, but no less destructive, than their atomic counteparts.

Typos Can Be Treacherous and Teacherous – Tips for How Brands and Businesses Can Use Typos And Avoid Typos During Marketing and Advertising

Typos can be incredibly embarrassing for brands and businesses. Typos in brand messaging, advertisements, communication, signage, or social media make the brand appear inattentive, non-domestic, unprofessional, under qualified, and/or of inferior quality. Typos can break the character of a brand during customer support sessions. Typos, misspellings, and incorrect grammar are some of the most notorious pieces of troll bait. Typos in online media or social networks where users can respond will invite negative messaging, (“trolling”, “trolls”, and “cyberbullying”), regardless of content or tone. Other customers and users will inevitably see these negative comments and will internalize that negativity with the brand.

Brand names, domain names, product names, and naming in general is one place where typos can really help or hurt a business. As discussed above with Domain Check Typo Generator you can get all of your brand’s typos, misspellings, and typo domain names. Covering those bases can get customers in the door instead of letting them hit a wall. Brands with common typo URLs, either in the domain name or in a subdomain that point to the correct place can be seen as helpful, competent, useful, caring, and/or providing a personalized experience. It is common to create new startup or product names by combining shortened versions of words so be aware of common atomic typos and subatomic typos during creative naming and brand identity brainstorming sessions. Watch your incoming search keywords, internal site search keywords, customer support tickets, and incoming client and customer emails to identify common misspellings, typos, or general misnomers being made with your products and brand. Autocorrect and suggested searches on form fields for things like typoed URLs, typoed email, and typoed search will improve conversion.

With the increase in brand communication to customers typos are slightly more acceptable than they were; a single typo will not ruin your brand’s entire image. On faster and ephemeral social media platforms typos are routinely ignored. Celebrities often tweet typos, though celebrities with clean, intelligent, perfectionist, pious and/or authoritative public personas, characters, or active roles may actively avoid typos in communications. Some characters embrace typos to convey a particular persona. As the title of this section suggests, a good typo can make a funny; it might not be grammatically correct but it gets the point across. With modern small phone screens and fat fingers some typos, and their resultant autocorrects, have become memes. There are entire comedy sites dedicated to autocorrect and typos.

Speaking of typos, who decided to put the ‘s’, ‘e’, and ‘x’ keys that close?

Missed The Link to the Typo Generator? Click Here To Play Around!

Just When You Thought the Internet was Safe Here’s Trending Domains!

Domain Check Added a Nifty Trending Domains Page

If you caught the earlier post on the recent birth of the impish Domain Check Twitter account then you’re in for a treat; Domain Check has just released a full page dedicated exclusively to trending domain names. This is basically a view for the same data set of trending topics, hashtags, and breaking news that the Twitter bot pulls on to create the tweets. Each day the previous day’s trending domain names are archived so you can aimlessly page back through the domain name ideas and laugh at what a full site dedicated to some of these trends would be like. Its also an easy way to go back and find a trending domain that may have caught your eye earlier from the Domain Check Twitter or the Domain Check Facebook.

Let Other People Be Creative

It can be a bit of a pain in the ass to get creative with a brand name or domain so its always good to have some extra help to get the creative juices flowing. Just paging through a few days worth of amazing Twitter hashtags may very well be enough to kick your brain in high gear or at least get a few chuckles. Its definitely a fun tool, check out the trending domains at Domain Check

Missed the link? Click here for Trending Domain Names at Domain Check!

A Troublesome Imp Is Born: Domain Check Autotweeting Trending Topic Dot Coms

Domain Check Now Tweets Available Trending Dot Com Domain Names

Before you go any further, be sure to follow it @domaincheckplug

As you would expect with anything retweeting anything from Twitter the results of the available .com domain names from the Domain Check Twitter Bot are predictably hilarious on occasion. Thankfully the Domain Check Twitter Bot is just a reflection of what is actually happening on Twitter and not tweeting this ridiculous stuff on its own. Some of the hashtags and trending topics it retweets are actually pretty good and a few of the domain names flirt with staying power. Its surprising what’s taken and what’s not registered yet, everything from gems like demtownhall.com to strippernamefails.com.

Gotta Stay Relevant

Definitely worth following Domain Check on Twitter for a few days, and since its a quick thing to digest with no clicking necessary it makes the .com names it puts are are like good one-liners

Domain Check Twitter if you missed the link, @domaincheckplug

Domain Check Plugin if you want to look up domain names and SSL certificates

The Grand Olde Case Monkey Design Your Own iPhone Case Revival

How Case Monkey Does The Best With Design Your Own iPhone Case

Just recently I dusted off some stats from one of our oldest brands, Case Monkey, the design your own iPhone case site. Case Monkey has been around for years and has a lot of fans, and that means it has some great stats and analytics. I specifically wanted to deep dive in to the seasonal trends and see what’s out there. What I found was that our initial marketing strategy to create a custom phone case site based on the target phrase “design your own iphone case” had paid off. Over time that phrase has maintained a pretty consistent position with regards to Google Trends and traffic analysis. As long as we keep having ever model of custom iPhone case, we seem to do great. The rest of the trends seem to follow the same seasonal trends as any other custom product.

Design Your Own iPhone Case” vs “Design Your Own iPad Case” With Case Monkey

One of the best things we did for Case Monkey was to let you design your own iPad case. While iPad sales represent approximately 10% of the total sales of iPhones we find that iPads almost always need a case. We create the most durable custom iPad cases and that causes people to come back over time to get new iPad cases as they upgrade. Having the quality product over years has really helped Case Monkey compete as a top tier “create your own iPad case” brand.

How to Sell Cheap iPhone Cases Without Being Cheap

Even though Case Monkey has the lowest prices on cheap cell phone cases and bulk cell phone cases and wholesale cell phone cases you never want to make your brand actually cheap. We kept creating the best quality custom cell phone cases for the lowest prices we could… while still keeping fast shipping and a durable product. Over the years our competitors ended up failing by taking the idea of “cheap cell phone cases” too literally and creating a bad product with unfavorable shipping. Thanks to our commitment to quality at Case Monkey the data shows we’re able to compete with cheap cell phone cases from anyone but still maintain a customer base over years.