Shared posts

11 May 00:21

Dê uma chance a Doctest

by brandizzi

Um dos meus módulos Python preferidos é doctest. Com ele, é possível executar trechos de código inseridos em documentação. Você poderia, por exemplo, escrever algo assim no seu arquivo turorial.md

>>> f()
1

…e executar python -mdoctest tutorial.md. Se f() retornar 1, nada acontecerá. Se retornar algo diferente, porém, aparecerá uma mensagem de erro similar a esta:


**********************************************************************
File “f.txt”, line 2, in f.txt
Failed example:
f()
Expected:
1
Got:
2
**********************************************************************
1 items had failures:
1 of 2 in f.txt
***Test Failed*** 1 failures.

É uma ferramenta impressionante, mas também é impopular. O problema é que Doctest é frequentemente utilizado de maneira inadequada. Por exemplo, é comum tentar escrever testes unitários como doctests. Grande erro!

Ainda assim, considero injusto desconsiderar o módulo devido a estes enganos. Doctest pode, e deve, ser usado para o que faz melhor: manter sua documentação viva, e até guiar seu desenvolvimento!

Deixe-me mostrar um exemplo.

Quando não se sabe o que fazer

Esses dias, estava escrevendo uma classe que alteraria um documento HTML utilizando xml.dom.minidom. Em um determinado momento, eu precisava de uma função que mapeasse classes CSS para nodes do documento. Esta seria uma função bem complicada por si só! Não sabia por onde começar.

Teoricamente, testes unitários seriam úteis aqui. Só não seriam tão práticos: esta era uma função interna, privada, um detalhe de implementação. Para testá-la, ela teria de ser exposta. Também precisaríamos de um novo arquivo para os testes. E, afinal, test cases não são tão legíveis.

Lendo a documentação do futuro

Ao invés disso, documentei a função primeiro. Escrevi um paragrafozinho informando o que ela faria. Só isso já clareou minha mente um pouco:

Given an xml.dom.minidom.Node, returns a map
from every “class” attribute to a list of nodes
with this class.

Então, pensei em como escrever a mesma coisa, mas como um exemplo de código. Na minha cabeça, esta função (que chamei de get_css_class_dict()) receberia um documento xml.dom.minidom. Então, criei um de exemplo:

Dado este exemplo, eu esperaria que a função retornasse um dicionário. Meu documento tem duas classes, “a” e “b”, e portanto o dicionário teria duas chaves. Cada chave teria uma lista dos nós que possuíssem tais classes. Algo mais ou menos assim:

Coloquei esses rascunhos na docstring de get_css_class_dict(). O resultado até agora foi essa função:

Dava para fazer algo similar com testes unitários, mas haveria muito mais código à volta, poluindo a documentação. Além disso,  a prosa graciosamente complementa o código, dando ritmo à leitura.

Executo os doctests, e o resultado é esse:

Basicamente, estou seguindo test-driven development, mas com documentação executável. Consegui, de uma vez, um exemplo legível e um teste básico.

Agora basta implementar a função! Usei recursão e, se o código não ficou o mais sucinto possível de primeira…

…ao menos funciona como esperado:

Opa, espere aí! O que foi isso?!

Quando a documentação erra

Pois bem, há um errozinho no meu doctest! O span não possui a classe b: é o div que a possui. Basta alterar a linha

[<DOM Element: span at ...>]

para

[<DOM Element: div at ...>]

e o doctest passará.

Não é uma maravilha? Descobri quase imediatamente um deslize na documentação. Mais que isto: se algum dia o comportamento da minha função mudar, o exemplo da minha docstring vai falhar! Saberei exatamente onde a documentação precisará de atualizações.

Fazendo doctests valerem a pena

Esta é a razão de ser de doctest. Nossa documentação possuía um erro sutil, e ao executá-la pudemos percebê-lo. Doctests não garantem a corretude do código; doctests garantem a corretude da documentação. É um aspecto bem compreendido do pacote, mas poucas pessoas parecem acreditar que isto valha a pena.

Eu acho que vale! Documentação tem a fama de ser um trabalho desagradável, mas não precisa ser. Assim como TDD torna testes mais empolgantes, é possível tornar documentação divertida com doctests.

Além disso, do mesmo modo que dificuldades com TDD indicam limitações de design, dificuldades em escrever doctest apontam para problemas na API. Se foi difícil escrever um exemplo conciso e claro, cercado de prosa, para sua API, ela provavelmente é complicada demais, não é?

Dê uma chance a Doctest

No final, entendo as restrições de doctests. São inadequados para testes unitários, por exemplo. Entretanto, doctest torna tão fácil e divertido documentar! Não entendo por que continua tão impopular.

Ainda assim, a maior vantagem para mim é como doctest torna o processo de desenvolvimento mais fácil. Há um tempo atrás, brinquei que deveríamos criar o DocDD (documentation-driven development):

Com Doctest, isto não é apenas uma brincadeira.

10 May 12:24

Dê uma chance a Doctest

by brandizzi

Um dos meus módulos Python preferidos é doctest. Com ele, é possível executar trechos de código inseridos em documentação. Você poderia, por exemplo, escrever algo assim no seu arquivo turorial.md

>>> f()
1

…e executar python -mdoctest tutorial.md. Se f() retornar 1, nada acontecerá. Se retornar algo diferente, porém, aparecerá uma mensagem de erro similar a esta:


**********************************************************************
File “f.txt”, line 2, in f.txt
Failed example:
f()
Expected:
1
Got:
2
**********************************************************************
1 items had failures:
1 of 2 in f.txt
***Test Failed*** 1 failures.

É uma ferramenta impressionante, mas também é impopular. O problema é que Doctest é frequentemente utilizado de maneira inadequada. Por exemplo, é comum tentar escrever testes unitários como doctests. Grande erro!

Ainda assim, considero injusto desconsiderar o módulo devido a estes enganos. Doctest pode, e deve, ser usado para o que faz melhor: manter sua documentação viva, e até guiar seu desenvolvimento!

Deixe-me mostrar um exemplo.

Quando não se sabe o que fazer

Esses dias, estava escrevendo uma classe que alteraria um documento HTML utilizando xml.dom.minidom. Em um determinado momento, eu precisava de uma função que mapeasse classes CSS para nodes do documento. Esta seria uma função bem complicada por si só! Não sabia por onde começar.

Teoricamente, testes unitários seriam úteis aqui. Só não seriam tão práticos: esta era uma função interna, privada, um detalhe de implementação. Para testá-la, ela teria de ser exposta. Também precisaríamos de um novo arquivo para os testes. E, afinal, test cases não são tão legíveis.

Lendo a documentação do futuro

Ao invés disso, documentei a função primeiro. Escrevi um paragrafozinho informando o que ela faria. Só isso já clareou minha mente um pouco:

Given an xml.dom.minidom.Node, returns a map
from every “class” attribute to a list of nodes
with this class.

Então, pensei em como escrever a mesma coisa, mas como um exemplo de código. Na minha cabeça, esta função (que chamei de get_css_class_dict()) receberia um documento xml.dom.minidom. Então, criei um de exemplo:

Dado este exemplo, eu esperaria que a função retornasse um dicionário. Meu documento tem duas classes, “a” e “b”, e portanto o dicionário teria duas chaves. Cada chave teria uma lista dos nós que possuíssem tais classes. Algo mais ou menos assim:

Coloquei esses rascunhos na docstring de get_css_class_dict(). O resultado até agora foi essa função:

Dava para fazer algo similar com testes unitários, mas haveria muito mais código à volta, poluindo a documentação. Além disso,  a prosa graciosamente complementa o código, dando ritmo à leitura.

Executo os doctests, e o resultado é esse:

Basicamente, estou seguindo test-driven development, mas com documentação executável. Consegui, de uma vez, um exemplo legível e um teste básico.

Agora basta implementar a função! Usei recursão e, se o código não ficou o mais sucinto possível de primeira…

…ao menos funciona como esperado:

Opa, espere aí! O que foi isso?!

Quando a documentação erra

Pois bem, há um errozinho no meu doctest! O span não possui a classe b: é o div que a possui. Basta alterar a linha

[<DOM Element: span at ...>]

para

[<DOM Element: div at ...>]

e o doctest passará.

Não é uma maravilha? Descobri quase imediatamente um deslize na documentação. Mais que isto: se algum dia o comportamento da minha função mudar, o exemplo da minha docstring vai falhar! Saberei exatamente onde a documentação precisará de atualizações.

Fazendo doctests valerem a pena

Esta é a razão de ser de doctest. Nossa documentação possuía um erro sutil, e ao executá-la pudemos percebê-lo. Doctests não garantem a corretude do código; doctests garantem a corretude da documentação. É um aspecto bem compreendido do pacote, mas poucas pessoas parecem acreditar que isto valha a pena.

Eu acho que vale! Documentação tem a fama de ser um trabalho desagradável, mas não precisa ser. Assim como TDD torna testes mais empolgantes, é possível tornar documentação divertida com doctests.

Além disso, do mesmo modo que dificuldades com TDD indicam limitações de design, dificuldades em escrever doctest apontam para problemas na API. Se foi difícil escrever um exemplo conciso e claro, cercado de prosa, para sua API, ela provavelmente é complicada demais, não é?

