Assorted random stuff.


























 
Archives
<< current













 
This is where you stick random tidbits of information about yourself.



























Random bit stream
 
Friday, November 08, 2002  
"Power to the people!" Remember that rallying cry? The most imporant issue on the ballots last Tuesday, one that could signal a fundemental change in the power structure of the nation by including the people in the system of checks, received almost no media coverage. I had to search for nearly 3 days, and put together bits of information from different sources to finally figure out what happened. Unfortunately, after strong campaining against the amendment, it was defeated by a margin of 4 to 1.

Amendment A on the South Dakota ballot, the "Jury Nullification" amendment to the state constitution, would allow jurors in the state to acquit defendants who are technically guilty, but who are charged with laws that the jury deems unfair. Jury nullification is forbidden in all states currently, although there is no legal means to enforce this--you cannot punish the jurors--but any mention of the concept by the defense would likely result in a mistrial. Judges and prosecutors intimidate jurors into looking at "just the facts" and not considering the fairness of the law. Practically every word said about the bill was against it--judges, legislators, police, even the media hated the idea. Why? Power...

Legislators have power--they make the laws. Often the executive branch has veto power over those laws, so they have a chance to strike down the ones that they don't like, and there's also the power to pardon those who do get convicted. The police enforce the laws, so if they don't like a law, they just don't enforce it. Prosecutors can choose not to press charges, judges can dismiss cases, and since prosecutors and judges are often elected positions, the media has the power to prevent reelection of any elected officials that they dislike. So if a criminal gets to court, he's already guilty in the eyes of the executive branch, the judicial branch, the legislative branch, and the media. So what happens if the jury can acquit based on their feelings on the law? That means instead of a 4-way share of power, we now add the people, and get a 5-way sharing of power.

And when was the last time you saw anyone who was in favor of decreasing their own power?

9:25 AM

Friday, October 25, 2002  
"It's not getting any smarter out there. You have to come to terms with stupdity, and make it work for you."
--Frank Zappa

10:12 AM

 
From the New York Times website, 10/25/2002:

Officials Say Records Show Gun Was Illegally Owned
By FOX BUTTERFIELD
[cut]
Mr. Faraday was careful to say its copies of the M-16 were not assault weapons, since they do not have collapsible stocks, flash suppressers or a mounting to install a bayonet, some features that were ruled out by the 1994 ban. The magazine of the XM15 also holds only 10 rounds, the permissible limit set by the 1994 ban.

In addition, the rifle is only a semiautomatic, requiring a trigger pull for each shot, not fully automatic as a military rifle, which allows multiple rounds to be fired with a single pull of the trigger.

But Kristen Rand, the legislative director for the Violence Policy Center in Washington, a gun control group, said that the XM15 seized in Mr. Muhammad's car still had features that mimic an assault weapon.

"It complies with the letter of the law, but it is still an assault rifle," Ms. Rand said.
[cut]

Given that the term "assault rifle" is LEGALLY defined as a rifle with flash suppressor, bayonet lug, pistol grip, etc., it is NOT an "assault rifle". The whole "assault rifle" concept has NOTHING to do with functionality, it's entirely cosmetic. "It looks like a military rifle, therefore it must be evil."

But at least Ms. Rand is honest in admitting she is pushing an agenda, even though she lies to do so...

10:10 AM

 
Once again the media proves that it's pushing an agenda.

