Author Archive for ryan

easySwap is now uSwap

The new version of easySwap (beta 2.0) is out! The NTU Student Union has volunteered to host it on their server (and provide the manpower to maintain it, so I had to change the name to uSwap as well, to be in line with their branding.

Find it at http://su.ntu.edu.sg/uswap

Unfortunately, I still did not have time to implement the other features that I had wanted to, especially the email notifications. High priority in my list is also to implement caching of the results so that it wouldn’t be so taxing on the server when the “refresh rate” is high.

Part of me also wanted to port the project over to plain html/php so that its supported on the iPhone/iPad (probably with jQTouch), but… that’s for next time.

Satoshi’s Last Words

Thanks to Makiko Itoh for translating Satoshi’s last words. It is definitely long and rambling as she claimed, but I found it an easy reading. Being an animator and also someone who tends to surround myself with work, makes me rethink.

http://www.makikoitoh.com/journal/satoshi-kons-last-words

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/

World War II retold on Facebook

A refreshing version of World War II told on Facebook.

Source: http://www.collegehumor.com/article:1802364

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/

Free Transform Manager As3

Put together a simple transform manager for a friend’s project. Supports dragging and single click scaling and rotating. Source provided after the jump.

Continue reading ‘Free Transform Manager As3′

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.