Wednesday, November 3, 2010

Political Zen

To all my liberal friends: divided government is good. It encourages debate and compromise on issues that should not be decided along party lines.  There is a role for government but we cannot kill the private sector in order to redistribute wealth or grant government control to every sector of every life.  Ignore people who hate others or call them idiot's because they disagree with a point of view. These people are political poison. 

You are not the center of the nation.

To all my conservative friends: you did not take the senate due to purest ideology thrown behind less-than-electable candidates. There is a role for government in our lives to help others. We need your voice to help determine the most cost effective way to do that but to make a positive change you have to be open to change. Don't shut out liberal ideas just because a loud person on the radio or web says to.

You are not the center of the nation.

To the sane center: hold the new guys responsible for their actions. Make them return sanity to the national government through tactics used by the looney left and purest right. Pay attention. Get involved. Write emails. Try to tap down the fringe in either direction and disavow the talking heads and loud people.

Pay more attention to the body politic and listen to different view points but always use common sense about human nature to shape your decisions. Ignore numbers thrown at you by either side. They are lies wrapped in statistics. Use what you see around you to make your decisions.

If an elite takes a point of view, first ask yourself "what's in it for them." The political elites will use you to further their own ends. The media elites seek to influence you to make advertising dollars and exert a slightly twisted control over the political process.

DO NOT get caught up in a cult of personality. That leads to the suspension of critical thought and the shutting out of other view points.

When the presidential election comes around, cross party lines vote against the extreme elements of either party that seem to be doing well.

Thus endeth my political thought for the day.

Cheers,
Keith

Friday, May 28, 2010

Google And Linux

I am happy to report that Google now supports Linux for the Chrome browser. It was a painless install but I had to close Firefox in order for Chrome to import my settings.  Now I'm off to see if the Goggle Web Toolkit actually works with Linux now.

Sunday, May 9, 2010

JSF 1.2 – Eclipse 3.5.2 – JBOSS 5.1

My philosophy has always been "programming should be easy."  I confess that for me it always has been easy.  Picking up new languages isn't hard.  For me concepts flow and paradigms shift without much difficulty.  I use Eclipse as my IDE of choice due to the variety of languages I use.  With Eclipse I can quickly move back and forth between Perl, PHP, Groovy, Ruby, Java, C, SQL and HTML without ever leaving Eclipse.  I love it.

So enter my decision to take up Java Enterprise Web applications.  I've used Java for a number of years now so figured there wouldn't be that big a transition to JEE Web apps.  And while I still hope that is the case, my first attempt at getting a simple app up and running took far longer than it should have. 

First, a little background on the project: I've had this standard project I do in any new language or frame work which constructs a star sector 20 light years across.  Its a great object oriented exercise due to the implicit inheritances and mutation of the star systems, stars, planets, moons and asteroids. 

Since any good project starts with a good database design, I started on the database and Data Transfer Objects incorporating a DAO factory for the pattern.  All that went really well.

Once I had star systems generating properly, it was time to put up a web page to display the information.  It was then I hit molasses.

I settled on a JSF/Richfaces display layer utilizing JBOSS as the JEE container.  The boring details are JSF 1.2, JBOSS 5.1 and Eclipse 3.5.1. 

Rather than give you all the false starts, I'm going to detail what actually worked.  I'll leave the complaining for another blog. 

There really isn't any configuration required for Eclipse or JBOSS so after you've installed JBOSS and Eclipse, bring up Eclipse and switch to the JEE perspective.  Down at the bottom there will be a Servers tab.  Right click New and set up your JBOSS Server.

Next, go to File->New->Dynamic Web Project.  You'll need to give it a name like Eclipse35Jboss51JSF, select JBOSS 5.0 as the target runtime, Dynamic Web Module Version 2.5, and Configuration of JavaServer Faces 1.2.  (see screen below).  Click Finish to create the project.



Now comes the odd part for me.  I've just added the JSF libraries to my build
path but since JBOSS 5.1 has these included you now need to make sure they don't make it into your WAR.  Right click on the project name -> Properties -> Project Facets -> Java Server Faces and toggle the "Include libraries with this application" check box (see below)




Now go back to your project.  You'll be creating two files (index.html and index.jsp).

Right click on the WebContent folder->New->HTML.  For some reason the remains obscure, if you reference the faces file directly it doesn't work.  Its almost as though you need to give JBOSS a little time to compile the servlet. Mare your HTML file look something like this


<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Refresh" content= "0; URL=index.faces"/>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Starting Web App</title>
</head>
<body>
<p>The application will be with you shortly. :-)</p>

