Archive

Author Archive

Railscasts / idleFingers theme for Komodo

October 27th, 2009 admin No comments

Railscasts theme for Komodo

I started using Komodo edit recently so I went ahead and converted the Railscasts theme to it.

As with the TextMate theme, this works best with the Bitstream Vera Sans Mono font.
I recommend size 11, bold for ultimate readability.

Download this theme at GitHub

Memcached button.php for Aardvark Topsites

September 14th, 2009 admin No comments

This mod replaces button.php with a simpler, ultra fast memcached based button.php for Aardvark Topsites.
Memcached allows you to cache data in the servers’ memory and is very simple and fast.

First off, this mod isn’t for everyone as most servers do NOT have memcached installed.
If you don’t understand this, ask your host to installed them.

Download this mod

My topsite receives over 500 requests to button.php per second, I find the stats interesting so I didn’t want remove it.
After I switched to this my server load went from 80%+ to less than 5%.
This is not really the right way to use memcached although it works very well and has saved me a lot of hassle.

Before you do anything, back up your database!
This mod is released as-is, use it at your own risk.
I will not be held reponsible if anything happens to your site or server.

Requirements:

Contents of this mod:

  • button.php – rewritten to use memcached
  • update_memcache.php – periodically updates the database with the collected statistics and resets the memcache

Possible problems:

Buttons containing stats no longer work which is probably a good thing as they put a massive load on the server.

Installing memcached:

Debian / Ubuntu:

(sudo) apt-get install memcached

CentOS: (may need the rpmforge repo enabled)

yum install memcached

Installing memcache php module:

Using PECL which comes with php:

pecl install memcache

You could always compile both from source if you wish.

Installing this mod: 

  1. Overwrite button.php with the new version included in this mod.
  2. Copy update_memcache.php to somewhere on your server
    If you place it outside of the aardvark root, update the require_once(…)  to the correct path
  3. Add the following to settings_sql.php and change the settings to suit your site
    $CONF['memcached_host'] = "127.0.0.1"; //Address of memcached server, usually localhost
    $CONF['memcached_port'] = '11211'; //Port used by above server$CONF['button_num_enabled'] = false; //Do you want to use multiple buttons depending on rank, e.g. 0.png, 1.png...
    $CONF['button_num_count'] = 20; //How many buttons have you created?
    $CONF['button_num_url'] = "<a href="http://www.domain.com/images">http://www.domain.com/images</a>"; //Where are the images located?
    $CONF['button_num_type'] = "png"; //The images extension
    $CONF['button_single_url'] = "<a href="http://www.domain.com/images/button.png">http://www.domain.com/images/button.png</a>"; //Url of the main image, used if button_num_enabled is false or rank is higher than button_num_count
  4. Create a cronjob to trigger update_memcache.php every so often.
    I recommend every 15 minutes although it really doesn’t matter.
    Every 15 minutes: */15 * * * * php /path/to/update_memcache.php

And you’re done! You probably want to run update_memcache.php manually now so that button.php has data to work with and doesn’t have to wait for the cron to kick in.

If you have any questions or problems, leave a comment!

Railscasts / idleFingers theme for phpDesigner

June 29th, 2009 admin 4 comments

About a year ago, I was experimenting with Ruby on Rails on OS X and, of course, TextMate was the editor of choice. Ryan Bates creates fantastic screencasts for rails at railscasts.com and uses a variation of a TextMate theme originally based on idleFingers

As I didn’t really want to learn a new language + framework, I opted for CakePHP, taking everything I learned from Rails and putting it to good use.

phpDesigner is my editor on Windows as its feature set is ideal for me. I missed the theme I used with TextMate as it’s makes the code very easy to read, so I created this theme.

Take a look at the included readme for details on how to set it up.

EDIT: Updated to include JavaScript style.

Download Theme

Media Player classic addon for LCD Studio

June 29th, 2009 admin No comments

This is a plugin for LcdStudio, it enables Media Player Classic support with a variety of options.

  • Length (h:m:s)
  • Length (milliseconds)
  • Muted – 0 or 1, muted being 1
  • Now Playing (Filename)
  • Now Playing (Smart) – Grabs the title from ID3 Tags, falling back to the filename when unavailable (ID3v2 > ID3v1 > Filename)
  • Path – Full path of the song / video.
  • Position %
  • Position (h:m:s)
  • Position (milliseconds)
  • Running – True or False
  • State Text – Playing, Paused or Stopped
  • Volume % – Media Player Classics Volume

There are also ID3 specific variables

  • Album
  • Artist
  • Genre
  • Title
  • Bitrate

Download Addon

Categories: PHP Tags: , , ,