Category Archives: Meetup

Meetup: Workplace London, Facebook

I was lucky to receive another invitation to a private Facebook event, this time the first ever public event at their new offices at 1 Rathbone Square. The focus this time was on Workplace, an application developed entirely from the London offices of Facebook.

Ben Mathews – Practical Security for Workplace

Workplace is a product that helps people work together. It looks a lot like Facebook, but it’s a tool for people to communicate and share things for their work. The website, mobile apps and colour scheme differ from Facebook (so all your personal information is separated). Workplace places emphasis on groups and chat.

Well known companies using Workplace include Walmart, Starbuck and Heineken. These firms have formally adopted the product, it’s administered centrally and employees are members of the firm’s community while they work there. In other firms, the use of Workplace grows organically – employees can set up an account and invite colleagues to join groups (it’s free to use).

Key features include Live Video (great for presentations and Q&A globally), Workplace Chat (a desktop app neatly integrated into the OS) and Company Dashboard (for admins to look after the community).

Ben’s focus is on security for Workplace. There is a difference emphasis from consumer Facebook, where it’s vital to enable users to get back into their account, so multiple methods are supported, such as email/telephone/photo id/friends. For a workspace account, the account is linked more to the employer than to the person. When they leave the company, they should lose access. The basis is the business email account – if you still have access to your company email account, it is assumed that you still have access to the Workplace account. However, a person may work for multiple firms (e.g. main employer and a non-profit) – these identities are kept separate.

Workplace are working on solving the wider problem of identity, to be able to support people who aren’t sitting at a desk and/or don’t have a company email account, but need to re-gain access to their account. Under consideration are crowd-sourcing security (where your colleagues can confirm your identity so that your password can be reset). A less sophisticated idea is just to allow a manager authenticate their employee using the org chart – but that fails if the manager is unavailable. If you have a company admin, they could block an account when people leave the firm (caveat – confirmation by email that the person no longer has access).

Workplace highlight accounts at risk – Facebook check password dumps (websites that list passwords and accounts that have been compromised), so any matching accounts on Workplace can be notified that the account is at risk. In that case, they advise the user to reset their password (and educate them on the danger of re-using passwords across websites).

Spam Prevention – spam is in the eye of the beholder, the poster may think that a post is useful, but maybe the receiver doesn’t. Some tools exist in Facebook to prevent this – e.g. you can’t invite too many friends to an event. But for Workplace, those limits may not make sense – some global distribution lists are appropriate, such as for firm-wide announcements. Spam limits need to be context dependent – the company may want aggressive/lenient levels for spam filtering. During Hurricane Irma, one firm was posting regularly on Workplace and breached the spam limits, so these needed to be quickly adjusted.

Astha Agarwal & Connor Treacy – Building for the Workplace Platform

Initially, the application was called Facebook at Work – this was widely seen as a bad idea since Facebook was thought of as “not allowed at work”, so when re-launched it became Workplace. The Platform allows customer integration software/bots to be written. There are APIs for user management and group/content management. Bots can plug other tools into the Platform for chat and groups, to power everyday tasks. For example, discussions can be converted into tasks using a bot. They have also created an Interview Bot – to give useful reminders and context for interviews. 3000 companies are already using software integrations into Workplace. Another example is a bot to create groups for flight crews so that they can coordinate last minute changes.

Bots are built on top of the Facebook graph API, and bots in chat are very similar to bots for messenger. This enables developers to move from one codebase to another quickly. Many features are carried over, like quick replies (Yes/No), persistent menus and localisation (to translate bots into different languages).

Bots can act as a person in a group – so bots can like, comment and post. The bot can mention a person in a post so that they get a ping to look at the post. This was demonstrated for a bot that files issues in the bug tracking system when it is mentioned, and pings back to the issue creator to give them the ticket number.

Blaise DiPersia & Lyndsay Watt – Learning to Ship Love

