GCast 64:

Noise Reduction with Audacity

Learn how to use Audacity to reduce the background noise in an audio file.


Episode 580

Jason Bock on .NET Core 3

Jason Bock describes the most important new features in .NET Core 3


WideSargassoSeaCharlotte Bronte's Jane Eyre includes the character of Bertha - Rochester's mad wife, whom he keeps locked in the attic.

In Wide Sargasso Sea, Jean Rhys tells Bertha's story and her descent into madness.

Her name was Antoinette and she was the Creole daughter of a slave owning family in 19th century Jamaica. The family fell into financial and social ruin when the British Empire outlawed slavery.  The local freed slaves hated them enough that they eventually burned down their home and killed Antoinette's brother. Her mother married a wealthy Englishman, who killed himself, driving her mother to madness. Antoinette was raised by nuns at a convent and eventually an Englishman married her for her inheritance. But the unnamed Englishman (presumably Mr. Rochester) was unloving and believed rumors that he heard about Antoinette and her family. He became distant and unfaithful and even began calling her "Bertha" instead of her real name over Antoinette's objections.

The book humanizes Bertha / Antoinette, who is no longer the monstrous lunatic of Bronte's novel. Her troubled mind is in part due to heredity and in part to her traumatic upbringing and unhappy marriage.  Her marriage to Rochester resulted in the loss of her freedom, which is analogous to the slavery inflicted by her own ancestors. The novel explores conflicts between races and genders and classes and forces the reader to think about the choices we make in life. Although Antoinette looks white, she is part black and not fully accepted by either race. Her marriage to Rochester is, in part, an effort to escape her situation.

Sargasso is probably the most interesting examples of fan fiction I've read. The narration suddenly shifts from Antoinette to Rochester without explanation, which was a bit jarring and confusing. But a quick re-read of the opening pages of Section 2 clarified my perspective.

It isn't necessary to read Jane Eyre before this novel, but it helps one appreciate where the character is going. If you have not yet read Bronte's classic novel, I recommend reading a synopsis before diving into this one. The book does stand on its own; but is better as a prequel and explanation of Bronte's novel.


Episode 579

Laurent Ellerbach on Diversity and Inclusion Workshop

Laurent Ellerbach has developed a workshop to help people think about and talk about Diversity and Inclusion. In this workshop, attendees articulate their ideas visually using Lego bricks.


September 2019 Gratitudes

Comments [0]

10/6
Today I am grateful for phone calls yesterday from my sister Debbie and my cousin Kevin.

10/5
Today I am grateful to write some code the past couple weeks for the first time in too long.

10/4
Today I am grateful for a free annual flu shot.

10/3
Today I am grateful for a visit this week from John and Becky.

10/2
Today I am grateful for dinner last night with John and Becky.

10/1
Today I am grateful for a long-overdue haircut last night.

9/30
Today I am grateful to see the Billy Cobham Crosswinds Project featuring Randy Brecker last night at the City Winery.

9/29
Today I am grateful to cook a nice meal for someone yesterday for the first time in a long time.

9/28
Today I am grateful to see Bruce Cockburn in concert last night.

9/27
Today I am grateful for a grocery store 1 block from my home.

9/26
Today I am grateful to see Ad Astra in Lincoln Square last night. And for a 10-mile bike ride home after the movie.

9/25
Today I am grateful for the flexibility to work where I want on many days.

9/24
Today I am grateful for a birthday dinner with Tim and Natale last night at Au Cheval.

9/23
Today I am grateful for my son's new job as head basketball coach at Kalamazoo College.

9/22
Today I am grateful to attend the MSU-Northwestern football game in Evanston yesterday.

9/21
Today I am grateful for a few days in Redmond and Bellevue.

9/20
Today I am grateful:
-to attend a Train the Trainer course for a Diversity and Inclusion workshop yesterday
-for lunch yesterday with my boss's boss's boss (After months of phone conversations, we finally met in person)

9/19
Today I am grateful for my first visit to an Afghan restaurant.

9/18
Today I am grateful for dinner with John last night.

9/17
Today I am grateful for a night in my own bed.

9/16
Today I am grateful for an excellent weekend in London.

9/15
Today I am grateful for:
-a tour of Westminster Abbey
-Lunch with Peter
-my first visit to the British Museum
-seeing "Matilda" live in London's West End

9/14
‪Today I am grateful for:‬
‪-Coffee with Galiya and Gary ‬
‪-Dinner with James and Gosia ‬
‪-Seeing Rachel before she left London ‬

9/13
Today I am grateful to work with customers who are excited about what we are working on together.

9/12
Today I am grateful to work with smart people.

9/11
Today I am grateful for dinner with this team at an English Pub last night.

Sep 11, 2019, 7:29 AM

9/10
Today I am grateful for my first visit to Peterborough, England.

9/9
Today I am grateful for a week in Rome.

9/8
Today I am grateful to visit the Coliseum, the Forum, the Vatican, the Spanish Steps and other attractions in Rome yesterday with Hattan, Anders, and Robert.

9/7
Today I am grateful for a successful OpenHack in Rome this week.

9/6
Today I am grateful my camera was still there when I went back to look for it.

9/5
Today I am grateful for a hot shower following a restless night.

9/4
Today I am grateful for dinner with Hattan last night.

9/3
‪Today I am grateful for my first visit to Rome in over 30 years. ‬

9/2
Today I am grateful for my first visit to the Chicago Botanic Garden.


AmericanTragedyClyde Griffiths is an ambitious young man.

At the age of 21, he finds himself working for a rich uncle who owns a shirt company. He is the boss of a department filled with young ladies and, despite company rules expressly forbidding such things, begins an affair with one of them - the beautiful Roberta Alden. He is also welcomed into the social circles of the local aristocracy, where he is liked for his good looks and charm. Soon, he meets rich, beautiful Sondra and decides he loves her instead of Roberta. Unfortunately, he continues to sleep with Roberta; and, when she becomes pregnant, he is left with a dilemma: marry the girl he no longer loves or abandon her for Sondra, risking exposure for his philandering. It is at this point that Clyde contemplates murder.

Clyde sounds like a terrible person. Who would treat people like this and place his own ambitions above the very lives of others? But An American Tragedy by Theodore Dreiser does not begin with Clyde's entry into high society. It begins with his childhood in Kansas City, where Clyde was the eldest son of street evangelists. Poor and embarrassed, he finds work as a hotel busboy, which puts some money in his pocket. He begins spending his evenings squandering his salary on booze and prostitutes. After being exploited by the selfish gold digger Hortense Briggs, who manipulates him into buying her expensive gifts, he develops a mistrust of women. At one point, Clyde is a passenger in a stolen car that is involved in a fatal hit-and-run. Fearing arrest, Clyde flees Kansas City and changes his name. By doing so, he learns that he can avoid responsibility and punishment by running away.

Each stage of Clydes's life reinforces in him his desire for material wealth and social standing. He becomes more self-centered with each passing year - not evil, but with little empathy toward others.

The book ends with a murder trial, a thorough analysis of one of the book's central tragedies.

There are side stories: the office of the ambitious district attorney that has no qualms about manufacturing evidence; the mother who refuses to acknowledge the possibility that her son might be guilty; the virginal Roberta's agonizing choice to give herself to Clyde or risk losing him; and Sondra, whose parents disapprove of her relationship with a boy they see as lower in social ranking.

But mostly, this is Clyde's story. And the reader cannot help but sympathize with him, even though his problems are almost entirely self-inflicted. Clyde is a product of his experiences. He has been conditioned by society to want what others have, and he doesn't have the courage to question this.

Dreiser removes much ambiguity by telling the reader explicitly what is in the mind of each character as they are speaking. With Clyde, the ambiguity remains because Clyde himself does not understand his own emotions.

There are three deaths in the novel. And, although each is tragic, the real tragedy of the story is the slow descent of Clyde's conscience. He never sees himself as evil, but he falls for the material comforts, and the pretty girls, and he comes to believe that he is entitled to these things and that his desires take precedence over the needs of anyone else.

An American Tragedy is not perfect. It's longer than it needs to be, and it moves slowly at times. But it is a good crime story; a good legal drama; and a very good psychological analysis of a misguided mind growing up under the influence of American values.


CobhamBrecker (2)Maybe it was the rain. Or the fact that it was a Sunday. Or because they performed 2 shows on  the same day.

But the City Winery was barely half full for the legendary drummer Billy Cobham and his Crosswinds Project, which featured his longtime collaborator trumpeter Randy Brecker.

CobhamBrecker (3)Cobham and Brecker have a long history together. They co-founded the jazz-rock fusion band Dreams in the late 1960s before launching successful careers as solo artists and collaborating with many of the jazz greats. Brecker found great success pairing with his brother Michael as The Brecker Brothers, while Cobham co-founded the Mahavishnu Orchestra with guitarist John McLaughlin.

Sunday they were together again, along with 4 other musicians (guitar, bass, keyboard, and bassoon) at the City Winery. I caught the second of two shows and the band was tight and energetic.

Named for his classic 1974 album, the Crosswinds Project played the full Spanish Moss Suite from that LP, leading in with a beautifully rendered solo keyboard version of "Savannah the Serene".

CobhamBrecker (1)It was Cobham's band and he led the way, but each of his band took turns with outstanding solo and ensemble performances. I was particularly impressed with keyboardist Osam Elelwy, who brought both energy and emotion to the evening's performance.

At 75 years young, Billy Cobham is celebrating his legacy and still sharing continuing to pour himself into his music. It will be tough to match the influence he has had on musicians in the past, but he is still inspiring audiences.


Episode 578

Raj Krishnan on Azure Data Explorer

