Shared posts

13 Apr 00:17

Fangamer’s Power Mitt I hope this works better as an oven...

by 20xx






Fangamer’s Power Mitt

I hope this works better as an oven mitt than the Power Glove did as a controller!h2

Fangamer is selling this amusing Jon Kay-designed oven mitt for $15. There’s no left-handed version yet, but send them a message if you’re interested in such a thing!

I’m having a hard time thinking of another genuinely funny oven mitt.

BUY The Wizard
13 Apr 00:16

Parting Shot: New Marvel T-Shirts Tell Boys They Can Be Heroes, And Girls That A Hero Will Save Them

by Joseph Hughes

Apr 12th 2013 By: Joseph Hughes

Following the success of the Avengers film, and with Iron Man 3 set to hit theaters next month, the characters who make up Marvels Avengers team are more recognizable than ever. Naturally, the publisher is taking advantage of that fact via merchandise, including the two t-shirts pictured above.

Of course, aside from the cut of the shirts, the second you look at them you instantly know which is meant for boys and which is for girls, and therein lies quite a problem.

Marvel had no comment when asked, but these shirts were seemingly both licensed out to a manufacturer -- which is to say, not produced by Marvel-- and there's an excellent chance that their creation was not directly overseen by anyone in the Marvel offices. That's simply the nature of licensing: the content owner at times does not closely review every licensed product. Further, I've not been able to ascertain who made both shirts (the Iron Man tee was made by Mighty Fine). It's possible they were manufactured by two different companies, meaning this could really just be a case of one middle man making a perfectly acceptable shirt while another completely screwed up.

All that said, it's not an excuse. These are Marvel's characters, the foundation of their company. As such, these products represent them, not the manufacturers. When people see this, and are (rightfully) bothered by it, they aren't going to care what middle man made the shirts. They're going to instantly direct their ire toward Marvel, as it it will look to them as if Marvel is telling boys they can be heroes, and telling girls that, if they're lucky, a hero will come save them.

Marvel, and most licensors in general, need to play a larger role in what people are doing with their intellectual properties. Because on the surface, this is just one more superhero product that tells girls to find their heroes elsewhere, instead of being heroes themselves.

[Via Huffington Post]

12 Apr 22:29

Crick's Nobel Medal Fetches $2.3 Million At Auction

by Soulskill
firehose

G.R.O.S.E

ananyo writes "Francis Crick's Nobel medal fetched US$2.27 million at an auction in New York yesterday. The proud new owner is Jack Wang, chief executive of 'Biomobie' a company that intends to sell walnut-sized, flying-saucer-shaped electromagnetic devices that it claims have medically regenerative powers. The closely-watched sale featured a range of Crick memorabilia that the family had kept in storage for many years. Up for auction along with the medal — awarded for Crick's role in the 1953 discovery of the structure of DNA — were his lab coat, sailing logbooks and garden journals. Expectations were high because the day before, auctioneer Christie's had brokered the sale of a letter from Crick (PDF) to his 12-year-old son for $6 million, more than triple the pre-sale estimate. The letter went to an anonymous bidder. The new owner of the Crick medal is a Chinese-born American who says his motivation for purchasing the medal was to stimulate research into the 'mystery of Bioboosti,' which, he says, produces electromagnetic stimulation that can 'control and enable the regeneration of damaged organs.' Those benefits are, needless to say, so far unproven. Crick's family has said it will donate at least 20% of the proceeds from the sale of the medal and other items to the Francis Crick Institute, a biomedical research centre scheduled to open in London in 2015."

Share on Google+

Read more of this story at Slashdot.



12 Apr 22:28

"Expanding west means California, as well as the 12 states back home still sans Dunkin’Donuts:..."

firehose

fuckshit
nasty fucking coffee

“Expanding west means California, as well as the 12 states back home still sans Dunkin’Donuts: Alaska, Hawaii, Idaho, Minnesota, Montana, Nebraska, North Dakota, Oregon, South Dakota, Utah, Washington, and Wyoming. By 2015, about two-thirds of the chain’s new U.S. stores will be in the western part of the country”

- America: Dunkin’ Donuts’ Next Frontier - Yahoo! Finance
12 Apr 22:15

According To The New DSM-5, Odds Are You Will Have A Mental Disorder

Beware the DSM-5, the soon-to-be-released fifth edition of the “psychiatric bible,” the Diagnostic and Statistical Manual. The odds will probably be greater than 50 percent, according to the new manual, that you’ll have a mental disorder in your lifetime.
12 Apr 22:14

Anonymous To The Rescue In Canada Rape Case

firehose

and no, not many people are excited about it, including the victim's mother

After Rehtaeh Parsons was raped and cyberbullied, police dropped the case. Then she killed herself. Now Anonymous is demanding justice.
12 Apr 22:10

What is Bro Science? (by BroScienceLife) Brotege, french for...



What is Bro Science? (by BroScienceLife)

Brotege, french for Protege, which is a kind of muscle car

12 Apr 21:52

Wordpress Sites Under Wide-Scale Brute Force Attack

by Soulskill
firehose

great

New submitter NitzJaaron writes "Some of us have been experiencing attacks on Wordpress sites for the last few days, but it's now beginning to be widely reported that there's a fairly large brute force attack happening on Wordpress users on multiple hosts, including HostGator and LiquidWeb. 'This attack is well organized and again very, very distributed; we have seen over 90,000 IP addresses involved in this attack.' CloudFlare has announced that they're giving all users (free and paid) protection from said attacks with their services. 'The attacker is brute force attacking the WordPress administrative portals, using the username "admin" and trying thousands of passwords.'" Further reports available from Immotion hosting and Melbourne server hosting.

Share on Google+

Read more of this story at Slashdot.



12 Apr 21:51

Generating electricity from alcohol

by Mike Szczys

thermoelectric-generator-lamp

Here’s a thermoelectric generator which [x2Jiggy] built. The concept uses heat from a flame, biased against cooler temperatures produced by that huge heat sink making up the top portion of the build to produce electricity via the Peltier effect.

The build is passively cooled, using a sync assembly that takes advantage of heat pipes to help increase the heat dissipation. A nearly flat heat sink makes up the mounting surface for the hot side, which faces down toward a flame driving the generator. [x2Jiggy] started the project by using a can, wick, and olive oil as the heat source. He managed to get about 2V out of the system with this method. What you see here is the second version. It swaps out the olive oil lamp for an alcohol stove. The cans with holes punched in them act as a wind screen while also providing a stable base. This rendition produces about 3V, but it doesn’t sound like there are any precise measurements of what it can do under load.


Filed under: green hacks
12 Apr 21:51

Dan Teasdale leaves Twisted Pixel

by Richard Mitchell
Dan Teasdale leaves Twisted Pixel Twisted Pixel designer Dan Teasdale is moving on to (presumably) greener pastures. Today marks his last day at Twisted Pixel, Teasdale noted on Twitter. "I honestly thought something incredibly unique and amazing would have to come out of left field for me to even consider leaving," writes Teasdale. It would appear that just such an opportunity has arisen, though he's not sharing what it is just yet, saying only that "it's a shift in what I've been doing for the past 15 years."

Teasdale plans to take a break before his next venture begins, relaxing on a "Great American Road Trip" and working on his bizarre, recently Kickstarted app, Super Drake Tracker 2000 EX. The app tracks the flight status of Harmonix director of communication and brand management, John Drake. It also allows users to buy Drake a Diet Coke. The project originally sought $550, but went on to raise over $10,000.

For his part, Drake feels "weirdly responsible" for Teasdale's departure.

JoystiqDan Teasdale leaves Twisted Pixel originally appeared on Joystiq on Fri, 12 Apr 2013 16:15:00 EST. Please see our terms for use of feeds.

Permalink | Email this | Comments
12 Apr 21:21

Great Music Is 'As Good As Sex'

firehose

#soundstudies

Listening to great music is as good as sex, according to new research.
12 Apr 21:21

Meet The SWUGs Of Yale: Women ‘Washed Up’ At 21

To be a SWUG is to embrace “the slow, wine-filled decline of female sexual empowerment as we live out our college glory days. Welcome to the world of the ladies who have given up on boys because they don’t so much empower as frustrate, satisfy as agitate.”
12 Apr 21:20

Custom Neo Geo Video Game Consoles Made of Exotic Wood by Analogue Interactive

by Kimber Streams
firehose

ffgg

Black Label

Analogue Interactive, a site that sells beautifully designed wood Neo Geo consoles, has introduced the Black Label, a service which allows you to choose from hundreds of custom exotic woods. The Black Label sets comes with an Analogue CMVS Slim, two Analogue Arcade Sticks, solid brass Black Label tags, video and audio cables, and a power supply.

