Site MapJava

If you have Cookies enabled,
you can check to see if any files you have downloaded
have been updated since you downloaded them
by clicking here.



A collection of succinct Java and JavaScript code examples,
all free, beautiful and potentially gold-dust!

My intention is to provide simple, free access to useable solutions to common but difficult programming problems.

I have treated the creation of each class as a puzzle and hopefully have evolved good solutions.

If you know any better solutions then please e-mail me so that everyone can share your wisdom!

A good place to start is the Site Map

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Content Expansion

Generally when you click a link you are taken to a new Web page, but if the amount of information the link refers to is small that is distracting and unnecessary.
When documenting the installation of some software for my work, I realised that it would be valuable to print out a page with only certain sections of the whole text visible.
The principle is the same as fold-editors or 'outlining' documents use.
I developed a little script and style to show and hide content in a similar way to file and folder tree's work when you expand a folder.
Its hard to know how to descibe this principle, so the best way must be by example.

So this is an example of the script in use. You can get the source for this behaviour from the web:
Browse http://RossM.net and go to the Java section.
There should be a menu in the top left with 'Java' as one of the entries.
If not, try clicking the arrow in the bar at the top of the page which takes you to the Site Map and search for 'Java' there.
Go to the 'Expanding Text' section of the Java page, and check that the example is still on this page (if not follow any new link to the example).
Right-click the page and 'View Source' to get the Java Script for the example:
Look in the '<head>' section at the top of the page source code. You want the '<style>' and '<script>' sections.
Paste and edit the '<style>', '<script>' and example '<div>' sections to your new file and edit them to suit.

You can see how clicking the word "Web" opens up text which describes where to get the files from.
You can select how much text you need to be printed.
If you have any other '<div>' sections in your page, you will need to give these ones a 'class'.
Your divs now have a class <div id="Script" class="fold">
and the div style now uses div.fold instead of just div:
  <style>
       div.fold {display:none; margin:0 0 4px 4px; padding:0 0 2px 4px; border: 2px solid #888; border-top:none; border-right:none; -moz-border-radius-bottomleft:1em;}
  </style>

RC4 Encryption

Heres a little function to help you encrypt strings.
The Encode and Decode are performed by the same function.
The file is a working example, you only need the RC4 function in your own pages.
You can run this code by clicking here.


If anyone thinks its worth me maintaining or updating any of the above, please e-mail me.