Raj Krishnan describes Azure Data Explorer - a highly-scalable, very fast in-memory data store formerly known as Kusto.


BruceCockburn-60Bruce Cockburn sat outside Maurer Hall at Lincoln Square's Old Town School of Folk Music, smiling, chatting, and signing autographs. His sold-out concert had ended almost an hour before, but he patiently waited for each photo request and each expression of gratitude - gratitude for the evening's music and for four decades of recordings. He did not show his 74 years at all. Until he stood up and one noticed a curve in his back that kept him bent over a bit too much and forced him to use a cane beyond a few steps.

Any age-related frailties were conspicuously absent during his nearly 3-hour performance. He sat while playing and singing, but he left his seat between songs to change instruments (he brought four guitars plus a charango - a small South American stringed instrument). But the thing that mostly defies Cockburn's years is his voice, which remains the rich baritone that made him semi-famous half a lifetime ago.

BruceCockburn-71 Cockburn seemed to get stronger as the show progressed. During the first half of his show, he softened up the audience - lulling them into a feeling of comfort; but, after intermission, one could feel the energy increase. From the anger of protest songs like "Call it Democracy" and environmental anthems like "If a Tree Falls" to the uplifting and upbeat "wondering Where the Lions Are" (my favourite Cockburn song), the septuagenarian singer-songwriter kept the energy high.

He was accompanied on stage by a young man that I assume was his son (Bruce introduced him as someone with the same last name), who alternated between guitar and accordion. This helped fill in some of the songs, but one gets the feeling that the elder Cockburn could have carried the show himself.

It was a rare treat to see a legendary performer like Bruce Cockburn, who is still going strong.


Photos


DayOfTheLocustNathanael West's The Day of the Locust takes place in 1930s Hollywood; but it has little to do with the film industry. This even though the book opens with a parade of movie extras marching past and ends with fans rioting outside a movie premiere.

Most of the story takes place around the edges of movie life. Tod Hackett works as a set painter for a movie studio and Faye Greener is a sometimes extra, waiting for her chance to be a star.

Tod is infatuated with Faye, but Faye cares only for herself and uses Tod, along with every man who comes into his life. Some of the men she teases, some she sleeps with, and some she exploits. She particularly takes advantage of Homer Simpson (Yes. Homer Simpson), a shy, repressed Midwesterner who comes to California hoping the mild weather will heal his failing health. After the death of her father, Faye moves into Homer's house and invites her lover and his friend to move into his garage, where they host illegal cock fights. She is verbally abusive to all her suitors, but she is cruelest to Homer.

The Day of the Locust shines a light on the shallowness of Hollywood culture. As Hackett tells it, people "have come to California to die". The pleasant weather isn't enough to occupy them, and they don't have enough money or imagination to fight the inevitable boredom that overwhelms their lives. So, everyone devolves into a shallow version of themselves.

