Mostly Bollogs, I'm afraid

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



Thursday, 20 November 2014

Straight C

I have something that works.

It is GCC and on a 16bit machine, so int is 16 bits.

typedef unsigned int uint16;

#define NO_OF_BATTERIES 2
#define TIME_AVERAGE 5
uint16 aa_timeAverage[NO_OF_BATTERIES][TIME_AVERAGE]={1,2,3,4,5,6,7,8,9,0xa};

uint16* pNewTimeValue;

void main(void) {
    int iBattery=0;
    pNewTimeValue = aa_timeAverage[iBattery]);             // store pointer for new time average value
    memmove(aa_timeAverage[iBattery]+1,                       // destination: element 1
         aa_timeAverage[iBattery],                                         // source: element 0
        sizeof(uint16)*(TIME_AVERAGE-1));                     // shift up Time Values
    *pNewTimeValue=99;
}

If I change it to:

    memmove(aa_timeAverage[iBattery]+1,                      // destination: element 1
        &(aa_timeAverage[iBattery][0]),               // source: element 0
        sizeof(uint16)*(TIME_AVERAGE-1));                          // shift up Time Values

I need to cast as (const uint16 *)&(aa_timeAverage[iBattery[0]) to stop a compiler "suspicious pointer" warning.

Anyone know why?


Thursday, 6 November 2014

Fool

The Government announced today that they are to write to the petrol-selling folk to tell them that the oil price has fallen by 20% and the pump price has only fallen by 5% and that this isn't good enough.

That's a fact.

80% of the price the consumer pays at the pump goes to the Treasury, in Fuel Duty (with VAT compounded on that duty).

That's a fact, too.

Take the price of petrol as £1.25.

80% of that is a quid.

The petrol you're paying for is 25p.

If that falls by 20%, it's now 20p. Add the quid that the Treasury takes, it's £1.20.

Now, 5% off the original £1.25 is 6¼p. So you should be paying £1.25 - 6¼p, which is £1.18¾p.

So you're paying 1¼p per litre too much for fuel, unless you go to TESCO, ASDA, Morrison's. And many others, in which case you're paying less. And you're getting more than 5% off. You can shop around, it's your choice. All petrol is much the same, and there aren't many refiners.

The petrol-selling folk sell a lot of petrol. And they employ a lot of people, who pay tax to the Treasury.

And the government is going to write to the petrol-selling folk to tell them to be fair.

I know who you need to write to.

So now who's a fuel fool?

Any rocket scientists, politicians, mathematicians out there want to argue?



Tuesday, 4 November 2014

Recursion

I'm having trouble getting my head round this.

Monday, 3 November 2014

Those few. Those happy few.

I am humbled by those who fought for our country.

I wasn't there when it was invaded by the Germans, not in the fighting kind of way. I am here now, being invaded by the Germans, whose economy is fucked beyond recognition. Who are now asking us for £1.7Bn to bale them out of the shit in which they've found themselves, because some pillocks thought that joining the EU was a brilliant plan.

Fuck them. Fuck the EU.

Those who fought, against their will, often, for that which we hold dear, who died because we had no choice but to fight the bastards, those good and true men, I hold in the utmost respect. The poor sods.

Those who now fight in silly skirmishes, against brown people with oil, where the MSM report daily if ONE of them has died, no, I don't do that. They would be better off, those happy few, telling the government to stuff their stupid pseudo-patriotic bollocks right up their arses so it brings to mind cancer of the tonsils, and by God I wish they'd have the balls to do so.

Just me. No offence to the proper geezer who did that for the right reasons. I just don't know many of them.

As always, just my opinion.



Wednesday, 1 October 2014

Right

Right, you bastards.

David Cameron was table-thumping today about how he lost a child and how he went to a hospital and how they "loved" him like their own.

I bloody understand that.

I lost a daughter when she was 25, to fucking cancer. You can't blame a party for that.

What you CAN do is to call out some fucking wanker who thinks that going "condolences" to Alice, on fucking Twitter, whose bloody murder was down to inactive, illiterate, fucking stupid Plod and an attitude of Political-Correctness trumps common sense and human fucking decency. Such as Ed "I must extend my Bosh Hizbollah" or whatever shit Jewish pants to all his fucking friends.

If David (yes, he is a fucking poof) Cameron wants to thump a table because he's had enough of this shit, then let him.

I thump the table. Frustrated. Often.

I despise the cunting lot of them.

Don't, just DON'T pan the guy because he has an experience. He has a piece to say.

Yes, they can all fuck off. Labour don't have a monopoly on the fucking NHS.

No, YOU fuck off.

Cameron

On the other hand, we denounce with righteous indignation and dislike men who are so beguiled and demoralized by the charms of pleasure of the moment, so blinded by desire, that they cannot foresee the pain and trouble that are bound to ensue; and equal blame belongs to those who fail in their duty through weakness of will, which is the same as saying through shrinking from toil and pain. These cases are perfectly simple and easy to distinguish. In a free hour, when our power of choice is untrammelled and when nothing prevents our being able to do what we like best, every pleasure is to be welcomed and every pain avoided. But in certain circumstances and owing to the claims of duty or the obligations of business it will frequently occur that pleasures have to be repudiated and annoyances accepted. The wise man therefore always holds in these matters to this principle of selection: he rejects pleasures to secure other greater pleasures, or else he endures pains to avoid worse pains.

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.

Wednesday, 6 August 2014

Weird email

Good Morning

 Hope you get this on time, I made a trip to Brussels(Belgium) i had my bag stolen from me with my passport and personal effects therein. The embassy has just issued me a temporary passport but I have to pay for a ticket and settle my hotel bills with the Manager.

I have made contact with my bank but it would take me 5-7 working days to access funds in my account, the bad news is my flight will be leaving in less than 12-hrs from now but I am having problems settling the hotel bills and the hotel manager won't let me leave until I settle the bills, I need your help/LOAN financially and I promise to make the refund once I get back home,the fastest and safest means of getting the money to me now is via Western union Money Transfer you are my last resort and hope, Please let me know if I can count on you and I need you to keep checking your email because it's the only way I can reach you.

Waiting for your mail

Many thanks,
KC

Thursday, 3 July 2014

Infamy

Notice of removal from Google Search: we regret to inform you that we are no longer able to show this pages from Pengy's website in response to certain searches on European versions of Google.


Monday, 23 June 2014

Camel

I went to Marrakech last week for a few days. Spell checker says it's Marrakesh. It isn't.

Marrakech is in Morocco, which is officially Royaume du Maroc, because the French overran it in the early 20th century, when the Brits were overrunning India and places like that. That's why they speak French. They speak another language too but, like Flemish, nobody else speaks that, so they can talk about you while you're there.

They're all crooks. All of them. They're all skint, apart from the King, but they all have pictures of the king hanging on their walls, presumably so when the revolution comes and he deploys the army, they hope not to get shot. The king has loads of palaces and shit.

The currency of Morocco is the Dirham (easier to remember Durham and say it in a Northern accent), which is abbreviated to DH, or MAD. Every 10 of those is worth roughly 70p, unless you change money at Heathrow in which case every ten of those is worth £1, and you're an arse.

Petrol is £1 a litre. That doesn't matter, because you get in a taxi which will try to charge you 60DH (about £4) to go anywhere. You tell them 20DH. They say 45. You say 20. They say 40. You say 20. They say "vous voulez" which means "bugger it, I need the money" and you give them 20 at the end of the journey, unless they are nice in which case you give them 30. Check your change. Fuck it, it's £1.40 and you've got ten miles for that, in blistering heat. The aircon doesn't work. The windows are either open or missing, though. I THINK they drive on the right, but it's hard to tell.

Go to the Ensemble Artinasal, a government (I use the term loosely, the government is lining its own pockets, not like our one) run bunch of shops where you don't haggle. The price is the price. Find the price of the thing you want, then go to the souk, or market, or den of thieves, which is like Mos Eisley Spaceport except the people in Mos Eisley have better teeth. At least they have teeth.

Go round the souk, where everything similar is grouped. So if you want a particular thing, say a lampshade, you go to lampshade street. You can get a heck of a lot of work for not much money. Tell them that is what you're offering and walk off, they'll find you, eventually that's what you'll pay. If he won't take it, next door will, and if you're lucky a fight will break out and they will throw stuff about.

A bloke will come up to you and tell you that the way you're going is the wrong way, and "is closed." He will take you round in circles for hours and then ask for money. Tell him to fuck off. Whatever you offer him "is not enough." Take the piss out him for a while then tell him that in payment, you will give him some advice, this being "find the twat who told you that you could rip off an Englishman with a simple trick like that, and kick him in the bollocks." This leaves them confused. If it doesn't work out, growl a bit. They're mainly short and not very well-nourished.

Passport control is shit, like every banana republic I've been to. Takes ages. I presume they're worried about people getting out, because nobody in their right mind would want to get in for longer than a few days.

On the upside, the restaurants are excellent. I managed beers, wine, escargots (6), locally caught Atlantic spider crab, ris de veau, proper Baba au Rhum (where they put the rum bottle on the table and you neck most of it), decent brandy, coffee and petits fours, cost about £22 and I was in the gutter. Taxi home, £1.40. Brilliant. Put on half a stone.

Or you can eat in the square, on the street, choice of 50+ "cafes", no alcohol, loads of food, great kebabs, salads, watch a fight, about £4. Imodium and Diarolyte, as well as unbranded Kaolin and Morphine available at all pharmacies, about £4 too. Lost half a stone.

Interesting fags can be bought from the baccy-man, "normal" Marlboro about £2.80. Or 20p each if you only want one. Or 50p if you want them a bit interesting. If you are caught smoking these, Plod would like some too, and a few quid, please.

Don't take the piss out of Allah. They hate that.

Ah yes, camel. I missed the camel and got this pic of some people going to work. Have that instead.

Pengy x



Monday, 9 June 2014

C#

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace BuildRack
{
    public partial class Form1 : Form
    {
        public Color[] cTable={Color.Black, Color.Brown, Color.Red, Color.Orange, Color.Yellow, Color.Green, Color.Blue, Color.Indigo, Color.Gray, Color.White};
        public int ix = 0;
        TableLayoutPanel Rack;
        public Form1()
        {
            InitializeComponent();
            this.Rack = new System.Windows.Forms.TableLayoutPanel();
            Padding pad = new Padding(0);
            Rack.Margin = pad;
            Rack.Enabled = true;
            Rack.Location = this.ClientRectangle.Location;
            Rack.Size = this.ClientRectangle.Size;
            Rack.CellBorderStyle = TableLayoutPanelCellBorderStyle.Single;

            for (ix = 0; ix < 10; ix++)
            {
                this.Rack.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 10.0F));
                this.Rack.RowStyles.Add(new RowStyle(SizeType.Percent, 10.0F));
                Label b = new Label();
                b.Text = ix.ToString();
                b.BackColor = cTable[ix];
                Rack.Controls.Add(b, 0, ix);
                Rack.SetColumnSpan(b, ix+1);
                b.Size = b.Parent.Size;
                b.MouseDown += b_MouseDown;
            }
            Rack.DragDrop += Rack_DragDrop;
            Rack.DragOver += Rack_DragOver;
            Rack.DragEnter += Rack_DragEnter;
            this.Controls.Add(Rack);
            Rack.Show();
        }

        void Rack_DragEnter(object sender, DragEventArgs e)
        {
            throw new NotImplementedException();
        }

        void Rack_DragOver(object sender, DragEventArgs e)
        {
            throw new NotImplementedException();
        }

        void Rack_DragDrop(object sender, DragEventArgs e)
        {
            throw new NotImplementedException();
        }

        void b_MouseDown(object sender, MouseEventArgs e)
        {
            Rack.AllowDrop = true;
            ((Label)sender).DoDragDrop(sender, DragDropEffects.Move);
        }
    }
}

