teleren/devto huggingface dataset:
Moving from apollo-boost to GraphQL subscriptions with apollo-client
Tags: tutorial, apollo, graphql, webdev
Published: 2019-12-24 11:31:24

---
title: Moving from apollo-boost to GraphQL subscriptions with apollo-client
published: true
date: 2018-07-25 00:00:00 UTC
tags: tutorial, apollo, graphql, webdev
canonical_url: https://blog.hasura.io/moving-from-apollo-boost-to-graphql-subscriptions-with-apollo-client-cc0373e0adb0/
---

This is a simple tutorial on how to use GraphQL subscriptions with Apollo.

![](https://blog.hasura.io/content/images/downloaded_images/moving-from-apollo-boost-to-graphql-subscriptions-with-apollo-client-cc0373e0adb0/1-t6XspdUqzOTkL-2dEr8y-A.png)

Let’s say you have the basic apollo-client working as per [https://www.apollographql.com/docs/react/essentials/get-started.html](https://www.apollographql.com/docs/react/essentials/get-started.html) and now you want to enable subscriptions.

* * *

This is what you probably have:

```
import { ApolloProvider } from "react-apollo";
import ApolloClient from "apollo-boost";

const client = new ApolloClient({
  uri: "https://w5xlvm3vzz.lp.gql.zone/graphql"
});
ReactDOM.render(
  (<ApolloProvider client={client}>
   <App />
  </ApolloProvider>),
  document.getElementById('root'));
```

Now, to move to subscriptions, this is what you need to change your apollo-client setup to:

```
import { ApolloProvider } from "react-apollo";
// Remove the apollo-boost import and change to this:
import ApolloClient from "apollo-client";
// Setup the network "links"
import { WebSocketLink } from 'apollo-link-ws';
import { HttpLink } from 'apollo-link-http';
import { split } from 'apollo-link';
import { getMainDefinition } from 'apollo-utilities';
import { InMemoryCache } from 'apollo-cache-inmemory';
const wsurl = wss://hasura-demo.herokuapp.com/v1alpha1/graphql;
const httpurl = https://hasura-demo.herokuapp.com/v1alpha1/graphql;

const wsLink = new WebSocketLink({
  uri: wsurl,
  options: {
    reconnect: true
  }
});
const httpLink = new HttpLink({
  uri: httpurl,
});

const link = split(
  // split based on operation type
  ({ query }) => {
    const { kind, operation } = getMainDefinition(query);
    return kind === 'OperationDefinition' && operation === 'subscription';
  },
  wsLink,
  httpLink,
)

const client = new ApolloClient({
  link,
  cache: new InMemoryCache()
});
// Use the client just as before
ReactDOM.render(
  (<ApolloProvider client={client}>
   <App />
  </ApolloProvider>),
  document.getElementById('root'));
```

This reads as:

1. Create a `wsLink`
2. Create an `httpLink`
3. Create a new apollo-link which delegates all GraphQL queries to `httpLink` unless they are `subscription` queries
4. Create a `ApolloClient` which uses the link object we created above
5. Enable `InMemoryCache` because that’s what we had with `apollo-boost`

These are the packages you need to install:

```
npm install --save apollo-client apollo-link-ws apollo-link-http apollo-link apollo-utilities apollo-cache-inmemory
```

And that’s it. You’re ready to start using Subscriptions!
Use GraphQL subscriptions from your NodeJS code
Tags: node, graphql, webdev, javascript
Published: 2019-12-22 06:00:51

---
title: Use GraphQL subscriptions from your NodeJS code
published: true
date: 2018-07-25 00:00:00 UTC
tags: nodejs, graphql, webdev, javascript
canonical_url: https://blog.hasura.io/use-graphql-subscriptions-from-your-nodejs-code-988132c542d9/
---

Setting up your NodeJS code to use GraphQL subscriptions involves going through a few hoops.

Using GraphQL subscriptions from your NodeJS code is especially useful if you want to react to events or changes on a GraphQL backend

We’ve setup a simple boilerplate to help you get GraphQL subscriptions setup at: [https://github.com/hasura/nodejs-graphql-subscriptions-boilerplate](https://github.com/hasura/nodejs-graphql-subscriptions-boilerplate).

![](https://blog.hasura.io/content/images/downloaded_images/use-graphql-subscriptions-from-your-nodejs-code-988132c542d9/1-JokDua7r6Bof0G8A9DBSfw.gif)
On KISSing
Tags: career, programming, productivity
Published: 2018-07-24 23:15:45

---
title: On KISSing
published: true
description: 
tags: career, programming, productivity
---

Usually I consider myself good at learning from my mistakes, but one particular mistake has taken me a long time to learn. What is the mistake?  **That adding a little complexity will result in a better and more maintainable system.**

The complexity usually comes in very innocently; a little library, a custom select UI, an ORM.  Or it can come in less innocently; a build tool (rip Grunt).  When I first add it, I feel great about it.  It solved my problem and made me feel like my co-workers should applaud the elegant thing I did.  And time passes with it doing its job (hopefully well).

Slowly the landscape changes, more depends on the little spot of complexity I added, then one day some clouds roll in.  A feature is needed or a bug is found, and it comes time to do the dreaded deed, maintain my old code.  

This is when I **always** regret my silly added complexity.  

Remembering why you made decisions is hard.  Figuring out why someone else did it that way is even worse.  If I have learned one thing in my career, it is to plan on things changing; team members will come and go, as will technologies.  Just about the only thing you can do to help reduce the impact of these changes is to Keep It Simply Silly.
Sending a GET Request to GitHub API asking for a list of commit messages in a Pull Request
Published: 2018-07-24 23:12:53

---
title: Sending a GET Request to GitHub API asking for a list of commit messages in a Pull Request
published: true
description: 
tags: 
---
I want my Python Flask server to send a GET Request to the GitHub REST API V3, asking for all commits messages in a Pull Request, and perhaps receive it as a single payload.

Any suggestions on how I can approach this issue?
What Do I Know?
Tags: career, life
Published: 2018-07-24 21:42:03

---
title: What Do I Know?
published: true
description: 
tags: career, life
canonical_url: https://tj.ie/what-do-i-know
---

A couple of years back, I began to let the waves of new tech wash over me, knowing the tide would go back out again. I started to relax a bit more, and accept that the stuff I knew was enough for what I needed. "What's the rush?" For that, I count myself lucky. 

That's not to say I stopped learning new things -- far from it -- but I came to accept that I'll never know everything. I started with HTML, CSS, and JavaScript over 10 years ago, and I'm still using them today. I'll probably be using them for the next 10, too. All the while I'm tacking on new bits of experience and knowledge. Slowly but surely.

I found my work journal from a previous job, and it kinda shocked me the number of things I was doing on a given day. I never really stopped to assess what it would all lead towards, or how I could eventually spend that experience to sell my skills. For example, on one day I was working on 3 different projects, troubleshooting with clients, reviewing code, attending meetings, and writing a spec for an upcoming job. That's a lot of stuff I would cast off as "just work", before spending my nights tangled in envy at all the cool stuff people were building in the open-source world. I was envious because I filled all my social feeds with such amazing people, and I compared myself to them. 

I'm not an internet-famous developer. I'm not a Vue or React expert. I haven't created a library that's used by thousands of developers.

But I know stuff. 

If I hadn't kept a log of my days, I don't think I would have realised how much I've been exposed to and developed from. I can't underestimate the value of writing stuff down with pen and paper. I don't need to charge it, I don't need to be connected to the internet. All I need is a few quiet minutes to reflect on my journey thus far. I can build a piece of software, and not understand every software engineering principle, but I'll learn some more of them eventually with practice. Just because I can't put an exact name to all the stuff I know, doesn't mean I don't know it, if that makes sense. Know what I mean?
Welcome Thread - v14
Tags: welcome
Published: 2018-07-24 20:29:38

---
title: Welcome Thread - v14
published: true
description: Introduce yourself to the community!
tags: welcome
---

Hey there! Welcome to dev.to!

![WELCOME TO THE INTERNET](https://media2.giphy.com/media/mW05nwEyXLP0Y/giphy.gif)

# Welcome!
1. Leave a comment below to introduce yourself! You can talk about what brought you here, what you're learning, or just a fun fact about yourself.

2. Reply to someone's comment, either with a question or just a hello. 👋

3. Or answer this question: what's your favorite non-coding hobby?
Exploding Rails Giveaway
Tags: rails
Published: 2018-07-24 16:55:19

---
title: Exploding Rails Giveaway
published: true
description: SmoothTerminal is giving away three copies of Exploding Rails by Ryan Bigg.
tags: rails 
---

Want to learn how to build Rails apps with rom-rb and dry-rb? Smooth Terminal is giving away three copies of _Exploding Rails_ from Ryan Bigg!

https://contests.smoothterminal.com/?ks_giveaway=exploding-rails
Securing an OpenShift Container Image CI/CD Pipeline with Anchore
Tags: anchore, containers, openshift, jenkins
Published: 2018-07-24 16:47:13

---
title: Securing an OpenShift Container Image CI/CD Pipeline with Anchore
published: true
description: A new blog series about securing container images with Anchore
tags: anchore, containers, openshift, jenkins
cover_image: https://thepracticaldev.s3.amazonaws.com/i/c4y73wogb7ty2bfcc7yq.png
---

A new blog series about container security using [OpenShift](https://openshift.com), [JenkinsCI](https://jenkins.io) and [Anchore](https://anchore.com) is now live. It extends upon a previous post where I set up an OpenShift/Jenkins integrated build pipeline, adding image scanning:

https://blog.osninja.io/container-security-with-anchore-part-one/
How do you sell refactoring to your team?
Tags: discuss, refactoring
Published: 2018-07-24 16:37:28

---
title: How do you sell refactoring to your team?
published: true
description: Refactoring is a great thing to do, but oftentimes you need to sell it first. How do you do it?
tags: discuss, refactoring
---

Refactoring is often a great thing to do. If you maintain a piece of software for years, chances are you'll refactor somewhat regularly.

Even though refactoring is a good practice, your team might have plenty of valid reasons why it doesn't want to refactor something. How do you sell them on the idea?
Practice Go: Warriors
Tags: go, challenge
Published: 2018-07-24 16:14:36

---
title: Practice Go: Warriors
published: true
description: Go Warriors
tags: go, challenge
---
[Create a Pull Request for this exercise](https://github.com/plutov/practice-go/tree/master/warriors)

BitVille and ByteVille are 2 warring tribes. BitVille has a spy telescope called the Hobble Scope, to count the number of Byte Warriors in ByteVille. The Hobble Scope, however, has a problem. Its primary lens is contaminated with bugs which block part of each image. The Hobble Scope's flawed images are stored by pixels in a file.

Each image is square and each pixel or cell contains either a 0 or a 1. At each pixel location, 1 is recorded if part or all of a Byte Warrior is present and a 0 if any other object, including a bug, is visible. 1. A Byte warrior is represented by at least a single binary 1. 2. Cells with adjacent sides on the same row and/or column or Cells which are diagonally adjacent - which contain binary ones, comprise one Byte Warrior. A very large image of one Byte Warrior might contain all ones. 3. Distinct Byte Warriors do not touch one another. 4. There is no wrap-around. Pixels on the bottom are not adjacent to the top and the left is not adjacent to the right (unless, of course, there are only 2 rows or 2 columns).

Output:

The output should be a single number specifying the number of unique Byte Warriors in the image.

### Example

Input:

```
100100
001010
000000
110000
111000
010100
```

Output: 3

Why?

There is 1 warrior on top left most corner (just 1 pixel), 2nd warrior on the top right (3 "1" pixels), 3rd warrior on the left bottom corner (7 "1" pixels).

### Run tests with benchmarks

```
go test -bench .
```

### Have fun!
A Look at Android ML Kit - the Machine Learning SDK
Tags: android, machinelearning, firebase, mlkit
Published: 2018-07-24 15:53:38

---
title: A Look at Android ML Kit - the Machine Learning SDK
published: true
description: Learn about the different APIs available in Google's ML Kit (mobile machine learning SDK). You will also learn how to create an application that uses one of its APIs.
tags: #android #machinelearning #firebase #mlkit
canonical_url: https://auth0.com/blog/a-look-at-android-ml-kit-the-machine-learning-sdk/
---

In today's fast-moving, information-rich world, it is becoming more necessary to build applications that are intelligent in the way they process the data they are fed. Artificial Intelligence is quickly becoming an essential tool in software development. 

In this article, we will look at the ML Kit mobile SDK that brings all the Google’s expertise on machine learning techniques to mobile developers in an easy-to-use package. We will look at the various APIs offered by the SDK, and then we will take one of the APIs on a test drive by creating an Android application that makes use of it. 

[Read on 🤖📱](https://auth0.com/blog/a-look-at-android-ml-kit-the-machine-learning-sdk/?utm_source=dev&utm_medium=sc&utm_campaign=android_ml_kit)

![A Look at Android ML Kit - the Machine Learning SDK](https://thepracticaldev.s3.amazonaws.com/i/rfgxc2b56fwrr3agpszo.png)
How to systematically determine requirements?
Tags: discuss, requirements
Published: 2018-07-24 15:37:05

---
title: How to systematically determine requirements?
published: true
description: 
tags: discuss, requirements
---

My team has a serious problem with forgetting seemingly obvious requirements. The 1-2 weeks before a release are full of "oh wait, we forgot about _x_. But it's an easy change, no big deal." Simple omissions are bound to happen, but by the time we release, the list of omissions we caught is usually bigger than the list of initial requirements.

**What's a good starting point for systematically determining requirements for new features _up front_**?

Questions to consider:
- are there any checklists you use?
- are there any particular areas where more requirements are forgotten than others? (ex. security, UI layout, etc.)
- any useful / widely accepted books addressing this subject?
- have you been on a team that successfully addressed this problem; if so, how did you fix it?
What are the great function/method/etc. names in popular libs/languages?
Tags: discuss
Published: 2018-07-24 14:23:44

---
title: What are the great function/method/etc. names in popular libs/languages?
published: true
description: 
tags: discuss
---

Naming things is hard, but what are the ones that have stood out to you as great choices that have stood the test of time?
The Incredible Evolution of Automated Testing
Tags: testing, automation, devops, selenium
Published: 2018-07-24 14:15:34

---
title: The Incredible Evolution of Automated Testing
published: true
description: The Incredible Evolution of Automated Testing. From 2013 to 2018. 
tags: testing, automation, devops, selenium
---

Let's take a trip back in time, all the way to 2013. 

Here are some of the headlines from that year:
• Apple announces the iPhone 5s.
• Oscar Pistorius is charged with murder.
• The Boston Marathon bombings.
• Sir Alex Ferguson retires as Manchester United manager.
• Edward Snowden reveals himself as the source of the NSA leaks.
• Microsoft announces the Xbox One.
• **Automated testing is difficult and painful.**

wait, what?

![automated testing girl](https://images.pexels.com/photos/1036620/pexels-photo-1036620.jpeg?auto=compress&cs=tinysrgb&dpr=2&h=750&w=1260)

If you wanted to set up some scripts to test your web application, that task would have easily taken up 3-4 months of your time.


You had to break it down in the following components:
• Develop your own automated testing framework with Selenium 
• Write the tests for your web application
• Stabilize the tests
• Configure a number of VMs where you can run your tests
• Integrate your tests into your CI/CD system 
• Configure a schedule for your tests to run on a daily basis
• Help your colleagues understand the framework that you built

And all of that was probably done by a tester, not a developer.

Can you imagine the chaos? 

And nothing can compare to the pain of using Selenium, you had to tell it to wait before interacting with each element.  

Don't even get me started on automated tests for mobile apps, that was a complete train wreck back then.

Do you remember running your own Appium server? It was so frustrating and slow.

Thankfully, all of that has changed. We now have platforms such as [Endtest](https://endtest.io).

![software testing tools](https://i.imgur.com/C4tavcC.png)


Here's what I could find about them, after doing some extensive research:

![software testing tools comparison](https://i.imgur.com/W9bQPtk.png)

What used to take us 3-4 months to implement can now be done in 2-3 days.

We don't even have to code. All we have to know is how the extract the element locators from the browser console or from the page source. That's it. 

And we get things that we didn't even dare to dream about back then, such as video recordings of our test runs.

Back in 2013, you needed mad developer skills in order to build such tests. 

In today's world, even your good ol' granddad can pull it off.

![automated testing grandpa](https://images.pexels.com/photos/1254690/pexels-photo-1254690.jpeg?auto=compress&cs=tinysrgb&dpr=2&h=750&w=1260)
How to Build 2 Factor Auth for Home Wi-Fi?
Tags: discuss, opensource, security
Published: 2018-07-24 11:51:27

---
title: How to Build 2 Factor Auth for Home Wi-Fi?
published: true
cover_image: https://www.securew2.com/wp-content/uploads/2018/11/MFA-Network-Security.png
description: Survey to inquire if 2 Factor Auth is possible for Home Wi-Fi?
tags: discuss,opensource,security
---

Since we use the Internet 24x7x365 nowadays, it occurred to me very few of us are keen to invest time in our ubiquitous router's security or tweaking it to be more optimum. This stems from the fact that most of current OEMs often provide cryptic features that we setup once & forget when it's required again.

From what I've found out, firmware like [DD-WRT](https://dd-wrt.com/), [OpenWRT](https://openwrt.org/), [VyOS](https://vyos.io/), [Tomato](http://www.polarcloud.com/tomato), [PfSense](https://www.pfsense.org/) do exist to bridge that gap but they have a very steep learning curve which places too much dependency on the person who masters it.

I also recently discovered that all home/enterprise Wi-Fi devices are potentially susceptible to being broken due to the WPA2 [vulnerability](https://www.krackattacks.com/) so I'm looking to implement 2 Factor Authentication & below are my requirements:

## Hardware:
A regular router with RJ-45 WAN input 4 RJ-45 LAN ports and Wi-Fi `802.11 b/g/n/ac` capabilities within a decent budget within **$100**.


## Software:
1. Linux OS having a web-UI / CLI to view traffic statistics, track & manage users, logging, bandwidth tracking / throttling.
2. Ability to add customized plugins in (*Python, Go, Ruby or Shell*).
3. Easy to understand documentation in case of problems.
4. Any external application (_again open source_) for 2-Factor Authentication via SMS.


## Process Flow for 2 Factor Authentication:
1. People use their smartphones or other mobile devices to pair up with my Wi-Fi and enter the password (*standard method, no RADIUS or Active Directory involved here*)
2. They see a Splash page to input their mobile number (*like the public Wi-Fi hotspots, e.g: Google RailWire Wi-Fi in India*)
3. Then they enter their mobile number that my router will store along with possibly the **MAC ID** & few key details of the mobile device.
4. My router will now send an **OTP** via **SMS** to the number provided above.
5. People use the **OTP** to connect to my Wi-Fi post which router authenticates to gives them access.
6. Router then tracks usage of that **MAC ID** as long connection persists.
7. If connection breaks, user has to re-authenticate using step 2 → step 5

---

#### Could anyone please share any information about a system that allows to implement all of the above?
Magento 2 Contact Form Extension    
Tags: magento2contactform
Published: 2018-07-24 10:33:00

---
title: Magento 2 Contact Form Extension    
published: true
description: 
tags: Magento 2 contact form
---

Magento 2 contact form extension by FME, as the name suggests, adds a contact us form to your Magento 2 store. It adds a dedicated & fully responsive contact us page which allows users to interact with you in case of any question/help. It also adds a quick contact us popup which you can enable/disable to let customers contact you without visiting the contact us page. You can customize the fields in the form to collect all required information from your customers. 

[Magento 2 contact form](https://www.fmeextensions.com/advance-contact-us-form-popup-magento-2.html) extension allows you to effectively manage user submissions. You can see the list of all queries with other details in the admin panel and mark them as replied or not replied. It also offers SEO configuration settings to rank your contact us page in search results. For example, you can give a custom page link, page title & description.

###Key Features of Magento 2 Contact Form Extension

- Add & customize a contact us page
- Enable/Disable quick contact popup
- Add custom form fields
- Add Google Map & recaptcha
- Manage user submissions
- SEO settings
- Email configuration settings
KittyCoin Reboot?
Published: 2018-07-24 07:02:56

---
title: KittyCoin Reboot?
published: true
description: Can abandoned Coins be rebooted and made better?
tags: 
---

I bought a masternode in a coin called KittyCoin, for $26...the next week the Devs and other staff, that had dumped almost all the coins, disappeared and ran off to Siberia, or the Maldives, or the Carribean, or whatever....

They shut down the Discord, Telegram, Website, Twitter and so on. In other words completely erasing the coin from the net as best they could.

So, I started thinking, that thousands of folks with useless coins and Masternodes, and a completely abandoned coin with Masternodes working perfectly, and giving coins and so on...

Could it be rebooted? I asked Masternodes.online if they would hold off de-listing, and the exchange if they would hold off and both agreed.

But they said we would need a new ANN on the forum, a Telegram and Discord and Twitter, and a rebuilt website.

So I put up a twitter (https://twitter.com/Coin3Kitty) and bought the domain kittycoin.xyz and Joined Discord and opened a server that is KittyCoin Rebooted, and now I'm hoping someone with experience in Developing would look over the wallet, and maybe work on making a basic webpage, and maybe finding someone who is good at promoting, and help me reboot this coin...I bet if we could get the users together who own a bunch, they'd be willing to contribute, and if we could even get the coin to a dime you could make some decent money, especially since this sucker requires 20k for a 
So, am crazy? Or CAN this be done? And is there a way to help folks, make it live again, AND make some bank?