No one seemed to be working toward anything meaningful. Tod is complex ("a very complicated young man with a whole set of personalities, one inside the other like a nest of Chinese boxes); but everyone he encounters is a simple stereotype from the ill-tempered dwarf to the silent cowboy to the mother pushing her spoiled son to be a child star. It's no wonder that so many of them fall for Faye's empty charms. 


This book is satirical and depressing and filled with sexual frustration, which leads to heartbreak, which often leads to violence.

And I liked it.


GoodOmensAziraphale is an angel and Crowley is a demon and both have been living on Earth for thousands of years and they have grown to like it. They even like each other. Sort of. So, they are distressed to learn that the antichrist has been born, signaling the impending end of the world.

Anathema Device is the descendent of Agnes Nutter - a 17th century soothsayer whose predictions have all come to pass. Agnes has predicted the coming Armageddon.

Newton Pulsifer and Sergeant Shadwell are incompetent witch hunters, who only know that something strange is going on, so they chase it across England, trying to avoid bad people and any monetary expenditures.

The Chattering Order of St. Beryl are a group of bumbling Satanists charged with swapping the newborn antichrist, so he is raised by a powerful political family. They accidentally place him with the wrong family, so he grows up in a small Oxfordshire village raised by middle class parents.

Years later, the Four Horsepersons of the Apocalypse are racing toward the 11-year-old antichrist, planning to finalize his rise to power. Horseman Pestilence retired after the discovery of penicillin, so he has been replaced by Pollution.

And then it gets weird.

These are some of the elements of Good Omens by Terry Pratchett and Neil Gaiman - two of my favourite authors.

It's hard to tell which parts are Gaiman and which are Pratchett. Gaiman is better at inventing worlds and making them seem believable. Pratchett is better at laugh-out-loud humour. And there is plenty of both in this story.

Good Omens is a tale about the worth of humanity and about the relative power of nature versus nurture. But mostly it is about silliness and funny jokes. If you love Gaiman and you love Pratchett (and who doesn't?), you will enjoy this book.


IMG_5933When my boys were young, I would regularly read to them and their classmates. One of our favourite authors was Roald Dahl, so I spent many Fridays reading chapters from Charlie and the Chocolate Factory, James and the Giant Peach, and Matilda.

Saturday night, I had the chance to experience Matilda - the Musical live at London' Cambridge Theatre.

It was a delightful interpretation of a delightful book.

Matilda is the story of a young girl who loves books, but is despised, discouraged, and verbally abused by her ignorant and amoral parents. When she goes to school, she finds the other children absurdly ignorant, the older kids callous and teasing and - worst of all - the headmistress Miss Trunchbull is cruel and domineering.

Matilda is bright and mischievous and unafraid. But her life is made miserable by the adults who surround her. The one great exception is her kindly teacher Miss Honey, who cares about Matilda, but is too timid to stand up to Miss Trunchbull.

The Cambridge Theatre production made use of the entire theatre. Actors frequently entered and exited the stage up the center aisle (right next to my seat, as it turned out); and the action sometimes extended up into the balcony. In a break from tradition, the intermission ended without warning with Matilda's father stepping onstage to read a statement on the dangers of excessive reading. People hurried back to their seat when they discovered the play had resumed.

The title character was played perfectly by Tilly-Raye Bayer, a tiny girl with the cherubic face and a precocious attitude.

I saw many children in the audience enjoying the show, but many adults like me also had a great time. It took me back to a simpler time that I shared with my boys.

My second experience in London's famous West End theatre district was a delight.


"White Noise" by Don DeLillo

Comments [0]

WhiteNoiseJack and Babette have an idyllic, if unconventional life. Jack is a professor at a small midwestern college, whose Hitler Studies program has proved enormously popular. The major is so popular that a colleague is building a similar curriculum around Elvis Presley in addition to a course about car crashes in movies. Babette has a successful career reading tabloid stories to blind people.

They live in a nice house near campus with four children from their numerous previous marriages. They are a little too obsessed with death, but what of that?

Things start to disrupt when Jack is exposed to toxic fumes that descend on their town - an incident that brings him closer to the death he fears.

Babette learns of a pill that claims to cure death anxiety, but the only source of this pill will only trade it for sex. She concedes and Jack takes the affair in stride when he first learns of it; but later plots violent revenge.

White Noise by Don DeLillo is a surreal book. From absurd pop-culture college majors to the unexplained "toxic cloud" to unlikely medicines to the children who seem more mature than their parents to the ex-wives with even quirkier personalities than Jack and Babette's family.

DeLillo makes it work, thanks to his gift of humor. His dialogue is often inane, but funny. And he throws the reader off by including unrelated details in many scenes, such as describing the shoes a character wears or relaying what is heard on the TV in the background.

White Noise is an enjoyable satire and a good read.


TheirEyesWereWatchingGodUntil this week, I was unfamiliar with Zora Neale Hurston or her 1937 novel "Their Eyes Were Watching God".

But I read it and I'm glad I did.

This is the story of Janie Crawford - a black woman growing up in Florida in the early 20th century. Janie is the product of a white man raping her mother and her mother is the result of the rape of Janie's grandmother by her plantation master.

It is a full generation following the emancipation of slaves in America, but the poor, uneducated blacks of the region are still far from equal. This book reminds us that they had stories to tell and people to love and lives to lead.

As a young girl, Janie hoped for love. As a teenager, Janie's grandmother arranged her marriage to an older man, hoping to avoid the tragedies of the last two generations. This marriage fails and her second husband dies, and she marries a charming gambler, who is much younger than her. Their life seems good until a flood and a rabid dog attack disrupts it.

But these plot devices are just Hurston's ways of allowing us to see inside Janie and her neighbors. She struggles to love her husbands, even though they sometimes behave irrationally and occasionally violently. She struggles with other blacks, even though some of them have ideas that are strange to her. And she struggles to survive in a world designed by white men.

Her first two husbands treat her as a piece of property. Only her third husband gives her the love she desires. He is far from perfect, but he accepts Janie as a person.

We cannot escape the racial overtones in this novel because most of the characters are black and are living in a white-controlled society. But the book is more about gender roles and the relationship between men and women than about race. Janie searches for love but ends up being controlled by the men in her life. The black men of this story are controlled by the white men; and they take out their frustration by controlling their black women.

Hurston strives to make the dialogue authentic, including poor grammar and phonetic (mis)pronunciations, which can make this book a challenge to read. But this adds to the color of the story. And I happened to choose the audiobook, read by Ruby Dee, who did a masterful job.

"Their Eyes Were Watching God" is a story of strength and endurance by a woman seeking love and affirmation and survival. Janie is human but heroic. She asserts and defends herself while surviving in a world she does not control. Ultimately, she succeeds in living her life by her own rules.


IMG_5744Glenn Tilbrook celebrated his birthday with us in Chicago.

Tilford - along with Chris Difford - are the driving force behind the band Squeeze. Squeeze began as a New Wave band in the late 1970s, but progressed to become one of the most creative bands of the early 1980s - producing some very inventive melodies, rhythms, and arrangements. Difford and Tilbrook were the founders, songwriters, and leaders of the band and they are the only two original members to remain with the group today.

Saturday night at the Chicago Theatre, they were joined by a very good backing ensemble, especially a drummer, filled with kinetic energy and a masterful keyboard player.

From the moment they walked on stage, they were focused on the music. The band played four songs before they paused to greet the audience.

Mixed in with some lesser-known album cuts, the band played many of their hits, including "Annie Get Your Gun", "Cool for Cats" (a rare Difford vocal), "Goodbye Girl", and "Up the Junction". Highlights of the evening included an acoustic version of "Tempted" and a rousing version of "Black Coffee in Bed" to close the night.

The seats at the Chicago Theatre were a little too close to allow any pogo dancing; but the audience got on their feet when they recognized a song.

IMG_5748During their heyday, Squeeze was moderately popular on American radio stations, while they enjoyed much greater success in their native UK and on my college dorm room stereo.

At the end of the show, Difford wished his friend a Happy Birthday, showed a video from back home, and led the crowd in singing "Happy Birthday".

We all celebrated.


Episode 577

Lorena Mesa on the Python Software Foundation

Lorena Mesa is a GitHub data engineer and a Director of the Python Software Foundation.

She describes the mission of the Foundation and how they assist Python developers and the Python community.

Links:

http://lorenamesa.com/
https://twitter.com/loooorenanicole
https://www.python.org/psf-landing/
https://www.python.org/psf/
https://github.com/psf/
https://pycon.org/


August 2019 Gratitudes

Comments [0]

9/1
Today I am grateful to attend the Squeeze concert last night with John.

8/31
Today I am grateful for a visit yesterday to the September 11 Memorial and Museum in lower Manhattan.

8/30
Today I am grateful for:
-My first visit to Birdland Jazz Club
-Seeing "The Phantom of the Opera" on Broadway

8/29
Today, I am grateful for my first visit to Purchase, NY.

8/28
Today I am grateful for my first visit to the Metropolitan Museum of Art yesterday.

8/27
Today I am grateful that I've had a few weeks without work travel.

8/26
Today I am grateful to attend Mass at Assumption Church for the first time.

8/25
Today I am grateful for a bike ride along the lakefront in Milwaukee yesterday.

8/24
‪Today I am grateful to see Max Weinberg’s Jukebox in concert last night. ‬

8/23
Today I am grateful for dinner with John last night.

8/22
Today I am grateful for a tour of the Glessner House Museum yesterday.

8/21
Today I am grateful for a hot bath last night.

8/20
Today I am grateful for a weekend in Flagstaff with Dan.

8/19
Today I am grateful for a visit to Walnut Canyon National Monument, Grand Falls, and Winslow yesterday.

8/18
Today, I am grateful for a drive through the deserts, canyons, mountains, and plateaus of central Arizona.

8/17
Today I am grateful to attend an extra-innings Giants-Diamondbacks baseball game last night at Chase Field.

8/16
Today I am grateful for:
-the Dell technician who fixed my motherboard yesterday;
-a chance to speak at the Chicago .NET User Group last night

8/15
Today I am grateful for my longest bike ride of the year (so far)

8/14
Today I am grateful that so many electronics can be fixed by turning them off and on.

8/13
Today I am grateful that downtown Chicago becomes more bike-friendly every year.

8/12
Today I am grateful to visit the United States Pizza Museum yesterday.

8/11
Today I am grateful to see Sam Shepard's "True West" last night on my first visit to the Steppenwolf Theatre.

8/10
Today I am grateful for my new dresser.

8/9
Today I am grateful for a few days in southwest Michigan.

8/8
Today I am grateful for a walk around Saugatuck yesterday.

8/7
‪Today I am grateful to watch the sun set over Lake Michigan last night. ‬

8/6
Today I am grateful for dinner last night with Emilija and Larissa.

8/5
Today I am grateful to see Santana and the Doobie Brothers in concert last night.


William Faulkner's Light in August opens as Lena Grove arrives in Jefferson, Mississippi after traveling hundreds of miles to Jefferson, Mississippi in search of Lucas Birch - the father of her unborn child. Lucas left Alabama, promising to send for Lena as soon as he was settled, but she never heard from him.

Lena learns that Lucas has been living in Jefferson for months under an assumed name. He has been bootlegging with a drifter named Joe Christmas.

Christmas was raised in an orphanage, then adopted by an abusive stepfather, whom he murdered. He has been on the run ever since. At the beginning of the novel, he is having a relationship with Joanna Burden - a local descendent of abolitionists, who is shunned by the whites in town because of her tolerance and kindness toward the blacks.

Each major character we meet is a misfit: an unwed mother or a defrocked preacher or a criminal or an abolitionist or an orphan. Many of them are self-destructive and all of them are interesting. When Faulkner introduces each character, he takes the time to review their backstory - explaining how they came to their troubles.

Soon, there is a murder and a manhunt and a town seeking justice for someone they never liked.

Race plays a huge role in this novel. One character looks white but is filled with self-loathing because he believes he is part black. The local white folks are quick to believe the guilt of an alleged murderer when they learn he may be part negro.

One thing the racism of the characters succeeds in doing is masking the extreme misogyny of many of the characters.

Sometimes the frequent time hops make this a difficult story to follow; but, stay with it. It is filled with tragedy and human drama and raw emotion.


GCast 63:

Sentiment Analysis JavaScript Demo

In this video, I walk you through a JavaSript application that calls the Sentiment Analysis Cognitive Service.


Episode 576

Dan Rey on Microsoft Surface

Dan Rey describes the different versions of Microsoft Surface and how you can use them to be more productive.


WhiteTeethWhite Teeth by Zadie Smith follows the lives of old friends Archie Jones and Samad Iqbal. They met when serving together in a tank in World War II, where they got lost, missed the end of the war, and sentenced a war criminal to death; they remained friends; married much younger women; had children; worked menial jobs in north London; and spend their free time in a filthy pub drinking beer and eating greasy food.

But they are very different. Archie is English and simple and easygoing; Samal is a fiery and opinionated Bangladeshi immigrant, who wants his family to maintain the traditions of his homeland.

Samal is so troubled by the English influence on his family that he sends his son Magid back to Bangladesh so he can learn his ancestral ways.

The plot becomes more complex as Smith introduces more characters and tells their backstories and their lives become more and more intertwined. In addition to Archie and Samad, she gives us:

Clara: Archie's young Jamaican wife, who is trying to escape the influence of her Jehovah's Witness mother.

Alsana: Samad's wife. She never forgives Samad for sending away their son.

Millat and Magid: Twin sons of Samad and Alsana. They grow up with very different personalities. After Magid is sent to Bangladesh, Millat turns to a life of pot-smoking and womanizing for a few years, before embracing Islam. Magid rejects religion and embraces intellectualism.

Irie: Archie and Clara's daughter. She is intelligent but lacks self-esteem and has a hopeless crush on Millat.

The Chalfens, an intellectual, liberal, well-meaning, dysfunctional family, who try (sometimes successfully) to mentor the Jones and Iqbal children.

There are other characters, and each has their backstory and their quirks, but the narrative revolves largely around the characters listed above. The book often jumps around in time to reveal the backstories of each character. But it does so succinctly and successfully. In the end, all the characters end up in the same room with different goals and an unexpected result.

Smith explores several conflicts including the struggle between immigrant assimilation and tradition to the role of race in society; the difficulty of parents and children to understand and relate to one another; and the meaning of religion in individual lives. She does so with a good story and with a witty prose, as in the following:

"Oh he loves her; just as the English loved India and Africa and Ireland; it is the love that is the problem, people treat their lovers badly."

I enjoyed the characters and I enjoyed the story.

White Teeth is one of the best novels I've read this year.


Weinberg-10A jukebox (for those too young to remember) was a machine filled with black vinyl discs - each containing a different song. They could be found in a lot of bars and diners and patrons could insert one or more coins and select the songs they wanted to hear.

Max Weinberg's Jukebox works on the same principle. A screen next to the stage continuously scrolled a list of almost 200 songs and Max periodically went into the audience to ask what people wanted to hear. And then he and his band played those requests.

Weinberg (for those too young to remember) rose to fame as the drummer of Bruce Springsteen's legendary E Street Band; and later led Conan O'Brien's house band for both the Late Show and the Tonight Show.

Max Weinberg opened his City Winery show Friday evening with Cream's "White Room" and Tom Petty's "American Girl" before soliciting requests from the audience. Anything on the scrolling list was fair game and the list was packed with classic rock favourites from The Beatles, The Who, The Stones, Springsteen (of course), and a host of others. Max played the drums and was accompanied by 2 guitarists and a bass player - each of which took turns singing lead.

In 2+ hours, I counted 26 songs performed by the band, including "Lola", "Drift Away", and "Me and Julio" - each delivered with tight playing, high-quality musicianship and great enthusiasm.

It was like listening to a really good bar cover band with one famous guy in it.

Weinberg-22They closed the night with a trio of high-energy Springsteen songs: "Pink Cadillac", "Dancing in the Dark", and "Glory Days". For the final song, Max invited audience members to join the band onstage.

A great concert (for those too young to remember) happens when both the audience and the performers enjoy themselves. This was one of those evenings.


More photos


Recently, I was working on a VM that someone else provided me and I needed to download an executable from the Internet onto this VM. I discovered that the only installed browser on the VM was Internet Explorer 11 and that the browser was configured to prevent anyone from downloading files from the Internet.

I don't know if this is the default setting for IE 11, but here is how to change the setting to allow users to download files.

Open Internet Explorer.

From the menu, select Tools | Internet Options

The "Internet Options" dialog displays. Select the "Security" tab, as shown in Fig. 1.

IE01
Fig. 1

Click the [Custom Level] button. The "Security Settings" dialog displays. Scroll down to the "Downloads/File download" section, as shown in Fig. 2.

IE02
Fig. 2

Select the "Enable" radio button and click the [OK] button. If prompted for confirmation, click [Yes].

Click the [OK] button to close the "Internet Options" dialog.

Now you can download files linked within the browser.


GCast 62:

Sentiment Analysis Cognitive Service

This video explains the Sentiment Analysis service, which is part of the Text Analytics Cognitive Service.


A data warehouse ("DW") is an ideal tool for collecting and associated disparate data.

A data warehouse has been a part of Microsoft SQL Server for decades, so it's not surprising that it is also included in Microsoft Azure.

To create a SQL Data Warehouse in Azure, navigate to the Azure Portal, sign in, and click the [Create a resource] button (Fig. 1).

dw01-CreateANewResourceButton
Fig. 1

From the menu, select Databases | SQL Data Warehouse, as shown in Fig. 2

dw02-SqlDataWarehouse
Fig. 2

The "SQL Data Warehouse" dialog displays, allowing you to enter information about your new data warehouse, as shown in Fig. 3

dw03-NewSqlDataWarehouse
Fig. 3

At the "Subscription" field, select the subscription in which you wish to create this data warehouse. Most of you will have only one subscription.

At the "Resource group" field, select an existing resource group or click the "Create new" link to create a new resource group in which to add this data warehouse. A resource group is an organizational unit to keep together related Azure resources.

At the "Data warehouse name" field, enter a unique name for your warehouse.

The "Server" field lists all SQL servers in the selected subscription. Every data warehouse is stored in one SQL Server. Select the SQL Server for this DW or click the "Create new" link to create a new SQL Server.

Clicking "Create new" displays the "New server" blade, as shown in Fig. 4. In this blade, you can enter the server name, location, and admin login credentials for a new server.

dw04-NewServer
Fig. 4

Click the [Review + create] button to display the "Review + create" tab of the "SQL Data Warehouse" dialog, as shown in Fig. 5.

dw05-ReviewCreate
Fig. 5

Click the [Create] button to create a new SQL Data Warehouse. This process may take a few minutes (longer if you also chose to create a new server).

After the Data Warehouse creation is complete, you can navigate to its management page. The "Overview" blade is shown in Fig. 6.

dw06-Overview
Fig. 6

In this article, you learned how to create a new Azure SQL Data Warehouse.


"Herzog" by Saul Bellow

Comments [0]

HerzogPoor Moses Herzog.

His wife convinced him to buy a house in Chicago; then tried to have him committed; then, left him for his best friend. On top of that, he is denied contact with either of his children.

Moses sets out for Chicago with his later father's antique pistol, 2 bullets, and murder on his mind. But nothing goes right, and his plans fall apart, and he is in an automobile accident and the police discover his loaded pistols.

The action does of Saul Bellow's Herzog does not happen until the novel is at least half over. But the author keeps us engaged through Moses's angst, as his life falls apart. Moses deals with his depression by writing letters - most of which are never sent and many of which are addressed to famous people such as Friedrich Nietzsche and (then-President) Dwight Eisenhower.

Herzog is unstable; but he is not crazy as his shrewish wife asserts. And his letter-writing decreases as he comes to terms with the cards he is dealt.

Bellow's writing is poignant and sad, but sometimes humorous, with lines such as

"Lead me into Penn Station"
and
"Will never understand what women want. What do they want? They eat green salad and drink human blood."

This book will appeal to anyone who has experienced the helplessness of a mid-life crisis; or the pain of betrayal; or the paralysis of uncertainty.


"Ubik" by Philip K. Dick

Comments [0]

UbikDeath is very different in the universe of Philip K. Dick's Ubik. Rather than simply ending life or transitioning to an afterlife, the recently dead remain cognizant. If properly preserved, technology exists that allows the living to communicate with the dead - sometimes for years. The consciousness slowly decays over time, after which the deceased finally cease to exist or are reborn anew.

Psychics are common enough in this universe to keep Glen Runciter busy. His company specializes in protecting people from psychic intrusion.

A group of powerful anti-psychics, led by Runciter, travel to the moon to meet with a potential client, where they are attacked and seemingly hurled back in time to the year 1939. But not everything is like the 1939 of their own past and they wonder exactly where they are.

Runciter is a good man and so is his employee Joe Chip. Chip is the perfect hero. He is loyal to his employer and dedicated to finding the truth; but he is financially irresponsible and always lacking funds (a problem when every appliance, device, and door requires a cash fee before it will operate).

Ubik is an imaginative tale of action and drama and speculative science fiction. Dick does an excellent job of taking far-fetched ideas and making them seem plausible. In under 250 pages he builds an entire world; then, destroys that world and creates another.

The story is both dark and humorous.

This novel influenced science fiction for many years after its 1969 publication. Douglas Adams must have read about the annoying talking doors when he wrote them into his Hitchhiker series. At times, we see nested realities, in a way that echoed in the 2010 film "Inception".

The narrative keeps changing our expectations. He keeps us guessing about reality versus illusion and life versus death and past versus present. And that's just the way Philip K. Dick wants it.


In the last article, I walked through the syntax of calling the Bing Spell Check service.

In this article, I will walk through a simple JavaScript application that calls this service.

If you want to follow along this sample is part of my Cognitive Services demos, which you can find on GitHub at https://github.com/DavidGiard/CognitiveSvcsDemos 

This project is found in the "SpellCheckDemo" folder.

Here is the main web page:

Listing 1:



    </span>Spell Check Demo<span style="color: rgb(0, 119, 0);">
    
    
    
     rel="stylesheet" href="css/site.css">

 
     

Spell Check Demo

id="TextToCheck">Life ig buuutiful all the tyme
id="SpellCheckButton">Check Spelling! id="NewTextDiv">
id="OutputDiv">

As you can see, the page consists of a text area with some misspelled text; a button; and 2 empty divs.

The page looks like this when rendered in a browser:

scjs01-PageOnLoad
Fig. 1

When the user clicks the button, we want to call the Spell Check service, sending it the text in the text area.

We want to display the values in the web service response in the OutputDiv div; and we want to display some of the raw information in the response in the NewTextDiv div.

Below is the screen after clicking the [Check Spelling] button

scjs02-PageAfterClick

Fig. 2

We need a reference to the outputDiv, so we can easily write to it.

Listing 2:

var outputDiv = document.getElementById("OutputDiv");
  

Next, we bind code to the button's click event, as shown in Listing 3.

Listing 3:

var spellCheckButton = document.getElementById("SpellCheckButton"); 
spellCheckButton.onclick = function () { 
    // Replace this with your Spell Check API key from Aure 
    var subscriptionKey = "xxxxxxxxxxxxxxxxxxxxxxxx"; 

    outputDiv.innerHTML = "Thinking...";

    var textToCheck = document.getElementById("TextToCheck").textContent; 
    var webSvcUrl = "https://api.cognitive.microsoft.com/bing/v7.0/spellcheck/?text=" + textToCheck; 
    webSvcUrl = webSvcUrl + "&mode=proof&mkt=en-US";

    var httpReq = new XMLHttpRequest(); 
    httpReq.open("GET", webSvcUrl, true); 
    httpReq.setRequestHeader("Ocp-Apim-Subscription-Key", subscriptionKey) 
    httpReq.setRequestHeader("contentType", "application/json") 
    httpReq.onload = onSpellCheckSuccess; 
    httpReq.onerror = onSpellCheckError; 
    httpReq.send(null); 
};
  

This code gets the text from the text area and makes an asynchronous HTTP GET request to the Spell Check API, passing the API key in the header. When the API sends a response, this will call the onSpellCheckSuccess or onSpellCheckError function, depending on the success of the call.

Listing 4 shows the onSpellCheckSuccess function:

Listing 4:

function onSpellCheckSuccess(evt) { 
    var req = evt.srcElement; 
    var resp = req.response; 
    var data = JSON.parse(resp);

    var flaggedTokens = data.flaggedTokens; 
    if (data.flaggedTokens.length > 0) { 
        var newText = document.getElementById("TextToCheck").textContent; 
        ; 
        var outputHtml = ""; 
         flaggedTokens.forEach(flaggedToken => { 
            var token = flaggedToken.token; 
            var tokenType = flaggedToken.type; 
            var offset = flaggedToken.offset; 
            var suggestions = flaggedToken.suggestions; 
            outputHtml += "
" outputHtml += "

Token: " + token + "

"
; outputHtml += "Type: " + tokenType + "
"
; outputHtml += "Offset: " + offset + "
"
; outputHtml += "
Suggestions
"
; outputHtml += "
    "; if (suggestions.length > 0) { suggestions.forEach(suggestion => { outputHtml += "
  • " + suggestion.suggestion; outputHtml += " (" + (suggestion.score * 100).toFixed(2) + "%)" }); outputHtml += "
"
; outputHtml += "
"
; newText = replaceTokenWithSuggestion(newText, token, offset, suggestions[0].suggestion) } else { outputHtml += "
  • No suggestions for this token
"
; } }); newText = "

New Text:

"
+ newText; var newTextDiv = document.getElementById("NewTextDiv"); newTextDiv.innerHTML = newText; outputHtml = "

Details

"
+ outputHtml; outputDiv.innerHTML = outputHtml; } else { outputDiv.innerHTML = "No errors found."; } };

As you can see, we parse out the JSON object from the response and retrieve each flaggedToken from that object. For each flaggedToken, we output information, such as the original text (or token), the tokenType, and suggested replacements, along with the score of each replacement.

If an error occurs when calling the API service, the onSpellCheckError function is called, as shown in Listing 5.

Listing 5:

function onSpellCheckError(evt) { 
    outputDiv.innerHTML = "An error has occurred!!!"; 
};
  

Finally, we replace each token with the first suggestion, using the code in Listing 6.

Listing 6*:

function replaceTokenWithSuggestion(originalString, oldToken, offset, newWord) { 
    var textBeforeToken = originalString.substring(0, offset);

    var textAfterToken = ""; 
    if (originalString.length > textBeforeToken.length + oldToken.length) { 
        textAfterToken = originalString.substring(offset + oldToken.length, originalString.length); 
    }

    var newString = textBeforeToken + newWord + textAfterToken;

    return newString; 
 }
  

Here is the full JavaScript:

Listing 7:

window.onload = function () {

    var outputDiv = document.getElementById("OutputDiv");
    // var subscriptionKey = getKey();

    var spellCheckButton = document.getElementById("SpellCheckButton");
    spellCheckButton.onclick = function () {
        var subscriptionKey = getKey();
        var textToCheck = document.getElementById("TextToCheck").textContent;

        var webSvcUrl = "https://api.cognitive.microsoft.com/bing/v7.0/spellcheck/?text=" + textToCheck;
        webSvcUrl = webSvcUrl + "&mode=proof&mkt=en-US";

        outputDiv.innerHTML = "Thinking...";

        var httpReq = new XMLHttpRequest();
        httpReq.open("GET", webSvcUrl, true);
        httpReq.setRequestHeader("Ocp-Apim-Subscription-Key", subscriptionKey)
        httpReq.setRequestHeader("contentType", "application/json")
        httpReq.onload = onSpellCheckSuccess;
        httpReq.onerror = onSpellCheckError;
        httpReq.send(null);
    };

    function onSpellCheckSuccess(evt) {
        var req = evt.srcElement;
        var resp = req.response;
        var data = JSON.parse(resp);

        var flaggedTokens = data.flaggedTokens;
        if (data.flaggedTokens.length > 0) {
            var newText = document.getElementById("TextToCheck").textContent;
            ;
            var outputHtml = "";
            flaggedTokens.forEach(flaggedToken => {
                var token = flaggedToken.token;
                var tokenType = flaggedToken.type;
                var offset = flaggedToken.offset;
                var suggestions = flaggedToken.suggestions;
                outputHtml += "
" outputHtml += "

Token: " + token + "

"
; outputHtml += "Type: " + tokenType + "
"
; outputHtml += "Offset: " + offset + "
"
; outputHtml += "
Suggestions
"
; outputHtml += "
    "; if (suggestions.length > 0) { suggestions.forEach(suggestion => { outputHtml += "
  • " + suggestion.suggestion; outputHtml += " (" + (suggestion.score * 100).toFixed(2) + "%)" }); outputHtml += "
"
; outputHtml += "
"
; newText = replaceTokenWithSuggestion(newText, token, offset, suggestions[0].suggestion) } else { outputHtml += "
  • No suggestions for this token
"
; } }); newText = "

New Text:

"
+ newText; var newTextDiv = document.getElementById("NewTextDiv"); newTextDiv.innerHTML = newText; outputHtml = "

Details

"
+ outputHtml; outputDiv.innerHTML = outputHtml; } else { outputDiv.innerHTML = "No errors found."; } }; function onSpellCheckError(evt) { outputDiv.innerHTML = "An error has occurred!!!"; }; function replaceTokenWithSuggestion(originalString, oldToken, offset, newWord) { var textBeforeToken = originalString.substring(0, offset); var textAfterToken = ""; if (originalString.length > textBeforeToken.length + oldToken.length) { textAfterToken = originalString.substring(offset + oldToken.length, originalString.length); } var newString = textBeforeToken + newWord + textAfterToken; return newString; } };

