Tuesday, August 18, 2009

Setup MySQL Development in Eclipse

Using MySQL and Java? Check out an easier way: Yank

Setting up Eclipse as a MySQL development environment using the Database Development perspective is quite easy. Here you will find a step-by-step guide showing how to set up Eclipse for MySQL development. The tutorial shows how to get the right version of Eclipse, how to setup a MySQL database, how to get and use the Connector/J database driver, how to connect to a database within Eclipse, and how to create a table containing some sample data.

Step 1: Download and Install the Eclipse IDE for Java EE Developers.



Step 2: Download the Connector/J MySQL Database Driver.


Step 3: Download, Install, and start up MySQL. If you're developing on a Mac, see: Install MySQL on Mac OS X.

Step 4: Open up Eclipse and switch to the "Database Development" perspective (Window --> Open Perspective --> Other... --> Database Development perspective).




Step 5: Connect to your MySQL database.

In the "Data Source Explorer" view, right click on "Database Connections" and select "New...".



On the first page of the "New Connection Profile" Wizard, select the "MySQL" connection profile type and hit "Next >".

Click the circle with a plus sign next to the "Drivers" drop-down box.

On the "Name/Type" tab, select the MySQL JDBC Driver version 5.1 (or whatever version you downloaded). Just ignore the error in the wizard for now.

On the "Jar List" tab, add the driver .jar from the package that you downloaded and remove the default .jar that was added to the list. The error message in the wizard should now disappear. Click "OK".

On the second page of the "New Connection Profile" Wizard, edit the connection properties. In the "Database" and "URL" fields, change the word "database" to the actual name of the database you want to connect to. Change the URL, User name and Password appropriate to your circumstance. By default the MySQL database setup creates a root user with a blank password. Test the connection and hit "Finish".


Step 6: Create a table.

In the main Eclipse menu, select File --> New --> SQL File.



In the "New SQL File" wizard, select the folder where the SQL file should be stored. Create a new project if you don't have one yet. Give the file a name and hit "Finish".

In the SQL Editor view, write an SQL statement to add a table to the selected database. Highlight the text to be executed, right click, and choose "Execute Selected Text".


Step 7: Add data to the table.

In the "Data Source Explorer" view, dig down into the directory structure until you find your table in the "Tables" folder. Right click on it and choose Data --> Edit.



In the table editing view that appeared, add your data. Save to commit your changes.



Piece of cake!!

Uninstall MySQL on Mac OS X

Using MySQL and Java? Check out an easier way: Yank

Uninstalling MySQL on Mac OS X is very easy - you just have to delete some files. Here you will find instructions to delete both MySQL and the MySQL Startup Item, which you may have installed following the instructions found here: Install MySQL on Mac OS X. Be aware that doing this will delete all your MySQL databases and data.

Step 1: Uninstall MySQL. Fire up the Terminal and type in: cd /usr/local , hit enter, type in: ls , hit enter, and verify that there are two items called "mysql" and "mysql-5.1.37-osx10.5-x86_64" (or similar). These are the two items you want to delete. Type in: sudo rm mysql , hit enter, type in: sudo rm -rf mysql-5.1.37-osx10.5-x86_64 , and hit enter. You'll need to enter your password at some point when prompted.





Step 2: Uninstall the MySQL Startup Item. In Termainl type in: cd /Library/StartupItems , hit enter, type in: ls , hit enter, and verify that there is an item called "MySQLCOM". This is the item you want to delete. Type in: sudo rm -rf MySQLCOM , and hit enter. You'll need to enter your password at some point when prompted.

Piece of cake!!

See also: Install MySQL on Mac OS X
And also: Installing and Running Tomcat on Mac OS X
And also: Set MySQL Server System Variables on Mac OS X
And also: My Mac OS X MySQL Cheat Sheet

Monday, August 17, 2009

Install MySQL on Mac OS X

Using MySQL and Java? Check out an easier way: Yank

Update: I just verified that the 10.6 version works on Mountain Lion 10.8.

There are already several instructions out there on how to install MySQL on Mac OS X, but most of them are either outdated or more complicated than they need to be. Here you will find an easy tutorial showing how to install MySQL, start it up, access it as the default root user, create a database, delete the database and exit.

