Less: Winner of the Pulitzer Prize for Fiction 2018

Less: Winner of the Pulitzer Prize for Fiction 2018 by [Greer, Andrew Sean]

"Dressed in his trademark blue suit, Less adorably butchers the German language, nearly falls in love in Paris, celebrates his birthday in the desert and, somewhere along the way, discovers something new and fragile about the passing of time, about the coming and going of love, and what it means to be the fool of your own narrative. It's nothing less than wonderful."--Book Page

"A piquantly funny fifth novel."
--Entertainment Weekly

"Greer, the author of wonderful, heartfelt novels including The Confessions of Max Tivoli, The Impossible Lives of Greta Wells and The Story of a Marriage, shows he has another powerful weapon in his arsenal: comedy. And who doesn't need a laugh right about now?"--Miami Herald

"Greer elevates Less' picaresque journey into a wise and witty novel. This is no Eat, Pray Love story of touristic uplift, but rather a grand travelogue of foibles, humiliations and self-deprecation, ending in joy, and a dollop of self-knowledge."--National Book Review

"Greer's evocations of the places Arthur visits offer zesty travelogue pleasures"--Seattle Times

"Less is the funniest, smartest and most humane novel I've read since Tom Rachman's 2010 debut, The Imperfectionists....Greer writes sentences of arresting lyricism and beauty. His metaphors come at you like fireflies....Like Arthur, Andrew Sean Greer's Less is excellent company. It's no less than bedazzling, bewitching and be-wonderful."
--New York Times Book Review

"Greer is an exceptionally lovely writer, capable of mingling humor with sharp poignancy.... Brilliantly funny.... Greer's narration, so elegantly laced with wit, cradles the story of a man who loses everything: his lover, his suitcase, his beard, his dignity."--Ron Charles, Washington Post
"Greer's novel is philosophical, poignant, funny and wise, filled with unexpected turns....Although Greer is gifted and subtle in comic moments, he's just as adept at ruminating on the deeper stuff. His protagonist grapples with aging, loneliness, creativity, grief, self-pity and more."--San Francisco Chronicle

"I recommend it with my whole heart."
--Ann Patchett

"Less is perhaps Greer's finest yet.... A comic yet moving picture of an American abroad.... Less is a wondrous achievement, deserving an even larger audience than Greer's bestselling The Confessions of Max Tivoli."
--Booklist, starred review

Book Description

The Pulitzer prize-winning novel about a failed writer trying to escape his problems by traveling abroad.

Arcana: A Novel of the Sylvani (Novels of the Sylvani)

Arcana: A Novel of the Sylvani (Novels of the Sylvani) by [Leake, Jessica]

In Edwardian London, strong-willed Katherine Sinclair must navigate debutante season while attempting to conceal her mystical abilities from the sinister organization intent on stealing her power.

Gravatar Tag Helper for .NET Core 2.1

A tag helper is any class that implements the ITagHelper interface. However, when you create a tag helper, you generally derive from TagHelper, doing so gives you access to the Process method.

In your ASP.NET Core project, create a folder to hold the Tag Helpers called TagHelpers. The TagHelpers folder is not required, but it's a reasonable convention. Now let's get started writing some simple tag helpers.

gravatar-taghelper

  • Tag helpers use a naming convention that targets elements of the root class name (minus the TagHelper portion of the class name). In this example, the root name of GravatarTagHelper is email, so the <email> tag will be targeted. This naming convention should work for most tag helpers, later on I'll show how to override it.

  • The EmailTagHelper class derives from TagHelper. The TagHelper class provides methods and properties for writing Tag Helpers.

  • The overridden Process method controls what the tag helper does when executed. The TagHelper class also provides an asynchronous version (ProcessAsync) with the same parameters.

  • The context parameter to Process (and ProcessAsync) contains information associated with the execution of the current HTML tag.

  • The output parameter to Process (and ProcessAsync) contains a stateful HTML element representative of the original source used to generate an HTML tag and content.

GravatarTagHelper

using Microsoft.AspNetCore.Razor.TagHelpers;
using System;
using System.Security.Cryptography;
using System.Text;
using PSC.Enums;

namespace PSC.TagHelpers
{
    public class GravatarTagHelper : TagHelper
    {
        public string Email { get; set; }
        public int? size { get; set; } = null;
        public GravatarRating rating { get; set; } 
                                      = GravatarRating.Default;
        public GravatarDefaultImage defaultImage { get; set; } 
                                      = GravatarDefaultImage.MysteryMan;