Hopefully, this sample gives you an idea how to get started building your first app that uses the Bing Spell Check API.



* This code currently has a bug in it: It only works if each suggestion is the same length as the token it replaces. I plan to fix this bug, but I'm publishing now because:

  1. It is not a fatal bug and
  2. It is not relevant to the call to the API, which is the primary point I'm showing in this article.

GCast 61:

Text Recognition C# Demo

In this video, I walk you through a C# application that calls the Text Recognition service, passing in an image of text and retrieving that text.


In the last article, I showed how to create a Bing Spell Check service in Azure. Once you have created this service, you can now pass text to a web service to perform spell checking.

Given a text sample, the service checks the spelling of each token in the sample. A token is a word or two word that should be a single word, such as "arti cle", which is a misspelling of the word "article".

It returns an array of unrecognized tokens, along with suggested replacements for these misspelled tokens.

URL and querystring arguments

The URL for the web service is
https://api.cognitive.microsoft.com/bing/v7.0/spellcheck

You can add some optional querystring parameters to this URL:

mode
Set this to "proof" if you want to check for spelling, grammar, and punctuation errors
Set it to "spell" if you only want to check for spelling errors.

If you omit the "mode" querystring argument, it defaults to "proof".

mkt
Set this to the Market Code of the country/language/culture you want to test. This is in the format [Language Code]-[Country Code], such as "en-US" for United States English. A full list of Market Codes can be fond here.

