Quote

"For like a shaft, clear and cold, the thought pierced him that in the end the Shadow was only a small and passing thing: there was light and high beauty for ever beyond its reach." -- J.R.R. Tolkien

Sunday, February 23, 2014

Cast Java Map to ConcurrentMap

I couldn't find a quick and easy example of this on Google, so here you go:

Using Google Guava:

Map<String, String> map;
ConcurrentMap<String, String> ccMap = new MapMaker().weakKeys().weakValues().makeMap();
ccMap.putAll(map);

Saturday, February 15, 2014

Simple & Stupid Logger for Java

Since I cannot find a logger easy enough for me to use, I made one.

The jar file is here: linky

This logger is thread safe.

Example usage in a servlet:

package com.logtest;

import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.ServletConfig;
import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import log4andrew.Logger;
import log4andrew.LogLevel;

/**
 * Servlet implementation class Test
 */
@WebServlet("/Test")
public class Test extends HttpServlet {
    private static final long serialVersionUID = 1L;
    private static String filePath = "";
    private static String fileName = "";
    Logger fLogger = null;
    final static String FS = File.seperator;
    /**
     * @see HttpServlet#HttpServlet()
     */
    public Test() {
        super();
    }
   
    @Override
    public void init(ServletConfig config){
        ServletContext scxt = config.getServletContext();
        filePath = scxt.getRealPath("WEB-INF") + FS + "logs" + FS;
        fileName = "servletTest";
        fLogger = new Logger(filePath, fileName, LogLevel.INFO);
    }

    /**
     * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
     */
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        PrintWriter out = response.getWriter();
        out.println("file location: " + filePath + fileName);
        fLogger.critical("some message");
        out.println("debug message logged");
    }

    /**
     * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
     */
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        doGet(request, response);
    }

}

Saturday, January 4, 2014

The Most Damaging President Ever

I found an article on the site RealClearPolitics.com, which describes in somewhat gory detail the damage that President Barack Obama has done to our nation.  Sadly, the damage is not constrained to merely domestic policy.

In his social justice crusade, he has managed to put more people on government assistance than any other time in the history of our nation, destroying human, intellectual, and operational capital that our nation requires to remain competitive on the global stage.  In his over-zealousness for remaking America in his image, he has dragged the credibility of his office and our nation through the mud with every nation of importance in the world.  With blind fervor, Obama has overturned principles of integrity in leadership that have stood, more or less, since the dawn of human civilization.

I am doubtful whether America will be able to recover from the damage that he has done, particularly since a sizable portion of our nation still rallies around the call to crusade: "In Obama we trust."


Sunday, December 15, 2013

How to ask questions on the Internet

I found an excellent site that serves as a remind to all who operate on the Internet.

How to ask questions the smart way:
http://www.catb.org/~esr/faqs/smart-questions.html

It is a good reminder for myself, as well as anyone else who seeks to interact intelligently.

Tuesday, December 10, 2013

Stripped-down Version of Glass-Steagall

Today, a stripped-down version of the Glass-Steagall Act was put back in place today, 5 years after the financial world nearly brought our nation to the brink of collapse.  While, not an ideal solution, having a holey parachute is better than none at all.  Just hope to God that the regulating agencies are able to maintain intelligent and hawkish regulators indefinitely, otherwise the "Volker Rule" is going to hell in a handbasket.

Saturday, November 30, 2013

Arsonists Running the Fire Brigade


This article is a superb explanation of some of the structural problems facing our economy today, exasperated by foolish and corrupt Central Bankers and driven by greedy bastards on Wall Street.

The current trends, which are strongly reinforced by the honorless sociopolitical culture that has completely pervaded modern Western society, are going to result in nothing less than the utter and complete implosion of our financial, political and social systems.


As this quote in the article below states: "People who have made retirement plans based on past return assumptions will not be happy. Does anyone truly understand the implications of making the world's reserve currency a carry-trade currency for an extended period of time? I can see how this is good for bankers and the financial industry, and any intelligent investor will try to take advantage of it; but dear gods, the distortions in the economic landscape are mind-boggling."


The Dodd-Frank legislation needs to be disposed of and replaced with the Glass-Steagall Act from 1933.  Anything less will mean the total collapse of the world financial markets under the corruption of government and the greed of the captains of the financial sectors.

The PDF to the original article is here: http://d21uq3hx4esec9.cloudfront.net/uploads/pdf/131130_TFTF2.pdf

Edited: 2015-10-23 to fix 1937 to 1933 for passage of GS Act.


Saturday, November 2, 2013

Character Encoding

I found an incredibly entertaining article regarding the development and use of character encoding sets.  I am going to paste it below in case this fellow ever decides to quit hosting his website.

Original article: http://www.joelonsoftware.com/articles/Unicode.html
 

Tuesday, October 29, 2013

The Girl Who Did Not Age

I just learned today of the death of the girl who did not age.  The girl Brooke Greenberg was born prematurely and grew to the age of five years old when she simply stopped growing.  I am not sure what to think of this mystery, for it is a mystery.  She had many scientists jumping to study her in hopes of finding a 'fountain of youth' in her genes, and perhaps they will.  I am not sure if that is something that we will ever be able to master though.  Hopefully, we can find a way to cure this incredibly curious Syndrome X, since ageless existence does not appear to last long.

http://shine.yahoo.com/parenting/toddler-20-years-old-forever-young-due-baffling-175300753.html

