Monday, July 28, 2008

War on drugs

The occasional glass of merlot is about as far as I dip into drug use, but I'm intelligent to recognize when something doesn't work, and to perceive the cause and effect cycle that seeds drug related criminal activity.

There's no doubt that the US is in a drug use epidemic, yet upon closer examination, the majority of drug users are non-violent. Despite more and more draconian drug laws, the US still has one of the highest incidents of drug use in the world.

Drug use is not a criminal problem, it is a social and addiction problem. Locking up non-violent drug offenders with violent criminals and not giving them treatment for their drug addiction isn't going to do anything except turn some of them into violent criminals with a drug problem.

Which brings us to the root of drug-related crime. Ultimately, it's a vicious circle. The more laws there are, and the more the police try to enforce the law, the worse a problem drug related crime becomes. But why?

Simple. As more law enforcement effort is focused toward prohibiting something, the more profitable that something becomes.

Ultimately, the only reason drug crime (and other 'vice' crimes such as prostitution and gambling) exist is because of government prohibitions. A free market in drugs would reduce the level of profitability to a point where it would not longer enable criminals to reap huge rewards.

The best way — really the only way — to end drug crime is to end the prohibitions against them. Once drugs are legal, they will no longer provide the huge profit they now do and related criminal activity will dissolve. Drugs can be regulated and taxed. Drug use and users can be tracked through registration and distribution programs. Ninety percent of crime would disappear overnight.

But that's not what our government does. Instead, it continues to fight a war it can't win. The very effort to prevent drug sales and use drives them underground, thereby guaranteeing enormous profits to those willing to take the risk to be part of the market. The riches are then used to bribe public officials and gain a certain amount of protection from the public sector. And that doesn't include the money spent on drug enforcement, which is a business unto itself.

This cycle is doomed to continue indefinitely until our leaders wake up and admit they are wrong and do something to change policy.

Friday, July 25, 2008

Found Some Cool T-Shirts


I'm not a raging liberal, but I'm certainly no fan of Bush and the administration that's driven this country into the ground over the last 8 years. If pressed, I'd profess to be a humanist. The short version: I believe there's enough for everybody, violence and hate are counter-productive and demean those who perpetrate it, we should be better care-takers of our planet, and we worry to much about stuff and not enough about each other.

So I'm poking around the web the other day, as I am wont to do, and I found some T-Shirts in CafePress store that express a lot of the values I hold. The store is called ClosingTagTees, and whomever created it found a unique way to present a variety of social statements; using code syntax.

Take for example </mccain>, which, as anyone who's ever written code knows, means 'end mccain'. I thought it a pretty succinct way of expressing one's opinion. Given my chosen profession, it stuck a particular affinity in me and I thought it quite clever.

CafePress prices, IMO, are a bit high, but I'm going to pick up </mccain> and maybe one or two others, like </hate> and </war>. is too trite....

Maybe one day the opinions expressed by these shirts will actually be realty, though given human history and nature, I doubt it.

Wednesday, July 09, 2008

JavaScript - Close Window and Refresh Parent

I've run into this scenario more than once: I have a button or link that spawns a new window, usually a window with some sort of form in it, like a rating or comment. After the user make his or her rating or comment and submits it, I want the new window to close ad the window underneath to refresh to show the new rating or comment. So here's a JavaScript that will close a new window and also refresh the parent window.

The function:
<script language="JavaScript" type="text/javascript">
function CloseAndRefresh()
{
opener.location.reload(true);
self.close();
}
</script>
You can call the function a couple of ways. You can use a link:
<a href="#" onClick="CloseAndRefresh(); return:false;">Close</a>
Or a button:
< input type="button" value="close" onClick="CloseAndRefresh();"
Or you can make it part of the submit:
<input type="submit" value="submit" onClick="CloseAndRefresh(); return:true;"

JavaScript Open New Window

Here's the JavaScript I use when I want to spawn a new window:

Using a button:
<input value="submit" 
onclick="javascript:window.open
('NewPage.html', 'WindowName',
'width=450, height=350, top=100, left=100, toolbar=0,
menubar=0,location=0,status=0,scrollbars=0,resizable=0');"
type="button">
Using a link:
<a href="#"
onclick="javascript:window.open
('NewPage.html','WindowName',
'width=450, height=350, top=100, left=100,
toolbar=0, menubar=0, location=0, status=0, scrollbars=0, resizable=0');
return:false;">New Window</a>
The return:false; at the end keeps the link click from completing, so you can use a # as the link destination.

New Stuff

Didn't do much for a while there after converting SFReader to the DoNetNuke platform. It's been stable for a couple of months now. I had some problems with SQL injection, but was unable to identify the source. Ultimately I ended up writing a scrubber script that I call every few minutes.

The SQL injection problem was an epidemic. Many of my sites ended up getting attacked and I saw posts all over the web about similar injection attacks happening all over the place. I had to take a couple of days and go through my site, making sure I was checking querystring and form values, stripping out/replacing the single quote and performing the IsNumeric check to make sure values were valid. Since I did, I've suffered no more injections.

I've got two new sites up"

TagaSite.net - I've been having fun with tag clouds recently so I built a free web directory that replied on a tag cloud instead of the normal category selection almost all other directories rely on.

Nollij.net - The name (pronounced 'knowledge') comes from Calvin and Hobbes. Nollij is a directory of freebies on the Internet: free samples, free trials, special savings and other unique offers. Another tag on my using a tag cloud classification system.

Check them out, let me know what you think.....