Black Label

images via Analogue Interactive

via Kotaku

12 Apr 21:20

Woman Puts Herself Into Pop Culture on Facebook With Custom Cover Photos

by Justin Page

Custom Facebook Profiles

Redditor RubberDogTurds has created a clever series of custom Facebook profile and cover photos that place her into popular films, television shows and video games. You may remember when we previously posted about a similar Facebook profile photo trick by Libby Cooper.

Custom Facebook Profiles

Custom Facebook Profiles

Custom Facebook Profiles

Custom Facebook Profiles

Custom Facebook Profiles

images via RubberDogTurds

12 Apr 21:19

▲∴⦿∴▲

by watcha
12 Apr 21:19

Limited Edition Geisha Themed Braces Are A Nice Touch With A...



Limited Edition Geisha Themed Braces Are A Nice Touch With A Dinner Jacket. 

12 Apr 21:19

21 Books Written by and About Women That Men Would Benefit From Reading

by Emily Temple
tinafey_bossypants.jpg Little, Brown and Company flavorpillheader.PNG

Suburban-Angst Films
The Stages of a Woman's Life, in Photos
Margaret Thatcher in Pop Culture


This week, Salon published a great interview with Meg Wolitzer (whose just-released novel The Interestings is currently being enjoyed by more than one Flavorwire staffer). "Men," she says, "with very few exceptions, won't read books about women." Though not exactly a new idea, this pronouncement gains a little force by coming hot on the heels of GQ's "The New Canon: The 21 Books from the 21st Century Every Man Should Read," which contains (you guessed it, drumroll please, etc.) three books written by women.

Though I won't disparage any of the books that made the list, I will offer my own—as an attempt to work towards ameliorating the problem laid out by Wolitzer and neatly exemplified byGQ. After all, though there are three books by women on their list, only the Munro could really be said to be primarily about them. Below are 21 books by and about women that every man should read.

atwood.jpg

The Handmaid's Tale, Margaret Atwood

Margaret Atwood is essential reading no matter your gender, and this chilling depiction of a dystopian future is one of her best. In the Republic of Gilead, women's rights have been completely eradicated, and the country is ruled by a racist, homophobic, misogynist, ultra-conservative cult. As Flavorwire editor-in-chief Judy Berman quipped, "This is every woman's worst nightmare that men have never thought about." So think about it.


bad behavior.jpg

Bad Behavior, Mary Gaitskill

Gaitskill's incredible collection is filled with women walking the borderlands—of sexual experience, of self-actualization, of family. This book digs under your skin, titillates, forces you to re-evaluate everything you ever thought about sex and love and what it means to be a person in the world. This book is terrifying.


born.jpg

A Guide to Being Born, Ramona Ausubel

This one doesn't come out until May, but I'll recommend it now for good measure. Ausubel's luminous collection is organized around the origins of life—that is, the stages of love, conception, gestation, and birth—but her stories aren't as simple as all that. Men may never be able to feel the fetus in their stomach and be sure that it is a three-headed giraffe, but with this collection, they'll at least get a taste.


fey.jpg

Bossypants, Tina Fey

Everyone likes Tina Fey, so this shouldn't be too hard a sell. The comedian's memoir is (obviously) hilarious, but also filled with reflections on being an awkward girl, a woman in show business, and a mother. You bros will be laughing so hard that you won't even realize you're learning about what it's like to be a real-life lady.


speed.jpg

Speedboat, Renata Adler

In her aforementioned interview, Meg Wolitzer laments, "Something nebulous and thought-based—a book of ideas—people seem much more willing to have that from a man than a woman." Well, here is exactly that: a loose, penetrating, ruthless, glorious novel about a young journalist making her way through New York City.


carter.jpg

The Bloody Chamber, Angela Carter

The modern fairy tale, whether in retelling or creation, has become a ripe area for feminist thought, for explorations of sexuality, for wit and irony and vulgarity to seep out of what was once a prim little moralistic package. No one does this better than Angela Carter, whose rich retellings of the classic tales thrum with blood and language.


flame.jpg

The Flamethrowers, Rachel Kushner

Here's a special lure for all you male readers: girl racing motorcycles across salt flats. Past that, the book is gritty and searing and immediately essential, a subtle novel about art and love and truth and a woman on a knife's edge. Read it.


moore1.jpg

Self-Help, Lorrie Moore

No one does wry brilliance better than Lorrie Moore. In this collection, she will teach you everything you need to know: how to talk to your mother, how to be an other woman, how to become a writer, how to live. Darkly comic and dazzling, it's a way inside the head of all the smart women you've ever known.


kate.jpg

Heroines, Kate Zambreno

In Heroines, Zambreno traces the impact—or rather, the exiling—of the female experience on and from literature, untangling the stories of "the mad wives of modernism" both historical and fictional, "who died in the asylum. Locked away, rendered safe. Forgotten, erased, or rewritten." Enlightening and intense, it's a must-read.


kind.jpg

Kindred, Octavia Butler

In this novel, a 26-year-old modern black woman is suddenly (and then repeatedly) transported back in time to a slave plantation in the antebellum South, where she is subjected to all the harshest parts of slavery as she protects the son of a slaveowner. Rarely does social criticism come with such incendiary storytelling.


left.jpg

The Left Hand of Darkness, Ursula K. Le Guin

All right, I'm cheating with this one a little, since it can't be properly said to be about women at all—instead, it's about a human man who travels to an alien planet populated by a race of beings who are genderless, or rather unisex, able to assume either binary gender during reproduction. The novel is beautiful and filled with timeless philosophical insights as to the nature of humanity and society—a definite classic I'm happy to make an exception for here.


dora_edited-1.jpg

Dora: A Headcase, Lidia Yuknavitch

Yuknavitch's protagonist, the 17-year-old Ida, is a modern reincarnation of Freud's famous bisexual case study Dora, whom our most famous shrink deemed "hysterical." Ida may be a bit "hysterical" too—but she's taking back the term. She's raunchy, irreverent, filled with the desire to strip naked in the middle of "Nordfucks" or shave her head, sidekicked by a beautiful gang of weirdos. "I want to create new girl myths," Yuknavitch said of the book. I think everyone should read them.


second.jpg

The Second Sex, Simone de Beauvoir

"I hesitated a long time before writing a book on woman," De Beauvoir begins. "The subject is irritating, especially for women; and it is not new. Enough ink has flowed over the quarrel about feminism; it is now almost over: let's not talk about it anymore." This was in 1959—and the sentiment is as fresh now as it was then, just like (most of) the rest of De Beauvoir's lucid book, equal parts literary and philosophical. All else aside, it's one of the most classic feminist texts in the language. And men should read more of those.


warrior.jpg

The Woman Warrior, Maxine Hong Kingston

Maxine Hong Kingston's take on the memoir blends her personal experiences with traditional Chinese folktales, examining the Chinese-American experience as well as the female one, taking on the cultural source of oppression, something we could all do to think more about. She writes: "There is a Chinese word for the female I—which is 'slave.' Break the women with their own tongues!" So why even be a girl? "I refused to cook. When I had to wash dishes, I would crack one or two. 'Bad girl,' my mother yelled, and sometimes that made me gloat rather than cry. Isn't a bad girl almost a boy?" This is the kind of thing most boys never have to think about.


plath.jpg

The Bell Jar, Sylvia Plath

It's pretty much a given that everyone should read The Bell Jar, but I'll just drive the point home again—it's a look into the conflicted mind of a tortured genius snuffed out too soon.


mirth.jpg

The House of Mirth, Edith Wharton

There is so much in this book that carries over perfectly to the modern era. Sure, maybe not the idea of tableaux vivants as party diversions, but the double standards for men and women, the vicious social games women play with each other, the perils of depending on another person—these issues are all alive and well. Plus, the novel is phenomenal. Can't go wrong.


pym.jpg

Excellent Women, Barbara Pym

John Updike, male of all males, called this high comedic novel "a startling reminder that solitude may be chosen and that a lively, full novel can be constructed entirely within the precincts of that regressive virtue, feminine patience." What the never-married, witty but mild-mannered Mildred Lathbury would have to say about that, I cannot say.


colette.jpg

The Complete Claudine, Colette

Though Colette's frisky stories aren't nearly as scandalous today as they were when they were first printed, she is still a giant of French literature, and her writing is just about as daring, sexy, gorgeous, and smart as she. As this book's introduction describes it, Colette is "[a]ccessible and elusive; greedy and austere; courageous and timid; subversive and complacent; scorchingly honest and sublimely mendacious; an inspired consoler and an existential pessimist -- these are the qualities of the artist and the woman." A must for any reader who sees female writing as only one thing.


