teleren/devto huggingface dataset:
Laravel 9 Generate and Download PDF using DomPDF Example
Tags: laravel
Published: 2022-02-26 05:12:01

Hi All,

Today our leading topic is laravel 9 pdf file from view. In this article, we will implement a laravel 9 generate pdf file. you can see how to generate pdf in laravel 9. Here you will learn laravel 9 to create a pdf from view. Let's see below the example laravel 9 pdf generator.

I will give you a simple example of how to generate a pdf file in laravel 9. we will use DomPDF composer package to generate a pdf file in laravel 9. just follow the below step and get a simple pdf using laravel 9.

[Laravel 9 Generate and Download PDF using DomPDF Example](https://www.codecheef.org/article/laravel-9-generate-and-download-pdf-using-dompdf-example)
How to Containerize Golang app with Docker
Tags: go, docker
Published: 2022-02-26 04:08:22

To containerize a Golang app is similar to any other project. We need to use the base image for golandg and build the app.

Install Docker desktop , if you are on windows and create an account first. Then in the project create Dockerfile ( no extension required) with following command. 

```
FROM  golang:1.18beta2-bullseye
RUN mkdir /app
ADD . /app
WORKDIR /app
RUN go build -o main .
CMD ["/app/main"]
```
`Save the file in root of the project`

## Building the Docker Image

Go to the terminal and CD into the project folder and build the image. Docker image can be used to run different process.

```
docker build -t my-go-app . 
```

try to list image using docker images command.

``` 
docker images 
```
## Using the image
To use the image we created with run command.

```
docker run -d -p 8080:8080 --name test1 my-go-app
```

The above command will run the image in detached mode, leaving console reedy for another execution.

It also exposed to port internal 8080:8080. Go to the browser and try localhost:8080 and it should have working.

## Stopping, Starting and removing containers

Using `docker stop <container-name/id>`. Once it stopped can delete using `docker rm container-name/id ` command.

Need to start again ? use the `docker start` command. 

Wanna know running processes/ containers ? Try `docker ps`.

Here is more guides on 
 * [Golang](https://devmnj.wordpress.com/tag/golang/)
 * [Docker](https://devmnj.wordpress.com/tag/docker/)
An Infographic About Python List Comprehensions
Tags: python, beginners, design, tutorial
Published: 2022-02-26 04:42:00

![Python List Comprehensions](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/j1pxua6ei2mtl5w4seca.png)

I spent way to much time on this infographic.

The good news is I have a template for future programming tips. I predict my time spent on the next graphic will be considerably less.

My inspiration for creating this comes from [Simon Høiberg's](https://twitter.com/SimonHoiberg) tips for JavaScript. I recommend checking out his content.

I will say that list comprehensions shouldn't be used for everything. There are cases where it's more readable to write out the for loop (e.g. nested for loops).

List comprehensions are really powerful. You can mimic filter and map expressions using a list comprehension.

```python
numbers = [1, 2, 3, 4, 5, 6, 7, 8, 9]

# filter numbers greater than 5
x = [n for n in numbers if n > 5]

# map the numbers to a string
x = [str(n) for n in numbers]
```
---

Thanks for reading! Let me know what you think of the infographic. I appreciate any feedback.
Day 7/100, 100 Days of Code
Tags: javascript, beginners, codenewbie, devjournal
Published: 2022-02-26 04:31:43

I keep forgetting to post! While this is technically my 8th day, we'll just call it 7. I know the days don't have to be consecutive for this challenge, but consistency helps keep me motivated.

Glad I took another day to focus on the **iterator** methods. Feel like I'm learning super slow and running into challenge after challenge trying to understand. 

Today I started working on a mini linter project. It was an array that consisted of one big paragraph of words, and I used different iterators to modify it into a new array.


I'm also learning that **google is my friend** :)
JavaScript HTML DOM
Tags: html, javascript, webdev, beginners
Published: 2022-02-26 04:04:23

Hello Everyone 👋
In this article, we will start the concept of Document Object Model (DOM). DOM is a very important part to learn while learning JavaScript/ You can say the real use of JavaScript starts from here. **In Simple Words**, your HTML document or document's elements are stored in the form of objects (nodes & children) in the JavaScript document object through which you can access them by using JavaScript.

When a web page is loaded, the browser creates a _Document Object Model_ of the page. The HTML DOM is constructed as a tree of Objects (nodes and childnodes). Refer to the figure below for visual representation.
![Main DOM](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/axz7b1j58h8i3h9wcqqz.png)
 
## Nodes & Childnodes
All parts of the document, such as elements, attributes, text, etc. are organized in a tree like structure; consisting of parents (e.g.: body element) and children (e.g.: H1, Script elements). These individual parts of the document are known as nodes and childnodes.
![Generalized DOM](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/u3cj5u93dd9kuafszwwz.png)

## Node Relationships
The term parent, child, and siblings are used to describe the relationships.
* In a node tree, the top node s called the root (or a root node)
* Every node has exactly one parent, except the root (which has no parent)
* A node can have a number of children
* Siblings (brothers or sisters) are nodes with same parent

Take a look at this piece of code followed by a visual representation in the form of a DOM Tree for a better understanding of above given points.
```html
<html> <!––Root Node/Element-->
     <head> <! ––First Child of Root -->
          <title>DOM Tutorial by Mursal</title> <! ––Child of Head Node-->
     </head>

     <body> <! ––Last child of root -->
          <! ––Child Nodes of Body node and sibling nodes of each other -->
          <h1>DOM Lesson one</h1>
          <p>Hello World!</p>
     </body>
</html>
```
![DOM Tree](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/krqdk7m2tzhhbzp9bvea.png)

## Takeaways
From the above given code and illustrations, you can read
* `<html>` is the root node
* `<html>` has no parents
* `<html>` is a parent of `<head>` and `<body>`
* `<head>` is the first child of `<html>`
* `<body>` is the second child of `<html>`
* `<head>` has one child: `<title>`
* `<title>` has one child (a text node): "DOM Tutorial by Mursal"
* `<body>` has two children: `<h1>` and `<p>`
* `<h1>` has one child: "DOM Lessen one"
* `<p>` has one child: "Hello World!"
* `<h1>` and `<p>` are siblings

In our next article, we will be discussing how we can access a DOM Object using JavaScript.
Telescope v.2.8.0 progress
Tags: opensource
Published: 2022-02-26 03:37:56

This week is the busiest one since I started this semester, which is the mid-term week. Everybody was getting ready for their mid-term tests, and me as well. I have one on Thursday, and two on Friday.

For this week, I was reviewing the PRs in Telescope, it seems the work flow is slow this week, I guess people focus on their mid-term tests, but they still pay attention on Telescope.

[PR #2939](https://github.com/Seneca-CDOT/telescope/pull/2939) was opened, then we had a discussion whether to keep this or not. Because user can go back to the Telescope page, where they can see the blog posts, by using the button already implemented by the browser. So, adding this feature is kind of redundant. At the end of the day, we decided to close this PR.

[PR #2977](https://github.com/Seneca-CDOT/telescope/pull/2977#issuecomment-1049298014) has introduced me the basic concept about Supabase. It is really hard to understand it at first, by reviewing the codes Duke has made, then reading the comments to see the ideas, I somehow got the fundamental. My email was *ting-ting* all the times because of this PR.

Beside [PR #3041](https://github.com/Seneca-CDOT/telescope/pull/3041), I finish 90% of the Vietnamese translation version for the overview of Telescope. During the time I do the translation, I just realized that I have never known some definitions in Vietnamese even I am using, and seeing it around me most of the time. The hardest part for this is to have everything make sense. English to Vietnamese is a huge gap, so I proof read it multiple time even I am only transcribing one sentence.

I think this would be what I have done so far this week. Next week is the reading week, we will not have any classes. However, I would try to keep track with what is going on with Telescope. Cheer!
Spring Security. Creating users
Tags: java, database, security, tristan
Published: 2022-02-26 03:35:12

###Introduction
- This series is going to be on Spring Security. This tutorial assumes that you already have your spring project set up, if you do not, please check out the YouTube video [HERE](https://www.youtube.com/watch?v=9SGDpanrc8U&t=1482s) 

###GitHub Link
[HERE](https://github.com/thePlebDev/Spring-security-examples/tree/master/src/main/java/com/example/demo/models)

###Video explanation

{% embed https://www.youtube.com/watch?v=p8h9-u-nB0g %}

###Conclusion
- Thank you for taking the time out of your day to read this blog post of mine. If you have any questions or concerns please comment below or reach out to me on [Twitter](https://twitter.com/TristanJava).
Build WEB 3.0 Login With Metamask | MORALIS AND REACT JS
Published: 2022-02-26 03:31:01


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/j582q50gt0725lvyd952.jpg)## Introduction


As you all know that web 3.0 is the new technology for the year 2022 and web 3.0 devs are earning a lot and the demand for web 3.0 developers is also increased.

So in this small video you will learn about web 3.0
this video gives you an idea on how you can create a simple login page using web 3.0, metamask and with moralis authentication.

Trust me it is a very great and helpful video. most of the web 3.0 applications you will require a login page, so in this video i open you the door to web 3.0

## Before Getting Started

So before starting this project you must do these steps

1. Install [Metamask](https://metamask.io/) extension in your browser
2. Create and setup your [Moralis](https://moralis.io/) account

## Links will be required

Moralis Link - https://moralis.io
React Moralis DOCS - https://docs.moralis.io/moralis-server/tools/react-moralis

And finally here is the tutorial video to start coding and making your project

{% embed https://www.youtube.com/watch?v=HBuyglr-xCg&t=27s %}

## Thankyou

**thankyou so much for reading this blog and i hope that you liked it also if you want more of this blogs and tutorial videos make sure to (Subscribe)[https://youtube.com/codingfire?sub_confirmation=1] to my youtube channel and follow me**

SUBSCRIBE 💗 - https://youtube.com/codingfire?sub_confirmation=1

Source Code (Github) - https://github.com/CoderZ90/web3.0-login
Laravel 9 Roadmap 2022 | Laravel 9 Developer Roadmap 2022 | Laravel 9 New Features - Codexashish
Tags: laravel, php, programming, beginners
Published: 2022-02-26 03:21:40

 This article will be discussing what we can expect from Laravel 9 in 2022 and how it will change the developer landscape in the coming years. This is a complete guide to Laravel, a framework for PHP developers. This guide will take you through all the basics of Laravel in order to help you create your own projects.

## Laravel 9 Complete Roadmap
The guide also includes useful tutorials and links to third-party resources that you can use according to what you need. PHP programming is an open-source, server-side scripting programming language designed for web development. Laravel is a framework that is written in PHP, and as such, it allows for rapid application development. Laravel has been downloaded 5 million times and has more than 3 million users. It is one of the best and most popular PHP frameworks today.

## Q:- What is Laravel 9 Framework?
Ans. Laravel 9 is an open-source, free PHP web application framework. It is built with a focus on the end-user experience and offers many features out of the box. Laravel 9 is the latest version of this popular framework. Laravel is the perfect tool for creating a robust and sophisticated website.  It's easy to use and offers rich functionality.

## Q:- What is the latest version of Laravel?
Ans. The latest version of the Laravel framework is 9.1.0

## Q:- What are available databases supported by Laravel?
Ans. Currently Laravel Support 4 Databases:-

- MySQL
- SQL Server
- PostgreSQL
- SQLite

## Q:- How to install Laravel 9?

1. via composer
2. laravel alias
Install Laravel 9 Via Composer:-
composer create-project laravel/laravel:^9.0 ProjectName
Install Laravel 9 Via laravel alias:- 
laravel new ProjectName

## Q:- List some new features of laravel 9?
Enum Class
PHP 8 Support
PHP 8 String Functions
New Accessors And Mutatiors 
Eloquent ORM
Artisan CLI
Automatic Pagination
Anonymous Stub Migration
New Query Builder Interface

**Q:- What are the default packages provided by Laravel 9 **Framework?
Laravel/breeze package 

Laravel/ui

JetSteam

Cashier

Dusk

Fortify

Horizon

Octane

Passport

Sail

Sanctum

Scout

Socialite

Telescope

Horizon

Valet

## Step.1:- Basic Knowledge
PHP

VueJs

Tailwind

AWS

HTML

CSS

Bootstrap

Database

JQuerry

JavaScript



## Want to Read:- Search codexashish on google.
Thankyou
Rails 7 JS on page load
Tags: rails, javascript, ruby
Published: 2022-02-26 02:59:43

After diving in many rabbit holes trying to figure out why my JS was not loading after using rails link helper `link_to`... I think I have the answer. 

[Rails guide](https://guides.rubyonrails.org/working_with_javascript_in_rails.html#page-change-events) tells us one thing however, this seems to be working for me

```
document.addEventListener("turbo:load", function () {
  yourFunction();
});
```

Hope this helps you!

demo: [https://rails-7-esbuild.herokuapp.com/](https://rails-7-esbuild.herokuapp.com/)
repo: [https://github.com/jocvegar/rails_7_esbuild](https://github.com/jocvegar/rails_7_esbuild)
#38 - Assemble string CodeWars Kata (6 kyu)
Tags: javascript, webdev, tutorial, 100daysofcode
Published: 2022-02-26 02:07:06

##Instructions
**Task**
In this task, you need to restore a string from a list of its copies.

You will receive an array of strings. All of them are supposed to be the same as the original but, unfortunately, they were corrupted which means some of the characters were replaced with asterisks ("*").

You have to restore the original string based on non-corrupted information you have. If in some cases it is not possible to determine what the original character was, use "#" character as a special marker for that.

If the array is empty, then return an empty string.

**Examples:**

```
input = [
  "a*cde",
  "*bcde",
  "abc*e"
]
result = "abcde"


input = [
  "a*c**",
  "**cd*",
  "a*cd*"
]
result = "a#cd#"
```

---

##My solution:

```javascript
function assembleString(arr){
  let r = []
  for(let i = 0; i<arr.length; i++){
    for(let j = 0; j<arr[i].length; j++){
      if(i==0) r.push(arr[i][j])
      if(r[j] == '*' || arr[i][j] !== '*') r[j] = arr[i][j]
    }
  }
  return r.map(x=>x=='*' ? '#' : x).join('')
}
```

---

##Explanation
First I made an empty array in the variable "r"

```javascript
let r = []

```
---

After that I used 2 for loops, the first one to iterate through arr, and then the other to iterate into every array inside of it that contained a word, inside of the second loop, first I checked if it is the first word array, I will push it as it is, so I can get it as a base for the other iterations, and I can start from something.

```javascript
for(let i = 0; i<arr.length; i++){
    for(let j = 0; j<arr[i].length; j++){
      if(i==0) r.push(arr[i][j])
```

---

After that I used another conditional that checked if the the element in "r" that is in the same index position we are iterating is a "*" and the character that I'm iterating isn't a '*' it means that we discovered another character, so I just change "*" to the correct character

```javascript
if(r[j] == '*' || arr[i][j] !== '*') r[j] = arr[i][j]
```

---

At the end I just returned the "r" array, that contained the last result, but first I mapped it to change every "*" to a "#" and to join it into an array

```javascript
return r.map(x=>x=='*' ? '#' : x).join('')
```



---

**What do you think about this solution? 👇🤔**

[My Github](https://github.com/Cesardlr)
[My twitter](https://twitter.com/cesar__dlr)
[Solve this Kata](https://www.codewars.com/kata/6210fb7aabf047000f3a3ad6)
AppleScript Automation.
Tags: programming, opensource, automation
Published: 2022-02-26 01:26:26

#ShortStory.

A few weeks ago, I was curious about accessing different devices on my network. After a long time researching, I found that it's accessible simple to ssh into my local machine IP address. 

In my subsequent work, I found something exciting. I was able to control the brightness of my Macbook Pro from my iMac terminal, and one time I left my table to take a quick break for breakfast, and the monitor on my laptop went to sleep. I pressed enter and saw the log-in page, BUT I could still use my laptop via ssh on the terminal. 

I thought it would be interesting to access the keyboard via terminal, but it is hard to do with .sh/bs. 

Behind a research work, I found that AppleScript is a thing. We can automate and ask it to do something exciting. 
The first thing I did was create a "google" function in the terminal that opens google search with the flag as a query input - 

```
google "What's your search?".
```

Second thing was this code, that opens: Spotlight - type Notepad and prints HelloWorld.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/v990vzsgzlq2r4dh340p.gif)

Code > 

```
tell application "System Events"
	delay 0.5
	keystroke space using command down
	delay 0.5
	keystroke "Text"
	delay 0.5
	keystroke "Edit"
	delay 0.5
	keystroke return
	delay 1
	keystroke "Hello world!"
end tell
```

### Conclusion

> Automation!

⚠️ Previous Blog Post Tips And Tricks About Shell & CURL [Link]
This post is the best for short commands.

⚠️ Future Blog Post About Collaborative WhiteBoard with Node.js + React.js + AWS(EC2): [Link]

### Links

🖇 Follow me on [GitHub](https://github.com/aserputov) 

🖇 Follow me on [Twitter](https://twitter.com/aserputov) 

_p.s This post was made out of my curiosity
My Second Experience In Being Sheriff
Tags: opensource, programming, javascript, sherif
Published: 2022-02-26 01:25:25


For those who forgot, I'm a kind of maintainer in [Telescope](https://github.com/Seneca-CDOT/telescope).

This week I had my second experience being a sheriff. (Sheriffs help steward and manage the project's infrastructure and make sure that the team can function optimally at all times.
)

In our responsibilities as always was included to :
> Monitoring all of our systems for possible issues or failure
> Keeping PRs moving through review.
> General issue maintenance.
> Helping with git issues
> Communicating with the team on Slack and GitHub 
> Being available and visible on Slack.
> Backing-out changes that can't be fixed. 
> Running meetings, including weekly triage.

We had two meetings, progress and triage.

The first meeting we had on Tuesday, led by Alex, was about Telescope progress. The topic was about multiple things related to new enhancements, bugs, and cloud migration.
Overall, the meeting was exciting and productive. We spoke to many people, discussed their progress and found out the interests of each member of the group.

In the second meeting, I led the triage one with my partner, @AlexRomanova. 

We currently have sixty open issues, and Alex had a great idea of getting rid of them by assigning or closing.

We created a GitHub [Planning page](https://github.com/orgs/Seneca-CDOT/projects/9) and divided the issues into different categories. 
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/uqoj0oc7xtou49z130d2.png)

We worked through each issue and analyzed it. Sometimes, mentioned people in issues help us understand things more profoundly if we have trouble understanding.

The management of repo and help to team members on Slack was generally acceptable but maybe a bit stressful.

Luckily, nothing happened to the system during our maintenance.

#Conclusion

⚠️ Read My Plan For 2.8 release: [here](https://twitter.com/aserputov/status/1490435738911088641)

#Links

🖇 Follow me on [GitHub](https://github.com/aserputov) 

🖇 Follow me on [Twitter](https://twitter.com/aserputov) 

p.s This post was made for Telescope
My plan for 2.8 release in Telescope
Published: 2022-02-26 01:25:14


For those who forgot, I'm a kind of maintainer in [Telescope](https://github.com/Seneca-CDOT/telescope).

This week I was a Sheriff and saw that we have sixty open issues.

After looking through all of them I assigned few of them to me and decided to check what I have for today in my list of issues.

Almost fifteen issues is in my list. 

> Four of them are related to Eslint.
> Three of them are related to Ngnix.
> Two of them are research work.
> Others are in group related to Telescope.
> Only one is my own issue for Documentation.

My plan for 2.8 is to finish:

Cloudfare research issue regarding server less functionality.
Cloudfare is a website security company that provides content delivery network and DDoS mitigation services. Its services occur between a website's visitor and the Cloudflare customer's hosting provider, acting as a reverse proxy for websites.

Start research about Ngnix.
Ngnix is a web server that can also be used as a reverse proxy, load balancer, mail proxy and HTTP cache

Finish my Documentation [issue](https://github.com/Seneca-CDOT/telescope/issues/2855).

Finish all Eslint issues.
[Eslint1](https://github.com/Seneca-CDOT/telescope/issues/3000)
[Eslint2](https://github.com/Seneca-CDOT/telescope/issues/2999)
[Eslint3](https://github.com/Seneca-CDOT/telescope/issues/2998)

#Conclusion

⚠️ Read My Blog About My Second Experience Of Being Sheriff: [here](https://twitter.com/aserputov/status/1490435738911088641)

Also, great news, my Pull Request was approved for RedPanda.

#Links

🖇 Follow me on [GitHub](https://github.com/aserputov) 

🖇 Follow me on [Twitter](https://twitter.com/aserputov) 

p.s This post was made for Telescope