Friday, 23 May 2014

SQLSERVER

Script:

DROP TABLE EVENTS;
CREATE TABLE EVENTS(MAC bigint NOT NULL, Node tinyint, Datim DateTime NOT NULL,
Type tinyint NOT NULL, Event smallint NOT NULL, Status tinyint NOT NULL);
Insert into events(MAC, Node, Datim, Type, Event, Status) values(0x123456789abc, 4, '2014-05-13 13:25:30:001', 1, 27, 1);
Insert into events(MAC, Node, Datim, Type, Event, Status) values(0x123456789abc, 4, '2014-05-13 13:25:30:002', 1, 27, 1);
select * from events;

Results:

20015998343868 4 2014-05-13 13:25:30.000 1 27 1
20015998343868 4 2014-05-13 13:25:30.003 1 27 1

Why?

Monday, 28 April 2014

Hero?

A weird thing happened to me at the weekend.

I was standing at my car outside a hotel in a silly little town in Belgium, waiting for Mr Hotel to come out with a key for the parking, trying to ensure Mr Plod didn't come first and tow me away.

Anyway, a chap came rushing up, swinging a handbag. A lady was screaming "voleur" or something similar, which I believe means "thief", and luckily she didn't shout it in Flemish, or I'd assume she just wanted a drink, and I assumed chap had snatched her bag. Like a twat, I lurched in front of said chap and sort of got in his way, I think. So he dropped the bag.

