Pebbl has been revamped! v0.3

by Developer @ pebbl.co.uk on Saturday, 13 February 2016

Ok, so in reality this release happened a while ago... but it has taken me until now to actually write about it.

This work has been going on in the background of my life for a while — true, the birth of my daughter definitely pushed what was already background beyond whatever layer you might imagine lies behind that. But considering Pebbl has been in development since 2007, it is probably used to coming second fiddle to everything else.

Prior to this recent release, I had been playing around with Unity (something which I completely failed to mention here, and I still won't, because the work — not the knowledge or the technology — is now obsolete).

You can see those experiments (along with other previous examples) by clicking one of the images below. Be warned you will need the Unity Player installed for some of them.

Part of life as a developer is to be constantly checking and re-checking what is available to help do your job. Over the nine years of Pebbl works, I haven't just been naively re-inventing a wheel with my bespoke code. I have constantly been on the look out for decent Game Dev libraries. Those that will help me speed up my work, whilst at the same time give me the control that I need.

This research has spanned a number of solutions: EaselJS, PaperJs, Box2D, Unity, Early Phaser, D3, Three, and then smaller subsets like TweenJS, Spine (for animation), and PolyK (for polygon handling). If you combine the above with all my work on ALWTM, the effort spans further into other technologies like Flash, Silverlight, C# and more.

Unfortunately, for all my attempts, I couldn't find anything fully satisfactory. Hence the reason for trying to building my own libraries with very small amounts of free time. Certain libraries would start off promising, only to fall down at some pivotal point later on. Usually this would either be in terms of performance, or a particular missing feature. That is at least until I started using Pixi.js, and the more recent version of Phaser. Both have given me the ability to happily put together the following:

True, I must be quite demanding customer when it comes to Game Dev libraries. Considering there are a lot of Games and "games" already out there, that have been powered by the technologies I have already mentioned. But there are a number of abilities that I want my online worlds to have, that have ruled out a lot of what is on offer (at least not without some serious extension of existing code).

Polygons, where for art thou Polygons?

One key issue is the ability to hit test against polygon shapes. I flirted (as mentioned above) with complex physics engines for a while. Most give you this ability (at least for convex polygons) out of the box. The problem is, whilst you may gain a lot from a physics engine like Box2D — it simplifies very complicated interactions — it actually complicates all the other parts of a game that would usually be easy to code. The likes of working with platforms consistently, or just trying to get objects to sit still, becomes a real headache — especially if you insist on slopes.

The curving of a slope

This has been the part that has made nearly all my personal projects difficult. I could obviously just concede and produce another platformer with a tile map; but where would the fun be in that? Both ALWTM and Pebbl require slopes — Pebbl is very annoying in that it requires curved platforms... and I have yet to come across a Game Dev library that helps properly with this (without using a physics engine). I attempted to use Phaser's Ninja Physics, but it wasn't flexible enough — but to be honest, what I'm requesting is a tall order.

Latest version

Pebbl v0.3 still uses Phaser (powered underneath in part by Pixi) but I've added in my own collision handler called imagination.js:

http://pebbl.co.uk/v0.3/scripts/imagination.js

I say my own, but to be honest the hard work so far has been done by the brilliant PolyK library — without which I think I would have given up.

For Pebbl, the PolyK lib allows me to raycast out from an entities position, and detect if there was a collision against quite complicated shapes. The system is still very buggy — as you will see in the demo. Especially if you attempt to walk underneath the plant. But this method is much easier to build a game around than using a physics engine; and I will iron out the kinks over time.

This system allows me to add polygon hit areas to static (or programmed motion) entities. I don't think I'll extend the work to dynamic motion entities just yet (not until I can get static to work properly). This at least will cover all the elements I actually need to support polygons... for now.

The misadventure of National Express and the "soft" hand luggage.

by Developer @ pebbl.co.uk on Friday, 1 August 2014

It is a sad state of affairs when common sense does not prevail, unfortunately that is exactly what happened when travelling back from a weekend break in Prague. What had been a nice birthday celebration was unexpectedly scarred by a strange company policy — and one individual who enforced said policy — that left us with a very stressful, costly and tiring journey home. From now on I will quite happily pay triple the cost of any National Express ticket, just to avoid getting in that ridiculously petty situation again.

No one expects the Flanders Pigeon Murderer

If you are planning to purchase anything to bring back from holiday, and part of your journey will be travelling with National Express, I urge you to think twice. Because it seems that if it is not "soft" you will be forced to place it in the hold. They seem to think that a handbag or rucksack, carrying absolutely anything under the sun, is safer than a light, well packed, mainly cardboard and polystyrene box.

Quite how any of these items can cause a problem if placed under a seat, I have no idea... But I am pretty certain — if we are talking hypothetical-worse-case-scenarios, which we obviously are — I would prefer a singular light box pouncing towards me, than a bag that would more than likely break open in a cascade of sharp, powdered or liquid contents.

Next time — if there is a next time, which I really do not see how there can be — all I would need do is take my fragile purchase out of its obvious box and place it in a spare rucksack or carrier bag; as this is precisely what other people were allowed to take on board without any stringent "safety checks".

Four candles?

Perhaps we could have avoided this baffling problem if: for one, we had foreseen it (no other form of transport has had a problem be it train, plane, or bus... I have even carried a rolled carpet on a bus before); and two, we had contacted National Express prior to boarding and requested a note of permission — as their luggage terms state. However, in my opinion, this would have made for a further mockery of their "it could be dangerous" excuse.

At the end of the day I get the feeling that this was a case of our "driver" following the rules to a letter, when applying a bit of common sense would have been more sensible. And if that is not the case, and he would have likely applied this logic to everyone; no excuses! Then perhaps National Express should realise they need to be as accommodating as the other forms of transport, to avoid catching weary travellers off-guard. Especially when they do not draw attention to this unexpected policy in any of their advertising, nor on their tickets.

Why do I think common sense should have overridden their one-size-fits-all luggage terms?

  1. The journey we are talking about is from Heathrow (HRW) to Woking (WOK), it takes all of 30 minutes.
  2. The coach had about ten people on it — a pessimistic much-less-than-half-full — and only one stop before Woking, where it terminates.
  3. The box was easy to hold under one arm, and could have sat pretty much anywhere, the floor, my lap, under the seat, in a cordoned-off area at the back surrounded by warning stickers and bi-weekly safety announcements.
  4. It was late, the penultimate service, and the ticket office was now closed.
  5. It was obvious, being at an airport, that this box had just flown from a destination without incident.

The Norwegian Blue... what's wrong with it?

It has been a while since I have encountered such illogical thinking, and for that matter rudeness. However, I should have twigged something was odd when ours was the only coach to have people standing around waiting — whilst the driver sat in the back ignoring us until two minutes before scheduled departure time. His demeanour was moody and abrupt, with no pleasantries. All I can guess is either this person really does not take his company's ethos to heart, a supposedly friendly and professional transport service, or he cannot stand his job. It might even be that National Express are not giving their drivers enough time for breaks, which would make anyone moody. If that is the case however, then there is even more of a reason not to travel with them.

In the end we were forced to take a Taxi, which was rather costly... but at least the driver was friendly and got us home.

The Sun Helmet

by Developer @ pebbl.co.uk on Wednesday, 16 July 2014

Considering I just spent a little while, and absoutterrefutley failed, trying to find a reference to this story online — I thought I'd post it here. Considering it would be crime against all be-hatted individuals if it were ever to wander off and get lost, especially in Cuba:

A pleasant three degrees below zero wind was blowing. The early morning Londoners shivered through the bitingly cold rush hour. Among them was a bowler-hatted Mr. Oliver Thrigg. The first snow of summer was starting to fall as he joined his 'AA members only' bus cue.

Glancing to a bus que opposite (it was a different que to his cue, as the spelling proves), what he saw shook him to his foundation garment. There, in the que opposite, was a man wearing a sun helmet, eccentricity yes, but this fellow didn't have a stamp of a genuine eccentric, no, fellow looked far too normal! Curiosity got the upper hand, crossing the road he killed a cat. Once across he joined the que and left his on the other side.

The sun-helmeted man caught a 31A bus, Mr. Thrigg signalled a passing 49 A. 'Follow that bus,' he told the driver. 'Anywhere but Cuba,' said the driver. At Victoria Station the sun-helmeted man booked to Southampton, as did Mr. Thrigg, who kept him under surveillance until they reached Southampton, where by now the snow was 3 foot deep, which explained the absence of dwarfs in the street.

The man continued to wear his sun helmet. 'Why, why, why,' said Thrigg, whose curiosity had killed another nine cats, making a grand total of one. 'I must follow this man etc.' The man booked aboard the Onion Castle and was handed £10 and an oar (Assisted Passage they call it). The ship headed south, and so did Mr. Thrigg and his enigma, which he used for colonic irrigation. During the whole trip the man appeared at all times in a sun helmet. Several or eightal times he was almost tempted to ask the man his secret. But no, as Thrigg was travelling steerage and the man 1st Class, plus the fact it was a special Non-fraternising Apartheid Cruise, no contact was possible.

On the 12th of Iptomber the ship docked at Cape Town. Even though Thrigg got through Customs and Bribes at speed, he just missed the Sun Helmet as he drove off in a taxi. Thrigg flagged down an old cripple driver. 'Follow that Sun Helmet,' he said jumping on the [man's] back. To cut the story short, Mr. Thrigg used scissors and cornered the man in the middle of the Sahara. The heat was intolerable as Thrigg walked up and said, 'Why are you wearing that sun helmet?' 'Because,' said the man, pointing al a 113° thermometer in the shade, 'the sun man! This protects the head.' 'I see,' said Mr. Thrigg. 'Well I better be off, I'm late for work.' As he departed for the caravan que, the man in the sun helmet spotted him. 'Good God, a man wearing a bowler hat! A bowler hat! Here, in the Sahara? I must find out why,' he thought as he joined the caravan cue behind Mr. Thrigg.

By Spike Milligan

UI Improvement request for Amazon's confirmation page

by Developer @ pebbl.co.uk on Friday, 11 April 2014

Dear Amazon,

I would like to highlight an issue that has recently caught me in regard to your confirmation step. My reason for complaint is that I actually find your ordering process very good and was surprised to be caught out by a problem, and would like to improve the process for others if possible.

Put simply, the attached order has an estimated delivery of a month, there was no prior mention of this on the Seller's item page — I have contacted them in complaint of this — and when going through to purchase there were no alarm bells triggered by your system. Unfortunately I do not have a screen shot of the page I saw when ordering but I am very certain it was similar to this one:

It should be noted the actual seller I purchased from is different to that pictured in the screen shot.

As you can see the estimated "dispatch" is larger than anything else, and gives the illusion that the item will arrive quickly (especially as this text can change between estimated dispatch, estimated delivery with no colour difference — I originally understood that date to be delivery). When I purchased the item it was along with a number of others, which means spotting the small 7-23 days is even more unlikely, added to the fact that 7-23 days might be standard for them, but is in no way "standard" to me.

It is my feeling that anything that could take longer than a week to deliver should come with a warning note, or perhaps a highlight icon, or even just a colour difference in the text. Even when I scanned the other pages of order information, or the final order email nothing really stood out:

The problem was exacerbated by the fact that the range was a month long, because even the days matched up. Most other items I ordered had a range between Monday to Thursday of that week, whereas the attached order was Monday to Thursday of next month.

Basically it would have helped a great deal just to have some notifier that things were out of the ordinary. I've put a number of orders through Amazon, over a number of years, and have never had an unexpected delivery period of that length. Perhaps I've managed to avoid ordering from Sellers in China before, but that could bring me on to another point that Item pages are generally location agnostic, and perhaps should mention the Seller's origin.

Thanks for your time,

I look forward to your response.

Reply — received in under an hour

(I think they may have misread the tone of my email, it was not such a big deal, but good to hear that comments have been passed on.)

Hello,

Firstly, please accept my sincere apologies for any inconvenience caused by this situation.

I do understand that you are not happy with the estimated delivery date given for [your order] and wish us to update the exact delivery date on the seller's item page.

Thank you for taking the time to bring this to my attention.

We build our website information from many sources, and we really appreciate knowing about any errors or issues that have been overlooked. I have forwarded your message to the relevant department so that they will update the exact delivery date properly in the seller's item page.

Also, I do understand your concern regarding the seller's location.

Please be informed that when purchasing an item from Amazon Marketplace, you're buying it from a Seller other than Amazon.

If there are items being offered on the Amazon website by other Sellers, this will be indicated in a blue box on the right of the product's detail page. By clicking the "Used and New" link you’ll be able to see a full list of Sellers offering the item for sale. In this list, under "Seller Information" you can see where the item will be dispatched from.

I'm sorry if this wasn't clear when you placed your order.

In this case, I have now forwarded your email to the relevant department and requested them to update the seller locations more conveniently.

I apologize again for any inconvenience you have experienced in this case; the vast majority of Marketplace orders are trouble-free, but in the rare case that you're unable to reach an agreement with a seller, we're happy to file a Guarantee claim.

While I know this situation has been a disappointment, I do want to assure you that this was rare and is not typical of our normal service levels. I can assure you that we will do everything we can to help make your next experience more rewarding, if you give us a chance.

We look forward to seeing you again soon.

Warmest regards.

[Amazon].

Game Update : ALTWM 0.2

by Developer @ pebbl.co.uk on Saturday, 4 January 2014

Just a quick post to say I've just turned 32 (Good old binary offsets) and, not only that but I've also released a new web publish of my first "Long Way Till Morning" Unity Scene... Oh Yeah! It now comes with added Particle Systems to handle weather effects, plus I've improved the terrain generation using a very nice unity plugin / import called "Ferr 2D Terrain". This should mean I can start chucking together new scenes in a much more expedient manner... Scenes which will all support damn nice lighting, particles, multiple cameras and physics all from the get-go.

ALWTM : Version 0.2

Coming up next:

  1. Character Animation Control, both Pixel KeyFrames and Spines.
  2. LostBeach Scene.
  3. Multiple Terrain interaction, Annabell will be able to choose which terrain she can travel on, allowing for less linear gameplay.
  4. Submaps, allowing Annabell to travel into smaller regions like her House or the Church (both found, but not yet implemented in the demo).

Oh and P.S. Watch this space for a Unity update with regards to Pebbl!

For now though, I'm off to bed.

Game update : ALWTM & Unity 2D

by Developer @ pebbl.co.uk on Saturday, 14 December 2013

Most definitely A Long Way Till Morning

I can't quite believe that after another period of indeterminacy I've managed to cobble together yet another step forward on my path to creating a worthy online/offline platform adventure game... Obviously over all this time I've been developing game assets, which takes a lot of energy, but I haven't made much progress in the way of a Game Engine; beyond what I've tinkered with in the HTML5 space.

That's recently changed all thanks to Unity and their latest 2D release.

Unity (the Game development tool, not the Microsoft "extensible dependency injection container") is something I've had my eye on ever since it first started. It popped up at the time where I wasn't sure if I was going to invest time into building my own 2D platform engine in Flash, JavaScript or perhaps something else... I stumbled across their homepage and was rather impressed with the types of games they had running from within a browser environment.

At the time however it was much more geared towards 3D, so much so that after downloading the dev environment I found myself getting lost in the likes of Blender, 3D meshes, Shaders (if you think usual programming languages are gobbledygook, try Shaders) and fighting with 3D Cameras and Lights to appear 2D, whilst keeping pixel definition. So after getting frustrated I left my .unity project files to gather dust, but I signed up to the Unity mailing list and kept an eye on new releases.

Unity 4.3

Nothing much happened in the way to interest me, with my specific requirements, for a good number of years.. that is, until they released Unity 4.3 with added 2D support. To cut a long story short I downloaded the upgraded version and within a month of weekends I've imported my assets using a mixture of Spine and 2DToolKit, and have got a rough parallax demo up and running with simulated physics out of the box:

Unity Demo (A = left, D = right, Space = jump).

I still have a lot to tweak, and getting the camera to stop scaling with different window sizes is my first priority, but the main thing that Unity has help me with is to make easy all the things I would have found very time consuming and tricky to balance cross-device — like physics, lighting and layer effects... the downside being that it has quite a steep learning curve and all the things I would have found easy in either Flash or HTML5 are now the difficult things — Text handling, GUI adornments, asset loading and management, pixel perfection and pixel collisions... But hey, if it was too simple I probably wouldn't enjoy doing this in the first place.

Railway Refunds

by Developer @ pebbl.co.uk on Friday, 6 December 2013

You'd..

Just thought I'd write a short post about the pointlessness of trying to get a refund from the differing UK train operators; for one to blow off steam, and for two to laugh at the whole ridiculousness of the situation.

Like..

I have tried a grand total of three times — across the entirety of all my thirty one years — to get my money back from these purveyors of uncomfortable journeys. Time that would have been better spent, it would seem, learning to yodel. I would have ended up with the same result, no money back, but at least I could communicate the reasons why I might be running late across vast distances.

A..

It seems that for most companies, where there is an actual public facing staff — that are not locked away behind glass — and a realistic threat of competition; you can get a refund if the service you paid for was not provided, or was just less than satisfactory. I have experienced this across a wide range of businesses, almost instantaneously upon asking, from supermarkets, to cinemas; clothing retailers to gadget emporiums... and even decent train companies like Eurostar.

Unfortunately, all that many of our prized transport hubs can generally offer is a worried, ill-prepared individual encased in perspex — or hiding in a cupboard — who can rarely give any help beyond pre-scripted issues. It can be even less fortunate for yourself if you happen to trigger one of these pre-scripted responses, because it will usually involve being handed a thin leaflet of some kind. This is exactly what happens when you mention in passing that the specific train you've opted for has unexpected evaporated, and that due to communication being so bad — what with all this new fangled technology lying about the place — you haven't been able to find out when and from which direction the next chariot of standing-room-only will be coming from... All of which has led you to the curious but surely understandable feeling of wanting your money back.

..What?

All I can say is, DO NOT FILL OUT THAT FORM! You will be wasting your precious life, and unless we are talking hundreds of pounds, where the hope alone of getting it back might be worth it, you will really just be exercising one arm of a business that makes it their business to hold on to as much money as they possibly can. You know, for share-holders and the like...

Instead — if you can — go back to the leaflet wielding helper and ask for your ticket to be shifted to another day, that is if you can face the possibility of the same thing happening all over again.

If you decide not to heed my warning though, and it isn't a snow day, I shall tell you what will happen next. After an indeterminate amount of spacetime you will get some, little or no correspondence kindly informing you that your request has been denied, rejected, forgotten about, then — and only then — buried in soft peat BY the Ravenous Bugblatter Beast of Traal... Feeding the beast alone has cost more than the £24 you wanted back, so you now in fact owe them money.

... either that or they'll just tell you your journey wasn't delayed for more than 30 minutes, when quite obviously they were there and you weren't.


With special thanks to Southern Trains, South West Trains and Clapham Junction.

GP Search : A New Hope?

by Developer @ pebbl.co.uk on Monday, 11 November 2013

Dear NHS Choices,

I'd just like to comment that your "Results for GP in FULL POSTCODE" search is rather misleading in the fact that it doesn't take into account catchment areas. I've already had to call through a number of different surgeries only to be told that they don't serve my street — when they are less than a mile away?? Your search returns practices that are at least 2 miles out.

Having such small catchment areas in the first place is ridiculous, and not to mention a complete postcode lottery, but it's even more so if your website's location-based search doesn't take this into account. It's all very well having abilities like showing the 'general age of patients', which I'm sure is useful information to someone, somewhere, but these 'nice to haves' should only be implement once the more logical features are in place. I can't be the only person to have mentioned this...

So after what started out as a promising search, with a few pages of choice, it seems I have wasted time, money and I am actually stuck with only the first three on the list — all of which have very bad reviews.

Anything you can do to improve your search would be much appreciated, saving future exasperation of patients would be an honorable cause to have.

Reply — received 8th January 2014

Dear Mr Glanville

I am sorry to hear you have been frustrated by the lack of catchment area information for GPs displayed on NHS Choices. We do not present this data as it is not available as a centrally collated record.

GP practices catchment area is made at their own discretion, leading to variability across the country.

We do recognise that the catchment area impacts on patients ability to choose a GP practice and we are considering this in further iterations and in the development of NHS Choices.

Kind Regards

The NHS Choices Data Team

Private Landlords and Letting and Managing Agents (Regulation) Bill

by Developer @ pebbl.co.uk on Monday, 4 November 2013

Sorry, just had to post about this. Hopefully this will lead to some improvements for the average renter, or at least a body that can be complained to in the "unlikely" event of a problem. The next step would be to actually give that body powers to actually do something. I wont hold my breath however.

Private Landlords and Letting and Managing Agents (Regulation) Bill 2013-14

Mandatory national register of private landlords

Tech Wars : Yet more gender imbalancing?

by Developer @ pebbl.co.uk on Friday, 18 October 2013

Just read through yet another article stating how there needs to be more women in tech, and putting forward the notion that it's all because there isn't anything specific or special in place for women.

I can tell you the two main reason why there were less women into computers/science whilst I was at school. One, because it wasn't seen as the 'cool thing to do' and two, because young girls generally are extremely bitchy between themselves and belittle anyone that seems to be on a different path from the zeitgeist of magazines, trends and popular society. Young boys are often the same, but more in the direction of vying to be the best, and poke fun at those that are weaker.

To be honest there were hardly any people (notice no gender there) that were into computers, and I mean really into them, in terms of actually seeing and understanding the power and beauty of structure and code. In fact most people really didn't have the time of day, and those that were good at programming, or science, or maths were shunned and bullied as geeks. I knew a few girls who were geeks but they were shunned just the same as the guys; the downside being that they were probably shunned by their fellow girls more than the guys.

So whereas the BBC article below does state that there is a "worryingly" small percentage of women in the tech industry, the article doesn't put it in perspective and state that actually, there aren't many people in this country in that industry (hence the reason for the recent drives towards coding)... and if the teaching I received is anything to go by — when computers were far easier to hack and understand — I am not surprised things have not improved.

What I'm trying to get at is there shouldn't be any special implementations for Women, there should just be a better drive towards the fun side of programming (which seems to be happening at least in some places); to show people what you can really achieve and how flexible your career can be. It should not just be based on 'hey, you can make lots of money in the latest gold rush' i.e. Apps (my main reason for disliking cheesy companies like Treehouse), or 'hey look, so many open source coders have done the work for you so you can just bolt third-party code together and job done!' which seems to be the extent of many newbie coders abilities.

100 Women: Why tech needs a makeover to attract girls

TBH. Isn't that BBC title rather sexist? Or does my definition of sexism require a `brew update`?

Disclaimer alert!

Before I get lynched, a little disclaimer. I am not stating that Women coding in the current work place do not have a harder time than their Male equivalents; I know of a number of Women who do hit problems that guys would not. This is mainly due to old-guard idiotism, unchallenged assumptions, or foolish macho behaviour. Sometimes it can also be down to the Women in question being more sensitive to a situation and cautious before making a move, which can be the difference between having an idea backed or a promotion given... basically there are definitely problems. My belief is the only solution is to get more people happy and confident with coding. What you most definitely should not being doing is involving positive discrimination.

Non-Party Campaigning : 38 Degrees

by Developer @ pebbl.co.uk on Friday, 23 August 2013

Dear Chloe Smith MP,

I am writing to you, as I'm sure are a number of other people, after having read a plea from 38 Degrees in regard to the recently proposed Transparency of Lobbying, Non-Party Campaigning and Trade Union Administration Bill. Their fear is that the "Non-party campaigning" section could mean that they are unable to run effectively in the future..

I have just been reading over the bill on parliament.uk, and as usual, things are about as clear as an foggy evening in Cornwall. Now whether 38 Degrees' fears have warrant, being a layman in these areas I do not know; but from what I have read it does seem that Non-party campaigns will definitely have reduced expenditure by quite a bit. Political jargon-reading aside, there is one thing I am very clear on, that there is a huge difference between unknown, closed, private lobby groups who work for large scale companies with vested interests; and groups or charities like 38 Degrees that are supported by the general public and who broadcast their aims far and wide.

You can most probably guess at which ones I would support, and which ones I feel need to behave more openly. At the end of the day I do not blindly follow each and every 38 Degrees campaign like many in the political sphere might believe, but I do value their existence and continued operation. They provide a invaluable service of bringing national and local issues to light that I am interested in, issues that would have otherwise -- I'm sure quite happily -- been kept as quiet as possible.

So please can you confirm that this new Bill will not hamper something that I see as a valuable service, and possibly one of the only real ways that the general public can get a partial say in the way this random country is run. If you cannot, then please modify your thinking and your approach. I am all for greater openness when it comes to government, and if what 38 Degrees say is true, this would be a move in the opposite direction.

Thank you for your time, I look forward to your reply.

http://www.publications.parliament.uk/pa/bills/cbill/2013-2014/0097/cbill_2013-20140097_en_3.htm

New housing supply — Talk London

by Developer @ pebbl.co.uk on Tuesday, 13 August 2013

After posting a quick comment on the Talk London site, I felt that I should elaborate a bit more here. My comment was in response to the following statement:

"The single biggest housing challenge facing London
is increasing the supply of new homes."


Sorry, but I have to disagree. Building more now will just mean more properties are purchased / owned by companies or buy-to-let landlords who already own, and do very well by, multiple properties. Especially when 'Help to Buy' is extended beyond first time buyers, and not limited to numbers of properties. More houses brought into the lettings market will not mean that rents will magically decrease. More likely the new properties will be brought in at the "current rate" and will increase upwards from there.

My experience of Letting Agents are that they specifically advise/convince their landlords on what the "going rate" is for a property, and even after that figure has been plucked from the relative air, they still play psychological tricks on potential renters, counting on the lack of open information and experience that many renters have:

  • Constant mentioning of needing to "move quickly" — even on dejected properties.
  • Rushing multiple parties around viewings together — instilling greater feel for demand.
  • Showing only bad/old stock way before showing that which matches the renters criteria.
  • Attempting to rent properties that really should be classed as illegal or a health hazard.
  • Showing expensive properties, stating none exist for your target range.
  • Magically producing suitably priced properties when mentioning interests with other agents.
  • "Other parties have yet to place a deposit.." — start a real or imagined bidding war.
  • Delaying tactics when a renter needs to move quickly — forcing last minute decisions.
  • Not having a preview of the actual contract (what stipulations?) to hand at the viewing.

On top of the above, when you finally choose to go for a particular property — on the most likely small smattering of information you've been given — you then have to jump through a ridiculous number of hoops to prove that you aren't a criminal and that your finances are acceptable... Yet nothing of the same is expected of the Landlord, who could quite easily become insolvent or unhinged later on — more often than not, I have not even met the landlord in person.

So in my mind the single biggest challenge is how do we bring in a fairer, more open system that isn't just there to make a profit.

  1. How do we get back to a place where shelter isn't treated as a for profit business?
  2. How can we prevent runaway prices?
  3. Why should the cost of a property increase with demand?
  4. How can we escape the tricks of estate agents?

Some solutions?

  • Accreditation for Landlords, Estate Agents, Properties, and Renters.
  • Public agents that are not paid on commission.
  • Public body that renters/landlords can report bad practice, properties or renters to.
  • More open information about properties.

Please campaign equally.

by Developer @ pebbl.co.uk on Saturday, 3 August 2013

Let me first start by saying I obviously have nothing against campaigning for a better tomorrow, and I believe the following campaigns that I mention have merit, however I am getting a little fed up of the sexism that is being involved. It is as if these changes being requested are only for the good of women, and men obviously never have to deal with anything like this, because.. well they are just men who already have far superior lives to women, and are, of course, the root of all the problems.

For example, take the recent rather popularised campaign of Caroline Criado-Perez to improve the reporting controls in twitter — an amiable target what with all the despicable trolls around — however, through all the reporting and her own announcements it is as if this will only be for the benefit of women. Obviously this follows because she is described as a feminist campaigner, but why does being feminist automatically mean you discriminate against men? Why does being a troll automatically mean you are male? True, the statistics might show that on average trolls are more likely to be male, however just because that fact exists does not mean all men are trolls; it also does not mean that men are free from Troll fishing themselves — far from it.

The same is true of another recent campaign Shelve It, again introduced by feminists. Their idea, I find, a little lacking in merit. If they were truly worried about the effect magazines have on the youth in Birmingham then my first port of call would be to hide away the over dramatised, celebrity-focused, weight-loss-addicted, sex-obsessed "women's" magazines. These proliferate far further than certain "Mens mags" and do far more damage in my mind, as they are seen as acceptable, which is why similar articles wind their way into magazines that target younger girls. I do agree that magazine covers are ridiculous, for both men and women — and if some need to be covered up, then so be it — but it should be based on a rule that includes all magazines, not just targeted at a few titles that the campaigners obviously dislike personally.

In my mind the things that should red flag a magazine for covering up should include:

  1. Air-brushing of any appearance.
  2. Only showing fake-people i.e super slim, glowing teeth or over-toned to the point of explosion.
  3. Sensationalised headline titles.
  4. Overt or unartistic nudity.

It is the false impressions that are damaging children of today, they sure as hell damaged my generation. Kids need to know more about what real life is like, what real people are like — not what magazines, media and porn show the world to be.

So my complaint put simply — if you are to campaign, whatever it is... please make your campaign fair to all. Even if your efforts are to highlight something that is particularly affecting one gender, I will bet right now, that you will be overlooking and neglecting a seeming minority. You can also bet, if that minority has "typical" male traits, then it is likely you will never have heard of their existence in the first place.

Please support legal recognition of humanist marriages on the 20/21 May

by Developer @ pebbl.co.uk on Wednesday, 15 May 2013

Dear Sadiq Khan MP,

I am writing wrote to you the other day as your constituent to request your support for the legal recognition of humanist marriages when it is debated and voted upon at the Report Stage of the Marriage (Same Sex Couples) Bill on 20/21 May.

It seems baffling to me, as I'm sure it does to you, that people should still be discriminated against in particular terms of law solely based upon their sexuality or religious beliefs; where those beliefs in question neither hurt or discriminate against others.

If those who believe in a particular religion are allowed to be married in the way they wish, then so should every and anyone else, even those who follow no religion. I for one have always disliked the idea of a registry office wedding, precisely for the fact that it cannot be easily personalised and always seems to be held in places that have a similar feel to that of polling stations or classrooms. Not in a nice place to remember for the rest of your life. Obviously it is possible to have a registry wedding and then an event elsewhere, but this is where the problem lies, why should certain people have to do this... when others do not.

This simple change to the aforementioned bill would harm no one, yet it would enable people like myself to have the same choices as other human beings who — due to the simple randomness of life — just happen to hold differing belief systems.

Thank you for your time.

Easter Egg : Reminiscence of old projects

by Developer @ pebbl.co.uk on Tuesday, 14 May 2013

Was just checking back over a few old sites that I worked on and realised that some of the easter eggs I built in were still there and working — considering I know the guys behind these site pretty well, and it's been a few years (try closer to 7), I don't think they'll mind if I at least point one out.

I'm of the opinion that sites should have more fun / hidden elements baked-in, rather than the increasingly impersonal, out-of-the-box and off-the-shelf sites that you see everywhere today. It's those kinds of playful elements that give a human touch and memory to the otherwise transient complexity that forms the web.

To find the above Flash map you just need to visit http://www.airportguides.co.uk. Checking the map you'll see that there are two thin lines that cross at one point, triple click where the lines cross (you should get a pointer cursor) and then you should see a new island appear. Clicking this island should modify the content of the page, injecting some credits about the people who built the site — a kind of hidden humans.txt :)

Now for something else that humanises an otherwise hard to reach subject... and obviously does it in a far superior way — *hats off*.

JavaScript : Clone an object in JavaScript with Doppel

by Developer @ pebbl.co.uk on Thursday, 9 May 2013

With all my recent work towards Describe.js there have been a few mini functionalities that I've been able to generalise, ExpReg was one, Doppel is another. I've seen many deep clone methods in my time, but for Describe I needed the option to change the way the cloning was accomplished on a per usage basis. This might be quite a specific use-case, but there's no harm in putting it up here as a separate piece of code.

Whilst the following design is obviously not optimal — calling a function for every clone operation is quite slow — it does offer a lot of flexibility and mean that external code can form part of the cloning process.

var objToClone, objDoppel;

objToClone = {'hello':{'abc':123}, 'world':{'def':'456'}};
objDoppel  = Doppel(objToClone);

console.log( objDoppel ); /// an output that looks like objToClone
console.log( objDoppel.test ); /// undefined

objToClone.test = 'added';

console.log( objDoppel.test ); /// 'added'

Doppel is hardwired to use Doppel.IMPOSTOR by default. This descriptor attempts to create clones that inherit from their origin — as shown above. If you wish to override this behaviour you could just modify Doppel.IMPOSTOR any way you like, or, you could pass in another descriptor:

var objToClone, objDoppel;

objToClone = {'hello':{'abc':123}, 'world':{'def':'456'}};
objDoppel  = Doppel(objToClone, Doppel.CLONE);

console.log( objDoppel.test ); /// undefined
objToClone.test = 'added';
console.log( objDoppel.test ); /// undefined

Essentially Doppel is a map function but for objects. If you so wished you could do something like this:

var objToClone, objDoppel;

objToClone = {'hello':{'abc':123}, 'world':{'def':'456'}};
objDoppel  = Doppel(objToClone, {
  'object' : function(){ return {}; }
  'string' : function(e){
    return e.target.replace('456', '654');
  }
});

Which would result in a cloned object but with 'def':'456' being changed to 'def':'654'. Anyway, it's a random bit of code that someone else might find useful, so here it is:

/**
 * Doppel 0.1
 *
 *  Doppel is a system that can clone an object in a tailored way.
 *  
 *  @param obj       : the object to be cloned
 *  @param behaviour : an object containing type-keys which 
 *                     describe what should be done for each 
 *                     var type found. See Doppel.IMPOSTOR or
 *                     Doppel.CLONE for examples, you can pass
 *                     your own object too.
 *  @param recurse   : boolean if true will deep clone, if false
 *                     will only clone the object passed. (not
 *                     implemented fully yet, assume true)
 *
 *  @author Phil Glanville - 2013/05
 */
var Doppel = (function(){
  var g, describe, doppel, impostor, DoppelEvent;
  /// DoppelEvent mimics a similar implementation of an Event object
  /// an instance of this "event" is passed into each clone description
  /// method, giving quite a bit of useful information, and allowing
  /// that code to decide where the recursion stops.
  DoppelEvent = function(target, parent, property, path){
    /// the target object
    this.target = target;
    /// the parent of target
    this.parent = parent;
    /// property on the parent storing target
    this.property = property;
    /// a built recursive path of properties
    this.path = path;
    /// Doppel will continue to recurse if true
    this.recurse = true;
  };
  DoppelEvent.prototype.preventRecursion = function(){
    this.recurse = false;
  };
  DoppelEvent.prototype.allowRecursion = function(){
    this.recurse = true;
  };
  /// the actual recursive worker function
  g = function(obj, behaviour, recurse, work, parent, property, path){
    var r,i,e,t = describe && describe.type 
      ? describe.type(obj) 
      : typeof obj
    ;
    if ( recurse ) {
      e = new DoppelEvent(obj, parent, property, path);
      /// just in case we've come across this object before.
      /// @todo: would be good to find a more optimal way that 
      /// doesn't rely on modifying any src or dst object.
      if ( (i=work.src.indexOf(obj)) !== -1 || 
           (i=work.dst.indexOf(obj)) !== -1 ) {
        return work.dst[i];
      }
    }
    /// create our doppel
    r = (i=behaviour[t]||behaviour['default']) ? i.call(this, e) : obj;
    /// store for checks next time around
    work.src.push( obj );
    work.dst.push( r );
    /// if we are still allowed to recurse
    if ( e.recurse ) {
      for( i in obj ) {
        r[i] = g(obj[i], behaviour, recurse, work, obj, i, path+'/'+i);
      }
    }
    return r;
  };
  /// the exposed function that will be Doppel()
  doppel = function(obj, behaviour, recurse, work){
    recurse = true; /// false mode is not fully implemented yet.
    describe = typeof describe !== 'undefined' 
      ? describe 
      : {type:function(o){return typeof o;}}
    ;
    if ( arguments.length === 2 ){ 
      if ( behaviour === true ) {
        behaviour = doppel.IMPOSTOR;
        recurse = true;
      }
      else if ( behaviour === false ) {
        behaviour = doppel.IMPOSTOR;
        recurse = false;
      }
      else {
        recurse = true;
      }
    }
    else if ( arguments.length === 1 ){
      recurse = true;
    }
    if ( !behaviour ){
      behaviour = doppel.IMPOSTOR;
    }
    if ( recurse ) {
      work = {src:[], dst:[]};
    }
    return g(obj, behaviour, recurse, work, null, null, '');
  }
  /**
   * using the impostor description means that each of your
   * clonable properties will inherit from the origin, but
   * will essentially be a new object in-themselves.
   */
  impostor = function(){};
  doppel.IMPOSTOR = {
    /// for objects, create a new instance with the origin inherited
    'object' : function(e){
      impostor.prototype = e.target; return new impostor();
    },
    /// please note function clone does not honour function.length
    'function' : function(e){
      return function(){e.target.apply(e.src, arguments);}
    },
    /// you could inherit an array from an array, but it would be weird
    'array' : function(e){
      return target.slice(0);
    },
    /// for anything else, return the origin
    'default' : function(e){
      e.preventRecursion();
      return e.target;
    }
  };
  /**
   * The Clone description will actually create new objects for clonable
   * items. These new items have no link to their origin what-so-ever.
   * This is a very simple clone, if you wish to perform cloning of
   * objects containing DOM Elements or other complex Native 
   * constructs I'd recommend building your own description object.
   */
  doppel.CLONE = {
    /// for objects, new object
    'object' : function(e){
      return {};
    },
    /// for arrays, slice clone
    'array' : function(e){
      return e.target.slice(0);
    },
    /// for anything else, leave as it is
    'default' : function(e){
      e.preventRecursion();
      return e.target;
    }
  }
  return doppel;
})();

Please drop your legal challenges with regard to the Robin Hood / Tobin Tax.

by Developer @ pebbl.co.uk on Thursday, 2 May 2013

Dear George Osborne,

For once I felt as though many countries around the world were doing the right thing.. obviously ignoring the UK — I haven't seen us do much of anything right for a while — and now I hear that we, as a country, are trying to get in the way of other countries doing what they think is best. Why??

I keep hearing arguments against the "Robin hood tax" idea, and none of them hold water, especially when the number of countries involved is high. In fact all I see, as I have done with much of the financial issues of late, is big business and the very wealthy protecting their own interests. Now I totally understand the need for people to protect their own worlds, but you have to agree that the current way of existence is rather skewed towards those with deep pockets; and those with money have far more resources to fend for themselves than anyone else. They do not need any further help, and should remember they would not have got where they are without many of the little people underneath.

So I am writing to ask you to please drop your legal challenges with regard to the Robin Hood / Tobin Tax. You are not standing for my interests — as a UK Voter — in any way, shape or form. In my mind this tax is a small change that will make a large positive difference to many the world over, way beyond the foolishly imposed boundaries of "Country".

Believe it or not, we are all in this [Life] together, silly political catchphrases aside.

Thank you for your time.

VAT : Oh what I would do for a world where things actually made sense.

by Developer @ pebbl.co.uk on Sunday, 28 April 2013

Another rant post I'm afraid. After finally managing to submit my first VAT Return online, I spotted a link where I could give feedback to HRMC. It's only after merrily filling out a short complaint in their textarea that I spot the words "350 character limit"... forget how simple it is to limit a textarea, or to give a character counter... as usual I'm not supposed to expect the same level of quality from a government run website to that of the rest of the commercial world, or so it would seem, but I keep falling into that trap. So rather than completely truncate what I wrote I thought I'd post it here:

350 chars is not enough!

As usual, whenever I end up having to do dealings with any branch of the HRMC online it's as if only those who have studied Tax law could navigate and understand exactly what is expected, and only those who spot small links at the top right (a very bad location for western eyes) will find some of the most important navigation items. After your tenth page, third dead-end and twentieth bullet point starting with a complicated "IF" statement, you are already lost as to what applies and what doesn't.

My main complaint is that there is hardly any tailoring to the individual user, or type of business, something that the business world has to do otherwise they face losing custom. The whole experience when dealing with anything tax related is so impersonal I spend most of my time unsure if I've actually managed to do things correctly -- which is all I wish to do. This has been so much to the point that I have now taken on an accountant, and even now, things are still murky.

If the above wasn't bad enough, you even have inaccuracies in your forms. I've recently signed up to the flat-rate VAT Scheme, and if I had gone ahead reading your nine box VAT form myself, I would have filled out the values as it was asked. Thankfully my accountant advised me that I should be filling out box 7 with gross figures... there is no mention of this on the form itself.

Overall, I got the same experience from the VAT system as I have done with the Self Assessment system, the only positive is that the VAT form is much, much shorter.

Anyone might think this complication is done on purpose to create jobs...

Oh and one more thing...

The form doesn't even allow for return characters...!?! It doesn't tell you this however, it just gives you an error back saying "incorrect format" — good work HRMC.

describe.js v0.4, 0.5 and 0.6 have all been, urm... skipped.

by Developer @ pebbl.co.uk on Saturday, 27 April 2013

Things have gone a little quiet on the describe.js front, and the reason for this is that the last three versions have failed to be finished, and so, have also failed to see the light of day. Mainly because I kept on coming up with better ideas, well at least according to my brain anyway.

So just to keep things going — until I actually post some code — I thought I'd report that I'm now working on version 0.7. There is a reason for these leaps, which I'll explain once I'm done, but it should mean that describe will be even more powerful and extensible than before.

You'll just have to take my word for it for the moment though.

JavaScript : Simple RegExp wrapper called ExpReg

by Developer @ pebbl.co.uk

I just put this miniature library together to help work with Regular Expressions in a cleaner and abstracted manner. It's pretty simple, but RegExp interaction in JavaScript has always been a little clunky in my opinion, so it doesn't take much to smooth things out a little.

/// example usage
var result = 
  ExpReg(/\|/gi)
    .haystack('[believe|dont]|[either,way]')
    .replace(function(match, i){return '{'+i+'}';})
    .haystack()
;
/// result = '[believe{8}dont]{14}[either,way]'

Whilst the above may actually be shorter to type in pure JavaScript:

String('[believe|dont]|[either,way]')
  .replace(/\|?(\[[^\]]+\])/gi, function(match, i){
    return '{'+i+'}';
  })
;

.. the problem with the above is that it is completely different from the formation to step through items matched, for example:

var m, re = /\|?(\[[^\]]+\])/gi;
while( (m = re.exec('[believe|dont]|[either,way]')) ) {
  /// do whatever processing required here.
};

