Wednesday, June 7, 2006

Play Online Thambola . Housie . Bingo !!!!!!!

This site has been moved to http://www.99applications.com
To download code/application click the following link 99applications.com/java_programs and you can also find many c and c plus plus common programs in C & C++ section


Thambola LAN v 1.0


Figure 00 ( Basic Interface)

This is Online Thambola LAN/Internet Game. Its a multiplayer game. This application can be used as a "Server" or "Client".

Download your application according to your Operating System..

Download Thambola Windows Application
Download Thambola Windows Command Line Application
Download Thambola Linux Application
Download Thambola Solaris Application
Download Thambola JAR File

Note: To Run the Application make sure that Your system contains Java Runtime Environment.
Use WinRAR to unzip the downloaded file.

About ThambolaLAN Application:

This application is based on the original Thambola Game often called Housie, Bingo and many more. In Thambola Game, one person will draw the numbers and announce, similarily here one person will host the game and all the others will join the game. Each person can draw a maximum of 3 tickets from server( host ). When ever the server starts the game, clients will be getting the number on his screen.

Instructions on how to play:

Figure 01: Server Interface

  • After downloading the application. unzip it using winRAR.
  • Open the Application
  • To make the Application as Server or Hosting the Game:
    • Click on the Listening( Located at top-right corner ) and then Specify a Port to Listen on. See figure one
Figure 01: Listen and Connect To

    • Click on GO
    • If it is successfull then new Window will open (ServerStatistics) as shown in figure two.

Figure 02: Server Statistics

    • In Server Statistics Specify the number of tickets you want to generate for the game Click on Generate Game, It may take some time if you specify more number of tickets
    • After Generating the game, You can set a timer to start the game or you can start the game immediately
    • Server will start sending the numbers to clients connected
    • To view the finished numbers click on the View Finished Numbers on ServerStatistics Window.

Figure 03: View Numbers Generated

  • To make the application as Client:
    • Click on the Connect to and specify the serverIP and the server port number on the top right corner, and click on GO
    • If there is some server running you will be connected else it will return an error
    • Submit number of tickets you want. "ONE", "TWO" or "THREE"
    • When the game starts you can view the number on CallerBoard
    • Just click on the number, if u got the number. It will be highlighted
    • When you complete First Line or Second Line or Third Line then submit it by clicking the appropriate option on the ticket
    • Ticket will be validated by the server and result will be announced in MessageBox


Figure 04: Client Interface

feedback.javasourcecode@gmail.com with Subject Line as Thambola:Feedback

bugs.javasourcecode@gmail.com with Subject Line as THAMBOLA: Bugs

download.javasourcecode@gmail.com with Subject Line as THAMBOLA: Code Download

Mail this Page to Your Friend click here

Stay tuned with this Site to get Lots of updates on this application




Tuesday, April 4, 2006

New Clock Field in Java !!

This site has been moved to http://www.99applications.com
To download code/application click the following link 99applications.com/java_programs and you can also find many c and c plus plus common programs in C & C++ section


Visit http://freesourcecode.blogspot.com for more programmes like, Thambola, Housie, Love Calculator, Friendship Calculator, FLAMES, Animations, Digital Number, Sudoku.java, Clock Field. - Java.



This is new Java Field just like other, TextField, labels or any UI objects. This Clock field extends the JLabel component and has all the functionality of a label with added functionality of displaying the time in different fashions like

HH:MM:SS AM/PM LOCALE
HH:MM AM/PM
HH:MM:SS AM/PM
HH:MM ( 24hr Clock )
HH:MM:SS ( 24hr Clock with Seconds )

As it is extended from JLabel, we can change the font, size of the label, background, foreground and etc. etc.

Its usage is also very simple like JLabel, creating an object of ClockField and adding it to the Panel in the UI, and setting its bounds ( to place it at our convinient place ).

To start the clock tickering, just call the function "showClock" of ClockField.

Now it Starts...

Download the ClockField.java and Test.java Source code for free here..

To Test the Program, Read the ReadMe.txt given with Sourcecode.

Below are some screen shots depicting the above explanation :P

Different Clock Styles
HH:MM:SS AM/PM LOCALE Started.All Different Styles of Displaying Started...

Give Feedback for Improvement.

Friday, March 24, 2006

Housie, Tambola, Bingo Source Code - ( Digitalized )

This site has been moved to http://www.99applications.com
To download code/application click the following link 99applications.com/java_programs and you can also find many c and c plus plus common programs in C & C++ section




Housie is a gambling game played in New Zealand, Australia, and Northern Britain (Southern Britain call it Bingo), where players mark off numbers on a ticket as they are randomly called out. It is very similar to the American game Bingo, however the tickets and the calling are slightly different.

A typical housie ticket is shown to the right. It contains fifteen numbers, arranged in nine columns by three rows. Each column contains either one, two, or very rarely three, numbers. The first column contains numbers from 1 to 9, the second column numbers from 11 to 19, the third 20 to 29 and so on up until the last column, which contains numbers from 80 to 90, the 90 being placed in this column as well). When players first come to the venue (often a church hall, rugby club or other place with sufficient tables and chairs) they must buy tickets or book of tickets. A book usually contains fifty tickets which are played over the course of the night. Players generally play between one and six books. At many venues, special "Super Housie" tickets, usually with much larger prizes, are also played at various times throughout the session. The game is presided over by a caller, whose job it is to call out the numbers and check winning tickets. He will announce the prize or prizes for each game before starting. The two ways of winning a prize are:
  • Full House - covering all fifteen numbers on the card.
  • Line - covering a horizontal line of five numbers on the card. In bonus (Super Housie) games, often three lines may be claimed - top, middle and bottom.

The caller will then say "Eyes down" to indicate that he is about to start. He then begins to call numbers as they are randomly selected, either by an electronic device or by drawing counters from a bag. The calling is generally very fast, with generally one number called per second, can be customized ( 5 seconds ).