"Brilliant," I thought to myself, "now he'll run away and she can have her bag back." Like you do.

So chap pulls out a knife. I laugh. I laugh because I think I've probably shat myself and the only thing you can do when you've probably shat yourself is to laugh. It wasn't such a big knife, to be honest, I've eaten an apple with a bigger one than that.

So, chap puts on his best "grrrr" expression, I put on my best deathwish face and ask "do you speak English?"

He nods. I assume, as he was quite white, that nod meant "yes", as opposed to in these strange countries where it means "no", and that as he responded at all he understood the question.

"You've got one go," said I, because I'm brilliant at saying the right thing. Then I take a deep breath, wonder what it's like being properly dead, and another chap comes up behind knife-wielder and clonks him on the head, whereupon he falls down and the new arrival sits on his head, accompanied by two of his mates, and the Plod are two minutes behind. Bird gets her bag back and all is well. Plod don't want to interview me, presumably because they're Belgian.

So I park the car.

Then I go to the pub.

Does that make me a hero? Does it fuck. It makes me stupid. I suspect that if the opportunity arises I won't do it again. Not unless I've got spare pants.


Wednesday, 2 April 2014

Fuck

So, you get up at 5. Every fucking day. You go and do a job, which you happen to like.

You get quite a lot of money.

Nearly all of it goes. Nearly all of it. You pay it to the HMRC, or the ex, and no fucker deserves it. It doesn't pay for anything useful. It is robbed off you.

