Programming

The Delicious Truth about Regular Expressions (regex)

Wait! Don’t run away! I know the whole thought of a regex terrifies some of you (it made me cringe now some months ago) but when I sat down and figured it out I realized how amazing they are and… well… I reacted accordingly: tl;dr Regexes are amazing because ‘/

Read more

Sender Policy Framework – Protect your E-mail from Spam with SPF

Don’t let your email fall into spam or the limbo of undelivered/unreceived emails. Add an SPF record to your domain: it’s quick, simple, and the benefits speak for themselves.

Read more

mySQL Tidbits: GROUP_CONCAT and ON DUPLICATE KEY UPDATE Examples

Some of the trickiest queries involve a GROUP_CONCAT or a cascade. Here are some use cases and tips.

Read more

mySQL Find and Replace throughout Entire WordPress Database

We use this every time we migrate from a development domain to the live domain. Don’t let old development links sneak away from you again!

Read more

Change WordPress Site URL

If you’ve ever had to transfer a WordPress site between domains, then you know all about the pain of changing the URL. Here’s how to make it quick.

Read more

Mass Renaming Files via Command Prompt

Source: http://superuser.com/questions/16007/how-can-i-mass-rename-files-from-the-command-line-or-using-a-3rd-party-tool Thanks to zdan of superuser.com tl;dr? Here’s the script: dir /B > fileList.txt for /f “tokens=1,2,3,4,5 delims=-” %i in (fileList.txt) DO ren “%i-%j-%k-%l-%m” “%i-flowers-%l-%m” rm fileList.txt  Enjoy. Now for the curious, read on. 😀 What those commands do are as follows: Create a list of the files in your current folder as a text file. Loops through the list of files and renames them. Deletes the text file so you’re left with your deliciously renamed files en masse. Now, the way the loop works is really cool, and I mean REALLY cool. Here’s what happens: It loops through every line in the file we just created, passing it to the rename command. So then for every line, the rename command then “tokenizes” the line based on the delimiters, AKA separators. Renames the file based on these temporary tokens to the desired string of text and/or arrangement of tokens. So, now we can gather what info the script is using: Tokens: 5, %i, %j, %k, %l, %m Delimiters: – Current File Name Pattern: “%i-%j-%k-%l-%m” Desired File Name Pattern: “%i-flowers-%l-%m” Now we know, after that close look at what the command does, that the script is using 5 tokens, what their variables are, how it’s delimiting the file name, what the file name pattern currently is, and how it will be renamed. I told you it was neat. It certainly makes life easier when you’re handed a batch of files improperly renamed ever-so-slightly.  🙂 Enjoy.  

Read more

Solution: jQuery .append() or .appendTo not working in IE8, IE7, or IE6

The solution to this is more of a warning: when you create elements in the DOM, if they are not closed, IE8, IE7 and IE6 will not allow any modification to that element, including .append() and .appendTo() because they are not considered standard or correct DOM elements, and hence are treated as text. Make sure that you close your elements such as <div></div><a></a>, etc. so the older browsers can tell what you are trying to do. All modern browsers including IE 9, will still append to the non closed element if you decide not to close them, at least in my experience this occurs with <a >records but I have not tested with others.

Read more

The Internet Progresses: Adobe Flash Discontinued

Flash was a language written to display dynamic content and enhance the look and feel of web pages. There are many things that Flash did that couldn’t be done by most browsers during its era. The problem with Flash is that every browser built had to include, or at least support a plugin version of flash, to display the content. Flash constantly gets updated so there have always been many issues with it. There was a disconnect between Flash and the Browser, it was just something else that needed to be maintained. This issue happened with Java and Javascript. Javascript replaced Java not because it was “better” but because it was lightweight and able ot be built into the browser.  Java’s Javascript is HTML 5. The difference is HTML5 is lighter, better, and promotes new and cleaner standards without the need to update an app, as it is built into your browser. With the dawn of mobile computing, flash has been a struggle. Most mobile browsers didnt support flash natively, and Adobe wasn’t ready to have flash installed in a non PC/Max/Linux environment such as iOS (iPhone, iPad). Porting it to Android wasn’t as big of a problem because it uses a near-true linux kernel. So Adobe is killing flash, and I say, for the better. HTML 5 is quickly becoming the standard that all browsers can follow, and allows different content to be displayed based on what browser the user is using. The biggest holdback has been browsers such as IE 6, 7, and 8, which have no HTML5 compatibility. A large part of the world still uses these browsers but it is losing hold. Most people who use them are either locked down by their operating system or don’t know what a browser really is (Sound Familiar? “I use Windows as my Browser!”). I think that Microsoft killing off Windows XP, and requiring Windows 7 to use IE9 has helped in this decision. Forcing users to use a modern browser is a must for progress. Not only is there rich dynamic and beautiful content out there to be had with modern browsers, but there is security too. Internet Explorer has been the defacto browser for many corporations because it gave direct access to the OS through the browser. As nice as that is, in a stacked environment like Microsoft Windows, it becomes the number one problem with using IE as your browser, you open up the guts of your PC to the rest of the world, whereas Browser like FireFox and Chrome do not. Farewell Adobe Flash, it was nice knowing you. I am excited to see all the web tech that will start to be created in HTML5. Oh…and worried all your Flash Content is all for not? Guess What ? Google provides a free bit of code that you can run in your browser to convert (most of) your SWF (Flash) files into HTML 5!! Here is the link to this sweet project: http://www.google.com/doubleclick/studio/swiffy/ Out with the old, in with the New! Thats how it works with Tech!

Read more

How to Connect Website Badge / Link to Google+ Business Page

For those of you who skipped configuring your badge for Google+ Pages and can’t find the option anymore, use the following link: https://developers.google.com/+/plugins/badge/config Type in your page’s ID and you will be able to create it again.  You can see it live here at esotech.org at the footer and also the breadcrumb on inner pages. You will have to add a bit of code to your header, and then use the link wherever you like. The link seems highly customizable if you know what you are doing. For example, setting height and width of the icon shouldn’t be a problem. Here is a code snippet example for Esotech’s Page. <!– Place this tag in the <head> of your document–> <link href=”https://plus.google.com/103467698593383507666/” rel=”publisher” /> <!– Place this tag where you want the badge to render–> <a href=”https://plus.google.com/103467698593383507666/?prsrc=3″ style=”text-decoration: none;”> <img src=”https://ssl.gstatic.com/images/icons/gplus-64.png” width=”64″ height=”64″ style=”border: 0;”> </img> </a>

Read more

Solution: Using Include or Require in PHP but Can’t Find File

  • Oct 10, 2011
  • PHP
  • 1

The situation is you are trying to use include or require to load a file from a folder in your site, when the file you are calling include or require from is inside a different folder in the site and NOT the document root. The issue is, when you use include outside of your document root, it considers that folder as the document root, so you are forced to give it the real root directory of your website on the server. Your File: website.com/directory/script.php Your Code in that file: require_once( “/directory2/filename.php”); or include_once( “/directory2/filename.php”); If properly configured, you can use this PHP Server Key/Variable. $_SERVER[“DOCUMENT_ROOT”] So a good Example would be the following: include_once( $_SERVER[“DOCUMENT_ROOT”] . “/directory2/filename.php”); or include_once( $_SERVER[“DOCUMENT_ROOT”] . “/directory2/filename.php”); In the case that directory is the folder just after the root of your site.

Read more