Showing posts with label to. Show all posts
Showing posts with label to. Show all posts

Tuesday, August 27, 2013

Rules for success

This just came into my head, and I think it's worth writing down.

What are the rules for success? I know what #1 is: Don't be stupid. How about the rest?

Rules for Success
  1. Don't be stupid
  2. Set Reasonable Goal
  3. Make Plan
  4. Do Plan
  5. Adjust previous steps until done
  6. Success!!!

And well, that's all there is to it. Of course, the devil is in the details, but as long as you can follow these steps, I think you'll be fine. :)

Monday, August 20, 2012

Petit Computer Journal#3


Petit Computer Journal #3

How to use Buttons and Directional Pad

Let's do something real quick. Let's make a counter that will increase when a button is pushed. Looking at the various commands, it is obvious that it is either BUTTON() or BTRIG(). Let's use BTRIG(). Reading the Help entry shows that the value returned by BTRIG() is usually 0. Non-zero if there's a button pushed. Perfect. We come up with this very quickly:

CLS
@COUNTER
B=BTRIG()
IF B==0 GOTO @COUNTER
A=A+1:A=A%1000:'0-999 CYCLE
?A;"      "
GOTO COUNTER

We run the program, and press a button. We see that the counter increments, all right. And it cycles to 999 like it should. However, the program registers so many button presses. That is not what we want. We want 1 increment per button push. So, we need to fix it. At this point, most people would do the sensible thing and type into Google: "Petit Computer how to use button". 

Haha, joking aside, we do need to understand how to read buttons properly. What do we do when the platform does not have built-in debugger? Well, we make our own!


What to do when things go wrong

I know I'm bucking the convention, here, but writing self-debugging program isn't that much trouble. The most important thing is that you want to understand what's going on. The simplest, easiest method to do it is read the manual. When the manual fails, however, we need to do better. That means we need to try things out and see what happens. It's called, "Learning without a teacher" or "Research". If you passed high school, then you know how to do it.

First make a hypothesis: One button press=one event. (desired behavior)

Then gather data: One button press=many events (observed)

Therefore, the conclusion is: what we want, and what we have are two different things. Error!

There are many kinds of errors in computer programming, but let's just simplify things a bit for now.

Computers are stupid, remember? If you mistype a command, the computer cannot handle it. If you forget a variable, the computer cannot handle it. If you transposed commands or letters or anything, the computer cannot handle it. The computer will complain: "Syntax Error!" That means, you have typed something incorrectly as to confuse the computer.

Another kind of error occurs when you ask the computer to do the impossible. Dividing by zero is one. GOTO a unlabelled section is another. These kind of errors are called "Run-time Error", because they occur at the running of the program.

Sometimes the program runs fine, but doing something else than what we want. We want to roll 5 dice, but only 1 is rolled. That means that what we say and what we want to say are two different things. We need to figure out a different way to say what we want. This is called "Semantic Error".

If, however, your screen is cracked, plastic is chipped, and stylus bent, then we have what is called PEBKAC Error: Problem Exists Between Keyboard And Chair. You probably should stay off computer programming for a while.

A binary review

If you're wondering why the values for the buttons are 1,2,4,8 etc, the answer is that the buttons do not have separate variables. The figure is all one number! There are different bits to the number, and that is what we're seeing. We can take a look at various bits by doing this code:

V=9
FOR I=0 TO 7
P=POW(2,I)
IF (P AND V) THEN ?"1"; ELSE ?"0";
NEXT
PRINT

In this case, we're doing a "Binary AND" (instead of "Logical AND") using bit 0-7. You can, of course, increase the bits to 31. I'm trying to keep it simple. Try putting in different values into V variable.


Source code for button readings

If we want to see what the buttons do, then it is very simple to do this:

CLS
@MAINLOOP
A=BUTTON(0)
B=BUTTON(1)
C=BUTTON(2)
D=BUTTON(3)
E=BTRIG()
LOCATE 0,0
?"BUTTON(0) ";:V=A:GOSUB @BIN
?"BUTTON(1) ";:V=B:GOSUB @BIN
?"BUTTON(2) ";:V=C:GOSUB @BIN
?"BUTTON(3) ";:V=D:GOSUB @BIN
?"BTRIG()   ";:V=E:GOSUB @BIN

'PLACEHOLDER

GOTO @MAINLOOP

@BIN
FOR I=0 TO 7
P=POW(2,I)
IF (P AND V) THEN ?"1"; ELSE ?"0";
NEXT
PRINT
RETURN

You can see the flickers for Button 1-3. That means the change happens in an instant. In this case, the change happens only in one frame, or 1/60 of a second. That's fast! I also see that the flickers on B is identical with the flicker on E. From that, I deduce that BTRIG() is equivalent to BUTTON(1). Is there any delay or waiting either with BTRIG() or BUTTON()? None that I can see.

If you want to make sure, replace the "'PLACEHOLDER" with these lines:

IF A!=E THEN LOCATE 0,7 :V=A:GOSUB @BIN:V=E:GOSUB @BIN
IF B!=E THEN LOCATE 0,10:V=B:GOSUB @BIN:V=E:GOSUB @BIN
IF C!=E THEN LOCATE 0,13:V=C:GOSUB @BIN:V=E:GOSUB @BIN
IF D!=E THEN LOCATE 0,16:V=D:GOSUB @BIN:V=E:GOSUB @BIN

The suspicion that BTRIG()==BUTTON(1) is confirmed! Now that's what I call successful research!



The fixed source code

Now that we know what is happening, we can do different things to fix it. 

First, we can specify that the increase is between Button Push and Button Release, like so:

CLS
@COUNTER
B=BUTTON(2)
IF B==0 GOTO @COUNTER
A=A+1:A=A%1000:'0-999 CYCLE
@C2
B=BUTTON(3)
IF B==0 GOTO @C2
?A;"      "
GOTO COUNTER

And that works nicely. However, let's see if we can improve things a bit. The manual mention VSYNC 1, as a way to get the input right. So, let's use that

CLS
@COUNTER
B=BUTTON(2):VSYNC 1
IF B==0 GOTO @COUNTER
A=A+1:A=A%1000:'0-999 CYCLE
?A;"      "
GOTO COUNTER

That also works, and notice that it is cleaner. What happens if VSYNC is set to something other than 1? Try it! You'll see that you will be missing some button presses. The exception to that is if you use BUTTON(0), and only at the sync.

CLS
@COUNTER
B=BUTTON(0):VSYNC 15:IF B==0 GOTO @COUNTER
A=A+1:A=A%1000:'0-999 CYCLE
?A;"      "
GOTO COUNTER

And that's what we want. Problem solved!

The rest of Console Entry Commands

Try out this command: BREPEAT 4,60,4
That will cause the A button to be repeated if you press it longer than 1 second. Pretty neat, eh?

Also, what is the difference between INKEY$, INPUT, and LINPUT?
INKEY$ behaves just like BUTTON(), in that it doesn't stop and wait for keypress.
LINPUT, LINE-INPUT, takes the whole line, including commas.
INPUT takes the line, and assign different values separated by commas.

And that's all there is to it!

Wednesday, July 11, 2012

Nasty People


Have you ever tried to have an argument with a totally unreasonable person? Very frustrating, wasn't it? Yet, it happens all the time. This last one was absolutely horrible, and when I was reflecting upon it, the full extent of horror revealed itself, and it's not pretty.

First of all, I will refer to have read a certain kind of BOOK. Specifically, Anthony Weston's A Rulebook for Argument. It is a small, concise guide to have a reasonable argument. It also details a few logical fallacies that unreasonable people love to use. I tell everybody to read it and use it. So far, no luck.

