teleren/devto huggingface dataset:
Connecting via FTP on MODLR
Tags: database, analytics, javascript
Published: 2021-03-03 04:34:44

We have been using [MODLR](https://modlr.co) for a while for our connected planning tool, once we decided to move out of excel spreadsheets. One of the situations we found ourselves in recently was to implement file transfer from our server to MODLR to import data automatically.

We created a Process in our data model and then went over to the script editor in Javascript to start with.

- Create a new FTP connection (we use model variables so we can keep this clean)
```var client = ftp.Connect(protocol, host, port, username, password);```

Reference from the docs:
**protocol** - The ftp protocol for this connecton. At the moment, only "sftp" is supported.
**host** - The ftp host like a domain name or an ip address
**port** - The port to use on the ftp connection
**username** - The username to use
**password** - The password for the user

- Check if the connection was successful and transfer file
```
if (client.IsConnected()) {

// Transfer file
    var result = client.Upload('WeeklyReport.csv', '/var/www/html/weekly-reports/');
//returns a boolean based on the result

} else {
//send a sms notification using notifications.sms
}
```
FEC Day 5-6
Published: 2021-03-03 09:16:40

This was the weekend where we were supposed to take a break from coding. I decided to code a bit anyway though and made 2 axios requests. I played around a lot in postman and in our gLearn to better understand the data we were receiving. I decided to have two requests to the api within one axios request because I felt like we would need both the product data and styles data at the same time.
Coding Creativity with IBM Developer Series
Tags: techtalks, workshops, devrel, community
Published: 2021-03-03 09:04:48

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/hd92ekbi3iasnml7key1.jpg)

Since the beginning of the pandemic, we had to work from home and so our team of Developer Advocates has been delivering workshops in the IBM Developer Series on <a href="https://www.crowdcast.io/ibmdeveloper">crowdcast</a> and it has been growing ever since. We are always working on the series to deliver the best content we have. With IBM Developer Series, you can learn every day how to access everything, and build anything.

Now we are back with our series for 2021! This year we are starting with 3 workshops every week, where each day has a theme:
- Security Tuesdays
- Data and AI Wednesdays
- Cloud-native and Red Hat OpenShift Thursdays

### Who are we?
Our team of bright developer advocates is based in MEA. We are passionate individuals in the technology we work with, our skills and expertise vary between AI, Cloud-native, DevOps, Security, and much more!

### What do we do?
Our goal is to nurture the developers with the latest technology trends and showcase the many amazing things we can do with different tech!
There’s so much that we do, like delivering workshops, writing tutorials and code patterns, and working on new solutions!

### Why should you join us in the Developer Series?
If you are passionate about learning, come learn with us! You can attend the workshops anytime, from the comfort of your home, anywhere!
You can expect our workshops to vary from building machine learning models, smart chatbots, building and deploying data science pipelines, DevOps pipelines, container technologies, serverless, securing your applications, and much more! And it’s all open source!

### How to attend developer series workshops?
You can check out more details on our series on various platforms like <a href="https://www.crowdcast.io/ibmdeveloper">crowdcast</a>, <a href="https://www.meetup.com/IBM-Cloud-MEA/">meetup</a>, and LinkedIn. If you ever miss a workshop or want to watch it at any time, the replays are available the moment a stream ends! You can watch them from the same link.

### Speak with us!
Did you know that you can also be featured as a guest speaker in the series? And it's very simple! When you attend any of our events, you can submit a form and we will contact you very soon!

### Got more questions?
Our team of Developer Advocates is always ready to support the developer community! Never hesitate to contact us through email or our socials if you have any issues or questions about a workshop you attended, a code pattern you tried, or any questions you may have on IBM Cloud.
MongoDB setup for creating REST API
Tags: mongodb, node, javascript, database
Published: 2021-03-03 08:49:34

Here I am going to explain how to set up your database MongoDB for creating REST API using node.js,express which you can later fetch  using any frontend like React.I am not covering the basics of mongoDB here.

Steps to be followed:

1. Go to MongoDB website [mongoDB](https://www.mongodb.com/3) and create your free account by signing up or signing in using your Google account.
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/kcq9f310hsfpdkxczm9w.JPG)

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/zu5k0cqcspqvf5gfke9k.JPG)

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/26jt4loo3bs81tcn6bct.JPG)

