/home/jeff/blog

Sucking away valuable moments of your life ...

J2EE and “sane” Application Deployment

| Comments

As I have been delving deeper into the J2EE Servlet specification during the rewrite of REMITT, I have been learning some very interesting, and sometimes very painful, lessons about trying to package something without requiring complicated installations.

To get authentication working in Tomcat, the normal way is to define a Context and Realm in TOMCAT_HOME/conf/server.xml. A relatively undocumented file called META-INF/context.xml allows fragments to be distributed with war files. This would be a great solution if it didn’t mean that authentication was now deeply dependent on editing a file in the web archive, which kind of takes the advantage completely out of having one. D’oh!

Next up was the idea of using JAAS, which is a way of setting all of the security information in a single configuration file, and using a custom security module. Which would work very well, if I wanted to pre-extract the war file and pass an archaic system property file through JAVA_OPTS. This seems, again, too difficult to make any sort of sense.

I eventually found a solution by creating my own Filter and LoginModule, then setting the system property for the JAAS configuration manually in the init() portion of the Filter. A little filter and realm information in WEB-INF/web.xml, and everything seems to work somehow. I understand that the Servlet guys wanted to make sure that the J2EE server context and app context were at two different levels (hence the reason a DataSource in META-INF/context.xml or tomcat’s conf/server.xml isn’t writeable at all), but it makes it a mess for clean deployment.

As it stands now, I can run the server with an override file like like:
JAVA_OPTS="-Dproperties=/my/remitt.properties" ./bin/catalina.sh start

And I think that’s worth the hassle to set up, since it makes deployment a breeze.

Rich People

| Comments

I think one of the biggest things that keeps America from moving forward is the intellecually bankrupt notion that people exist independently of one another, and that each person is independently financially responsible for their entire life. It’s a horrible concept, which was promulgated, at least in part, by Ayn Rand and her followers. I quote:

  • In answer to the question: “If a morality is not based on the common good, what is it then based on?”: on a definition of the moral individual and on that which is good for him. The moral individual is the best and highest possible to man. By what standard? By the essence of man’s nature. The man living in accordance with his nature is the moral man and the “surviving” man — he carries the life force, the life principle, he is the self-renewing “energy” and the fountainhead. What is man’s nature? Man is a reasoning being.

And since morality is a matter of free will, open to all but the insane — the good of the moral man is good for all, i.e., for all those who wish to be moral.

What is good? That which is in accordance with the life principle of man. The independent, the self-reverent, the self-sufficient.

Do I set myself up as an arbitrary elite and formulate a morality for my own kind of elite, at the expense of others? No, because it is not to be enforced upon “others” or anyone. “Others” are free not to accept it and not to subscribe to it; they may have their own kind of collectivism, altruism or whatever they wish. But they are not free to enforce it upon me and my “elite” — they are not free to arrange their collectivism at our expense. The objective dividing line is: no man exists for the sake of another man. […]

This point — no man exists for the sake of another man — must be established very early in my system. It is one of the main cornerstones — and perhaps even the basic axiom.

Quoted from the Journals of Ayn Rand

Where do I start with where this goes wrong? I guess I could start with “What is good? That which is in accordance with the life principal of man. The independent, the self-reverent, the self-sufficient.” It’s a very narcissistic point of view, assuming that people exist solely for themselves. Wikipedia refers to a community as a “group that is organized around common values and social cohesion within a shared geographical location, generally in social units larger than a household”. Common values and social cohesion infer interdependencies between the persons involved, ostensibly in the aspiration toward a higher common good. Whereas no person exists solely for the sake of another person, a web of interdependency links all of us, and what is good for one person in particlar is rarely good for society in general.

Now we can move on to the rich, or the “parasite class”. I tend to think of money as a claim on human labor, as per Chris Martenson. The issue with the incredible wage disparity that we see in our system of “pure capitalism” (which is quite debatable, as we have been injecting public funds for private gain as of late), is that the labors of the highest paid echelon of society could not possibly be justified over the laborers of the lowest.

