tag:blogger.com,1999:blog-65188860800967810532024-03-27T11:20:05.947+05:30My TakesDinesh Bajajhttp://www.blogger.com/profile/09687011542043594704noreply@blogger.comBlogger19125tag:blogger.com,1999:blog-6518886080096781053.post-28798109873469450122017-11-06T10:42:00.001+05:302017-11-06T11:36:45.155+05:30How to get past "InaccessibleObjectException" while running a JavaFX application in Java 9?<div dir="ltr" style="text-align: left;" trbidi="on">
When you run a JavaFX project, that was perfectly running fine in Java 8, now in Java 9, you are faced with "InaccessibleObjectException" exception that is thrown by the Java runtime. It complains that the variables and/or methods that you have declared as private (albeit annotated with @FXML) in your "controller" classes are inaccessible as your project's Java module has not made "open" the containing package to the JDK module "javafx.fxml". Here is the full text of the exception thrown by the runtime in my sample JavaFX project:<br />
<blockquote class="tr_bq">
java.lang.reflect.InaccessibleObjectException: Unable to make field private javafx.scene.control.Label sample.Controller.nameLabel accessible: module LearningJavaModules does not "opens sample" to module javafx.fxml</blockquote>
<br />
I have declared the "nameLabel" Label variable as follows in the controller class:<br />
<blockquote class="tr_bq">
@FXML<br />
private Label nameLabel;</blockquote>
<br />
And it has been declared in the corresponding fxml file as below:<br />
<blockquote class="tr_bq">
<Label fx:id="nameLabel" /></blockquote>
<br />
In order to remove this exception, one needs to add the following line to the "module-info.java" file of your project's Java Module:<br />
<blockquote class="tr_bq">
opens sample to javafx.fxml;</blockquote>
<br />
Here is the complete "module-info.java" file of my sample JavaFX project:<br />
<blockquote class="tr_bq">
module LearningJavaModules {<br />
requires javafx.graphics;<br />
requires javafx.fxml;<br />
requires javafx.controls;<br />
opens sample to javafx.fxml;<br />
exports sample;<br />
}</blockquote>
<br />
Please note that it has been given in the "JavaFX: New & Notworthy" presentation by Oracle dated September 19, 2016 that one needs to add the following line to the "module-info.java" file:<br />
<blockquote class="tr_bq">
exports private my.pkg to javafx.fxml;</blockquote>
<br />
However, this doesn't work. It seems that the implementation has changed since the above-mentioned presentation by Oracle was released. One now needs to use "opens" instead of "exports" to make private fields accessible to JavaFX runtime.<br />
<br />
Trust that you find this useful. :-)<br />
<pre style="background-color: white; font-family: "Courier New"; font-size: 10.8pt;"></pre>
</div>
Dinesh Bajajhttp://www.blogger.com/profile/09687011542043594704noreply@blogger.com3tag:blogger.com,1999:blog-6518886080096781053.post-37245498846319530802017-10-01T00:43:00.000+05:302017-10-01T08:21:27.232+05:30School Fee Manager - a free and open-sourced JavaFX application<div dir="ltr" style="text-align: left;" trbidi="on">
Hi,<br />
<br />
I am writing this post to introduce 'School Fee Manager' - an application that I have written for a neighborhood Play School.<br />
<br />
This application manages fee payment records and student registration details. It issues fee receipts, generates few MIS reports, and prints Driver Sheet for school bus drivers' who ferry students to the school. It allows for filtering data on almost every screen where it displays the data so as to enable easy access to the relevant data. The filter facility can be accessed on most occasions by right-clicking a table-cell and choosing appropriate option from the context menu.<br />
<br />
While generating a fee payment receipt, the application auto calculates the fee due, and auto populates the table that displays the fee items being paid. If a student is paying only a subset of the fee items due, then the remaining fee items can be removed from the receipt. It also provides for editing a fee payment receipt after it is generated to change the payment mode if that may be required.<br />
<br />
The options to backup, restore and compact databases are available as they should be available in any good application. Few screenshots of the application are given below:<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjoeYowZi3hN9NfquDnPmMfG_yt48Mv-N-Lppu9f5RPLDRci7gLGLBBRu-in5PJhuMVprOT7n1nx64KO_yG8wmZICaSS0CoiMF8HrbEUeTnfNxMx-cMwV8kh7GYj5ldwCGhXgDueFPZHtX5/s1600/Fee+Receipt+Generation.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="859" data-original-width="1600" height="171" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjoeYowZi3hN9NfquDnPmMfG_yt48Mv-N-Lppu9f5RPLDRci7gLGLBBRu-in5PJhuMVprOT7n1nx64KO_yG8wmZICaSS0CoiMF8HrbEUeTnfNxMx-cMwV8kh7GYj5ldwCGhXgDueFPZHtX5/s320/Fee+Receipt+Generation.png" width="320" /></a></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEijZPUzHXo2ooaONg0I-KH_PD78CMffTorePefErXMmiKOSj8E-eUp7Pk1-EnxdQNvPDFMjmteL5o8Pp3m8N6ujWkL2aZM3wpLgnhOZxswZbj4kImuaLkjomtcf0FRqw5bC_tnbWbkPup9N/s1600/Fee+Receipt.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="658" data-original-width="680" height="309" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEijZPUzHXo2ooaONg0I-KH_PD78CMffTorePefErXMmiKOSj8E-eUp7Pk1-EnxdQNvPDFMjmteL5o8Pp3m8N6ujWkL2aZM3wpLgnhOZxswZbj4kImuaLkjomtcf0FRqw5bC_tnbWbkPup9N/s320/Fee+Receipt.PNG" width="320" /></a></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjQDIokRdj60V1xz3NohdJ7aOMSW8r83sROmx02Ci9Rtob7uwZo-6RL_wn7-wvNEF83ZzfhSeNvokUP9l1uN7PbpyI2eh326wTGBzRR9PtV80dlqJ1NH7EEJhqSQ1G57YTGb5gc8IOqZjC7/s1600/Receipt+Lookup.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="859" data-original-width="1600" height="171" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjQDIokRdj60V1xz3NohdJ7aOMSW8r83sROmx02Ci9Rtob7uwZo-6RL_wn7-wvNEF83ZzfhSeNvokUP9l1uN7PbpyI2eh326wTGBzRR9PtV80dlqJ1NH7EEJhqSQ1G57YTGb5gc8IOqZjC7/s320/Receipt+Lookup.png" width="320" /></a></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh4QXz39XibhGZcHfNNsG7zxy9H3Tuvj3B8nlaPvTf65tA3syaLku-9JbnPKb0HDbZUcjZB5KKFWMK7KGb_jlnFxmjBXkIwViJ9nnwm2KnxE8NXpoLkkLoKgjEc3WgQOOSLXIBdv_M6v7Kw/s1600/Registration+Details+sub-view.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="859" data-original-width="1600" height="171" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh4QXz39XibhGZcHfNNsG7zxy9H3Tuvj3B8nlaPvTf65tA3syaLku-9JbnPKb0HDbZUcjZB5KKFWMK7KGb_jlnFxmjBXkIwViJ9nnwm2KnxE8NXpoLkkLoKgjEc3WgQOOSLXIBdv_M6v7Kw/s320/Registration+Details+sub-view.png" width="320" /></a></div>
<br />
You can see many more screenshots of the application <a href="https://imgur.com/gallery/Nl14U" target="_blank">here</a>.<br />
<br />
The entire source code of the application as well as its executable file and Windows setup file is available for download. You can download it from <a href="https://1drv.ms/f/s!AhyysGGfm92khjeCyAGgh9lxECzp" target="_blank">here</a>.<br />
<br />
Please note that you need to have Java SE Runtime Environment (JRE) installed in your system in order to run this application. You can get the latest edition of JRE for your system from <a href="http://www.oracle.com/technetwork/java/javase/downloads/jre8-downloads-2133155.html" target="_blank">here</a>.<br />
<br />
I trust you will find this application useful. Truly speaking, I myself would have find this application extremely useful if I was learning JavaFX application development.<br />
<br />
Should you have any query regarding the application, please use the comment section below to communicate with me.<br />
<br />
Thanks for reading this post.<br />
<br />
Cheers!<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br /></div>
Dinesh Bajajhttp://www.blogger.com/profile/09687011542043594704noreply@blogger.com10tag:blogger.com,1999:blog-6518886080096781053.post-52470071012147403122016-09-22T23:00:00.002+05:302016-10-03T11:39:25.042+05:30FXBilling - A free and open-sourced JavaFX Billing Application<div dir="ltr" style="text-align: left;" trbidi="on">
Hi, I am happy to share with all the readers of my blog a billing application named FXBilling that I have developed in JavaFX. Before I tell more about this application, please have a look at its screenshot below:<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjWofElTeb3tJSptBDGRVF1Teohjd3MgGXqVCVW6fbFAQcwlOa0Kufyr3zkRBoSr10pnrZ0eLtoNTkYREE75JMpy2p1efkZpJRn1ZD9E5_GHGJrXl9XbNAEV8TsNbw2XyuPF7tZD87z9aEp/s1600/Invoice.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="170" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjWofElTeb3tJSptBDGRVF1Teohjd3MgGXqVCVW6fbFAQcwlOa0Kufyr3zkRBoSr10pnrZ0eLtoNTkYREE75JMpy2p1efkZpJRn1ZD9E5_GHGJrXl9XbNAEV8TsNbw2XyuPF7tZD87z9aEp/s320/Invoice.png" width="320" /></a></div>
<br />
More screenshots of the application can be viewed <a href="http://imgur.com/gallery/W1mmS" target="_blank"><span style="color: blue;"><b>here</b>.</span></a><br />
<br />
This application is targeted at small-scaled Indian Traders, and is a JavaFX port of my earlier released C# billing application named <b><a href="http://dineshbajajktn.blogspot.in/2012/12/biller.html" target="_blank">Biller</a>. </b>The features include invoice generation & printing, invoice search, payment receipt, payment search, customer account lookup & printing, database backup & restoration.<br />
<br />
I have taken every care to make this application bug-free; however, a bug or two may still have crept in. So, if you come across any bug, please let me know.<br />
<br />
The Java version 8 (update 72) has been used to develop this application. Hence, you will require this or a newer version of Java to run the application. You can download Java SE Runtime Environment (JRE) from <b><a href="http://www.oracle.com/technetwork/java/javase/downloads/jre8-downloads-2133155.html" target="_blank">here</a>.</b><br />
<br />
<a href="https://1drv.ms/u/s!AhyysGGfm92kg1V1nnyI27JuWQXi" target="_blank"><b>FXBilling Executable Download Link</b></a><br />
<br />
<b><a href="https://1drv.ms/u/s!AhyysGGfm92kg1TRHIQUb1thlcpE" target="_blank">FXBilling Source Code Download Link</a></b><br />
<br />
<span style="color: blue;"><b><u><a href="https://1drv.ms/u/s!AhyysGGfm92kg1OXpkyohf4dwWkM" target="_blank">FXBilling Windows Installer Link</a></u></b></span><br />
<br />
I trust that you will find this application useful whether you are a developer or a user, and you will also enjoy using it as much as I have enjoyed developing it. Do provide your feedback through the comments section below.<br />
<br />
Thanks for your time!<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br /></div>
Dinesh Bajajhttp://www.blogger.com/profile/09687011542043594704noreply@blogger.com44tag:blogger.com,1999:blog-6518886080096781053.post-5074963172873389132016-01-29T23:31:00.000+05:302016-01-29T23:31:43.058+05:30An Indian Matrimony website with source code in ASP.NET Web Pages<div dir="ltr" style="text-align: left;" trbidi="on">
Today, I am sharing a website that I have developed to teach myself website development. It is a basic version of a typical Indian Matrimony website that allows users to register themselves, post their profiles and search for a suitable partner.<br />
<br />
The website is complete as all the bare minimum features have been implemented. The website enables quick and advanced partner search as well as a search by Profile Id. The user can register with the site and create his/her profile; he/she can also upload up to 3 photos. The registration is not required to perform a partner search. Although, it is required to send a message to a user.<br />
<br />
The facility to send a message to a user is not yet implemented. It is a critical feature as the website doesn't disclose the contact details of its users; so, in the absence of this feature, an interested person has no means to contact a profile owner. This facility (and some other facilities like blocking a message from a user, pagination of partner search results etc.) may be make available in a future release of the website.<br />
<br />
The website has been developed in <a href="http://www.asp.net/web-pages" target="_blank">ASP.NET Web Pages 3</a> framework using <a href="https://www.visualstudio.com/en-us/news/vs2013-community-vs.aspx" target="_blank">Visual Studio 2013 Community Edition</a>. The data store is SQL Server 2012. The server side language is C#.<br />
<br />
No third party library or framework has been used either on the client side or the server side. It is all native, pure and standards-complaint HTML, CSS and JavaScript on the client side. The website supports modern browsers only (A modern browser usually means a browser that has been released not more than 2 years back). I have tested the application in the latest version of Chrome for Windows (version 48), but it should work in all capable modern browsers as no Chrome-specific property, feature or method has been used.<br />
<br />
This source code could be a great learning resource for a person looking to learn website programming as it tries to make maximum use of the modern APIs like Constraint Validation API, asynchronous file upload through AJAX, displaying file upload progress through a Progress Bar etc. Best of all, it is all done through natively-available features. So, one is not burdened with the necessity to learn 3rd party libraries.<br />
<br />
<a href="https://onedrive.live.com/redir?resid=A4DD9B9F61B0B21C%21461" rel="nofollow" target="_blank">Website source code</a> | <a href="http://imgur.com/gallery/aRK7y" rel="nofollow" target="_blank">Screenshots</a><br />
<br />
Hope, you find this project useful. Please feel free to provide your feedback through the comments section.<br />
<br />
Thanks for reading this post :-)</div>
Dinesh Bajajhttp://www.blogger.com/profile/09687011542043594704noreply@blogger.com22Katni, Madhya Pradesh 483501, India23.8308453 80.40722549999998123.7146398 80.245863999999983 23.9470508 80.56858699999998tag:blogger.com,1999:blog-6518886080096781053.post-8244219328094050782013-10-04T16:41:00.000+05:302014-11-03T13:45:43.701+05:30Automatic client-side validation using the HTML5 'pattern' attribute<div style="font-size: 1.3em;">The new "pattern" attribute defined in HTML5 facilitates automatic validation of a textbox value by allowing the developer to define a Regular Expression pattern for the field. On form submission, the input value is validated against the pattern, and if the validation fails, the browser highlights the field and shows an error message. <br />
Let's see an example that illustrates all this:<br />
<br />
<div style="margin-top: -0.5em; background-color: #87CEFA;"><br />
<code style="font-family: monospace; white-space:pre;"><br />
<!DOCTYPE html><br />
<html lang="en"><br />
<head><br />
<meta charset="utf-8"><br />
<title>Pattern attribute example</title><br />
</head><br />
<body><br />
<form><br />
<label id="pincode">Pin Code:</label><br />
<!--"required" attribute makes input mandatory in an input element --><br />
<input type="text" id="pincode" name="pincode"<br />
pattern="^[1-9][0-9]{5}$" required<br />
title="A six digit number that doesn't begin with zero."><br />
<br /> <br /><br />
<button type="submit">Submit</button><br />
</form><br />
</body><br />
</html><br />
</code><br />
</div><br />
<div style="font-size: 1.em;"><p>Running the above code in the Google Chrome browser gives me the following screenshot:</p><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgYAByt_WFJKHda0e5N1lSLVBqIuRhB-nZvoU-J-Ulnb_F2eWg8TYNPRNlAdz5MM0FUhTCaEhCQZopVlQNcDgGY4Ga7-TJPrpkKfx2xACK6EtwAkuBI6XwzI1ctHImCF9iSCwtV3skWWDWe/s1600/Screenshot.png" imageanchor="1" ><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgYAByt_WFJKHda0e5N1lSLVBqIuRhB-nZvoU-J-Ulnb_F2eWg8TYNPRNlAdz5MM0FUhTCaEhCQZopVlQNcDgGY4Ga7-TJPrpkKfx2xACK6EtwAkuBI6XwzI1ctHImCF9iSCwtV3skWWDWe/s1600/Screenshot.png" /></a><br />
</div></div>Dinesh Bajajhttp://www.blogger.com/profile/09687011542043594704noreply@blogger.com0Katni, Madhya Pradesh, India23.8283805 80.41853119999996123.712175000000002 80.257169699999963 23.944586 80.579892699999959tag:blogger.com,1999:blog-6518886080096781053.post-62726816315257139292013-10-02T13:20:00.000+05:302013-10-02T13:20:04.267+05:30JavaScript Slideshow<div style="font-size: 1.3em;"><p>In this post, I will illustrate how to periodically change the image source of an 'img' element using JavaScript. This is a simple Slideshow, and doesn't show any animation in sliding in and sliding out of images. Images will be shown one after one at an interval of 3 seconds. Let's see the code now:<br />
</p><br />
<div style="background-color: #E6E6FA; margin-top: 0;"><code style="font-family: monospace; white-space: pre-wrap;"><br />
<!DOCTYPE html><br />
<html><br />
<head><br />
<title>JavaScript Slideshow</title><br />
</head><br />
<body><br />
<img ><br />
<script><br />
var photos = ["file:///C:/Users/Public/Pictures/Sample Pictures/Tulips.jpg",<br />
"file:///C:/Users/Public/Pictures/Sample Pictures/Penguins.jpg",<br />
"file:///C:/Users/Public/Pictures/Sample Pictures/Lighthouse.jpg",<br />
"file:///C:/Users/Public/Pictures/Sample Pictures/Koala.jpg",<br />
"file:///C:/Users/Public/Pictures/Sample Pictures/Jellyfish.jpg"]; <br />
setInterval(changePhoto, 3000); //change image every 3 seconds<br />
var imageElement = document.getElementsByTagName("img")[0];<br />
imageElement.src = photos[0];<br />
var arrayIndex = 0;<br />
var arrayLength= photos.length;<br />
function changePhoto() {<br />
arrayIndex++;<br />
if (arrayIndex === arrayLength) {<br />
arrayIndex = 0;<br />
}<br />
imageElement.src = photos[arrayIndex];<br />
}<br />
</script><br />
</body><br />
</html><br />
</code><br />
<br />
</div><br />
</div>Dinesh Bajajhttp://www.blogger.com/profile/09687011542043594704noreply@blogger.com0tag:blogger.com,1999:blog-6518886080096781053.post-81219897117967659542013-09-30T20:37:00.000+05:302013-09-30T20:37:10.999+05:30Extending properties/methods of an existing class in JavaScript<div style="font-size: 1.3em;"> In JavaScript, properties/methods of an existing class can be extended by using the 'prototype' property of that class. Let's see an example of how to add a function named 'isInt' to String class. This function, as is obvious from its name, tells whether the text content of the target String is a number or not.<br />
<br />
<div style="white-space: pre; font-family: monospace; background-color: #F0FFFF;"><code><br />
<script><br />
if (String.prototype.isInt == null) { <br />
String.prototype.isInt = function() { <br />
var result = parseInt(this.valueOf()); <br />
return !isNaN(result);<br />
}<br />
} <br />
var i = "27";<br />
var j = "shyam"; <br />
var paraElement = document.getElementById("output");<br />
paraElement.innerHTML = ("Is '27' an integer : " + i.isInt());<br />
paraElement.innerHTML += (" <br > Is 'shyam' an integer : " + j.isInt()); <br />
</script><br />
</code><br />
</div></div>Dinesh Bajajhttp://www.blogger.com/profile/09687011542043594704noreply@blogger.com3tag:blogger.com,1999:blog-6518886080096781053.post-37112370768213007852013-09-30T13:00:00.000+05:302013-09-30T13:00:44.359+05:30Displaying validation failed messages to user using JavaScript and CSS<p style="font-size: 1.3em;"> We need to alert the user of the failed validation if he has entered wrong input values in a web form. The validation is done prior to the form submitted to the server (back-end), and the submission is cancelled if the validation fails. Let's see an example of how to do client-side validation, and show error message(s) on validation failure.<br />
</p><br />
<div style="white-space: pre; background-color: #F5FFFA; font-family: monospace;"><!DOCTYPE html><br />
<html><br />
<head><br />
<title>CSS Tooltip</title><br />
<style> <br />
#nameError {display: none; color: red; font-weight: bold; font-size: 1.2em; margin-left: 10px; background-color: #FFDAB9;}<br />
</style><br />
</head><br />
<body><br />
<form><br />
<fieldset><br />
<legend>Student Information</legend><br />
<div><br />
<label id="studentName">Student name:</label><br />
<input name="student"><br />
<span id="nameError">Name not specified, or not of valid length.</span><br />
<br /><br />
(Minimum allowed length is 3, and max allowed length is 12.)<br />
</div> <br />
<div><br />
<button type="submit">OK</button><br />
</div><br />
</fieldset><br />
</form><br />
<script><br />
var frm = document.forms[0];<br />
frm.addEventListener("submit", onFormSubmit, false);<br />
var nameField = document.getElementsByName("student")[0];<br />
var errorElement = document.getElementById("nameError"); <br />
function onFormSubmit(e) {<br />
if (nameField.value.length < 3 || nameField.value.length> 12) { //validation failed<br />
e.preventDefault();<br />
errorElement.style.display = "inline-block";<br />
nameField.focus();<br />
}<br />
}<br />
</script><br />
</body><br />
</html><br />
</div><br />
See a screenshot of the displayed validation message:<br />
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh9tD_Q9zyiCa_VAw419XrnRNTv4UM7b5LUrtiBdZ_c5LYjMjR3VdAOFQVjvyEBYrlwEbIDcKqX6p9Gk2Eckubttcm-TvSlWvtfUZfhyQ0OAVcMQqJ3oc-WajI0A2eBgdZt5nb11gsu91Ow/s1600/Region.png" imageanchor="1" ><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh9tD_Q9zyiCa_VAw419XrnRNTv4UM7b5LUrtiBdZ_c5LYjMjR3VdAOFQVjvyEBYrlwEbIDcKqX6p9Gk2Eckubttcm-TvSlWvtfUZfhyQ0OAVcMQqJ3oc-WajI0A2eBgdZt5nb11gsu91Ow/s320/Region.png" /></a>Dinesh Bajajhttp://www.blogger.com/profile/09687011542043594704noreply@blogger.com0tag:blogger.com,1999:blog-6518886080096781053.post-77903783833161221932013-09-30T12:03:00.001+05:302013-10-02T07:50:52.263+05:30Showing tooltip for a DOM element using CSS.<div dir="ltr" style="text-align: left;" trbidi="on">
Some websites show tooltips for input controls to help user enter the correct values. This not only provides for better user experience, but also potentially reduces the server network traffic as there are less chances of the failed validation at the server end, and the resultant transmission of error messages from the server to the user.<br />
<br />
The question is how to show the tooltip to the user as a DOM element doesn't expose any property for tooltip? The answer lies in using CSS. Let's see an example of how it is done. <br />
<br />
<br />
<section style="background-color: azure; font-family: 'Courier New', Courier, 'Lucida Console', Monaco, monospace; margin-top: 0; white-space: pre;"><br />
<br />
<br />
<!DOCTYPE html><br />
<html><br />
<head><br />
<title>CSS Tooltip</title><br />
<style> <br />
div {position: relative;}<br />
#nameTip {position: absolute; left: 20%; top: 8%;}<br />
span {display: none;}<br />
div:hover span{display: inline; color: green; background-color: yellow;}<br />
</style><br />
</head><br />
<body><br />
<form><br />
<fieldset><br />
<legend>Student Information</legend><br />
<div><br />
<label id="studentName">Student name:</label><br />
<input type="text" id="studentName"><br />
<span id="nameTip">Minimum allowed length is 3, and max length is 12</span><br />
</div> <br />
<div><br />
<label id="dob">Date of birth:</label><br />
<input type="text" id="dob"><br />
<span id="dobTip">Date should be in the format like 2013-29-09</span><br />
</div> <br />
<div><br />
<button type="submit">OK</button><br />
</div><br />
</fieldset><br />
</form><br />
</body><br />
</html><br />
<br />
</section><br />
<br />
See the screenshot below of the tooltip popped up (the mouse is not visible in the screenshot, and I don't know how to capture it):<br />
<br />
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhWagCNbcnNUq_dcvPcsXVEcrZWvI4raXWir2gywDNLF6nGxFe63JOVXbuLkkUcPtPw-nSIPyumX3fZO2RcZl3uheHGLpL-91EKnDewZg97xDhjwBpq6UsPdVWdBLlocw-LUB-ZgFWWiKwK/s1600/screenshot.png" imageanchor="1"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhWagCNbcnNUq_dcvPcsXVEcrZWvI4raXWir2gywDNLF6nGxFe63JOVXbuLkkUcPtPw-nSIPyumX3fZO2RcZl3uheHGLpL-91EKnDewZg97xDhjwBpq6UsPdVWdBLlocw-LUB-ZgFWWiKwK/s1600/screenshot.png" /></a><br />
<br />
<span style="font-size: large;"><i>PS: I later discovered that DOM Elements expose a attribute called "title", and setting the value of this attribute effectively works as a tooltip for that element.</i></span><br />
<br />
<br /></div>
Dinesh Bajajhttp://www.blogger.com/profile/09687011542043594704noreply@blogger.com0tag:blogger.com,1999:blog-6518886080096781053.post-16055761237932727732013-09-13T15:34:00.001+05:302013-09-13T15:34:29.349+05:30Coloring alternate rows of a HTML table<div dir="ltr" style="text-align: left;" trbidi="on">
<span style="font-size: large;">A table containing large number of rows can be visually represented in a better way by coloring alternate rows in different (often contrasting) colors. The rows can be styled using the CSS selectors. Let's see an example of this:</span><div>
<br /></div>
<div>
<div>
<span style="font-family: Courier New, Courier, monospace;"><!DOCTYPE html></span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"><br /></span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"><html lang="en"></span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"><head></span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"><meta charset="utf-8"></span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"><title>Selecting Alternate Table Rows</title></span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"><style></span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"> table {border-collapse: collapse;}</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"> th, td {border: 1px solid gray; padding: 5px;}</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"> <span style="background-color: #b6d7a8;">tr:nth-child(2n+2) {background: #E1F5A9;}</span></span></div>
<div>
<span style="background-color: #b6d7a8; font-family: Courier New, Courier, monospace;"> tr:nth-child(2n+3) {background: #CEECF5;}</span></div>
<div>
<span style="background-color: #b6d7a8; font-family: Courier New, Courier, monospace;"> tr:first-child{background: #F6CECE;}</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"> </span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"></style></span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"></head></span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"><body></span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"><br /></span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"><h1>CSS Table Row Selectors</h1></span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"><br /></span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"><table></span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"> <tr></span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"> <td>Col 1</td> <td>Col 2</td> <td>Col 3</td></span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"> </tr></span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"> </span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"> <tr></span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"> <td>One</td> <td>Two</td> <td>Three</td></span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"> </tr></span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"> </span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"> <tr></span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"> <td>Asia</td> <td>Africa</td> <td>Europe</td></span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"> </tr></span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"> </span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"> <tr></span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"> <td>Summer</td> <td>Winter</td> <td>Spring</td></span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"> </tr></span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"> </span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"> <tr></span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"> <td>Cricket</td> <td>Football</td> <td>Tennis</td></span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"> </tr></span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"></table></span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"><br /></span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"></body></span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"></html></span></div>
</div>
<div>
<span style="font-family: Courier New, Courier, monospace;"><br /></span></div>
<div>
<span style="font-family: inherit;">Here is the output:</span></div>
<div>
<span style="font-family: inherit;"><br /></span></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg1toC-rrvRa8zJCp1yWUSobucmY-FMAoT-KEANiNmy051iFWY78GEdWaxMBK9dUsJJ6hMKDBTsFqtXDSH-Gb-cPI0xtt4G1L_o0xuxOjljsXwEbfNRGuNRcQLpZ06NidxeZmVHdTECtlO1/s1600/HTML_Table.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg1toC-rrvRa8zJCp1yWUSobucmY-FMAoT-KEANiNmy051iFWY78GEdWaxMBK9dUsJJ6hMKDBTsFqtXDSH-Gb-cPI0xtt4G1L_o0xuxOjljsXwEbfNRGuNRcQLpZ06NidxeZmVHdTECtlO1/s1600/HTML_Table.png" /></a></div>
<div>
<br /></div>
</div>
Dinesh Bajajhttp://www.blogger.com/profile/09687011542043594704noreply@blogger.com0tag:blogger.com,1999:blog-6518886080096781053.post-6636681849656114492013-09-13T14:44:00.002+05:302013-09-13T14:51:28.985+05:30Cancelling form submission through JavaScript<div dir="ltr" style="text-align: left;" trbidi="on">
<span style="font-size: large;">When doing client-side validation on a web form, there arises a need to cancel the form submission if the user has not provided the data as required by the host website. This can be easily accomplished by invoking the preventDefault method on the 'event' argument passed to the form's 'Submit' event-handler. An example will better illustrate it; so, here it goes:</span><br />
<span style="font-size: large;"><br /></span>
<span style="font-family: Courier New, Courier, monospace;"><!DOCTYPE html></span><br />
<span style="font-family: Courier New, Courier, monospace;"><br /></span>
<span style="font-family: Courier New, Courier, monospace;"><html lang="en"></span><br />
<span style="font-family: Courier New, Courier, monospace;"><head></span><br />
<span style="font-family: Courier New, Courier, monospace;"><meta charset="utf-8"></span><br />
<span style="font-family: Courier New, Courier, monospace;"><title>Cancelling Form Submission</title></span><br />
<span style="font-family: Courier New, Courier, monospace;"><style></span><br />
<span style="font-family: Courier New, Courier, monospace;"> .error {border: 2px solid red;}</span><br />
<span style="font-family: Courier New, Courier, monospace;"> div:last-child {margin-top: 10px;}</span><br />
<span style="font-family: Courier New, Courier, monospace;"></style></span><br />
<span style="font-family: Courier New, Courier, monospace;"></head></span><br />
<span style="font-family: Courier New, Courier, monospace;"><body></span><br />
<span style="font-family: Courier New, Courier, monospace;"><br /></span>
<span style="font-family: Courier New, Courier, monospace;"><form method="post" action="#"></span><br />
<span style="font-family: Courier New, Courier, monospace;"> </span><br />
<span style="font-family: Courier New, Courier, monospace;"> <div></span><br />
<span style="font-family: Courier New, Courier, monospace;"> <label for="name">Your name (atleast 3 characters long): </label></span><br />
<span style="font-family: Courier New, Courier, monospace;"> <input type="text" name="name" id="name" required /></span><br />
<span style="font-family: Courier New, Courier, monospace;"> </div></span><br />
<span style="font-family: Courier New, Courier, monospace;"> </span><br />
<span style="font-family: Courier New, Courier, monospace;"> <div></span><br />
<span style="font-family: Courier New, Courier, monospace;"> <button type="submit">OK</button></span><br />
<span style="font-family: Courier New, Courier, monospace;"> </div></span><br />
<span style="font-family: Courier New, Courier, monospace;"></form></span><br />
<span style="font-family: Courier New, Courier, monospace;"><br /></span>
<span style="font-family: Courier New, Courier, monospace;"><script></span><br />
<span style="font-family: Courier New, Courier, monospace;"> </span><br />
<span style="font-family: Courier New, Courier, monospace;"> var formElement = document.forms[0];</span><br />
<span style="font-family: Courier New, Courier, monospace;"> formElement.addEventListener("submit", onFormSubmission, false);</span><br />
<span style="font-family: Courier New, Courier, monospace;"> </span><br />
<span style="font-family: Courier New, Courier, monospace;"> function onFormSubmission(e) {</span><br />
<span style="font-family: Courier New, Courier, monospace;"> var textElement = document.getElementById("name");</span><br />
<span style="font-family: Courier New, Courier, monospace;"> <span style="background-color: #d9ead3;"> if (textElement.value.length < 3) {</span></span><br />
<span style="background-color: #d9ead3; font-family: Courier New, Courier, monospace;"> textElement.className = "error";</span><br />
<span style="background-color: #d9ead3; font-family: Courier New, Courier, monospace;"> <b> e.preventDefault();</b></span><br />
<span style="background-color: #d9ead3; font-family: Courier New, Courier, monospace;"> }</span><br />
<span style="font-family: Courier New, Courier, monospace;"> } </span><br />
<span style="font-family: Courier New, Courier, monospace;"> </span><br />
<span style="font-family: Courier New, Courier, monospace;"></script> </span><br />
<span style="font-family: Courier New, Courier, monospace;"><br /></span>
<span style="font-family: Courier New, Courier, monospace;"></body></span><br />
<span style="font-family: Courier New, Courier, monospace;"></span><br />
<span style="font-family: Courier New, Courier, monospace;"></html></span><br />
<span style="font-size: large;"><br /></span>
<span style="font-size: large;">Some people could say that what I have written is nothing new, and is known for ages. They would be very true if they said so. However, my motive behind writing these posts is not to announce any path-breaking discoveries to the world, but to note down some of my learnings so as to reinforce it.<br />
</span> <span style="font-size: large;"><br />
</span></div>
Dinesh Bajajhttp://www.blogger.com/profile/09687011542043594704noreply@blogger.com0tag:blogger.com,1999:blog-6518886080096781053.post-87998964153345617392012-12-28T16:31:00.001+05:302012-12-28T16:31:11.898+05:30Displaying Indian Currency Symbol in C#<div dir="ltr" style="text-align: left;" trbidi="on">
<span style="font-size: large;">The new Indian Currency Symbol (<b>₹</b>) can b<span style="font-size: large;">e shown in a C# application by using the <span style="font-size: large;">Un<span style="font-size: large;">icode es<span style="font-size: large;">cape seq<span style="font-size: large;">uence (\u). The </span></span></span></span></span>Unicode character value assigned to the <span style="font-size: large;">new <span style="font-size: large;">Indian currency symbol is 8377. It is equivalent to 20B9 in he<span style="font-size: large;">xadecimal (base 16) <span style="font-size: large;">notation.</span></span></span></span></span><br />
<span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"> </span></span></span></span></span><br />
<span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;">So, we can <span style="font-size: large;">display the new currency symbol in a C# application <span style="font-size: large;">in the following manner:</span></span></span></span></span></span></span><br />
<br />
<span style="font-family: "Courier New",Courier,monospace;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;">label<span style="font-size: large;">1.Text = <span style="font-size: large;">"\u2<span style="font-size: large;">0B<span style="font-size: large;">9"</span></span></span>;</span></span></span></span></span></span></span></span></span><br />
<br />
<span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;">Please <span style="font-size: large;">see the screenshot below that shows a W<span style="font-size: large;">indows Forms C# application <span style="font-size: large;"><span style="font-size: large;">displaying</span> the new currency symbol<span style="font-size: large;">.</span></span></span></span></span></span></span></span></span></span></span></span><br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgG3josQqtHuotDWIr6OuaFBegmoBeyT66v_9VtPtX4aHP-oql1lrNyHdSIbPe1RYwoeOnPvPNwRv_WqdgcMN61MXb4V21rMNVeFKeFXWVz-wWzqNyLbNXW0Kv3pnosLLP4wa4GkfJVjK39/s1600/Indian+Rupee+Symbol+in+Dot+NET.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgG3josQqtHuotDWIr6OuaFBegmoBeyT66v_9VtPtX4aHP-oql1lrNyHdSIbPe1RYwoeOnPvPNwRv_WqdgcMN61MXb4V21rMNVeFKeFXWVz-wWzqNyLbNXW0Kv3pnosLLP4wa4GkfJVjK39/s1600/Indian+Rupee+Symbol+in+Dot+NET.png" /></a></div>
<br />
<span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;">The labels in th<span style="font-size: large;">e abo<span style="font-size: large;">ve screenshot </span></span>have been as<span style="font-size: large;">signed text using the following commands:</span></span></span></span></span></span></span></span></span></span></span></span></span><br />
<br />
<span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;">label1.Text = "\u20B9 - " + label1.Font.Name;<br />label2.Text = "\u20B9 - " + label2.Font.Name;<br />label3.Text = "\u20B9 - " + label3.Font.Name; </span></span></span></span></span></span></span></span></span></span></span></span></span><br />
<br />
<span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;">To display the currency symbol, the f<span style="font-size: large;">ont used must support Unicode S<span style="font-size: large;">tandard 6.0 or later. If you<span style="font-size: large;">r OS is Windows 7 <span style="font-size: large;">or </span>Vista and you are using a Microsoft font and it is not d<span style="font-size: large;">isplay<span style="font-size: large;">ing<span style="font-size: large;"> the currency symbol, you may like to install the<span style="font-size: large;"> update that</span></span></span></span></span> Micr<span style="font-size: large;">osoft relea<span style="font-size: large;">sed in earl<span style="font-size: large;">y 20<span style="font-size: large;">11 to update <span style="font-size: large;">its fonts. To <span style="font-size: large;">know more about <span style="font-size: large;">this update<span style="font-size: large;">, please visit <a href="http://support.microsoft.com/kb/2496898" target="_blank"><b><span style="color: blue;">this link</span></b></a>.</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span><br />
<br />
<span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;">Happy <span style="font-size: large;">coding!</span> </span></span></span></span></span></span></span></span></span></span></span></span></span></span></span> </span></span></span> </span></span></span></span></span></div>
Dinesh Bajajhttp://www.blogger.com/profile/09687011542043594704noreply@blogger.com0tag:blogger.com,1999:blog-6518886080096781053.post-18108074310624055542012-12-28T08:51:00.002+05:302014-11-03T13:24:48.544+05:30Android Application Source Code<div dir="ltr" style="text-align: left;" trbidi="on"><span style="font-size: large;">Around two years back I wro<span style="font-size: large;">te<span style="font-size: large;"> an application in the process of learning Android <span style="font-size: large;">application development. The application <span style="font-size: large;">created was named 'Schedule View' as <span style="font-size: large;">it<span style="font-size: large;"> would let a user view the complete schedule <span style="font-size: large;">of the ICC Cricket World Cup<span style="font-size: large;"> held in the Indian subcontinent<span style="font-size: large;"> in 2011. The application was posted online<span style="font-size: large;"> and made available for free, and it<span style="font-size: large;"> ha<span style="font-size: large;">d</span> a fair n<span style="font-size: large;">umber of downloads<span style="font-size: large;">. You can still download the application from <b><span style="color: blue;"><a href="http://slideme.org/application/schedule-view" target="_blank">here</a></span></b><span style="font-size: large;"> & <b><span style="color: blue;"><a href="http://www.androidfreeware.net/download-schedule-view.html" target="_blank">here</a></span></b>.</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span><br />
<br />
<span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;">Well, I am now making available the source code of th<span style="font-size: large;">is application in the h<span style="font-size: large;">ope that it could be of help to somebody who<span style="font-size: large;"> is learning the r<span style="font-size: large;">opes of <span style="font-size: large;">Android application development. <span style="font-size: large;">The source code is available as<span style="font-size: large;"> an Ecl<span style="font-size: large;">ipse project, and can be downloaded from <a href="https://skydrive.live.com/redir?resid=A4DD9B9F61B0B21C!396" target="_blank"><span style="color: blue;"><b>here</b></span></a>.</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span><br />
<br />
<span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;">Thank you. :-)</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></div>Dinesh Bajajhttp://www.blogger.com/profile/09687011542043594704noreply@blogger.com4tag:blogger.com,1999:blog-6518886080096781053.post-25247682450677156062012-12-27T18:26:00.000+05:302014-11-03T13:22:40.486+05:30Number To Words in C# - Source Code<div dir="ltr" style="text-align: left;" trbidi="on"><span style="font-size: large;">In my previous post <a href="http://dineshbajajktn.blogspot.com/2012/12/number-to-words-in-java.html" target="_blank">Number To Words in Java</a>, I <span style="font-size: large;">presented the code to convert a number to words i<span style="font-size: large;">n the Indian Numbering System (INS). N<span style="font-size: large;">ow I <span style="font-size: large;">tra<span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;">nslated</span> that code to <span style="font-size: large;">C# so that <span style="font-size: large;">it could be used in a .N<span style="font-size: large;">E<span style="font-size: large;">T application. The translation was fairly easy<span style="font-size: large;"> as C<span style="font-size: large;"># and Ja<span style="font-size: large;">va's syntax resemble quit a lot.</span></span></span></span></span></span></span></span></span></span></span></span></span></span><br />
<br />
<span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;">The class in <span style="font-size: large;">the translated code retains th<span style="font-size: large;">e same name <span style="font-size: large;">which is NumberToWord<span style="font-size: large;">s. A typical usage of the c<span style="font-size: large;">lass would be like this:</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span><br />
<br />
<pre style="background: none repeat scroll 0% 0% white; color: black;"><span style="font-size: large;"><span style="font-family: "Courier New",Courier,monospace;"><span style="color: blue;">decimal</span> number = 1084.92M;
<span style="color: blue;">string</span> numberInWords = <span style="color: #2b91af;"> <span style="font-family: Times,"Times New Roman",serif;"><span style="color: black;">(line break given for clarity)</span></span></span></span></span></pre><pre style="background: none repeat scroll 0% 0% white; color: black;"><span style="font-size: large;"><span style="font-family: "Courier New",Courier,monospace;"><span style="color: #2b91af;">NumberToWords</span>.<span style="font-size: large;">C</span>onvertNumberToWords(number);</span></span></pre><br />
<span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;">The class pro<span style="font-size: large;">duces the same<span style="font-size: large;"> output as its corresponding Java class.</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span><br />
<br />
<span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><a href="https://skydrive.live.com/redir?resid=A4DD9B9F61B0B21C!394" target="_blank"><span style="color: blue;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;">Class <span style="font-size: large;">download link</span></span> </span></span></span></a></span></span> </span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span><br />
<span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"> </span></span></span></span></span> </span></span></span></span></span></span></span></span></span></span></span></span></span></span></div>Dinesh Bajajhttp://www.blogger.com/profile/09687011542043594704noreply@blogger.com0tag:blogger.com,1999:blog-6518886080096781053.post-68355486837809958642012-12-27T16:46:00.001+05:302014-11-03T13:23:02.223+05:30Number To Words In Java - Source Code<div dir="ltr" style="text-align: left;" trbidi="on"><span style="font-size: large;">The invoices now-a-days carry not only the invoice amount but the amount in words also (Though it is not a requirement, and I personally don't see any usefulness of showing the amount in words).<br />
<br />
While converting a number to words, we have to find a solution that is unique to the <i>Indian Numbering System (INS)</i>. <br />
<br />
The INS is different from the <i>Western Numbering System (WNS)</i> in the sense that after the first grouping that is done on thousand, the rest of the groupings are done on hundred. So, for a amount like 374892, the conversion in INS would read as "<span style="font-size: large;">Three</span> Lakh (or Lac) Seventy Four Thousand Eight Hundred & Ninety Two"; While this same number would be converted to WNS as "Three Hundred Seventy Four Thousand Eight Hundred & Ninety Two". The words Million, Billion, Trillion, Zillion and so forth are alien to INS, whereas WNS is ignorant of the words Lakh (or Lac), Crore, Paisa.<br />
<br />
In one of my applications, I had to write code to convert amount to words, and the result of which is the class "<i>NumberToWords</i>". The typical usage of this class is as under:<br />
<br />
<code>String numberInWords = NumberToWords.convertNumberToWords(numberVariable);</code> <br />
<br />
Here, numberVariable is of type<i> java.math.BigDecimal</i> and can be declared and initialised like this: <br />
<br />
<code>BigDecimal numberVariable = new BigDecimal("1094.75");</code><br />
<br />
To download the code, please visit <a href="https://skydrive.live.com/redir?resid=A4DD9B9F61B0B21C!393" target="_blank"><span style="color: blue;"><b>this link</b></span></a>.</span><br />
<span style="font-size: large;"><br />
</span> <span style="font-size: large;">Below is a table that shows numbers on the left and their corresponding conversion to words on the right done by the aforesaid class.</span><br />
<br />
<br />
<div style="font-size: large;"><table border="1" bordercolor="#FFCC00" cellpadding="4" cellspacing="4" style="background-color: #ffffcc; width: 90%px;"><tbody>
<tr> <th>Amount</th> <th>Conversion To Words</th> </tr>
<tr> <td align="right">1084.72</td> <td>One Thousand Eighty Four & Seventy Two Paise </td> </tr>
<tr> <td align="right">0.96</td> <td>Ninety Six Paise</td> </tr>
<tr> <td align="right">558972691</td> <td>Fifty Five Crore Eighty Nine Lakh Seventy Two Thousand Six Hundred Ninety One</td> </tr>
<tr> <td align="right">10932756847</td> <td>One Thousand Ninety Three Crore Twenty Seven Lakh Fifty Six Thousand Eight Hundred Forty Seven</td> </tr>
<tr> <td align="right">0.00</td> <td>Zero</td> </tr>
<tr> <td align="right">7</td> <td>Seven</td> </tr>
<tr> <td align="right">11.15</td> <td>Eleven & Fifteen Paise</td> </tr>
<tr> <td align="right">109</td> <td>One Hundred Nine</td> </tr>
<tr> <td align="right">-111.11</td> <td>Minus One Hundred Eleven & Eleven Paise</td> </tr>
</tbody></table></div><br />
<div style="font-size: large;">Trust this is of use to somebody. And thank you for your time for reading this post. :-))</div></div>Dinesh Bajajhttp://www.blogger.com/profile/09687011542043594704noreply@blogger.com1tag:blogger.com,1999:blog-6518886080096781053.post-39378569859807974822012-12-23T14:24:00.000+05:302014-11-03T14:05:02.474+05:30A Free C# Billing Application with Source Code (.NET)<div dir="ltr" style="text-align: left;" trbidi="on"><h3 style="text-align: left;"><u><span style="color: #cc0000;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;">Biller - The Free Billing Application</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></u></h3><h3><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="color: purple;"><span style="color: black;"></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></h3><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="color: purple;"><span style="color: black;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;">I am glad to present Biller - a free billing application. This application has been developed keeping small Indian businesses in mind. In India, most of the goods are sold without paying any taxes i.e. tax evasion is done on most of the sales, and hence no tax is added in the invoice. The invoices issued to the customers in general are not the ones that are shown to the Sales Tax officials. This application therefore in keeping in mind its target users don't support the concept of tax. </span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span><br />
<br />
<h4 style="text-align: left;"><u><span style="color: #cc0000;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;">Application Screenshots</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></u></h4><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="color: purple;"><span style="color: black;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;">16 screenshots of the application are available. To view these, please click this link<b><span style="font-size: large;">.</span></b></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span><br />
<span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="color: purple;"><span style="color: black;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><a href="http://postimage.org/gallery/bmv0a4f4/" target="_blank"><b>Application Screenshots link</b></a></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span><br />
<br />
<h4 style="text-align: left;"></h4><h4 style="text-align: left;"></h4><h4 style="text-align: left;"></h4><h4 style="text-align: left;"><u><span style="color: #cc0000;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;">Application Download </span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></u></h4><h4><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="color: purple;"><span style="color: black;"></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></h4><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="color: purple;"><span style="color: black;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;">The application can be downloaded for free. The application download size is less than a MB. </span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span><br />
<span style="color: blue;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><b><a href="http://sdrv.ms/ZF18Ff" target="_blank">Application Download link</a></b></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span><br />
<br />
<h4 style="text-align: left;"></h4><h4 style="text-align: left;"></h4><h4 style="text-align: left;"><u><span style="color: #cc0000;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;">Application Pre-requisites<span style="font-size: large;"> (Impo<span style="font-size: large;">rtan<span style="font-size: large;">t)</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></u></h4><h4><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="color: purple;"><span style="color: black;"></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></h4><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="color: purple;"><span style="color: black;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;">Though the application code itself is quite small, the framework and tools used by it are bulky. To install and run the application, you need to have the following software installed on your computer:<br />
<br />
1) <span style="color: #f1c232;"><u><b>.NET Framework 4.0</b></u></span><br />
Full version of .Net Framework 4.0 needs to be installed on your computer. The compact version of .NET Framework better known as the Client Profile version won't suffice for running this application as it uses Crystal Reports.<br />
<b><span style="color: blue;"><a href="http://www.microsoft.com/en-in/download/details.aspx?id=17718" target="_blank">.NET Framework Download link</a></span></b></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span><br />
<span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="color: purple;"><span style="color: black;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><br />
If you are using Windows 8, then you are not required to download the .NET Framework as Windows 8 comes bundled with .NET Framework 4.5.<br />
<br />
2) <span style="color: #f1c232;"><u><b>Crystal Reports Runtime Engine for .NET Framework 4.0</b></u></span><br />
Though I hated to use it in my application due to its bulkiness, I had no other option but to use it as it is the only professional quality reporting tool available for .NET world for free. Microsoft's ReportViewer infrastructure that comes bundled with Visual Studio is not adequate for professional reporting requirements.<br />
<span style="color: blue;"><a href="http://downloads.businessobjects.com/akdlm/cr4vs2010/CRforVS_redist_install_32bit_13_0_4.zip" target="_blank"><b>Download link for Crystal Reports Runtime Engine for .NET Framework 4.0</b></a></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span><br />
<br />
<h4 style="text-align: left;"></h4><h4 style="text-align: left;"></h4><h4 style="text-align: left;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="color: purple;"><span style="color: black;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><u><span style="color: #cc0000;"><span style="font-size: large;">Application Source Code</span></span></u></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></h4><h4><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="color: purple;"><span style="color: black;"></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></h4><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="color: purple;"><span style="color: black;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;">Full souce code of the application is available for download. The application has been written in C# using Visual Studio 2010. The database used is SQL Server Compact Edition (CE) version 4.0. </span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span><br />
<span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="color: purple;"><span style="color: black;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><br />
</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span> <span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="color: purple;"><span style="color: black;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="color: blue;"><b><a href="http://sdrv.ms/ZF0FD8" target="_blank">Application Source Code Download link</a></b></span><br />
</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span><br />
<span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="color: purple;"><span style="color: black;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;">Few peo<span style="font-size: large;">ple</span> may wonder why I am making available the <span style="font-size: large;">complete</span> source code of the application available for free. Well, to tell you the truth it was a t<span style="font-size: large;">ough decision </span>and at the same time easy decision for me to take. It was tough because for a developer the source code is a very valued and dear capital. Its value can only be appreciated by those people who have devoted their significant time and energy to acquire the knowledge to write it. And it was a easy decision for me to take because I really wanted to give something back to the world. It is my way of expressing my gr<span style="font-size: large;">ati<span style="font-size: large;">tud</span></span>e and <span style="font-size: large;">acknowledge</span> indebtedness to the Internet community for their magnanimity and helpfulness. If it were not for the help available to me through numerous articles, tips and tricks, free e-books, code samples<span style="font-size: large;"> & </span>Videos posted on Internet, and also help offered by kind souls available in various forums, I would not even think about writing software. </span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span><br />
<br />
<h4 style="text-align: left;"></h4><h4 style="text-align: left;"><span style="color: #cc0000;"><u><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;">Feedback Solicited</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></u></span></h4><h4><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="color: purple;"><span style="color: black;"></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></h4><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="color: purple;"><span style="color: black;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;">I would love to receive your feedback about the application - good or bad. You can provide the feedback through the comment section to this blog post. You can also email me on the email address provided in the 'About...' option under the Help menu in the application.<br />
<br />
Thank you :-))<br />
<br />
</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span><span style="font-size: large;"><b><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><span style="font-size: large;"><br />
</span></span></span></span></span></span></span></b></span></div>Dinesh Bajajhttp://www.blogger.com/profile/09687011542043594704noreply@blogger.com71Katni, Madhya Pradesh, India23.836081 80.39546999999993223.719887 80.234108499999934 23.952275 80.55683149999993tag:blogger.com,1999:blog-6518886080096781053.post-89928546936362417522012-12-16T16:32:00.001+05:302014-11-11T08:10:05.393+05:30Disabling Parameter Prompt Dialog Box in Crystal Reports For Visual Studio<div dir="ltr" style="text-align: left;" trbidi="on">
While working with Crystal Reports for Visual Studio 2010, I came across a strange problem. The problem was that the report was prompting me through a dialog box to input values for the parameters defined in the report when I was showing the report in my application. It was indeed a strange behavior as I had assigned the values to all the parameters in the report before showing the ReportViewer control.<br />
<br />
I then started searching the internet for the solution to this problem, and came to know that users are experiencing this problem from as early as 2005!!! This made me wonder why this problem has not been resolved yet as I am using the very latest version (CR for VS 2010 Update 4) downloaded few days before from the SAP website. I came across many solutions that had been suggested to get rid of the dialog box. I tried most of them but unsuccessfully as the obdurate dialog box refused to let go, and this made me really frustrated.<br />
<br />
After spending many hours trying to find a fix to this issue, I finally got the solution posted in <a href="http://www.it-sideways.com/2011/10/how-to-disable-parameter-prompt-for.html" target="_blank">this blog post</a>. The solution is to follow the steps provided below when showing a report:<br />
<ol style="text-align: left;">
<li>Assign a data source to the report like <code>repotDocumentObject.SetDataSource(aDataSourceObject)</code></li>
<li>Assign the report to the CrystalReportViewer control like <code>reportViewer.ReportSource = reportDocumentObject</code>.</li>
<li>Set parameter values like <code>reportDocumentObject.SetParameterValue(0, invoiceDate)</code>.</li>
</ol>
That's it. That is all required to get rid of the annoying Parameter Prompt Dialog box in Crystal Reports for Visual Studio. </div>
Dinesh Bajajhttp://www.blogger.com/profile/09687011542043594704noreply@blogger.com7Katni, Madhya Pradesh, India23.8283805 80.41853119999996123.8283805 80.418531199999961 23.8283805 80.418531199999961tag:blogger.com,1999:blog-6518886080096781053.post-16051922310763176102012-11-16T11:30:00.001+05:302014-11-11T08:12:56.901+05:30Windows Forms DataGridView FAQ PDF Download<div dir="ltr" style="text-align: left;" trbidi="on">
<span style="color: black; font-family: Verdana; font-size: 9.5pt;"><span style="color: black; font-family: Verdana; font-size: 9.5pt;"><span style="color: black;"> </span></span></span> <br />
<div class="western" style="page-break-after: avoid; text-align: left;">
</div>
<div class="western" style="page-break-after: avoid; text-align: left;">
<b><span style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;"><span style="color: blue; font-size: large;"><a href="https://skydrive.live.com/redir?resid=A4DD9B9F61B0B21C%21381&authkey=%21ACsrSX-tIp3evYI" target="_blank">Link to the FAQ file</a></span></span></b><br />
<b><span style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;"><span style="font-size: medium;"><span style="font-weight: normal;"><br /></span></span></span></b>
<b><span style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;"><span style="font-size: medium;"><span style="font-weight: normal;">A developer who has worked with Windows Forms will appreciate the importantance of the control <a href="http://msdn.microsoft.com/en-us/library/system.windows.forms.datagridview.aspx">DataGridView</a> to the application development. It is an all-in-one control that enables one to display, add, edit and delete data in a grid. It exposes numerous properties, methods & events to fully <span style="font-size: medium;">customize</span> its <span style="font-size: medium;">behavior</span>. It is therefore not uncommon that one will look for some help (apart from the documentation) when working with it.</span></span></span></b></div>
<div class="western" style="page-break-after: avoid; text-align: left;">
<br /></div>
<div class="western" style="text-align: left;">
<b><span style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;"><span style="font-size: medium;"><span style="font-weight: normal;">When one goes to the <a href="http://social.msdn.microsoft.com/Forums/en/winformsdatacontrols/threads">Windows Forms Data Controls and Databinding forum</a> hosted by Microsoft to seek help, he/she is asked to refer to the DataGridView FAQ before posting any query in the forum as the FAQ contains the answers to the most common questions related to the control. The link presented therein is : <a href="http://www.windowsclient.net/Samples/Go%20To%20Market/DataGridView/DataGridView%20FAQ.doc">http://www.windowsclient.net/Samples/Go%20To%20Market/DataGridView/DataGridView%20FAQ.doc</a></span></span></span></b></div>
<div class="western" style="text-align: left;">
<br /></div>
<div class="western" style="page-break-after: avoid; text-align: left;">
<b><span style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;"><span style="color: black;"><span style="font-size: medium;"><span style="font-weight: normal;">However, the above-mentioned link doesn't work as it takes one to the MSDN Code Repository, where the FAQ in question can't be found. I also faced the same problem, but on a further Google search, I was able to find the FAQ .doc file hosted on a third-party file sharing site. I then converted it to a PDF file since I find it more convenient to read, and then hosted it on my SkyDrive account so that others can access it. The link to the file is provided at the very beginning of this post.</span></span></span></span></b><br />
<b><span style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;"><span style="color: black;"><span style="font-size: medium;"><span style="font-weight: normal;"><br /></span></span></span></span></b>
<b><span style="font-family: "Helvetica Neue",Arial,Helvetica,sans-serif;"><span style="color: black;"><span style="font-size: medium;"><span style="font-weight: normal;">Thank you for reading this post. :-)</span></span></span></span></b> </div>
</div>
Dinesh Bajajhttp://www.blogger.com/profile/09687011542043594704noreply@blogger.com2Katni, Madhya Pradesh, India23.8283805 80.41853119999996123.712175000000002 80.257169699999963 23.944586 80.579892699999959tag:blogger.com,1999:blog-6518886080096781053.post-84868407188792660522012-08-10T11:09:00.000+05:302014-11-03T13:52:28.456+05:30MLM Admin - Source code for JavaFX application<div dir="ltr" style="text-align: left;" trbidi="on"><span style="font-size: small;">Hello and welcome to my blog :-). In this blog pos<span style="color: #660000;"><span style="font-size: small;">t, <span style="color: black;">I<span style="font-size: small;"> am sharing </span></span></span></span>a JavaFX application that I have written. The application has been written using <b>Java 7 Update 5 and JavaFX version 2.1</b>.</span><br />
<span style="font-size: small;"><br />
</span> <span style="font-size: small;"><b><u>Background for this post:</u></b></span><br />
<span style="font-size: small;"><br />
</span> <span style="font-size: small;">Actually, I never intended to write this blog, and made this application available public. But, it so happened that the client who had contracted me to write this application was offering peanuts to me as a fee for writing this app. His behavior was not unusual as software piracy is very rampant in Katni, Madhya Pradesh, India where I live, and people are just not inclined to shell out money for the software. They in general don't value any thing that can't be touched e.g writing (sorry for sounding accusative). So frustrated at on not getting the reasonable fee for this app, I decided to make it available to the public in large.</span><br />
<span style="font-size: small;"><br />
</span> <span style="font-size: small;">This application is a result of my first serious attempt at writing a JavaFX application. Prior to that I have written few Swing applications, but was not satisfied with the sedate looks they offered. So when I heard about the graphically rich behavior of the JavaFX framework, I was naturally excited.</span><br />
<span style="font-size: small;"><br />
</span> <span style="font-size: small;">So enough of background info for the app and this blog post :-), now let me turn my attention to the app itself. Before I could start writing about the app, you may want to know how it looks. Well, few screenshots of the application are available<b> <a href="http://postimage.org/gallery/1zm9ntyo/">here</a>. </b>The application (sans source code) can be downloaded<span style="font-size: small;"> </span>by clicking<a href="https://rapidshare.com/files/594788935/MLM%20Admin.zip"><b> </b></a><span style="font-size: small;"><b><a href="https://skydrive.live.com/redir?resid=A4DD9B9F61B0B21C!380&authkey=!APBNEr1P5E2NYzw">here</a>.</b></span></span><br />
<span style="font-size: small;"><br />
</span> <span style="font-size: small;"><b><u>Objective of the application:</u></b></span><br />
<span style="font-size: small;"><b><u><br />
</u></b> The objective is to the manage the membership details of a<a href="http://en.wikipedia.org/wiki/Multi-level_marketing"><i><b> multi-level marketing</b></i></a> firm. The client's primary demand was that the application should notify the user about the commissions due (if any) to the existing members when a new member joins the business. The application supports so-called<i> <b>Matrix plans</b></i>, where formed a matrix of 3, 4 or etc. which continues to every level. If you choose a matrix of 3 then every member has to join three members under him/her.</span><br />
<span style="font-size: small;"><br />
</span> <span style="font-size: small;">The app works according to the principle that the the joining fee of a member becomes due to him/her on completing level 1. The commission due to a member on completing level 2 or more can be specified in the Business rules dialog box as a percentage of the total amount received as joining fee from the members of the completed level. See the image below:</span><br />
<span style="font-size: small;"><br />
</span> <br />
<div class="separator" style="clear: both; text-align: center;"><span style="font-size: small;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhEonPrZrhExxwqrSGTTbrM480rICwMc0Qy80rQT1F2HV1vCrLKbRZsCStMTCp4xptZokHna4ycNC9BNS_5WCz5HDRV9IfHDz6DmcAtQ_7GVfg0_Jb5jRksFkJq2pnNaZLmUY9VYgGSrWCC/s1600/Business+Rules.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhEonPrZrhExxwqrSGTTbrM480rICwMc0Qy80rQT1F2HV1vCrLKbRZsCStMTCp4xptZokHna4ycNC9BNS_5WCz5HDRV9IfHDz6DmcAtQ_7GVfg0_Jb5jRksFkJq2pnNaZLmUY9VYgGSrWCC/s320/Business+Rules.png" height="320" width="306" /></a></span></div><span style="font-size: small;"><br />
</span> <span style="font-size: small;">As expected, the application allows to view the member tree, and let you find out the number of members that have joined (directly or indirectly) under a particular member. See the screenshot below:</span><br />
<span style="font-size: small;"><br />
</span> <br />
<div class="separator" style="clear: both; text-align: center;"><span style="font-size: small;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEje3gGHdlBA-hyp6jeRxNrHD-M-y6m7eOLSsGwa1Ll0TabELDKAP8QtWKx5NcjZgU98DUj-YW3fdRagooz_sgr8ADs3JM8uvKE5YMYYYVnEdnOamYJ2P7jdjq9qILnne_frmfujbbE6oI4A/s1600/Sub+Members+Count.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEje3gGHdlBA-hyp6jeRxNrHD-M-y6m7eOLSsGwa1Ll0TabELDKAP8QtWKx5NcjZgU98DUj-YW3fdRagooz_sgr8ADs3JM8uvKE5YMYYYVnEdnOamYJ2P7jdjq9qILnne_frmfujbbE6oI4A/s320/Sub+Members+Count.png" height="303" width="320" /></a></span></div><span style="font-size: small;"><br />
</span> <span style="font-size: small;"><br />
</span> <span style="font-size: small;"><b><u>FXML & Scene Builder:</u></b></span><br />
<span style="font-size: small;"><br />
</span> <span style="font-size: small;">When I started writing the application, I had heard about the JavaFX<i> <a href="http://docs.oracle.com/javafx/2/api/javafx/fxml/doc-files/introduction_to_fxml.html"><b>FXML</b></a></i> language, but I didn't use it initially as I was not inclined to learn a new XML derivative just for writing the user interfaces (UIs). So, I wrote the user interfaces for the first two windows (a.k.a. Stages in JavaFX parlance) in Java code. But, I soon realized that it is not going to work out as writing code for designing UIs is very cumbersome. So, reluctantly I turned my attention to FXML, and fortunately I stumbled upon<i> <a href="http://docs.oracle.com/javafx/scenebuilder/1/get_started/jsbpub-get_started.htm"><b>JavaFX Scene Builder</b></a></i><b> </b>tool. This tool is really good as it makes designing user faces just a matter of drag and drop (you of course need to know various layout panes available in JavaFX to effectively use the tool).</span><br />
<span style="font-size: small;"><br />
</span> <span style="font-size: small;"><b><u>Relative newness of the JavaFX platform:</u></b></span><br />
<span style="font-size: small;"><br />
</span> <span style="font-size: small;">As the JavaFX platform is relatively new, it doesn't yet have all the necessary armory to design the modern day apps. They have started few separate projects to fill this void, and one such project is<a href="http://jfxtras.org/"><b> <i>JFXtras2</i></b></a>. It features, among other controls, a useful <b><i>Calendar</i></b> control that is missing from the standard control library of JavaFX. I though have not used it in this app as I found it midway through the development of this project.</span><br />
<span style="font-size: small;"><br />
</span> <span style="font-size: small;">The biggest plus point for JavaFX is its rich multimedia support and the support to design attractive user interfaces by just using the standard <i>Cascading Style Sheets (CSS).</i> How I wish I had more knowledge of the CSS so that I could design better user interfaces for my apps.</span><br />
<span style="font-size: small;"><br />
</span> <span style="font-size: small;"><b><u>Source Code:</u></b></span><br />
<span style="font-size: small;"><br />
</span> <span style="font-size: small;">You can download the complete source code for the application as a Netbeans 7.2 project from <a href="https://skydrive.live.com/redir?resid=A4DD9B9F61B0B21C!378&authkey=!ABNJlc4Mngpo3x4"><b>this</b></a> link.</span><br />
<span style="font-size: small;"><br />
</span> <span style="font-size: small;">The applications uses few external libraries, and you will need to include those libraries in your Netbeans project to compile the application. The external libraries are:<b><i><a href="http://joda-time.sourceforge.net/"> Joda Time</a></i></b>, <b><i><a href="http://jasperforge.org/projects/jasperreports/">Jasper Reports</a></i></b>, and <b><i><a href="http://db.apache.org/derby/">Apache Derby</a></i></b>.</span><br />
<span style="font-size: small;"><br />
</span> <span style="font-size: small;"><b><u>Disclaimer:</u></b></span><br />
<span style="font-size: small;"><b><u><br />
</u></b> I don't hold the license for the icons used in the application. I have used them for illustrative purposes only. Use the icons at your responsibility only.</span><br />
<span style="font-size: small;"><br />
</span> <span style="font-size: small;"><b><u>Feedback:</u></b></span><br />
<span style="font-size: small;"><br />
</span> <span style="font-size: small;">I would be glad to hear your feedback regarding the application and this blog post. If you have any question related to the app, please feel free to ask, and time permitting, I shall try my best to answer them.</span><br />
<span style="font-size: small;"><br />
</span> <span style="font-size: small;">Thank you for reading the post. :-)</span></div>Dinesh Bajajhttp://www.blogger.com/profile/09687011542043594704noreply@blogger.com4Katni, Madhya Pradesh, India23.836081 80.3954723.7198865 80.2375415 23.9522755 80.5533985