teleren/devto huggingface dataset:
Laravel clear cache without using artisan command
Tags: laravel, artisan, php, beginners
Published: 2021-05-16 12:31:57

In this tutorial, we are going to learn how to clear route cache, laravel application cache, config cache in a Laravel 8 application using with out artisan command-line interface.

## routes/web.php
```php
// clear route cache
Route::get('/clear-route-cache', function () {
    Artisan::call('route:cache');
    return 'Routes cache has clear successfully !';
});

//clear config cache
Route::get('/clear-config-cache', function () {
    Artisan::call('config:cache');
    return 'Config cache has clear successfully !';
});

// clear application cache
Route::get('/clear-app-cache', function () {
    Artisan::call('cache:clear');
    return 'Application cache has clear successfully!';
});

// clear view cache
Route::get('/clear-view-cache', function () {
    Artisan::call('view:clear');
    return 'View cache has clear successfully!';
});
```
[Read more...](https://larainfo.com/blogs/laravel-clear-cache-without-artisan)
Node.js Extract MongoDB Data to Excel(.xlsx) File – using exceljs
Tags: node, excel, exceljs, mongodb
Published: 2021-05-16 12:26:49

https://grokonez.com/node-js/node-js-extract-mongodb-data-to-excel-xlsx-file-using-exceljs

Node.js Extract MongoDB Data to Excel(.xlsx) File – using exceljs

In the tutorial, Grokonez shows how to extract data from MongoDB to Excel(.xlsx) File with Node.js using <code>exceljs</code> lib.

<!--more-->
<h2>Technologies</h2>
<ul>
<li>Node.js</li>
<li>MongDB</li>
<li>exceljs</li>
</ul>
<h2>Goal</h2>
– We create a Node.js project as below structure:

<img src="https://grokonez.com/wp-content/uploads/2019/03/Nodejs-export-mongodb-data-to-excel-file-using-exceljs-project-structure.png" alt="Nodejs-export-mongodb-data-to-excel-file---using-exceljs---project-structure" width="593" height="163" class="alignnone size-full wp-image-17230" />

– MongoDB Data:

<img src="https://grokonez.com/wp-content/uploads/2019/03/nodejs-export-mongodb-data-to-csv-file-mongodb-records-1.png" alt="nodejs-export-mongodb-data-to-csv-file---mongodb-records" width="600" height="99" class="alignnone size-full wp-image-17231" />

<pre><code class="language-javascript">
{"_id":1,"name":"Jack Smith","address":"Massachusetts","age":23}
{"_id":2,"name":"Adam Johnson","address":"New York","age":27}
{"_id":3,"name":"Katherin Carter","address":"Washington DC","age":26}
{"_id":4,"name":"Jack London","address":"Nevada","age":33}
{"_id":5,"name":"Jason Bourne","address":"California","age":36}
</code></pre>

– Excel File:

<img src="https://grokonez.com/wp-content/uploads/2019/03/Nodejs-export-mongodb-data-to-excel-file-using-exceljs-results.png" alt="Nodejs-export-mongodb-data-to-excel-file---using-exceljs---results" width="650" height="158" class="alignnone size-full wp-image-17232" />
<h2>Practice</h2>
<h3>Install MongoDB & Exceljs</h3>
Init <code>package.json</code> file by cmd: <code>npm init</code> -> Then install <code>mongodb</code> & <code>exceljs</code> libs:

<pre><code class="language-javascript">
$npm install --save mongodb
$npm install --save exceljs
</code></pre>

-> <code>package.json</code> file:

More at:
https://grokonez.com/node-js/node-js-extract-mongodb-data-to-excel-xlsx-file-using-exceljs

Node.js Extract MongoDB Data to Excel(.xlsx) File – using exceljs
Why I Moved To Sidekick Browser
Tags: productivity, privacy
Published: 2021-05-16 12:15:24

# 1.Can Search Instantly
You can instantly Bring A search bar, it'll search from history, bookmarks, Web apps you stored, Contacts and documents  
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7x7m3jqpxk4zlcy9ur2p.png)

#2.Can Pin web apps and can access them anytime and anywhere
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/fva7fea80mfy9ztf5hhd.png)
Why use Tabs when you can use web apps directly
In this you can directly work in apps instead of tabs and the side bar which clears the clutter can save time from switching tabs and make work more efficient.

#3.Switch Between accounts
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/giz6ubl41cp5sdlgeyz4.png)
You can instantly switch between diff accounts and save alot of time, and also can control notification of web app.

#4.Collaboration
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/feihr51mkfxqe7mczksk.png)
Set up new team members with every app, bookmark, and credential before they open their browser. Every work tool they need is right at their fingertips.