The main benefit of using ExpReg would be that the way of dealing with Regular Expressions is standardised, and all the RegExp objects that are created are remembered, so you can refer back to them quickly — useful in code that reuses expressions. Plus it's easy to add new methods that work in a builder fashion — similar to jQuery.

/// another example using a string instead of literal RegExp
ExpReg('/./gi')
  .haystack('this should match every letter')
  .each(function(match, i){alert(i)})
;

/// an example of mapping
var words = 
  ExpReg(/\w+/gi)
    .haystack('this should match every word')
    .map(function(match){return match})
;

Just in case it comes in useful, here is the recently imagined source code of expreg.js :)

/**
 * ExpReg 0.1
 *
 *  ExpReg is just a simple RegExp wrapper that has some useful 
 *  functions for dealing with Regular Expressions. This include 
 *  is designed to work with require.js but can also operate as 
 *  a normal js include.
 *
 *  @author Phil Glanville - 2013/05
 */
var ExpReg;
/// define not-exist fallback
(typeof define === 'undefined' && 
  (define=function(a){return (ExpReg = a())}));
/// hook into require.js
define(function(){
  "use strict";
  var global = {
    delims: new RegExp('^([^a-z0-9\s])(.+?)\\1([gimy]{0,4})$','i'),
    lookup: {}
  };
  /**
   * The outer wrapping constructor that will be exposed as ExpReg
   */
  var ExpReg = function(re, haystack){
    var t;
    if ( this instanceof ExpReg ) {
      if ( !global.lookup[re] ) {
        if ( re instanceof RegExp ) {
          global.lookup[re] = re;
        }
        else if ( (t = global.delims.exec(re)) ) {
          global.lookup[re] = new RegExp(t[2],t[3]);
        }
      }
      this.exp = global.lookup[re];
      this.source = haystack?haystack:'';
      this.matches = [];
      this.matched = false;
      this.reversed = false;
    }
    else {
      if ( typeof this == 'string' ) {
        return new ExpReg(re, ''+this);
      }
      else {
        return new ExpReg(re, haystack);
      }
    }
  };
  /**
   * Simple jQuery like attr function
   */
  ExpReg.prototype.attr = function( name, value ){
    if ( arguments.length == 2 ) {
      this.exp[name] = value;
    }
    else {
      return this.exp[name];
    }
  };
  /**
   * Define the haystack that the RegExp will search
   */
  ExpReg.prototype.haystack = function(string){
    if ( arguments.length && (typeof string == 'string') ) {
      this.source = string;
      this.matched = false;
      return this;
    }
    else {
      return this.source;
    }
  };
  /**
   * Return a particular matched item. A matched item will
   * be an object that contains a zero-indexed array of .groups 
   * and an .offset property that gives the start of where the 
   * match was found.
   */
  ExpReg.prototype.item = function(n){
    if ( arguments.length == 0 || n === undefined || n === null ) {
      return this.matches;
    }
    else if ( n < 0 ) {
      return this.matches[this.matches.length+n];
    }
    else if ( n < this.matches.length ) {
      return this.matches[n];
    }
    else {
      return null;
    }
  };
  /**
   *
   */
  ExpReg.prototype.findAll = function(){
    /// remove previously found items
    this.matches.length = 0;
    /// reset and scan
    var groups; this.exp.lastIndex = 0;
    /// if we are global we can findAll
    if ( this.exp.global ) {
      while( (groups = this.exp.exec(this.source)) ) {
        this.matches[this.matches.length] = {
          groups: groups,
          offset: this.exp.lastIndex-groups[0].length
        };
      }
    }
    /// if not global, match the first and stop
    else {
      this.matches[this.matches.length] = {
        groups: (groups = this.exp.exec(this.source)),
        offset: this.exp.lastIndex-groups[0].length
      };
    }
    ///
    this.matched = true;
  };
  /**
   * Replace current selection with either string or result of callback
   */
  ExpReg.prototype.replace = function(param){
    if ( !this.matched ) { this.findAll(); }
    if ( this.matches.length ) {
      if ( typeof param == 'string' ) {
        this.source = this.source.replace(this.exp, param);
      }
      else if ( param.call ) {
        var exrg = this;
        this.source = this.source
          .replace(this.exp, function(a,b){return param(a,b,exrg)});
      }
    }
    return this;
  };
  /**
   * Call a callback for each match found
   */
  ExpReg.prototype.each = function(callback){
    if ( !this.matched ) { this.findAll(); }
    if ( this.matches.length ) {
      var i, l = this.matches.length;
      for( i = 0; i < l; i++ ) {
        callback.call(this, this.matches[i], i, this);
      }
    }
    return this;
  };
  /**
   * Map the matches to an array
   */
  ExpReg.prototype.map = function(callback){
    var a = [];
    if ( !this.matched ) { this.findAll(); }
    if ( this.matches.length ) {
      var i, l = this.matches.length;
      if( typeof callback == 'undefined' ) { callback = 1; }
      if ( callback.call ) { 
        for( i = 0; i < l; i++ ) {
          a[i] = callback.call(this, this.matches[i], i, this);
        }
      }
      else {
        for( i = 0; i < l; i++ ) {
          if ( this.matches[i] && 
               typeof this.matches[i].groups[callback] != 'undefined' ){
            a[i] = this.matches[i].groups[callback];
          }
        }
      }
    }
    return a;
  };
  /**
   * wrap the matches with strings
   */
  ExpReg.prototype.wrap = function(pre, post){
    this.replace(function(match){
      return pre+match+post;
    });
    return this;
  };
  ExpReg.prototype.reverse = function(){
    if ( !this.matched ) { this.findAll(); }
    this.matches.reverse();
    this.reversed = !this.reversed;
    return this;
  };
  /**
   * debug log
   */
  ExpReg.prototype.log = function(pre, post){
    this.each(function(match, i){
      console.log(i, match);
    });
    return this;
  };
  String.prototype.ExpReg = ExpReg;
  return ExpReg;
});
/// remove our temporary define fallback
(ExpReg) && (define = undefined);