0

Compiling PHP on Centos

Posted by admin on Nov 30, 2009 in Database, Unix

The precompiled PHP binary does not include MySQL support so it must be recompiled from source.

Download the PHP package and untar it

Download the httpd headers
yum install httpd-devel

Configure
./configure –with-mysql=/usr/bin/ –with-libdir=lib64
–with-apxs2 –with-pic –without-aolserver

make
make test
make install
edit http.conf

LoadModule php5_module        /usr/lib64/httpd/modules/libphp5.so

AddType application/x-httpd-php .php

Alias /php/ "/var/www/html/php/htdocs/"
<Directory "/var/www/html/php/htdocs/">
   Options Indexes FollowSymlinks
   AllowOverride All
   <LimitExcept POST GET>
      Order deny,allow
      Deny from all
   </LimitExcept>
</Directory>

ScriptAlias /cgi-php/ "/var/www/html/php/"
<Directory "/var/www/html/php/">
SetEnv LD_LIBRARY_PATH /opt/oracle/product/10.2.0/client_1/lib32
   Options +ExecCGI
   AllowOverride None
   <LimitExcept POST GET>
      Order deny,allow
      Deny from all
   </LimitExcept>
</Directory>

Restart the httpd daemon

 
0

Convert DateTime to Date in SQL Server

Posted by admin on Nov 26, 2009 in Uncategorized
SELECT CONVERT(DATETIME, FLOOR(CONVERT(FLOAT, DateField)))

 
0

Adding Raize font in Linux

Posted by admin on Nov 23, 2009 in Unix

Raize is a great font for programming because it is clean and clear. Download it here http://www.raize.com/devtools/tools/raize_font_linux-1.0.tar.gz or here http://www.raize.com/devtools/tools/rzfont.asp and install as follows

Step 1

Untar to ~./fonts or /usr/share/fonts

Step 2

You need to remove the “no-bitmap” link and replace it with the “yes-bitmap” one

# rm /etc/fonts/conf.d/70-no-bitmaps.conf
# ln -s /etc/fonts/conf.avail/70-yes-bitmaps.conf /etc/fonts/conf.d/

Step 3

Then you need to reconfigure the fonts package

# dpkg-reconfigure fontconfig
Cleaning up category truetype..
Cleaning up category type1..
. . .
Updating category cid..
Regenerating fonts cache… done.

Thats all.

Tags:

 
0

Restoring from time machine

Posted by admin on Sep 30, 2009 in Uncategorized

A successful time machine restore will still leave the Hackintosh PC dead because the MBR will be destroyed.

After the restore, use ms-sys to recreate the MBR (sudo ms-sys -m /dev/sda) and set the boot flag to the first primary partition using gparted.
Now use the installation DVD to install Chameleon so it will boot OSX.
This was successful except that the network was unavailable. I tried installing AppleBMC5751ethernet kext from my USB drive but this kept failing. Eventually, I restored the kext from the time machine backup and it was immediately detected.

 
0

Hackintosh Adventures

Posted by admin on Sep 30, 2009 in Uncategorized

Upgrading to 10.5.7 was problematic. My working 10.5.4 install would not have supported the video card which I wanted so I had to bite the bullet.

Steps
Restored from TM backup
Installed iAtkos 7 over the top choosing Voodoo kernel 9.5.0, Chameleon2 and USB kext (No network, No Video)
Successful but the root password has changed and I can’t sudo anymore
Changed root password from install disk
Booted safe -x and visudo to add myself
Now can boot but only from install disk rd=disk0s3 (3rd partition)
Started Linux Mint and installed ms-sys from sourceforge. ms-sys -m /dev/sda to fix mbr
gparted shows boot flag set for OSX partition but still can’t boot
This leaves video which has old drivers and freezes occasionally and network to fix

 
0

Asterisk PBX

Posted by admin on Sep 25, 2009 in Asterisk

Well, I’ve got my simple PBX running Asterisk up and running.

First, I used colinux to install Ubuntu on Windows so that I can share the server. Colinux is really a great system and I’m impressed how stable it is.

I installed Asterisk 1.4 using apt-get and decided against a GUI since there were only 3 files to change. extensions.conf, voicemail.conf and sip.conf.

