OS X Icon Sets… For FREE!

Posted in Uncategorized on December 30th, 2006 by Troy

Everybody loves something for nothing, and people who own Apple Mac’s love it even more when that free something is pretty too! … Don’t argue - you know it is true.

I stumbled on this the other day, and it is awesome. There are so many icon libraries here my whole machine is now polluted with things that have no iconic representation of what they are for - but still - they look way cool.

These icons will work on pretty much any OS X box, mac mini’s, powerbooks even XServe’s…

Pixelgirl’s icon sets for OS X machines are here. Yes, she does have some for that other operating system, but lets not talk about that.

Redirecting a subdomain to your site

Posted in Uncategorized on December 30th, 2006 by Troy

So, you want to have something like http://corporate.purpleoranges.com/ automatically work with your CMS or whatever you use and have it redirect to http://www.purpleoranges.com/site/corproate.html or something like that?

Here is a snippet of php code that will do just that. Before this will work - you will need to have a wildcard CNAME setup to point to your web site, and you (if you are using host-header) will need to let your web server know that it should process requests for all these sub domains.


# Redirect Based on domain name
# 061229 Troy Kelly
# This code is covered by a creative commons licence.
# You are free:
# * to Share — to copy, distribute, display, and perform the work
# * to Modify — to make derivative works
# Please see the requirements placed on you here http://creativecommons.org/licenses/by-sa/2.5/au/
$basedomain = ‘my.com’; # The base url for your site DO NOT INCLUDE WWW
# eg if your site is http://www.purpleoranges.com/
# put purpleoranges.com
$appurl = ‘/user.php?username=%sub%’; # Where you want to redirect to at the base URL (above)
# So it will become http://my.com/user.php?username={subdomain}
# Should not need to change the rest…
$basesections = count(explode( ‘.’ , $basedomain ));
$domainparts = explode( ‘.’ , $_SERVER["HTTP_HOST"]); #Get all the parts of the domain into an array
if (count($domainparts) > $basesections) {
if ($domainparts[(count($domainparts) - ($basesections+1))] <> ‘www’) {
$redirect = ‘http://www.’.$basedomain.str_replace(”%sub%”, $domainparts[(count($domainparts) - ($basesections + 1))], $appurl);
header ( “HTTP/1.1 301 Moved Permanently” );
header(”Location: $redirect”);
}
}

Merry XMas

Posted in Uncategorized on December 24th, 2006 by Troy

Torrents on a Mac

Posted in Uncategorized on December 24th, 2006 by Troy

So, you have a shiny silver (or white) Apple Mac running OS X and you want to download a torrent. It really isn’t that hard, so don’t stress. Of course you should only download legal material using your Mac and BitTorrent client, so for the sake of this exercise - our example will assume that you want to download the public domain movie Star Wreck: In the Pirkinning

The first thing you are going to need is a client to download the torrents with. Searching Google returns quite a few applications. Most of them are fairly easy to get up and running, but keep in mind that a lot of them are “works in progress” and still being worked on by different groups of people.

I use Transmission, it is small very easy to install, setup and use. Which ever application you choose to use you will need to “open” or “forward” ports from your router to your Mac. There are some Bit Torrent clients out there that allege they have support for UPnP in the case of the more prominent one, UPnP in the case of the more prominent one, BitRocket, this is a misleading claim as the software in its current form does not actually support UPnP.

Getting back on track… If you have chosen to use Transmission then by default you will need to forward TCP port 9090 to your Mac.

Once you have your software, you may want to flick through the preferences and set where you want to save the downloaded files to, how much bandwidth you want to allow to flow in each direction, and anything else you want to customise. It is important to keep in mind that by the very nature of torrents you should share at least as much as you download. When you are downloading a torrent off the internet, you are not downloading from one central server, but from several other people just like you - who have an interest in the same file. As you get bits and pieces of the file, other people can get those bits and pieces off you.

Now that you have your BitTorrent client up and running, you need to find something to download. As you may be aware, there are some files on the internet that there is ongoing debate over as to the legality for people like you and I to download them, so for today we will be downloading a file that is without a doubt in the public domain.

I like to use a site called torrents.to for my torrent searching, it is a portal to several other sites and is quite easy to use. Once you are at the site, simply enter what you are looking for, select a search engine from the list and click the “Search Torrents” button. For our example, you would type in Star Wreck, select MiniNova as your engine and click the button.

