Tuesday, August 21, 2012

Word (Mac) and Removing Field Codes

So, if you're using Mendeley and you have all of your citations (references) in a Word document on your Mac, and you are ready to submit your Word document, you need to change all the field codes from field codes into regular old text showing the result of the field codes.

Word help does not help (bastards). The Internets assumes you are not using an awesome Unix-based OS, and tells you to select all the text and then use control-shift-F9. This does not work on a Mac, even though there is a control key. It's close, though:

Command-A (select all the text in the doc).
Command-Shift-F9 (changes all the field codes to text of just the results).

Better on a Mac:
Command-A (select all the text in the doc).
Command-6 (changes all the field codes to text of just the results).
C/o Adept Scientific from three years ago, and it still works today with Word Mac 2011.

Monday, August 20, 2012

R and Outputs and Printing and Loops

First off, R is really similar to python and it is making some things easier and some things more difficult.

But, R apparently won't print in loops. This is sort of weird.

So if you have...

for (i in 1:5) { summary(my_lm) }

...that won't output to the screen, but if you then just select the "summary(my_lm)" part and run that it prints fine like it should albeit once (perhaps that's a hint of sorts).

So you need...

for (i in 1:5) { print(summary(my_lm)) }

...which works like summary(my_lm) works when it's not in a loop.

Update: Apparently the same thing is true for two other conditions! One, I believe, is for outputs in general, so includes if you are trying to output to a file (or at least save to a file). So if you are trying to do something like the following generic example:

pdf("my_filename.pdf")
plot(x, y)
dev.off()


...generally, that works -- unless it's in a loop! Again, you need to do:

pdf("my_filename.pdf")
print(plot(x, y))
dev.off()


Note I am assuming you know how to do the whole pdf() or maybe there's jpg() or whatever with dev.off() at the end there.

Two, is that the output (to screen or file) call doesn't have to be in the loop itself, not exactly. It can be in a function which is called by a loop, and R notices it, so again you need to explicitly call "print()" with whatever you were trying to do that works fine when not in a loop. 

So to be clear, this does not work:

make_Plots <- function(ii) {
    # Makes the plots, saves to PDF (no it doesn't!)
    my_file <- paste("My_filename_sequence_", ii, ".pdf", sep="")
    pdf(my_file)
    plot(x, y)
    dev.off()
} # End of make_Plots 


# Main, as it were.
for (i in 1:10) {
    make_Plots(i)
}



So you see in the function call, we change the output device to be the PDF device (not the screen or anything else). So, when we call "plot" and then close the PDF device with "dev.off()" the plot call gets outputted into a PDF file with the specified name. But it doesn't, since this is an output/print call that is in a loop -- even though the loop is in the main and the output call is not!

Again, you need print(), like so:

make_Plots <- function(ii) {
    # Makes the plots, saves to PDF (this one does!)
    my_file <- paste("My_filename_sequence_", ii, ".pdf", sep="")
    pdf(my_file)
    print(plot(x, y))
    dev.off()
} # End of make_Plots 


# Main, as it were.
for (i in 1:10) {
    make_Plots(i)
}


So, I believe if you were to call the first make_Plots (no print) while control is not in a loop, it would work fine. But if you then call this otherwise fine and working and you tested it function while in a loop, it will stop working. That is insanely annoying, but I assume there is some reason for it. Sort of addressed in this FAQ, but just briefly.

Thursday, August 16, 2012

Rocky Horror Homage in EQII

Yes, even more homage in EQII -- honestly given how much content there is in-game, I've barely scratched the surface. But not all homage is fantasy-based, or nerdly, although most is. Here's an example (from one of the questlines for Paineel, which is three expansions ago), and it's not quite geek culture, although it is geeky in terms of musicals or movies, but it is certainly not mainstream -- the movie The Rocky Horror Picture Show (aka just Rocky Horror). I think I've seen it twice, but that was a long time ago.

Anyway, if you know a few of the songs, you might know "The Time Warp": "Let's do! The time warp! Agaaaaaaain!!!", that one. It's just a jump to the left...


Monday, August 13, 2012

Guest Post at Play As Life

I have a guest post about my Digital Elves piece up over at Play As Life. And, just recently on the local NPR station (WNYC), the Brooklyn-based show "Kings County" (Brooklyn is Kings County), they had comedian Wyatt Cenac of the Daily Show, who talked about how there are no brown hobbits (i.e., fantasy people like elves and hobbits are always white). It starts at about the 8min 25sec mark in the show. Very funny. Relates to what I was talking about in the Digital Elves paper, which has been accepted at the journal Games and Culture. And, recently, a great post about humanizing Orcs!

Ritual, Television, and the Olympics

I was reading the New Yorker recently (August 6, 2012 issue) and there was this great quote from a piece, titled "Glory Days: What we watch when we watch the Olympics" by Louis Menand.

If someone described to you an ancient civilization in which, every four years, at great expense, citizens convened to watch a carefully selected group perform a series of meticulously preset routines, and in which the watching was thought of not as a duty but as a hugely anticipated and unambiguously pleasurable experience, you would guess that, socially, this ritual was doing a lot of work. You would assume that it was instilling, or reinforcing, or rebooting attitudes and beliefs that this hypothetical civilization regarded—maybe correctly, maybe just superstitiously—as vital to its functioning.
I love reading about ideas about ritual described like this, especially as it is reminiscent of both Geertz and Carey. Ritual is... often? always? a communicative act, and as such is pro-community behavior (especially with its historical dimension, tying the current community together and with its embodiment in the past).

Thursday, August 9, 2012

Python's csv.DictReader returns...

I spent a few hours banging my head against what now seems like something that should have been pretty easy to figure out, except I haven't coded in 20 years so a lot of the time although I have a general idea what I'm doing, figuring out the specifics and finding and understanding the online help (of all sorts) is really difficult. When I learned to code, there was no online help.

csv.DictReader.... it doesn't return a Python dictionary object. (It returns a... list? of dictionaries...)

Seems like it would, given the name, but no. And that was so difficult to figure out (thus, have to make a blog post out of it).

The csv library is great for dealing with data (since it deals with csv files). And Python dictionaries are pretty cool. But the csv.DictReader object is not a dictionary object.

It's like, if you hand it 100 things, and expect one big dictionary with 100 entries, you don't get that. You get back 100 little dictionaries of one entry each.

I haven't yet used Python's dictionaries at all, but I think the benefit to the csv object is it iterates better. I assume there's some reason to do it that way, but if I understood that, I wouldn't have had any problems in the first place.

Create an object which operates like a regular reader but maps the information read into a dict whose keys are given by the optional fieldnames parameter. If the fieldnames parameter is omitted, the values in the first row of the csvfile will be used as the fieldnames.
"Into a dict....", so, a dictionary object, right? No.

Thursday, August 2, 2012

Game Homage: H. P. Lovecraft in Oblivion

One of my favorite games, and one of my... well, he's not one of my absolute favorite writers, but as an old-school New Englander he's my boy: H. P. Lovecraft. In Oblivion, there is a questline called "A Shadow Over Hackdirt" which, as pointed out in various wiki entries, is an homage to Lovecraft's "The Shadow Over Innsmouth." A town! A dark secret! Mystery! Note that, according to the Wikipedia page, "The Shadow Over Innsmouth" is based on other stories. Culture begets culture.

One of the Oblivion wikis also has a list of easter eggs, many of which are homage.

I mostly focus on homage in EverQuest 2, since there is so much of it, but people like to play with the things they like, so homage shows up in a lot of game spaces.