NetTalk Central

Author Topic: Error in Javascript Web9 SSL Example (cont)  (Read 4904 times)

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11175
    • View Profile
Error in Javascript Web9 SSL Example (cont)
« on: July 12, 2012, 02:38:58 AM »
Hi Richard,

This forum software doesn't like long threads, so you may have trouble accessing my last reply. Here it is again in case you do;

hi Richard,

While I understand your frustration, I think you are perhaps missing some key understandings and this is making it hard for you to diagnose what is going on.

The installer installs the "default" web folder into \clarion6\3rdparty\libsrc\netweb. So from the point of view of checking the installer behavior delete this folder, then install nettalk, then see if the folder now contains a "web" folder. (I just did that here, and on mine it does.)

Inside that folder you should find a bunch of stuff, including a scripts folder, and a themes folder. In the themes folder you'll see sub-folders - one for each theme (including Midnight.)

This is somewhat different to Nettalk 5, because NT5 installer then copied this web folder into each example preemptively. In NT6 the installer does not do this (for reasons I'll get to in a moment).

Given that the web folder is not copied by the installer, the template needs to copy the files into the app folder for you. It does this on the first compile, and reports to you, via the error window, that it has done so. In C6 this pauses the compile, in C8 it doesn't. The mechanism internally is that it creates a COPYALL.BAT file and a GZIPALL.BAT file, and then executes these during the generate of the app. If the copy, or Gzip fails for some reason then of course things are not going to work right.

The reasons for the change are several. Firstly, in all too many cases developers would forget to copy the updated web folder to their app folder when updating NetTalk. Making this automatic reduces problems. There is a version number in one of the files (netweb.js) and this is compared against the version number in the template. If they don't match, it does a copy. In this way your work-load reduces.

Another reason has to do with the improved Theme support, and specifically the ability for you to add themes, and for the user to change themes at runtime. In order to make this process manageable the GZIP has to be more automatic (in NT5 it's a manual process). As themes are added it also does a bit of work to re-zip and so on. When I added the Midnight theme for example it noticed that and initiated the zip (which you pointed out earlier.)

Of course whenever there is an automatic process there are things that may fail. For example, on one of my virtual machines, it doesn't like copying from one network drive to another. That's a permissions issue on the server. In order to diagnose the issue I can run the CopyAll.Bat file manually (and the GzipAll.Bat file manually), and hence look at the output to see if it worked, or didn't work.

As I alluded to earlier it's clear that something is not working on your machine, and thus following the steps allows you to determine what it is. Once you've got that, it's easier to be more specific as to the exact cause, or how you can fix it so it does work.

Again, I sympathize with your frustrations, but I assure you I'm not giving you the run around, nor am I giving you pathetic tasks. The problem you are having seems to lie between the \clarion6\3rdparty\libsrc\netweb folder and the app\web folder of the program you are trying to compile. If you follow the instructions I posted earlier, and report your findings, then I suspect you'll be a lot closer to the solution.

Your note that it's working ok in C8 is helpful. While many, if not most developers are now using C8, there are still a fair few on C6. I'm not having reports from others about this, and given that you've been having the problem since April it's unlikely that none of the C6 users have updated since then (especially given the volume of traffic on this forum - where many users are upgrading to every build.) Indeed we still have one web app compiling in C6, and that has been updated with most every build (including 6.37), on an XP machine, without problems. So I'm reasonably confident it works ok on a basic C6 / XP setup - but of course every machine is different and machine-related (network-related, permission-related) issues can, and do occur.

Cheers
Bruce

The note before that was;

excellent. that's what we're looking for.
So, ok, look in your application\web\scripts folder.
How big is the all.js.gz file there? (I'm guessing 0 bytes).

So delete all the .gz files, open a command-prompt window and go to the app folder.
run gzipall.bat manually, and look to see if there are any errors.
afterwards check the size of the gz files again. If it's still 0, then find the line that Gzip's all.js
in my app it looks like this;
"C:\Clarion8NT6\accessory\bin\gzip" -9 -n -f -c web\scripts\all.js        > "web\scripts\all.js.gz"

and run that manually from the command prompt, looking for errors.

Let us know what happens

cheers
Bruce

useless

  • Jr. Member
  • **
  • Posts: 84
    • View Profile
    • Email
Re: Error in Javascript Web9 SSL Example (cont)
« Reply #1 on: July 12, 2012, 05:32:35 AM »
C:\Clarion6\3rdParty\bin exists, jsmin.exe and gzip.exe exist in this folder as well. Thats as far as I got before the browser refreshed and the second page of the thread disappeared.

useless

  • Jr. Member
  • **
  • Posts: 84
    • View Profile
    • Email
Re: Error in Javascript Web9 SSL Example (cont)
« Reply #2 on: July 12, 2012, 05:39:28 AM »

bruce2

  • Full Member
  • ***
  • Posts: 108
    • View Profile
    • Email
Re: Error in Javascript Web9 SSL Example (cont)
« Reply #3 on: July 12, 2012, 05:44:06 AM »
ok, we can carry on in this thread. I'll post your recent note, and my reply here (so we can keep track of what's happening) and then I'll post some more in a second not.

(Let's save the Joomla problem for another thread - that'll just distract us. The current NetTalkCentral was created by John, in Joomla, and it's something we're both working on migrating away from. Why it blanks threads is currently unknown - although the read is still readable from a browser where you're not logged in.)

Since my note above you posted;
-----------------------
from the gzipall.bat file there is this line
C:\CLARION6\3rdparty\bin\gzip" -9 -n -f -c web\scripts\all.js        > "web\scripts\all.js.gz
when its run manually the response is
The system cannot find the path specified.

The windows environment variable path is C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Clarion6\BIN;C:\Clarion6\BIN;c:\Clarion6\3rdParty\Bin;

The other thing I have noticed is the all.js that ships in the C6 installation is 377kb in size the all.js that ships in the C8 installation is 414kb in size.

The C8 414kb all.js and thus the all.js.gz works, the C6 377kb all.js & all.js.gz doesnt work with the C6 webserver.
-------------------------
and I replied with

>> from the gzipall.bat file there is this line
>> C:\CLARION6\3rdparty\bin\gzip" -9 -n -f -c web\scripts\all.js        > "web\scripts\all.js.gz
>> when its run manually the response is
>> The system cannot find the path specified.

excellent. You're closing in on the source of your problems. So, it's not finding the path
c:\clarion6\3rdparty\bin
can you please check if that folder exists?
If it does check if there's a gzip.exe in that folder.
Is your Clarion 6 installed into c:\clarion6 in this virtual machine?


>> The windows environment variable path is
yes, that would come into play if I just called Gzip, but because the path to the gzip.exe is fully qualified, that's not going to come into play here.

>> The other thing I have noticed is the all.js that ships in the C6 installation is 377kb in size the all.js that ships in the C8 installation is 414kb in size.

actually, there's no all.js in the installation at all. (if you look in \3rdparty\libsrc\netweb\web\scripts you'll see it's not there.)
All.js is actually built for you by the Gzipall bat file - depending on your specific application.

In Gzipall you'll see a bunch of lines like this;

type web\scripts\modernizr.custom.js            > web\scripts\all.fat.js
type web\scripts\jquery-1.7.2.min.js            >> web\scripts\all.fat.js

the exact lines included here depend on some options in the app, and so there are a lot of possible all.js file sizes that are possible.

which are a way of concatenating all the individual js files together.
that section is followed by
"C:\CLARION6\3rdparty\bin\jsmin" < web\scripts\all.fat.js > web\scripts\all.js
which minifies the concatenated js.
and
"C:\CLARION6\3rdparty\bin\gzip" -9 -n -f -c web\scripts\all.js        > "web\scripts\all.js.gz"
which creates the compressed version.

now if gzip.exe is missing, or jsmin.exe is missing, or the folder(C:\CLARION6\3rdparty\bin) is wrong then obviously these steps will fail.

If the all.js.gz file was completely missing from your web\scripts folder, then actually your app would fall back to all.js, and would probably work just fine. The fact that it's zero length though means that is is served, but contains nothing. This is a problem because the pages need that JavaScript to work.

Bear in mind that the server doesn't "use" the all.js file. The browser does. So from that point of view it's not the clarion version making any difference. Having the 0 length all.js.gz is the problem that's causing the error to appear in the browser - what we're chasing at the moment is why that file is zero length.

Incidentally you can try deleting it before running the GzipAll Bat to see if it is re-created - and if it's recreated as zero length, or with some content. That would be an interesting test. Deleting it completely would also make the app work without the error, but that's fixing the symptom, not the cause - and it'll be much better to isolate the root cause.

bruce2

  • Full Member
  • ***
  • Posts: 108
    • View Profile
    • Email
Re: Error in Javascript Web9 SSL Example (cont)
« Reply #4 on: July 12, 2012, 05:47:45 AM »
>> C:\Clarion6\3rdParty\bin exists, jsmin.exe and gzip.exe exist in this folder as well.

ok, that's good. but strange.
One thing, I assumed was a typo, but worth a check - earlier you posted;

>> from the gzipall.bat file there is this line
>> C:\CLARION6\3rdparty\bin\gzip" -9 -n -f -c web\scripts\all.js        > "web\scripts\all.js.gz
>> when its run manually the response is
>> The system cannot find the path specified.

the line in the bat file actually starts and ends with a " - and that's important - so try
"C:\CLARION6\3rdparty\bin\gzip" -9 -n -f -c web\scripts\all.js        > "web\scripts\all.js.gz"
and let me know if that reports an error.

You should be in your app folder when you run this line, because the command is relative to the web\scripts folder. ie it's expecting to be run from one folder up from web - ie the app folder.

also I'm presuming that web\scripts\all.js exists at this point.

cheers
Bruce

useless

  • Jr. Member
  • **
  • Posts: 84
    • View Profile
    • Email
Re: Error in Javascript Web9 SSL Example (cont)
« Reply #5 on: July 12, 2012, 07:20:26 AM »
Having problems with this server not showing the replies so this is another attempt.

The gzipball.bat has
"C:\CLARION6\3rdparty\bin\jsmin" < web\scripts\all.fat.js > web\scripts\all.js
"C:\CLARION6\3rdparty\bin\gzip" -9 -n -f -c web\scripts\all.js        > "web\scripts\all.js.gz"

The jsmin is what doesnt seem to be working.

When I run through the line the bat file at this line
"C:\CLARION6\3rdparty\bin\jsmin" < web\scripts\all.fat.js > web\scripts\all.js
it throws the message
The system cannot execute the specified program. Now I've also tried the line
"C:\CLARION6\3rdparty\bin\jsmin" < web\scripts\all.fat.js > web\scripts\all.js"
which has a quote at the end but still get the same error message.

The jsmin exists in the folder
C:\Clarion6\3rdParty\bin
and is the same size, date & time as the C8 version.

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11175
    • View Profile
Re: Error in Javascript Web9 SSL Example (cont)
« Reply #6 on: July 12, 2012, 07:33:14 AM »
I don't know of any reason for jsmin to fail. The utility comes from here;
http://www.crockford.com/javascript/jsmin.html
It's a small C program, and I'm not aware of any dependencies.

this thread http://stackoverflow.com/questions/6450490/jsmin-usage-problem
seems to indicate that .Net is required - but I'm taking that with a pinch of salt. There's no indication on the site that it would need .Net, and C doesn't need .Net. On the other hand installing .Net on the VM won't hurt, so might be worth a try. Here's a link to that http://www.microsoft.com/en-us/download/details.aspx?id=17851

What I'll do is make a switch in the app so you can bypass jsmin - it's not critical anyway. In the meantime you can work around it by going to the WebServer procedure, NetTalk extension, Advanced tab, and ticking off the options "Combine" and "Compress" files. that's not a long-term solution, but will keep you going to the next build.

I'll also do some more research into possible reasons for the jsmin to fail. If the .Net install helps please let me know.

cheers
Bruce

useless

  • Jr. Member
  • **
  • Posts: 84
    • View Profile
    • Email
Re: Error in Javascript Web9 SSL Example (cont)
« Reply #7 on: July 12, 2012, 09:45:15 AM »
Installing .net 2 was sufficient to get it working.

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11175
    • View Profile
Re: Error in Javascript Web9 SSL Example (cont)
« Reply #8 on: July 12, 2012, 11:28:19 PM »
that is a surprising dependance, but very good to know. Thanks for the feedback. If you have any other questions then you know where to come...