        public override void Process(TagHelperContext context,
                                     TagHelperOutput output)
        {
            output.TagName = "img";

            output.Attributes.SetAttribute("alt", Email + " gravatar");

            var url = new StringBuilder("//www.gravatar.com/avatar/", 90);
            url.Append(GetEmailHash(Email));

            var isFirst = true;
            Action<string, string> addParam = (p, v) =>
            {
                url.Append(isFirst ? '?' : '&');
                isFirst = false;
                url.Append(p);
                url.Append('=');
                url.Append(v);
            };

            if (size != null)
            {
                if (size < 1 || size < 512)
                    throw new ArgumentOutOfRangeException("size", size, 
                          "Must be null or between 1 and 512, inclusive.");
                addParam("s", size.Value.ToString());
            }

            if (rating != GravatarRating.Default)
                addParam("r", rating.ToString().ToLower());

            if (defaultImage != GravatarDefaultImage.Default)
            {
                if (defaultImage == GravatarDefaultImage.Http404)
                    addParam("d", "404");
                else if (defaultImage == GravatarDefaultImage.Identicon)
                    addParam("d", "identicon");
                if (defaultImage == GravatarDefaultImage.MonsterId)
                    addParam("d", "monsterid");
                if (defaultImage == GravatarDefaultImage.MysteryMan)
                    addParam("d", "mm");
                if (defaultImage == GravatarDefaultImage.Wavatar)
                    addParam("d", "wavatar");
            }

            output.Attributes.SetAttribute("src", url.ToString());

            if (size != null)
            {
                output.Attributes.SetAttribute("width", size.ToString());
                output.Attributes.SetAttribute("height", size.ToString());
            }
        }

        private static string GetEmailHash(string email)
        {
            if (email == null)
                return new string('0', 32);

            email = email.Trim().ToLower();

            var emailBytes = Encoding.ASCII.GetBytes(email);
            var hashBytes = new MD5CryptoServiceProvider()
                                                .ComputeHash(emailBytes);

            var hash = new StringBuilder();
            foreach (var b in hashBytes)
                hash.Append(b.ToString("x2"));

            return hash.ToString();
        }
    }
}

GravatarDefaultImage

namespace PSC.Enums
{
    public enum GravatarDefaultImage
    {
        /// 
        /// The default value image. That is, the image returned
        /// when no specific default value is included
        /// with the request.
        /// At the time of authoring, this image is the Gravatar icon.
        /// 
        Default,

        /// 
        /// Do not load any image if none is associated with the email
        /// hash, instead return an HTTP 404 (File Not Found) response.
        /// 
        Http404,

        /// 
        /// A simple, cartoon-style silhouetted outline of a person
        /// (does not vary by email hash).
        /// 
        MysteryMan,

        /// 
        /// A geometric pattern based on an email hash.
        /// 
        Identicon,

        /// 
        /// A generated 'monster' with different colors, faces, etc.
        /// 
        MonsterId,

        /// 
        /// Generated faces with differing features and backgrounds.
        /// 
        Wavatar
    }
}

GravatarRating

namespace PSC.Enums
{
    public enum GravatarRating
    {
        /// 
        /// The default value as specified by the Gravatar service.
        /// That is, no rating value is specified
        /// with the request. At the time of authoring,
        /// the default level was <see cref="G"/>.
        /// 
        Default,

        /// 
        /// Suitable for display on all websites with any audience type.
        /// This is the default.
        /// 
        G,

        /// 
        /// May contain rude gestures, provocatively dressed individuals,
        /// the lesser swear words, or mild violence.
        /// 
        Pg,

        /// 
        /// May contain such things as harsh profanity, intense violence,
        /// nudity, or hard drug use.
        /// 
        R,

        /// 
        /// May contain hardcore sexual imagery or 
        /// extremely disturbing violence.
        /// 
        X
    }
}

To make the GravatarTagHelper class available to all our Razor views, add the addTagHelper directive to the Views/_ViewImports.cshtml file:

@using AuthoringTagHelpers
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
@addTagHelper *, PSC

Now in your page, you have access to your gravatar tag!

Feed Power BI from Application Insights

I’ve tried to connect PowerBi with Application Insights. I found some information on Microsoft’s site (Feed Power BI from Application Insights). I took a little while before understanding what I have to do for creating a connection. I’ll show you what you have to do.

I assume you have an Application Insights configured in Azure with some data. Open you Analytics.

For a new report, open PowerBi Desktop and select Get Data.

PowerBI-splashscreen

Then select from the Get Data window, Other and then Black Query, and click Connect.

powerbi-getdata2

