teleren/devto huggingface dataset:
Factor app - Preparation
Tags: esoteric, factor
Published: 2021-10-24 09:18:30

My previous posts covered the basics of programming in Factor. Tat was necessary information to start playing around with the language and you wouldn't go far without it. Now that I've laid a foundation it's time to set a goal and learn towards it.

### The goal
###### What it is and why it's that
My goal for this part of the tutorial is to make a desktop app that interactively visualises history of games of Neptune's Pride. You don't need to know anything about NP except from that it's a game about conquering stars in space. I've chosen this project for a couple reasons:
1. It touches a couple useful aspects of programming in Factor, http requests and UI among others.
2. There is an easily accessible source of online data to test the project.
3. I wanted to do it anyway 😋

It's both something I am competent to explain and something I have motivation for doing. I believe that things learned during this project are also useful in other applications.

### What we will learn
###### I'm going to be learning too!
The project tackles two big subjects I haven't covered yet: UI and http communication. The latter will only be required on a basic level so that's what I will start with. For UI Factor offers an extensive gadget-based system that I will spend a lot of time exploring and explaining, and I hope I will manage to get pretty deep into it in the process. Gadgets are also tied closely to models which are worth at least one article by themselves.

As often as possible the articles will contain actual progress on building the app, so there will be no shortage of practical examples to show how to make use of each vocabulary or concept.