</body>
</html>

Basically you just add the redirect, change the title, and put a wee bit of content in the page.


Now create your jsf file named index.jsp.  WebContent->New->JSP


After filling in the file name hit NEXT>
Eclispe does some nice things for (and sometimes to) you.  In this case you can let it fill in the JSF tags for you.  On the next screen you'll get a list of templates.  Select the first one. (see below)


Now you can add some JSF content to your page.

You can add this code snippet between the and 





<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="f" uri="http://java.sun.com/jsf/core"%>
<%@ taglib prefix="h" uri="http://java.sun.com/jsf/html"%>
<!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=UTF-8">
<title>New Title</title>
</head>
<body>
<f:view>
<h:form id="searchForm">

<h:outputText id="ot1" value="Search Text: "/>
<h:inputText id="it1"/> <br />
<h:commandButton id="cb1" value="Go"/> <br />
<h:commandLink id="cl1" value="About Page"/>

</h:form>
</f:view>
</body>
</html>


Now save everything and deploy it to JBOSS by right clicking on the project name->Run As->Run On Server then selecting JBOSS 5.0 and finish.  If you did everything correctly you should get something like.



Good luck and let me know if it worked.

I'll be posting project updates as the weeks roll on.

Sunday, January 10, 2010

ADHD and Diet

More stuff from the New Ideas website.  I'm going to cut and paste the contents of an article on diet here for easy reference (and because you never know when I link will change).

http://newideas.net/adhd/adhd-diet


Finding Out if it is ADD ADHD or Food Allergies

What NOT to eat for TWO WEEKS: the first step in this ADHD Diet

First, let's find out if there are food allergies causing the ADHD symptoms or behaviors. Eliminate these foods for two weeks, then get ready to add them back in to the ADHD diet...
  • NO DAIRY PRODUCTS, especially cow's milk. This is the single most important restriction. The American Pediatric Association estimates that a significant percentage of all children are allergic to milk. Instead try Almond milk, Rice milk, or Better Than Milk. And drink lots of water instead of milk for two weeks.
  • NO YELLOW FOODS. Especially Corn or Squash. Bananas are white, but don't eat the peel. About 1/1000 people have problems with the stuff that makes these foods yellow in color.
  • NO JUNK FOODS. If it comes in a cellophane wrapper, don't eat it. Stop eating junk food and your brain will work better. Junk foods tend to be very high in sugars and carbohydrates, and our brains get fuzzy and our kids get more hyperactive when sugars and carbohydrates are eaten together.
  • NO FRUIT JUICES. They have too much sugar. One small glass of apple juice has the sugar content of eight apples. Later on you can have juice, but for now if you have to have any juice just dilute it with water 50/50.
  • CUT SUGAR INTAKE BY 90%. If you can, cut it down to zero. Sugar is in just about everything, but give it a try. Do your best to reduce your sugar intake without going crazy.
  • CUT CHOCOLATE BY 90%. No more than a single piece, once a week.
  • NO NUTRASWEET. None. Period. Never. It's bad for you. It is bad for your brain.
  • NO PROCESSED MEATS and NO MSG. Only get meats with labels that say, “Turkey and Water,” etc. If the meat has chemicals listed that you can't pronounce, don't buy it and don't eat it.
  • CUT FRIED FOODS BY 90%.
  • AVOID FOOD COLORINGS WHENEVER POSSIBLE. See if your child is sensitive to any particular colors, such as Reds, Yellows, etc. For now, though, avoid all if possible.
  • AVOID FISH. We hate to say this, as there used to be so many benefits to eating fish, especially the Essential Fatty Acids (EFAs) or Omega Oils. But the problem these days is that the mercury levels in most fish is simply too high to be either safe or healthy. Mercury is the second most toxic metal on earth, and is a terrible neuro-toxin. Until we clean up the oceans and the rivers of mercury, just don't eat it. Sorry.
SUMMARY: Just eat foods that God made for a while. Eat like people did in the 1940's, or the 1840's. Go to a used book store and get some good old cook books for recipe ideas. There really are about 10,000 meals that you CAN eat. Just not much in the way of “fast foods” or “convenience” foods.

After the First Two Weeks of the ADHD Diet

AFTER TWO WEEKS begin adding the restricted foods back into your diet, one food every other day. Eat A LOT of that food every day for four days. If you have a problem with one of the foods, you will see some kind of a “reaction” within four days. The reaction can vary from big red splotches on the body to ears turning bright red to explosive temper outbursts. If there's a problem, you'll know. If there's no problem, enjoy the food.