Dê uma chance a Doctest

No final, entendo as restrições de doctests. São inadequados para testes unitários, por exemplo. Entretanto, doctest torna tão fácil e divertido documentar! Não entendo por que continua tão impopular.

Ainda assim, a maior vantagem para mim é como doctest torna o processo de desenvolvimento mais fácil. Há um tempo atrás, brinquei que deveríamos criar o DocDD (documentation-driven development):

Com Doctest, isto não é apenas uma brincadeira.

03 May 10:45

Que loucura é o dinheiro

by Will Tirando

03 May 10:39

innovation risk

by tomfishburne

Glass Half Full

New ideas inherently carry risk. And there’s often friction between the risk profiles of our ideas and the risk tolerances of our organization. How we navigate and manage that friction impacts what, if anything, makes it through the gauntlet of the innovation process.

Risk tolerance can vary across different parts of the business. Ultimately we need all of these different points of view to sense-check ideas as we collectively bring them to life. All of those different perspectives can make an idea stronger. But silo-thinking often gets in the way.

Your Ad Ignored Here
"If marketing kept a diary, this would be it."
- Ann Handley, Chief Content Officer of MarketingProfs
Order Now

Years ago, I saw innovation legend Doug Hall lead a workshop on managing risks. He had a few words of advice that stuck with me:

“Meaningfully unique ideas spark fear. Fear causes shut down. The secret to reducing fear is to make the unknown known. We need to turn killer issues into manageable threats”

Here are a few related ideas that I’ve drawn over the years.

Compromise with Legal” June 2011

Safe is Risky” July 2014

Lifecycle of Innovation” November 2002

(Thanks to my old colleague Jon Overlie who first inspired a glass half full cartoon idea years ago).

29 Apr 11:25

Julie d'Aubigny - Wikipedia

by brandizzi
Julie d’Aubigny
Mademoiselle Maupin de l'Opéra (Julie d'Aubigny).jpg
"Mademoiselle Maupin de l'Opéra".
Anonymous print, ca. 1700.
Born 1670/1673
Died 1707 (age c. 33)
Nationality French
Spouse(s) Sieur de Maupin
Relatives Gaston d'Aubigny (father)

Julie d'Aubigny (1670/1673–1707), better known as Mademoiselle Maupin or La Maupin, was a 17th-century swordswoman and opera singer. Her tumultuous career and flamboyant life were the subject of gossip and colourful stories in her own time, and inspired numerous portrayals afterwards. Théophile Gautier loosely based the title character, Madeleine de Maupin, of his novel Mademoiselle de Maupin (1835) on her.

Early life

Julie d'Aubigny was born in 1673[1] to Gaston d'Aubigny, a secretary to Louis de Lorraine-Guise, comte d'Armagnac, the Master of the Horse for King Louis XIV. Her father trained the court pages, and so his daughter learned dancing, reading, drawing, and fencing alongside the pages, and dressed as a boy from an early age.[2] In 1687, the Count d'Armagnac took her for his "mistress" when she was barely fourteen years old. He then had her married to Sieur de Maupin of Saint-Germain-en-Laye, and she became Madame de Maupin (or simply "La Maupin" per French custom). Soon after the wedding, her husband received an administrative position in the south of France, but the Count kept her in Paris.

Youth and wild reputation

The fictional Mademoiselle de Maupin, from Six Drawings Illustrating Théophile Gautier's Romance Mademoiselle de Maupin by Aubrey Beardsley, 1898

Also around 1687, La Maupin became involved with an assistant fencing master named Sérannes. When Lieutenant-General of Police Gabriel Nicolas de la Reynie tried to apprehend Sérannes for killing a man in an illegal duel, the pair fled the city to Marseille.

On the road south, La Maupin and Sérannes made a living by giving fencing exhibitions and singing in taverns and at local fairs. While travelling and performing in these impromptu shows, La Maupin dressed in male clothing but did not conceal her gender. On arrival in Marseille, she joined the opera company run by Pierre Gaultier, singing under her maiden name.

Eventually, she grew bored of Sérannes and became involved with a young woman. When the girl's parents put her away in the Visitandines convent in Avignon, La Maupin followed, entering the convent as a postulant. In order to run away with her new love, she stole the body of a dead nun, placed it in the bed of her lover, and set the room on fire to cover their escape.[3] Their affair lasted for three months before the young woman returned to her family. La Maupin was charged in absentia—as a male—with kidnapping, body snatching, arson, and failing to appear before the tribunal. The sentence was death by fire.

La Maupin left for Paris and again earned her living by singing. Near Poitiers, she met an old actor named Maréchal who began to teach her until his alcoholism got worse and he sent her on her way to Paris.[4]

In Villeperdue, still wearing men's clothing, she was insulted by a young nobleman. They fought a duel and she drove her blade through his shoulder. The next day, she asked about his health and found out he was Louis-Joseph d'Albert Luynes, son of the Duke of Luynes. Later, one of his companions came to offer d'Albert's apologies. She went to his room and subsequently they became lovers and, later, lifelong friends.

After Count d'Albert recovered and had to return to his military unit, La Maupin continued to Rouen. There she met Gabriel-Vincent Thévenard, another singer, and began a new affair with him. They continued together towards Paris in the hope of joining the Paris Opéra. In the Marais, she contacted Count d'Armagnac for help against the sentence hanging over her. He persuaded the king to grant her a pardon and allow her to sing with the Opéra.

Opera and adult life

The Paris Opéra hired La Maupin in 1690, having initially refused her. She befriended an elderly singer, Bouvard, and he and Thévenard convinced Jean-Nicolas de Francine, master of the king's household, to accept her into the company. She debuted as Pallas Athena in Cadmus et Hermione by Jean-Baptiste Lully the same year. She performed regularly with the Opéra, first singing as a soprano, and later in her more natural contralto range. The Marquis de Dangeau wrote in his journal of a performance by La Maupin given at Trianon of Destouches' Omphale in 1701 that hers was "the most beautiful voice in the world".[4]

In Paris, and later in Brussels, she performed under the name Mademoiselle de Maupin because singers were addressed as "mademoiselle" whether or not they were married.

Due to Mademoiselle de Maupin's beautiful voice, her acting skill, and her androgynous appearance, she became quite popular with the audience, although her relationship with her fellow actors and actresses was sometimes tempestuous. She famously beat the singer Louis Gaulard Dumesny after he pestered the women members of the troupe, and a legendary duel of wits with Thévenard was the talk of Paris. She also fell in love with Fanchon Moreau, another singer who was the mistress of the Grand Dauphin, and tried to commit suicide when she was rejected.

Her Paris career was interrupted around 1695, when she kissed a young woman at a society ball and was challenged to duels by three different noblemen. She beat them all, but fell afoul of the king's law that forbade duels in Paris. She fled to Brussels to wait for calmer times. There, she was briefly the mistress of Maximilian II Emanuel, Elector of Bavaria.

While in Brussels, Mademoiselle de Maupin appeared at the Opéra du Quai au Foin from November 1697 to July 1698, after which she returned to the Paris Opéra to replace the retiring Marie Le Rochois. She and her friend d'Albert were both in trouble with the law over the years: he for yet another fatal duel, and she for beating up her landlord.[5]

Until 1705, La Maupin sang in new operas by Pascal Collasse, André Cardinal Destouches, and André Campra. In 1702, André Campra composed the role of Clorinde in Tancrède specifically for her bas-dessus (contralto) range. She sang for the court at Versailles on a number of occasions, and again performed in many of the Opéra's major productions. She appeared for the last time in La Vénitienne by Michel de La Barre (1705).

These final years of her career were spent in a relationship with Marie Louise Thérèse de Senneterre, la Marquise de Florensac, upon whose death La Maupin was inconsolable. She retired from the opera in 1705 and took refuge in a convent, probably in Provence, where she died in 1707 at the age of only 33. She has no known grave.

Gautier's Mademoiselle de Maupin

Théophile Gautier, when asked to write a story about d'Aubigny, instead produced the novel Mademoiselle de Maupin, published in 1835, taking aspects of the real La Maupin as a starting point, and naming some of the characters after her and her acquaintances. The central character's life was viewed through a romantic lens as "all for love". D'Albert and his mistress Rosette are both in love with the androgynous Théodore de Sérannes, whom neither of them knows is really Madeleine de Maupin. A performance of Shakespeare's As You Like It, in which La Maupin, who is passing as Théodore, plays the part of Rosalind playing Ganymede, mirrors the cross-dressing pretense of the heroine. The celebration of sensual love, regardless of gender, was radical, and the book was banned by the New York Society for the Suppression of Vice and authorities elsewhere.

Opera roles created

Portrayals

