Fri, 25 Nov 2011

Eggshell brownies

— SjG @ 9:50 am

After seeing an article where they showed brownies baked in egg shells (via BoingBoing), I thought it would be a good thing to try for a family gathering. Thus began a haphazard adventure in baking…

Final verdict: a lot of work, interesting results, probably won’t be doing again.

Filed in:

Wed, 23 Nov 2011

YA Fiction

— SjG @ 10:02 am

As much as I like some of the new crop of young adult fiction, I can’t help but wonder if this phenomenon isn’t just rooted in publishers being squeamish and authors being lazy. The category allows — no, encourages — writers to be less nuanced, paint with broader strokes, and, of course, avoid sexuality altogether.

Then again, the YA Fiction phenomenon may simply be symptomatic of “non-young adults” non-reading.

Filed in:

Sun, 20 Nov 2011

The Magic of New Things

— SjG @ 9:26 am

We humans appear to be programmed for scarcity. We lust for high energy foods — sugars, fats, refined carbohydrates — even when we’re not hungry. Just thinking about donuts may be sufficient to trigger a rewarding brain chemistry reaction1. Similarly, we tend to gather possessions — often far more than we need. We don’t dispose of old, unused possessions because we’re sure we may need them some day. And we’ll often acquire things we don’t need because we anticipate they will be more difficult to obtain in the future. We don’t need them now, but there is the possibility that we will need them at some later time. As advertisers have learned, a quick way to make someone want something is to give the impression that the opportunity to have it is limited: buy now! So we do.

There is an obvious (and possibly even correct) evolution-based argument for the behaviors of scarcity. If a species spends 200,000 years struggling to survive in a minimal environment, those who hoard or are gluttonous may well have a survival advantage over those who don’t or aren’t. A few calories here or there could be the difference between life or death. An animal pelt could make the difference between freezing to death and surviving.

It turns out that there may be corollary programming that motivates us to seek out new and novel things. When we encounter new stimuli, we receive a short-duration boost of some of the same “reward” brain chemicals as we do from food or sex2. Again, a series of questionable evolutionary explanations can explain this: those who explore are more likely to discover untapped resources and thereby have a selective advantage, or perhaps those who try new things may discover new uses for already identified resources3.

So now we fast forward to our time of relative abundance. Modern society has exploited this set of unpatched vulnerabilities in our brain chemistry, and combined our programming for accumulation and our programming for novelty to create a consumer culture4. The fashion industry tells us we need new, novel shoes, while the computer industry tells us we need to upgrade to the latest versions of everything. We need to add new music to our collections every week, and try the latest McProcessedMeat sandwich, see new movies, learn the latest dance, and so on. Every Christmas, there’s the hot new toy that everyone needs to get, whether it was a Hula hoop, a Magic 8 Ball, a pet rock, Beanie Babies, Tickle-me Elmos, Cabbage Patch Kids, or a Furby.

Even outside of obsessive consumer culture, we’re fascinated by new things, especially if they fit into some familiar framework. There’s something tremendously exciting about receiving an unexpected letter or a package in the mail, often amplified if we can identify the sender. It can trigger the anticipation response, the accumulation response, and the novelty response all at once. What’s more, even virtual items evoke a similar emotional reaction: an email from a friend, or an incoming SMS or incoming instant message.

The Internet is rife with sources for these novelty and accumulation dopamine-hits. We subscribe addictively to news feeds. Countless companies like Facebook and Twitter capitalize on our desire for a stream of new-but-familiar snippets of information from and about our friends. Online games allow us to accumulate virtual goods (points, badges, titles, Linden Dollars, ISK) while we explore new environments. Our smart phones let us download new apps, and notify us daily of updates to our existing collection.

All of this finally brings me to my actual point, which involves the creative process. Why do people get such pleasure from creating new things? Perhaps the sense of satisfaction from making things is a combination of the reward-impulses discussed above. After all, when you make something, you end up with some increment over what you had before. This keys into the stockpiling instinct. What’s more, as you make things, you are provided with stream of exciting new things (especially as your skill level increases). Part of the act of creation is discovery5, which speaks directly to our desire for novelty.