Step 1: Download MySQL. Go to the downloads page at mysql.com. Under the section "MySQL Community Server" click on the "Download" link. Find the particular version of MySQL that is appropriate for your OS and machine architecture. In my case, I downloaded the "Mac OS X 10.5 (x86, 64-bit)" version because I have Mac OS X 10.5 running on a MacBook with a 64-bit Intel processor. You want to download the DMG Archive, not the compressed TAR Archive.

Note: Use the 10.6 version for Snow Leopard, Lion, and Mountain Lion.





Step 2: Access the installers. Go the the directory where the .dmg file was downloaded to and mount the .dmg file by double clicking it. The .dmg contains the MySQL and MySQL Startup installer packages as well as the MySQL.prefPane.



Step 3: Install MySQL and the MySQL Startup Item. Double-clicking on mysql*.pkg icon starts an installer wizard that takes you through a few intuitive installation steps. Once you click through the wizard and accept a license agreement you should see the "install succeeded" page. Repeat for MySQLStartupItem.pkg and MySQL.prefPane.



Step 4: Verify Install. Fire up the Terminal and type in:
cd /usr/local
, hit enter, type in:
ls
, and verify that there are two items. The Mac OS X .pkg of MySQL installs itself into /usr/local/mysql-VERSION and /usr/local/mysql.



Step 5: Restart your computer. When the computer reboots, it will startup the database server allowing you to connect to it. You can also probably start MySQL without rebooting by starting it through the MySQL preference Pane under System Preferences although I haven't tried that. If you prefer the command line, the start and stop commands are listed at the bottom of this article.

Step 6: Use MySQL. Type in:
/usr/local/mysql/bin/mysql -u root -p
The last part of the command tells it you want to start it up as the root user and that you'd like to be prompted for a password. By default the root's password is blank, so when you are prompted for it, just hit enter. You are now using MySQL, and you can tell it what to do at the MySQL command prompt:
mysql>



Note about error 2002 people are reporting!


If after installing MySQL and trying to use MySQL as root user as in step 6, and you see this following error:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)

, it's probably because MySQL is installed but not yet running. Make sure you've started MySQL as outlined in Step 5. To verify that it's running, open up Activity Monitor and under "All Processes", verify you see the process "mydqld".


If you installed the preference pane, you should also see there that MySQL is running.


Step 7: Create a database, delete it and exit MySQL. At the mysql> prompt, type in:
create database mynewdatabase;
Verify that it was created by typing in:
show databases;
You should see the database along with the default databases. Delete the database by typing in:
drop database mynewdatabase;
Verify that it was deleted by typing in:
show databases;
Exit MySQL by typing in:
exit;


Piece of Cake!!

In addition, here are the commands you need to start and stop MySQL:
sudo /Library/StartupItems/MySQLCOM/MySQLCOM stop
sudo /Library/StartupItems/MySQLCOM/MySQLCOM start
sudo /Library/StartupItems/MySQLCOM/MySQLCOM restart


See also: Uninstall MySQL on Mac OS X
And also: Installing and Running Tomcat on Mac OS X
And also: Set MySQL Server System Variables on Mac OS X
And also: My Mac OS X MySQL Cheat Sheet

Monday, August 10, 2009

Placing Two DIVs Side-by-Side using CSS

There is a little CSS trick needed when placing two HTML elements or DIVs side-by-side in order to prevent the two elements from jumping out of the containing DIV. In this simple demonstration there is an 'outer' DIV containing a 'header' DIV containing a 'title' DIV and a 'search' FORM. The FORM could just as well be a DIV for this to work. The title and search are forced left and right using 'float:left' and 'float:right' respectively. The trick is to add a third DIV after the search FORM inside the header DIV with a CSS 'clear:both' styling: <div style="clear:both;"></div>.

Before:



After:


HTML & CSS:


<html>
<head>
<style type="text/css">

#outer {
    width:600px;
    margin:0 auto;
    background:#BBBBBB;
    text-transform:uppercase;
    padding:10px;
}

#header {
    background:#0044FF;
    padding:5px 10px;
}

#title{
    background:#FF2244;
    padding:10px;
    float:left;
}

#search{
    background:#22CC22;
    padding:10px;
    float:right;
}

</style>
<body>
<div id='outer'>
    <div id='header'>
        <div id='title'>
            <p>Website Title</p>
        </div>
        <form id='search' method="get">
            <input type="text" name="searchText" />
            <input type="submit" value="Search" />
        </form> 
        <div style="clear:both;"></div>
    </div>
</div>
</body>
</html>


