sobrique: (bubble tree)
The short summary: The weather was a bit grim. Offical 'ground temperature' did drop to -6 on some nights. But despite that, the event was fun.

The event started with us pulling up on site at about 17:00 Thursday. And being rather shocked at the incredible number of tents in place - as far as we could tell, around 1000 people were on site, which is already larger than Maelstrom.

The IC field was also looking quite busy - the Profound Decisions (PD) crew had been putting up copious quantities of tents, and a few 'permanent-ish' buildings, in the form of the senate and the tavern. We ended up putting our tent in the OC field, simply because of available space. Which given that wasn't a small field, is another sign of just how many people were there and keen to be involved.

There had been mud, which threatened to make things difficult - vehicles weren't being allowed on site. The massive pile of wood chips went a long way to making a servicable road.

Time in was earlier than 'usual' on Friday - there were many players who hadn't caught the start time of 13:00. (Maelstrom always started at 18:00). But given just how many things needed doing over the weekend - the daisy chain of electing - it was necessary. As a consequence of sorts, there wasn't really much room for politicking and campaigning - senators in particularly, were primarily elected right off the back of ... well, how many voters they turned up with in the first place. On one hand, it's slightly annoying but ... also largely inevitable. There will be time enough over the next year for campaigning to happen.
This, I think, was a pattern repeated over the festival - no one really knew anyone else, so it turned into a massive nepotism exercise. But then, I guess the 'cover story' of the collapse of the existing structures of the Empire is also .... well, going to trigger exactly that result too, so it's all to the good.

I like how the elections were structured, and think they'll be giving plenty of room for ongoing shenanigans - each of the areas of politics worked subtly differently. From the 'mercantile' elections being offered by auction, to the more standard 'popular vote' mechanisms.

I also heard plenty of enthusiastic reports on the battles - I didn't go myself, but by all accounts there were around 600 participants on each 'side' - and the combats were suitably tactical, and - in many ways - unforgiving of errors. (A few groups got isolated, surrounded and torn torn to shreds).

However I think what really made the event for me - there were clear guidelines on what each nation was 'all about' - including traditions, views and costuming. And at the event this really did create camps with very different 'feels' to them - colours, themes, styles - made it easy to believe you were visiting different nations within the Empire. There was a feel of a festival or fair, which meant wandering around the camps to socialize, trade and scheme felt... well, less like a hazardous operation, and altogether more like the 'done thing'. Or at least, if it weren't for drag of squelching though mud to get there.

I was also quite well impressed with the cohesion with the ref team - as far as I can tell, there are 'field refs' who primarily act as point of contact, and can radio back to get more detail - and can therefore do anything that's needed, rather than needing separate teams. Having an 'egregore' for each nation (basically a personified spirit of the nation) also helped have a focal point - (who also had a radio, so could pass on information about what was going on).

So yes - broadly speaking, the first event was far less chaotic than it really could have been. The weather wasn't anyone's friend, but it also was handled very well by the site crew, making it an inconvenience, not a disaster. And I never had to queue up in GOD, which was almost a shame given how toasty and warm it was in there....
sobrique: (Default)
Every year or so, the government issues us all with a free piece of paper and a pencil to scribble on it, and offers to have a look through the whole lot. In the face of such largess, it seems almost rude not to participate. I would therefore like everyone to take the time to do a pretty doodle, scribble or scrawl. If you can manage it, submit a photo of it, and I'll collate them.

I'm referring to ballot papers, and electoral turnout - this PCC election in particular seems to have been something of a farce - reports of very quiet polling stations, widespread low turnouts.

But this isn't really news - voter turnout has been pretty poor for many years, and no one really pays much heed. Go on - what proportion of your electorate turned out for the last council election? Mine was 31%. Near 7 out of 10 people didn't spent 10m putting a mark on a piece of paper.

I've heard a variety of excuses - from 'I couldn't be bothered' to 'it makes no difference anyway'.

And I can _sort_ of sympathise. I mean, given the way we do the elections - if there are multiple candidates a vote for a minority group can end up a wasted vote. Whilst it _might_ get their deposit back, realistically the choices in the general election are either for or against the 'lead' candidate.
There's very few three way marginals out there, and realistically no minority party is going to win, ever. Because of 'first past the post' there's very few candidates outside the 'big three' who ever win a seat. Of the 650 seats, just 29 were in that category.
Likewise... well, take a look if you will - the demographics of the UK:
Now compare that against the demographics of the House of Commons.

But the problem with low turnout - of not casting _your_ vote - is that then it's hard to tell the difference between:
- those that can't be bothered.
- those that are satisfied that any of candidates would be acceptable.
- those that don't want to endorse anyone.
- those that object to the election in some way.