drinking.jpg

Drinking With Men, Rosie Schaap

Men love bar stories, right? Funny, smart, and insightful, Schaap's memoir as a drinking buddy will make you a better person.


inferno.jpg

Inferno, Eileen Myles

Some men might be put off by a "poet's novel," but we bet they'll be on board once they read that killer first line: "My English professor's ass was so beautiful." Myles can be difficult, but she can also be incredible, and in this story of a young poet's self-actualization, she's both. Take note.


persepolis.jpg

Persepolis, Marjane Satrapi

I maintain that Satrapi's beloved graphic memoir of growing up in Iran during the Islamic Revolution is a must-read for absolutely everyone, so including it here is a no-brainer. What does it mean to be a tough little girl into rock music in a country that suppresses their women? What does it mean to be a tough little girl? Satrapi will tell you with grace, humor and delightful illustrations.

This post also appears on Flavorpill, an Atlantic partner site.
    


12 Apr 20:18

Aspect-Oriented Programming in PHP with Go!

by Patkos Csaba

The concept of Aspect-Oriented Programming (AOP) is fairly new to PHP. There’s currently no official AOP support in PHP, but there are some extensions and libraries which implement this feature. In this lesson, we’ll use the Go! PHP library to learn AOP in PHP, and review when it can be helpful.


A Brief History of AOP

Aspect-Oriented programming is like a new gadget for geeks.

The term Aspect-Oriented Programming took shape in the mid-1990s, inside a small group at Xerox Palo Alto Research Center (PARC). AOP was considered controversial in its early days — as is the case with any new and interesting technology — mostly due to its lack of clear definition. The group made the conscious decision to release it in a half-baked form, in order to let the larger community provide feedback. At the heart of the problem was the “Separation of Concerns” concept. AOP was one possible solution to separate concerns.

AOP matured in the late 1990s, when Xerox released AspectJ, and IBM followed suit with their Hyper/J in 2001. Today, AOP is a well-established technology that has been adopted by most common programming languages.


The Basic Vocabulary

At the heart of AOP is the aspect, but before we can define “aspect,” we must discuss two other terms: point-cut and advise. A point-cut represents a moment in our source code, specifying the right moment to run our code. The code that executes at a point-cut is called, advise, and the combination of one or more point-cuts and advises is the aspect.

Typically, each class has one core behavior or concern, but in many situations, a class may exhibit secondary behavior. For example, a class may need to call a logger or notify an observer. Because these functionalities are secondary, their behavior is mostly the same for all the classes that exhibit them. This scenario is called a cross-concern; these can be avoided by using AOP.


The Various AOP Tools for PHP

Chris Peters already discussed the Flow framework for AOP in PHP. Another AOP implementation can be found in the Lithium framework.

Another framework took a different approach, and created a complete PHP extension in C/C++, performing its magic on the same level as the PHP interpreter. It is called the AOP PHP Extension, and I may discuss it in a future article.

But as I noted earlier, for this tutorial, we’ll review the Go! AOP-PHP library.


Installing and Preparing Go!

The Go! library is not an extension; it’s completely written in PHP for PHP 5.4 and higher. Being just a plain PHP library allows for easy deployment, even in restrictive, shared-hosting environments that do not allow you to compile and install your own PHP extensions.

Install Go! with Composer

Composer is the preferred method for installing PHP packages. If you do not have access to Composer, you can always download it from the Go! GitHub repository.

First, add the following lines to your composer.json file.

{
    "require": {
        "lisachenko/go-aop-php": "*"
    }
}

Next, use Composer to install go-aop-php. Run the following command from a terminal:

$ cd /your/project/folder
$ php composer.phar update lisachenko/go-aop-php

Composer will install the required packages and dependencies in just a few seconds. If successful, you should see something similar to the following output:

Loading composer repositories with package information
Updating dependencies
  - Installing doctrine/common (2.3.0)
    Downloading: 100%

  - Installing andrewsville/php-token-reflection (1.3.1)
    Downloading: 100%

  - Installing lisachenko/go-aop-php (0.1.1)
    Downloading: 100%

Writing lock file
Generating autoload files

After the installation has completed, you will find a directory, called vendor, in your source folder. The Go! library and its dependencies are installed there.

$ ls -l ./vendor
total 20
drwxr-xr-x 3 csaba csaba 4096 Feb  2 12:16 andrewsville
-rw-r--r-- 1 csaba csaba  182 Feb  2 12:18 autoload.php
drwxr-xr-x 2 csaba csaba 4096 Feb  2 12:16 composer
drwxr-xr-x 3 csaba csaba 4096 Feb  2 12:16 doctrine
drwxr-xr-x 3 csaba csaba 4096 Feb  2 12:16 lisachenko

$ ls -l ./vendor/lisachenko/
total 4
drwxr-xr-x 5 csaba csaba 4096 Feb  2 12:16 go-aop-php

Integrate Go! Into Our Project

We need to create a call that sits between the routing/entry point of our application. The autoloader then automatically includes the class. Go! refers to this as an Aspect Kernel.

use Go\Core\AspectKernel;
use Go\Core\AspectContainer;

class ApplicationAspectKernel extends AspectKernel {

	protected function configureAop(AspectContainer $container) {

	}

	protected function getApplicationLoaderPath() {

	}

}

Today, AOP is a well-established technology that has been adopted by most common programming languages.

For this example, I’ve created a directory, called Application, and added a new class file, ApplicationAspectKernel.php within it.

Our aspect kernel extends Go!’s abstract AspectKernel class, which provides the basic functionality that the aspect kernel requires to do its job. There are two methods we must implement: configureAop(), which registers our future aspects, and getApplicationLoaderPath(), which provides a string representing the full path to the application’s autoloader.

For now, simply create an empty autoload.php file in your Application directory, and change the getApplicationLoaderPath() method, accordingly.

// [...]
class ApplicationAspectKernel extends AspectKernel {

	// [...]

	protected function getApplicationLoaderPath() {
		return __DIR__ . DIRECTORY_SEPARATOR . 'autoload.php';
	}

}

Don’t worry about autoload.php just yet; we’ll fill in the missing pieces shortly.

When I first installed Go! and reached this point of my process, I felt the need to run some code. So let’s begin building a small application!


Creating A Simple Logger

Our aspect will be a simple logger, but we first need some code to watch before we start with the main portion of our application.

Create A Minimal Application

Our small application will be an electronic broker, capable of buying and selling shares.

class Broker {

	private $name;
	private $id;

	function __construct($name, $id) {
		$this->name = $name;
		$this->id = $id;
	}

	function buy($symbol, $volume, $price) {
		return $volume * $price;
	}

	function sell($symbol, $volume, $price) {
		return $volume * $price;
	}

}

This code is quite simple. The Broker class has two private fields that store the broker’s name and ID.

This class also offers two methods, buy() and sell() for buying and selling shares, respectively. Each of these methods accepts three arguments: the share’s symbol, the number of shares, and the price per share. The sell() method sells the shares and then calculates the total money received. Conversely, the buy() method buys the shares and calculates the total money spent.

Exercise Our Broker

We can easily exercise our Broker by writing a PHPUnit test. Create a directory, called Test inside the Application directory, and, within it, add a new file, BrokerTest.php. Append the following code to that file:

require_once '../Broker.php';

class BrokerTest extends PHPUnit_Framework_TestCase {

	function testBrokerCanBuyShares() {
		$broker = new Broker('John', '1');
		$this->assertEquals(500, $broker->buy('GOOGL', 100, 5));
	}

	function testBrokerCanSellShares() {
		$broker = new Broker('John', '1');
		$this->assertEquals(500, $broker->sell('YAHOO', 50, 10));
	}

}

This test simply checks the return values of the broker’s methods. We can run this test and see that our code is at least syntactically correct.

Add an Auto Loader

Let’s create an autoloader that physically loads the classes that our application needs. This will be a simple loader, based on the PSR-0 autoloader.

ini_set('display_errors', true);

spl_autoload_register(function($originalClassName) {
    $className = ltrim($originalClassName, '\\');
    $fileName  = '';
    $namespace = '';
    if ($lastNsPos = strripos($className, '\\')) {
        $namespace = substr($className, 0, $lastNsPos);
        $className = substr($className, $lastNsPos + 1);
        $fileName  = str_replace('\\', DIRECTORY_SEPARATOR, $namespace) . DIRECTORY_SEPARATOR;
    }
    $fileName .= str_replace('_', DIRECTORY_SEPARATOR, $className) . '.php';

    $resolvedFileName = stream_resolve_include_path($fileName);
    if ($resolvedFileName) {
        require_once $resolvedFileName;
    }
    return (bool) $resolvedFileName;
});

