Solution for missing battery icon on Surface Book running Windows 10

Recently I got a Surface Book 2. From the beginning, my battery icon was missing, and I spent hours researching how to fix it. I didn’t even have battery show up in device manager.

To save you hours, here is the solution:

  1. Go to device manager
  2. View -> show hidden devices
    Missing battery icon on Surface Book
  3. Uninstall Surface Serial Hub Driver:
    Missing Battery Icon on Surface Book - uninstall Surface Serial Hub Driver
  4. uninstall all other devices that have warnings*
  5. reboot and wait a few minutes for missing drivers to get reinstalled

(*) – I am not 100% sure step 4 is required, but it won’t hurt and it may help.

After that you should get your battery status back:

Surface Book - battery status

It should also be visible in device manager now:

Surface Book device manager - battery status

 


Domain-Driven Design – tl;dr

Domain Driven Design

After hearing about Aggregates and Bounded Contexts over, and over again, I decided to check out what Domain-Driven Design is all about. There is a ton of DDD resources on the Internet, but this blog post is for my personal reference. I am publishing it so I can google it, and maybe you find it useful as well. This post is about what DDD is, and how it can help you to write better code.

What is DDD?

According to Wikipedia:

Domain-driven design (DDD) is an approach to software development for complex needs by connecting the implementation to an evolving model. The premise of domain-driven design is the following:

  1. placing the project’s primary focus on the core domain and domain logic;
  2. basing complex designs on a model of the domain;
  3. initiating a creative collaboration between technical and domain experts to iteratively refine a conceptual model that addresses particular domain problems.

More pragmatic (and ignorant) definition: DDD is software development approach that focus on business processes over implementation details. This allows developers to work with business people more effectively. It also makes code more maintainable and extendable.

Most important DDD terms (buzzwords):

  • Ubiquitous Language – using business terms for naming classes, methods and variables
  • Domain – functionality of the system
  • Bounded Context – components used to deliver a functionality (AKA domains)
  • Value Object – simple, immutable class representing some business term
  • Entity – class with unique identifier, usually used to represent persistent data
  • Aggregate – group of entities
  • Repository – class used to save and retrieve aggregate (AKA save/retrieve data to/from database)
  • Application Service – your Domain(s) communication layer
  • Anti-corruption layer – layer for interaction with external (or legacy) system
  • CQRS (Command Query Responsibility Segregation) – separates querying for data from modifying data
  • Event Sourcing – storing changes to application state as a list of events, which allows to invoke and process events in producer/consumer fashion

Resources to learn about Domain-Driven Design

There are two DDD bibles: Blue Book and Red Book. I’ve been told to do not read Blue Book as first introduction to DDD, because it’s very “heavy” and hard to understand. People were right. I would also add: it’s not very well written (shoot me for criticizing DDD God AKA Eric Evans).

List of recommended resources, sorted in order that I would recommend to follow if you are new to DDD. I strongly recommend positions in bold!

Notice that I placed Blue Book at the end. It’s hard to absorb. It also suffers from low knowledge/pages ratio.

There is also Domain-Driven Design path on Pluralsight that has nice set of courses around DDD and software design.

My thoughts on DDD

Before diving into DDD I was expecting to learn about something new and revolutionary. After reading about Ubiquitous Language, Aggregates and Bounded Context I still didn’t see much difference between DDD and good, SOLID software design. It feels like DDD is mostly about good object-oriented design presented in particular, formalized way with specific buzzwords (aggregate, bounded context, etc.). In Uncle Bob’s Agile Principles, Patterns, and Practices in C#, there is the Payroll Case Study example that is following clean code, good design and implementation practices. If you were put that example into DDD book…it would fit. If you take examples from DDD books and put it into Uncle Bob’s book…it would fit fine as well.

There are however, some new concepts introduced by DDD. Such as Repository pattern, CQRS or Event Sourcing. Are last two actually DDD? Or they are just related to DDD?