Of course there are many additional reasons to create. There’s the need to express emotion. There’s the cultural status as an artist (or the absurd title “Maker”6). There is the struggle against boredom, or distraction from problems. There is simple necessity, in the case of inventions, followed by indolence (if necessity is the mother of invention, surely laziness is the father). Still, with the possible exception of inventions, I would argue that the desire to create in response to those reasons is rooted in the brain chemistry surrounding the magic of new things.

1 Well, in any case, anticipation of food (or other pleasures) are associated with release of “happy” brain chemicals like serotonin and dopamines.

2 I’m oversimplifying, as usual, but there is evidence that suggests that novel situations (and even the anticipation of novelty) both give us a lift.

3 It’s worth noting that these arguments have simple counter-arguments. Those who explore new places may be more likely to discover new resources, but they’re also more likely to be eaten by a hitherto unknown monster or contract a disease for which no prior immunity exists. The fun thing about evolution-based explanations is that they’re often simple, convincing, and wrong.

4 I’m sure someone will point out the US-centricity of these ideas, and I don’t deny it. While anecdotally, I’ve observed similar behaviors in people in places where I’ve traveled (including places which have significantly different cultures), I freely admit that I see things through the lens of my US culture. It’s also worth noting that in an environment of relative abundance, the tendencies encouraged by consumer culture can kill us, whether via obesity or being buried alive under our hoarded collections of National Geographic magazine and Royal Wedding commemorative plates.

5 As artist and teacher Penny Longpre once told me, “the difference between an artist and an amateur is that an artist knows which mistakes to keep.” Artists often refer to the paint or the clay having some kind of volition — a mind of its own. I think this is really the same thing. Whether it’s unintentional details or a result of the characteristics of the material, unexpected elements provide ideas during the creation process, which can then lead the work into new directions.

6 I’m overly sensitive to this self-congratulatory bit of culture. I’m not sure why every generation seems to think it has single-handedly invented music, sex, and everything else. The octogenarian down the street was no less creative in crafting his model railroad just because he didn’t call himself a “Maker,” and his wife was no less innovative when it came to improvising implements around the house even though she didn’t use the “DIY” acronym. People are resourceful and adaptive, and don’t need self-aggrandizing labels to legitimize their accomplishments.

Filed in:

Tue, 25 Oct 2011

Thoughts while reupholstering

— SjG @ 9:31 pm

It’s time to reupholster the kitchen chairs. They’re just (relatively) cheap Ikea chairs, but it seems like it’d be a waste to pitch them just because the non-replaceable cushions have become stained and/or faded. I figured I’d reupholster them myself. I’d never done this before, but how hard can it be?

So I found myself in the office, using a few homemade implements to loosen hundreds of staples, and then pincers to pull ’em out. Quacky (the cat; formally addressed as Daphne) kept interrupting. She evidently found the activity irksome, insofar as it did not involve petting her.

The new fabric color is an orangey, stripey color (not unlike Quacky), and as I worked my mind wandered about pumpkins and other symbols of the season.

Why is it, I wondered, that October brings not only a proliferation of Halloween decorations, but also the appearance of Christmas decor? After all, there’s another significant holiday betwixt. Is the reason thematic? Well, perhaps, I concluded, but not really. Halloween is superficially about spookiness and perhaps confronting mortality, but it’s really an excuse to break out of the humdrum, to escape normal standards of behavior, to don costumes, to go mad with decorations, and for adults to drink and children to overindulge in candy. Christmas as celebrated here is ostensibly a religious holiday (and again, a chance to confront concepts of mortality), but it’s really observed more as an orgy of gift-giving/gift-receiving, a chance to wear silly reindeer hats to the office, an excuse to go mad with decorating, and a justification for adults to drink and for children to overindulge in candy.

I had finished removing the staples, and using the old fabric as a template, I traced out the shape on the replacement fabric, and cut my new portion. Then, after giving Quaky a few minutes of petting, I got back to work, stretched the new fabric over the foam and tried to make sure it all lined up correctly.

