Apache Modules

Apache runs with statically compiled modules and shared modules.
Statically compiled means they're always available and can't be disabled without recompiling.
Shared modules come in the form of .so files found in the modules direction. These are enabled via config files.

http -? for more info.

httpd -t -D DUMP_MODULES
lists all shared/static modules
apachctl -l
lists static modules

Additional resource: http://www.devside.net/guides/linux/apache-ssl-deflate

Checking For Mobile Browsers

This helps determine if the browser is mobile or not. $agents will need to be updated as necessary.

function isMobile(){
$agents = array('Mobile Safari', 'iPhone', 'IEMobile', 'PPC', 'webOS','Blackberry', 'Mobile');
foreach($agents as $a) {
if ( strpos($agent, $a) != '' ) {$m = true; }
return $m;

Possible usage:
<div <?php print isMobile()?"id='right-column-mobile'":"id='right-column'"; ?>>

Mirroring With WGET

Mirroring example:
wget --mirror -E --convert-links --wait=2 http://example.com

--mirror = -r -N -l inf --no-remove-listing
-r recursive
-N timestamping
-l depth/level
--no-remove-listing - ftp related options.
-E --adjust-extensions - converts everything to correct extensions, e.g., PHP -> HTML
--convert-links - makes things viewable locally

Scheduling Powershell Task

Powershell is pretty awesome. Using it on Win 7 box. Summary.

1. set-executionpolicy RemoteSigned - Remove scripts need to be signed. Local scripts written by you don't.
2. task schedule: powershell -command "& 'C:\MyScripts\script.ps1' "

Reference: http://www.searchmarked.com/windows/how-to-schedule-a-windows-powershell...

Replacing Hard Drive on Linux

When you run out of disc space, replacing a hard drive doesn't mean system wipe. Depending on your configuration, the follow articles will help make things easier.

Todo: I'll write about my specific configuration and what I did to get things up and running again.

Reference: http://www.skullbox.net/newsda.php
Reference: http://fedoraproject.org/wiki/SELinux/Troubleshooting/AVCDecisions
Reference: http://www.howtoforge.com/forums/showthread.php?t=1857
Reference: http://www.yolinux.com/TUTORIALS/LinuxTutorialAdditionalHardDrive.html

Creating PHP Daemons

Sometimes, writing a linux daemon doesn't have to be in c or c++. PHP is an option. Here are some articles I've used to creating mine. I'll post some examples up and summarize what I've learned, and why I chose PHP later.

Reference: http://www.linux.com/archive/feed/4689
Reference: http://devlog.info/2010/03/07/creating-daemons-in-php/
Reference: http://bipinb.com/making-php-program-as-daemon.htm/comment-page-1#commen...
Reference: http://kevin.vanzonneveld.net/techblog/article/create_daemons_in_php/
Reference: http://www.perkiset.org/forum/php/forked_php_daemon_example-t474.0.html

Hard Links

Sometimes, a file may have multiple hard links created. Removing all of them isn't straight forward. You have to find them first.

This article explains a few linux commands on how to find and delete them.

Reference: http://linuxcommando.blogspot.com/2008/09/how-to-find-and-delete-all-har...

Assignment Inside A Condition

It's very common in PHP to see code written like this:

if($summary = get_post_summary())
return $summary;

What I'm referring to is assignment inside a condition. Cunningly enough, it can be done in JavaScript too, although it's far less common:

if(summary =
return summary.innerHTML;

At first glance you'd be forgiven for thinking that's a typo! Indeed, some debuggers will flag that with a warning, asking if you meant a test for equality (==) and mistyped it as assignment (=).

Linux Command Line Reference

These are the command line operations I use the most. More to come later.

ps (-ef, -aux) | grep
pmap -x

SeLinux Enabled:

Reference: http://www.pixelbeat.org/cmdline.html
Reference: http://www.linux.org/lessons/beginner/l1/lesson1a.html

More Readings:

Hello World

Rather typical title for an opening post. What can I say? I’m a computer geek!

Goal here is to writing about the things I've learned. I forgot a lot of the things I've learned because other things just need to fill the plate. As resourceful as Google might be in finding things, it doesn't do a very good job of summarizing everything that I've already read and processed, especially in comments.

Favorite Drupal Modules

I use some or all of the following modules on all of my Drupal sites. I've summarized what benefits I've found from using them as well. The list is organic and this post will change over time. Personal reference but you're free to read about it. Haven't summarized everything yet. Like I said, organic.

Administration Menu
URL 301 Redirect
PathAuto: URL alias
Custom Breadcrumbs

Google Analytics Module

Google Analytics is cool. Keeps track of who visits your site. Other good jazz reporting.

Download the module instead of implementing code inside your theme. Benefits include:

1. This way, you can continue to implement the code without worrying about which theme does what.
2. Automatically filters out the key parts of your site, e.g., admin, from being tracked.
3. Enables you to locally cache the JS file for speedier load times. File is updated daily.

Reference: http://drupal.org/project/google_analytics

Administration Menu Module

By far one of the coolest and must have modules, the Administration Module creates a drop down menu system at the top of your website. These menus provide everything with quick access to your default Drupal Navigation Menu.

Reference: http://drupal.org/project/admin_menu

Syndicate content