They caught what they think are the killers who have been shooting random people in the Washington, DC area. On the news last night (network news, don't recall which channel) they were pushing the following (mis)information:

One of the shooters was in the military, and stationed in Washington state, where there is a sniper school. The man was not in the sniper school, he was a mechanic.

The rifle used was a .223 Remington caliber. This caliber was a modification of the .222 Remington, made by Eugene Stoner, developer of the AR-15 series rifle. The .223 had a slightly larger case, which allowed it to fire slightly heavier bullets, and a shorter neck, which worked better in a semiautomatic rifle than the long necked .222 Remington. Both cartridges fall into the category of varmit cartridges, suitible for game such as prarie dogs and cyotes. In many states it's illegal to hunt deer with the .223, and in the others it's the minimum acceptable caliber (and you'd better be really accurate, because there is no range for error). The military was very heistant about it's adoption, in part because of the short range of the .223 (only 300 yards--see post of 3/28/2002 for more info on the adoption of the M-16). All military and most police sniper rifles are in .308 Remington, a far more powerful and long range cartridge. So, since the .223 Remington is a marginal cartridge as far as power is concerned, why do they keep harping on the "high powered rifle" bit?

The rifle used was a Bushmaster XM-15, a semiautomatic rifle. Never mind that he only ever fired one shot at a time.

The rifle in question shoots a bullet that travels "a mile and a half a second". So how the hell do you get a mile and a half a second from 3050 to 3200 feet per second, which is what a .223 is actually capable of? No smallbore rifle I've ever encountered (and believe me, I've encountered a bunch) has been capable of propelling a bullet over 4500 f/s, and that requires a load hot enough to literally burn some of the rifling out of the barrel in less than a thousand rounds.

Blatantly wrong facts, focus on trivial and unrelated details, and deliberate use of misleading, high emotional context phrases. If the media is the watchdog of the free state, then where is the media's watcher?

9:39 AM

Wednesday, October 23, 2002  
To restate:

"Never attribute to malice that which can be adequately explained by stupidity." --Hanlon's Razor

But some days you really have to wonder just how far stupid coincedences go--was an act just serendipitous stupidity (if you'll allow for such a thing) or a subtle and devious conspiracy? A case in point...

The ANSI standard for the C language includes a handy function called "assert(int expression)". Its purpose is to stop the program and invoke the debugger if the given expression evaluates to a logical false condition (signified by a value of 0). So, the statement "assert(0);" will throw an exception that the debugger will catch and let you examine the program at that point. This is quite handy for debugging, because you can use assert statements to verify all your assumptions, and the debugger will immediately inform you if one of your assumptions is incorrect. It is not uncommon to use an assert to, for example, verify that a file was successfully opened, and then, if the file was not opened successfully, handle the error condition gracefully. The reason for the assert is to notify the programmer that the file was not opened, so it can be determined if the file was not opened because the filename was incorrectly assembled (which would be a program bug) or because the given directory did not exist (a runtime error that should be handled by the code, not a bug). Since you don't want assertions firing in cases like this in your release code, the "assert(int x)" function is actually a macro that is defined as nothing in release mode. All this is fine and good.

Now enter Microsoft. Since the compiler and debugger are closely tied to each other, they are written by the same group. Since invoking the debugger is very dependent on the debugging environment, the actualy implementation of "assert(int x)" is entirely up to the compiler/debugger authors. Therefore, you'd expect an assert in Visual C/C++ to pop up the Visual Studio debugger and stop at the given line. And it does. But here's where the line between malice and stupidity blurs...

Microsoft has ANOTHER version of the assert command, called "ASSERT(int x)". It works exactly the same as "assert(int x)", it's just all caps, and, C/C++ being case sensitive, that makes it a different function as far as the compiler is concerned. The big difference is that "assert(int x)" is an ANSI standard library call, whereas "ASSERT(int x)" is a Microsoft only call. All of Microsoft's sample code, the MFC source code, etc., is all written using ASSERT rather than assert, and to keep things looking neat, programmers tend to get in the habit of using ASSERT because it's what's already there.

So now you have some code written using Visual Studio, and you want to port it to a different OS. Everything is portable except the ASSERT function, but since it's the same as assert, the obvious solution is to make ASSERT become assert by doing the following:

#ifndef _WINDOWS
/* only for non-Windows code, otherwise Visual C/C++ will complain about duplicate definitions of ASSERT */
#define ASSERT(x) assert(x)
#endif

That should make all the ASSERTs into asserts, right? But think again...doing this actually results in a very slippery little Heisenbug. Consider the following:

#define A B
#define B C
A
B

What happens when the preprocessor works on that? Since only a single pass is made, only one substitution can occurr, so the output is:

B
C

and not

C
C

as would be the result of multiple passes. This is actually a good thing, since it is entirely possible to do:

#define A B
#define B A

which, in a single pass model, swap A and B in the code, and in a multipass model will result in a crash due to infinite recursion. Now remember I said that assert(x) is actually a macro that is defined as nothing in release mode? Then here's what we have in release mode:

/* assert.h defines assert(x) as nothing) */
#define assert(x)

/* we try to port code written with Microsoft's bastard ASSERT macro */
#define ASSERT(x) assert(x)

ASSERT(2 + 2 == 5);

Which, after preprocessing becomes:

assert(2 + 2 == 5);

But, since assert is supposed to be removed by the preprocessor, IT STILL FUNCTIONS IN RELEASE MODE! The only problem is that, since it's release mode code THERE'S NO DEBUGGER TO CATCH THE EXCEPTION! Since the debugger doesn't catch the exception, it falls back to the default behavior for that type of exception, which is a call to abort(), which TERMINATES THE PROGRAM!

Of course, all this goes away once you compile in debug mode--the debugger catches the exception, halts at the assert, and you can continue on. The error handling code does what it's supposed to, so you try again in release mode and IT DIES AGAIN!

So is this really attributable to mere stupidity? Or is it a carefully crafted scenario designed to cause subtle, nearly untraceable crashes in ported code that ran fine under Windows? I propose a corollary to Hanlon's Razor:

"The odds of an act being malicious are directly proportional to the profit of the act to the actor."

And by that corollary, I think there's some devious bastard working for Microsoft who saw a perfect opportunity to sabotage attempts to port Windows code to other platforms.


2:32 PM

Tuesday, October 22, 2002  
10/22/2002

"Labor Unions Among Top Donors in U.S. Politics

WASHINGTON (Reuters) - Six of the 10 biggest donors in U.S. politics are labor unions, and they give largely to Democrats, a nonpartisan research group said on Tuesday.

The top 100 donors have given over $1 billion to U.S. political parties and federal candidates since 1989, and Democrats got 60 percent of it because of the generosity of labor unions on the list, said a new report by the Center for Responsive Politics, which tracks money in politics.

The biggest single donor was the public service and health care union known as the American Federation of State, County & Municipal Employees. It made nearly $30.7 million in contributions since the center began systematically tracking contributions, the report said.

Five other labor unions, and three professional associations representing real estate agents, trial lawyers, and doctors, took nine of the top 10 slots on the list of big donors.

Only one corporation, tobacco giant Philip Morris, made the top 10, with contributions of $18.6 million. Three-fourths of that money went to Republicans.

Of the 100 top donors, 51 were corporations; 27 were labor unions; 17 were trade and professional associations, and five were categorized as "ideological" or single-issue groups such as the National Rifle Association. It was ranked as the 22nd biggest donor and gave 82 percent of its dollars to Republicans.

By industry, the U.S. financial sector had the deepest pockets, with banks, insurance (news - web sites) companies and accountants making $226,749,297 in donations since 1989, the center said. As a sector they gave 58 percent of their donations to Republicans.

But the financial world total trailed the $345,730,591 in contributions from labor unions as a group over the same time period -- a whopping 94 percent of which went to Democrats, the report said.

In addition to AFSCME, the other unions in the top 10 were the National Education Association, a teachers' union; the Teamsters Union; the International Brotherhood of Electrical Workers; the Service Employees International Union, and the Communications Workers of America.

Although he ran only one federal campaign during the period surveyed, President Bush (news - web sites) ranked second on the top recipient list, garnering $3.2 million.

Top recipient was the House Democratic leader, Rep. Richard Gephardt of Missouri, who received $3.8 million since 1989, and is serving in his seventh term since that time. "

Now, given that, how about this, taken from Reuters later the same day:

"He [Gephardt] added, "If Republicans win control of Congress, they will enact the special-interest agenda, not the people's agenda.""

Yep, can't trust those lackeys of the special interest groups. Evil groups like the NRA spend unheard of amounts of money on those Republicans while the poor Democrats scrape by with nothing, all in the name of staying free from special interest ties...

5:04 PM

Tuesday, April 16, 2002  
At http://www.uspto.gov/, the US Patent and Trademark Office website, we find patent 6,368,227, awarded April 9, 2002. The abstract:

"Method of swinging on a swing

Abstract

A method of swing on a swing is disclosed, in which a user positioned on a standard swing suspended by two chains from a substantially horizontal tree branch induces side to side motion by pulling alternately on one chain and then the other."

I kid you not. It exists. Even verified it at the http://www.delphion.com patent database.

And, should you say "What's the big deal?", let me quote from the US patent law:

"Novelty And Non-Obviousness, Conditions For Obtaining A Patent

In order for an invention to be patentable it must be new as defined in the patent law, which provides that an invention cannot be patented if: “(a) the invention was known or used by others in this country, or patented or described in a printed publication in this or a foreign country, before the invention thereof by the applicant for patent,” or “(b) the invention was patented or described in a printed publication in this or a foreign country or in public use or on sale in this country more than one year prior to the application for patent in the United States...”

Perhaps this was all meant as a joke, but it never should have passed the patent review. But was it really meant as a joke? The last line of the patent reads:

"Licenses are available from the inventor upon request."

9:04 AM

Thursday, March 28, 2002  
From the Jargon dictionary, www.jargon.net:

Murphy's Law /prov./ The correct, *original* Murphy's Law reads: "If there are two or more ways to do something, and one of those ways can result in a catastrophe, then someone will do it." This is a principle of defensive design, cited here because it is usually given in mutant forms less descriptive of the challenges of design for lusers. For example, you don't make a two-pin plug symmetrical and then label it `THIS WAY UP'; if it matters which way it is plugged in, then you make the design asymmetrical (see also the anecdote under magic smoke).

Edward A. Murphy, Jr. was one of the engineers on the rocket-sled experiments that were done by the U.S. Air Force in 1949 to test human acceleration tolerances (USAF project MX981). One experiment involved a set of 16 accelerometers mounted to different parts of the subject's body. There were two ways each sensor could be glued to its mount, and somebody methodically installed all 16 the wrong way around. Murphy then made the original form of his pronouncement, which the test subject (Major John Paul Stapp) quoted at a news conference a few days later.

Within months `Murphy's Law' had spread to various technical cultures connected to aerospace engineering. Before too many years had gone by variants had passed into the popular imagination, changing as they went. Most of these are variants on "Anything that can go wrong, will"; this is correctly referred to as Finagle's Law. The memetic drift apparent in these mutants clearly demonstrates Murphy's Law acting on itself!


Extract from:

Hearings before the Special Subcommittee on the M-16 Rifle Program of the Committee On Armed Services

House of Representatives Ninetieth Congress First Session

May 15, 16, 31, June 21, July 25,26,27, August 8, 9, and 22, 1967

Begin extract:

Mr. Morgan: On the ammunition, Mr. Chairman, I have just two more questions. Are you familiar with the reasons stated by the Army for the changeover from the IMR to the ball powder? Do you have any first hand knowledge or second hand knowledge of that?

Mr. Stoner: Well, the only - I have a little first hand knowledge because I was approached after this ammunition inspection was made by a person, I think it is the Secretary of Defense's Office, in looking at the technical data package.

Mr. Ichord: When was this?

Mr. Stoner: This was at the time, I forget how long it was, but it is at least a couple of years ago. He asked me my opinion on it, and I asked him why they were holding out for the ball propellant and they said, well this was more or less, as I could gather, a policy within the Army. They wanted to have everything ball propellant that they could in small arms.

Mr. Morgan: Because of the cost savings or what?

Mr. Stoner: Well, I think this was one of their reasons, and the fact that it burned a little cooler and so forth.
Like I said before, I didn't advise it because we had already had over 1,000 weapons in Vietnam that had gone through I thought, very well. These were the weapons that were sent over by ARPA, you know, prior to the adoption. I'm not sure of these times, but in that area of time.

Mr. Morgan: 1962?

Mr. Stoner: These were using the older cartridges which I didn't hear any complaints on in that particular test, and these were used by the Vietnamese troops who knew very little about any kind of a weapon. And based on that, and all the tests we had for years - in other words, this went on from, like I say, the first test was in 1958. There were quite a few years of testing all over the world. All of our experience was with the other cartridge, with the other propellant, and I didn't quite see changing horses in the middle of the stream without an awful lot of testing before we did it. And I advised this person of that, and also let it be known to other people, but it didn't seem to do much good. They went ahead anyway.

End extract.

The "Mr. Stoner" in the above excerpt is Eugene Stoner, the developer of the AR-15 rifle, adopted by the U.S. military as the M-16. A perfect example of two ways to do things, IMR or ball powder, one of which will cause catastrphic results--high gas port pressures, stuck cases, and thousands of lives lost when soldiers found themselves in firefights unarmed.

4:47 PM

Wednesday, March 27, 2002  
Hanlon's Razor:

"Never attribute to malice that which can be adequately explained by stupidity."

9:42 AM

Tuesday, February 19, 2002  
I hate Visual Basic. A lot. It's supposed to be so fast and easy (a Rapid Application Development system), but all it does is make the easy things easier, and the hard things impossible.

It was decided to write the tradeshow demos in VB because we wanted something spiffy looking and we needed it done in a month and a half (me, I was asking for a spec for this year's demo before the trade show last year...). So they chose VB because it was oh so fast and convenient.

Yeah, right.

First issue. The demo is a prototype application that controls our new color imaging toolkit, which is quite powerful and extremely flexible. We wanted an application that exposed the maximum amount of power and flexibility, while keeping the user interface fairly straightforward and simple. As Apple Computers is fond of saying, "Easy is hard."

I decided, after quite a bit of research into how not to design user interfaces (most advice on the subject is of the what not to do type) I decided that modal dialogs were not the way to go. I hate them, they're annoying, and they violate a number of principles of good UI design, the main one being they keep you from referring back to other data in your app while the dialog hogs the focus. All of the settings dialogs are to be displayed in one area at the top of the app, with the currently selected operation's settings taking over the space. Using the standard VB practice of stacking, I put each operation's controls in a different frame, and stacked the frames. The idea is that you hide all the frames except the one that has the "focus". Worked great, until an error message box pops up from VB:

Reached limit: cannot create any more controls on this form

Apparently you can only put 255ish controls onto any given form, and I'd just hit that undocumented limit. Sounds like a lot, but try stacking 15 or 20 frames with 20 or more controls each, and you'll see why I had that many controls. So I had to start over again, copy controls across frame by frame, and rewrite the underlying code to handle a number of MDI children, minus borders, inside an MDI frame. And of course this means a rewrite of all the underlying code, as well. On to the next compaint...

Undo doesn't work in the form building component.

Don't accidentally delete something, or it's gone. You'll need to recreate it from scratch, and get it sized and posistioned just right or your app will look all wrong, since of course the one you accidentally delete is the control relative to which all others are located. Don't overwrite a control name and then switch focus off the text box either, as that cannot be undone. Have to remember the control name exactly, or it will break the underlying code.

The penultamate complaint is about how VB handles errors upon loading. For example, here's one I got when reopening the project:

Line 13: Class MSComctlLib.StatusBar of control sbStatusBar was not a loaded control class.
Line 43: Class MSComDlg.CommonDialog of control dlgCommonDialog was not a loaded control class.
Line 50: Class MSComctlLib.ImageList of control imlToolbarIcons was not a loaded control class.

Now rember that it's Visual Basic, not Line Numbered Basic. The text editor (what of it there is) hides most of the code from you, and what little is shows you has no way to get a line number relating to that error. So to see what causes the problem you have to load up the .frm file in a text editor (at least it will let you do that--I think VB 3.0 stored the .frm info in a non-text file). So I got this error, and I loaded up the file in an editor that will show me line numbers (yeah, gvim!), and what do I see around line 13?

...
Begin MSComctlLib.StatusBar sbStatusBar
Align = 2 'Align Bottom
Begin VB.Menu mnuFile
...

Note that there is no End for that first Begin. Note that there appears to be some properties missing as well. 51 lines of properties missing, plus the line containing End. That's 52 lines that VB sent off to la-la land for me. Thanks, I needed that. Fortunately, I'm paranoid, and I'd checked my code into SourceSafe several times that day, so I diff'ed the current and previous versions, grabbed the 52 missing lines, stuck them in the .frm file, and reloaded the project.

Ah, well, it's not like I'm under any stress to get this thing done in two more days. At least it's given up on the bad file writing, after a mere 3 times.

7:07 PM

 
This page is powered by Blogger.