Loading ...
Sorry, an error occurred while loading the content.

Re: Does Ajile use synch or asynch script loading?

Expand Messages
  • iskitzdev
    Hi Andrea, Thanks for the suggestion, I appreciate the feedback, but I m not sure I completely follow. Could you elaborate a bit on what you mean by
    Message 1 of 13 , Feb 1, 2007
    • 0 Attachment
      Hi Andrea,
      Thanks for the suggestion, I appreciate the feedback, but I'm not sure
      I completely follow. Could you elaborate a bit on what you mean by
      independent and "easily identify what changes and what does not"?

      Thanks,
      Michael

      --- In ajile@yahoogroups.com, "Andrea" <aercolino@...> wrote:
      >
      > A little suggestion about the examples you include in the distribution.
      > They should be independent, so that one can easily identify what
      > changes and what does not.
      >
    • iskitzdev
      Hi Andrea, Thanks for the kind words, I like my coding style too, go figure! :-D Positive feedback is really encouraging. Sorry for this very delayed
      Message 2 of 13 , Feb 1, 2007
      • 0 Attachment
        Hi Andrea,
        Thanks for the kind words, I like my coding style too, go figure! :-D
        Positive feedback is really encouraging. Sorry for this very delayed
        response, but I've had a really busy last few weeks, doesn't look like
        that will change much.

        Your Chili script/module sounds interesting. I took a brief peek at it
        and thought about using it on Ajile's Examples page, but haven't
        gotten around to integrating it as yet.

        I did try Dean's packer, the downloadable HTA version, and found some
        issues with how it compressed Ajile. I'm fairly confident that there
        are no syntax violations, warnings or other issues with the way I've
        written Ajile, so I don't know if it's just a bug with the other
        developer's porting of packer to HTA. The 15 KB size you've mentioned
        is definitely tempting :-)

        As you've seen, I do a lot of things in Ajile and I need to be sure
        that I can rely on the compressor to preserve that logic. So far my
        modified version of Brain Jar's Crunchinator [
        http://www.brainjar.com/js/crunch/ ] works fast and reliably enough in
        Firefox, tough it too encounters problems when used in other browsers
        (i.e. Opera & IE).

        I like your suggestion for a "lite" version of Ajile though I didn't
        realize that the size was an issue (32 KB w/ current compression).
        I'll try to look into this Ajile Lite possibility, but namespaces are
        a key part to it's core Importing feature so the "lite" version as
        you've described would essentially just be a dynamic loader. Not an
        issue, but I'd probably want to modify Ajile's overall design to make
        the dynamic loading it's core/basic feature with Importing and
        Namespaces as optional runtime inclusions... Needs more thought, it's
        definitely something I'll consider for the 1.0 release, though I
        expect to make other releases before reaching that major milestone.


        Michael

        --- In ajile@yahoogroups.com, "Andrea" <aercolino@...> wrote:
        >
        > Thanks for posting the uncompressed source, which reveals at least
        > all the hard work you did for Ajile! I like your coding style :-) It
        > seems a good piece of software.
        >
        > I'm going to try and implement it in Chili.
        >
        > I need a solution to automatically load dependencies. Chili 1.x is a
        > simple code highlighter that depends upon jQuery, and two additional
        > files (.js + .css) for each language to highlight. So the number of
        > files to load in a page for a Chili 1.x setup is n = 2 + 2 L. It
        > already manages quite well at loading all the 2 L files, using the
        > jQuery.getScript for .js files and the head tag method for .css
        >
        > Chili 2.0 will offer support for mixed language code (like html +
        > javascript, php + html + javascript, ...), and support for external
        > files (i.e. the code to highlight is not embedded in the page). I
        > want to implement the mixed language feature by means of a modular
        > approach, where for example the html recipe (a json language
        > definition file) delegates the parsing of javascript parts to the
        > javascript recipe, which would be loaded on demand.
        >
        > I liked the idea of loading an additional recipe only when the Chili
        > engine comes to a step that requires it, even though I can change my
        > mind and define the recipe format so that all the dependencies are
        > declared at the start of the recipe. This is not a perfectly dynamic
        > solution, because the dependencies will be loaded even if the
        > particular code to highlight does not need them.
        >
        > jQuery does not offer support for dependencies (and its ajax module
        > is not very flexible). They plan to do it in the near future though,
        > but I don't know what they mean with "dependency support", because
        > they want to do it in 500 (five hundred) bytes...
        >
        > I'm not greatly concerned about the size of the libraries, but Ajile
        > is quite a big one. If I find it useful for Chili, I'd like to have
        > it at least compressed with Dean Edward's packer, which makes ajile
        > 15 KB. Did you try it?
        >
        > And do you think it could be possible for you to extract a "lite"
        > version of Ajile? Something much simpler, without namespaces support,
        > with just one method for recursively loading scripts on demand.
        >
        > --Andrea
        >
        >
        > --- In ajile@yahoogroups.com, "iskitzdev" <iskitzdev@> wrote:
        > >
        > > Hi Andrea,
        > > Sorry I didn't get back to you earlier, busy, busy, busy.
        > >
        > > It looks like I did make at least one mistake in that snippet of
        > code.
        > > You're right that there'll be 2 listeners for A's import. That in
        > > itself shouldn't be a problem. With Ajile there's a listener
        > > preference, listeners are notified in the order that they were
        > registered.
        > >
        > > The code should've looked like this:
        > >
        > > importJSON("A");
        > > Ajile.AddImportListener("A", main);
        > >
        > > Regarding Ajile's synchronous/asynchronous behavior:
        > > When doing dynamic script loading via DOM manipulation (no
        > > XMLHttpRequest) the JavaScript engine within browsers currently
        > > requires that the execution path that initiated the dynamic loading
        > > complete before the engine can move on to actually process the newly
        > > loaded script. This inherent browser behavior and the lack on a
        > > reliable script.onload event creates the requirement for a
        > > listener/callback to notify once that load has actually completed.
        > > Without it code will generate "<variable> undefined" errors since
        > > those variables won't have been processed when the code that access
        > > them is executed.
        > >
        > > Hope that makes sense, you may have already realized/known this.
        > >
        > > Though I haven't as yet seen code that demonstrates the whole
        > process
        > > of how you actually interact/use your JSON objects, I don't see why
        > > Ajile can't be used to implement the solution. Can you explain
        > exactly
        > > what're you're trying to do (the goal) outside of using Ajile or any
        > > other solution? It would really help me to possibly identify a
        > solution.
        > >
        > > Perhaps Ajile needs to have an ImportJSON or similar directive to
        > > support cases like yours; you shouldn't have to jump through hoops
        > to
        > > import JSON data; it needs some thought.
        > >
        > >
        > > -Michael
        > >
        > > --- In ajile@yahoogroups.com, "Andrea" <aercolino@> wrote:
        > > >
        > > > Thanks for answering Mike.
        > > >
        > > > I see your method, and it looks interesting, but I cannot find
        > the
        > > > call to ImportJSON. Maybe your code should read:
        > > >
        > > > ImportJSON("A");
        > > > Ajile.AddImportListener("A", main);
        > > >
        > > > If this is what you meant then there are two listeners on the
        > same "A
        > > > is loaded" event: one for main() and one for LoadLeafs(). That is
        > not
        > > > bad a concept in general, but in this case I think it is, because
        > main
        > > > () really needs LoadLeafs() to have finished before starting.
        > > >
        > > > The listeners setup reveals that AJILE is asynch script loading,
        > I
        > > > guess.
        > > >
        > > >
        > > > --- In ajile@yahoogroups.com, "iskitzdev" <iskitzdev@> wrote:
        > > > >
        > > > > Hi Andrea,
        > > > > Just saw your 2nd message.
        > > > >
        > > > > Since JSON objects are essentially anonymous object instances
        > you'll
        > > > > need to make them self-defining in order for them to
        > be "importable"
        > > > > in the browser-based JavaScript environment Ajile is made for.
        > > > >
        > > > > NOTE: In the following code the object's name and filename must
        > be
        > > > the
        > > > > same case if working in a case-sensitive environment like UNIX.
        > > > >
        > > > > Where A.js is defined as:
        > > > >
        > > > > { name: "A", req: "B", data: {...}, self: window[name] = this };
        > > > >
        > > > >
        > > > > Use the following (untested) to import your custom JSON objects
        > with
        > > > > Ajile:
        > > > >
        > > > >
        > > > > function importJSON(name)
        > > > > {
        > > > > Import(name);
        > > > > Ajile.AddImportListener(name, loadLeaves);
        > > > >
        > > > > function loadLeaves(objName)
        > > > > {
        > > > > var reqs = window[objName].req;
        > > > >
        > > > > for(var req in reqs)
        > > > > if(typeof(window[req]) == "undefined")
        > > > > importJSON(req);
        > > > > }
        > > > > }
        > > > >
        > > > >
        > > > > Import("A");
        > > > > Ajile.AddImportListener("A", main);
        > > > >
        > > > > function main() {
        > > > > for( var leaf in A.leafs )
        > > > > alert( leaf.data );
        > > > > }
        > > > >
        > > > > I don't have all of the information about how you use your JSON
        > > > > objects' members or if they even have to be JSON objects so
        > this is
        > > > > the best answer I can give at this time.
        > > > >
        > > > > Hope that helps,
        > > > > Michael
        > > > >
        > > > >
        > > > > --- In ajile@yahoogroups.com, "Andrea" <aercolino@> wrote:
        > > > > >
        > > > > > Actually, is less dramatic.
        > > > > > Processing need to wait until all the tree is loaded.
        > > > > >
        > > > > > Example files:
        > > > > > file a.js: { name: "A", req: "b.js", data: {...} }
        > > > > > file b.js: { name: "B", req: ["c.js", "d.js"], data: {...} }
        > > > > > file c.js: { name: "C", data: {...} }
        > > > > > file d.js: { name: "D", req: ["a.js", "e.js"], data: {...} }
        > > > > > file e.js: { name: "E", data: {...} }
        > > > > >
        > > > > > Example program:
        > > > > > function main() {
        > > > > > var tree = import( "A" );
        > > > > > for( var leaf in tree.leafs )
        > > > > > alert( leaf.data );
        > > > > > }
        > > > > >
        > > > > > If the import is asynch the program will fail.
        > > > > >
        > > > >
        > > >
        > >
        >
      • Andrea
        Compression ----- The online version of Dean Edwards packer is the one. The downloadable version was somewhat buggy for me too. I m using it extensively, and
        Message 3 of 13 , Feb 6, 2007
        • 0 Attachment
          Compression ----- The online version of Dean Edwards' packer is the
          one. The downloadable version was somewhat buggy for me too. I'm
          using it extensively, and I still have no issues. They say something
          weird about ";" for terminating expressions, for example that a ";"
          is needed after a "}" if this is the end of an object rather than of
          a block, which makes sense.

          Examples ----- What I meant by "independent examples", is that the
          way they are now, it's rather difficult for me to understand the
          setup, or the minimal setup if you like. I'd like to see many
          examples that increase in complexity rather than one complex (or
          multiple) example, for at least two reasons: (1), I can find the
          complexity level I'm interested in, and peruse the examples from that
          to lower levels, and (2) I can grasp how each functionality changes
          the code. This can be done if I can clearly see all the execution
          path from the page to the result (an alert?), which I think should be
          easy with many folders, whose mostly duplicated files add info really
          rather than redundancy.


          News ----- Yesterday I've released Goon. [
          http://www.mondotondo.com/aercolino/noteslog/?page_id=113 ]
          It's what I needed for Chili: simple (one function) and short (2KB).
          It's kind of the Ajile lite I suggested, but it really doesn't share
          much with Ajile, except the script loading functionality.


          --Andrea



          --- In ajile@yahoogroups.com, "iskitzdev" <iskitzdev@...> wrote:
          >
          > Hi Andrea,
          > Thanks for the kind words, I like my coding style too, go
          figure! :-D
          > Positive feedback is really encouraging. Sorry for this very
          delayed
          > response, but I've had a really busy last few weeks, doesn't look
          like
          > that will change much.
          >
          > Your Chili script/module sounds interesting. I took a brief peek at
          it
          > and thought about using it on Ajile's Examples page, but haven't
          > gotten around to integrating it as yet.
          >
          > I did try Dean's packer, the downloadable HTA version, and found
          some
          > issues with how it compressed Ajile. I'm fairly confident that there
          > are no syntax violations, warnings or other issues with the way I've
          > written Ajile, so I don't know if it's just a bug with the other
          > developer's porting of packer to HTA. The 15 KB size you've
          mentioned
          > is definitely tempting :-)
          >
          > As you've seen, I do a lot of things in Ajile and I need to be sure
          > that I can rely on the compressor to preserve that logic. So far my
          > modified version of Brain Jar's Crunchinator [
          > http://www.brainjar.com/js/crunch/ ] works fast and reliably enough
          in
          > Firefox, tough it too encounters problems when used in other
          browsers
          > (i.e. Opera & IE).
          >
          > I like your suggestion for a "lite" version of Ajile though I didn't
          > realize that the size was an issue (32 KB w/ current compression).
          > I'll try to look into this Ajile Lite possibility, but namespaces
          are
          > a key part to it's core Importing feature so the "lite" version as
          > you've described would essentially just be a dynamic loader. Not an
          > issue, but I'd probably want to modify Ajile's overall design to
          make
          > the dynamic loading it's core/basic feature with Importing and
          > Namespaces as optional runtime inclusions... Needs more thought,
          it's
          > definitely something I'll consider for the 1.0 release, though I
          > expect to make other releases before reaching that major
          milestone.
          >
          >
          > Michael
          >
          > --- In ajile@yahoogroups.com, "Andrea" <aercolino@> wrote:
          > >
          > > Thanks for posting the uncompressed source, which reveals at
          least
          > > all the hard work you did for Ajile! I like your coding style :-)
          It
          > > seems a good piece of software.
          > >
          > > I'm going to try and implement it in Chili.
          > >
          > > I need a solution to automatically load dependencies. Chili 1.x
          is a
          > > simple code highlighter that depends upon jQuery, and two
          additional
          > > files (.js + .css) for each language to highlight. So the number
          of
          > > files to load in a page for a Chili 1.x setup is n = 2 + 2 L. It
          > > already manages quite well at loading all the 2 L files, using
          the
          > > jQuery.getScript for .js files and the head tag method for .css
          > >
          > > Chili 2.0 will offer support for mixed language code (like html +
          > > javascript, php + html + javascript, ...), and support for
          external
          > > files (i.e. the code to highlight is not embedded in the page). I
          > > want to implement the mixed language feature by means of a
          modular
          > > approach, where for example the html recipe (a json language
          > > definition file) delegates the parsing of javascript parts to the
          > > javascript recipe, which would be loaded on demand.
          > >
          > > I liked the idea of loading an additional recipe only when the
          Chili
          > > engine comes to a step that requires it, even though I can change
          my
          > > mind and define the recipe format so that all the dependencies
          are
          > > declared at the start of the recipe. This is not a perfectly
          dynamic
          > > solution, because the dependencies will be loaded even if the
          > > particular code to highlight does not need them.
          > >
          > > jQuery does not offer support for dependencies (and its ajax
          module
          > > is not very flexible). They plan to do it in the near future
          though,
          > > but I don't know what they mean with "dependency support",
          because
          > > they want to do it in 500 (five hundred) bytes...
          > >
          > > I'm not greatly concerned about the size of the libraries, but
          Ajile
          > > is quite a big one. If I find it useful for Chili, I'd like to
          have
          > > it at least compressed with Dean Edward's packer, which makes
          ajile
          > > 15 KB. Did you try it?
          > >
          > > And do you think it could be possible for you to extract a "lite"
          > > version of Ajile? Something much simpler, without namespaces
          support,
          > > with just one method for recursively loading scripts on demand.
          > >
          > > --Andrea
          > >
        • iskitzdev
          Hi Andrea, Thanks for the info. I ll look into Dean s online version, but I d rather use an off-line tool. About the Examples. I think I understand but am not
          Message 4 of 13 , Feb 10, 2007
          • 0 Attachment
            Hi Andrea,
            Thanks for the info.

            I'll look into Dean's online version, but I'd rather use an off-line tool.

            About the Examples. I think I understand but am not quite sure. It may
            be that we have different ways of learning/explaining things. I'm
            basing that on my first impressions after looking at Goon and how
            you've implemented and documented it ;-)

            I meant for the examples to be simple and straightforward, but I did
            make the assumption that the user/reader would be fairly familiar with
            JavaScript and it's variations and so also tried to avoid redundant
            code, as it clutters in my mind and understanding. You do make good
            points about being able to identify specific complexity levels and
            work backwards or forwards from there.

            It sounds like what you're asking for may be a full code-supplemented
            explanation of each of Ajile's features, namely: Dynamic Loading,
            Namespacing, Importing, Packaging, Versioning, Cloaking, Debugging,
            Options, etc. Just thinking about that amount of work is making me
            tired :-) I would need help or quite a bit of time as I'm in the midst
            of other projects - of course my own fault :-).

            Goon looks interesting. I took a quick peak. Haven't fully wrapped my
            head around how it works, but it seems to work well with your samples.
            The core script element creation is clear but I'd need to look at the
            script relationships and operation sequence to fully grasp your
            approach. Either way, I'm glad you were able to create what you needed!

            Thanks for all the feedback so far. Hopefully I can address some of
            your needs/concerns in a future release. I intend to further simplify
            use and understanding, but expect that to involve a good deal of work.

            -Michael

            --- In ajile@yahoogroups.com, "Andrea" <aercolino@...> wrote:
            >
            > Compression ----- The online version of Dean Edwards' packer is the
            > one. The downloadable version was somewhat buggy for me too. I'm
            > using it extensively, and I still have no issues. They say something
            > weird about ";" for terminating expressions, for example that a ";"
            > is needed after a "}" if this is the end of an object rather than of
            > a block, which makes sense.
            >
            > Examples ----- What I meant by "independent examples", is that the
            > way they are now, it's rather difficult for me to understand the
            > setup, or the minimal setup if you like. I'd like to see many
            > examples that increase in complexity rather than one complex (or
            > multiple) example, for at least two reasons: (1), I can find the
            > complexity level I'm interested in, and peruse the examples from that
            > to lower levels, and (2) I can grasp how each functionality changes
            > the code. This can be done if I can clearly see all the execution
            > path from the page to the result (an alert?), which I think should be
            > easy with many folders, whose mostly duplicated files add info really
            > rather than redundancy.
            >
            >
            > News ----- Yesterday I've released Goon. [
            > http://www.mondotondo.com/aercolino/noteslog/?page_id=113 ]
            > It's what I needed for Chili: simple (one function) and short (2KB).
            > It's kind of the Ajile lite I suggested, but it really doesn't share
            > much with Ajile, except the script loading functionality.
            >
            >
            > --Andrea
            >
            >
            >
            > --- In ajile@yahoogroups.com, "iskitzdev" <iskitzdev@> wrote:
            > >
            > > Hi Andrea,
            > > Thanks for the kind words, I like my coding style too, go
            > figure! :-D
            > > Positive feedback is really encouraging. Sorry for this very
            > delayed
            > > response, but I've had a really busy last few weeks, doesn't look
            > like
            > > that will change much.
            > >
            > > Your Chili script/module sounds interesting. I took a brief peek at
            > it
            > > and thought about using it on Ajile's Examples page, but haven't
            > > gotten around to integrating it as yet.
            > >
            > > I did try Dean's packer, the downloadable HTA version, and found
            > some
            > > issues with how it compressed Ajile. I'm fairly confident that there
            > > are no syntax violations, warnings or other issues with the way I've
            > > written Ajile, so I don't know if it's just a bug with the other
            > > developer's porting of packer to HTA. The 15 KB size you've
            > mentioned
            > > is definitely tempting :-)
            > >
            > > As you've seen, I do a lot of things in Ajile and I need to be sure
            > > that I can rely on the compressor to preserve that logic. So far my
            > > modified version of Brain Jar's Crunchinator [
            > > http://www.brainjar.com/js/crunch/ ] works fast and reliably enough
            > in
            > > Firefox, tough it too encounters problems when used in other
            > browsers
            > > (i.e. Opera & IE).
            > >
            > > I like your suggestion for a "lite" version of Ajile though I didn't
            > > realize that the size was an issue (32 KB w/ current compression).
            > > I'll try to look into this Ajile Lite possibility, but namespaces
            > are
            > > a key part to it's core Importing feature so the "lite" version as
            > > you've described would essentially just be a dynamic loader. Not an
            > > issue, but I'd probably want to modify Ajile's overall design to
            > make
            > > the dynamic loading it's core/basic feature with Importing and
            > > Namespaces as optional runtime inclusions... Needs more thought,
            > it's
            > > definitely something I'll consider for the 1.0 release, though I
            > > expect to make other releases before reaching that major
            > milestone.
            > >
            > >
            > > Michael
            > >
            > > --- In ajile@yahoogroups.com, "Andrea" <aercolino@> wrote:
            > > >
            > > > Thanks for posting the uncompressed source, which reveals at
            > least
            > > > all the hard work you did for Ajile! I like your coding style :-)
            > It
            > > > seems a good piece of software.
            > > >
            > > > I'm going to try and implement it in Chili.
            > > >
            > > > I need a solution to automatically load dependencies. Chili 1.x
            > is a
            > > > simple code highlighter that depends upon jQuery, and two
            > additional
            > > > files (.js + .css) for each language to highlight. So the number
            > of
            > > > files to load in a page for a Chili 1.x setup is n = 2 + 2 L. It
            > > > already manages quite well at loading all the 2 L files, using
            > the
            > > > jQuery.getScript for .js files and the head tag method for .css
            > > >
            > > > Chili 2.0 will offer support for mixed language code (like html +
            > > > javascript, php + html + javascript, ...), and support for
            > external
            > > > files (i.e. the code to highlight is not embedded in the page). I
            > > > want to implement the mixed language feature by means of a
            > modular
            > > > approach, where for example the html recipe (a json language
            > > > definition file) delegates the parsing of javascript parts to the
            > > > javascript recipe, which would be loaded on demand.
            > > >
            > > > I liked the idea of loading an additional recipe only when the
            > Chili
            > > > engine comes to a step that requires it, even though I can change
            > my
            > > > mind and define the recipe format so that all the dependencies
            > are
            > > > declared at the start of the recipe. This is not a perfectly
            > dynamic
            > > > solution, because the dependencies will be loaded even if the
            > > > particular code to highlight does not need them.
            > > >
            > > > jQuery does not offer support for dependencies (and its ajax
            > module
            > > > is not very flexible). They plan to do it in the near future
            > though,
            > > > but I don't know what they mean with "dependency support",
            > because
            > > > they want to do it in 500 (five hundred) bytes...
            > > >
            > > > I'm not greatly concerned about the size of the libraries, but
            > Ajile
            > > > is quite a big one. If I find it useful for Chili, I'd like to
            > have
            > > > it at least compressed with Dean Edward's packer, which makes
            > ajile
            > > > 15 KB. Did you try it?
            > > >
            > > > And do you think it could be possible for you to extract a "lite"
            > > > version of Ajile? Something much simpler, without namespaces
            > support,
            > > > with just one method for recursively loading scripts on demand.
            > > >
            > > > --Andrea
            > > >
            >
          Your message has been successfully submitted and would be delivered to recipients shortly.