May. 14th, 2009

elfs: (Default)
Aside from the bacon, there's one more advantage to being home. Only myself and Omaha. And no kids during school hours.
elfs: (Default)

I don’t know if this is a common phenomenon.  I’ve spoken with a lot of artists who swear by their Wacoms and don’t ever work on anything else at all, but I’ve found that while my Wacom Bamboo is good for some things, when it comes to rapid design I’m much happier tossing off sheet after sheet of paper with a handful of colored pencils.   I’ll use the Wacom for clean-up, and that’ll be extensive use, but the initial will always be done on paper.  The tactility, simplicity, and above all else the narrow focus of “just draw it on paper” seems to work for me.

This was especially true yesterday.  I was trying to design a blackboard theme, with lots of chalk lines, and no matter what I tried, my handwriting via the Wacom sucked.  On paper, my hand is quite readable, but on the Wacom, no dice.  Scrawly, off-center, badly angled.  I imagine if I have a Wacom Cintiq the quality would have been substantially changed, but a Bamboo is for clean-up, nothing more.

This entry was automatically cross-posted from Elf's technical journal, ElfSternberg.com
elfs: (Default)

I was reading through the Wordpress source code, trying to figure out a problem for a contractor, when I saw the function compact().  When I saw it I boggled, read the description, and shook my head.

Compact() takes a list of variable names as strings, and returns a hash of those variable names and their values.   So if you have something like:

$title = "My blog";
$link = "foo";
$h = compact('title', 'link');

You get back a hash of array(’title’ => ‘My blog’, ‘link’ => ‘foo’).

That, to my thinking, is completely messed up.  You’re giving this function, which has its own scope, explicit permission to twiddle with variables in the current scope and create a new variable.  It’s one of those things that convinces me that PHP is an unholy mess of silliness.

And then my brain reminded me that, hey, you can do the exact same thing in python.  So, I have:

import inspect
def compact(*args):
    return dict([(i, inspect.currentframe().f_back.f_locals.get(i, None))
                 for i in args])

def foo():
    a = "blargh"
    b = "bleah"
    c = ['1', '2', '3']
    return compact('a', 'b', 'c')

print foo()

And sure enough, this spits out: {’a': ‘blargh’, ‘c’: ['1', '2', '3'], ‘b’: ‘bleah’}

I hang my head in shame for giving Django developers one more thing around which they can develop bad habits.

This entry was automatically cross-posted from Elf's technical journal, ElfSternberg.com

Profile

elfs: (Default)
Elf Sternberg

June 2025

S M T W T F S
1234567
891011121314
15161718192021
22232425262728
2930     

Most Popular Tags

Style Credit

Expand Cut Tags

No cut tags
Page generated Aug. 1st, 2025 08:28 am
Powered by Dreamwidth Studios