Insights Featured Managing file and folder permissions on CentOS when deploying with Git I use Git as a version control and deployment system. When a website gets pushed to a server, all files get pulled into the web root (i.e. htdocs) by a user named git executing git pull in the post-receive hook. By default, all files and folders git creates have
Insights Manually install stable version of APC in CentOS First you’ll want to make sure you have all required packages installed: yum install php-pear php-devel httpd-devel pcre-devel gcc make Most tutorials will now say to use PECL to install APC: [root@vps ~]# pecl install apc downloading APC-3.1.13.tgz ... Starting to download APC-3.1.13.tgz (171,
Solutions SELinux: AVC denied read for postfix I recently installed dovecot and postfix (postfix how-to documentation) on a server running an optimized and hardened version of CentOS 5.6 (LAMP): yum install postfix dovecot system-switch-mail system-switch-mail-gnome After starting both services: /etc/init.d/dovecot start /etc/init.d/postfix start I noticed several log entries in /var/
Insights How to escape pound sign in Apache RewriteRule If you’re setting up a redirect and want to redirect to a specific page and “tab” on that page, you need to make sure Apache does not escape the URL, otherwise # will turn into %23. You can do that by using the NE (no escape) flag: RewriteRule ^/(.*) http://domain.
Insights Remove post type slug in custom post type URL and move subpages to website root in WordPress I recently had a need to rewrite the URLs of all parent and child pages in a custom post type so that they appeared to live at the website root, but in reality, continued to live in a custom post type within their hierarchy. Preface The situation: 1. I have
Insights Prevent checked categories in meta box from appearing at top in WordPress I previously shared a jQuery snippet that enforces parent checkboxes to be checked when a child is checked and children to be unchecked if the parent is unchecked. This works really great in theory, except that WordPress, by default, moves all checked checkboxes to the top of the category list,
Insights Automatically check parent checkbox if child is selected in WordPress To keep all posts in WordPress organized in terms of categorization, it helps to make sure that when a user selects a category that’s three levels down, i.e. has two parents, that all the corresponding parents get checked. What follows is a short and sweet JavaScript solution to
Insights MySQL query for getting three most recent posts for last 12 months in WordPress I recently had a need to retrieve the last three posts for the last 12 months that had at least one or more posts in WordPress. Another requirement was to display a “more” link that would redirect the user to the archive of that month, provided there was at least
Insights Dynamically insert data into MySQL table based on select query result I was working on a new feature for a site, and while it closely resembles WordPress’ native post formats, it offers more flexibility and control. Users can choose from predefined post layouts and it will display the post using a custom layout and branding. Since this is a new feature,
Insights Proportionally constrain image based on fixed width or height using PHP The following post isn’t WordPress specific, however I’m using this in a WordPress environment, so you’ll find several references to it. Array containing the file details I have a custom meta box that allows a user to upload an image (or any file, really) to a post,
Insights Convert random-looking string into readable PHP, using bitwise operator, to reveal pharma hack Today I came across an interesting piece of code in an archived WordPress 3.4.1 installation. At first it didn’t make much sense, but after careful examination, it wasn’t so random after all — malicious code never is. In this post we're going to reverse-engineer the
Insights Backup your Drobo 5N to CrashPlan Central Below are the steps for creating a Drobo read-only user, creating a batch file to automatically mount your share, setting up a task to automatically execute your batch file when your computer logs on, and last but not least, adding the new share to CrashPlan for backup. Create a read-only
Solutions No value for post_date_gmt and post_modified_gmt when creating drafts in WordPress I have a custom post type containing records that get dynamically updated every 24 hours from an external source. All those posts are initially created as a draft and only published to the site once their content has been confirmed, if at all. Since I use the GMT timezone for
Solutions WordPress cron not executing scheduled events I recently tried to schedule an event to be executed twice daily in WordPress MU 3.5 via the wp_schedule_event function, but for some reason the event never fired. I confirmed that the event was indeed scheduled properly, but when reviewing the timestamp of the event via wp_
Insights Update a field in a MySQL table based on two fields from another I have a custom post type in WordPress for employees and used a combination of first and last name as the post title. Both the first and last name are also stored in individual fields in the post meta table. Later I decided to change the structure of the post
Insights How to change your Windows 7 login screen background Tired of looking at the same ol’ Windows login screen? This guide shows you how to replace the standard Windows login screen background with an image of your choice. It also covers what types of images work best, how to create or find them, and what changes need to be
Insights Target and style an HTML element only if it has two classes I was working with custom menus in my WordPress theme and assigned each menu item its own class so that I could have a custom background image. This is basically how WordPress renders the menu (I simplified the number of classes in the example below, as WordPress generates a lot
Insights CSS clearfix leaves space below container I’ve been using clearfix to clear floats for years now, and I always knew that it left a little bit of space after the HTML container that is was applied to. Most of the time I sort of worked around it, but I was curious whether there was a
Insights Change your list bullet to a custom character in CSS Today I was wondering whether I could use a custom character as my list bullet. The requirement was that it was strictly CSS and not a background image. Turns out, it’s actually pretty straightforward: ul { list-style: none; } ul li:before { color: #f00; content: '» '; font-size: 1.2em; font-weight:
Solutions Wrong toolbar icons in Microsoft Office (Word, Excel, etc) for Mac I came across a really bizarre issue on my Mac regarding the toolbar icons in Word (and Excel). For example, the save button now contained an icon of scissors and the up arrow on the scroll bar was now the spell check icon. Needless to say, this mix-up is less
Insights How to get Sass support in Sublime Text I was working with a few .scss files in Sublime Text 2 today and noticed that it didn’t support Sass syntax out of the box. There’s actually a really awesome Sublime package for installing other packages called Package Control. Here’s how you can get that up and
Products Top 3 MacBook Pro Retina Accessories Today I spilled some coffee over my fairly new MacBook Pro (MBP). The liquid rolled over the corner of my trackpad, over the arrow keys and shift key, over 1/3 of the speaker, and by then, a friend had picked up the MBP and forced the coffee to roll
Products Backup Solution: CrashPlan When I first started backing up my data, I simply copied and pasted my files from one folder to another. The problem is that if the hard drive crashes, all that data will still be lost. After that, I invested in an external hard drive, but eventually got tired of
Insights Using the HTML5 video player for serving .ogv files in Firefox and Safari, and .mp4 files in Internet Explorer I was working with a web page that used the following code to embed videos: <video width="320" height="240" controls> <source src="videos/demo.ogv" type="video/ogg"> </video> But they weren’t playing in
Insights How to use PHP’s namespaces and constants within your WordPress plugins Recently I switched from using a class to emulate a namespace in my WordPress plugins to actually using PHP’s namespace, which is available in PHP 5.3.0 or greater. I’m going to demonstrate some things that all my plugins thus far have in common. 1. Create a