qexo-general
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qexo-general] Flakiness


From: Eric Safern
Subject: [Qexo-general] Flakiness
Date: Thu, 16 Jan 2003 21:16:55 -0800
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.2a) Gecko/20020910

I've changed around my program a little, and all of a sudden it
has started flaking out on me.  It runs and works perfectly some of
the time, but sometimes gives me flaky results - either an empty file, with just the headers, or two-three cookies from different locations in the file other times.

Here's the code:

define function Rand ($mn, $mx) {
let
        $x := $mx - $mn + 1,
        $rnd := java.util.Random:nextInt(java.util.Random:new(), $x),
        $rnd := $rnd + $mn

return ($rnd)
}

define function RenderPage($dat) {
let
        $newline := "
",
{--     $header1 := response-content-type('text/xml'), --}
        $header1 := "",
$header2 := unescaped-data("<?xml-stylesheet type='text/xsl' href='/style/GetFortune.xsl'?>"), $header3 := unescaped-data("<?xml-stylesheet type='text/css' href='/style/GetFortune.css'?>"),
        $header4 := unescaped-data("<?xml version='1.0' ?>"),
        $header5 := "",
        $header6 := "",

$txt := ($header1, $newline, $header2, $newline, $header3, $newline, $header4, $newline, $header5, $newline, $header6, $newline, $dat, $newline)

return ($txt)
}

define function GetFortune($tp) {

let
$cookies := document("/var/www/html/fortunes.xml")/fortunes/address@hidden/cookie,
        $min := 1,
        $max := count($cookies)

return
        if ($max = 0) then ("We're so sorry! We
have nothing to say about the topic '", $tp, ".'") else $cookies [ Rand($min,$max) ]
}


{--     $tp :=  $command-line-arguments[1], --}
{--     $tp := invoke($request,"getQueryString"), --}
{--     $tp := "art", --}
let
        $tp := "art",
$dat := if ($tp = "ListAllTypes") then document("/var/www/html/fortunes.xml")/fortunes/list/@type else GetFortune($tp)

return
        RenderPage ($dat)


Here's the output:

address@hidden work]$ ./RunIt GetFortune.xql
we have arguments, running GetFortune.xql

<?xml-stylesheet type='text/xsl' href='/style/GetFortune.xsl'?>
<?xml-stylesheet type='text/css' href='/style/GetFortune.css'?>
<?xml version='1.0' ?>



address@hidden work]$ ./RunIt GetFortune.xql
we have arguments, running GetFortune.xql

<?xml-stylesheet type='text/xsl' href='/style/GetFortune.xsl'?>
<?xml-stylesheet type='text/css' href='/style/GetFortune.css'?>
<?xml version='1.0' ?>


<cookie src="art" id="art-98">
        <text>
                Good night, Mrs. Calabash, wherever you are.
        </text>
</cookie>
address@hidden work]$ ./RunIt GetFortune.xql
we have arguments, running GetFortune.xql

<?xml-stylesheet type='text/xsl' href='/style/GetFortune.xsl'?>
<?xml-stylesheet type='text/css' href='/style/GetFortune.css'?>
<?xml version='1.0' ?>



address@hidden work]$ ./RunIt GetFortune.xql
we have arguments, running GetFortune.xql

<?xml-stylesheet type='text/xsl' href='/style/GetFortune.xsl'?>
<?xml-stylesheet type='text/css' href='/style/GetFortune.css'?>
<?xml version='1.0' ?>


<cookie src="art" id="art-211">
        <text>
                Jim, it's Grace at the bank.  I
checked your Christmas Club account.
You don't have five-hundred dollars. You have fifty. Sorry, computer foul-up!
        </text>
        <author>
                "The Rockford Files"
        </author>
</cookie><cookie src="art" id="art-401">
        <text>
                TV is chewing gum for the eyes.
        </text>
        <author>
                Frank Lloyd Wright
        </author>
</cookie>
address@hidden work]$

here's a little input, if you would like to test it yourselves:

<?xml version="1.0" encoding="US-ASCII" standalone="no"?>
<!DOCTYPE fortunes SYSTEM "http://linux.timebytes.com/dtds/fortunes.dtd";>
<fortunes xml:lang="en-US">>
<list type="art">
<cookie src="art" id="art-1">
        <text>
                fortune 1
        </text>
</cookie>
<cookie src="art" id="art-2">
        <text>
                fortune 2
        </text>
</cookie>
<cookie src="art" id="art-3">
        <text>
A celebrity is a person who is known for his well-knownness.
        </text>
</cookie>
<cookie src="art" id="art-4">
        <text>
                fortune 4
        </text>
</cookie>
</list>
</fortunes>


Any thoughts are welcome!





reply via email to

[Prev in Thread] Current Thread [Next in Thread]