Mostly Bollogs, I'm afraid

But occasionally, a glimmer of truth.
If you find one, please let me know.



Wednesday, 24 September 2014

Ideal

In an ideal world, everyone would be able to afford everything they wanted, and nobody would ever be ill. The sun would shine in the day and it would rain at night.

There would be no crime, and everybody would be nice to each other.

In the real world, the only way people can afford things is for other people to suffer in order to make them cheaply enough for this to happen. So, unless you stop buying every electronic gadget that comes out, and stop wearing clothes that are so cheap you can throw them away instead of washing them, you're subscribing to that.

The alternative is that everyone earns the same. This would be nice. It used to be the case in East Germany. Unfortunately, the "same" meant that nobody could afford anything, because the world doesn't spin like that. Nobody, apart from Mother Teresa of Calcutta, would want to train for years to work 25 hours a day as a doctor when the bloke whose job it was to pick strawberries for two hours a day in the sunshine earned the same and didn't have any responsibility.

Everyone could have a nice car, but that car would be a Wartburg Tourister. I had one. Trust me, you wouldn't want one.

People get ill because the human is a bit of a shit design, and if God had done a bit more work instead of resting on the seventh day, that might be different too. But it isn't.

Ditto the sunshine. The earth is round, and because of the way it revolves and where the sun is and complicated stuff like that, the Sahara is hot and dry and Norway is dark for half the year. In a few years, Britain will be less wet and more hot, and in yet another few it will be wet and cold again. It always has been and always will be.

Criminals will always be with us because we're not all doctors. Some of us are thick and we don't earn as much as the doctor up the road, so we steal. Especially if we're big and a bit nasty.

I think even the nasty Tory voters would like everything to be wonderful. The difference between the nasty Tory and the idealist Socialist is mainly their view of reality.

I would vote for Miliband, Balls or Hitler if there was even an outside chance that the world would end up with any form of equality, and everyone would live happily ever after.

There is no chance. It can't happen. A pint pot will not hold a quart.

Under any government, you CAN'T afford everything, you WILL get ill, it WILL rain at Glastonbury and there WILL be floods. Some people WILL always hate you, because they can, because they don't understand you.

And you WILL keep buying shit from Primark. You will NOT give a stuff about the Indian who can't afford to feed their kids. Because the iPhone is shiny.

And you WILL go and vote next year, for one lot or the other, because you always do, even though they lie to you, cheat you, then make hollow apologies to match the hollow promises.

I won't. And I've bought a lottery ticket.


Monday, 22 September 2014

C# bug

Here is some code.

If you make a form using it and run it, it should produce three labels.

It does on my PC. It doesn't on any of eight other PCs I have access to.

Why not?

namespace TestStat
{
    partial class Form1
    {
        ///
        /// Required designer variable.
        ///
        private System.ComponentModel.IContainer components = null;

        ///
        /// Clean up any resources being used.
        ///
        /// true if managed resources should be disposed; otherwise, false.
        protected override void Dispose(bool disposing)
        {
            if (disposing && (components != null))
            {
                components.Dispose();
            }
            base.Dispose(disposing);
        }

        #region Windows Form Designer generated code

