Evan J Palmer's Blog

A blog about learning (code, improv, film and, anything else).

Month: August, 2013

Don’t say anything for a minute

anthony-hopkins-the-silence-of-the-lambs-1

Here’s a good improv game that Marko taught us in class last class.

A player starts a scene in silence. He picks an emotion and an activity and starts doing it.

A second player comes out and joins the activity, with an emotion too. It might be the same emotion, it might be a different one.

The two players make eye contact, but don’t talk – just feed off each other – maybe muttering under their breath.

Eventually, one talks and the scene starts – but they don’t talk about anything other than pleasantries (“pass me the fork”, “nice day today” etc) then all of a sudden they burst out about the emotion.

And that’s it, that’s the whole set up.

It actually works really well as long as these things take place at the beginning:

  • Eye contact
  • Emotion
  • Change

Endowment

Image

 

A new tool that we learnt at improv last night was the “game” of endowments.

I did cool little air quotes around “game” because I guess it’s more of a technique than a game.

Anyway, you start a scene and to give it more… substance (?) you start endowing the other player with personality traits. As you’re endowing them, you watch them carefully for reactions. Are they accepting your offer? Are they enjoying it?

The idea is to give out heaps of stuff that the other player might like to use, so basically forget about yourself, and really focus to make sure the other player is having fun.

Marko says, that if you know the player well, and you know they like doing something, then start throwing offers in that direction. For example, if you know someone likes playing deformed, decrepit characters you could come in to a scene with an offer like:

“You monster. I’ve seen you sneaking around out the back of the valley. The bloodstains on your clothes…”

Hopefully you’d see the other player take on these traits.

Another example would be if you didn’t know the other player so well, so you could look at them and throw out some subtle offer for them. The example Marko gave was if a guys looks like he might consider himself a ladies man, perhaps try something like:

“Oh well, I bet you get all the ladies”

and look at his reaction. If he smiles, back it up with something like:

“I mean, you’re a great looking guy, and rich.”

I don’t know, something like that.

I suppose you should be equally aware that someone might not like your offer, and not push traits on other people too hard. But that’s my own thought – I could be wrong there, but I wouldn’t like it if someone pushed say, a young child character on me because I particularly hate playing characters like that.

Change

Image

The most important thing I think I’ve learnt at improv recently is the importance of change on a scene.

You can take a really strong character with a really strong emotion and you’re off to a great start. Once you’re in there, with the other player, you can start having fun, but once the relationship and location and all that jazz is established, it’s easy to get stuck in a rut.

Personally, I know I’m in a rut when my stress levels peak out – the panic sets in that I’m at a dead end.

Luckily, change will get you out of there.

Your strong character can have a change of heart – in any direction – and it really breaths new life in the scene and gives it a direction.

It also seems to point it to a resolution, which is nice.

 

 

I don’t use iTunes

right_dark_theshining

I have an iPhone and an iPad.

I’m actually really looking forward to switching to a Droid phone in February when my current contract runs out. Not because I dislike my iPhone, the opposite in fact. But, I’m just looking forward to trying some of the new features that I’ve been hearing about.

I probably won’t upgrade my tablet for a while.

Anyway, I’ve told a few people that I don’t use iTunes recently and they freak out.

I actually don’t see the use for it.

Here’s how I do it.

I should also note that this wasn’t a conscience decision. Like, I didn’t say to myself “Fuck iTunes and all y’all. Imma investigate to work around it.” I just naturally picked apps that tended to not require iTunes.

  1. Back up I use iCloud
  2. For music, I use Spotify
    I sync some playlists offline (via wi-fi) so I rarely use MP3s anymore – I never pirate music.
  3. I install my apps via the App Store on my phone
  4. Podcasts I use Downcast
  5. RSS I use Feedly
    I actually don’t know if RSS is something that iTunes does, but hey, I like Feedly
  6. For Comics I use Comic Zeal
    Comic Zeal can share a folder over WiFi
    Honorable mention to the amazing app Comixology, which is only a little too pricey for me to use.
  7. Stanza/iBooks for reading
    with stanza I download fiction by connecting to Tuebl
    with iBooks, I email PDFs of tech stuff. I have to admit, this is probably a bit of a work around. But it works for me, and is faster than connecting my iPad to the computer and loading up iTunes.

 

