Posts

Showing posts from August, 2011

An Historical History of Java Applets

I have stumbled across an eleven year old (2000 vintage) article , which already describes Applets as if they were "has been" technology. I quote: SUN Microsystems introduced Java applets with much fanfare back in 1995. Applets immediately took the web world by storm because they added the ability to display dynamic web content within browsers in what was essentially a static HTML world. During those initial days, it appeared that using Java applets was the best way to add dynamic content to web pages [but when] Dynamic HTML finally started taking shape, things changed drastically. The Document Object Model (DOM) exposes elements within a web page as programmable components with their own set of properties and methods ... Applets suddenly started to look old and primitive. The W3C’s endorsement of Dynamic HTML finally set the tone for the new breed of sophisticated, dynamic web pages. Oh dear! The author does mention some advantages to Applets. I shall ci

Java Applet Revision

Image
I first posted an entry on this topic back in February 2009 . To refresh my memory, I'll just run through the steps of adding a very simple applet to a web page again. The code for the simple applet is as follows: import javax.swing.JApplet; import java.awt.Graphics; public class HelloWorld extends JApplet { public void paint(Graphics g) { g.drawRect(0, 0, getSize().width - 1, getSize().height - 1); g.drawString("Hello world!", 5, 15); } } This was borrowed from the old (pre-Oracle) Java tutorial. A slightly more sophisticated version is offered in the current Java Applet tutorial . The code to include the applet in a web page might be: <html> <body> <applet code="HelloWorld.class" width="150" height="50"> </applet> </body> </html> And the page might look like this.

Asynchronous JavaScript and XML (AJAX)

Image
I am looking at the W3Schools tutorial on AJAX . The tutorial begins with the statements: AJAX is not a new programming language, but a new way to use existing standards. AJAX is the art of exchanging data with a server, and update parts of a web page - without reloading the whole page. It is the exchanging data with a server phrase which interests me. AJAX was made popular in 2005 by Google, with Google Suggest. Google Suggest [uses] AJAX to create a very dynamic web interface: When you start typing in Google's search box, a JavaScript sends the letters off to a server and the server returns a list of suggestions. I used the same concept in the 90's in a VB application I created for the WA Trotting Association to help them maintain a database of competition entrants. So that idea is not new, but I guess doing it on a web page must be. Apparently modern browsers (IE7+, Firefox, Chrome, Safari, and Opera) support the keystone of AJAX , the XMLHttpRequest

Document Object Model (DOM)

Image
I remember once attending a seminar by Microsoft where they were describing themselves as the cleverest people in the world for inventing what they called the Component Object Model (COM). It was only years later that I learned that they didn't really invent the idea at all, but copied it from other object oriented programming languages. Anyway, the Document Object Model (DOM), although it rhymes with COM, has nothing to do with Microsoft, but is a World Wide Web Consortium (W3C) standard defined as: A platform and language-neutral interface that allows programs and scripts to dynamically access and update the content, structure, and style of a document. According to the W3Schools tutorial on DOM : The DOM is separated into 3 different parts / levels: Core DOM - standard model for any structured document XML DOM - standard model for XML documents HTML DOM - standard model for HTML documents The DOM defines the objects and properties of all document elements, and the

eXtensible Markup Language (XML)

Image
I am looking at the W3Schools tutorial on XML . I like the clarification on the roles of HTML and XML: HTML was designed to display data, with focus on how data looks. HTML truncates multiple white-space characters to one single white-space. XML was designed to transport and store data, with focus on what data is. White-space is Preserved in XML. XML Stores New Line as LF. XML tags are not predefined. You must define your own tags. XML documents must include an XML declaration and can include a DOCTYPE declaration, which in turn refers to "system" of tags/elements, set out in either a DTD file or in a Schema . XML does not DO anything other than to transport and store data. XML data is stored in plain text format. This provides a software and hardware independent way of storing data. XML documents must contain a root element. This element is "the parent" of all other elements. All elements can have sub elements (child elements). The tutorial gi

JavaScript by w3schools

I was planning to slot in an entry on XML here, but I note the W3Schools tutorial on XML puts JavaScript as required knowledge. As I branched into web language revision because HTML and XHTML were required knowledge for JavaScript , I might as well start on that now. I have to say that having praised the W3Schools tutorial on PHP , I am a little disappointed by this one . It is all over the place. I came here because the Mozilla Getting Started with JavaScript page began with a "corny" example but zero explanation of the language structure or syntax. And now this one does the same thing: <html> <head> <script type="text/javascript"> function displayDate() { document.getElementById("demo").innerHTML=Date(); } </script> </head> <body> <h1>My First Web Page</h1> <p id="demo">This is a paragraph.</p> <button type="button" onclick="

Web language Revision

I'm probably stretching the definition of revision here. My only formal tuition in web languages was in HyperText Markup Language (HTML)(1 - except there was no number then) and it wasn't very formal. From memory it was a free one hour lecture provided by UWA to encourage research students to use the new medium to publicize their work. Anyway, disappointed by the Mozilla Getting Started with JavaScript page, I went back to a Google search on "JavaScript Tutorial" and W3Schools was on top of the list again. Curious, I checked Wikipedia to find: W3Schools is not affiliated in any way with the World Wide Web Consortium (W3C). It is created and owned by Refsnes Data, a Norwegian family-owned software development and consulting company. Affiliated with W3C or not, I liked the style of their PHP tutorial , so I checked out their JavaScript tutorial . Listed as required knowledge was HTML and CSS, and a link was provided to their Home Page , in ca

