Fresh Fitness Food (FFF) offers bespoke meals delivered to‑door daily, in London and several other city centers in the UK. Through personalized (macro-specific) meal plans, FFF gives its subscribers the exact nutrition they need on a daily basis, providing the precision, structure, and consistency needed to achieve their fitness goals.
Having enjoyed steady growth since launch, last year saw FFF delivering around 60,000 meals a month. Its website and backend solutions at the time could barely support this volume of orders, but FFF already had plans to grow in the UK and go international via a franchising model. Hence, while upgrading its web platform – FFF also wanted to digitize several manual processes and tasks done via a number of disjointed tools. The intent was to make its operations standardized and scalable while creating a proprietary technology platform that would transition it from meal delivery into a technology company.
While searching for a technology partner FFF was introduced to Calcey by one of Calcey’s long-standing clients in London. Calcey’s long list of clients in the food-tech and fit-tech space in London made a convincing case that they had finally found the right partner.
FFFs’ CEO Caspar and Emma who played the role of product owner for the new web portal traveled to Colombo to participate in a ‘design and discovery’ workshop to kick off the project. During this intense week-long workshop they gave the Calcey team a crash course in the intricacies of their business model and brainstormed how the new digital platform could help FFF on-board, service and retain customers with greater efficiency.
Fast-forward 9 months, FFF’s brand new web portal is now live and accepting orders! Calcey’s team built, tested the solution and completed the migration of FFF’s legacy data, which involved parsing data from several sources together to form complete client records, just in time for FFF to launch an integration with F45 and face its busiest season of the year with confidence.
The cloud-based solution that Calcey delivered for FFF combines enterprise resource planning (ERP) capabilities with a customer relationship management (CRM) system. All recipes for food to be cooked, along with attached nutritional values are maintained within the solution. Similarly, all client records from their postcodes to fitness goals, nutritional needs, exclusions (due to preferred diet or allergies), and meal delivery schedules are managed within the web portal. Limiting the variety of meals cooked on a daily basis is key to FFF’s cost efficiency. However, this has to be done without overly repeating the same food types and taking into account the individual nutritional needs and exclusions of every user. Taking all of these constraints into account to arrive at meals to be served to a specific user on a daily basis or ‘meal balancing’ as it’s known at FFF, traditionally required a team of nutritionists. Today the bulk of this work is done via an algorithm. After balancing the meals the solution creates a ‘cooking sheet’ stipulating food items and quantities to be cooked, a ‘labeling sheet’ setting out how portions should be customized for each user and a ‘shopping sheet’ listing down inventory to be purchased, on a daily basis. Finally, a delivery manifest is generated with precise instructions for delivery staff. A true end-to-end solution indeed or as FFF’s CEO puts it “a truly spectacular piece of software that works beautifully!”.
The new web portal had an immediate impact on FFF’s bottom line, improving its direct margin for food, staff and packaging costs by 14% within just 2 months of launch.
Calcey, one of Sri Lanka’s leading software product engineering companies recently sponsored the BreakIT SaaS Summit in Stockholm, Sweden. The event was organized by BreakIT, Sweden’s leading digital publication and was attended by over 400 local industry executives. Calcey CEO Mangala Karunaratne and Software Architect Premuditha Perera delivered an expert address sharing lessons learned from Calcey’s many years of experience in delivering high-complexity SaaS (Software as a Service) systems for clients in Silicon Valley.
Speaking after the event, Calcey’s CEO said, ‘We see great potential for providing software engineering services to Swedish companies. We already power one of Sweden’s largest e-commerce brands – Nelly.com – and have great partners and relationships here. We partnered with BreakIT in collaboration with our local partner in Sweden – Best of Sri Lanka. I’m looking forward to seeing Sweden join the U.S. and the U.K. as one of our largest markets’.
Calcey’s CEO, Mangala Karunaratne on-stage at BreakIT SaaS Summit in Stockholm
BreakIT CEO Camilla Björkman said, “We are so proud to have Calcey as one of our main partners of the SaaS Summit in Sweden. They added a lot of value to the event by sharing their experience of building world-class SaaS products. I’m sure their presentation would have made a number of Swedish tech companies interested in visiting Sri Lanka.”
Calcey is a boutique software product engineering firm that combines innovative Silicon Valley culture with the highly skilled engineering talent of Sri Lanka. Founded in 2002, Calcey’s 130-strong team provides Agile product engineering and quality assurance services and enterprise mobile, web and cloud solutions for clients across the globe.
Calcey’s development center and headquarters in Trace City, Colombo
Sri Lanka’s IT industry just added another feather to its cap.
Sri Lanka’s IT industry is dwarfed by that of its northern neighbor, but the island nation more than makes up for it by the imaginative solutions it is able to offer customers. The world-class talent pool available in the country has prompted firms such as the London Stock Exchange Group to acquire a Sri Lankan software company to run their core trading software platform. It is not surprising then, that Sri Lanka was crowned the “Outsourcing Destination Of The Year-2019” for the third time by the National Outsourcing Association of the UK. Previously, the country won the award in 2013, and 2014.
Sri Lankan software professionals are in high demand. A recent survey conducted by ICTA Sri Lanka has found that there is an annual demand for more than 20,000 software professionals. As the sector continues to grow, this demand for quality talent will only grow. And there is no sign of business slowing down. Day by day, more and more companies are flocking to Colombo in search of high-quality IT expertise.
But why do customers prefer Sri Lanka for IT offshoring?
Culture
Sri Lankans are generally more in tune with cultural behaviors in the West. Sri Lanka lacks an outsized homegrown entertainment industry similar to Bollywood. As a result, Sri Lankans are exposed to Western media and pop culture from an early age, which allows them to be comfortable with those from a different culture. Combine this with the legendary Sri Lankan hospitality, and you have the perfect ‘unfair advantage’. As a result, Sri Lankan software professionals find it easy to get along well with their Western counterparts, leading to faster execution and better collaboration.
Just ask the management of Nelly.com, a Scandinavian eCommerce player, who decided to deploy an extended development team at Calcey.
Flexibility
Except for a few large-scale players who exclusively focus on multi-million dollar contracts for Fortune 50 or Fortune 100 companies, the bulk of Sri Lankan IT service providers are comfortable working with small to medium-scale companies. Here at Calcey, we pride ourselves on our ability to work with both corporates and startups, even those trying to build an MVP.
Why?
Because we know that it is today’s small businesses that will grow into tomorrow’s large behemoths, and every elephant dominating the stock exchanges today was once a tiny ant.
Some of our large-scale clients include CompareNetworks and Paypal, while some of the fast-scaling tech companies that we work with such as FreshFitnessFood and Nutrifix, have gone on to shake up their respective markets in the UK.
Low Staff Turnover
Sri Lankan software professionals are well-paid, and working conditions are world-class at many local software firms. The proof is in the details. Our friend Thomas Säld, Global Head of R&D at IFS AB, a Swedish software firm with offices in Sri Lanka, regularly tells the story of how nearly 20 years later, most members of the original Sri Lankan engineering team of 20 still work at IFS. This was one of the key reasons for IFS to expand its operations in Sri Lanka. Today, IFS’ global delivery center in Colombo houses nearly 1000 employees.
Employers in Sri Lanka’s IT service industry don’t hesitate to invest in developing their people and as a result, tenures are long and turnover is very low.
Punching Above The Weight Class In Innovation
The team from the University of Sri Jayawardenepura which re-created Harry Potter’s sorting hat/ Credits: University of Sri Jayawardenepura
Then there is also Vega, Sri Lanka’s first homegrown electric supercar manufacturer. Their development center is located right next to our offices, and we consider ourselves lucky to be able to witness a dream to build a fully electric supercar become a reality.
It is truly astonishing how much potential Sri Lanka’s IT
sector holds. Today, Sri Lankan software powers everything from stock exchanges
to open banking platforms. Who knows what tomorrow holds?
But one thing is for sure. Sri Lanka fully deserves to be called the ‘Island of Ingenuity’!
Opinion
No Time To Ride: Uber Sri Lanka’s Automation Debacle
Learn from an unhelpful chatbot and build a better customer support system for your business
Uber Sri Lanka is in the news again, this time for turning a blind eye to the issue of an errant driver assaulting a customer over an innocent question about a canceled trip. To make things worse, Uber Sri Lanka has done nothing to rectify the situation after the passengers took to social media, leaving its chatbots to spew pre-programmed messages instead. Understandably, this has infuriated many, and questions are being raised about the legality of Uber’s operation in Sri Lanka, where there is no formal channel for unsatisfied customers to raise their grievances.
In #lka, at least 2 incidents involving @Uber_SL drivers have been reported to the police; in one instance, the passenger has been badly injured. Uber does not have a customer service hotline in #SriLankapic.twitter.com/6BCGiOogpE
Sri Lankan users have been voicing complaints regarding Uber, but to no avail/ Source: Twitter
Customer care has been hailed as an area in which chatbots can excel, rendering customer support executives a thing of the past. However, as is visible with the Uber Sri Lanka debacle, a chatbot can sometimes do more harm than good.
Against such a backdrop, what should you be aware of if you’re thinking about deploying a chatbot to solve your business problems?
Understand The Different Types of Chatbots
Chatbots can be categorised into two primary categories: ‘Transactional Chatbots’ and ‘Knowledge Chatbots. Before you deploy a chatbot in your business, make sure you understand what each type of chatbot can and can’t do. Deploying a transactional chatbot in a place that needs a knowledge chatbot is a recipe for disaster.
Transactional Chatbots are built and optimised to execute a limited amount of specialised processes which eliminates the need to talk to an expert or use more complicated UIs such as mobile apps or websites. In contrast, knowledge chatbots support thousands of processes and in some cases, can even make decisions for you.
Transactional chatbots are trained on top of structured data
and can do a set of limited operations. Think of what a bank operator can do
for you over the phone: verify your identity, block your stolen credit card,
give you the working hours of nearby branches and confirm an outgoing transfer.
The exact same functionality can be imparted to a transactional chatbot, which
can then be deployed via Facebook Messenger, for instance.
On the other hand, knowledge bots are helping you both make a decision and execute it. In order to be able to “make a decision” the chatbot is usually trained with a vast amount of unstructured and structured data, and is trying to produce a response as an expert. Though not exactly bots, IBM Watson (and Deep Blue before it) are good examples of knowledge systems.
A matrix showing the differences between knowledge chatbots and transactional chatbots / Source: progress.com
Simple, But Not Stupid
For a chatbot to truly deliver value, it must simultaneously be simple to use, while not being too simplistic a.k.a. ‘stupid’ to turn away and/or frustrate users. This is a problem Uber Sri Lanka has to deal with. Remember that a chatbot is not sentient, and is only as good as its bank of pre-programmed scenarios. When a query doesn’t match a pre-programmed scenario, the bot gets stuck in a loop and users get frustrated.
When a chatbot gets stuck in a loop, user frustration is not too far away / Credits: progress.com
A casual scroll on Twitter is enough to get a sense of how quickly the average Sri Lankan Uber rider is frustrated by the misplaced efforts of the chatbot.
Disgruntled Uber users are not hard to find in Sri Lanka / Source: Twitter
This is where sophisticated Natural Language Processing
systems come in. Microsoft, Amazon, and Facebook already provide state of the
art Natural Language Processing (NLP) developer tools to help your bot
understand user intents, so whenever you deploy a chatbot, make sure the
chatbot is built to benefit from these powerful NLP engines.
Know What You Will Pay
Nobody likes hefty bills of eye-popping amounts. It pays (in
this case, literally) to understand how your chatbot vendor will charge you for
your chatbot.
Generally, enterprise-level chatbot platforms use one of the
following pricing models:
Subscription:
Build limited or unlimited bots for a flat monthly or annual fee. This is
probably the most suitable model for an enterprise.
Pay per usage:
The platform cost is based on chatbot usage and the number of API calls. This
model can provide you with a higher degree of flexibility allowing you to scale
gradually.
Pay based on performance: The platform cost is based on how the chatbot performs against the goals agreed between the customer and vendor. For example, a successful interaction between the bot and the client, which leads to a signup, is considered as a paid conversation, regardless of the length of the chat. Under this model, enterprises will be charged accordingly to the goals achieved.
Don’t Underestimate Humans
Chatbots may be better and more efficient at a range of things, but they cannot beat a human at one thing: displaying empathy. Therefore, depending on the function of a chatbot, it becomes important to ensure that a human is available to step in and takes over a user interaction if things get out of hand. After all, even the most experienced support agent often requires a second opinion and your chatbot is no different. That is why it is recommended to follow a bot-human hybrid model, which allows a human to take over an interaction depending on the complexity and criticality of the issue.
To understand this issue in detail, take a look at the two screenshots below. In both cases, the triggering keyword is “server failure”. In the first case, the user simply wants information about the precautionary measures in case of a server failure, while in the second case, the user wants to report the occurrence of a server failure.
Same keywords, but different questions entirely. How the chatbot responds is important /Credits: Kommunicate.io
What are your views on chatbots? Who has deployed chatbots
well and who hasn’t? Let us know your thoughts below!
Skype, at one time the favorite Peer-2-Peer (P2P) calling service of a generation raised on MSN Messenger, can be termed the precursor to the myriad social messaging and networking apps we have on our phones today. First released in 2003, Skype eventually went on to upend the international call market. By 2014, Skype accounted for nearly 40% of the international call market. In other words, by 2014, nearly 214 billion minutes of calls were being made through Skype.
What helped Skype morph into the behemoth it became? And what can others learn from their story? Read on to find out.
It’s All About The Team
The success of an early stage startup is very much down to its founding team and the dynamics between them. The founding team behind Skype looked nothing like the typical MacBook-toting, ‘Silicon Valley Startup Guy’ types we’ve come to know and recognise in recent years. Instead, Skype’s founders were..rather ordinary, but a well functioning unit with complementary skills. First there was Niklas Zennström, a Swede who was employee No.23 at Swedish telco Tele2. Then there was Janus Friis, a Dane who worked his way up in customer service for a Danish telecom operator. Programming was the responsibility of Jaan Tallinn, Ahti Heinla, and Priit Kasesalu, Estonian schoolmates who once learned PHP over a weekend in order to win a coding assignment for Tele2 (where Niklas also worked). Rounding out this team was Toivo Annus, who was well versed in project management.
The perfect combination of skills to build a product!
The Skype team from its early days/ Credits: https://heureka-conference.com/
Just Because You Fail, Don’t Throw The Baby Out With The Bathwater
Not many know that Skype was actually born out of the remnants of a previous product– Kazaa, which was built by this founding sextet. A P2P file-sharing platform similar to Napster, but without the requirement for an intermediary server, the founding team envisioned Kazaa to be everything Napster was not. This meant staying on the right side of the law and creating a better, faster backend.
It didn’t take long for Kazaa to succeed. Within a very
short time after its launch in September 2000, Kazaa became the most downloaded
program on the internet, picking up users at the rate of one per second.
Then came trouble.
Like Napster before it, Kazaa also found itself on the wrong
side of the law. But not for lack of trying. Zennström and Friis tried, and
failed, to seal a deal with US film and music companies. Lawsuits started
raining on them, and the team found itself hiding from an army of ferocious US
lawyers. Some of the attempts to haul the Kazaa team in front of the law are so
mind-boggling that they deserve to be included in a Hollywood movie. Take for
instance the time when Zennström went to see a play at a Stockholm theater and
was approached by a stranger. The individual is said to have handed Zennström’s
wife a bunch of flowers and held out an envelope containing a summons for
Zennström. The Swede made a run for it; the summons failed to be duly
delivered. He was similarly pursued in London, this time by a motorcycle, but
Zennström managed to give the messenger the slip.
Having eventually made peace with the film companies and music labels, the Kazaa team looked at a new, but less legally fraught outlet for their new P2P technology. The founders had been smart enough to isolate Kazaa’s intellectual property in a shell company based in the British Virgin Islands. As they toyed with various ideas at a local bar, Annus and Friis had their “eureka!” moment—they could make voice calls cheap and easy by sharing data peer to peer just as Kazaa did. They even talked about creating Wi-Fi phones, an idea that would later be implemented in Skype. In the spring of 2003, an early alpha was coded and shared for testing with about 20 people.
The Skype team preparing to launch Skype 1.0/ Credits: heureka-conference.com
The name of the project originated from the words
“sky” and “peer.” Following the example of Napster and
others, the name was shortened to “Skyper.” But because the domain
Skyper.com was already taken, the ‘r’ was shaved off. “Skype” it was.
Beta Testers Can Be Wrong Too
To a devout follower of the ‘Lean Startup’ methodology,
there is no way forward except through MVPs and beta testing. In principle,
this is not a bad idea at all. But sometimes, the initial feedback you receive
can be worthless. Just ask the Skype team.
When Skype was first released, talking to a computer was
seen as an extremely silly thing to do— as silly as talking to your hand did
when mobile phones first appeared. Feedback on the initial version of Skype was
not exactly enthusiastic. The sound was glitchy, for instance. But when testers
realized that they could now speak via computer to people on the other side of
the world for free, attitudes change. The key however, is to make sure
customers understand your entire value proposition.
Simple Is Beautiful
One of the biggest drivers of Skype’s early success was the simplicity of the app. The team did a fine job of making the technology easy to use, and the friendly, soothing UI didn’t scare away anyone. Careful attention was paid to ensure that unlike other services, Skype slipped easily through firewalls. The program left no footprints on the Internet, the call quality was great, and the service worked like a charm. Right from the beginning, Skype’s product managers were clear in their vision to make sure Skype remained usable to everyone. “Right from the start we set out to write a program simple enough to be installed and used by a soccer mom with no knowledge of firewalls, IP addresses, or other technological terms,” proclaimed one of the early Skype employees, Lauri Tepandi.
Skype shipped with a friendly, easy to use UI /Credits: afterdawn.com
Embrace Constraints
From the time it launched, Skype captured the attention of
investors thanks to its ability to scale fast and ship new features at
astonishing speed, with a small team of around 20 employees. On its first day
of launch, Skype was downloaded by 10,000 people. Within a couple of months, it
already had one million users. Throughout this time, Skype rarely faced a
service outage. The key to this solid performance was Skype’s tech team, who
weren’t in the habit of flinching in the face of adversity. Even though they
lacked many resources, Skype’s tech team was forever confident of their skills
and creativity in deploying code.
Steve Jurvetson, an early investor in Skype remarked “I remember wondering: how can they be so good? How can such a small group can do so much so quickly, compared to typical development efforts in, for example, Microsoft? I had the impression that maybe coming out of a time of Soviet occupation, when computers were underpowered, you had to know how to really program, effectively, and parsimoniously, being very elegant in sculpting the programming code to be tight, effective, and fast. [That’s] not like in Microsoft, which has a very lazy programming environment, where programs are created that have memory leaks and all sorts of problems, that crash all the time and no one really cares—because it’s Microsoft!”
Skype surpasses 10 million users much faster than any service before it /Credits: Steve Jurvetson
Jurvetson was right about the Skype team’s talent. Priit Kasesalu, one of the tech whiz’s in Skype Six (as they are now referred to), is just one example of how talented Skype’s tech team was. A high school friend of Jaan Tallinn, Kasesalu hacked modems as early as the Soviet era at the House of Young Technicians, and is a game fanatic whose home is ‘filled with servers’. According to a famous anecdote often heard in the Skype offices, when Tallinn and others argue about the technological feasibility of some kind of mechanism, Kasesalu usually comes to them and says, “Stop, I’ve figured it out.”
Do Away With The B.S.
Skype’s founding culture, one which did away with the superfluous in favor of practicality and straightforwardness, was another key driver of growth for the company. New ideas were welcomed with open arms, and there were countless instances where ideas were programmed into a product the moment they popped into someone’s mind. Some coders would have an idea in the morning and by the same evening, it might already have 10,000 users.
When the price list was being drafted for Skype Out, a service that would allow users to make Skype calls to telephone networks, the Skype team didn’t bother with market research. After all, they were launching something completely new. There was no precedent, and nowhere to go look for data on how much people would be willing to pay. Instead, two Skype employees devised the list in one night, using nothing but Excel. This may not be the best approach to follow at all times. But the point is that you don’t have to overcomplicate things (and beware of analysis paralysis).
Skype’s ‘No B.S. approach’ (which we at Calcey also love and preach) permeated throughout the company. Every week, five to ten 10 employees joined the company. The screening system was simple and very much the product of Toivo Annus, one of the founders who was in charge of global development. You were hired if you passed the test assignment. Wage negotiations were often redundant—if you deserved to be in the company, you’d be paid what you needed.
Skype’s culture attracted employees from far and wide. Eileen Burbidge, an American, ditched Yahoo and Silicon Valley to come and work for Skype. Burbidge was taken aback by the Skype culture but in a good way. “Having just come from 11 straight years of working in Silicon Valley, I was super impressed and actually amazed that these technical leaders seemed not to have any ego at all, didn’t care about titles, didn’t care about roles or pointing fingers and were all insanely committed to seeing the ‘project which had turned into a company succeed,” said Burbidge. “They had a sense of responsibility and discipline that I had never witnessed before.”
Eileen Burbidge at a TechCrunch Disrupt event in London /Credits: fortune.com
Used to American small talk, Burbidge quickly realized it
would not work in this environment.
“I was used to greeting people with a ‘ping’ or a ‘you there?’ followed by a ‘how are you?,’ ‘having a good day?,’ ‘am I interrupting?,’ or ‘can I ask you a question?’ But for Toivo all of this was superfluous and simply needless cycles. He would just reply with one word: ‘Ask.’” Burbidge told VentureBeat. Of course, Toivo and the rest of the Skype team were not being rude towards Burbidge. It was just that with English being a second language for most employees in Skype’s Tallinn headquarters, many didn’t possess the vocabulary to engage in pointless small talk. According to Burbidge, now a partner at London-based Passion Capital, this was a coincidence that ended up being very good for Skype’s culture.
Thanks in large part to its culture, and scrappy, ‘never say
die’ attitude, Skype’s success paid off handsomely for most of the company’s
initial employees and investors. In 2005, eBay agreed to acquire Skype for USD
2.5 billion in cash and eBay stock. Then in 2009, eBay divested Skype to a
consortium of investors including Silver Lake, Andreessen Horowtiz, and the
Canada Pension Plan Investment Board for US$1.9 billion, valuing Skype at
US$2.75 billion.
Then came the announcement to top them all.
In 2011, Microsoft acquired Skype for USD 8.5 billion…in
CASH. At the time, the deal was perhaps the largest carried out by Microsoft,
and rightfully turned many a head. But how Skype has fared since then is a
story for another day.
Today, Skype may be a shadow of its former self, a company in
decline even. But that’s very much part and parcel of a company’s lifecycle.
However, the lessons startups and founders can learn from Skype’s early days,
will forever remain invaluable.
How to
Not just a ‘one-trick’ pony: How to use .net Core to Monitor App Health
Monitoring app health is of utmost importance in order to ensure that bugs and other vulnerabilities are patched on time. Today, let’s delve into ASP.net Core, a middleware solution that provides support to conduct health checks on an application.
First introduced in ASP.net Core 2.2, the health check feature is exposed via configurable HTTP endpoints. These health checks can then be used to check whether a database is responding, to check whether all dependencies are in order and more.
Getting started To get started, create an ASP.net Core project in Visual Studio 2017. To do so,
Launch the Visual Studio 2017 IDE.
Click on File > New > Project.
Select “ASP.Net Core Web Application (.Net Core)” from the list of the templates displayed.
Specify a name for the project.
Click OK to save the project.
A new window “New .Net Core Web Application…” is shown next.
Select .Net Core as the runtime and ASP.Net Core 2.2 (or later) from the drop-down list at the top.
Select API as the project template.
Ensure that the checkboxes “Enable Docker Support” and “Configure for HTTPS” are unchecked
Ensure that “No Authentication” is selected as it is not necessary.
Click OK.
Register health check services
Next, proceed to call the AddHealthChecks method in the ConfigureServices method of the Startup class. The health check middleware can be added by calling the UseHealthChecks as shown in the code snippet below.
public void ConfigureServices(IServiceCollection services)
{
services.AddHealthChecks();
}
public void Configure(IApplicationBuilder app, IHostingEnvironment env)
{
app.UseHealthChecks("/health");
app.UseStaticFiles();
app.UseCookiePolicy();
app.UseMvc();
}
Do note that under this method, both the ConfigureServices and Configure methods are called by the runtime.
Built-in vs. custom health checks
Now we come to a fork in the road. ASP.net provides us the ability to either use the built-in health check or to deploy custom health checks.
The built-in health check allows you to take advantage of the Entity Framework Core DbContext health check to report if the Entity Framework Core DbContext is able to connect to a given database. To do this, add the Microsoft.Extensions.Diagnostics.HealthChecks.EntityFrameworkCore NuGet packages and configures health checks in the ConfigureServices method as shown below.
Do remember that you always have the option of using other health check packages available on NuGet. These include SQL Server, MySQL, MongoDB, Redis, RabbitMQ, Elasticsearch, Hangfire, Kafka, Oracle, Azure Storage, and more. These community packages are available in the AspNetCore.Diagnostics.HealthChecks repository on GitHub.
This doesn’t work for me. I want to go custom.
Assume you want to verify if the application is unable to connect to a database or an external service. If you decide to create a custom health check, extend the IHealthCheck interface and implement the CheckHealthAsync method.
public class MyCustomHealthCheck : IHealthCheck
{
public Task<HealthCheckResult>
CheckHealthAsync(HealthCheckContext context,
CancellationToken cancellationToken =
default(CancellationToken))
{
throw new System.NotImplementedException();
}
}
Note how the HealthCheckResult struct has been used here.
public async Task<HealthCheckResult>
CheckHealthAsync(HealthCheckContext context,
CancellationToken cancellationToken =
default(CancellationToken))
{
if (IsDBOnline())
{
return HealthCheckResult.Healthy();
}
return HealthCheckResult.Unhealthy();
}
The IsDBOnline method can be used to check if the database is working as intended.
private bool IsDBOnline()
{
string connectionString =
"some connection string to connect to the database";
try
{
using (SqlConnection connection = new
SqlConnection(connectionString))
{
if (connection.State !=
System.Data.ConnectionState.Open)
connection.Open();
}
return true;
}
catch (System.Exception)
{
return false;
}
}
The HealthCheckResult object shown in the code above allows us to pass description, exception, and status data represented as a dictionary of key-value pairs. This information can then be presented on a health check web page. After building your custom health check, remember to configure the custom health check type appropriately in the ConfigureServices and Configure methods of the Startup class to start leveraging it.
Visualize your health check
If you wish to view the results of your health check in a more visually appealing format, you can use an open-source visualization tool named HealthChecksUI. To use this tool, install it from NuGet by using the following command at the package manager console window.
Install-Package AspNetCore.HealthChecks.UI
Once the installation is complete, configure the package in the ConfigureServices and Configure methods of the Startup class.
public void ConfigureServices(IServiceCollection services)
{
services.AddHealthChecksUI();
}
public void Configure(IApplicationBuilder app, IHostingEnvironment env)
{
app.UseHealthChecks("/health", new HealthCheckOptions
{
Predicate = _ => true,
ResponseWriter =
UIResponseWriter.WriteHealthCheckUIResponse
});
app.UseHealthChecksUI();
}
Finish things off by adding the following configuration in the appsettings.json file to let HealthChecksUI know where to fetch the health check information from.
How one man learned to build things that matter, the hard way.
Alex Tew’s name may not ring a bell to Gen-Zers today, but for Millennials and the generations before them, Tew’s story is the stuff movies are made of. Venture capital-funded growth and stock exchange listings didn’t mean anything to Tew. He just wanted to make money, quick, and that’s exactly what he did. At 21, Tew was a millionaire. And it took him only 4 months to get there!
Meet Alex Tew /Credit: Coach.me
Then he became depressed.
Then he made it big, again.
How?
And what lessons can we learn from Tew’s story?
Striking Gold and Post-success Depression
One late night in August 2005, Tew was in his room, wondering how he was going to pay off his student loans. At the time, he had just enrolled in business school at the University of Nottingham. Tew decided to brainstorm cheap things he could sell a million of. He managed to come up with a few ideas, including one for a questionable product called the ‘Gum Slinger’, which was basically a small pouch for used chewing gum.
Then he struck gold: Tew decided to start a web page with a million pixels that could be purchased for $1 apiece.
Today, this idea would have been laughable. But remember, this was 2005, and the internet as we know it today was still in its infancy. MSN Messenger ruled supreme, and internet advertising was a virtual mirror of the Wild West.
Tew’s concept was extremely simple. For a minimum of $100, an advertiser could buy a 100-pixel block (10 x 10 grid) and display an image or logo of their choosing, with a hyperlink. The only guideline was that it couldn’t be porn.
Tew managed to successfully sell 4.7k pixels to friends and family, and he used the money to hire a PR agency to draft a press release. The release was picked up by the BBC and The Guardian, and advertisers started buying up pixels on his site.
The evolution of milliondollarhomepage.com
One month in, Tew had raked in $250k and was receiving 65k hits per day. By the end of October, he’d made $500k from more than 1.4k advertisers. Come New Year’s Eve, 999k pixels had been purchased. Tew auctioned off the last 1k on eBay; MillionDollarWeightLoss.com bid $38k, bringing his grand total to $1.04m
After paying the tax man his fair share, Tew was left with nearly $700k to his name. He promptly dropped out of college and moved to London. Over the next four years, Tew tried to replicate his initial success by launching various different ventures. But it was all in vain.
Lesson 1: Provide Value, Don’t Demand Attention
Success can be like a treadmill. Once you achieve a certain amount of it, there comes an insatiable hunger for more. This can trick people into focusing their energies on creating things whose success entirely depends on virality or fame. Instead, Tew argues that you must focus on building things that actually enhance someone’s quality of life i.e. provide value. “Success can actually be bad and can teach you the wrong things. I was thinking about ideas that would get attention instead of providing value” says Tew.
Unable to replicate the success he had with the Million Dollar Homepage, Tew moved to San Francisco and joined a friend’s startup incubator.
Lesson 2: Look To Your Own Problems To Find Your Next Idea
The four years he spent looking for his next big idea (2006-2010) took a toll on Tew. He didn’t eat or sleep well, and his mental health took a toll. Till then a lifelong meditator, Tew found himself slowly drifting away from his daily practice. Tew realised that he had to initiate some corrective action..so he built another website. The result was donothingfor2minutes.com, a simple website with a 2-minute timer that would restart if you moved your cursor. It was Tew’s way of forcing himself to meditate.
The timing was perfect. The rise of the internet and the proliferation of smartphones had brought with it loads of ‘mental clutter’ and people were starting to talk about digital detoxes. Questions were being asked about the long-term impact of social media on one’s mental health, and the practice of mindfulness was having its moment.
According to Google Trends, search interest in mindfulness has continued to grow
Lesson 3: Take Your Time To Build
Alex was in no hurry. He built donothingfor2minutes.com in 2010. He took the next two years to figure out what he was going to do with it. In 2012, he finalised his plan to build a more robust meditation app.
Finding the seed money wasn’t easy and Tew was laughed out of many meetings. “When you talk about meditation with people who don’t meditate, and who work in tech, it’s so far outside of their world of focus,” he says.
Tew eventually managed to put together $1.5 million and launched Calm, the meditation app.
It didn’t take long for the Calm app to become popular Credit: Calm App
Lesson 4: Be Clear About How You Are Going To Monetize
From the outset, Tew was very clear about what his value proposition was going to be, and how he was going to monetize his app. To this day, the app’s flagship feature– a 10-minute guided meditation– remains free. Calm makes money by selling premium access to things like ‘Sleep Stories’ (which are basically bedtime stories for adults), and masterclasses on wellness topics.
Calm, Today
Calm’s annual revenue growth is almost a perfect ‘hockey stick
Today, Calm is valued at more than $1 billion and counts the likes of TPG and Ashton Kutcher among its investors. The app is locked in a two-way battle for domination with competitor Headspace and was named Apple’s App of the Year in 2017. According to App Annie, an app market data firm, Calm is the top-grossing health and fitness app and 20th overall on iOS, while Headspace, its main competitor, is the seventh-highest-grossing health and fitness app and 103rd overall on iOS. With more than 40 million downloads and more than 1 million paying customers, Calm’s success has been nothing short of extraordinary.
And behind much of this success is one man: Alex Tew (and his life lessons).
Some time ago, we wrote a blog post on what Reactive programming is. As a technique, reactive programming has become so popular that more than 40 languages, including Java, have evolved to support reactive programming techniques. Reactive programming powers the codebases of some of the world’s largest online platforms such as Netflix, AirBnB, and Crunchbase. So clearly, it’s a technique worth familiarising yourself with.
One of the key principles underpinning Reactive programming is the use of asynchronous data streams. But what is an asynchronous data stream? Simply put, an asynchronous data stream is a stream of data where values are emitted, one after another, with a delay between them. The word asynchronous means that the data emitted can appear anywhere in time, after one second or even after two minutes, for example.
With Reactive programming, data streams will become the spine of your application. Events, messages, calls, and even failures will be conveyed by a data stream. In a reactive programming environment, these streams will be observed and reacted to, when a value is emitted.
What are the key benefits of using Reactive techniques in your codebase?
Functional Reactive programming will allow you to avoid intricate stateful programs. Instead, you will be able to make use of clean input/output functions over observable streams
Asynchronous Traditional try/catch methods cannot handle errors in asynchronous computations, but ReactiveX is equipped with better mechanisms to handle errors.
Less is more Reactive programming provides developers with operators and transformation elements, which can be used to convert boilerplate into fewer lines of code.
Concurrency Reactive programming also provides new schedules and observers to handle threading and queues.
Getting Started
RxSwift is one of the best ways to deploy reactive code in your application, especially if you develop for iOS. Essentially, it is Swift’s own version of ReactiveX (or Rx). The more technically inclined amongst us would think of RxSwift as a library to compose asynchronous and event-based code using observable sequences and functional style operators, which allows for parameterized execution through schedulers.
RxSwift can be installed through CocoaPods just like any other pod library. A typical Podfile would look something like this:
# Podfile
use_frameworks!
target 'YOUR_TARGET_NAME' do
pod 'RxSwift', '~> 4.0'
pod 'RxCocoa', '~> 4.0'
End
Next, run podfile to install the RxSwift library to your project.
$ pod install
Understanding the RxSwift Landscape
There are a few key elements in the RxSwift universe which you must keep in mind at all times.
Observable Sequences, Observables and Observers
Everything in RxSwift is an observable sequence, or something that operates on or subscribes to events emitted by an observable sequence. Observable sequences which will emit data continuously for one or more instances are simply called ‘Observables’.
Observers on the other hand, can subscribe to these observable sequences to receive asynchronous notifications as new data is gathered to perform operations. Observable sequences can emit zero or more events over their lifetimes.
In RxSwift an Event is just an Enumeration Type with 3 possible states:
.next(value: T) When a value or collection of values is added to an observable sequence it will send the next event to its subscribers. The associated value will contain the actual value from the sequence.
.error(error: Error) If an Error is encountered, a sequence will emit an error event. This will also terminate the sequence.
.completed If a sequence ends normally it sends a completed event to its subscribers.
Subjects
Subjects are a special form of observable sequences, to which you can subscribe and dynamically add elements. Currently, RxSwift has four different kinds of subjects.
PublishSubject: If subscribed to, you will be notified of all the events that happen after you subscribed.
BehaviourSubject: A behavior subject will give any subscriber the most recent element and everything that is emitted by that sequence after subscription.
ReplaySubject: If you want to replay more than the most recent element to new subscriber on the initial subscription, you need to use a ReplaySubject. With a ReplaySubject, you can define how many recent items you want to emit to new subscribers.
Variable: A variable is nothing but a BehaviourSubject wrapper which feels more natural to non-reactive programmers. It can be used just like a normal variable.
Operators
Operators are used to filter, transform or combine data sequences before sending them to subscribers. RxSwift provides what is known as a ‘Marble Diagram’ to help select the operators you need. A Marble Diagram visualizes the transformation of an observable sequence. It consists of the input stream on top, the output stream at the bottom and the actual transformation function in the middle.
Schedulers
Schedulers are used to create thread safe operations. Generally, operators will work on the same thread where the subscription was created. With the use of a scheduler, operators can be forced to work on a specific queue.
RxSwift has five types of schedulers:
MainScheduler This scheduler abstracts work that needs to be performed on MainThread. In case schedule methods are called from the main thread, it will perform the action immediately without scheduling. This scheduler is usually used to perform UI-related work.
CurrentThreadScheduler This scheduler schedules units of work on the current thread. This is the default scheduler for operators which generate elements.
SerialDispatchQueueScheduler — This scheduler abstracts work that needs to be performed on a specific dispatch_queue_t. It will make sure that even if a concurrent dispatch queue is passed, it is transformed into a serial dispatch instead. Serial schedulers enable certain optimizations for observeOn.The main scheduler is an instance of the SerialDispatchQueueScheduler at work.
ConcurrentDispatchQueueScheduler — This scheduler abstracts work that needs to be performed on a specific dispatch_queue_t. You can also pass a serial dispatch queue, and it should not cause any problems. This scheduler can be used when some work needs to be performed in the background of the application.
OperationQueueScheduler — This scheduler abstracts work that needs to be performed on a specific NSOperationQueue. This scheduler is suitable for instances where there is some bigger chunk of work that needs to be performed in the background and you want to fine tune concurrent processing using the maxConcurrentOperationCount. function.
And that’s about it. You have now successfully learned the basics of RxSwift. Feel free to give RxSwift a try yourself by clicking on https://github.com/ameera/LoginWithRxSwift
In a world where data was touted as the ‘new oil’, it was only a matter of time before the debate between privacy and data sharing reached a new crescendo. Starting with Cambridge Analytica, scandal after scandal has kept alive the ever-evolving debate around how our personal data is collected and used.
In short… don’t be Dogbert Credit: Scott Adams/Dilbert
To begin with, sharing data does have its merits. For instance:
Medical researchers need access to confidential patient data to use in their studies of diseases to identify cures.
Retail chains need consumer data to identify markets that can support new stores while meeting demand.
Municipalities need to share data to improve transit systems and public safety.
Makers of intelligent connected cars need to enable vehicle data exchange and the monetization of vehicle data while protecting data privacy.
However, when companies and app developers start using this vast pool of data at their disposal to create new revenue streams by essentially commoditizing the user, there arises a question about the ethics of such practices. For instance, The Verge has revealed that while struggling to generate revenues post-IPO, Facebook considered selling access to user data in order to make money. Last year, Buzzfeed News revealed that out of nearly 160,000 free Android apps available on the Google Play Store, nearly 55% tried to extract and share the users location with third parties, while 30% accessed the device’s contact list.
In light of all this, it is only natural for users to start worrying about the privacy of their data, prompting governments to crack down hard on firms and developers who misuse personal data. But, as developers, how do we ensure that the data we collect is used for the common good, and not for any nefarious purposes (even by accident)? Where do we draw the line when it comes to data collection practices?
Here is a list of best practices (and common sense) which we advise our clients to follow
Have a privacy policy
Before you try to collect any data at all, it is important to think really hard about why you want to collect customer data, how you want to use it, and whether or not you will be sharing this data with external parties. Once these basics have been figured out, build upon them to formulate a data collection and privacy policy for your company, product, or app. Use simple, clear language (because nobody understands legalese), but run it past your lawyer to make sure that everything is okay. Finally, make the policy available and easily accessible on your website and app.
Be transparent
While the law may shape how you disclose your policies and handle your data, being transparent with your users about how their data is collected, used, and shared is a very good idea. After all, being transparent builds trust. Providing users with the power to control the data they share with you is also a giant leap forward. For instance, if you’re developing an app, consider providing users the ability to view, limit, or delete the data they have shared with you. This will ensure that whatever data you have with you, has been collected entirely with the consent of your users.
Designing self-service pages where users can control their data can be a huge step forward for user privacy and consensual collection. Users can understand the data they’ve explicitly provided, the data you’ve gathered in the background based on their usage, and the ongoing ways that data is currently entering your systems. This encourages users to take an active and considered approach to their own privacy and allows users to refuse specific types of collection with an understanding of how that may affect their access.
When given a choice between collecting and correlating data in the background and asking for it explicitly from users, it is usually best to tend towards the latter. While your privacy policy may outline various ways that you may gather data, asking directly will minimize surprises and help build trust. Users may be willing to provide more information when they feel like they control the interaction rather than when it is collected by monitoring behavior, which can feel intrusive.
If you’re domiciled in a locality where GDPR applies, then it goes without saying that almost all of the above are requirements that you must comply with. GDPR is essentially a legal framework which governs how firms can collect and handle user data, while providing greater protection and rights to individuals. The costs of non-compliance with GDPR can be quite high. Smaller offences could result in fines of up to EUR 10 million or two per cent of a firm’s global turnover (whichever is greater). Those with more serious consequences can have fines of up to EUR 20 million or four per cent of a firm’s global turnover (whichever is greater). For more information, see what The Guardian has to say.
Build strong safeguards
If you are collecting user data, a data breach can be your worst nightmare. Not only would it be a public-relations disaster, but in a worst-case scenario, it could spell the end of your company or startup. Data breaches lead to people’s identities being stolen, credit cards being opened in their name without them knowing it, and even fraudulent tax returns being filed. If you’re going to collect all this personal data, it’s your responsibility to safeguard the data you collect.
To that end, we recommend that you:
Back up your data in case your systems crash
Ensure there is no personally identifiable information within your database (make sure it’s all encrypted or anonymized)
Have malware, antivirus software, and firewalls that protect from data breaches (and make sure it’s all up to date)
Have an emergency plan in the event of a data breach
Minimise permissions
When you ask users permission to access certain data or services on their phones, ensure that you are only asking for permissions that are appropriate, and not excessively intrusive. For example, if your app is a simple tic tac toe game, it doesn’t make sense to ask the user for permission to access the camera on their device.
Don’t use code you don’t understand
Developers usually work with a lot of open-source software when building apps, and it is a very common (and good) practice to rely on other people’s code snippets, be it in the form of frameworks or libraries, where relevant. Platforms such as GitHub are a treasure trove of top-notch code snippets, which can often cut development time by a significant amount. But if that code is handling your users’ information inappropriately, it’s your problem. So make a point of checking code before you rely on it.
What are your thoughts on the data privacy vs. data sharing debate? Let us know in the comments below!
At Calcey, we recently found ourselves having to deal with linking a legacy system with a new information system on behalf of a client. In order to avoid complications, we explored the possibility of deploying Kafka within a docker container.
What is Kafka?
Kafka is an open-source, fault-tolerant event streaming platform. Kafka can help bridge the information gap between legacy systems and newer systems. Imagine a situation where you have a newer, better system that needs data from an older, legacy system. Kafka can fetch this data on behalf of the developer without the need to build an actual connection between the two systems.
Kafka, therefore, will behave as an intermediary layer between the two systems.
In order to speed things up, we recommend using a ‘Docker container’ to deploy Kafka. For the uninitiated, a ‘Docker container’ is a lightweight, standalone, executable packages of software that include everything needed to run an application: code, runtime, system tools, system libraries, and settings.
To deploy Kafka, three pieces of the puzzle need to fall in place: the ZooKeeper server, Kafka server, and a connector to the data source. In addition, we will be making use of SQL server’s Change Data Capture (CDC) feature to feed data into Kafka. CDC records any insertion, updating, and deletion activity that is applied to a SQL Server table. This makes the details of the changes available in an easily consumed relational format. But that’s a topic for another day.
The easiest way to set all this up is to use Debezium. We recommend using the Debezium image which can be downloaded from https://debezium.io/docs/tutorial/. This image will allow you to configure ZooKeeper, Kafka and the Connector in one go.
With both ZooKeeper and Kafka now set up, all you have to do is tell Kafka where your data is located. To do so, you can connect Kafka to a data source by means of a ‘connector’. While there is a wide range of connectors available to choose from, we opted to use the SQLServer connector image created by Debezium. Once a connection is established with the data source, pointing the connector back to the Kafka server will ensure that all changes are persisted with.
And that’s all there is to deploying Kafka in a Docker Container!