Like any software team, Facebook have to balance Time to Market with Quality of Execution. Facebook’s Values inform their decision making – be bold, create social value, move fast and break things. This approach was initially good because they released exciting new features – but also disoriented some users and sometimes made the infrastructure unstable. Eventually there was a breakdown in user trust and a rift in company unity (between customer support and developers on new features). So “moving fast” was changed to “Shipping Love”, to encompass the delivery and quality together.

Now, tasks are evaluated against Value, Ease of Use and Craft – prioritised in that order (note that the different applications within Facebook such as WhatsApp and Instagram have slightly different emphasis on each of these).

Valuable – does it solve a real problem for a person, in a unique way
Easy to use – core features are easy to find, less common features still discoverable.
Craft – moments of delight and magic, handle failures and edge cases gracefully

Facebook Reactions was a good example of this philosophy. First, it had to be confirmed as a real problem that people wanted to be solved, tested in user focus groups. The team analysed which sticker emojis were used and how many comments were already single phrases. Reactions met all the requirements – value, easy to use and well-crafted – and is one of the most popular new features.

Leave a comment

Filed under Meetup

Meaningful Connections @ Facebook

Facebook invited me (and a few hundred others!) to a private event at their London offices to network and hear presentations from several of their engineers.

Allan Mertner – Welcome
Allan was previously at King (makers of Candy Crush) and joined just five months ago. He leads the Ads group in London – the largest group in Facebook London. The culture is to move fast and ship things, to make things better – at scale.

Damien Lefortier – Causal Modeling: Delivering Incremental Advertiser Value
A conversion is any event of interest happening on the advertiser’s side (subscribing, purchasing etc). Incrementality is a conversion caused by the ad that would not have happened otherwise. So reporting these incremental conversions is a goal for any advertising platform. But it’s hard to assess – how to measure people that would have discovered the advertiser anyway.

Attribution frameworks
Used as a proxy to incrementality for determining which conversions are considered for both reporting and delivering. Eg. 1-day or 7-day click-through (so record that the person saw the ad, then count it if they convert within some period if going to the advertiser’s site). Or 1-day View-through – the whole thing from showing the ad to converting within a day. But not all attributed conversions are incremental – may have happened anyway.

Delivering incremental value
First need to measure incremental conversions! Then you can assess if you’re improving your delivery. So you can measure random samples of people that are shown/not shown the ad, and see how many convert.

Causal modelling – model both the conversion probability given ad exposure and given non ad exposure. No need for attribution with this approach. E.g. 1 – Natural Experiments – use the natural randomisation in the system to get data. Use this to train a model – but needs correction for biases. E.g. 2 – Small randomised trials – collect data, but typically means less data to teach models.

A model can not only be used for measuring, but also predicting the impact of an ad campaign. It’s a hard, and interesting, machine learning problem. But it actually works – such as for Brand Awareness following ad campaigns.

Brian Rosenthal – How Facebook culture influenced our ad system evolution
Brian has been at Facebook for over 8 years and has worked on much of the Ads codebase.

Mission driven, monetisation business. Facebook don’t want you to see ads that waste your time and the advertiser’s money. This helps frame the problem as one of efficiency – which is appealing to engineers!

Stage 1: Launching Quickly
Ads started in 2004/2005 – it was initially a college site, so the adverts were related to colleges, storage and moving companies. Ads were integrated as part of the social media interface, not just as banner ads. They had an Advert creation interface, where you could add your ad – with identification of who is running it. Then in 2007, an auction where you could bid per click (where a higher bid increased the likelihood of it being seen). In 2009, you could finally edit your ads (previously, they were only created or bulk uploaded)

Stage 2: Embrace best practices
Figured out the right principles – unlike stage 1 (which was quick and dirty to launch), they really understood the problems. Fixed bugs due to database inconsistencies – instead, adopted modular, transactional units – taking 12 months to ensure consistency (half of that time writing tests). Enforced a strict API layer (so internal code also had to use the API as well as outside users). The auction functionality matured – multi-objective optimisation. You could now bid on all the actions you wanted.