Assuming nothing goes pear shaped you will have a list of the available matching torrents. You would click on one of those and follow the instructions to download the torrent.

This will not actually download the movie, it will simply give you a very small file that ends with the extension .torrent. It is now up to you to drag this file on to your chosen torrent client and let it do the work.

Some torrents take minutes while others take days. It all depends on how many people are interested in the file you want, how much of their bandwidth they decide to share with you, and the quality of the network connectivity between you and them.

It should be said that many of the things covered here have an associated risk with them. Downloading files from the internet and not knowing their original publisher is a risk which can of course be mitigated with virus protection, another risk is opening holes in your firewall. This is not absolutely essential to the operation of torrents, but you will notice significant improvements if you do. As with anything - make sure you understand what is going on enough that you are comfortable before you do it and you should be fine.

Installing VoiceOne / Asterisk on an OS X Server

Posted in Uncategorized on December 21st, 2006 by Troy

This is how to get Asterisk and VoiceOne working on an OS X server box. This is not an idiots guide by any measure… and a lot of assumptions about your technical skills are made.

First of all - you will need to enable MySQL (see link)

Do you have XCode installed? You need that to compile anything… It is here.

If you don’t already have a /usr/src to hold everything in… make one
sudo mkdir /usr/src
sudo chown -R root:admin /usr/src/
sudo chmod 775 /usr/src/

Get Asterisk… and install it
cd /usr/src
 
curl -O http://ftp.digium.com/pub/asterisk/releases/asterisk-1.2.14.tar.gz
 
curl -O http://ftp.digium.com/pub/asterisk/releases/asterisk-addons-1.2.5.tar.gz
 
curl -O http://ftp.digium.com/pub/asterisk/releases/asterisk-sounds-1.2.1.tar.gz
 
find . -name asterisk-\*.tar.gz -exec tar zxvf {} \;
 
cd asterisk-1.2.14
 
#(to isolate the asterisk install - NOT REQUIRED) cat Makefile | sed "s:\?=:\?=/usr/local/asterisk:" > Makefile.new
 
#(if you do the above) mv Makefile.new Makefile
 
make
 
sudo make install
 
cd ../asterisk-addons-1.2.5 && make && sudo make install && cd ..
 
cd asterisk-sounds-1.2.1 && sudo make install && cd ..
 
echo 'asterisk::1026:1026::0:0:Asterisk Server:/dev/null:/bin/bash' | sudo niload -v passwd /
 
echo 'asterisk:*:1026:asterisk' | sudo niload -v group /
 
sudo mkdir /var/run/asterisk
 
curl -O http://superb-west.dl.sourceforge.net/sourceforge/voiceone/voiceone-0.4.2.tar.gz
 
cd /Library/WebServer/Documents/ && tar zxvf /usr/src/voiceone-0.4.2.tar.gz
 
cat voiceone/admin/config/config.inc.php | sed "s:\$soapPassword = \"voiceone\";:\$soapPassword = \"NEW-PASSWORD\";:" > voiceone/admin/config/config.inc.php.new && mv voiceone/admin/config/config.inc.php.new voiceone/admin/config/config.inc.php
 
cat voiceone_webservices/config/config.inc.php | sed "s:\$htaccessPassword=\"voiceone\";:\$htaccessPassword=\"NEW-PASSWORD\";:" > voiceone_webservices/config/config.inc.php.new && mv voiceone_webservices/config/config.inc.php.new voiceone_webservices/config/config.inc.php
 
cat voiceone_webservices/config/config.inc.php | sed "s:\$synDbUser=\"root\";:\$synDbUser=\"voiceone\";:" > voiceone_webservices/config/config.inc.php.new && mv voiceone_webservices/config/config.inc.php.new voiceone_webservices/config/config.inc.php
 
cat voiceone_webservices/config/config.inc.php | sed "s:\$synDbPassword=\"voiceone\";:\$synDbPassword=\"NEW-PASSWORD\";:" > voiceone_webservices/config/config.inc.php.new && mv voiceone_webservices/config/config.inc.php.new voiceone_webservices/config/config.inc.php
 
cat voiceone_webservices/config/script/vo-tools.sh | sed "s:/var/www/html:`pwd`:" > voiceone_webservices/config/script/vo-tools.sh.new && mv voiceone_webservices/config/script/vo-tools.sh.new voiceone_webservices/config/script/vo-tools.sh
 
