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.

Friday, 22 December

03:14

5 GitHub tips for new coders freeCodeCamp - Medium

This October I celebrated my 5 year anniversary working at GitHub. 5 years ago, I was an enthusiastic accountant (like straight nerdmy former twitter handle was @taxaly) who knew nothing about code, let alone about using Git and GitHub.

Now Im an enthusiastic Data Scientist who knows a handful of things about coding using Git & GitHub. Its partially thanks to learning these technologies that I made this rewarding career switch.

But even working at GitHub, learning Git and GitHub were hard! As its own form of an open source contribution, I wanted to share with other folks new to coding my top 5 tips for using GitHub.

Tip #1: Change your default text editor associated with Git

For many people, the default text editor when using Git from the terminal is VIM. VIM can be a terrible, scary thing for the new or casual hacker. Or even for veteran hackers or @haacked himself.

If you ever find yourself with a merge conflict (and you will, see tip #4), youll get kicked out to VIM to fix the conflict and then youll need to know the specific VIM commands to edit the doc and want to cry. For more than a year I had a sticky note on my monitor at work as a reminder of the basic VIM commands like i (to edit) and :wq (to save and quit). To avoid the potential tears, you could just change the default text editor.

In order to change your text editor...

01:37

Data science with Python: 8 ways to do linear regression and measure their speed freeCodeCamp - Medium

8 ways to perform simple linear regression and measure their speed using Python

We discuss 8 ways to perform simple linear regression in Python ecosystem. We gloss over their pros and cons, and show their relative computational complexity measure.

For myriad of data scientists, linear regression is the starting point of many statistical modeling and predictive analysis projects. The importance of fitting (accurately and quickly) a linear model to a large data set cannot be overstated. As pointed out in this article, LINEAR term in the linear regression model refers to the coefficients, and not to the degree of the features.

Features (or independent variables) can be of any degree or even transcendental functions like exponential, logarithmic, sinusoidal. Thus, a large body of natural phenomena can be modeled (approximately) using these transformations and linear model even if the functional relationship between the output and features are highly nonlinear.

On the other hand, Python is fast emerging as the de-facto programming language of choice for data scientists. Therefore, it is critical for a data scientist to be aware of all the various methods he/she can quickly fit a linear model to a fairly large data set and asses the relative importance of each feature in the outcome of the process.

However, is there only one way to perform linear regression analysis in Python? In case of multiple available options, how to choose the most effective method?

Because of the wide popularity of the machine learning library scikit-learn, a common approach is often to call the Linear Model class from that library and fit the data. While this can offer additional advantages of applying other pipeline features of machine learning (e.g. data normalization, model coefficient regularization, feeding the linear model to another downstream model), this is often not the fastest or cleanest method when a data analyst needs just a quick and easy way to determine the regression coefficients (and some basic associated statistics).

There are faster and cleaner methods. But all of them may not offer same amount of information or modeling flexibility.

Please read on.

The entire boiler plate code for various linear regression methods...

00:11

Youth Work Cuts, Bits & Pieces and a touch of Christmas Cheer IN DEFENCE OF YOUTH WORK

20170317-_DSC1341

Head done in, as usual, so simply sending seasonal greetings to all our readers and supporters- Ta to Justin Wyllie for photo

Its always difficult to know what and how much to post across the holidays period, particularly the Christmas and New Year festive season. Thus this will be the last post of 2017 and inevitably a mix of gloom and hope, of contradiction and tension. It does contain links to articles/reports and blogs that you might read over a warming drink on a dark winters night in Macclesfield or indeed a cooling beverage on the beach in Mozambique.

CYPN reports that Youth service cuts deeper than predictedSpending on youth services by local authorities last year fell by 42m more than initially predicted, government figures have revealed. Statistics published by the Department for Education show that total expenditure by local authorities on youth services in 2016/17 came to...

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

IndyWatch Education Feed Today.

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

Thursday, 21 December

19:50

How ignoring UX hurts your API and what you can do about it freeCodeCamp - Medium

Photo by Helloquence on Unsplash

Creating experiences that users love is crucial to the success of any product. Companies invest lots of resources trying to make sure they have kickass landing pages and cool page transitions. Yet, these efforts are often in sharp contrast with developers experiences when they try to consume their APIs.

Quick Note: This is about APIs in the context of RESTful services.

Your API is a full-fledged product. It is consumed by developers who are considered to be technically sound, but that doesnt mean they are less-deserving of top notch, premium treatment. Developers are users, too.

The goal of user experience design in industry is to improve customer satisfaction and loyalty through the utility, ease of use, and pleasure provided in the interaction with a product.UX Curve

Youre Losing Money

Long before a developer decides to recommend your product/service to the tech lead or company, you should know that theyve already scoured your API documentation page. Theyve tried calling several endpoints, and have made sure that theyre comfortableand in rare cases, happywith your offering(s).

You lose revenue if anything (docs, response time, and so on) doesnt meet the developers standards. Theyd rather go in search of more desirable alternatives than stick around trying to figure out the correct way to consume your API.

Youre Missing Out On Talent

A study by Glassdoor shows that 61% of their users actively conduct research about a company before deciding to apply for a job there. We can only expect this number to be steeper for professional developers that have a 98% employment rate (3.9% work part-time), according to StackOverflows Developer Survey.

Developers put your company and products under the microscope when considering an opportunity to work with you. For companies that offer publicly accessible APIs, its a portal into the engineering practices in your company (and offers the possibility of discovering major red flags).

Seemingly basic things like using the wrong HTTP methods to perform actions on resources, not versioning endpoints, and poor documentation could be all a developer needs to decide if theyll consider joining your engineering team or move on instead.

Im sure youd agree that losing top talent to the co...

19:28

How to solve the Google recruiters puzzle about throwing eggs from a building freeCodeCamp - Medium

There are a lot of great puzzles for programming job interviews. My favorite one is also known as one of the favorites among Google recruiters:

You work in a 100 floor building and you get 2 identical eggs. You need to figure out the highest floor an egg can be dropped without breaking. Find an algorithm that is minimizing number of throws in the worst-case scenario.

We can make a few assumptions:

  • If an egg doesnt break when dropped from some floor, then it will not break when dropped from any lower floors.
  • An egg that survives a fall can be used again.
  • A broken egg must be discarded.
  • The effect of a fall is the same for all eggs.
  • If an egg breaks when dropped, then it would break if dropped from a higher floor.
  • If an egg survives a fall then it will survive a shorter fall.

Most people writes some algorithms to solve this puzzle (and we will do it too), but there is actually an easy solution.

Simplest answer

The simplest way to obtain the minimal floor is to throw an egg from the first floor, then from the second and so on. This way when egg is finally broken then we will know that this is the floor. This is a reliable algorithm, but in worst-case scenario it would take 100 throws.

The important thing to notice is that it is the only reliable algorithm when you have only one egg. So you need to start using this algorithm when you break the first egg.

Intuitive answer

This way, our first egg should be used to split the 100 floors range into smaller ranges as efficiently as possible. Thus, an intuitive and popular answer is to throw the first egg from 1/n-th of the floors to check. For instance 1/3. Then the algorithm will look like the following:

  • Throw the egg from 33rd floor. If it breaks, then we check the first 32 floors using the second egg.
  • Otherwise, we throw the egg from 33 + (67 * 1/3) = 55th floor. If it breaks, then we check floors 34 to 55 using the second egg.

Worst case scenario for 1/3 is max(33, 24, ) = 33. This way we might find a perfect n that optimizes the number of throws using some dynamic programming. This is a valuable solution that presents programming thinking, but it is not an optimal solution.

Perfect solution

To understand the perfect solution, we need to understand the equilibrium that is used to calculate the number of throws in the worst case scenario:

Where F(n) is the next floor from which we throw the first egg

If we introduce following variable:

then equilibrium is following:

...

17:18

How To Make create-react-app work with a Node Back-end API freeCodeCamp - Medium

How to get create-react-app to work with a Node.js back-end API

Photo by Sebastien Gabriel on Unsplash

This is a very common question among newer React developers, and one question I had when I was starting out with React and Node.js. In this short example I will show you how to make create-react-app work with Node.js and Express Back-end.

create-react-app

Create a project using create-react-app.

create-react-app example-create-react-app-express

Create a /client directory under example-create-react-app-express directory and move all the React boilerplate code created by create-react-app to this new client directory.

cd example-create-react-app-express
mkdir client

The Node Express Server

Create a package.json file inside the root directory (example-create-react-app-express) and copy the following contents:

{
"name": "example-create-react-app-express",
"version": "1.0.0",
"scripts": {
"client": "cd client && yarn start",
"server": "nodemon server.js",
"dev": "concurrently --kill-others-on-fail \"yarn server\" \"yarn client\""
},
"dependencies": {
"express": "^4.16.2"
},
"devDependencies": {
"concurrently": "^3.5.0"
}
}

Notice I am using concurrently to run the React app and Server at the same time. The kill-others-on-fail flag will kill other processes if one exits with a non zero status code.

Install nodemon globally and the server dependencies:

npm i nodemon -g
yarn

Create a server.js file and copy the following contents:

const express = require('express');

const app = express();
const port = process.env.PORT || 5000;

app.get('/api/hello', (req, res) => {
res.send({ express: 'Hello From Express' });
});

app.listen(port, () => console.log(`Listening on port ${port}`));

This is a simple Express server that will run on port 5000 and have a single API GET route /api/hello.

At this point you can run the Express server with the following command (still inside the root directory):

node server.js

Now navigate to http://localhost:5000/api/hello, and you will get the following:

...

06:49

Lets Backtrack And Save Some Queens freeCodeCamp - Medium

https://derickbailey.com/wp-content/uploads/2015/01/recursion1.jpg

Thats a weird looking title, that probably doesnt make sense right now. But trust me, this is a pretty long post and is really fun!

What is Backtracking ?

Backtracking is a standard problem solving technique based on recursion.

A backtracking algorithm tries to build a solution to a computational problem incrementally. Whenever the algorithm needs to decide between multiple alternatives to the next component of the solution, it simply tries all possible options recursively.

Depth First Search (DFS) uses the concept of backtracking at its very core. So, in DFS, we basically try exploring all the paths from the given node recursively until we reach the goal. After we explore a particular branch of a tree in DFS, we can land up in two possible states.

  • We found the goal state in which case we simply exit.
  • Or, we did not find the goal state and we hit a dead end. In this scenario, we backtrack to the last checkpoint and we then try out a different branch.

For detailed introduction to the Depth First Search Algorithm, go through

Deep Dive Through A Graph: DFS Traversal

and for a detailed intro to backtracking and recursion in general, check out the following two articles.

Now that we are all pros in backtracking and recursion, lets see what do Queens have to do with all this.

The Famous N-Queens Problem

Positioning queens on a chess board is a classical problem in mathematics and computer science.

The Queens Puzzle (aka the eight queens puzzle), was originally published in 1848. It involves placing eight queens on an 8x8 chess board, in such a manner that no two queens can attack each other.

The queen happens to be the most powerful piece on the chess board, primarily because of the freedom of movement that it has.

The queen can move in 8 different directions, as illustrated in the image below:

...

06:38

I was just a 15 year old kid dreaming about security research. Then I uncovered my first exploit. freeCodeCamp - Medium

Since I was young, I always had dreams. One was to go to Hack the North (the largest hackathon in Canada), which I achieved this previous September. It surpassed my wildest dreams. My team even won an API prize from eSentire.

Minutes after finding out we won.

But the point of my story isnt that I went to some hackathon and won some prize. The point is that I accomplished something that I thought was completely beyond my abilities.

Do you know that feeling? Yes, I know that there are people out there who can pull that off. But only people with years of experience at [skill].

Well that was me 3 years ago, when I started out programming.

I thought the idea of making a computer do something was pretty cool. It never crossed my mind that one day I would do anything amazing with it.

In fact, I told myself over and over that all the things I was building had already been done before. That the value in this process was just in me me gaining experience from recreating it.

Well, winning a prize at Hack the North broke my self-suppressing chains. Noit ripped them off completely. I was ready to do anything.

Another dream I had, though much smaller: obtaining a GitHub hoodie.

Id always admired GitHub as a company, and thought it would be so badass to wear a hoodie from them.

2 months later, I was a low point, stuck in my work. I remembered this GitHub hoodie dream of mine.

The issue was, I couldnt just buy the hoodie. How could I wear something that implied so much skill while having just used money to purchase it? I hadnt earned it, but I wanted it.

I thought for a couple of ways I could earn it. Maybe a hackathon where GitHub sponsored, like GitHub Game Off. But they all had too many variables.

Then I remembered hearing about their bug bounty program. When I heard about it, though, I dismissed it. I thought, thats far to advanced for me.

Well not anymore. It was time to get to work.

Lets Get Hacking!

I was really pretty clueless poking around their website. After all, this was my first time attempting to hack a website.

I finally landed on GitHubs issue system. I already knew that they parsed your comments with their own markdown parser. And with that, I had found my vector of attack. After 6 hours of work, I found a vulnerability far from serious, but good enough to try submitting.

It was a little scary, as you can only submit 5 bugs as a new user, and then youre toas...

03:49

Understanding the Template Method design pattern by eating at Chipotle freeCodeCamp - Medium

Object-Oriented Design Patterns in Life gain an intuitive understanding of OO design patterns by linking them with real-life examples.

Template Method is a commonly used design pattern in programming and real life.

Before we dive into details of the pattern, lets learn an important life lesson:

Chipotle 101: How to Order at Chipotle.

There are four steps involved:

  1. Choose a vessel: Burrito vs. Bowl vs. Tacos vs. Salad
  2. Add meat: Chicken vs Steak vs. Barbacoa vs. Carnitas vs. Vegetarian
  3. Add toppings: Tomato vs. Corn vs. Green Chili vs. Red Chili
  4. Add extras & drinks: Chips vs. Guacamole vs. Salsa vs. Beer vs. Soda

For example, my go-to order is Bowl + Steak + (Tomato + Corn) + Guacamole and my friend Ambers go-to order is Burrito + Chicken + (Green Chili + Red Chili) + (Chips + Soda).

If we code our go-to orders in Ruby, they will look like:

https://medium.com/media/b2d3cbb045f92efc1c7a4a4f2cfcdff9/href

When we order, we put everything we want into the vessel and return the stuffed vessel.

Unfortunately, Amber and I decided to go on a diet for a while. And we decided that when we ordered from Chipotle, we could only get tomato as a topping and no extras. So our choices are limited to:

  1. Vessel: Burrito vs. Bowl vs. Tacos vs. Salad
  2. Meat: Chicken vs. Steak vs. Barbacoa vs. Carnitas vs. Vegetarian
  3. Toppings: Tomato
  4. No extras & drinks

During the diet, our go-to orders have to be modified to:

  • Sihui: Bowl + Steak + Tomato + No extras & drinks
  • Amber: Burrito + Chicken + Tomato + No extras & drinks

Putting our orders down in Ruby, we have the following:

https://medium.com/media/cac00cf3c892da886f76420ef11f7055/href

Since both our orders have the exact same toppings, extras, and order methods, it makes sense to pull them out as a parent class, DietOrder, and have DietOrderSihui and DietOrderAmber inherit from it.

https://medium.com/media/0c433dd5e2e454cd658c1f10d885cc0f/href

Now our friend Ben wants to join our Chipotle Diet Club, and he likes Tacos with Carnitas. Then his order will be:

...

03:40

Shining a Spotlight on Error Boundaries in React 16 freeCodeCamp - Medium

React 16 has better error handling than previous React versions. If an error occurred inside of a component, it would corrupt Reacts internal state. Then, we would end up with cryptic error messages, or just a blank screen. React lacked a way to expressively and eloquently handle these errors.

That has changed in React 16, thanks to Error Boundaries. The React Docs explain how they work:

Error boundaries are React components that catch JavaScript errors anywhere in their child component tree, log those errors, and display a fallback UI instead of the component tree that crashed.

Ive developed a real-life scenario that can describe how Error Boundaries work:

A Real Life Scenario

Imagine that you are a parent at a swimming pool, and you have one child. The swimming pool represents the app, you represent a Parent component, and your child represents a Child component.

Theres also a lifeguard, who represents an Error Boundary component.

At the pool, your child is jumping off of the diving board, along with their friends, (any third-party like a user, a library, or an HTTP request).

Youre tanning when your child falls off of the diving board and hits her leg.

Without a lifeguard, youd never know what caused your child to fall. Did her friends push her? Was the board slippery? Did she suddenly become unconscious?

Because this is React 16, the lifeguard has been watching everything ensue. After rescuing your child, the lifeguard can tell you exactly what happened. In this case, her friend pushed her off of the diving board.

Now, its easy to tell what actually caused the error. The establishment that owns the swimming pool (the developer), can now easily mitigate future risk by making sure only one person stands on the diving board at a time.

Step 1: Spin up a React application using create-react-app

Well start by spinning up a React application using create-react-app. If you havent done this before, Ive written up a cheatsheet that you can follow. If you need a bit more guidance, you can follow the instructions in Tutorial: How to Make HTTP Requests in React, Part 1.

Once youve set up your application and know that it runs locally, we can get started with the actual coding.

Step 2: Start building out components

Ive removed a lot of the boilerplate c...

03:21

How to Transform Your #100DaysOfCode Log Into a Visual Experience freeCodeCamp - Medium

Photographer: Lauren Mancke

Learning how to code is an unrivaled modern experience. As an aspiring developer, no matter what level youre at, you have a unique and fascinating story to tell based on your personal experiences and creations.

However, lacking the ability to effectively tell your story or generate interest can lead to many missed opportunities. Alexander Kallaways #100DaysOfCode challenge encourages you to code for at least an hour every day for 100 days. The challenge provides a helpful sample log for documenting and sharing your daily progress.

While I truly appreciate the sample log, the story-teller in me wouldnt allow my log to look identical to everyone elses. Plus, I couldnt imagine anyone reading through my 100 text-based entries (besides possibly my mom).

Screenshot of #100DaysOfCode Log Template

As a creator, I wanted to accompany my posts with descriptive images.

I didnt want to simply tell what I worked on. I wanted to show exactly what my projects looked like at different stages.

I strongly believe in making it as easy as possible for potential employers and recruiters to see your work. People are busy and may not make it very far down your list of 100 text-exclusive entries. And even if you arent yet trying to attract potential employers, you will still have a more entertaining and enjoyable experience for friends and other developers to check out.

Tips and Suggestions

Create an Introduction - This can be a short and sweet introduction of who you are and what your log is. This will give your log life right from the beginning as your viewer can connect with you as a human. I also included an image at the top of mine to make it feel more like an article or story.

Example of a #100DaysOfCode Log introduction

Add photos, screenshots, and gifs - The #100DaysofCode logs are very long and wordy. Images for each entry will greatly help with quickly showing what youve worked on.

#100DaysOfCode post with images

Add screenshots of things such as your actual code, a work in progress, a finished site, and even memes to drive home points. To hyperlink screenshots, I uploaded my screenshots to G...

03:17

Building a multi-tenant app is easyif you have an apartment! freeCodeCamp - Medium

These days, more and more startups are appearing on the SaaS market. For their apps, they have several development approaches to choose from. And one of the technical models is the multi-tenancy or multi-tenant app. If youre going to share all your software with your startup customerseither with the ability to have separate data/content and URLs (say, SaaS), or just part of ityou need a multi-tenant app.

This is not the only choice: I should mention other approaches, but lets just mention thema comparison of different approaches could be a good topic for the next article.

Here is my list (ordered by implementation complexity):

  • URL path-based SaaS. Easiest one. Single domain, single DB, etc. Application-level restrictions for data.
  • Multi-tenant SaaS. Medium complexity. Subdomain-based or domain-based. Multiple databases or schemas. Database-level restrictions for data.
  • Virtualization-based SaaS (thanks to Docker and friends!). High level of complexity. Subdomain/domain-based. Multiple apps and DB copies. Virtualization-level restrictions for data.

Multi-tenancy

So what is multi-tenancy? Multi-tenancy is a software development architecture approach in which each client gets their own app configuration and data (strictly or softly isolated from other clients). Each instance is called a tenant.

Over the past few years, Ive worked on several multi-tenant apps (I mostly did multi-tenancy from scratch). And even now, Im working on two multi-tenant apps.

Lets move on from the introduction and theory to the practice, and look at what could be used for multi-tenant apps in the world of Ruby on Rails.

Apartment

This is number one for Ruby on Rails apps. Lets add it to Gemfile:

gem apartment

After bundle install you need to run a generator so youll get some basic configuration templates:

bundle exec rails generate apartment:install

Now you have config/initializers/apartment.rb where you can tweak how you want to use Apartment. The most important things that should be configured are: how apartment will know how to identify your tenants for storing data (well assume its a PostgreSQL database where each PostgreSQL schema is a separate tenant), and how to show data depending on HTTP requests.

Ok, in one app Im developing I have a Website ActiveRecord model with slug field. Therefore, the first setting looks like this, and each website is a tenant:

config.tenant_names = lambda { Website.pluck(:slug) }

Lets say I decided to treat any subdomain as the websites slug. So i...

03:17

A Visual Guide to Understanding the = Sign in JavaScript freeCodeCamp - Medium

The assignment operator, or = sign, is actually very misleading for anyone that is learning to code for the first time.

You are taught about the concept of the equals sign for your entire life in math class.

2 x 3 = 6

x-4 = 0

The things on the left side of the equation are equal in value to the things on the right side of the equation. They could be flipped at any time, and the statement would still be true.

And then JavaScript comes in like the Kool-Aid man and completely destroys this understanding.

Oh, and dont get me started with the concept of variables. In algebra class, we are taught that variables can only be equal to numbers that satisfy the equation. For example,

x-4x+3 = 0

In the equation above, x can only be 1 or 3. But in JavaScript, the concept of a variable is actually quite different than what you learnt in algebra class.

This is a huge issue! It means that every time a newbie looks at an = sign when they are learning about variables, they need to repeat in their head over and over:

Its not what you think it means.

Its not what you think it means.

Its not what you think it means.

I wanted to create a more memorable way to explain variables than re-teaching what an = sign means. By the end of this tutorial, you will understand why the = in variable assignment is more like a ramp that loads up a truck.

This should create a clear guide about the purpose of variables and how to use them throughout your script.

The Name and the Value of a Variable

Variables are containers for carrying values within your script. In some ways, they are the opposite of variables from algebra.

  • You can always give them a new value and restart your script. There is no permanent equality to satisfy some condition.
  • The left side of the statement has a completely different purpose than the right side of the statement.

Here is an example:

let days = 7;

This is called declaring the variable. It creates a new truck called days that can drive around your script and deliver its value OR pick up a new value.

  • The let keyword announces that you are creating a new variable. Or, in the analogy we are about to use, creating a new truck.
  • The variable needs a u...

03:10

I just asked 23,000 developers what they think of JavaScript. Heres what I learned. freeCodeCamp - Medium

I recently published our results for the 2017 edition of the annual State of JavaScript survey, collected from over 23,000 developers.

The results revealed many things, from popularity trends to salary breakdowns. Youll want to take a look for yourself if you havent done so already. But among all these data, here are the 10 things that stood out most to me.

Even if youve already seen the results, you might want to check out the new Features and Opinions sections weve just added.

Insight #1: React is here to stay

This years edition confirmed last years trend: React is currently the dominant front-end library.

React has the most happy users (dark purple bar) by far

Reacts early criticisms (usually centered around the way it mixes HTML and JS) now seem like a distant memory, and Facebook put to rest developers last major hangup this year by getting rid of their licenses patent clause.

With both usage numbers and developer satisfaction at an all-time high, its safe to say React is sitting at the top of the hill, at least for the time being.

Insight #2: Angular is shifting to a new role

This doesnt mean you should count Angular out just yet. While its true it doesnt have the same momentum as React, it does have a few very strong factor going for it.

First, Angular has Googles might behind it. Say what you want, thats some of the best engineers in the industry working full-time to improve the framework.

Its also important to point out that Angular still has a huge user base. Banks, governments, and other large companies cant adopt the latest hotness as fast as your average freelancer, and for that reason they often have large legacy Angular codebases to maintain.

new Angular (2+) vs old Angular (AngularJS): smaller adoption, but much higher developer satisfaction

But the final point is probably the most key: Angular is not trying to fight React head-to-head anymore, instead refocusing itself on the enterprise market. Just look at Angulars adoption of TypeScript: while it may have put off some developers, that decision also brought the kind of reliability and security needed for enterprise apps....

02:49

How I Scraped 7000 Articles From a Newspaper Website Using Node freeCodeCamp - Medium

How I scraped 7,000+ articles from a newspaper website using Node

Credit : http://www.surlmag.fr/stephanie-binet-interview-surl-rap/

Why did I do this?

My girlfriend is writing a paper about the perception of French Hip-Hop music through time. To do that, she would like to text-mine articles from LeMonde.fr, a French mainstream newspaper.

Problem: there have been more than 7,000 articles talking about hip-hop music since the 80s.

My girlfriends reactionMemegenerator.net

Lets code!

For this program I will use:

  • Local NodeJS Script
  • fs: to write a JSON file
  • Request: to make POST and GET requests
  • Cheerio: to load HTML and be able to interact with it
//To install cheerio :
npm i --save cheerio

Be sure you have all of it in your package.json, and everything should be fine :)

