Archive for the ‘Uncategorized’ Category

Criminal Justice System and who wants to work at it

Tuesday, June 23rd, 2020

I’m pondering that maybe you should never allow anyone who *wants* to be a judge or a politician be one. I also think you need to watch the cops who want to be cops closely – make sure they want to be cops for the right reasons. The problem is we have a bunch of thugs abusing their power – in general I’m not even convinced you should let the person who wants to run the neighborhood association do so, the issue is the odds of people wanting power not abusing it sooner or later are really, really low.

Perl module for decoding tekpower TP4000ZC

Tuesday, April 7th, 2020

I didn’t see one of these lying around so I banged this together in a few minutes to be able to use the TP4000ZC with a raspberry pi.. the intention is to use this to monitor the main bus voltage of my solar array.

This is provided, obviously, with no warranty, and is based on information found at tek’s web site. It seems to match the display.


package tekpower;

use Device::SerialPort;
use Data::Dumper;
use strict;

sub new {
my $self = {};
my $type = shift;
my $port = shift;

$self->{'debug'} = 0;
$self->{'port'} = $port;
$self->{'dev'} = Device::SerialPort->new($port, 1) || die "Failed to open $port";
$self->{'dev'}->baudrate(2400);
$self->{'dev'}->parity('none');
$self->{'dev'}->databits(8);
$self->{'dev'}->stopbits(1);
$self->{'dev'}->dtr_active(1);

$self->{'dev'}->debug($self->{'debug'}) if($self->{'debug'});
$self->{'dev'}->write_settings;
$self->{'dev'}->read_const_time(3000);
my $r = bless($self, $type);

return $r;
}

