teleren/devto huggingface dataset:
A Web Scraper using Golang.
Tags: go, scraper
Published: 2020-07-28 04:38:08

# <u>Web Scraper</u>
Go is has increasingly become popular due to its flexibility amd power.
So today,we build a simple web scraper using golang.
We make a GET request to the website.
```go
package main
import(
        "fmt"
        "net/http"
        "io/ioutil"
)

func main(){
       //Make GET request
       resp,err := http.Get("www.example.com")
       Check(err)
       
       //close the connection stream
       defer resp.Body.Close()

       //get the bytes acquired
       resultsInBytes,err := ioutil.ReadAll(resp.Body)
       Check(err)

       //convert into a readable format
       results := string(resultsInBytes)

       //Display website
       fmt.Println(results)
}

//error handler function
func Check(err error){
       if err!= nil{
            fmt.Println(err)
       }
}
```

We can make it powerful in a way that it can store the acquired website in a file but we will use the io module to copy the website to the file,instead of ioutil module.

```go
package main
import(
        "fmt"
        "net/http"
        "io"
        "os"
)

func main(){
       //create file
       f := os.Create("filename.html")

       //Make GET request
       response,err := http.Get("www.example.com")
       Check(err)
       
       //close the connection stream
       defer resp.Body.Close()

       //get the bytes acquired
       resultsInBytes,err := io.Copy(f,resp.Body)
       Check(err)

       //convert into a readable format
       results := string(resultsInBytes)

       //Display website
       fmt.Println(results)
}

//error handler function
func Check(err error){
       if err!= nil{
            fmt.Println(err)
       }
}
```
Is it possible for a JS library to have full TS support, but doesn't use TS extension?
Tags: javascript, typescript, discuss, babel
Published: 2020-07-28 04:28:02

