Thursday, October 29, 2009

Tag Cloud: Pelosi's Health Care Bill


Click for larger version »


Tag cloud generated with Wordle.

Tuesday, October 27, 2009

Health Care: The Public Option Oxymoron

We've heard it from the president. We've heard it from the speaker of the house. The "public option" is the only way to provide "real competition and choice" in health insurance.

Government competition? Choice? How very Orwellian. The only entity that is capable of legally taxing you (and throwing you in jail) -- the only entity that can run a virtually unlimited deficit (since they print the money) -- this is the entity that will provide us with "competition," eh?

What's a good example of another industry where the U.S. government has generated this much needed competition? Okay, how about any government at any point in history?

The truth is, governments create monopolies. Look at the U.S. postal service, for example (hint: it is illegal to compete with them).

But, you might say, Obama clearly stated that the public option would need to compete in the market; that it would need to be self-sustaining. Oh, really? Pardon me for being skeptical. So if the public option goes bankrupt, you promise to do away with it? Of course not. Once it's in place, it will be impossible to eliminate; the government will subsidize it for the rest of eternity (just like the USPS, Amtrak, and everything else it's gotten its tentacles around).

If the public option would really compete, then why does it need to be connected to the government at all? Just set it up as a non-profit insurer and let it compete. The liberal chorus isn't happy with that idea precisely because they know this is a trojan-horse to gain control over the entire health sector.

As an aside, do you know how much the insurers are making? Around 6%.