Mozilla JavaScript Learning Material

Image
A Google search on "JavaScript Tutorial" brings up an abundance of online learning materials. I added Mozilla to the search string to find their Getting Started with JavaScript page. I can't resist commenting on the style of the page. There are comments like: JavaScript is a very easy language to start programming with. All you need is a text editor and a web browser to get started. And: JavaScript is a great programming language for introductory computer languages. It allows instant feedback to the new student and teaches them about tools they will likely find useful in their real life. This is in stark contrast to C, C++ and Java which are really only useful for dedicated software developers. And then the first code example is: <span onclick="alert ('Hello World!');">Click Here</span> With zero explanation besides a list of mouse "events" other than onclick . To be fair, the code works. When slotted into an

Playing with PHP

Image
I'm not sure who w3schools are, but they have a tutorial on PHP. They offer a list of things you need , including MySQL, Apache and PHP. I'm going to ignore this, because I am tired of getting things to work at home and then scratching my head to make them work on a production server. I do note however that my web host claims to offer MySQL, Apache and PHP on its server. I shall therefore do all of my experimenting in a live environment. Unprofessional perhaps, but how many people look at my web site anyway? The first code sample is a good old "Hello World" message: <html> <body> <?php echo "Hello World"; ?> </body> </html> I popped this in a text file, called it hello.php, and uploaded it to my web host. I then typed: http://www.interactived.com/hello.php into my browser, and what do you know, the following page appeared: So far so good. There followed a number of boring chapters on

J2EE

Three years ago I began this blog with a discussion of The Java Tutorial . I didn't read it from top to bottom. I took what I needed to do what I wanted to do. I left some quite large chunks unread, so when I decided to research Java Servlets , I fully expected to find them there. Certainly they were part of a tutorial , but it had an unfamiliar feel to it. When I clicked on the home link, I found myself looking at the J2EE 1.3 Tutorial - "A beginner's guide to developing enterprise applications on the Java 2 Platform, Enterprise Edition SDK version 1.3" . "Beginners guide" sounds good, but "developing enterprise applications" is something I neither need nor want to do. In my first post I suggested that using NetBeans to craft "Hello World" was like using a sledge hammer to crack a nut, and at first glance, using J2EE to make a simple connection between my little applet and a database is worthy of the same analogy.

A few notes on JavaScript

I am one the 99% of the world who has long nursed the misconception that JavaScript has something to do with Java. And why not? The name sort of implies it. It was only after I searched without success on the Java Tutorial site for some mention of JavaScript that I stumbled across the knowledge that JavaScript was in fact developed by Netscape, under the name LiveScript. Armed with that knowledge, it is not surprising to find the best reference information on Mozilla site. According to Wikipedia , the nonsensical name choice had something to do with Netscape wanting to cash in on the popularity and cachet of Java, and Sun wanting support for Java technology in the then popular Netscape browser. For a while only the Netscape family of browsers supported JavaScript. Microsoft later produced what it calls JScript to run in its browser. JScript is similar but not identical to Javascript. According to Foldoc JavaScript runs a hundred times slower than C , and ten

Forum Comments on Java Applets

It is so long since I last posted on the once was Sun/Java now is Oracle developer forum my account seems to have been ditched. While I wait to have it resurrected I've done a little searching in the Java Database Connectivity (JDBC) forum using the search term "Applet". My first search, using the default 3 month period, yielded nothing. No one had posted anything about or even mentioned Applets in the last three months. So either they are very easy to use and work very well, so hardly anyone has any problems with them, or maybe ... not very many people use them at all. My stomach was beginning to churn a bit, when I extended the search period to the current year - and with good reason. Somebody, a little bit like me I think, had written a game in an applet, and wanted to record top scores in a database. He described his connection problem in this thread , and the first reply began: Doing JDBC calls from an Applet is such a bad idea that I am glad y

Webcity

My web site is hosted by WebCity , an Australian domain registrar and web host, whose motto is "Self Service Savings". And when they say self service they mean self service. They offer a very comprehensive self help library , supplemented by a range of good video tutorial s, but the whole site is somewhat cryptic, if you don't know your way around, and they don't really like being contacted. However, they are also true to their word on savings. Certainly they saved me money on my original domain registrar and on my traditional ISP. The ISP offered free web space, but charged a ridiculous annual fee to domain holders. This didn't include domain registration, which I paid for separately. I guess it covered the one off three minute task of letting the domain registrar know my physical web address, but apart from that, I have no idea how they justified it. Webcity also offer a MySQL server, and when I plucked courage to ask them about it they

Limitations of Java Applets

Having installed IIS, I was still struggling to get my Applet to connect to the MySQL database, and I stumbled across this post . The grammar is questionable but of relevance to me is: This keeps coming up ... applets trying to make JDBC database connections don't work in general ... Mainly because JDBC is a server side technology. Where applets may only always and forever communicate with the HTTP server ... which they originated from (same server as their code base) ... and in general the database will almost always be on a different server. In other words, it doesn't matter how hard I work to get the Applet working at home, when I upload to my ISP it probably won't work, because their MySQL server is most likely on a different box to the web server with my code on it. I guess I could send them a question, but if I want to make my code robust, I probably need a more general solution. The post quoted above goes on to suggest solutions, but at this stage of