The "Proof" mode supports only en-US,  es-ES, and pt-BR Market Codes.

If you omit the mkt argument, the service will guess the market based on the text. Therefore, it is a good idea to include this value, even though it is optional.

Below is an example of a URL with some querystring values set.

https://api.cognitive.microsoft.com/bing/v7.0/spellcheck?mode=proof&mkt=en-us

POST vs GET

You have the option to submit either an HTTP POST or an HTTP GET request to the URL. We will discuss the differences below.

If you use the GET verb, you pass the text to check in the querystring, as in the following example:

https://api.cognitive.microsoft.com/bing/v7.0/spellcheck?mode=proof&mkt=en-us&text=Life+ig+buuutifull+all+the+tyme

With the GET method, the text is limited to 1,500 characters

If you use the POST verb, the text is passed in the body of the request, as in the following example:

text=Life+ig+buuutifull+all+the+tyme

With the POST method, you can send text up to 10,000 characters long.

Results

If successful, the web service will return an HTTP 200 ("OK") response, along with the following data in JSON format in the body of the response:

_type: "SpellCheck"

An array of "flaggedTokens", representing spelling errors found

Each flaggedToken consists of the following information:

  • offset: The position of the offending token within the text
  • token: The token text
  • type: The reason this token is in this list (usually "UnknownToken")
  • suggestion: An array of suggested replacements for the offending token. Each suggestion consists of the following:
  • score: a value (0-1) indicating the likelihood that this suggestion is the appropriate replacement

Below is an example of a response:

{
   "_type": "SpellCheck",
   "flaggedTokens": [{
     "offset": 5,
     "token": "ig",
     "type": "UnknownToken",
     "suggestions": [{
       "suggestion": "is",
       "score": 0.8922398888897022
     }]
   }, {
     "offset": 8,
     "token": "buuutifull",
     "type": "UnknownToken",
     "suggestions": [{
       "suggestion": "beautiful",
       "score": 0.8922398888897022
     }]
   }, {
     "offset": 27,
     "token": "tyme",
     "type": "UnknownToken",
     "suggestions": [{
       "suggestion": "time",
       "score": 0.8922398888897022
     }]
   }]
 }
  

In this article, I showed how to call the Bing Spell Check service with either a GET or POST HTTP request.


The Bing Spell Check API allows you to call a simple web service to perform spell checking on your text.

Before you get started, you must log into a Microsoft Azure account and create a new Bing Spell Check Service. Here are the steps to do this:

In the Azure Portal, click the [Create a resource] button (Fig. 1); then, search for and select "Bing Spell Check", as shown in Fig. 2.

sc01-CreateResourceButton
Fig. 1

sc02-SearchForBingSpellCheck
Fig. 2

The "Bing Spell Check" (currently on version 7) page displays, which describes the service and provides links to documentation and information about the service, as shown in Fig. 3

sc03-BingSpellCheckLandingPage
Fig. 3

Click the [Create] button to open the "Create" blade, as shown in Fig. 4.

sc04-CreateSpellCheckBlade
Fig. 4

At the "Name" field, enter a unique name for your service.

At the "Subscription" dropdown, select the subscription in which to create the service. Most of you will have only one subscription.

At the "Pricing Tier" dropdown, select the free or paid tier, as shown in Fig. 5.

sc05-PricingTiers
Fig. 5

The number of calls are severely limited for the free tier, so this is most useful for testing and learning the service. You may only create one free Spell Check service per subscription.

At the "Resource Group" field, select a resource group to associate with this service or click the "Create new" link to associate it with a newly-created resource group. A resource group provides a way to group together related service, making it easier to manage them together.

Click the [Create] button to begin creating the service. This process takes only a few seconds.

Open the service and select the "Keys" blade, as shown in Fig. 6.

sc06-KeysBlade
Fig. 6

Either one of the keys listed on this page must be passed in the header of your web service call.

Save a copy of one of these keys. You will need it when I show you how to call the Bing Spell Check Service in tomorrow’s article.


Episode 575

Kevin Gates on Cloud Architecture

Cloud Solution Architect Kevin Gates walks us through the architecture of a sample application migrated from on-premise to Azure.

http://www.dreaddontdie.com/


DeathComesForTheArchbishopDeath Comes for the Archbishop by Willa Cather follows the life of Bishop Jean Marie Latour, appointed to lead the new diocese of New Mexico, when the region is annexed by the United States, following the Mexican-American War.