A candidate who wins, with 70% of the electorate not casting a vote _can_ call that a mandate.

So I'd like you to consider very hard next election - if none of the candidates appeals to you, then take the time to go and spoil your ballot.
The outcome is much the same - your vote will be excluded from the proceedings, and the same candidate won. However, it's much harder for them to claim the tacit support of the electorate when people _did_ turn out, and took the time to _not_ vote for them.

I would really like to see an election where the winning candidate was 'outvoted' by spoiled ballots. A clear message _that_ would be.

But realistically - nothing changes if you stay at home. You're deemed to be tacitly supporting whoever one. Even if that wasn't your intent - you get lumped in with all the people who couldn't be bothered.

So please - take the time to spoil your ballot. Make your protest by _actually_ making a protest.

(Note: I mean this in lieu of not voting at all. If you have a candidate or party you wish to support, then knock yourself out. If you don't, I'm sure a minority/independent might be appreciative of getting a bit closer to getting their deposit back.
Whatever you do though - resist the temptation to 'opt out' by staying home. Opt out by drawing a pretty picture on that free piece of paper).
sobrique: (Default)
Have you ever wondered why you don't get 'round' numbers of gigabytes when you're buying a phone, or memory card?
No doubt you've seen it - you'll see 8, 16Gb, 32GB, and almost never a 10, 20Gb or 30Gb.

The reason is actually quite simple - because the simplest representation of information is the binary state - on or off. We call this the 'bit' - or Binary Digit and it doesn't matter if that's a light switch, or a punch card with holes and 'not holes'.

If you string together bits - you get a multiplying effect. If I have _two_ bits - each can be in two states, giving us 4 combinations. (ON/ON, ON/Off, Off/ON, and Off/Off).
As we add more bits, we end up with more potential combinations, and we simplify the two states into '1' for on, and '0' for 'off'.

This is where we get the start of binary - computer memory is incredibly simplistic, and you can think of it all as a long sequence of switches - that are either on or off.

A byte - with 8 'bits' - gives us 2 ^ 8 states - or 256.
So if we were wanting to represent numbers - we could convert any number between 0 and 255 into a 'byte'.
But it's cumbersome to write:
100 = 0110 0100

That's why hexidecimal is used - hexidecimal is base 16 - so each 'digit' goes from 0-15. (0-9A-F).
That's actually a much easier way of representing a binary number, as you can take each 'chunk' of 4 bits.
So that '100' in decimal, could be represented as 0110 (6) and 0100 (4). (the reason we have to use 'hex' is because the 4 bit block go up to 16, and so we need extra numbers).

But anyway - memory is - in effect - a bunch of switches. Each switch we add doubles the number of possible states - so where '8 bits' gives us 256 states, 9 gives us 512, and 10 gives us 1024.

The 'standard' size is 8 bits to make up a byte - that gives us 0000 0000 -> 1111 1111 - or to represent it in hexidecimal - 00 to FF. (You may see 0x in front of a hex number, just to make it clear that 0x64 is _not_ 64 in decimal.)

This is largely why you get memory sizes in multiples of 2.
1 Kb = 2 ^ 10 bytes.
1 Mb = 2 ^ 20 bytes.
1 Gb = 2 ^ 30 bytes
1 Tb = 2 ^ 40 bytes.

Because you double your number of 'states' by adding an extra bit, it ends up effectively wasteful to 'round down' to neat multiples of 10, as we're used to. If you want to hold 'up to 100 (decimal)' different states - 7 bits hold 2^7 states, which is 128. 6 bits holds 2^6 states - or 64.
So we'd need to use 7 bits, and - basically - throw away 28 of them, and never use them. Which is largely why we end up with 'nice neat' multiples of 2 for almost all our storage devices.
32 Gb being 2^35 bytes.

*We have Claude Shannon to thank for much of the grounding of information theory.,
sobrique: (Default)
It seems another thing may be comment worthy on the subject of free speech.
A court case was won today.
A gay couple, who won a case against a B&B, who refused to let them sleep in a double bed.

This I think, is a good thing. The refusal was 'on religious grounds', and I'm quite pleased with the result.

However, that isn't what's prompted me to get out the keyboard. What has, is that someone high profile has decided to contest the ruling, by posting the address of the couple concerned on twitter.
Something which has give me pause to think - what do I think of _that_ in the context of previous posts on freedom of speech.

And my first thought is - I'd be considering posting my name, address and a veiled threat on Twitter to be at least as offensive as the previous cases.
Which for the sake of reference, in one case covered being sexually explicit about an abducted (and presumed murdered) 5 year old on facebook, and in the other wearing a t-shirt that supported the murder of two police officers.