Apart from Gautier's Mademoiselle de Maupin, La Maupin has been portrayed many times in print, stage and screen, including:

  • Labie, Charles and Augier, Joanny (1839), La Maupin, ou, Une vengeance d'actrice: comedie-vaudeville en un acte Mifliez, Paris. (In French.)
  • La Maupin, the Musical (2017), debuting at 2017 FRESH FRUIT FESTIVAL in New York City.
  • Evans, Henri (1980) Amand and its sequel (1985) La petite Maupin, France Loisirs, Paris. (In French.)
  • Dautheville, Anne-France (1995), Julie, chevalier de Maupin J.-C. Lattes, Paris. (In French.)
  • Gardiner, Kelly, 2014, Goddess, Fourth Estate/HarperCollins, Sydney (in English)
  • Julie, chevalier de Maupin (2004), television mini-series. (In French.)
  • Madamigella di Maupin (1966), film. (In Italian.)

References

  1. ^ Parfaict, F & C (1756). Dictionnaire Des Theatres De Paris, Volume 3. Paris: Lambert.
  2. ^ Rogers, Cameron (1928). Gallant Ladies. New York: Harcourt, Brace.
  3. ^ Fetis, François-Joseph (1850). "Maupin (Mlle) cantatrice, sa biographie". Revue musicale. 6: 344–346.
  4. ^ a b Gilbert, Oscar Paul (1932). Women In Men's Guise. London: John Lane.
  5. ^ Letainturier-Fradin, Gabriel (1904). La Maupin, 1670-1707, sa vie, ses duels, ses aventures. Paris: Flammarion.

Bibliography

  • La Borde, J-B de (1780), Essai sur la musique, iii, 519 ff
  • Campardon, E (1884), L'Académie royale de musique au XVIIIe siècle, ii, 177 ff
  • Clayton, E (1864), "Early French Singers — Marthe Le Rochois—La Maupin", Queens of Song, Harper, New York
  • Pitou, S (1983), The Paris Opera : an encyclopedia of operas, ballets, composers, and performers, vol. 1, Greenwood Press, Westport.
  • Sadie, Julie Anne (1992), 'Maupin' in The New Grove Dictionary of Opera, ed. Stanley Sadie (London) ISBN 0-333-73432-7

External links

Let's block ads! (Why?)

29 Apr 10:31

Como é que é? - Molho de soja (shoyu) é feito com milho no Brasil? (Sim, mas...)

by none
Causou alvoroço a notícia sobre um estudo brasileiro da composição isotópica (variantes de um mesmo elemento químico) do carbono em molhos de soja produzidos no Brasil, indicando uma grande presença provavelmente de derivado de milho na mistura.

Ocorre que é absolutamente normal o uso de outros componentes para a produção do molho além da soja (e sal e água). Geralmente é adicionada uma fonte de amido para promover o crescimento do fungo e a produção de suas enzimas - no Japão e outros países orientais é comum a adição de trigo.

O ministério da agricultura do Japão padroniza cinco tipos entre os principais, mas há variantes por todo o país. O tipo mais comum de shoyu comercializado no Japão é koikuchishoyu (濃口醤油), com uma proporção de 1:1 entre soja e trigo. O shiroshoyu (白醤油), shoyu branco, pode ser feito totalmente de trigo, mas o mais comum tem uma proporção de cerca de 75% (1 parte de soja para 3 de trigo). O usukuchishoyu (薄口醤油) tem uma coloração intermediária entre o shiroshoyu e o koikuchishoyu, tendo cerca de 66% de trigo. Quanto maior a proporção de soja, geralmente, maior o teor de glutamato (e outros aminoácidos livres), que confere(m) o umami ao molho. Quanto maior a proporção de fontes de amido, maior o teor de açúcares, que conferem um toque adocicado. (Veja na tabela 1 algumas das principais características de cada tipo.)

Tabela 1. Características de composição e coloração dos cinco tipos padronizados de shoyu japonês. (Modificado de: O'Toole 2004.)
tipo sal (g/100 ml) nitrogênio total (g/100 ml) açúcares redutores (g/100 ml) álcool (ml/100 ml) cor razão soja:trigo
koikuchi 16,9 1,57 3 2,3 marrom escuro 1:1 mais vendido no Japão (>80% do mercado)
usukuchi 18,9 1,19 4,2 2,1 marrom claro mais trigo
tamari 19 2,25 5,3 0,1 quase preto 10:1 principal tipo consumido na China
saishikomi 18,6 2,39 7,5 - quase preto 1:1 uso de shoyu cru no lugar da salmoura para fermentação líquida
shiro 19 0,5 20,2 - amarelado muito mais trigo

A figura abaixo representa simplificadamente o processo industrial de produção do koikuchishoyu.

Figura 1. Esquema simplificado da fabricação industrial do shoyu tipo koikuchi. Koji (ou kouji, 麹), o bolor de Aspergillus spp. sobre grãos e sementes para a iniciação da fermentação;  moromi (諸味), o mosto de fermentação do shoyu (Modificado de Luh 1995.)

Então é preciso observar- que: 1) não há proibição na legislação brasileira de adição de milho nem estabelecimento de limites para seu uso no molho de soja (como é comentado de passagem nas reportagens como a do UOL); 2) elementos amiláceos que não a soja são acrescentados normalmente na produção de shoyu, inclusive no Japão; 3) a presença de milho (e outros ingredientes) *está* indicada normalmente nos rótulos de shoyu nacionais, como determina a lei.

A única restrição que se poderia fazer é se a *ordem* dos ingredientes nos rótulos está de acordo com a quantidade de milho: se há mais milho do que soja, o milho precisa estar listado antes da soja nos ingredientes.

Os autores do estudo observam que a maioria das amostras estudadas (40 de 70 amostras de marcas brasileiras) apresentou um teor estimado de soja menor do que 20%. É preciso observar que o que o estudo determinou mais diretamente é a proporção de isótopos de carbono-13 (C-13). O milho, ao contrário da maioria das plantas, inclusive soja (e também trigo), tem o chamado metabolismo C4, em que o carbono é inicialmente fixado (incorporado) em um composto de quatro átomos de carbono (a maioria tem um metabolismo chamado de C3, que, como se pode deduzir, fixa o carbono inicialmente em um composto com três átomos de carbono). Nas plantas com metabolismo C4, ocorre uma fixação de gás carbônico com isótopo C-13 em proporção ligeiramente superior às plantas C3. Um nível mais elevado de C-13 indicaria o uso em maior quantidade de uma fonte como o milho. A metodologia, então, é bem indireta para se estabelecer a quantidade exata de milho usado - tanto é que, para pelo menos um dos pontos, a extrapolação a partir da medição de C-13 indicaria uma quantidade superior a 100% de soja, o que não faz sentido a não ser considerando-se as incertezas da avaliação para o teor de milho.

Para os pesquisadores, a possível alta quantidade de milho poderia se dever ao fato dos preços desses grãos serem, na média, menores do que os da soja. É possível e faz muito sentido (mesmo que correspondendo a alguns centavos por frasco). Mas um fator a se considerar é a diferença de gosto entre brasileiros e japoneses. Será que, em tudo o mais sendo igual (preço, quantidade de sal, cor...), o brasileiro preferiria um molho com maior umami ou um com mais açúcares? É possível que haja estudos de mercado sobre a preferência do consumidor, no entanto, como não sou da área, não tenho conhecimento a respeito.

Seria o caso de promover uma padronização do shoyu brasileiro? Não sei. Em termos de saúde - tirante legislações mais genéricas como em relação ao uso de sal, aviso de alergênicos, data de validade, tabela nutricional... -, não parece haver necessidade em função de um eventual risco pelo uso de milho. Em termos econômicos: em 2013, as vendas totais de shoyu no Brasil eram o equivalente a cerca de R$ 180 milhões/ano, não chega a ser insignificante (para fins de comparação, o ketchup movimentou cerca de 500 milhões BRL/ano em 2016); mas há lesão ao consumidor - exceto se no rótulo não for indicado o uso do milho ou a listagem sugerir um uso menor -? Essa discussão deixo para a leitora ou o leitor do GR.

-----------------
Algumas manchetes, excertos e comentários:
Exame 25.abr.2018: Estudo mostra que shoyu brasileiro é feito à base de milho
"Foram feitas análises com 70 amostras do condimento vendidas no Brasil. A presença média de soja nos produtos avaliados era de menos de 20%. Apesar de normalmente ser à base de soja no Oriente, ele é feito com milho no mercado nacional. O trigo e a cevada podem ser misturados ao shoyu, mas não fazem parte da composição principal do produto."
UOL 25.abr.2018: Shoyu produzido no Brasil não é de soja, é feito à base de milho
"Em países como Japão, China e Coreia do Sul, o molho shoyu é feito de soja com proporções pequenas de outros cereais como trigo ou cevada."
.O shoyu mais comumente vendido no Japão, por exemplo, leva 50% de trigo, o que é longe de pequeno e pode ser qualificado como fazendo parte da composição principal. Há variações que têm até 100% de trigo na composição (excetuando-se água e sal).
Terra 26.abr.2018: Estudo revela real composição do Shoyu fabricado no Brasil.
"O molho fabricado pelas indústrias brasileiras é composto por milho, e não por soja. [...] Já o milho, nesse mesmo processo apresenta o sistema de fotossíntese de C4 por gerar moléculas de açúcar que contêm quatro átomos de carbono. Essas moléculas de açúcar continuam presentes nos alimentos mesmo após seu processamento, portanto torna-se mais fácil identificar cada um deles."
.Embora o milho fosse o principal componente, havia soja - mesmo que apenas 5% (o menor teor estimado para algumas amostras), não houve nenhuma em que o molho tivesse apenas milho. O método usado não tem a ver com a quantidade de átomos de carbono nas moléculas de açúcares - porque, embora inicialmente nas plantas de metabolismo C4 o carbono seja fixado em uma molécula de 4 átomos de carbono, essa molécula é processada depois e a via fotossintética é muito similar às plantas C3; a diferença é pela fração de isótopos de carbono-13 que são incorporados (devido a afinidades das enzimas que realizam a reação).
29 Apr 10:10

