Mark McKay

Ranch Hand
+ Follow
since Mar 20, 2011
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by Mark McKay

By context, I'm referring to a Javascript context - something much like a scope.  When you create an instance of a Javscript engine within Java, it comes with a root context that you can define variables and methods in.  All functions running within this context can see and manipulate objects in this context.  It also provides a way for your Java program to interact with the Javascript by putting Java objects in the Javascript via a wrapper that uses reflection.  You can also have contexts within contexts so that different context can have different objects defined  within them and which can be disposed of when you no longer need them.

I'm using XML because it is the most natural way to express the data my program needs that I can think of.  This program will use a log of strings and using XML files will make each page easy to edit by hand.  

In many ways the program I have in mind is like a primitive web browser which is why I'm trying to create something like that.  I have a pretty good idea of how to build it in Java, but not any other language.  The trouble with Java is it is no longer a good choice for anything that needs to run in a web browser.
1 year ago
I can't figure out how to load and run javascript within javascript.  Most of the articles I come across are more ways to inject Javascript into a webpage, particularly from before javascript had the import statement.  What I need instead is to be able to load Javascript into a context.  For example, I want my program to be able to parse an xml file such as:



I need to be able to load everything in the script tags into some sort of context and then be able to evaluate the expressions and statements in the attributes of other nodes in the same context.  I can't find any way to do this with javascript.  If you know of a way, please let me know.
It need to
1 year ago
I used to program a lot in Java, but haven't touched it for several years now. I'm thinking of diving back in because I have an idea for a game. The main reason to use Java is its scripting engine - this app would rely a lot on loading and executing bits of javascript at runtime, and I remember Java's JS language bindings as one of the best I've come across.

What's holding me back is trying to figure out how I would put this on the web. I could do it as a servlet, but I would prefer something entirely client-side since I don't really need it to access any data on my server. If applets were still a thing, that would be perfect but they have been phased out and do not seem to be coming back.

I've tried to use webstart before, but found that it runs into a ton of security issues too. Since I want casual users to be able to access this game, I don't want them to have to configure a ton of things just to get my Java app going.

Is there some sort of modern equivalent of applets I can use? Or maybe cross compile my Java into a javascript/html? Or are servlets my only option if I want to write this in Java?
1 year ago
Looks like Gradle has its own repository.  A file called ./gradle/daemon/7.2/registry.bin was storing the invalid directory name, and once I deleted that things worked again.
2 years ago
I'm trying to run Grade and running into some weird behavior.  I think that it's pulling bad values from the system properties file - java.home in particular.  Where can I find the file where these properties are stored?  I'd like to examine my system properties to see what is there.
2 years ago
I've been using Java for years and am still wistful for the days of applets where you could write a simple program, post it on a webpage and let anyone on the world use it without having to worry about certificates or permissions.

The web world has moved onto HTML5 which provides most of the web readiness the applets had, but which is also much harder to program in.  I've come across some projects like DukeScript that let you write in Java and then convert that to HTML5, but that is proprietary.  Are there any open source projects around for writing in Java and then converting it to HTML5?  Are there any plans for Oracle to provide tools that do this?
7 years ago
I'd like to create a website that will allow users to log in, create content and save their state so that they can retrieve it if they log in again. I've taken a stab at creating my own login system, but I'm worried about security and keeping personal user info on my server where it could be hacked. Are there any good options for authenticating users aside from a rolling your own code?
8 years ago
For a while I've been thinking it would be a neat hobby project to make my own toy piano. Not a full sized one, but something more that a kid would use with tiny keys. I'd need to have some sort of electronic system that could get keystrokes and play MIDI notes in response. I'm pretty good with Java, but know very little about hardware or how I'd go about building such a thing. Any suggestions?
9 years ago
I'm trying to design a website that will require users to register and login before they use it. In order to keep things separate, I was thinking it might be useful to create a single web archive that just handles the user signup and login. That way I could work on my other web archive apps independently and have them just check to see if the user has logged in and posted a token somewhere, and if not redirect to the login webpage.

Is there a way to do this?

10 years ago
Looks like that was it. Thanks.
I'm using Netbeans to develop, and that text was present in the original default index.html file. But I've changed it since then, recompiled and redeployed. It's not hiding out in an uncleaned build directory either.
Well, it appears to be installed and running, and I can run JSP pages and servlets in it. The manage app shows no errors. I just can't get my index.html page to show up by default.
The default wasn't working. Originally I had no web.xml file and use using annotations to declare my servlet. But my welcome page wasn't displaying so I tried creating an explicit web.xml and putting it in there. Didn't seem to help.
It's the default config:

<welcome-file-list>
<welcome-file>index.html</welcome-file>
<welcome-file>index.htm</welcome-file>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
I'm creating a new web archive. I've added a /WEB-INF/web.xml file with the tag

<welcome-file-list>
<welcome-file>index.html</welcome-file>
</welcome-file-list>

However, whenever I browse to http://localhost:8080/MyWebApp/, I see a page that simply says "TODO write content". I have to explicitly go to http://localhost:8080/MyWebApp/index.html to see my welcome page.

Did I miss something, or am I misunderstanding the concept of welcome pages? I'd like the index page to show by default if the user selects the empty directory. Also, I don't know what page/servlet is generating the content I see if I browse the root.