How To Use Wildcard Characters in MySQL statements

You’ll need to make use of wildcard characters to perform powerful searches in MySQL. The 2 wildcard characters that you can use in “LIKE”-queries in MySQL are: % which matches 0 or more characters _ which matches exactly one character To search for a date, you can use a query like the following, which gives you everything that happened from 10 to 19 August of 2015, between 9:01am to 9:09am. SELECT * FROM `yourTable` WHERE `datetime` LIKE ‘2015-08-1_ 09:0%’

How to correctly display CSV files (Excel 2013)

Excel 2013 has an issue displaying files in CSV format that other versions of Excel doesn’t seem to have. To fix this, you’ll just need to open the CSV file with any text editor (like Notepad), and add the following as the first line: sep=, This sets the comma (or any other character that you need) as the separator. Now just save and close the file from your text editor, and then open it with Excel 2013.

How to redirect one domain to other domain with all query string variables (htaccess)

If you ever have the need to move domain names, the following .htaccess code will help move all visitors to your second domain name. This method also preserves your URLs’ query string variables, so there’s a less likely chance of something breaking. You can use this: RewriteEngine On RewriteCond %{HTTP_HOST} firstdomain.com$ RewriteRule ^(.*)$ http://www.seconddomain.net/$1 [L,R=301]

How to find and replace a text string in all files on your cPanel / WHM / Linux / Unix server

If you need to quickly find and replace all occurrences of a string of text, the Linux shell is a very helpful too. To do this, we’ll be using the find, xargs, and sed commands. Find is pretty self-explanatory, and sed is short for “stream editor”, which allows you to filter and transform text. xargs is a command that takes in input and executes your chosen command on it – and in our following example, allows you to run the

Continue Reading

How to find and replace text string in all MySQL tables

The following tutorial is helpful if you have a MySQL database and need to find and replace all occurrences of a string, for example, replacing “www.YourOldDomain.com” with “www.YourNewDomain.com”. This is useful if you are moving or cloning your website to another domain, especially if you are using software such as WordPress. First, go to your old domain name and export the ENTIRE database, including enabling the option to “drop tables” if they’re already present. If you’re using PHPMyAdmin, you’ll want

Continue Reading

How To Keep Indentation For The Second Line Onwards In Your Lists (CSS / HTML)

If you’re trying to preserve indentation for your lists, especially when you have multiple lines, then this is the code that you need. It’s fast, east, simple, and works to keep the indentation for the second line onwards (per bullet-point). As you’d imagine, this will work for both ordered (OL) and unordered (UL) lists. li { list-style-position: inside; text-indent: -1em; }

Essential .htaccess Tips and Tricks

People running on a good web host should be able to make use of a .htaccess file, which is a plain text file that allows you to have configuration rules that affect your Unix web server on a per-directory basis. This is a good starting .htaccess file that beefs up your web server’s security, with rules from a post on 0x000000.com, and SigSiu.net Regex Character Definitions For htaccess In addition, I found the following write-up useful for understanding the characters

Continue Reading

Sliding Sidebar