How I used jQuery to push a dynamically generated file to the web browser based on the user’s input

There are times when we want to push a dynamically generated file to our users based on their inputs. That file could be an excel file that holds payment transaction reports for a time period or a tabulation of guest names who had accepted invitations to our corporate house warming.

In such cases, the user should be presented with a dialog box which lets him decide whether to save it somewhere in her local filesystem or open the file for viewing with an appropriate application in his computer.

For example, in my tool for generating boilerplate coding from a list of country names, I am presented with some input fields where I can submit some instructions to format the output of the boilerplate coding. And upon clicking on the “Generate” button, I am shown a dialog box that looks like the following:

Image of firefox dialog box after submitting request to generate some files.

Let’s cook up a simple scenario to demonstrate this idea with jQuery.

Suppose we are creating a simple game for the user to draw a random number. For this, we have a text field for the user to write his name. There will be a number dial that changes at random. When the user clicks on the “Get lucky number” button, the browser will present a text file for the user to download.

The text file will contain the user’s name and the number taken from the number dial at the instance when he clicks on the button.

Why my Java applets took much longer to load when I upgrade to Java Runtime Environment version 7

I was looking after a couple of Java applets that are used in our private network for more than a decade. Changing business requirements mandated the upgrade of the Java Runtime Environment from version 1.5 to version 1.7. That change had caused my Java applets to load very slowly. On Java Runtime Environment version 1.7, my applets took at least 20 times longer to load.

How did this happen? Why did my Java applets took significantly longer to load when I upgraded my Java Runtime Environment to version 7? This post records how I had managed to solve the mystery and gotten my applets to run like they were on Java Runtime Environment 1.5.

Configurations that I set in my Java Control Panel to get my Java Plug-in to tell me more about the Java applets and binaries that it is running

Right after I took over the maintenance work for Java applets that are a decade old, I did an important tweak to my Java Runtime Environment: I applied some configurations for the Java Plug-in on my computer to be as verbose as possible when it had to run my Java applets.

This post shows how I had configured in my Java Control Panel in my windows machine for the sake of performing diagnostic tasks when trouble brews.

Steps to check whether a process had utilised a port before your application does with windows built in facilities

As a systems analyst, it is inevitable for me to go to windows based computers to check out the applications that I am taking care of. Most of my applications listen to commands via TCP/IP ports in order to do work.

Whenever a user reports that one of such applications is failing on their machine, the first thing that I will check out is whether that application is able to reserve the port that it is supposed to listen to.

Although there are Sysinternal suite of diagnostic tools for me to use, there are client machines does not allow foreign executables to execute on them.

This post details the steps that I take to check out whether there is a port binding issue in the event that my application fail to run in windows based machines.

SQL query to find foreign key constraints that reference columns in a table in oracle database

I was rather new to a system with hundreds of Oracle database tables. There was once when I realized that I had to delete a redundant row from the SYSTEMS_CONFIGURATION table.

As there are foreign key references to the SYSTEMS_CONFIGURATION table, I had to first remove all foreign key references to the redundant SYSTEMS_CONFIGURATION table row prior to deleting it.

This post captures the SQL query which I had ran on my Oracle database to find all the tables which had foreign key references to SYSTEMS_CONFIGURATION table, so that I can write the SQL update statements to delete all child references to the redundant SYSTEMS_CONFIGURATION row prior to deleting it.

How to use jQuery to detect user checking and unchecking a checkbox

I wanted to show / hide some input fields when a user checks / unchecks a checkbox on a web page.

To investigate how I can use jQuery to detect user checking and unchecking a checkbox, I cooked up a scenario.

There is a page with a HTML checkbox and a message. When the checkbox is checked, the message shows; if not, the message hides.

Pretty straightforward scenario to get me into working out a proof of concept to fulfill my objective.

How to use jQuery to access the DOM structure of parent HTML webpage from within the child HTML window

Sometimes, instead of showing a dialog box within a web page, it is more strategic to spawn a new HTML window as a dialog box to capture user input. This technique is especially useful when there are Java applets embedded in the web page, as Java applets tends to appear in front of every visual element on a HTML web page. There is no easy solution to place a visual element, for instance a HTML div, on top of Java applets.

Spawning another web page in another window is straightforward, but how do I send data collected from a child HTML window back to the parent HTML webpage? With this question in mind, I set out to find an answer.

How to use jQuery to intercept form submissions and validate form input

There came a time where I had to create a HTML form to accept inputs from users in order to generate a report. Before submitting the form to the back end server, there are some validations that I can perform on the data at the client side to reduce the number of HTTP responses that my server had to generate for unwanted inputs. The cost savings is especially significant when the form submission contains large file as part of the HTTP request.

I chose to use jQuery for intercepting the form submissions and do some data validation before I allow the browser to create a HTTP request to the server. This post documents a proof of concept, as a stepping stone, to realize my objective.