Sunday, October 13, 2013

Failure: The Secret of Success

I am going to have to let this article speak for itself.  Tony Bruins would be proud.  You are not the only one, Tony!


Scott Adams' Secret of Success: Failure

    By SCOTT ADAMS
If you're already as successful as you want to be, both personally and professionally, congratulations! Here's the not-so-good news: All you are likely to get from this article is a semientertaining tale about a guy who failed his way to success. But you might also notice some familiar patterns in my story that will give you confirmation (or confirmation bias) that your own success wasn't entirely luck.
If you're just starting your journey toward success—however you define it—or you're wondering what you've been doing wrong until now, you might find some novel ideas here. Maybe the combination of what you know plus what I think I know will be enough to keep you out of the wood chipper.

Saturday, October 12, 2013

Why the United States of America cannot default

With everyone on every side shouting about a sovereign default of the U.S., the simple fact of the matter is that the U.S. cannot default in the traditional sense.  So long as we have a lenient and accommodative Federal Reserve Bank that is willing to print money.  The only thing holding them back are self-imposed rules against money printing.


As David Kotok puts it in his piece "Moving Chess Pieces:"
In our view the US will not default. It has an absolute ability to pay. This is a political fight, not an economic one. The credit of the US is not the same as Detroit’s or economically risky like Puerto Rico’s. The country is not dismembering like Argentina or unable to support budgets like Greece. Comparisons between the US and these others are not valid.
Or as Cullen Roche, author of the paper "Understanding the Modern Monetary System", says:
Let’s get this straight.  The United States government CANNOT default on its obligations without some sort of mental lapse from Congress (the trade here, short sovereign US CDS every time it spikes).  The government is the supplier of the sovereign currency.  The government is a currency issuer & carries NO foreign currency denominated debt.  If they have fiscal problems they simply print more.  They press a button on a computer and magic money appears in an account.  That’s literally how it works.    The US government is not a household or a state.  They are not Greece who does not print their own currency.  It’s ENTIRELY different.
Read more at http://pragcap.com/us-default#TsIDCWSgHQpGHsK0.99
 Let’s get this straight.  The United States government CANNOT default on its obligations without some sort of mental lapse from Congress (the trade here, short sovereign US CDS every time it spikes).  The government is the supplier of the sovereign currency.  The government is a currency issuer & carries NO foreign currency denominated debt.  If they have fiscal problems they simply print more.  They press a button on a computer and magic money appears in an account.  That’s literally how it works.    The US government is not a household or a state.  They are not Greece who does not print their own currency.  It’s ENTIRELY different.
Or as Alan Greenspan has said in the past to Congress and other media outlets:
The United States can pay any debt it has because we can always print money to do that. So there is zero probability of default.

And given the recent history of the Federal Reserve's willingness to print money to the tune of $85 billion per month, I say there is zero chance that the Fed will let the U.S. government default, regardless of what the yahoos in Congress do or not do.
Let’s get this straight.  The United States government CANNOT default on its obligations without some sort of mental lapse from Congress (the trade here, short sovereign US CDS every time it spikes).  The government is the supplier of the sovereign currency.  The government is a currency issuer & carries NO foreign currency denominated debt.  If they have fiscal problems they simply print more.  They press a button on a computer and magic money appears in an account.  That’s literally how it works.    The US government is not a household or a state.  They are not Greece who does not print their own currency.  It’s ENTIRELY different.
Read more at http://pragcap.com/us-default#TsIDCWSgHQpGHsK0.99
Let’s get this straight.  The United States government CANNOT default on its obligations without some sort of mental lapse from Congress (the trade here, short sovereign US CDS every time it spikes).  The government is the supplier of the sovereign currency.  The government is a currency issuer & carries NO foreign currency denominated debt.  If they have fiscal problems they simply print more.  They press a button on a computer and magic money appears in an account.  That’s literally how it works.    The US government is not a household or a state.  They are not Greece who does not print their own currency.  It’s ENTIRELY different.
Read more at http://pragcap.com/us-default#TsIDCWSgHQpGHsK0.99

Thursday, October 10, 2013

Deplorable Behavior from the National Park Service

I have to repost this, as it is a perfect example of the kind of political debauchery that the Obama administration is engaged in.  It is shameful and makes a mockery of our nation, much like his Presidency.


Tuesday, September 24, 2013

The U.S.-Europe Relationship

George Friedman of Stratfor always comes up with curious and seemingly truthful articles.  This one is no different and very much aligns with what I have experienced in our nation's relationship with Europe.  I don't think I have too many Europeans that read this blog, but it would be curious to see if their honest opinion matches this article.

Probably one of the more telling sections is at the end:

Whenever I visit Europe -- and I was born in Europe -- I am struck by how profoundly different the two places are. I am also struck at how the United States is disliked and held in contempt by Europeans. I am also struck at how little Americans notice or care.
There is talk of the transatlantic relationship. It is not gone, nor even frayed. Europeans come to the United States and Americans go to Europe and both take pleasure in the other. But the connection is thin. Where once we made wars together, we now take vacations. It is hard to build a Syria policy on that framework, let alone a North Atlantic strategy.
I very much agree that Europe is weak, despite their own opinions of themselves, and they are therefore largely irrelevant on the world stage.  The history of our world seems to be coming down to this: a showdown between Islamists and the U.S.

I hope we come out on top of this struggle.