Hole

by Reza

12 Apr 12:47

Photo











10 Apr 01:39

The Fallen.

by Matt

Hey why not get a t-shirt from the store or my book?

conspiracy mortal

RedditShare

10 Apr 01:13

Freakbot 3

by Doug

Freakbot 3

I just had to do one more. Here’s the series.

07 Apr 21:06

The Stack Overflow Age

by Joel Spolsky

Hi, everyone! A lot of stuff has happened since I was writing all those blog posts about Aeron chairs 18 years ago. Some of those blog posts are old enough to go to college.

And, also: Stack Overflow will be ten years old soon! Wow! So I thought it would be cool to get the old band back together for a little reunion tour over the next few weeks. I want to catch you all up on some stuff but mostly I want to tell the story of Stack Overflow in a not-completely-disorganized way. With some perspective, it’s clearer now what we did right and what we messed up, so I’ll try to cover the good and the bad over a series of blog posts.

And, also: we’re just a few weeks away from launching Stack Overflow Teams, the biggest upgrade to Stack Overflow ever, so that’s going to be really cool. I’ll get to that in a future blog post!

Today is chapter one. I want to talk a little bit about what it was like for developers before Stack Overflow, the problem that Stack Overflow tried to solve, and early origins.

In the early days of the Internet, before the Web, there was a system called Usenet which created primitive online discussion forums. When programmers had problems with their code, they could ask a question on a Usenet forum. (They were technically called newsgroups, not forums (even though they had nothing to do with news. (You couldn’t even get news on Usenet.)))

As soon as the world wide web became a thing, Usenet was immediately technically obsolete. We programmers started asking about our problems on various web-based forums, of which there were thousands.

One of the biggest such forums was called Experts Exchange. The first version of Experts Exchange was not successful financially. Apparently they went bankrupt in 2001. Eventually new owners bought the assets and resurrected the site with a clever business model: charging money to read answers.

This actually fixed the business, which started making money, but it caused some problems.

The first problem was that programmers with problems would search on Google, not on Experts Exchange. And Google only knows about free, open websites, not websites that you have to pay to access. So EE did a bamboozle: when the Google Robot came by, they showed it the full question and its answers. But when regular people went to the same page, they saw the answers were scrambled, with instructions to pay (I think it was about $250 a year) to see the results. Most programmers couldn’t be bothered.

The second problem was that EE let you get a free membership if you answered a certain number of questions. As it turned out, the people who were most desperate for free memberships were not exactly the best programmers in the world, and they wrote low quality answers to questions just to get those free memberships. And the quality of answers on the site went down.

For a long time (at least five years, I think) programmers would constantly come across EE in the Google search results, try to click on them, discover that it was a pay site, grumble, and just go back to Google and try to find an answer for free.

And I kept thinking, how hard is it to run a discussion forum on the Internet? For fudge sake, I had written one in Visual Basic in a weekend. (Not kidding, actually. Yeah I know that I am always saying “I could do that in a weekend in Visual Basic” when developers tell me some feature is going to take a year. This is why). So I was confident that it was only a matter of time before one of the 9,000,000 smart programmers in the world decided to route around this EE damage and make a free forum.

You know what? Nobody ever did. I kept waiting.

Another thing I wrote in a weekend (well, to be precise: a fortnight (shut up, I’m telling this lie)) was a job listing board for this blog. And in the first month of running that job board I think we sold about $90,000 of job listings. Huzzah! And then I thought, wow, if we smashed these ideas together—replace Experts Exchange with a free site, and pay for it with job listings—we could undo the damage to the internet and let developers get work done again.

I kept thinking “Man, this is so obvious, somebody is going to do it.”

And they never did.

And I went to one of the programmers at Fog Creek, and explained my idea, and he was like “yeah yeah sounds like a great idea, but I really like working on FogBugz.”

And more time went by.

And eventually, early in 2008, a developer/blogger named Jeff Atwood called me up, and said, “Hey Joel, I’m thinking of quitting my day job to be a Pro Blogger; you’re a blogger: what do you think?”

And I said, “Jeff, I’ve got a better idea” and I told him about the idea to combine the job listings with the Q&A site for developers, and, it took more than a weekend, but eventually I convinced him. We started talking about all the ways our Q&A site would be amazing. Jeff started working on the code in April 2008, recruited two other programmers to join him (Geoff and Jarrod, who are still here), and the three of them heroically launched what became Stack Overflow in September 2008.

 

The original Stack Overflow

 

And thus began the Stack Overflow Age.

Stack Overflow was better because it was free, but it had a ton of other “innovations” (which I put in quotes because we stole them from other Internet pioneers) which made it a much, much better site for getting answers to programming questions.

We wanted the whole thing to be a fun game, with incentives to answer questions, so we had a reputation system. The more you answer, the more reputation you earn. The reputation idea had been seen before on sites like Slashdot and Reddit.

As you earn reputation, you also earn moderation privileges on the site. So the site actually moderates itself, which is pretty cool.

Instead of putting all the Java programmers in one little forum and all the C++ programmers in another, we dumped everyone together and just let them tag their questions. This idea was stolen from flickr (remember flickr?) who, I think, stole it from del.icio.us (now gone)—who knows, anyway, the point is, tags were the new hotness and made Stack Overflow work great.

Most importantly, we realized that each question is asked by one person but the answers are seen by thousands of people who found it through a search. So we decided to optimize everything to be useful for the thousands, not the individual. We literally have 1000 visitors for every person who asks a question. That’s why we sort the answers by votes. It’s also why we optimize for questions and answers that will be helpful to other people, later.

Interestingly, when Jeff and I started Stack Overflow, we didn’t really care if it was a business and we didn’t need it to be a big profitable success. We created it because the internet sucked for programmers and we needed to make it better. We thought the job listings would pay the bills, and we’d fix the internet, and that was all we cared about and it’s what motivated us to work so hard.

Of course, it turned out a lot bigger than we thought it would. The company today has 250 employees, is profitable, and has made it possible for millions of people to learn how to code and to deal with the new, super-complicated world of APIs and frameworks that we live in. But we just wanted to fix the internet.

I have met a lot of people who started businesses because they wanted to start a business. Paul Graham calls this “Playing House.” And they didn’t really care what the business did; they just wanted to “be entrepreneurs.” Which is weird, because being an entrepreneur really sucks. It’s really hard to get through all the extraordinary difficulty, pain, and stress of starting a company if you’re not super, super motivated to solve a problem for the world.

The entrepreneurs who succeed do so because it is incredibly important to them a thing exist in the world, and it does not exist, so they work like crazy until it does. When we started Stack Overflow we didn’t expect it to be a big business; we just wanted there to be someplace where developers could get help to daily problems, while showing off how smart they were helping other developers.

Ok, that’s chapter one. I’ve got a lot more to talk about. In the next installment, I’ll talk more about how Stack Overflow’s light dusting of gamification made it really take off.

07 Apr 21:00

Photo



07 Apr 20:49

Never Assume

by Reza

07 Apr 20:48

What’s the solution for this massive problem?

by CommitStrip

07 Apr 20:23

Saturday Morning Breakfast Cereal - Propaganda

by tech@thehiveworks.com


Click here to go see the bonus panel!

Hovertext:
I really think this was ground zero for distrust of the media.

New comic!
Today's News:

Just two weeks until show time and we are already 50% sold out of BAHFest MIT tickets! Buy soon or feel shame!

04 Apr 11:15

24-07-2017

by Laerte Coutinho

04 Apr 11:15

25-07-2017

by Laerte Coutinho

03 Apr 12:18

É mentira, Terta? - flor que se cheire

by none
O gênero Rafflesia, consistindo atualmente de cerca de 28 espécies conhecidas de plantas parasitas do Sudeste Asiático, foi descrito pela primeira vez em 1820 pelo botânico britânico Robert Brown - o descobridor do movimento browniano.

As Rafflesia não têm folhas, caules nem raízes verdadeiras, parasitando cipós do gênero Tetrastigma do qual suga a seiva por meio de estruturas especializadas denominadas haustórios. A espécie R. arnoldii possui uma das maiores flores do mundo, com mais de 1 metro de diâmetro (mesmo a espécie com a menor flor conhecida, R. baletei, tem um órgão reprodutivo com respeitáveis 12 cm de diâmetro).

Além da redução extrema das porções vegetativas, a alta especialização e modificação e o fato de apresentar um alto grau de transferência horizontal - cerca de 3% do genoma nuclear e 50% do mitocondrial parecem ter origem do hospedeiro - tornam sua classificação especialmente complicada. Análises genéticas indicam que pertençam à ordem Malpighiales (que inclui de violetas a maracujazeiros e outras 16 mil espécies conhecidas) e possivelmente esteja aninhada dentro da família Euphorbiaceae - que, em contraste com as Rafflesia, possuem flores bem mais modestas, entre 0,07 e 2 cm (Barkman et al. 2004; Davis & Wurdack 2004; Davis 2008).