Piece of Cake!!

Sunday, August 9, 2009

Hexidecimal and RGB Color Palette

Here's a color palette of a small sampling of the 256^3=16,777,216 possible colors to choose from when coding with colors across a wide range of computer languages (Java, C#, CSS, MATLAB, etc.) on systems that support 24-bit colordepth. The hex color chart contains both the hexidecimal and rbg codes. It was generated with a JSP script, which can be found below for reference.

 
000000
0,0,0
 
000022
0,0,34
 
000044
0,0,68
 
000066
0,0,102
 
000088
0,0,136
 
0000AA
0,0,170
 
0000CC
0,0,204
 
0000EE
0,0,238
 
0000FF
0,0,255
 
002200
0,34,0
 
002222
0,34,34
 
002244
0,34,68



 
002266
0,34,102
 
002288
0,34,136
 
0022AA
0,34,170
 
0022CC
0,34,204
 
0022EE
0,34,238
 
0022FF
0,34,255
 
004400
0,68,0
 
004422
0,68,34
 
004444
0,68,68
 
004466
0,68,102
 
004488
0,68,136
 
0044AA
0,68,170
 
0044CC
0,68,204
 
0044EE
0,68,238
 
0044FF
0,68,255
 
006600
0,102,0
 
006622
0,102,34
 
006644
0,102,68
 
006666
0,102,102
 
006688
0,102,136
 
0066AA
0,102,170
 
0066CC
0,102,204
 
0066EE
0,102,238
 
0066FF
0,102,255
 
008800
0,136,0
 
008822
0,136,34
 
008844
0,136,68
 
008866
0,136,102
 
008888
0,136,136
 
0088AA
0,136,170
 
0088CC
0,136,204
 
0088EE
0,136,238
 
0088FF
0,136,255
 
00AA00
0,170,0
 
00AA22
0,170,34
 
00AA44
0,170,68
 
00AA66
0,170,102
 
00AA88
0,170,136
 
00AAAA
0,170,170
 
00AACC
0,170,204
 
00AAEE
0,170,238
 
00AAFF
0,170,255
 
00CC00
0,204,0
 
00CC22
0,204,34
 
00CC44
0,204,68
 
00CC66
0,204,102
 
00CC88
0,204,136
 
00CCAA
0,204,170
 
00CCCC
0,204,204
 
00CCEE
0,204,238
 
00CCFF
0,204,255
 
00EE00
0,238,0
 
00EE22
0,238,34
 
00EE44
0,238,68
 
00EE66
0,238,102
 
00EE88
0,238,136
 
00EEAA
0,238,170
 
00EECC
0,238,204
 
00EEEE
0,238,238
 
00EEFF
0,238,255
 
00FF00
0,255,0
 
00FF22
0,255,34
 
00FF44
0,255,68
 
00FF66
0,255,102
 
00FF88
0,255,136
 
00FFAA
0,255,170
 
00FFCC
0,255,204
 
00FFEE
0,255,238
 
00FFFF
0,255,255
 
220000
34,0,0
 
220022
34,0,34
 
220044
34,0,68
 
220066
34,0,102
 
220088
34,0,136
 
2200AA
34,0,170
 
2200CC
34,0,204
 
2200EE
34,0,238
 
2200FF
34,0,255
 
222200
34,34,0
 
222222
34,34,34
 
222244
34,34,68
 
222266
34,34,102
 
222288
34,34,136
 
2222AA
34,34,170
 
2222CC
34,34,204
 
2222EE
34,34,238
 
2222FF
34,34,255
 
224400
34,68,0
 
224422
34,68,34
 
224444
34,68,68
 
224466
34,68,102
 
224488
34,68,136
 
2244AA
34,68,170
 
2244CC
34,68,204
 
2244EE
34,68,238
 
2244FF
34,68,255
 
226600
34,102,0
 
226622
34,102,34
 
226644
34,102,68
 
226666
34,102,102
 
226688
34,102,136
 
2266AA
34,102,170
 
2266CC
34,102,204
 
2266EE
34,102,238
 
2266FF
34,102,255
 
228800
34,136,0
 
228822
34,136,34
 
228844
34,136,68
 
228866
34,136,102
 
228888
34,136,136
 
2288AA
34,136,170
 
2288CC
34,136,204
 
2288EE
34,136,238
 
2288FF
34,136,255
 
22AA00
34,170,0
 
22AA22
34,170,34
 