As each number is called, players check to see if that number appears on their tickets. If it does, they will mark it.When all the numbers required to win a prize have been marked off, the player calls out "Line" or "House" depending on the prize, and an official will come and call out the numbers on the ticket. The caller will check to see if each number has been called, and if it has, he will say "House correct - please pay out". if not correct, he will say "Bogus..", and ticket is no more useful.

Business of Housie:

In New Zealand and Australia, housie is often used a fundraiser by churches, sports teams, and other groups, and raffles are sold before the game.

Housie or Bingo is an expanding and highly profitable business in the UK, with many companies competing for the customers' money.

These been.

  • Gala Bingo Clubs
  • Mecca Bingo Clubs

As well as offering the familiar Housie/Bingo played by marking numbered books, most large clubs have their tables modified for the playing of cash housie. (Coin slots.) This is highly profitable for the operator, with a typical "take" of fifty percent of the stake.

Caller Slang:

When calling, the caller will usually say both digits on their own first, and then the number itself, for example, three-two, thirty-two. Some callers will use many of these slang terms, others just a few. However, "Kelly's Eye", "Legs Eleven" and "Top of the Shop" are often used, even if none of the others are.

  • Number 1 is "Kelly's Eye".
  • A number between 1 and 9 is called "Number 1, on it's own".
  • Number 10 is "One-oh, Dowling Street".
  • Number 11 is "All the ones, legs eleven".
  • Number 12 is "One-two, just the doz".
  • Any number ending in a zero (20, 30, 40 etc) is called "Two-oh, blind twenty".
  • Any number consisting of two identical numerals (22, 33, 44 etc) is "Twenty-two, all the twos".
  • Number 45 is "Halfway there".
  • Number 69 is "Dinner For Two Sixty Nine"
  • Number 88 is "Two Fat Ladies Eighty Eight
  • Number 90 is "Top of the Shop".
Reference: http://en.wikipedia.org/wiki/Housie

Now, my Work of Getting Housie Going:

Following are some of the outputs of the Thamboa Program, Have a look of it...

Download Free Java Source Code For Thambola here....

Caller's Board

Displaying Finished Numbers

Generating Tickets

Currently working on making this Thambola Game available online ...


Give feedback to improve :)

http://free-source-code.blogspot.com

Monday, March 13, 2006

The Love Calculator !!!!

This site has been moved to http://www.99applications.com
To download code/application click the following link 99applications.com/java_programs and you can also find many c and c plus plus common programs in C & C++ section




Welcome to this great invention of Doctor Love!

We all know that a name can tell a lot about a person. Names are not randomly chosen: they all have a meaning.
Doctor Love knew this so he made another great invention just for the lonely you!

Sometimes you'd like to know if a relationship with someone could work out. Therefore Doctor Love himself designed this great machine for you. With The Love Calculator you can calculate the probability of a successful relationship between two people. The Love Calculator is an affective way to get an impression of what the chances are on a relationship between two people.

This is just a fun application. Dont take it seriously.

Note: This is a funny logic in this testing if this example has caused any problems, please excuse me its only meant for fun!

Download API & Java Source Code For Love Calc here....

/**************************************************************************/
Java Program - Love Calculator
Author@ Krishnakanth Soni
Feedback@ sonikrishnakanth@gmail.com

Usage: java Love rama sita
/**************************************************************************/

import java.util.*;

class Love
{
private String name1;
private String name2;

public void setFirstName( String name1 ){
this.name1 = name1.toUpperCase();
}

public void setSecondName( String name2 ){
this.name2 = name2.toUpperCase();
}

public void setNames( String name1, String name2 ){
this.name1 = name1.toUpperCase();
this.name2 = name2.toUpperCase();
}

private Vector getCount(){
Vector list = new Vector();
String love = "LOVE";
String name1 = this.name1;
String name2 = this.name2;
for( int i=0; i<name1.length(); i++ ){
String temp = name1.charAt(i) + "";

if( list.contains(temp) ){
int indexOfElement = list.indexOf( temp );
int prevCount = Integer.parseInt( list.get(++indexOfElement).toString() );
prevCount++;
String newCount = (prevCount) + "";
list.set( indexOfElement, newCount );
continue;
}

list.add( temp );
list.add( "1" );
}

for( int i=0; i<name2.length(); i++ ){
String temp = name2.charAt(i) + "";

if( list.contains(temp) ){
int indexOfElement = list.indexOf( temp );
int prevCount = Integer.parseInt( list.get(++indexOfElement).toString() );
prevCount++;
String newCount = (prevCount) + "";
list.set( indexOfElement, newCount );
continue;
}

list.add( temp );
list.add( "1" );
}

for( int i=0; i<love.length(); i++ ){
String temp = love.charAt(i) + "";

if( list.contains(temp) ){
int indexOfElement = list.indexOf( temp );
int prevCount = Integer.parseInt( list.get(++indexOfElement).toString() );
prevCount++;
String newCount = (prevCount) + "";
list.set( indexOfElement, newCount );
continue;
}

list.add( temp );
list.add( "1" );
}

Vector result = new Vector();

for( int i=1; i<list.size(); i+=2 ){
result.add( list.get(i) );
}

//System.out.println( result );
return result;
}

public int getLovePer(){
Vector count = getCount();
if( count.size() == 1 ){
String result = count.get(0).toString() + "";
return Integer.parseInt(result);
}

if( count.size() == 2 ){
String result = count.get(0).toString() + count.get(1).toString();
return Integer.parseInt(result);
}

do{
Vector sub = new Vector();
int size = count.size() / 2;
//System.out.println( count.size() / 2 );
for( int i=0; i<size; i++ ){
String newC = ( Integer.parseInt( count.get(i).toString() ) + Integer.parseInt( count.get( count.size() - 1 - i ).toString() ) ) + "";

if( newC.length() == 2 )
{
sub.add( (newC.charAt(0) + "") );
sub.add( (newC.charAt(1) + "") );
}else{
sub.add( newC );
}
}

if( (size*2) != count.size() )
sub.add( count.get(size) );

count = new Vector();
count = sub;
//System.out.println( count );
}while( count.size() != 2 );

String result = count.get(0).toString() + count.get(1).toString();
return Integer.parseInt(result);
}

public int getLovePer( String name1, String name2 ){
String temp1 = this.name1;
String temp2 = this.name2;

setNames( name1, name2 );
int lPercentage = getLovePer();
setNames( temp1, temp2 );

return lPercentage;
}

public String toString(){
String result = "[ Love Percentage Between " + this.name1 + " And " + this.name2 + " is " + getLovePer() + "% ]";
return result;
}

public static void main(String[] args)
{
//System.out.println("Hello World!");
Love love = new Love();
if( args.length == 2 ){
love.setNames( args[0], args[1] );
System.out.println( "\n" + love + "\n" );
System.exit(0);
}else{
System.out.println( "\nUse With Proper usage, Find a sample FREINDSHIP Below\n java FriendShip name1 name2 \n" );
}
love.setNames( "krishna", "radha" );
System.out.println( "\n" + love + "\n" );
}
}

