You can subscribe to this list here.
| 2004 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(6) |
Oct
(6) |
Nov
(8) |
Dec
(2) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2005 |
Jan
(19) |
Feb
(15) |
Mar
(10) |
Apr
(8) |
May
(7) |
Jun
(9) |
Jul
(13) |
Aug
(31) |
Sep
(111) |
Oct
(52) |
Nov
(72) |
Dec
(42) |
| 2006 |
Jan
(21) |
Feb
(32) |
Mar
(33) |
Apr
(24) |
May
(15) |
Jun
(40) |
Jul
(32) |
Aug
(19) |
Sep
(38) |
Oct
(37) |
Nov
(63) |
Dec
(37) |
| 2007 |
Jan
(18) |
Feb
(39) |
Mar
(69) |
Apr
(49) |
May
(71) |
Jun
(59) |
Jul
(71) |
Aug
(85) |
Sep
(46) |
Oct
(14) |
Nov
(25) |
Dec
(56) |
| 2008 |
Jan
(24) |
Feb
(77) |
Mar
(104) |
Apr
(44) |
May
(41) |
Jun
(11) |
Jul
(31) |
Aug
(59) |
Sep
(44) |
Oct
(86) |
Nov
(66) |
Dec
(93) |
| 2009 |
Jan
(88) |
Feb
(41) |
Mar
(49) |
Apr
(135) |
May
(22) |
Jun
(31) |
Jul
(60) |
Aug
(71) |
Sep
(76) |
Oct
(18) |
Nov
(52) |
Dec
(20) |
| 2010 |
Jan
(8) |
Feb
(50) |
Mar
(35) |
Apr
(48) |
May
(46) |
Jun
(84) |
Jul
(38) |
Aug
(61) |
Sep
(51) |
Oct
(31) |
Nov
(17) |
Dec
(18) |
| 2011 |
Jan
(51) |
Feb
(14) |
Mar
(17) |
Apr
(23) |
May
(15) |
Jun
(11) |
Jul
(5) |
Aug
(5) |
Sep
(15) |
Oct
(8) |
Nov
(5) |
Dec
(25) |
| 2012 |
Jan
(2) |
Feb
(4) |
Mar
(6) |
Apr
(9) |
May
(27) |
Jun
(32) |
Jul
(36) |
Aug
(10) |
Sep
(16) |
Oct
(3) |
Nov
(13) |
Dec
(7) |
| 2013 |
Jan
(1) |
Feb
(4) |
Mar
|
Apr
(1) |
May
|
Jun
(2) |
Jul
|
Aug
(1) |
Sep
(4) |
Oct
(2) |
Nov
(1) |
Dec
|
| 2014 |
Jan
|
Feb
|
Mar
(2) |
Apr
(1) |
May
(2) |
Jun
(9) |
Jul
(5) |
Aug
(2) |
Sep
(4) |
Oct
|
Nov
|
Dec
|
| 2015 |
Jan
(3) |
Feb
(2) |
Mar
(4) |
Apr
(3) |
May
(1) |
Jun
(2) |
Jul
|
Aug
(2) |
Sep
(5) |
Oct
(1) |
Nov
|
Dec
|
| 2016 |
Jan
|
Feb
(5) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(5) |
Sep
(3) |
Oct
|
Nov
|
Dec
|
| 2017 |
Jan
(6) |
Feb
|
Mar
|
Apr
(10) |
May
(2) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(1) |
Nov
(1) |
Dec
|
| 2018 |
Jan
(2) |
Feb
(5) |
Mar
|
Apr
|
May
(1) |
Jun
(3) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2019 |
Jan
|
Feb
(1) |
Mar
|
Apr
|
May
|
Jun
|
Jul
(1) |
Aug
(1) |
Sep
|
Oct
|
Nov
|
Dec
|
| 2020 |
Jan
|
Feb
(2) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(2) |
Oct
|
Nov
|
Dec
|
| 2021 |
Jan
(5) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2023 |
Jan
|
Feb
(2) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
|
From: <php...@li...> - 2007-09-25 12:14:58
|
Hi Jost,
thanks for the quick response. it works now (see below)
On 9/25/07, php...@li... <
php...@li...> wrote:
> Hi,
>
> >
> [o(DepMnt0302AcctDispDelSrvImport$InBankParameters)]->setCurrTrxDate((Date)c(Date)).
>
> AFAIK you need to pass a date object. Not a class. Note the "c" above.
So c for class and o for object (yes it is obvious now I know)
> > $java_date = new Java("java.sql.Date");
>
> You cannot instanciate java.sql.Date() because no such constructor exists.
> You probably want
>
> java("java.sql.Date")->valueOf(...);
That did not work. I can howeever create an instance of java.sql.Date even
if no such constructor exists (bug?)
> > $java_date->valueOf("2007-12-07");
>
> Why do you ask the date class "$java_date" to return an instance
> "2007-12-07" and then throw it
> away?
That was the problem. I did not realise that I was throwing it away.
The complete code that works is:
$java_date = *new* Java("java.sql.Date");
$java_date = $java_date->valueOf("2007-12-07");
$proxy_input->getInParameters()->getInBankParameters()->setCurrTrxDate(
$java_date);
Note the
$java_date = $java_date->valueOf("2007-12-07");
instead of the line that I had originally
$java_date->valueOf("2007-12-07");
Thanks again,
Apostolos
|
|
From: <php...@li...> - 2007-09-25 11:50:46
|
Hi,
> [o(DepMnt0302AcctDispDelSrvImport$InBankParameters)]->setCurrTrxDate((Date)c(Date)).
AFAIK you need to pass a date object. Not a class. Note the "c" above.
> $java_date = new Java("java.sql.Date");
You cannot instanciate java.sql.Date() because no such constructor exists. You probably want
java("java.sql.Date")->valueOf(...);
For backward compatibility the JavaBridge allows the above construct, but it issues a warning on
log level 3 and above that you should correct the above code or use new JavaClass("java.sql.Date")
instead, if that's what you want.
> $java_date->valueOf("2007-12-07");
Why do you ask the date class "$java_date" to return an instance "2007-12-07" and then throw it
away?
Regards,
Jost Boekemeier
__________________________________
Yahoo! Clever - Der einfachste Weg, Fragen zu stellen und Wissenswertes mit Anderen zu teilen. www.yahoo.de/clever
|
|
From: <php...@li...> - 2007-09-25 10:30:28
|
Hi,
I have instantiated a Java object in PHP 5.1.6 using the version 3.2.1b of
the php/java bridge.
I am trying to call a method (setCurrTrxDate) that expects a
java.sql.Dateparameter to be passed and I am getting the following
Java exception:
java.lang.Exception: Invoke failed:
[o(DepMnt0302AcctDispDelSrvImport$InBankParameters)]->setCurrTrxDate((Date)c(Date)).
Cause: java.lang.IllegalArgumentException: argument type mismatch
Responsible VM: 1.5.0_09
The relevant PHP code is:
$java_date = new Java("java.sql.Date");
$java_date->valueOf("2007-12-07");
$proxy_input->getInParameters()->getInBankParameters()->setCurrTrxDate($java_date);
I cannot understand why I am getting the type mismatch and I do not
understand the (Date)c(Date) part in the exception :-(
Any suggestions will be highly appreciated,
Apostolos
|
|
From: <php...@li...> - 2007-09-20 09:04:32
|
Hi, [creating a java object from a php value] please re-read the java_session() and java_closure() documentation on http://php-java-bridge.sourceforge.net/pjb/docs/php-api/java_8c.html#doc25 and http://php-java-bridge.sourceforge.net/pjb/docs/php-api/java_8c.html#doc32 Also please see the FAQ entry "how do I create a Java object from a PHP value". Regards, Jost Boekemeier __________________________________ Kennt man wirklich jeden über 3 Ecken? Die Antworten gibt's bei Yahoo! Clever. www.yahoo.de/clever |
|
From: <php...@li...> - 2007-09-19 19:31:52
|
Hi all
Is it possible put an php object inside of a java session,
like this :
$session=java_session("testSession");
$session->put("obj", $php_object);
Thank you
--
Juliano
|
|
From: <php...@li...> - 2007-09-19 19:22:32
|
Got it, turns out my editor wasn't saving to the original Options.php. My
bad, sorry for the spam.
Shahin
On 9/19/07, ssa...@uc... <ssa...@uc...> wrote:
>
> Note that I also changed define ("JAVA_HOSTS", "127.0.0.1:8080"); to
> define ("JAVA_HOSTS", "127.0.0.1:8081"); in the Options.php in Apache's
> htdocs/java/ with no luck.
>
> Shahin
>
> On 9/19/07, ssa...@uc... < ssa...@uc...> wrote:
> >
> > Hello,
> >
> > I've placed JavaBridge.war in Tomcat's webapps dir, and test.php and
> > java/ are in Apache's htdocs. Apache is on localhost:8080, and Tomcat is on
> > localhost:8081. http://localhost:8080/test.php gives me phpinfo()
> > output, but directly below I get:
> >
> > protocol error: Method Not Allowed
> > The requested method PUT is not allowed for the URL
> > /JavaBridge/JavaBridge.phpjavabridge.
> > , Internal error at col 4
> >
> > I get the same output for http://localhost:8081/JavaBridge/test.php ,
> > and the Session and php Numberguess examples give me the same error. What
> > am I doing wrong?
> >
> > I also tried the above with JavaBridge.jar and php-servlet.jar in
> > Tomcat's shared/lib dir.
> >
> > Thanks in advance for your help.
> >
> > Shahin
> >
>
>
|
|
From: <php...@li...> - 2007-09-19 19:13:00
|
Note that I also changed define ("JAVA_HOSTS", "127.0.0.1:8080"); to define
("JAVA_HOSTS", "127.0.0.1:8081"); in the Options.php in Apache's
htdocs/java/ with no luck.
Shahin
On 9/19/07, ssa...@uc... <ssa...@uc...> wrote:
>
> Hello,
>
> I've placed JavaBridge.war in Tomcat's webapps dir, and test.php and java/
> are in Apache's htdocs. Apache is on localhost:8080, and Tomcat is on
> localhost:8081. http://localhost:8080/test.php gives me phpinfo() output,
> but directly below I get:
>
> protocol error: Method Not Allowed
> The requested method PUT is not allowed for the URL
> /JavaBridge/JavaBridge.phpjavabridge.
> , Internal error at col 4
>
> I get the same output for http://localhost:8081/JavaBridge/test.php , and
> the Session and php Numberguess examples give me the same error. What am I
> doing wrong?
>
> I also tried the above with JavaBridge.jar and php-servlet.jar in Tomcat's
> shared/lib dir.
>
> Thanks in advance for your help.
>
> Shahin
>
|
|
From: <php...@li...> - 2007-09-19 17:24:53
|
Hello, I've placed JavaBridge.war in Tomcat's webapps dir, and test.php and java/ are in Apache's htdocs. Apache is on localhost:8080, and Tomcat is on localhost:8081. http://localhost:8080/test.php gives me phpinfo() output, but directly below I get: protocol error: Method Not Allowed The requested method PUT is not allowed for the URL /JavaBridge/JavaBridge.phpjavabridge. , Internal error at col 4 I get the same output for http://localhost:8081/JavaBridge/test.php, and the Session and php Numberguess examples give me the same error. What am I doing wrong? I also tried the above with JavaBridge.jar and php-servlet.jar in Tomcat's shared/lib dir. Thanks in advance for your help. Shahin |
|
From: <php...@li...> - 2007-09-14 09:02:02
|
Hi,
> PHP scripts, the protocol also enables access of PHP scripts from within Java
> classes. However, I have not found any documentation or examples which
please re-read the INSTALL.J2SE document.
If you double-click on test.bat or test.sh, version 4.2 starts a test Java web server which allows
you to run any JSR223 script engine.
Regards,
Jost Boekemeier
__________________________________
Kennt man wirklich jeden über 3 Ecken? Die Antworten gibt's bei Yahoo! Clever. www.yahoo.de/clever
|
|
From: <php...@li...> - 2007-09-13 20:44:59
|
Dear php/Java bridge developers I would like to implement Java classes that use php/Java bridge to access functions of existing PHP scripts. The homepage of php/Java bridge states that besides accessing Java classes in PHP scripts, the protocol also enables access of PHP scripts from within Java classes. However, I have not found any documentation or examples which explain how this can be achieved. I would be grateful if you gave me some tips or point to any resources regarding this. Yours Ferdinand Tatzig |
|
From: <php...@li...> - 2007-09-11 18:22:19
|
Hi,
> solution. I am unsure of where I should put all my jar files and my conf files and dictionary
> dir.
please re-read the "libraries" section from the README and FAQ; the libs belong to WEB-INF/lib, if
you want to create a distributable web application or into {php.java.bridge.base}/lib, if you want
to use the standalone application.
The conf files should go into a jar file or into {php.java.bridge.base}/lib or WEB-INF/classes.
Temporary files should go into a directory within java.io.tempdir. Please see the Java system
properties php.java.bridge.base, java.io.tmpdir and java.ext.dirs.
Regards,
Jost Boekemeier
Heute schon einen Blick in die Zukunft von E-Mails wagen? www.yahoo.de/mail
|
|
From: <php...@li...> - 2007-09-11 13:25:55
|
Hi, I've written a Java app that uses a couple of external Jar libraries : = lucene, commons-logging and jwnl (Java WordNet library). This wordnet = library also requires some conf files and a dictionary directory. The Java part of this app work perfectly but now I wish to call a Java = method from a php environment. I've successfully installed the Java/php = bridge following this guide http://www.dsl.uow.edu.au/~sk33/php5java.htm When i test the bridge with the helloworld app, it works. However, I've = been trying to figure out how to get my own Java project to work for a = few days now and I can't seem to find the solution. I am unsure of where = I should put all my jar files and my conf files and dictionary dir. I = tried putting everything in my htdocs, but that didn't work. Placing the = libraries in the php/ext dir doesnt do the trick either. Packing = everything in one jar doesn't work. I'm running out of idea's and can't = find documentation that describes how I should handle this. Any help is more then welcome. |
|
From: <php...@li...> - 2007-09-11 13:23:24
|
> Why don't you simply put the code in a procedure and invoke
> it when needed?
Sure - it's a bit unusal though, to include stuff this way, but it
would work.
Frankly, I don't quite understand why there is such unexpected and
strong reluctance to accept my proposed tiny, tiny modification. Just
change lines 5-7 from:
...
$version = phpversion();
if ((version_compare("5.1.2", $version(), ">"))) {
$msg = '<br><strong>PHP '.$version.' too old.</strong>...
...
to:
...
if ((version_compare("5.1.2", phpversion(), ">"))) {
$msg = '<br><strong>PHP '.phpversion().' too old.</strong>...
...
and then there won't be any more such trouble (and also no special
"style" or wrapper necessary to include the bridge necessary).
Take it or leave it...
Michael
|
|
From: <php...@li...> - 2007-09-11 12:11:47
|
Hello!
Why don't you simply put the code in a procedure and invoke it when needed?
For example:
<?php
$version=3.14;
function func(){
include("http://localhost:8080/JavaBridge/java/Java.inc");
}
func();
$s = new java("java.lang.String", "hello");
echo $s; echo " "; echo $version;
?>
should display hello 3.14.
Peter
---------------------------------
Pinpoint customers who are looking for what you sell.
|
|
From: <php...@li...> - 2007-09-11 07:22:54
|
> -----Original Message----- > From: php...@li... > [mailto:php...@li...] > On Behalf Of php...@li... > Sent: Dienstag, 11. September 2007 00:04 > To: php...@li... > Subject: Re: [Php-java-bridge-users] PLEASE name > globallyvisiblevariablesvery unique! > > > Why not just include java.inc first? Then, even if it does > use variables they you've set, then you'll overwrite the > value and it won't be an issue. I can't see any reason why > you couldn't do the include at the top of the page. I always > put it just after session_start(); > > --Nathan Shaskin > Compliance Publishing Because that part that declares $version is outside the code, that I write, as is the code that later checks for it. My code is dynamically, i.e. at runtime, embedded into this sequence. The code that declares $version and the code that uses it are both outside my control. I am essentially just providing the middle part that returns some values (using the java-bridge). I agree, that this is maybe not the best possible solution, but that's the way this library, that I am using, works... Michael |
|
From: <php...@li...> - 2007-09-10 22:03:49
|
Why not just include java.inc first? Then, even if it does use variables they you've set, then you'll overwrite the value and it won't be an issue. I can't see any reason why you couldn't do the include at the top of the page. I always put it just after session_start();
--Nathan Shaskin
Compliance Publishing
php...@li... wrote: > -----Original Message-----
> From: php...@li...
> [mailto:php...@li...]
> On Behalf Of php...@li...
> Sent: Montag, 10. September 2007 19:43
> To: php...@li...
> Subject: Re: [Php-java-bridge-users] PLEASE name globally
> visiblevariablesvery unique!
>
> ...
> Other libraries use similar code in their setup. I don't see
> a problem
> with this. I don't even understand the problem.
Sigh! My last attempt before giving up hope:
I have code like that roughly looks as follows.
---------------
...
$version = '1.0.0'; // this may also - say - be passed in as
parameter.
...
require_once(
);
...
...
// followed my some other code, that expects to see the
// variable value defined at the begin (or being passed in):
...
read_file('foo_bar_'.$version.'.xyz'); // supposed to read
'foo_bar_1.0.0.xyz'
...
---------------
then this code would now suddenly search for 'foo_bar_5.2.3.xyz'
(which most likely will not exist and hence this method fails), since
the innocently looking require_once(...) has modified the $version
variable during the check for the current php-version.
Why is it so hard to understand, that I simply ask, NOT to use a
variable called "$version"? As we have seen this is a very likely
variable name, may thus already exist and its modification can lead to
unexpected results.
I guess your answer will now be: MY code should not use a variable
called "$version", but since this is code that sits in a third party
library that I do not want to modify (since I then would have to
repeat that same modification in each new version) this is not an
option.
Hope I could make myself clear and if not I don't care any more...
Michael
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
php-java-bridge-users mailing list
php...@li...
https://lists.sourceforge.net/lists/listinfo/php-java-bridge-users
---------------------------------
Park yourself in front of a world of choices in alternative vehicles.
Visit the Yahoo! Auto Green Center.
|
|
From: <php...@li...> - 2007-09-10 20:46:59
|
> -----Original Message-----
> From: php...@li...=20
> [mailto:php...@li...]=20
> On Behalf Of php...@li...
> Sent: Montag, 10. September 2007 19:43
> To: php...@li...
> Subject: Re: [Php-java-bridge-users] PLEASE name globally=20
> visiblevariablesvery unique!
>=20
> ...
> Other libraries use similar code in their setup. I don't see=20
> a problem=20
> with this. I don't even understand the problem.
Sigh! My last attempt before giving up hope:
I have code like that roughly looks as follows.
---------------
...
$version =3D '1.0.0'; // this may also - say - be passed in as
parameter.
...
require_once(<php-bridge's Java.inc>);
...
<do somethings with the java-bridge>
...
// followed my some other code, that expects to see the=20
// variable value defined at the begin (or being passed in):
...
read_file('foo_bar_'.$version.'.xyz'); // supposed to read
'foo_bar_1.0.0.xyz'
...
---------------
then this code would now suddenly search for 'foo_bar_5.2.3.xyz'
(which most likely will not exist and hence this method fails), since
the innocently looking require_once(...) has modified the $version
variable during the check for the current php-version.
Why is it so hard to understand, that I simply ask, NOT to use a
variable called "$version"? As we have seen this is a very likely
variable name, may thus already exist and its modification can lead to
unexpected results.=20
I guess your answer will now be: MY code should not use a variable
called "$version", but since this is code that sits in a third party
library that I do not want to modify (since I then would have to
repeat that same modification in each new version) this is not an
option.
Hope I could make myself clear and if not I don't care any more...
Michael
|
|
From: <php...@li...> - 2007-09-10 17:47:08
|
Hi,
> DeclaredMethods (according to getDeclaredMethods):
> - doSomething([Ljava.lang.String;)
> - doSomething(java.util.List)
you could use java_inspect($object), which also prints the methods. :)
> I've tried to pass a single string the following ways:
> - java.lang.reflect.Array with java.lang.String
> - java.util.Arrays->asList with array('...')
> - ArrayList, how do I cast this to a java.util.List ?
All wrong. :) You need to pass a typed array.
> I keep getting a NoSuchMethodException.
Just pass a Java array or let the PHP/Java Bridge coerce the argument. For example:
$varargs = array("1", "2", "3");
or
$varargs = array (new Java("java.lang.String", "1"), new Java("java.lang.String", "2"), ...);
should work.
Regards,
Jost Boekemeier
Heute schon einen Blick in die Zukunft von E-Mails wagen? www.yahoo.de/mail
|
|
From: <php...@li...> - 2007-09-10 17:42:34
|
Hi Michael,
> > This means that we have to prefix all *temporary* variables
> > with java_. I don't think this is a good idea.
>
> Well - if you want to similar effect in other environments, then I
> guess this would be needed.
I don't think so. People shouldn't write unnatural code. I have never seen prefixes for temporary
variables such as:
for($myLib_i=0; $myLib_i<100; $myLib_i++) {...}
> that $version was actually the only var that is used in that way.
Other libraries use similar code in their setup. I don't see a problem
with this. I don't even understand the problem.
If you use the following code:
$i=something;
require_once("some_lib.php") ::= { ... for($i=0; $i<100; $i++) ... }
doSomethingWith($i);
then there's a bug in your code, I think. Your global variable "$i" should be named "$myApp_i",
not simply "$i".
Regards,
Jost Boekemeier
Wissenswertes für Bastler und Hobby Handwerker. BE A BETTER HEIMWERKER! www.yahoo.de/clever
|
|
From: <php...@li...> - 2007-09-10 17:31:12
|
Hi, according to http://msdn2.microsoft.com/en-us/library/ms740668.aspx the winsock error #10054 means: Connection reset by peer. An existing connection was forcibly closed by the remote host. This normally results if the peer application on the remote host is suddenly stopped, the host is rebooted, the host or remote network interface is disabled, or the remote host uses a hard close (see setsockopt for more information on the SO_LINGER option on the remote socket). This error may also result if a connection was broken due to keep-alive activity detecting a failure while one or more operations are in progress. Operations that were in progress fail with WSAENETRESET. Subsequent operations fail with WSAECONNRESET. Isn't it possible to shut down the back end? How do you stop tomcat? However, this is not a problem with the PHP/Java Bridge. The bridge uses pfsockopen() to create a persistent connection to the back end. PHP can and should detect if the back end has been restarted or not. Regards, Jost Boekemeier Machen Sie Yahoo! zu Ihrer Startseite. Los geht's: http://de.yahoo.com/set |
|
From: <php...@li...> - 2007-09-10 16:02:52
|
Whenever the PHP/JavaBridge on Apache has lost connection to Tomcat, then that was it! If - for example - Tomcat has been brought down and restarted, then the next time I want to call some java-code I get the following notice: -------------------------------------------------------------- Notice: fwrite() [function.fwrite]: send of 117 bytes failed with errno=3D10054 An existing connection was forcibly closed by the remote host. in C:\Program Files\xampp\htdocs\test\Java.inc on line 740 protocol error: , Invalid document end at col 8. Check the back end log for details. Notice: fwrite() [function.fwrite]: send of 11 bytes failed with errno=3D10054 An existing connection was forcibly closed by the remote host. in C:\Program Files\xampp\htdocs\test\Java.inc on line 746 -------------------------------------------------------------- In other words, if one side goes down, one has to bring down the other as well and has to restart both. Only then they will "find" each other again. Couldn't the bridge try to reconnect? I find it a bit tedious and also not very robust, that I always have to bring down both sides in lock-step and can't simply let one run all the time. Michael |
|
From: <php...@li...> - 2007-09-10 14:32:44
|
I think you could/should use an array(). For example the code below displays 12:
--- varargs.php ---
<?php require_once("http://localhost:9092/JavaBridge/java/Java.inc");
java_require("varargs.jar");
$varargs = new java("Varargs");
$t1 = new java('Varargs$Test', 1);
$t2 = new java('Varargs$Test', 2);
echo $varargs->varargs(array($t1, $t2));
?>
--- Varargs.java ---
public class Varargs {
public static class Test {
public int i;
public Test (int i) {
this.i = i;
}
public String toString() {
return String.valueOf(i);
}
}
public static String varargs(Test ...tests) {
StringBuffer buf = new StringBuffer();
for (Test test : tests) {
buf.append(test);
}
return buf.toString();
}
public static void main(String[] args) {
System.out.println(varargs(new Test(1), new Test(2)));
}
}
Peter
---------------------------------
Moody friends. Drama queens. Your life? Nope! - their life, your story.
Play Sims Stories at Yahoo! Games.
|
|
From: <php...@li...> - 2007-09-10 10:32:10
|
Hi Jost,=20
> -----Original Message-----
> From: php...@li...=20
> [mailto:php...@li...]=20
> On Behalf Of php...@li...
> Sent: Montag, 10. September 2007 11:32
> To: php...@li...
> Subject: Re: [Php-java-bridge-users] PLEASE name globally=20
> visible variablesvery unique!
>=20
> ...
> how can a temporary variable, which is used only within the=20
> Java.inc block, break your application?
OK - maybe "global" was the wrong term here. It's not really "global"
in the PHP sense. Apologies!
But it is "global" in the sense, that obviously the code, that I am
using (a widget library for which I was creating additional widgets
that then get dynamically loaded) creates an environment into which
that widget code gets dynamically loaded and embedded and in that
environment there obviously already exists a variable "$version".
> ...
> $version is a variable which is used only in the if() block.=20
> Since php currently doesn't support name spaces, it is=20
> created in the global environment instead. Whether or not an=20
> included library uses temporary bindings in the global=20
> environment should not affect a well-written application.
If there already exists a variable "$version" OUTSIDE (i.e. before)
the if-block, then obviously it takes that variable (and does not
create and use a new local var) and so overwrites its value, i.e. that
statement has an outside noticable effect.
> This means that we have to prefix all *temporary* variables=20
> with java_. I don't think this is a good idea.=20
Well - if you want to similar effect in other environments, then I
guess this would be needed. However, I just checked again, it seems
that $version was actually the only var that is used in that way.
Everything else seems to be used inside functions or classes and
should thus not harm. And all others var and constants that I found
during my quick glance ($JAVA_BASE, JAVA_HOST, JAVA_SERVLET,
JAVA_LOG_LEVEL, etc.) are already named such, that they are rather
unlikely to clash (and if they do, the names already suggests where to
look...). I hope I didn't miss any, though.
=20
> > I even suggest to NOT use any variable here, but to write=20
> this snippet=20
> > as
> > follows:
> > ...
> > if ((version_compare("5.1.2", phpversion(), ">"))) {
> > $msg =3D '<br><strong>PHP '.phpversion().' too=20
> old.</strong><br>\nFor
>=20
> How does this help? The temp var $msg is also created in the=20
> global environment.
Agreed - one could even compose the msg directly in the method call
thus avoiding the declarartion and use of $msg, but since that
variable is only used in the subsequent die(...) anyway, I did not
consider that an issue, while the use (and possible modification) of
"$version" obviously IS an issue and should be avoided.
Look, I didn't mean to cause a major headache here. I only reported a
problem that I banged into using the PHP/JavaBridge in my environment
and a IMHO really minor change, that allows to fix this and avoid
similar griefs for others in the future.=20
Michael
|
|
From: <php...@li...> - 2007-09-10 09:32:28
|
Hi,
> code, I didn't actually *use* anything from it, yet, just including it was
> enough to break my application.
how can a temporary variable, which is used only within the Java.inc block, break your
application?
> After some quite substantial investigation I had to learn, that the reason
> was, that the Java.inc file uses a globally visible variable "$version"
$version is a variable which is used only in the if() block. Since php currently doesn't support
name spaces, it is created in the global environment instead. Whether or not an included library
uses temporary bindings in the global environment should not affect a well-written application.
For version 4.2.3 we could turn the code block into a lambda() and immediately invoke it. This way
the bindings are created local to the anonymous function and do not pollute the global env.
> Apparently some other code that I am using also checks for such a variable.
> It expects to find 1.0.0 but now found 5.2.3 (the PHP version I am using)
Isn't it possible to keep your *global variables* in a separate map? BTW: I would prefix all
global variables with appname_ to avoid clashes with other libs. Temporary bindings don't need to
prefixed, though.
> if you use (and then leave around) such globally visible variables, then
> PLEASE make their names VERY unique.
This means that we have to prefix all *temporary* variables with java_. I don't think this is a
good idea.
However, we can and probably should turn global code blocks into anonymous functions and invoke
them immediately.
> I even suggest to NOT use any variable here, but to write this snippet as
> follows:
> ...
> if ((version_compare("5.1.2", phpversion(), ">"))) {
> $msg = '<br><strong>PHP '.phpversion().' too old.</strong><br>\nFor
How does this help? The temp var $msg is also created in the global environment.
Regards,
Jost Boekemeier
__________________________________
Yahoo! Clever - Der einfachste Weg, Fragen zu stellen und Wissenswertes mit Anderen zu teilen. www.yahoo.de/clever
|
|
From: <php...@li...> - 2007-09-10 09:19:52
|
Hi,
I'm having some problems with a Java 1.5 feature.
I have a java class with a function like:
public void doSomething(String...) {
...
}
DeclaredMethods (according to getDeclaredMethods):
- doSomething([Ljava.lang.String;)
- doSomething(java.util.List)
I've tried to pass a single string the following ways:
- java.lang.reflect.Array with java.lang.String
- java.util.Arrays->asList with array('...')
- ArrayList, how do I cast this to a java.util.List ?
I keep getting a NoSuchMethodException.
Any suggestions?
Setup:
- Apache 2.2.4
- PHP 5.2.3
- Tomcat 5.5.17
- Java Bridge 4.2.2
|