I am very much hoping to see the gentleman in question in court, and would very much hope he got at least as much of a sentence as the other individuals.

As to the broader question? Well, I'm not sure how I'd compare it if I'm honest. I think willfully violating someone's privacy - especially in a context which encourages harm to them - to be more like criminal behavior than being the 'ordinary' kind of obnoxious and offensive.

And maybe as such, something that warrants the protection of law, where maybe 'just' being offensive might not.
sobrique: (Default)
Two stories in the news in the last few days have concerned me slightly.
This one:
Is about a guy who wore a T-shirt that was offensive, following the death of two police officers.
He's got 8 months in prison. (ALthough, I believe 4 months for the offence, and 4 for

And this one here:
He made an obnoxious offensive joke about the missing - presumed abducted and murdered - 5 year old, April Jones.

These worry me. I don't wish to defend what they said - it was obnoxious, tasteless, unpleasant and probably distressing.
No, what worries me is that I'm not sure it should be a crime to be an odious gobshite.

There's one simple reason - because when you have a law that makes it illegal to say certain things - things that are 'judged to cause offense' - then you have to have someone who makes the final decision - this joke is crass but ok. That one crosses the line. This point of view is impolite. That one is criminal.

And put very simply - I can think of no one I would trust to make that decision. If you do it via 'popular opinion' then you're at risk of minority oppression - how many people would find it 'ok' to make an unpleasant comment about Jimmy Savile at the moment? Now, same question, but aimed at transexuals perhaps? Do you see where I'm going with this? There will always be minorities that - by virtue of who they are - are more 'popularly acceptable' to be offensive about.

If you have some other group being the 'taste police' then you've got a bigger risk - that of appointing a group that has bias built in because of who they are - look if you will at the demographics of the current members of parliament. How many are white, middle class, middle aged, male, and from a public school background? Would you say that's more than average from the population?
How about the judiciary? Does that not have the same problem?

I'm worried that very simply you cannot truly appreciate something that is outside your realm of experience. You cannot understand what it is like to be bullied or abused for who you are, if it's never happened to you. If you've never been fat, female, gay, transsexual, black, disabled, ill, raped, abused as a child, mentally unwell... then how can you be someone who passes judgement on 'offensive'?
sobrique: (Default)
I have seen a few places now, expressing the sentiment that Mark Bridger - the man who is in custody, in the April Jones abduction case - should be tortured until he tells them the truth.

I would very much hope that no one I consider a friend believes this. But you know what? If you do, I'm _not_ going to torture you.

Here is the problem - we have a trial by jury system, which must have a jury return a verdict that the person is guilty, beyond reasonable doubt.
And until a jury has done this, the person is innocent.

Now, that's not very efficient. After all, proving something 'beyond reasonable doubt' is not exactly easy - it takes time to gather evidence, and sometimes it doesn't prove it to a high enough standard.

But fundamentally, there is no other choice - history has many lessons for us on this subject - that if we allow mobs to rule, then EVERY minority suffers. Be that because they're kicked to death for being a goth, or not allowed to vote because they're a woman.

We have a jury system, and a democratic political system - not because they're good, and because they're effective, but because as a society, we have PROVEN time and again, that we are not capable of being humanitarian.

So I'd say to you all - please bear it in mind - this man _may_ be guilty. But until a jury - after consideration of the evidence - says: "Guilty, beyond reasonable doubt", then he is as innocent as you are. As innocent as the girl who was beaten to death for being a goth, and as innocent as the child who has gone missing.

If - and only if - he is found guilty - then the situation changes. But even then, we imprison to protect society, and rehabilitate the offender. Torture doesn't do this. It isn't even particularly good at 'finding the truth'. Witches have been burned on the basis of evidence from torture.
I have to say though - I do sympathize with all the people who are angry, frustrated and want the girl to be saved. But a society based on vengeance leaves _everyone in it_ worse off.
sobrique: (Default)
This week, I have mostly been playing with Thread::Queue.
Once of the downsides of perl threading is that it's not particularly lightweight. Spawning lots of new threads to do a single task isn't a very efficient way of doing a task - especially if you have libraries imported, and large data tables.

So the method I've been playing with is queue oriented - spawn a number of threads equal to some arbitrary parallelism target - 1 per 'resource' consumed is a good bet (so for processor intensive stuff, one per processor - if you're doing remote access to 15 servers, one each).

And then implement a 'queue' which is a thread safe implementation of a FIFO queue (FIFO = First in, First out).

It uses the library Thread::Queue, so you include that at the start of your program. You don't actually strictly speaking need to be threading to use it though - there's other reasons to use a FIFO.

So as a sample:

Read more... )

