php-general Digest 2 Nov 2009 08:53:33 -0000 Issue 6422

Topics (messages 299552 through 299557):

Classes and Functions
        299552 by: Daniel Kolbo
        299553 by: Mathieu Rochette
        299554 by: Larry Garfield

shell_exec fails to compile java class?
        299555 by: דניאל דנון

Re: Help with my first recursion menu
        299556 by: Lex Braun

PHP and Javascript escape character problem, --> those who like to solve things 
can try to solve this issue, its tricky I think ;)
        299557 by: acetrader

Administrivia:

To subscribe to the digest, e-mail:
        php-general-digest-subscr...@lists.php.net

To unsubscribe from the digest, e-mail:
        php-general-digest-unsubscr...@lists.php.net

To post to the list, e-mail:
        php-gene...@lists.php.net


----------------------------------------------------------------------
--- Begin Message ---
Hello,

Is there a way to see what objects and functions a script
loaded/required/used?

I could recursively loop through the globals, but if objects were unset,
then i may miss some.

I could make a 'tracking' object and every time i load/include a file
(which contains a class def or a function def) to add that file to the
tracking object...but it would be nice if i didn't have to modify my
existing code to see which objects and functions a script actually used,
or at least, requested and loaded into memory.

Thanks in advance,
Daniel Kolbo
`


--- End Message ---
--- Begin Message ---
On Sun, Nov 1, 2009 at 9:50 PM, Daniel Kolbo <kolb0...@umn.edu> wrote:

> Hello,
>
> Is there a way to see what objects and functions a script
> loaded/required/used?
>
I don't think it's possible to that in PHP code.

>
> I could recursively loop through the globals, but if objects were unset,
> then i may miss some.
>

> I could make a 'tracking' object and every time i load/include a file
> (which contains a class def or a function def) to add that file to the
> tracking object...but it would be nice if i didn't have to modify my
> existing code to see which objects and functions a script actually used,
> or at least, requested and loaded into memory.
>
maybe what you are looking for is  xdebug (http://xdebug.org/). It provide
code coverage analysis.

>
> Thanks in advance,
> Daniel Kolbo
> `
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


-- 
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?