sub read {
my $self = shift;
$self->{'dev'}->reset_error;
my ($count,$buf) = $self->{'dev'}->read(64);
print "count: $count\n" if($self->{'debug'});
my @array = split(//,$buf);
my $notOk = 1;
while($notOk && @array) {
my $z = shift(@array);

print "z: " . ord($z) if($self->{'debug'});

my $checksum = (ord($z) & 0xF0) >> 4;
print "checksum: $checksum\n" if($self->{'debug'});
if($checksum == 1) {
unshift(@array,$z);
$notOk = 0;
}
}
my @v_array;
# first check high order bits
my ($i, $checksum);
for($i=0;$i<14;$i++) { $checksum = ord($array[$i]) & 0xF0; $v_array[$i] = ord($array[$i]) & 0x0F; $checksum = $checksum >> 4;
if($checksum != ($i+1)) {
print "Checksum mismatch at $i ($checksum)\n" if($self->{'debug'});
return undef;
}

}

# second decode reading;
my $mode;

$self->{'smode'} = "AC" if($v_array[0] & 8);
$self->{'smode'} = "DC" if($v_array[0] & 4);
# bit 2 is auto ranging, do we care?
# bit 1 is RS232, um, if you don't know that, what are you doing here?
$self->{'sign'} = "+";
$self->{'sign'} = "-" if($v_array[1] & 8);
$self->{'digit1'} = $self->convert_digit($v_array[1], $v_array[2], 0 );
$self->{'digit2'} = $self->convert_digit($v_array[3], $v_array[4], 1 );
$self->{'digit3'} = $self->convert_digit($v_array[5], $v_array[6], 1 );
$self->{'digit4'} = $self->convert_digit($v_array[7], $v_array[8], 1 );

$self->{'number'} = $self->{'sign'} . $self->{'digit1'} . $self->{'digit2'} . $self->{'digit3'} . $self->{'digit4'};

$self->{'range'} = 'u' if($v_array[9] & 8);
$self->{'number'} *= 0.000001 if($v_array[9] & 8);

$self->{'range'} = 'n' if($v_array[9] & 4);
$self->{'number'} *= 0.000000001 if($v_array[9] & 4);
$self->{'range'} = 'k' if($v_array[9] & 2);
$self->{'number'} *= 1000 if($v_array[9] & 2);

# 1 is diode, do we care?
$self->{'range'} = 'm' if($v_array[10] & 8);
$self->{'number'} *= 0.001 if($v_array[10] & 8);

$self->{'range'} = '%' if($v_array[10] & 4);
$self->{'range'} = 'M' if($v_array[10] & 2);
$self->{'number'} *= 1000000 if($v_array[10] & 2);

$self->{'mode'} = "farad" if($v_array[11] & 8);
$self->{'mode'} = "ohm" if($v_array[11] & 4);
$self->{'mode'} = "delta" if($v_array[11] & 2);

# bit 1 is hold, do we care?

$self->{'mode'} = "amps" if($v_array[12] & 8);
$self->{'mode'} = "volts" if($v_array[12] & 4);
$self->{'mode'} = "hz" if($v_array[12] & 2);

return $self->{'smode'} . ' ' . $self->{'mode'} . " " . $self->{'sign'} . " " . $self->{'digit1'} . $self->{'digit2'} . $self->{'digit3'} . $self->{'digit4'} . ' ' . $self->{'range'};

}

sub convert_digit {
my $self = shift;
my $lhs = shift;
my $rhs = shift;
my $include_decimal = shift;
my $decimal;

if($include_decimal) {
if($lhs & 8) {
$decimal = ".";
} else {
$decimal = "";
}
}

$lhs = $lhs & 7;

my $d;

# 000 0101 = 1
if($lhs == 0 && $rhs == 5) {
$d = 1;
# 101 1011 = 2
} elsif($lhs == 5 && $rhs == 11) {
$d = 2;
# 001 1111 = 3
} elsif($lhs == 1 && $rhs == 15) {
$d = 3;
# 010 0111 = 4
} elsif($lhs == 2 && $rhs == 7) {
$d = 4;
# 011 1110 = 5
} elsif($lhs == 3 && $rhs == 14) {
$d = 5;
# 111 1110 = 6
} elsif( $lhs == 7 && $rhs == 14) {
$d = 6;
# 001 0101 = 7
} elsif($lhs == 1 && $rhs == 5) {
$d = 7;
# 111 1111 = 8
} elsif($lhs == 7 && $rhs == 15) {
$d = 8;
# 011 1111 = 9
} elsif($lhs == 3 && $rhs == 15 ) {
$d = 9;
# 111 1101 = 0
} elsif($lhs == 7 && $rhs == 13 ) {
$d = 0;
} elsif($lhs == 6 && $rhs == 8) {
$d = "L";
} else {
return undef;
}

my $v = $decimal . $d;
print "V: $v\n" if($self->{'debug'});
return $v;
}

1;

Solar

Saturday, April 4th, 2020

So, i’ve decided to stop waiting for the government to make some sort of ‘green new deal’ happen and put my money where my mouth is. It also helps reduce my paranoia to know that I will have backup water and power supplies if the government (who provides both things in the city of Seattle) experiences some sort of outage or other difficulties. So, I’m putting out 3.5kW divided as 1.6kW of monocrystalline and the rest amphorous (the idea here is to make power in both sunny and cloudy conditions). Realistically I expect to see maybe 1kW output except high noon on the brightest parts of summer, but that is still enough to keep my fridge and freezer running, and I can also add a grid intertie inverter to reduce my power bills when I’m not using the array for backup power or to charge my electric car.

I’m also putting in 10kW of backup energy storage, which can be charged either via the grid (I’ve got a 40 amp charger) or via the solar array. I will likely also experiment with solar towers and solar tracking. Those of you who know me know I often have hobbies-for-a-year – this is my hobby for 2020.

I am also adding numerous rain barrels to store rainwater and a 12 volt pumping system that can be used to pressurize my pipes via a water filter from the rainwater, as well as some 12 volt emergency lighting.

For Jennifer And Vicky

Sunday, March 22nd, 2020

The Living Years, by Mike and the Mechanics

Every generation
Blames the one before
And all of their frustrations
Come beating on your door

I know that I’m a prisoner
To all my Father held so dear
I know that I’m a hostage
To all his hopes and fears
I just wish I could have told him in the living years

Crumpled bits of paper
Filled with imperfect thought
Stilted conversations
I’m afraid that’s all we’ve got

You say you just don’t see it
He says it’s perfect sense
You just can’t get agreement
In this present tense
We all talk a different language
Talking in defence

Say it loud, say it clear
You can listen as well as you hear
It’s too late when we die
To admit we don’t see eye to eye

So we open up a quarrel
Between the present and the past
We only sacrifice the future
It’s the bitterness that lasts

So Don’t yield to the fortunes
You sometimes see as fate
It may have a new perspective
On a different day
And if you don’t give up, and don’t give in
You may just be OK.

Say it loud, say it clear
You can listen as well as you hear
It’s too late when we die
To admit we don’t see eye to eye

I wasn’t there that morning
When my Father passed away
I didn’t get to tell him
All the things I had to say

I think I caught his spirit
Later that same year
I’m sure I heard his echo
In my baby’s new born tears
I just wish I could have told him in the living years

Say it loud, say it clear
You can listen as well as you hear
It’s too late when we die
To admit we don’t see eye to eye

Some proof that we’re being stupid

Sunday, March 22nd, 2020

#1: Some hackers start 3D-printing and sharing shapefiles for medical equipment. They promptly get sued.
#2: Tesla is told it can’t keep making cars. EVERY CAR IS 30kwh ON THE HOOF. If the grid goes down.. and it might, disasters don’t always come at you one at a time.. they could run oxygen concentrators and ventilators just by attaching a inverter to the 12V battery and leaving the car turned on but in park. Think of a electric car as a ‘bucket’ for carrying power from the grid to places that might have lost it. Tesla is one of the few mfgrs who should be scaling up.. along with makers of solar panels, batteries, and wire. We don’t know how bad this is gonna be, but.. if naught else, we’ll be better prepared next time.

Simulation, Virtualization, On the iron?

Friday, January 24th, 2020

So, I had a long series of conversations with someone on my recent Africa adventure about whether or not we are living in a simulation. Most of you already know that I have noticed that both evolution and intelligent design would discover virtualization fairly early on as a way to do a lot more with the same resources. Virtualization opens a lot of doors vs. running ‘on the iron’ – we already know that we have some virtualization features, such as dreaming and imagining possibilities, but I think it likely that we probably go a good deal further than that.

One of the thoughts i had never been struck by before which struck me on this particular version of enumerating the age-old discussion was that humans do not really have instincts to speak of – so one appropriate use of virtualization is to build the neural structures necessary to survive before we meet the real world. It’s quite possible that we’re still in our mother’s womb, living through recordings of various situations so we can build the neurological structures and be ready to deal with the real world, which may be far stranger and wilder than anything we’ve experienced thus far. When you think about it, if evolution hasn’t already found this, it’s a bit of surprise, because surely the child that experiences training simulations in-womb is going to have a *far* higher survival score than the child who does not.

Anyway, one can think of a number of scenarios in which simulation or virtualization would be a winning strategy – if we’re the product of intelligent design we’re almost certainly inside a virtualization envelope, because it protects the designer from us. One amusing possibility that’s occurred to me is that we may be the result of someone trying to develop a really accurate video game that simulates life forms – so accurate that those life forms turn out to experience the world as real. It would be, it seems to me, a easy mistake to make.

The psychology of stated truth

Friday, January 24th, 2020

So, I recently went on a African safari – a lot more about this later, including pictures and the like – most of the trip was amazing, but it did have a few disturbing moments. Today I’m going to talk about the one in which someone asserted a number of untruths as facts.

The whole thing started because I was talking about the opiod epidemic and mentioned marijuana in a list of “relatively harmless” drugs. Someone at the table I was at – and this person will remain nameless, but I’m fairly sure they have a significant mental illness – asserted that MJ had killed many, many people.

It came out that his sister was killed by a drunk driver who also had MJ in his system. And, I agreed with a couple of his points, which I’ll get to later – but he kept asserting increasingly obviously fictional, increasingly disturbing statistics.

Now, I’m generally disposed to believe things people present as facts, with the obvious exception of certain political figures who I know lie constantly and without limit. It wasn’t until he stated something directly opposed to personal experience and also widely reported group experience that I realized that he was, in fact, insane. Or else trolling me, but I prefer to believe insanity.

I do feel for him that he lost someone he loved. I do feel confident that he totally misidentified the root cause – the root cause is humans driving cars – we really shouldn’t drive cars, we’re not good a it – and the secondary contributing cause would be the alcohol. MJ earns tertiary status.

I finally told him to drop it – which is rather out of character for me, but once I had done some internet searches and confirmed that the things he was saying were not true, I found it *very* disturbing to listen to him talking about the subject because I knew he was injecting false information into my mind. I suspect he’s got a cohort of anti-MJ friends who egg him on and tell him things that *he* believes are true, although it’s possible that he makes all this stuff up himself. I also am fairly sure he didn’t *know* the things he was telling me weren’t true – but he certainly wasn’t ready to listen to a dissenting opinion. He was not in general willing to let anyone get a word in edgewise.

I’m sure I have been that person in terms of talking too much. I hope I haven’t been the one presenting utter fiction as fact.

Part of what I found interesting is how, as I listened to him, his point of view which was opposite of mine seemed more reasonable and plausible until he made statements which were clearly and obviously false, at which point I found listening to him frustrating and alarming. I do hope he finds whatever help he needs – I seem to know a lot of people that start to throw the baby out with the bathwater after losing a sister. (I am not sure if I’ve written about why I am absolutely against Marsy’s law for all, but that would be another example of someone pushing for a excessive solution because their sister died)

Anyway, I kept running web searches to verify that the “facts” he was telling me weren’t. One of the thoughts I of course had is it’s possible I am the insane one, and my mind was swapping out the text the web sites were returning with the text that I expected to see. But there’s no way to tell if that’s the case. It’s possible he and I live in two different universes and in his all the things he said are true. Again, no good way to know.

Another thing I noticed is he has the typical disease of certain lawmakers and other individuals of thinking that addicts are worthless and should be jailed for life or killed at the first convenient moment. I of course understand both that many addicts are also our most creative people, and that history owes much to people who were flawed in that particular way. But, see elsewhere, the people who tend to end up in power are the worst of us – because the best of us generally don’t want power over anyone but themselves. And probably thus will it ever be. I can only hope my insane table-mate doesn’t end up with any political power, because I have no doubt that he would make the world a worse place.

OK, to bring this back home to the original topic.. one of the weaknesses of the way humans are put together, as we know from the Milgram effect, is we tend to trust authority more than we should. Authority apparently can be something as simple as speaking in a authoritarian tone of voice. This is alarming because it means I might have many “facts” stored which aren’t, simply because they were spoken in a authoritarian tone. He *really* had to say something obviously not true (he stated that MJ has no medicinal value and that the idea that it is one of the best anti-nausea substances we know of was completely false – of course part of his defense of that statement was that it was listed as something to use only when all else had failed – which I’m not surprised, big pharma doesn’t make much of a profit on MJ. I note that TMS for PTSD sufferers is also listed as something to use only when all else has failed, whereas I would use it as one of the first things I would attempt. Big Pharma owns the medical industry and has no ethics at all. but we all already know that, and I digress..)

One other interesting thing to take away – if he had let it go after our first discussion, I would have researched it much more heavily than I am now likely to. I am pretty thoroughly convinced that adding MJ to the list of legal drugs has gained us far more (in terms of bright, creative, helpful people we are no longer putting in jail) than it has cost us (traffic fatalities might go up by a few)

I will mention there are a few points he made that I agree with – 1) You shouldn’t drive when stoned. It does increase your RT. 2) You DEFINITELY should not even THINK about driving when stoned and drunk. I don’t know exactly what that would do, but nothing good. 3) We are breeding more and more potent weed, and we should think about whether that’s really such a hot idea.

