Here is an example on how to use a Java Applet to generate a PDF from XHTML or XML source. The main advantage of using an Applet to generate from XHTML or XML source is XHTML/XML source can be gzip compressed from the source web server which reduces very much its size to be transferred over a slow network connection and is speedier, while compared to an actual PDF file that’s transferred over the same network.
Archive for the 'Tutorial' Category
The HostIP.info provides API allows you to get the country including the city as well. The simple PHP script that can get the country is as follow:
The Google Chart API provides an easy way to generate a chart dynamically by sending a simple URL to Google Chart service as follows:
And Google Chart returns you an image of the chart. As shown the above you just need to pass the Google Chart with three parameters, which are cht (Chart Type), chd (The percentage distribution of your data on Chart), chs (Chart size), and the chl (Chart Label)
The Google Gears Geolocation API allows you to display your current position data by obtaining it from your WiFi antenna. The Google Gears Geolocation API is able to obtain the exact location of the user’s current location, in terms of latitude, longitude and even the address etc. User browsers such as Internet Explorer, Firefox must have Google Gears installed excepts Google Chrome, in order to have the Google Gears API to work on your browser.
PHP Curl allows you to validate if a given URL exists. What you need to do is just a simple function as follows, which takes an input URL and returns the code. If the returned code is 200, then the URL exists, else it doesn’t!
TinyURL allows long URL to be shortened. In this example, I’d like to show how you can build a text form that contains text keyed in by a user, and sends to the server-side PHP to detect those overly long URLs and shorten them one by one by sending them to TinyURL service.
Before I proceed, I’d like to let you know that TinyURL has an API, which is as follows and it returns a single string only that is the tiny url which has been shortened from the given “url” parameter.
If you’re asked to build a PHP script that pumps out some data from the database and presents in an HTML table to the users. And on the first row of the table, shows the titles of each field (As pictured above). Once the user clicks on each title the data in the column need to be sorted. If you implement this in a server-side scripting such as PHP, it’ll then need to send the request back to the server to get the server-side PHP script to sort the data by changing the “ORDER BY” in an SQL statement.
I’ve built a simple Ajax language translation tool based on the Google Ajax Language API. It’s pretty easy to build one by yourself, by going through some of the examples and documentations given on the Google API page.
The Java or JDK comes with NO support of any official API for FTP connection. But there is an internal that comes in the sun.net package, but this is NOT well-documented, and you will hardly find how to use other methods within the sun.net.ftp.FtpClient class.