Archive for the 'Solutions' Category

Joomla: TinyMCE is screwing up RokStories

RokStories is an easy way to add those rotating images on your joomla installation. Making them work, however, might require some tinkering. By default, the TinyMCE content editor modifies your html for its own purposes, and this screws up RokStories as it cannot recognize the images in your article if there are foreign attributes such as mce_src in the <img alt=”" /> tag. Editing the html source (with the TinyMCS Source editor) will not solve the problem as the extra attributes are inserted once you go back to the editor and save.

A quick way to overcome this is to temporary disable TinyMCE and use a plain text editor, removing unknown attributes and making sure the url to the images are relative. Other points to take note if its still not working:

  1. Remove any height and width definitions.
  2. Shift the src attribute to the front (<img src=”…” alt=”…” /> instead of <img alt=”…” src=”…” />)
  3. Remove any instances of <div></div>
  4. Add a readmore tag to separate the text content from the image.

Tutorial from Rocket Theme: http://www.rockettheme.com/forum/index.php?f=18&t=82376&p=420867&rb_v=viewtopic

Joomla: Template parameter file is not writable

While working with joomla themes, one might come across this problem of the template parameter file not being writable. You may have tried to change the permission of params.ini to 0755, but somehow the permission is reset to 0555 everytime you save your changes. What could be the problem?

Seems like the answer lies in the com_template core component. Open the file ~/administrator/components/com_template/controller.php and search for this line “Could not make the template parameter file unwritable”. You’ll see that this component is actively reseting the permission to 0555 with this code:


if (!$ftp['enabled'] && JPath::isOwner($file) && !JPath::setPermissions($file, '0555')) {
JError::raiseNotice('SOME_ERROR_CODE', JText::_('Could not make the template parameter file unwritable'));
}

So the solution becomes straight forward – change the ’0555′ to ’0755′. Do not worry about security concerns as you are only granting write permission to the owner.

Is your wordpress installation safe?

An interesting article discussing the common ways hackers can inject code into a clean wordpress site.

http://ottopress.com/2009/hacked-wordpress-backdoors/

Move EBS AMI’s across regions

Was trying out an instance in the Asia-Pac (Singapore) region but realize I can’t simply move my AMI from the EU region here. Fortunately I found the guides below for a potential solution to this problem. Keeping them here for my own future reference.

Summary:

http://citizen428.net/?p=420

Step by step:

http://blog.ibd.com/scalable-deployment/copy-an-ebs-ami-image-to-another-amazon-ec2-region/

Installing XDebug on Virtualmin

XDebug helps you debug or profile your php code. It is useful for complex sites where it is not feasible to read each line of source to determine where you should start optimizing (especially if those are not your own code, as in the case of contributed extensions). One point to note is that XDebug does not output in a human readable way, you need to use tools like kcachegrind to parse the output to gather information from it.

To install with pecl:
pecl install xdebug

You can craft your own .ini, or you can get a default (albeit unsupported) xdebug.ini from http://gggeek.altervista.org/2007/11/26/the-completely-unofficial-xdebugini/ and place it in /etc/php.d along with the ini’s of other modules.

Important directives:
zend_extension="/usr/lib/php5/20060613/xdebug.so" <– to enable this module, but set the path to your own path to xdebug.so. (use find -name xdebug.so to locate it)
xdebug.profiler_enable=1 to enable the profiller
xdebug.profiler_output_dir is the output directory for the logs. You can leave it as the default /tmp directory

restart apache

node-view-[viewname].tpl.php not working

If you are using row style: node in your view, its recommended that you use the node-view–[viewname].tpl.php to theme your output instead of views-view-row-node–[viewname].tpl.php.

However, you must make sure node.tpl.php exists in your theme (or subtheme) in order for node-view-* to be picked up by Drupal.

Custom content type not showing up?

You’ve created a custom drupal module to define a content type, its showing up in the create content menu, but its not showing up in the admin/content/type menu. What could be wrong?

Check that you have declared the [module_name]_form() function in your .module file.

Function header:

function [module_name]_form($form_state)

Note: if its not even in the create content menu, you need the [module_name]_node_info() function.

Skype for Windows Mobile 6

Apparently Skype decided to discontinue the Skype client for Windows Mobile 6, although existing installations would continue to run. I’m glad that I only found this out after I bought my skype credits.

But thankfully the .cab file can still be found online, and they work fine on my HTC Diamond 2.

http://www.4shared.com/file/GrqhiMzD/Skype_v300256_For_Windows_Mobi.html
http://www.box.net/shared/static/rxi1nb6j3q.cab

God I didn’t know I was buying myself into so much trouble when I got my Diamond 2

Laggy Flash CS4? There’s an update to fix that

After suffering a laggy Flash CS4 for nearly 6 months, I finally decided maybe it was an issue with the software and not my file. I feel stupid for not considering this possibility - an update which fixes the problem have been existing for over a year now.

Download it at: Adobe Flash CS4 Professional Update (10.0.2)

30MB (140 for Mac) and doesn’t require a restart.

Apache Error #28 – No space left on device

The Apache server on my EC2 instance stopped suddenly and refuses to restart. Repeating in the error log is this misleading error:

(28)No space left on device: mod_rewrite: could not create rewrite_log_lock
Configuration Failed

A quick check with df -h and repquota -v indicates that there are plenty of disk left and no user is over his quota. The culprit turns out to be left over semaphore arrays. To check whether they exist on your system, use

ipcs -s | grep apache

In my case this returns a shocking 128 left overs. To clear them, run

Continue reading ‘Apache Error #28 – No space left on device’