My dialplan looks like this which allows incoming calls to extension 1000 and if not answered, prompt for 5 to transfer to my mobile or hang on for voicemail.

[globals]

[general]
autofallthrough=yes

[default]
exten => s,1,Verbose(1|Incoming call handler)
exten => s,n,Dial(SIP/1000,20)
exten => s,n,Background(ivr)
exten => s,n,WaitExten(5)
exten => s,n,Voicemail(1000)
exten => s,n,HangUP()

exten => 5,1,Verbose(1|Diversion to mobile)
exten => 5,n,Dial(SIP/sip_proxy/mymobilenumber)
exten => 5,n,HangUP()
exten => t,1,Voicemail(1000)
exten => t,n,HangUP()

exten => i,1,Voicemail(1000)
exten => i,n,HangUP()

[outgoing_calls]
exten => _X.,1,NoOp()
exten => _X.,n,Dial(SIP/sip_proxy/${EXTEN})

[internal]
exten => 1000,1,Verbose(1|Extension 1000)
exten => 1000,n,Dial(SIP/1000,30)
exten => 1000,n,Hangup()

exten => 2000,1,Verbose(1|Extension 2000)
exten => 2000,n,Dial(SIP/2000,30)
exten => 2000,n,Hangup()

exten => 9999,1,Verbose(1|Listen to voicemail)
exten => 9999,n,VoiceMailMain(1000)
exten => 9999,n,Hangup()

[phones]
include => internal
include => outgoing_calls

I have 2 ATAs configured as the extensions 1000 (Linksys 3102) and 2000 (Grandstream Handytone 486) and these are on my engin VoIP service. sip.conf looks like this.

[1000]
; Office (Linksys 3102)
disallow=all
allow=ulaw
allow=alaw
canreinvite=no
context=phones
dtmfmode=rfc2833
host=dynamic
incominglimit=1
nat=never
;port=5060 ; we could use port 5061 rather than 5060
qualify=yes
secret=password
type=friend
username=1000 

[2000]
; Home phone (Grandstream)
disallow=all
allow=ulaw
canreinvite=no
context=phones
dtmfmode=rfc2833
host=dynamic
incominglimit=1
nat=never
qualify=yes
secret=password
type=friend
username=2000 

[sip_proxy]
context=default
type = peer
allow=ulaw
allow=alaw
canreinvite=no
dtfmmode=rfc2833
fromuser=myphonenumber
host=apollo.engin.com.au
fromdomain=apollo.engin.com.au
outboundproxy=apollo.engin.com.au
realm=voice.mibroadband.com.au
insecure=invite,port
secret=password
username=myphonenumber

Voicemail is the default IVR which didn’t need much except I’m using ssmtp instead of sendmail.

 
0

Database Stats

Posted by admin on Sep 9, 2009 in Database

The Oracle automated process for gathering statistics is hidden away under schedules. To find if it is active,
SELECT * FROM DBA_SCHEDULER_JOBS;

The stored procedure can be run at another time by SYS using
EXEC DBMS_STATS.GATHER_DATABASE_STATS_JOB_PROC;

 
0

Bulk Rename of Files

Posted by admin on Aug 22, 2009 in Uncategorized

I had a lot of files like .xml.bad which I wanted to rename to .xml

perl -e "use File::Copy; map { $y=$x=$_; $x=~s/\.bad//; File::Copy::mv $y,$x;  } glob ('*.bad');" 

Tags:

 
0

MySQL backup

Posted by admin on Aug 14, 2009 in Database

A good fast backup

mysqldump –all-databases –single-transaction –flush-logs –quick –user=xxx –password=yyy | gzip -4 >backup.gz

 
0

Syntax colors in Cygwin

Posted by admin on Jul 31, 2009 in cygwin

Make sure that the newest version has been downloaded and create a .vimrc file in your home directory with the following lines

syntax enable
set sw=4 ts=4 et
set wildmenu
hi Comment ctermfg=darkgray
hi String  ctermfg=blue

Tags:

Copyright © 2008-2010 Brinsmead Data Services All rights reserved.