What did I want?
In the end, I wanted to have an Excel file organized like this :

My Goal

Therefore, I had to use a JSON structured like this. Ill show you at the end of this article how to convert JSON to Excel.

[
{
date:,
title:,
description:,
text:,
url:,
},
]

First step: get all articles URLs

The first step was quite easy. Thanks to the advanced search feature, I just had to get the URL link of the result page and tell my code how to:

  • Look for the number of results
  • Calculate the number of pages, knowing that there are 30 articles per page
  • Get the title, the description, the date, and the URL of the 30 articles for each page

Here is the code to do so:

https://medium.com/media/5acb9877e60c3ae8baea5be44984d296/href

Once I did that, I had a JSON file with more than 7,000 entries. For each of them, I had:

  • A Date
  • A Title
  • A Description
  • A URL

I was just lacking the content

Okay, I just have to use the same code and run it for the 7000 URLs I have to get the content !

Image Credit...

Wednesday, 20 December

05:23

Fashion As Design: A Conversation with Paola Antonelli Coursera Blog

Paola Antonelli joined The Museum of Modern Art in 1994 and is a Senior Curator in the Department of Architecture & Design, as well as MoMAs founding Director of Research & Development. She teaches the course Fashion as Design, which looks at a selection of more than 70 garments and accessories, ranging from kente cloth to jeans to 3D-printed dresses, and explores their profound impactssocial, cultural, economic, and environmentalon the world. She has taught at the University of California, Los Angeles; the Harvard Graduate School of Design; and the MFA programs of the School of Visual Arts in New York. Read on to discover more about the course and her experience as a curator at MoMA.