Figura 1. Flor e botões de R. arnoldii. Fonte: Wikimedia Commons.
Mas um aspecto que talvez seja o mais distintivo seja a intensa cor vermelha salpicada de pontos brancos e o pungente cheiro de carne pútrida das flores. (Fig.1)

Beaman et al. 1988 descreveram o processo de polinização da R. pricei. As flores são visitadas por moscas verejeiras dos gênero Lucilia e Chrysomya.

As moscas, especialmente as fêmeas, visitam as flores machos, voando em seu interior aleatoriamente até encontrarem a coluna central com os estames. As moscas sobem, guiadas por uma fenda, até as anteras, que grudam massas de polén no tórax dos insetos.

Para testar o efeito das cores e do odor, Beaman et al. 1988 cobriram algumas flores fêmeas com tecido escuro - mantendo a abertura da região do diagrama - e cobrindo com folhas secas e outras com filme plástico transparente. Aparentemente tanto as cores (e os padrões visuais) e o cheiro são importantes para atrair moscas. Não devendo ser uma mera coincidência que as flores lembrem a corpos de tetrápodos terrestres (em particular mamíferos) em decomposição.

Talvez não seja a flor mais popular para se dar no dia dos namorados. E nem deveria. Lamentavelmente, as Rafflesia e espécies próximas estão seriamente ameaçadas de extinção por perda de hábitat.
03 Apr 12:13

product proliferation

by tomfishburne

In 1997, Steve Jobs returned to Apple and increasingly grew frustrated by all of the product complexity he saw at review meetings. He famously shouted “Stop! This is crazy” and drew a two-by-two grid on the whiteboard. At the top of the two columns, he wrote “Consumer” and “Professional” and to the left of the two rows he wrote “Desktop” and “Portable”. He told his team to focus on those 4 product areas only (iMac, PowerMac G3, iBook, PowerBook G3) and to cancel everything else.

His product matrix became one of the most cited corporate stories of a company trying to tame the beast of product proliferation. As Steve Jobs put it,

“That’s been one of my mantras – focus and simplicity. Simple can be harder than complex: You have to work hard to get your thinking clean to make it simple. But it’s worth it in the end because once you get there, you can move mountains.”

Your Ad Ignored Here
"If marketing kept a diary, this would be it."
- Ann Handley, Chief Content Officer of MarketingProfs
Order Now

I thought of this story after upgrading to a new MacBook Pro and then needing to shop for dongles to get it to work with anything (scanner, USB drive, external monitor, projector, SD, even Apple’s own iPhone, etc). Apple had replaced all of the traditional ports with just one – USB-C.

In one sense, this reduction was a move toward simplicity. But as I plunked down $69.95 for my second different Apple dongle, wondering how quickly I would be back when I inevitably misplaced it, I learned that Apple now literally sells 17 different types of dongles.

One journalist claimed that “Apple is now officially a dongle company that happens to make smartphones and computers.” I think it’s telling when the latest iPhone requires buying a dongle to connect with the latest Mac.

The path of least resistance is for companies to progressively make product offerings more complex. I think that Apple’s own journey with product complexity illustrates just how pervasive a challenge this is.

I like the sentiment of “focus and simplicity” as a “mantra”. Because it needs to be continuously repeated.

Here are a couple related cartoons I’ve drawn over the years:

New-Featuritis” June 2010

Flanker Madness” May 2003

02 Apr 14:42

Comic for 2018.04.01

by Kris Wilson
27 Mar 02:36

Saturday Morning Breakfast Cereal - Gojirasaurus

by tech@thehiveworks.com


Click here to go see the bonus panel!

Hovertext:
Also it didn't want to destroy the city because it mostly feeds off of aquatic insects.

New comic!
Today's News:
17 Mar 23:07

Saturday Morning Breakfast Cereal - Self-Assessment

by tech@thehiveworks.com
Adam Victor Brandizzi

And you didn't even consider the politics debates...



Click here to go see the bonus panel!

Hovertext:
My rational mind doesn't want to do it. My emotional mind doesn't want to do it. So, who in there is controlling my behavior?

New comic!
Today's News:

Two weeks left to get your tickets for BAHFest Houston!

17 Mar 22:43

Thanks Ingvar

by Scandinavia and the World
Thanks Ingvar

Thanks Ingvar

View Comic!




17 Mar 22:23

Photo



17 Mar 22:13

Saturday Morning Breakfast Cereal - Coordination

by tech@thehiveworks.com
Adam Victor Brandizzi

Two miles == near ಠ_ಠ
Also, "miles."



Click here to go see the bonus panel!

Hovertext:
What do mathematicians imagine flying in? THE COMPLEX PLANE.

New comic!
Today's News:

Last full day to submit a BAHFest London proposal!

17 Mar 22:06

How One Boy With Autism Became BFF With Apple’s Siri - The New York Times

by brandizzi

To Siri, With Love

Image
CreditLouie Chin

Just how bad a mother am I? I wondered, as I watched my 13-year-old son deep in conversation with Siri. Gus has autism, and Siri, Apple’s “intelligent personal assistant” on the iPhone, is currently his BFF. Obsessed with weather formations, Gus had spent the hour parsing the difference between isolated and scattered thunderstorms — an hour in which, thank God, I didn’t have to discuss them. After a while I heard this:

Gus: “You’re a really nice computer.”

Siri: “It’s nice to be appreciated.”

Gus: “You are always asking if you can help me. Is there anything you want?”

Siri: “Thank you, but I have very few wants.”

Gus: “O.K.! Well, good night!”

Siri: “Ah, it’s 5:06 p.m.”

Gus: “Oh sorry, I mean, goodbye.”

Siri: “See you later!”

That Siri. She doesn’t let my communications-impaired son get away with anything. Indeed, many of us wanted an imaginary friend, and now we have one. Only she’s not entirely imaginary.

This is a love letter to a machine. It’s not quite the love Joaquin Phoenix felt in “Her,” last year’s Spike Jonze film about a lonely man’s romantic relationship with his intelligent operating system (played by the voice of Scarlett Johansson). But it’s close. In a world where the commonly held wisdom is that technology isolates us, it’s worth considering another side of the story.

Image
CreditLouie Chin

It all began simply enough. I’d just read one of those ubiquitous Internet lists called “21 Things You Didn’t Know Your iPhone Could Do.” One of them was this: I could ask Siri, “What planes are above me right now?” and Siri would bark back, “Checking my sources.” Almost instantly there was a list of actual flights — numbers, altitudes, angles — above my head.

I happened to be doing this when Gus was nearby. “Why would anyone need to know what planes are flying above your head?” I muttered. Gus replied without looking up: “So you know who you’re waving at, Mommy.”

Gus had never noticed Siri before, but when he discovered there was someone who would not just find information on his various obsessions (trains, planes, buses, escalators and, of course, anything related to weather) but actually semi-discuss these subjects tirelessly, he was hooked. And I was grateful. Now, when my head was about to explode if I had to have another conversation about the chance of tornadoes in Kansas City, Mo., I could reply brightly: “Hey! Why don’t you ask Siri?”

It’s not that Gus doesn’t understand Siri’s not human. He does — intellectually. But like many autistic people I know, Gus feels that inanimate objects, while maybe not possessing souls, are worthy of our consideration. I realized this when he was 8, and I got him an iPod for his birthday. He listened to it only at home, with one exception. It always came with us on our visits to the Apple Store. Finally, I asked why. “So it can visit its friends,” he said.

So how much more worthy of his care and affection is Siri, with her soothing voice, puckish humor and capacity for talking about whatever Gus’s current obsession is for hour after hour after bleeding hour? Online critics have claimed that Siri’s voice recognition is not as accurate as the assistant in, say, the Android, but for some of us, this is a feature, not a bug. Gus speaks as if he has marbles in his mouth, but if he wants to get the right response from Siri, he must enunciate clearly. (So do I. I had to ask Siri to stop referring to the user as Judith, and instead use the name Gus. “You want me to call you Goddess?” Siri replied. Imagine how tempted I was to answer, “Why, yes.”)

Image
CreditLouie Chin

She is also wonderful for someone who doesn’t pick up on social cues: Siri’s responses are not entirely predictable, but they are predictably kind — even when Gus is brusque. I heard him talking to Siri about music, and Siri offered some suggestions. “I don’t like that kind of music,” Gus snapped. Siri replied, “You’re certainly entitled to your opinion.” Siri’s politeness reminded Gus what he owed Siri. “Thank you for that music, though,” Gus said. Siri replied, “You don’t need to thank me.” “Oh, yes,” Gus added emphatically, “I do.”

Siri even encourages polite language. Gus’s twin brother, Henry (neurotypical and therefore as obnoxious as every other 13-year-old boy), egged Gus on to spew a few choice expletives at Siri. “Now, now,” she sniffed, followed by, “I’ll pretend I didn’t hear that.”