Who uses the immediate window in Visual Studio?

800px-requiem_for_a_dream_screenshot_2

So I recently sat down with some colleagues, to show them an interesting bug (not blog-worthy, just an off-by-one that had been lying dormant in production since the dawn of time).

They were crowded around my desk, coffees in hands, with their eyes shining, full of eagerness to see the breakpoint get hit, and hear my explanation of the issue.*

The break point gets hit *gasp*

I highlight the offending line and paste it into the immediate window.

“Whaaaaaaaaaaat?” my colleagues scream in unison!

They were surprised that I used the immediate window and told me they literally never use it.

I explained how I use it:

  • I set a break point and hit it
  • I load up the immediate window now I have access to any variable that is in scope
  • I might use intellisense to look around objects
    This works particularly well with collections, as I can use the index notation []
  • I might use it to execute a method that throws an exception
    This is so handy, because if we stepped over this method in the debugger, the exception would get thrown and we’d have to start the process again. This wouldn’t be an issue if I this particular method was testable – I could just set it up to throw an exception, but I was working with legacy code. Hey, I inherited debt.
  • I might use it to execute some code several times
    I’m not sure how this could be a achieved using the GUI tools
  • The other day I used it to throw an exception in the code. I wanted to see what would happen if an exception got thrown, so set a break point in the code I was interested in, then set an object that would soon to be called to null, causing a null reference exception.

It’s worth noting I use a similar debugging technique when working with JavaScript, setting breakpoints and using the console in Chrome’s dev tools.

Now I don’t know if my methods are certainly the best. I know that I do use watches, and other GUI tools to compliment the immediate window, but it turns out I use it more often than my colleagues, so that’s’ interesting if nothing else.

I think there might be an indication that the Immediate Window is not commonly used. I’ve noticed that LINQ and some other Net3.0+ features are not supported.

What do you think? How do you use the immediate window?

*huge exaggeration

Build Current Project – Keyboard Short Cut for Visual Studio

I’ve got a nifty little short cut mapping that I’d like to share with you for Visual Studio.

Usually when you want to build your solution, you probably hit CTRL+SHIFT B… unless you’re a sick freak who prefers the laborious task of pressing the play button with the mouse (I once met one).

Now this is okay for small solutions, but if your application is a little beefier you can save some time by setting up your mappings like me.

I’ve got CTRL+SHIFT+B mapped to build the current project only (not the entire solution), and CTRL+ALT+SHIFT+B to do the entire solution.

The benefit of this is that when I CTRL+SHIFT+B to build my build time is much shorter than having to compile the whole project.

To set this up:

  1.  Tools -> Options -> Environment -> Keyboard
  2.  Put the cursor in “Press Keyboard Shortcut Keys” and shift CTRL+SHIFT+B
  3.  In Show Commands Containing, type: Build.BuildSelection
  4.  Select Build.BuildSelection from the drop down list and hit apply
  5.  Put the cursor in “Press Keyboard Shortcut Keys” and shift CTRL+ALT+SHIFT+B
  6.  In Show Commands Containing, type: Build.BuildSolution
  7.  Select Build.BuildSolutionfrom the drop down list and hit apply
  8.  ???
  9.  PROFIT!

First Shoot with Actors or The Importance of Story Boards

S4_Tobias_(02)

On Saturday we shot our first short with people who aren’t normally involved.

We had the regulars, plus two actors  I met at improv classes, and an extra cameraman. We also shot at a friend’s house, so we had some spectators too – people who had inconvenienced themselves by lending us their house as a location.

Because we had these extra stakeholders, I was super conscience of time.

There was one glaring mistake that came to light that day – I hadn’t planned my shots.

We had a solid script.
We had rehearsed.
We had all the props.
We had a charged camera
We had laptop for reviewing
We had lights
Audio was sorted

But we really should have story boarded storyboards, for two reasons:

Firstly to make sure we didn’t miss any shots. I haven’t finished editing yet, but I have a feeling that I’ve missed a few shots – mostly around the bit where I’m acting, so at least I can reshoot myself if I need, but with story boards, this wouldn’t be a problem,

Secondly so we could tell everyone how much longer was left without guessing. After a few hours of shooting people were getting bored and hungry. It was hard for me to guess how long we had left because I couldnt’ say, well, we’ve done about 50% of the shots. As a result, we rushed scenes towards the end, and they didn’t turn out as well as they could have.

