?

Log in

No account? Create an account
Roy Janik [entries|archive|friends|userinfo]
Roy Janik

[ website | Parallelogramophonograph ]
[ userinfo | livejournal userinfo ]
[ archive | journal archive ]

ain't it strange that I have brain activity? [Dec. 2nd, 2002|05:26 am]
Roy Janik
I just redeemed one weekend of no sleep for "basic functionality of long overdue CS project".
Tomorrow (or whenever I wake up), I'll find the bugs, make some examples, document things, etc.
I'll not post the code here, but here's an example of what the "end user" would be responsible for writing:

<watercups>
    <stream>
        <type>FILE</type>
        <name>TelnetStream</name>
                <filename>data/teldata.txt</filename>
    </stream>

    <stream>
        <type>FILE</type>
        <name>FTPStream</name>
                <filename>data/ftpdata.txt</filename>
    </stream>

    <stream>
        <type>FILE</type>
        <name>HTTPStream</name>
                <filename>data/httpdata.txt</filename>
    </stream>

    <fountain>
        <name>screenout</name>
        <type>CONSOLE</type>
    </fountain>
    <fountain>
        <name>fileout</name>
        <type>file</type>
        <filename>results/alerts.txt</filename>
    </fountain>
    <cup>
        <name>alpha</name>
        <baseline>
            <type>average</type>
        </baseline>
        <rule>
            <operator>UPPER</operator>
            <value>50</value>
            <out>30</out>
        </rule>
        <combine>average</combine>
        <defaultout>5</defaultout>
    </cup>

    <cup>
        <name>beta</name>
        <baseline>
            <type>weighted</type>
            <value>80</value>
            <ramptime>3</ramptime>
            <initial>4242</initial>
        </baseline>
        <rule>
            <operator>VARIES</operator>
            <value>50%</value>
            <out>30</out>
        </rule>
        <rule>
            <operator>UPPER</operator>
            <value>20</value>
            <out>40</out>
            <alert>Crossed upper threshold in beta!</alert>
        </rule>
        <combine>add</combine>
        <defaultout><passthrough/></defaultout>
    </cup>

    <cup>
        <name>gamma</name>
        <baseline>
            <type>hardcoded</type>
            <value>2323</value>
        </baseline>
        <rule>
            <operator>LOWER</operator>
            <value>50%</value>
            <out>30</out>
            <alert>WOOT!!</alert>
        </rule>
        <combine>greatest</combine>
        <defaultout><baselineval/></defaultout>
    </cup>
    <cup>
        <name>omega</name>
        <baseline>
            <type>hardcoded</type>
            <value>7</value>
        </baseline>
        <combine>add</combine>
        <defaultout><passthrough/></defaultout>
    </cup>

    <tube> <from>TelnetStream</from> <to>alpha</to> </tube>
    <tube> <from>TelnetStream</from> <to>beta</to> </tube>
    <tube> <from>TelnetStream</from> <to>gamma</to> </tube>
    <tube> <from>FTPStream</from> <to>alpha</to> </tube>
    <tube> <from>FTPStream</from> <to>beta</to> </tube>
    <tube> <from>FTPStream</from> <to>gamma</to> </tube>
    <tube> <from>HTTPStream</from> <to>alpha</to> </tube>
    <tube> <from>HTTPStream</from> <to>beta</to> </tube>
    <tube> <from>HTTPStream</from> <to>gamma</to> </tube>
    <tube> <from>alpha</from> <to>omega</to> </tube>
    <tube> <from>beta</from> <to>omega</to> </tube>
    <tube> <from>gamma</from> <to>omega</to> </tube>
</watercups>
LinkReply

Comments:
[User Picture]From: vyvyanbasterd
2002-12-02 10:04 am (UTC)
Why didn't you embed the attributes in the tags? For example:

< stream type="FILE" name="TelnetStream" >
(Reply) (Thread)
[User Picture]From: zinereem
2002-12-02 10:30 am (UTC)
It's a religious debate, but the trend is to shy away from attributes. The common wisdom goes that attributes should only be used for meta-data, and that tags should be used for actual data.

So while I could see moving type into an attribute, since it describes what sort of stream we have, name should remain a tag.

<stream type="FILE">
<name>TelnetStream</name>
</stream>

But ultimately I decided that the tags I had specified were too important to call metadata. That is, I needed them to operate properly. Now, if I had something like "createdOn" and "author", data which might be important for reporting purposes, but which the application would not directly use, those bad boys would go in an attribute.

But again, it could go either way. My personal preference is for tags, since they're more extensible. But the only times you have to use tags is when you need to have multiple instances of the same type under one parent, or when the type needs to have sub-children.
(Reply) (Parent) (Thread)
[User Picture]From: vyvyanbasterd
2002-12-02 10:51 am (UTC)
Gotcha; I haven't actually read any of the "philosophy" on XML; I just remember looking at my own schema and saying: "This is more than I need."

I guess I did put those things that were data in their own tags. Sort of the same debate between the "is a" and "has a" relationships.
(Reply) (Parent) (Thread)
[User Picture]From: cailin23
2002-12-02 01:49 pm (UTC)
GEEK ALERT GEEK ALERT GEEK ALERT
(Reply) (Parent) (Thread)
[User Picture]From: vyvyanbasterd
2002-12-02 02:19 pm (UTC)
PEOPLE WITH JOB ALERT PEOPLE WITH JOB ALERT

< /harsh>
(Reply) (Parent) (Thread)
[User Picture]From: zinereem
2002-12-02 02:24 pm (UTC)
Not to be picky, but you should have had a start tag:

<harsh>

PEOPLE WITH JOB ALERT PEOPLE WITH JOB ALERT

</harsh>
(Reply) (Parent) (Thread)
[User Picture]From: vyvyanbasterd
2002-12-02 02:39 pm (UTC)
You forgot the extra braces:



...

(Reply) (Parent) (Thread)
[User Picture]From: cailin23
2002-12-02 09:44 pm (UTC)
you guys are HOMO.

and make WAY MORE MONEY THAN I EVER WILL.
(Reply) (Parent) (Thread)