Programming

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

Java Concepts: Objects; Classes, Variables, and Methods

tl;dr (too long; didn’t read) – Java uses classes which declare variables that store information and are modified/retrieved by methods once an object of that class is instantiated. The next post will contain code complimenting these concepts. // Continue if you want to read more. /* Java is an object-oriented programming language, but just what is an object? To find out, we must first delve into the concept of classes. Classes are “templates” of objects. These “templates” dictate all the variables, or “data,” and methods, which are essentially “actions,” that the still unknown object will have. The class will have a name, along with variables and methods. The only time you may see these names is when you are instantiating an object from the class or calling (“executing”) a method of an object, which can only be done because of the code in its originating class. To instantiate means “to create an instance of,” which, if used in real-world context (although awkward), would be akin to saying “make me one of those, and make it just like the others.” Wait, I know I might have lost you by this point, but you needed to understand what variables, methods, and classes were before an object made any sense. We know a class is a template, right? Well, consider that you can instantiate multiple objects based on this class. What this means is that they are absolutely identical in every way except for maybe their data and name, which we normally call a “reference” (because it’s actually referring to a location in memory, a hexadecimal number that would glaze your eyes over!). If a metaphor would help, they’re all identical twins that know different things, but can do the same actions! So, even though you declare variables and methods in a class, when a variable is modified or a method is run they are not affecting the class but the object that was instantiated! Now it makes sense suddenly, doesn’t it? But wait! How does this “instantiation” thing work you ask? Good question, through a type of method (yes, these are methods) called constructors! What they do is (hold onto your hats because I’m using the next word in a different sense) instantiate the variables of an object so that the object knows what data is has in case it has to do something. Now wait, we just instantiated the object, why instantiate the variables; moreover, what’s the difference? The answer is we haven’t instantiated the object yet, we need to set values to the variables so that the object has data. Only then should the object be considered instantiated! So now we know what an object is: an instance of a class that has variables and methods dictated by the class. You might be wondering about methods at this point. Methods have, traditionally, two types: accessors, and mutators. What’s an Accessor? Well, quite simply, it accesses and returns (“gives back”) data stored in the object. Nothing too special, right? Mutators, on the other hand, can do all sorts of creative things but normally modify the data of an object in some way. You won’t always get data back from these, nor will they always tell you whether they successfully executed, but their purpose is clear: when something gets changed, this is the type of method it becomes. Something to note is that this is simply a naming convention, not a requirement. You can call them “Destroyer” methods and nobody can really say anything about it, as the compiler will not complain and your code will still run. Despite this, I encourage you to think of others who may read your code, and to try your best to keep to a standard  and/or convention! The next post will actually involve some code examples of all these concepts, which will be linked here upon creation. If you’re still having trouble, don’t fret, keep reading up on the concepts as much as you can and, if necessary, ask for metaphors or similes! */

Read more