From: Shannon W. <we...@ro...> - 2005-05-12 18:42:22
|
Hey Bob, I've got a patch for html.c that adds a "suppress_head" parameter to not output the <body> and <head> tags. It's in my cvs tree - is there a way to commit it or should I send a patch to the list (or you)? Secondly - I've been having a segfault problem lately that started a few weeks ago (from CVS build). What happens is when rlib has an error (say a BAD_OPERAND or bad SQL) it will segfault, the apache child will die, and it won't print out an error message - I just see a message in apache error log that the child died. However it only happens after it's been running for awhile - if I immediately restart the server it will run ok and rlib will show the error message. If it's been running for more than 5 or 10 minutes say, that's when it crashes. I wish I had time to track it down more than that, but I haven't at the moment. I realize it will be hard to look into unless it can be duplicated. It's more if a heads up and to see if anyone else is experiencing this. Thirdly, I'm interesting in adding support to the PHP binding to lookup a variable in a hash (in addition to a single variable, as now). I figure this can be done with another attribute to the <field> tag - "index" for example. I looked into it a bit and I can add this much to php/environment.c if rlib_php_resolve_memory_variable gets two parameters. I can see where to add it to the structure to keep the "index" string (in parsexml.c). The tough part is pcode.c -- how can I get access to that index string in rlib_new_operand? Or, what's the better way to implement it? Thanks, Shannon |
From: Bob D. <bd...@si...> - 2005-05-12 20:42:36
|
Hi > I've got a patch for html.c that adds a "suppress_head" parameter to not > output the <body> and <head> tags. It's in my cvs tree - is there a way > to commit it or should I send a patch to the list (or you)? Unified diff please. Can you send it to rli...@li... > Secondly - I've been having a segfault problem lately that started a few > weeks ago (from CVS build). What happens is when rlib has an error (say > a BAD_OPERAND or bad SQL) it will segfault, the apache child will die, > and it won't print out an error message - I just see a message in apache > error log that the child died. However it only happens after it's been > running for awhile - if I immediately restart the server it will run ok > and rlib will show the error message. If it's been running for more than > 5 or 10 minutes say, that's when it crashes. > > I wish I had time to track it down more than that, but I haven't at the > moment. I realize it will be hard to look into unless it can be > duplicated. It's more if a heads up and to see if anyone else is > experiencing this. Hym... Dunno. We have The lasted RLIB in a production environment and it's not crashing. > Thirdly, I'm interesting in adding support to the PHP binding to lookup > a variable in a hash (in addition to a single variable, as now). I > figure this can be done with another attribute to the <field> tag - > "index" for example. I looked into it a bit and I can add this much to > php/environment.c if rlib_php_resolve_memory_variable gets two > parameters. I can see where to add it to the structure to keep the > "index" string (in parsexml.c). The tough part is pcode.c -- how can I > get access to that index string in rlib_new_operand? > > Or, what's the better way to implement it? Well.. Hym...... In the long term it would be good if RLIB could hash and haves lists(arrays) of data for other purposes. This would be kinda hard. What would be easier to be able to pass RLIB custom functions (even from binding languages like PHP) So some new api like rlib_add_function(r, "custom_function", pointer_to_function) Then in the xml you could: <field value="custom_function('ht_name', 'ht_value')"> In order to do this we would have to also make public rlib's stack (push, pop) In php you would do: function custom_function() { $ht_value = rlib_SPECIAL_POP($rlib); $ht_name = rlib_SPECIAL_POP($rlib); $value = $$ht_name[$ht_value]; $ht_name = rlib_SPECIAL_PUSH($rlib); } Freaky eh? - bob |
From: Shannon W. <swe...@ro...> - 2005-05-13 14:30:06
|
Bob Doan wrote: > Hi > > >>I've got a patch for html.c that adds a "suppress_head" parameter to not >>output the <body> and <head> tags. It's in my cvs tree - is there a way >>to commit it or should I send a patch to the list (or you)? > > > Unified diff please. > > Can you send it to rli...@li... > Ok, sent. > > >>Secondly - I've been having a segfault problem lately that started a few >>weeks ago (from CVS build). What happens is when rlib has an error (say >>a BAD_OPERAND or bad SQL) it will segfault, the apache child will die, >>and it won't print out an error message - I just see a message in apache >>error log that the child died. However it only happens after it's been >>running for awhile - if I immediately restart the server it will run ok >>and rlib will show the error message. If it's been running for more than >>5 or 10 minutes say, that's when it crashes. >> >>I wish I had time to track it down more than that, but I haven't at the >>moment. I realize it will be hard to look into unless it can be >>duplicated. It's more if a heads up and to see if anyone else is >>experiencing this. > > > Hym... Dunno. We have The lasted RLIB in a production environment and > it's not crashing. > Are you using it with PHP 4.3.x under Apache 1.3.x? When I get a chance I'm going to run it under gdb and see where the segfault lies - or at least find a way to consistently reproduce it. > >>Thirdly, I'm interesting in adding support to the PHP binding to lookup >>a variable in a hash (in addition to a single variable, as now). I >>figure this can be done with another attribute to the <field> tag - >>"index" for example. I looked into it a bit and I can add this much to >>php/environment.c if rlib_php_resolve_memory_variable gets two >>parameters. I can see where to add it to the structure to keep the >>"index" string (in parsexml.c). The tough part is pcode.c -- how can I >>get access to that index string in rlib_new_operand? >> >>Or, what's the better way to implement it? > > > Well.. Hym...... In the long term it would be good if RLIB could hash > and haves lists(arrays) of data for other purposes. > > This would be kinda hard. > > What would be easier to be able to pass RLIB custom functions (even from > binding languages like PHP) > > So some new api like > rlib_add_function(r, "custom_function", pointer_to_function) > > Then in the xml you could: > <field value="custom_function('ht_name', 'ht_value')"> > > In order to do this we would have to also make public rlib's stack > (push, pop) > > In php you would do: > > function custom_function() { > $ht_value = rlib_SPECIAL_POP($rlib); > $ht_name = rlib_SPECIAL_POP($rlib); > $value = $$ht_name[$ht_value]; > $ht_name = rlib_SPECIAL_PUSH($rlib); > } > > > Freaky eh? > Definitely. The ability to hook into a custom function would be great. The PHP interface seems a little low level, though, I wonder if there's a way to hide some details. If it gets that far, it might not be too much of a stretch to run built in PHP functions on rlib data. That would open up a great wealth of functions, obviously. In the short term however, can you think of a way to get rlib_php_resolve_memory_variable access to an optional index string so that if Z_TYPE_PP(data) == IS_ARRAY it can look it up? Thanks, Shannon |
From: Bob D. <bd...@si...> - 2005-05-13 15:12:28
|
Hi, > > Definitely. The ability to hook into a custom function would be great. > The PHP interface seems a little low level, though, I wonder if there's > a way to hide some details. > > If it gets that far, it might not be too much of a stretch to run built > in PHP functions on rlib data. That would open up a great wealth of > functions, obviously. > I could make it: <? custom_function($name, $value) { return $$name[$value]; } ?> (I guess that simplifies things for PHP People ;) ) If you can tell me how to call a PHP function w/ variables from c I'll make this the "short term" solution. It would probably only take me an hour or 2 to do this. |
From: Shannon W. <we...@ro...> - 2005-05-13 16:52:41
|
Bob Doan wrote: > > > I could make it: > > > <? > > custom_function($name, $value) { > return $$name[$value]; > } > > ?> > > (I guess that simplifies things for PHP People ;) ) > > If you can tell me how to call a PHP function w/ variables from c I'll > make this the "short term" solution. > > It would probably only take me an hour or 2 to do this. > That would be fantastic. I'm no authority on the Zend PHP API - luckily calling user functions appears to be documented here: http://www.php.net/manual/en/zend.calling-user-functions.php Thanks, Shannon |
From: Bob D. <bd...@si...> - 2005-05-13 20:00:04
|
Hey dude, > That would be fantastic. > > I'm no authority on the Zend PHP API - luckily calling user functions > appears to be documented here: > > http://www.php.net/manual/en/zend.calling-user-functions.php I got a present for ya You can now do something like this: $rlib = rlib_init(); rlib_version(); rlib_add_datasource_array($rlib, "local_array"); rlib_add_query_as($rlib, "local_array", "data", "data"); rlib_add_report($rlib, "array.xml"); rlib_add_function($rlib, "bobdoan", "bobdoan", 1); rlib_add_function($rlib, "mikeroth", "mike_roth", 2); rlib_set_output_format_from_text($rlib, "pdf"); rlib_execute($rlib); header(rlib_get_content_type($rlib)); rlib_spool($rlib); rlib_free($rlib); function mike_roth($a, $b) { return "pancakes are yummier then $a and $b"; } function bobdoan($a) { return strtoupper($a); } And then in the XML do: <field value="bobdoan(mikeroth('bacon', 'eggs'))" width="50"/> http://www.sicom.com/~bdoan/rlib-1.3.4.tar.gz see src/examples/php/array[xml|php] as an example You owe me a crash fix now ;) - Bob |
From: Shannon W. <we...@ro...> - 2005-05-13 20:18:04
|
Bob Doan wrote: > > And then in the XML do: > > <field value="bobdoan(mikeroth('bacon', 'eggs'))" width="50"/> > > http://www.sicom.com/~bdoan/rlib-1.3.4.tar.gz > > see src/examples/php/array[xml|php] as an example > > You owe me a crash fix now ;) > > - Bob > Woo hoo :) Looks great, I'll start playing with it shortly. That's going to be really powerful. For example I know I can use that right away with urlencode() because some of my "link" attributes need it. I'll definitely look in the crash bug. You might also be getting another patch for the html renderer. I'm actually having a lot of problems with bad generated HTML breaking the pages and it's kind of critical for me to fix that now so I'm about to dive in. Thanks, Shannon |
From: Shannon W. <we...@ro...> - 2005-05-13 21:32:32
|
> > And then in the XML do: > > <field value="bobdoan(mikeroth('bacon', 'eggs'))" width="50"/> > > http://www.sicom.com/~bdoan/rlib-1.3.4.tar.gz > > see src/examples/php/array[xml|php] as an example > > - Bob Hey Bob, Quick (hopefully) simple bug: the arguments are showing up to the PHP function in the reverse order. In your example, one would expect it to show up as "Bacon and Eggs" in the output but in fact it shows up "Eggs and Bacon". Other than that it looks great, thanks a lot. Shannon |
From: Bob D. <bd...@si...> - 2005-05-13 21:56:16
Attachments:
fix.patch
|
Attached is an untested patch which should fix the problem let me know - bob On Fri, 2005-05-13 at 17:30 -0400, Shannon Weyrick wrote: > > > > And then in the XML do: > > > > <field value="bobdoan(mikeroth('bacon', 'eggs'))" width="50"/> > > > > http://www.sicom.com/~bdoan/rlib-1.3.4.tar.gz > > > > see src/examples/php/array[xml|php] as an example > > > > - Bob > > Hey Bob, > > Quick (hopefully) simple bug: the arguments are showing up to the PHP > function in the reverse order. In your example, one would expect it to > show up as "Bacon and Eggs" in the output but in fact it shows up "Eggs > and Bacon". > > Other than that it looks great, thanks a lot. > > Shannon > > > ------------------------------------------------------- > This SF.Net email is sponsored by Oracle Space Sweepstakes > Want to be the first software developer in space? > Enter now for the Oracle Space Sweepstakes! > http://ads.osdn.com/?ad_id=7393&alloc_id=16281&op=click > _______________________________________________ > Rlib-users mailing list > Rli...@li... > https://lists.sourceforge.net/lists/listinfo/rlib-users -- Bob Doan <bd...@si...> |
From: Shannon W. <we...@ro...> - 2005-05-13 22:30:07
|
Bob Doan wrote: > Attached is an untested patch which should fix the problem > > let me know > > - bob Hey Bob, Patch works great, thanks. I researched the HTML problem I was having and it turns out to be a bug related to trim_links. Circa line 279 in layout.c, if it does the trim links a call to rlib_layout_output_extras_start is made which (in html) starts a <span> tag if there is a background color. However, there is never a call to _end after that so that span tag is never closed. I tried to hack this by adding a call to end_draw_cell_background() and it fixes it somewhat but I'm pretty sure this isn't correct, or at least all that needs to be done. Please advise :) Shannon |
From: Bob D. <bd...@si...> - 2005-05-13 22:46:00
|
> Patch works great, thanks. Anyone out there in User Land know if any other report writer can allow you to do this????? It seems like a nice features to have... > > I researched the HTML problem I was having and it turns out to be a bug > related to trim_links. Circa line 279 in layout.c, if it does the trim > links a call to rlib_layout_output_extras_start is made which (in html) > starts a <span> tag if there is a background color. However, there is > never a call to _end after that so that span tag is never closed. > > I tried to hack this by adding a call to end_draw_cell_background() and > it fixes it somewhat but I'm pretty sure this isn't correct, or at least > all that needs to be done. > Send a patch and let me have a look |