Friday, October 5, 2012

Using Game Controllers for Browser-Based Games

With the recent release of Google Chrome version 22, the Gamepad API is ready for action (no manual adjustment of chrome://flags required).  

Recommended reading:




A great interface to use:
However, due to issues as described in the post:
for the time being, it is better to use the patched version of the code posted at: 
(a GitHub fork of sgraham's code)
at least until the main branch is updated with these changes.

Sunday, September 9, 2012

Digital Humanities

I was recently asked to attend an informal discussion about the "Digital Humanities".  Some quick Google searching revealed a wealth of interesting links, which I'm posting here for my own (and possibly others' ?) future reference:


Wikipedia
http://en.wikipedia.org/wiki/Digital_humanities
"...today digital humanities embrace a variety of topics ranging from curating online collections to data mining large cultural data sets. Digital Humanities currently incorporates both digitized and born-digital materials and combines the methodologies from the traditional humanities disciplines ... with tools provided by computing (such as data visualisation, information retrieval, data mining, statistics, computational analysis) and digital publishing."

Alliance of Digital Humanities Organizations
http://digitalhumanities.org/
http://digitalhumanities.org/dhq/
http://digitalhumanities.org/answers/topic/what-is-digital-humanities
"The Alliance of Digital Humanities Organizations (ADHO) promotes and supports digital research and teaching across all arts and humanities disciplines, acting as a community-based advisory force, and supporting excellence in research, publication, collaboration and training."

CUNY Digital Humanities Resource Guide
http://commons.gc.cuny.edu/wiki/index.php/The_CUNY_Digital_Humanities_Resource_Guide
"...a collaboratively produced introduction to the field of Digital Humanities..."

Digital Humanities Now
http://digitalhumanitiesnow.org/
"Digital Humanities Now showcases the scholarship and news of interest to the digital humanities community through a process of aggregation, discovery, curation, and review. Digital Humanities Now also is an experiment in ways to identify, evaluate, and distribute scholarship on the open web through a weekly publication and the quarterly Journal of Digital Humanities."

Humanities Blast 
http://humanitiesblast.com/publications/
"Engaged Digital Humanities Scholarship"

National Endowment for the Humanities
http://www.neh.gov/divisions/odh
"...supports projects that employ digital technology to improve humanities research, education, preservation, access, and public programming. To that end, ODH works with the scholarly community, and with other funding agencies in the United States and abroad, to encourage collaboration across national and disciplinary boundaries. In addition to sponsoring grant programs, ODH also works collaboratively with the field, participating in conferences and workshops with scholars, librarians, scientists, and other funders to learn more about how to best serve digital scholarship."

Thursday, August 16, 2012

Google Apps Script

Time to prep for the Fall semester classes.  I typically create a spreadsheet of topics on Google Docs Drive, and for student-ease-of-use I would like to use that data in a Google Calendar.  To get these two apps talking, I'm learning Google Apps Script.  It is simple to complete https://developers.google.com/apps-script/your_first_script in a matter of minutes, the syntax is quite readable and easy to understand...

Helpful links:
https://developers.google.com/apps-script/defaultservices

Functions for interacting with spreadsheets:
https://developers.google.com/apps-script/class_spreadsheetapp

Functions for interacting with calendars:
https://developers.google.com/apps-script/class_calendarapp

Here's the function I wrote to export data (lists of dates and topic names for a Calculus 2 course for Fall 2012) to a calendar.

To use it: from Google Spreadsheets, go to Tools -- Script Editor... and enter in the function below (changing variable values as necessary). Save it, then execute the script from Tools -- Script Manager..., accept all the permission requests (only necessary on the first run, as in the tutorial example linked to above), and then execute this script again.

function SpreadsheetToCalendar() 
{
  // This function should be executed from the 
  //  spreadsheet you want to export to the calendar
  var mySpreadsheet = SpreadsheetApp.getActiveSheet();
  
  var myCalendar = CalendarApp.openByName("Calculus 2");
  
  // optional - delete existing events
  var events = myCalendar.getEvents(new Date("January 1, 2011 EST"), 
      new Date("January 1, 2013 EST"));
  for (var i = 0; i < events.length; i++) 
  {
     events[i].deleteEvent();
  }
  
  var dataRange = mySpreadsheet.getRange("B2:C46");
  var data = dataRange.getValues();
  
  // process the data
  for (i in data) 
  {
      var row = data[i];
      // assume that each row contains a date entry and a text entry
      var theDate  = row[0];  // First column of row
      var theTitle = row[1];  // Second column of row
      myCalendar.createAllDayEvent(theTitle, theDate);
  }
 
}
P.S. I've switched to using http://www.stylifyyourblog.com/2012/07/syntax-highlighting-in-blogger-using.html and http://www.tools.stylifyyourblog.com/p/postify.html to format code snippets in this blog... highly recommended!

Saturday, June 9, 2012

Three.js examples on GitHub

In the process of learning Three.js, I am creating my own comprehensive set of examples.  For my own convenience as well as anyone else that may be interested, I'm posting all the code on GitHub at:

http://stemkoski.github.com/Three.js

(As an added bonus, I'm learning how to use GitHub.)

Friday, March 30, 2012

Simple Fast Multimedia Library - setup with Code::Blocks

I love this library.  Compiling and running the basic program was a bit tricky; I had a bunch of "libgcc_s_dw2-1.dll is missing" errors.  What I ended up doing to solve these errors was:
  • First, download the compiler "mingw-with-gcc-4.4.zip" discussed on the webpage http://www.sfml-dev.org/tutorials/1.6/start-cb.php; unzip it into an easy-to-find directory such as C:\MinGW
  • Next, install the Code::Blocks IDE from http://www.codeblocks.org/downloads/26 -- but choose the one that does not include MinGW. When installing, if Code::Blocks doesn't automatically find the MinGW directory you set up earlier, you can configure the compiler afterwards as follows: 
    • In the menu bar, go to "Settings", select "Compiler and Debugger..."
    • In the new window make sure the "Global Compiler Settings" image on the left is highlighted/selected
    • In the "Selected Compiler" dropdown list choose "GNU GCC Compiler"
    • In the tabs underneath the dropdown list, click on "Toolchain Executables". 
    • There will be a textbox where you can type the name of the directory where you unzipped the MinGW compiler
  • In the window described above
    ("Settings -> "Compiler and Debugger..." -> "Global Compiler Settings"), click the "Linker Settings" tab, and in the textbox labelled "Other Linker Options", enter the following five lines of text:
            -static-libgcc
            -static-libstdc++
            -lsfml-graphics
            -lsfml-window
            -lsfml-system
Hope this helps somebody out there (perhaps even my future self?).

Thursday, March 29, 2012

(re)learning C++

I haven't really used C++ since my undergraduate days -- I've mostly worked in Java recently.  Feeling nostalgic, I decided to refresh these particular skills.  I'll be using the freely available C++ IDE called Code::Blocks (available at http://www.codeblocks.org/) and the tutorials at http://www.cplusplus.com/doc/tutorial/introduction/ (where Code::Blocks appears to be recommended above Dev-C++).  Running the "Hello World" program was easy, but to stop the exiting immediately, I recommend adding an int "dummy" variable and a "cin" to the standard code, e.g.,

// my first program in C++

#include <iostream>
using namespace std;

int main ()
{
  int pauseVariable;
  cout << "Hello World!" << endl;
  cout << "Type something and press Enter to continue..." << endl;
  cin >> pauseVariable;
  return 0;
}
P.S. Figured out syntax highlighting thanks to http://mlawire.blogspot.com/2009/07/blogger-syntax-highlighting.html except that (at the time of posting) "Edit HTML" is located under the Template menu in your Blogger dashboard.
P.P.S. Code::Blocks integrates nicely with the Simple and Fast Multimedia Library - http://www.sfml-dev.org/

Thursday, February 16, 2012

What Every Computer Science Major Should Know

Recommended reading:
http://matt.might.net/articles/what-cs-majors-should-know/
I appreciate the specific suggestions in this article, and I particularly agree with the need for a portfolio (including code samples). Thanks to Steve Bloch for the link.

Wednesday, February 15, 2012

Construct 2

Construct 2 is an amazing drag-and-drop style game editor that compiles games to HTML5 and JavaScript, which can then be hosted on Scirra's Arcade or on Kongregate. The free version that has 95% of the capabilities of the paid version. JavaScript plugins are easy to write. The user community forums are active and helpful. Try it out!