22AA44
34,170,68
 
22AA66
34,170,102
 
22AA88
34,170,136
 
22AAAA
34,170,170
 
22AACC
34,170,204
 
22AAEE
34,170,238
 
22AAFF
34,170,255
 
22CC00
34,204,0
 
22CC22
34,204,34
 
22CC44
34,204,68
 
22CC66
34,204,102
 
22CC88
34,204,136
 
22CCAA
34,204,170
 
22CCCC
34,204,204
 
22CCEE
34,204,238
 
22CCFF
34,204,255
 
22EE00
34,238,0
 
22EE22
34,238,34
 
22EE44
34,238,68
 
22EE66
34,238,102
 
22EE88
34,238,136
 
22EEAA
34,238,170
 
22EECC
34,238,204
 
22EEEE
34,238,238
 
22EEFF
34,238,255
 
22FF00
34,255,0
 
22FF22
34,255,34
 
22FF44
34,255,68
 
22FF66
34,255,102
 
22FF88
34,255,136
 
22FFAA
34,255,170
 
22FFCC
34,255,204
 
22FFEE
34,255,238
 
22FFFF
34,255,255
 
440000
68,0,0
 
440022
68,0,34
 
440044
68,0,68
 
440066
68,0,102
 
440088
68,0,136
 
4400AA
68,0,170
 
4400CC
68,0,204
 
4400EE
68,0,238
 
4400FF
68,0,255
 
442200
68,34,0
 
442222
68,34,34
 
442244
68,34,68
 
442266
68,34,102
 
442288
68,34,136
 
4422AA
68,34,170
 
4422CC
68,34,204
 
4422EE
68,34,238
 
4422FF
68,34,255
 
444400
68,68,0
 
444422
68,68,34
 
444444
68,68,68
 
444466
68,68,102
 
444488
68,68,136
 
4444AA
68,68,170
 
4444CC
68,68,204
 
4444EE
68,68,238
 
4444FF
68,68,255
 
446600
68,102,0
 
446622
68,102,34
 
446644
68,102,68
 
446666
68,102,102
 
446688
68,102,136
 
4466AA
68,102,170
 
4466CC
68,102,204
 
4466EE
68,102,238
 
4466FF
68,102,255
 
448800
68,136,0
 
448822
68,136,34
 
448844
68,136,68
 
448866
68,136,102
 
448888
68,136,136
 
4488AA
68,136,170
 
4488CC
68,136,204
 
4488EE
68,136,238
 
4488FF
68,136,255
 
44AA00
68,170,0
 
44AA22
68,170,34
 
44AA44
68,170,68
 
44AA66
68,170,102
 
44AA88
68,170,136
 
44AAAA
68,170,170
 
44AACC
68,170,204
 
44AAEE
68,170,238
 
44AAFF
68,170,255
 
44CC00
68,204,0
 
44CC22
68,204,34
 
44CC44
68,204,68
 
44CC66
68,204,102
 
44CC88
68,204,136
 
44CCAA
68,204,170
 
44CCCC
68,204,204
 
44CCEE
68,204,238
 
44CCFF
68,204,255
 
44EE00
68,238,0
 
44EE22
68,238,34
 
44EE44
68,238,68
 
44EE66
68,238,102
 
44EE88
68,238,136
 
44EEAA
68,238,170
 
44EECC
68,238,204
 
44EEEE
68,238,238
 
44EEFF
68,238,255
 
44FF00
68,255,0
 
44FF22
68,255,34
 
44FF44
68,255,68
 
44FF66
68,255,102
 
44FF88
68,255,136
 
44FFAA
68,255,170
 
44FFCC
68,255,204
 
44FFEE
68,255,238
 
44FFFF
68,255,255
 
660000
102,0,0
 
660022
102,0,34
 
660044
102,0,68
 
660066
102,0,102
 
660088
102,0,136
 
6600AA
102,0,170
 
6600CC
102,0,204
 
6600EE
102,0,238
 
6600FF
102,0,255
 
662200
102,34,0
 
662222
102,34,34
 
662244
102,34,68
 
662266
102,34,102
 
662288
102,34,136
 
6622AA
102,34,170
 
6622CC
102,34,204
 
6622EE
102,34,238
 
6622FF
102,34,255
 
664400
102,68,0
 
664422
102,68,34
 
664444
102,68,68
 
664466
102,68,102
 
664488
102,68,136
 