For example, I want to use Flow, as well as Babel, probably also with [tcomb](https://github.com/gcanti/babel-plugin-tcomb). (or [some other reasons](https://dev.to/patarapolw/laziest-way-to-publish-for-both-npm-and-script-src-4859)?)

{% post https://dev.to/patarapolw/laziest-way-to-publish-for-both-npm-and-script-src-4859 %}

> To compile with `tsc` to JavaScript for web browsers, you have to add `.js` to all imports and exports. [This is a known issue in TypeScript (and probably wontfix).](https://github.com/microsoft/TypeScript/issues/13422)

IMO, Babel can be more powerful than TypeScript, as it allows me to define my own grammars; therefore, more plugins to choose, not limited to a single authority. Also, plugins are written in JavaScript, therefore can emit JavaScript codes, not only some IDE safety only.

I know both Flow and TypeScript emit their own specific type definitions, not cross-compatible with each other; but are there ways to normalize that (e.g. emit JSDoc as well)?

I have seen repos with `*.d.ts` inside it. Are there libraries to help writing that?
Migrating Your WordPress Website To A New Domain
Tags: wordpress, tutorial, webdev, codenewbie
Published: 2020-07-28 04:23:05

Imagine having to rebuild your WordPress website all over again because you got a new domain name.

On several occasions, I have had to build WordPress websites on temporary domains, and then move them to the permanent domain when ready. 

The right tool for this is the “All-in-One WP Migration” plugin which currently has over 2 million active installs. This plugin exports your entire website – including the database, and imports into the  new domain.

Once installed and activated in the old wordpress dashboard, A menu for the newly installed plugin appears on the sidebar. Hover over it, then;

* Click “Export”
* Select “Export to” > **File**

![GYRO Design Lab](https://gyrodesignlab.com/wp-content/uploads/2020/07/select-export-to-file-1024x559.png)

* Once the archive process is complete, click to download.

![GYRO Design Lab](https://gyrodesignlab.com/wp-content/uploads/2020/07/download-archived-file-1024x554.png)

* Now go to the wordpress dashboard of the new domain
* Install and activate the “All-in-One WP Migration” plugin. Again, you will find the link to the newly installed plugin on the side panel. Hover over it:
* Click “Import”
* Select “Import to” > **File**

However, recent installations of All-in-One WP Migration only allows you a 128mb upload limit while previous installs on the same server allowed 520mb uploads. If your website exceeds the limit, you need install and activate the [All-in-One WP File extension plugin](https://import.wp-migration.com/). 

Now go ahead and import your downloaded website.

![GYRO Design Lab](https://gyrodesignlab.com/wp-content/uploads/2020/07/import-archive-file-1024x561.png)

Once your website is successfully imported, the page reloads, and you will be required to enter your login details to re-access your dashboard.

You’re good to go
Understanding Git and GitHub
Tags: git, github, codenewbie, tutorial
Published: 2020-07-28 04:13:27

First of all, Git is to GitHub – what porn is to pornhub.

Let me tell you a story.

Back when i started out coding, and had to collaborate with another developer, i would send the backend guy a zipped version of my frontend code – either in a flash drive, or via email, and whenever i needed to make further UI changes, he would send back the codebase [including his backend code], and I would have to navigate the codebase to make my changes without messing up my guy’s backend code.

So Rookie! But hey! We got the job done. Most importantly, I had fun doing it.

Imagine the horror if it was a large project – with over 15 developers working on it.

By the way, I started out doing web design – using HTML, CSS, and jQuery because it was the only coding space I felt I could immediately see the effect of my code.

For some reason, the resources I could lay my hands on – made zero reference to Git or GitHub, so I had no idea what those terms meant. Even after I finally got to know of them, the concepts got more and more confusing than I’d like to admit. 

#### Now that I understand the concepts, it has been a fun ride.

Git and GitHub are two very different entities, and can not be used interchangeably.

Git is a distributed version control system; this means It allows us to track changes in an application, in a folder, in a single file – over time, across different users, and different computers. 

GitHub is like a social network or platform for Git repositories; a repository is a set of files for a project. GitHub allows us to share our repositories with team members, publish things online, and collaborate on open-source projects.

Git can be used on it’s own. It is the main technology, while GitHub is the platform to share it and collaborate using Git.

The first step to becoming a Git-GitHub rockstar is to try out this simple task;

#### Let’s create a simple repository containing a readme.txt file


1. Download Git [here](https://git-scm.com/downloads)
2. Register on [GitHub](https://github.com), and create a repository.
3. Now create a “readme.txt” file in a folder on your desktop.
4. Open this folder > Right click > Now click the “Git Bash Here” option to open the terminal.
5. In the terminal, type `git init` then press enter
6. `git add readme.txt`
7. `git commit -m "first commit message"`
8. `git remote add origin URL` [copy this URL from the your repository page]
9. `git push -u origin master`


We have successfully created our first repository containing a readme.txt file.

This can be shared with team members so they can make changes within the file, or even create new folders which would be accessible to you.
Effective Java! Use Instance Fields Instead of Ordinals
Tags: java, effective, enum, architecture
Published: 2020-07-28 04:00:49

---
title: Effective Java! Use Instance Fields Instead of Ordinals
published: true
description: A dive into chapter 35 of Effective Java
tags: java, effective, enum, architecture
series: Effective Java Review
canonical_url: https://blog.scaledcode.com/blog/effective-java/effective_java_use_instance_instance_fields_not_ordinals/
---
 
There are times that there is a natural ordering and ordinals that could be assigned to our different `enums`.  For example consider the following:
```java
public enum Ensemble {
  SOLO, DUET, TRIO, QUARTET, QUINTET, SEXTET, SEPTET, OCTET, NONTET, DECTET; 

  public int numberOfMusicians( return ordinal() + 1; );
}
```

Using the `ordinal` built-in function may initially seem like a good idea as the ordinals follow the correct number that should be returned from our `numberOfMusicians` function. The problem lies in the maintenance of the `enum`. The ordering of the values in the `enum` are tied to their value. This can cause problems for if we want two values to return the same value or if we want to skip a value. For example consider a _double quartet_ which should return `8` from the `numberOfMusicians` function. However an ordinal can only be connected to one value and `OCTET` is already connected with that ordinal. Also consider if we wanted to make a value for _triple quartet_ which should return a `12` from the `numberOfMusicians` function. However ordinals go in order and the last value we have would match up with `11` and not `12`. So we either need to make a useless value to fill up space or we can't do it. 

So what we should reach for instead is using instance variables. Using this method we get way more flexibility without giving up much conciseness. Let's take a look at how this would look.
```java
public enum Ensemble {
  SOLO(1), DUET(2), TRIO(3), QUARTET(4), QUINTET(5), SEXTET(6), SEPTET(7), OCTET(8), DOUBLE_QUARTET(8), NONTET(9), DECTET(10), TRIPLE_QUARTET(12); 

  private final int numberOfMusicians;

  public Ensemble(int numberOfMusicians) {
    this.numberOfMusicisians = numberOfMusicians;
  }

  public int numberOfMusicians( return numberOfMusicians; );
}
```
In this new and improved version we no longer use the `ordinal` function and instead use the instance fields. This has given the flexibility to easily add the _double_ and _triple_ quartet ensemble values. 

So what good is the `ordinal` function if we basically are told never to use it. Well the documentation itself says: "Most programmers will have no use for this method. It is designed for use by general-purpose enum-based data structures such as `EnumSet` and `EnumMap`". Unless you are writing code like that you don't need to worry about this function.
Nightmare of Regular Expression will end here?
Tags: regularexpression, javascript
Published: 2020-07-28 03:36:14

---
title: Nightmare of Regular Expression will end here?
published: true
description: This library wrap all old not human-friendly regex holy-crap my nightmare will end here
tags: regularexpression, javascript
cover_image: https://dev-to-uploads.s3.amazonaws.com/i/6fesadfuwmzpspebhuex.png
---

I discover that repo when checking on Github for morning coffee 

seem interesting 

{% github francisrstokes/super-expressive %}
Day 57 : 100DaysofCode - Remembering to Git Commit Often
Published: 2020-07-28 03:27:40

I have figured out what I want to build in the future. I want to build a command line tool or maybe an app that reminds me to commit my code ever so often. Recently I have been putting 5 minute alarms on my phone to remind me, but that can get a bit annoying. I do not know about everyone else, but once I put on my headphones and begin coding I forget to commit what I am doing. Then when I finally get a few things functioning to my liking I realize I have not committed in 15-20 minutes.

![Alt text of image](https://media.giphy.com/media/uxpOnmmGkeEOQ/giphy.gif)

So here I am adding more work by going to each file and seeing what I did so I can git add and commit. 

There has to be a better way! I saw this article that talks about something similar to my idea. 

{% link https://dev.to/suin/git-remind-do-you-forget-to-git-commitgit-push-17pb %}

However, I want to build something that tracks files as they are saved. For example, if you edit and save a file more than 3x, 5x, or 10x you get a little alert saying you should commit now. 

I personally feel like this will be very helpful in the dev community. Hopefully I can start working on it soon. If anyone has any ideas or other solutions please let me know, all ideas are welcome. 

As always thanks for reading!

Sincerely,
Brittany 

Song of the day:

{% youtube IeVoBe2shq0 %}
Angular 9 Material Expansion Panel Example
Published: 2020-07-29 09:58:05

---
title: Angular 9 Material Expansion Panel Example
published: true
date: 2020-07-28 03:27:28 UTC
tags: 
canonical_url: https://www.itsolutionstuff.com/post/angular-material-expansion-panel-example-angular-9-mat-expansion-panelexample.html
---

Now lets see example of angular material expansion panel example this example will help you angular 9 material expansion panel This post will give you simple example of angular matexpansionpanel example This article will give you simple example of angular mat expansion panel exampleAngular
Make your app appear on the start menu with just one file
Tags: linux, ubuntu, beginners
Published: 2020-07-28 03:04:19

You just made an awesome app! Now you want others to be able to install it, and use it. You may want it to appear on the main menu, it must be searchable, it must appear in the context menu as "open with <your_app>". You might further want to pin it to the dock or add it to favorites.

Taking the example of [Coreavor]([https://github.com/Mithil467/Coreavor](https://github.com/Mithil467/Coreavor/blob/master/coreavor.desktop)), a simple image viewer that I made recently, I needed to associate the program with images so that I can right click and open it in `Coreavor`.

All of this is achieved with the help of a desktop file which is a simple text file with `.desktop` extension.

```
[Desktop Entry]
Type=Application
Name=Coreavor
Icon=/usr/share/icons/coreavor.png
Comment=A simple Image Viewer
Exec=/usr/local/bin/Coreavor %U
TryExec=/usr/local/bin/Coreavor
Terminal=false
MimeType=image/png;image/gif;image/jpg;
```

Every desktop file must have this structure, although not all fields are compulsory, but messing up a field might result in unwanted results.
Most of these fields are self explanatory.

- `Exec` takes in the instruction to be executed. The `%U` at the end takes in command line arguments which are passed to your program.
- `TryExec` is the file path to the executable.
- `MimeType` is used to associate your program with files of a certain type.

You can read about the standard and information regarding more keys used in `.desktop` file [here](https://specifications.freedesktop.org/desktop-entry-spec/desktop-entry-spec-latest.html)

Place this file in the `/usr/share/applications` directory so that it is accessible system wide, or in `~/.local/share/applications` to only make it accessible to a particular user.

All your other apps' desktop files are present here. You can have a look at any of these files to understand and learn from them.

References:

[Gnome's guide](https://developer.gnome.org/integration-guide/stable/desktop-files.html.en)

[KDE's guide](https://techbase.kde.org/Development/Tutorials/Desktop_File)
Data Science in Python: Pandas Read Sources
Tags: pythonbeginner, datascience, collaboration, pandas
Published: 2021-04-14 12:14:34

---
title: Data Science in Python: Pandas Read Sources
published: true
date: 2020-07-28 03:00:00 UTC
tags: pythonbeginner,DataScience,Collaboration,pandas
canonical_url: https://andersonbraz.com/data-science-in-python-pandas-read-sources
---

In this post I show basic knowledge and notes for data science beginners. You will find in this post an link to Jupyter file with code and execution.

## Pandas Basics

Pandas is a fast, powerful, flexible and easy to use open source data analysis and manipulation tool, built on top of the Python programming language.

Use the following import convention:

```
import pandas as pd

```

## Important

Here I continue the content of the previous post [Data Science in Python: Pandas Introduction](https://dev.to/braz_anderson/data-science-in-python-pandas-introduction-546e-temp-slug-2652034)

This post I consider three sources: CSV, XLSX and SQL Query

## Read and Write CSV

```
pd.read_csv('origin-file.csv', header=None, nrows=5)
pd.to_csv('destin-file.csv')

```

## Read and Write Excel

```
pd.read_excel('origin-sheet.xlsx')
pd.to_excel('destin-sheet.xlsx', sheet_name='Sheet1')

```

## Read and Write to SQL Query or Database Table

```
from sqlahchemy import create_engine
engine = create_engine('sqlite:///:memory:')

pd.read_sql('SELECT * FROM my_table;', engine)
pd.read_sql_table('my_table', engine)
pd.read_sql_query('SELECT * FROM my_table;', engine)

```

## Conclusion

Pandas is flexible and easy to use analysis and manipulation data with external sources.

## See on Practice - Code and Execution

colab.research.google.com/drive/1XAr9EMsuwH..

## Credits

Photo by [Markus Spiske](https://unsplash.com/@markusspiske?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText) on [Unsplash](https://unsplash.com/?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText)
Multi tab / page view in flutter
Tags: dart, android, ios
Published: 2020-07-28 02:46:29

To give the pages of the TabBarView a unique scroll position storage container, use a PageStorageKey.

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/ma3robzq1qtiiirti5us.gif)

```dart
import 'package:flutter/material.dart';

void main() {
  runApp(new MyApp());
}

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return new MaterialApp(
      home: new MyHomePage(),
    );
  }
}

class MyHomePage extends StatefulWidget {
  @override
  State createState() => new MyHomePageState();
}

class MyHomePageState extends State<MyHomePage> with TickerProviderStateMixin {
  TabController _controller;
  int _tab = 0;

  @override
  void initState() {
    _controller = new TabController(length: 2, vsync: this);
  }

  Widget build(BuildContext context) {
    return new Scaffold(
      appBar: new AppBar(title: new Text('Example App')),
      body: new TabBarView(
        controller: _controller,
        children: <Widget>[
          new ListView.builder(
            key: new PageStorageKey('feed'),
            itemBuilder: (BuildContext context, int index) {
              return new ListTile(
                title: new Text('Feed Item $index'),
              );
            },
          ),
          new ListView.builder(
            key: new PageStorageKey('notifications'),
            itemBuilder: (BuildContext context, int index) {
              return new ListTile(
                title: new Text('Notification $index'),
              );
            },
          ),
        ],
      ),
      bottomNavigationBar: new BottomNavigationBar(
        onTap: (int value) {
          _controller.animateTo(value);
          setState(() {
            _tab = value;
          });
        },
        currentIndex: _tab,
        items: <BottomNavigationBarItem>[
          new BottomNavigationBarItem(
            icon: new Icon(Icons.home),
            title: new Text('Home'),
          ),
          new BottomNavigationBarItem(
            icon: new Icon(Icons.notifications),
            title: new Text('Notifications'),
          ),
        ],
      ),
    );
  }
}
```
Good developer podcasts
Published: 2020-07-28 02:44:08

Here are some my favourite podcasts for developers.

#JavaScript Jabber 
JavaScirpt jabber is a podcast that talks about different topics mostly connected to javasciprt but you don't need to know javascript to understand. Now saying that there are some episodes that are dedicated for JavaScript developers.

#CodeNewbie 
CodeNewbie is a podcast that talks about how developer came to be and their journey.

#Developer Tea 
Developer Tea talks about a variety of developer topics. More like JavaScript Jabber. They also talk how to be a better programmer. 

#The Real Python Podcast 
This talks about python coding tips and interviews, and lot's of other topics related to python this is the JavaScript Jabber for python.
The No. 1 WFH hack
Tags: productivity, workstations
Published: 2020-07-28 02:41:34

If you're reading this, you're probably working from home. OR you go to an office and work from home on a side project.

Let's get something straight. You need boundaries when you work from home, or you will always be working/not working simultaneously. This results in non productive and stressful work/life balance.

This is my gift to you! 

> Ready?

Keep your computer in 1 spot in the house.

> Thats it?

Yep that's it. You need separation of your relax space and your hustle space. If you just bring your computer everywhere you "relax", your home becomes your stressful work space.

It's all about creating a physical boundary between work and relax, so at the end of the day you can disconnect and separate. 

> No your dining room table is not an option.

Get creative, don't spend a lot of money.

Thanks for reading

Scott
Why Don't We Teach Coding Practices In Academia?
Tags: computerscience, leadership, discuss
Published: 2020-07-28 02:04:23

After been in the tech industry for just a little over 3 years, I've come to the realisation that no matter the level of seniority there had been a rather consistent pattern.

Fellow coders, unless trained / learnt good coding practices, have had really horrible coding habits. Discussing about what those practices are would be out of the scope of this topic.

And that begs the question.

Why do Academia around the world not have (at least common ones) coding practices to be a mandatory subject to be taught or at least be advocated to its students?
Must know python libraries
Tags: python
Published: 2020-07-28 01:50:09

Here are a few of the top python libraries that I think every should know.

#Numpy: 
Numpy is a library that will help you do some complex maths with python and this is very useful when you are doing something like machine learning or data handling. You don't need to know everything about maths but it's a good idea to go through stuff like mean. Just for knowledge.

#Matplotlib: 
Matplotlib is a library that allows you to make and plot graphs and visualise things in a better way. This will is especially helpful when you are working with data. 

#Pandas:
Pandas is a library that allows you to work with csv and other types of data documents and just data in general. Pandas allows you to import other documents like a .csv file

#Conclusion:
With this sweet of tool's you can do some very complex stuff, and if you add tensorflow with this tool set you can create and craft some amazing things. I didn't mention libraries like pygame or tensoflow, because they are meant for a topic; whereas these can be used in most if not all big applications.
Bathe, the simplest WordPress starter theme
Tags: wordpress, wpenv, sass, browsersync
Published: 2020-07-28 01:44:10

---
title: Bathe, the simplest WordPress starter theme
published: true
description: The simplest WordPress starter theme including Sass, PostCSS, Autoprefixer, stylelint, Webpack, ESLint, imagemin, Browsersync, etc.
tags: wordpress, wpenv, sass, browsersync
cover_image: https://ixkaito.github.io/bathe/images/ogimage.png
---

I released a simplest WordPress starter theme including full setup for Sass, Autoprefixer, stylelint, Webpack, ESLint, Browsersync, etc.

- Documentation: https://ixkaito.github.io/bathe/
- GitHub repository: https://github.com/ixkaito/bathe

If you use [wp-env](https://developer.wordpress.org/block-editor/packages/packages-env/) with Bathe, you can start your theme development really fast.

**1. Download or clone your repository generated from Bathe**
**2. Change directories into the Bathe folder**
```shell
cd /path/to/bathe
```
**3. Start wp-env**
```shell
wp-env start
```
**4. Install dependencies**
```shell
npm i
```
**5. Start developing**
```shell
npm run dev
```

Of course, you can use Bathe with any development environment other than wp-env.

I would love to hear your feedback, and issues and PRs are welcome 😎