– A shell script for serving sites

I am experimenting with using a Linux virtual machine as my web development environment of choice. I store the vm on a removable drive so that I can develop from any location, without having to setup a working environment. Previously I had to check out the repositories, setup a local webserver and I had trouble keeping things working, because every configuration change had to be applied in every location. Now it is all centralized and my life is simpler.

The aim is to make working on projects as easy as possible. I have all projects checked out in a folder called /var/sites. They are mostly PHP projects and because of my shared hosting environment they share a single apache configuration. How can I easily serve them? Having seperate virtualhosts for each project would result in me having to make manual changes on every location again, so this was not the way to go.

Instead I created a simple shell script that creates a symbolic link from the Apache’s webroot to the project I am working on:

echo "Available sites:"
ls  /var/sites
echo -n "Type site to serve: "
read site
if [ -z "$site" ]
sudo rm /var/www
sudo ln -s /var/sites/$site /var/www

April 28, 2011 at 11:40 AM in Development, Linux

[Patch] CodeIgniter Helper class patch for Textile

For those that do not follow me on twitter (@pacifika), I’ve created a patched version of Textile, the html generator alternative to Markdown, to make it easier to use in CodeIgniter projects. I have provided the patch and patched Textile on support forums of both projects.

[Patch] CodeIgniter Helper class patch for classTextile.php · Textpattern CMS Support Forum.

After patching, you can just use Textile like this:

$text = Textile("Dude this is *my* code!");

For more information read the post on the forums!

April 26, 2011 at 2:51 PM in PHP

How To Search for Asterisk in Excel

A while ago I had to normalize values in an Excel sheet where some of the values contained an asterisk (*) and some did not. However it’s not immediately clear how to search for a asterisk. It turns out the escape character is a tilde so searching for ~* is the correct way to do this.

Searching for ~* to search for an asterisk in excel

Searching for ~* to search for an asterisk in excel

April 21, 2011 at 12:14 PM in Windows

iTunes App Updates Sync

Wouldn’t it be useful if iTunes would (have at least the option to) sync app updates to your device automatically after downloading them? How often I have forgot to sync and find out later in the day that my apps are still out of date.

April 13, 2011 at 10:25 AM in macOS, Windows

Intranet Migration Strategy

Next week we’re turning off our old intranet site so I have setup a “Migration Switch” and a redirection page so that from the moment we turn off the site people will not be able to access it. Because if we actually turn off the site we would receive phonecalls with people needing access to their lost data, and because certain parts of the old intranet are reused in our new one, we instead check if the page is embedded, and if it’s not check that the user is on a whitelist of specifically allowed users (us). If this is not the case we redirect them.

Next week we will remove all navigation links to the old intranet, turn on the switch, and remove the documents from the search indexer on the (new) intranet. There must be better terminology for old and new intranet.

Hopefully this will ensure that everything works smoothly.

April 13, 2011 at 10:41 AM in Development

Create an Avatar Specific Communication Channel

Sometimes you will want to create a listener that will not interfere with any other avatar using the same object near you. The basic solution of detecting the owner creates a lot of overhead, therefore a better solution is to have individual channels.

Thanks to Winter Seale, on the SecondLife scripters mailing list:

use an avatar specific
channel. To do that I would define a function:

integer get_channel(key avatar, integer offset){
 return (integer)("0x"+llGetSubString((string)llGetOwnerKey(),-8,-1))
 + offset

Then in your script, use:

 llSay( get_channel( llDetectedKey(number), -1234 ), (string)llDetectedKey(number) );
 llListen( get_channel( llGetOwner(), -1234 ), "", "", "");

* The reason this is better is that it keeps only one script (the
avatar’s) listening on this channel. Without this, a script for every
person with a HUD would have to execute code every time your in world
object was touched.

April 5, 2011 at 10:27 AM in Second Life