        ///
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        ///
        private void InitializeComponent()
        {
            this.statusStrip1 = new System.Windows.Forms.StatusStrip();
            this.toolStripStatusLabel1 = new System.Windows.Forms.ToolStripStatusLabel();
            this.toolStripStatusLabel2 = new System.Windows.Forms.ToolStripStatusLabel();
            this.toolStripStatusLabel3 = new System.Windows.Forms.ToolStripStatusLabel();
            this.statusStrip1.SuspendLayout();
            this.SuspendLayout();
            //
            // statusStrip1
            //
            this.statusStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
            this.toolStripStatusLabel1,
            this.toolStripStatusLabel2,
            this.toolStripStatusLabel3});
            this.statusStrip1.Location = new System.Drawing.Point(0, 228);
            this.statusStrip1.Name = "statusStrip1";
            this.statusStrip1.Size = new System.Drawing.Size(768, 25);
            this.statusStrip1.TabIndex = 0;
            this.statusStrip1.Text = "statusStrip1";
            //
            // toolStripStatusLabel1
            //
            this.toolStripStatusLabel1.Name = "toolStripStatusLabel1";
            this.toolStripStatusLabel1.Size = new System.Drawing.Size(151, 20);
            this.toolStripStatusLabel1.Text = "toolStripStatusLabel1";
            this.toolStripStatusLabel1.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
            //
            // toolStripStatusLabel2
            //
            this.toolStripStatusLabel2.Name = "toolStripStatusLabel2";
            this.toolStripStatusLabel2.Size = new System.Drawing.Size(420, 20);
            this.toolStripStatusLabel2.Spring = true;
            this.toolStripStatusLabel2.Text = "toolStripStatusLabel2";
            //
            // toolStripStatusLabel3
            //
            this.toolStripStatusLabel3.Name = "toolStripStatusLabel3";
            this.toolStripStatusLabel3.Size = new System.Drawing.Size(151, 20);
            this.toolStripStatusLabel3.Text = "toolStripStatusLabel3";
            this.toolStripStatusLabel3.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
            //
            // Form1
            //
            this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.ClientSize = new System.Drawing.Size(768, 253);
            this.Controls.Add(this.statusStrip1);
            this.Name = "Form1";
            this.Text = "Form1";
            this.statusStrip1.ResumeLayout(false);
            this.statusStrip1.PerformLayout();
            this.ResumeLayout(false);
            this.PerformLayout();

        }

        #endregion

        private System.Windows.Forms.StatusStrip statusStrip1;
        private System.Windows.Forms.ToolStripStatusLabel toolStripStatusLabel1;
        private System.Windows.Forms.ToolStripStatusLabel toolStripStatusLabel2;
        private System.Windows.Forms.ToolStripStatusLabel toolStripStatusLabel3;
    }
}

Wednesday, 10 September 2014

Dementia

I read today in the news about the horrendous scam whereby a person with dementia costs £30K a year to keep, and they have to pay £20K themselves.

These figures are rounded because I can't be arsed to look them up.

If you have, say, cancer, it costs about the same but you don't have to pay.

Now, please have a go at the system, the evil Tories, whatever, while I tell you some facts.

People with dementia largely sit around all day, not having any idea what day it is, what time it is, what their name is, or who you are when you visit them. Don't argue, because this is true. My mum had it, I go regularly to see my mate's mum who also has it.

I live very well indeed on a whole heck of a lot less than £30K a year, and that includes all the alcohol I can drink, all the fags I can smoke, and all the curry I can fit in my neck.

So what? I hear you ask.

This is what. If I put ten of me in here, I could live on about a ninth of what I live on. Add to that the Phillipino, etc., staff, who are paid absolute pittances.

Dementia patients do not get medical care, unless they need a doctor, who is then brought in. And is on the NHS.

Now. Ask this question. WHY does it cost £30K a year?

The answer is: it doesn't. It never did. But as long as there are rascals who want to make money hand over fist, it will cost £30K a year.

And nobody will believe me. And this rumour will carry on circulating, and nothing will be done.

Bollocks.

Monday, 1 September 2014

For Sam

Here's a silly thing. I can't say too much in case matey identifies himself.

I have a friend who happens to be a professor in a physics department at a leading British university. He has been this for a lot (really a lot) of years. He has three doctorates. God knows why.

He has a big interest in cars. He had been to see a new thing where the power steering was all electric, and was telling me how absolutely fab that was.

I asked why. Cos I'm stupid like that. He explained that because it was electric it didn't use any fuel.

You can see this coming, can't you?

I pointed out that the electricity has to come from somewhere, very possibly by the alternator in the car recharging the battery, perhaps, using the power from the engine, which uses fuel? He said "no," because he is a professor of physics.

I just despair sometimes.



Thursday, 21 August 2014

Algebra

a=b

Multiply by a:

a²=ab

Subtract b²:

a²-b²=ab-b²

Factor:

(a-b)(a+b)=b(a-b)

Divide by (a-b):

