Category Archives: Uncategorized

KeePass Problems – “The composite key is invalid” (SOLVED!)

Hi everyone,

Recently, I moved to a new computer and have been working to install all the software I previously used. KeePass has been indispensable; a wonderful program that I’ve used for years now. Fortunately, or not, opening KeePass in the past has been as simple as clicking on the icon and typing in my password. After backing-up all of my files from the old computer and moving them to the new, I installed KeePass 2.whatever and tried to open my kdbx file. Surprisingly, I got an error that “the composite key is invalid” even though I was sure I typed my password correctly.


The solution, for me at least, is that I was using key file (a separate file from the KeePass kdbx file that has a .key extension) as extra security, but it had been so long that I didn’t remember this detail.


Notice how the Key File field is unselected and “none”? This was my problem. When I initially setup KeePass years ago, I chose to create a .key file for more protection, but my new installation didn’t know this. Firstly, the .key file might be in the same directory as your .kdbx database file. If this is the case, just FYI, this is a TERRIBLE practice. You should never put your key file in the same place as your .kdbx; that’s like hanging the key to your front door on a hook next to your front door. Choose the browse folder next to the key file field, and navigate to the same directory as your kdbx:


Your files probably won’t have the same name, because you give them a specific name when you set them up. Also, if you don’t find a .key file in the directory with your .kdbx and are still having the problem, you might try to do a search on your computer for a .key file located somewhere else. It’s possible you specified a different location when initially setting up your password database.

Hope this helps you!


Line up, everybody! Line up, Line up! Making decimals in Strings to line up in Java

Okay, sorry for the title.  Having kids, I’ve seen Bubble Guppies way too many times.  On to the topic at hand.  I just had a Java project in which I had multiple currency and percent values in the form of Strings that were stacked vertically, but I needed to make the decimal points line up for uniformity’s sake.  Unfortunately, I searched far and wide for a simple solution – some built-in feature that would do this for me – but nothing came up.  So I decided to create my own function that would solve the problem.  NOTE: If you know of an easier way to do this, please let me know as I’m still learning!

First of all, the requirements of my project asked that my numbers be formatted using the NumberFormat class.  For any monetary value, the number would be formatted using the getCurrencyInstance() method, and percentages using getPercentInstance() with setMinimumFractionDigits(3) and setMaximumFractionDigits(3).  Therefore, when I format currency, the result is a string like “$1,000.00”, and percentages show like “5.250%”.

In my application, a Loan Interest Calculator, I needed to print out the principal amount, interest rate, total interest, and total loan repayment amounts.  Obviously you can see my issue with the decimals not lining up.  My first run of the program produced the following output:

Loan Amount:   $1,000.00
Interest Rate: 10.250%
Interest:      $102.50
Repayment:     $1102.50

Note that, in my source code, I’m printing out a concatenation of string literal (i.e. “Loan Amount: “) and a variable (i.e. loanAmount) so that I can format the number properly. Like this:

System.out.println("Loan Amount: " + loanAmount);

Now that you can see the problem, I’ll move on to the solution. In my mind, I needed to add a certain unknown number of spaces before each amount to make the decimals line up. Clear as mud? In my case, I knew that one particular value, the repayment amount, would always be the largest. So my idea was to first find the length of the largest value, then find the difference between that and value I wanted to format. Then, using a for loop, I would create a String of spaces equal to the difference in length. Here’s the beginning of my function:

private static String formatForDecimals(String number, String largest) {
    int totalPrefix = largest.length() - number.length();
    String prefix = "";
    String formattedNum = "";
    for (int i = 0; i < totalPrefix; i++) {
        prefix += " ";
    formattedNum = prefix + number;

To test this, I simply called the formatForDecimals() method in my println for each value, like this:

System.out.println("Loan Amount: " + formatForDecimals(loanAmount, repayment));

This got me really close, as you can see:

Loan Amount:  $1,000.00
Interest Rate:  10.250%
Interest:       $102.50
Repayment:     $1102.50

The one thing I didn’t account for was the extra decimal place and percent sign in the percentage. So i tweaked my function with this:

private static String formatForDecimals(String number, String largest) {
    int totalPrefix = largest.length() - number.length();
    if (number.contains(%)) {
        totalPrefix += 2;
    String prefix = "";
    String formattedNum = "";
    for (int i = 0; i < totalPrefix; i++) {
        prefix += " ";
    formattedNum = prefix + number;

Basically, I wanted to check the String to see if it was a percentage and, if so, add two extra spaces to account for the extra characters. And it worked! I got the following output:

Loan Amount:  $1,000.00
Interest Rate:    10.250%
Interest:       $102.50
Repayment:     $1102.50

Okay, so I know this is not a perfect solution by any means. As I said, I’m not a Java expert, so if you know of anything that would’ve made this easier, post a comment or something! I’m always welcome to learning new things.

Oh, and just for clarification, the reason I included the “largest” as a parameter was because I had to use the same formatting in a different place with different values, so I wanted to make my code reusable.

Thanks for reading!

Installing Eclipse for C/C++ and MinGW


Whether you’ve just decided to learn C/C++ or you’ve been developing for years, using an IDE (Integrated Development Environment) can make your life so much easier. IDEs offer many helpful features, from color-coded syntax to in-line debugging auto-complete features.

Netbeans has typically been my go-to IDE. However, many developers prefer Eclipse for its open-source roots and large collection of plugins. However, installing Eclipse can be a bear, especially for those new to the development world. Therefore, I decided to write up a quick tutorial that worked for me.

NOTE: This tutorial is based on Windows 7, though installations on other previous versions of Windows is likely to be the same or very similar.

Eclipse is a java-based program. Even if you don’t want to develop in Java, Eclipse will need a JVM (Java Virtual Machine) to work. If you’re new to these terms, don’t fret; it’s not complicated! You have two options. First, you can simply install the Java Runtime Environment (or JRE) by going to Otherwise, if you want to develop in Java, visit the same link to find the Java Development Kit (JDK) download. At any rate, the installation process is fairly straightforward. Continue on once you have Java installed on your machine.

The first thing you need is the Eclipse download file from Look down the list for “Eclipse IDE for C/C++ Developers” and find the Windows 32 Bit/Windows 64 bit links on the right. Make sure you choose the version that matches your operating system! If you’re unsure whether you have 32- or 64-bit, look under Control Panel>System and Maintenance>System.

After clicking the link, you’ll be taken to a Download – Mirror Selection page. Choose any mirror (the first listed will be fine) to begin the download. Notice that the download is a zip file and NOT an exe. This is where many people become confused. There is no installer for eclipse!

Don’t let my previous statement worry you. The next steps are REALLY easy. Unzip the download file to your “C:\Program Files” directory, then open the eclipse folder and find the eclipse.exe file. This is Eclipse. Double-clicking will open, but I suggest creating a shortcut on your desktop or pinning it to your Start menu for easier access. See, I told you it was easy. However, there are a few more things you need to do before you can actually create C applications.

NOTE: If Eclipse warns you that it can’t find Java, you may have to add your JRE/JDK to your PATH environment variable. It’s very easy, just google something like “Add Java to PATH.”

Programs written in C must be compiled into machine language before they can be run. However, Eclipse w/ C/C++ does not come prepackaged with a set of compilers, so unless you already have one installed on your computer, you’ll need to follow this step. There are multiple options when it comes to compilers, but MinGW is one of the top recommended for Windows machines – and it’s what I use!

First, download MinGW at link. Second, run the installer. During the installation, you will be asked which components you would like to install. “C Compiler” will automatically be selected, but feel free to add others as you wish.

Third, you will need to make sure that MinGW is added to your PATH. Basically, just append “C:\MinGW” to the end of the path (unless you specifically changed the location during the installation). Finally, open Eclipse and test by creating a new C project to build and run. If you already know what you’re doing, good luck and thanks for reading! Otherwise, continue to the next section on creating a simple C project in Eclipse.

Follow these steps to create a simple Hello World project in Eclipse:

    File>New>C Project. Give the project a name (like “helloWorld”), choose “Empty Project” in the Project Type box and “MinGW GCC” in the Toolchains box, then click Finish.
    You should see your new project listed in the Project Explorer pane on the left. Right-click on the project, then choose New>Source File. Give the file a name (like “main.c”), but make sure you type the “.c” extension. Then click Finish.
    In your new file, type the following code:

#include <stdio.h>;
int main() {
printf("Hello C Programmers!");
return 0;

    Now build your application by right-clicking on the project and choosing “Build Project”. Keeping my fingers crossed that I have not left out any steps, you should not receive any errors in the console at the bottom.
    Finally, run your program by right-clicking on the project and choosing Run As>Local C/C++ Application.

If that worked and you saw the message printed to the console, then congratulations! You have successfully installed Eclipse/MinGW and built your first program! Have fun and let me know if you have any questions.


JavaFX 1.3 Officially Released Apr 22!

JavaFX 1.3 Now Available!

JavaFX 1.3 Now Available!

This is what we’ve all been waiting for; the highly anticipated and much-needed JavaFX 1.3 SDK.  This new releases promises, and from my experience delivers, great enhancements to performance, JavaFX controls, layout and transforms, and much more!  Along with the release of JavaFX 1.3 comes the NetBeans 6.9 Beta release, so be sure to download both!

Here is one blog post and resource for JavaFX 1.3 that you will not want to miss:

James Weaver has been working on a attention-grabbing project in 1.3; a 3D Cuboid Calendar which interacts with the Google Calendar API.

3D Cube Calendar

3D Cube Calendar

From front to back, the cube displays the months of the year.  As the user rotates the cube (even on the z axis, a new conditional feature of 1.3 explained in Jim Weaver’s post), each side represents a different filter or view of the year.  For instance, if a user looks at the left side of the cube, they are viewing all of the Sundays in the year.  Jim has also added the ability to “peel back” layers of the cube, so instead of only viewing all Sundays, they can view the rest of the week days.

There are even more features to this cube, so be sure to check out Jim’s blog post here.

JavaFX 2-Day Course

Hello, all!

My apologies for the gap in posting.  The past few weeks have been extremely hectic.  I have been working with my mentor Jim Weaver in creating a 2-day JavaFX course for Sun (now Oracle).  We will be flying out to Santa Clara, CA March 1st for a “Beta Teach” of the course.  This is an exciting opportunity for me, and I’m looking forward to learning new things while I am out there.

Once we are back, and have finished some refining of the course material, I will get to posting some cool new things!



My New Blog!

Hello, everyone!

My name is Chris Wright, and I am a software developer for VNImedia, LLC based out of Marion, IN.  I’ve been wanting to get a blog going for quite some time and figured now would be as good a time as any!

This blog will mainly focus on JavaFX code and will throw in some other cool posts from time to time.  Other topics can and will include advancements in augmented reality, something that my mentor James Weaver has been dabbling with (check out his new blog on the topic), and Groovy code which my coworker Brian Shultz has been experimenting with (look HERE).

More or less, this blog will be where I post new things that I’ve learned in JavaFX and other fields.  Feel free to critique my work, because that’s what it’s all about!

Have a fantastic day,

Chris Wright