OK, so both Halloween and Christmas provide a justification to behave differently. They are both holidays about consumption, whether in the “buy a whole lotta decorations” or the candy/alcohol sense. But that forgotten holiday centers around feasting as well: Thanksgiving is a well known opportunity to overindulge. So why are stores filled with Christmas stuff instead of the chronologically more appropriate Thanksgiving stuff? After all, you can decorate for Thanksgiving too — many of us have fond memories of making cut-out paper Pilgrims in their belted hats and turkeys in elementary school. Why not turkey and corn yard decorations?

By now, I was trying to secure the new fabric, and my staple-gun kept jamming. I had to disassemble it twice to remove mis-fed staples that had gotten twisted up inside the mechanism. And when it worked, each thwack of a staple going in would startle Quacky, and she gave me a doleful yellow-eyed glower.

So is Thanksgiving less of an event because of our discomfort about what likely befell the Native American hosts of the first Thanksgiving? Elementary school pictures always had happy “indians” partying with the Pilgrims — it wasn’t until later, that we wondered if those were the same “indians” who fought against the cowboys. And it wasn’t until much later when we ventured into A People’s History that we got anything like the actual story.

Or is Thanksgiving not a such a great marketing opportunity because it’s ostensibly about appreciating what we have? It may be hard to sell gratitude as a consumable product. I personally find gratefulness to be a powerful emotion, and a positive influence on my day to day mood. I keep a list with me, entitled “important things,” where I occasionally jot down small circumstances for which I’m grateful. At one point, Elizabeth and I had a bound book where we planned to write down daily gratitudes: unfortunately, that seems to have gotten lost in the shuffle. Perhaps a rigid schedule is not the right approach, but I think the idea still has merit. Still, bound books or no, it’s going to be a lot harder to sell gratitude gear at WalMart than it will be to sell realistic brain-dripping lawn zombies or battery-powered Santa Clauses.

I finally got the fabric stapled down, and one chair finished. It was an amateurish job, but not bad for a first try. Quacky looked more than a bit skeptical, but I’m optimistic that the next three will be better.

Filed in:

Fri, 21 Oct 2011

Using PHPExcel with Yii

— SjG @ 2:18 pm

I was running into problems with conflicting autoloaders when I tried to use PHPExcel with the Yii framework. There are instructions out on the web on how to resolve this, but they are only useful if you’re not creating instances of Yii active record models while you’re using PHPExcel. That’s fine if you’re using Yii to create an Excel spreadsheet from already instantiated Yii classes, but my need is to read an Excel spreadsheet and import its data into my database.

It turns out that this is fairly straightforward as well. The trick is in realizing that PHPExcel is registering its autoloader when it’s instantiated, so you don’t need to register it yourself.

public function actionImport()
  $message = '';
  if (!empty($_POST))
    $file = CUploadedFile::getInstanceByName('import');
    $spec = Yii::app()->basePath.'/data/imports/'.$file->name;
    spl_autoload_register(array('YiiBase', 'autoload'));
    try {
         $inputFileType = PHPExcel_IOFactory::identify($spec); 
         $objReader = PHPExcel_IOFactory::createReader($inputFileType);  
         if ($inputFileType != 'CSV')
        $objPHPExcel = $objReader->load($spec); 
        $objWorksheet = $objPHPExcel->setActiveSheetIndex(0);
        $highestRow = $objWorksheet->getHighestRow();
        for ($row = 1;$row < $highestRow+1; $row++)
             $myObjThing = new MyObject; // Yii AR model
             $myObjThing->someField = $objWorksheet->getCellByColumnAndRow(1, $row)->getValue();
             $myObjThing->otherField = $objWorksheet->getCellByColumnAndRow(5, $row)->getValue();
             $myObjThing->detachBehaviors(); // PHP < 5.3 memory management
    catch (Exception $e)
       $message = 'There was a problem handling your file. Technical details: '.$e->getMessage();
    if (! empty($message))

Pretend WordPress didn’t hose the formatting on that …