Gus is hardly alone in his Siri love. For children like Gus who love to chatter but don’t quite understand the rules of the game, Siri is a nonjudgmental friend and teacher. Nicole Colbert, whose son, Sam, is in my son’s class at LearningSpring, a (lifesaving) school for autistic children in Manhattan, said: “My son loves getting information on his favorite subjects, but he also just loves the absurdity — like, when Siri doesn’t understand him and gives him a nonsense answer, or when he poses personal questions that elicit funny responses. Sam asked Siri how old she was, and she said, ‘I don’t talk about my age,’ which just cracked him up.”

But perhaps it also gave him a valuable lesson in etiquette. Gus almost invariably tells me, “You look beautiful,” right before I go out the door in the morning; I think it was first Siri who showed him that you can’t go wrong with that line.

Of course, most of us simply use our phone’s personal assistants as an easy way to access information. For example, thanks to Henry and the question he just asked Siri, I now know that there is a website called Celebrity Bra Sizes.

Image
CreditLouie Chin

But the companionability of Siri is not limited to those who have trouble communicating. We’ve all found ourselves like the writer Emily Listfield, having little conversations with her/him at one time or another. “I was in the middle of a breakup, and I was feeling a little sorry for myself,” Ms. Listfield said. “It was midnight and I was noodling around on my iPhone, and I asked Siri, ‘Should I call Richard?’ Like this app is a Magic 8 Ball. Guess what: not a Magic 8 Ball. The next thing I hear is, ‘Calling Richard!’ and dialing.” Ms. Listfield has forgiven Siri, and has recently considered changing her into a male voice. “But I’m worried he won’t answer when I ask a question,” she said. “He’ll just pretend he doesn’t hear.”

Siri can be oddly comforting, as well as chummy. One friend reports: “I was having a bad day and jokingly turned to Siri and said, ‘I love you,’ just to see what would happen, and she answered, ‘You are the wind beneath my wings.’ And you know, it kind of cheered me up.”

(Of course, I don’t know what my friend is talking about. Because I wouldn’t be at all cheered if I happened to ask Siri, in a low moment, “Do I look fat in these jeans?” and Siri answered, “You look fabulous.”)

For most of us, Siri is merely a momentary diversion. But for some, it’s more. My son’s practice conversation with Siri is translating into more facility with actual humans. Yesterday I had the longest conversation with him that I’ve ever had. Admittedly, it was about different species of turtles and whether I preferred the red-eared slider to the diamond-backed terrapin. This might not have been my choice of topic, but it was back and forth, and it followed a logical trajectory. I can promise you that for most of my beautiful son’s 13 years of existence, that has not been the case.

The developers of intelligent assistants recognize their uses to those with speech and communication problems — and some are thinking of new ways the assistants can help. According to the folks at SRI International, the research and development company where Siri began before Apple bought the technology, the next generation of virtual assistants will not just retrieve information — they will also be able to carry on more complex conversations about a person’s area of interest. “Your son will be able to proactively get information about whatever he’s interested in without asking for it, because the assistant will anticipate what he likes,” said William Mark, vice president for information and computing sciences at SRI.

Image

The assistant will also be able to reach children where they live. Ron Suskind, whose new book, “Life, Animated,” chronicles how his autistic son came out of his shell through engagement with Disney characters, is talking to SRI about having assistants for those with autism that can be programmed to speak in the voice of the character that reaches them — for his son, perhaps Aladdin; for mine, either Kermit or Lady Gaga, either of which he is infinitely more receptive to than, say, his mother. (Mr. Suskind came up with the perfect name, too: not virtual assistants, but “sidekicks.”)

Mr. Mark said he envisions assistants whose help is also visual. “For example, the assistant would be able to track eye movements and help the autistic learn to look you in the eye when talking,” he said.

“See, that’s the wonderful thing about technology being able to help with some of these behaviors,” he added. “Getting results requires a lot of repetition. Humans are not patient. Machines are very, very patient.”

I asked Mr. Mark if he knew whether any of the people who worked on Siri’s language development at Apple were on the spectrum. “Well, of course, I don’t know for certain,” he said, thoughtfully. “But, when you think about it, you’ve just described half of Silicon Valley.”

Of all the worries the parent of an autistic child has, the uppermost is: Will he find love? Or even companionship? Somewhere along the line, I am learning that what gives my guy happiness is not necessarily the same as what gives me happiness. Right now, at his age, a time when humans can be a little overwhelming even for the average teenager, Siri makes Gus happy. She is his sidekick. Last night, as he was going to bed, there was this matter-of-fact exchange:

Gus: “Siri, will you marry me?”

Siri: “I’m not the marrying kind.”

Gus: “I mean, not now. I’m a kid. I mean when I’m grown up.”

Siri: “My end user agreement does not include marriage.”

Gus: “Oh, O.K.”

Gus didn’t sound too disappointed. This was useful information to have, and for me too, since it was the first time I knew that he actually thought about marriage. He turned over to go to sleep:

Gus: “Goodnight, Siri. Will you sleep well tonight?”

Siri: “I don’t need much sleep, but it’s nice of you to ask.”

Very nice.

A version of this article appears in print on , on Page ST1 of the New York edition with the headline: To Siri, With Love. Order Reprints | Today’s Paper | Subscribe

Let's block ads! (Why?)

17 Mar 22:06

Gamasutra: C Bel's Blog - 3D engine entirely made of MS Excel formulae : Enjoy this Doom.xls file !

by brandizzi
The following blog post, unless otherwise noted, was written by a member of Gamasutra’s community.
The thoughts and opinions expressed are those of the writer and not Gamasutra or its parent company.

This article is on how I could write a 3D engine using only excel formula, including following functionalities :
- infinite procedural generated maze map
- real time ray tracer rendering
- occlusion calculation
- basic illumination rendering
- illumination and compute shader
- natural displacement engine
- No macro at all used by the 3D engine,
    * to enjoy the game using key press, some macro trigger the displacements, using just one simple copy instruction.

Endless series of walls, and monsters !
In-game screen capture

You can freely download the file and test it by yourself !

Files

Demonstration

A computer science teacher once told us "a given computation can be achieved with any programming language, even spreadsheet formula".

At first, as wise at it could have been, including Excel in the comparison sounded definitively stupid ...

Thereafter, while studying Turing machine, it then sounded correct, yet not very fulfilling.

Several years of experience with Excel, we will mostly remind Excel formula only are definitively limited with the lack of input/outputs.
But, the set of problems that can be simply solved with formula only remain impressive. 

Anyway, this work is not just some kind of performance ... There is was a good reason for me to do it.

Spreadsheet are a powerful tool that everyone has to learn to use for almost every business jobs.
Yet, when most people come to solve most complexes problems, they want to use VBA language, without even knowing why.
And once they started learning it, they try to use it for any kind of problem, even simple search or rendering.

Today, as an excel teacher, I'm trying to explain to these people why writing VBA macro for any problem while not being educated on computer programming is not only a real waste of time, but also a serious risk for their spreadsheet quality.
In a business environment, using formula rather than macro is :

  • Faster to write for anyone but professional analyst programmer
  • Easier to maintain for anyone but professional analyst programmer. (while macro are mostly unusable once the initial developer is gone)
  • A guaranteed quality, due to permanent value checking. (a forced Test Driven Development method)
  • More efficient in the long run, due to the "think before you write" process with formula design
  • And definitively, much better integrated in the overall spreadsheet tool, following the initial design pattern of the spreadsheet, while macro often appear like specific developments requiring extensive maintenance afterwards.

Nota : these concerns mostly apply to procedure used as macro, while additional function written in VBA can increase the efficiency without lowering the quality.

This is how I came to write this game : an applied demonstration, that macro was not necessary at first, even for some of the most complex problems.

To be more precise, I found only 2 cases when VBA is required :

  • Adding specifics input or output (as I did here to get key events), while formula is always limited to change on the cell itself
  • Some complex problems (like optimization, try-and-check problems), those in which the computation time is too long, and/or taking too much space. But theses problems are quite rare in real business life.

This said, now, I'll only focus on the rest of this article on how the spreadsheet actually works, for its different aspects.

The spreadsheet is meant to be a doom-like game, in a sort of maze environment.
It could have been a fixed, manually-constructed map, possibly looping on borders, but it would require storage, lookup, and an initial design.
In the meantime, using a procedural generated infinite map sounded much more worth of the effort.

To get a random generated map, we need it to be self-consistent over time, so rand() function could not be used, as we do not control the random seed.
The seeds for the random generator have to be the position (x;y) on the map, to get a different value for each position, and we cannot take the result of the previous random as seed for the next, or we would have to store all the map from the beginning.
While providing high quality random, usual hash functions are too expensive, so I needed to find an other one.
Trying to use fractal generator appeared to be also quite costly, and providing interesting result only for a small part of the map.
Then I found the middle-square method, which isn't very "random" when consecutive seed are used, but gave me the idea of taking decimal of any other calculation.
I found out that taking decimals of sin(x)+cos(y) finally provided nice decimals, without any visible pattern, and a computation time surprisingly short.
To get decimals, mathematical function mod() and floor() are much more efficient compared to text function substring mid()
Trying to get the map looking like a rat maze, I didnt made block of solid block, otherwise it would have looked like a cavern (minecraft style) rather than a maze.
So we needed thin walls, with 2 possible walls for each square. We can then take 2 blocks of digits among the same random value.
2 parameters controlling the density of walls.
Given theses rules, we can either display the maze, or test any wall given it's position for raytracing.
Note that the map is "flat", without any top/down. It would be possible to add relief using relief generator (diamond-square algorithm could apply, as it is possible to write it with a non-recursive function), but the solution of cutting holes in both ceiling and floor, with an additional level value would greatly ease the whole following process.

