Digital Adventures

Notes on programmable logic, tabletop games & other stuff

Twitch API Adventures

| Comments

A few days ago, itmeJP mentioned something to the effect of “it would be cool if you could see the percentage of people in chat who are following you.” After about a day of deliberation/procrastination, I started working on such an app. In short, this app was written in Java using Spring (currently neck-deep in Spring at work, so I can belt out a simple application almost as fast as I used to be able to with Django). You can find the source code of the project here.

Tools Used

  • Java JDK 1.7
  • Eclipse Mars! I had no idea that a new version of Eclipse was out
  • Maven 3
  • Spring 4.1
  • ActiveMQ 5.7
  • h2 Database 1.4
  • Unirest 1.4
  • Sock.js/STOMP

Approach #1: Fetch all followers

The first attempt at this application fetched all followers of a particular streamer and stored these names in an embedded database. This worked perfectly for some streamers (like my old account with 4 followers?!) but intermittently for others. After some more error handling was added, I discovered that Twitch was sending me a 403 (Forbidden) response after 16 pages of results… what? Turns out that there is an undocumented feature that limits the follower API to only allow the retrieval of 3200 (first 1600 and most recent 1600) followers. This brings me to approach #2:

Approach #2: Fetch one at a time

Mercifully, Twitch also provides an API for one-off “does x follow y?” queries. The code written in part 1 was rewritten to instead store the replies from these one-off calls. Fortunately, I read this before attempting to implement the simple IRC member list reader. Unfortunately, I didn’t read this part before implementing the member list reader. Long story short, this solution works for smaller channels (<1000 viewers), but not for larger ones (unless of course you want to know if anyone on the moderator staff doesn’t follow you). Attempt 3 (after a two day break):

Approach #3: Use the API, stupid

Turns out that there is a tmi API that provides a viewer list (and is much, much cleaner than reading the response from NAMES). Once that API call was squared away, I spent the next few hours implementing websocket support and improving the look of the page. There isn’t much to say about this approach since it more or less ‘just worked’, which is good for my stress levels but makes for poor storytelling.

tl;dr: After getting around some weird Twitch API limitations, the app works relatively* flawlessly. Get version 0.1 of it here.

Removing Hobby Paint From Carpeting

| Comments

A bit (okay, maybe a lot) of dark blue Citadel paint was spilled on the carpet about a month ago. Since the first Google result actually provided bad advice, I decided to post some instructions for how to reliably remove hobby paint from a carpet.

First, you’ll need the following supplies: a roll of paper towels, a sponge, a container that can hold a quart or more of water, corn starch, and a multipurpose foaming household cleaner (see below). If are painting above a carpeted surface, GO GET THOSE SUPPLIES NOW. We largely lucked out by having those supplies on hand. We used Greased Lightning general purpose kitchen cleaner, but I would imagine that any cleaner that cleans via a foaming would work equally well.

The Process

  1. Don’t panic
  2. Fetch the supplies listed above. Fill the container approximately halfway with water
  3. Using the paper towels, pinch the paint upwards. Use a new section of paper towel each time. Try not to push the paint laterally, this will just make the affected area much larger
  4. Spray the cleaner on the affected area and wait a few seconds
  5. Using the sponge, scrub the affected area. Rinse the paint-and-cleaner soaked sponge in the bucket of water frequently
  6. You may need to reapply the cleaner several times until the paint in the affected area is mostly removed from the carpet pile. The padding/backing of the carpet will likely still be stained, creating a shadow effect.
  7. Dump the water and replace with fresh water. Might as well rinse the sponge as well
  8. Load the sponge up with water and scrub affected area
  9. Fold the towel over 2-3 times and place on top of the affected area. Walk on top of the towel for 30+ seconds
  10. Liberally apply corn starch to damp area
  11. Wait at least 4 hours, if not longer. The corn starch should be tinted the color of the paint (good luck if using off-white paint)
  12. Vacuum up corn starch.

At this point the paint should be barely noticeable. Don’t worry too much if you can still see an outline of the paint; your problem is that the surrounding non-painted area was lightened by the aggressive cleaning. Both the area affected by paint and its surroundings will darken over time with ordinary foot traffic, blending the two together nicely.

Don’t forget to use a drop cloth next time.

Craftworld Eldar

| Comments

Tl; dr for 7th Edition changes: I’m glad that I didn’t invest too heavily in Wave Serpents. For posterity, I’m posting my 1500 point lists.

Craftworld Eldar, 7th Edition (Warhost Formation)

Guardian Battlehost

  • Farseer w/ Singing Spear
  • Guardian Defenders (30 models)
  • Vaul’s Wrath Support Battery
  • Vyper Squadron
  • War Walker

Aspect Host

  • Dire Avengers
  • Fire Dragons w/ Wave Serpent
  • Warp Spiders

Seer Council

  • Farseer (2x)
  • Conclave (5x Warlock)

Wraith Constructs

  • Wraithlord w/ 4 guns

Notes

  • May omit Wraithlord for additional Support Battery or Vyper
  • May change from Seer Council to other command unit.