Once I though the kids would get the house. The ex goes to the fucking gym, looking like a twat, for what reason I have no idea. The kids sit around the house doing fuck all, watching telly, pissing about on the iPhone thingies.

I can't get any sense out of any of them.

Fuck this. It's pointless.

Pointless. Fuck this.

Debate

Nick Clegg, bloke who wanted power, who batted off Cameron and Brown those years ago, and sided with the one who wanted it more.

Nigel Farage, ornery bloke who likes beer and fags. Is an EU MP.

Neither do anything for me.

They had a debate. I think Nick is a bigger cunt.

Tomorrow, I will wake up at 5 a.m., so I can go to work, and most of what I get will be taken off me by the ex, the government, the EU. So they can spunk it on the feckless, the wasters.

In the evening, I will come back and tweet, then go to bed early, then do the same again. And again.

Which one of them won the debate?

I know not. I care not. I feel like dumping the ex, the kids, telling everyone to fuck off, and being actually quite well off, which I should be, earning what I do.

You know what? I don't give a fuck what you think. Not a flying fuck. Fuck it.


EE

Here we go. Another example of what happens when you employ children and offshore IT.

EE offer a package on PAYG where you can buy a "pack". You text (e.g.) Smart25 (to buy a £25 pack) to 441.

They THEN tell you that in 30 days they will automatically take another £25 off you.

Being the crafty penguin that I am, I will NOT leave £25 credit there for them to take at the drop of a hat.

At the end of the 30 days, they text you to say that in 2 days they will take the £25. This is fine. I then forget to credit it with £25, so when they try to take it, they can't, and then they text you saying "we were unable to take the £25. Please top up and text Smart25 to 441".

So I credit it. And text Smart25 to 441.