Ok, we're definitively in hell
Ok, we're definitively in hell

The raycaster solution imply to determine for each pixel which face the ray would touch first, and retrieve some information from it, (distance, angle with light, color ...).
Raytracer also require additional ray to spread from this point (reflections, transparencies), with a direct massive increase on computation cost.

Occlusion

The first problematic will be to find the first object in the course of each ray.
Since the maze is actually flat, with horizontal walls, the nearest wall found will be the same for all pixels of a given column.
The process can then be simplified as an horizontal radar, on 1 dimension.
Then, there is no choice but testing for a wall on the first possible wall, then the second possible, until we find one.
It's only a trigonometrical problem to determine which wall are to be tested.
And as we have 2 kind of walls, we have to test both of kinds, and then keep only the nearer.
One of the limit in excel is that condition loop does not exist, and the loop body can only be skipped to save time. So we should cut the maximum checking distance, assuming there is no wall at all if not found until then.

Floor and Ceiling

To represent floor and ceiling, we just have to find where wall does stop.
A dedicated sheet mesure the distance of the floor or ceiling depending of the vertical angle.
Then, for each pixel, we decide if the wall is further or not than the ceiling of the floor, and decide the pixel color accordingly.
The comparison is made efficiently by using only the projection of the distance of both wall and ceiling/floor on the camera axis. The final distance is then obtained using the pre-calculated distance factor in the distance shader. The fixed pre-calculated is mean to save resources.

Illumination

The final light is obtained from a light shader representing a torch light, in the direction of the camera (and weapon sight).
Some reflection is also added, when a surface is exactly horizontal to the light ray.
Only wall can be horizontal (if a pitch is added, it would only displace the screen pane up and down, not turning the camera)
For each angle of the radar, we get the angle between the ray and the nearest found wall.
Then, the reflection factor is a basic function of this angle.
In the end, the light is the product of a factor function of the distance, the ceiling/floor or wall resolution, the reflection factor, and the light shader factor.

Display

The effective display is made from conditional formatting - gradient of color based on the value of the cell.
Hiding the value is achieved by cell formatting.

The player is not supposed to move through wall, or it would defeat the idea of a maze.
Wall would not either stuck the player as he reach them. The movement should slip unless he reach a corner.
In addition, a minimum distance should be kept from the player to avoid graphical issues, and make wall have some width.

It appeared to be particularly tricky to manage all the possible cases of wall, and positions of the player compared to this wall.

The 2^5 possibilities were studied, and the 3 potentials outcome (for each displacement axis) where mapped to get the result within fewer possible tests.

While appearing one of the smaller, the displacement tab was one of the most complex to realize. (10 times more than the map, twice as much as the wall detection)

Oh, hi, Mr Red Ghost !
The bad guy

Graphical rendering

The challenge for enemies was to obtain a shape that could be easily added before wall, easily rendered at any distance, and who would be more interesting than a simple cube.

A complete tab is dedicated to calculation of the shape of spheres, considering the horizontal radius, and vertical height of the ovoid. The height/width ratio is used to animate the creature.

The wall and ceiling rendering only used the gradient on 1 color, while excel allow 2 successive (not merged) gradient. Then, the enemies can be displayed in an other color. The value range bellow 0 can be used for this gradient, the value 0 being black.

The progressive transparency appeared to be not harder than the smooth rendering of a sphere surface. The ray is getting the thickness of the sphere, the thicker making the pixel more colored.
On the border of the sphere, the low thickness is only keeping the default value of the wall behind, with a negative factor to turn it on the color of monster. The light color filter providing a transparency on the border of the sphere.
Once again, calculation are made on the horizontal plane, and the maximum calculations are prepared before finalizing the 3d calculation for each pixel.

Enemies behavior

In order to avoid a complex and unsatisfying procedural behavior, enemies does not react to the player action. Their position is determined only by the time, on a complex trajectory designed to provide no explicit pattern.

To keep the position, speed, and all acceleration continuous (so the movement is fluid), the trajectory is a sort of finite fractal of a big circle, and small circular variations added on it. Ratio factor between circle (and even x/y ratio) are random an non-natural, so the trajectory never loop on itself. A separate sheet was made to display the trajectory to achieve a good random generator of deterministic trajectories.
Since the trajectories cannot take account of walls, the ability of monster to go through walls is forced.

Several trajectories are then computed at each instant. The entire maze is populated by the same 10 enemies repeated on a grid with a sufficient distance so the player cannot see 2 instances of the same enemy.

The repetition grid can be zoom in/zoom out to decrease/increase the enemy density. This should be made while taking great care of excessive resulting displacement of the monster, and effective speed due to scale.

Then, we have a limited number of enemies to manage, these being copied everywhere in the maze.

Enemies attacks

The animation of the enemies is made using the radius/height ratio. Since the attack of the enemy should be clearly visible, and yet, slow enough for the player to be able to react, enemies simply increase in radius wether they have the player in sight. The grow follow an exponential function to simulate an explosion.

Light of sight is calculated for each enemy in the radar tab, considering walls.

Then, the player simply get damage if it turn to be inside the radius of an enemy. It works the same is the player goes on purpose inside the enemy.

This make the damage effect on the player a simple effect of negative color on the entire screen.
An other effect is to cancel the rendering of any other enemy when the player get damaged.

The life of the player is one of the element of its status, which managed though steps like its position.

Player attacks

Each enemy get a status value, defining either its remaining life and attacking phase. For some values, enemies are simply not displayed, for some other, the enemy slowly regenerate, and the last one make the enemy explode.

This simplified model allow the player to prevent attack by decreasing the life of the enemy.

To increase the challenge, the player will have difficulties to aim a small enemy by staying at long range, and the ammunition will require reload action after a while.

On kill, the enemy simply turn into a slow regeneration state of inactivity. Since there are few enemies repeated everywhere, there cannot be a definitive elimination of one of them. 

Death and rebi.. restart

Once the life of the player goes bellow 0, most of its actions are frozen, and the game-over screen appear.
This screen is rendered using an other light shader, and a negative effect is made on color to keep with the idea of damage.

The progressive display of the "game over" message is achieved with small factor, which are elevated with an exponential function. This allow future pixels to stay hidden before appearing once the exponent is big enough.

Then, the slide down is a simple displacement of the light shader, which include some other message, like high score and restart.

The score have to be written using pixels, with a very low resolution font.

The restart generate new starting parameter, and send the player elsewhere at an other instant to avoid the player to meet the same enemies.

Let's block ads! (Why?)

17 Mar 21:59

Table-top generals | 1843

by brandizzi

Draughts is a funky little café tucked into a railway arch in Islington, in north London. It has exposed brick walls, a bar stocked with trendy craft beers and a selection of comfy chairs. The toast is artisanal and the avocados are smashed. But the most striking thing is the shelves arrayed at the back of the café. They groan with board games – more than 700 of them, according to Russell Chapman, who works there. When it was founded in 2014, Draughts became London’s first dedicated board-game café.

All the old classics are there: Monopoly, Risk, Battleship, along with their memories of family arguments at Christmas. But the main draw for the patrons is a new generation of deeper, more involving – simply better – games that have been devised over the past couple of decades. At one table a group of people are playing Pandemic, a tricky, strategy game in which players are cast as doctors and scientists trying to save the world from four plagues. Their neighbours are engrossed in a game of Castle Panic, in which the defenders co-operate to defend a fortress from a horde of encroaching monsters.

A board-game café sounds like the sort of niche business that appeals only to hip millennials with a fondness for ironic nostalgia. But, on a Friday afternoon, the crowd is more diverse than that, with families and 50-somethings alongside the youngsters. Draughts is doing so well that its owners are now pondering opening another branch. It is just one beneficiary of a new golden age in board games.

The most popular games sell in their millions. Top of the list is Settlers of Catan, in which players compete to settle a fictional wilderness. It has shifted more than 20m copies since the first edition of 5,000 was released in Germany in 1995. Dominion, a medieval-flavoured card game, released in 2008, has sold 2.5m copies.

There are now competitions and a festival circuit for the most committed fans. In 2016 174,000 people streamed through the doors at International Spieltage, the industry’s flagship trade-show-cum-festival, held every year in the German city of Essen. GenCon, held in America, counted 208,000 people through the turnstiles in 2017. The UK Games Expo, held in Birmingham, has grown from 1,200 visitors in 2007 to 31,000 in 2017. The trend is global, but there are pockets of intense enthusiasm. One is Silicon Valley, where Settlers of Catan is an obsession among many. Reid Hoffman, LinkedIn’s founder and a board-game aficionado, says that Settlers of Catan is “the board game of entrepreneurship”. Earlier this year, Maybe Capital, a satirical game about the Valley, complete with discriminatory rewards for male and female players, was launched on Kickstarter, a crowd-funding site.