That’s all we need for the autoload.php file. Now, change BrokerTest.php to require the autoloader instead of Broker.php class.

require_once '../autoload.php';

class BrokerTest extends PHPUnit_Framework_TestCase {
	// [...]
}

Running BrokerTest proves that the code still works.

Connecting to Application Aspect Kernel

Our final step is to configure Go!. We need to connect all the components so that they work in harmony. First, create a file, called AspectKernelLoader.php, and add the following code:

include __DIR__ . '/../vendor/lisachenko/go-aop-php/src/Go/Core/AspectKernel.php';
include 'ApplicationAspectKernel.php';

ApplicationAspectKernel::getInstance()->init(array(
    'autoload' => array(
        'Go'               => realpath(__DIR__ . '/../vendor/lisachenko/go-aop-php/src/'),
        'TokenReflection'  => realpath(__DIR__ . '/../vendor/andrewsville/php-token-reflection/'),
        'Doctrine\\Common' => realpath(__DIR__ . '/../vendor/doctrine/common/lib/')
    ),
    'appDir' => __DIR__ . '/../Application',
    'cacheDir' => null,
    'includePaths' => array(),
    'debug' => true
));

We need to connect all the components so that they work in harmony.

This file sits between the front controller and the autoloader. It uses the AOP infrastructure to initialize and call the autoload.php when needed.

In the first line, we explicitly include AspectKernel.php and ApplicationAspectKernel.php. These files must be explicitly included, because, remember, we have no autoloader at this point.

In the following code segment, we call the init() method on the ApplicationAspectKernel object and pass it an array of options:

  • autoload defines the paths to initialize for the AOP library. Adjust the paths according to your directory structure.
  • appDir refers to the application’s directory.
  • cacheDir specifies a cache directory (we’ll ignore this for this tutorial).
  • includePaths represents a filter for the aspects. We want all the specified directories to be watched, so leave this array empty to watch everything.
  • debug provides extra debugging information, which is useful for development, but you should set it to false for deployed applications.

To finalize the connection between the different pieces, find all references to autoload.php in your project and replace them with AspectKernelLoader.php. In our simple example, only the test file requires modification:

require_once '../AspectKernelLoader.php';

class BrokerTest extends PHPUnit_Framework_TestCase {

// [...]

}

For bigger projects, you may find that it’s useful to use bootstrap.php for PHPUnit; the require_once() for autoload.php or our AspectKernelLoader.php should be included there.

Log the Broker’s Methods

Create a file, called BrokerAspect.php, and add the following code:

use Go\Aop\Aspect;
use Go\Aop\Intercept\FieldAccess;
use Go\Aop\Intercept\MethodInvocation;
use Go\Lang\Annotation\After;
use Go\Lang\Annotation\Before;
use Go\Lang\Annotation\Around;
use Go\Lang\Annotation\Pointcut;
use Go\Lang\Annotation\DeclareParents;

class BrokerAspect implements Aspect {

	/**
	 * @param MethodInvocation $invocation Invocation
	 * @Before("execution(public Broker->*(*))") // This is our PointCut
	 */
	public function beforeMethodExecution(MethodInvocation $invocation) {
		echo "Entering method " . $invocation->getMethod()->getName() . "()\n";
	}
}

We begin by specifying several use statements for the AOP infrastructure. Then, we create our aspect class, called BrokerAspect, which must implement Aspect. Next, we specify the matching logic for our aspect:

* @Before("execution(public Broker->*(*))")
  • @Before specifies when to apply the advice. Possibilities are @Before, @After, @Around and @AfterThrowing.
  • "execution(public Broker->*(*))" specifies the matching rule as the execution of any public method on a class, called Broker, with any number of parameters. The syntax is: [operation - execution/access]([method/attribute type - public/protected] [class]->[method/attribute]([params])

Please note that the matching mechanism is admittedly somewhat awkward. You can use only one ‘*‘ (star) in each part of the rule. For example, public Broker-> matches a class, called Broker. public Bro*-> matches any class starting with Bro, and public *ker-> matches any class ending with ker.

public *rok*-> will not match anything; you may not use more than one star for the same match.

The method following the matcher will be called when the event occurs. In our case, the method executes before each call on one of Broker‘s public methods. A parameter, called $invocation (of type MethodInvocation), is automatically passed to our method. This object provides different ways of obtaining information about the called method. In this first example, we use it to obtain the method’s name and print it.

Registering The Aspect

Merely defining an aspect is not enough; we need to register it into the AOP infrastructure. Otherwise, it will not be applied. Edit ApplicationAspectKernel.php and call registerAspect() on the container in the configureAop() method:

use Go\Core\AspectKernel;
use Go\Core\AspectContainer;

class ApplicationAspectKernel extends AspectKernel
{

    protected function getApplicationLoaderPath()
    {
        return __DIR__ . DIRECTORY_SEPARATOR . 'autoload.php';
    }

    protected function configureAop(AspectContainer $container)
    {
        $container->registerAspect(new BrokerAspect());
    }
}

Run the tests and check the output. You should see something similar to the following:

PHPUnit 3.6.11 by Sebastian Bergmann.

.Entering method __construct()
Entering method buy()
.Entering method __construct()
Entering method sell()
Time: 0 seconds, Memory: 5.50Mb

OK (2 tests, 2 assertions)

So we’ve managed to run code whenever something happens on the broker.

Finding Parameters and Matching @After

Let’s add another method to the BrokerAspect.

// [...]
class BrokerAspect implements Aspect {

	// [...]

	/**
	 * @param MethodInvocation $invocation Invocation
	 * @After("execution(public Broker->*(*))")
	 */
	public function afterMethodExecution(MethodInvocation $invocation) {
		echo "Finished executing method " . $invocation->getMethod()->getName() . "()\n";
		echo "with parameters: " . implode(', ', $invocation->getArguments()) . ".\n\n";
	}
}

This method runs after a public method executes (note the @After matcher). We then add another line to output the parameters used to call the method. The output of our test now is:

PHPUnit 3.6.11 by Sebastian Bergmann.

.Entering method __construct()
Finished executing method __construct()
with parameters: John, 1.

Entering method buy()
Finished executing method buy()
with parameters: GOOGL, 100, 5.

.Entering method __construct()
Finished executing method __construct()
with parameters: John, 1.

Entering method sell()
Finished executing method sell()
with parameters: YAHOO, 50, 10.

Time: 0 seconds, Memory: 5.50Mb

OK (2 tests, 2 assertions)

Getting Return Values and Manipulating Execution

So far, we’ve learned how to run extra code before and after a method executes. While this is nice, it’s not overly useful if we can’t see what the methods return. Let’s add another method to the aspect and modify the existing code:

 //[...]
class BrokerAspect implements Aspect {

	/**
	 * @param MethodInvocation $invocation Invocation
	 * @Before("execution(public Broker->*(*))")
	 */
	public function beforeMethodExecution(MethodInvocation $invocation) {
		echo "Entering method " . $invocation->getMethod()->getName() . "()\n";
		echo "with parameters: " . implode(', ', $invocation->getArguments()) . ".\n";
	}

	/**
	 * @param MethodInvocation $invocation Invocation
	 * @After("execution(public Broker->*(*))")
	 */
	public function afterMethodExecution(MethodInvocation $invocation) {
		echo "Finished executing method " . $invocation->getMethod()->getName() . "()\n\n";
	}

	/**
	 * @param MethodInvocation $invocation Invocation
	 * @Around("execution(public Broker->*(*))")
	 */
	public function aroundMethodExecution(MethodInvocation $invocation) {
		$returned = $invocation->proceed();
		echo "method returned: " . $returned . "\n";

		return $returned;
	}

}

Merely defining an aspect is not enough; we need to register it into the AOP infrastructure.

This new code moves the parameter information to the @Before method. We also add another method with the special @Around matcher. This is neat, because the original matched method call is wrapped inside the aroundMethodExecution() function, effectively supressing the original invocation. Inside the advise, we need to call $invocation->proceed(), in order to execute the original call. If you don’t do this, the original call will not occur.

This wrapping also allows us to manipulate the returned value. What we return in our advise is what returns in the original call. In our case, we didn’t change anything, and your output should look like this:

PHPUnit 3.6.11 by Sebastian Bergmann.

.Entering method __construct()
with parameters: John, 1.
method returned:
Finished executing method __construct()

Entering method buy()
with parameters: GOOGL, 100, 5.
method returned: 500
Finished executing method buy()

.Entering method __construct()
with parameters: John, 1.
method returned:
Finished executing method __construct()

Entering method sell()
with parameters: YAHOO, 50, 10.
method returned: 500
Finished executing method sell()

Time: 0 seconds, Memory: 5.75Mb

OK (2 tests, 2 assertions)

Let’s play a little and offer a discount for a specific broker. Return to the test class, and write the following test:

require_once '../AspectKernelLoader.php';

class BrokerTest extends PHPUnit_Framework_TestCase {

	// [...]

	function testBrokerWithId2WillHaveADiscountOnBuyingShares() {
		$broker = new Broker('Finch', '2');
		$this->assertEquals(80, $broker->buy('MS', 10, 10));
	}

}

This will fail with:

Time: 0 seconds, Memory: 6.00Mb

There was 1 failure:

1) BrokerTest::testBrokerWithId2WillHaveADiscountOnBuyingShares
Failed asserting that 100 matches expected 80.