DDD is also enforcing designing system around business domain, not around, e.g. database. That is usually a case when designing architecture from scratch quickly. As 99% of apps are CRUDs, ending up with database driven architectures would be natural. You usually start with file->new project, and go from there. This is not a problem for small apps, but might strike later when evolving the app. DDD solves that problem.

If you are familiar with Clean Code and SOLID design as presented in Agile Principles, Patterns, and Practices in C# then DDD does not bring much new concepts to the table. It may make you think more from a business perspective, and consider using new patterns (Repository pattern, CQRS or Event Sourcing) though.

It’s worth to notice that even if you look at Domain-Driven Design path on Pluralsight, there are non-DDD courses about good/clean design as part of the path. Thus, good design is prerequisite of DDD. On top of that we have mentioned earlier buzzwords, CQRS and Event Sourcing.

Going back to DDD terms (AKA buzzwords), they could be also summarized as follows:

  • Ubiquitous Language – use meaningful names for classes, methods and variables
  • Domain – be aware what problem you are solving
  • Bounded Context – group objects that depends on each other
  • Value Object – simple, immutable class
  • Entity – class with unique identifier, usually used to represent persistent data
  • Aggregate – group of related entities
  • Repository – facade over your persistence layer to make it implementation agnostic
  • Application Service – your system’s API
  • Anti-corruption layer – layer for interaction with external system
  • CQRS (Command Query Responsibility Segregation) – separates querying for data and modifying data
  • Event Sourcing – storing changes to application state as a list of events, which allows to invoke and process events in producer/consumer fashion

What DDD enforces from the beginning is layered architecture that may not always be needed. Should you follow DDD in your projects? The answer is, as always, “it depends”. There are some good ideas there, but being over obsessed with favoring DDD in your design decisions over pragmatism will lead to over-engineering.

After TDD and BDD there is DDD. Should you use DDD in all your projects? No. It’s just a way to design software. Also: using DDD does not mean that you need to use all patterns from Blue Book and Red Book.

It seems like DDD should definitely help in long term, but over-engineering (with CQRS and Event Sourcing) may unnecessary complicate things. Actually, I should say: writing SOLID code would help you…and here we are again: is DDD really something different than just good software design?


Building Cloud Search as a Service with AI

AI Search

It’s been almost a year since I joined Azure Search team. A lot has changed since then. I joined right after team doubled by merge with Text Analytics team with a mission to add intelligence to search. A few months later entire Cognitive Services (Azure Machine Learning APIs) platform team joined us. Then we hired additional developers to build scalable platform for both Cognitive Services and Azure Search. After that we also got a team of data scientists who are building the actual machine learning models. Now, as the Applied AI team, we are in the center of AI and Cloud at Microsoft.

Azure Search is a search-as-a-service cloud solution that gives developers APIs and tools for adding a rich search experience in web and mobile applications. You get for free things like autocomplete, suggestions, synonyms, results highlighting, facets, filters, sorting and paging. Functionality is exposed through REST API or .NET SDK. The biggest pain, which is infrastructure and availability are managed by us.

While having all of that, we also need a great developer experience. Everybody needs to be able to understand how to build that Search AI pipeline without spending hours on reading docs. This is another thing we are working on. Email me or tweet message me if you are interested in that kind of stuff.

Where are we going?

Cognitive Search

We want to build the best Search as a Service platform that enables developers to add Bing-like Google-like search experience to their websites. No need for hiring search experts who know what inverted index is. No challenges with shard allocation and how to implement master election properly. No need for distributed systems expertise to scale this for large amount of data. Last, but not least: no need for setting up, owning and managing the infrastructure. Everything is being taken care of by the platform. By the Cloud.

Our team is also working on market-leading Machine Learning APIs. We are going to utilize these ML models and enable you to search through not only text, but also through your images, audio and videos.

There is a lot of challenges in that journey. From processing large amounts of data, through doing it in reasonable time (performance/parallelization), to providing efficient user experience throughout the process.