What led you to become a curator?

I was studying to receive my Masters degree in Architecture from the Polytechnic of Milan, and while I was studying, I started working as an editorial assistant on various projects. I also worked as a journalist for an architecture and design magazine called Domus and Abitare. There were many different platforms to which I applied my desire to talk about design; it was quite organic. I had never worked at a museum before MoMA, I simply answered an ad in a magazine and got the position. I started in 1994 and was an Associate Curator and then made my way up the ranks until I arrived at the position of Senior Curator. A few years ago, I started the Department of Research and Design, where we explore the idea that museums are community centers for societyplaces where people can test ideas and experiment on new models for living together through art.

What does Fashion as Design mean?

Design is a wide umbrella that encompasses different applications, ranging from furniture, architecture, video games, to typefaces and fashion. Fashion is a form of design. Its very often shown as a moment in history according to a narrative that is based on the creation of an object. In an exhibition of design that has fashion as a topic, its important to focus on the garments: the way they are built, the technology behind them, the social context, and the economic consideration. Not only for the way they look and the style they provide, but also as objects of design production.

What are some challenges in presenting Fashion as Design?

This...

03:12

Let me introduce you to Swift networking with Siesta my new favorite library. freeCodeCamp - Medium

Today Id like to tell you about my new favorite iOS networking library called Siesta. Whats so great about it, and why cant I just use Alamofire? you might ask. Actually, you can use Alamofire with Siesta! Because its a networking abstraction layer above HTTP clients.