/home/csaba/Personal/Programming/NetTuts/Aspect Oriented Programming in PHP/Source/Application/Test/BrokerTest.php:19
/usr/bin/phpunit:46

FAILURES!
Tests: 3, Assertions: 3, Failures: 1.

Next, we need to modify the broker to provide its ID. Just implement a getId() method, as demonstrated below:

class Broker {

	private $name;
	private $id;

	function __construct($name, $id) {
		$this->name = $name;
		$this->id = $id;
	}

	function getId() {
		return $this->id;
	}

	// [...]

}

Now, modify the aspect to adjust the buying price for a broker with an ID of 2.

 // [...]
class BrokerAspect implements Aspect {

	// [...]

	/**
	 * @param MethodInvocation $invocation Invocation
	 * @Around("execution(public Broker->buy(*))")
	 */
	public function aroundMethodExecution(MethodInvocation $invocation) {
		$returned = $invocation->proceed();
		$broker = $invocation->getThis();

		if ($broker->getId() == 2) return $returned * 0.80;
		return $returned;
	}

}

Instead of adding a new method, just modify the aroundMethodExecution() function. It now only matches methods, called ‘buy‘, and triggers $invocation->getThis(). This effectively returns the original Broker object so that we may execute its code. And so we did! We ask the broker for its ID, and offer a discount if the ID is equal to 2. The test now passes.

PHPUnit 3.6.11 by Sebastian Bergmann.

.Entering method __construct()
with parameters: John, 1.
Finished executing method __construct()

Entering method buy()
with parameters: GOOGL, 100, 5.
Entering method getId()
with parameters: .
Finished executing method getId()

Finished executing method buy()

.Entering method __construct()
with parameters: John, 1.
Finished executing method __construct()

Entering method sell()
with parameters: YAHOO, 50, 10.
Finished executing method sell()

.Entering method __construct()
with parameters: Finch, 2.
Finished executing method __construct()

Entering method buy()
with parameters: MS, 10, 10.
Entering method getId()
with parameters: .
Finished executing method getId()

Finished executing method buy()

Time: 0 seconds, Memory: 5.75Mb

OK (3 tests, 3 assertions)

Matching Exceptions

We can now execute extra code when a method is entered, after it executes and around it. But what if a method throws an exception?

Add a test method to buy a large number of shares:

function testBuyTooMuch() {
	$broker = new Broker('Finch', '2');
	$broker->buy('MS', 10000, 8);
}

Now, create an exception class. We need this because the built-in Exception class cannot be caught by Go! AOP or PHPUnit.

class SpentTooMuchException extends Exception {

	public function __construct($message) {
		parent::__construct($message);
	}

}

Modify the broker to throw an exception for a large value:

class Broker {

	// [...]

	function buy($symbol, $volume, $price) {
		$value = $volume * $price;
		if ($value > 1000)
			throw new SpentTooMuchException(sprintf('You are not allowed to spend that much (%s)', $value));
		return $value;
	}

	// [...]

}

Run the tests and ensure that they fail:

Time: 0 seconds, Memory: 6.00Mb

There was 1 error:

1) BrokerTest::testBuyTooMuch
Exception: You are not allowed to spend that much (80000)

/home/csaba/Personal/Programming/NetTuts/Aspect Oriented Programming in PHP/Source/Application/Broker.php:20
// [...]
/home/csaba/Personal/Programming/NetTuts/Aspect Oriented Programming in PHP/Source/Application/Broker.php:47
/home/csaba/Personal/Programming/NetTuts/Aspect Oriented Programming in PHP/Source/Application/Test/BrokerTest.php:24
/usr/bin/phpunit:46

FAILURES!
Tests: 4, Assertions: 3, Errors: 1.

Now, expect the exception (in the test) and make sure they pass:

class BrokerTest extends PHPUnit_Framework_TestCase {

	// [...]

	/**
     * @expectedException SpentTooMuchException
     */
	function testBuyTooMuch() {
		$broker = new Broker('Finch', '2');
		$broker->buy('MS', 10000, 8);
	}

}

Create a new method in our aspect to match @AfterThrowing, and don’t forget to specify Use Go\Lang\Annotation\AfterThrowing;

 // [...]
Use Go\Lang\Annotation\AfterThrowing;

class BrokerAspect implements Aspect {

	// [...]

	/**
	 * @param MethodInvocation $invocation Invocation
	 * @AfterThrowing("execution(public Broker->buy(*))")
	 */
	public function afterExceptionMethodExecution(MethodInvocation $invocation) {
		echo 'An exception has happened';
	}

}

The @AfterThrowing matcher suppresses the thrown exception and allows you to take your own action. In our code, we simply echo a message, but you may do whatever your application requires.


Final Thoughts

This is why I urge you to use aspects with care.

Aspect oriented programming is like a new gadget for geeks; you can immediately see its great potential. Aspects allows us to introduce extra code in different parts of our system without modifying the original code. This can prove to be immensely helpful, when you need to implement modules that pollute your methods and classes with tightly coupled references and method calls.

This flexibility, however, comes with a price: obscurity. There is no way to tell if an aspect watches a method just by looking at the method or its class. For example, there is no indication in our Broker class that anything happens when its methods execute. This is why I urge you to use aspects with care.

Our use of the aspect to offer a discount for a specific broker is an example of misuse. Refrain from doing that in a real project. A broker discount is related to brokers; so, keep that logic in the Broker class. Aspects should only perform tasks that do not directly relate to the object’s primary behavior.

Have fun with this!

12 Apr 20:07

Dragon's Crown trailer shows a bit too much of the Sorceress

by JC Fletcher
firehose

games, games, games

Dragon's Crown Sorceress mini
So here's our problem with Dragon's Crown. The art is technically very well-done, and almost entirely, unreservedly beautiful to look at. It's one of the most impressive 2D creations ever. But there are also ... problematic aspects to it.

And by "aspects" we mean the Sorceress, whose carefully drawn voluptuousness and general lack of clothing makes a game we'd think everyone should see just that much harder to show off. Speaking of which, maybe don't watch this at work.

JoystiqDragon's Crown trailer shows a bit too much of the Sorceress originally appeared on Joystiq on Fri, 12 Apr 2013 13:00:00 EST. Please see our terms for use of feeds.

Permalink | Email this | Comments
12 Apr 19:51

Birthday Cake Martini

by elsiecake
firehose

when's your birthday Russian Sledges

Birthday Cake MartiniDo you have a birthday coming up? Or a friend's birthday? Or a very merry UNbirthday? If so, we have the perfect martini just for you! It tastes like a cake and there are sprinkles. Basically, it's the most indulgent martini ever... very fitting for a birthday, don't you agree?Birthday Cake Cocktail RecipeBirthday Cake Martini, Serves One 

3 ounces fluffed marshmallow vodka 
1 ounce cream of coconut (be sure to stir well before using!)
2 ounces Amaretto
3 ounces Godiva White Chocolate Liqueur
Honey
Sprinkles (I used nonpareils)

In a mixer, combine Vodka, coconut, Amaretto and White Chocolate Liqueur. Add ice and shake. Serve in a glass rimmed with sprinkles!How to rim a glass with honey + sprinkles!How to rim a glass with honey + sprinkles!I always use honey to rim my glasses... just like this. You can see I'm taking a practice round with another glass here. Gotta get it just right! :)Birthday Cake Cocktail (magic!!)Sprinkle a few on the top too. When they sink down into the glass they will start to bleed color, it's really pretty!The best birthday martini ever!Now I want it to be somebody's birthday. Cheers! Elsie

12 Apr 19:10

Tattoo You

12 Apr 19:08

11 Rejected Canadian Flag Designs

Here's a fun fact: Canada didn't have an official national flag until February 15, 1965. A not-so-fun fact: choosing one caused a huge divide in both public and political opinions, and the matter had to be settled by cloture in the Canadian House of Commons.
12 Apr 19:08

