Bear Bibeault

Marshal
+ Follow
since Jan 10, 2002
Bear likes ...
Mac Mac OS X IntelliJ IDE jQuery Java
Author of:
Secrets of the JavaScript Ninja, 1st and 2nd editions,
jQuery in Action, 1st, 2nd and 3rd editions,
Ajax in Practice, and
Prototype and Scriptaculous in Action
Austin, TX
Cows and Likes
Cows
Total received
173
In last 30 days
0
Total given
186
Likes
Total received
4563
Received in last 30 days
4
Total given
2929
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Rancher Scavenger Hunt
expand Ranch Hand Scavenger Hunt Green check
expand Greenhorn Scavenger Hunt Green check

Recent posts by Bear Bibeault

Steve Dyke wrote:
I embed the HTML string into a JSON string that is called by jQGrid.

If I put single quotes around the parameter the onclick event will not fire.


It's not at all clear how the JSON blob is related to the link.

Is the string OK in the blob? How is the link formatted using the blob content?

Steve Dyke wrote:What I mean is I create the JS string on the server side of the app then pass the string to the client side.


How?

And, if the string is not correct on the backend, that's where it needs to be fixed.

If the string is correct, then at what point, if any, does it get mangled?

If the string is not mangled, then check the usage of the string.
Yes if that's the Generated HTML, the syntax is a mess. What should it be?

And, there's no such thing as "server side IMG tag" so not sure what this has to do with server side. The JavaScript is executed in the browser. The fact the JS is on a JSP template is irrelevant (unless there are JSP directives involved, which there do not appear to be).
Please read this article for an overview on what JSP is and how it works.

Then you might want to read this article for info on properly structuring Java web apps.
1 week ago
JSP

Sean Paulson wrote:That makes sense...this code seems like it would be reckless to use though.


Not the best code I've seen. At minimum wakeup should be scoped.

Sean Paulson wrote:
really? in his code comments it states


The comment is crappy.

To make wakeup alias resolve, the code would be: wakeup = resolve;

Sean Paulson wrote:
My confusion is with the wakeup() how is wakeup set to the resolve function?


It isn't. It's set to the anonymous function, which in turn calls the resolve function.

Is the confusion about where the resolve function comes from? It's provided by the Promise interface and passed to the executor function as a parameter.

Sean Paulson wrote:my question is how does it know to return the wakeup function as a new promise and not the log function? (or both?)


It doesn't return either function. The call to create the promise returns a Promise instance.

The promise has an executor function which is called and can either resolve (by calling resolve() or reject (by calling reject() the promise. (Note that these functions are passed to the executor function and can be named anything, but calling them anything but resolve and reject is to spit in the face of convention.)

If the promise is resolved, whatever is passed to resolve() becomes the result of the promise, in this case true (which is apparently discarded).

I am amusing [sic] it is returning the wakeup function as a promise object to be precise(also keeping it in a unresolved state until the wakeup is called).


No. As stated above, it returns a promise, not the function. The code has no access to the executor function.

The anonymous function created inside the executor function is stored in the global variable (boo! hiss! growl!) wakeup for later usage.

   await wakeable(); // returns to event loop here


This is likely the line thats could be generating confusion. wakeable is a function that creates and returns a promise. It does not return a function.

Be aware that await is just some syntactic sugar around dealing with promises without the need for callbacks.

That help?

John Herrington wrote:I mean like if the data is either generated using a JSP template or if it was provided to it, it might be somewhere on the server?


Again, at no point in the generation of output is it written anywhere but to the response.

Unless its [sic] coming from database, which I haven't searched. I've searched the whole server and no where I found the content string in any file. Is it possible for a JSP template to pull data from database?


Sure. Caveat being that JSP templates should not have any processing code in them, but since the dawn of JSP they have been used poorly.

Based upon this, it sounds like you are actually trying to find where the data is coming from? (You haven't really said what you are actually trying to accomplish.)

Also any hint in finding the source JSP template?



This is your best bet for finding the source of the data; finding the template and seeing where it's pulling its data from.

As Ron posted, the URL mapping is the thread to start pulling at...
2 weeks ago
JSP
If I am understanding your question correctly: the generated JSP output is not saved in the file system anywhere. The output is generated using the JSP template, along with any data provided to it, then sent as the content of the response. At no time is the generated content written to the file system.

If you are not acquainted with how JSP works, perhaps this article might be helpful.
2 weeks ago
JSP

Mark Volkmann wrote:Let's do this! Hit me up with your questions about Svelte and/or Sapper! No question is too basic.



OK, basic, what are Svelte and Sapper? I've heard of Svelte (but not much in the way of details), but never even heard of Sapper.
Welcome to the Ranch, Mark.
You claimed:
  • node js is the language which comes as best in those parameters
  • it can provide the same features by consuming less memory compare to java
  • node can handle more requests than Java for the same api build

  • What evidence do you have to support these claims?