Stage 3: Deeper lessons
Try things again, decouple concerns. In 2011, the world was moving to mobile, but ads didn’t work on mobile! They tested ads on mobile and it was a failure. Trying again with deeper knowledge helped to get it right. Decoupled concerns – an early design error was to have objectives and ad formats entangled. These were separated so that every format supported every objective and the code was independent. Dynamic Ads introduced – made the ad more suited to the person (‘customer segmentation’). Objective-based ad buying – do you want to increase adds to cart or checkouts?

Current problems
Scaling, fighting fraud, quality, malicious actors. Biggest thing has been to be adaptive, to change what they do to meet demand.

Ben Savage – Reducing Unintentional Clicks
Ben joined Facebook in 2013 – initially thinking it would be for a year or so, but has stayed because it’s a fun place to work!

Facebook has a long term view – they need their advertisers to be happy, getting return on investment and increasing their budget year-on-year. This enables Facebook to increase the sophistication of their offering – they used to bill by Clicks, now can model conversions.

Audience Network – the problem was that the value of a click was lower than that on Facebook news feed. They saw that the number of clicks reported was not well associated with the number of significant website sessions. Hypothesis – this poor conversion was due to unintentional clicks. This was frustrating for the users and reduced the value per click.

Tinder uses audience network for its ads. The click goes to Web View – so you can measure the time spent in the browser (before they go back to the launching app). At Facebook, Data Wins Arguments. If there are short sessions, it’s likely the click was unintentional. Could they remove the financial incentive to get these unintentional clicks?

Well, what if they stop billing advertisers for such clicks? Blogged that the company would stop billing for this, even though it reduced revenue, because it’s the right thing to do. As an engineer, that’s pretty rewarding. The hope is that advertisers would then re-design ads (such as removing active whitespace areas) because they wouldn’t count clicks for that anyway.

Wrap up
The panel answered questions from the audience. One development they would love to see is that, for users who allow mobile Facebook to track their location, associating showing an ad with the user physically visiting the store to make a purchase. Another feature that’s already available is “Why am I seeing this?” if you’re wondering why a particular ad was selected for you.

Leave a comment

Filed under Meetup, Technology

C++ London Meetup: Distributed C++

This is the first time that the Stockholm C++ and the London C++ group have combined to produce a series of lightning talks, half given from Sweden and half from England.

Bjorn Fahller: A variant of recursive descent parser
Raised issues with generators and lexers when trying to do this, particularly for debugging. What about std::variant? Has knowledge of the type that it’s holding, and there’s std::visit that can overload function call operators for each type.

// visitor class is defined elsewhere, too far from its declaration!
visitor visitor_obj; 
int i = std::visit(visitor_obj, variant_var );

// Alternative - Bjarne's overload approach with lambdas  
auto t = lexer.next_token();
    [=](ident var){ return lookup( var.value); },
    [=](number n){ return n.value;}
  , t );

The template overload makes clever use of deriving from a lambda via templates and C++17 features. The details are here.

Bjarne also referenced: Matt Kline’s post on std::visit is everything wrong with modern c++.

Mikael Rosbacke – Yet another state machine tool
How to make it easy to write state machines? Hierarchy, entry/exit action, queuing, no heap allocations, no code generation.

Mikael’s framework provides a finite state machine base class from which you derive and post events as they arrive. Each state derives from a framework state base class, and provides an event method to transition into other states.


Simon Pettersson – The Art of manufacturing types
Compile time lookup-table – with a very convincing demo in compiler explorer, where marking the lookup result as constexpr changed the compiled code to simply a constant.


Paul Dreik – what is this std::forward thing?
A beginner’s guide to forwarding references – suppose you want to write a wrapper function that does some action then calls an underlying function. You would need to use std::forward like this, otherwise the wrong overload of function f would be called:

struct S{};

void f(S& s){ puts("f(S&)"); }
void f(S&& s){ puts("f(S&&)"); }