magpieandwhale: kaydeefalls: theletteraesc: The daily...



magpieandwhale:

kaydeefalls:

theletteraesc:

The daily headline in my brain.

This is the kind of week I’m having.

Ah, the siren call of my chosen profession.

12 Apr 19:06

"Mycroft's Delight"

firehose

Holmes fandom is reliably crazy

(Author’s note: I wrote / posted this about a year ago. Somewhere along the line last year I took it down. I have no damn idea why. So I’m putting it up again. The writing’s okay, and the recipe’s worth resharing.)


Mycroft’s Delight (aka, Double Chocolate Courvoisier Torte with Brandied Buttercream Filling and Two Icings [Brandied Nutella Frosting and Cream Cheese & White Chocolate Ganache Glaze])

(…Fic first. Recipe after.)


Mycroft… knows that power, especially when it leans so close to the absolute, must be constantly tested to prove that its foundations are sound. Its bearer’s weak points must be laid bare, examined, reinforced, then stress-tested again. And for Mycroft, cake is a weak point. It would be irrational to deny it.

So when it comes time for him to do the quarterly assessment of his strengths and his ability to manage his weaknesses, not just any cake will do. He requires something truly dangerous, a veritable Moriarty among cakes… so that his mettle can be tested, and proven not wanting, at the highest possible level. And finding the worthy antagonist for such tests has occasionally proven as much fun as the test itself…





Once upon a time, in somber mood, Mycroft Holmes asked Dr. John Watson what, in the light of the qualities of Sherlock’s mind and certain piratical tendencies, one might deduce about his brother’s heart. He asked this — so John thought later — seemingly with no great concern that any similar question might be asked about him. And indeed few men, or women either (Anthea aside) would be correctly positioned to either ask or answer. Sherlock, if the subject arose, would probably roll out the heavy-gauge snark and suggest that in his brother’s case, the way to his heart is almost certainly via his stomach — but due to the first organ’s tiny wizened size, something’s apparently gone wrong with the connections to the second, so that incoming material inevitably continues through the system in the normal boring fashion…hence Mycroft’s never-ending diet.

When this issue comes up in conversation, as with Sherlock it always does, Mycroft mostly just sighs: because the nature of his job mandates that he keep himself in proper condition to do it, and this issue has accordingly been folded into his personal security and self-defense portfolio. Other aspects of that portfolio are slightly less controversial between him and Sherlock: the invisibly armored black cars, the overarmed, overtrained drivers, the redoubtable Anthea and her watchstanding colleagues — about whose gifts even Mycroft is glad to relax into don’t-need-to-know mode. He does know that the Double-0’s (though not necessarily their watchful Quartermasters) tend to exit the soi-disant “International Exports” building en masse to avoid embarrassment (theirs) when they see Mycroft’s Angels coming in to do their yearly sidearm and unarmed-combat certifications with their normal no-testosterone-needed competence.

And then of course there’s Mycroft’s final line of defense, which almost no one suspects because that umbrella looks so very, very slim. (The inevitable rumors have made the rounds about hidden ricin pellets, but these are unfounded.) Naturally, Anthea knows what the umbrella’s hiding. Equally naturally, Sherlock long ago deduced what’s in there. And in his very mellowest moods — stretched out beside the midnight fire and cradling the violin, with John cozily dozed-off in the opposite chair — the world’s only consulting detective will sometimes allow himself a tiny, secret smile when the issue comes up for consideration. If he was able to speak a civil word to his brother without arousing his suspicions, he might even some day admit to being obscurely touched that Mycroft carries with him everywhere, invisible in plain sight, a perfectly tempered, razor-edged reminder of the long golden childhood afternoons when they played the Pirate Game together with shouts and sticks, before moving on to edgy adolescence and beginning to routinely drive each other mad.

About the diet, though, Sherlock unfailingly rags Mycroft without mercy: and it’s really most unfair, because it does work. Mycroft has for some years employed the Rotation Diet, which after a truly Holmesian level of assessment he eventually determined was the most effective tool for his own purposes. It sets a rational intake and (surprisingly light) exercise baseline, does a good job of fooling his metabolism into burning more calories than it should, and allows for the inevitable ups and downs of his work life: and in particular it allows for “free weeks” during which one may safely go a bit off the rails.

This is important to Mycroft, because he knows that power, especially when it leans so close to the absolute, must be constantly tested to prove that its foundations are sound. Its bearer’s weak points must be laid bare, examined, reinforced, then stress-tested again. And for Mycroft, cake is a weak point. It would be irrational to deny it.

So when it comes time for him to do the quarterly assessment of his strengths and his ability to manage his weaknesses, not just any cake will do. He requires something truly dangerous, a veritable Moriarty among cakes… so that his mettle can be tested, and proven not wanting, at the highest possible level. And finding the worthy antagonist for such tests has occasionally proven as much fun as the test itself.

Now, Mycroft has more than once had reason to be pleased that he can count among his closer acquaintances a gentleman who occasionally serves a neighboring European government in a capacity similar to Mycroft’s. This gentleman — whose codename is “Colin” — while confabulating with Mycroft late one night over brandies at the Diogenes, let slip (in that particular sort of casual manner meant to suggest to his counterpart that the matter’s not casual at all) that he knows a woman who has a close connection at Confiserie Sprüngli in Zürich.

This made Mycroft’s eyebrows go up with interest. That choice place near the lakeside end of the Bahnhofstrasse, under the shade of the linden trees, is known and honored among chocolate lovers the world over for the suave intensity of its productions; and the best of its cakes, the truffle cake, is truly a thing of beauty, if a bit lightweight for Mycroft’s requirements. However, Sprüngli proper, as it turns out, was not the epicenter of his colleague’s interest. Colin told Mycroft of how in a moment of weakness (possibly fueled by a bit too much after-hours kirsch), the Sprüngli confectioner shared with Colin’s female associate a tale of something extraordinary, a secret hidden away among the mountain peaks a couple hundred kilometers south: a link to something in both his, and Mycroft’s and Colin’s, lines of work — something both richly confectionery and tantalizingly historical, and something that poses a possible solution to Mycroft’s upcoming quarterly quandary.

At the juncture of the two mountain chains that bisect Switzerland north-to-south and east-to-west, there is a strategic pass: and guarding the heart of that pass is a garrison town called Andermatt. The place is placid in the obvious way that only army towns with a secret to keep can be. On the surface everything seems quite calm, the normal Swiss efficiency overlaying everyday life and the normal tourist influx to the local ski areas, while Swiss soldiers on deployment come and go, mostly by rail, doing yearly duty rotations and coming back from operational maneuvers in the most S.O.P.-ish manner.

Mycroft, of course, by virtue of his office knows for a certainty what some Swiss suspect — that all the mountains around Andermatt are tunneled deep with caves not made by nature, and stuffed full nigh to bursting with assorted military hardware of a nature that would cause the most dreadful fuss if word ever got out. Of course it does not: here also the Swiss are most efficient. What Mycroft knows about the business often makes him smile… but not as much as he now smiles about the Andermatt neighborhood’s great nonmilitary secret. For just over the mountain wall to the eastward, through the smaller gateway valley called the Oberalppass, lies something far more interesting to Mycroft in the near term than the three mountains with the fighter-plane dispensers inside, the concealed death rays, and the buried nukes. And this secret is… a cake.

It must be said here that if Mycroft has another weakness besides cake, it’s an unquenchable thirst for life’s resonances. If one can see Moriarty as a manipulative, string-pulling, malice-bloated spider at the heart of a farflung web of information meant to be turned to evil purpose, then one can also conceive of Mycroft as the queen bee (yes, shut up, Sherlock, truly it’s getting quite old) at the heart of a vast, humming hive of historical and modern data; an exquisitely tone-sensitive analyst tuned to the chorused thrumming of past, present and likely future, and graced with the synthesis gift, the ability to hook that old or distant or unlikely solution to this new problem and cause things to sort themselves out for the best. Very occasionally, being human, he fails at this — especially and most painfully when dealing with problems closest to him. The resonances tend to fall out of phase then, or their sines cancel — and when he fails, he does so, to his endless grief, spectacularly. But mostly Mycroft succeeds, and as a result goes on year by year professionally listening to the hum of history, trying to stay alert to past errors while analyzing what’s in tune, what’s not, and how it all resonates with the now. And the resonances are always key. They’re a sign of the universe trying to heal its own wounds or suggesting ways to put its own problems right, and Mycroft has learned that he ignores them at his peril.