Lawyers, for example, have no cap on the amount of money they can charge (I prefer to use the more fitting word “extort”) their clients, mainly because they not only control rich and powerful lobbys, but also because the majority of lawmakers are lawyers. You not only can’t trust rich people to regulate crookery, you really can’t trust people to regulate themselves. I swear, it really doesn’t work. I’m sure that for the lawyer involved in a case, charging 500 dollars an hour seems like it makes a great deal of sense from a personal standpoint, as he or she can advance their lifestyle through the acquisition of enormous piles of cash-money, but society as a whole does not benefit from this behavior. For example, people filing for bankruptcy generally don’t have a few thousand dollars laying around to hand to some lawyer who is just going to have his lowly paralegal do the majority of the work, then bill it at his normal rate. Did I forget to mention that profit-sharing of legal fees with non-bar certified professionals (non-lawyers) isn’t legal, as the lawyers in Congress have written laws to ensure that? Must be nice to make your own rules…

Back to individualism, and why it’s such a crock. The majority of the services that an average American uses during the day are in some way, shape or form at least somewhat community owned or controlled. Roads and sewers are owned and operated by the communities in which they are located. Police, fire and ambulance servers are, in all but the most far-fetched cases, owned and operated by municipalities. Public power infrastructure is maintained by states and to a lesser degree municipalities. Healthcare over a certain age, at least in theory, is spread out over the community as a whole, as a way of supporting our elderly citizens.

Calling all of this “socialism” is probably right. The greater issue is “what is wrong with socialism?” The answer lies in the inability for a small percentage (which would otherwise be a statistical anomaly) of people to claw their way into an utterly lavish lifestyle by using the labor of less fortunate (or most likely, more scrupulous) people to get there.

Then there is the moral premise of the entire Randian argument — whatever is good for you, is obviously better than what is good for everyone, because you’re more important than everyone else. People who are rich generally get that way by making profit on some sort of labor or time investment (discounting the parasite “investor class”, which makes money solely by leveraging existing money in a corrupt system which leans towards investment over labor). The issue with that is that draining an inordinate amount of money out of the economy as a whole, for the sole purpose of greed and self-aggrandizement, is detrimental to the people who are actually performing the labor and consuming the services in question. A healthy income can still be derived from personal labors without the upward motion of wealth from the actual laborers working underneath the person or people in question. Therefore, being rich implies being greedy.

When I say “rich”, I don’t mean those people who have gone to school for ten years to get a degree and earn 100,000 dollars a year or more. I mean the people who are dragging in 200,000 or even 500,000 dollars a year. I can’t conscionably see how anyone can produce labor that is worth that kind of money (at least in 2009 dollars).

The bottom line is that rich people are different from pretty much everyone else. Hoping you’re going to be the asshole on top raining golden showers of delight on the happy plebes below is a terrible reason to push destructive policies and strip back social measures designed to keep people safe and healthy. Taxing the rich at a higher percentage isn’t unfair, it’s just evening the playing field, restoring community “wealth” back to the community and the people who actually produced the wealth. Go socialism?

Rewriting REMITT, the J2EE Way

| Comments

For those people who are unfamiliar with my programming ventures, I had written a three stage extensible billing system a few years back called REMITT (which stands for REMITT Electronic Medical Information Translation and Transmission). I had created the majority of the code in about a week and the XSL transforms required for it to function in another two weeks or so.

Since then, the project has been somewhat languishing, due to it being written in Perl, which is a minor pain to get running for most people on a good day, compounded with it using XML-RPC with sessions as a remote procedural call dialect.