#5.Inbuilt adblocker and Tracker Blocker
Sidekick doesn’t have an ad-based business model, so we can block ads and trackers without compromise.

#6.AI Based Tab suspension and improved ram management
Sidekick saves memory by automatically suspending tabs that you don't need at the moment.

#7.Create workflows 
you can create workflows and workspaces for various roles in your team and easily manage them.

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

##Check it out
Download [click](https://www.meetsidekick.com/)
Create A Dictionary App using Django and BeautifulSoup
Tags: django, python, html
Published: 2021-05-16 12:04:24

Welcome Back, 
After a long time again putting a new blog. In this blog, I am going to create a 'Dictionary Website' where user can type a **Word** and can get the **meaning** of the Word.
{% youtube r5kgXFGwb_Q %}
Here is the Source Code for this Project:-
1.) views.py
```python
from django.shortcuts import render
from django.http import HttpResponse, HttpResponseRedirect

from bs4 import BeautifulSoup
import requests



# Create your views here.
def home(request):
	if request.method == "POST":
		word = request.POST['word']
		url = 'https://www.dictionary.com/browse/'+word
		r = requests.get(url)
		data = r.content
		soup = BeautifulSoup(data, 'html.parser')
		span = soup.find_all('span', {"class": "one-click-content"})

		param = {'text': span[0].text, 'word': word}
		return render(request, 'index.html', param)
	else:
		return render(request, 'index.html')
```

2.) urls.py
```python
from django.urls import path
from . import views

urlpatterns = [
	path('', views.home, name='home'),
]
```
3.) Index.html
```html
<!doctype html>
<html lang="en">
  <head>
    <!-- Required meta tags -->
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">

    <!-- Bootstrap CSS -->
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.1/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-+0n0xVW2eSR5OomGNYDnhzAbDsOXxcvSN1TPprVMTNDbiYZCxYbOOl7+AMvyTG2x" crossorigin="anonymous">

    <title>Django Dictionary</title>
  </head>
  <body style="background-color: black;">

    <div class="container w-50 my-3">
    <div class="container btn btn-primary">
    	<h1>Dictionary App</h1>
    </div>
    <br><br><br>
    <div class="mb-3">
    	<form action="{% url 'home' %}" method="post">
    		{% csrf_token %}
  			<input type="text" class="form-control" name="word" id="exampleFormControlInput1" placeholder="Search Word..."><br>
  			<input type="submit" name="" class="btn btn-success" value="Search">
  		</form>
	</div>
	<hr>
	<h4 class="text-danger">{{word}}</h4>
	<h5 class="text-info">{{text}}</h5>
	</div>


    

    <!-- Option 1: Bootstrap Bundle with Popper -->
    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.1/dist/js/bootstrap.bundle.min.js" integrity="sha384-gtEjrD/SeCtmISkJkNUaaKMoLD0//ElJ19smozuHV6z3Iehds+3Ulb9Bn9Plx0x4" crossorigin="anonymous"></script>

  </body>
</html>
```

ANY PROBLEM?
Comment Down...

Thank You.
Node.js Extract MongoDB Data to CSV File – using Json2Csv
Tags: node, csv, mongodb, json2csv
Published: 2021-05-16 12:03:48

https://grokonez.com/node-js/node-js-extract-mongodb-data-to-csv-file-using-json2csv

Node.js Extract MongoDB Data to CSV File – using Json2Csv

In the tutorial, Grokonez shows how to extract data from MongoDB to CSV File with Node.js using <code>Json2Csv</code> lib.

<!--more-->
<h2>Technologies</h2>
<ul>
<li>Node.js</li>
<li>MySQL</li>
<li>json2csv</li>
</ul>
<h2>Goal</h2>
– We create a Node.js project as below structure:

<img src="https://grokonez.com/wp-content/uploads/2019/03/nodejs-export-mongodb-data-to-csv-file-project-structure.png" alt="nodejs-export-mongodb-data-to-csv-file---project-structure" width="599" height="149" class="alignnone size-full wp-image-17220" />

– MongoDB Data:

<img src="https://grokonez.com/wp-content/uploads/2019/03/nodejs-export-mongodb-data-to-csv-file-mongodb-records.png" alt="nodejs-export-mongodb-data-to-csv-file---mongodb-records" width="600" height="99" class="alignnone size-full wp-image-17221" />

<pre><code class="language-json">
{"_id":1,"name":"Jack Smith","address":"Massachusetts","age":23}
{"_id":2,"name":"Adam Johnson","address":"New York","age":27}
{"_id":3,"name":"Katherin Carter","address":"Washington DC","age":26}
{"_id":4,"name":"Jack London","address":"Nevada","age":33}
{"_id":5,"name":"Jason Bourne","address":"California","age":36}
</code></pre>