Friday, March 10, 2006

The FriendShip Calculator

This site has been moved to http://www.99applications.com
To download code/application click the following link 99applications.com/java_programs and you can also find many c and c plus plus common programs in C & C++ section




Welcome to this great invention of Doctor Friend!

We all know that a name can tell a lot about a person. Names are not randomly chosen: they all have a meaning.
Doctor Friend knew this so he made another great invention just for the lonely you!

Sometimes you'd like to know if a relationship with someone could work out. Therefore Doctor Friend himself designed this great machine for you. With The Friendship Calculator you can calculate the probability of a successful relationship between two people. The Friendship Calculator is an affective way to get an impression of what the chances are on a relationship between two people.

This is just a fun application. Dont take it seriously.

Note: This is a funny logic in this testing if this example has caused any problems, please excuse me its only meant for fun!

Download API & Java Source Code For Friendship Calc here....

/**************************************************************************/
Java Program - Friendship Calculator
Author@ Krishnakanth Soni
Feedback@ sonikrishnakanth@gmail.com

Usage: java Friendship rama sita
/**************************************************************************/

Output Screen

import java.util.*;

class FriendShip
{
private String name1;
private String name2;

public void setFirstName( String name1 ){
this.name1 = name1.toUpperCase();
}

public void setSecondName( String name2 ){
this.name2 = name2.toUpperCase();
}

public void setNames( String name1, String name2 ){
this.name1 = name1.toUpperCase();
this.name2 = name2.toUpperCase();
}

private Vector getCount(){
Vector list = new Vector();
String friendShip = "FRIENDSHIP";
String name1 = this.name1;
String name2 = this.name2;
for( int i=0; i<name1.length(); i++ ){
String temp = name1.charAt(i) + "";

if( list.contains(temp) ){
int indexOfElement = list.indexOf( temp );
int prevCount = Integer.parseInt( list.get(++indexOfElement).toString() );
prevCount++;
String newCount = (prevCount) + "";
list.set( indexOfElement, newCount );
continue;
}

list.add( temp );
list.add( "1" );
}

for( int i=0; i<name2.length(); i++ ){
String temp = name2.charAt(i) + "";

if( list.contains(temp) ){
int indexOfElement = list.indexOf( temp );
int prevCount = Integer.parseInt( list.get(++indexOfElement).toString() );
prevCount++;
String newCount = (prevCount) + "";
list.set( indexOfElement, newCount );
continue;
}

list.add( temp );
list.add( "1" );
}

for( int i=0; i<friendShip.length(); i++ ){
String temp = friendShip.charAt(i) + "";

if( list.contains(temp) ){
int indexOfElement = list.indexOf( temp );
int prevCount = Integer.parseInt( list.get(++indexOfElement).toString() );
prevCount++;
String newCount = (prevCount) + "";
list.set( indexOfElement, newCount );
continue;
}

list.add( temp );
list.add( "1" );
}

Vector result = new Vector();

for( int i=1; i<list.size(); i+=2 ){
result.add( list.get(i) );
}

//System.out.println( result );
return result;
}

public int getFriendShipPer(){
Vector count = getCount();
if( count.size() == 1 ){
String result = count.get(0).toString() + "";
return Integer.parseInt(result);
}

if( count.size() == 2 ){
String result = count.get(0).toString() + count.get(1).toString();
return Integer.parseInt(result);
}

do{
Vector sub = new Vector();
int size = count.size() / 2;
//System.out.println( count.size() / 2 );
for( int i=0; i<size; i++ ){
String newC = ( Integer.parseInt( count.get(i).toString() ) + Integer.parseInt( count.get( count.size() - 1 - i ).toString() ) ) + "";

if( newC.length() == 2 )
{
sub.add( (newC.charAt(0) + "") );
sub.add( (newC.charAt(1) + "") );
}else{
sub.add( newC );
}
}

if( (size*2) != count.size() )
sub.add( count.get(size) );

count = new Vector();
count = sub;
//System.out.println( count );
}while( count.size() != 2 );

String result = count.get(0).toString() + count.get(1).toString();
return Integer.parseInt(result);
}

public int getFriendShipPer( String name1, String name2 ){
String temp1 = this.name1;
String temp2 = this.name2;

setNames( name1, name2 );
int fPercentage = getFriendShipPer();
setNames( temp1, temp2 );

return fPercentage;
}

public String toString(){
String result = "[ Friendship Percentage Between " + this.name1 + " And " + this.name2 + " is " + getFriendShipPer() + "% ]";
return result;
}

public static void main(String[] args)
{
//System.out.println("Hello World!");
FriendShip fs = new FriendShip();
if( args.length == 2 ){
fs.setNames( args[0], args[1] );
System.out.println( "\n" + fs.toString() + "\n" );
System.exit(0);
}else{
System.out.println( "\nUse With Proper usage, Find a sample FREINDSHIP Below\n java FriendShip name1 name2 \n" );
}
fs.setNames( "krishna", "radha" );
System.out.println( "\n" + fs.toString() + "\n" );
}
}