As you all know, I don’t partake myself so I don’t really have a horse in this race, other than a number of my friends do and I don’t think any of them belong in jail. I actually think the people *putting* them in jail are the people who belong in jail.

Anger and lies

Tuesday, September 17th, 2019

So, it did occur to me recently as I was reading a friend’s book about Christianity that I still get angry when I consider the tenants of Christianity. Not nearly as much as I did, now that I Understand that Christianity is built on a series of lies, and exists both to make the population easier to control and to make money for the churches. But I do still get angry.

On one paw, it shouldn’t matter to me what anyone believes as long as they are not trying to control my behavior. On the other paw, a lot of Christians *are* trying to control my behavior, by making laws based on their twisted sense of morality, and also, it makes me made to know that even as we speak, children’s minds are being broken in the exact same way mine was broken, and Christians are patting themselves on the back about what good people they are as they break the minds of their children.

Okay, so let’s look at the big fundamental lie. They say that God’s love is unconditional. Then they say if you don’t believe in Jesus you will never be one with God and you will go to hell. These two things can not both be true. Unconditional means without conditions. God loves you. Period. If you’re muslim, God loves you just as much. If you made up your own religion, God loves you just as much.

Ah, they say, but God is a *just* God and therefore.. nope, stop right there, I call BS. Unconditional means unconditional. You just added a condition. “But the bible says..”

