Category archives: programming

Having Trouble Removing New Relic Javascript?

Have you tried removing New Relic’s WordPress plugin, yet still have New Relic JavaScript displaying on your webpage? Have you deleted every trace of New Relic from your MySQL database, yet the script still appears in the HTML?

Worry not. PHP is automatically inserting the JavaScript. Below is one simple solution. You must edit (or add) the following line in your php.ini or comparable file as follows:

newrelic.browser_monitoring.auto_instrument = false

That’s it!

Unable to Edit or Rotate Images in WordPress

Have you ever experienced the following error in WordPress:

Could Not Load the Preview Image
Could not load the preview image. Please reload the page and try again.
Chances are you have WHM/cPanel and are running ModSecurity with the following rules enabled:

950120, 960015, 981243, 981044, 981049, 950901, 981245, 981243, 981257
If you have access to WHM yourself, you can disable the rules yourself.

  1. Log into WHM
  2. Navigate to Security Center
  3. Click on ModSecurity Tools
  4. Search for each of rules 950120, 960015, 981243, 981044, 981049, 950901, 981245, 981243, 981257
  5. Choose to Disable each rule
  6. Restart Apache after you disable each rule

Get Back the System Sleep Preferences in Mac OS X

I recently purchased a Mac Pro (late 2013) and discovered that the Energy Saver Pane is a little different; most notably, the Computer Sleep slider is missing. Here is how to get it back.

First, use the following terminal commands to determine the model and board ID of your computer:

sysctl hw.model | awk '{ print $2 }'
ioreg -l | awk -F\" '/board-id/ { print $4 }'

Second, navigate to the following folder:

cd /System/Library/Extensions/IOPlatformPluginFamily.kext/Contents/PlugIns/X86PlatformPlugin.kext/Contents/Resources/

Third, determine the .plist file that corresponds to the model and board ID of your computer; e.g., Mac-F60DEB81FF30ACF6.plist.

Fourth, modify the file that corresponds to the model and board ID of your computer:

sudo vi /System/Library/Extensions/IOPlatformPluginFamily.kext/Contents/PlugIns/X86PlatformPlugin.kext/Contents/Resources/Mac-UDID.plist

Fifth, change the following line:

UnifiedSleepSliderPref

to

UnifiedSleepSliderPref

Sixth, regenerate kext cache by “touching” the Extensions directory:

sudo touch /System/Library/Extensions

Finally, wait a minute just to make sure the system has enough time to finish regenerating the kext cache. Then, reboot your mac.

Alas, you will once again have the two-slider pane.

System Energy Dual Preferences

Make WordPress Print Pretty

Making your WordPress site print-friendly is probably not the first thing on your GTD list. However, the process is relatively straightforward. The simplest method is editing your existing header.php and style.css files.

First, look for the HTML declaration in your theme’s main file, usually header.php. Search for something like this:

<link rel="stylesheet" 
href="<?php bloginfo('stylesheet_url'); ?>" type="text/css" media="screen" />

Change the last attribute to:

media="screen, print"

Second, it’s time to edit your theme’s CSS file, usually style.css. Add the following code to the bottom of the stylesheet:

@media print and (color) {
* {
     -webkit-print-color-adjust: exact;
     print-color-adjust: exact;
  }
}

That’s it! If you have caching enabled, remember to empty your cache. Happy printing.

Hide SafeMonk Shortcut on Mac Desktop

SafeMonkI recently installed SafeMonk to encrypt my DropBox files. Unfortunately, SafeMonk adds an unnecessary shortcut to the desktop. Below is a nifty trick to hide that shortcut.

Open a terminal session, type “SetFile -a V”, and drag the SafeMonk shortcut onto the terminal window. You should observe an output along following lines:

# sudo SetFile -a V /Users/[username]/Dropbox/SafeMonk

Press enter and type in your password after the prompt. The above command “SetFile” sets the invisible extended attribute on the SafeMonk folder. You will next need to relaunch Finder for this setting to take effect. You can do this by entering “killall Finder” in your terminal session. Finally, you might want to put an alias (not a symlink) of the SafeMonk folder in your Dropbox folder.

five Mac OS X Snow Leopard Tweaks I Can’t Live Without

1.) Always view Mail.app attachments as icons.

defaults write com.apple.mail DisableInlineAttachmentViewing -bool yes

Restart Mail.app, and voila!

2.) Use a spacer to split the Dock between Docked applications and non-Docked applications.

defaults write com.apple.dock persistent-apps -array-add
'{"tile-type"="spacer-tile";}' && killall Dock

3.) Add one or more stacks of recently used items.

defaults write com.apple.dock persistent-others -array-add 
'{ "tile-data" = { "list-type" = 1; }; "tile-type" = "recents-tile"; }' 
&& killall Dock

4.) Enable new List view in Dock Stacks.

defaults write com.apple.dock use-new-list-stack -bool yes 
&& killall Dock

5.) Enables gradient effect on mouse over.

defaults write com.apple.dock mouse-over-hilite-stack -boolean yes 
&& killall Dock