teleren/devto huggingface dataset:
YDKJS — Scopes and Closures — Part2
Tags: javascript, tutorial, webdev, beginners
Published: 2019-08-13 15:57:04

Welcome to the Part2 of YDKJS series. As told in part1 this series is based on my learnings from legendary book series You don’t know JS by Kyle Simpson and Javascript series by Kaushik Kothagul from Javabrains.

Before understanding scope in details we have to understand two concept. Every operation in JS is either **Read operation** or **Write Operation**.

Consider the below statement -
> **var a = 10;**

Now this is a **write operation** because we write 10 to variable a.

Now, consider the below statement.
> **console.log(a);**

This is a **read operation** because we read the value of variable a.

Let consider another example.
> **var a =10;
var b;
b=a;**

Now in this the line **b=a** is interesting, because for **a** it’s a **read operation** and for **b** it’s a **write operation**.

Let consider another example to make the concept even more clear.

![read write example](https://cdn-images-1.medium.com/max/2000/1*8yASTrrEqtBGzSxMh0rzKQ.png)*read write example*

Now at line 4, there is a **write operation** because when *greet(“Nabendu”)* is called from line 8, we have **function greet(name=”Nabendu”)** here. So, assigning name variable the value “Nabendu”.
And at line 5 the usual read operation as we are reading the value of a.

Let’s move to one more important concept related to read and write operations.
> **If we use a variable without declaring it. It is ok to do a write operation, but not ok to do a read operation.**

Let’s see example to be more clear.

![read operation](https://cdn-images-1.medium.com/max/2000/1*kCB2_JSF7HIU7LkaeTTplA.png)*read operation*

*In the above we tried to do a read operation on a variable foo, without even declaring it and the compiler throws an error.*

Now consider below.

![write opertion](https://cdn-images-1.medium.com/max/2000/1*obZP4yRXpeaJOcLS6g32dg.png)*write opertion*

*We do a write operation in line 1 ie foo=10. Here also we are not declaring foo. Now this is perfectly right and the compiler doesn’t throws an error.*

Window object is the object in which all global variables are created as properties.

Let’s define these below two variables in firefox scratchpad and then do reload and run.

![firefox scratchpad](https://cdn-images-1.medium.com/max/2000/1*9ym49IdPdDPHTwVQ-RGssQ.png)*firefox scratchpad*

In the firefox console write window and we can see the Window object containing these two variables.

![Window object](https://cdn-images-1.medium.com/max/2406/1*7qiCr3aKFTMx5ksA_tMvGA.png)*Window object*

Also, can access these two variables as window object’s properties.

![window object properties](https://cdn-images-1.medium.com/max/2076/1*OM_kylDGOK4OS5XuuWIqzg.png)*window object properties*
Security in open source projects
Tags: security, opensource
Published: 2019-08-14 02:23:38

---
title: Security in open source projects
published: true
description: In recent years, the amount of open source components used by developers has experienced significant growth. Millions of open source libraries are distributed through centralized systems such as Maven Central (Java), NPM (JavaScript) and GitHub (Go).
tags: security,open source
---
In recent years, the amount of open source components used by developers has experienced significant growth. Millions of open source libraries are distributed through centralized systems such as Maven Central (Java), NPM (JavaScript) and GitHub (Go).
tags: security,open source

In this talk, I will present the common security problems faced by companies that use open source. We will also talk about how to manage the risks of open source software using people, processes and tools

![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/ezzcepawluacalkmxj6g.png)

[Slides]
https://www.slideshare.net/jmoc25/security-in-open-source-projects

[Video]
https://media.ccc.de/v/froscon2019-2361-security_in_open_source_projects
JavaScript Array Splice Issue
Tags: javascript, array, splice, webdev
Published: 2019-08-15 14:23:04

---
title: JavaScript Array Splice Issue
published: true
description: This is an issue that cropped up for me today: I was splicing a name out of an array and was getting the wrong result back. The issue was a simple one with a quick fix that took me several hours to track down what was going on.
tags: JavaScript, Array, Splice, WebDev
series: JavaScript Issues
cover_image: https://thepracticaldev.s3.amazonaws.com/i/3vn8ke839ubkd7t7d79q.png
---

This is an issue that cropped up for me today: I was splicing a name out of an array and was getting the wrong result back. The issue was a simple one with a quick fix that took me ***several hours to track down*** what was going on.

Now that I've seen the answer, it's obvious ... at the time I was seeing the issue, it was frustrating to say the least.

Finding a good way to query the issue (couldn't come up with good search terms) led me to creating this article.

I wrote the following code ...

```javascript
triggerDelete: async (name) => {
  let stored = ['one', 'two', 'three', 'four', 'five'];
  stored = stored.splice(stored.indexOf(name), 1);
  return stored;
}
```

I've simplified it some. The issue was simple, when I passed in **'two'** the array returned was ...

```javascript
triggerDelete('two');

/*
 * returns ['two'], not ['one', 'three', 'four', 'five']
 */
```

I expected **['one', 'three', 'four', 'five']** to be the array returned.

... after two hours of searching and finally asking for a second pair of eyes, the solution was ...

```javascript
triggerDelete: async (name) => {
  let stored = ['one', 'two', 'three', 'four', 'five'];
  stored.splice(stored.indexOf(name), 1);
  return stored;
}
```

Quite simply, the issue was that I was not changing the array, I was assigning the result of the **splice** back into the **stored** variable; hence, **['two']** ...

Hopefully this article will save someone else some of the pain I felt down the road!
Replacing MouseEvents with PointerEvents
Tags: eventhandler, mouseevent, pointerevents, ui
Published: 2019-08-16 05:38:00

---
title: Replacing MouseEvents with PointerEvents
published: true
tags: eventhandler, mouseevent, pointerevents, ui
canonical_url: https://stephencharlesweiss.com//2019-08-14/input-events-with-pointers/
---

How can the necessity of handling different types of inputs (e.g., mouse, touch, and pen) by duplicating event handler logic? The Pointer Event makes a compelling case that it’s a solid solution.

[![pointer](https://stephencharlesweiss.com/static/7aac3619127b537520b5240c5349b4eb/b100d/pointer.png)](/static/7aac3619127b537520b5240c5349b4eb/b100d/pointer.png)_Figure1A pointer is a hardware agnostic representation of input devices that can target a specific coordinate (or set of coordinates) on a screen._ <sup>1</sup>

> Pointer Events provide all the usual properties present in Mouse Events (client coordinates, target element, button states, etc.) in addition to new properties for other forms of input: pressure, contact geometry, tilt, etc. <sup>2</sup>

While Pointer Events are not yet supported by all browsers, there is wide adoption among major modern browsers (Safari being the major exception, though support is coming in v13).<sup>3</sup>

[![can i use pointer events](https://stephencharlesweiss.com/static/d5a8fc72a4b6eb9dda8ce0e7f269111d/b9e4f/can-i-use-pointer-events.png)](/static/d5a8fc72a4b6eb9dda8ce0e7f269111d/1589a/can-i-use-pointer-events.png)

This is a boon as pointer events will make the act of dealing with different input events much simpler.

# <svg aria-hidden="true" focusable="false" height="16" version="1.1" viewbox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg>Resources:

- <sup>1</sup> [Pointer Events | W3](https://www.w3.org/TR/pointerevents/)
- <sup>2</sup> [_ibid._](https://www.w3.org/TR/pointerevents/)
- <sup>3</sup> [Pointer Events | Can I use…](https://caniuse.com/#search=pointerdown)
WhatsApp It! – My first useful app
Published: 2023-05-25 07:26:52

---
title: WhatsApp It! – My first useful app
published: true
date: 2018-10-31 09:11:12 UTC
tags: 
canonical_url: https://blog.afrieirham.com/whatsapp-it-my-first-useful-app
---

# Who is this apps for?

Anyone who always in need to contact other people through WhatsApp but have no interest in saving their contact details. All you need to do is just type in the number and it will direct you to WhatsApp.

It is essentially a click to chat feature. Try it [here](https://whatsappit.afrieirham.com).

# The inspiration

When I was in charge of taking t-shirt orders for my colleges event which is the Software Engineering Day recently, I find out that it is unnecessary to save the customers phone number just to tell them about the payment.

I am a person who dont like to keep my contact list full with unknown people or someone who I have contacted once. Thus, this app is made. :)

# Click to Chat feature

I first found out about this feature when I was trying to shop online on Instagram. Most sellers provide a link on their bio for us to click and then it opens up WhatsApp with their number. Sometimes they even pre-filled it with some generic text, which I find really handy.

# How it works

The logic behind it is pretty simple.

First, I save the input from the user in a Variable. Then I append it to the Click to Chat [Custom URL from WhatsApp](https://faq.whatsapp.com/general/chats/how-to-use-click-to-chat) and save it in another Variable. When the user click the WhatsApp It! button, it will open up that link in a new tag.

For example, user type in 012324xxxx, the number will then append to the link Variable, creating `https://wa.me/012324xxxx`. Finally, the user will be directed to that link when they click on WhatsApp It!

# What are the tools that I use?

I use Bootstrap for the front-end and JavaScript for the logic. I also use GitHub to host it with GitHub page.

# New features that I have in mind

I am currently trying to add more country code into it so that you can use it to WhatsApp anyone, as long as they have WhatsApp account.

I have read some reviews about a similar app on Google PlayStores that gave me some ideas on other features that might be helpful. My friends and family also give me some feedback which helps a lot.

Thank you for reading, appreciate it!
Recovery and USB Boot
Tags: beginners, tutorial
Published: 2019-08-16 08:39:51

Now we are going to clean install MacOS, therefore we need the image from Apple and then we will create a USB to boot from it.

Open App Store and Search for Mojave.

![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/n1c7f2u7znwsl2mpge2r.jpg)

Click Oo Get and it should start downloading it.

![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/l9f0hthqjuoeaa3jj6oe.jpg)

Mine, took me to the update section and started downloading the image.

![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/9vqdc9ysgto17w483lkk.jpg)

Once that is done, connect a USB to your Mac and Open Disk Utility.

![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/oyw867rijcb0hfs4sxk3.jpg)

Now select the USB and Click on Erase Partition and Name is USB

![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/0lw2rnrhbaq66huvpx04.jpg)

![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/xsw6tl2797fc25cwqa8b.jpg)

![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/w4gtx78tmr2qx50tr492.jpg)

Next open Terminal and paste the Following Command

```
sudo /Applications/Install\ macOS\ Mojave.app/Contents/Resources/createinstallmedia --volume /Volumes/USB--nointeraction && say Mojave Drive Created
```
![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/5u2fdozc3yu9vq7n8cw3.jpg)

![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/pwlc3stakj81t8ekt0xj.jpg)

Once Complete You have the USB Ready.
Weekly Links #1
Tags: weekly, architecture, microservices, java
Published: 2019-08-16 13:03:31

I'm the "Link guy" and I like collecting useful stuff https://kgoralski.gitbook.io/wiki/

* [Decisions  & Tradeoffs](https://ruthmalan.com/Journal/2019/20190629SlideDocTechnicalLeadershipDecisions.pdf) by Ruth Malan https://ruthmalan.com/
* [Things I Learnt The Hard Way in 30 Years of Software Development](https://blog.juliobiason.net/thoughts/things-i-learnt-the-hard-way/) by Julio Biason 
* [What does success look like?](https://zef.me/what-does-success-look-like-590f775b7b58) by Zef Hemel
* [Hail the maintainers](https://aeon.co/essays/innovation-is-overvalued-maintenance-often-matters-more) - "when people start new open source projects, new start ups, new blogs, they celebrate it. When we maintain Linux distribution, kernels, glibc, and gcc, they get no thanks." quote by Scott McCarty
* [Designing the Right Things](https://jarango.com/2019/08/10/designing-the-right-things/) by Jorge Arango
* [Upgrade your cargo cult for the win](https://meaningness.com/metablog/upgrade-your-cargo-cult) by David Chapman
* [Latency SLOs Done Right](https://www.usenix.org/conference/srecon19asia/presentation/schlossnagle-latency) by Theo Schlossnagle
* [Hash table tradeoffs: CPU, memory, and variability](https://medium.com/@leventov/hash-table-tradeoffs-cpu-memory-and-variability-22dc944e6b9a) by Roman Leventov
* [Strengthen the Weakest Link](https://getnave.com/blog/theory-of-constraints/) by Sonya Siderova
* [Why our team cancelled our move to microservices](https://medium.com/@steven.lemon182/why-our-team-cancelled-our-move-to-microservices-8fd87898d952) by Steven Lemon
* [Java Project Loom Update](https://youtu.be/NV46KFV1m-4) with Alan Bateman and Rickard Bäckman
* [Java vs. Kotlin — Part 1: Performance](https://medium.com/@bards95/comparative-evaluation-of-selected-constructs-in-java-and-kotlin-part-1-dynamic-metrics-2592820ce80) by Jakub Anioła
* [Paged Out!](https://pagedout.institute/?page=issues.php) is a new experimental (one article == one page) free magazine
* [Preventing The Capital One Breach](https://ejj.io/blog/capital-one) by Evan J
* [Major breach found in biometrics system used by banks, UK police and defence firms](https://www.theguardian.com/technology/2019/aug/14/major-breach-found-in-biometrics-system-used-by-banks-uk-police-and-defence-firms)
* [Stripe Home](https://stripe.com/gb/blog/stripe-home) - Stripes created "People", a directory to help Stripes meet and get to really know each other. "People" focused on connecting individuals across the company
* [Platform Engineering at DAZN](https://youtu.be/-1rVhPWjd_s)
* [AMD Rome Second Generation EPYC Review: 2x 64-core Benchmarked](https://www.anandtech.com/show/14694/amd-rome-epyc-2nd-gen)
* [LXD 3.16 has been released](https://discuss.linuxcontainers.org/t/lxd-3-16-has-been-released/5445)
How to Write Unit Tests with JUnit 5 in Java (Eclipse)
Published: 2019-08-17 22:02:39

---
title: How to Write Unit Tests with JUnit 5 in Java (Eclipse)
published: true
description: 
tags: 
---
## What is JUnit?
JUnit is a Java testing framework. It can be used for both Unit Testing and UI Testing. It is a great tool and fun to use. In this article, I would like to demonstrate how to use this framework in Eclipse IDE for beginners. 

Junit 5 comes with Eclipse so all we need to do is add it to our project when we first creating the project. 

Steps:
1. add Junit to the project.
2. add new file -> create a new class file.
3. add new file -> create JUnit Test file.
4. write some methods in the class.
5. create an object of that class inside the Junit Test file.
6. use the object to invoke class methods to test inputs and outputs.

```
//This class has one method which will return a string argument.
public class HelloWorld {

     public String printThis(String str){
            
               return str;
        }

}
```
```
//The JUnit file would look like this

class HelloWord{
//instantiate a HelloWorld object called hello.
   HelloWorld hello = new HelloWorld();

//test method names tends to be descriptive 
   @Test
   void should_return_a_same__passing_string_value(){

//one way to think about constructing a test is use these 3 steps

       //given (the inputs)
       String cake = "chocolate cake";

       //when (the actions)
       String cakeTest = "chocolate cake";
   
       //then (the results)
   
       assertEquals(cakeTest, hello.printThis(cake) );
//this will pass the test if both values are equal.
 }
}
```

These are the steps to perform a most basic unit test.
Is talking with a recruiter as a junior dev worth it?
Tags: career, beginners, webdev
Published: 2019-08-21 14:08:26

---
title: Is talking with a recruiter as a junior dev worth it?
published: true
cover_image: "https://techjr.s3.amazonaws.com/images/techjrsite.png"
description: We interviewed a recruiter this week on Tech Jr, he spilled all his dirty secrets on how you can get hired!
tags: career, discuss, beginners, webdev
---

This week on [Tech Jr](https://techjr.dev/episodes/2019/recruiter-mike-torres-shares-job-search-strategies-and-secrets) we spoke with recruiter-turned-dev Mike Torres about dealing with recruiters during the job search.

{% podcast https://dev.to/techjrpodcast/recruiter-mike-torres-shares-job-search-strategies-and-secrets %}

We didn't have much luck with recruiters as junior developers, but what about you?

Let us know in the comments if you've had good/bad luck talking to recruiters.
The Ultimate Beginner Git Cheatsheet
Tags: beginners, git, github
Published: 2019-08-22 14:06:47

Hello everyone!

I wanted to share a guide that I give to everyone who wants to start understand Git at a basic and advanced level. It's something that I still use and reference every day at work. Enjoy [The Ultimate Beginner Git Cheatsheet](https://mukulrathi.com/git-beginner-cheatsheet/)!
Problems that forced me to leave ProtonVPN for Mullvad
Tags: vpn, protonvpn, protonvpnreview
Published: 2019-08-27 10:05:51

---
title: Problems that forced me to leave ProtonVPN for Mullvad
published: true
tags: VPN,protonvpn,protonvpn review,vpn
canonical_url: https://kevinhq.com/problems-that-forced-me-to-leave-protonvpn-for-mullvad/
---

This purely based on my own experience with both VPN apps. Others may find it different because there are so many factors involved. Please keep in mind that Mullvad doesn’t have an affiliate program at the time I write this. This means I am not writing this to promote their service. The comparison may not… [Continue reading »Problems that forced me to leave ProtonVPN for Mullvad](https://kevinhq.com/problems-that-forced-me-to-leave-protonvpn-for-mullvad/) ![](http://feeds.feedburner.com/~r/kevinhq/~4/P6NLRp2zD3g)
Finding A Tech Job Made Easy 
Tags: hiring, career, beginners, computerscience
Published: 2019-08-25 19:01:07

As a computer science graduate of Northern Illinois University. I would like to share my experience and knowledge gained during the job search.
If you are a Full Stack Developer looking for a job in the market, here are the websites where you can  submit your job applications:

Linkedin
Indeed 
Dice
Vault
Company Website's(You can find openings in the careers portal of the company) 
College Website's(Every University has its own career portal) 
Glass Door
Angel List
StackOverflow 
Monster
Zip Recruiter 
Krop
Mashable
The Muse
SimplyHired
RubyNow
AngelList

Do you have any tips or resources you would like to share?
Openship - Open source dropshipping application and more
Published: 2019-10-17 18:29:39

[Openship](https://openship.org) started as a personal backend to manage my e-commerce shops. Inventory for my shops were coming from multiple sources like Amazon, Aliexpress, Rakuten 3PL, ShipBob, etc. Before, I was using Zapier and Google Sheets to manage routing of orders, returns, and replacements, but realized I could optimize more by connecting with the APIs directly. That's when I decided to build Openship. 

![openship dashboard](https://www.openship.org/static/f5e7d4f7985ef92817c12a9c6642a553/47f2e/appshot.png)

Openship is a Shopify application that allows you to connect and manage all your shops' operations from one dashboard. It allows you to dropship items from Aliexpress and Amazon, but also route your orders to your own inventory stores like FBA, ShipBob, or a custom 3PL solution. Dropshipping is a good way to test items before buying in bulk, but the model is not sustainable in the long-run. Building a brand and differentiating are the next steps and Openship allows that transition smoothly without being locked-in to any fulfillment service or platform.

![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/gces7bvpq3z5qrmrpwsq.png)

Openship is also a development tool. It allows you to access Shopify's GraphQL Admin API for each of your shops using the built-in GraphQL Playground. You can make quick changes to your products or orders right from the dashboard. You can also make micro applications that use the API. For example, our customer service agents found it cumbersome to locate an order's tracking. We built a simple input where the agent could enter the customer's name, address, or order name and it would fetch the tracking. Internally, we have also built micro applications that open tickets when we are contacted, send replacements for lost items, handle returns, buy more inventory when our Rakuten 3PL inventory is running low, etc. We plan to clean these up and release them as well. 

**What's the catch? How can you offer this application for free and have it be [open source](https://github.com/openshiporg/openship)? How do you plan to monetize?** 

All great questions. Our goal is simple. Provide an intuitive operations backend with a clean UI that can be customized and adapted. Within this dashboard, we are building a marketplace where users can list their products for others using the platform to source from. This includes one-time orders or bulk buying and private labelling. The marketplace will have an industry low seller fee of 4%. 

![openship Marketplace](https://thepracticaldev.s3.amazonaws.com/i/emb6gfbb0qrlrxtw5blk.png)

This is called an open core model. We are providing an application and then monetizing around that free service. We believe this will align our goals with those of our users since their success will be linked with ours.

**Tech Stack**

React.js
Next.js
Evergreen UI
Koa.js

You can read more about the tech stack [here](https://www.docs.openship.org/tech-stack).
Predicting BS using ML.Net
Tags: net, chargeid, machinelearning, mlnet
Published: 2020-04-02 00:25:58

---
title: Predicting BS using ML.Net
published: true
tags: .net,chargeid,machine learning,ml .net
date: 2018-08-08 13:00:51 UTC
canonical_url: 
---

# Predicting BS using ML.Net

Machine learning is typically the realm for R/Python. But can .Net move into this space?

In this talk we will run through Microsoft’s new ML.Net framework including what it currently offers, how to build a learning pipeline and how to deploy a model to an Azure Service.

[![image](https://mckeltblog.azurewebsites.net/wp-content/uploads/2018/08/image_thumb-7.png "image")](/wp-content/uploads/2018/08/image-7.png)

[https://slides.com/chrismckelt/deck-451cdb94-a37d-47b7-9d49-6686065e7d03](https://slides.com/chrismckelt/deck-451cdb94-a37d-47b7-9d49-6686065e7d03 "https://slides.com/chrismckelt/deck-451cdb94-a37d-47b7-9d49-6686065e7d03")

<iframe width="576" height="420" src="//slides.com/chrismckelt/deck-451cdb94-a37d-47b7-9d49-6686065e7d03/embed?style=dark&amp;byline=hidden&amp;share=hidden" frameborder="0" scrolling="no" allowfullscreen="" mozallowfullscreen="" webkitallowfullscreen=""></iframe>