### Conclusion
###### That was a short one
I want to make something and share what I learned in the process, which is the main premise of this blog. All source code will be available in the [Esoposting Examples repository](https://github.com/olus2000/Esoposting-Examples) on github as soon as the next article is published at some point in the next two weeks. Hope to see you there!
Connecting Express backend to Javascript frontend
Tags: javascript
Published: 2021-10-24 09:12:24

This was something that confused me until recently.

## The set up

Let's say you have your server running on port 8000 with this code:
```javascript
app.get('/api', async (req, res) => {
  // get some data from an API
  console.log(data)
  res.json(data)
})
```
If you go to localhost:8000/api in your browser, it'll show you the data you've got from your API.

So all you need your front end to do is to navigate to that same location.
```
  const response = await fetch('http://localhost:8000/api');
  const data = await response.json();
  console.log(data);
  // do something with the data
```

Run your server on port 8000 and your client on another port and it gets the data all ok. So it works right? Not so much. If you open your front end on your phone, it won't get the data. Why? Because localserver doesn't make sense to your phone. You can't open http://localhost:8000/api on your computer, you have to do something like 192.168.1.1:8000/api to get it to work.

## Webpack
Webpack has a solution for this: a [proxy](https://webpack.js.org/configuration/dev-server/#devserverproxy). It tells the client the server's location, so it can go there. You just have to add the details to your webpack config file.
```
devServer: {
    proxy: {
      '/api': 'http://localhost:8000',
    },
  },
```
And then in your client you just need to point it to /api:
```
  const response = await fetch('/api');
  const data = await response.json();
  console.log(data);
  // do something with the data
```

Which works. Except it gave me pause. In my server I have this line:
```
const port = process.env.PORT || 8000;
```
What this says is, if you have a port use it, otherwise use 8000. It's possible that the service you've uploaded to will choose its own port. In which case, this proxy won't help.

## Serve client from the server
The solution for an uploaded/built site is to [serve it from the server](http://expressjs.com/en/starter/static-files.html). In other words, when you go to localhost:8000 you get your index page.
```
const path = require('path');
app.use(express.static(path.resolve(__dirname, '..', 'public')));
```
In my case, the index folder is one folder up from the server, and then in the public folder.

The trouble with this is that if you're using a build tool that doesn't update the index, css and js files until you build it (rather than run it) then it won't help much.

In summary, it's simple, just a bit of a pain.
Who were programmers?
Tags: programming, beginners, career, world
Published: 2021-10-24 08:56:15

Hi, my name is Saifullah Usmani. I am a Programmer and a Graphic Designer. I have been programming for almost 5 years now. And I have worked with several freelance clients.

If it sounds like a thing that will add value in your life then consider following my page because I keep creating quality content for you.

##Who were programmers?
What I think is that the programmers were actually the problem solvers for the world.
They had a very important role in the world's progress, but that spirit seems lost.
People are learning programming for jobs, money etc. But very few really want to change the world with it.

##Be a problem solver:
You are becoming a programmer. It is not just a hobby/passion/career but more than that. I think you must invest some of your time in solving problems of the world in any way possible.
It is not your duty to do so, but I think it will make you a better person in general and also benefit the world and the people that are gonna come after you in this world.

##What is problem solving skill?
This skill is what it sounds. But it is a skill so you have to learn it. It also depends on the mental capacity but it can also be learned. You can sharpen your brain. It is not impossible.

You are given a problem and you try to think a solution and solve it. Then find a much better solution to do it better. That is generally what problem solving is.

I hope you guys got what I wanted to say.
Let me know what your thoughts are.

Thanks for reading this much. See you soon.




[![DigitalOcean Referral Badge](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/00rcc3tqicv68383vo0r.png)](https://www.digitalocean.com/?refcode=9d6f3f71c1b4&utm_campaign=Referral_Invite&utm_medium=Referral_Program&utm_source=badge)
Affiliate Link☝



##Follow me:
Hire me: https://www.fiverr.com/saifullah02 (For web development Purposes)
My New Blog: [saifullahusmani.com](https://saifullahusmani.blogspot.com/)
*Follow me here:* https://dev.to/saifullahusmani
*YouTube:* http://bit.ly/saifullahusmani (Programming Tutorials Coming Soon).
*Discord:* https://discord.gg/AKyvy8Y
*Facebook*: https://www.facebook.com/SaifullahUsmani693
Consistancy!!
Tags: learning, css, webdev, beginners
Published: 2021-10-24 08:46:31

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/rf8tiy0jncqidlbypg80.png)

I hear this a lot on instagram, " consistancy can take you atleast 2 years ahead in life in 6-10 months. I am an Angular dev in ADP, I always start learning and leave it in the middle never complete it, I know there are many people out there the same way, I feel super happy that I am starting something out, but end up learning a little. Therefore for this I am keeping a track in an excel sheet, we know that keeping the count of the streak motivates us, therefore I am doing the same using Excel sheet. I am challenging myself to do this for 60 days, minimum time one hour. Lets see how it goes, I am going to update the same in one week. 
Well for what I am leanring, it is mordern CSS and git and github. I know HTML and CSS and little bit of git, but trying to learn even more and become a better developer.
code every day with me
Tags: javascript, programming, 100daysofcode, algorithms
Published: 2021-10-24 08:39:09

**--DAY 6--**
Hi, I am going to make #100DaysOfCode Challenge.Everyday I will try solve 1 problem from leetcode or hackerrank. Hope you can go with me until end.
**Now let's solve problem today:**
-Problem: Valid Parentheses
-Detail: https://leetcode.com/problems/valid-parentheses/
-My solution (javascript):
```
var isValid = function(s) {
  if(s.length%2!=0) return false;
  let map = new Map([
    ['[',']'],['(',')'],['{','}']
  ])
  let stack=[],closeChar=[];
  for(let x of s){
    if('([{'.includes(x)) stack.push(x);
    else if(x == map.get(stack[stack.length-1])){
      stack.pop();
    }
    else closeChar.push(x);
  }
  return(stack.length==0&&closeChar.length==0)?true:false;
};
```
-->*If you have better solution or any question, please comment below. I will appreciate.*
How to evict specific pods on the Kubernetes cluster
Tags: kubernetes, go
Published: 2021-10-24 08:31:28

---
title: How to evict specific pods on the Kubernetes cluster
description: This article will present what pod eviction is and introduce a kubectl plugin to do that, kubectl-evict.
published: true
tags:
- Kubernetes
- Go
---

## Introduction

Kubernetes is a very popular and the most widely used container orchestration.  It has a sophisticated and flexible scheduling system to deploy your application on production.  The administrators would use a kubectl CLI to manage the cluster and deployed pods.  The kubectl CLI provides enough features to manage the cluster, but the developer can customize CLI with a kubectl plugin.  This article will present what pod eviction is and introduce a kubectl plugin to do that, [kubectl-evict][ueokande/kubectl-evict].

## Pod Eviction

Kubernetes provides *pod eviction*, which stops pods and removes them from the node.  The pod eviction is usually used when the node is shutting down, or the cluster performs a rolling restart of nodes to minimize the downtime of the service.  The kubectl CLI has a sub-command `kubectl drain` to evict pods from the specified node and, the command makes the node as unschedulable:

```console
$ kubectl drain your-node
```

## kubectl-evict: evicts specific pods 

The kubectl CLI does not provide a feature to evict specific pods. I sometimes need this feature to safely remove pods from the node or test a [PodDisruptionBudget][].  The [kubectl-evict][ueokande/kubectl-evict] is a kubectl plugin that allows evicting certain pods from the node.

{% github ueokande/kubectl-evict no-readme %}

Although there are already plugins to evict pods such as [dwradcliffe/kubectl-evict][] and [kubectl-evict-pod][rajatjindal/kubectl-evict-pod], the above plugin has a high compatibility interface with `kubectl logs` or `kubectl exec` and provides the following features:

- Allows evicting pods by a label selector
- Evicts pods created by Deployment or DaemonSet
- Supports `--dry-run` and `--grace-period` flags

You can get the plugin by the following:

```console
$ go install github.com/ueokande/kubectl-evict@latest
```

## Usage

To evict a specific pod:

```console
$ kubectl evict nginx-abcd-1234
```

It also allows evicting pods by label selector.  The following shows to evict pods which has a label `app=nginx`:

```console
$ kubectl evict -l app=nginx
```

Evict pods created by Deployment:

```console
$ kubectl evict deployment/nginx
```

You can of course evict pods from the node:

```console
$ kubectl evict node/worker-1
```

Note that `kubectl evict` does NOT make the node as unschedulable (cordon), so use `kubectl cordon` or `kubectl drain` if you need to do this.

[Eviction API]: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.22/#create-eviction-pod-v1-core
[ueokande/kubectl-evict]: https://github.com/ueokande/kubectl-evict
[dwradcliffe/kubectl-evict]: https://github.com/dwradcliffe/kubectl-evict
[rajatjindal/kubectl-evict-pod]: https://github.com/rajatjindal/kubectl-evict-pod
[PodDisruptionBudget]: https://kubernetes.io/docs/tasks/run-application/configure-pdb/
測試的一小步 專案的一大步
Published: 2021-10-24 08:28:55

本文僅獻給那些從來不寫測試的同學們。

我們都知道測試的重要性，教材也都鼓勵我們重視測試，追求測試覆蓋率，可是其實你知道、我知道、獨眼龍也知道，測試根本就沒有寫，東西看起來會動就好。（？！）

根據某些祖傳的統計數據，測試的程式碼平均會是其它程式碼的六倍，在資源（沒錢、沒人）與死線（沒時間）的雙重壓力下，也難怪測試始終寫不下去，因此本文只會請同學大大寫一個測試，真的一個就好。

## 一個測試

```ruby
# test/system/home_page_test.rb

class HomePageTest < ApplicationSystemTestCase
  test "show homepage" do
    visit "/"
    assert_text "Text on your homepage"
  end
end
```

跑一下：

```sh
> bundle exec rails test:system
```

這樣簡單的把首頁打開的測試，背後代表的意義是：

1. 專案的首頁被瀏覽器打開了。
2. 因而專案必須真的跑起來好讓瀏覽器訪問。
3. 你寫下了第一條測試，而且應該是成功的，好棒棒，給自己掌聲鼓勵。

這只是測試的一小步，卻是專案的一大步。

忘掉上面六倍的恐怖數字吧！藉由這一個微小但確切的測試，看著它 pass 有沒有感到一絲絲的小確幸呢？

如果有的話（灑花轉圈圈），來寫下一個測試吧，可以是測試註冊帳號，也可以是測試登入，測試是一種累積，看到它們 pass 的那種安心感是難以言喻的，從此不用再提心吊膽、偷偷摸摸交付給客戶，測試是我們的好朋友，也是工程師的浪漫～。

本文改寫自〈[Write One Test](https://andycroll.com/ruby/write-one-test/)〉。
Big News for Tabnine & Visual Studio!

Tags: webdev, programming, productivity, news
Published: 2021-10-24 08:19:56

September and October have been huge months for the Tabnine community, with support for several new IDEs added, including Eclipse, Rider, JupyterLab, AppCode, and DataGrip. Now we’re moving into fall with our biggest IDE addition yet, Visual Studio. 

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7re0b4qprn5qrt7c32ds.gif)

According to the Top IDE Index, Visual Studio is the most popular IDE by far, racking up 28.65% of all Google searches, more than Eclipse and Visual Studio Code combined. Adding Visual Studio to Tabnine’s lineup of supported IDEs will allow us to serve a massive new segment of the community.

Visual Studio’s collaboration and customization options make it a favorite among large development teams. Our recent launch of Tabnine for Teams allows us to offer team-specific contextual code completions elevating your team’s development experience.

With more major players entering the AI-assisted code completion space this year, and the increasing demand from developers for team-friendly tools, we thought it was the perfect time to add Visual Studio to Tabnine’s growing list of supported development environments.

Tabnine is thrilled to offer all Visual Studio users access to the industry’s leading AI code completion assistant. Breeze through your daily dev work with code completions that eliminate tedious, repetitive typing tasks and elevate the entire development experience for you and your team.
An easy way to count elements in a JavaScript array
Published: 2021-10-24 08:15:36

---
title: An easy way to count elements in a JavaScript array
description: Learn how to find the number of times an item appears in an array in JavaScript
cover_image: https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8tgsvopjyhy19h0e9okj.jpg
canonical_url: https://www.kudadam.com/blog/python-count-in-javascript
---

If you have a Python background, you are probably familiar with the `count` method in the list class.
The `count` method does not exist in JavaScript. For those unfamiliar with the `count` method, it counts the number of times an item appears in an array. For example, suppose we have a `numbers` array, and we want to find the number of times the number '2' appears in the array. In Python, we would do it like this.

```python
numbers = [1,2,3,4,5,2,3,4,2,4,2]
print(numbers.count(2)) # => 4
```

The code would return 4 because the number '2' appears four times in the array.
Since this technique did not exist in JavaScript, I decided to write my own.

```javascript
Array.prototype.count = function (item) {
	return this.filter((x) => x === item).length;
};
```

Extending JavaScript inbuilt classes can cause unexpected behaviour and conflicts with other libraries, so it's better to create custom classes instead.


In the code above, I extended the Array class and added a new method called count through the prototype. The method takes an argument called `item`. It then filters the array and returns the number of times `item` was found in the array.

To utilise the code, simply construct an array and call the count method as shown below.

```javascript
let names = ['David', 'Walsh', 'David', 'Tania', 'Lucretius'];
names.count('David'); //=> 2
```
Which language is Best? Which language to learn first?
Published: 2021-10-24 08:03:27

If you are beginner in programming or planning to pick up a career in programming then this article is for you.

You might have seen people talking/discussing about “How one programming language is better than other programming languages”. But I think that’s wrong, Let me explain why, because each language has its own support in the industry. Let’s take five most popular languages.
1)	Python
2)	Java
3)	JavaScript
4)	C++
5)	C#
Now, each of them has their own support in the industry in a specific field/fields.
Python is mostly used for Data Science and Machine Learning. Some also use it for web development but in web development most of them use JavaScript because all the End-End work is done by JavaScript alone by using MongoDB, (Reactjs, Angular, Vue), Expressjs, Nodejs. And not only because of the frameworks and libraries but also many companies already have their software in that language so switching everything will make it a big mess. 
C++ and C#  both are used for desktop application development and game development and Java for android application development. If you are thinking to learn android application development then I would suggest you to learn java and kotlin.

