|
 Follow Me On Twitter

Check out Patti Hermes'
Hot Holiday Gifts Guide
Parents Help Your Kids Learn ABC's and Spelling
Premier learning tools help kids excel.
<%@ page import="java.net.*"%>
<%@ page import="java.io.*"%>
<%@ page import="javax.xml.parsers.DocumentBuilderFactory"%>
<%@ page import="javax.xml.parsers.ParserConfigurationException"%>
<%@ page import="org.xml.sax.SAXException"%>
<%@ page import="org.w3c.dom.*"%>
<%@ page import="java.util.*"%>
<%!
// The following code was graciously provided by Armond Avanes (http://www.armondavanes.com)
private String tla_ads( HttpServletRequest request, HttpServletResponse response ) throws IOException, ParserConfigurationException, SAXException
{
// Number of seconds before connection to XML times out
// (This can be left the way it is)
int CONNECTION_TIMEOUT = 10;
// Local file to store XML
// This file MUST be writable by web server
// You should create a blank file and CHMOD it to 666
String LOCAL_XML_FILENAME = "local_333572.xml";
String INVENTORY_KEY = "4CS3W5HUYUMH32CAIFYR";
File localXmlFile = new File( getServletConfig().getServletContext().getRealPath(LOCAL_XML_FILENAME ) );
if( !localXmlFile.exists() ) {
return( "Script error: " + localXmlFile.getName() + " does not exist. Please create a blank file named " + localXmlFile.getName() + "." );
}
if( !localXmlFile.canWrite() ) {
return( "Script error: " + localXmlFile.getName() + " is not writable. Please set write permissions on " + localXmlFile.getName() + "." );
}
if( localXmlFile.lastModified()<(new Date().getTime() - 3600*1000) || localXmlFile.length()<20 ) {
String request_uri = (request.getRequestURI()!=null) ? request.getRequestURI() : "";
String user_agent = (request.getHeader("User-Agent")!=null) ? request.getHeader("User-Agent") : "";
URL url = new URL("http://www.text-link-ads.com/xml.php?inventory_key=" + INVENTORY_KEY + "&referer=" + response.encodeURL( request_uri ) + "&user_agent=" + response.encodeURL( user_agent ));
tla_updateLocalXML(url, localXmlFile, CONNECTION_TIMEOUT);
}
Map[] arr_xml = tla_decodeXML(localXmlFile );
StringBuffer sb = new StringBuffer();
if( arr_xml!=null && arr_xml.length>0 ) {
sb.append( "\n\n" );
for( int i=0; i" );
sb.append( map.get("BeforeText") );
sb.append( " " + map.get("Text") + " " );
sb.append( map.get("AfterText") + "\n" );
}
sb.append(" ");
}
return sb.toString();
}
private void tla_updateLocalXML(URL url, File file, int time_out) throws IOException
{
file.setLastModified( new Date().getTime() );
String xml = file_get_contents_tla(url, time_out);
if( xml!=null && !xml.trim().equals("") ) {
FileWriter fw = new FileWriter(file);
fw.write( xml );
fw.close();
}
}
private String file_get_contents_tla(URL url, int time_out) throws IOException
{
URLConnection urlConnection = url.openConnection();
//urlConnection.setConnectTimeout( time_out * 1000 );
//urlConnection.setReadTimeout( time_out * 1000 );
InputStream is = urlConnection.getInputStream();
StringBuffer content = new StringBuffer();
int ch;
while( (ch=is.read())!=-1 )
content.append( (char)ch );
is.close();
return content.toString();
}
private Map[] tla_decodeXML(File file) throws ParserConfigurationException, IOException, SAXException
{
Document dom = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse( file );
Node linksRoot = dom.getFirstChild();
NodeList links = linksRoot.getChildNodes();
List result = new ArrayList();
for( int i=0; i
<%= tla_ads(request, response) %>
|
Parent to Parent
After the Election, Time to Make Nice
by Patti Hermes
November 4th is Election Day. So go out there, teach your children some lessons in civic responsibility, and vote for your candidates. Once you've voted, once we've all voted and the votes are counted, it's out of our hands. So what's next?
Whether we like it or not, we're stuck with whoever wins, whether it's our candidate or not, right? So then it's time to let it go and just live with the results. That's what it means to be an American. Whatever the outcome, we have to make do, for better or worse.
So, did you have any nasty family arguments over this year's candidates? Instead of gloating (or sulking, whatever the case may be), now is the time to make up. Particularly, if you're planning on sharing Thanksgiving Dinner with any political foes, it's a good time to just make nice and get on with our lives. Every election has winners and losers, but family relationships should not be allowed to fall into the L column.
It seems that the 2008 election has been one of the most divisive, nationally. But then again, so did the last one, and the one before that, and the one before that … etc. They all get pretty contentious; after all, the stakes are pretty high.
But over the next few weeks, it is a good time to dig deep into the well of good will toward our fellow man. Show your children that politics is only a slice of our lives. Sometimes, when things get out of hand, we need to go back to our old friends, our neighbors and the crazy part of our family and make amends. And accepting the results gracefully, whatever happens, shows our children how mature we can be when we need to.
I belong to a couple of homeschooling groups, in which we hold wildly opposing views, politically. Yet, we share the common goal of wanting to educate our children about the election process. So while some parents prefer to cover the subject with families that share their views, and some keep to themselves, one group leader proposed to cover it in detail, in a large group, but in the guise of electing the Best Local Park. Certainly a subject we don't all agree on, yet it is not likely to cause any heated debate. While keeping to somewhat neutral subjects, and a lot of local history, we avoid any potential arguments, and the kids all get to play together, too.
For us, this election season has been about making friends, not enemies. They're easier to live with in the long run.
Comment Script
Comments
This comment form is powered by GentleSource Comment Script. It can be included in PHP or HTML files and allows visitors to leave comments on the website.
|
|
| Patti Hermes is a freelance writer and columnist, specializing in family and parenting subjects and works for children, as well as essays and a blog, Writes For Chocolate. She works at home where she referees two spirited little boys and occasionally their father. Originally from Massachusetts, she and her husband of eighteen years are now raising their happy family in the Midwest. To read more visit her on the web at
http://writesforchocolate.blogspot.com
|