I then get a message saying I can't do that (even though that's what they told me to do) because I already have one.

You can't ring them. They charge you to ring them.

So, instead, I write this on my blog. Then I post it all over Twitter and wait until they look really, really stupid.

Hello, EE. Any comments?


Tuesday, 1 April 2014

Birthday

She's not here to date but she's willing to chat, so I'll try not to rib her or act like a twat.

I'm crap at photography - all comes out grey - and my taste in music would ruin your day.

Fashion to me is like buffing a turd, but fun's where it's at, yes, folks, that's right, you heard.

So, she's not a fool, though it's April the first, have a happy one Sally ...

OK. I did my worst.

Happy birthday @sallyinsussex


Monday, 31 March 2014

Vote

Who would you vote for? Take the easy quiz and I'll tell you.

1. You would like a big house, but you're pigshit thick.
2. You would like to redecorate your house, but you can't afford it.
3. You would like a house.
4. What is a house?


Answer:

1) Labour.
2) Conservative.
3) Divorced.
4) LibDem.

Friend

A friend is someone who'd probably visit you in prison.

A real friend is someone who'd send you a cake in prison, with a file in it.

A true friend is someone who'd prop himself up on that bunk and say to you "we really fucked up there, didn't we?"


Due

Help me out.

Some time ago, I was born. I'm guessing (as it was a while ago) it's because my parents had sex, or something.

I am told that my taxes are due.

DUE.

I have had the shiteist education in the world, from the state, and fuckall else. It seems to me that DUE means that I pull myself together, get up at 5 a.m., go 75 miles at about 90% tax on diesel, earn what I can screw out of someone, and that taxes are DUE.

I have googled "DUE". It says nothing like why I need to pay anything into a huge slushpot so it can go to administration of the NHS, paying for suits to strut about, talking shit, and fund the sort of arsebuckets who get on Jeremy Kyle.

Help me. I'm going postal.

Tuesday, 18 March 2014

Crapiler

I have a compiler which won't compile this. The error is at the bottom.  It's perfectly valid ANSI C, apart from possibly the undeclared array sizes (but it makes no difference if I declare those).

So, C folk, how do I address these without incurring the compilers wrath? I have six other compilers which accept this, but this one won't. The dog.

typedef struct {
    BYTE preamble;
    BYTE packsize[2];
    BYTE target;
} sPacketHeader;

typedef struct {
    BYTE size;
    BYTE Origin;
    BYTE module;
    BYTE version;
    BYTE sub;
} sDCUheader;

typedef struct {
    struct {
        BYTE ADH;
        BYTE ADL;
    } sAD[3];

    unsigned FAN_INITIATE : 1;
    unsigned CLOCK : 1;
    unsigned PLA16D : 1;
    unsigned OVERLOAD : 1;
    unsigned GROUP_FAULT_REPORT : 1;
    unsigned SHUTDOWN : 1;
    unsigned EXCESS_TEMP : 1;
    unsigned FILLER1 : 1;

    unsigned HOT_STANDBY : 1;
    unsigned EARTH_FAULT : 1;
    unsigned OVERRIDE : 1;
    unsigned ENGAGED : 1;
    unsigned LINE_FAULT : 1;
    unsigned AMP_FAULT : 1;
    unsigned MODE_D : 1;
    unsigned HIGH_TEMP : 1;

    // inhibit bits are inverted
    unsigned INHIBIT_AMP_FAULT : 1;
    unsigned INHIBIT_EXCESS_TEMP : 1;
    unsigned INHIBIT_EARTH_FAULT : 1;
    unsigned INHIBIT_EOL : 1;
    unsigned filler2 : 4;
} sAmpData;

typedef struct {
    unsigned ROTARY :4;
    unsigned SELECTED :4;
    unsigned PERMANENT :1;
    unsigned HEALTHY :1;
    unsigned MUX_ON :1;
    unsigned JUMPER :1;
    unsigned filler :4;
} sCageData;

typedef struct {
    sPacketHeader packetheader;
    sDCUheader DCUheader;
    struct {
        BYTE length;
        union {
            BYTE payload[1];
            struct sBits {
                BYTE version;
                sAmpData ampData;
            } bits;
        } u;
    } DCUdata;
    BYTE subcount;
    BYTE checksum[2];
} AmpIn;