But unlike libraries like Moya, this one doesnt hide HTTP from you. This gives you a great middle ground, and thats exactly how I like to consume my REST APIs.

By adopting a resource-centric approach, rather than a request-centric one, Siesta provides an app-wide observable model of a RESTful resources state.

What does this mean? It means avoiding unnecessary network requests and redundant response deserialization. It decouples view controllers from network request lifecycles. It provides transparent response parsing out of the box. And much more.

In this tutorial, Id like to show you how to get started with this awesomeness and make your networking great again, swiftly 

Setup

Install it from Cocoapods:

pod 'Siesta', '~> 1.0'

For the purposes of this tutorial, I built a simple CRUD app with a REST API and JWT-based authentication which I deployed to Heroku.

To get started, create a separate class for your API. Lets call it AwesomeAPI.swift

Lets define a basic API configuration here:

https://medium.com/media/b9ee33773b319372b8a01b202c6d2561/href

Here we define a global singleton for our API. We configure the service with the URL for our API and standardTransformers which are default parsers for text and image responses. We also enable logging in debug mode, which is very useful for debugging requests against your API. Finally, we define our first resource accessor, a public method of our API class returning a resource which we are now going to use in our view controller.

To fetch the data from our newly defined resource we need to create a resource observer in our view controller:

https://medium.com/media/250e86b3e7bd940de32844256a9743ef/href

