This week's book giveaway is in the JavaScript forum.
We're giving away four copies of Svelte and Sapper in Action and have Mark Volkmann on-line!
See this thread for details.
Win a copy of Svelte and Sapper in Action this week in the JavaScript forum!

Peter Lager

Greenhorn
+ Follow
since Nov 10, 2012
Peter likes ...
C++ Java
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Peter Lager

Hi Adam thanks for the additional info on mime-type I will investigate that further. In the meantime I have found a work around by simply removing the test for the Content-Type. I know this is not good practice but for the time being it will do. If you visit my website you will see the animation working.


Thanks guys.
Hi Adam thanks for the pointer towards Firebug it is interesting that my new host does not appear to produce the "Content-Type" header when trying to load the file. (See image) so I will revisit the code and do some experiments but any suggestions are appreciated.

I cannot compare the responses from both servers because I have transferred my domain name and website to the new host and I can't access the old host servers.

It is not a cross domain issue because all the files are in the same domain (lagers.org.uk) and on the same host servers.

I am not using JQuery because I am totally new to JavaScript programming and this was my first serious JavaScript (learning) project.
I have recently moved web hosts and some Javascript that worked on my old host does not work on the new host. The getPattern method is responsible for initiating a file load by calling the getText method.
The console output indicates that the call to getResponceHeader(...) line 16 returns null which is unexpected behaviour. Any ideas / solutions welcome.


In line 9 it calls the getText method


Console Output
The .LIF files are simple text files storing cell position data for Conway's Game of Life

Get text Q7.LIF Type 16 lifepattern.js:32:3
Get text Q11.LIF Type 1 lifepattern.js:32:3
Ready state 2 status 200 httpget.js:21:4
Ready state 3 status 200 httpget.js:21:4
Ready state 4 status 200 httpget.js:21:4
Getting response header httpget.js:24:4
ResponseHeader null httpget.js:26:4
syntax error Q11.LIF:1:1
TypeError: type is null httpget.js:27:0
Ready state 2 status 200 httpget.js:21:4
Ready state 3 status 200 httpget.js:21:4
Ready state 4 status 200 httpget.js:21:4
Getting response header httpget.js:24:4
ResponseHeader null httpget.js:26:4
syntax error Q7.LIF:1:1
TypeError: type is null httpget.js:27:0
I am a Java programmer and I am interested in using JavaScript. I have several Java libraries that I wish to convert to JS. I am using Eclipse Keplar and experimenting with the VJET plugin. I have been going through the VJET tutorials and have created a couple of test classes in JS.

I tried the JS2Java code generation feature of VJET and got the following response

Js 2 Java code generation
Done
Generator output:
file:/Users/peter/Documents/e-workspaces/wsPKL-JScript/Vjet3/src/Test.java
file:/Users/peter/Documents/e-workspaces/wsPKL-JScript/Vjet3/src/TestJsr.java
Generator complete.


Great I got two the two Java files to play with.

I then created a Java project with a very simple Java class and attempted to convert it to JS with the following result

Java to JS code generation
Done
Generator output:
Generator complete.


i.e. no JS files.

I tried putting the Java class in the VJET Project but that had no effect. I have looked at the VJET help docs but it doesn't cover this area.

Any help would be appreciated.
6 years ago
I have been launching it locally using the WebStorm IDE into GoogleChrome.

Anyway I tried uploading it to a webserver and it worked fine on both GoogleChrome and Firefox and it worked fine. Out of interest I tried opening it locally with FireFox and again it worked. Just seemed to be file:/// URLs with GoogleChrome.

Since the all the files were in the same directory I did not anticipate security issues becase they were not crossOrigin.

Thanks for pointing me in the right direction.
I am just started with JavaScript and I am trying to manipulate image data at the pixel level. The code below is taken from a book and it is supposed to
  • load an image,
  • display it in a canvas object,
  • grab the pixels on the left side and invert them and finally
  • display the inverted image



  • Webpage HTML


    Then canvas.js



    I am probably missing something very simple but I can only get the first image to appear. Any help is apprciated.
    The applet I have created is a fixed size 660px by 420px and when the browser zoom is 1.0 then it sets aside an area 660px x 420px which is good. Now when the mouse wheel is used to zoom in then it increases the area set aside for the applet. So if the zoom level is 2 it sets aside 1320x840px but I want this area to remain as 660x420px.

    The applet object has an id 'myapplet' and the div id is 'AppletDiv' and the code in size_changed is my effort to control the applet size
  • by changing the applet_height and applet_width variables depending on the zoom level (r.zoom)


  • use javascript to set the myapplet and AppletDiv objects with



  • This is my first effort to use JavaScript in a meaningful way so a lot of what I am doing is hack and see so any suggestions are welcome.

    Thanks for reading.
    I have a web page with an applet (using object tag) inside a div region which can be seen [url=http://www.lagers.org.uk/temp/applet/indexjs_2.html here[/url].

    The problem I have is that the Java layout for the applet is fixed size but when using the mouse wheel to zoom in/out of the webpage the 'applet area' increases and what I want to enforce a maximum size.

    I have posted the page source inside the body tags below. Sorry about the length but the resize stuff is near the end.


    Using the Bank application as an example assume you create a class called Account which has a public field called accNbr (the account number). Because it is declared public then it can be changed from anywhere in the entire bank application software. What happens if the actual number is wrong for instance it has only 7 digits when the bank uses 8 digits for account numbers - the account has become 'invisible'. If the field had been declared private (encapsulated) in the Account class with a public method setAccNbr e.g.
    public boolean setAccNbr(long accNbr) { ...
    then this method could be used to validate the parameter, change the field only if it is ok and pass back true/false depending if it was valid.
    It means that the whole bank application must use this method to set the account number so ensuring that it is valid.
    7 years ago