Friday, December 18, 2009

APEX Notes

If you want to access a procedure without going through the APEX security, alter wwv_flow_epg_include_mod_local to include your procedure.
I had a simple procedure, that lists all applications, called apex_apps:

CREATE OR REPLACE PROCEDURE apex_030200.apex_apps
AS
BEGIN
FOR i IN (SELECT TRIM(TO_CHAR (display_id)) ID, NAME
FROM apex_030200.wwv_flows
WHERE display_id NOT BETWEEN 4000 AND 5000
ORDER BY NAME)
LOOP
HTP.p ('<li><a href="f?p=' || i.ID || '">' || i.NAME || '</a></li>');
END LOOP;
END;


However, calling this resulted in:
[Fri Dec 18 15:57:12 2009] [error] [client x.x.x.x.] 
mod_plsql: /apex/apex_apps HTTP-403
It is forbidden to call this procedure directly from the browser!

After changing wwv_flow_epg_include_mod_local to

CREATE OR REPLACE function APEX_030200.wwv_flow_epg_include_mod_local(
procedure_name in varchar2)
return boolean
is
begin
-- return false; -- remove this statement when you modify this function
--
-- Administrator note: the procedure_name input parameter may be in the format:
--
-- procedure
-- schema.procedure
-- package.procedure
-- schema.package.procedure
--
-- If the expected input parameter is a procedure name only, the IN list code shown below
-- can be modified to itemize the expected procedure names. Otherwise you must parse the
-- procedure_name parameter and replace the simple code below with code that will evaluate
-- all of the cases listed above.
--
if upper(procedure_name) in (
'APEX_APPS') then
return TRUE;
else
return FALSE;
end if;
end wwv_flow_epg_include_mod_local;

everything works as designed.

Monday, December 14, 2009

My first program

Entry # 100 - celebration? Anyway, ran into probably my first program ever. Machine code, for an MC6800 (6802, actually). Dates back to 1978 or 1979:

inadd: CLRB ; clear count
CLR,X
PUSH B ; count on stack
CLR 1,X
inadd3: BSR INHEX
BMI inadd1
LDB#4
inadd2: ASL 1,X
ROL,X
DEC B
BNE inadd2
PSHS A
ORA 1,X
STA 1,X
PULS A
INC,B ; count
LDB,S
CMPB#S
BNE inadd3
inadd1: LDB,S+ ; b=count0 + #hex counts
RTS

INHEX = INCHNP

It's a counter, that should be able to count over 256, if I recall correctly. Quite complicated when you only have 8 bits. The code may not even be correct, as pencil tends to fade, and recycled paper becomes yellowish brown. Not much contrast there.
Addition: I could try it of course, as I still own a Motorola MEK6800D2 kit...