I decided to embark on a complete rewrite of the core of REMITT to make it more portable, more extensible, better designed and far more stable than it had been in past. I have gotten about 3/4 of the way through rewriting the core of REMITT as a J2EE application using MySQL as a database backend. There are a number of improvements I have been working on, including:

  1. True crossplatform nature. – Being J2EE, you can even run it on *shudder* Windows if you felt the need to. I wouldn’t recommend it, but you could do it.
  2. Better threading model. – Instead of a single executor thread pool, each stage of transformation gets its own pool, maintained and reaped by a single control thread. As Java has a very nice threading model, this was much easier than I had anticipated.
  3. Transport scripting. – Instead of requiring heavy-duty programming expertise to write transport plugins, I moved to using Rhino do do embedded Javascript scripting for them, as well as allowing SFTP transport.
  4. Namespaced configuration. – Each user can have their own configuration *per* plugin, which is a lot easier than before. It also has the ability for each plugin to present its configuration options to a frontend, so there’s no more worrying about configuration variable names.
  5. SOAP. – I’m using CXF for web services, and it took me all of a second to generate a proxy class using wsdl2php which worked perfectly the first time around.
  6. Web Interface. – Through the magic of JSP, the REMITT server has its own set of administration pages and monitoring functions, so it’s not quite as much of a black box as before.
  7. IDE Support. – Eclipse is a beautiful IDE, and with Javadoc completion support, makes anything I could have used with Perl look like crap. ‘Nuff said.
  8. OO Model. – Perl OO is to Java OO as a Pinto is to a Tesla Roadster. This thing actually has some architecture behind it. It’s about time.

I’ll be posting the code into REMITT’s SVN trunk shortly, as soon as I’m positive that it does *something* in case anyone else feels the need to work on it. In the meantime, I’ll continue to play with it until I get something useful out of it.

Sharecropping

| Comments

I was flipping through radio stations on my way to one of the colocation centers I have to visit for work, and chanced upon a Worcester-area right wing talk radio station. I got fed up about 60 seconds into the broadcast, listening to a man with very poor English asking why the government wants to take small business’s hard earned money away from them and give it to people who don’t deserve it.

Randian masturbation aside, it made me a little angry to hear. I think some of it has to do with the notion that some people “deserve” well paying jobs (and the intellectually bankrupt notion that everyone could have well paying jobs if only they weren’t so not white and lazy). “Why does the government want to force me to pay for poor people to see the doctor,” these people ask, “when it costs us so much money?”

Then I remember that Americans pay the people who do the actual work very little. Minimum wage in the United States is being raised to 7.25 this month. This effectively means that a day laborer earning minimum wage can look forward to a fat paycheck of 290 dollars a week before taxes, and about 15,000 dollars a year, also before taxes. That’s a monthly gross income of 1,160 dollars. How exactly are these people, who are the “cogs” who push production in this country, supposed to afford anything? Our growing wage disparity isn’t exactly helping, as the money which would be going to allow equitable pay and healthcare for workers is padding executive level bonuses.

Again, we see the spectre of forced capitalism rising above the common sense of single payer (or at least somewhat publically funded and run) healthcare. The same small business owners who are kvetching and crying about how they will have to fund healthcare, would effectively be paying the same or more likely *less* money, as government run healthcare would have substantially lower administrative costs. The crusty top of the US income earners, who suck in millions (if not billions) without actually *producing* anything would have to pay a greater share, to compensate for the gigantic overabundance of money they have siphoned out of our financial system over the last thirty or forty years or so of reduced regulation and non-existant watchdogging.

Then I thought of sharecropping. You get the ability to eek out a living from someone who actually *owns* things, but you never own anything. You rent your house, you lease a car (if your credit is any good), and you never really are able to afford much. If you are lucky enough to get married, your kids are either looked after by family or grow up as latch-key kids so that you can afford to buy them food and clothes. Which part of this sounds like the America espoused in all of those flag-waving campaign-time commercials? If we actually treated our people well and paid them an actual living wage, socialized the healthcare and benefits systems, and put some (oh noes! not teh capitalism!) caps on executive pay, we’d probably be better off.

But I know how this goes — we’ll hem and haw about everything, Congress will pass a meaningless law giving subsidies to insurance companies, and we’ll all get sicker and die poorer. Yay pure capitalism!