--- End Message ---
--- Begin Message ---
On Sunday 01 November 2009 2:50:55 pm Daniel Kolbo wrote:
> Hello,
>
> Is there a way to see what objects and functions a script
> loaded/required/used?
>
> I could recursively loop through the globals, but if objects were unset,
> then i may miss some.
>
> I could make a 'tracking' object and every time i load/include a file
> (which contains a class def or a function def) to add that file to the
> tracking object...but it would be nice if i didn't have to modify my
> existing code to see which objects and functions a script actually used,
> or at least, requested and loaded into memory.
>
> Thanks in advance,
> Daniel Kolbo
> `

Depends what you are trying to do with it, but I suspect these are a good 
start:

http://www.php.net/get_defined_functions
http://www.php.net/get_defined_vars
http://www.php.net/get_defined_constants
http://www.php.net/get_declared_classes
http://www.php.net/get_declared_interfaces
http://www.php.net/get_included_files

-- 
Larry Garfield
la...@garfieldtech.com

--- End Message ---
--- Begin Message ---
Hello!

I need to use shell_exec (or any other similar function) in order to compile
a java class-file.

I have all the needed components installed on my computer (Windows XP with
Java SDK) - I can use "java c:\path...." in order to compile using
Start->Run.

When I try to do the same with shell_exec or `` it returns null and it
doesn't compiles. Even when there are errors - it doesn't show them at all.

I've tried to use instead of "java c:\path..." the full java command line
compiler path but it didn't work either.


When I try functions such as "echo test" it works.


Clearly I'm missing here something - problem is... what?

-- 
Use ROT26 for best security

--- End Message ---
--- Begin Message ---
Hi,

On Sat, Oct 31, 2009 at 11:07 AM, MEM <tal...@gmail.com> wrote:

>
>
> *From:* Lex Braun [mailto:lex.br...@gmail.com]
> *Sent:* sábado, 31 de Outubro de 2009 14:05
> *To:* MEM
> *Cc:* php-gene...@lists.php.net
> *Subject:* Re: [PHP] RE: Help with my first recursion menu
>
>
>
> Hi,
>
> On Wed, Oct 28, 2009 at 5:22 PM, MEM <tal...@gmail.com> wrote:
>
> I've been told that stack is the way to go, so I'm trying to understand the
> following code:
> http://pastebin.com/m5616c88f
> I've commented every line so that any of you could see if I'm interpreting
> something wrong:
>
>
> I have two questions about this code, that hopefully someone on the list
> could explain:
>
> 1)
> Why do we need to remove the last array item? (on line 32):
> array_pop($urlStack);
>
> On line 20, $url creates an URL path that includes the $cat path.  Once
> you've completed iteration on all children of $cat, the url path should no
> longer include $cat path, thus it is removed from $urlStack.
>
>
>
>
> 2)
> Why we print the closed tag of the li element, after the recursive call?
> (on
> line 29)
> echo "</li>\n";
>
>  Line 29 is closing the li element that was opened on line 23 for $cat.
>
>
>
> Thanks a lot in advance,
> Márcio
>
>  -Lex
>
>
>
>
>
>
>
>
>
> Thanks a lot. I knew that:
>
> “Line 29 is closing the li element that was opened on line 23 for $cat.”
>
>
>
> My question intend to be more like:
>
> Why that line to close the li element is **after** the recursive call?
>
> Somehow, it seems that instead of creating something like this:
>
> <ul>
>
> <li>item1</li>
>
> <li>item2</li>
>
> <li>item3</li>
>
> </ul>
>
>
>
> We are doing:
>
> <ul>
>
> <li>item1
>
> <li>item2
>
> <li>item3
>
> </li>
>
> </ul>
>
>
>
Say you have a tree menu that contains :
$arr = array('item1' => 'Item 1', 'item2' => array('item2a' => 'Item 2a',
'item2b' => 'Item 2b'));
$urlStack = array('category');

When you call the tree() function with the above $arr values, the function
acts as follows:
1. First time through the function, the opening ul element is printed
2. First time through the foreach loop sets $cat = 'item1' and $val = 'Item
1'.
3. As this is not an array, the else condition prints <li>Item 1</li>
4. Second time through the foreach loop sets $cat = 'Item 2' and $val =
array('item2a' => 'Item 2a', 'item2b' => 'Item 2b').
5. As this is an array, the if condition prints <li><a href=''>Item</a> and
calls the tree function recursively
6. Second time through the tree function, another <ul> element is printed
and the two sub items are printed as <li>sub item</li> as they do not
contain additional arrays.  Tree function ends by printing the closing </ul>
tag.
7. The foreach loop from step 5 continues and prints the closing </li>. Tree
function ends by printing the closing </ul> tag.

The output from calling tree($arr, $urlStack) would thus be:
<ul>
<li>Item 1</li>
<li>
<a href="?path=category/Item 2">Item 2</a>
<ul>
<li>Item 2a</li>
<li>Item 2b</li>
</ul>
</li>
</ul>

--- End Message ---
--- Begin Message ---
Hi there,

I am doing an application that allows me to create RSS channels and put
feeds inside of each channel. Everything works so far, but - now I have
started to do the 'Edit Channel', 'Edit Feed', 'Delete Channel' and 'Delete
Feed' functionalities and have run into a problem. For me its a big problem
cause Im not a guru programmer but for you out there it may be a piece of
cake.

I have the following line of code:

$myFeedHTML .=  "<TH ROWSPAN=3 BGCOLOR='#99CCFF'> $feedItemImagePath <br />
<br /> <input type='Button' value='Edit' width='100px'
onClik='javascript:DeleteChannelAndAllOfItsFeeds()' /> <br /> <br
/>DELETE<br /></TH>";

In $myFeedHTML I'am always appending new HTML data to it, in this case I'am
appending a table row/header row that has an image in it and underneath the
image it has two buttons, one is for the EDIT functionality and the other is
for the DELETE functionality.

Now... notice the onClik events ->
onClik='javascript:DeleteChannelAndAllOfItsFeeds()'    . I ususally use that
method to call a javascript function from within a button or a link....and
like this is works (on its own - ie when its not being appended as a normal
string to the variable $myFeedHTML). 

But...When it is appended to a variable so that I echo everything at once in
the end, the onClik action must be included inside a " (double quotes) and
inside  ' (single quotes) so that it can be appeneded to the string, now
when this is being done everything gets mixed because of of all the " and '
thus the program thinks that these are normal escape characters and just
skips over the javascript call function that is nested within the onClik
event. So the onClik is not getting a function assigned to it. (you can see
this in the code I've pasted above)

What can I do in order to append it to my $myFeedHTML variable and at the
same time have it assigend a javascript function inside of its EDIT/DELETE
button onClik event ?

Can you give me some example maybe etc ?

Image Preview: 

http://old.nabble.com/file/p26156627/my%2BEscape%2BProblem.jpg 

btw: I know I've written onClik wrong but I wrote it this way in this forum
cause it wouldn't let me post my thread because it regards it as an illegal
tag lol. B-)B-)

Thank you very much :) ,
The Ace


-- 
View this message in context: 
http://old.nabble.com/PHP-and-Javascript-escape-character-problem%2C---%3E-those-who-like-to-solve-things-can-try-to-solve-this-issue%2C-its-tricky-I-think--%29-tp26156627p26156627.html
Sent from the PHP - General mailing list archive at Nabble.com.


--- End Message ---

Reply via email to