Here we add a resource observer to our ping resource, and define a delegate method which is called when the resources state is changed. A state could change when an observer is added or when it has some new data, for example....

02:42

How we used CircleCI 2.0 to build and deploy an Angular app to AWS S3 freeCodeCamp - Medium

Photo by Drew Beamer on Unsplash

In todays world, continuous integration and deployment (CI & CD) is a very common practice and an important part in any application life cycle. If you want to avoid spending valuable time on tasks that you can actually automate, keep on reading.

In this tutorial, Im going to walk you through the steps we have followed to integrate a CI & CD pipeline in the development process of one of our Angular apps using CircleCI 2.0 and AWS S3.

Requirements

Before you start this tutorial, I assume you have the following:

  • A CircleCI account
  • An AWS account with rights to create new users
  • An AWS S3 Bucket
  • A Bitbucket or Github repository with your project
  • A cup of coffeeyou know keeps you warm and focused :)

Setting up CircleCI

Lets get to work. For setting up CircleCI, you need to create a new folder in your project root called .circleci (notice the dot) and add a config.yml file to it. Leave it empty for a second.

Go to the CircleCI interface and add your project by going to Projects tab > Add Project . CircleCI should have already found all your public repos. Select your project and press the Setup project button.

Select the options that fit you best (Linux/Platform 2.0/Node in our case), copy the sample config generated down on the page into your own config file, and push the changes to your repo. Now you can press the Start building button.

You can find a gist with the final configuration here.

Understanding the CircleCI configuration file

The bread and butter of this tutorial is to understand how to make use of the CircleCI config file. It has 3 main components: a version, a list of jobs, and a list of workflows.

Then we have the list of jobs. You can think of a job like an independent environment for running a list of commands or steps. Common things that you can achieve within a job include:

  • Installing the tools you need to run/build/test your project
  • Executing bash commands
  • Storing or restoring items from the CircleCI cache

Then we have the list of workflows. A workflow is a way to manage your jobs. Lets say you need a job to run only on specific branches or at specific times, or you want some of the jobs to run in parallel and some in sequence....

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