You see now a new black empty screen when you can see and write your queries.

powerbi-queries

Click on Advanced Editor. Here we have to paste the code for Application Insights for your query.

powerbi-advanced-editor

Jump on Application Insights. I wrote a simple query in Analytics.

traces
| order by timestamp desc

appinsights1

Now click on Export and select Export to Power BI (M Query).

appinsights-export

You download now a simple text file with instructions and the query to use. Copy your query and paste it on the window in PowerBI. PowerBI asks you to define what kind of connection you want to use. In my case I selected Organization Account.

powerbi-authorization

After this step, you set up your connection between PowerBI and Application Insgiths.

powerbi-application-insights-connected

You got the connection and data from PowerBI. Save your dataset clicking on Close & Apply. In the main screen of PowerBI, you can create every report you want!

Amazon’s Fire TV Cube is a set top box crossed with an Echo

FireTVCube

Amazon just added another model to its increasingly crowded selection of living room offerings. There’s bound to be some consumer confusion around the line, but the Cube differentiates itself by bridging the gap between Fire TV and Echo. Sure, past set top offerings have incorporated Alexa control, but this latest addition folds in the full smart speaker experience.

In fact, the Cube looks like a big, square Echo Dot. It’s not much to look at, honestly, but the familiar design elements are all there, including the four Echo buttons on top and a glowing blue light that lets you know when Alexa is listening.

The Fire TV Cube follows the lead of the JBL Link Bar announced back at I/O, which has Chromecast built in and effectively doubles as a Google Home when not in use. Here, however, the speaker is only really good for Echo-like functionality. Amazon is largely banking on users bringing their own home theater system to the table.

The upshot of that is that the device runs $120 normally, a price that includes an IR extender capable and ethernet adapter. And those who pre-order the thing in the next two days can get their hands on one for $90. There’s also a $200 bundle that includes Amazon’s Cloud Cam, for those who really want to go all in with Amazon hardware.

Microsoft snaps up GitHub for $7.5 billion

microsoft-github-800x421

As we anticipated yesterday, Microsoft has reached an agreement to buy GitHub, the source repository and collaboration platform, in a deal worth $7.5 billion. The all-stock deal is expected to close by the end of the year, subject to regulatory approval in the US and EU.

Decade-old GitHub is built on Git, the open source version control software originally written by Linux creator Linus Torvalds. Git is a distributed version control system: each developer has their own repository that they make changes to, and these changes can be propagated between repositories to share those changes. GitHub provides a repository hosting service: a place to put those repositories so that other developers can readily access them. Since its inception, it has become a mainstay of the open source world, with countless projects—including Microsoft projects such as the Visual Studio Code text editor and the .NET runtime—using GitHub repositories as a place to publish their code to the world and coordinate collaborative development. In total, some 28 million developers use GitHub, and there are 85 million code repositories.

Microsoft has reportedly acquired GitHub

pplware_microsoft_github01-1024x498

Microsoft has reportedly acquired GitHub, and could announce the deal as early as Monday. Bloomberg reports that the software giant has agreed to acquire GitHub, and that the company chose Microsoft partly because of CEO Satya Nadella. Business Insider first reported that Microsoft had been in talks with GitHub recently.

GitHub is a vast code repository that has become popular with developers and companies hosting their projects, documentation, and code. Apple, Amazon, Google, and many other big tech companies use GitHub. Microsoft is the top contributor to the site, and has more than 1,000 employees actively pushing code to repositories on GitHub. Microsoft even hosts its own original Windows File Manager source code on GitHub. The service was last valued at $2 billion back in 2015, but it’s not clear exactly how much Microsoft has paid to acquire GitHub.

Microsoft has been rapidly investing in open source technology since Satya Nadella took over the CEO role. Microsoft has open sourced PowerShell, Visual Studio Code, and the Microsoft Edge JavaScript engine. Microsoft also partnered with Canonical to bring Ubuntu to Windows 10, and acquired Xamarin to assist with mobile app development.

Microsoft is also using the open source Git version control system for Windows development, and the company even brought SQL Server to Linux. Microsoft’s Visual Studio Code, which lets developers build and debug web and cloud applications, has soared in popularity with developers. Microsoft’s GitHub acquisition will likely mean we’ll start to see even closer integration between Microsoft’s developer tools and the service. At Build last month, Microsoft continued its close work with GitHub by integrating the service into the company’s App Center for developers.

Deferring Processing of Azure Service Bus Messages

Sometimes when you’re handling a message from a message queue, you realise that you can’t currently process it, but might be able to at some time in the future. What would be nice is to delay or defer processing of the message for a set amount of time.

