teleren/devto huggingface dataset:
Pytorch reading for starters in Machine Learning
Tags: machinelearning, python
Published: 2020-06-23 16:42:35

https://medium.com/@gbadhanane/pytorch-linear-regression-model-to-predict-life-tendency-of-people-with-heart-failure-clinical-e79274ede624?source=friends_link&sk=4fe7efd7cc21c4e9a7232b7ee71e5d9e


Please let me know what you think, applaud, and share. Thanks!
Boomerang International Educational Services
Published: 2020-06-23 16:42:22

BIES Provides consultation and support services to International students who want to study in Australia.
 We recommend a suitable College/University based on Students grades, needs, budget and preferred City. We hold events to welcome students when they arrive in Australia. We provide ongoing support, after Students arrive in Australia.  BIES Provides support to Universities & Colleges based in Australia and overseas who wish to market their services to overseas markets and attract students to study at their institution. For more detail visit at: https://www.studysouthaustralia.com.au
Using yarn v2 berry with create-react-app
Tags: react, tutorial, javascript, yarn
Published: 2020-06-23 16:23:22

Today I decided to try out the new yarn berry version (v2) with create-react-app and couldn't find any material to get started, so I hope this guide will help you if you are planning to use the new yarn version with CRA :).
This shows how to get started with a new app but you can follow the same steps with an already existing app.

_You will need to install yarn if it's not yet installed on your machine. `npm install -g yarn`_

### Creating the app

First, let's create a create-react-app application with typescript (typescript is optional).

```sh
npx create-react-app my-app --template typescript
cd my-app
```

### Migrating to yarn berry