Now, If you are thinking which language to learn first then my answer is it really doesn’t matter but I would suggest you to got with Java. Because Java is bit moderate to learn/ get adapted to. So, If you learn it first then it would be easy for you switch between languages because you will not be working with only one language.
What is a REST API? | Design Principles of REST API
Tags: restapi, architecture, node, webdev
Published: 2021-10-24 07:24:13

{% youtube I75zkl37JcQ %}

One way or the other you have always interacted with a REST API.
If you've ever wanted to know, How does a REST API work? then this tutorial is definitely for you.

Project Enquiries: https://www.srajangupta.com/
My Coding Bootcamp Journey - Week 1 of 13
Tags: beginners, webdev, javascript
Published: 2021-10-24 07:18:05

Well, one week done already and we covered so much. Basically the precourse work was covered but in a way that reinforced it. It was done with a series of live Zoom lectures with the chance to ask questions in the Zoom chat and by video. This format really helped clarify some issues and raise other ones in an interactive way. It was almost like being in a classroom - with 70 other people. The chat does a get a bit busy!

## Topics covered include
Introductions to:

- Command Line
- Git
- GitHub
- Data variables & expressions
- Conditional logic
- Functions & execution context
- Arrays & iteration
- Understanding errors
- Objects & for...in
- Array methods
- Sharing between files (module.exports & require)
- Regular expressions
- HTML
- CSS