Home..

Friday, February 24, 2006

Things That Java Does Not Have



The inventors of Java were C/C++ programmers, and they made conscious decisions to leave out most of the C/C++ features that get programmers into trouble. Not you of course, you are a great programmer and you never make mistakes and your code is wonderful. It's your dumb, lazy, careless coworkers I'm talking about here.

Java has no global variables or functions

Of course you've heard that global variables are evil, but maybe you never really bought into it. You made a variable global "for now" and never got back to making it local. Or you have a variable (probably named something like "DEBUG") that's referenced just about everywhere, so it needed to be global.

Every Java variable is part of some class, so you'll have to change your ways, and you'll feel a lot better about yourself. Looking for the abs() function? It must be in the Math class. Where is "stdin" defined? It's a public static field in the "System" class. Trying to find "atoi()"? Umm...ok, there it is: Integer.parseInt().

Java has no pointer and address operators

That's right, no more "*person" and no more "&person". How about we just use "person" everywhere? Really! Things are much simpler that way.

Java has no "struct" or "union"

A class is a bunch of variables and methods ("method" is just the object-oriented term for "function"). So why do we need a "struct"? It's just a class that happens to have no methods. And a union to save data of one type or another at a single location? That's what subclasses are for. If you don't know what a subclass is yet, don't worry: it's a basic OO concept, and you'll learn it as you learn Java.

Java has no pre-processor and no macros

What do you use your pre-processor for? Let's see...
  • You define your "structs" there, but structs are gone now.
  • You define TRUE and FALSE, but Java has the boolean type built-in.
  • You define some simple function-like macros that are really hard to read and should probably just be functions, but you wanted to save a few milliseconds at runtime when your application ran on a 80286 processor. You're past that now.
  • You have lots of "#ifdefs" to handle various compilers, various Operating Systems, and various hardware. Java takes care of all those inconsistencies for you. "Write Once, Run Anywhere", as they say.

Java does not have "unsigned" types

Was it really worth the two seconds of effort for you to type "unsigned" when you knew your int should never be negative? Was it really worth the savings of two bytes of runtime memory out of the 20 million bytes that your program uses? It's possible, but I doubt it.

Java has no bitfields

Again, do we really need to have the ability to specify a particular number of bits that you need to save a few bits in memory? If you need a one-bit value, use the "boolean" primitive type in Java. If you have a two-bit field, shouldn't you really be using an "enum" anyway and clearly specify what those values are? Please, go back to concentrating on your application and don't worry excessively about wasted bits.

Java has no operator overloading

Ah, yes, operator overloading. The previous developer was so cute to have written:
x = person1 + person2;
The problem is, you don't know what it means to "add two people together". Are you adding their ages? Are they getting married or something perhaps more intimate? In fact, now that you think about it, does "+" really mean much of anything except to add two numbers? OK, ok, let's assume it means to concatenate two Strings together, but that's it. No operator overloading. Just say:
 "person1.marry(person2)"
...using an appropriate method name.

Java has no comma operator

Do we really need this operator in a language? Nah.

Java has no goto statement

You knew this was coming! The "Gotos Considered Harmful" discussion has been going for 35 years now. We're all grownups here. We all know you can write nice code without gotos, and in the very rare case where the code might be a little nicer where we need to break out of a particular nested loop, we can do it. Goto is dead. Long live goto.

Java has no function pointers

The syntax for function pointers is just plain ugly. You can do the same thing in Java, in a cleaner way, using Reflection. For example:
 Method method = Person.class.getMethod("getAddress", null);
// invoke the "getAddress()" method on object "joe"
Object address = method.invoke(joe, null);

Java has no enums

Now how am I going to put a positive spin on Java's lack of a "enum" type? Well, I can't. I wish Java had an enum. But of course, you can make do by defining your own class, and get all the compile-time type-checking that you'd like:
class MarriageStatus {
public static final MarriageStatus SINGLE = new MarriageStatus();
public static final MarriageStatus MARRIED = new MarriageStatus();
public static final MarriageStatus DIVORCED = new MarriageStatus();
}

Java has no "varargs"

There's no need for this "varargs" stuff. If you have a set of fields that you tend to pass around together, put them together into a class and pass an instance of the class around. If you have a function that works on a list of objects (and the list can be any length) then just pass a List object.

Java does not allow multiple inheritence

It's surprising but true: multiple inheritence is way overrated. Sure, you can think of examples where it seems like you'd want multiple inheritence, but in the real world, it's very rare that you want to inherit behaviour from more than one superclass. More often, multiple inheritence is used where a Java interface would be better suited. Say I'm the database guy, and I write a bunch of functions that you call to access the database. How do we formally agree on what functions I provide? I know what you're thinking: I write a superclass that lists all the functions, and then I subclass it and you create an instance and call the methods. That's how it's usually done in C++, but that's not a good way to do it. You shouldn't care what my class is a subclass of, all you should care about is that I have implemented a certain set of methods. That's what an interface is: a list of methods that can be called. In Java, we write an interface (which is just a list of method signatures). I implement the interface, and you call the methods. Trust me, you'll be pleasantly surprised that you don't really need multiple inheritence in the few places where you think you do.

Home

Tuesday, February 21, 2006

Who I am To You ? Hum Aapke Hai Kaun ???? - Source Code For FLAMES

This site has been moved to http://www.99applications.com
To download code/application click the following link 99applications.com/java_programs and you can also find many c and c plus plus common programs in C & C++ section




Who I Am To You ???
Hum Aapke Hai Kaun??????

F.L.A.M.E.S

By - Krishnkanth Soni

In India, North-Indian teenagers, following small formula for choosing a boyfriend or girlfriend. That is FLAMES. This is a fun application.


What is FLAMES?
F for Friend
L for Lover
A for Affair
M for Marriage
E for Enemy
S for Sister


How the calculation?
Take guy name and girl name
Example: Rama and Sita