(Upon a bit more reading, I think that tenant farming might be a little more apropos for a comparison, since it involves forced evictions.)

Mortgaging Our Lives for Money

| Comments

“Everybody here sells his time for money. It’s like taking a mortgage against your life.” – Dr Dick Solomon (3rd Rock from the Sun, “I Enjoy Being A Dick”)

Although the quote “the love of money is the root of all kinds of evil” is an oft-malighed, often quoted Biblical “New Testament” passage which is used by quite a few bible-thumping born-agains, I started thinking about the reason why money would be such a powerful motivating force.

A quick search on “money” comes up with a history on how money is to be exchanged for goods and services. Chris Martenson’s “Crash Course” says that money is a claim on human labor. We can then infer that human labor is indirectly exchanged for goods and services, but know from experience that the value of peoples’ labor varies greatly, even among the people in a single country. It can then be deduced that the value of all peoples’ labor, and therefore time, is not equal.

Is it not exceedingly possible that money is an indicator that your time is more valuable than your neighbor’s time? Is it not also possible that it implies that your *life* is more valuable?

This is the prevailing sentiment in our Capitalist society, which places a greater emphasis on the acquisition of money than the health and welfare of its own people, usually by arguing that the government *they* elected can’t work properly because it’s full of the incompetant people *they* elected, and that in the face of every feasability and critical analysis, that the “free market will solve everything”. And I quote: “Just because Americans are uninsured doesn’t mean they can’t receive health care; nonprofits and government-run hospitals provide services to those who don’t have insurance, and it is illegal to refuse emergency medical service because of a lack of insurance.” (from the previous link) Apparently people who have less money than you are perfectly entitled … to clog up emergency services rather than being able to seek preventative medicine, which is far more of a solution than creating clusterfucks in emergency rooms, not strictly for saving money, but for keeping people off gurneys.

Getting back to the point… is one person more valuable than another based solely on their earning potential? I seriously doubt that the CEO of Bear Stearns, who destroyed the equivalent of millions of hours of human labor, is somehow a more valuable human being than a bricklayer who works for an hourly paycheck, yet we place far more importance on the CEO by compensating his time with more equivalent labor.

And “European Socialism” is *so* horrible…

Performance Bonuses

| Comments

I think that after reading things like this about taxpayer outrage at executive level bankers raking in performance bonuses for apparently tanking the world financial system, I’m starting to think that we’re wrong about the outrage.

Not that we shouldn’t be outraged about funnelling money to jackholes who buy and sell people like me during lunch … more that they really should get performance bonuses if it’s based on *performance*.

Look at what they’ve done: the upward motion of wealth from retirement funds and other previously untouchable funding sources, along with the end of the ownership society, yet their stockholders are still seeing money thanks to wheelbarrow loads of cash money straight from your grandkids’ future earnings. They’re raiding the *federal* coffers, eating tax money previously only available for bombing dark people and educating children, and moving that money into their vaults. I mean, if that isn’t an amazing performance, what is?

They tank the system, then get our money. Take a bow, you fat greedy pig fuckers. Hopefully a few more of you get cold-cocked before this thing blows over.

Private Health Insurace Will Damn Us All

| Comments

There has been, for some time, debate in the United States regarding healthcare “reform”, as our current system does not serve a fair percent of the population, and out of those served, many are “underinsured”. From Michael Moore’s Sicko to Howard Dean’s offer to present the issue in front of Congress, there is no doubt that the system is horribly, horribly broken.

I believe the issue is a systemic one, hinging on the broken premise that “private insurance”, that is, pay-for-play insurance funded by either direct periodic payments or employer contributions, is a far superior method of providing healthcare. A publically traded company has a primary obligation to its shareholders and their dividends. This is a bit of an issue with health insurance, as the “proven way” of increasing margins is denying coverage to people.