Next shoot I won’t skimp on this important planning step.

On The Number Two.

still-of-robert-wagner-in-austin-powers--international-man-of-mystery

Ahhhh variable names.

I think I care much more about them than a sane person should. Today I’d like to share with you my opinion on the tendency of developers to abbreviate the word “to” to the number “2”.

What I’m talking about it using this:


var order2Refund = new Order();

In oppose to this:


var orderToRefund = new Order();

I’m on the side of using the entire word, because as a code writer we want our code to be as readable as possible, giving as much intent as possible.

If you’re used to the “2” abbreviation it is no mental jump for you to associate that to the word “to”, but for developers reading who do not have that connection, it is an unnecessarily wasted thought that could be better used solving a business problem.

People may say I’m being pedantic, but I really don’t see the benefit of this abbreviation. I mean sure, it’s one less key stroke, but the key that you’re now using is out of the most used area in the keyboard and probably not as deeply ingrained in your muscle memory – so I doubt very much time would be saved…. not to mention and grammatically incorrect.

The end.

New Improv Techniques (new to me anyway)

John Belushi as Bumble Bee at Skating Rink

At  improv class yesterday Marko gave us some excellent pointers.

Namely:

  • Tilting/panning
  • Raising the stakes
  • “This is the day…”

These are awesome methods to use in a scene (improvised or in writing) to help progression and to make it interesting.

Each of these techniques can be used when a scene is in limbo, for example, a couple is sitting around talking about the weather.

Here’s a brief description of each:

  • Tilting/panning
    In this technique, the improvisers will be in a rut and one person will “tilt” the scene by pulling something interesting in, like announcing he/she wants a divorce, or is getting ill. Ideally this should be somewhat related to what’s going on in the scene at the moment.
  • Raising the stakes 
    Not dissimilar to tilting/panning, raising the stakes is where the improviser will exaggerate a reaction to progress the scene.
  • “This is the day…”
    If stuck for a tilt/pan/way to raise the stakes, an improvisers can think to himself “Today is the the day <blank>” to help the scene progress.


I think I got these right – add a comment if I didn’t!

Usages of SQL Server Table Aliases

group1

In my opinion, SQL Server Table Aliases are over used.

I often see SQL statements in which an alias is used to abbreviate the table name, then the alias is used to specify otherwise ambiguous columns.

For example:

SELECT o.Id
FROM Order o
JOIN Product p on o.ProductId = p.Id
where o.ProductId = 666

I think this abbreviation doesn’t lead to more readable code, and would argue the opposite is true.

Keeping in mind that code is written once, but read many times, I would write the above statement like this:

SELECT Order.Id
FROM Order
JOIN Product on Order.ProductId = Product.Id
where Order.ProductId = 666

Note that I did not abbreviate the table names. My reasoning for doing this is that there can be no confusion which table is being referenced – so there is one less mental step required, even when the reader is reading the code for the first time.

I have two arguments to back me up.

Firstly, to illustrate other patterns when we do not use these types of aliases, imagine this C# code:

var o = new Order();
o.Id = 1234;
var ps = _productRepository.GetByOrderId(o.Id);

foreach(var p in ps)
{
Console.Write(p.OrderId + " : " + p.Id )
}

I think most developers would agree that the variable names here are not useful in describing what we’re working with, and unnecessarily obfuscate the code.

Perhaps a better name would be something like:

var order = new Order();

or, even better,

var orderToFulfil = new Order();

With this example, we can already see some kind of intent being conveyed..

Secondly, to show when I feel an alias is useful, consider self joins. In the case of self joins an alias is required, because using the table name would not resolve ambiguity.

One option that appears to be common would be to use an abbreviation like this:

SELECT *
FROM Order o
JOIN Order o2 ON o.ParentId = o2.Id

I don’t think these alias’ help with the readability of the SQL or to show any kind of intent, so I advocate being more descriptive.

SELECT *
FROM Order originalOrder
JOIN Order reshippedOrder ON originalOrder.Id = reshippedOrder .ParentId

Again, hopefully here some kind of intent is beginning to become apparent.

Now, I’ve checked MSDN on their suggested usage and it seems they don’t agree with me. I think this is one of the  few cases in which I don’t agree wit the MSDN docs.