2.Create a cluster.
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/j8p2t1cm79eirs5inp8z.JPG)
Choose Shared Clusters which is free.
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/uvlc2sbsd3f168dwhsk0.JPG)
Now you can choose AWS and North Virginia region which mostly people use and then click on Create Cluster at the bottom.
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/svhll4ku4s9gx5k4m9ol.JPG)
It will take few minutes in cluster creation.
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/y9ozu20n1jbtcflv88la.JPG)

3.Now create user.
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/uv3itwwvqauqehf1dy7p.JPG)
Authenticate the user by giving username,password and choosing Database user privileges-Read and write to any database.
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ai0rvnz2e9bd6smskil7.JPG)

4.Now go to Network access and whitelist your IP Address.
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/94pr1vqu6cn3qhq10wh6.JPG)
Choose your current IP address and confirm.

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/9lcw19atjtkfhozi8gm5.JPG)
You will only be able to connect to your cluster from the list of IP Addresses in IP Access List.

5.Now go to Clusters and choose Connect.
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5w7k9ziyr5ue3kf92be9.JPG)
Now connect your application.
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/o0d2u567mckbyampnvmx.JPG)
Now copy the link which you will use in your project.Replace the password in the link with the actual password you set before.
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/y5v03atkes3fh5w68ar9.JPG)

Now you can use this link to connect to database in your REST API or MERN stack if you work in React or any other frontend.