6644AA
102,68,170
 
6644CC
102,68,204
 
6644EE
102,68,238
 
6644FF
102,68,255
 
666600
102,102,0
 
666622
102,102,34
 
666644
102,102,68
 
666666
102,102,102
 
666688
102,102,136
 
6666AA
102,102,170
 
6666CC
102,102,204
 
6666EE
102,102,238
 
6666FF
102,102,255
 
668800
102,136,0
 
668822
102,136,34
 
668844
102,136,68
 
668866
102,136,102
 
668888
102,136,136
 
6688AA
102,136,170
 
6688CC
102,136,204
 
6688EE
102,136,238
 
6688FF
102,136,255
 
66AA00
102,170,0
 
66AA22
102,170,34
 
66AA44
102,170,68
 
66AA66
102,170,102
 
66AA88
102,170,136
 
66AAAA
102,170,170
 
66AACC
102,170,204
 
66AAEE
102,170,238
 
66AAFF
102,170,255
 
66CC00
102,204,0
 
66CC22
102,204,34
 
66CC44
102,204,68
 
66CC66
102,204,102
 
66CC88
102,204,136
 
66CCAA
102,204,170
 
66CCCC
102,204,204
 
66CCEE
102,204,238
 
66CCFF
102,204,255
 
66EE00
102,238,0
 
66EE22
102,238,34
 
66EE44
102,238,68
 
66EE66
102,238,102
 
66EE88
102,238,136
 
66EEAA
102,238,170
 
66EECC
102,238,204
 
66EEEE
102,238,238
 
66EEFF
102,238,255
 
66FF00
102,255,0
 
66FF22
102,255,34
 
66FF44
102,255,68
 
66FF66
102,255,102
 
66FF88
102,255,136
 
66FFAA
102,255,170
 
66FFCC
102,255,204
 
66FFEE
102,255,238
 
66FFFF
102,255,255
 
880000
136,0,0
 
880022
136,0,34
 
880044
136,0,68
 
880066
136,0,102
 
880088
136,0,136
 
8800AA
136,0,170
 
8800CC
136,0,204
 
8800EE
136,0,238
 
8800FF
136,0,255
 
882200
136,34,0
 
882222
136,34,34
 
882244
136,34,68
 
882266
136,34,102
 
882288
136,34,136
 
8822AA
136,34,170
 
8822CC
136,34,204
 
8822EE
136,34,238
 
8822FF
136,34,255
 
884400
136,68,0
 
884422
136,68,34
 
884444
136,68,68
 
884466
136,68,102
 
884488
136,68,136
 
8844AA
136,68,170
 
8844CC
136,68,204
 
8844EE
136,68,238
 
8844FF
136,68,255
 
886600
136,102,0
 
886622
136,102,34
 
886644
136,102,68
 
886666
136,102,102
 
886688
136,102,136
 
8866AA
136,102,170
 
8866CC
136,102,204
 
8866EE
136,102,238
 
8866FF
136,102,255
 
888800
136,136,0
 
888822
136,136,34
 
888844
136,136,68
 
888866
136,136,102
 
888888
136,136,136
 
8888AA
136,136,170
 
8888CC
136,136,204
 
8888EE
136,136,238
 
8888FF
136,136,255
 
88AA00
136,170,0
 
88AA22
136,170,34
 
88AA44
136,170,68
 
88AA66
136,170,102
 
88AA88
136,170,136
 
88AAAA
136,170,170
 
88AACC
136,170,204
 
88AAEE
136,170,238
 
88AAFF
136,170,255
 
88CC00
136,204,0
 
88CC22
136,204,34
 
88CC44
136,204,68
 
88CC66
136,204,102
 
88CC88
136,204,136
 
88CCAA
136,204,170
 
88CCCC
136,204,204
 
88CCEE
136,204,238
 
88CCFF
136,204,255
 
88EE00
136,238,0
 
88EE22
136,238,34
 
88EE44
136,238,68
 
88EE66
136,238,102
 
88EE88
136,238,136
 
88EEAA
136,238,170
 
88EECC
136,238,204
 
88EEEE
136,238,238
 
88EEFF
136,238,255
 
88FF00
136,255,0
 
88FF22
136,255,34
 
88FF44
136,255,68
 
88FF66
136,255,102
 
88FF88
136,255,136
 
88FFAA
136,255,170
 
88FFCC
136,255,204
 