1.cut all common letters in those names, now the remaining words are "rma" and "sit"

2.Now calculate all the letters, that is 6 letters

3.Now take FLAMES calculate from the F and cut it on 6th letter

Example:
After cutting the FLAMES
FLAME

4. Now again calculate form the next letter keep on calculate until you will get one letter
that will decide your relationship.

Note: Flames is a funny logic in this testing if this example has caused any problems, please excuse me its only meant for fun!

Download API & Java Source Code For FLAMES here....

/**************************************************************************/
Java Program - Calculating Flames
Author@ Krishnakanth Soni
Feedback@ sonikrishnakanth@gmail.com

Usage: java Flames rama sita
/**************************************************************************/

Output Screen


public class Flames
{
private String name1 = "";
private String name2 = "";

public Flames(){
name1 = "rama";
name2 = "sita";
}

public void setNameOne( String name1 ){
this.name1 = name1.toLowerCase().trim().replaceAll( " ", "" );
}

public void setNameTwo( String name2 ){
this.name2 = name2.toLowerCase().trim().replaceAll( " ", "" );
}

public void setNames( String name1, String name2 ){
this.name1 = name1.toLowerCase().trim().replaceAll( " ", "" );;
this.name2 = name2.toLowerCase().trim().replaceAll( " ", "" );;
}

private String findDifference(){
String difference = "";
String temName = this.name2;
for( int i=0; i<name1.length(); i++ ){
String a = name1.charAt(i) + "";
if( name2.indexOf( a ) != -1 ){
name2 = name2.replaceFirst( a, "" );
}else{
difference += a;
}
}
difference += name2;
this.name2 = temName;
return difference;
}

public String getFLAMES(){
String flamesResult = "";
int difference = findDifference().length();
if( difference == 0 ){
if( name1.equals( name2 ) )
return "You have Given Same Names, So Can't find FLAMES";
else
return "Can't find FLAMES for the Given Names";
}
String fResult[] = { "FRIENDS", "LOVERS", "AFFAIR", "MARRIAGE", "ENEMIES", "SISTERS/BROTHERS" };
int k=0;
for( int i=5; i>0; i-- ){
int j=1;
while( j < difference ){
k++;
if( k == fResult.length )
k = 0;
j++;
}
String fResult1[] = new String[i];
int m = 0;
for( int kk=0; kk fResult.length; kk++ )
if( kk != k )
fResult1[m++] = fResult[kk];
fResult = fResult1;
if( k == fResult.length )
k = 0;
flamesResult = fResult[0];
}
return flamesResult;
}

public String getFLAMES( String name1, String name2 ){
String nameOne = this.name1;
String nameTwo = this.name2;
setNames( name1, name2 );
String flames = getFLAMES();
setNames( nameOne, nameTwo );
return flames;
}

public String toString(){
return "[ F.L.A.M.E.S For \"" + this.name1 + "\" And \"" + this.name2 + "\" Is \"" + getFLAMES() + "\" ] ";
}

public static void main(String[] args)
{
Flames fl = new Flames();
if( args.length == 2 ){
fl.setNames( args[0], args[1] );
System.out.println( "\n" + fl.toString() + "\n" );
System.exit(0);
}else{
System.out.println( "\nUse With Proper usage, Find a sample FLAMES Below\n" );
}
fl.setNames( "rama", "sita" );
System.out.println( "\n" + fl.toString() + "\n" );
}
}

Home

Monday, February 20, 2006

Business Clubbed - Mixture of Two Classes : Animated Number Source Code ...

/*************************************************************************/
Program Printing Number in Digital Format with Animation at Command Prompt
Use of previous classes TypeWriter and DigitalStyle
Author@ krishnakanth Soni
feedback@ sonikrishnakanth@gmail.com

Usage: java AnimateNumber 12345 34567
/************************************************************************/

Output Screen Shot 1

Output Screen Shot 2

Output Screen Shot 3

Download API & Java Source code for AnimatedNumber here...


class AnimateNumber
{
private TypeWriter tw = new TypeWriter();
private DigitalStyle ds = new DigitalStyle();

public void animateNumber( int number ){
tw.type( ds.getDigitalInString( number ) );
}

public void setSpeed( long speed ){
tw.setTypingSpeed( speed );
}

public void setFontSize( int fontSize ){
ds.setFontSize( fontSize );
}

public static void main(String[] args)
{
AnimateNumber an = new AnimateNumber();
an.setSpeed( 50 );
an.setFontSize( 2 );
if( args.length >= 1 ){
for( int i=0; i<args.length; i++ ){
try{
an.animateNumber( Integer.parseInt(args[i]) );
System.out.println( "\n\n" );
}catch(Exception e){}
}
System.exit(0);
}
int a[] = { 23, 4567, 3424, 9898, 5065 };
for( int i=0; i<a.length; i++ ){
an.animateNumber( a[i] );
System.out.println( "\n\n" );
}
}
}

Home




Saturday, February 18, 2006

Business Clubbed - Mixture of Two Classes

You can use the two Classes "TypeWriter" and "Digital Style" to animate a given number.... This is an example of re-usability of software code or procedure :P

Try it and let me know,,, I ll post it soooon

Home

Friday, February 17, 2006

Represent Number in Digital Format - Java



/*************************************************************/
Represents a number in Digital Format
Author @ Krishnakanth Soni

Usage: java DigitalStyle
Example: java DigitalStyle 124 256 5895 1236
/*************************************************************/
Output Screen

Download API & Java Source Code for DigitalStyle here...

