Monday, 6 August 2012

Are you at work?

Irony for the day, I've had two people phone me up "Are you at work?"....

Before 5pm on a Monday... Erm... let me see... yes... yes I'm at work... I'm going to assume by the bemused calls you're not?!?!  Dear GNU compiler above help me.

Google Listen

I was an avid podcast listener, especially when I first got an iPod, however over time I have found working (code) whilst listening to material I am unfamiliar with rather distracting and stopped the habit, sticking to music I know which let me concentrate better.

Anyhow, recently I've taken to more testing than coding, which means I need to entertain myself whilst waiting on minutes and minutes long system builds, this necessitates the iPod coming back, and I need to get some stuff on there...

Now I searched for decent podcast finding software, and really came up with naught, there's a few like "Podcast Finder" and of course the channels on community sites, not to mention iTunes.  But none of them do the biz for me.

So I googled "podcast finders" and you know what never in that list of results did I see the now to be axed "Google Listen" service.  It seems they set up that software and service just to find and track podcasts, sounds remarkably like what I've been trying to do, but they're about to axe the service?... Why?....

Seems google feel no-one would notice its gone... No Google, no-one is going to notice if when you google for exactly what your service does one can't find the gods damn service!  This is so ludicrous as to beggar belief....

Even now I know the service exists, if I google "Google Listen", I don't find anything about the actual service, just the news reports explaining its demise... Google, really, if you want to know why people aren't using your whatever service, just google for it yourself and don't use any keyword jargon you know targets it, think like an every man in the street, think like me, ask me to google something for you even, because clearly you've missed this elephant in the room and gotten the wrong end of its trunk.

Monday, 30 July 2012

Olympic Seats


I'm getting pretty tired of these documentaries about British Olympians, there's been two I've seen, one about a diver and one about a Judoka... Both of whom have gone on to fail to get a medal, sometimes even to fail to qualify...

Its all rather tiresome, and very British, the moment anyone says "we might win", we either worry so much and balls it up, or we get cocky and balls it up.... The  net result is a lot of ball and nearly no medal...

So people, stop bigging these people up, let them get on doing their own little things, and go get moaning about the stupic seating system which in my experience put people off trying to buy tickets and which has resulted in the fiasco of swathes of empty seats... And appart from the Archery (which had very limited numbers of seats) I've seen multitudes of empty seats at the Judo, at the Swimming, at the Kayaking and at other events... The dressage too!...

The only place I've not seen empty seats was the beach volley ball ladies matches!!!!

Sunday, 29 July 2012

Code Kicker

This evening, I've relived the good old days, I've spent a lot of time (about five hours) coding... This is no big deal, but... I've done this late at night, I've done it after a few drinks... and I've achieves a massively impressive (at least to myself) amount of work, changing the whole underlying strata of a project I'm working on... and it all worked first time... (well apart from spelling progress without an r, its done).

And this is the good old days, because it was just like being back at Uni... I loved coding at uni, I think I picked a degree with too little actual coding within it... But tonight I relived that feeling of achieving something.

Thursday, 26 July 2012

Charlotte Blackman

I'm going to keep this one short and sweet... My thoughts, sympathy and condolences go out to all of Charlottes immediate Family, close friends of ours.

Such a wonderful family, such nice people, we're absolutely devastated for you and only wish that things were different.


My wife is devastated by the news, she recalls only how wonderful Charlotte was, remembering her coming and doing some cleaning around our house years back.  Only a fortnight ago we had a meal out with Rach and she was telling us how proud she was of Charlotte getting a first in her degree.

It is so unfair for this to have happened, so unkind of the world to have thrown this burden of grief at such undeserving people, and I can only imagine doubly so for Matt.

As I understand it the family won't return until they can bring Charlotte with them, and until we see them I can only hope they know our thoughts are with them.

Monday, 23 July 2012

Why....

Why do people not phone me (I have a phone folks which tells me I have missed calls, it in fact logs all my calls in and out) and then say "I've tried to get you, but it just rang and ran".... No it didn't, you have not tried to get me at all, you've waited for me to call you you shady sod.

