User talk:Sanchom

From mediawiki.org
Latest comment: 16 years ago by Sanchom in topic Applet extension

My wiki home is at w:en:User:Sanchom. Please fetch me from there if you start a conversation here. I'll come here to join any MediaWiki related conversations, but rarely check this page. Sanchom 15:22, 6 May 2007 (UTC)Reply


Applet extension[edit]

(pasted from conversation started on Wikipedia)

Hi,

Thx for your extension. However I've some problems with having it run on my wiki. I use MW 1.6.7 on Solaris. On the extension page there is no info regarding MW version supported. What environment configuration do I need to have it working - I'm able to use the applet on your website - FlightComputer. However I'm not able to get anything (I use Mozilla and IE) on my wiki - there is some info that applet has been no initialized. Do I have to set anything in my wiki (except the LocalSettings.php configuration and new applet.php added to my extensions directory).

thx, --Aretai 15:31, 27 April 2007 (UTC)Reply

I see your message here... but I'm a bit busy with school for one more day. I'll take a closer look at things and have an answer for you on Sunday probably. Talk to you later. Sancho 19:49, 27 April 2007 (UTC)Reply
Yes am still having problems with applets on my wiki. What are the requirements for the Java to be used with your extension? All other questions are still valid.
--Aretai 09:11, 1 May 2007 (UTC)Reply

Update. I've tried to run your applet (as a test) - FlightComputer.jar locally and on my wiki (http://mywiki/extensions/applet.html), but got some errors. applet.html have code:

<html>
<body>
<title>Applet</title>
<body>
<h1>Hello</h1>
<applet code="ca.ubc.cs.sanchom.DaltonPlotterApplet" archive="http://mywiki/extensions/FlightComputer.jar" 
width=525 height=900>
</applet>
</body>
</html>

and errors I get with Java console:

java.lang.ClassNotFoundException: ca.ubc.cs.sanchom.DaltonPlotterApplet
    at sun.applet.AppletClassLoader.findClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at sun.applet.AppletClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at sun.applet.AppletClassLoader.loadCode(Unknown Source)
    at sun.applet.AppletPanel.createApplet(Unknown Source)
    at sun.plugin.AppletViewer.createApplet(Unknown Source)
    at sun.applet.AppletPanel.runLoader(Unknown Source)
    at sun.applet.AppletPanel.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)
Caused by: java.io.IOException: open HTTP connection failed.
    at sun.applet.AppletClassLoader.getBytes(Unknown Source)
    at sun.applet.AppletClassLoader.access$100(Unknown Source)
    at sun.applet.AppletClassLoader$1.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)

--Aretai 09:59, 1 May 2007 (UTC)Reply

Okay, what is does the HTML source show when you view one of your wiki pages that is supposed to be rendering applet tags? Sancho 04:53, 4 May 2007 (UTC)Reply

It just renders the default java applet error "x" icon within a rectangle. Actually first the applet is being loaded (the screen displays the java rotating star) and then the "x" icon is displayed. I've managed to place one of the default applets while having it stored in my root folder with code:

<applet code="Blink.class" width=100 height=100>
</applet>

but if possible I would like to store the applets in extensions/applets and in .jar format and there are some problems here. I'm also able to display applet in the html form: http://mywiki/extensions/example1.html In this case it's GraphApplet However if I try to put it on wiki with code:

<applet code="/extensions/GraphApplet.class" width=300 height=120>
</applet>

I get nothing. --Aretai 09:51, 4 May 2007 (UTC)Reply

  • I mean, can you load one of the pages that you think should be displaying an Applet and view the HTML source of the page? (There should be a menu item somewhere that lets you "view source"). Let me know how the applet tag ended up being served to your browser. Sancho 14:34, 4 May 2007 (UTC)Reply

OK. Sorry have misunderstood you. Here is what I get (sorry won't post the whole page source):

<p><applet archive="http://mywiki/extensions/FlightComputer.jar" code="ca.ubc.cs.sanchom.DaltonPlotterApplet" width="525" height="900" ></applet></p>


I tried to have it in the main directory (as other working applets), but still get the error. The code here is:

<p><applet archive="http://mywiki/FlightComputer.jar" code="ca.ubc.cs.sanchom.DaltonPlotterApplet" width="525" height="900" ></applet>
</p>

--Aretai 16:01, 4 May 2007 (UTC)Reply

  • And you have checked that you have given the FlightComputer.jar the correct permissions on your server? Sancho 16:23, 4 May 2007 (UTC)Reply
    • Also, the HTML source that you posted above shows that the applet extension is working properly. It seems to create the correct HTML applet tags. The problem is with your set-up... perhaps the permissions on the .jar file?... Sancho 15:21, 6 May 2007 (UTC)Reply
Yeah I have checked the permissions thing. Yes it is important, however doesn't fix it this time. i.e. I'm not able to see this particular applet run on my wiki. However I've checked around how to call the applet and eventually succeeded with the java classes stored on diff than root folder and so with the .jar files. So thx for your help anyway.

--Aretai 11:44, 8 May 2007 (UTC)Reply

  • I'd suggest a slight change to the code. Currently your extension doesn't support the param tags (parameters for applets). It can be easily fixed with:
foreach( $expected_tags as $tag ) {
	if ( isset($argv[$tag]) )
		$output .= $tag . "=\"" . $argv[$tag] . "\" ";
    }

    $output .= ">".$input."</applet>";

    return $output . "\n";

instead of

	if ( isset($argv[$tag]) )
		$output .= $tag . "=\"" . $argv[$tag] . "\" ";
    }

    $output .= "></applet>";

    return $output . "\n";

Then users can specify a parameter they want to have applet running. It may be quite useful - example: http://java.sun.com/applets/jdk/1.4/demo/applets/BarChart/example1.html - user can create his own bar charts. Also have you thought of making it compliant with w3c specification? - http://www.w3.org/TR/html4/struct/objects.html#h-13.4 --Aretai 15:28, 10 May 2007 (UTC)Reply

  • Yes, I should make both of these changes... thanks for the suggestions. This isn't a great extension right now. It did what I needed, which was minimal rendering of applet tags into the HTML. I didn't even know they were deprecated! I will make these changes. Sanchom 16:13, 16 May 2007 (UTC)Reply