When Colin started describing to Mycroft what lay up past the Oberalp mountain wall, this particular resonance thrummed right down into Mycroft’s bones, and his mouth started watering as he heard not only what went into the cake, but who was making it. Not too far over the Oberalppass from Andermatt, Colin told him, on the main pass road, is a little town called Sedrun. It is a quiet place, at once (in the classic Swiss manner) gracious to visitors and inturned and suspicious of strangers in the way of small country towns everywhere. But this place holds something unusual hidden at its heart. In Sedrun’s confiserie works a direct descendant of one of the great names among the professional confectioners whom the Swiss of centuries past called “sugar-bakers”. These men (and a very few women) moved among the great courts of Europe at the beck and call of royalty — free agents who moved from ducal to royal to imperial court for vast sums of money or other considerations — and everywhere they went, they baked pastries and cakes of fabulous quality, and constructed monumental confections beyond the skill of mere mortals.

But these superstar chefs of their time came to carry with them more secrets than just how to make perfect millefiori-style sugar plate that looked like Venetian glass, or what mixture of flours in the dough would produce the optimum rise and flakiness in that (then) hot new treat, the croissant. Wearers of the perfect cover story, and free to travel where lesser men could not because of the skills in their hands and the recipes in their heads, the sugar-bakers pioneered professional organized espionage — spying for one petty king or count or grand duke against another, turning double or triple agent as it pleased them, courting reward and risking death for fun or the joy of travel or the pleasure of matching wits with their rivals (or their clueless masters) and coming off best. They were the great-great-grandparents of the agents of MI5 and MI6, playing the Great Game in times and circumstances as deadly as our modern ones… but their preferred weapons were flour sieves and pastry bags. Their stories are hardly ever told in our time, but again and again the sugar-bakers quietly changed the course of history and the face of political Europe, while at the same time spending their days interleaving butter a hundred layers deep with dough and marzipan, or perfecting the stable buttercream filling.

The cake of Sedrun — a multilayer chocolate torte with an unusual array of icings — was based on a family recipe a quarter-millennium old, and was being baked by the direct descendant of one of these lost experts. Mycroft could no more have refused the prospect of tasting a cake of such noble lineage than he could have refused to shake the umbrella off his closest secret and match swords with his brother under the summer trees of their childhood, were Sherlock only to pick up a blade and challenge him one more time.

So having heard the tale, Mycroft bided his time until an excuse arose to take him to Zürich (a tête-a-tête with an unfortunate British-affiliated private banker caught deep in most ill-advised weapons-related money laundering). Then, that distasteful business handled, in company with Anthea he made his way a couple hours’ drive south and east in the big embassy-lent car, down EuroRoute 2 to the Gotthard Pass, through the camo-ridden streets of Andermatt, and finally up over the Oberalppass to Sedrun. There, on the north side of the two-lane main road, he found the confiserie of his desire. It was no more than the bottom floor of a brown three-story chalet with awninged cafe tables outside and a wood-paneled coffee shop attached: a simple tidy quarry-tiled space full of a truly divine scent of baking bread and a number of polished pine tables and chairs, the whole of it no bigger than Speedy’s. Mycroft sat down at a table for two and ordered a slice of the cake.

When it arrived on the shining table on its plain white plate, Mycroft’s casually ironic thought about the need to seek out a Moriarty among cakes rose up for reconsideration and took him by the throat. The cake’s surface was pale, slick and glossy, elegant and smooth — but underneath, it was dark, dark at heart. Mycroft had rarely gotten the sense before that while he was sizing up a piece of cake, it might be doing the same to him. He was getting it now.

He picked up his fork post haste, stuck it deep into the thing before it could start coming up with any clever ideas, and abandoned himself wholeheartedly to pleasure.

Normally, as a general indicator of a cake’s quality, Mycroft timed himself to see how long it took to finish a slice. This time… he forgot. It wasn’t that time exactly stood still while he was eating, but it certainly slowed down to an amble and paused occasionally to admire the scenery.

Afterwards Mycroft stood up very quietly, ordered himself a milchkaffee, and strolled out briefly through the scatter of sidewalk tables, past gossiping town housewives and middle-school kids chattering in Romansch, past where Anthea sat texting busily away with a glass of the local soft Fendant white wine in front of her. There he stood on the sidewalk and looked westward up the curving pass road, while considering his options and doing sums in his head.

There the afternoon sun had already slid out of sight downsky in a wash of misty air, blinding beams from it striking upward from behind the towering jagged snow-dappled peaks of Oberalp and Piz Cavradi, silhouetting them: rays of a crown of white fire against the paling blue. Mycroft stood there for a little, breathing in that very clean, already-cooling air, thinking of old mistakes made, the pain of making them, the price of putting them right, and the need to keep oneself on an even keel while doing so — because sometimes mere bare self-denial serves nobody’s best interests. Behind him, up the grassy hill behind the bakery, cowbells were making a quiet musical tunk, tunk sound. Across the road, out of sight on the downslope but very close, icy glacier-fed water rushed and tumbled over a bed of big rounded stones; for this was the southernmost source of the Rhine, and the soft kicked-up spray of the living water hung the scent of new beginnings on the still air.

Mycroft stood there a few seconds more, then went back in for his coffee. He sat and drank it, musing; then went to the bakery counter to pay his bill, and finally asked to speak to the master baker.

The man wasn’t long coming out — a craggy silver-haired man of middle height whose stance and look immediately put Mycroft in mind of someone at home. Post-military, Mycroft immediately perceived: but considering the combination of Swiss military tradition (all adult males serve in some capacity) and this particular neighborhood, that was obviously going to be the rule rather than the exception. High-ranking, but gave it up to carry on the family tradition when his father died. Happily married, training his son to carry on the tradition after him, but not ready to retire just yet: tempers his chocolate personally. Proud: and in command. …A few minutes’ conversation made it plain that under no circumstance would this gentleman ever part with the recipe: and of course that made sense. Had to try, though. Nothing ventured, nothing gained…. But after a few minutes more, the two of them worked out an arrangement by which someone from the British Embassy in Bern who had business down this way would swing by once every couple of months, pick up a cake, and send it home to London in the daily diplomatic pouch.

And so it would come to pass. The challenge would be to make such a cake last him two months: if it went away before then (not, of course, counting pieces given to other people) Mycroft would hone his resolve to a finer edge and try again. If he succeeded, then he would chalk up a small victory and allow himself another cake. As he went out to the car (where Anthea was already esconced) carrying the string-tied cake box, the matter was already managed and ready to be dismissed. In his own mental management storage — no palace of the mind, but a utilitarian space that looked far more like the warehousing facility in Raiders of the Lost Ark — the cake was already sliced up and tucked away in a virtual twin of his own larder freezer.

But the satisfaction of what he’d acquired remained, and Mycroft smiled slightly to himself as he got into the car, already planning the disposition of those careful slices. A few seconds later the driver pulled out, making a doubtless-illegal U-turn in the middle of the Oberalppass road and heading west again for the tall stack of switchback curves that would lead back down to Andermatt and the northbound motorway.

Then Mycroft sighed: because enjoyable as such indulgences were, they were better far when shared. However, Anthea would unfortunately refuse such an offering, as her preferences did not run to chocolate. Sherlock, as a message to the present’s source, would bin it without a second thought. John would most likely eat it, out of a desire not to waste, if nothing else: but his acceptance of the gesture would likely cause him complications later, and Mycroft had no desire whatsoever to destabilize that particular household dynamic. Mrs. Hudson, however, would enjoy some. Mycroft tagged one of those in-mind slices with her name. And Colin must of course have a slice. A moment later that one had been moved into the kitchen freezer in Mycroft’s virtual version of the Diogenes Club.

And there was — he thought while the car wound its way down the switchbacks — one more possibility.

Mycroft hesitated. Yet, still…

Nothing ventured, nothing gained.

He pulled his phone out. Anthea glanced over at him. “Something you need, sir?”

Mycroft shook his head. He dialed: waited for the connection: and smiled a small secret smile.

“DI Lestrade, please. …Yes, thank you, I’ll hold…”




In greywash’s the sensation of falling as you just hit sleep, there’s a passing reference to “a careful two slices of what Sherlock is certain is excellent chocolate cake in [Mycroft’s] freezer—in case of emergencies”. This, I feel sure, is that cake.

Locally it was referred to simply as an Urner brenntweintorte, suggesting that its ancestor-cake originally came from over the border (Andermatt is in Canton Uri: Sedrun is in the Graubunden.) I had no better success getting the recipe than Mycroft did. But over time I’ve learned how to pretty accurately analyze what I’m eating, and when I ate this cake in Sedrun years ago, “I saw whut they did thar” and took careful notes with an eye to reproducing it some day.

