Sunday, May 27, 2018

FizzBuzz in Go

I recently started poking around at Go again.
I like to prove I can write FizzBuzz in a new language (without looking up any language-specific syntax).

This is pretty straightforward - sometimes people go with a case statement, but I wasn't sure what kinds of comparisons were allowed in a Go switch.  It might be fun to see if I can perform an evaluation (i%5 ==0), or am limited to specific values (1,'a', false).

Thursday, June 1, 2017

Getting Started with Appengine

My brother asked about building web pages on Google AppEngine.  A while back I recorded this getting started tutorial.  The expectation is 0 knowledge of how AppEngine works and brings you from empty folder to working website in under 45min.


Monday, January 9, 2017

Password Mindfullness


No one likes changing their password.  Memorization requires wrote.  Most password policies create passwords that are hard for people to remember, and easy for computers to guess.

Password change can be fun, and even useful outside of improving security.  I'd like to suggest the idea of "Password Mindfulness".  Use your password change as an opportunity to focus on something you want to improve.






Create a simple phrase that makes you mindful of a goal.  Some examples:

Managing Stress:

  • MyProblemsAreSmall
  • SipTheCoffee.EnjoyTheTaste

Building Relationships:

  • AskOthersAboutTheirDay
  • TheGreatestJoyIsTakingAnInerestInOthers!

Regarding the 2016 Election:

  • ThisTooShallPass!2016
  • The only thing necessary for the triumph of evil is for good men (and women) to do nothing.
    • (Keep in mind most passwords can include spaces, so the above sentence is long, hard to crack and includes special characters)

Mindful Passwords can be strong, and call us to an awareness of something.  (An added bonus is that as your priorities change, you can update your password.  No need to wait for that 90 day roll over!) 

Thursday, January 5, 2017

Hello, PC - Leaving Apple Hardware

Part of working at Stack Overflow means refreshing a desktop or laptop build every 2 years.  For the better part of the last year, I've been waiting on my refresh, and proclaiming the good word about the upcoming Macbook Pro 2016 refresh. Sadly, MBP 2016 refresh is generally underwhelming.  As a result, I went with a Razer Blade 2016 with  Razer Core docking station.

Razer Costs:
  • Blade QHD+ 1Tb - $2700
  • Razer Core - $500
  • GTX 1080 - $680
  • ASUS 27" PQ278QR - $699
Total: ~4600

Apple Cart
(The 2016 MBP, with considerably less power comes in about $600 higher)

Setup:
The Razer Core acts as a docking station connecting the PQ278QR, a second vertical document monitor, and my assorted USB peripherals (USB hub / mouse / keybaord / headset). 


  Only 2 leads connect to the laptop - USB C on the Right, and the laptop charger on the left.

To keep my host OS as agnostic as possible, a majority of my work day is compartmentalized into VM's.  Any kind of web development is done in my Ubuntu VM.  OSX Development for Simian / Caulflower Vest is done in either my OSX Development VM, or an OSX Testing VM (Simultaneous running of these VM's has been the greatest strain on the 16GB of system ram.  Bumping my paging file to 32gig seems to have resolved most issues).  I offloaded my domain joined Windows VM to a Vmware View Pool running on a remote ESXI cluster (Although this could have easily run locally as well.)

All local VM's are backed up daily to my Synology, and the Synology copies that volume to AWS.  

With very little customization to the laptop OS (aside from aesthetics / workflow tools like Divvy and Pussh) I can easily remain host agnostic.  In researching this build I discovered that the Intel NUC is compatible with the Razer Core.  The NUC could easily replace my laptop in the event of physical damage or repair.
  
Disappointments:

Windows
Windows 10, while a huge improvement over 7, still has significant use issues.  Working with multiple monitors with varying DPI is a nightmare.  Moving a window from screen to screen results in a stutter.  At high DPI, windows 10 is not pretty.  (Where native windows fails, a multi-monitor ubuntu VM works just fine)

Ram
Going with the Razer meant the same ram limitations as the MBP at 16GB.  While this was a major factor in pushing me away from the Macbook Pro, I reasoned that I could get by with less demanding Linux VM's, than running Windows in a VM on OSX.  

The Bezel
Razor hardware is nice overall, but the bezel is just hideous.  I'm not someone who would have thought I'd care greatly about bezel size.  The bezel on the Razer is over 1" in place.  

