teleren/devto huggingface dataset:
I have deployed my facebook clone on heroku and netlify
Tags: showdev, node, react, socketio
Published: 2021-05-20 05:48:05

### Hello Community If you are reading this post definitely you had seen my previous post where i have shown my facebook clone project 

{% link harshmangalam/i-have-created-facebook-clone-in-mern-stack-4agn %}

I have deployed Nodejs and Mongodb backend on heroku and mongodb cloud.
And frontend has successfully deployed on netlify.

Media related to post image and profile image has deployed on firebase.

### I have taken some screen shot while visiting to this site

#### dark mode

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


#### light mode
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/edvd300cwbmoltvk564m.png)


#### Auth screen

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


### netlify live


[Visit Demo](https://facebook-harsh.netlify.app)
Core Programming principles in R
Tags: rprogramming, datascience, beginners
Published: 2021-05-20 05:19:45

Hello everyone, let us dive into the basics of R programming:
Before getting started with R, download the necessary files like R Studio and R. But don't worry because I already wrote a blog on how to install R on macOS and Windows. The link to the blog is mentioned below:
https://dev.to/ruthvikraja_mv/installing-r-studio-on-mac-59hc
The following topics are covered in this article:

1.Types of variables.
2.Logical variables and operators.
3.Conditional and loop statements.

The R code for the above concepts are as follows:
```python
######################## SECTION 1 ###########################
# To execute code use -> command + return[Shortcut] in MAC
# integer
# In R Programming for assigning value to a variable the following symbol is used:
 # <- [Which denotes an arrow] but “=” also works for assigning value to a variable.
## Types of Variables
x<-2L # By default x would be double if we store 2 in it so, L is used to denote an integer type
typeof(x) # Used to check the type of an object
# double
y<-2.5
typeof(y)
# complex
z<-3+2i
typeof(z)
# character
a<-”h”
typeof(a)
# logical
q<-TRUE #(OR) q<-T
typeof(q)
 
## Using Variables
A<-10
B<-5
C<-A+B
C # To print object C
# variable 1 → Comments
var1<-2.5
var2<-4
result<-var1/var2
result
sqrt(var2) # Inbuilt function
greeting <-”Hello”
typeof(greeting)
 # OR #
class(greeting)
name<-”Bob”
message<-paste(greeting, name)
message
“Hello” + “Bob” # This throws an error whereas in Python it works -> print(“Hello”+”Bob”)
 
# Execute:
# Logical Operators:
4<5
100>10
4==5
4!=5
5<=5
5>=5
# NOT Operator -> !
# OR Operator -> |
# AND Operator -> &
# isTRUE()
# To find the remainder the following command is used in R:
5%%4 # Not 5%4 as we do in Python
result <- !TRUE
result
isTRUE(result)
# while loop
while(TRUE){print(“Hello”)} # In python identation is used whereas in R curly brackets are used
# for loop
for(i in 1:5){
 print(“Hello R”)
 }
# Here i is an iterator and prints “Hello R” for 5 times
# Here 1:5 represents a vector of numbers
# Execute the following codes:
1:5
for(i in 5:10){
 print(i)
}
# if statement
# Let us generate one random normalized number:
x<-rnorm(1) # Since, it is a normalized number the mean is 1 and standard deviation is 0
if(x>1){
 answer<-”Greater than 1"
}else{
 if(x>=-1){
 answer<-”Between -1 and 1"
 }
 else{
 answer<=”Less than -1"
 }
}
# The above structure is a nested if structure
# Now let us implement else if:
if(x>1){
 answer<-”Greater than 1"
}else if(x>=-1){ # In python we use elif() for else if()
 answer<-”Between -1 and 1"
 }else{
 answer<=”Less than -1"
}
# To remove a variable the following command is used:
rm(answer)
```
Thank you, for spending your time on my post. Follow me for more updates on R.

#The next post will be on Fundamentals of R[Section 2]

Happy coding…
PcapPlusPlus v21.05 Released!
Tags: cpp, networking, opensource
Published: 2021-05-20 05:00:55

After almost 9 months since the previous release, I'm excited to announce a new release of PcapPlusPlus: [v21.05](https://github.com/seladb/PcapPlusPlus/releases/tag/v21.05) :tada::tada:

For those who are not familiar with the project: [PcapPlusPlus](https://pcapplusplus.github.io/) is an open source project. It's a multi-platform C++ library for capturing, parsing and crafting of network packets. It is designed to be efficient, powerful and easy to use.

[PcapPlusPlus](https://pcapplusplus.github.io/) enables decoding and forging capabilities for a large variety of network protocols. It also provides easy to use C++ wrappers for the most popular packet processing engines such as libpcap, WinPcap, Npcap, DPDK and PF_RING.

If you like the project please support it by giving it a [GitHub star](https://github.com/seladb/PcapPlusPlus/stargazers):star::star2::star:

Here is are some interesting additions included in this release:
- Official [Android support](https://pcapplusplus.github.io/docs/quickstart/android)
- [TLS fingerprinting](https://pcapplusplus.github.io/docs/features#tls-fingerprinting) based on [JA3](https://engineering.salesforce.com/tls-fingerprinting-with-ja3-and-ja3s-247362855967)
- TLS 1.3 parsing
- Apple silicon M1 support 
- New protocol support:
 - SSH (parsing only)
 - IP Sec (AH + ESP, parsing only)
 - DNS over TCP
- Significant size reduction of compiled libraries
- UDP multicast support
- Tons of bug fixes and enhancements


Feel free to reach out to me for any question or suggestion you might have. You can open a [GitHub issue](https://github.com/seladb/PcapPlusPlus/issues), post on [PcapPlusPlus Google Group](https://groups.google.com/d/forum/pcapplusplus-support) or shoot me an email to pcapplusplus@gmail.com
Dark UI mode of google
Published: 2021-05-20 04:47:39

Google Search and some other google's products and websites have an option of dark mode now. Hey wow what a great thing.

So, will web designers and developers have an easy api or smth (not just by google) to continue websites experience in the same mode that was clicked? That would be alright.

There is a dark mode in browsers, in OS itself, in apps and websites. Now it's needed to have it easy and as the one, in a single tap. 

Read more: https://bit.ly/3vzRoUg
Laravel 8 QR Code Generate Tutorial

Tags: laravel, php, tutorial, programming
Published: 2021-05-20 04:44:19

Hi Dev,

Today,I will learn you how engender QR Code in laravel 8 we will show QR Code engenderer example in laravel 8.I will engenderer QR Code useing simplesoftwareio/simple-qrcode package in laravel 8. laravel 8 QR Code engenderer example. in this tutorial, i would relish to show you how to engender or engender QR Code in laravel 8 utilizing simplesoftwareio/simple-qrcode package.

Utilizing this simplesoftwareio/simple-qrcode package, you can engender simple qr code, qr code, image qr code, text qr code in laravel 8 app. As well as, you can send this qr codes in mail and text message.

In this tutorial, i will utilize simplesoftwareio/simple-qrcode package to engender simple, text, numeric and image qr code in laravel 8 app.

more..

if you want to see full example follow this link..

https://codingtracker.blogspot.com/2021/05/laravel-8-qr-code-generate-tutorial.html
Node.js : Determining the line count of a text file
Tags: node, programming, webdev, javascript
Published: 2021-05-20 04:19:29

Create a new file as app.js and paste below code -

app.js
```javascript
const readline = require('readline');
const fs = require('fs');
var file = 'path.to.file';
var linesCount = 0;
var rl = readline.createInterface({
 input: fs.createReadStream(file),
 output: process.stdout,
 terminal: false
});
rl.on('line', function (line) {
 linesCount++; // on each linebreak, add +1 to 'linesCount'
});
rl.on('close', function () {
 console.log(linesCount); // print the result when the 'close' event is called
});
```

Run below command -
```
node app.js
```

You will get the line count of text file.

<a href="https://www.buymeacoffee.com/rkycom" 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>

With all that being said, I highly recommend you keep learning!

Thank you for reading this article. Please feel free to connect with me on [LinkedIn](https://www.linkedin.com/in/www-rajeshkumaryadav-com/) and [Twitter](https://twitter.com/rky_com).
How to Safely Downgrade from PHP 7.4 to PHP 7.3 on Ubuntu 20 LTS
Tags: ubuntu, php74, php73, devops
Published: 2021-05-20 04:03:33

Good Day Pare, In this tutorial, I'll teach you how to downgrade your PHP 7.4 to PHP 7.3 on your Ubuntu 20.04 LTS safely. For this, we will use different commands such sudo, apt-get, a2dismod, and a2endmond which we will explain along the road.

This tutorial can be use for downgrading your PHP 7.3 to PHP 7.2 and so on and so forth.

Visit the full tutorial here:
[https://letscodepare.com/blog/how-to-safely-downgrade-from-php-74-to-php-73-on-ubuntu-20-lts](https://letscodepare.com/blog/how-to-safely-downgrade-from-php-74-to-php-73-on-ubuntu-20-lts)
Creating Deno Scripts Like Node NPM Scripts
Published: 2021-05-20 03:33:29

One of the greatest features of NodeJS is the package.json file. The file not only tracks dependencies but also allows us to easily create scripts as easy as writing some JSON.

```json
"scripts": {
  "start": "NODE_ENV=development PORT=5000 node server.js",
  "dev":"NODE_ENV=development PORT=5000 nodemon server.js"
}
```

So instead of typing those long commands you could instead say `npm start` or `npm run dev`. This allowed very verbose commands to be easy to use.

Deno JS, the newer Rust based secure Javscript runtime that provides first class support for typescript is great and offers lots of benefits:

- Being in written in Rust, it's super fast
- Having first class support for Typescript makes working with Typescript easier than ever.
- By defaulting to as little access to hardware as possible you don't have to worry about unexpected scripts messing with your files, running processes or using you network in unexpected ways.

That catch... verbose commands.

So I want to run a file that can use env variables, run shell commands and use the internet... the command would be...

`deno run --allow-net --allow-run --allow-env index.ts`

You could just use the --allow-all flag, but then you lose the security deno offers. In a situation like this, an NPM Scripts like tool would be great but unfortunately there isn't one.

Options:

1. You could use shell scripts, but of course there is differences between scripts for PowerShell or Bash.

2. You could use other languages to write scripts, but still just another thing other people who use your code have to install.

3. You could use a library, but seems like overkill to bring a whole library for a few basic commands.

**Solution:**

Here is a template I made for a basic scripts file. Has more of a python "manage.py" feel, but still better than nothing.

```ts
// command | deno run --allow-run scripts.ts <script> |

// save the script name in a variable
const scriptName = Deno.args[0]

// create a variable to hold the child process
let p;

// switch statement for each possible script
switch (scriptName) {

  case "start":
    // run a command
    p = Deno.run({ cmd: ["deno", "run", "file.ts"] });
    // process output when it completes
    await p.status()
    break;


  case "dev":
    p = Deno.run({
      cmd: ["deno", "run", "--allow-all", "./file.ts"],
    });
    await p.status()    
    break;

  // default output if not a script you made  
  default:
    console.log("No Script by that name");
}
```

In this case, you'd just run `deno run --allow-run scripts.ts start` to run the start script. Still fairly verbose and maybe in the future a better built-in option will exist.
5/19 TIL: gqlgen: go graphql lib
Published: 2021-05-20 03:07:32

- go mod init command creates a go.mod file to track our code's dependencies
    - go mod init {module path} ex. github.com/{username}/gqlgen-todos
- gqlgen
    - after installing gqlgen,  doing a `go run (http://github.com/99designs/gqlgen) init` will create a graphql structure based on the suggested package layout
    - schema is defined in schema.graphql
    - doing `gqlgen generate` compares the schema files with the models and bind wherever it can directly to the model
    - implement a field in Resolver.go to track our state and add logic to the resolver methods
    - go run server.go to start
- https://gqlgen.com/getting-started/
Talmudic Gems For Rails Developers
Tags: programming, rails, mentoring, community
Published: 2021-05-20 10:53:48

---
title: Talmudic Gems For Rails Developers
published: true
date: 2021-05-20 01:40:59 UTC
tags: programming, rails, mentoring, community
canonical_url: https://blog.yechiel.me/talmudic-gems-for-rails-developers-77f6cb98c9ad
cover_image: https://cdn-images-1.medium.com/max/1024/0*AyhczZpRbRsXYvwP
---

A few weeks ago, I gave a talk at RailsConf titled Talmudic Gems For Rails Developers.

In the talk I discussed lessons I learned from a lifetime of Talmudic study that helped me in my journey as a developer, and which I felt could benefit other developers in their growth.

The talk is geared at any developer looking to grow using the timeless wisdom of the Talmudic sages, not just Rails developers.

I shared a transcript of the talk in the Torah && Tech newsletter [issue #123](https://mailchi.mp/2bc93e8bd182/torah-tech-issue-6751637?e=bb66b91b8e) (if you haven’t yet, you can sign up to the newsletter, and get the first year’s worth of newsletters in book format, at the Torah && Tech website: [torahandtech.dev](https://torahandtech.dev/)).

The talk has just been posted to YouTube, and I’m happy to share it with my audience!

{% youtube d08GFQDT824 %}

If you would like to delve into some of the sources I mentioned, you can find links in the source sheet I prepared [here](https://gist.github.com/achasveachas/000e4e08e193140e372cd4819d025f4a).

Happy Learning!

* * *
TIL Chromebook Linux Launcher Creation
Tags: todayilearned, gamedev, godot, shelf
Published: 2021-05-20 01:23:32

2021-05-19

Previously I set my Chromebook to run Godot but I didn't like opening terminal to run it and would rather have a pinned icon to launch Godot. Debian Packages installed from Chrome's Files have such shortcuts created automatically but [AppImages](https://appimage.org/) don't. To make a launcher for an AppImage, it's necessary to make a .desktop file and place it in a specific folder.

One way to make a .desktop file is to open the Text app and write the descriptions by hand.
```
[Desktop Entry]
Name=Godot
Comment=Great Game Engine
Exec=/home/goldenxp/apps/godot33
Icon=/home/goldenxp/icons/godot-icon.png
Type=Application
Categories=Development;Graphics;Game
```
There are [other options](https://specifications.freedesktop.org/desktop-entry-spec/desktop-entry-spec-latest.html) one can take advantage of like keywords and terminal display, etc.

When you're satisfied, you need to save the file in a specific location so that it's picked up by the Chrome OS Launcher. Read [here](https://chromium.googlesource.com/chromiumos/platform2/+/master/vm_tools/garcon/README.md) for some info on this. The location I'm going to use is `~/.local/share/applications/`. It's hidden by default so when you want to save it, you'll need to show hidden files.
![Show Hidden Files in Chrome's Files App](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5i097y6n15dnsssrw7a2.png)
Once you save it, it should take a couple of seconds for it to show up in the Launcher. Now you can click to launch and even pin the app to the shelf.

![Resulting icon showing up in Linux Apps](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/h4gokyaure02zvoef93r.png)

Note: I've noticed that some .desktop edits don't register updates in Chrome. The workaround is to delete the .desktop file and remake it.
LeetCode 1283. Find the Smallest Divisor Given a Threshold (javascript solution)

Tags: algorithms, javascript
Published: 2021-05-20 00:15:14

###Description:

Given an array of integers nums and an integer threshold, we will choose a positive integer divisor, divide all the array by it, and sum the division's result. Find the smallest divisor such that the result mentioned above is less than or equal to threshold.

Each result of the division is rounded to the nearest integer greater than or equal to that element. (For example: 7/3 = 3 and 10/2 = 5).

It is guaranteed that there will be an answer.

###Solution:
Time Complexity : O(nlog(n))
Space Complexity: O(1)

```javascript
// Binary search
var smallestDivisor = function(nums, threshold) {
    // Add result of each item in nums divied by mid to sum and check if sum <= threshold
    function checkCondition(mid){
        let sum = 0
        for(const num of nums) {
            sum+=Math.ceil(num/mid)
        }
        return sum <= threshold
    }
    // Lowest possible number can be 1 and the highest number can be the max of nums
    let left = 1, right = Math.max(...nums) 
    // Binary search template
    while(left < right) {
        const mid = left + Math.floor((right-left)/2)
        if(checkCondition(mid)) right = mid
        else left = mid+1
    }
    return left
};
```
Rails find_each/ find_in_batches pitfalls
Tags: rails, activerecord
Published: 2021-05-17 12:27:33

Every rails-developer knows about method `find_each` or `find_in_batches` (if you check the implementation for the first one you find that it uses the second one under the hood) from **ActiveRecord**. Even more, it is a good practice to use these methods when you need to iterate throw a big amount of records in DB.
If you don't familiar with it you can check this https://apidock.com/rails/ActiveRecord/Batches/find_each.

Looks like, we always can/must use `find_each` instead of `each` when we need to iterate throw some bunch of records. We also thought this way. But one of our applications struggled with DB: load for DB was around 95%, it was obvious that DB is a bottleneck.

I'd started to analyze slow-query logs in MySQL and reports in NewRelic. It was quite simple to find the place in the code which produce this SQL query:
```ruby
 Survey.select(:id, :offer_uuid).active.where(provider: provider).where.not(survey_id: current_surveys).find_in_batches(batch_size: 10) do |survey_batch|
  DeactivateSurveysService.perform(survey_batch, provider)
end
```
Because of using `where.not` MySQL should fetch all records in order to sort them by id (this sorting used in `find_each/find_in_batches`) and only after this takes 10 records - it can very slow if a scope of the records is big how we had.

***CONCLUSION***

It is good practice using `find_each`/`find_in_batches` in order to not consume a lot of memory but need to be aware of what resulting SQL is.
You have a better laptop than your users
Tags: webdev, testing, qa, a11y
Published: 2021-05-23 06:05:54

---
title: You have a better laptop than your users
published: true
date: 2021-05-20 00:00:00 UTC
tags: webdev, testing, qa, a11y, accessibility
canonical_url: https://thomasxbanks.com/articles/you-have-a-better-laptop-than-your-user/
cover_image: https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6786swff8mtkbkm86uqx.jpeg
---

I have a fairly decent laptop provided by my employer and I'm lucky enough to have a strong, reliable internet connection. Not everyone does. I'll say that again for the Bro's at the back:

> Not all of your users will have a top-spec device and good wifi like you do.

In the past I've been guilty of assuming that everyone has a comparable experience to myself.

**This leads to Bad Habits™️.**

## How to be better

Optimise for performance over appearance. Basically, don't make someone download 5Gb of images and 500Mb of JavaScript just to read your Terms & Conditions page.

Test on spotty wifi. Try using the site on a train or in a coffee shop or using the City's free wifi (if you have it where you are). This is how your user will experience your site - not via 100Gb Ethernet cables.

Test on budget devices - find a few common mid-priced devices (you could probably get them from [eBay](https://www.ebay.co.uk/sch/i.html?_from=R40&_trksid=p2334524.m570.l1313&_nkw=iphone+7&_sacat=0&LH_TitleDesc=0&_osacat=0&_odkw=iphone+7)) and test on those instead.

If you're feeling extra spicy - make sure at least one of those devices has a cracked screen for a truly authentic browsing experience 😜
Custom Model Field Validator - Django
Tags: django, python, database
Published: 2021-08-09 13:56:34

---
title: Custom Model Field Validator - Django
published: true
date: 2021-05-20 00:00:00 UTC
tags: django, python, database
canonical_url: https://tech.serhatteker.com/post/2021-05/custom-model-field-validator/
---

Django has it's built-in [validators] which you can use, however if you want to write your own custom validation:

```python
# models.py
from django.core.exceptions import ValidationError
from django.db import models
from django.utils.translation import gettext_lazy as _

def validate_positive(value):
    if value < 0:
        raise ValidationError(
            _("%(value)s is not positive."),
            params={"value": value}
        )


class Book(models.Model):
    author = models.ForeignKey(Author, on_delete=models.CASCADE)
    title = models.CharField(max_length=120)
    price = models.DecimalField(validators=[validate_positive])

```

With `validate_positive` **validator** we ensure that **price** is always positive.

> **NOTE**
>
> **validators** *param* always must be a **list**, even though there is *one* validator.

By the way you don't need to use `gettext_lazy` but it's a good habit for **i18n**.



All done!




[validators]: https://docs.djangoproject.com/en/3.2/ref/validators/
Cross-functional teams aren't the only valid option
Tags: agile, processes, team, teamstructure
Published: 2021-05-23 19:56:42

---
title: Cross-functional teams aren't the only valid option
published: true
date: 2021-05-20 00:00:00 UTC
tags: agile,processes,team,teamstructure
canonical_url: https://jhall.io/archive/2021/05/20/cross-functional-teams-arent-the-only-valid-option/
---

The idea of the cross-functional team gets a lot of attention in the Agile and Scrum media. And it _is_ a great idea.

As the thinking goes, if a piece of functionality requires, say, both front-end and back-end work, it’s easier to have all that work being done on one team, rather than trying to coordinate across two (or more) teams. And this is often true.

But it can, and often is, taken too far.

Remember the _reason_ for cross-functional teams: To eliminate bottlenecks to providing customer value.

If you depend on some other team for a piece of functionality, but _they are not a bottleneck_, then you will gain nothing by embedding them within your team—and may lose a lot!

* * *
_If you enjoyed this message, [subscribe](https://jhall.io/daily) to <u>The Daily Commit</u> to get future messages to your inbox._
CodePen - CSS Illustration (Animation)
Tags: codepen, css, html, webdev
Published: 2021-05-19 23:38:17

CSS illustration that I have been working on for several days. I hope you enjoy it and find it useful in some way.
I used SVG for some elements, such as gears, but it can be edited if you need it. I also used GSAP to create the BLOB effect in the background. For the rest of the elements, I only used CSS.

{% codepen https://codepen.io/Astap/pen/yLgvGYp %}