– CSV File:

<pre><code class="language-json">
"_id","address","age","name"
1,"Jack Smith",23,"Massachusetts"
2,"Adam Johnson",27,"New York"
3,"Katherin Carter",26,"Washington DC"
4,"Jack London",33,"Nevada"
5,"Jason Bourne",36,"California"
</code></pre>
<h2>Practice</h2>
<h3>Install MongoDB & Json2CSV</h3>
Init <code>package.json</code> file by cmd: <code>npm init</code> -> Then install <code>mongodb</code> & <code>json2csv</code> libs:

More at:
https://grokonez.com/node-js/node-js-extract-mongodb-data-to-csv-file-using-json2csv

Node.js Extract MongoDB Data to CSV File – using Json2Csv
nodejs,json2csv,csv,mysql
Published: 2021-05-16 12:00:08

https://grokonez.com/node-js/node-js-extract-mysql-data-to-csv-file-using-json2csv

Node.js Extract MySQL Data to CSV File – using Json2Csv

<!-- wp:paragraph -->
<p>In the tutorial, Grokonez shows how to extract data from MySQL to CSV File with Node.js using <code>Json2Csv</code> lib.</p>
<!-- /wp:paragraph -->

<!-- wp:html -->
<!--more-->
<!-- /wp:html -->

<!-- wp:heading {"level":3} -->
<h2>Technologies</h2>
<!-- /wp:heading -->

<!-- wp:list -->
<ul><li>Node.js</li><li>MySQL</li><li>json2csv</li></ul>
<!-- /wp:list -->

<!-- wp:heading {"level":3} -->
<h2>Goal</h2>
<!-- /wp:heading -->

<!-- wp:paragraph -->
<p>– We create a Node.js project as below structure:</p>
<!-- /wp:paragraph -->

<!-- wp:image {"id":17169} -->
<figure class="wp-block-image"><img src="https://grokonez.com/wp-content/uploads/2019/03/nodejs-export-mysql-data-to-csv-file-using-json-2-csv-project-structure.png" alt="nodejs-export-mysql-data-to-csv-file-using-json-2-csv-project-structure" class="wp-image-17169"/></figure>
<!-- /wp:image -->

<!-- wp:paragraph -->
<p>– MySQL Data:</p>
<!-- /wp:paragraph -->

<!-- wp:image {"id":17170} -->
<figure class="wp-block-image"><img src="https://grokonez.com/wp-content/uploads/2019/03/nodejs-export-mysql-data-to-csv-file-using-json-2-csv-mysql-records.png" alt="nodejs-export-mysql-data-to-csv-file-using-json-2-csv-mysql-records" class="wp-image-17170"/></figure>
<!-- /wp:image -->

<!-- wp:paragraph -->
<p>- CSV File:</p>
<!-- /wp:paragraph -->

<!-- wp:html -->
<pre><code class="language-javascript">"id","address","age","name"
1,"Jack Smith",23,"Massachusetts"
2,"Adam Johnson",27,"New York"
3,"Katherin Carter",26,"Washington DC"
4,"Jack London",33,"Nevada"
5,"Jason Bourne",36,"California"
</code></pre>
<!-- /wp:html -->

<!-- wp:heading {"level":3} -->
<h2>Practice</h2>

More at:

https://grokonez.com/node-js/node-js-extract-mysql-data-to-csv-file-using-json2csv

Node.js Extract MySQL Data to CSV File – using Json2Csv
Daily Developer Jokes - Sunday, May 16, 2021
Tags: jokes, dailydeveloperjokes
Published: 2021-05-16 12:00:03

---
title: "Daily Developer Jokes - Sunday, May 16, 2021"
description: "Check out today's daily developer joke! (a project by Fred Adams at xtrp.io)"
series: "Daily Developer Jokes"
cover_image: "https://private.xtrp.io/projects/DailyDeveloperJokes/thumbnail_generator/?date=Sunday%2C%20May%2016%2C%202021"
published: true
tags: #jokes, #dailydeveloperjokes
---

