Toms Online Notebook Sharing my stuff.

Entries tagged [java]

Creating a JAR file with only the classes needed

by tgutwin


Posted on Sunday Jan 29, 2017 at 01:46PM in Programming


CupOfJava.jpgHave you ever wanted to create a JAR file for your Java class but only wanted to collect and jar the class files required by your class?
I found a very useful class to do this for you:
It is called: ZipLock written by Stuart D. Gathman at his company Business Management Systems.

Direct link to Original ZipLock.java file.
Its perfectly simple and OpenSource!  Thanks Stuart.

I also wrote a simple bash script below to wrap the calling of the java class...

Read More

LedNet Proxy

by tgutwin


Posted on Sunday Dec 18, 2016 at 06:40PM in Programming


LedNet-5Wire.jpgI want to control a LED light Strip with the 5 channel (rgbw) LEDNet controller that I bought.  I want to use my own software. Thankfully others have figured out the IP messaging packet, so I wrote my own little app that lets me program/control a Strip of RGBw LEDs.

The ultimate intent is to be able to control it using My UDI ISY-994 home controller.

Its all do-able.

Read More

Zip Download Servlet

by tgutwin


Posted on Sunday Oct 16, 2016 at 12:33PM in Programming


Java LogoI needed a simple Java Servlet to zip a directory of files (or a single file) with parameters to dynamically specify what to zip up.

It does NOT create a temp file; it zips and streams the output directly to the client.
its called ZipFiles.

Here it is...

Read More

Raspberry Pi2 Pi4J Java - RGB LED Example

by tgutwin


Posted on Tuesday Jan 26, 2016 at 08:41PM in Technology


Pi4J IconI have started to get some useful sample/examples completed on my Raspberry Pi2. Here is the Schematic and Java code to control an RGB LED.

I also have examples for:

  • controlling multiple GPIO pins with external transistor driven LEDs and Java Pi4J code that times their cycling.
  • Pulse Width Modulation (PWM) control of GPIO pins and an RGP LED.

 These will be discussed in other posts.

Read More

My New Raspberry Pi2 running Fedora 21 with Full JAVA JDK

by tgutwin


Posted on Tuesday Jan 26, 2016 at 08:23PM in Technology


Raspberry IconI Got a Raspberry Pi2 ! It has a 900MHz quad-core ARM Cortex-A7 CPU  and 1GB RAM.

I first tried noobs with Debian and it ran out of the noobs box very well.  The noobs version of Fedora DID NOT because it was not built for the new version of the ARM processor in the Pi2. That was no big deal because thanks to user clivem on the Pi Forums an image was avaialble.  See the forum link for the details. It is a full F21 version that is called FIDORA.

It was very easy to get this working. It is Fedora 21 for the ARM, with full yum repo support including rpmFusion.

Read More

My WebAPP/Archiver for Rainforest Eagle Messages

by tgutwin


Posted on Monday Jan 25, 2016 at 06:29PM in Technology


Announcing PowerEYE, your own WebAPP to access & archive your Rainforest Eagle power meter data (privately) to your own computer.

http://powereye.webarts.ca

  • Do you have a new smart meter from your power utility?
  • Do you also have a Rainforest Eagle energy access gateway device to that talks to your meter and collects your power & energy usage data?
  • Do you also want more infomation from your Eagle or have concerns about the privacy of sending your data over the internet just to see some detailed usage charts or download your data?
  • Do you also have a UDI ISY-994 home controller that you want to control or send the Rainforest Eagle messages to?

Then this might be of interest to you...

Read More

Java Changed security permission for DERBY network socket

by tgutwin


Posted on Monday Jan 25, 2016 at 06:25PM in Technology


I just realized that my Apache Derby database had stopped listening on its DB port 1527.Apache Derby


It took a bit of tracing but soon found
that a Java runtime policy had changed to be more restrictive than
before. It now restricts java apps to create and listen to IP ports by
default.


The FIX:
add the follwoing to the end of the java.policy file in the jre\lib\security dir


grant {
permission java.net.SocketPermission "localhost:1527", "listen";
};


Thats it. the derby network server now starts as usual.


Installing Apache Roller in Jetty 9

by tgutwin


Posted on Sunday Jan 24, 2016 at 05:15PM in Technology


jettyIcon.pngsteamroller5.jpgI have been using Google for my Web Based notebook Blog for a few years, however, it did not have all the features I wanted to use; like commenting and a tag cloud. SO, I installed my own weblog software - Apache Roller. I also looked at WordPress, but I wanted a Java only solution. You are looking at it right now. This is how I got it running on Jetty.

I am going to point out how easy it was to install in a simple Java Servlet engine like Jetty, without a full Application Server. The Roller instal docs say that all it needs is a servlet engine, but then it goes on to only have examples for installing in full J2EE Application Servers (JBOSS, Tomcat, Websphere).

I use Jetty 9 on its own, without a full App server, and it was very easy to get going. My production DB is MariaDB (mySql) on Fedora 23.

Read More