88FFEE
136,255,238
 
88FFFF
136,255,255
 
AA0000
170,0,0
 
AA0022
170,0,34
 
AA0044
170,0,68
 
AA0066
170,0,102
 
AA0088
170,0,136
 
AA00AA
170,0,170
 
AA00CC
170,0,204
 
AA00EE
170,0,238
 
AA00FF
170,0,255
 
AA2200
170,34,0
 
AA2222
170,34,34
 
AA2244
170,34,68
 
AA2266
170,34,102
 
AA2288
170,34,136
 
AA22AA
170,34,170
 
AA22CC
170,34,204
 
AA22EE
170,34,238
 
AA22FF
170,34,255
 
AA4400
170,68,0
 
AA4422
170,68,34
 
AA4444
170,68,68
 
AA4466
170,68,102
 
AA4488
170,68,136
 
AA44AA
170,68,170
 
AA44CC
170,68,204
 
AA44EE
170,68,238
 
AA44FF
170,68,255
 
AA6600
170,102,0
 
AA6622
170,102,34
 
AA6644
170,102,68
 
AA6666
170,102,102
 
AA6688
170,102,136
 
AA66AA
170,102,170
 
AA66CC
170,102,204
 
AA66EE
170,102,238
 
AA66FF
170,102,255
 
AA8800
170,136,0
 
AA8822
170,136,34
 
AA8844
170,136,68
 
AA8866
170,136,102
 
AA8888
170,136,136
 
AA88AA
170,136,170
 
AA88CC
170,136,204
 
AA88EE
170,136,238
 
AA88FF
170,136,255
 
AAAA00
170,170,0
 
AAAA22
170,170,34
 
AAAA44
170,170,68
 
AAAA66
170,170,102
 
AAAA88
170,170,136
 
AAAAAA
170,170,170
 
AAAACC
170,170,204
 
AAAAEE
170,170,238
 
AAAAFF
170,170,255
 
AACC00
170,204,0
 
AACC22
170,204,34
 
AACC44
170,204,68
 
AACC66
170,204,102
 
AACC88
170,204,136
 
AACCAA
170,204,170
 
AACCCC
170,204,204
 
AACCEE
170,204,238
 
AACCFF
170,204,255
 
AAEE00
170,238,0
 
AAEE22
170,238,34
 
AAEE44
170,238,68
 
AAEE66
170,238,102
 
AAEE88
170,238,136
 
AAEEAA
170,238,170
 
AAEECC
170,238,204
 
AAEEEE
170,238,238
 
AAEEFF
170,238,255
 
AAFF00
170,255,0
 
AAFF22
170,255,34
 
AAFF44
170,255,68
 
AAFF66
170,255,102
 
AAFF88
170,255,136
 
AAFFAA
170,255,170
 
AAFFCC
170,255,204
 
AAFFEE
170,255,238
 
AAFFFF
170,255,255
 
CC0000
204,0,0
 
CC0022
204,0,34
 
CC0044
204,0,68
 
CC0066
204,0,102
 
CC0088
204,0,136
 
CC00AA
204,0,170
 
CC00CC
204,0,204
 
CC00EE
204,0,238
 
CC00FF
204,0,255
 
CC2200
204,34,0
 
CC2222
204,34,34
 
CC2244
204,34,68
 
CC2266
204,34,102
 
CC2288
204,34,136
 
CC22AA
204,34,170
 
CC22CC
204,34,204
 
CC22EE
204,34,238
 
CC22FF
204,34,255
 
CC4400
204,68,0
 
CC4422
204,68,34
 
CC4444
204,68,68
 
CC4466
204,68,102
 
CC4488
204,68,136
 
CC44AA
204,68,170
 
CC44CC
204,68,204
 
CC44EE
204,68,238
 
CC44FF
204,68,255
 
CC6600
204,102,0
 
CC6622
204,102,34
 
CC6644
204,102,68
 
CC6666
204,102,102
 
CC6688
204,102,136
 
CC66AA
204,102,170
 
CC66CC
204,102,204
 
CC66EE
204,102,238
 
CC66FF
204,102,255
 
CC8800
204,136,0
 
CC8822
204,136,34
 
CC8844
204,136,68
 
CC8866
204,136,102
 
CC8888
204,136,136
 
CC88AA
204,136,170
 
CC88CC
204,136,204
 
CC88EE
204,136,238
 
CC88FF
204,136,255
 