Yarn berry no longer uses the node_modules folder so we need to delete it. To read more about this, take a look at yarn documentation regarding [Plug'n'Play
](https://yarnpkg.com/features/pnp)

```sh
rm -rf node_modules
```

We need to tell yarn that we want to use berry for this project.

```sh
yarn set version berry
```

Now let's install our dependencies with the new yarn version.

```sh
yarn install
```

After this step, you will notice that a new `.yarn` folder and `.yarnrc.yml` file were created. To see more information on the role of every folder, take a look at [this issue](https://github.com/yarnpkg/berry/issues/454#issuecomment-530312089).

We don't want to commit the yarn cache files, let's add the following lines to our `.gitignore` file.

```
.yarn/*
!.yarn/releases
!.yarn/plugins
.pnp.*
```

That's it, yarn berry is now configured for our project. Run `yarn start` to start the app in development mode. Open http://localhost:3000 to view it in the browser.

You should see the following screenshot 🎉.

![Create react app](https://dev-to-uploads.s3.amazonaws.com/i/h4t9fxvfyucqtkvaznvs.png)

You might notice that VSCode (or other editors) does not resolve the third party dependencies typescript types (such as react). In order to setup your editor follow the [yarn documentation](https://yarnpkg.com/advanced/editor-sdks).
Javascript map, filter and reduce visually explained
Tags: javascript
Published: 2020-06-23 16:16:26

![alt text][image]

[image]:https://i.redd.it/yf7rw3pjiapx.jpg "Javascript functions easily explained"

I found this and I think it's extremely useful for understanding each of these functions. 
And of course, is very funny :D

Write down your thoughts and comments.

Source: [link](https://i.redd.it/yf7rw3pjiapx.jpg)
The Case for Test Cases: How Unit Testing Saved my A**
Tags: testing
Published: 2020-06-23 16:15:44

Most developers know that they should write tests, yet few do. This article outlines a very specific scenario I was in recently where my tests came to my rescue, which demonstrates why test are so important.

## Setting the Stage

I was put in charge of rewriting some legacy code to improve performance, reliability, visibility, etc. It was a scheduling system that triggered events at specific times that were defined by the users of the system, and they needed to be repeated at set intervals. The intervals were very dynamic and could be daily, weekly, monthly, on a set day of the month, on certain days of the week, and the kicker is that the users’ time zone needed to be considered. This meant that if they expected it at 1pm, the offset needed to be factored into the recalculation of when that event should fire next.

The rewrite went mostly well. Some bugs to iron out, but what new code doesn’t have those? Nothing major, until a very specific event in the system needed to be fired in a specific time zone. This is where our story really begins.

## The Ticket

I get a call on my day off stating that a specific event is firing over and over again and would not stop. And to top it all off, the user is aware when these events fire, so I can only imagine how annoying this must have been. We disabled those events to prevent the user from getting spammed, but there was work to be done.

I traced the bug to a very specific function that is used by EVERY EVENT that gets processed by the system. It was the function that calculates the next time that each event in the system needed to fire next. It was good that the source was discovered very quickly, but now it needed to be fixed, and any incorrect calculation could cause A LOT of records to get recalculated incorrectly, potentially resulting in an even bigger issue.

## The Saving Grace, My Tests

When I started this rewrite, the first thing I did I take a TDD approach, which means I wrote unit tests before I wrote much (if any) production code. Along the way, I would fix any tests that broke and at the end of the rewrite, and a pretty comprehensive test suite that covered most of the system.

Because of this, I could actually write a test case to simulate the bug and see it and debug it while I was ironing out the issue. Also, I could see if any of the existing tests broke along the way. This provided not only a way for me to test the function without affecting production data, but a means to fix the bug with the confidence that the events that DID work will continue working. 

The end result of course is that the bug was fixed (along with several other that were uncovered during my testing), the user was happy, the other users were not affected, and this was all done confidently and quickly.

> If you enjoy this content, feel free to support me on [YouTube](https://www.youtube.com/channel/UCLx9EihBDfoJMncRWSZZoXg) or visit my website [brianmorrison.me](https://brianmorrison.me) for regular coding tutorials & exercises.

# Do you practice TDD? If not, what holds you back? Comment below 👇
What's the best way to render specific items from a Rails collection? 
Tags: help, rails, ruby
Published: 2020-06-23 16:11:34

---
title: What's the best way to render specific items from a Rails collection? 
published: true
description: A quick Rails views question for picking and choosing objects.
tags: 
- help
- rails
- ruby
//cover_image: https://direct_url_to_image.jpg
---

Hi!  I've got a small Rails app where I'm going to have a small number (<200) of rows in a database.  When I display them, order is going to important to me (making a menu, so I'd like to be able to control which item goes where).

I imagine that querying the database for each individual item as I come to it is not efficient.  So I believe what I probably want to do is get all of them and pass them to the view and have the view decide where they should go.

I'd like to be able to do something like this:

```erb
<h2>Summer Drinks</h2>

<%= @cocktails["Margarita"] %>

<!-- Or even better yet: -->

<%= cocktail "Margarita" %>
```

I know that I could have the controller map over the records and store them in a hash by name, pass that hash to the view, and subsequently write a helper function to provide the syntactical sugar.  But, is there an easier, Railsier way to do it?  It feels like there should be, but my searching hasn't turned up anything.

If it helps, I've got a unique index on the Name column of the Cocktails table.

Additionally, I don't plan to add/update cocktails (think 1-2 database changes/week).  I could lean pretty heavily on caching/precompiling if that's a factor in the solution.

Thank you!
Jekyll Tip: Use the --host option on your local site to access it from any device on your network
Tags: jekyllrb, blog, tutorial
Published: 2020-06-23 15:56:31

The command `jekyll server`, by default, binds to `127.0.0.1`, as you can see in the following logs.

```sh
$ jekyll serve
[...]
Server address: http://127.0.0.1:4000/
Server running... press ctrl-c to stop.
```

This means that the website is only accessible by the device that you are running the command.

To make the website accessible by other devices on the same network, run `jekyll serve --host=0.0.0.0`. 

```sh
$ jekyll serve --host=0.0.0.0
[...]
Server address: http://0.0.0.0:4000/
Server running... press ctrl-c to stop. 
```

This will make the Jekyll blog accessible by the IP address of your machine, and thus accessible by other devices on the same network.

A neat command that you can use to find the IP address of your machine is the following:

```sh
ifconfig en0 | grep "inet " | awk '{print $2}'
```

This will output your IP on the Terminal in the format `192.168.0.XXX`. 

Type this IP followed by `:4000` on your favorite browser and you will be able to now browse your blog from the mobile device!! :rocket:
Open Production-ready Web Projects
Tags: awesome, list, open, webdev
Published: 2020-06-23 15:13:51

Last week, I just discovered that Dev.to source is available on Github and the codebase is huge! 

{% tweet  1273801164530671616 %}

That day, I spent my whole evening skimming through the source code and its comprehensive docs prepared by the team. I launched the project on my machine using Docker Compose in a few minutes. It's super easy to set up.

From reading the source code, I've learned how people in a big project is deployed, what each of the background jobs does, how they do caching, how they build/rebuild and update Elasticsearch indexes, etc. I also learned how the team coordinates on what features to work on systematically. It's not something that you can simply learn from tutorials or courses.

# Launching a new Awesome list

Today, **I present to you, [Open Production-ready Web Projects List](https://open-web-projects.netlify.app)**. I have compiled a list of web projects that are:

- In use in production
- The source is available as Open source
- Can be deployed locally/on-prem
- Ready to use (zero development required)
- Preferrably offered as SaaS service as well

The intention of this list is to show how real-world projects look like. I have grouped the projects by programming languages and frameworks they are built on. If you are using the same stacks as theirs, you can learn from them on how they organize and structure the code.

I am pretty sure you can learn a ton as I did from reading their code!

# Contributing

I really appreciate it if any of you could submit a [Pull Request](https://github.com/sdil/open-production-web-projects) to this newly created list. I really hope to see this list grow bigger!
What is Nullish Coalescing? - JavaScript Tutorial
Tags: javascript, tutorial, webdev, codenewbie
Published: 2020-06-23 14:59:47

Learn more about this new logical operator nearing to become standard for JavaScript that's used in many other languages! 

Check out the proposal here: 
https://github.com/tc39/proposal-nullish-coalescing

If you'd like to see more of my videos, [head over to Youtube!](https://www.youtube.com/channel/UCWaB4SBBUCvhYb91fz5Vidg) 

For more content, stay tuned! A follow/sub comes a long way to show support 

Follow and connect with me on:
----------------------------------
🐦 Twitter: https://twitter.com/coderarchive
📚 Github: https://github.com/luvuong-le
💼 LinkedIn: https://www.linkedin.com/in/lu-vuongle/
📷 Instagram: https://www.instagram.com/coderarchive/
📝 Dev.to: https://dev.to/coderarchive
Facebook Messenger Video/Voice Chat
Published: 2020-06-23 14:47:49

Hello, I have built some WebRTC Applications before, which did not even worked on Iphone 5s (IOS 11.x.x), and as I am aware FB Messenger uses React Native which also has webrtc implementation there, so it won't work on older phones as well as i think, but as i tested Messenger even worked on Iphone 4s and i bet it would work on iphone 4 as well. how do they achieve this? whats the technology they are using?
Daily Challenge #261 - Diagonal Strings
Tags: challenge
Published: 2020-06-23 14:27:46

---
title: Daily Challenge #261 - Diagonal Strings
published: true
series: Daily Challenge
description: You have a string array has N elements and each element of array has N length(NxN).
tags: challenge
//cover_image: https://direct_url_to_image.jpg
---
In this challenge, you'll be given an array of strings with N elements and each element has N length. 

First, sort the given array alphabetically. Your output will consist of letters obtained diagonally (from top left to bottom right). Collect the new string, then change the order and obtain a new string. Repeat this process until you have as many strings as was originally given in the array. 

**Example:**
```
  1234                       Abcd                           
  aBcd                       kAta                           
  kaTa                       qwEr                           
  qweR -> 1234 => "1btr"     1234 -> abcd => "aae4"         

  Kata                       Qwer
  qWer                       1234
  1234                       abCd
  abcD -> kata => "kw3d"     katA -> qwer => "q2ca"

  Output : {"aae4","kw3d","1btr","q2ca"} (by input order)
```

**Tests:**
`string[] { "1a8er", "B36jh", "AiYe3", "B1t0a", "g47uj" };`
`string[] { "ab", "12" };`

Good luck!
***
_This [challenge](https://www.codewars.com/kata/5c6d80d7ff00de2dcc4d4188) comes from frkn2076 on CodeWars. Thank you to [CodeWars](<https://codewars.com/>), who has licensed redistribution of this challenge under the [2-Clause BSD License](<https://opensource.org/licenses/BSD-2-Clause>)!_

_Want to propose a challenge idea for a future post?  Email **yo+challenge@dev.to** with your suggestions!_
Voices of the Elephant Podcast Episode - My Technology Journey, PHP, Opensource, Java
Tags: php, opensource, java
Published: 2020-06-23 14:25:01

---
title: Voices of the Elephant Podcast Episode - My Technology Journey, PHP, Opensource, Java
published: true
description: 
tags: php, opensource, java
---
I am excited to have been hosted on the Voices of the Elephant podcast by [Cal Evans](https://blog.calevans.com/) 

https://voicesoftheelephpant.com/2020/06/23/interview-with-stephen-s-musoke/

Talking about my technology journey, opensource, Java, PHP (of course) and what I am doing with it in Uganda and Africa
Implementation logic of Rails Params Perimited
Tags: ruby, sourcecode
Published: 2020-06-23 14:14:32

---
title: Implementation logic of Rails Params Perimited
published: true
description: 
tags: Ruby, Sourcecode
---
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/ba11n6opuevgcqmqj1u1.jpg)

In Rails `Controller#action`, get the parameters passed by the user to the server, and store in the DB there will be a special operation `params.require(:product).permit(:name,:desc)`

#### Why need to call the `permit` method

Imagine a scenario where you want to develop an api interface for receiving json data returned by a third party and creating it in a database.

```ruby
params= {user:{nickname: 'mixbo', email: 'lb563@foxmail.com', admin:true}}

class UsersController < ApplicationController
  def	create
    @user = User.create params[:user]
  end
end
```

As you can see from the above code, the `params` sent from the third-party interface includes a field `admin` This is a very dangerous operation.

And permit is to mark some allowed fields and check whether the permitted flag is included before saving to the database.



#### Implementation of Params#permit

The specific implementation is placed in the `ActiveSupport::StrongParameter` module

```ruby
module ActionController
  class Parameters
    def permit(*filters)
      params = self.class.new
      #..bala bala
      params.permit!
    end

    def permit!
      each_pair do |key, value|
        Array.wrap(value).each do |v|
          v.permit! if v.respond_to? :permit!
        end
      end
      @permitted = true
      self
    end

    def permitted?
      @permitted
    end
  end
end
```

You can see from the code above. when calling the `permit!` method on the `params` object. will set the `@permitted` of the params object to true

Before `params` is saved to the database, `active_record` will first check whether the parameters in `params` are approved by `permit`. The relevant source code is as follows:

```ruby
def sanitize_for_mass_assignment(attributes)
  if attributes.respond_to?(:permitted?)
    raise ActiveModel::ForbiddenAttributesError if !attributes.permitted?
    attributes.to_h
  else
    attributes
  end
end
```

The attributes passed to the `sanitize_for_mass_assignment` method are `params` objects. The method will first determine whether `params` exists in the permitted? method. 

If the `params` object can respond to the `permitted?` method, the `to_h` method is called.



Hope it can help you :)
Facing Unknown Encoding Error
Tags: javascript, node, help, webdev
Published: 2020-06-23 14:12:37

I am facing following error.
""TypeError [ERR_UNKNOWN_ENCODING]: Unknown encoding: /{%PRODUCTNAME%}/g""

Following is My Code:

//Server
const http=require('http');
const fs=require('fs');
const url=require('url');


const replaceTemplate=(temp,product)=>{
    var output=temp.toString(/{%PRODUCTNAME%}/g,product.productName).replace();
    output=output.replace(/{%IMAGE%}/g,product.image);
    output=output.replace(/{%PRICE%}/g,product.price);
    output=output.replace(/{%FROM%}/g,product.from);
    output=output.replace(/{%QUANTITY %}/g,product.quantity);
    output=output.replace(/{%DESCRIPTION%}/g,product.description);
    output=output.replace(/{%NUTRIENTS%}/g,product.nutrients);
    output=output.replace(/{%ID%}/g,product.id);

    if(!product.organic)output=output.replace(/{%NOT ORGANICR%}/g,'not organic');
        return output;
}


const tempOverview=fs.readFileSync('./templates/overview.html');
const tempCard=fs.readFileSync('./templates/template-cart.html');
const tempProduct=fs.readFileSync('./templates/product.html');

const data=fs.readFileSync('./dev-data/data.json');
const dataObj=JSON.parse(data);


const server= http.createServer((req,res) => {

const pathName=req.url;
if(pathName==='/' || pathName=='/overview'){
    //Overview Page
    res.writeHead(200, {'Content-Type':'text/html'});
    const cardHtml =dataObj.map(el =>replaceTemplate(tempCard,el));
    console.log(cardHtml);

    res.end(tempOverview);
}
//Product Page
else if(pathName=='/product'){
    
    res.end('This Is Product Path');
}
   //API Page
else if(pathName=='/api'){
 
fs.readFile('./dev-data/data.json',(err,data)=>{
    if(err){
        console.log('Error Occured')
    }
            //Not Found Page
    else{

        const productData=JSON.parse(data)
        res.end(data);
    }
})

}




else{
  res.writeHead(404,{
      'Content-Type':'text/html',

  });
  res.end('<h1>Page Not Found</h1>');
}




   

})
server.listen(8000,'127.0.0.1',()=>{
    console.log('Server Is Started');
})
Jual Obat Aborsi Jogja 082146239353 Obat Aborsi Cytotec Asli Di Jogja
Tags: obat, aborsi, jogja, jual
Published: 2020-06-23 14:01:36

Obat Aborsi Jogja, Jual Obat Aborsi Jogja, Obat Aborsi Jogja Asli, Obat Penggugur Kandungan Jogja, Obat Pelancar Haid Jogja.

SOLUSI aborsi Tanpa Resiko DAN adalah EFEK Samping
> BISA dilakukan Sendiri Tanpa Bantuan orang lain
> Tanpa kuret Langsung Bersih
> BISA Hamil Kembali
Cytotec Obat Aborsi Ampuh Merupakan Solusi Tepat Cara Mengagurkan Kandungan Paling Aman Sampai Tuntas Tanpa Efek Samping Karena Obat Abori Ini Resep Ampuh Dan Manjur. Cytotec Ini Adalah Obat Abori yang sudah banyak digunakan di berbagai negara besar di eropa, afrika dan negara besar lainnya. Produk yang dikenal dengan misoprospol ini (Cytotec, Arthotec, Oxaprost, Cyprostol, Mibetec, Prostokos dan Misoprostol Cytotec). Langkah aborsi menggunakan obat memiliki tingakatan Sukses lebih dari 97%. Bagi Anda yang berdomisili di negara asia yang tidak di sediakan akses obat aborsi untuk menggugukan keseimbangan. Kamu semua bisa mengakses situs jualcytotecampuh.com ini untuk membeli obat tersebut. yang pastinya kami berkenan untuk menopang dan keselamatan demi langkah dalam menggugukan kandungan dengan obat misoprostol cytotec.
Kami memberitakan dengan membantah Obat Misoprostol dalam aksi (menentang, dengan cara cara obat ini berkerja, serta cara cara akurat dalam mengonsumsi obat ini). Dengan informasi ini kami rangkup sesuai penelitian dari WHO (Organisasi Kesehatan di Dunia).
nama, alamat, apotik, apotek, yang, jual, penjual, jualan, obat, aborsi, penggugur, gugurkan, menggugurkan, hujanin, keguguran, isi, penggugur hubungan, janin, hamil, cyan, isi , tempat aborsi, klinik aborsi, klinik kuret, hamil, alamat, toko, toko obat, pengedar, tempat, wilayah, daerah, tanpa, resep, dari, ada, adakah, dokter, bidan, rumah, sakit, alamat, mifeprex, obat bius herbal, selai, pil, tablet, klinik, tradisional, dukun, pijat, herbal, telat, terlambat, bulan, cara, cari, cari, aman, bukti, pengiriman, berhasil, bergaransi, garansi, di jamin, terjamin, paling, area, pesanan, resmi, yang menjual, gelap, peluntur, mana, bisa, penjualan, dimana, dapatkan, lokasi, spesialis, dokter aborsi, klinik, aborsi, tuntas, cari, daerah, tempat aborsi, obat aborsi, chopas, terap 1 satu bulan,2 dua bulan, 3 tiga bulan, 4 bulan, untuk, kuret, kiret, beli, bagus, ampuh, manjur, baik, daerah, terbaik, beli, murah, termurah, legal, ilegal, dokter persediaan, artikel, transaksi, asli cara, aman, berhasil, aman, berhasil, bergaransi, jaminan, toko, peluntur, wilayah, mana, bisa, penjualan, dimana, mendapatkan spesialis, dokter aborsi, klinik aborsi, tuntas, cari, daerah, klinik aborsi, resep, keuangan, untuk, kuret, beli, ampuh, manjur, bagus, daerah, terbaik, murah, mudah, murah, persediaan dokter, anthrai, terbaik, murah, mudah, murah, resep dokter mencari-pakai, pakai, asli, asli, palsu, orisinil, mengaborsi, harga, di mana,
Pemesanan Cara:
TLP / WA / SMS: 082146239353