public class DigitalStyle
{
private int fontSize;

public DigitalStyle(){
fontSize = 1;
}

public boolean setFontSize( int fontSize ){
if( fontSize >= 2 ){
this.fontSize = fontSize;
return true;
}
return false;
}

//flag[0] = Top Line
//flag[1] = Top Left
//flag[2] = Top Right
//flag[3] = Middle
//flag[4] = Bottom left
//flag[5] = Bottom Right
//flag[6] = Bottom Line
private String[] printZero(){
boolean flag[] = new boolean[7];
for( int i=0; i<flag.length; i++ ){
flag[i] = true;
}
flag[3] = false;
return printDigitalStyle(flag);
}

private String[] printOne(){
boolean flag[] = new boolean[7];
for( int i=0; i<flag.length; i++ ){
flag[i] = true;
}
flag[0] = false;
flag[1] = false;
flag[3] = false;
flag[4] = false;
flag[6] = false;
return printDigitalStyle(flag);
}

private String[] printTwo(){
boolean flag[] = new boolean[7];
for( int i=0; i<flag.length; i++ ){
flag[i] = true;
}
flag[1] = false;
flag[5] = false;
return printDigitalStyle(flag);
}

private String[] printThree(){
boolean flag[] = new boolean[7];
for( int i=0; i<flag.length; i++ ){
flag[i] = true;
}
flag[1] = false;
flag[4] = false;
return printDigitalStyle(flag);
}

private String[] printFour(){
boolean flag[] = new boolean[7];
for( int i=0; i<flag.length; i++ ){
flag[i] = true;
}
flag[0] = false;
flag[4] = false;
flag[6] = false;
return printDigitalStyle(flag);
}

private String[] printFive(){
boolean flag[] = new boolean[7];
for( int i=0; i<flag.length; i++ ){
flag[i] = true;
}
flag[2] = false;
flag[4] = false;
return printDigitalStyle(flag);
}

private String[] printSix(){
boolean flag[] = new boolean[7];
for( int i=0; i<flag.length; i++ ){
flag[i] = true;
}
flag[2] = false;
return printDigitalStyle(flag);
}

private String[] printSeven(){
boolean flag[] = new boolean[7];
for( int i=0; i<flag.length; i++ ){
flag[i] = true;
}
flag[1] = false;
flag[3] = false;
flag[4] = false;
flag[6] = false;
return printDigitalStyle(flag);
}

private String[] printEight(){
boolean flag[] = new boolean[7];
for( int i=0; i<flag.length; i++ ){
flag[i] = true;
}
return printDigitalStyle(flag);
}

private String[] printNine(){
boolean flag[] = new boolean[7];
for( int i=0; i<flag.length; i++ ){
flag[i] = true;
}
flag[4] = false;
return printDigitalStyle(flag);
}

private String[] getNumber( int number ){
switch(number){
case 1:
return printOne();
case 2:
return printTwo();
case 3:
return printThree();
case 4:
return printFour();
case 5:
return printFive();
case 6:
return printSix();
case 7:
return printSeven();
case 8:
return printEight();
case 9:
return printNine();
case 0:
return printZero();
}
String[] result = new String[1];
result[0] = "Invalid";
return result;
}

private String[] printDigitalStyle( boolean[] flag ){
String digit[] = new String[ (fontSize*2) + 3 ];
//Top
int currentIndex = 0;
digit[currentIndex] = " ";
for( int i=1; i<=fontSize; i++ )
if( flag[0] )
digit[currentIndex] += "-";
else
digit[currentIndex] += " ";
digit[currentIndex] += " ";
currentIndex++;
//left and right legs
for( int i=1; i<=fontSize; i++ ){
digit[currentIndex] = "";
if( flag[1] )
digit[currentIndex] += "|";
else
digit[currentIndex] += " ";
for( int j=1; j<=fontSize; j++ )
digit[currentIndex] += " ";
if( flag[2] )
digit[currentIndex] += "|";
else
digit[currentIndex] += " ";
currentIndex++;
}
//middle
digit[currentIndex] = " ";
for( int i=1; i<=fontSize; i++ )
if( flag[3] )
digit[currentIndex] += "-";
else
digit[currentIndex] += " ";
digit[currentIndex] += " ";
currentIndex++;
//left and right legs
for( int i=1; i<=fontSize; i++ ){
digit[currentIndex] = "";
if( flag[4] )
digit[currentIndex] += "|";
else
digit[currentIndex] += " ";
for( int j=1; j<=fontSize; j++ )
digit[currentIndex] += " ";
if( flag[5] )
digit[currentIndex] += "|";
else
digit[currentIndex] += " ";
currentIndex++;
}
//bottom
digit[currentIndex] = " ";
for( int i=1; i<=fontSize; i++ )
if( flag[6] )
digit[currentIndex] += "-";
else
digit[currentIndex] += " ";
digit[currentIndex] += " ";
return digit;
}

public String[] getDigital( int number )
{
String result[] = new String[ (fontSize*2) + 3 ];
String num = "" + number;
String nums[][] = new String[num.length()][];

for( int i=0; i<num.length(); i++ ){
nums[i] = getNumber( Integer.parseInt(num.charAt(i) + "") );
}

for( int i=0; i<result.length; i++ ){
result[i] = "";
for( int j=0; j<nums.length; j++ )
result[i] += nums[j][i] + " ";
}
return result;
}

public String getDigitalInString( int number ){
String digital[] = getDigital( number );
String result = "";
for( int i=0; i<digital.length; i++ )
result += digital[i] + "\n";
return result;
}
public static void main(String[] args)
{
DigitalStyle ds = new DigitalStyle();
ds.setFontSize(2);
if( args.length >= 1 ){
for( int i=0; i<args.length; i++ ){
try{
String[] digit = ds.getDigital(Integer.parseInt(args[i]));
for( int j=0; j<digit.length; j++ )
System.out.println( digit[j] );
System.out.println( "\n" );
}catch(Exception e){}
}
System.exit(0);
}
int a[] = { 23, 4567, 3424, 9898, 5065 };
for( int i=0; i<a.length; i++ ){
String[] digit = ds.getDigital(a[i]);
for( int j=0; j<digit.length; j++ )
System.out.println( digit[j] );
System.out.println( "\n" );
}
}
}

Home

Thursday, February 16, 2006

Program Printing a Given File in Type Writing Style