Fairly simple, but does allow for daisy chained processing (e.g. moving from one FIFO queue to the next).
The only slightly complicate part is in handling 'thread exiting'. I've taken to using an 'exit' signaler in the queue. (use an arbitrary pattern, and 'catch' when that occurs).
However the other possibility is in just using some kind of 'all done' shared variable, that you set once the queue is fully populated - because what you don't want to do is just assume that because the queue is empty, work is finished - because when you first start the thread, this might be the case, or perhaps if there's a dependency - or perhaps once the first items get 'dequeued' then the other threads might see an empty queue.

I've been using this mechanism to create a 'cascade' of tasks - run something on one (group of) server(s). Do a some processing. Run something based on the result on another server. This is well suited to queue style processing.
Similarly - because you're queue oriented, then it's also well suited to scaling up (or down) the parallelism. Such as when you're in a multi processor environment, for example - you may want to hog all the processors that are available, but you'll lose efficiency if you overdo it.
sobrique: (Default)
"[Vimes] learned something new: the very very rich could afford to be poor. Sybil Rankin lived in the kind of poverty that was only available to the very rich, a poverty approached form the other side. Women who were merely well-off saved up and bought dresses made of silk edged with lace and pearls, but Lady Ramkin was so rich she could afford to stomp around the place in rubber boots and a tweed skirt that had belonged to her mother. She was so rich she could afford to live on biscuits and cheese sandwiches. She was so rich she lived in three rooms in a thirty-four roomed mansion; the rest of them were full of very expensive and very old furniture, covered in dust sheets.

The reason that the rich were so rich, Vimes reasoned, was because they managed to spend less money.

Take boots, for example. He earned thirty-eight dollars a month plus allowances. A really good pair of leather boots cost fifty dollars. But an affordable pair of boots, which were sort of OK for a season or two and then leaked like hell when the cardboard gave out, cost about ten dollars. Those were the kind of boots Vimes always bought, and wore until the soles were so thin that he could tell where he was in Ankh-Morpork on a foggy night by the feel of the cobbles.

But the thing was that good boots lasted for years and years. A man who could afford fifty dollars had a pair of boots that'd still be keeping his feet dry in ten years' time, while a poor man who could only afford cheap boots would have spent a hundred dollars on boots in the same time and would still have wet feet.

This was the Captain Samuel Vimes 'Boots' theory of socio-economic unfairness."

On a related note - my new boots have arrived. First impressions are that they're comfy and robust.

I'm also dead impressed with the customer service I got from Polimil. (
They phoned me the day after I ordered, to say they were out of stock.
They suggested an alternative that they could dispatch immediately (One I had been considering, so it was a good alternative).
And then they gave me an indication of lead time to get new stock - 5-7 working days.
I chose to wait, and was quite impressed to see them dispatch Thursday (so more like 4 working days) to arrive Friday.

It's easy to get used to 'very average' customer service, so I was quite pleased with my shopping experience - I'll be remembering them for next time.

The boots come well reviewed - who couldn't like (from the site)
"I have been wearing this excellent boot for the last five years and nothing else comes close. Some trainer wearers will think it's too rigid but the extra support lends it to the more demanding user. I've hopped over high security spiked steel fencing, trudged through broken glass and needles, even got dragged a quarter mile by a stolen car. Let me tell you, when you are lying on your back at 40mph with only your boots between you and the Tarmac, these bad boys are what you need. I won't wear anything else."
sobrique: (Default)
This is perhaps in the wrong order, but to follow on from a couple of rambles lately - threading and perl.
How do you basically do this?
Here is an example:
Read more... )

OK, that's pretty simplistic I know - but the major way I've found threads useful is for what amount to embarrassingly parallel problems, like 'connect to 200 servers, and run the same commands on each of them'. You could quite easily replace that rather trivial 'sleep' subroutine, with one that does an ssh to a host, to run a command and capture the output. (And maybe process the results, before returning them)

Also note: Perl has had threads for a while, but the module doesn't necessarily contain all the functions you need - latest version as of 2012-07-23 is 1.86 which is available from CPAN. (

More detail:
sobrique: (Default)
So, I've been fiddling around with Perl, and threading.
One of the things that's been bugging me, is that when I've tried to do a 'return' from a perl subroutine, it's not worked - and I couldn't for the life of me figure out why.
What's _supposed_ to happen, is that you do 'thread -> join' to join the thread (once it's finished running) and that's supposed to capture the return result.

Why it wasn't working is thanks to this little snippet in the documentation (Yes, RTFM, I know. But to be fair, I wasn't looking for it in _that_ bit).

"The context (void, scalar or list) for the return value(s) for "->join()" is determined at the time of thread creation."