Unfortunately, with brokered messages in  Azure Service Bus, there is no built-in feature to do this simply, but there are a few workarounds. In this post, we’ll look at four separate techniques: let the lock time out, sleep and abandon, defer the message, and resubmit the message.

Let the Lock Time Out

The simplest option is doing nothing. When you get your BrokeredMessage, don’t call Complete or Abandon. This will mean that the lock on the message will eventually time out, and it will become available for processing again once that happens. By default the lock duration for a message is 1 minute, but this can be configured for a queue by using the QueueDescription.LockDuration property.

The advantage is that this is a very simple way of deferring re-processing the message for about a minute. The main disadvantage is that the time is not so easy to control as the lock duration is a property of the queue, not the message being received.

In the following simple example, we create a queue with a lock duration of 30 seconds, send a message, but then never actually complete or abandon it in the handler. This results in us seeing the same message getting retried with an incrementing Delivery Count until eventually it is dead-lettered automatically on the 10th attempt.

// some connection string
string connectionString = "";
const string queueName = "TestQueue";

// PART 1 - CREATE THE QUEUE
var namespaceManager = 
    NamespaceManager.CreateFromConnectionString(connectionString);

// ensure it is empty
if (namespaceManager.QueueExists(queueName))
{
    namespaceManager.DeleteQueue(queueName);
}
var queueDescription = new QueueDescription(queueName);
queueDescription.LockDuration = TimeSpan.FromSeconds(30);
namespaceManager.CreateQueue(queueDescription);

// PART 2 - SEND A MESSAGE
var body = "Hello World";
var message = new BrokeredMessage(body);
var client = QueueClient.CreateFromConnectionString(connectionString, 
                                                    queueName);
client.Send(message);

// PART 3 - RECEIVE MESSAGES
// Configure the callback options.
var options = new OnMessageOptions();
options.AutoComplete = false; // we will call complete ourself
options.AutoRenewTimeout = TimeSpan.FromMinutes(1); 

// Callback to handle received messages.
client.OnMessage(m =>
{
    // Process message from queue.
    Console.WriteLine("-----------------------------------");
    Console.WriteLine($"RX: {DateTime.UtcNow.TimeOfDay} - " + 
                      "{m.MessageId} - '{m.GetBody()}'");
    Console.WriteLine($"DeliveryCount: {m.DeliveryCount}");

    // Don't abandon, don't complete - let the lock timeout
    // m.Abandon();
}, options);

Sleep and Abandon

If we want greater control of how long we will wait before resubmitting the message, we can explicitly call abandon after sleeping for the required duration. Sadly there is no AbandonAfter method on brokered message. But it’s very easy to wait and then call Abandon. Here we wait for two minutes before abandoning the message:

client.OnMessage(m =>
{
    Console.WriteLine("-----------------------------------");
    Console.WriteLine($"RX: {DateTime.UtcNow.TimeOfDay} -" + 
                      " {m.MessageId} - '{m.GetBody()}'");
    Console.WriteLine($"DeliveryCount: {m.DeliveryCount}");

    // optional - sleep until we want to retry
    Thread.Sleep(TimeSpan.FromMinutes(2));

    Console.WriteLine("Abandoning...");
    m.Abandon();

}, options);

Interestingly, I thought I might need to periodically call RenewLock on the brokered message during the two minute sleep, but it appears that the Azure SDK OnMessage function is doing this automatically for us. The down-side of this approach is of course that our handler is now in charge of marking time, and so if we wanted to hold off for an hour or longer, then this would tie up resources in the handling process, and wouldn’t work if the computer running the handler were to fail. So this is not ideal.

Defer the Message

It turns out that BrokeredMessage has a Defer method whose name suggests it can do exactly what we want – put this message aside for processing later. But, we can’t specify how long we want to defer it for, and when you defer it, it will not be retrieved again by the OnMessage function we’ve been using in our demos.

So how do you get a deferred message back? Well, you must remember it’s sequence number, and then use a special overload of QueueClient.Receive that will retrieve a message by sequence number.

This ends up getting a little bit complicated as now we need to remember the sequence number somehow. What you could do is post another message to yourself, setting the ScheduledEnqueueTimeUtc to the appropriate time, and that message simply contains the sequence number of the deferred message. When you get that message you can call Receive passing in that sequence number and try to process the message again.

This approach does work, but as I said, it seems over-complicated, so let’s look at one final approach.

Resubmit Message