This site has been moved to http://www.99applications.com
To download code/application click the following link 99applications.com/java_programs and you can also find many c and c plus plus common programs in C & C++ section




/***********************************************************/
Program to Print a File in Type Writing Style
- Krishnakanth Soni
sonikrishnakanth@gmail.com
/***********************************************************/
Output Screen
One Charector of file is printed for the specified speed..... So output may be some animation type when you execute.....

Download API and Source Code of TypeWriter here...

import java.io.*;

public class TypeWriter
{
long typingSpeed; //in nano seconds, letter per speed
File fileToType;

public TypeWriter(){
typingSpeed = 100;
fileToType = null;
}

public void setTypingSpeed( long typingSpeed ){
this.typingSpeed = typingSpeed;
}

public void setFileToType( String fileToType ){
if( fileToType.endsWith( ".txt" ) ){
this.fileToType = new File( fileToType );
if( ! this.fileToType.exists() ){
type( "-----------\nFile Not Found.....\n\n" );
System.exit( 0 );
}
}else{
type( "-----------\nFile is Not a Text Document.......\n\n" );
}
if( this.fileToType == null ){
type( "-----------\nFile Not Set.....\n\n" );
System.exit( 0 );
}
}

public void type( String line ){
for( int i=0; i < line.length(); i++ ){
System.out.print(line.charAt(i) + "" );
try{
Thread.sleep( typingSpeed );
}catch(Exception e){}
}
}

public void startTyping(){
if( fileToType == null ){
type( "-----------\nFile Not Set.....\n\n" );
System.exit( 0 );
}
try{
System.out.println( "\n\nFile Typing Started....\n\n" );
BufferedReader br = new BufferedReader( new FileReader( fileToType ) );
String str = "";
while( (str = br.readLine() ) != null ){
type( str );
}
}catch(Exception e){}
}

public static void main( String args[] ){
TypeWriter tw = new TypeWriter();
tw.setTypingSpeed( 50 );
tw.setFileToType( args[0] );
tw.startTyping();
}
}

Home

Source Code to Solve SuDoKu - Java

This site has been moved to http://www.99applications.com
To download code/application click the following link 99applications.com/java_programs and you can also find many c and c plus plus common programs in C & C++ section


For Sudoku Solver UserInterface click here ...

Sudoku (Japanese: ??, sudoku), also known as Number Place, is a logic-based placement puzzle. The aim of the canonical puzzle is to enter a numerical digit from 1 through 9 in each cell of a 9�9 grid made up of 3�3 subgrids (called "regions"), starting with various digits given in some cells (the "givens"). Each row, column, and region must contain only one instance of each numeral. Completing the puzzle requires patience and logical ability. Although first published in a U. S. puzzle magazine in 1979, Sudoku initially caught on in Japan in 1986 and attained international popularity in 2005.

Basic SudoKu Image...


To know more about SuDoKu, visit the following link..
http://en.wikipedia.org/wiki/Sudoku

Download API & Java Source code of SuDoKu here...

/******************************************************/
Program to Solve Given Basic SuDoKu
Krishnakanth. S
sonikrishnakanth@gmail.com
/******************************************************/
Output Screen


See the source code at SuDoKu.java

Home

Java Source Code For Converting a Given "Number" into "Words" ...

This site has been moved to http://www.99applications.com
To download code/application click the following link 99applications.com/java_programs and you can also find many c and c plus plus common programs in C & C++ section




This program can genrally used by bank applications where you need to convert given "cheque" amount or "DD" amount in "words". or it can be used in any application where you want to display the number in word format. Hope this program works for you. :)


/***************************************************************/

Program to covert a given number in words Format
Author: Krishnakanth Soni
feedback at: sonikrishnakanth@gmail.com

usage: java Converter [list of numbers as arguments]
example: java Converter 1234 3456 4567 4321 9999

/**************************************************************/
Output Screen
Download API & Source Code for Converter here..

