IndyWatch Education Feed Archiver

Go Back:30 Days | 7 Days | 2 Days | 1 Day

IndyWatch Education Feed Today.

Go Forward:1 Day | 2 Days | 7 Days | 30 Days

IndyWatch Education Feed was generated at Community Resources IndyWatch.

Tuesday, 18 September


A better versioning scheme for your React Native modules - Medium

In this article, I will tell you about the versioning scheme we use for our React Native modules at Wix.

TL;DR: semver syntax and git commits.


Get it Done

Major: manually from package.json.

"version": "2.0.0"

Minor: number of commits on the master branch.

Patch: number of commits in <branch> since diverged from master. On the master branch, it will be 0.




How To Create an Interactive Flex Layout Designer In JavaScript - Medium

The best tutorials come from finishing real projects. When the project is done, I like sharing what I learned.

This time, the project is my CSS flex layout designer. I will explain how I created it from start to finish and provide example source code below.

Open Flex Layout Designer

This is the instance of flex class were going to code in this tutorial.

Thats what were building in this tutorial. You can also spawn multiple instances of it at will on the same page with different default parameters.

Here is the Open Flex Layout Designer < click to try it live again:

Open Flex Layout Designer

I think its a fun project because the built-in CSS flex functionality cuts out most of the work for us. The most difficult thing here is writing the drag and drop code, but still, its not that hard.

To create this flex layout designer we will briefly use jQuery for cross-browser click events and jQuery.css method to dynamically set CSS properties to our flex items while they are being resized.

FIRST THINGS FIRST. Why are you creating your application? Why is it needed? (Is it?)

Its fine if you get excited about ideas. But to write effective software that people actually need, you must never write a line of code without first asking if there is a need for what you are about to create.

You always start in the same way.

Find an existing problem that needs to be solved. In my case, I was able to answer this question. Thats because most flex tutorials I found online were either too limited or contained explanations using static images.

I mean, come on. This is flex. The name itself alludes to the fact that things will be flexing. That is, resizing, scaling, changing. So why all the static image tutorials for flex?

This didnt sit well with me. I knew that to create a truly useful tool that has high educational value, an interactive approach was overdue.

Your application idea should start with an abstract vision. Usually, it is something you get excited about. But remember that your software must also solve a real, existing problem.

For me, I wanted to create a tool or generator that doesnt exist yet. Something you wish existed for personal reasons.

In this case, the CSS flex layout ex...

Go Back:30 Days | 7 Days | 2 Days | 1 Day

IndyWatch Education Feed Today.

Go Forward:1 Day | 2 Days | 7 Days | 30 Days

Monday, 17 September


Math Teachers and Homeschool Bloggers: We Want You! Denise Gaskins' Let's Play Math

Do you have a favorite blog post about math activities, games, lessons, or hands-on fun? The Playful Math Blog Carnival would love to feature your article!

We welcome math topics from preschool through the first year of calculus. Old posts are welcome, as long as they havent been published in past editions of this carnival.

Click here to submit your blog post

Dont procrastinate: The deadline for entries is this Friday, September 21. The carnival will be posted next week at nebusresearch blog.

Have you noticed a new math blogger on your block that youd like to introduce to the rest of us? Feel free to submit another bloggers post in addition to your own. Beginning bloggers are often shy about sharing, but like all of us, they love finding new readers.

Need an Idea-Starter?

If you havent written anything about math lately, here are some ideas to get your creative juices flowing

  • Talking Math with Kids: Children often have surprising insight. Even when theyre confused about math, their point of view can open our adult eyes to new understanding. Share your kids stories...


A Beginners Guide to GraphQL - Medium

All you need to know about the latest buzzword thats taking the API development scene by storm.


GraphQL is a query language and runtime that we can use to build and expose APIs as a strongly-typed schema instead of hundreds of REST endpoints. Your clients see the schema. They write a query for what they want. They send it over and get back exactly the data they asked for and nothing more.

A schema looks like:

So, if a client wants a user with an ID of 2, instead of doing a GET /api/v1/users/2, they would rather send a query like this:

and get a response like this:

Why should REST watch its back, and why should you care?

  1. The schema is strongly-typed. The schema dictates that the id parameter must be an integer. If a client sends user(id: 2) instead, the GraphQL engine will reject the whole query.
  2. Clients pick what they need. See those braces after the query parameters? Thats how our clients tell which fields they want. Fewer fields = leaner and faster responses.
  3. Its fast. Fields not picked wont be processed, meaning less stress on the server.