Why do people post videos on YouTube, of what might be interesting material, and.then.they.talk.in.a.monotone.drone.so.you.stop.the.video.and.don't.listen.to.them... I mean, look around people, look at how the BBC or Sky, how interviewers present information in the form of the spoken word and emulate them!.... Don't just sit and drivel on... Also... Don't... please don't just put yourself as the focus of the camera... If you're on YouTube talking about code, then for christ sake put some code up, don't let us see your pimply stub nosed shit eating grins.

Why do people not look at road signs?... I mean, they're up there for a reason, telling  you to merge from the right, or give way to the left, or that cows are crossing... all very useful information... Not to mention, lanes have arrows in them saying where they go, if you are at an island going right and there are two lanes going right... think "Hey directly after this island I need to take a left"... and get into the left most of the right flowing lanes... don't be right, go right and then cut everyone up going left and look at the other people like they're morons, you're the moron!

Why do people not accept factual presentations from me?... Now, I don't know what it is, but I can be stood holding up a white piece of paper and declaring "This is white"... and my audience will stroll off... Yet someone I'm sat looking at right now can just say "This white paper, see it.... its fucking blue dude"... and they go... "Oh yes, blue blue blue..."...


Sunday, 22 July 2012

Using boost::signal Example

From my previous post you maybe aware I had a problem integrating two different modules, produced separately and in isolation, which when brought together instigated a compile time error... Well, over the day I've spent a few hours... well about four... trying to work out what to do...

I had thought I needed some mechanism to be connectionless - hence my use of boost::asio for its UDP operation - which could deliver the messages with as little programmer (or rather code dependence on the programmer) as possible.

I spent sometime looking at message exchange via some web technology, looked at named pipes, shared memory, and even gave up on the connectionless ideal and went for a network topology of TCP/IP Connections... None came up as acceptable to my needs, they were either so complex in code as to need very significant amounts of testing, or they brought into my code base so many external files as to swamp the project and blur the line between multiple licenses.

However, late in the day I stumbled; and I feel a fool for stumbling so late; over boost::signals.  Initially I ran through their simple tutorial and was happy to see a function being invoked after connection from another location.

After a little thinking I also stumbled over a pattern of thinking via which I was able to replace my asio use of UDP as a message transporter to send a message to multiple locations through my code.


My pattern is to have one class control a copy of the signal, and to pass pointers to this to each outlying class, these outlying classes can then connect to receive the signal into local functions bound with boost::bind and viola... A signal sent to the central, and only, copy of the signal can be propagated extremely quickly throughout the other classes.

Here is my code:


#include <iostream>
#include <string>

#include <boost/signal.hpp>
#include <boost/bind.hpp>


using namespace std;

typedef boost::signal<void(const string&)> Func;
typedef Func* FuncPtr;

class A
{
private:

FuncPtr m_Signal;

boost::signals::connection m_Connection;

void OnSignal (const string& p_Message)
{
cout << "A::OnSignal [" << p_Message << "]" << endl;
}


public:

A (FuncPtr p_Signal)
:
m_Signal (p_Signal)
{
m_Connection = m_Signal->connect(boost::bind(&A::OnSignal, this, _1));
}

~A ()
{
m_Signal->disconnect(m_Connection);
m_Signal = nullptr;
}

};

class B
{
private:

Func m_Signal;

public:

B ()
{
}

FuncPtr Getsignal()
{
return &m_Signal;
}

void Transmit (const string& p_Message)
{
m_Signal(p_Message);
}

};


int main ()
{
B* b = new B();
A* a = new A(b->Getsignal());

b->Transmit("Hello World");

delete a;
delete b;

cin.get();
return 0;
}


This easily provides a simple framework upon which I can wrap a single instance of a signal, or different signals into a single class, in this example "B" and then pass out the pointer to that instance, in this example to "A".  And then the transmit is sent to all listeners.

One can register multiple instances of the "A" class and the transmit of the call goes to all the handlers for it.

I believe I may be able to turn what I had represented as an Event raised from many places, into a single Signal instantiated in one location.

I admit I will end up with multiple signals, one for each Event I had before, but the transmission system drops to zero lines of code, and all the lines of code I am using in the boost library have been very very well tested, unlike the code one would employ from ones own hand...

My new task therefore is to turn this reverse concept of a message to better meet my implementation of a state machine.