teleren/devto huggingface dataset:
Trick to read all the content of a file in java
Tags: java, computerscience, file
Published: 2020-10-06 05:06:15

Hello I recently need to write a program where I need to find the duplicates book title from a given text file and store it in a output file.

But it's quite difficult to read file in java as there are many options available but after searching the internet I found the awesome process where you can read the file just with few lines of code.

Let's see the code

```java
//required imports
//such as file handling java.io //and java.files
import java.io.*;
import java.util.Iterator;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.Collections;
import java.util.List;


//utility class for read the file in line and store it in
//an array and return it.
class OpenFileExample6 {
    //functions static to call from outside to the class
    public static List<String> readFileInList(String fileName) {
        
        //craeted a list of strings to store all the title from the file
                       
        List<String> lines = Collections.emptyList();

        //required try catch block to avoid any Input Output Exception and program can run
        //without any error
        try {
            lines = Files.readAllLines(Paths.get(fileName), StandardCharsets.UTF_8);
        } catch (IOException e) {
            e.printStackTrace();
        }
        //return the string of array
        return lines;
    }
}
```

Above code I used to read all the content from the file the magic is happened by these lines

```java
try {
            lines = Files.readAllLines(Paths.get(fileName), StandardCharsets.UTF_8);
        } catch (IOException e) {
            e.printStackTrace();
        }
```

Great now it's your turn to use it in java to read the file and don't forget to import java.nio library.
Copyright Up To Date (The Automate Way)
Tags: html, javascript, webdev
Published: 2020-10-06 05:05:02

>Let's be honest, **outdated copyright disclaimers on a website looks bad**. Looks like the website it's unmaintained on many levels. On the other hand, you don't want to manually update it every 1st of January on every website you own right? Let me help you **automate this task with 2 lines of code**. If you want to know more about the importance of updating your copyright dates I found [this post][sonet digital] with a more in-depth explanation.

First, let's create a basic HTML template where we will have our copyright disclaimer at the footer:
```html
<body>
  <header>Lorem ipsum dolor sit</header>

  <main>Lorem ipsum dolor sit amet consectetur adipisicing elit.</main>

  <footer>Copyright © <span id="copyright"></span>, My Company Name</footer>

  <script src="app.js"></script>
</body>
```

And then, our javascript will look like this:
```javascript
const copyright = document.querySelector('#copyright')

copyright.innerHTML = new Date().getFullYear()
```

That's it, you are cover now. 😎

Bonus tip:💡

In case you need a range of years instead of a single year in your copyright disclaimer, you can easily tweak the above code.

```html
<footer>Copyright © <span id="copyright">2010 - </span>, My Company Name</footer>
```
```javascript
const copyright = document.querySelector('#copyright')

copyright.innerHTML += new Date().getFullYear()
```


---

Thank you for reading, if you like my content, you can always find me on Twitter [@eligarlo][twitter profile].





[sonet digital]: https://sonet.digital/blog/general/keep-copyright-up-to-date/
[twitter profile]: https://twitter.com/eligarlo
One Tip For Learning How To Code
Tags: beginners, learning
Published: 2020-10-06 05:02:27

---
title: One Tip For Learning How To Code
published: true
description: One Tip For Learning To Code
tags: #beginners #learning
cover_image: https://dev-to-uploads.s3.amazonaws.com/i/tjn7vnxh7e96mmyd9orr.jpg
---

The amount of advice out there on learning how to code is overwhelming. 