Where are we now?

We already have fast, reliable and production-ready system for full-text search. You can provision it in no-time, scale by adding more replicas or partitions, and monitor using metrics we provide. You can query it with .NET SDK or using REST API. We even have Open Source UI generation tool that gets you started with the latter: AzSearch.js.

To learn more about current capabilities of Azure Search check this awesome presentation by Bryan Soltis:

There are two ways to populate your search index: by simply inserting documents (records) into it, or by using indexer – a mechanism that enables you to sync your search index with your data source (SQL or NoSQL Database, blob storage, etc.).

We have already started adding AI to our search pipeline, by enabling you to run text analytics and OCR on your data. If you are using indexer, you can create a skillset, which can detect people, entities, organizations, locations, key phrases, and language on the textual data. On top of that you can use OCR that can recognize text from your images, and enable you to search through that text. You can also run mentioned text analytics on recognized text. We call this approach Cognitive Search. Here is a quick video by Brian and Corom from our team, with a sneak peak of what’s possible:

Last year we created a prototype of Cognitive Search, using JFK files that went public. You can check out our JFK files website, github repo and below video from Connect(); conference in 2017, where Corom explaines how he built a pipeline to achieve what is possible now with just checking the checkbox:

We announced Cognitive Search at the //build conference earlier this year. Together with NBA we built a website that allows you to search through player’s photos. You can search for players, their shoes or correlations between them:

Similar approach can be used for variety of different scenarios. From filtering your family photos, through analyzing medical records data, to deciding which crypto-currency to buy. Now, all these PDFs and doc documents you have on your hard drive can be used to make an informed business decision.

There are a lot of companies using Azure Search in production. It’s super exciting for me that Real Madrid is using Azure Search. It’s my favorite football club since I was a kid.

How’s the team?

My favorite thing about our team are the people. Every single person is bringing something else to the table, and there is something you can learn from each one of them. From distributed systems expertise, through API design, to building efficient monitoring infrastructure that enables to maintain production cloud service. One of our team members is Henrik Frystyk Nielsen who is best known for his pioneering work on the World Wide Web and subsequent work on computer network protocols. Currently he works on encapsulating Machine Learning models into containers. Our manager, Pablo Castro started not only Azure Search, but also OData protocol and LINQ to Entities. Our Project Manager Lance Olson was one of the founders of the .NET! You can check out what people say about our team on blind! Search for “Azure Search” 😉 There is also a blog post written by Pablo a few years ago: Startup at Microsoft. A lot has changed since then. We went through a few rounds of “funding”, and our team grew. However, we still believe in core values expressed there. For example: every engineer from the team still talks to customers on daily basis either through social media or directly over email or Skype.

BTW: We are hiring!


Seeing AI Photo Gallery

Microsoft Seeing AI

Seeing AI is a mobile app that narrates the world around you. It enables people with low vision to recognize faces, objects, text, bills, colors, and much more! Seeing AI was first announced at //build conference in 2016.

Over last few months I was working with Seeing AI team overnight on in-app Photo Gallery that allows you not to browse through photos that you have taken earlier. Before you could only take photo, analyze it, and save (without description). Now, you can save it with description that you can later retrieve. You can also analyze photos taken with your phone camera.

One of the challenges was to decide what details about the photo should we present. We have a lot of different channels (short text, document, person, scene, etc.). For now we decided to show scene description, place and date when photo was taken. Let us know if you have suggestions to improve this!

SeeingAI - photo gallery

Another problematic part was deciding how to distinguish between analyzed, and not analyzed photos. Initially we had a toggle to switch between recognized photos and all photos. Ultimately we decided to have only 1 view with all photos. Thoughts?

For non recognized photos we needed to provide mechanism to analyze them. Initially user had to open photo, and explicitly tap ‘analyze’. We changed this approach to automatically analyze not recognized photos when going to full screen view, and enable users to reanalyze them. The ‘reanalyze’ button might be useful in situations where we update app with new AI models. These models may do better job in recognizing photos.