Happy Learning :)
You can follow me on [Twitter](https://twitter.com/kritikasri27) and [Github](https://github.com/kritika27).
What is a Web Application?
Tags: webdev, tutorial, todayisearched
Published: 2021-03-03 08:41:31

Nowadays, web application becomes common on the market VietNam. Millions of businesses use the Internet as a cost-effective communications channel. 

We can understand Web applications use a combination of server-side scripts (PHP and ASP) to handle the storage and retrieval of the information, and client-side scripts (JavaScript and HTML) to present information to users. 

##Definition of Web application
A web application is a computer program that utilizes web browsers and web technology to perform tasks over the Internet.

##How a process work of web application 
Web applications are usually coded in browser-supported languages such as JavaScript and HTML as these languages rely on the browser to render the program executable.

Furthermore, the web application requires a web server to manage requests from the client, an application server to perform the tasks requested, and, sometimes, a database to store the information.
  
##Now, Lets's see examples of web application
[Web applications examples](https://www.designveloper.com/blog/web-application-examples/) include online forms, shopping carts, word processors, spreadsheets, video and photo editing, file conversion, file scanning, and email programs, and email programs such as Gmail, Yahoo and AOL. Popular applications include Google Apps and Microsoft 365.

![What is a web application](https://www.shutterstock.com/fr/image-photo/bw-website-design-wireframe-examples-web-1712701984)

##The last Benefits of a web application
They reduce software piracy in subscription-based web applications
They are not installed on the hard drive, thus eliminating space limitations.

Web applications run on multiple platforms regardless of OS or device as long as the browser is compatible. They reduce costs for both the business and end-user as there is less support and maintenance required by the business and lower requirements for the end user’s computer
How to Grow Cucumber in Cypress in Just 10 steps
Tags: cypress, bdd, cucumber
Published: 2021-03-03 08:32:45


> ![image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5thgila18oifls2s5cpr.png)
 What is Cucumber?
Cucumber is a software tool that supports behavior-driven development (BDD).

> What is BDD?
BDD bridges the gap between business stakeholders and the technical team through a common platform. Hence, communication among the team becomes more transparent.
Gherkin is being used as the language in which the test cases are written in a simple format and can also be read and modified by a non-technical user.

> Please see the below blog for complete detail (Step By Step)
https://kailash-pathak.medium.com/how-to-grow-cucumber-in-cypress-in-just-10-steps-21c5a086b929

> Please see the below VIDEO for complete implementation  (Step By Step)

  https://youtu.be/-ptgxtb3xVs
Generate Cucumber .html report in Cypress in Just “5” Steps
Tags: cypress, cucumber
Published: 2021-03-03 08:23:00

> Problem statement
We need a .html report where we can see the results of the cucumber cypress test case in graphical form (pie chat etc.)

> Solution
With the help of two plugins “cypress-cucumber-preprocessor” and “multiple-cucumber-html-reporter,” we can achieve this

> Please see the below blog for complete detail
https://qaautomationlabs.com/generate-cucumber-html-report-in-cypress/

> Please see the below VIDEO for step by step implementation
https://youtu.be/gNl8bnOyr8g
Cypress test case execution in CI/CD using CircleCI
Tags: cypress, circleci
Published: 2021-03-03 08:20:00

> What is CircleCI
CircleCI is a modern continuous integration and continuous delivery (CI/CD) platform.
Set up CircleCI and Integration of CircleCI with the repository

> Please open below link for complete detail
https://qaautomationlabs.com/%ef%bf%bc/

> Video of all steps attached below
https://youtu.be/eHcDBJaFLWk
How do you prefer to create a new project?
Tags: javascript, webdev, typescript, discuss
Published: 2021-03-03 08:16:21

- From scratch?
- Bootstrapping?
- Clone a Git or Git template? (I would recommend to add `--depth=1` or use `degit`.)

If you choose "from scratch", what do you often do first thing first? What about other options?

## From scratch

Actually, I often do from scratch, by

```sh
yarn init -y
yarn add typescript prettier -D
yarn tsc init
```

Then, check most of the `eslint`'ty options in `tsconfig.json`, as well as `experimentalDecorators`.

Yeah, it's the very benefit of TypeScript for me, actually.

Creating `.prettierrc` is even optional for me.

I also used to do `npx eslint --init`, but that will also need `syzer -u`.

## Bootstrapping

```sh
yarn create nuxt-app $NAME
cd $NAME
npx syzer -u
yarn
```

Then check for broken dependencies.

I think `syzer` (maybe also `npm-check-updates`) is a very good package. Keeping updated will help fix security problems.

{% post https://dev.to/rocktimsaikia/syzer-update-your-npm-dependencies-at-one-go-5g5f %}
Neuroplasticity is not a Word 
Tags: neurology, neuroplasticity, neurohacking
Published: 2021-03-03 08:15:11

---
title: Neuroplasticity is not a Word 
published: true
description: no such word
tags: neurology, neuroplasticity, neurohacking
//cover_image: https://direct_url_to_image.jpg
---

as it turns out my browser or dev.to does not recognize many of the words that are newer, but neuroplasticity is an OLD concept with the idea going back to William James and neurological definition appearing in 1945 by Justo Gonzalez, the field got much more interesting after Marian Diamond published her work in the early 60s.

Andrew Huberman, PhD is doing a lot of work in his lab as well as in the field of science popularisation.

I wish everyone well who is into this idea as part of their development experience.
RSpec: what's important for the test
Tags: rspec, ruby, beginners
Published: 2021-03-03 08:14:09

Situation: we need to make sure that we charge the user the correct amount when he uses a coupon. Important point: the class responsible for this has a huge API with mandatory arguments.

First take:
```ruby
context "when coupon is applied" do
  it "charges user $500" do
    allow(Cashier).to receive(:charge)

    purchase.perform

    expect(Cashier).to have_received(:charge)
      .with(
        user: user,
        sum: 500,
        description: "season ticket purchase",
        coupon: coupon
      )
  end
end
```

If we leave the test as it is, it will distract us with details that are not important: the user, the description of the charge, the coupon. Since we want to make sure that the amount has changed, we only need to check the amount:

```ruby
context "when coupon is applied" do
  context "charges user $500" do
    allow(Cashier).to receive(:charge)

    purchase.perform

    expect(Cashier).to have_received(:charge)
      .with(hash_including(sum: 500))
  end
end
```
10 second Celebration
Published: 2021-03-03 08:07:40

---
title: 10 second Celebration
published: true
description: 
tags: 
//cover_image: https://direct_url_to_image.jpg
---

I have thought of a little productivity hack:
- celebrate your small successes for 10 seconds 
to enhance the significance of connections in your brain
which takes about 10 seconds.

It should press into memory the how and the why and everything leading up to the insights and final steps that lead to your achievement.

The achievement could be an insight or a work task upon completion.
It does not matter if it is a routine that you needed to engage in or an innovation.

I sometimes dance to mark the celebration. I think that this could potentially help with putting my vestibular system in a weird state where neuroplasticity gets a restart.
สรุป Pattern ของ router helper function ที่ Phoenix นั้น generate ให้
Tags: elixir, phoenix
Published: 2021-03-03 08:05:38

เวลาเรากำหนด router เพื่อจะใช้ map path กว่าถ้ามีการ request ตาม pattern  ของ path ที่กำหนด จะให้ไปเรียก NameController.action ฟังก์ชันไหน ตัว Phoenix เองมันจะ generate Helper module ที่มี helper function ในการสร้าง URL endpoint ให้ด้วย ซึ่ง กฎในการสร้างมีคร่าวๆแบบนี้

## 1. มันจะใช้ชื่อ controller เป็น prefix เช่น

```elixir
post "posts", PostController, :create
```

มันก็จะสร้าง helper function ให้สองชื่อคือ

- `post_path`
- `post_url`

## 2. ถ้าเราไม่อยากได้ชื่อ controller เราสามารถกำหนดเองได้ด้วย option `:as` เช่น

```elixir
post "posts", PostController, :create, as: "my_post"
```

มันก็จะสร้าง helper function แบบนี้แทน

- `my_post_path`
- `my_post_url`

## 3. ถ้าเกิดมี resources ซ้อนกัน มันก็จะตั้งชื่อ helper โดย prefix ด้วยชื่อ controller ที่ซ้อนกันเช่น

```elixir
resources "/users", UserController do
  resources "/posts", PostController
end
```

มันก็จะสร้าง helper function แบบนี้

- `user_post_path`
- `user_post_url`

ถ้าเราเปลี่ยนไปใช้ option `:as` มันก็จะเอา as ของทั้งสองอันมาต่อกันแทน

## 4. ถ้ามี scope แล้ว scope ใส่ option `:as` ไปด้วย มันจะเอา option ของ scope มาเป็น prefix ด้วย เช่น

```elixir
scope "/admin", HelloWeb.Admin, as: :admin do
  pipe_through :browser

  resources "/reviews", ReviewController
end
```

มันก็จะสร้าง helper function แบบนี้

- `admin_review_path`
- `admin_review_url`


Ref: https://hexdocs.pm/phoenix/routing.html

## ขอฝาก Buy Me a Coffee
สำหรับท่านใดที่อ่านแล้วชอบโพสต์ต่างๆของผมที่นี่ ต้องการสนับสนุนค่ากาแฟเล็กๆน้อยๆ สามารถสนับสนุนผมได้ผ่านทาง Buy Me a Coffee คลิ๊กที่รูปด้านล่างนี้ได้เลยครับ

<a href="https://www.buymeacoffee.com/weerasak" target="_blank"><img src="https://cdn.buymeacoffee.com/buttons/v2/default-yellow.png" alt="Buy Me A Coffee" style="height: 60px !important;width: 217px !important;" ></a>

ส่วนท่านใดไม่สะดวกใช้บัตรเครดิต หรือ Paypal สามารถสนับสนุนผมได้ผ่านทาง PromptPay โดยดู QR Code ได้จากโพสต์ที่พินเอาไว้ได้ที่ Page DevDose ครับ https://web.facebook.com/devdoseth

ขอบคุณครับ 🙏
How to fetch an external API with useEffect()
Tags: beginners, react
Published: 2021-03-03 07:54:09

I just had a day full of headaches while trying to debug code while browsing StackOverflow, Reddit and Discord channels...

This post is for my future self but also for anyone who's having issues making external API calls in React. Specifically using fetch inside of useEffect.

TLDR: This is how you do it.
```
    const fetchWeather = async (url) => {
        const response = await fetch(url)
        const json = await response.json()
        setForecast({ data:json, loading:false })
    }

    useEffect(() => {
        if (search !== '') {
            fetchWeather(url)
        }
    }, [search])
```

In this post I will be going over the following topics.
1. Why useEffect for fetching an api?
2. What's with the if statement inside the useEffect?
3. What's happening inside fetchWeather?
4. Why async/await?

------------------------------------------------------------------


*Why useEffect for fetching an api?*
- useEffect is the functional version of ComponentDidMount, ComponentDidUpdate and ComponentWillUnmount
- When making an API call, typically you don't want to make a call to the API with every render. In the example above, useEffect will invoke the callback (first argument) ONLY WHEN an item inside the array of dependencies (second argument) is changed

*What's with the if statement inside the useEffect?*
- Without the if statement, useEffect will always run in the initial render
- This was an issue in my code because the initial value for search (a dependency for the url) is ''. This results in a failed API call because there is a missing query to the API.
- Skipping the initial render allows the user to input a query to the API which then re-renders the app with the API data.

*What's happening inside fetchWeather?*
1. fetchWeather takes a url as an argument
2. It then uses fetch to make an http request with the url
3. Next line parses the http response into json
4. setForecast updates the forecast state with the new data and also sets loading to false so that the data can be rendered

*Why async await?*
Fetch is promise based so you have to "await" for the promise to be resolved before moving on to the next line of code. E.g. you can't parse the response to json until the response is resolved. Another option is to use .then() and .catch() syntax to perform actions after a promise is resolved.
How Use Dark Theme In Any Web App.
Tags: javascript
Published: 2021-03-03 07:45:09

>
#Code
```
var divs = document.querySelectorAll("*")
for (var i = 0; i < divs.length; i++){
    divs[i].style.backgroundColor = "rgb(34,34,34)";
divs[i].style.color = "white";
}
```
Project 53 of 100 - Another Instagram Clone, this Time with Users
Tags: react, firebase, 100daysofcode, javascript
Published: 2021-03-03 07:22:00

*Hey! I'm on a mission to make 100 React.js projects ending March 31st. Please follow my dev.to profile or my [twitter](https://www.twitter.com/jwhubert91) for updates and feel free to reach out if you have questions. Thanks for your support!*

Link to the deployed project: [Link](https://cp-instagram-clone-jwhubert91.web.app/)
Link to the repo: [github](https://github.com/jwhubert91/100daysofreact/tree/master/day-53-cleverprogrammer-instagram-clone)

This project took me 4 days to complete. I started it on Saturday and assumed it would be done in a couple hours, since [the tutorial it's based on](https://www.youtube.com/watch?v=f7T48W0cwXM&ab_channel=CleverProgrammer) is only 3 hours. I ran into several bugs and even a couple of areas where I had to write code that was different from the tutorial to get it to work without errors.

The result is a fully functioning Instagram knockoff with auth, users, posts, comments, and a handy flagging system that deletes a post if it's inappropriate. Please y'all- if you see something inappropriate in the app I am counting on you to remove it :)

I'm not going to write a ton about this because I have a personal rule not to work past 1 am and it's now past 2 am- but here are a small handful of rules I learned.

####1. Material UI is powerful, but has a learning curve
Material UI is the UI system this web application is built with. There are only a few components in this application that use it, but where it's used it does make nice, well-styled components.

####2. You can center things with <center></center>
This was amazing to me. One of those funny basic html tricks you learn late in your coding career. You can center thing quickly by making the elements you want to center children within the `<center>` tags. It's a breeze to horizontally center now.

####3. Firebase is still easy
I know there are alternatives now and I'm curious to see how they go, but Firebase is still an excellent, well fleshed-out system for serverless programming. With a few clicks and a few pre-built functions you can get going with authentication, file storage, and a NoSQL database. You can even store collections (like a table in the SQL world) inside of documents (like a row in the SQL world).

I'll be making more React-Firebase projects in the coming weeks so will talk more then about how I got them to work and dive deeper into the code. For now, feel free to peruse my Github repo for this one and by all means watch the tutorial! This CleverProgrammer tutorial is one of the best I've seen, and it's up to date and fun, which are priceless :)
How to Run Cypress Test Cases “10” times Faster in Parallel In CI/CD
Published: 2021-03-03 07:22:00

A) Run Cypress Test case in Parallel in CI/CD
B) How to record cypress tests in the cypress dashboard
C) Store test screenshots and videos as CircleCI artifacts


Part 2 : https://www.youtube.com/watch?v=Rjm9IH4F41c&t=76s
Part 1 https://youtu.be/eHcDBJaFLWk​

https://kailash-pathak.medium.com/how-to-run-cypress-test-cases-10-times-faster-with-parallelization-490a7eec22b0?source=your_stories_page-------------------------------------
Nevertheless, Sirani McNeill Coded in 2021
Tags: theycoded
Published: 2021-03-03 07:17:35

---
title: Nevertheless, Sirani McNeill Coded in 2021
published: true
tags: theycoded
---

<!-- ✨This template is only meant to get your ideas going, so please change/add/remove these prompts as you wish! We also encourage you to create your own title if you’d like! ✨ -->

## My most recent achievement was…

## Advocating for myself looks like…

## My biggest goal is…

## My advice for allies to support underrepresented folks who code is...

<!-- Once your post is published, it will not appear on the /t/theycoded page until an admin approves it. This is an extra step to ensure there is no abuse on this important tag. -->