## Friday Fun
On Friday we even managed to build a web page and had  a show and tell. If you want to see my attempt, comment and I may post a link!

Friday finished with a massive game of [Sketchful](https://sketchful.io/) which was fun but how do some people get the words so quickly???

## Onward
Next week we hit the Fundamentals. I've had a good rest this weekend, I'm gonna need it!

If you have any further questions about the experience of bootcamp, contact me on the socials, especially [Twitter](https://twitter.com/Web_Dev_Rich)
How to Program iOS on iOS
Tags: ios, beginners, tutorial, database
Published: 2021-10-24 07:14:15

> Do I need a mac to program iOS?
> How to program iOS on Windows? 
> Do I need a Mac to program iOS?

This is a frequent question asked by amateur programmers (or want-to-be programmer) looking to get into iOS programming.


For a long time the answer was a definite “yes - a Mac is required to program iOS”.

However that is no longer true.

![Programming on an iPad Mini](https://cutecoder.org/wp-content/uploads/2020/06/img_0072.jpg)

Programming iOS on the device itself has been feasible for a long time now. Often with the help of an external keyboard, of course. However apparently not many people know about it. Moreover many iOS developers themselves seems to be denying this fact – probably due to _job security_ reasons.



[Read on](https://tinyurl.com/ydm3h9td) to find out how to program on an iPad, iPhone, or even iPod touch without needing a Mac.
Difference between UI and UX ? 
Published: 2021-10-24 07:14:02

UI [USER INTERFACE] :- 
UI design refers to the aesthetic elements by which people interact with a product, such as buttons, icons, menu bars, typography, colors, and more. User experience (UX) design refers to the experience a user has when interacting with a product.

UX [USER Experience] :- 
UX design is the process design teams use to create products that provide meaningful and relevant experiences to users. This involves the design of the entire process of acquiring and integrating the product, including aspects of branding, design, usability and function.

WANT TO KNOW MORE 
Follow @hackthisfalldev 
Many more intersecting things are coming 
SOCIALS 
IG :- https://www.instagram.com/hackthisfall/
Twitter :- https://twitter.com/hackthisfall
How can I learn UX/UI design?
Published: 2021-10-24 07:05:53

To learn UI/UX design you must enroll yourself in a communication design course. There are several schools that offer a degree or diploma in communication design. There are even some schools that offer a dual degree - international and UGC recognized, in the discipline.

Given the practicality of the subject, most communication design programmer are designed to deliver skill-based learning, where students get a more hands-on approach and sharpen their creative design skills. These programmer are often multidisciplinary where students not only learn about graphics and designing but are also made familiar with the concepts of advertising, marketing, branding, etc., making them a jack of all trades.

I learn and gain knowledge about UI/UX from hackathon name @hackthisfalldev 
and really had an amazing experience in it.
How to Integrate macOS Notarization into CI/CD jobs
Tags: devops, macos, gatekeeper, notarize
Published: 2021-10-24 07:04:18

> “Is there instruction on how to best integrate [notarization] into a CI build process?”

Unlike App Review, notarization is a completely automated process that does not require human intervention. At least it’s automated on Apple’s side. You would need to invest a good amount of effort in setting up automation otherwise spend even more time notarizing every release.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/skyn90wgvfkni3iqk3kq.jpg)

How to automate this process? [Read on to find out more](https://tinyurl.com/ygbf79gw).