CCAA00
204,170,0
 
CCAA22
204,170,34
 
CCAA44
204,170,68
 
CCAA66
204,170,102
 
CCAA88
204,170,136
 
CCAAAA
204,170,170
 
CCAACC
204,170,204
 
CCAAEE
204,170,238
 
CCAAFF
204,170,255
 
CCCC00
204,204,0
 
CCCC22
204,204,34
 
CCCC44
204,204,68
 
CCCC66
204,204,102
 
CCCC88
204,204,136
 
CCCCAA
204,204,170
 
CCCCCC
204,204,204
 
CCCCEE
204,204,238
 
CCCCFF
204,204,255
 
CCEE00
204,238,0
 
CCEE22
204,238,34
 
CCEE44
204,238,68
 
CCEE66
204,238,102
 
CCEE88
204,238,136
 
CCEEAA
204,238,170
 
CCEECC
204,238,204
 
CCEEEE
204,238,238
 
CCEEFF
204,238,255
 
CCFF00
204,255,0
 
CCFF22
204,255,34
 
CCFF44
204,255,68
 
CCFF66
204,255,102
 
CCFF88
204,255,136
 
CCFFAA
204,255,170
 
CCFFCC
204,255,204
 
CCFFEE
204,255,238
 
CCFFFF
204,255,255
 
EE0000
238,0,0
 
EE0022
238,0,34
 
EE0044
238,0,68
 
EE0066
238,0,102
 
EE0088
238,0,136
 
EE00AA
238,0,170
 
EE00CC
238,0,204
 
EE00EE
238,0,238
 
EE00FF
238,0,255
 
EE2200
238,34,0
 
EE2222
238,34,34
 
EE2244
238,34,68
 
EE2266
238,34,102
 
EE2288
238,34,136
 
EE22AA
238,34,170
 
EE22CC
238,34,204
 
EE22EE
238,34,238
 
EE22FF
238,34,255
 
EE4400
238,68,0
 
EE4422
238,68,34
 
EE4444
238,68,68
 
EE4466
238,68,102
 
EE4488
238,68,136
 
EE44AA
238,68,170
 
EE44CC
238,68,204
 
EE44EE
238,68,238
 
EE44FF
238,68,255
 
EE6600
238,102,0
 
EE6622
238,102,34
 
EE6644
238,102,68
 
EE6666
238,102,102
 
EE6688
238,102,136
 
EE66AA
238,102,170
 
EE66CC
238,102,204
 
EE66EE
238,102,238
 
EE66FF
238,102,255
 
EE8800
238,136,0
 
EE8822
238,136,34
 
EE8844
238,136,68
 
EE8866
238,136,102
 
EE8888
238,136,136
 
EE88AA
238,136,170
 
EE88CC
238,136,204
 
EE88EE
238,136,238
 
EE88FF
238,136,255
 
EEAA00
238,170,0
 
EEAA22
238,170,34
 
EEAA44
238,170,68
 
EEAA66
238,170,102
 
EEAA88
238,170,136
 
EEAAAA
238,170,170
 
EEAACC
238,170,204
 
EEAAEE
238,170,238
 
EEAAFF
238,170,255
 
EECC00
238,204,0
 
EECC22
238,204,34
 
EECC44
238,204,68
 
EECC66
238,204,102
 
EECC88
238,204,136
 
EECCAA
238,204,170
 
EECCCC
238,204,204
 
EECCEE
238,204,238
 
EECCFF
238,204,255
 
EEEE00
238,238,0
 
EEEE22
238,238,34
 
EEEE44
238,238,68
 
EEEE66
238,238,102
 
EEEE88
238,238,136
 
EEEEAA
238,238,170
 
EEEECC
238,238,204
 
EEEEEE
238,238,238
 
EEEEFF
238,238,255
 
EEFF00
238,255,0
 
EEFF22
238,255,34
 
EEFF44
238,255,68
 
EEFF66
238,255,102
 
EEFF88
238,255,136
 
EEFFAA
238,255,170
 
EEFFCC
238,255,204
 
EEFFEE
238,255,238
 
EEFFFF
238,255,255
 
FF0000
255,0,0
 
FF0022
255,0,34
 
FF0044
255,0,68
 
FF0066
255,0,102
 
FF0088
255,0,136
 
FF00AA
255,0,170
 
FF00CC
255,0,204
 
FF00EE
255,0,238
 