typedef struct {
    sDCUheader DCUheader;
    struct {
        BYTE length;
        union {
            BYTE payload[1];
            struct sBits {
                BYTE version;
                sAmpData ampData;
                sCageData cageData;
            } bits;
        } u;
    } DCUdata;
    BYTE subcount;
} sAmpOut;

sAmpOut sao[2];


int main() {
sao[1].DCUdata.u.bits.cageData.ROTARY=1;

// error: unknown member "cageData" in sBits

}

Tuesday, 11 March 2014

Obituary

I'm writing this because I've not heard so much sycophantic bollocks in my life.

Bob Crow died.

He was a trade unionist, and a communist, who never did any good for anyone (apart from himself and his immediate family) in his whole life.

He believed in what he thought was right, because he came from a shit background. He was thick as planks.

To further his members' glorious pay cheques, he worked at least a dozen strikes of the tube service since 2006, making sure that the ordinary workers of London had to pay through the nose for their service, whilst tube drivers (who need no qualifications other than a heartbeat) took away the fat end of £50k p.a. each. And he took the fat end of £150k p.a. and spunked a council house.

The reason they tried to (and hopefully do) lay off the "ticket officers" is because the rest of the fucking union have milked the system for so much that it's unsustainable.

Bob Crow was a cunt in life, and remains so in death.

If you have a problem with that, like this bullshit about "he did what he believed in", read Mein Kampf or Stalin's memoirs.

Fuckwits.

Here is the apology you asked for >.<

I'm desperately searching this bucket of fucks for one that I give, in vain.

No, YOU fuck off.

Tuesday, 4 March 2014

I have written

A blog. I hope you like it.

Friday, 14 February 2014

SQL - the final solution

Two blogs ago, there was a problem. Now there is not. Thanks to Clive Eisen for telling me I was being a wanker.

Here is said solution:

Table:

DROP TABLE MAPELEMENTS;
CREATE TABLE MapElements (Auto int, Element int);
Insert into MapElements values(1,2);
Insert into MapElements values(1,3);
Insert into MapElements values(1,4);
Insert into MapElements values(1,5);
Insert into MapElements values(1,6);
Insert into MapElements values(2,7);
Insert into MapElements values(2,8);
Insert into MapElements values(2,9);
Insert into MapElements values(7,10);
Insert into MapElements values(7,11);
Insert into MapElements values(10,12);
Insert into MapElements values(10,13);
Insert into MapElements values(4,12);
Insert into MapElements values(5,13);

Procedure:

DROP PROCEDURE AlarmHierarchy
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author:
-- Create date: <14>
-- Description:
-- =============================================
CREATE PROCEDURE AlarmHierarchy
-- Add the parameters for the stored procedure here
@p1 int
AS
BEGIN
SET NOCOUNT ON;

with cte as (

select auto, element from MapElements where
element = @p1 
union all
select a.auto, a.element from MapElements a
INNER JOIN cte r
on a.Element = r.Auto 
)
select * from cte order by auto, element;
END
GO

C Code (to get hierarchy containing Element 12):

