Project: PhotoHosting

Description

This is a very simple website offering uploading and sharing of 2 megapixel size photos, at a relatively high quality, social-media aware, and very hard to “steal”.

Motivation

A lot of free image hosting services are either overly ad-filled, or explicitly prevent uploading content which may be considered “NSFW”.

I wanted something less restrictive, less busy with ads (but still able to have ads on it), using some technologies which I would hope would facilitate fast I/O.

One principle was to try to always have the photo viewer coerced into visiting the website itself, as opposed to simply serving the image file.

This is accomplished by having the social media thumbnails relatively small, and a lower quality. Any attempt to actively open the image itself will always result in the webapp serving an entire page with the image embedded.

Technologies

I wrote this website is written in Java on the Apache Struts 2 framework accessing an HBase database.

Of the NoSQL databases, HBase seemed to be the only one which natively supports larger binary content, so it was a relatively easy option.

You can access the primary site here: https://photohosting.hostnucleus.ca/

To view an example of how the photos are presented: https://photohosting.hostnucleus.ca/show/cooked-chicken-on-white-plate-8de5b69c-020d-4480-addc-5d3af7013ba8.action

Update

Well, thanks to the complete cluster-fuck that is Java 11 (with it’s complete butchering of Java compatibility), and Apache’s lacklustre ability to move HBase away from Java 1.8, this project is officially dead. I simply cannot get the Tomcat webapp to talk to HBase.

So … yeah … fuck the OpenJDK “community”, and fuck Apache.

Error calling method on NPObject

I’ve had a bit of a problem with a Java Applet running in Safari on Windows. I have JavaScript code which attempts to invoke public methods in the Applet, but whenever I try to call these I get the error “Error calling method on NPObject”.

I’ve read a fair amount of BS “causes” (from things like “it’s a hidden DIV” to “Upgrade your JRE”), none of which proved to the the problem.

The real problem?

Safari doesn’t care if the applet is loaded before trying to invoke the methods.

Under Chrome, Opera, Firefox and even my much hated Internet Explorer, if you try to invoke a method on an applet which hasn’t loaded yet, the JavaScript runtime waits for the applet to complete, and then resumes. Safari does not.

So now, as part of the applet tag’s parameters, I have to include a method name which the applet must invoke in JavaScript, thereby guaranteeing that the applet is loaded and running.

Now I have the problem that apparently Safari is trying to execute JavaScript methods as URLs, thus causing a “Malformed URL” error.

Update:

After a bit of experimenting, it seems Safari does not like trying to pass and return non-String values. So, instead of using LiveConnect’s “call” method, you have to use “eval”, and don’t expect to be able to pass object around.