Craftworld Eldar, 7th Edition

Command

  • Autarch w/ Swooping Hawk wings
  • Farseer w/ Singing spear

Troops

  • Windrunner Jetbike (x4) w/ 1 autarch. 2 squads.
  • Alternatively, one squad of Windrunner and one Guardian Defender squad

Elite

  • Fire Dragons w/ Exarch and Wave Serpent
  • Wraithblades w/ Wave Serpent

Fast

  • Crimson Hunter
  • Swooping Hawks w/ Exarch
  • Warp Spiders w/ Exarch

Heavy

  • Vaul’s Wrath Support Battery (2x) w/ D-cannon
  • Wraithlord w/ weapon and glaive

Shorty Got a New Skeleton

| Comments

The three existing implementations of Shorty now use the latest version of Skeleton css (2.0.4) hosted on cdnjs. The most apparent change is that Skeleton went from a 16-column system to a 12-column system.

I hope to finish a version in Node.js with Express later this week. Astute readers will notice that this is not the Spring implementation that I mentioned last time, and that is because (as it turns out) Spring isn’t fun to work with, even with all the bells and whistles offered by Spring Boot and the IntelliJ Spring plugin.

Warhammer 40k - Eldar Farseer

| Comments

Another figure painted. Hannah and I worked on this one together; I did the easy base coats and coarse detail, while Hannah painted the highlights and fine detail.

Farseer image

We’re also currently working on a Wave Serpent, a unit of 4 Jetbikes, a unit of Fire Dragons and (still) the rest of the squad of Guardians.

Works in Progress

Shorty Update: Python

| Comments

Remarks about the three implementations completed thus far:

Tornado

  • Least disliked version (as a whole) thus far
  • Least painful to develop (no surprise; I’ve worked with Tornado previously)

Flask

  • I’d gotten rather used to class-based views; they were missed here
  • I enjoyed using the Jinja2 template engine (certainly more than the Tornado template engine)
  • Lack of included batteries seems like a major step backwards after using Django and Tornado

Flask with SQLAlchemy

  • Nope
  • Flask-SQLAlchemy package made using SQLAlchemy less painful, but, as a whole, Alchemy is the least pleasant ORM I’ve used

Up next: Spring (Java). I look forward to using it properly with Maven or Gradle, a nice change of pace from work where those tools are curiously verboten. [Edit 2/20/15: Maven is no longer disallowed by my employer.]

Update

| Comments

Still really easy to write these roundup posts, so here you have it. Things I’ve been working on since the last one of these:

  • Migrated my other domain to a new EC2 instance (generation 2 micro) since the generation 1 reserved instance contract ran out last month.
  • Built a squad of Eldar Guardians and a Farseer. One of the Guardians is painted, see it here
  • Two sessions of the Pathfinder Iron Gods campaign
  • Read Think Like a Freak. Verdict: Okay, but not great. I’ve read and watched a number of articles and videos about their work and this book merely compiled those sources into a single product. Skip it if you’ve done the same.
  • Shorty, now in 2 frameworks (and another 50% completed)

Warhammer 40k - Eldar Guardian

| Comments

Today I finished painting my first Eldar figure. While this wasn’t the first 40k figure that I’ve painted as of late, it was the first one that I felt invested in the outcome of. Granted, it’s a little lumpy in places and the fine detail isn’t so fine, but it represents a good baseline of what I can currently produce. Hey, if nothing else this model will serve as a complementary “before” picture to a model that is yet to be painted in the (distant) future.

You can find some images of the model here and a video showing the progression on youtube below:

I also posted the images and video on the 40k subreddit and received some useful feedback. Some ideas for next time:

  • Use white or grey primer
  • Use a wet palette
  • Don’t paint everything the base color

Shorty

| Comments

Shorty is a simple URL shortener. I came up with the idea as a good way to perform some due diligence for the framework that I will use for an upcoming web app rewrite. Since there isn’t much sport in blindly rewriting an app in the same language/framework that it was originally written in, I figured that I should have a go at writing a simple app in some other languages/frameworks. That’s where Shorty comes in; the problem is well defined, there aren’t too many requirements, and the legwork of coming up with a data model and site layout is handled. Think of this like TodoMVC, only not for frontend JS.

The first framework tried was Tornado due to my extensive trials with it when writing skillbook. I considered skipping it entirely, but didn’t since I figured that it would be beneficial to start easy and work out the issues with the database and layout in a framework that I was well versed in.

You can find the code for Shorty on GitHub.

Pathfinder AP: Iron Gods - Fires of Creation

| Comments

After many weeks trying to find a fourth, we finally settled for three and started playing the Iron Gods Pathfinder Adventure Path. Some PC exploits from the session:

  • Crushed a malfunctioning mechanical repair drone under an anvil
  • Sniffed some dusty brown mold
  • Used prestidigitation instead of an acrobatics check (whoops)
  • Watched an allied NPC critically miss her arch-nemesis

Session 2 of part 1 will convene sometime next week. Live in Austin and want to play? We’re still looking for a fourth, and I can (probably) figure out a way to write you into the story.