public class Converter
{
private double getPlace( String number ){
switch( number.length() ){
case 1:
return DefinePlace.UNITS;
case 2:
return DefinePlace.TENS;
case 3:
return DefinePlace.HUNDREDS;
case 4:
return DefinePlace.THOUSANDS;
case 5:
return DefinePlace.TENTHOUSANDS;
case 6:
return DefinePlace.LAKHS;
case 7:
return DefinePlace.TENLAKHS;
case 8:
return DefinePlace.CRORES;
case 9:
return DefinePlace.TENCRORES;
}//switch
return 0.0;
}// getPlace

private String getWord( int number ){
switch( number ){
case 1:
return "One";
case 2:
return "Two";
case 3:
return "Three";
case 4:
return "Four";
case 5:
return "Five";
case 6:
return "Six";
case 7:
return "Seven";
case 8:
return "Eight";
case 9:
return "Nine";
case 0:
return "Zero";
case 10:
return "Ten";
case 11:
return "Eleven";
case 12:
return "Tweleve";
case 13:
return "Thirteen";
case 14:
return "Forteen";
case 15:
return "Fifteen";
case 16:
return "Sixteen";
case 17:
return "Seventeen";
case 18:
return "Eighteen";
case 19:
return "Ninteen";
case 20:
return "Twenty";
case 30:
return "Thirty";
case 40:
return "Forty";
case 50:
return "Fifty";
case 60:
return "Sixty";
case 70:
return "Seventy";
case 80:
return "Eighty";
case 90:
return "Ninty";
case 100:
return "Hundred";
} //switch
return "";
} //getWord

private String cleanNumber( String number ){
String cleanedNumber = "";

cleanedNumber = number.replace( '.', ' ' ).replaceAll( " ", "" );
cleanedNumber = cleanedNumber.replace( ',', ' ' ).replaceAll( " ", "" );
if( cleanedNumber.startsWith( "0" ) )
cleanedNumber = cleanedNumber.replaceFirst( "0", "" );

return cleanedNumber;
} //cleanNumber

public String convertNumber( String number ){
number = cleanNumber( number );
double num = 0.0;
try{
num = Double.parseDouble( number );
}catch( Exception e ){
return "Invalid Number Sent to Convert";
} //catch

String returnValue = "";
while( num > 0 ){
number = "" + (int)num;
double place = getPlace(number);
if( place == DefinePlace.TENS || place == DefinePlace.TENTHOUSANDS || place == DefinePlace.TENLAKHS || place == DefinePlace.TENCRORES ){
int subNum = Integer.parseInt( number.charAt(0) + "" + number.charAt(1) );

if( subNum >= 21 && (subNum%10) != 0 ){
returnValue += getWord( Integer.parseInt( "" + number.charAt(0) ) * 10 ) + " " + getWord( subNum%10 ) ;
} //if
else{
returnValue += getWord(subNum);
}//else

if( place == DefinePlace.TENS ){
num = 0;
}//if
else if( place == DefinePlace.TENTHOUSANDS ){
num -= subNum * DefinePlace.THOUSANDS;
returnValue += " Thousands ";
}//if
else if( place == DefinePlace.TENLAKHS ){
num -= subNum * DefinePlace.LAKHS;
returnValue += " Lakhs ";
}//if
else if( place == DefinePlace.TENCRORES ){
num -= subNum * DefinePlace.CRORES;
returnValue += " Crores ";
}//if
}//if
else{
int subNum = Integer.parseInt( "" + number.charAt(0) );

returnValue += getWord( subNum );
if( place == DefinePlace.UNITS ){
num = 0;
}//if
else if( place == DefinePlace.HUNDREDS ){
num -= subNum * DefinePlace.HUNDREDS;
returnValue += " Hundred ";
}//if
else if( place == DefinePlace.THOUSANDS ){
num -= subNum * DefinePlace.THOUSANDS;
returnValue += " Thousand ";
}//if
else if( place == DefinePlace.LAKHS ){
num -= subNum * DefinePlace.LAKHS;
returnValue += " Lakh ";
}//if
else if( place == DefinePlace.CRORES ){
num -= subNum * DefinePlace.CRORES;
returnValue += " Crore ";
}//if
}//else
}//while
return returnValue;
}//convert number

public static void main( String args[] ){
Converter cv = new Converter();

if( args.length >= 1 )
{
for( int i=0; i<args.length; i++ )
System.out.println( "Given Number : " + args[i] + "\nConverted: " + cv.convertNumber(args[i]) + "\n\n" );
System.exit(0);
}

System.out.println( "Given Number : 999999999\nConverted: " + cv.convertNumber("999999999") + "\n\n" );
}//main
} //class

class DefinePlace{
public static final double UNITS = 1;
public static final double TENS = 10 * UNITS;
public static final double HUNDREDS = 10 * TENS;
public static final double THOUSANDS = 10 * HUNDREDS;
public static final double TENTHOUSANDS = 10 * THOUSANDS;
public static final double LAKHS = 10 * TENTHOUSANDS;
public static final double TENLAKHS = 10 * LAKHS;
public static final double CRORES = 10 * TENLAKHS;
public static final double TENCRORES = 10 * CRORES;
} //class


Home

Indian Contribution in Globalization

India finds a slot in this "global cultural exchange" through its strength from the knowledge of Upanishads. The major contribution of India, in the world to day, would be in the sphere of spirituality. The rich spiritual heritage of India, as expounded by the Seers in Vedanta and recently in the lives and teachings of Sri Ramakrishna and Swami Vivekananda, is the only 'thing' which India can offer for global prosperity and welfare.

In the global division of labour this work has come to her lot, and re-evaluation of attitudes, values, belief systems in the light of the development of this spiritual knowledge will bring the needed uniformity and universality to the meaning of modernity.

One hundred years back, Swami Vivekananda initiated the process when he said: "Here in this blessed land, the foundation, the backbone, the life-centre is religion and religion alone. Let others talk of politics, of glory of acquisition of immense wealth poured in by trade, of the power and spread of commercialism, of the glorious fountain of physical liberty; but these the Hindu mind does not understand and does not want to understand. Touch him on spirituality, on religion, on God, on the soul, on the Infinite, on spiritual freedom, and I assure you, the lowest peasant in India is better informed on these subjects than many a so-called philosopher in other lands. We have yet something to teach to the world. This the very reason, the raison d'etre, that this nation has lived on, in spite of hundreds of years of persecution, in spite of nearly a thousand years of foreign rule and foreign oppression. This nation still lives; the raison d'etre is, it still holds to God, to the treasure house of religion and spirituality."

He maintained that for humanity to survive and progress, it is essential that rishi culture of yesteryears be re-established in India and thence in the whole world. True religion forms the backbone of Indian culture and ethos, and if that is broken it will cause immense loss to India as well as the global civilization.

That every person should be able to put Vedanta in the practice was the sole purpose of Swami Vivekananda's teaching. He realized the Vedantic principles of divinity of each soul and maintained that religion consists in manifestation of this divinity in every aspect of one's life. He was worried that this universal ideal might gradually get diluted under the barbaric onslaught of combined materialism and 'science without spiritual content'. He clearly saw the West 'as almost borne down, half-killed, and degraded by political ambitions and social scheming.'

Swamiji's plan for educating the masses, emancipation of women, removing the 'blot of untouchability', etc. are a few examples of his love for India so that it could play this role with dignity and poise. There-fore, revival of Indian masses by education, spread of knowledge of physical sciences, and projection of Vedanta as scientific universal religion were a few thoughts uppermost in his mind.

As Swami Ashokananda had said, "Behind all his (Swami Vivekananda's) patriotism, deep down there was the spiritual motive. For him India was synonymous with the spirit of religion. 'If India is to die,' he said, 're-ligion will be wiped off from the face of the earth, and with it the Truth.' He did not want see India as a replica of a Western country. His dream of future India was that along with material prosperity, which would be hers, she would, as the Queen of Nations, extend the hand of peace and blessedness to all peo-ples of the world."

Home

Friday, February 3, 2006

First



hi..

My first post ...