Hello, Euler!

18 July 2016

Last Thursday I was browsing a coworker’s repositories on GitHub and noticed one inconspicuously called euler. And that’s how I discovered Project Euler! The website describes the project as “a series of challenging mathematical/computer programming problems that will require more than just mathematical insights to solve.”

I wouldn’t describe myself as a math aficionado, but have had a blast working my way through the problems. So far, I have already picked up a lot about prime numbers and touched the ceilings of number-based data structures many times! With over 500 problems (and a new one every week), I’ll be able to keep myself occupied for a while.

Like my coworker I now too have an euler repository that you can browse.

Pokémon Go

12 July 2016

Last week, the world was forever changed with the release of Pokémon Go a.k.a. Nintendo letting Niantic reskin Ingress with Pokémon to make tons of money. I’ve been playing the game for a few days and it’s fun. Walking around outside and seeing tons of people playing this game was truly unexpected; I never imagined “Pokémon on mobile” was going to be delivered like this. It’s refreshing – both to be outdoors and to see gamers who are traditionally recluse out and mingling.

So many people outside!

But the game has its fair share of issues:

  • The game is very buggy. I’ve had it crash and completely lock up at least twice each day since installing it. I’m sure stability will increase with coming patches.
  • Servers are having trouble keeping up with the huge spike in popularity. This isn’t too shocking. It reminds me of how terrible the servers were for the rebooted Final Fantasy XIV back in 2013.
  • There’s also been some privacy complaints about the iOS version having full access to your Google account. Given how buggy the app is, I was not shocked when they said it was a configuration mistake.
  • This game destroys my battery. Got 80% battery left? You mean 80 minutes left of Pokémon Go playing time! I can now empathize with Android users who live under the tyranny of terrible battery life.

Drawing people in with the Pokémon IP and getting them into the Ingress geo-caching game model has been successful so far, but Pokémon Go is just scratching the surface today. I’m really hoping Niantic is cranking on social features. I’d love to have a friends list, trade Pokémon, get bonuses for hanging out with other trainers, make clans, gift Pokémon to friends, and see friends on the map.

Authenticating Programmatically Sent Emails

10 July 2016

Work on the Ruby and Sinatra project continues and this weekend I worked on creating a helper method for sending emails so I can have users confirm the emails they used to register. I wanted to send emails from a mailbox I set up on a custom domain I’m hosting with DreamHost. I created a mailbox on DreamHost’s admin panel and with the mail Ruby gem it was pretty straightforward to get emails sent.

class ApplicationController < Sinatra::Base

  # Configure mail gem
  # You can use the config_env gem to save sensitive information (https://github.com/SergXIIIth/config_env)
  options = { :address              => 'www.yourdomain.com',
              :port                 => 587,
              :user_name            => '[email protected]',
              :password             => 'yourpassword',
              :authentication       => 'plain',
              :enable_starttls_auto => true,
              :openssl_verify_mode  => OpenSSL::SSL::VERIFY_NONE }
  Mail.defaults do
    delivery_method :smtp, options
  get '/mailtest/?' do
    Mail.deliver do
      to user@yourdomain.com
      from 'Welcome <[email protected]'
      subject 'Test Subject'
      body 'Test Body'

Hit and the endpoint and you’re done! Or are you? To the Gmail inbox!

Gmail has some doubts!

All looks good except Gmail ominously warns us: “Gmail couldn’t verify that chuckpad.io actually sent this message.” This means “Gmail doesn’t know if the message is coming from the person who appears to be sending it,” which makes our messages excellent candidates to get caught by Gmail’s spam filters! Read more about authenticated messages here.

After some digging around, I learned about Sender Policy Framework (SPF) records. Basically, a DNS record can have some metadata which identifies which servers are permitted to send email on behalf of the domain. DreamHost’s default “SPF information doesn’t include DreamHost’s mail servers” because you can always opt to host your domain’s mail servers elsewhere. Fortunately, this can be easily remedied by adding the SPF record v=spf1 include:netblocks.dreamhost.com to our domain’s DNS record.

Gmail's doubts are gone!

Give the DNS caches of the world a few hours to refresh, try again, and boom! Success! Programmatic and authenticated!

Thoughts on Star Ocean 5

06 July 2016

A week after its release, I beat Star Ocean Integrity and Faithlessness a.k.a. Star Ocean 5. Here are some of my thoughts on the game.

  • The game is short: I beat it in 24 hours doing about 70% of the side quests.
  • The story is pretty poor. It’s easily the weakest in the series.
  • I liked the cast of characters and the voice-acting was pretty good! Each character was unique and memorable. The story didn’t do the characters enough justice but the optional Private Actions gave some opportunities for development.
  • The battle system is good, but the AI was terrible at making all characters useful. Heal spells always seemed to be improperly timed!
  • How cutscenes were implemented was lazy and really hurt the delivery of the already-bad story. Cutscenes were rendered without any special handling and would let the player walk around and control the camera. This likely saved a lot of development time as cutscenes did not need to be “directed” but really cheapened each scene.
  • The camera was bad: too close to the character and too jarring when moving around.
  • There was too much backtracking without early fast travel options.
  • The option to have orchestrated battle music from Valkyrie Profile was great! This reminded me how much I want Valkyrie Profile 3 to happen.

So much potential squandered!

Conclusion: it’s the weakest entry in the series so far. Even though I just finished trashing the game pretty hard, I powered through it because it was fun to play (I’m a masochist). Along with the Tales series I always considered Star Ocean to be a reliable source for decent JRPGs. This game sadly makes me question that. I would not recommend buying the game at the $60 price-tag, but if you find this game in the bargain bin, I’d recommend picking it up if you’re hungry for a JRPG.

Don't Forget the License!

28 June 2016

If you write some code and want to share it with the world, don’t forget to add a license! Posting code on a public repository on GitHub and allowing people to incorporate that code into their own products are not one and the same. So add a license please!

As will all things, there are tons of licenses for you to pick from. choosealicense.com has a nice guide on the most commonly used licenses. Basically, if you want to let people use your code without too many restrictions go with the MIT License.

So go forth! Code, slap a license on it, and share it!