Elchanan Mossel’s Probability Problem in JavaScript

An interesting problem popped into my twitter feed this morning:

Here’s how I wrote the problem in JavaScript:

function rollDie() {
  return Math.floor(Math.random() * (7 - 1) + 1);
}

function allEven(arr) {
  for (var i = 0; i < arr.length; i += 1) {
    if (arr[i] % 2 !== 0) {
      return false;
    }
  }

  return true;
}

function rollsToSix() {
  var rollResults = [];
  var sixRolled = false;

  while (sixRolled === false) {
    var roll = rollDie();

    if (roll === 6) {
      rollResults.push(6);
      sixRolled = true;
    } else {
      rollResults.push(roll);
    }
  }

  console.log(rollResults);
  return rollResults;
}

function howManyPositiveResults(attempts) {
  var positiveResults = 0;

  for (var i = 0; i < attempts; i += 1) {
    var resultOfRoll = allEven(rollsToSix());

    if (resultOfRoll === true) {
      positiveResults += 1;
    }
  }

  return positiveResults;
}

console.log(howManyPositiveResults(100));

The above program runs the results 100 times and returns the number of positive results. It also logs all the rolls even if the consecutive rolls included odd numbers.

It was fun to watch Mike Lawler do this problem with his children. I learned another approach to the problem from him. You can watch it here:

Exploring Elchanan Mossel’s fantastic probability problem with kids

When Transferring Domains – Make Sure to Turn WhoIs Privacy Off

contactprivacy.com Transfer Problem Solved

TLDR – Turn off WhoIs Privacy if you are transferring from hover.com to domains.google.com

Reasoning Behind this Blog Post

While having trouble switching a domain from hover.com to domains.google.com I found the solution which would have saved me a bit of time. I hope this blog post saves you a bit of time if you find yourself struggling with this problem.

Unable to Transfer a Domain? An authorization email has been sent to @contactprivacy.com

The Domain Transfer Problem

Here’s the image that got me stuck:

Turn WhoIs Off

Google Domain Message

An authorization email has been sent to <yourDomaing.ninja@contactprivacy.com. Please follow the instructions provided in the email to authorize the transfer. If we don’t hear back by <date>, the transfer will be canceled.

 

Vinyl Plank Flooring, Wastewater Tanks and a Custom Mosaic Bathroom on the Skoolie

Today I wrapped up the floor. Critical to today’s success where a table saw, a circular ‘chop saw’, and careful measurements.

V worked hard on her custom mosaic tile bathroom. It’s been a crazy time. We’re working all the time and it feels like we’re never going to be complete.

Also, I lifted the wastewater tanks up on the underside of the bus today. Huzzah!

Thank you for watching.

Old Focus 01/08/16

This is my nownownow entry from January 8th, 2016. To see what I’m focused on now, go here.

Learning to Code

I’ve learned Ruby on a basic level now. I’m having a really good time solving scaleable math problems.

Before applying for App Academy, I want to exhibit excellence in basic Ruby coding. To do this, I’m reading books on Ruby, playing Ruby games and going through external tutorials (also, Ruby monk and Koans.)

Learning to code has changed the way I think about things. I love it. Even if AppAcademy turns out to not be a great fit, I’m going to continue to get good at this skill. The opportunities in the open source community and solving problems in a scaleable way is far to interesting to not get involved. I’m hooked.

 

Our Business

Our company is called Freedom Podcasting. We offer podcast production services and podcast editing services:

We’re focused on ensuring that we have the bandwidth to bring on more clients while ceaselessly creating excellent, chart topping podcasts.

 

Video Editing

I’ve completed the video editing for our YouTube series which documents our trip across the country in 2015. The next step will be to do a welcome video for the series.

Embedding 3d Scripts to make Websites Engaging

I’d love to be able to embed elements like this into the backdrops of websites to make them look really amazing and futuristic. This one is a bit dramatic and would be distracting…. but if I could slow it down and make the moving shapes low contrast, I think it would make an amazing website. Maybe a good one page element for a data science company or something like that.

See the Pen Nonsense Clocks by Zevan Rosser (@ZevanRosser) on CodePen.

w1 – App Academy Bootcamp Prep Wrap UP

160 Spear Street
The first week of AppAcademy bootcamp-prep is behind our class.

Even though I spent the first few months of the year studying the subject matter in-depth, I’m still finding this class to be useful. Let’s talk about some benefits:

First, it’s great to be around people who are actually good at computer programming. As I was walking home after the first day of class, looking up at the big glass buildings, I realized something crazy. That day was the first time I’ve actually talked with other computer programmers.

I’ve done lots of web development with our podcast production company, but never really met anyone who had a deep appreciation of iterative thinking and back-end languages like Ruby and JavaScript.

So it was surprising to actually sit down and enjoy a conversation about the details of what makes different functions better than others, even when the results are the same.

The Good

Bootcamp Prep is great because we take it slow. I think learning thinks like loops, arrays, variables, strings, objects, NaN and many more basics of programming, are going to be critical to a programmers success. I’m happy to go over things again and again.

It’s helpful to learn these elements from different people too. It’s great that a/A has video lessons from other professors, not just our main, in-class, professor. Learning from others helps me see the subtle nuances which might have eluded me on the first pass.

Sure, I can solve that problem with a for loop… how do you do it with a while loop. This stuff should be like walking forwards or backwards to a programmer.

The Bad

There is a style of teaching in which people who are knowledgable ask questions to those that don’t know the answer. There are these long pauses and I don’t think it works well for programming. It’s great for philosophy or some social sciences, but in programming the answers are to specific. Here’s an example:

Teacher = T | Student = S

S – Why is my loop causing my terminal to go blank?

T – You’re forgetting to iterate your while loop. Do you remember how to iterate?

S – (long tortured pause, starring at impossible code)…

 

This goes on a lot. I think there is a better way to do it. It’s all about speed. Here’s how I think it would be more effective.

S – Why is my loop causing my terminal to go blank?

T – You’re forgetting to iterate your while loop. Do you remember how to iterate?

S – (short confused pause)

T – Ok so with while loops you need to write in an iterator. Here is how to write a while loop to iterate from 4 to seven:

i = 4
  while (i < 7) {
  console.log(i)
  i += 1
}

T – Now type in node + the file name and run that code. Ok, so you want this while loop to be part of your muscle memory. You want to be able to type this without looking at a screen. So do this 5 times for the following iteration: 10 – 20, 20 – 30, 30 – 40, 40 – 50, 50 – 60.

S – (goes off to typing things really quickly)

App Academy View

Week One is Done

The best thing that has helped me this first week is hard work.

I’m going over every note, every video and doing every problem available 2-3 times and I’m doing them in different ways. Before each class, I work on the problems we will have at the end. That way I know the sticky parts before they come up in class.

Luckily, I’m loving the process. I love writing programs. I love solving the problems and I love the pressure of tests.

See you next week.