It’s truly a cake worthy of a Mycroft’s attention; and having finally made it just now and had a slice, I can verify that this is a very, very close match to the original. It’s nowhere near as pretty, for which apologies. (I can still see the original in my mind’s eye: the glaze on top was smooth enough to skate on, and their version had six significantly skinnier layers. It was a beautiful thing.)

Anyway, the rest of it it is now going…as you might guess… into the damn freezer before I eat it all myself at one go.

 

Double Chocolate Courvoisier Torte with Brandied Buttercream Filling and Two Icings (Brandied Nutella Frosting and Cream Cheese & White Chocolate Ganache Glaze) ...otherwise known as Mycroft’s Delight

Note please: this cake will take the guts of an afternoon to make. Don’t attempt it as a last-minute thing. In particular, there’s no harm in baking the layers, soaking them in the syrup, and then refrigerating them overnight — you can then pick up where you left off with the fillings and icings.

Ingredients come first: directions after.

Also note: this recipe is set up for three 8-inch layers. You can, of course, if you like, do what I did here — bake two 9-inch layers in a springform, then cut them in half crossways and stack them.

Ingredients:

For the cake proper:

  • 6 large eggs
  • 1 cup superfine granulated sugar or fine caster sugar
  • 1 teaspoon vanilla extract or essence
  • 4 ounces unsweetened baking chocolate, melted and slightly cooled
  • 1/2 cup good quality cocoa
  • 1 cup flour, sifted
  • 1/2 teaspoon baking powder
  • 1/2 teaspoon powdered cinnamon
  • 1/4 teaspoon mace
  • 1/2 teaspoon orange extract and 1 teaspoon orange zest, crushed as smooth as possible in a mortar (or if you’re lucky enough to have access to it, a half teaspoon of orange zest puree)
  • A few grinds of fresh nutmeg (about 1/8 teaspoon if we’re being picky about it)

For the soaking syrup:

  • 1/4 cup sugar
  • 1/3 cup water
  • 2 tablespoons Courvoisier cognac (alternately, you can substitute a good brandy: Hennessey, etc)

For the buttercream frosting base / filling:

  • 3 cups confectioners’ sugar / icing sugar
  • 2/3 cup unsalted butter
  • 2 large egg yolks
  • 4 tablespoons Courvoisier or brandy (whichever you used above)

(A note in passing: you will be dividing this in half. Half goes in between the layers; the other half gets Nutella mixed into it and goes on the sides of the cake.)

For the brandied Nutella side-frosting:

  • 4 ounces Nutella, warmed
  • 2 ounces melted milk or dark chocolate
  • 1 tablespoon Courvoisier or brandy, as above
  • 2 teaspoons cocoa powder

For the ganache / cream cheese glaze:

  • 1 recipe white chocolate ganache (see below)
  • 3-4 ounces Philadelphia or similar cream cheese (plain Neufchatel will also work)

The white chocolate ganache proper:

  • 4 ounces premium-quality white chocolate, finely chopped
  • 1/3 cup heavy cream
  • 3/4 tablespoon unsalted butter, at room temperature and cut into 3 pieces

…So let’s take this one thing at a time.

First of all, make the cake layers.

Butter and flour three 8-inch cake pans/tins, even if they’re nonstick. (To prevent the cake acquiring pale patches during baking, you can mix a teaspoon of cocoa with each couple of teaspoons of the flour you use to prep the pans.)

In a mixer with the whisk attachment, beat together the eggs, sugar, vanilla, orange extract and orange zest, until this business is light and fluffy — usually ten to twenty minutes. At the end of this process, slow the speed down and add the dry spices.

When these have been combined, stop the mixer and alternately fold in by hand the combined, remaining dry ingredients and the melted chocolate.

Preheat the oven to 350F / 175C. Bake the layers for about fifteen minutes until done (check for doneness with a skewer if you have any doubts). Remove the layers from the oven and allow to cool for at least 15-20 minutes: then bang the pans on the worktop to loosen things up, and turn the layers out onto a rack to cool completely (usually 30-45 minutes).

When completely cool, use a skewer to poke twenty or so little holes in the top of each layer. Do your best not to go all the way through the bottom of the layer. Put the layers on a cookie sheet or other waterproof surface to prepare for the next stage.

Now make the soaking syrup:

Boil the sugar and water together for five minutes. Remove from heat and allow to cool. When cool, stir in the cognac or brandy (whichever you used) and set aside until the layers are ready.

When they are, pour the syrup carefully over the tops of the layers so that it soaks in through the holes. Use a pastry brush to paint any excess syrup evenly over the tops of the cake layers.

Now set the layers aside while you work on the filling and icings.

Make the buttercream filling:

In the mixer bowl, using the “normal” beater or paddle, combine the butter, icing sugar, egg yolks and brandy, and beat like crazy for about ten minutes until perfectly smooth (beat longer if you need to).

Scoop out half the buttercream and use it to “butter” the bottom and middle layers of the cake: then stack them. Press down evenly and gently on them (I usually use a cookie sheet for this) to even out the layers and the filling.

Now make the Nutella-and-buttercream side frosting

Add the cocoa, melted chocolate, brandy and Nutella to the remaining buttercream mixture, and beat very well. Since the goal is for this mixture to stick to the sides of the cake and not run straight off onto the serving plate, check the texture and beat in some extra cocoa if necessary to thicken the frosting until it’s tractable.

Smooth the sides of the cake with the flat of a knife if necessary to deal with any buttercream that’s oozed out the sides. Use the Nutella frosting mixture to coat the sides of the cake. Also frost the upper edge and a little ways up onto the top surface of the cake with the Nutella mixture if you can. If you have enough to frost the whole top without the side frosting being too thin, that’s great: it’ll look better.

Finally, make the white chocolate ganache and cream cheese glaze

Prepare a large bowl with some cold water and ice cubes in it. Then break up the white chocolate into as many pieces as possible, and put them in a heatproof bowl that will fit comfortably in the bigger bowl that contains the cold water and the ice cubes.

Bring the heavy cream to a boil. Then pour it over the white chocolate. Working with a whisk or spatula, gently stir the chocolate and cream together until the white chocolate is completely melted. When the ganache is smooth, stir in the butter.

Now cool the ganache by putting the its bowl into the larger one and stirring constantly so that it doesn’t harden. After about five minutes of this, start beating in the cream cheese by forkfuls. You’ll probably need to whisk it at the end of this process to get rid of the last few lumps. Finally, add a tablespoon or so of brandy to make it easier to work with. (You can correct the thickness of the ganache back and forth by beating in more cream cheese or a little more brandy until it reaches the consistency you’re after.) Spread and/or drizzle this mixture over the top of the cake until it’s evenly covered.

Once all this craziness is finished, you may want to refrigerate the cake for half an hour to stabilize everything a little.

Serve in thin slices. A shot of brandy on the side (to cut the incredible richness) and a double espresso wouldn’t hurt, either.

Enjoy!

Mycroft’s colleague “Colin” in meditative mode

12 Apr 19:05

Photo



12 Apr 19:05

presidentofstarkindustries: OKAY. THEY KNOW ABOUT PEPPERONY....



presidentofstarkindustries:

OKAY. THEY KNOW ABOUT PEPPERONY. THEY CALL THEMSELVES PEPPERONY
I’M DONE. I’M SO DONE. NOW YOU CAN BURY ME.

image

Sounds entirely reasonable to me.

12 Apr 19:01

readrunread: madehimsaycomfychairs: anthropologylove: nudityan...

firehose

THE MIXER BEATER





readrunread:

madehimsaycomfychairs:

anthropologylove:

nudityandnerdery:

feigenbaumsworld:

Dalek Princess by ~brienicole

And she’s holding the beater from an electric mixer. That is too adorable.

gdjkberjkgnerjkmgbndskj

MY. FUTURE. KIDS.

I may have just shrieked incoherently.

12 Apr 19:01

Crocheted Food Art by Kate Jenkins

by EDW Lynch

Crocheted food art by Kate Jenkins

Artist Kate Jenkins makes elaborate crocheted food art in her studio in Brighton, UK. Much of her art depicts the local fare—fish and chips, bangers and mash, and so on—but a recent series, “Kate’s Diner,” focused on classic American food. We previously posted about Jenkins’ crocheted anatomical hearts.

Crocheted food art by Kate Jenkins

Crocheted food art by Kate Jenkins

Crocheted food art by Kate Jenkins

Crocheted food art by Kate Jenkins

Crocheted food art by Kate Jenkins

Crocheted food art by Kate Jenkins

via The City Loves You, Visual News

12 Apr 19:01

Photo



12 Apr 19:01

sugaryumyum: Mary O’Mallet - Bottom Feeders

firehose

paging Miriam









sugaryumyum:

Mary O’Mallet - Bottom Feeders