Latour travels to New Mexico from his home in Ohio with his friend and colleague Joseph Vaillant. They encounter many challenges: the rough environment; the lack of roads; a clash of cultures; widespread poverty; murderers who prey on travelers; rogue priests; and those who refuse to recognize the transition of authority to the new archbishop.

In addition to the story of Latour, we hear other tales of the place and time where this novel takes place. One memorable story was of a drunken, ill-tempered priest, who killed a young Indian servant when the boy spilled some food on him. The priest was captured and killed by the locals a few days later.

The story is loosely best on the lives of Jean-Baptiste Lamy and Joseph Projectus Machebeuf, who served as Catholic Bishops in the southwest US during the mid-19th century.

Cather is at her best when describing the New Mexico sky and landscape. She tells a straightforward story without much fanfare and she does a good job of contrasting the personalities of the two missionaries: the stoic Latour and the outgoing Vaillant. Each man loves God and believes in their mission but tackles it in his own way.

Like most biographies, Death Comes for the Archbishop covers the main character’s life to the end. So, while the title comes from the last chapter, it is a bit misleading. The book is far more about the Archbishop's life than about his death. As Latour himself put it: "I shall not die of a cold, my son. I shall die of having lived."


TropicOfCancerI don't really know how to take Tropic of Cancer by Henry Miller.

The novel is written in the first person and the narrator has the same name as the author. So, am I to believe that Mr. Miller was a sex addict and all his friends were sex addicts and misogynists?

The story follows Miller and his friends - mostly bohemian American expatriates - as they navigate the squalid neighborhoods of Paris searching for sexual partners, artistic fulfillment, and survival. Miller tries to embrace the pleasures of life, sleeping with a variety of prostitutes and other women; but it is a challenge. He doesn't know where his next meal is coming from; but he is still focused on finding his next lay. His wife recently left for New York and he wonders why she has not communicated with him in the months since her departure. He expects her return, but it seems unlikely she will.

Still, it's difficult to feel sorry for Miller and his friends, as their descriptions are littered with misogyny. Virtually, every woman in the novel is referred to as a "c*nt" and most exist only as sexual outlets for Miller and his friends. In one scene, Miller steals his money back from a prostitute when she leaves the room after they have sex.

Many will dismiss this novel because of its strong sexual content. The writing is salacious and often shocking. Many men spend their youths focused on sex; and a few, like Miller, extend this obsession into middle age and this is his and their story.

Although very sexual, I cannot call this writing erotic. At no point did I find myself aroused by the exploits of Miller and his friends.

The novel has an important place in the history of literature. Its explicit sexuality pushed a lot of boundaries when it was first published in 1934. And it was banned as pornographic in the United States for 3 decades, until a 1961 obscenity trial that escalated to the Supreme Court. It is also significant culturally. One can hear Miller's strong influence on the beat writers of the 1950s and 1960s - from his stream-of-consciousness prose to his rejection of society's norms to his casual and frank discussion of alcohol and drug abuse. 

And this book is important for the prose that Miller brings to his writing. Here is how he describes his adopted city:

"Paris is like a whore. From a distance she seems ravishing, you can’t wait until you have her in your arms. And five minutes later you feel empty, disgusted with yourself. You feel tricked."

Tropic of Cancer is worth reading for its influence on literature and for its celebration of the joys of living.


GCast 60:

Text Recognition Cognitive Service with Binary Images

The Text Recognition Service supports sending a binary image and reading any text in that image. This video shows you how.


Santana-41Santana and the Doobie Brothers were two of my favourite bands as I was growing up in suburban Detroit. Sadly, I never had the chance to see either of them in concert. Until this week.

Both bands were on stage Sunday night at the Hollywood Casino Amphitheatre in Tinley Park.

DoobieBrothers-62The Doobie Brothers opened the show with an energetic performance - their trademark funky mix of rock, blues, country, and soul.

Michael McDonald is not part of the current Doobie lineup (a stand-in sang "Takin' It to the Streets"), but the last 1970s core of Tom Johnson, Patrick Simmons, and John McFee were there and this was the version of the band I first fell in love with. This was the first time I've ever seen a warmup act come out for an encore, but the audience loved it when they returned to play "Listen to the Music" and "Black Water" (my personal favourite).

DoobieBrothers-37After a brief intermission, the sun set, the lights dimmed, and Santana opened their set with "Soul Sacrifice", their percussion-heavy instrumental from their 1969 debut album.

The centerpiece of this band is and has always been Carlos Santana, from whom the band takes its name. But Carlos has always surrounded himself with excellent musicians and they proved their prowess tonight. Instrumentals alternated with vocal songs; hits alternated with deep cuts; ballads alternated with songs of high-energy and the band was great throughout. It was particularly special when Carlos took over with a guitar solo. At 72, he remains one of the world's great guitarists. He can showcase his technical prowess and bring emotion to his music.

Santana-76 Santana has been able to stay relevant through five decades by reinventing themselves - not only artistically, but also commercially.

He played to the audience between songs, mentioning the influence of Chicago Blues legend Otis Rush on the arrangement of "Black Magic Woman".

Santana-26 After an encore that included the 1999 mega-hit "Smooth", the band finally left the stage - over 4 hours after the show began.

This was my first visit to the Hollywood Casino Amphitheatre, my first time seeing the Doobie Brothers, and my first time seeing Santana. It was a night to remember.


More Santana photos

More Doobie Brothers photos


Episode 574

Mercedes Bernard on Dev Together

Mercedes Bernard started Dev Together to connect new software developers with mentors that would help them learn valuable skills. Over a year later, it is popular and spreading to other cities.


July 2019 Gratitudes

Comments [0]

8/4

Today I am grateful to attend my building's annual summer party yesterday.

8/3

Today I am grateful for the gym on the 70th floor of the Aon Center.

8/2

Today I am grateful for so many excellent taco places in Chicago.

8/1

Today I am grateful for my bicycle.

7/31

Today I am grateful to find $30 in an old jacket yesterday.

7/30

Today I am grateful to accidentally stumble across a Rev. Sekou concert last night at Millennium Park.

7/29

Today I am grateful for:

-Seeing Peter Frampton in concert last night with my son

-My first visit to Maxwell Street Market

7/28

Today I am grate for:

-an afternoon at the Field Museum with my son

-dinner with my sister-in-law, my nephews, and my sons last night.

7/27

Today I am grateful for 5 years living in Chicago.

7/26

Today I am grateful to see a show at Second City last night.

7/25

Today I am grateful for my first visit to the Tampa Museum of Art.

7/24

Today I am grateful for dinner last night in Tampa with Kevin and Judy.

7/23

Today I am grateful to speak at the Chicago Cloud Conference yesterday.

7/22

Today I am grateful for a weekend in Detroit.

7/21

Today I am grateful for:

-3rd row seats to see Jeff Lynne’s Electric Light Orchestra last night with old friends;

-The hospitality of Ken

7/20

Today I am grateful for:

-breakfast with Josh yesterday

-a chance to see my sister Debbie for the first time since she moved to Hawaii.

7/19

Today I am grateful to deliver a presentation on Azure Functions at Indy Software Artisans in Indianapolis last night - my first user group presentation of 2019!

7/18

Today I am grateful for dinner and drinks last night with Nick and Tim.

7/17

Today I am grateful my espresso machine is cleaned out and now producing a much tastier beverage much more quickly.

7/16

Today I am grateful to celebrate Emilija's birthday with her friends and family at a Costa Rican restaurant yesterday.

7/15

Today I am grateful for a day in Whitefish Bay, WI.

7/14

Today I am grateful to visit the Taste of Chicago last night.

7/13

Today I am grateful for a visit the National Hellenic Museum yesterday.

7/12

Today I am grateful for the 50 years we had with Denise before she left us 10 years ago today.

7/11

Today I am grateful that I finally figure out how to record TV shows and movies off DirectTV.

7/10

Today I am grateful to the Chicago Bicycle Company for fixing my bike seat yesterday.

7/9

Today I am grateful to work with high school students through the Northwestern Academy yesterday.

7/8

Today I am grateful to attend my first Joliet Slammers game yesterday, which concluded with an extra-inning walk-off RBI for the home team.


PortraitOfTheArtistA Portrait of the Artist as a Young Man is James Joyce's somewhat autobiographical novel. Joyce channels his own childhood and young adulthood through the character of Stephen Dedalus.

The book recounts young Stephen's school years, where he passes through a number of phases. He is at first intimidated by the older students, teachers, and priests at his school, struggling to fit in; later, he pursues the carnal pleasures of life; a sense of guilt turns him away from this life and he considers becoming a priest; after deciding against this, he begins to reject all society's values he grew up with and escapes to a life as an artist. These are major swings in a short time, but they are during his formative years, when Stephen is deciding who he will become. In the end, he turns away from the faith of his youth because so much of it was based on fear of damnation and a rejection of worldly pleasures, and he could not reconcile that with a love of beauty. In doing so, he rejects everything he knows to begin anew in a foreign place.

I don't know how much of Portrait applies to Joyce's own life, but he makes the novel personal, bringing us inside Stephen's mind as he struggles with his conflicts.

If you like books with a lot of action, skip this one. But if you like poetic writing and insights into the evolution of a philosophy, this book may be for you.


GCast 59:

Cognitive Services Text Recognition service

Learn to extract text from an image using the new Text Recognition service.


Frampton Remains Alive

Comments [0]

Frampton (6)A father and son sharing a passion is a wonderful thing.