cat voiceone_webservices/config/script/vo-tools.sh | sed "s:-d \"/proc/\`cat \$AST_RUN_DIR/asterisk.pid\`\":\"\$(ps ax | grep \`cat \$AST_RUN_DIR/asterisk.pid\` \| grep -v grep)\":" > voiceone_webservices/config/script/vo-tools.sh.new && mv voiceone_webservices/config/script/vo-tools.sh.new voiceone_webservices/config/script/vo-tools.sh
 
cat voiceone_webservices/config/script/vo.cfg | sed "s:/usr/sbin/safe_asterisk:\"/System/Library/StartupItems/Asterisk/Asterisk start\":" > voiceone_webservices/config/script/vo.cfg.new && mv voiceone_webservices/config/script/vo.cfg.new voiceone_webservices/config/script/vo.cfg
 
cat voiceone_webservices/config/script/vo.cfg | sed "s:/etc/init.d/asterisk:\"/System/Library/StartupItems/Asterisk/Asterisk\":" > voiceone_webservices/config/script/vo.cfg.new && mv voiceone_webservices/config/script/vo.cfg.new voiceone_webservices/config/script/vo.cfg
 
cat voiceone_webservices/config/script/vo.cfg | sed "s:\"astgenkey:\"`which astgenkey`:" > voiceone_webservices/config/script/vo.cfg.new && mv voiceone_webservices/config/script/vo.cfg.new voiceone_webservices/config/script/vo.cfg

Now you have some file maintaining to do…

In /etc/asterisk create the following files

asterisk.conf

[directories]
astetcdir => /etc/asterisk
astmoddir => /usr/lib/asterisk/modules
astvarlibdir => /var/lib/asterisk
astagidir => /var/lib/asterisk/agi-bin
astspooldir => /var/spool/asterisk
astrundir => /var/run/asterisk
astlogdir => /var/log/asterisk
[files]
astctlpermissions = 0660
astctlowner = asterisk
astctlgroup = asterisk
astctl = asterisk.ctl

logger.conf
[general]
[logfiles]
console => notice,warning,error
messages => notice,warning,error
full => notice,warning,error,debug,verbose

modules.conf
[modules]
autoload=yes
noload => pbx_gtkconsole.so
noload => pbx_kdeconsole.so
noload => chan_modem.so
noload => chan_modem_aopen.so
noload => chan_modem_bestdata.so
noload => chan_modem_i4l.so
load => res_musiconhold.so
noload => chan_alsa.so
preload => res_config_mysql.so
[global]

extconfig.conf
[settings]
extensions.conf => mysql,voiceone,ast_config
iax.conf => mysql,voiceone,ast_config
meetme.conf => mysql,voiceone,ast_config
misdn.conf => mysql,voiceone,ast_config
musiconhold.conf => mysql,voiceone,ast_config
queues.conf => mysql,voiceone,ast_config
sip.conf => mysql,voiceone,ast_config
zapata.conf => mysql,voiceone,ast_config
iaxusers => mysql,voiceone,iax_buddies
iaxpeers => mysql,voiceone,iax_buddies
sipusers => mysql,voiceone,sip_buddies
sippeers => mysql,voiceone,sip_buddies
voicemail => mysql,voiceone,voicemail_users
extensions => mysql,voiceone,extensions_table

res_mysql.conf
NOTE The password in here should match what you used in the section above
[general]
dbhost = localhost
dbname = voiceone
dbuser = voiceone
dbpass = NEW-PASSWORD-FROM-ABOVE
dbport = 3306
dbsock = /private/var/mysql/mysql.sock

cdr_mysql.conf
NOTE The password in here should match what you used in the section above
[global]
hostname=localhost
dbname=voiceone
table=cdr
user=voiceone
password=NEW-PASSWORD-FROM-ABOVE
port=3306
sock=/private/var/mysql/mysql.sock
userfield=1

manager.conf
[general]
enabled = yes
port = 5038
bindaddr = 0.0.0.0
;displayconnects = yes
[admin]
secret=qwerty_123_mnbvc
deny=0.0.0.0/0.0.0.0
permit=127.0.0.1/255.255.255.0
read=system,call,log,verbose,command,agent,user
write=system,call,log,verbose,command,agent,user

