BlackJack Card Counting (True Count) in Java

2011.04.19

CardCounting v. 1.0 is an application in Java, which computes and plots the True Count for seven Card Count strategies (Wizard Ace/Five, KO, Hi-Lo, Hi-Opt I, Hi-Opt II, Zen Count and Omega II).

A rough estimation of the advantage of the player is that it increases 0.5% every time the True Count is increased by 1. Note, that the player starts with advantage approximately -0.5% (which means that the dealer has an advantage 0.5% at the beginning). Thus, from the graphs you can compute the player advantage at each state of the game.

For help how to use the Java application CardCounting v. 1.0 (download and unzip the file first) open a command prompt, navigate to the directory you have saved the jar file and write:

java -jar CardCounting.jar help

The Java Runtime Environment (JRE) is required to run the application.
The only parameter you can set is the number of the remaining decks.
You can edit the graph by right clicking on it and selecting Properties (for the plot I used the JFreeChart library).
If you run the application from command prompt you will get the sequence of the cards as came out from the deck.

On my previous post about RSA Encryption v. 1.0 I had a question about how to make a .jar to run with double click. I created CardCounting v. 1.0 to run with double click (by simply Exporting a Runable JAR file in Eclipse).
Just download the zip file, unzip it and double click the .jar file. If .jar files are associated with JRE, then you should get the graph with the True Counter for the seven Card Counting strategies.
However, with that way you are not able to pass the number of the remaining decks as an argument.

For any question you can comment ;)

Categories : Programming  Java  Programming

RSA Encryption in Java

2011.04.10

RSA Encryption v. 1.0 is an application in Java, which encrypts a text in a .txt file using the RSA algorithm.

In general RSA Encryption works as follows:
Assume that A wants to send an encrypted message to B.

1. B selects two prime numbers, usually denoted with p and q
2. Then B computes N = p*q
3. In addition, B selects another number, e, which is co-prime to (p-1)(q-1)
4. Finally, B computes the multiplicative inverse, d, of (p-1)(q-1), which is the private key and must be kept secret. So, we have that ed = 1*mod((p-1)(q-1))
5. (N, e) is the public key that B sends to A
6. Now, A has to encrypt the message denoted by M. Note, that M is a number. The encrypted message is C = M^e*(mod N)
7. A sends the encrypted message C to B
8. Now, in order B to decrypt the message C, the private key d is used. Thus, B computes C^d*(mod N) and gets the decrypted message M.

For help how to use the Java application RSA Encryption v. 1.0 (dowload and unzip the file first) open a command prompt, navigate to the directory you have saved the jar file and write:

java -jar RSAencryption.jar help

All the available commands are listed (i.e how to generate public and private keys, how to encrypt/decrypt text).
The Java Runtime Environment (JRE) is required to run the application.
The text file you want to encode should be located in the same directory with the jar file.

If you need a copy of the source code you can contact me.

Have fun ;)

Personal Documents Organiser new version 0.2.0.0

2011.04.01

A new version (still in Beta) of the Personal Documents Organiser for Windows in C#, Documents Order Obsession v. 0.2.0.0 is here.

The updated version brings many new features with a new interface, that will help you to organise your documents (and your files in general) better.
Some of them are:

+ Documents Order Obsession v. 0.2.0.0 has a proper installer now
+ New re-ordered main menu
+ Icon menu for easier access to frequent actions (i.e. creation and edit of Entries)
+ Export your entries to CSV file (open it in Excel)
+ Open the associated file directly from Documents Order Obsession v. 0.2.0.0
+ Star your “favorite” entries
+ Filter to view only your Starred entries
+ Completed tasks now are indicated with icons
+ Check online for new versions

Other features include:

+ Create up to six categories, filter them and color them to find easier what you are looking for
+ Show/Hide completed tasks
+ Keep History of your changes
+ Import/Export the entries from/to a XML file

Documents Order Obsession v. 0.2.0.0 is written in C# and requires Microsoft .NET Framework 4 (x86 and x64), SQL Server Compact 3.5 SP2 and Windows Installer 3.1.
If you do not have them installed do not worry. The installer will download all the prerequisites from Microsoft.

To install:
1. Download Documents Order Obsession v. 0.2.0.0
2. Unzip it
3. Run the executable

Note 1: If you get an error that cannot connect to database you should run the program as Administrator (Shift + Right click > Run as Administrator)

Note 2: This is a Beta version. If you find any bugs or have any suggestions please contact me.

If you need a copy of the source code please contact me.

Feel free to comment ;)

Directory Activity Monitor for Windows

2011.03.30

Now you can monitor and log the create, change, rename and delete events of files and folders in any directory, in a local or network hard drive!

With Directory Activity Monitor v. 0.1.0.0 you can set a directory and get notifications for any change happened in any file or folder. You can even keep history of the events and export it to a file. So, you will know exactly when a file or folder, was created, changed, renamed or deleted.

Directory Activity Monitor v. 0.1.0.0 is a software written in C# and works under Windows with Microsoft .NET Framework 4 (x86 and x64) and SQL Server Compact 3.5 SP2 installed. If you do not have them installed the installer will download them from Microsoft’s web site.

Some of the features of the current version are:

+ Set any directory to monitor (in a local or network drive)
+ Enable/Disable history of all the events
+ Export history to CSV or TXT format
+ Enable/Disable the monitoring of subdirectories
+ Enable/Disable the monitor of specific events (create, change, delete and rename)
+ Enable/Disable the balloon notificatiosn in System Tray
+ Select to start automaticaly with Windows
+ Check online for new versions

To install:
1. Download Directory Activity Monitor v. 0.1.0.0
2. Unzip it
3. Run the executable file

Note: This is a Beta version. If you find any bugs or have any suggestion, please do not hesitate to contact me.

If you have any question about parts of the code you can comment below.

If you need a copy of the source code please contact me.

For more software check the Programming Section.

Personal Documents Organiser for Windows in C#

2011.03.21

New version available: Download Documents Order Obsession v. 0.2.0.0

Lately I have started to work on some projects on C# and I am really excited about the way that C# applications communicate with Windows.

Documents Order Obsession v. 0.1.0.0 is an application that will help you to organise your documents and put them in order. However, it can be used to track and organise any kind of information as the given categories can be configured from the user.

Some of its features are:

+ Create up to six categories to add your document entries
+ Color each category to be easier to distinct entries belonging to a specific category
+ Show/Hide completed tasks
+ Filter categories
+ Keep History of creating, editing and deleting entries (History can be disabled)
+ Import/Export the entries from/to a XML file
+ View Statistics

Documents Order Obsession v. 0.1.0.0 is written in C# and requires Microsoft .NET Framework 4 (x86 and x64), SQL Server Compact 3.5 SP2 and Windows Installer 3.1 to be installed. If you do not have them installed do not worry. The installer will download all the prerequisites from Microsoft.

To install:
1. Download Documents Order Obsession v. 0.1.0.0
2. Unzip it
3. Run the setup.exe.

Note: This is a Beta version. If you find any bugs or have any suggestions, use the Feedback form under the Help menu or comment in the post.

If you have any question about parts of the code you can comment below.

If you need a copy of the source code please contact me.