Cpanel wildcard subdomains custom web root

I had a scenario where I wanted to point all *.domain.com to /webroot/blogs and www.domain.com to /webroot/ Just using apache you can simply add a virtualhost for www.domain.com and point it to webroot and add a second virtualhost below it of *.domain.com and point its document root to webroot/blogs If you use cpanel though, you need to setup a sudomain with * as the subdomain and change your webroot to /webroot/blogs. Now when cpanel decides to rebuild the httpd.conf file … Continue reading

Posted in General | Leave a comment

Yii httpexception would not render view

Ran into this problem and finally figured out it was due to bad access rules. I set access rules to deny all actions to any users that didn’t have ‘admin’ role. The problem is, this also denied the use of the site/error action. So the trick of course is allow all users access to that action.

Posted in Coding | Leave a comment

Custom values for CGridView DataColumns (Yii)

You can get pretty elaborate with column values. For example: array( ‘header’ => ‘Status’, ‘name’ => ‘status’, ‘filter’ => actionButtonAll(), ‘value’ => function($data, $row) use ($model){ // declare signature so that we can use $data, and $row within this function // also allows us to use outside (external) variables, that are not defined within grid, return actionButton($data->id, $data->userDutyHistory->admin_checked, $data->userDutyHistory->user_checked, $data->userDutyHistory->admin_silent_uncheck, $model->user_duty_history_user_timestamp);// echo also works }, ‘type’ => ‘raw’, ),

Posted in General | Leave a comment

Nested controllers in Yii

This allows for up to 3 directories of nested controllers to use IndexController as the default controller http://www.yiiframework.com/forum/index.php/topic/34323-nested-controllers-issue/

Posted in General | Leave a comment

WordPress Feedburner XML declaration allowed only at the start of the document

Sometimes when burning wordpress feeds to feedburner you can get “wordpresss XML declaration allowed only at the start of the document”. The issue is most likely whitespace in one of the theme files (perhaps header.php or theme-functions.php) In any case, a quick fix is to edit wp-blog-header.php, replacing everything between the < ?php ?> tags with: /** * Loads the WordPress environment and template. * * @package WordPress */ if ( !isset($wp_did_header) ) { $wp_did_header = true; ob_start(); //add this … Continue reading

Posted in General | Leave a comment

Finding large files on linux

find / -type f -size +1000000k -exec ls -lh {} \; | awk ‘{ print $9 “: ” $5 }’ Prints out a list of files that are 1 gig or more each. Very useful when disk space is reaching critical and you need to free space up.

Posted in General | Leave a comment

Android callog content provider can take a limit clause

Despite what you may read some android content providers (including the Call Log) can accept a sql LIMIT. Before passing the URI to managedQuery() first do: Contacts.People.CONTENT_URI.buildUpon().appendQueryParameter(“limit”, “150″).build()

Posted in Coding, General | Leave a comment

Hacking lfd csf v5.07 high 5 minute load average email to include MySQL Process List

joe /etc/csf/lfd.pl Go to about line 1906, just before: open (IN, “</etc/csf/loadalert.txt”); add: my @mysql = `mysqladmin -uUSERNAME -pPASSWORD processlist`; Go to line 1925, just before: $line =~ s/\[boundary\]/$boundary/ig; add: $line =~ s/\[mysql\]/@mysql/ig; Save and close /etc/csf/lfd.pl ———————————————– joe /etc/csf/loadalert.txt add just before the last line —[boundary]–: ————–[boundary] Content-Type: text/html; name=”mysql.txt” Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=”mysql.txt”   MySQL Process List: [mysql] Save and close and restart LFD!

Posted in Coding, Computer, General | Leave a comment

My Experimental Fix for the “Digg Effect”

With the increase of large social networking sites, like Digg, Slashdot and Reddit popping up all over the web, it’s getting easier for the small-time bloggers to get their often well-deserved hour in the spotlight. All it takes is one interesting blog entry and one of your visitors taking a moment to share it with visitors of one of these bigger sites. What most bloggers don’t realize until it happens to them is an appearance on the front page of … Continue reading

Posted in Coding, Computer | Leave a comment

iPod Building

This building is at Avenida Santo Amaro in São Paulo SP, Brazil. Take a close look at the side of the building. Someone has redone the exterior of two floors of the building in the shape of an iPod:

Posted in Computer Art, Gadget | Leave a comment