Seeing AI is built with Xamarin iOS native. I was surprised that we had to build entire gallery from scratch. There was no plugin or open source sample we could use. Hint: opportunity for you!

You can download Seeing AI from App Store.


QCon conferences – real experts experience exchange

QCon Beijing - speakers

Earlier this year I attended QCon Beijing and QCon Sao Paulo conferences. I really like QCon, because there is no marketing, just real experts exchange of experience. After my first QCon (Shanghai in 2016) I was very excited to come back this year!

QCon Beijing

Cognitive Search

I delivered talk about Building web apps with Cloud and AI. I showed how to build intelligent web apps with Azure Search and Cognitive Services (Azure Machine Learning APIs). We call this approach Cognitive Search. In my demo I showcased how you can determine which crypto currencies to buy using sentiment analysis on tweets. I streamed tweets to Event Hub, which triggers Azure Function that calls Text Analytics API to calculate sentiment of tweet. I store tweets and its sentiments in SQL Database. I also created Azure Search index to be able to effectively search through tweets. This index is being syncronized with SQL DB through integrated change tracking, and Azure Search indexer that runs on schedule.

Cognitive Search architecture

I built UI using AzSearch.js (UI generation tool for Azure Search indexes), ASP.NET Core and TypeScript (BTW: there is a lot of cool stuff in TypeScript these days!).

Crypto Search UI

In addition to search interface I also created aggregation chart comparing sentiments between different cryptos:

crypto charts

Source code is on github: crypto-search.

Video from my talk:

My talk was very well received. Attendees were assessing talks with green (great talk), yellow (ok talk) and red (bad talk) cards. I got 117 green, 9 yellows and 0 reds.

Conference

I had a great opportunity to meet a lot of engineers and architects from leading tech companies from around the World.