In this [video](https://www.youtube.com/watch?v=HhNv7eLEoCY&t=8s), I go over just **one** tip that helped me go from beginner to employed developer. While there is lots of great advice out there, I focus on just one action that can get you from total newbie to coder.

I also invite you to join the [CodeBookClub](https://madisonkanna.com/codebookclub/) a community I help run for new and experienced developers.

I'd love to hear your feedback or comments. 

If you're learning how to code, what are you struggling with? 

If you already work as a developer, what is the **one** tip you'd share with new developers who are just getting started?
Resetting a WordPress admin password
Tags: wordpress, database
Published: 2020-10-06 05:01:03

I'm not particularly eager to work on WordPress, but sometimes you inherit legacy code or have to support a client.

The worst thing is where you get access to the database, but nobody knows the login anymore.

So how do we go about changing the admin's password?

> Pre: You must have access to the database!

## Using phpMyAdmin to change the WordPress password

The first thing we need to do is log in to phpMyAdmin and find our database.

Then we need to open up the `wp_users` (wp can be underscored by something unique for your install).

![PhpMyAdmin for WordPress install](https://cdn.hashnode.com/res/hashnode/image/upload/v1600855104030/0OehEIFE5.png)

Now we need to click the `edit` button on the admin record.

In the password field, add the new password in a readable way and choose `MD5` as the Function.

![Reset WordPress password](https://cdn.hashnode.com/res/hashnode/image/upload/v1600855217658/USFjHqfzp.png)

> Please don't use passwords like this example above

Now you can click `save`, and we will be able to login with our new password!

### Thank you for reading, and let's connect!

Thank you for reading my blog. Feel free to subscribe to my email newsletter and connect on [Facebook](https://www.facebook.com/DailyDevTipsBlog) or [Twitter](https://twitter.com/DailyDevTips1)
UI Dev Newsletter #25
Tags: html, css, javascript
Published: 2020-10-06 05:00:26

- [A Complete Guide to CSS Media Queries](https://bit.ly/3jxbCbx)
Learn all about how media queries can modify the appearance (and even behaviour) or a website or app based on a matched set of conditions about the user’s device, browser or system settings.

- [Make Your Own Dev Tool](https://bit.ly/2SwoTF2)
Amber Wilson shows how bookmarklets could be super handy during development.

- [Why Tailwind CSS](https://bit.ly/34nrgQl)
Shawn Wang explains some pros and cons of using Tailwind CSS.

- [There's a good reason why experienced devs say "it depends" so often](https://bit.ly/2GtWld9)
Jerod Santo tries to reason why devs use the term “it depends”.

- [Inspect CSS Grid](https://bit.ly/3jCdtvy)
This guide shows you how to discover CSS grids on a page, examining them and debugging layout issues in the Elements panel of Chrome DevTools.

- [npm automation tokens](https://bit.ly/3ixgfAX)
npm introduces a new setting for access tokens to support publishing to the npm registry from CI/CD workflows.

- [Achieving Vertical Alignment (Thanks, Subgrid!)](https://bit.ly/33viyQx)
Cathy Dutton shows how to use subgrid to vertically center the content across all items.

- [Build a responsive media browser with CSS](https://bit.ly/3lbQ8RK)
Andy Bell shows how to use modern CSS layout to create a flexible media browser and video player layout that maintains its aspect ratio at all viewports.

Happy coding!

[Subscribe to the newsletter here!](https://bit.ly/34155z3)
Getting started with JSON(JavaScript Object Notation)
Tags: javascript, webdev, 100daysofcode, beginners
Published: 2020-10-06 04:44:52

JSON(**J**ava**S**cript **O**bject **N**otation) is a storage format that is completely language independent and it is used to store and transport data. It's quite an important topic as the data which we fetch from external API usually consists of Arrays of elements which are in JSON format. 

The syntax of JSON is quite similar to the Object literal syntax which also consists of name, value pairs. But here both names, as well as values, are quoted in inverted commas.

Let us look at the example below :
```
//Object literals syntax
let details = {
      firstName : "John",
      lastName : "Adams",
      age : 27
}

//JSON syntax
{
      "firstName" : "Mike",
      "lastName" :  "Bush",
      "age" : 25
}

```
It is believed that in previous years XML format was widely used which has tags surrounding the data.The above mention JSON data in XML format is represented as below
```
<details>
     <firstName>Mike</firstName>
     <lastName>Bush</lastName>
     <age>25</age>
</details>

```
As you can see the XML format is verbose as compare to JSON i.e. for a single value "Mike", the name "firstName" is repeated twice for the opening and closing tags which is quite unnecessary. Also, the JSON can be parsed to Object literal which makes it faster to work with.

JSON is so popular that even JavaScript understands it and it has inbuilt functions to convert from JSON to object literal and vice versa.


- 
Javascript provides `JSON.stringify()` method to convert data from object literal format to JSON format

```
 const objectData = {
    firstName : "Mike",
    lastName : "Bush"
 }

 const JSONdata = JSON.stringify(objectData)
 console.log(JSONdata)

```
*Output*:- 

```
{"firstName":"Mike","lastName":"Bush"}
```

- 
There is another method called`JSON.parse()` which converts JSON format data to Object literal format

```
const JSONdata = '{ "firstName" : "Mike", "lastName" : "Bush"}';
const ObjectData = JSON.parse(JSONdata)

console.log(ObjectData)
```
*Output*:-
```
{firstName: "Mike", lastName: "Bush"}
```
This is what I learned when I started with JSON. Understanding fundamentals and the methods of JSON are important as they are an elemental part of accessing information with API.

**Conclusion **:

- JSON syntax is similar to Object literal where both name-value pair is in inverted commas.

- 
`JSON.stringify()` Object --> JSON 
- `JSON.parse()` JSON --> Object 

>Thank you for your time for reading the article, give a follow on my [twitter](https://twitter.com/kadamsarvesh10) as I am documenting my learning
Top App Development Australia
Tags: appdevelopmentaustralia, appdevelopersaustralia, appdevelopmentcompanyaustralia
Published: 2020-10-06 04:20:40

Being a top mobile [**App Development Australia**](https://www.indiaappdeveloper.com/app-development-company-australia/) Company, India App Developer feels proud at offering top-class mobile app development services at reasonable prices. By working together with us, you will never regret the money and time spent on a superb mobile app.

At India App Developer, we do not simply create apps, our app developers in Australia create long-term relationships with all our clients via our leading-edge app solutions. Our best app development company in Australia takes a superb approach to make responsive mobile apps. We have been offering incomparable mobile apps to various industries around the world. We have become connoisseurs in outstanding user engagement and driving increased revenues. 

As the best app development company in Australia, we promise 3 things: our mobile app will be flawless in its performance, great-looking, and drive high ROI. We have been fulfilling this promise for years and thus we have proved to be the most valued mobile app development company in Australia. We also ensure that our apps offer outstanding user experiences and assist our clients to stand out always. 

Are you ready to make the next huge sensation in the apps world? If yes, then get in touch with us!
Introduction to Python
Published: 2020-10-06 04:12:16

Website:https://bestpythontutorials.com

Buy Siteground Web Hosting:[https://www.siteground.com/index.htm?afcode=4bbbeb6048f7d8fd1efec76817755662]

Python is an Object Oriented Language developed by Guido Van Rossoum as a replacement of ABC and modula-3 Language.Python was actually developed with a goal to make a programming language whose syntax is very easy to learn and also It is very widely used in the field of AI

#Features of Python
* It is easy to learn as it's syntax is like plain english.
* It is a high level language thus a very-very programmer friendly language.
* It is an interpreted language so it is easy to debug for advance or a beginner user .
* It is a cross platform language i.e it can be run on Windows,Mac or Linux.
* It is free and open source i.e you can use it for free and can also modify it if you are a advance programmer.

#Some disadvantages of Python
* It is not a fast Language like C or C++.
* It has lesser Libraries than other languages like Java and C++.
* It's not a type safe language.
* Many OOPs feature is not supported directly.


#What we can build or do with Python

* Currently it is widely used in the field of Artificial Intelligence.
* It can be used for developing graphical games using pygame module.
* It can be easily integrated to Database Applications.
* It is also used for System Administration.
* GDscript whose syntax is similar to python is supported by godot game engine.
* It is also used for developing Powerful web applications with framworks like Django or Flask.
* You can also build awesome Desktop Applications with frameworks like Tkinter,Kivy or PyQt.

#What type of Language is Python

Python is an object oriented,interpreted and dynamic language. Its high-level built in data structures, combined with dynamic typing and dynamic binding, make it very attractive for Rapid Application Development.
Hacktoberfest 3 down one to go.
Tags: hacktoberfest
Published: 2020-10-06 04:07:39

I made progress on my Hacktoberfest goals. I had two more pull request accepted. I added to a user groups's site and I did a bit for coder education.
The user group had requested an favicon for their site. I took their logo and modified it to appropriate size. And placed it in the requested folder. Then I added the link so the favicon would appear. The site was made with Eleventy. I've never used it before so I got to read code and learn a bit. 
 
My other contribution was adding some coding questions to a bot. I have a "Time I learned" log and pulled some things from there. I keep the log to give me blogging prompts. This time I just used it to make some questions with answers. I added them to the questions array. The maintainer approved them so maybe my trivia will appear on screen in the future.

I have one more PR to meet the goal, but I won't stop there I'll keep looking for ways to help open source. I'd like to do some accessibility work. 

![progress bar of 4 rectangles. 3 of them are filled in one is empty.  ](https://dev-to-uploads.s3.amazonaws.com/i/611grg7s4v2i2wgr3ji9.jpg)
Stereotype and Meta Annotations in Spring
Tags: stereotypes, metaannotations, spring, java
Published: 2020-10-06 03:54:52

@ComponentScan checks not only for components but for annotations that are themselves annotated with @Component too. Those are stereotype annotations:

* Component
* Controller
* Repository
* Service

We could add @Configuration and @RestController because @Configuration is annotated with @Component and @RestController is annotated with @Controller (some people disagree)

Meta-annotations are annotations that can be used to annotate other annotations. For example, the next custom annotation @MyTransactionalService is a meta-annotation:

```java
@MyTransactionalService
public class TransferServiceImpl implements TransferService {
  ...
}

@Retention(RUNTIME)
@Target(TYPE)
@Service
@Transactional(timeout=60)
public @interface MyTransactionalService {
  String value() default "";
}
```
Routing In Flask. 🍾
Tags: flask, python, webdev, beginners
Published: 2020-10-06 03:38:06

In this post we will learn about **routing** in flask. Its pretty easy.

### Fixed Routes

To create routes for your pages like about , contact and so on, we use this kind of routing when we have a permanent route.

```python
@app.route('/contact-us')
def ContactUs():
    return "Contact Us Page"

@app.route('/about-us/')
def ContactUs():
    return "About Us Page"
```

Creating fixed URLs is so damn simple. You might have spotted that in contact us page there was no trailing slash but in contact us we used it. We can use both, but keep in mind when we don't use trailing slash it will give a `404` error to people who visit the traling slash page . For Example it will give a `404` when a person visits `\contact-us\` but will server page on  `\contact-us`.

If you use the one URL pattern with trailing backlash like  `\about-us\` it will redirect users from  `\about-us` to  `\about-us\` and thus preventing mess.


### Dynamic Routes

In this section we will learn about dynamic routing. Dynamic routing means getting dynamic data in URL and then using it.

In Flask you can have use following converters to convert dynamic input from the URL.

1. string
2. int
3. float
4. path ( It is simple a string but also accepts shashles in the URL)
5. uuid

You may get data from URL without this parameters but is recommended to use.

Let's now see some examples:

```python
@app.route('dynamicurl/<varible_name>/')
def DynamicUrl(varible_name):
    return str(varible_name)
```

In above you may have seen that we pass the varible used in dynamic URL to the function and its how it is done, and previously I have talked about converters lets see how to use them,

```python
@app.route('dynamicurl/<str:varible_name>/')
def DynamicUrl(varible_name):
    return varible_name
```
It will convert the given input in string and will pass it to the function. You may try and use other converters on your own.

Hope you like it. 😊

Bye. 😍


---
Read it on my new website [ Routing in Flask ](http://ketaniralepatil.com/python/flask/routing-in-flask/) it will really support me.
---
Laravel 8 CRUD with Image Upload Guide
Published: 2020-10-06 03:29:51


Laravel 8 crud with image upload example tutorial. In this post, i will show you from scratch on how to make simple first crud application in laravel 8 with image upload and validation.

In this example post, i will create blog post crud (create , read, update and delete) app with image upload in laravel 8 and validation.


### Laravel 8 CRUD with Image Upload Tutorial

Step 1 – Install Laravel 8 Application
Step 2 – Configuring Database using Env File
Step 3 – Create Post CRUD Model & Migration
Step 4 – Create Post CRUD Routes
Step 5 – Creating Resource Controller
Step 6 – Create POST CRUD Blade Views File
Step 7 – Start Development Server
Step 8 – Run Laravel 8 CRUD with Image Upload App On Browser

[https://laratutorials.com/laravel-8-crud-with-image-upload-tutorial/](https://laratutorials.com/laravel-8-crud-with-image-upload-tutorial/ "https://laratutorials.com/laravel-8-crud-with-image-upload-tutorial/")
How to Image Upload in Laravel 8
Published: 2020-10-06 03:28:25

Laravel 8 image upload with validation tutorial. In this post, i will show how to image upload with validation in laravel 8.

In this post example, i will create image upload form in laravel. As well as validate image before upload to database and directory in laravel 8.


### Laravel 8 Image Upload Tutorial

Simple steps to image upload in laravel 8 app:

Step 1 – Install Laravel 8 Application
Step 2 – Configuring Database Details
Step 3 – Create Model & Migration File For Image Upload
Step 4 – Create Image Upload Routes
Step 5 – Creating Image Upload Controller
Step 6 – Create Blade File For Image Upload Form
Step 7 – Start Development Server
Step 8 – Run Laravel 8 Image Upload with Validation App On Browser

[https://laratutorials.com/laravel-8-image-upload-tutorial/](https://laratutorials.com/laravel-8-image-upload-tutorial/ "https://laratutorials.com/laravel-8-image-upload-tutorial/")
Laravel 8 CRUD App Tutorial From Scratch
Published: 2020-10-06 03:26:51

Laravel 8 crud example tutorial. In this post, i will show you from scratch on how to build/make simple crud application in laravel 8 with validation.

The crud means create, read, update and delete records from database.

In this example post, i will create blog post crud (create , read, update and delete) app in laravel with validation.

This tutorial will completely guide you from scratch to create crud app in laravel 8 for beginners.


### Laravel 8 CRUD – Simple CRUD Example Tutorial

Step 1 – Install Laravel 8 Application
Step 2 – Configuring Database using Env File
Step 3 – Create Post Model & Migration
Step 4 – Create Routes
Step 5 – Creating Resource Controller
Step 6 – Create Blade Views File
Step 7 – Start Development Server
Step 8 – Run Laravel 8 CRUD App On Browser

[https://laratutorials.com/laravel-8-crud-tutorial-step-by-step/](https://laratutorials.com/laravel-8-crud-tutorial-step-by-step/ "https://laratutorials.com/laravel-8-crud-tutorial-step-by-step/")
Custom file upload button
Published: 2020-10-06 00:55:24

Customizing the input `type="file"` is a bit annoying because it comes with a button and an unchangeable text.

With the `::file-selector-button` pseudo-selector you can edit the default button. It's still annoying because some CSS properties affect both the button and the text and some affect only the button 😒.

Another caveat is browser support. All major browsers except **Firefox** support the pseudo-selector.

You can read about the [::file-selector-button](https://developer.mozilla.org/en-US/docs/Web/CSS/::file-selector-button) for more details.

## How to customize the default upload button

We have our html input tag:

```html
<input id="upload" type="file" accept="image/*" />
```

Then in our css:

```css
input::-webkit-file-upload-button {
  background-color: peru;
  border: none;
  border-radius: 4px;
  padding: 10px 20px;
  box-shadow: 0 2px 8px 1px #454545;
  cursor: pointer;
}
```

**Note** that I used `-webkit-file-upload-button` instead of `file-selector-button`. `-webkit-file-upload-button` is for **Webkit/Blink** browsers like **Chrome** and **Opera**.

It's up to you if you wanna keep the "No file chosen" text. In this case, I don't wanna keep it. I'm not sure if it can be removed completely but adding `position: absolute;` puts the text behind the button.

Yayyy!!! 🎉🎉🎉 Now we have our completely customized upload button.

{% codepen https://codepen.io/gameshaker/pen/rNLBxZQ %}

Check out the [full code on codepen.io](https://codepen.io/gameshaker/pen/rNLBxZQ). or clone the [git repo](https://github.com/Dchole/custom-file-upload-input.git)
How to fetch data using ajax in laravel 8
Published: 2020-10-06 03:24:49

Laravel 8 ajax get/fetch data from database. In this post, i will show from scratch on how to get or retrieve data from database using ajax in laravel.

If you want to fetch/get data from database using jQuery ajax without reload the whole web page. And want to display on html page.

So, in this example post, i will use jQuery ajax to fetch data from database and display in blade view (html page). As well as how to use ajax request(GET/POST) in laravel to retrieve data from database


### How to Retrieve Data From Database using Ajax in Laravel 8

Step 1 – Install Laravel 8 Application
Step 2 – Configuring Database using Env File
Step 3 – Generate Dummy Record Into Database
Step 4 – Create Routes
Step 5 – Creating Ajax Get Data Controller
Step 6 – Create Blade File to Display Data
Step 7 – Start Development Server
Step 8 – Run Laravel 8 Ajax Get Data From Database App On Browser

[https://laratutorials.com/laravel-8-ajax-get-data-from-database-example/](https://laratutorials.com/laravel-8-ajax-get-data-from-database-example/ "https://laratutorials.com/laravel-8-ajax-get-data-from-database-example/")