Now you need to give VoiceOne (the websever) permission to run a control script as root. This is done with the command “visudo”. Call it as below
sudo visudo
And add the line below to the end of the file
www ALL=NOPASSWD: /Library/WebServer/Documents/voiceone_webservices/config/script/vo-tools.sh

Now we shall create the MySQL database. (This will require your root DB password)
mysqladmin --user=root -p create voiceone

Create the voiceone MySQL user and grant it permissions. Replace the password below with the one you have been using throughout this ordeal
echo "GRANT ALL PRIVILEGES ON voiceone.* TO 'voiceone'@'localhost' IDENTIFIED BY 'NEW-PASSWORD' WITH GRANT OPTION;" | mysql --user=root -p mysql

Some permissions and ownership cleaning
sudo find / -name asterisk -type d -exec chown -R asterisk:asterisk {} \;
sudo find /Library/WebServer/TokyoPV.com/ -name *.sh -exec chmod 755 {} \;
sudo chmod -R 777 /Library/WebServer/TokyoPV.com/voiceone/sandbox
sudo chmod -R 777 /Library/WebServer/TokyoPV.com/voiceone/admin/public/template/cache

Create a startup item for Asterisk…
cd ~
Create the file below - call it mkastgo.sh
#!/bin/bash
mkdir -p /System/Library/StartupItems/Asterisk
cd /System/Library/StartupItems/Asterisk
curl -O http://purpleoranges.com/asterisk/osx/asterisk_startup.txt
curl -O http://purpleoranges.com/asterisk/osx/startupparameters_plist.txt
mv /System/Library/StartupItems/Asterisk/asterisk_startup.txt /System/Library/StartupItems/Asterisk/Asterisk
mv /System/Library/StartupItems/Asterisk/startupparameters_plist.txt /System/Library/StartupItems/Asterisk/StartupParameters.plist
chmod 755 /System/Library/StartupItems/Asterisk/Asterisk
chmod 644 /System/Library/StartupItems/Asterisk/StartupParameters.plist

Now give that file permission to execute and run it as root
chmod 750 mkastgo.sh
sudo ./mkastgo.sh

Now - add Asterisk to the hostconfig file
sudo sh -c 'echo "ASTERISK=-YES-" >> /etc/hostconfig'
And get rid of our shell script
rm -f ./mkastgo.sh

Enabling/Installing MySQL on OS X Server

Posted in Uncategorized on December 21st, 2006 by Troy

Apple’s OSX Server 10.3 and above (that includes 10.4 - you know who you are) comes pre-installed with MySQL Server. You don’t (as many sites suggest) have to install it at all. It is exceptionally simple to enable.

Start Terminal.app (thats the little black window) and then enter the following

Create the MySQL Directories
sudo mkdir /var/mysql
Install the MySQL Databases
sudo mysql_install_db
Make the MySQL user and group the owner of their files
sudo chown -R mysql:mysql /var/mysql
Set MySQL to start at boot
sudo sh -c 'echo "MYSQL=-YES-" >> /etc/hostconfig'
Start MySQL Server
sudo /System/Library/StartupItems/MySQL/MySQL start
Set the root user password
/usr/bin/mysqladmin -u root password 'new-password'

Obviously - change new-password above to something a little more secure

Would Jesus shop at Wal Mart?

Posted in Uncategorized on December 18th, 2006 by Troy

I honestly thought that this advertisement was taking the piss when I came across it. Perhaps because it is almost 1am on a school morning, or maybe because it asks the question “Would Jesus shop at WalMart, should you?”. I read the site to find that it is in fact quite serious.

I think the issues listed on the site that has started this campaign sound serious enough, but I think we really need less religion infused with social commentary at the moment - not more. Look where it has gotten us so far, we have countries tearing themselves apart - all because they believe that their version of some higher being is “more right” then somebody else’s.

I find it so sad that fictitious characters like the ones depicted by many religions can cause such horrible atrocities. At least it gives me advertisements like this to brighten my Monday morning.

Never be bored again

Posted in Uncategorized on December 7th, 2006 by Troy

Well, the title may be a little misleading - but this will sure help you to curtail some of your boredom.

The good folks at The Globe Cast have launched their newest site and it is called simply enough Arcade Center. The site is a great repository of some awesome arcade style Flash games.

If you ever find yourself in need of something to fill some time, go check Arcade Center out.