As they say, "the solution to high prices is high prices." What that means is, in a free market, companies with abnormally high returns will spur competition, driving those returns down (that's why, by the way, the historic average returns for all companies in the U.S. is right around 6%).

So if the health insurers were actually making obscene profits (which they aren't), the proper solution is to make sure other companies can compete. We know that the government has imposed restrictions on who can sell insurance, where they can sell it, and what they must cover (which is why my wife and I were simply unable to buy a reasonably priced catastrophic policy when we lived in Oregon -- the state had mandated "minimal" coverage requirements that far exceeded what we needed or wanted).

If you want to fix health care, deregulate it. Allow insurers to compete and for new companies to enter the market. Allow people to buy whatever coverage they want. Disconnect health insurance from employment (which, interestingly enough, is an artifact of government wage controls during WWII). Get the government out of it and let us (not the government and not the special interests) decide how to fix it.

The public option is a canard perpetrated by statists who have only contempt for the free market. It is the slippery slope of government intervention, blaming the market for its own distortions and thereby justifying its expansion. Don't believe the rhetoric -- they do not want competition; they want control.

Monday, October 12, 2009

Doxygen by Example

Doxygen is a documentation system for use with many languages, including C++, C, Java, and Python.

First, install Doxygen. Using Ubuntu, I installed the package with:

$ apt-get install doxygen
Next. enter the source directory of a project you're working on and run:
$ doxygen -g
That will create a config file named Doxyfile in the current directory. You can customize it, but we'll accept the defaults for now.

Now begin writing your documentation. Here's an example of documenting a simple C++ program:

#include <iostream>

using namespace std;

/**
* @brief Example class to demonstrate basic Doxygen usage
* @author MLA
*
* This is a simple class to demonstrate how Doxygen is used.
* It implements the Euclidean algorithm to compute the greatest
* common divisor of two numbers.
*/

class Euclid {
public:

/**
* Compute the greatest common divisor of two integers.
*
* @param a first integer
* @param b second integer
* @return greatest common divisor of a and b
*/
static const int gcd(const int a, const int b) {
if (0 == b) return a;
return gcd(b, a % b);
}
};

Finally, run doxygen, which will process the files and generate documentation in the html subdirectory:
$ doxygen
For more details, see the Doxygen homepage.

Monday, August 17, 2009

C++ Constant for PI

Where's the definition for pi? Doesn't C++ provide a constant? What about C?

The C++ standard doesn't provide a value for pi but it's simple to define yourself:


#include <iostream>
#include <cmath> // M_PI is not standard

using namespace std;

class MathConst {
public:
static const long double PI;
};

const long double MathConst::PI = acos((long double) -1);

int main() {
cout.precision(100);
cout << "PI ~ " << MathConst::PI << endl;
}
Output:

$ g++ MathConst.cpp -o pi
$ ./pi
PI ~ 3.14159265358979323851280895940618620443274267017841339111328125
That is accurate to 18 decimal places.

Here's a definition in C:

#include <math.h>
#include <stdio.h>

double pi() {
const double pi = acos((double) - 1);
return pi;
}

int main() {
printf("%.20f\n", pi());
return 0;
}

Saturday, August 15, 2009

Health Care: Are Insurance Companies the Villains? Prove It.

President Obama is blaming insurance companies for many of health care's ills:

"We are held hostage at any given moment by health insurance companies that deny coverage or drop coverage or charge fees that people can't afford," Obama told a crowd of some 1,000 people in Montana.

"It's wrong. It's bankrupting families. It's bankrupting businesses. And we are going to fix it when we pass health insurance reform this year," he said.
If this is in fact true, then start a new, private health insurance company that doesn't hold us "hostage." It wouldn't expand government, is quick and simple to implement, and poses minimal risk. Organize it as a non-profit and Obama can put whomever he trusts in charge to ensure it behaves "responsibly." The only restriction is it can't receive any subsidies or other special treatment from the government.

If Obama is correct, then such an experiment should be wildly successful and we'll have addressed a key problem. If not, then maybe it will suggest he either doesn't know what he's talking about or is intentionally misdirecting us when he demonizes the private insurance industry.

Source:
Obama says insurance companies holding U.S. hostage Reuters News 14 Aug. 2009.
http://www.reuters.com/article/newsOne/idUSTRE57D47P20090814

Wednesday, August 5, 2009

Postgresql: Indexes on Foreign Keys

This query identifies foreign keys that are potentially missing indexes (Postgresql does not create indexes on foreign keys automatically).


/*
Look for foreign key constraints that are missing indexes on the
referencing table.

Orders results by the size of the referencing table, largest first,
on the assumption that, all else being equal, they are the most likely
to benefit from the addition of indexes.

This is only meant as a starting point, and isn't perfect.
It's possible, for example, that it will report a missing index
when in fact one is available. e.g., it won't realize that an index on
(f1, f2) could be used with a fk on (f1). However, it will recognize
that an index on (f1, f2) can be used with a fk on (f2, f1).

Usage: psql -q dbname -f pg-find-missing-fk-indexes.sql
*/

CREATE FUNCTION pg_temp.sortarray(int2[]) returns int2[] as '
SELECT ARRAY(
SELECT $1[i]
FROM generate_series(array_lower($1, 1), array_upper($1, 1)) i
ORDER BY 1
)
' language sql;

SELECT conrelid::regclass
,conname
,reltuples::bigint
FROM pg_constraint
JOIN pg_class ON (conrelid = pg_class.oid)
WHERE contype = 'f'
AND NOT EXISTS (
SELECT 1
FROM pg_index
WHERE indrelid = conrelid
AND pg_temp.sortarray(conkey) = pg_temp.sortarray(indkey)
)
ORDER BY reltuples DESC
;

Saturday, August 1, 2009

Linux: Download YouTube Videos

Install the youtube-dl script. With Ubuntu:


sudo apt-get install youtube-dl
Next, find the YouTube video you want to download and pass it to the script:

youtube-dl -b -t "http://www.youtube.com/watch?v=aEXFUbSbg1I"
Command-line options:

Usage: youtube-dl [options] video_url

Options:
-h, --help print this help text and exit
-v, --version print program version and exit
-u USERNAME, --username=USERNAME
account username
-p PASSWORD, --password=PASSWORD
account password
-o FILE, --output=FILE
output video file name
-q, --quiet activates quiet mode
-s, --simulate do not download video
-t, --title use title in file name
-l, --literal use literal title in file name
-n, --netrc use .netrc authentication data
-g, --get-url print final video URL only
-2, --title-too used with -g, print title too
-f FORMAT, --format=FORMAT
append &fmt=FORMAT to the URL
-b, --best-quality alias for -f 18
See also: youtube-dl Homepage