Mads Torgersen (the architect of C# language) shared future plans for C#. It was surprising for me how few people attended his talk. Sisie Xia and Chris Coleman from LinkedIn delivered a great talk about facing challenge of growth, and how they tackle it using their in-house tool Redliner. Julius Volz shared insights about Prometheus monitoring system.

Majority of talks were in Chinese. I went to Peng Xing‘s talk about how they develop Progressive Web Apps at Baidu. I was able to gather 60% of content, but got the essence by talking to him directly. I spent most of my time talking to people in the hallways. It was very eye opening to meet engineers from Chinese cloud giants. China cloud market is dominated by Alibaba Cloud (AliCloud), Baidu and Tencent. Azure and AWS have small market share. Google does not exists in China at all. Alibaba (largest online retailer in China) has even ambitions to overtake AWS in near future. It is worth to notice that Alibaba is Chinese equivalent of Amazon. At the same time people consider Baidu being Chinese Google, and Tencent (who owns WeChat) to be like Facebook. I had an opportunity to chat with Lu from Alibaba Cloud and Wang Yao (Head of IaaS at Baidu). After talking to them, and other engineers I would describe both companies’ stack in 3 Words: MacBook, Java and Go. This might be ignorant generalization, but almost every other engineer from big 3 (AliCloud, Baidu, Tencent) that I talked to was either writing code in Java or golang (using Mac of course). I also learned about Alibaba’s Search as a Service: OpenSearch. Something to keep eye on when they will be expanding to USA and Europe market.

The most popular track was of course Blockchain. Room was overflowed for the entire day:

QCon Beijing - blockchain track

China Tech

Every time when I visit China I am impressed by their progress. Highways superior to US interstates, fast trains between all major cities, and now – mobile payments adoption everywhere. Today, in China, most people use WeChat or AliPay. Sometimes cashier can get mad at you if you want to pay cash or credit card, because you cause inconvenience. Scanning QR code is 10x faster! You can even tip a waiter with your mobile phone!

Tipping in China

Last year in Seattle we had three bike-sharing companies, and everybody here thinks that we are at the edge of innovation. By the end of 2017 Beijing had 60 bike-sharing companies. Many of them started in 2016. During my visit I learned that China have engineers dominated government. Maybe this explains their progress?

If you are going to China, it is useful to have these 3 apps:
1. WeChat – Chinese facebook, for communication with other Chinese people, and exchanging contacts
2. DiDi – Chinese Uber
3. AliPay – for mobile payments (currently WeChat payments requires Chinese ID and account in Chinese Bank)

It was also great to meet China division of Cognitive Services team!

Cognitive Services - China team

Trip to China inspired me to read a book comparing Chinese and Western culture in the World of innovation and progress:

From the Great Wall to Wall Street

There is a lot of things that these two Worlds can learn from each other.

QCon Sao Paulo

Cognitive Search

Two days before my talk in Brazil, we officially announced Cognitive Search built in into Azure Search. You do not have to create Cognitive Service anymore. You do not have to write code that orchestrate processing data, and calling API. We do it for you. All what you have to do is to check the checkbox. More details here.

Cognitive Search

I extended my demo of crypto analysis based on tweets by adding sentiment analysis on news articles. A while ago we put news on Azure Search index. We filtered out news related to cryptos, and put it on Azure Blob storage. We also improved our JFK files demo, and now you can deploy it by yourself by following instructions in this github repo.

Video from my talk:

Usually during my talk I ask if somebody ever deployed ElasticSearch and how long did it take. In China one guy said it was ~2 weeks. In Brazil there was one guy who said: 6 months(!) 🙂 That’s why you don’t want this to be your problem. Azure Search takes care of deployment, availability and upgrades for you.

My talk was pretty well received in Brazil as well. I got 148 green, 15 yellow and 0 red cards.

Conference

QCon Sao Paulo had very diverse mix of experts from all around the World. Starting with Aaron Stannard (co-founder of AKKA.NET), Nicholas Matsakis (from Rust core team), and Rodrigo Kumpera (architect and top contributor of mono project), through Michelle Casbon (now Engineer in Google Cloud Platform focused on machine learning and big data tools), Ben Lesh (RxJS Lead at Google), and Martin Spier (performance engineer at Netflix) to Soups Ranjan (Director of Data Science at Coinbase*), Amanda Casari (Data Scientist at SAP Concur), and Piper Niehaus (Elm lang passionate).

The most interesting thing I learned at QCon Sao Paulo was how different companies struggle with monitoring, telemetry and system malfunction detection. They all have very sophisticated automation, but it is still not enough in today’s World complexity. As systems we build have more, and more complex architecture, we need to build even better monitoring software to maintain them.

In Azure Search we are using OData standard. However, recently GraphQL is gaining popularity. Dan McGhan shared this article about comparing GraphQL and OData: REST API Industry Debate: OData vs GraphQL vs ORDS. Interesting read!

Brazil

May is almost winter in Brazil, but it’s also the best time to visit. Not too hot, not too cold. Perfect weather for enjoying your time!

I like that every bar and restaurant in Brazil have TV on soccer channel 🙂 As a long standing fan of Brazil national football team (since Ronaldo Luiz Nazario de Lima times) I enjoyed it a lot!

Sao Paulo, the largest city in Brazil (21 million people) and financial center of the country, is also the largest tech-hub in south America. Most of tech-companies are there (Microsoft, Google, Amazon).

If you ever go to Brazil, remember to visit Sugarloaf to watch the sunset and after the sunset view 🙂

View from Sugarloaf after night

Summary

Speaking at QCons and connecting with engineers from different backgrounds is very valuable experience. Being able to learn about other cultures is a plus as well. Sharing with other work that you do everyday can also give you different perspective, and notice things that you would never think about.

If you want to learn more about Azure Search check out our getting started docs. To create intelligent search pipelines check out my Cognitive Search blog post. For more details we have quickstart and more comprehensive API overview.

Questions? Find me on twitter!

*Soups did not tell me what is the next coin coming to CoinBase 🙁