And thats all there is to it, really. No magic is going on. Just a more convenient, flexible, and natural way of building your API.

But what is life without those juicy core concepts and sweet, sweet code examples?

The Big Five

Before moving onto the actual fun, there are some concepts we need to have in mind, otherwise everything else wont make any sense.

Dont worryIll keep it short.


A member of the schema that reads data.


A me...


How to call JavaScript code on multiple DIV elements without the ID attribute - Medium

Photo by Sergey Zolkin on Unsplash

Written by @js_tut (Twitter)

In this tutorial, well take a look at how to call JavaScript code on multiple DIV elements on the page, when they are missing the id attribute (or when calling an individual element is not permitted, for some reason.)

This happens more often than you may think. For example, you have an image gallery (or any other list of elements) and you want to do some action on each element but dont want to access each element individually.

Lets say you have a few arbitrary HTML DIV elements:

  <div class = "image">content 1</div>
<div class = "image">content 2</div>
<div class = "image">content 3</div>

You can select these DIV elements, even though they dont have id attributes. In fact, they share the same class name image.

Lets see a few alternatives we have when it comes to selecting a collection of HTML elements. There are at least three ways of doing this in JavaScript.

1. Using document.getElementsByClassName

In order to select the elements in question, you can use the document.getElementsByClassName function.

It returns a non-iterable collection of all elements.

Which is just a list of elements, similar to (but not exactly as) Array.

let divs = document.getElementsByClassName("image");

2. Using document.getElementsByTagName

Same thing here, only using a different JavaScript function.

let divs = document.getElementsByTagName("div");

3. Using document.querySelectorAll

You can do the same exact thing with document.querySelectorAll function.

let divs = document.querySelectorAll("div");

Return Value

What do these functions return?

console.log(divs); // Let's output the results

Different types of objects.

Yet, containing the same selected elements:

1.) Functions getElementsByClassName or getElementsByTagName:

HTMLCollection(3) [div.image, div.image, div.image]
0 : div.image
1 : div.image
2 : div.image
length : 3, __proto__ : HTMLCollection

2.) Functi...


How to (Un)marshal JSON in Akka HTTP with spray-json - Medium

In the previous post, we added JSON support to our Akka HTTP API using circe.

This time well do the same but using spray-json. Akka HTTP supports it by providing an official librarywe dont need a third-party party one like we did with circe.

Project setup

Well go through the same steps as the previous tutorial to set up the project.

Clone the repo, and check out the branch 3.3-repository-implementation.

We will also do the changes we did in the previous tutorial.

First, we will replace the circe dependencies with the spray-json dependency since we wont be needing it for this tutorial. Update the build.sbt file with the following contents:

Next, we will add a save function to the TodoRepository and its implementation:

import scala.concurrent.{ExecutionContext, Future}