SQLINTEGER iAuto, iElement, dw;
sqlRet=SQLAllocStmt(hDBC, &hStmt);
if (sqlRet!=SQL_SUCCESS&&sqlRet!=SQL_SUCCESS_WITH_INFO)
SQLError(hEnv, hDBC, hStmt, wszSqlState, &pfNativeError, wszErrorMsg, sizeof wszErrorMsg, &howBigIsItThen);
swprintf_s(TSQL, L"alarmHierarchy 12");
sqlRet=SQLPrepare(hStmt, TSQL, SQL_NTS);
if (sqlRet!=SQL_SUCCESS&&sqlRet!=SQL_SUCCESS_WITH_INFO)
SQLError(hEnv, hDBC, hStmt, wszSqlState, &pfNativeError, wszErrorMsg, sizeof wszErrorMsg, &howBigIsItThen);
sqlRet=SQLBindCol(hStmt, 1, SQL_C_LONG, &iAuto, sizeof(iAuto), &dw);
if (sqlRet!=SQL_SUCCESS&&sqlRet!=SQL_SUCCESS_WITH_INFO)
SQLError(hEnv, hDBC, hStmt, wszSqlState, &pfNativeError, wszErrorMsg, sizeof wszErrorMsg, &howBigIsItThen);
sqlRet=SQLBindCol(hStmt, 2, SQL_C_LONG, &iElement, sizeof(iElement), &dw);
if (sqlRet!=SQL_SUCCESS&&sqlRet!=SQL_SUCCESS_WITH_INFO)
SQLError(hEnv, hDBC, hStmt, wszSqlState, &pfNativeError, wszErrorMsg, sizeof wszErrorMsg, &howBigIsItThen);
sqlRet=SQLExecute(hStmt);
if (sqlRet!=SQL_SUCCESS&&sqlRet!=SQL_SUCCESS_WITH_INFO)
SQLError(hEnv, hDBC, hStmt, wszSqlState, &pfNativeError, wszErrorMsg, sizeof wszErrorMsg, &howBigIsItThen);
while(true)
{
sqlRet=SQLFetch(hStmt);
if (sqlRet!=SQL_SUCCESS&&sqlRet!=SQL_SUCCESS_WITH_INFO&&sqlRet!=SQL_NO_DATA)
{
SQLError(hEnv, hDBC, hStmt, wszSqlState, &pfNativeError, wszErrorMsg, sizeof wszErrorMsg, &howBigIsItThen);
break;
}
if (sqlRet==SQL_NO_DATA)
break;
}
SQLFreeStmt(hStmt, SQL_DROP);

Gratuitous picture of Norks :


Thursday, 13 February 2014

Train

Here's another thing.

I used to have a house, once. It was near a railway.