Overall impressions

Portable
With the pull of 2 cords, I can take my gaming and development systems anywhere.  The Razer has an onboard GTX1060, which is GREAT for most games.  Using Duet I can turn my ipad into a second screen, or use my AOC 16" monitor.  

Powerfull
Part for part, the Razer 2016 has better graphics, Ram and CPU compared to the Macbook.  Not much to say on this, other than I'm getting much more machine for less.  

In conclusion - Never again Apple.  I was so ingrained in the Apple ecosystem that I nearly forgot what it was like to freely choose the hardware and software I wanted.  Some things are done very well by Apple  - OSX is a beautiful OS that looks great even in my VMs.  It's disappointing that a few marginal hardware improvements (32 gig of Ram, a reasonable battery, working with NVidia to put a substantial card in their system...) could have kept the MBP as my primary device; I am happy to be reminded by this "Brave" move that Apple does not care about Gamers, or developers with strong opinions about hardware.

Monday, July 11, 2016

Dear Blizzard: Please fix competitive play.

You don't have to look much further than /r/overwatch to see that competitive play is broken.  Matchmaking is a terrible joke, and Blizzard has acknowledge the problem.

After losing around 15 straight matches this weekend, while playing with very competitive friends, I've concluded ranked play is just not functional, much less enjoyable.

Below are some simple ideas, in patch note form, that would make play less terrible.

    • General
    • Player location data, and other exploitable information is treated more securely in the game client. 
      • We also intend to treat the use of aim-bots and other trainers much more severely.  We've hired 1 team member to create new detection methods for Governor on a weekly basis.
    • Heros
    • [Competitive]
      • Hero choice will now be a draft pick.
        • Players will be assigned draft picks randomly (similar to HotS)
        • Heroes must be unique per teams. 
      • Players with less than 8 hours on a given Hero will not be allowed to select that Hero in draft.
        • As a result, players must have 8+ hours of play on 7 unique heroes before entering competitive play.
      • Players can still switch to available heroes during the match.
    • Competitive Play
    • [Party System]
      • Players can "Search" for filler players based on criteria:
        • Minimum number of hours as a certain hero
        • Willingness to play certain class types
        • Hours since unlocking ranked play.
    • [Rank Experience]
      • Winning a match after a team mate leaves will result in a 2x reward
      • Leaving a match will result in a 2x rank loss for the leaver
      • Players that  lose with a level 25 on PUG will suffer no penalty*.

    • BUG FIXES
      • Sudden Death has been removed*.
      • 'Suffer No Penalty' has been removed from the early leaver text.
        • We apparently didn't understand what those words meant*.

  • *Tongue in cheek, but seriously these issues need to be addressed.




Saturday, May 23, 2015

Multi-threading and Web Requests


I'm writing a tool that needs to make over 200 API calls using the requests library in python.  The function is doing little more than asking for information and then appending that information into a list.  The current run time results look like this:
[Finished in 209.3s]
I think I can do better.   The main delay is caused because each request must be made after the previous request has finished (or in 'consecutive' order).  This happens because a single python script runs as a single thread, processing things consecutively.

Running multiple threads would resolve this problem.A quick search for python multithreading points me to the Pool class in the multithreading library. Using a pool of "workers" (threads) I can run each web request concurrently.

My first attempt at implementing a pool results in the following error:
Can't pickle
Stack Overflow had an answer pointing out that in order to pass the work around to multiple threads, the job for each thread needed to be converted into a standard format (serialized or 'pickled').  the particular serializer used by this library dosen't understand how to serialize an instanced method, so we'll help it out:
Placing the above script in my class means that it will add understanding for instanced method pickling.  

The next hurtle was the need to pass multiple values into a function called by a Pool instance.  While there seem to be many suggested ways of doing this, I found building a helper function to be easiest.  


This helper function takes the a tuple of arguments handed to it, and then calls the "real" function passing the tuple values in.  Putting everything together looks something like this:


In the end pool.map is handed the helper function to call, and a payload.  The payload consists of a list of tuples.  Each tuple contains the arguments needed for 1 call of the function doing the work (sometimes called the 'Critical Section').  The end result:
[Finished in 16.3s]
Running with 32 processes, the task took only 16.2 seconds.  I'd say that's a solid improvement.
; ;