Perhaps I'd better backtrack a little though - I mean, anyone who's not really 'into' perl, might not have a clue what I'm talking about when I say 'context'.
So I shall summarise.

Perl is quite clever - it has two 'real' variable types - scalar - which contains anything that's a single value (So any string, integer, float, character, reference). And array (or list) - which is a group of zero or more scalars.

The clever bit is that it can figure out what you mean, by the context in which you do it - a brief illustration (lj cut to avoid breaking formatting).

code here )

What's happening is the rather clever function 'wantarray' is being used to tell the call context of the subroutine 'wantarray' is undefined if it's a void context (the result is discarded). True if a list/scalar context and false if in a scalar context.

As for why this is useful - consider if you do something like 'grep' - a Unix command to find 'matches' against text patterns. If you do it in a 'list' context, having a list of the lines it found would be useful. If you do it in a scalar context, then having a number of matches is probably more useful (0 being 'false' you could do 'if grep("pattern", @text_block)' for example)

So anyway - the context of a threaded subroutine is set when the thread is _created_.
Which means you need to do something like:
Read more... )

On the face of it, you immediately discard '$thread' because it drifts out of scope (and it does). However, it also means your thread is created in a scalar context, so any results it returns will be scalar.
If you _don't_ do this, it'll be in a void context, and any return is discarded. Which was what was tripping me up.

And you will then be able to do:

Read more... )
Which won't work if you don't start the thread in a scalar context.
sobrique: (Default)
Because I imported a bunch of files from various directories - I wasn't quite sure if I duplicated my photo collection.

The solution? Well, probably quite a few. But here it is in Perl.

First download: Activestate Perl.

Then, open your favourite text editor (I'm starting to quite like Textpad - ) but notepad will do just fine.

Place into it the following code:
Read more... )
You'll - probably - need to edit '@paths_to_process'.
In perl, that's a list. Lists are values separated by commas, and with a curvy bracket on each end.
We use single quotes, because / has a special meaning, and we just want the literal text.
You could therefore do
@paths_to_process = ( 'C:\' ); 

and this would do all of your C drive. I wouldn't suggest that as a good idea, as it'll take a long time (because it has to open and read every file on your hard disk).
SO I'd suggest sticking with directories that you know you've stuff that might be duplicated. (E.g. pictures directories - but this doesn't really care what the file type is).

Anyway - then save that as '' (or anything you like, basically, as long as it ends '.pl' which tells Perl to 'work with' this file when you double click it). I'd suggest running it from a command prompt, but that's personal taste. (It prints text - the window will probably vanish after, but don't worry as there'll be a text file there with the results)


Jun. 13th, 2012 08:44 pm
sobrique: (Default)
Dear everyone who uses post codes on your website.
Would you kindly refrain from insisting my post code is incorrect if it doesn't include a space.
It's not rocket science to parse post codes.
They are
a) not case sensitive.
b) The second part is ALWAYS a digit, and two letters.
c) the 'first part' is ALWAYS two letters, and 1 or 2 digits.

(The first part is also geographically grouped, but the second part may not be.

So there's no ambiguity involved - you can't get 'mixed up' between AB1 23CD and AB12 3CD, AB123CD, ab123CD. They're all the same post code. (And it's region 'AB12').
Not being able to parse this on your website is just sloppy - at least, bearing in mind you're doing any validation whatsoever on your inputs. (Which you are, because you've spotted it hasn't got a space).
sobrique: (Default)
It would be impossible to avoid a comparison with Jim Butcher's Dresden files. So I won't. It's a similar sort of a story - it's about a modern day, urban wizard. It's set in London - Camden, specifically - so it resonated a little more clearly with me than Harry Dresden's stomping ground, Chicago.
I think regardless, it stands the comparison quite well - it's less light hearted too - fewer 'comedy' moments, but none the worst for it.
Alex Verus is the lead character, and runs an 'Arcana' shop in Camden. He's not a powerhouse of a mage, but he does have a very useful schtick - that of being a diviner, and able to see the future. I have to say, that sounded like a recipe for disaster for me - after all, whilst the author has perfect foreknowledge, it's a bit dull if the characters do. But it's handled very well, and plausibly so. It's the thing that lets the otherwise not amazingly powerful Alex keep on going.

It's well paced, and a real page turner, and one I think you'll not regret - assuming you like the general premise (or otherwise enjoyed Dresden Files).
Amazon Link.

Certainly one I'll be picking up more of.


May. 29th, 2012 08:00 pm
sobrique: (Default)
So, having come back from Maelstrom. The antepenultimate event. (Isn't that a good word?).
On a new character. End of the world is nigh. Things are starting to move. I had a variety of things I couldn't do, because of something else I did. But that was all fun, none the less (Nothing quite like someone trying to pick on you, whilst you're unable to do much about it).

