Mailcheck.js in Production

I was recently tasked with adding Mailcheck.js to some of our production pages and I want to describe a bit of the process I went through because I did some things a bit differently and had some fun along the way.

Lets start with a PSA - do not simply drop Mailcheck onto your website as is! In my opinion / findings the default algorithm is way too greedy - aka it will mostly suggest all emails should be ____@gmail.com. It is worth taking the time to tweak mailcheck for your particular userbase, on one wants to see a correction for their proper email address!

The first thing I did was dumped a ton of emails from our database to create a dataset to work with. I could have used Node to write some scripts to test out the Mailcheck behaviour but Python is just so much more convient for doing numerical analysis. Plus its what our data team uses so I could leverage some of their knowledge and code. So now for the fun part - I ended up using PyV8 (a python wrapper for calling out to Google’s V8 javascript engine). With this setup I was able to slice and dice through our production emails using python and pandas calling the exact javascript mailcheck algorithm and collecting my results. After tweaking the algorithm I could take the settings and new js code and put it in production.

Check out this wacky franken script that got the job done (pandas not included):

import PyV8

def init_mailcheck():
  global ctxt
  ctxt = PyV8.JSContext()
  ctxt.enter()
  ctxt.eval(open("mailcheck.js").read())


def run_sift3Distance(s1,s2):
  script = "Mailcheck.mailcheck.sift3Distance('%s','%s')" %(s1,s2)
  return ctxt.eval(script)


def run_splitEmail(email):
  script = "Mailcheck.mailcheck.splitEmail('%s')" %(email)
  return ctxt.eval(script)


def run_mailcheck(email):
  script = """ Mailcheck.mailcheck.run({
         email: "%s",
       })
   """ % (email)
  result =  ctxt.eval(script)
  if result:
    try:
      result = result.address + '@' + result.domain
    except(AttributeError):
       pass

  return result

if __name__=="__main__":
  init_mailcheck()
  print run_mailcheck("kevinhughes27@gmil.com")
  # >>> @kevinhughes27@gmail.com

read more

Dear Resident Evil 6 Developers

This is the first time I’ve felt compelled to write a real video game review/critique, why is this? because I’ve been a fan of RE since I was a kid and its one of my favourite franchises. While I will say I liked RE6 the game left me very frustrated and I need to talk about it.

RE is increasingly suffering from an identity crisis, is it a survival game? is it an action game? it’s getting more cinematic but at the same time someone is pushing to add more gamification. These goals are kind of at odds, you can’t just smash them all together and expect it to work.

Action vs. Survival I think going for a bit more action than the early games is fine and in my opinion you had the right balance in RE4, since then things have gotten weird. Melee seems to have gotten way more important to the extent that I’m using it when it doesn’t even make sense (this is detracting from the cinematic feel too). The mutations have also got a bit out of hand and I feel like I’m being penalized for headshots - shooting zombies in the face is one of the reasons I play RE. Most importantly the ammo conservation system is now broken, in RE4 I felt in control of my ammo supply and I could conserve in easy situations, in RE6 I felt like I was always scrambling but not in a good way. Finally when you gave enemies real guns it kind of tossed the ammo conservation aspect out the window - some guy is shooting at me but I have no ammo so I’m gonna run and punch him in the face what? (not very cinematic either..)

Cinematic vs. Gamification  The gamification is at odds with the cinematic grandeur of the game - I should have my gun raised looking intently at the next door or checking my back but instead I’m looking down at the guy whose brain I just stomped hoping to god that he drops some ammo so I’m not totally screwed in the next room - and then guess what he drops experience, fucking experience. My memories of RE6 should include the epic boss battles or being startled by a surprise monster but instead I remember running around after killing everything picking up swag and kicking boxes in looking for crap. Tell whoever is pushing the gamification to shove it and make the game epic!

tl;dr

  • Reduce/Remove the item drops, it makes the game less cinematic. Same goes for skill points just calculate it somehow
  • Melee is sick don't get me wrong but it should be used when it makes sense (think cinematic)
  • The mutations and enemy variants made sense in RE4, no need to one up it
  • I like shooting zombies in the face!
  • If enemies have guns we need more ammo

P.S. I just bought RE4 HD for PC and I am pumped!

read more

Weekend Project - Install SteamOS

This weekend I championed my way through installing SteamOS (the Debian distro by Valve that will be the installed on the upcoming Steam boxes). I had to do some pretty crazy stuff to get it working including dropping out of the automated install to manually inject grub-pc and then compiling the drivers for my wireless card. All in all it was a triumph!

and then finally:

This was an early beta release but they made some weird choices - like handicapping the basic Debian installer by fully automating it and only supporting efi. I was actually a bit disappointed when I finally finished because the end result is not really different from simply installing Ubuntu and setting Steam big picture mode to auto start, I am not sure what exactly I was expecting though. SteamOS is much more for OEMs than the DIY crowd at the moment but I can see that Valve is super invested in Linux at this point with a ton of additions to their own repositories. Good things are going to come of this I can feel it!

* Edit *

Almost all the hacking I had to do has been wrapped in Ye Olde SteamOSe 

* Edit 2 *

Wow Valve released an updated version of the beta addressing a lot of the problems Ye Olde SteamOSe addressed and they allegedly collaborated to get this done! This is why Valve is going to win the next generation - working with the community. Full story here

read more