There are 2 people involved here, I will mention person A and person B. This is not the complete conversation. I remove certain passages, especially near the end, due to ramblings and decency. I do preserve the lines as much as possible.

Person A: Solving the problem of unaffordable healthcare by requiring everyone to buy healthcare is like trying to solve homelessness by requiring everyone to buy a home.

Me: We already did that with SS retirement. I wonder why they didn't just extend Medicare for everybody. 30% admin fee of insurance for care adds up to a lot of money! I sure want to buy cheap, government back health care than expensive private ones.

Person A: Cheap government healthcare will turn into rationed government healthcare.....no thanks

[So far so good. I agree with Person A. Cheap government healthcare = rationed healthcare. I don't like it either, but that's what we have right now with Medicare. I pay money into it, and it's rationed to 65 years old or older, and only hospital stay unless you want to pay extra for MediGap.]

Person B: Ya want expensive healthcare? It's coming soon....... Government run healthcare isn't free....WE WILL PAY FOR IT>>>>>> DUH !

[This is the unreasonable person. You can tell right away by his tone of voice. "Ya want" instead of "You want", "DUH" which implies that what he says is common knowledge. (ad populus) This has all the superiority complex written all over it.]

[His claim (even though he phrased it as a question) that I want expensive Health Care is false. I specifically mentioned that I want cheap health care. What is wrong with this guy? Does he somehow equates "I want cheap" into "I want expensive"? I'm surprised he didn't say "rationed healthcare" is "unlimited healthcare". Same logic. Why did he pick on me?]

[So we have several statements:
False statement: You want expensive healthcare.
Maybe False statement: It's coming soon.
True, but irrelevant statement: Government run healthcare isn't free.
False statement: We will pay for it.
]

Me: We WILL pay for it? Last time I check they take out Medicare from my paycheck. We are paying for it now! I think Person A is right. Rationed is much more probable. Take a look at VA hospital situation if you want to see how it goes.

[I concentrate on the last statement. When somebody blatantly twisted my word into his own agenda, I don't bother. It's bottomless misery. This knowledge is gained by hard experience. Some people don't care about the truth. They just want to pick a fight with somebody for no reason.]

[I mention Medicare tax, which this person has been paying, but somehow completely ignore the fact. Ignoring clear facts when it invalidates your claims isn't a good trait to have. A normal person would have apologized for this oversight.]

Person B: I meant we are going to pay MORE.........way more, those of us that work that is. He said it would reduce healthcare costs, and steadily it has risen for all policies.

[He didn't apologize. Also notice a new line of reasoning coming out of nowhere: "He said it..." Who's he? None of the text above mentioned anybody claiming to reduce healthcare costs. This is an unexpected jab from the left field. Notice how he put in statement that may be true, but totally irrelevant? This trick on putting in irrelevant materials is an old trick that posers use. By "posers", I mean people who pretends to be somebody else, usually a much better person that the poser. In my experience, this process will take anywhere between 30-45 minutes to exhausts itself. In the meantime, said poser will have covered anything and everything under the sun...except the relevant topic.

Dubious claim: I meant we are going to pay WAY MORE.
There are several factors here.
1. The implicit agreement that right now, we aren't paying a lot, or at least reasonable fee.
2. That sometime in the future, the fee will radically increase.
3. Congress will do nothing to prevent this from happening.
4. Healthcare will have runaway cost, and that isn't happening right now.

I can tell you that there is a lot of grumbling right now that health insurance costs are climbing rather high. But they are all in the private sector side. The government side is still on the cheap side, just not available (being rationed).

However, his statement did pique my interest. A few questions comes to mind: How much more this will get? How soon will this happen? and What is the probability/confidence factor of this happening within that said time frame and level?Whenever somebody say "MUCH, MUCH more", I always ask "How much more EXACTLY?"
]

Me: Road tax < Toll Road fee. State College < Private College. I don't see how you can say Government Health Care will cost more than private ones. [snip] As far as paying more, that's a given. But how much more compared with privatization? Have you any resource to back your statement or are you going by unconfirmed hearsay?

Person B: [sarcasm deleted] Please name me one Government Institution that is efficient or cost saving, [snip] Rationing? You and the government can keep it, I don't want any part of it. Costs are going up now, my friends that pay for it tell me so.[snip] As most Democrats feel....believe everything you hear him say and none of what you see with your own eyes. Hope America wakes up before it's too late. Car companies, college tuition, now me and my doctor.....keep the change.

[I am having trouble following this train of thought. He was rambling, especially at the end. It gives me headache to try to follow through his reasoning. Read that last sentence again, and if you can decipher the meaning, please tell me. I can't make any sense out of it. Here goes:"Car companies, college tuition, now me and my doctor.....keep the change."

Basically, there are several nouns, followed by an imperative "keep the change". I don't see the connection at all. There is no verb. What is he trying to say? Looking at the preceding sentence "Hope America wakes up" didn't help. The sentence before that didn't help either. I believe he simply regurgitate random things, literally. Why? I don't know. But some curmudgeon likes to do that for no reason.

Insult: Please name me one Government Institution that is efficient or cost saving
The order of the sentences is correct. I gave him TWO examples how government is more efficient than private institution, and he followed by asking me to give him ONE example. Unless you are a contestant in Jeopardy!, it is considered extremely rude to follow up an answer with the question! This is a blatant attempt to erase my statement. This may work on unrecorded conversation, but on message board for all to see, this is just silliness.

False claim: Rationing? You and the government can keep it, I don't want any part of it.
What makes you think I want rationing? In fact, this statement "I wonder why they didn't just extend Medicare for everybody." actually shows that I DO NOT want rationing. I simply agreed with Person A that rationing is likely. I never endorse it. By falsely claiming that I want it, he makes it look like I'm some ignorant fool. This is an indirect attack on me. In my experience, this is what somebody does when he wants to do personal attack in an attempt to discredit a person. Very difficult to defend in normal face-to-face conversation. With recorded text? It can easily be shown false.

Hearsay: Costs are going up now, my friends that pay for it tell me so.
Yes, that is hearsay. Unless you can tell me exactly how much costs are going up, I'm going to call it hearsay. Anyway my statement "As far as paying more, that's a given. But how much more compared with privatization?" has just been tossed away. I already said that costs are going up. Why is he saying costs are going up, AFTER I said costs are going up? This is just like asking the question after getting the answer. Another insult. Also notice that he never answered my question: HOW MUCH MORE?

False statement: As most Democrats feel....believe everything you hear him say and none of what you see with your own eyes.
This God-like attribute is usually connected with Obama, but notice that he never mention the name? In any case, I'm not a Democrat. I'm an Independent. Notice how he randomly assign labels on me? This is so that he can claim that I am a sheep, blindly obeying somebody's statement, which is not true at all. This labeling is blatant attempt to manipulate opinions, which if you haven't read THE BOOK, is very effective.
]

Person B: Cheap government healthcare hehehehe, think again.

[I don't see how he can make this statement. Go back to the beginning. Specifically:
Me: We WILL pay for it? Last time I check they take out Medicare from my paycheck. We are paying for it now! I think Person A is right. Rationed is much more probable. Take a look at VA hospital situation if you want to see how it goes.
Person B: I meant we are going to pay MORE.........way more,

The previous exchange has shown that we have cheap government health care right now! It's called Medicare! Hello? Does he just randomly toss statements left and right without thinking whatsoever? Oh, what am I talking about? Of course he does!

Me: Gosh, you are so negative. You don't want this. You don't want that. Are you some kind of old curmudgeon? Because, as I see it, you ARE going by unconfirmed hearsay.

Person B: I wouldn't call my personal experiences with the VA as "hearsay". Another democrat argument, when you can't win the argument just start calling people names....... And personally, your opinion of me is less than meaningless. [sarcasm deleted]

[This is another misdirection. Typical of ramblings and/or deflection when it comes to the truth. Notice another democrat labeling. 
Misdirection: I wouldn't call my personal experiences with the VA as "hearsay" 
Nor did I say that. I was referring specifically to your friends' claim, of which you never actually see the figure yourself.

Leading: Another democrat argument,
False accusation: when you can't win the argument just start calling people names
Interesting that he says that, because I have shown that he's the one losing the argument, mostly because he's rambling. I also notice that he use the "Democrat" label on me. Do I call him names? Nope. I did ASK A QUESTION, whether or not he's a curmudgeon.

As to the question, he could have answered these way:
1. No, and here's why... I'd probably believe him.
2. Yes, and I'm sorry. I'd probably forgive him.
3. Not answer at all. It'll be an open question.
He didn't do any of that. What he did was:
4. Rambling, misdirection, heavy sarcasm and insults - which is exactly what a genuine curmudgeon would do.
]

At this point I knew that further communication is meaningless. Not because I lost the argument, but because he is being unreasonable, unwilling to listen, and unwilling to be wrong. He's insulting, and blames his defects on me. I do not need to consult a dictionary to understand that "less than meaningless" are words designed to hurt, not communicate. I could have said a lot of nasty things, but I didn't. I did pull out my computer to confirm my initial assessment of him, just because my blood boils. It was confirmed.

Me: Curmudgeon status: Confirmed. I have better things to do. Bye now! :)

Later on, Person A intercede on Person B behalf.

Person A: Calling Person B a curmudgeon is like calling a turd a rose. Nothing could be further from the truth. Simply having a negative opinion about something does not a curmudgeon make.[snip] I am all for good debates, but let us please be respectful with no name calling. That, to me, is a sign of losing an argument.

[Oh great. Another idiot in the art of rhetoric. Why can't people read THE BOOK?!
I have laid down the foundations why I think Person B fits a curmudgeon, and all that is ignored in favor of only one thing: a negative opinion. 

Are you kidding, Person A? Do you not read what was written? It's more than that!

This got snipped, but his claim that VA will not help Person B's cancer may be accurate, but insurance or no, private hospitals are required to help a person regardless of money. It just means Person B will be paying for it for the rest of his life.
]

Me: So, then, when Person B is calling me a Democrat, even though I'm Unaffiliated Independent, does that mean he's losing the argument? I'm not so stupid as not to know what hearsay/insult/sarcasm is. Sometimes good message can be sour, if the delivery is done poorly. Until Person B can clean up his language, I will keep calling him a curmudgeon, and rightly so.

Person A: so let me get this straight, you use a computer program to determine whether someone is negative or annoying? [snip] as far as calling you a democrat, I believe he is pointing out that you calling names instead of proving your point or providing facts is a typical tactic of many democrats. Just because someone may not be able to deliver the message in a flourish of brilliant verbage, does not automatically make their argument null. [snip]

[
Hidden assumption: so let me get this straight, you use a computer program to determine whether someone is negative or annoying?
I didn't realize this at first, but there is a hidden assumption here.

There are two possibilities:
1. What happened: I felt insulted. Anger has a way to distort perception. To be fair, I use objective calculation. Thus, I confirm my initial perception with a computer.
2. What is assumed: I am stupid. I therefore subject my will to a 2 bit machine to tell me what to do.

If you know me, then you know that assuming #2 is a GREAT INSULT to me, and if I stop at un-friend you at facebook, consider yourself very, very lucky!
]

[as far as calling you a democrat, I believe he is pointing out that you calling names instead of proving your point or providing facts is a typical tactic of many democrats.

Sigh. This statement is why I think we are premature in withdrawing flexible leather strap as educational implement, since I believe he needs one. But since we are in Modern times, let me just say this:


"You quack like a duck, sir. Not that I'm labeling you a duck, or calling you a duck. But you look like a duck, act like a duck, and quack like a duck!"

Get it?

I noticed he failed to mention Person B employed that very tactic!
]

Me: Yes, I use a computer. How else would you know the truth? Yes, rationed health care like Canada and VA aren't good. Do you somehow miss that? Very annoying to be criticized for believing something you don't believe. I don't believe that's a mark of a good man. You don't do that, Person A. Why is Person B doing that to me? He doesn't have to be brilliant (isn't that a straw man argument?), just not insulting or ignoring facts. Look, do me a favor and read Anthony Weston's A rulebook for Argument. If after readling it, you still think Person B is not being insulting, I will take your word. How's that?

[Here I was referring to Person B's constant derisions/ignorance, but I am too polite in these matters.]

Person A: I will leave it at this. No computer program is going to show intent. One of the problems with FB is that intent, tone and personal contact are missing. I do know Person B, and insulting is not his intent I am sure, however his experience sure carries a lot of weight with me. we are not all professional debaters, just people trying to make our way through.

[
1. I will leave it at this. No computer program is going to show intent.
This is when I suspect there is a hidden assumption.

2.  One of the problems with FB is that intent, tone and personal contact are missing.
True enough. But it doesn't take a genius to notice that his vocabulary changes. Also, the constant misdirection cannot be misinterpreted either.

3. Hearsay: I do know Person B, and insulting is not his intent I am sure, however his experience sure carries a lot of weight with me.
Did you ask Person B to make sure? No? Hearsay.

4. we are not all professional debaters, just people trying to make our way through.
This is a polite way of saying he will never read THE BOOK. Got it loud and clear, buddy. Sigh.

]

Me: That is true. And I will take your word that Person B has no intention to insult me. Then again, I have insulted many people *unintentionally*. So will you accept the fact that Person B may have insulted me unintentionally? When there is strong clashes of opinions, that is when I use the program to see who is the most opiniated. It works.

[
Even at this late term, I'm still willing to forgive Person B's transgressions. The hope, of course, that Person A will tell Person B that he has insulted me unintentionally, and apologize for it. 

Well, so far that hasn't happened. There is only one conclusion, then. Person B *intentionally* insulted me. Looking at the exchanges above, I don't see how it can be interpreted differently.
]

[
When there is strong clashes of opinions, that is when I use the program to see who is the most opiniated. It works.
I said this just to clarify which of the two assumption applies.
]



Alright. What do we have here?
Person A is reasonable, and accurate, even though he hasn't read THE BOOK. Person B is an old irascible grump, who has no qualms of ignoring facts, deriding people, twisting words, make false and ridiculous assumptions, and generally misleading people.

He also makes claims that are vague and generic, the kinds that cannot be fingered as false. Obviously, he cannot stand criticism. He cannot handle being wrong.

He also is willing to blame his defects on other people, as to make his faults other people, thus shifting the spotlight of blame away from himself.

Wait a minute.

This feels familiar.

Where have I seen this pattern before?

Ah.

I have it!

Here are the patterns:
1. Unwilling to listen
2. Unwilling to be wrong
3. Blames his defects upon other people
4. Drag in any irrelevant subjects to the discussion
5. Scream, yell, and behave abusively. (throwing tantrum)

We didn't exactly get to step 5, but all the signs point there.

The pattern fits that of Invalidators, as described by Jay Carter, in his book "Nasty People." Go read it. Go read THE BOOK, and go read this book.

Nasty People. Invalidators. Figures. Sigh.
Person B=Invalidator.

To Person B:
Now that I know what you are, I hope you understand that the time of forgiveness is past, and that any future attempt to apologize will be seen as deceitful manipulation attempt on your part. Go read Nasty People book for explanation. Thank you for understanding, and sorry that this happened.