You can subscribe to this list here.
2001 |
Jan
|
Feb
|
Mar
|
Apr
(57) |
May
(287) |
Jun
(166) |
Jul
(286) |
Aug
(273) |
Sep
(254) |
Oct
(144) |
Nov
|
Dec
|
---|---|---|---|---|---|---|---|---|---|---|---|---|
2002 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(1) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: Odysseas T. <ody...@ya...> - 2001-07-08 10:09:07
|
But you were right that the rest of the code isn't behaving the way it was supposed to :-) I needed to add a ksort right before the end of the IncludeModules function ksort($this->modules[$_group]); Keep in mind that the the "example" layout that index.php comes with is not following the default order but it explicitly alters it. Thanks for the bug, odysseas --- Justin Farnsworth <je...@ey...> wrote: > alex black wrote: > > > > > Sometimes my mind just falls apart, and I feel > like I am in that > > > state right now. In one of your last posts, you > suggested to > > > get a large/complex bit of data and store it in > a class variable, > > > and then (implied) down the load chain, this > variable can > > > be accessed. > > > > > > HOW? > > > > > $Page->modules['group_name'][load_order]->variable_name > > > > Thus my mention of possibly using unique names in > the page declaration, so > > making references to modules would be more simple. > > > > that would also complicate the page module sorting > functions, so I'm not > > sure it's worth doing that way. it may be a lot > more simple to have a module > > communication manager which is called by a module > that needs something, like > > a really simple Request class. > ================================================= > Alex: > > Oy weh. Now I was var_dump()'ing what you have > above, viz: > > var_dump($Page->modules['top'][0]); > > as I thought that was it after looking at Page.php, > and all I > was getting were NULL's. Of course, of course, I > was > in some decendant class method, and forgot to global > $Page > within the method...... > > But, Alex, you are not going to make us use this > syntax, > are you? No, you are figuring out something with a > bit more elegance, aren't you? :) > > There is _still_ something rotten, at least it seems > so, > in your array sort in Page. This load_order thingy > has, you realize, the weakness, that you can put in > index.php three modules in a 'top' group with > load_order(s) > as: > > EXAMPLE--- > > MOD1 load_order=>69 > MOD2 load_order=>22 > MOD3 load_order=>11 > > and this _should_ map/sort to > > $Page->modules['top'][0] ===> MOD3 > $Page->modules['top'][1] ===> MOD2 > $Page->modules['top'][2] ===> MOD1 > > but it doesn't. No matter what you put in your > load order, the sequence in $Page->modules['top'] > is ALWAYS IN THE ORDER OF the appearance in > index.php. > Anyway, it appears your uasort() thingy is not > working, > and that, specifically, your sorting comparison > function: > > create_function('$a,$b', 'return $a("load_order"] > - $b["load_order"];'); > > must be always returning 0, instead of (-1,0,+1) > accordingly. > > Now I am wondering, with your sorting, IF IT WERE > WORKING, > you have it mechanized, I think, that for my EXAMPLE > above, > admittedly wrong or sloppy, it would create a sparse > array > if the load_order was a number type and not a > number_string (with > quotes). > I think you also need to guard against sparse arrays > somehow. > Well, I haven't tried to "fix" > _IncludeModules($_group) > and see if it does create a sparse array.... > > OK Alex, so in any case, you are going to figure out > some > kind of way to reference _which_ instance of > multiple > loads of the same module easily. The only thing > that > occurs to me quickly is something like adding a tag, > as in: > > array( > 'name' => > "EyeLibrary", > 'package' => "lib", > 'load_order' => 2, > 'tag' => > "TableData", > 'options' => > "option1", > ), > > and then allow reference to that particular module > as: > > $Page->modules['top']['TableData']->method_or_property; > > That is knee-jerk, but gives you something to think > about. > > _jef > > > -- > Justin Farnsworth > Eye Integrated Communications > 321 South Evans - Suite 203 > Greenville, NC 27858 | Tel: (252) 353-0722 > > _______________________________________________ > binarycloud-dev mailing list > bin...@li... > http://lists.sourceforge.net/lists/listinfo/binarycloud-dev __________________________________________________ Do You Yahoo!? Get personalized email addresses from Yahoo! Mail http://personal.mail.yahoo.com/ |
From: Odysseas T. <ody...@ya...> - 2001-07-08 09:18:16
|
The sorting works as expected. Array order and key-value association are two different things in php. uasort doesnot change the key association, i.e., you should not see a 0 indexed element if you didn't original create one with that key. Check the *sort man pages for more info. odysseas > > Oy weh. Now I was var_dump()'ing what you have > above, viz: > > var_dump($Page->modules['top'][0]); > > as I thought that was it after looking at Page.php, > and all I > was getting were NULL's. Of course, of course, I > was > in some decendant class method, and forgot to global > $Page > within the method...... > > But, Alex, you are not going to make us use this > syntax, > are you? No, you are figuring out something with a > bit more elegance, aren't you? :) > > There is _still_ something rotten, at least it seems > so, > in your array sort in Page. This load_order thingy > has, you realize, the weakness, that you can put in > index.php three modules in a 'top' group with > load_order(s) > as: > > EXAMPLE--- > > MOD1 load_order=>69 > MOD2 load_order=>22 > MOD3 load_order=>11 > > and this _should_ map/sort to > > $Page->modules['top'][0] ===> MOD3 > $Page->modules['top'][1] ===> MOD2 > $Page->modules['top'][2] ===> MOD1 > > but it doesn't. No matter what you put in your > load order, the sequence in $Page->modules['top'] > is ALWAYS IN THE ORDER OF the appearance in > index.php. > Anyway, it appears your uasort() thingy is not > working, > and that, specifically, your sorting comparison > function: > > create_function('$a,$b', 'return $a("load_order"] > - $b["load_order"];'); > > must be always returning 0, instead of (-1,0,+1) > accordingly. > > Now I am wondering, with your sorting, IF IT WERE > WORKING, > you have it mechanized, I think, that for my EXAMPLE > above, > admittedly wrong or sloppy, it would create a sparse > array > if the load_order was a number type and not a > number_string (with > quotes). > I think you also need to guard against sparse arrays > somehow. > Well, I haven't tried to "fix" > _IncludeModules($_group) > and see if it does create a sparse array.... > > OK Alex, so in any case, you are going to figure out > some > kind of way to reference _which_ instance of > multiple > loads of the same module easily. The only thing > that > occurs to me quickly is something like adding a tag, > as in: > > array( > 'name' => > "EyeLibrary", > 'package' => "lib", > 'load_order' => 2, > 'tag' => > "TableData", > 'options' => > "option1", > ), > > and then allow reference to that particular module > as: > > $Page->modules['top']['TableData']->method_or_property; > > That is knee-jerk, but gives you something to think > about. > > _jef > > > -- > Justin Farnsworth > Eye Integrated Communications > 321 South Evans - Suite 203 > Greenville, NC 27858 | Tel: (252) 353-0722 > > _______________________________________________ > binarycloud-dev mailing list > bin...@li... > http://lists.sourceforge.net/lists/listinfo/binarycloud-dev __________________________________________________ Do You Yahoo!? Get personalized email addresses from Yahoo! Mail http://personal.mail.yahoo.com/ |
From: Justin F. <je...@ey...> - 2001-07-08 09:01:22
|
alex black wrote: > > > Sometimes my mind just falls apart, and I feel like I am in that > > state right now. In one of your last posts, you suggested to > > get a large/complex bit of data and store it in a class variable, > > and then (implied) down the load chain, this variable can > > be accessed. > > > > HOW? > > $Page->modules['group_name'][load_order]->variable_name > > Thus my mention of possibly using unique names in the page declaration, so > making references to modules would be more simple. > > that would also complicate the page module sorting functions, so I'm not > sure it's worth doing that way. it may be a lot more simple to have a module > communication manager which is called by a module that needs something, like > a really simple Request class. ================================================= Alex: Oy weh. Now I was var_dump()'ing what you have above, viz: var_dump($Page->modules['top'][0]); as I thought that was it after looking at Page.php, and all I was getting were NULL's. Of course, of course, I was in some decendant class method, and forgot to global $Page within the method...... But, Alex, you are not going to make us use this syntax, are you? No, you are figuring out something with a bit more elegance, aren't you? :) There is _still_ something rotten, at least it seems so, in your array sort in Page. This load_order thingy has, you realize, the weakness, that you can put in index.php three modules in a 'top' group with load_order(s) as: EXAMPLE--- MOD1 load_order=>69 MOD2 load_order=>22 MOD3 load_order=>11 and this _should_ map/sort to $Page->modules['top'][0] ===> MOD3 $Page->modules['top'][1] ===> MOD2 $Page->modules['top'][2] ===> MOD1 but it doesn't. No matter what you put in your load order, the sequence in $Page->modules['top'] is ALWAYS IN THE ORDER OF the appearance in index.php. Anyway, it appears your uasort() thingy is not working, and that, specifically, your sorting comparison function: create_function('$a,$b', 'return $a("load_order"] - $b["load_order"];'); must be always returning 0, instead of (-1,0,+1) accordingly. Now I am wondering, with your sorting, IF IT WERE WORKING, you have it mechanized, I think, that for my EXAMPLE above, admittedly wrong or sloppy, it would create a sparse array if the load_order was a number type and not a number_string (with quotes). I think you also need to guard against sparse arrays somehow. Well, I haven't tried to "fix" _IncludeModules($_group) and see if it does create a sparse array.... OK Alex, so in any case, you are going to figure out some kind of way to reference _which_ instance of multiple loads of the same module easily. The only thing that occurs to me quickly is something like adding a tag, as in: array( 'name' => "EyeLibrary", 'package' => "lib", 'load_order' => 2, 'tag' => "TableData", 'options' => "option1", ), and then allow reference to that particular module as: $Page->modules['top']['TableData']->method_or_property; That is knee-jerk, but gives you something to think about. _jef -- Justin Farnsworth Eye Integrated Communications 321 South Evans - Suite 203 Greenville, NC 27858 | Tel: (252) 353-0722 |
From: Jimmy H. <ji...@ha...> - 2001-07-08 07:15:56
|
Hi after finally having a win on my freebsd make system, now I move on to the more exciting part.... Under r2/binarycloud/ there are base build ext user Which one should I work on and which one should I not touch? Any hint for *first* time *newbie* on what to do to create a page, template, and an admin area? How about database connection etc? Where do I go? Thanks for the hints. Regards, Jimmy |
From: jason <ja...@gr...> - 2001-07-08 07:15:40
|
I am in favor of this. Like you said, simply for continuity. > I have not defined public/private class vars as php doesn't support them - > is anyone in favor of making an artificial distinctoin similar to the > private class names? > > like: > Private Class Vars: > _varname |
From: alex b. <en...@tu...> - 2001-07-08 06:52:13
|
hi all, on monday I'll be changing some important variable names, if you look at the global var space now, it contains: sImportMap <-- static, global var used by import (thus the (sName)) gImportPaths <-- global var used by import for paths bc_page <-- page declaration (note the discontinuity between this and gImportMap) Init <-- Class Timer Debug Sess bc_lang bc_lang_name bc_lang_datespec bc_lang_timespec Lang _lang bc_lang_charset bc_lang_currency_name bc_lang_currency_symbol Err Page _tmpl <-- "external" user-space variable that is significant to the system. ------- It will contain, instead: Static, globals vars of the form sVarName: sImportMap Global Vars of the form gVarName: gImportPaths gPageDef <-- this is what $bc_page will become. gLangCode <-- formerly $bc_lang gLangName <-- formerly $bc_lang_name gLangDateSpec <-- formerly $bc_lang_datespec gLangTimeSpec <-- formerly $bc_lang_timespec gLangCharset <-- formerly $bc_lang_charset gLangCurrencyName <-- formerly $bc_lang_currency_name gLangCurrencySymbol <-- formerly $bc_lang_currency_symbol Class names: Init Timer Debug Sess Lang Err Page External, user-space vars: _lang _tmpl At the moment, we haven't integrated Request into the page render process. Once that is done, the system will assume that register_globals is _OFF_ and act accordingly. (I will probably have init check the ini setting and send a warning message to Debug if it is on.) I will update the standards when I am done, but here are the rest: Class names: ClassName, must be contained by ClassName.php, one class per file. Public Methods & Constructor: PublicMethod Private Methods: _PrivateMethod (this is a change for continuity) Class Vars: varname I have not defined public/private class vars as php doesn't support them - is anyone in favor of making an artificial distinctoin similar to the private class names? like: Private Class Vars: _varname -------- time for sleep :) _alex |
From: alex b. <en...@tu...> - 2001-07-08 06:26:57
|
hi ronald, you are correct, before we were using package declarations, but now it's implicit. (I forgot :) I've removed the package declaration in my core cvs, I'll push that in with the next synch. There's some other foo going on with libs that I'm working on now. _a ----- Original Message ----- From: "TAO Ronald" <ron...@ho...> To: <bin...@li...> Sent: Saturday, July 07, 2001 9:17 PM Subject: Re: [binarycloud-dev] CVS > > > > > > I _just_ retrieved the latest CVS, and was able to install when I > > > noticed this. > > > Doesn't look quite right, thought I would ask first: > > > > > > r2/binarycloud/build/en/user/binarycloud/mod/mod/xslt_example/ > > > >You're right, that isn't correct. > >It could be that the module doesn't have a correct package declaration. > > > >are other modules working? > > > >_a > this is just because there is a package declaration inside > r2/binarycloud/user/mod/xslt_example/XSLT_Example.php that I haven't seen > it > in other module example, by removing the package declaration you can get > the > right things..... > but alex is it necessary to put the package declaration inside the module?? > I think so, but the make system seem to be do something wrong with this, > and > at the same time, the other example modules do not have the package > declaration. > > ronald :) > > Ronald TAO > ron...@ho... > > _________________________________________________________________________ > Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com. > > > _______________________________________________ > binarycloud-dev mailing list > bin...@li... > http://lists.sourceforge.net/lists/listinfo/binarycloud-dev > |
From: Odysseas T. <ody...@ya...> - 2001-07-08 06:24:43
|
Yes, you are right. The package declaration inside the XSLT_Example.php doesn't make sense. It must have got there by mistake. If you remove it (cvs will soon reflect the fixed up file) things should be fine. odysseas --- TAO Ronald <ron...@ho...> wrote: > > > > > > I _just_ retrieved the latest CVS, and was able > to install when I > > > noticed this. > > > Doesn't look quite right, thought I would ask > first: > > > > > > > r2/binarycloud/build/en/user/binarycloud/mod/mod/xslt_example/ > > > >You're right, that isn't correct. > >It could be that the module doesn't have a correct > package declaration. > > > >are other modules working? > > > >_a > this is just because there is a package declaration > inside > r2/binarycloud/user/mod/xslt_example/XSLT_Example.php > that I haven't seen > it > in other module example, by removing the package > declaration you can get > the > right things..... > but alex is it necessary to put the package > declaration inside the module?? > I think so, but the make system seem to be do > something wrong with this, > and > at the same time, the other example modules do not > have the package > declaration. > > ronald :) > > Ronald TAO > ron...@ho... > > _________________________________________________________________________ > Get Your Private, Free E-mail from MSN Hotmail at > http://www.hotmail.com. > > > _______________________________________________ > binarycloud-dev mailing list > bin...@li... > http://lists.sourceforge.net/lists/listinfo/binarycloud-dev __________________________________________________ Do You Yahoo!? Get personalized email addresses from Yahoo! Mail http://personal.mail.yahoo.com/ |
From: alex b. <en...@tu...> - 2001-07-08 06:22:01
|
> Sometimes my mind just falls apart, and I feel like I am in that > state right now. In one of your last posts, you suggested to > get a large/complex bit of data and store it in a class variable, > and then (implied) down the load chain, this variable can > be accessed. > > HOW? $Page->modules['group_name'][load_order]->variable_name Thus my mention of possibly using unique names in the page declaration, so making references to modules would be more simple. that would also complicate the page module sorting functions, so I'm not sure it's worth doing that way. it may be a lot more simple to have a module communication manager which is called by a module that needs something, like a really simple Request class. _alex |
From: Justin F. <je...@ey...> - 2001-07-08 05:18:20
|
Alex: Sometimes my mind just falls apart, and I feel like I am in that state right now. In one of your last posts, you suggested to get a large/complex bit of data and store it in a class variable, and then (implied) down the load chain, this variable can be accessed. HOW? Especially, what if I want something from a module in a group when they are two instances, but do different things because of passed in options. EXAMPLE stanza / module group top 'modules' => array( 'top' => array( 'load' => array( array( 'name' => "EyeLibrary", 'package' => "lib", 'load_order' => "1", 'options' => "option1", ), array( 'name' => "EyeLibrary", 'package' => "lib", 'load_order' => "2", 'options' => "option2", ), array( 'name' => "Blank", 'package' => "lib", 'load_order' => "3" ), ), ), ---------- Now in the above stanza, EyeLibrary that has load order "1" does something as dictated by option1, and stores that data at, say, $this->what_i_need. EyeLibrary that has load order "2" does something as dictated by option2, and stores that data at, say, $this->what_i_need. NOW, how the hell do I get the data EyeLibrary[0]->what_i_need? NOW, how the hell do I get the data EyeLibrary[1]->what_i_need? Both of these pieces of data are desired in Blank, load order "3". If I instantiate a new EyeLibrary within a following module, this is no good at all, because I have in the constructor something like: function EyeLibrary($_options="ain't no options in EyeLibrary") { $this->options = $_options; some other code, maybe return true; } so all I would get was "ain't no options...", which, for the example, is EyeLibrary->what_i_need. How do I do this without going global???? You instantiate the thing in $Page->_IncludeModules() with the options from $bc_page, but how do I get to that instantiation, and distinguish between the two loads???? WITHOUT GOING GLOBAL SCOPE in the constructor??? My mind is mush right now... _jef -- Justin Farnsworth Eye Integrated Communications 321 South Evans - Suite 203 Greenville, NC 27858 | Tel: (252) 353-0722 |
From: TAO R. <ron...@ho...> - 2001-07-08 04:17:46
|
> > > > I _just_ retrieved the latest CVS, and was able to install when I > > noticed this. > > Doesn't look quite right, thought I would ask first: > > > > r2/binarycloud/build/en/user/binarycloud/mod/mod/xslt_example/ > >You're right, that isn't correct. >It could be that the module doesn't have a correct package declaration. > >are other modules working? > >_a this is just because there is a package declaration inside r2/binarycloud/user/mod/xslt_example/XSLT_Example.php that I haven't seen it in other module example, by removing the package declaration you can get the right things..... but alex is it necessary to put the package declaration inside the module?? I think so, but the make system seem to be do something wrong with this, and at the same time, the other example modules do not have the package declaration. ronald :) Ronald TAO ron...@ho... _________________________________________________________________________ Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com. |
From: Justin F. <je...@ey...> - 2001-07-08 03:00:24
|
alex black wrote: [== snip, snip ==] > > Yes, I do respect Alex's "law" that he wants globals to be held to > > a minimum. What is the sweet compromise here???? > > Try and put your data in a class var in the module that gets the stuff from > mysql, then have your other module(s) get that class var. > > The reason I mentioned the naming thing above is because we instantiate > modules inside Page->modules[position_in_load_order] - so you'd be using the > load order which is page specific (i.e. that won't work well at all) > > I can see potentially wanting to add the "unique name" concept to > $bc_page['modules']['group'][x] because you might want to have the ability > to address modules individually (even if there are multiple instances of a > module on a page. > > That last thing needs quite a bit of thoght, because it can cause problems: > -unnecessary amount of work if you don't need to address modules > individually > -could potentially be easier to just assume that the import path is the > unique name and reference the module that way (though this has other > problems) > -egh, need to think about that one. [=======================] This is true, it is something else that I have "wondered" about, namely I already "use" multiple loads of the same module, even if it is a place holder called Blank.php. I wondered if name mapping was possible, but I am always asking... I really find programming with BC a, er, what, paradigm change in thinking. The nice problem with BC is, you are smothered with a plethora of riches, you can do things in several different ways, but you wish to retain generality, and all that good stuff. It is taking me some time to "feel" how to adjust things like module granularity, module functionality. Like do you create "thin" lookup tables, do you break out that huge data structure previously referred to as a module in itself, ad infinitum. But, it is fun. BC is a cafeteria with 52 kinds of cheesecake... I hope we discover as early as possible what we really "need". This does not imply that BC is bloated, on the contrary. Again, good job, Alex. _jef -- Justin Farnsworth Eye Integrated Communications 321 South Evans - Suite 203 Greenville, NC 27858 | Tel: (252) 353-0722 |
From: alex b. <en...@tu...> - 2001-07-08 02:10:43
|
> What I am sort of wrestling with, now, is the tradeoff between: > > 1. Writing code "correctly" Which is partially subjective :) > 2. Trying not to clutter up global scope with potential > danger of name clash Definitely want to avoid that at all costs. > 3. Increase performance, or the corrollary, not inadvertantly > decrease performance. Right. But you have fairly little to worry about there, this is PHP after all. > I will give you an example, here, which you may not think > typical. > > I have bolted together an "application" with a module that allows > you to UPDATE/INSERT/DELETE, find in any field, > sort on any field, jump to any record, browse all records > for all databases in my system. It works quite well, and is a > general module that I can bolt into other "applications". Cool, the lister :) > Since it is general, it makes one humungous number of SELECT's > in the constructor when you must fetch/SELECT > > - All database names > - All tables in each database, meaning, additionally > * field names > * field types > * field lengths > * field options wow, that is big. > which I collect and put into a large data structure. This module/Class > is called EditTable. > > OK, this is a big hit on MySQL, all done in the constructor. > You can even see the page generation is slow, even on a development > machine with your "private" database(s). > You can imagine what it would be if you have 50 databases with > 10 tables each, each table having, say 10 fields, and 50 clients > using it. Right, because you are doing a _huge_ amount of "discovery" for every action, which seems unnecessary. > Now, being a good boy, in other classes, when I need this class, or > something from it, I instantiatiate it with a new EditTable inside > another module instead of having the EditTable module put the > data structure in global scope one time, and have other modules go check > on > the existence of that data structure, and if not there, do That will screw you re: performance. You should be using it by reference (=&) to avoid creating a copy of the object. That's memory intensive as hell :) > a new EditTable. It is interesting to watch MySQL query logging > each time EditTable gets instantiated. You should make your "discovery" data available in a var of the class so other modules can ask it questions. > But, I am going to use this data structure in a Report Generator, > where you need the same kind of data to be able to generate reports > dynamically, and in other modules. I'm thinking we probably need to (unfortunately) allow for unique names in module declaration arrays, so modules can refer to each other simply. > So, I have a tension between going global, meaning, putting the > data structure global, so I don't have to instantiate a new > instance of EditTable, and taking the big MySQL hit over and > over, technically unnecessary. > > THIS WAS NOT THE CASE when the modules used Init(), as, in theory > Init() was only called once when loaded by BC, no matter how many times > you instantiated > the class inside another module. Before, you had to specifically > call Init() again (if you needed to, with options/different args). Right, but it isn't specifically a result of not using Init anymore. You should be putting that stuff in a var in your module, which other modules can "see". > Is it even worthwhile to consider asking Alex for some kind of > registration > facility for things/(big things) that indeed have a good reason for > being global? I have considered that, and I still can't quite justify it. You can do all of that talking-between-modules stuff with a combination of load order and well designed class variable structures in the modules. > Yes, I do respect Alex's "law" that he wants globals to be held to > a minimum. What is the sweet compromise here???? Try and put your data in a class var in the module that gets the stuff from mysql, then have your other module(s) get that class var. The reason I mentioned the naming thing above is because we instantiate modules inside Page->modules[position_in_load_order] - so you'd be using the load order which is page specific (i.e. that won't work well at all) I can see potentially wanting to add the "unique name" concept to $bc_page['modules']['group'][x] because you might want to have the ability to address modules individually (even if there are multiple instances of a module on a page. That last thing needs quite a bit of thoght, because it can cause problems: -unnecessary amount of work if you don't need to address modules individually -could potentially be easier to just assume that the import path is the unique name and reference the module that way (though this has other problems) -egh, need to think about that one. --------- in any case, this _is_ quite useful justin: this real world example is perfect. it _is_ easier to just create a module comm manager or something that gets loaded up only if a module needs to communicate, and have another module grab the variable from that module communications manager. I'll think about that one and get back to you. _a |
From: Justin F. <je...@ey...> - 2001-07-08 01:50:57
|
Alex/Guys: Look, I don't mind exposing my ignorance, but I am floundering around trying to get "experience" in bolting modules together and to establish some standards for our company's coding. What I am sort of wrestling with, now, is the tradeoff between: 1. Writing code "correctly" 2. Trying not to clutter up global scope with potential danger of name clash 3. Increase performance, or the corrollary, not inadvertantly decrease performance. I will give you an example, here, which you may not think typical. I have bolted together an "application" with a module that allows you to UPDATE/INSERT/DELETE, find in any field, sort on any field, jump to any record, browse all records for all databases in my system. It works quite well, and is a general module that I can bolt into other "applications". Since it is general, it makes one humungous number of SELECT's in the constructor when you must fetch/SELECT - All database names - All tables in each database, meaning, additionally * field names * field types * field lengths * field options which I collect and put into a large data structure. This module/Class is called EditTable. OK, this is a big hit on MySQL, all done in the constructor. You can even see the page generation is slow, even on a development machine with your "private" database(s). You can imagine what it would be if you have 50 databases with 10 tables each, each table having, say 10 fields, and 50 clients using it. Now, being a good boy, in other classes, when I need this class, or something from it, I instantiatiate it with a new EditTable inside another module instead of having the EditTable module put the data structure in global scope one time, and have other modules go check on the existence of that data structure, and if not there, do a new EditTable. It is interesting to watch MySQL query logging each time EditTable gets instantiated. But, I am going to use this data structure in a Report Generator, where you need the same kind of data to be able to generate reports dynamically, and in other modules. So, I have a tension between going global, meaning, putting the data structure global, so I don't have to instantiate a new instance of EditTable, and taking the big MySQL hit over and over, technically unnecessary. THIS WAS NOT THE CASE when the modules used Init(), as, in theory Init() was only called once when loaded by BC, no matter how many times you instantiated the class inside another module. Before, you had to specifically call Init() again (if you needed to, with options/different args). Thus, the switch to constructors has caused a "penalty" when you have a whole bunch of database work in the constructor. What would you guys do? Is it even worthwhile to consider asking Alex for some kind of registration facility for things/(big things) that indeed have a good reason for being global? Yes, I do respect Alex's "law" that he wants globals to be held to a minimum. What is the sweet compromise here???? _jef -- Justin Farnsworth Eye Integrated Communications 321 South Evans - Suite 203 Greenville, NC 27858 | Tel: (252) 353-0722 |
From: alex b. <en...@tu...> - 2001-07-08 01:24:21
|
I should qualify this and way we _will_ run the xml through xml2php, we don't right now. _a ----- Original Message ----- From: "Jimmy Harlindong" <ji...@ha...> To: <bin...@li...> Sent: Saturday, July 07, 2001 5:52 PM Subject: RE: [binarycloud-dev] So-called user constants > Hi > > > > > So, the question(s) are: > > > 1. Where should I define them for global scope? > > > > user/conf/conf.php (for the moment, soon the conf.xml) > > > Why would you want to use xml configuration file instead of php? > Wouldn't you think php parser works faster (even without with the help > of php cache / zend cache) than xml parser? > > Please enlighten me on the reason. > > Thanks > > > > _______________________________________________ > binarycloud-dev mailing list > bin...@li... > http://lists.sourceforge.net/lists/listinfo/binarycloud-dev > |
From: alex b. <en...@tu...> - 2001-07-08 01:23:57
|
because we run those xml files thourgh an xml->php makefile that (you guessed it) turns xml into php with various filters. that allows us to use xml because it is convenient and clean, while avoiding the performance problems associated with parsing xml at runtime. _a ----- Original Message ----- From: "Jimmy Harlindong" <ji...@ha...> To: <bin...@li...> Sent: Saturday, July 07, 2001 5:52 PM Subject: RE: [binarycloud-dev] So-called user constants > Hi > > > > > So, the question(s) are: > > > 1. Where should I define them for global scope? > > > > user/conf/conf.php (for the moment, soon the conf.xml) > > > Why would you want to use xml configuration file instead of php? > Wouldn't you think php parser works faster (even without with the help > of php cache / zend cache) than xml parser? > > Please enlighten me on the reason. > > Thanks > > > > _______________________________________________ > binarycloud-dev mailing list > bin...@li... > http://lists.sourceforge.net/lists/listinfo/binarycloud-dev > |
From: alex b. <en...@tu...> - 2001-07-08 01:22:25
|
that is a correct hierarchy, except for the misplaced xslt example module. the last one was fubar :) _a ----- Original Message ----- From: "Jimmy Harlindong" <ji...@ha...> To: <bin...@li...> Sent: Saturday, July 07, 2001 1:47 PM Subject: [binarycloud-dev] Make in FreeBSD #3 > OK the #2 try was wrong too, so here's the 3rd try: > > for i in $*; do > install -d $BUILD_DIR/`$GETPKG $i`/`dirname $i`/; > install -c $i $BUILD_DIR/`$GETPKG $i`/$i; > done > > The tree: > > D en > D user > D conf > R conf.php > R conf.xml > R datasources.php > R datasources.xml > R langs.php > R langs.xml > R operations.xml > D db > D dump > R year_mo_dy_hr_mn_sc.txt > D schema > R bc_errors.xml > R bc_form_submissions.xml > R bc_knowledge_base_tables.xml > R bc_perm_auth.xml > R bc_users.xml > R create_db.xml > D lang > R strings.xml > D mod > D hello_world > R HelloWorld.php > R OtherWorld.php > D set_lang_example > R Set_Lang_Example.php > D html > R form.php > D webalizer > R start.sh > D webalizer > R DNS.README > R README.FIRST > R country-codes.txt > R msfree.png > R sample.conf > R webalizer.1 > R webalizer.LSM > R webalizer.png > D xslt_example > R XSLTransformer.php > R form.xml > R form.xsl > R form_inputs.xsl > R my_xsl_error.php > D binarycloud > D mod > D mod > D xslt_example > R XSLT_Example.php > D roles > R god.php > R god.xml > D tmpl > D html > D layouts > R example.php > D masters > R example.php > R other.php > D htdocs > R bcp.xml > R destroy_session.php > R index.php > R xslt_example.php > R prepend.php > D resources > D css > R binarycloud.css > R phpdoc.css > R storm.css > D images > D binarycloud > D buttons > R add_question.gif > R cancel.gif > R delete.gif > R delete_all.gif > R delete_selected.gif > R hide.gif > R join.gif > R make_active.gif > R make_inactive.gif > R no.gif > R ok.gif > R rename.gif > R search.gif > R show.gif > R submit.gif > R update.gif > R yes.gif > D knowledgebase > R big_folder.gif > R kb_document.gif > R magnifying_glass.gif > D misc > R 000000.gif > R 10dot.gif > R 336666.gif > R 669999.gif > R 999999.gif > R CCCCCC.gif > R down_arrow.gif > R down_dis_arrow.gif > R trans.gif > R up_arrow.gif > D nav > R api.gif > R knowledge_base.gif > R send_email.gif > R site_map.gif > R storm.gif > R welcome.gif > D storm > R storm_header.gif > D titles > R admin.gif > R api_docs.gif > R install.gif > R knowledgebase.gif > R recent_news.gif > R send_email.gif > R site_map.gif > R test_xml.gif > R welcome.gif > D tmpl > R binarycloud.gif > R binarycloud_logo_sm.gif > R fire.jpg > R h_tile.gif > R hold.gif > D js > R base_lib.js > D binarycloud > D core > R Auth.php > R Debug.php > R Lang.php > R PEAR_Error.php > R Page.php > R Perm.php > R Sess.php > R error_codes_eng.php > R error_handler.php > D init > R Init.php > D lib > R Timer.php > D binarycloud > D lib > R ClientSniffer.php > > > > _______________________________________________ > binarycloud-dev mailing list > bin...@li... > http://lists.sourceforge.net/lists/listinfo/binarycloud-dev > |
From: alex b. <en...@tu...> - 2001-07-08 01:21:23
|
> > I _just_ retrieved the latest CVS, and was able to install when I > noticed this. > Doesn't look quite right, thought I would ask first: > > r2/binarycloud/build/en/user/binarycloud/mod/mod/xslt_example/ You're right, that isn't correct. It could be that the module doesn't have a correct package declaration. are other modules working? _a |
From: Jimmy H. <ji...@ha...> - 2001-07-08 00:51:25
|
Hi > > So, the question(s) are: > > 1. Where should I define them for global scope? > > user/conf/conf.php (for the moment, soon the conf.xml) Why would you want to use xml configuration file instead of php? Wouldn't you think php parser works faster (even without with the help of php cache / zend cache) than xml parser? Please enlighten me on the reason. Thanks |
From: Jimmy H. <ji...@ha...> - 2001-07-08 00:39:18
|
OK the #2 try was wrong too, so here's the 3rd try: for i in $*; do install -d $BUILD_DIR/`$GETPKG $i`/`dirname $i`/; install -c $i $BUILD_DIR/`$GETPKG $i`/$i; done The tree: D en D user D conf R conf.php R conf.xml R datasources.php R datasources.xml R langs.php R langs.xml R operations.xml D db D dump R year_mo_dy_hr_mn_sc.txt D schema R bc_errors.xml R bc_form_submissions.xml R bc_knowledge_base_tables.xml R bc_perm_auth.xml R bc_users.xml R create_db.xml D lang R strings.xml D mod D hello_world R HelloWorld.php R OtherWorld.php D set_lang_example R Set_Lang_Example.php D html R form.php D webalizer R start.sh D webalizer R DNS.README R README.FIRST R country-codes.txt R msfree.png R sample.conf R webalizer.1 R webalizer.LSM R webalizer.png D xslt_example R XSLTransformer.php R form.xml R form.xsl R form_inputs.xsl R my_xsl_error.php D binarycloud D mod D mod D xslt_example R XSLT_Example.php D roles R god.php R god.xml D tmpl D html D layouts R example.php D masters R example.php R other.php D htdocs R bcp.xml R destroy_session.php R index.php R xslt_example.php R prepend.php D resources D css R binarycloud.css R phpdoc.css R storm.css D images D binarycloud D buttons R add_question.gif R cancel.gif R delete.gif R delete_all.gif R delete_selected.gif R hide.gif R join.gif R make_active.gif R make_inactive.gif R no.gif R ok.gif R rename.gif R search.gif R show.gif R submit.gif R update.gif R yes.gif D knowledgebase R big_folder.gif R kb_document.gif R magnifying_glass.gif D misc R 000000.gif R 10dot.gif R 336666.gif R 669999.gif R 999999.gif R CCCCCC.gif R down_arrow.gif R down_dis_arrow.gif R trans.gif R up_arrow.gif D nav R api.gif R knowledge_base.gif R send_email.gif R site_map.gif R storm.gif R welcome.gif D storm R storm_header.gif D titles R admin.gif R api_docs.gif R install.gif R knowledgebase.gif R recent_news.gif R send_email.gif R site_map.gif R test_xml.gif R welcome.gif D tmpl R binarycloud.gif R binarycloud_logo_sm.gif R fire.jpg R h_tile.gif R hold.gif D js R base_lib.js D binarycloud D core R Auth.php R Debug.php R Lang.php R PEAR_Error.php R Page.php R Perm.php R Sess.php R error_codes_eng.php R error_handler.php D init R Init.php D lib R Timer.php D binarycloud D lib R ClientSniffer.php |
From: jason <ja...@gr...> - 2001-07-07 23:57:07
|
I _just_ retrieved the latest CVS, and was able to install when I noticed this. Doesn't look quite right, thought I would ask first: r2/binarycloud/build/en/user/binarycloud/mod/mod/xslt_example/ jason |
From: alex b. <en...@tu...> - 2001-07-07 22:36:55
|
> You have already pre-empted the name "BC_" prefix for > define()'s, and you call these "user constants". correct. these are constants that are used by the system, but always set by the user. > Now, what if I want a page-scope/all module defined constant. > What should I do? Where do I define() something that I wish > all modules to see in global scope. all constants are implicitly global. you can put a declare in conf.php, or you can declare a constant in your module. it's up to you. > Is this going to be possible in the *.xml file that will be > ripped into the index.php? If so, will it be put up there > at the top like: Yes. The .xml won't know anything about the set of constants, just that a certain xml structure should be ripped into a php define. so you can add whatever you like. > // ripped from /path/to/binarycloud/user/htdocs/index.xml > $SITE_EMAIL="jo...@so..."; //for email all over > $SITE_ROWS_BEFORE_PAGING=15; //for paging lists > $SITE_TEL_NO="1-800-6969"; // for telno all over > $SITE_WEBMASTER="wi...@so..."; > > or > > define(SITE_EMAIL,"jo...@so..."); It would be the latter, define. > and so forth. > > As an aside, I sort of think of these as "user constants", > but I suppose they are "site constants" or "page constants". They are also user constants. Agreed, the BC_ prefix ones are "special" and I may make an effort to make that a little more clear - but both 'sets' of constants come from the dev. > So, the question(s) are: > 1. Where should I define them for global scope? user/conf/conf.php (for the moment, soon the conf.xml) > 2. If you tell me some module that I will have to > load, such as a SiteLibrary.php, then I > guess I would have to go along with it, > but this seems wrong-headded. That would be stupid. So, yes, you are correct. > Now I want to be able to put them in the *.xml and > have them work as I described above, defining them > in global scope for THAT PAGE with any set of modules > called from and set of packages, and not have to worry > that I didn't load, say, the SiteLibrary.php that > would do it, with its potential omission. If I create > a new page(s) for the site six months after it has > been up, I might forget which bloody module globaled > my constants. This I don't understand - all 'constants' loaded by the system are system-wide (not page specific) and implicitly global. > What if I want: > > define(BUTTONS,"../resources/images/buttons/"); > define(SITE_GIZMOS,"resources/images/gizmos/"); > > Where? conf.php. > I suppose that now I am starting to get into the > operation of the XML --> php file thingy. I will > be happy when that is ready. > > And I would like to have defines()'s available in > that XML --> php. You will _only_ have defines available there. _a |
From: alex b. <en...@tu...> - 2001-07-07 22:32:39
|
> Would it not be possible to add another first level key > in index.php $bc_page[] such as: > > 'headers' => array( > 'def' => array( > 'name' => "stdheader", > 'package' => "html.headers", > 'type' => "html", > ), > 'special' => array( > 'name' => "redirectheader", > 'package' => "html.headers", > 'type' => "html", > ), > > ), no, as this will be taken care of by the template->module association capabilities of Page in the future. > and put another directory under templates called /headers > where these <head> templates live. > > It seems like this would slip in nicely.... > > Now I have not thought out all the implications, you will see > some problems immediately, such as: > > 1. Master templates would then be decapitated at the top from > <html> > down to and including > </head> > > but, if you like the idea, you may think of something more elegant. > However, I could live with the last outer logical template being > split into two parts, namely Well, the ability to associate modules with templates gives developers 100% power over where markup comes from, and what is presented to the client. _a |
From: alex b. <en...@tu...> - 2001-07-07 22:30:31
|
you can do that with default template->module associations. you coudl have a module that deals with all of your <head> contents, or just leave that markup in the master template. _a ----- Original Message ----- From: "jason" <ja...@gr...> To: <bin...@li...> Sent: Saturday, July 07, 2001 7:36 AM Subject: Re: [binarycloud-dev] BC and the <title> issue... > > I haven't look at the system in detail to get a full analysis of this > problem, but by just reading this scenerio I can see where we may need > to have the entire <HEAD> stanza as a template in itself. There will be > cases where we have multiple MASTER templates using this same HEAD > template. (one site that has different table/layout designs). In > theory this doesn't seem like a big deal to implement for such a > worthwhile feature to have. > > jason > > > Peter Bowyer wrote: > > At 07:33 AM 7/7/01 -0400, you wrote: > > >With the present platform, the source of the <title> is, of > > >course, the template used out of the $bc_page['templates'] > > >selection. The result of this machinery is that the > > >reusability of the template is diminished, and you _must_ > > >have a unique template for each page if you wish the title to be > > >different, even though such a template may be simple and > > >is able to be generalized and used over and over for a > > >large percentage of, or all, pages. > > > > What about the meta description and keywords? I like to change these > > slightly for each page on the web site - it helps with search engine > > ranking. A method of specifying default keywords, and then custom ones to > > append/replace the default with would be a good idea. > > _______________________________________________ > binarycloud-dev mailing list > bin...@li... > http://lists.sourceforge.net/lists/listinfo/binarycloud-dev > |
From: alex b. <en...@tu...> - 2001-07-07 22:29:41
|
not anymore. I just fixed it. core/ contains the corret files now. _a ----- Original Message ----- From: "Andreas Aderhold" <a.a...@th...> To: <bin...@li...> Sent: Saturday, July 07, 2001 6:07 AM Subject: RE: [binarycloud-dev] Problem in cvs > Hi Alex, > > >> there is a big problem in cvs source tree... > >> files in r2/binarycloud/base/core is actually the whole source tree > >> of bc... > > That problem still exists :(( > > Andi > > _______________________________________________ > binarycloud-dev mailing list > bin...@li... > http://lists.sourceforge.net/lists/listinfo/binarycloud-dev > |