trait TodoRepository {

def all(): Future[Seq[Todo]]
def done(): Future[Seq[Todo]]
def pending(): Future[Seq[Todo]]

def save(todo: Todo): Future[Todo]


class InMemoryTodoRepository(initialTodos: Seq[Todo] = Seq.empty)(implicit ec: ExecutionContext) extends TodoRepository {

private var todos: Vector[Todo] = initialTodos.toVector

override def all(): Future[Seq[Todo]] = Future.successful(todos)

override def done(): Future[Seq[Todo]] = Future.successful(todos.filter(_.done))

override def pending(): Future[Seq[Todo]] = Future.successful(todos.filterNot(_.done))

override def save(todo: Todo): Future[Todo] = Future.successful {
todos = todos :+ todo

This will allow us to create a POST request to create new todos.

And finally, update the Main object to create a list of todos for testing purposes, and with the appropriate routes:



The Hitchhikers Guide To React Router v4: Grok React Router in 20 minutes - Medium

A brown mug next to a MacBook with lines of code on its screen by Artem Sapegin on Unsplash

Hi fellow React Hitchhiker! Want a ride into React Router? Jump in. Lets go!

To understand the philosophy behind React Router, we need to know what a Single-Page Application (SPA) is.

What Is A Single-Page Application?

Basically its a web application or web site that interacts with the user by dynamically rewriting the current page rather than loading entire new pages from a server.

Why is this so good?!

1. avoids interruption of the user experience between successive pages

2. makes the application behave more like a desktop application

3. all the code resources are dynamically loaded and added to the page as necessary, usually in response to user actions

4. because its kewl and kewl and extra-ultra-wide-4K-level-of-kewl.

SPAs are an industry standard now, and lots of companies are in a quest to find programmers to develop their projects.

What is React Router?

React Router is a tool that allows you to handle routes.

Since youre dealing with an SPA, you need a way to trigger the contents that are loaded on the screen. React Router introduces a concept called Dynamic Routing, which is quite different from the Static Routing we are used to.

When youre dealing with Static Routing you declare your routes as part of your apps initialization before any rendering takes place (Rails, Express, Ember, Angular, and so on).

Dynamic Routing means that routing takes place as your app is rendering, not in a configuration or convention outside of a running app.

React Router v4 advocates and implements a component-based approach to routing.

It provides different Routing Components according to the needs of the application and platform.

In this specific case were going to explore <BrowserRouter> because we want to use dynamic routing in a web app context and leave the other ones for other circumstances.

Who Created React Router?

These two amazing human beings, Michael Jackson and Ryan Florence. And they deserve loads, tons of claps! Together they started React Training.

Nowadays, correct me if Im wrong, they followed separate paths:

Michael Jackson continues to develop React Training.

Ryan Florence created Reach.Tech.

Has React Router Anything To Do Wit...


How to go from Callbacks to Async Await in Node - Medium

I recently got a chance to work with Node again. Being a huge fan of promises, I never tried async await. Why? Because promises worked fine for me, thats why.

Sure thing promises work fine for simple controllers. Couple database querying and error handling, then promises can be nasty. Yes even if you chain them. What if some resolved value in your second promise chain was needed in your fourth promise? But again Id usually hack my way through (define a let variable at the top of the function scope and reassign it and then use it further).

Use Case Definition

I am creating a simple API spec, where the route is POST /users . The post body has some user details. If the user exists in the database, its values get updated else a new entry is created in the database.

For the sake of simplicity, I am not using any ORM / database. I am creating a dummy user model and using setTimeout to mock API calls and DB queries. I am also using Math.random() to decide whether to throw an error for the case of error handling.

I will be making these calls first via callbacks, then promises, and lastly using async/await.

Ok time for some code now.

Simple express server

User Model

This user model code is a dummy user object which will make mock API calls. There are two types of calls being made: one with callbacks and the other with promises. Both are effectively doing the same thing. Again Ive hardcoded a lot of stuff here for the sake of simplicity.


The traditional way of doing any sort of non-blocking I/O was with a callback where any I/O call was of the form

someAsyncOperation(dataObject, function(error, success) {
  if (error) {
// handle error
} else {
// do something with success

This works well if you are performing one async operation. If you end up doing multiple async ops with callbacks, you will end up with what is known as the callback pyramid of hell.


  1. Handy for single async operations. Allow easy data and error control.
  2. Should wor...


A definitive guide to conditional logic in JavaScript - Medium

Photo by Chris Ried on Unsplash

I am a front-end engineer and mathematician. I rely on my mathematical training daily in writing code. Its not statistics or calculus that I use but, rather, my thorough understanding of Boolean logic. Often I have turned a complex combination of ampersands, pipes, exclamation marks, and equals signs into something simpler and much more readable. Id like to share this knowledge, so I wrote this article. Its long but I hope it is as beneficial to you as it has been to me. Enjoy!

Truthy & Falsy values in JavaScript

Before studying logical expressions, lets understand whats truthy in JavaScript. Since JavaScript is loosely typed, it coerces values into booleans in logical expressions. if statements, &&, ||, and ternary conditions all coerce values into booleans. Note that this doesnt mean that they always return a boolean from the operation.

There are only six falsy values in JavaScriptfalse, null, undefined, NaN, 0, and ""and everything else is truthy. This means that [] and {} are both truthy, which tend to trip people up.

The logical operators

In formal logic, only a few operators exist: negation, conjunction, disjunction, implication, and bicondition. Each of these has a JavaScript equivalent: !, &&, ||, if (/* condition */) { /* then consequence */}, and ===, respectively. These operators create all other logical statements.

Truth Tables

First, lets look at the truth tables for each of our basic operators. A truth table tells us what the truthiness of an expression is based on the truthiness of its parts. Truth tables are important. If two expressions generate the same truth table, then those expressions are equivalent and can replace one another.

The Negation table is very straightforward. Negation is the only unary logical operator, acting only on a single input. This means that !A || B is not the same as !(A || B). Parentheses act like the grouping notation youd find in mathematics.

For instance, the first row in the Negation truth table (below) should be read like this: if statement A is True, then the expression !A is False.

Negating a simple statement is not difficult. The negation of it is raining is it is not raining, and the negation of JavaScripts primitive true is, of course, false. However, negating complex statements or expressions is not so simple...


Preprocessing for deep learning: from covariance matrix to image whitening - Medium

The goal of this post is to go from the basics of data preprocessing to modern techniques used in deep learning. My point is that we can use code (such as Python/NumPy) to better understand abstract mathematical notions. Thinking by coding! 

We will start with basic but very useful concepts in data science and machine learning/deep learning, like variance and covariance matrices. We will go further to some preprocessing techniques used to feed images into neural networks. We will try to get more concrete insights using code to actually see what each equation is doing.

Preprocessing refers to all the transformations on the raw data before it is fed to the machine learning or deep learning algorithm. For instance, training a convolutional neural network on raw images will probably lead to bad classification performances (Pal & Sudeep, 2016). The preprocessing is also important to speed up training (for instance, centering and scaling techniques, see Lecun et al., 2012; see 4.3).

Here is the syllabus of this tutorial:

1. Background: In the first part, we will get some reminders about variance and covariance. We will see how to generate and plot fake data to get a better understanding of these concepts.

2. Preprocessing: In the second part we will see the basics of some preprocessing techniques that can be applied to any kind of datamean normalization, standardization, and whitening.

3. Whitening images: In the third part, we will use the tools and concepts gained in 1. and 2. to do a special kind of whitening called Zero Component Analysis (ZCA). It can be used to preprocess images for deep learning. This part will be very practical and fun !

Feel free to fork the notebook associated with this post! For instance, check the shapes of the matrices each time you have a doubt.

1. Background

A. Variance and covariance

The variance of a variable describes how much the values are spread. The covariance is a measure that tells the amount of dependency between two variables.

A positive covariance means that the values of the first variable are large when values of the second variables are also large. A negative covariance means the opposite: large values from one variable are associated with small values of the other.

The covariance value depends on the scale of the vari...

Sunday, 16 September


How to make your own Python dev-server with Raspberry Pi - Medium

Image credit.,

In simple terms, Raspberry Pi is a super cheap ($40) Linux based computer. Thats it. Seriously.

It can do whatever you can imagine a normal Linux computer can do, such as browse the web, write code, edit documents, and connect to I/O devices such a thumb drive, mouse, keyboard, etc. This tutorial will be focused on learning how to make your own Python dev-server with Raspberry Pi.

Step 0. Define the goal

Before we begin, it is important to understand what is it that we are trying to build. By the end of the tutorial, you will be able to run a basic website (using Flask) off of a Raspberry Pi on your local home network.

The goal of this tutorial is to demonstrate how a Pi can be used as a dev-server, more specifically, the example will be to host a simple website (using Flask).

Step 1. State the assumptions

Here are some assumptions that this tutorial will make:

  1. You already have a Raspberry Pi set up with Raspbian OS. Here is a useful setup guide if you need one.
  2. The Pi is connected to your home WiFi (and that you know the Pis IP address).
  3. You will not require a screen going forward. assuming points 1 and 2 are complete.

We will use VS Code with the Remote VSCode extension to remotely create and edit files on the Pi. I definitely recommend that you use these two to follow along. Also, these will make working with remote files a lot easier, so thats a plus.

Step 2. Find the Pis IP address

First, connect the Pi to a power supply, and ensure that it is correctly booted up and connected to the WiFi/Ethernet (basically, it needs to have an internet connection).

We will use ssh to connect to and communicate with the Pi. To do that remotely using a laptop, you need to know its IP address. This can be easily obtained using your ISPs admin portal (usually available at Please note that this could be different for different ISPs.)

Usually, you should have your Pi connected to an address which may look similar to Again, this will be different for different people. So please use the IP address that you found for your Pi i...

IndyWatch Education Feed Archiver

Go Back:30 Days | 7 Days | 2 Days | 1 Day

IndyWatch Education Feed Today.

Go Forward:1 Day | 2 Days | 7 Days | 30 Days

IndyWatch Education Feed was generated at Community Resources IndyWatch.

Resource generated at IndyWatch using aliasfeed and rawdog