Look, I’m fairly sure – in the high 90s – that the bible is A: wrong and B: probably written by individuals with evil intent. And no, I don’t care what the bible says. In the absence of God making a sincere attempt to contact me and convince me my point of view is wrong, I’m going to assume that there either is no God, or God doesn’t work the way you all think God works. Stop lying to your children. Admit you don’t know, that no one knows, that there is no good way to know at the moment. The future of the human race may depend on your honestly. Remember that we have *fusion weapons* now – we can not afford to run the Crusades again.

Also, stop claiming Christianity is a superior religion to Islam because it doesn’t promote violence. We’re all aware of the violence being done in Africa in the name of Christianity – and we’re all aware of the crusades, and the burning of witches, and the never ending series of moral panics.

What I’ve been up to

Saturday, September 8th, 2018

So, you all have probably noticed I’ve been pretty quiet in blog-land lately. I’ve been busy with a couple of things – beyond the usual work stuff that I’m always doing.

So, if you’re curious, here’s what I’ve been up to:

1) I’ve been working off and on on a social calendaring app that I can’t say much more about yet other than it should be pretty cool when I get it done.

2) I’ve been doing a back to fundamentals thing with my music – been practicing a lot of scales and patterns, concentrating on A: playing them all without looking at the keyboard and B: working on complex patterns with my left hand, trying to get better at walking bass lines