Sunday night in Chicago, Jason Bonham's Led Zeppelin experience opened for Peter Frampton, where Jason played tribute to his father. Jason is the son of the late Zeppelin drummer John Bonham and he has assembled a group that sounds exactly like his father's band - down to the musical arrangements and a voice replica of Robert Plante.

Bonham's band would have been a great concert on its own, but the main attraction was Peter Frampton, the 69-year-old singer / guitarist, who recorded his first hit at the age of 18 with Humble Pie.

The thing I love about Peter Frampton is that he continued to evolve, without rejecting his past.

Frampton enjoyed his greatest commercial success in the 1970s, culminating with the recording and release of "Frampton Comes Alive" - Rolling Stone Magazine's 1976 album of the year.

Frampton (9)Sunday night in Chicago, Frampton drew extensively from his hits of that era - "Baby, I Love Your Way", "Do You Feel Like We Do", "Show Me the Way", ...), even opening with "Something's Happening", the song that opened his legendary live album; but he also exposed us to much of the new material on which he has been working the past 4 decades. He played from his cover of Soundgarden's "Black Hole Sun" from his Grammy-winning 2006 album "Fingerprints" and several tracks from his recent "All Blues" album.

Between songs, he charmed us with stories of his career and the musicians with whom he has interacted.

His 3-song encore consisted of songs from "Humble Pie", the band he co-founded at the age of 18.

No artist has become more associated with the Talk Box than Peter Frampton and he used it in this show - but sparingly enough that it remained fresh and not just a gimmick to prop up his songs.

DGAndTimThis was Frampton's final tour. He is retiring due to a diagnosed with a degenerative muscle disorder that will ultimately impair his ability to play guitar. But there was no evidence of any health problems at this show. His energy was high, and his playing was flawless. He and his band were on stage for nearly 2 hours.

I was excited to finally see Peter Frampton in concert - decades after originally discovering his music. And more excited that I shared the experience with my 25-year-old son, who seemed by far the youngest attendee.

A father and son sharing a passion is a wonderful thing.


Episode 573

Ruth Yakubu on Machine Learning tools in Azure

Cloud Developer Advocate Ruth Yakubu describes Machine Learning Services and other new ML tools available in Azure.


HandfulOfDustTony Last appears to have a good life. He is are young and wealthy and married to a beautiful woman and he enjoys spending time at his family's country home. But Tony's wife Brenda is unfaithful; Tony is the only one unaware of Brenda's affair with John Beaver, the dull and lazy son of a well-to-do businesswoman.

Tony's biggest mistake is that he trusts his wife and expects she will soon spend more time at home, instead of traveling to London every weekend. As a result, he is unprepared when he learns of her betrayal. When she demands a divorce, he leaves his home in England, completely abandoning his comfort zone to cross the ocean and to search for a lost city in South America.

None of the characters are particularly likeable. Most are concerned with the self-absorbed, meaningless social life of 1930s high society England. Even Tony, for whom the reader feels the most sympathy, is shallow and too comfortable to ever consider leaving home until he is shocked into doing so by his impending divorce. Brenda, of course, is horrible. Not only is she cheating on her devoted husband; she cares so little for their young son that she expresses relief when she hears of his death, because she initially feared she was learning of the death of her lover.

The final third of the novel, in which Tony struggles through the South American jungles, seem a departure from the rest of the novel; but this section underscore how  much Tony's life has been turned upside down by the betrayal of a frivolous wife.

Evelyn Waugh's talent for satire is on full display in this A Handful of Dust. He mocks the English upper class, exposing many of them as frivolous, selfish, and cold-hearted.

This was an uncomfortable novel for me. Tony reminded me too much of my younger self, when I placed trust in someone I should not have. When I was betrayed, I was paralyzed by my own indecision, waiting for her to come to her senses. Like Tony, I was too focused inward and on my past and on my own comfortable routine to recognize what was happening and to prevent it. Tony's quest ended when he ran far from home, placing his trust in an incompetent explorer - a decision that cost him his freedom and his life deep in the Brazilian rain forest.

Hopefully, I am now smarter and have learned better than Tony how to control my own destiny.


MrsDallowayNothing much happens in Virginia Woolf's Mrs. Dalloway\.

The entire book takes place on a single day in 1923 London. Clarissa Dalloway is preparing to host an evening dinner party; and Septimus Warren Smith is contemplating suicide, as he reflects on his experience fighting in World War I and watching his best friend Evans die shortly before the armistice. Septimus's wife Lucrezia wonders why he acts so strangely when the doctor said there is nothing wrong with him.

For every few lines of conversation, we get many paragraphs of inner monologue.

Mostly, the story consists of flashbacks: Septimus recalls his friendship with Evans and Clarissa remembers her old lover Peter (to whom she refused marriage, settling instead on the government bureaucrat Richard Dalloway) and her friend Sally (with whom she once shared a romantic kiss). The day is complicated when Peter shows up after years in India.

Septimus and Clarissa never meet in the novel, but they are tied together by their obsession with their own past and by a long-past relationship with a same-sex friend.

We also get glimpses into the lives and minds of other people - primarily through their connections with Clarissa Dalloway, even though that connection is often quite thin.

Woolf's stream-of-consciousness writing style and the lack of present-day action sometimes makes the book difficult to follow.

We shift from the thoughts of one person to another; and from the present to the past. It's all very confusing. But pay close attention. And we get commentaries on a wide range of topics:

  • The role and status of marriage in society: A woman attains higher status by marrying, but she loses much of her identity to her husband
  • Society's attitudes toward mental illness, specifically PTSD suffered by veterans
  • The effect our past choices and circumstances have on current lives
  • The inevitable movement of time and the importance of how we spend it
  • The shallow lifestyle embraced by many in high society.

There is much to absorb here. And Ms. Woolf's prose is enjoyable.


GCast 58:

Creating and Deploying Azure Resources with ARM Templates

Learn how to generate an ARM template and use it to create and deploy resources to Azure.


DeliveranceFour middle-class suburbanites decide to get away from society for a weekend. They hope to break the tedium of their daily lives and paddle through the uncharted rivers in the hills of Georgia.

But on the second day, they are attacked, rescued, and further terrorized.

With no one to help them, they take matters into their own heads, resulting in a legal and moral crisis.

This is the scenario of James Dickey's novel Deliverance.

It is a story of survival and suspense and ambiguity and self-doubt; of the power of nature; and the brutality of man.

Dickey does a masterful job shifting between descriptions of the power and beauty of nature and building tension within the story.

I read the book in a single sitting. By the end of the it, I was emotionally drained. Dickey is known mostly as a poet, but this novel takes us on a dark and deadly journey that is impossible to forget. The attack in the book became one the most memorable scenes in movie history, when John Boorman turned the novel into a movie 2 years later.

Set aside some time to read this novel and ask yourself: What would you do in these circumstances?


Databricks Articles

Comments [0]

GCast 57:

Azure Data Factory GitHub Deployment

Learn how to set up automated deployment from a GitHub repository to an Azure Data Factory.


In a recent article, I introduced you to the "Recognize Text" API that returns the text in an image - process known as "Optical Character Recognition", or "OCR".

In this article, I will show how to call this API from a .NET application.

Recall that the "Recognize Text" API consists of two web service calls:

We call the "Recognize Text" web service and pass an image to begin the process.

We call the "Get Recognize Text Operation Result" web service to check the status of the processing and retrieive the resulting text, when the process is complete.

The sample .NET application

If you want to follow along, the code is available in the RecognizeTextDemo found in this GitHub repository.

To get started, you will need to create a Computer Vision key, as described here.

Creating this service gives you a URI endpoint to call as a web service, and an API key, which must be passed in the header of web service calls.

The App

To run the app, you will need to copy the key created above into the App.config file. Listing 1 shows a sample config file:

Listing 1:


   
      key="ComputerVisionKey" value="5070eab11e9430cea32254e3b50bfdd5" />
   
 
  

You will also need an image with some text in it. For this demo, we will use the image shown in Fig. 1.

rt01-Kipling
Fig. 1

When you run the app, you will see the screen in Fig. 2.

rt02-Form1
Fig. 2

Press the [Get File] button and select the saved image, as shown in Fig. 3.

rt03-SelectImage
Fig. 3

Click the [Open] button. The Open File Dialog closes, the full path of the image is displays on the form, and the [Start OCR] button is enabled, as shown in Fig. 4.

rt04-Form2
Fig. 4

Click the [Start OCR] button to call a service that starts the OCR. If an error occurs, it is possible that you did not configure the key correctly or that you are not connected to the Internet.

When the service call returns, the URL of the "Get Text" service displays (beneath the "Location Address" label), and the [Get Text] button is enabled, as shown in Fig. 5.

rt05-Form3
Fig. 5

Click the [Get Text] button. This calls the Location Address service and displays the status. If the status is "Succeeded", it displays the text in the image, as shown in Fig. 6.

rt06-Form4
Fig. 6

## The code

Let's take a look at the code in this application. It is all written in C#. The relevant parts are the calls to the two web service: "Recognize Text" and "Get Recognize Text Operation Result". The first call kicks off the OCR job; the second call returns the status of the job and returns the text found, when complete.

The code is in the TextService static class.

This class has a constant: visionEndPoint, which is the base URL of the Computer Vision Cognitive Service you created above. The code in the repository is in Listing 2. You may need to modify the URL, if you created your service in a different region.

Listing 2:

const string visionEndPoint = "https://westus.api.cognitive.microsoft.com/";
  

### Recognize Text

The call to the "Recognize Text" API is in Listing 1:

Listing 3:

public static async Task<string> GetRecognizeTextOperationResultsFromFile(string imageLocation, string computerVisionKey)
{
    var cogSvcUrl = visionEndPoint + "vision/v2.0/recognizeText?mode=Printed";
    HttpClient client = new HttpClient();
    client.DefaultRequestHeaders.Add("Ocp-Apim-Subscription-Key", computerVisionKey);
    HttpResponseMessage response;
    // Convert image to a Byte array
    byte[] byteData = null;
    using (FileStream fileStream = new FileStream(imageLocation, FileMode.Open, FileAccess.Read))
    {
        BinaryReader binaryReader = new BinaryReader(fileStream);
        byteData = binaryReader.ReadBytes((int)fileStream.Length);
    }

    // Call web service; pass image; wait for response
    using (ByteArrayContent content = new ByteArrayContent(byteData))
    {
        content.Headers.ContentType = new MediaTypeHeaderValue("application/octet-stream");
        response = await client.PostAsync(cogSvcUrl, content);
    }

    // Read results
    RecognizeTextResult results = null;
    if (response.IsSuccessStatusCode)
    {
        var data = await response.Content.ReadAsStringAsync();
        results = JsonConvert.DeserializeObject(data);
    }
    var headers = response.Headers;
    var locationHeaders = response.Headers.GetValues("Operation-Location");
    string locationAddress = "";
    IEnumerable<string> values;
    if (headers.TryGetValues("Operation-Location", out values))
    {
        locationAddress = values.First();
    }
    return locationAddress;
}
  

The first thing we do is construct the specific URL of this service call.

Then we use the System.Net.Http library to submit an HTTP POST request to this URL, passing in the image as an array of bytes in the body of the request. For more information on passing a binary file to a web service, see this article.

When the response returns, we check the headers for the "Operation-Location", which is the URL of the next web service to call. The URL contains a GUID that uniquely identifies this job. We save this for our next  call.

Get Recognize Text Operation Result

After kicking of the OCR, we need to call a different service to check the status and get the results. The code in Listing 4 does this.

Listing 4:

public static async Task GetRecognizeTextOperationResults(string locationAddress, string computerVisionKey) 
 { 
    var client = new HttpClient(); 
    client.DefaultRequestHeaders.Add("Ocp-Apim-Subscription-Key", computerVisionKey); 
    var response = await client.GetAsync(locationAddress); 
    RecognizeTextResult results = null; 
    if (response.IsSuccessStatusCode) 
    { 
        var data = await response.Content.ReadAsStringAsync(); 
        results = JsonConvert.DeserializeObject(data); 
    } 
    return results; 
 }
  

This code is much simpler because it is an HTTP GET and we don't need to pass anything in the request body.

We simply submit an HTTP GET request and use the Newtonsoft.Json libary to convert the response to a string.

Here is the complete code in the TextService class:

Listing 5:

using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using System.Threading.Tasks;
using TextLib.Models;

namespace TextLib
{

    public static class TextService
    {
        const string visionEndPoint = "https://westus.api.cognitive.microsoft.com/";

public static async Task<string> GetRecognizeTextOperationResultsFromFile(string imageLocation, string computerVisionKey)
{
    var cogSvcUrl = visionEndPoint + "vision/v2.0/recognizeText?mode=Printed";
    HttpClient client = new HttpClient();
    client.DefaultRequestHeaders.Add("Ocp-Apim-Subscription-Key", computerVisionKey);
    HttpResponseMessage response;
    // Convert image to a Byte array
    byte[] byteData = null;
    using (FileStream fileStream = new FileStream(imageLocation, FileMode.Open, FileAccess.Read))
    {
        BinaryReader binaryReader = new BinaryReader(fileStream);
        byteData = binaryReader.ReadBytes((int)fileStream.Length);
    }

    // Call web service; pass image; wait for response
    using (ByteArrayContent content = new ByteArrayContent(byteData))
    {
        content.Headers.ContentType = new MediaTypeHeaderValue("application/octet-stream");
        response = await client.PostAsync(cogSvcUrl, content);
    }

    // Read results
    RecognizeTextResult results = null;
    if (response.IsSuccessStatusCode)
    {
        var data = await response.Content.ReadAsStringAsync();
        results = JsonConvert.DeserializeObject(data);
    }
    var headers = response.Headers;
    var locationHeaders = response.Headers.GetValues("Operation-Location");
    string locationAddress = "";
    IEnumerable<string> values;
    if (headers.TryGetValues("Operation-Location", out values))
    {
        locationAddress = values.First();
    }
    return locationAddress;
}

        public static async Task GetRecognizeTextOperationResults(string locationAddress, string computerVisionKey)
        {
            var client = new HttpClient();
            client.DefaultRequestHeaders.Add("Ocp-Apim-Subscription-Key", computerVisionKey);
            var response = await client.GetAsync(locationAddress);
            RecognizeTextResult results = null;
            if (response.IsSuccessStatusCode)
            {
                var data = await response.Content.ReadAsStringAsync();
                results = JsonConvert.DeserializeObject(data);
            }
            return results;
        }

    }
}
  

The remaining code

There is other code in this application to do things like select the file from disk and loop through the JSON to concatenate all the text; but this code is very simple and (hopefully) self-documenting. You may choose other ways to get the file and handle the JSON in the response.

In this article, I've focused on the code to manage the Cognitive Services calls and responses to those calls in order to get the text from a picture of text.


Sometimes a web service requires us to pass a binary file, such as an image in the request body.

To do this, we need to submit the request with the POST verb, because other verbs - most notably "GET" - do not contain a body.

One simple web service that accepts a binary file is the Cognitive Services Image Analysis API. This API is fully documented here.

I created a console application (the simplest .NET app I can think of) to demonstrate how to pass the binary image to the web service. This application is named "ImageAnalysisConsoleAppDemo" and is included in my Cognitive Services demos, which you can download here.

Assumptions

Before you get started, you will need to create a Computer Vision Cognitive Service, as described here.

I have hard-coded the file name and location, along with the Cognitive Services URL, but you can change these to match what you are using. You will also need to add your API key to the App.config file.

The code

The first thing we need to do is to read the file and convert it into an array of bytes. The code to do this is in Listing 1 below.

Listing 1:

byte[] byteData; ;
using (FileStream = new FileStream(imageFilePath, FileMode.Open, FileAccess.Read))
{
    BinaryReader = new BinaryReader(fileStream);
    byteData = binaryReader.ReadBytes((int)fileStream.Length);
}
  

Next, we call the web service, passing the byte array. The System.Net.Http client library helps us to make this call. Notice the "using" construct that converts the byte array into a ByteArrayContent object that is required by the library.

Within that "using", we make an asynchronous call to the web service and capture the results.

Listing 2 shows this code.

Listing 2:

var cogSvcUrl = "https://westus.api.cognitive.microsoft.com/vision/v2.0/analyze?visualFeatures=Description&language=en"; 
HttpClient client = new HttpClient(); 
client.DefaultRequestHeaders.Add("Ocp-Apim-Subscription-Key", computerVisionKey); 
HttpResponseMessage response; 
using (ByteArrayContent content = new ByteArrayContent(byteData)) 
{ 
    content.Headers.ContentType = new MediaTypeHeaderValue("application/octet-stream"); 
    response = await client.PostAsync(cogSvcUrl, content); 
}
  

Finally, we convert the results to a string, as shown in Listing 3. This web service returns JSON containing either information about the image or an error message.

Listing 3:

string webServiceResponseContent = await response.Content.ReadAsStringAsync();
  

Here is the full code:

Listing 4:

using System;
using System.Configuration;
using System.IO;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Threading.Tasks;

namespace ImageAnalysisConsoleAppDemo
{
    class Program
    {
        static void Main(string[] args)
        {
            MainAsync().Wait();
            Console.ReadLine();
        }

        static async Task MainAsync()
        {
            string key = GetKey();
            string imageFilePath = @"c:\test\kittens.jpg";
            if (!File.Exists(imageFilePath))
            {
                Console.WriteLine("File {0} does not exist", imageFilePath);
                return;
            }
            string results = await GetRecognizeTextOperationResultsFromFile(imageFilePath, key);
            Console.WriteLine(results);
        }


        public static async Task<string> GetRecognizeTextOperationResultsFromFile(string imageFilePath, string computerVisionKey)
        {
            // Convert file into Byte Array
            byte[] byteData; ;
            using (FileStream fileStream = new FileStream(imageFilePath, FileMode.Open, FileAccess.Read))
            {
                BinaryReader binaryReader = new BinaryReader(fileStream);
                byteData = binaryReader.ReadBytes((int)fileStream.Length);
            }

            // Make web service call. Pass byte array in body
            var cogSvcUrl = "https://westus.api.cognitive.microsoft.com/vision/v2.0/analyze?visualFeatures=Description&language=en";
            HttpClient client = new HttpClient();
            client.DefaultRequestHeaders.Add("Ocp-Apim-Subscription-Key", computerVisionKey);
            HttpResponseMessage response;
            using (ByteArrayContent content = new ByteArrayContent(byteData))
            {
                content.Headers.ContentType = new MediaTypeHeaderValue("application/octet-stream");
                response = await client.PostAsync(cogSvcUrl, content);
            }

            // Get results
            string webServiceResponseContent = await response.Content.ReadAsStringAsync();
            return webServiceResponseContent;
        }

        public static string GetKey()
        {
            string computerVisionKey = ConfigurationManager.AppSettings["ComputerVisionKey"];
            return computerVisionKey;
        }

    }
}
  

Fig. 1 shows the output when analyzing the image displayed in Fig. 2 (saved in “c:\test\kittens.jpg”).

AnalyzeImage
Fig. 1

Kittens
Fig. 2

This code is not complex, but it is not intuitive (at least not, to me). So, it's useful to understand how to write C# code to pass a binary file to a web service.


<< Older Posts | Newer Posts >>