teleren/devto huggingface dataset:
Eager Loading with Selected Columns in Laravel
Tags: laravel, php, mysql
Published: 2021-04-10 18:44:47

Let's say we have a case where we have a blog and each blog has authors and we need all author's name with each blog so what we are going to do is:

Blog::with('author')->get()
Now, in this case, we only need the author's name only rather than the full data of the author's table right? so what we can do:

Blog::with(['author' => function($query) {
	return $query->select(['id', 'name']);
}])->get();

https://techvblogs.com/blog/laravel-eager-loading-with-selected-columns
How to Use Bootstrap in Your Vue.js Apps
Tags: bootstrap, vue, javascript
Published: 2021-04-10 18:40:47

Vue.js is a popular front-end framework for building Single Page Apps. It provides structure and abstraction. We can also create a server-side rendering application using Vue.js, It's help for SEO ( Search Engine Optimization ). Bootstrap is a free and Open Source CSS Framework. With Bootstrap we can create a responsive and mobile-friendly web application and it's very easy to design a web application.

The Bootstrap-Vue project has done most of the heavy lifting of replacing jQuery with Vue by implementing Bootstrap features as Vue components.

In this blog, we learn about using bootstrap-vue with vue.js.

https://techvblogs.com/blog/how-to-use-bootstrap-in-your-vuejs-apps
Eloquent ORM (Object Relational Mapping) in Laravel
Tags: laravel, php, mysql, webdev
Published: 2021-04-10 18:38:56

 Laravel is a free, open-source PHP framework, created by Taylor Otwell. It follows a Model-View-Controller (MVC) design pattern. Laravel reuses the existing components of different frameworks which helps to create a perfect and outstanding web application. If you are familiar with PHP, Advance PHP it will make your task easier. Laravel is secure and prevents web attacks using their CSRF (Cross-site Request Forgery) protection.

Eloquent ORM is very useful for web development. It's very helpful for database operations like Create, Update, Delete, and any other operations. With Eloquent ORM you don't need to execute a query like PHP for create, update, delete, etc. Also, With Eloquent ORM we can fetch relational data with an easy method, Just we need to add some functions, and then It fetches records from a database like Pro. In this blog, we will cover some topics about Eloquent ORM.

https://techvblogs.com/blog/eloquent-orm-laravel
Running multiple instances of the Firebase Emulator
Tags: firebase, testing
Published: 2021-04-10 18:37:29