Health insurance (otherwise known as “coverage”) is meant to provide healthcare without substantial out of pocket expenses, in an effort to keep your average worker from going bankrupt in the case of a medical emergency. Unfortunately, ever since Dick Nixon handed us over to the HMOs with the “HMO Act”, we as a people have been at the mercy of an industry whose sole purpose is to deny the majority of claims for coverage. There have even been deaths reported when insurers have failed to cover life-saving procedures. Many, many more slip through the cracks in the form of people who cannot received preventative maintenance through regular checkups, instead using emergency rooms and clogging that part of the healthcare system when their problems have reached a critical point.

Unlike other civilized countries, the United States says that it supports the “free market”… except when it doesn’t. Supports fiscal responsibility … except when it doesn’t. The “free market” and government administered health care are not mutually excusive — just that private insurance has much higher cost due to its profit margins. Of course, the jackholes at the CATO institute would like you to believe that it’s oh-so-much-more-expensive … because “Private insurers incur administrative costs to make sure they (and their customers) aren’t getting ripped off.”. Sure does sound like you’re going to get *way* more false positives, as if you weren’t dealing with a “throwing the baby out with the bathwater” situation to begin with.

The fact of the matter is that as long as private insurance companies have to make a profit, their best interests are simply not to make you healthy or pay for anything to help you get healthier. Anything to that effect is purely coincidental. Their primary motivation is to juice you for money to feed their shareholders, not to make you healthier. Don’t listen to them, they’ll do their best to speak in reassuring tones and tell you about the “social good” and the “free market”. But trust me, they’ll step over your rotting corpse on the way to the bank, and won’t even give it a second thought.

Single payer insurance. Say it with me …

Trixbox Directory With Cisco Phones

| Comments

In case anyone may want to use Trixbox with Cisco 79xx phones and wants to use a directory with it, I have put together a hack to deal with the directory services, which nominally require SugarCRM, so that they report simple extensions back in the appropriate format.

1) In the Endpoint manager, make sure that the services URL and directory URL are in the default configuration for Cisco phones, and restart any phones which are running to activate the configuration.

2) In /var/www/html/cisco/services, make sure that index_cisco.php is symlinked to index.php

3) In /var/www/html/cisco/services/DBConnect.inc, change the default username and password to something with access to the asterisk database, and change the database name to asterisk.

4) Make PhoneDirectory.php in that directory contain:

< ?php

##########################################
# Config section

$Server = "http://$SERVER_ADDR/cisco/services";   # don't add a trailing slash!
$LongDistanceExtension = ""; # change this to match your config

##########################################
#
# Set content type
header("Content-Type: text/xml");

# This is the include file that establishes the connection to the MySQL database
require ("DBConnect.inc"); 

# This sets the offset for the LIMIT portion of the query
$NextStartingRow = $NextSet*30;

# Connect to the database
$ConnectionSuccess = db_connect();
if (!$ConnectionSuccess) exit;