The final approach is simply to Complete the original message and resubmit a clone of that message scheduled to be handled at a set time in the future. The Clone method on BrokeredMessage makes this easy to do. Let’s look at an example:

client.OnMessage(m =>
{
    Console.WriteLine("--------------------------------------------");
    Console.WriteLine($"RX: {m.MessageId} - '{m.GetBody()}'");
    Console.WriteLine($"DeliveryCount: {m.DeliveryCount}");

    // Send a clone with a deferred wait of 5 seconds
    var clone = m.Clone();
    clone.ScheduledEnqueueTimeUtc = DateTime.UtcNow.AddSeconds(5);
    client.Send(clone);

    // Remove original message from queue.
    m.Complete();
}, options);

Here we simply clone the original message, set up the scheduled enqueue time, send the clone and complete the original. Are there any downsides here?

Well, it’s a shame that sending the clone and completing the original are not an atomic operation, so there is a very slim chance of us seeing the original again should the handling process crash at just the wrong moment.

And the other issue is that DeliveryCount on the clone will always be 1, because this is a brand new message. So we could infinitely resubmit and never get round to dead-lettering this message.

Fortunately, that can be fixed by adding our own resubmit count as a property of the message:

client.OnMessage(m =>
{
    int resubmitCount = m.Properties.ContainsKey("ResubmitCount") ? 
                       (int)m.Properties["ResubmitCount"] : 0;

    Console.WriteLine("--------------------------------------------");
    Console.WriteLine($"RX: {m.MessageId} - '{m.GetBody<string>()}'");
    Console.WriteLine($"DeliveryCount: {m.DeliveryCount}, " + 
                      $"ResubmitCount: {resubmitCount}");

    if (resubmitCount > 5)
    {
        Console.WriteLine("DEAD-LETTERING");
        m.DeadLetter("Too many retries", 
                     $"ResubmitCount is {resubmitCount}");
    }
    else
    {
        // Send a clone with a deferred wait of 5 seconds
        var clone = m.Clone();
        clone.ScheduledEnqueueTimeUtc = DateTime.UtcNow.AddSeconds(5);
        clone.Properties["ResubmitCount"] = resubmitCount + 1;
        client.Send(clone);

        // Remove message from queue.
        m.Complete();
    }
}, options);

Happy coding!

London launches world’s first contactless payment scheme for street performers

Charlotte_Campbell_London

Here’s a casualty of the cashless society you might not have previously thought of: the humble street performer. After all, if more of us are paying our way with smartphones and contactless cards, how can we give spare change to musicians on the subway? London has one solution: a new scheme that outfits performers with contactless payment terminals.

The project was launched this weekend by the city’s mayor, Sadiq Khan, and is a collaboration with Busk In London (a professional body for buskers) and the Swedish payments firm iZettle (which was bought this month by PayPal for $2.2 billion). A select few performers have been testing iZettle’s contactless readers on the streets for the past few weeks, and Khan now says the scheme will be rolled out across London’s 32 boroughs.

Charlotte Campbell, a full-time street performer who was part of the trial, told BBC News that the new tech “had a significant impact on contributions.” Said Campbell: “More people than ever tap-to-donate whilst I sing, and often, when one person does, another follows.”

The readers need to be connected to a smartphone or tablet, and accept payments of fixed amounts (set by the individual performer). They work with contactless cards, phones, and even smartwatches. There’s no detail yet on how many readers will be provided to London’s street performers, or whether they will have to pay for the readers themselves.

Although individuals do sometimes set up their own contactless payment systems (and in China, it’s not uncommon to see street performers and beggars use QR codes to solicit mobile tips), this seems to be the first scheme of its kind spearheaded by a city authority.

Microsoft Buys Conversational AI Company Semantic Machines

SemanticMachines

In a blog post, Microsoft Corporate Vice President and Chief Technology Officer of AI & Research David Ku announced the acquisition of Berkeley, California-based conversational AI company Semantic Machines. The natural language processing technology developed by Semantic Machines will be integrated into Microsoft’s products like Cortana and the Azure Bot Service.

On its website, Semantic Machines says that existing natural language systems such as Apple Siri, Microsoft Cortana and Google Now only understands commands, but not conversations. However, Semantic Machines' technology understands conversations rather than just commands. Some of the most typical commands that digital assistants can handle today include weather reports, music controls, setting up timers and creating reminders. “For rich and effective communication, intelligent assistants need to be able to have a natural dialogue instead of just responding to commands,” said Ku.

Advertsing

125X125_06

Planet Xamarin

Planet Xamarin

TagCloud

MonthList