Latest Entries

mod_plsql XML example

To add a mod_plsql procedure to an Oracle application server is pretty straightforward. The first step is to add the DAD to the server using the console.

After logging into the application server console (http://app:1156) select HTTP_server > Administration > PLSQL > Create DAD.

Add the database connectivity information and restart the server. Then create the stored procedures to access the database and return XML. e.g.

CREATE OR REPLACE PROCEDURE web_getservices (p_account_no varchar2) AS
BEGIN
DECLARE
 ctx    dbms_xmlgen.ctxHandle;
 xml    CLOB;
 amount integer:= 5000;
 position integer := 1;
 charString varchar2(5000); --set to varchar2 max limit

BEGIN

  owa_util.mime_header ('text/xml');
  dbms_lob.createtemporary(
    lob_loc => xml,
    cache => true, -- this is the line to watch
	dur => dbms_lob.session
  );

  ctx := dbms_xmlgen.newContext('SELECT * FROM access_no_details WHERE account_no = '|| p_account_no);
  dbms_xmlgen.setRowTag(ctx, 'row');
  xml := dbms_xmlgen.getXML(ctx);
  dbms_xmlgen.closeContext(ctx);
  if length(xml) > 0 then
    dbms_lob.open(xml,dbms_lob.lob_readonly); -- Open the file in READ_ONLY mode
    loop
      dbms_lob.read(xml,amount,position,charString); --Read until end
      -- DEBUG dbms_output.put_line (charString);
      htp.prn(charString); -- generates the specified string,
      --not terminated with a newline.
      position := position + amount;
    end loop;

  else
    htp.prn('<ROWSET/>');
  end if;

exception
  when no_data_found then
     dbms_lob.close(xml);
     dbms_lob.freetemporary(xml);

  when others then
    htp.prn('<ROWSET><ERROR>'||SQLERRM||'</ERROR></ROWSET>');
END;

END web_getservices;
/

Delete stuck read receipt in Outlook

After changing ISPs in mail setup in Outlook I found that I had a read receipt that was stuck and stopped the normal send and receive.

To fix this, I downloaded MDBVU32.EXE from Microsoft and then followed the instructions here http://www.howto-outlook.com/howto/deletereadreceipt.htm

Basically, log on to the parent window, open the message store, open the root folder, abort and delete.

Works now.

New graphics card

I got a new graphics card for Christmas for my hackintosh. Its an older model Nvidia 8300 GS which has the lowest power consumption I could find so I don’t overload my power supply but still is HDTV ready.

I got it working eventually by configuring the NVCAP using OSXTools and choosing custom and then selecting the memory and DVI/VGA.

Then time machine and airport stopped working of course and I had to reconfigure them. The main task was to remove the /Library/Preferences/SystemConfiguration/NetworkInterfaces.plist file and reboot.

Went to Network System Preferences, tidied up the network interfaces (deleted bluetooth, a serial device, and the Firewire device) and re-configured Time Machine.

I lost all past backups but it now works.

Compiling PHP on Centos

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

Convert DateTime to Date in SQL Server

SELECT CONVERT(DATETIME, FLOOR(CONVERT(FLOAT, DateField)))

Adding Raize font in Linux

Raize is a great font for programming because it is clean and clear. Download it here http://www.mail-archive.com/lazarus@miraclec.com/msg16971/raize_font_linux-1.0.tar.gz
and install as follows

Step 1

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 2

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.

Restoring from time machine

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.

Hackintosh Adventures

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

Asterisk PBX

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.

Database Stats

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;


-->

Search

Enter the query to search and hit enter.


Copyright © 2004–2009. All rights reserved.

RSS Feed. This blog is proudly powered by Wordpress and uses Modern Clix.