Also: There was Pimms, good company, and socialising. The weather control was turned up a bit from last event. Given the choice between 'cold, huddled around the fire' and 'baking hot during the day, mayhem during the night' I'll definitely take the latter :).

Would quite like it if people weren't _quite_ so uptight come nightfall, but the onslaught of the Evil Dead makes that largely inevitable. I'm now in a place where - admittedly from a short run up - I have a win condition ahead of me, which I probably have no chance of making, but am going to try anyway. (It's probably not entirely congruent with some other win conditions out there, but that makes it all the more interesting).
sobrique: (Default)
This weekend's excursion, was to sunny Chepstow, for Waltz on the Wye. Staying a little outside town, in a B&B, which I can honestly say was absolutely wonderful. The Friday evening saw a meal, followed by heading into town for the evening - mostly centered around the drill hall.
The highlight of the evening I think would have to be Morgan and West, the time travelling magicians. But a 'bloody mary' crumpet in the park by the river was rather fun.

Saturday, we had an early start for an epic breakfast, followed by a retreat to tactically snooze, before heading into the town for lunchtime. A wander around the mechanized market, a visit to the castle (and the contraptions exhibition). Not forgetting, of course, the 'chap hop work-shop' with the illustrious Professor Elemental. Who was a bit overwhelmed - expecting a turnout of 'about 10 people'. I'm sure it comes as no surprise that there was considerably more interest than that.

A takeout pizza, and a 'quick-ish' change, before the evening's entertainment. A cabaret show - including the can can, some juggling, hula hoops, and of course, a spot of waltzing. The highlight of the evening would have to be the aformentioned Professor Elemental though - he's got a highly entertaining stage presence.

Sunday was a little more sedate - the kind people at the B&B did us a later breakfast, allowing for a bit more of a lie in. Again, into town after packing up. Catching 'the curious case' theatre production - which was somewhat hard to describe, but was quite funny.

There was a little more of the market, another crumpet or two, and a talk about hidden messages in jewellry.

Am now home. Fairly tired, and now convinced I look good in a top hat.

I would, however, like to make some observations.
Firstly: Goggles-on-hat are now cliche. Some outfits they make sense. Mostly, they're just a bit silly really. I have nothing wrong with the idea of wearing the goggles, and putting them on top of your hat to get them out the way. Having them as permanent hat ornaments though, is just a bit ridiculous. It's the metaphorical equivalent of wandering around in the countryside, wearing riding gear, but having never been near a horse in your life.

Also: I now have several ideas that are amusing me. Hedgehog skirts - crinoline with spikes that 'pop up' (Maybe also doing a 'colour unfurling thing').
Maybe kickstool crinolines (e.g. one with a mobile chair to sit on, as you go).
Cog skirts, so multiple of them can mesh together - turn every dance into an excess of twirling (and battling for gearing ratios).
How to make a portable 'smoke machine' to have a chimney stack on a stovepipe hat.
'book' style phone and kindle cases.
And I'm also trying to figure out if you can subvert the 'goggles on hat' by making them lenses for a projector.

So yes. All good fun. Think that'll be one of the ones we aim to do next year.

Oh, and whilst I remember: Air Kraken. Do they live on air biscuits?
sobrique: (Default)
So I have in the past, been a pig about the national lottery. Calling it a stupid tax. (Or a greed tax, which is why I occasionally buy a ticket when there's a really huge jackpot).
But one thing that I can see, is that it's got potential as a 'piece of a dream' - I mean, leaving aside how exploitative that is, you've got a moment to think of what you'd do with it, and the small possibility that it pans out.

So I'd like to suggest an alternative - the 'job' lottery. It's a bit like the real lottery, only it's one where you put in an application for a job that'd be life changing. Be that because it's your dream job, or it's got the best hours and benefits, or just ... well, because it's near somewhere you'd really like to live.

Take a moment to enter each week - there's plenty of websites, but I'd suggest playing in - you may not be qualified, but I guarantee you your odds of 'winning' are a lot higher than getting the jackpot on the lottery. Second prize is a chat, a tour, and a cup of coffee and a chat about what you'd need to get into it.
And even if you don't win... well, you've got your CV and applying skills brushed up a bit. And anyway, it's not like you'd win the lottery, either.

But once you do that, then take a moment to dream about what that job could mean for your future. What it'd be like to live there, or do that, or get paid HOW MUCH?!

(Entry fee is probably cheaper than the lottery, too. At least, provided you're applying for the 'send us a CV' ones...)
sobrique: (Default)
So, being a fan - as I am - of Perl, I've had a reason to take a bit of a look at threaded code.
Threading is one possible implementation of parallel code and - for my purposes - is quite useful when you've got multiple things going on, which require 'something else' to respond.

Such as - for example - if you've got to log in to a lot of different servers, to perform a simple task - the 'login' takes more real time, than it does 'processing time' - so by threading, you end up with the task being accomplished faster.

Perl is actually quite easy to 'thread' with - the only really hard part is that your perl interpreter must be compiled to support threading - and if it doesn't by default, then it's a bit of hassle to recompile it. The good news is, current versions of perl seem to by default (my small sample of 'a couple of systems' I didn't need to rebuild).

The basics of how to do it, can be found in 'perldoc perlthrtut' - but it goes a bit like this:

add 'use threads;' to the start of your code.

In your perl code, create a sub routine, that will run as a thread.
sub thread_test_subroutine
  my ( $arg_1, $arg_2 ) = @_;
  print $arg_1;
  sleep ( rand(10) );
  print $arg_2;
  return $arg_1 + $arg_2;

When you call that subroutine, rather than doing so in the normal fashion, do so using
threads -> create.

my $thread = threads -> create ( \&thread_test_subroutine, ( $first_arg, $second_arg ) );

And for the sake of neatness, you need to 'join' the thread (joining is perlish for 'wait for it to finish, and get any return codes).

threads -> join ( $thread );

And it's just like that.
Because I'm a smartarse, I wanted to get a bit more clever - you can extend this idea for creating several threads, to all run in parallel.

So for example:
for ( my $count=0; $count < 10; $count++ )
  threads -> create ( \&thread_test_subroutine, ( $first_arg, $second_arg ) );

foreach my $thread ( threads -> list() )
  if ( $thread -> tid() ) 
    my $result = $thread -> join();
    print $thread -> tid(), " returned ", $result, "\n";

Which creates 10 threads, waits for all 10 to 'do their thing' and then joins them. Hopefully you can see where that gets a bit handy, if you've got a lot of networked devices to do stuff with.

But the hard part when messing with threads, is things like communicating between them. There's two libraries that I've been looking at today for that purpose.

You see, when I create a 'load' of threads, the last thing I want to do is to do so in an open ended fashion - 100 threads for 100 servers might be ok.
10,000 threads for 10,000 servers might cause a bit of a problem.

That's where Thread::Semaphore comes in, and - because Thread::Semaphore isn't part of the base distribution - I've also been looking at threads::shared.

Thread::Semaphore 'lets you create a 'shared' counter. (Which defaults to 1).
There's two bits to it - 'down()' and 'up()'.
down() is used to decrease the semaphore, and - if it's zero - will wait until it can do this.
up() increases the semaphore.

So if you insert above:

my $resource_limit = Thread::Semaphore -> new ( 5 );

And within each subroutine, used:

$resource_limit -> down();
$resource_limit -> up();
when done, you'd end up with a scenario that - with 10 threads 'existing' - you'd only actually have 5 'running' at any time.

You can also have your resource limit locally, within a loop:
sub thread_test_subroutine
  my ( $semaphore, $host, $arg_1, $arg_2 ) = @_;
  print "$host";
  print $arg_1;
  #check there's a resource available to do this bit
  $semaphore -> down()
  sleep ( rand(10) );
  $semaphore -> up()
  print $arg_2;
  return $arg_1 + $arg_2;

my @server_list = ( "one", "two", "three", "four" );

foreach my $host ( @server_list )
  my $resources_per_host = Thread::Semaphore -> new ( 2 );
  for ( my $count=0; $count < 10; $count++ )
    thread -> create ( \&thread_test_subroutine, ( \&resources_per_host, $host, $first_arg, $second_arg ) );

Which passes your 'semaphore' into the thread as a reference, such that you'll only have to 'active' threads per server in your list.

If you don't have Thread::Semaphore available, you can 'fake it' by using a (thread) shared variable, and a lock.


sub thread_test_subroutine
  my ( $semaphore, $host, $arg_1, $arg_2 ) = @_;
  print "$host";
  print $arg_1;
  #check there's a resource available to do this bit
    lock ( $semaphore );
    sleep ( rand(10) );
  #lock is released, because it's now out of scope. 
  print $arg_2;
  return $arg_1 + $arg_2;

my @server_list = ( "one", "two", "three", "four" );

foreach my $host ( @server_list )
  my $resources_per_host : shared;
  for ( my $count=0; $count < 10; $count++ )
    thread -> create ( \&thread_test_subroutine, ( \&resources_per_host, $host, $first_arg, $second_arg ) );

Not quite as good, as you can only have two states - 'in use' or 'not' per host. But does still allow for a bit of crude throttling.

But it was somewhat easier than I thought to do something that was practically useful, using threaded perl. These snippets are for my own reference, rather than practical usefulness, and bear in mind - if you're playing with parallel programs, you can end up with all kinds of exciting and interesting things going on, if you're not careful.
sobrique: (Default)
If you've watched TV recently, you've probably seen an advert for one of the 'payday loan' companies. This is the most recent not-quite-a-scam, following on from the 'buy your gold at a stupidly low price' dealers.

However, were you aware just how much it costs to be 'consumer credit licensed'? As a sole trader, it will cost you the princely sum of £585. If it's a company, that goes up to a whole £1225.
( )

That ... well, that really doesn't buy an awful lot of regulation. Which is part of the reason the 'payday loan companies' are proliferating in this country - because it's at least relatively easy to set up, and really quite hard to fund effective regulation.

Alongside this, it probably hasn't escaped your notice, that interest rates are really low at the moment - savings accounts are just about tipping 3% interest, but ... frankly, that's a fairly lousy rate.

I wonder if the time hasn't come for peer-to-peer finance. Sort of like a 'lending market place' offering the opportunity to lend and borrow.
Offer out 'lending amounts' in small slices, to minimise individual risk, but still be in a position to - effectively - supply short-medium term loans (probably unsecured) and sit comfortably in that niche that means the lender gets a higher return than a 'savings account' in return for a little more risk.
And a borrower has access to credit that doesn't charge them 5000% APR.

What do you think? Would you make use of such a facility, if it were an option? To put down - say - £1000, to be lent out in £10 (or smaller) slices to individual borrowers, at interest rates that are 'competitive' with the existing loan/overdraft market?
Bank overdrafts clock in at 'around' 15-20%.
Credit card borrowing can be up to about 30%.
Bank loans might be in the 6-12% range.
Even mortages are generally (outside of fixed term) 4-5% (plus usually an arrangement fee).

And 'short term' credit, such as unarranged overdraft and those payday loans usually attract relatively fierce rates.

Now, you'd be trading off some risk in return for the increased rates (apparently pay day loans experience a 10-20% default rate) - there is a possibility of loss, and perhaps not full utilisation of the money (e.g. if it's not being 'borrowed' it won't necessarily be attracting interest.).

But the idea would be that you'd be able to specify acceptable borrowing quantity, interest rate and term, and probably a max proportion per individual, and a ticky box list of what you'd consider 'acceptable' in terms of who to loan to. (credit scoring, reference, security, er... whatever - but these'd be rolled into the price, in terms of applying a cost to the borrowing)

The individual would be able to 'request a quote' indicating approximate term of borrowing, and thus repayment rates (and in turn, interest). Which'd be calculated based on how many people were prepared to lend, and at what rate. (And probably be a smidgin in the middle to cover operating costs, credit scores, etc. ).
sobrique: (Default)
Two quotes that are related. Bonus points if you can guess the source (of both, the first one's easy!)
"Fear, hate, anger, the dark side are these."
If he'd thought about it, I'm sure he'd have included blame and resentment as well.
"There's magic in forgiveness."

Now, the reason they're related - they're all about emotions, and emotions that are ones aimed at someone or something.
That often leads to a trap though - because it's all too easy to focus on the target.
You fear Someone.
You hate Someone.
You blame Someone.
And you forgive Someone.

But the problem here, is the really important person in these emotions, is not the 'someone else'. But you.
The real reasons these emotions are 'of the dark side' is nothing to do with what you fear or hate. It's because they taint your perception of the world. They're an insidious poison, that skew your worldview, and make it a darker place.

That goes double if the thing you hate, fear or blame is yourself. I'm sure everyone's done it, at some point or other. That feeling of failure, of guilt that leads to self doubt, and self hate.

But still - it's not the subject of the emotion that matters, but the source.

The reason forgiveness is so inextricably linked though - forgiving someone is _also_ very little do to with the subject. It's all about letting go and putting aside all those dark side emotions. Forgiving isn't about forgetting. It's about letting go of that poison inside of you, and letting it go away, rather than clutching it close to your heart, where it can most hurt you.

So next time you feel tempted to 'stray towards the dark side' - just stop and think for a moment. Who's that actually hurting?
sobrique: (Default)
So, a wise man once said to me (and I paraphrase slightly, due to vagaries of memory):
There are two types of problem. The ones you care enough to do something about.
And the ones you don't.

The former, you should.
The latter, you shouldn't worry about.

I find it elegantly summarises how to live a contented life. Maybe even a happy one.
Page generated Sep. 26th, 2017 07:32 am
Powered by Dreamwidth Studios