3) I’ve been working – so far mostly on paper, not in code – on a four-neurotransmitter spiking neural network simulation which is intended to be capable of unsupervised learning. More on this later.

Hope you all are having fun out there.

The problem with laws

Monday, June 11th, 2018

So, one of the stupid things us humans do – and I know, there are a bunch – is try to create a rigid code of rules to describe acceptable behavior in every situation. This wouldn’t be such a problem if the Milgram effect wasn’t such a big thing with us – once rules are written down, we tend to follow them blindly *even when we know they are wrong*.

Anyone who’s done much coding understands that it’s *incredibly* difficult to get bug free code. Laws are essentially code for humans, and to add to the fun they’re often written by people who don’t have much experience coding at all, and often written for politically expedient reasons without considering the rule of unintended consequences. They also don’t get much revision or debugging.

I submit to the crowd that the basic *idea* of having laws is flawed. What we need are algorithms that can be used to judge the appropriateness of any situation, with broad group consensus, not a attempt to imagine every situation beforehand and codify what the punishment should be if someone chooses to take a certain action.

I repeatedly see laws getting used to justify, or at least call reasonable, behavior by the criminal justice system that is both abusive and counterproductive. One of the ones that makes me the most angry is the teens who are arrested for “producing child porn” when they do things like sexting, which is perfectly reasonable and natural behavior and should not be illegal at all. I understand the original point of the laws they were breaking was to protect children from predatory adults, but if our system was somewhat better designed, vindictive and/or milgrammed police officers and judges would not be able to use them to hurt the very people they were designed to protect.

I also see one problem with the *massive* concordance of laws we currently have is it is virtually impossible to even know what’s illegal any more. Unless you spend your life doing little else, there’s not a lot of hope of knowing what’s in the hodgepodge of state, federal, and local laws that apply to your current behavior. It’s also undoubtedly true that the people authoring the laws have not thought about the long term impact of their decisions. Most of the punishments are vastly beyond what the crime entails. Watching Le Miz the other day reminded me that we still think jailing someone for a year for stealing $500 is a reasonable thing to do – while at the same time, our jails *break people worse* in several ways:

A: They are designed to punish, not to reform. This punishment often leads to justifiable anger on the part of the punished, which leads to them being *less* inclined to work with our society

B: People are programmable – and we tend to entrain on our peer group. Locking up all the criminals together just means they entrain off each other, thusly making the convicts *more* criminal

If our desire is not to live in, to use Jordon Peale’s phrase, a ‘fucked up dystopia’, we should be trying to figure out how to get the people who break laws to fix themselves and develop as individuals in ways that ensure they won’t reoffend. I’ve talked in the past about one thing that might help accomplish that (see this) but this isn’t a subject I’m a expert in – it is, however, a subject that we could science until we had a well defined science of rehabilitation.

However, I think we also need to recongize that the law itself is often hurting people – we repeatedly criminalize things that should not be illegal just because some subset of people think that people should not be free to take that particular action. Religious people have a long history of using the law as a club to enforce their particular set of morals – even when the things they are criminalizing hurt no one but the person committing the act. The law should not be used to bully people based on your personal opinion about what is right and wrong – we should be able to develop a science of right and wrong as well, created by measuring harm to others.