template<typename T>
void wrap(T&& t){

int main(){
  S s;

  wrap( s );
  wrap( S() );

Dominic Jones – Reflecting on names – Facilitating expression tree transforms
Would like to transform expressions differently according to the variable inputs:

transform(a + a) -> 2 * a
transform(a + b) -> a * b

Thoughts are to introduce varid, a keyword based on the position of the declaration of the variables. Evaluated at compile time, a bit like address-of, possibly the hash of the file name, row and column of the referenced variable. The use is for faster automatic differentiation.

Phil Nash – a Composable Command Line Parser
When writing Catch 1.0, Phil wrote Clara 0.x – a command line parser library (but it never reached maturity). As part of Catch 2.0, he has written and completed Clara 1.0! The latest version of the library introduces class Opt which declares command line options, which are then combined with the pipe operator.

auto a = 
      Opt( width, "width" )
        ("How wide should it be?")
    + Opt( name, "name" )
        ("By what name should I be known");


C++ London University
Tristan is a volunteer at this initiative to support interested parties in learning C++. Hosted by Mirriad, it comprises a mixture of lectures, exercises and covers the basics. 4 meetings so far, looking for tutors and more students! Tristan Brindle –,,

Ian Sheret – Automatic Differentiation in C++
For mathematical functions in various domains. z = f(x,y) e.g. hypotenuse as root of sum of squares in a triangle. But what about values of z near x and y, if we change by some epsilon? Can use Ceres Jets to keep track of the differentiated values. Templatise the function so that you can pass in the Jet variables (instead of simply doubles). Then the return value automatically returns the derivatives as well as the function value!

Andrew Gresyk – Effective Screening Interviews
Consider cultural fit and technical fit – but if they do a separate cultural interview, 80% of people pass that anyway. Need to test communication and ability to write real code – asking knowledge questions only is not sufficient. Replace questions with practical exercises.

Jamie Taylor – Beyond SSO: The Merits of Fixed-Length Strings
std::string – easier and safer to work with than a c string. Handles memory allocation. Uses short string optimisation – short strings go on the stack, so no dynamic allocation.

But – length of SSO buffer is implementation defined. If string is too long, will dynamically allocate. Also, the fixed buffer inside the std::string will frequently be much larger than a very small string you wish to create (typically 32-bytes).

// fl::string is an alternative where the size of the buffer
// is customisable in the template parameters
template<size_t length>
class fl::string
  // Implementation elided!
  char m_data[length];

Don’t want to pay full cost of e.g. 32 byte std::string if your string will only be 3 characters. This allows you to specify the maximum length in the template. Get average 6x and 13x speed-ups for 8 and 32 character strings for both creation and access of string keys in maps. Can be more friendly for your cache and great for low-latency.

Vittorio Romeo – you must type it out 3 times
Vittorio wants to write a generic log and call method with a noexcept handler – but has to type the same forwarding signature three times! Solution could be the “=>” operator that’s been proposed.

Leave a comment

Filed under C++, Meetup, Programming

IET Meetup: Artificial Intelligence Marketing, Lisa de Bonis & Gary Jobe

Lisa de Bonis and Gary Jobe work for Havas, a communications and marketing firm who aim to demystify technology and find commercial/strategic applications for their customers. They frequently use cognitive systems like IBM Watson to understand imagery, language and unstructured data – enabling them to reason, learn and interact with the data.

Lisa demonstrated the power of today’s AI via Google Quick Draw, which can recognise pretty basic hand-drawn pictures, based on millions of examples of drawings of the same subject by other people.

Perhaps the most compelling example was Lisa/Havas’s involvement in EagleAI – a commission by ITV News during the recent US Elections. Given that news organisations all had access to the same polls, ITV News wanted a different angle. Havas had just 4 weeks to put together a system that could analyse speeches, tweets, blog posts, debates from the election campaign. The aim was to use AI to determine the main motivators for the electorate and provide insight. Whilst traditional pollsters predicted a Clinton win, EagleAI predicted a Trump win, and found he was in the lead throughout (being more in touch with the motivations of the voters).

Leave a comment

Filed under Meetup

C++ London Meetup: FFIG and Why Iterators got it Wrong

This month’s C++ London meetup features two talks – the first on C++/Python integration and the second on C++ iterators.

Foreign Function Interface Generator (FFIG) – Jonathan Coe
Jonathan presented his hobby project, FFIG, largely written on the train during his commute (!).

I want to be able to write C++ code and call it from Python without doing any extra work

He explained that existing solutions (Boost::python and SWIG) generate interfaces that bind you to a specific binary Python implementation. Whilst a work in progress, FFIG’s generated libraries are Python library independent (meaning you can compile once and call from multiple Python libraries).

FFIG generates a C-API on top of your C++ code, which eliminates any classes/structs, but provides a library readily callable from Python. It also generates a Python (or Ruby) library that layers the objects over the C-API, to restore the original interface. A key lesson learned during development was to hide any ownership concerns from the Python layer.

Why Iterators Got It Wrong – Arno Schödl
Arno has developed a range-like library within his firm (Think-Cell), which addresses some features of iterators perceived as ugly:

// Iterators returned by begin() and end() are asymmetrical
auto it = collection.begin(); // start of a non-empty collection
std::cout << *it; // ok - prints the first element of the collection
auto it2 = collection.end(); // end of a non-empty collection
std::cout << *it2;// error - undefined behaviour, end() returns 1 past the last element!

// Algorithms may return a valid element or a sentinel "border" indicator
std::vector<int> v1{0, 1, 2, 3, 4}, v2{};
auto result1 = std::find(std::begin(v1), std::end(v1), 2);
std::cout << *result1; // ok
auto result2 = std::find(std::begin(v2), std::end(v2), 2);
std::cout << *result2; // error - de-referencing end again

The summary was that his library distinguished between elements and borders instead of using iterators. Once rolled out through the codebase, this made the code clearer and avoided any chance of undefined behaviour. However, I think the availability of Eric Niebler’s Range library (or simple higher-order functions) make the STL so easy to use that these concerns shouldn’t put off new developers.

Leave a comment

Filed under C++, Meetup

ACCU Meetup: Making Templates Easier, Roger Orr

Roger Orr gave this month’s ACCU presentation on Making Templates Easier in C++. He showed two techniques that people commonly use to tailor template implementations for specific types: Tag Dispatch and SFINAE (via enable_if).

With Tag Dispatch, you can switch to different implementations of a template function using traits classes based on one of the input parameter types (e.g. use std::iterator_traits to target a faster implementation for random access iterators). The downside is that you often have to duplicate code across the different implementations.

With SFINAE, you can use typedefs within a parameter type to disable particular overloads. E.g. STL containers have a ::value_type typedef, so you can use that to differentiate between collections and scalar inputs. The downside is that you sometimes have to add additional, defaulted template parameters to allow the compiler to distinguish between otherwise identical template definitions.

Roger then introduced constexpr if from C++17 and concepts from C++20.

The advantages of constexpr if are that it can be used both inside and outside templates and specialisations can be defined inline. Any code that would not compile can be put inside a constexpr if and will be discarded. This seems more straightforward than the recursive template solutions Roger showed earlier in the talk.

Concepts are intended to help define the requirements of a template in a way visible to the compiler as well as the developer. Reusing concept definitions should leave to a domain-specific language that helps within a project. Better still, use of a template parameter type that doesn’t satisfy concept requirements will generate a more helpful error message than if SFINAE were used to achieve the constraints.

The finale was an overview of the new SpaceShip operator, !

The video is now available on the SkillsMatter website.

Leave a comment

Filed under C++, Meetup, Programming

BCS Meetup: 2017 Lovelace Lecture, Andrew Blake

I was lucky to get a ticket to hear Andrew Blake’s Lovelace lecture, on the subject of “Machines that (learn to) See”.

Machine vision works nowadays. Machines can: navigate using vision; separate object from background; recognise a wide variety of objects, and track their motion. These abilities are great spin-offs in their own right, but are also part of an extended adventure in understanding the nature of intelligence through visual perception.

The speaker was Laboratory Director at Microsoft Research, Cambridge and his team was behind the the Kinect technology. He is now Research Director at the Turing Institute.

The lecture covered the history of machine vision over the last 50 years, the rise and fall of different approaches to AI over the decades, and finally the recent successes of analysis-by-synthesis and empirical recognisers.

Leave a comment

Filed under Meetup