When doing local development using the [Firebase Emulator](https://firebase.google.com/docs/emulator-suite), it might be useful to run multiple instances of the emulator.

For example, I like to keep one instance of the emulator running for interactive development and another one for running my automated tests in the background.

You can run another instance of the emulator by passing a different configuration file using the `--config` file:

```sh
firebase emulators:exec --project testing --config="./firebase.test.json" 'jest'
```

Then, make sure to change the default ports in your `firebase.test.json` file:

```json
{
  "emulators": {
    "auth": {
      "port": 9098
    },
    "functions": {
      "port": 5002
    },
    "firestore": {
      "port": 8081
    },
    "database": {
      "port": 9001
    },
    "pubsub": {
      "port": 8086
    },
    "ui": {
      "enabled": true,
      "port": 4001
    }
}
```

That will allow you to run two instances of the Firebase Emulator at the same time.

---

[Follow me on Twitter](https://twitter.com/ceolinwill)
My own extension
Tags: addon, extension, showdev
Published: 2021-04-10 06:26:29

# My own extension
**Check out the extension:**
[Firefox Users](https://addons.mozilla.org/en-US/firefox/addon/nord-web-theme/)
[Chromium Browser users](https://microsoftedge.microsoft.com/addons/detail/pcaeblapppplaeiahlilfekiclnlphch)
[Github](github.com/nord-web-themes/Nord-Web-themes)

## The first release
I was using the Nord windows theme and saw the amazing community behind it. I wanted to add something to it, something never seen before. My idea was a chrome extension which would make websites more or less like Nord.

## The idea
I was really board , and i wanted to make something. So i decided to make nord web themes. I really liked the nord theme too and though many other would love it!

## The changes 
I have learned a lot ! I fixed a lot of issues and added a list of new websites, nevertheless , I really got board over the past weeks. I don't think i'll continue this project, since i am a web developer. I like to seek for challenges myself but making this extension isn't that easy. I'm doing what i want , not what people want.

## Why am i leaving ? 
Over the past years i want from a nord lover, to a nord hater. I just learned that looks don't matter. I wanted to focus on what i do, but, I was less productive. I always wanted to check for the new updates and such. I would understand that many are not like me , but i think it was for the better :)
Caching the Firebase Emulator on GitHub Actions
Tags: firebase, github, testing
Published: 2021-04-10 18:31:50

When testing your [Firebase](https://firebase.google.com/) application, you need to download the Firebase Emulator. Fortunately, [firebase-tools](https://github.com/firebase/firebase-tools) does that automatically for you.

However, when running your tests on a continuous integration environment such as [GitHub Actions](https://github.com/features/actions), you'll see the following warning:

```
It appears you are running in a CI environment. You can avoid downloading the Pub/Sub Emulator repeatedly by caching the /home/runner/.cache/firebase/emulators directory.
```

This means, `firebase-tools` is downloading the Emulator binary every time you run your CI pipeline. You can avoid this by caching the emulator instead:

```yml
jobs:
  test:
    runs-on: ubuntu-latest
    env: FIREBASE_EMULATORS_PATH: ${{ github.workspace }}/emulator-cache

    steps:
      - name: Cache firebase emulators
        uses: actions/cache@v2
        with:
          path: ${{ env.FIREBASE_EMULATORS_PATH }}
          key:
            ${{ runner.os }}-firebase-emulators-${{
            hashFiles('emulator-cache/**') }}
        continue-on-error: true
```

The step above will cache the emulator on GitHub Actions. The next time you run your tests, Firebase won't download the emulator again (unless the binary changed).

---

[Follow me on Twitter](https://twitter.com/ceolinwill)
Build REST API with Laravel
Tags: laravel, php, restapi, mysql
Published: 2021-04-10 18:30:49

With the rise of Mobile Development and JavaScript frameworks, using a RESTful API is the best option to build a single interface between your data and your client.

PHP has been the most popular web language in the present times by being simple to maintain, and quick to create feature-rich web applications. Websites that are dynamic, interactive, secure, and efficient need a powerful toolset to create and consume APIs.

In this article, you will learn how to build a modern RESTful API in Laravel.

Now let's look at building a PHP RESTful API with Laravel.

https://techvblogs.com/blog/build-rest-api-with-laravel
Como adicionar chave SSH no Github 

Tags: github, git, ssh
Published: 2021-04-10 18:20:21

1\. Instalar cliente SSH
```shell
$ sudo apt-get install openssh-client
```

2\. Gerar chave SSH 

```shell
$ ssh-keygen 
```

3\. Acesse seu perfil do Github e abra a página de gerenciamento de chaves SSH. O caminho para a página gerenciamentos de chaves SSH é **Settings/SSH and GPG keys**. Você também pode acessar a página pelo [link](https://github.com/settings/keys).
![image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/4dn14e0lh8cc9yrh5l9f.png)
 

4\. Adicione a chave SSH key, através do botão **_New SSH key_**. Para adicionar a chave basta informar um título para a chave, o título é útil para ajudar identificar a chave, no meu caso eu escolhi "PC trabalho" como título, depois de informar o título cole a chave geradas nos passos 2 e 3 no campo key e clique em **Add SSH key**.
![image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2fhmsgtbv5w1ebvgujca.png)
 

5\. Apos acionar o botão de **Add SSH key** o Github solicitara confirmação de senha, informe sua senha e pronto sua chave SSH foi adicionada. <br/>
Para verificar se sua chave foi gerada basta acessar a tela de gerenciamento de chaves SSH e GPG ([Settings/SSH and GPG keys](https://github.com/settings/keys)).
![image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/4r2mc1lo1o9iw9be26e2.png)
Sentiment Analysis on ANY Length of Text With Transformers (Python)
Published: 2021-04-10 18:15:22

{% youtube yDGo9z_RlnE %}

The de-facto standard in many natural language processing (NLP) tasks nowadays is to use a transformer. Text generation? Transformer. Question-and-answering? Transformer. Language classification? Transformer!

However, one of the problems with many of these models (a problem that is not just restricted to transformer models)  is that we cannot process long pieces of text.

Almost every article I write on Medium contains 1000+ words, which, when tokenized for a transformer model like BERT, will produce 1000+ tokens. BERT (and many other transformer models) will consume 512 tokens max - truncating anything beyond this length.

Although I think you may struggle to find value in processing my Medium articles, the same applies to many useful data sources - like news articles or Reddit posts.

We will take a look at how we can work around this limitation. In this article, we will find the sentiment for long posts from the /r/investing subreddit. This video will cover:

```
High-Level Approach
Getting Started
- Data
- Initialization
Tokenization
Preparing The Chunks
- Split
- CLS and SEP
- Padding
- Reshaping For BERT
Making Predictions
```
Simple Vue.js Pagination Example with Laravel
Tags: laravel, vue, bootstrap, javascript
Published: 2021-04-10 17:56:59

Pagination is a method for dividing content into several pages and creating appropriate layouts for a better and more organized presentation. Pagination is an essential requirement for blogs, websites that wish their front-pages to be sufficiently little to stack but then sufficiently showcase the most important posts. In this case, Laravel pagination or Vue pagination is a perfect choice for developers.

Components are one of the most powerful features of Vue. They help you extend basic HTML elements to encapsulate reusable code. At a high level, components are custom elements that Vue’s compiler attaches behavior to.

https://techvblogs.com/blog/laravel-vuejs-pagination-example
MLOPs Lifecycles
Tags: machinelearning, devops, datascience, deeplearning
Published: 2021-04-10 17:52:34

MLOPs life cycle 🔃 ⤵

- Define business need 

- Getting datasets ready. This phase includes data cleaning, labelling, pixel optimisation, open source datasets and enterprise data-lakes

- Model development (code part) 

- Training and optimisations of model 

- Deployment(uat/prod) 

- User interface and API development to let user interact with the model 

- Monitoring both model and system resources

- Insights and analytics

+ Continuous model training: deployed one time model can work for few time-frames and hence it needs retraining on new data 
+ world has changed. We use CI/CD tools like Jenkins and Docker/cubectl for code automation 

+ Security and protection of ML model against known vulnerability. This is the point most people ignore

-Thanks
How to send an email with Node.js
Tags: node, javascript, webdev
Published: 2021-04-10 17:52:28

Nodejs is a server-side javascript runtime environment built on the chrome v8 engine. It allows developers to use javascript on the server-side.

Nodejs is cross-platform. It is available for Windows, Linux, and Mac. As a part of this tutorial, Ubuntu 20.04 and Nodejs 14.15.0 versions are used to code and send mail.

In this tutorial, you'll learn how to send emails with HTML content and attachments using the nodemailer module, as well as set up Mailtrap, a fake SMTP server, for testing your code.

https://techvblogs.com/blog/send-email-with-nodejs
Build Crud App with Laravel and Vue.js
Tags: laravel, vue, bootstrap, javascript
Published: 2021-04-10 17:44:21

In this Laravel Vue.js Crud Example, You will learn how to implement Laravel Vue.js crud (create, read, update, and delete) spa (Single Page Application) with Vue.js, Vue Router, and Laravel Framework.

In today's, the most popular JS frameworks are Angular JS and Vue JS. Angular JS and Vue JS are very user-friendly JS frameworks and most popular. It provides to manage the whole project or application without refresh page and powerful jquery validation.

Vue comes pre-packaged with Laravel (along with Laravel Mix, an excellent build tool based on webpack) and allows developers to start building complex single-page applications without worrying about transpilers, code packaging, source maps, or any other 'dirty' aspects of modern frontend development.

https://techvblogs.com/blog/build-crud-app-with-laravel-and-vuejs
What's React.js (For Absolute Beginners)?
Tags: react, javascript, webdev, programming
Published: 2021-04-10 17:35:58

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

Hello. I know that you've stumbled upon the term "React" hella lot of times so I'm here to explain that to you assuming you know nothing about React. 

React is a JavaScript library to build UI. All web applications have a frontend (UI/anything that you can see).

### The Traditional Way to Build UI
Use HTML (for page structure), CSS (for styling) and JavaScript (for interactive behaviors).

### One Major Problem
To make complex functionalities/interactive behaviors such as converting kilogram (kg) to gram (g) using JavaScript, we need to manipulate the DOM element which can be difficult and needs us to write more code which can pollute the codebase.   

### What Will Happen If I Use React?
You will write way less code and you don't need to manipulate the DOM directly. The whole idea of React is to provide an abstraction over the DOM so you can focus on end product without unnecessary complexity.

### Any Other Cool Stuffs About React?
A whole lot. 
* Fast (thanks to virtual DOM)
* Has super large community
* Ease of learning (because it's not a framework or complete solution, but just a library)
* You can write HTML inside React components using something called JSX expressions (JavaScript XML) so there is no need for a HTML file
* etc.

### Example React Code
```javascript
import React from 'react';

function delete(props) {
  return (
    <div>
      <h1>Hello, world!</h1>
    </div>
  );
}

export default delete;
```
Learn by Doing: Practice PHP OOP (level 3)
Tags: php, laravel, beginners, tutorial
Published: 2021-04-10 17:33:43

---
title: Learn by Doing: Practice PHP OOP (level 3)
published: true
description: 
tags: php, laravel, beginner, tutorial
cover_image: https://dev-to-uploads.s3.amazonaws.com/i/iczmzu0j54ngchvwoeho.png
series: Python OOP
---

If you like this post and want more connect with me on Twitter: <a href="https://twitter.com/justericchapman?ref_src=twsrc%5Etfw" class="twitter-follow-button" data-show-count="false">Follow @justericchapman</a><script async src="https://platform.twitter.com/widgets.js" charset="utf-8"></script>

You want to learn PHP OOP for a long time but you keep postponing? Now is the time! For the next 30 days I will post php OOP exercises + solution.

Your challenge is to try to solve the small exercise without looking at the solution. You can use the web to search for concept but please dont look at the solution before at least try to solve the exercise.

We will start very easy but don't be bored because exercises will quickly became more and more challenging....

Challenge accepted?

<h1>Exercise #5</h1>
In exercise #4 we created a class with a constructor using property promotion: 
```php
<?php
class Product 
{
    public function __construct(private $name, private $description, private $price) 
    {
    }
}
```
Today your challenge is to create a getter and setter to modify the name property. 

Hint: Getter and Setter are 2 methods:

The getter method is a method that get (return) the object instance property value. 

The setter method is setting the current instance property value to a new supply value.

Let's do it!

<h1>Exercise #6</h1>
A quick one: When setting the property name. Make sure that the name first letter is Uppercase.

<h1>Solution:</h1>

<h1>STOP... Do the exercises first! It's the only way you will really learn.</h1>

If you have done your exercise here my solution. Noted most of the times, more than one solution will be possible. If you have something different that me, leave your solution in the comment to share and discuss.

<h3>Exercise 5 solution:</h3>
```php
class Product
{
    public function __construct(private $name, private $description, private $price) 
    {

    }

    public function setName($name){
        $this->name = $name;
    }

    public function getName(){
        return $this->name;
    }
}
```

<h3>Exercise 6 solution:</h3>
```php
public function setName($name){
    $this->name = ucfirst($name);
}
```

<h1>Conclusion</h1>
That's it for today. Tomorrow the journey continue, see you later! 

If you want to be contribute you can re-tweet this post on tweeter 
<a href="https://twitter.com/justericchapman?ref_src=twsrc%5Etfw" class="twitter-follow-button" data-show-count="false">Follow @justericchapman</a><script async src="https://platform.twitter.com/widgets.js" charset="utf-8">
Angular 6 ElasticSearch example – Documents Pagination with Scroll
Tags: angular, elasticsearch, pagination
Published: 2021-04-10 17:24:14

https://ozenero.com/angular-6-elasticsearch-example-documents-pagination-with-scroll

In the <a href="https://ozenero.com/elasticsearch/angular-6-elasticsearch-example-get-all-documents-in-index">post</a>, we had known how to get All Documents in Index. This Angular 6 Elasticsearch tutorial shows you way to do pagination with <code>scroll</code>.

Next: <a href="https://ozenero.com/elasticsearch/angular-6-elasticsearch-example-simple-full-text-search">Angular 6 ElasticSearch example – simple Full Text Search</a>

Elasticsearch Tutorials:
- <a href="https://ozenero.com/elasticsearch">Elasticsearch Overview</a>
- <a href="https://ozenero.com/elasticsearch/elasticsearch-filter-vs-query-context-overview">ElasticSearch Filter vs Query</a>
- <a href="https://ozenero.com/elasticsearch/elasticsearch-full-text-query-basic-queries">ElasticSearch Full Text Queries – Basic</a>

<!--more-->
<h2>Elasticsearch Documents Pagination with Scroll</h2>
<h3>Add ElasticSearch to Angular 6 Project</h3>
Please visit <a href="https://ozenero.com/frontend/angular/angular-6-elasticsearch-example-quick-start-how-to-add-elasticsearch-js">Angular 6 ElasticSearch – Quick Start – How to add Elasticsearch.js</a> for details.

With the post, you will know how to:
- Add ElasticSearch to Angular 6 Project
- Use it in the project
<h3>Add Document & Get All Documents in Index</h3>
- Add Document:
>> Please visit <a href="https://ozenero.com/elasticsearch/angular-6-elasticsearch-example-add-document-to-index">Angular 6 ElasticSearch example – Add Document to Index</a>.

<img src="https://ozenero.com/wp-content/uploads/2018/08/angular-6-elasticsearch-example-add-document-to-index-add-document.png" alt="angular-6-elasticsearch-example-add-document-to-index-add-document" width="397" height="628" class="alignnone size-full wp-image-14185" />

- Get All Documents:
>> Please visit <a href="https://ozenero.com/elasticsearch/angular-6-elasticsearch-example-get-all-documents-in-index">Angular 6 ElasticSearch example – Get All Documents in Index</a>.

<img src="https://ozenero.com/wp-content/uploads/2018/08/angular-6-elasticsearch-example-show-documents-in-index-result.png" alt="angular-6-elasticsearch-example-show-documents-in-index-result" width="419" height="609" class="alignnone size-full wp-image-14228" />
<h3>Get All Documents in Index with Scroll</h3>
<h4>Search with Scroll Param</h4>
More at:

https://ozenero.com/angular-6-elasticsearch-example-documents-pagination-with-scroll
Acting Lessons for Scala Engineers With Akka and Zio
Tags: scala, akka, zio
Published: 2021-04-10 21:15:49

---
title: Acting Lessons for Scala Engineers With Akka and Zio
published: true
date: 2021-04-10 17:20:09 UTC
tags: scala,akka,zio
canonical_url: https://www.softinio.com/post/acting-lessons-for-scala-engineers-with-akka-and-zio/
---

![Acting Lessons for Scala Engineers With Akka and Zio By Salar Rahmanian](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/kzftysthwt6zuy5kufiu.jpg)

In November 2020 I had the great privilege to do a [Talk at Scale By The Bay Conference](https://scalebythebay2020.sched.com/event/e54O/acting-lessons-for-scala-engineers-with-akka-and-zio).

### Here is the recording of my talk

{% youtube AQXBlbkf9wc %}

### I also wrote three blogs posts as a companion to my talk

[Introduction to the Actor Model](https://www.softinio.com/post/introduction-to-the-actor-model/)

[Introduction to Akka Typed Using Scala](https://www.softinio.com/post/introduction-to-akka-typed-using-scala/)

[Introduction to Zio Actors](https://www.softinio.com/post/introduction-to-zio-actors/)
bash relative pathing for writing files
Published: 2021-04-10 17:10:46

---
title: bash relative pathing for writing files 
published: true
description: 
tags: 
//cover_image: https://direct_url_to_image.jpg
---

Say you have a process that needs to run and writes it logs relative to where it runs.

As a tiny example here is a python program that writes a file using a relative path (the filename is /tmp/cool.py)

```python
outf = open("./dbg.txt","w")
outf.write("hey\n")
outf.close()
```

If you want to invoke that process from BASH then you have to be careful.

The file dbg.txt will be written relative to your working directory.

So in the example below the dbg.txt file is written in your home directory.

```
agcc@LAPTOP-BT02BD1T:~$ pwd
/home/agcc
agcc@LAPTOP-BT02BD1T:~$ python /tmp/cool.py
agcc@LAPTOP-BT02BD1T:~$ ls dbg.txt
dbg.txt
```

That is probably not what you wanted to do. More than likely you needed to change your working directory and then run the python script.

A really great tool to do that is subshell. In BASH that is parens around the commands.

Below I run the set of commands in a subshell. In the new subshell I change to a different directory and execute the python script then verify the file is present. I also printed my working directory. 

Finally I executed an ls in my top shell (no longer in a subshell) and there is no file written in that directory.

```
agcc@LAPTOP-BT02BD1T:~$ (cd /tmp && python cool.py && ls dbg.txt && pwd)
dbg.txt
/tmp
agcc@LAPTOP-BT02BD1T:~$ pwd
/home/agcc
agcc@LAPTOP-BT02BD1T:~$ ls dbg.txt
ls: cannot access 'dbg.txt': No such file or directory
```