FF00FF
255,0,255
 
FF2200
255,34,0
 
FF2222
255,34,34
 
FF2244
255,34,68
 
FF2266
255,34,102
 
FF2288
255,34,136
 
FF22AA
255,34,170
 
FF22CC
255,34,204
 
FF22EE
255,34,238
 
FF22FF
255,34,255
 
FF4400
255,68,0
 
FF4422
255,68,34
 
FF4444
255,68,68
 
FF4466
255,68,102
 
FF4488
255,68,136
 
FF44AA
255,68,170
 
FF44CC
255,68,204
 
FF44EE
255,68,238
 
FF44FF
255,68,255
 
FF6600
255,102,0
 
FF6622
255,102,34
 
FF6644
255,102,68
 
FF6666
255,102,102
 
FF6688
255,102,136
 
FF66AA
255,102,170
 
FF66CC
255,102,204
 
FF66EE
255,102,238
 
FF66FF
255,102,255
 
FF8800
255,136,0
 
FF8822
255,136,34
 
FF8844
255,136,68
 
FF8866
255,136,102
 
FF8888
255,136,136
 
FF88AA
255,136,170
 
FF88CC
255,136,204
 
FF88EE
255,136,238
 
FF88FF
255,136,255
 
FFAA00
255,170,0
 
FFAA22
255,170,34
 
FFAA44
255,170,68
 
FFAA66
255,170,102
 
FFAA88
255,170,136
 
FFAAAA
255,170,170
 
FFAACC
255,170,204
 
FFAAEE
255,170,238
 
FFAAFF
255,170,255
 
FFCC00
255,204,0
 
FFCC22
255,204,34
 
FFCC44
255,204,68
 
FFCC66
255,204,102
 
FFCC88
255,204,136
 
FFCCAA
255,204,170
 
FFCCCC
255,204,204
 
FFCCEE
255,204,238
 
FFCCFF
255,204,255
 
FFEE00
255,238,0
 
FFEE22
255,238,34
 
FFEE44
255,238,68
 
FFEE66
255,238,102
 
FFEE88
255,238,136
 
FFEEAA
255,238,170
 
FFEECC
255,238,204
 
FFEEEE
255,238,238
 
FFEEFF
255,238,255
 
FFFF00
255,255,0
 
FFFF22
255,255,34
 
FFFF44
255,255,68
 
FFFF66
255,255,102
 
FFFF88
255,255,136
 
FFFFAA
255,255,170
 
FFFFCC
255,255,204
 
FFFFEE
255,255,238
 
FFFFFF
255,255,255




Java Server Page (JSP) script:



<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>

</head>
<body>
<%@ page import="java.util.ArrayList" %>
<%ArrayList<String> rgbHexKeys = new ArrayList<String>();
ArrayList<String> rgbKeys = new ArrayList<String>();

for (int i = 0; i < 256; i++) {
    if (i % 2 == 0 || i == 255) { // only allow even numbers and 255
        String unsignedHex = Integer.toHexString(i);
        if (unsignedHex.length() < 2) { // force all numbers to have two digits
            unsignedHex = "0" + unsignedHex;
        }
        if (!unsignedHex.substring(0, 1).equalsIgnoreCase(unsignedHex.substring(1, 2))) { // filter out non-twin digits
            continue;
        }
        rgbHexKeys.add(unsignedHex);
        rgbKeys.add("" + i);
    }
}

for (int i = 0; i < rgbHexKeys.size(); i++) {
    for (int j = 0; j < rgbHexKeys.size(); j++) {
        for (int k = 0; k < rgbHexKeys.size(); k++) { 
            String rgbHexValue = (rgbHexKeys.get(i) + rgbHexKeys.get(j) + rgbHexKeys.get(k)).toUpperCase();
            String rgbValue = (rgbKeys.get(i) + "," + rgbKeys.get(j) + "," + rgbKeys.get(k)).toUpperCase();%>
            <div style="float: left;width: 70px;border: 1px solid #999999;margin: 0 10px 10px 0;padding: 5px;font:x-small Trebuchet, Verdana, Sans-serif;">
                <div style="background: <%="#"+rgbHexValue%>; height: 50px;"> </div>
                <div style="text-align:center;"><%=rgbHexValue %></div>
                <div style="text-align:center;"><%=rgbValue%></div>
            </div><%
        }
    }
}%>
</body>
</html>


Download JSP file here.