Generated by Daily Developer Jokes, a project by [Fred Adams](https://xtrp.io/) ([@xtrp](https://dev.to/xtrp) on DEV)

___Read about Daily Developer Jokes on [this blog post](https://xtrp.io/blog/2020/01/12/daily-jokes-bot-release/), and check out the [Daily Developer Jokes Website](https://dailydeveloperjokes.github.io/).___
### Today's Joke is...
![Joke Image](https://private.xtrp.io/projects/DailyDeveloperJokes/public_image_server/images/5e12597fe0374.png)

---
*Have a joke idea for a future post? Email ___[xtrp@xtrp.io](mailto:xtrp@xtrp.io)___ with your suggestions!*

*This joke comes from [Dad-Jokes GitHub Repo by Wes Bos](https://github.com/wesbos/dad-jokes) (thank you!), whose owner has given me permission to use this joke with credit.*

<!-- 
Joke text:
___Q:___ Where do developers drink?

___A:___ The Foo bar
 -->
Polymorphic associations in Rails
Tags: rails, ruby, beginners
Published: 2021-05-16 11:54:36

---
title: Polymorphic associations in Rails
published: true
description: A quick overview of how to use polymorphic associations in rails
tags: rails, ruby, beginner
cover_image: https://dev-to-uploads.s3.amazonaws.com/uploads/articles/i22st1sm44xxrmzd3n70.jpg
canonical_url: https://www.codeandclay.com/2019/02/21/polymorphic-associations/
---

A model can associate with other models by way of a polymorphic association. This can be useful when the associated models are not of the same class but share a common interface, or when a model shares the same type of relationship with multiple other models.

For example, three models `Post`, `Project`, and `Issue` may have many comments.

Instead of creating a different comment model for each of these three models (`PostComment`, `ProjectComment`…) it would be much more straightforward to have a single `Comment` model and establish a relationship to a *subject*.

```ruby
create_table :comments do |t|
  t.text :body
  t.references :subject, polymorhic: true
```
The `subject` could be a `Post`, `Project`, `Issue` or any other model we wish to attach a comment to.

The polymorphic option, instructs the database to store the associated object's type. The above migration creates a `:subject_type` column.

The relationships are established in the models like so:

```ruby
class Comment < ApplicationRecord
  belongs_to :subject, polymorphic: true
end

class Post < ApplicationRecord
  has_many :comments, as: subject
end

class Project < ApplicationRecord
  has_many :comments, as: subject
end

class Issue < ApplicationRecord
  has_many :comments, as: subject
end
```
How to read/write Word docx files in Python
Tags: python, docx, write, read
Published: 2021-05-16 11:42:46

https://grokonez.com/python/how-to-read-write-word-docx-files-in-python-docx-module

How to read/write Word docx files in Python

In this tutorial, we're gonna look at way to use <code>python-docx</code> module to read, write Word docx files in Python program.

<!--more-->
<h2>Word documents</h2>
Word <code>.docx</code> file has more structures than plain text. With <code>python-docx</code> module, we have 3 different data types:
- a <code>Document</code> object for entire document.
- <code>Paragraph</code> objects for the paragraphs inside <code>Document</code> object.
- Each <code>Paragraph</code> object contains a list of <code>Run</code> objects.

<img src="https://grokonez.com/wp-content/uploads/2019/01/read-write-word-docx-files-in-python-docx-module-docx-file.png" alt="read-write-word-docx-files-in-python-docx-module-docx-file" width="650" height="249" class="alignnone size-full wp-image-16684" />
<h2>Read/Write Word docx files in Python</h2>
<h3>Install python-docx module</h3>
Open cmd, then run:
<code>pip install python-docx</code>

Once the installation is successful, we can see <code>docx</code> folder at <code>Python\Python[version]\Lib\site-packages</code>.
(In this tutorial, we use <code>python-docx 0.8.10</code>)

Now we can import the module by running <code>import docx</code>.
<h3>Read docx file</h3>
<h4>Open file</h4>
We call <code>docx.Document()</code> function and pass the filename to open a docx file under a <code>Document</code> object.
<pre><code class="language-python">
>>> import docx
>>> gkzDoc = docx.Document('grokonez.docx')
</code></pre>
<h4>Get paragraphs</h4>
<code>Document</code> object has <code>paragraphs</code> attribute that is a list of <code>Paragraph</code> objects.
<pre><code class="language-python">
>>> gkzDoc = docx.Document('grokonez.docx')

>>> len(gkzDoc.paragraphs)
4
>>> gkzDoc.paragraphs[0].text
'JavaSampleApproach.com was the predecessor website to grokonez.com.'
>>> gkzDoc.paragraphs[1].text
'In this brandnew site, we don\u2019t only focus on Java & Javascript Technology but also approach to other technologies & frameworks, other fields of computer science such as Machine Learning and Testing. All of them will come to you in simple, feasible, practical and integrative ways. Then you will feel the connection of everything.'
>>> gkzDoc.paragraphs[2].text
'What does grokonez mean?'
>>> gkzDoc.paragraphs[3].text
'Well, grokonez is derived from the words grok and konez.'
</code></pre>
<h4>Get full-text</h4>
To get full-text of the document, we will:
- open the Word document
- loop over all <code>Paragraph</code> objects and then appends their <code>text</code>

More at:

https://grokonez.com/python/how-to-read-write-word-docx-files-in-python-docx-module

How to read/write Word docx files in Python
Laravel 8 Multiple Image Upload Tutorial Example

Tags: laravel, php, tutorial, programming
Published: 2021-05-16 11:38:19

<p>Hi Dev,</p>

<p>Today, I will learn you how to engender multiple image upload in laravel 8. We will show example of laravel 8 multiple image upload.Here you will learn laravel 8 multiple images upload. We will optically canvass example of multiple image upload laravel 8. this example will avail you laravel 8 multiple image upload with preview. Alright, let’s dive into the steps.</p>

<p>I will engender simple multiple image upload in laravel 8. So you fundamentally utilize this code on your laravel 8 application.I are going from starch so, we will upload multiple file and store on server then after we will store database additionally. so in this example we will engender "files" table utilizing laravel migration and inscribe code for route, controller and view step by step.</p>

<p>Here, I will give you full example for laravel 8 multiple image upload as bellow.</p>

<strong class="step">Step-1:Download Laravel 8 Fresh New Setup</strong>

<p>First, we require to download the laravel fresh setup. Utilize the below command and download fresh incipient laravel setup :</p>

<pre class="prettyprint">
composer create-project --prefer-dist laravel/laravel blog
</pre>
<strong class="step">Step 2: Add Migration and Model</strong>
<p>Here, we require engender database migration for files table and additionally we will engender model for files table.</p>
<pre class="prettyprint">
php artisan make:migration create_files_table
</pre>

<pre class="prettyprint">
&lt;?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateFilesTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('files', function (Blueprint $table) {
            $table->id();
            $table->string('files');
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('files');
    }
}
</pre>
<pre class="prettyprint">
php artisan migrate
</pre>
<p>Next I will create File model by using following command:</p>
<pre class="prettyprint">
php artisan make:model File
</pre>
<b>app/Models/File.php</b>
<pre class="prettyprint">
&lt;?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;

class File extends Model
{
    use HasFactory;

    protected $fillable = [
        'files'
    ];
}
</pre>
<strong class="step">Step 3: Create Routes</strong>

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

https://codingtracker.blogspot.com/2021/05/laravel-8-multiple-image-upload.html
How to read/write Excel files in Python
Tags: python, excel, read, write
Published: 2021-05-16 11:34:53

https://grokonez.com/python/how-to-read-write-excel-files-in-python-openpyxl-module

How to read/write Excel files in Python


In this tutorial, we're gonna look at way to use <code>openpyxl</code> module to read, write Excel spreadsheet files in Python program.

<!--more-->
<h2>Excel spreadsheet files</h2>
An Excel file is called a <em>workbook</em> which is saved on PC as <strong>.xlsx</strong> extension.
Each <em>workbook</em> contains one or more <em>sheets</em>.
Each <em>sheet</em> has columns (letters: A, B, C...) and rows (numbers: 1, 2, 3...).
A box addressed by [column, row] pair is called a <em>cell</em>.

<img src="https://grokonez.com/wp-content/uploads/2019/01/read-write-excel-files-in-python-openpyxl-module-excel-file.png" alt="read-write-excel-files-in-python-openpyxl-module-excel-file" width="680" height="290" class="alignnone size-full wp-image-16631" />
<h2>Read/Write Excel files in Python</h2>
<h3>Install openpyxl module</h3>
Open cmd, then run:
<code>pip install openpyxl</code>

Once the installation is successful, we can see <code>openpyxl</code> folder at <code>Python\Python[version]\Lib\site-packages</code>.
(In this tutorial, we use <code>openpyxl 2.5.12</code>)

Now we can import the module by running <code>import openpyxl</code>.
<h3>Read Excel file</h3>
<h4>Open workbook</h4>
We use <code>openpyxl.load_workbook(filename)</code> function with input <code>filename</code> to get a <code>Workbook</code> object that represents the Excel file.
<pre><code class="language-python">
>>> import openpyxl
>>> gkzWb = openpyxl.load_workbook('grokonez.xlsx')
>>> type(gkzWb)
<class 'openpyxl.workbook.workbook.Workbook'>
</code></pre>
<h4>Get sheets</h4>
We call Workbook's <code>get_sheet_names()</code> method to get list of all the sheet names in the workbook.

More at:

https://grokonez.com/python/how-to-read-write-excel-files-in-python-openpyxl-module

How to read/write Excel files in Python