# If the variable "ID" is passed in through the GET string, then display 
# extension, phone number and cell phone number for that record with the dial
# key functionality
if ($ID) {
        $PersonDirectoryListing = "n";

        //$Query  = "SELECT id, first_name, last_name, phone_home, phone_work, phone_mobile, phone_other ";
        //$Query .= "FROM contacts WHERE id = '$ID' ";
        //$Query .= "ORDER BY last_name "; 
        $Query  = "SELECT id,description FROM devices WHERE ( tech = 'sip' OR tech = 'iax' ) AND id = '".addslashes($ID)."' ";

        $SelectPersonInfo = mysql_query($Query,$ConnectionSuccess);

        while ($row = mysql_fetch_array($SelectPersonInfo)) {
                $WorkPhone = ereg_replace("[ ()-] ", "", $row['id']);

                $PersonDirectoryListing .= "n";
                $PersonDirectoryListing .= "Extension:n";
                //$PersonDirectoryListing .= "$LongDistanceExtension$WorkPhonen";
                $PersonDirectoryListing .= "$WorkPhonen";
                $PersonDirectoryListing .= "n";
        }

        $PersonDirectoryListing .= "n";

        echo "$PersonDirectoryListing";

# If the variable ID is not passed in on the GET string, then do the 
# entire company directory, unless last is passed in. If so then we
# will be using a LIKE filter in our SQL query
} else {
        $PersonNameList = "n";
        $PersonNameList .= "n";
        $PersonNameList .= "Please select onen";

        $Query  = "SELECT id,description FROM devices WHERE ( tech = 'sip' OR tech = 'iax' ) ";
        //$Query  = "SELECT id, first_name, last_name, phone_home, phone_work, phone_mobile, phone_other ";
        //$Query .= "FROM contacts WHERE deleted = 0 ";

        # If we are searching by last name the add this filter to the query
        if ($LastName) { $Query .= "and description like '%$LastName%' ";  }
        $Query .= "ORDER BY id ASC";

        # If this is the first page of the company directory then we will display the first 30
        if (!$NextSet) {
                $Query .= " Limit 0,30";
        # Now for each subsiquent call we get the next 30 records.
        } else {
                $Query .= " Limit $NextStartingRow,30";
        }

        # Execute the query
        //echo $Query;
        $SelectNameList = mysql_query($Query,$ConnectionSuccess);

        # Count the number of rows returned. This is important because if a full 30 are returned
        # we will display a more option

        $NumberOfRows = mysql_num_rows($SelectNameList);

        if ($NumberOfRows >= 30) {
                $NextSetValue = $NextSet 1;
        }

        # Parse through the query and set up the menu items.
        while ($row = mysql_fetch_array($SelectNameList)) {
                $PersonNameList .= "n";
                        $PersonNameList .= "";
                                $PersonNameList .= $row["description"];
                                if ($row["first_name"]) $PersonNameList .= ", " . $row["first_name"];
                        $PersonNameList .= "n";
                        $PersonNameList .= "";
                                $PersonNameList .= "$Server/PhoneDirectory.php?";
                                $PersonNameList .= "ID=";
                                $PersonNameList .= $row["id"];
                                $PersonNameList .= "n";
                $PersonNameList .= "n";
        }

        # If we set NextSetValue above then we will display the more option. Which sets NextSet
        if ($NextSetValue) {
                $PersonNameList .= "n";
                        $PersonNameList .= "MOREn";
                        $PersonNameList .= "$Server/PhoneDirectory.php?NextSet=$NextSetValuen";
                $PersonNameList .= "n";
        }
        $PersonNameList .= "";
        echo "$PersonNameList";
}
?>

Congratulations! We’re Finally an Adult Nation!

| Comments

After an actor, a CIA spook, a Republican in Democrat’s clothing and a moron, we finally have a President willing to let us become an *adult* nation. President Obama just announced that he wanted to create a high speed rail system in the United States. Hell, even the cheese-eating surrender monkeys in France have had one of those for *years* … I’m sure that the trucking lobby, oil lobby, or some other lobby I haven’t though of, will stymie this and kill it somehow, but at least we’re trying, finally.

All we need now is a distributed energy generation system and electric vehicles for short transport, and we’ll finally be ready to kick the greasy black dragon.

Dichotomy of the Human Condition

| Comments

Why is it that we have such a strong built-in need to survive when we’re miserable most of the time?

I guess that’s the biological imperative making sure that we perpetuate the species, in the same way that our genes fighting for dominance is most likely the root cause for our Randian inability to coexist with others without eventually trying to climb to new heights by stepping on them. I’m not really an Ayn Rand fan, if you haven’t gotten that from reading the last few sentences …

In another aspect, our need to succeed is a good part of what seems to make us miserable, in that we’re mostly taught to either (a) be happy with everything because this is what you have and God’ll give you a cookie when you’re wormfood or (b) nothing is *ever* enough. Neither of those mentalities really does much good for us as a collective of people, and I really wish that there were some easy solution that I could pull out to make everything all better. Unfortunately, people are beholden to their ingrained beliefs, and people rarely change. Anyone who says otherwise is probably selling something.