Because some fuckwit decided to top themselves (and I don't offer sympathy, because he was a fuckwit), he decided to do the deed a mile down the line.

So, the Health and Safety Executive thus decided to knee-jerk and insist that the train should blast its fucking abominable horn right outside my house, just in case the next jumper didn't know when to throw his worthless body on the line.

The house was therefore worthless.

This is what the state can do to you, with not a worry, nor a jot of compensation.

Fuck the state.

I now live on a worthless boat having been made skint by them. Fuck them. FUCK THEM.

I have hundreds of stories like this. Yet you still vote. You fucking idiots.

SQL

If anyone can help me with this I'll pay in chocolate/beer.

I have some objects which are linked via a link table, which has Parent/Child columns.

Here is the scenario. The ones above are parents, the ones below are children.

The table linking these like this is thus:

P    C
1    2
1    3
1    4
1    5
1    6
2    7
2    8
2    9
7   10
7   11
10  12
10  13
4    12
6    13

Where P=Parent, C=Child.

I want to devise a query where if I pick a Child (say 13) I get the rows back which are affected by said child.

As in the ones asterisked:

P    C
1    2 *
1    3
1    4
1    5
1    6
2    7 *
2    8
2    9
7   10 *
7   11
10  12
10  13 *
4    12
6    13 *

I know it's doable. I'm too thick/tired to work it out. It must be easy.

The DB is SQLserver.



Tuesday, 11 February 2014

Miliband

FACTS:

A few years ago, Tony Blair was Prime Minister.

Gordon Brown was Chancellor.

David Miliband was head of DEFRA.

The EU introduced a Single Farm Subsidy (SFP) rule.

David Miliband commissioned a computer system to process said rule, even though every other country in the EU had one which worked.

His didn't.

He lost 50,000,000 pounds.

Miliband went to Gordon Brown who said he couldn't have the money and that other parts of DEFRA had to find it.

Miliband went to British Waterways and the Environment Agency and suggested that they ask people who pay river licences (such as boaters) pay it.

Both raised their licence fees by around 15% p.a for three years. Neither stopped raising it since. Neither thought of charging fishermen or canoeists, despite their huge numbers. Neither spent any money at all, AT ALL, on flood defences because although they knew it was coming, the cuts were made. Gordon. Tony. David.

Those are all facts, plain and simple, no reporting, no partisan crap, just facts.

Somerset is flooded. Berkshire is flooded. David Miliband has a job at 1,000,000 pounds a year talking shit in America.

His brother is a cunt.

Thanks for reading.

PS some farmers are still waiting for their SFP payment, which won't matter much, as they're mainly pig farmers and their farms are underwater, so we're importing pig, most of which has swine flu at the moment. You carry on signing petitions. I'm reloading.


Monday, 3 February 2014

Pete Wishart

I've probably got this all wrong, but there seems to be a chap called Pete Wishart, who is an MP, who went to a school in Scotland (do Scotland have schools?) and they called him a gimp. I don't know what a gimp is, so I can only imagine it's a contraction of "talentless twat who didn't try too hard at school and couldn't do anything useful so became an MP so he could suck the life out of working people".

So he took offence because they were in a "public school" and because he's a lefty he thinks anyone, however bright, or thick, is the same.

I'm probably wrong, as I say. If I'm not, can you draw his attention to this so he can have me barred from Twitter, and Blogger?

Many thanks, people. The police have my name and address so I'll put the kettle on. Hope they can swim.

BTW I was thrown out of public school. I consider myself lucky.

Also, I'm thick, my IQ was only 168 last time I took the test, so, well, fuck you, really.

xxx

Job. MkII.

I require a chap/chapess with a serious geek thing who is interested in electronics and computing, who can program passably in C, and knows Ohm's Law, and is going to be treated like shit and come out the other end a bloody genius. They need to realise that life is hard, so is work, and that they are fucking useless, but wish to better themselves.

I would really like someone who knows what they're doing who wears their underpants outside their trousers and can change in a telephone box, which is what we've asked agencies to send us.

The problem is that we can't find the people because the stupid bastards put their CVs on a web site to which only bastard job agents have access. Said job agents then make sure we get sent folk who fit any description other than the one we're looking for, because they think they understand. They do NOT.

Back in the day it was possible to find someone who did not think that the world owed them a living. Nowadays the yoof think that the world does, and the only reason people work is to pay their fucking benefits.

There is nothing wrong with learning stuff on the job, and having the benefit of some top-rate chaps who know what they're doing, from whom to learn, and in return be sent to the stores for a long weight or a new box of sparks for the grinder. And having the piss taken mercilessly. But at the end of it they'll be useful.

FUCK knows what they teach people at Uni these days. I suspect mostly its how to justify getting in 10 minutes late then making coffee and microwaving toast before discussing football or what pile of shite was on telly last night. Those folk need not apply.

But if someone wants to work and is willing to learn and isn't as thick as two planks, and his mates have a problem with him/her having the bollocks/tits to go for it instead of going to Uni to do a degree in washing teatowels, I'll come with them to the pub and put their mates right for them, with my trusty bat.

Any questions such as "how much holiday/money/statutory sick benefit do I get?" will be greeted with the bum's rush. We're not a charity. We want to know what you can do for us. At least I'm honest.

Find me someone.

Friday, 17 January 2014

An Ode To Ed. And Ed. The metre is 8-6-8-6 so it fits most hymn tunes. Off you go.

Oh Ed, you make me laugh so much, so long and loud. My glee, when you so proudly say your piece on Twitter, or TV, is boundless, dearest Ed, for though I think you mean so well, we're all in the same handcart here, careering down to hell.

From time to time you come up with another hairbrained scheme, I don't know where you get them, but I do suspect your team of "experts", mostly unpaid kids from uni, tech or worse, with aspirations to a job or hands in public purse.

"Let's stop the evil bankers!" is your latest battlecry. I snork out loud as I then hear Ed Balls firmly deny he told the Bank of England chief to shut up yesterday; he did though, cos I heard him, so it isn't just hearsay.

"And Labour will start two more banks, competing with the rest," you do so make me chuckle, Ed, but surely, right, you jest? Two wrongs don't make a right, you know, no more than do two Eds. I sometimes wonder if you pair retire to separate beds!

So dearest Ed, continue as you are, and never change. That Cameron must thank his lucky stars, and find it strange that he could never lose the fight, not even to Farage, not even if the girl McCann was found in his garage.

Oh Ed, you fill me with delight as bumbling through the day you find another silly, stupid, foolish thing to say.
If you become our next PM, I swear I'll eat my hat. I wish you well though, keep it up. You adenoidal twat.