a+b=b

As a=b, substitute:

b+b=b

Combine:

2b=b

Divide by b:

2=1

Question. What's wrong?

Fair

C#

namespace MVAP
{
    class Canvas : Panel
    {
        public class StateObject
        {
            // Client  socket.
            public Socket workSocket = null;
            // Size of receive buffer.
            public const int BufferSize = 1024;
            // Receive buffer.
            public byte[] buffer = new byte[BufferSize];
            // Received data string.
            public StringBuilder sb = new StringBuilder();
        }
        StateObject state;
        public int iPage;
        public static Socket sock;
        Timer t;

        int X, Y;

        public Canvas()
        {
            Y=X*2;
        }
        public void Close()
        {
            sock.Close();
        }
    }
}

1.  Q1  I want to change X on an instance of Canvas from another class inside the MVAP namespace.

Canvas canvas=new Canvas();

When I type

         canvas.

I expect intellisense to offer me canvas.X. Why doesn't it?

2.   Q2 When I change X from my other class, I want the canvas to calculate Y as X*2 automatically. How do I do that?

3.   Q3 I want a routine which opens sock and broadcasts a single character poll on it. I want the program to do nothing apart from accept user input after that, but if the equipment receiving the broadcast sends a response, I want the canvas instance to asynchronously receive it and act on it. How do I do that?




C

int i;
i=1;
int k;

switch (i)
{
         case 1:
                 int j=1;
         case 2:
                 int j=2;
         default:
                 j++;
                 k=j;
}




1.  Q4 Where are the compilation errors?

2.  Q5 Assuming I fix the compilation errors, what is j at the end of this?

3.  Q6 What is k at the end of this?



struct a {
         int i;
}

struct b {
         int i;
}

struct c {
         struct a *pa;
         struct b **ppb;
}

1 Q7   I want to make a new instance of struct c, which holds exactly one struct a and many struct b's. I want to expand this as and when required. How would I declare this and how would I add to it?

SPI


I have two PICs which need to communicate via SPI. The master needs to communicate at 2Mbps.
1.  Q8 How do I set the speed of the slave PIC?
2.  Q9 The master sends a single-character request to the slave, and reads back a single-character response dependant on the request. How do I achieve this without the master sending more than one byte?




        


Thursday, 14 August 2014

Nightmares

I don't know why I'm telling you this, perhaps I'm hoping it will go away.

I have recurring nightmares, about three things. I used to have only one, but it went away. I had a bedroom (I didn't really, it was in the nightmare) which was three floors up in a house and I had to go through a winding corridor to get to it, but I kept getting stuck in the corridor and died. Most nights.

I'm glad I don't have that one any more.

The ones I have now are from experiences.

First one: I was a Plod at the Guildford Bombings (yes, I am that old) and I had to pick up bits of body and stuff. I get flashbacks from that one, still. I think this was in 1976.

Second one: I visited an old gaol somewhere in the lakes years ago. There was a dungeon, which was a gurt hole in the ground, with a small hole into which they dropped a prisoner for (say) stealing a chicken or owing the council some money. A "magistrate" sentenced him to having his arms tied behind his back and then dropping him down the hole, so his shoulders dislocated. If it didn't work, they did it again with weights tied to his feet, and if it didn't work again, increased the weight until it did. I think they did this in the 1800's.

Third one is the story of a chap who had a cross-amputation, i.e. have one arm and the opposite leg removed, with no anaesthetic, on a carpet of polythene, by "priests" with bonesaws and butchers' cleavers. The thing that got me was that he said "please make it quick." They didn't. They did this very recently and a far as I know they still do.

What I'm getting at is how, and why, a human can do any of these things to another human, or animal, in the name of some old bollocks which really didn't matter then and still doesn't.

WHY can't people just be?


"Many and sharp the num'rous ills 
Inwoven with our frame! 
More pointed still we make ourselves, 
Regret, remorse, and shame! 
And man, whose heav'n-erected face 
The smiles of love adorn, - 
Man's inhumanity to man 
Makes countless thousands mourn! 

Robert Burns.