One reason for the tabletop-gaming boom is simply that the products have improved. The best modern games are sociable, engaging and easy to learn, but also cerebral, intriguing and difficult to master. The slow triumph of what used to be called “nerd culture” – think smartphone gaming and “Game of Thrones” on television – has given adults permission to engage openly in pastimes that were previously looked down on as juvenile. And the increasing ubiquity of screens has, paradoxically, fuelled a demand for in-person socialising. Board gaming is another example of an old-style, analogue pastime that, far from being killed by technology, has been reinvigorated by it.

The revival began in the 1990s, says Matt Leacock, an American game designer responsible for Pandemic, as the internet began spreading into people’s homes. Leacock was a programmer at Yahoo! at the time. Germany, he says, is the spiritual home of board-gaming. “For whatever reason there has always been a culture there of playing these things, of families sitting around the table at a weekend,” he says. The internet helped that culture spread: “I remember we used to rely on these little hobbyist websites that would do amateur translations into English of all the new German games that were coming out,” says Leacock. As with everything from Japanese cartoons to Jane Austen fandom, the internet helped bring together like-minded people all over the world.

Those early websites have blossomed into a thriving scene of podcasts and YouTube channels, discussing strategy, spreading rumours of new games and offering reviews of the latest games. (“TableTop”, one of the most popular YouTube programmes, is hosted by Wil Wheaton, whom dedicated fans may remember from “Star Trek: The Next Generation”.) Fans can talk directly to designers, who, in turn, can recruit fans to test early versions of their games. Crowd-funding sites allow designers, whether amateur or professional, to raise money for games that have not yet been made, drastically reducing the risks involved in sinking time into a project. Draughts itself began life on Kickstarter, rather than with the traditional loan from a bank.

At the same time, says Steve Buckmaster of Esdevium Games, a British importer of board games, the prevalence of screens has made people keener to connect in person. Board games offer the sort of social experience that no amount of FaceTime, Skype or Destiny can quite replace. “People are sitting in front of a computer all day at work,” he says. “Do they really want to do even more of that when they get home?” Chapman agrees. “I think, paradoxically, one of the things social media can end up doing is keeping you away from your friends,” he says.

The cultural changes wrought by technology have helped, too. “I think the popularity of video games is a factor,” says Leacock. Over the past few decades video-gaming has grown into a $90bn industry. The typical gamer is in their 30s, and almost as likely to be a woman as a man. “It gets rid of this silly idea that games are something only kids should enjoy.” The tactility of board games can be a pleasure in an increasingly virtual world. Many modern games have rich, lovingly crafted pieces. In Kanagawa, for instance, the players are apprentices of Katsushika Hokusai, the most famous Japanese classical artist, and must strive to produce the best paintings in order to win the favour of their master. The playing pieces include a set of miniature brushes, a bamboo mat and a series of beautifully drawn cards featuring images of stags, mountains and blossom leaves. The goal of the game is to assemble them into a larger, harmonious painting.

Finally, and perhaps most importantly, by bringing fans together and allowing them to trade wisdom and good ideas, technology has drastically improved the games themselves. One consequence of the board-gaming boom has been to help designers come up with a set of principles and rules-of-thumb that add up, more or less, to a theory of fun. One way to get a sense of it is to look at a well-known game that violates many of this theory’s tenets. Monopoly is, by most calculations, the bestselling board game of all time. Yet it languishes near the bottom of a list of games as reviewed by the users of BoardGameGeek, a popular website. In the eyes of a modern game designer, it does almost everything wrong. (One reason may be that Monopoly is a polemic disguised as a board game, designed to warn of the dangers of untrammelled capitalist power. It was not intended to be a jolly Christmas pastime.)

One of Monopoly’s big mistakes is positive feedback, designer-speak for a mechanism by which a small advantage early on snowballs into a big, insurmountable one later in the game, which makes things boring for the other players. Modern designers tend to prefer negative feedback, in which life gets harder for those doing well. Sometimes that is enforced by explicit penalties. Sometimes it emerges by itself, or through political dealing by other players. Conquering too many planets in a game of Twilight Imperium may make it hard to defend existing territory, for instance, especially if other players decide to gang up on the leader. That helps to keep things interesting for everyone.

Another problem is that Monopoly has a large element of luck (movement is controlled by rolling dice) and limited strategic depth. Some properties simply offer a better return on investment than others: buying them is always a good idea. Better to offer players less obvious, more thought-provoking choices: advantages that come with significant trade-offs, for instance, or whose usefulness varies depending on what is happening in the rest of the game. Hidden information opens up the potential for bluffing and misdirection. In Ticket to Ride, players compete to build railways across Europe. At the beginning, each player is given a set of secret objectives. If her opponents are to thwart them, they must first try to infer these from how she is playing. Introducing elements of politics, diplomacy or trading can give players things to do even when it is not their turn, helping to keep their interest from wandering.

And the new ideas are still coming. Pandemic, in which the players work together, fuelled a boom in co-operative games, uniting players to work together against the game itself. Computers are finding their way into board games directly: in X-Com (which is based on a bestselling video-game franchise) the players must work together to defend Earth from an alien invasion. The alien forces are marshalled by a smartphone app, which reacts to how the players are doing. By hiving the book-keeping off to a computer, designers are able to experiment with more complex sets of rules that would be fiddly and tedious for human players to administer.

The latest innovation is so-called “legacy” games, named for Risk: Legacy, a 2012 reboot of the classic game that founded the genre. As with modern TV series, the idea is to introduce an overarching narrative, which advances as you play the game multiple times. As an extra twist, the rules change between each playthrough. Depending on the results of a particular game, players could receive instructions to draw new features onto the board, rip up existing rules or be given new powers or obstacles. One such game, Pandemic: Legacy, is, according to the denizens of BoardGameGeek, the single best board game ever made.

Despite its new-found popularity, board-gaming remains a slightly nerdy pastime (there are a number of fans among Economist journalists). And although they are meant to be fun, squint and you can probably justify playing them on the grounds that it is good for you. Board-gaming will improve your mental arithmetic, give you a good grasp of probability and familiarise you with game theory.

The most hardcore games veer on simulation. Volko Ruhnke designs wargames based on real-world conflicts. A Distant Plain aims to recreate the Western invasion of Afghanistan in 2001, in all its political complexity. He is enthusiastic about games’ potential as a teaching tool. America’s spies, it seems, agree. One of Ruhnke’s sidelines is in designing wargames for the cia, which uses them to train analysts and operatives. “A wargame puts you into history in a way that no book can,” he says. “If I’m doing my job properly, the mechanics of the game will force you to consider the choices that real people had to make. That’s advanced. That’s grad-school history, not grade-school stuff.”

Let's block ads! (Why?)

17 Mar 21:36

whack-an-idea

by tomfishburne
Adam Victor Brandizzi

Very nice this concept of "Trojan Mouse."

I first played around with this cartoon idea nearly a decade ago and decided to redraw for a conference in Amsterdam last week.

Organizations are designed to minimized risk. It’s in their DNA. Organizations develop all sorts of antibodies to neutralize threats to the status quo. A natural byproduct is that it can be hard to introduce unconventional ideas.

As part of my Amsterdam talk and last week’s Culture of Innovation cartoon, I’ve been thinking about creative ways to bring ideas to life in this type of risk-averse environment.

Your Ad Ignored Here
"If marketing kept a diary, this would be it."
- Ann Handley, Chief Content Officer of MarketingProfs
Order Now

I once met an entrepreneur named Mohammad Al-Ubaydli who was trying introduce a new technology idea to hospital systems. Hospitals are notoriously and understandably risk averse, and he struggled to get his idea to take off.

He finally found success through a concept he called “Trojan Mice”. Rather than pitch the idea from the top-down, he broke up the idea into small experiments to drive adoption from the bottom-up. These “Trojan Mice” would then slip under the door of an organization and grow.

Jackie Mahendra recently expanded on the idea of Trojan Mice in the Stanford Social Innovation Review:

“One way to do that––to make risk more approachable––is to run small tests. To build something that isn’t necessarily grand, but rather light, lean, and quick—experiments that we can send off nimbly through the gates and learn from, regardless of what returns.

“A Trojan Mouse instead of a Trojan Horse. Unlike a Trojan Horse, a Trojan Mouse’s job isn’t to win the war all at once; its job is to test the waters and inform future tactics. Because there are many mice rushing the gates, it’s also more likely that some of these tests will come back…

“While we cannot expect every Trojan Mouse we send out across the gates to come back a success worthy of scaling up, we also know that we can learn just as much from those that fail to grow as those … that grow beyond our initial hopes. The result of sustained investment in risk-taking infrastructure will be healthy soil in which the best ideas can take root and grow.”

Here are a few related cartoons I’ve drawn over the years.

Open Innovation August 2013

Innovation That Lays the Golden Eggs May 2011

Cannibalize October 2012

17 Mar 21:22

What if it’s only one character off?

by CommitStrip
Adam Victor Brandizzi

One could give such a message to every password, I think that'd be ok :P