teleren/devto huggingface dataset:
Astronomical computing – Ep 1 - A new hope
Tags: ruby, astronomy, programming
Published: 2022-04-11 20:25:19

## Introduction

I have always been passionate about astronomy. It has been years since I try to find a project that associates this passion with my love of coding.

I tried to scrap astronomical data from [Heavens Above](https://www.heavens-above.com) or [Nasa](https://solarsystem.nasa.gov/planets/overview/), to retrieve ephemerides from [SSD JPL Horizons](https://ssd-api.jpl.nasa.gov/doc/horizons.html) or to compute Solar System bodies with [Python libraries](https://rhodesmill.org/skyfield/).

There are many things to be done to achieve my real goal which is to provide open APIs and libraries to easily compute and consume space data.

In the mean time, I recently realized that I spent a lot of time to understand science popularization, but I neglected mastering the basis and I spent too much time away from resources that explain how to compute this data oneself.

## Introducing a new blog series

I recently discovered a wonderful book called _Astronomical Algorithms_ by Jean Meeus. This book provides a ton of methods and calculations around Solar System bodies such as the Moon phases, the planets' positions or even eclipses.

What I would like to do, is to dive into this book, try to understand it, adapt the calculations into a Ruby library, and explain on blog posts what I am learning and how things work.
I am not the first to adapt these calculations into libraries, you can easily find [C++](http://www.naughter.com/aa.html) or [JavaScript](https://github.com/onekiloparsec/AA.js) adaptations. These adaptations will be useful to me when things will be complicated for my simple mind. But my main goal is to understand completely what I will be reading and to provide as much as possible information about the mind process around understanding mathematical algorithms and building code around them.

I will make approximations, probably some mistakes, I will not wait to have a fully implemented, tested, documented library before publishing it. I really want to code as I discover the formulas and learn new notions.

## What next?

On the next episode, I will start with angles, their units and how to convert them.

_Happy hacking!_
GIT TIPS: Creating a new empty branch
Tags: git, beginners, programming, github
Published: 2022-04-11 20:22:27

# When to create a new empty branch?

Sometimes, it can be very useful to create a new empty branch on `git`. For example, imagine the following scenario: you are working on a website project but you also want to keep a good documentation aside, in the same repository. So, in order to keep things minimally separated, you can create a brand new branch called `docs` and keep your website code at another branch called `develop`.

That way, **you can always easily change from one workspace to another** (changing branches) and also keep everything inside your *repository*.

# How to create it?

It's simple: let's execute the command `git checkout`, in order to change to another branch. Also, we're going to use the `--orphan` flag, which is going to be responsible for creating a branch with *empty commits on it* (you can `git log` in order to verify this, after creating the branch).

Also, we must give the branch a name right after the `--orphan` flag.

```
git checkout --orphan <branch_name>
```

Then, your project files from the previous branch you were working at will still be there. But they will be there just as `untracked` files and they can be easily removed by executing the command:

```
git reset --hard
```

When using the `--hard` flag, `git reset` will be responsible for destroying any changes you've made in your branch files, compared to the last HEAD commit (last commit you've made). Since our branch is empty and has **no commits** on it, all the files are going to be instantly removed.


# Switching back to another branch:

After creating a commit in your new branch, it will be visible in your branch list, which you can check by using the command:

```
git branch
```

Then, you can switch between any branches by using:

```
git checkout <branch_name>
```


# Enjoyed it?

Please, like this post and follow me on social media!
Resolvendo exercícios do JSchallenger - (Javascript Basics #3)
Tags: javascript, jschallenger, typeof, serie
Published: 2022-04-11 20:16:00

O que deve ser feito?

- Escrever uma função que obtenha um valor como argumento
- Retornar o tipo do valor

Espera-se que utilizemos `typeof` nesta função.

### Para lembrar

`typeof` é um operador que retorna uma ***string*** com o tipo do valor informado.

```javascript
function myFunction(a) {
   return typeof a
}
```

### Resultados

```javascript
myFunction(1) // 'number'
myFunction(false) // 'boolean'
myFunction({}) // 'object'
myFunction(null) // 'object'
myFunction('string') // 'string'
myFunction(['array']) // 'object'
```

Para quem quiser resolver o desafio, o ***link*** está aqui:

[Get type of value](https://jschallenger.com/javascript-basics/type-value-javascript)

Gostou? Até a próxima anotação! :)
Let’s talk Relations
Published: 2022-04-11 20:06:13

When getting started on a Ruby or Rails app, you may find that you have many tables that correlate. For example, let’s say we are making an app for a football team, this team plays in many games throughout the season but has their own stadium in their city. If we wanted to show the relation in a rails, we would use the macros in the Teams model:

**Belongs_to**

We can use this macro to state that the team belongs to a specific city. (Notice that city is singular)

`Belongs_to :city`

**Has_many**

We use this to show that the Football team participates in many games throughout the season. With this relation, we could call TeamName.Games.All and the console would return all games the team has participated in.

`Has_many :games`

**Has_many.    , through:**
We can use this macro to show nested relations or relations that happen through an already associated relation. 

`Has_many :points, through: :games`

Now if we seeded our DB to display points for each team(that would be a lot of instances), I would be able to call 
TeamName.Points.All and the console would return the points from each game. This is because we now have access to points, through the games class.

**Simple enough right? If you found this informative, I’d love to hear your feedback.**
Check out my github to see how i use these macros:
https://github.com/robinlashae1
Ng-News: Episode 22/14
Tags: angular, javascript, programming, webdev
Published: 2022-04-11 20:02:02

This is a weekly posting, covering the latest updates from the Angular community.

{% embed https://youtu.be/IH6qkTaOrHc %}


## RFC: Standalone APIs

Alex Rickabaugh from the Angular core team published an RFC under the name “Standalone APIs”. It is based on Standalone Components, a new feature that will make NgModules optional. The use case here is, that although we can write our components as standalone, we still need NgModules for various tasks.

Think of the RouterModule for the routing configuration, the AppModule for bootstrapping, the HttpClientModule, the StoreModule in NgRx, etc.

The RFC “Standalone APIs” discusses alternative or new ways for these tasks, 

The RFC is open for everyone, you are invited to comment and many people have already done that.

[RFC: Standalone APIs](https://github.com/angular/angular/discussions/45554)

[Angular Blog on Standalone APIs](https://blog.angular.io/an-update-on-standalone-components-ea53b4d55214)

## nx 13.10 & Roadmap for v15
nx, an extension to the Angular CLI is available in v13.10. Most of the new Angular-related features are in the area of module federation.

But that’s not all of it. Juri Strumpflohner wrote an article where he gave a detailed overview of all the new features since version 13.5.

In addition, Viktor Savkin, the central person and co-founder of nx, published the roadmap for version 15. So that would be the next but one version. We can expect an automatic migration from Angular CLI projects, which contain multiple libraries and applications. The test execution will be faster and the Nx console, a plugin for VSCode, will get some additional features.

[Nx 15 Roadmap](https://github.com/nrwl/nx/discussions/9716)

{% embed https://dev.to/nx/whats-new-in-nx-1310-5126 %}

## Miscellaneous

Armen Vardanyan wrote a good article on use cases for the RxJs combination operators. So those that process multiple Observables.

{% embed https://dev.to/this-is-angular/understanding-rxjs-use-cases-part-i-2mfb %}

Vugar Abdullayev wrote a YouTube clone in Angular for three different monorepository tools: Lerna, TurboRepo and nx.

{% embed https://twitter.com/Vugar005/status/1502303304243720205 %}

Manfred Steyer published an article where he discusses in detail, how to deal with MicroFrontends, when multiple Angular versions or even different frameworks need to run together.

{% embed https://twitter.com/ManfredSteyer/status/1513373777924612100 %}
Django Register page with custom Form
Published: 2022-04-11 19:54:07

**forms.py**

```python
from django import forms
class registerCustom(forms.Form):
    username = forms.CharField(widget=forms.TextInput())
    password = forms.CharField(widget=forms.PasswordInput())
    confirm_password = forms.CharField(widget=forms.PasswordInput())
```
**views.py**

```python
from .forms import registerCustom
from django.contrib import messages
from django.contrib.auth.forms import User

def register(request):
    if request.method == 'POST':
        form = registerCustom()
        username = request.POST.get('username')
        password = request.POST.get('password')
        password2 = request.POST.get('confirm_password')
        if User.objects.filter(username=username).first():
            messages.error(request,'Username already existed')

        elif len(password) < 8 and len(password2) < 8:
            messages.error(request, 'Your password is too weak at least 8 character up !')
            return redirect('/reg')
        else:
            if password == password2:
                user = User.objects.create(username=username, password=password)
                user.save()
                messages.success(request,'Register successfully !')
                return redirect('/login')
            else:
                messages.error(request,'Password is not match')
                return redirect('/reg')
    else:
        form = registerCustom()
    return render(request,'app/register.html',{'form':form})
```
register.html

```html
{% block content %}
    <form method="POST">
    {% csrf_token %}
    {{ form }}<br>
    <button type="submit">Sign Up</button>
    <a href="{% url 'login' %}">Login</a>
    </form>
{% endblock %}

```
**urls.py**

```python
from django.urls import path
from . import views

urlpatterns = [

    path('reg/', views.register),
]

```
Commit early, commit often
Tags: git, github, codenewbie, programming
Published: 2022-04-11 19:23:11

## Introduction

It has been commonplace that people are kind of afraid of commiting. It's not rare to see big, heavy changes in one single commit. And this is not good, since it will not be easy to code review.

There are many, many ways to improve commits, and this goes through two simple tips: **standardize your commits** and **create more branches**. Let's talk about them a bit.

## Standardize your commits

It is very important to have a standard for message commits, because it makes it easier to read, as well as to reuse them. We only need to change specific details, depending on the changes being made. 

It works better when there's already a chosen flow, which is generally previously agreed with other team members. There are many options available, and lately I have been using gitmoji.dev as an add-on to them.

## Create more branches

Maybe because of subversion, people think that branching may create some overhead on the project. But that is not true. I see branching, along with git messages as part of the documentation. They must explain directly what is being done.

If a feature branch is created and two people are working on that, tasks must be defined and each (sub) branch should be created for each person. Then, one approves the changes of the other and vice-versa.

## Conclusion

Regarding the commits, along with standardization, I also like to commit empty changes using `git commit --allow-empty` to mark the beginning of a branch, or some intermediate and important point. I even commit broken or incomplete code this way!

`git commit --allow-empty -m":boom: going to lunch, incomplete code is pending bugfix on feature WorldDomination"`

Branching _per se_ may lead to a "branch hell" problem, but only if they are not properly managed. A branch must be created and then, when it's purpouse is reached, the pull request (or merge request) must be created, approved or rejected and them the branch must be deleted.

And that's it. If you have any doubts or suggestions, let me know in the comments below.

Cheers,
Django messages config with bootstrap
Published: 2022-04-11 19:42:14

**setting.py**

```python
from django.contrib.messages import constants as message_constants
MESSAGE_TAGS = {message_constants.DEBUG: 'debug',
                message_constants.INFO: 'info',
                message_constants.SUCCESS: 'success',
                message_constants.WARNING: 'warning',
                message_constants.ERROR: 'danger',}

```
**views.py**

```python
from django.contrib import messages
def Example(request):
    if request.method == 'POST':
        form = registerForm(request.POST)
        if form.is_valid():
            form.save()
           > messages.success(request,'Register successfully !')
           > messages.error(request,'Register successfully !')
           > messages.info(request,'Register successfully !')
           > messages.warning(request,'Register successfully !')
            return redirect('/login')
    else:
        form = registerForm()
    return render(request, 'app/register.html', {'form': form})
```
**JUST USE MY STEP AS I DID ABOVE NO NEED TO EXECUTE AT HTML**
Day 11 -- #100days
Tags: webdev, beginners, 100daysofcode, frontend
Published: 2022-04-11 19:41:43

Currently on Day 11 of my 100 days of code.
Done with lessons on grid and flexbox, putting those skills together in a project.

The project is an Admin dashboard that makes use of CSS grid and flexbox.This is what I'm to do.
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7pspk642ddpsip3icxg8.png)




This is what I've done so far, and I'm loving myself for coming this far... :)  
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/iz9kmlcuya2fimhw2zqw.png)

At the end of the project, I'm hoping to use that design for my portfolio. Will keep y'all updated.
Trouble finding good front end dev
Tags: webdev, frontend, hiring
Published: 2022-04-11 19:40:42

Hi everyone,

I work for a tech startup and we've recently been looking for a front end dev to hire full time or part time for our software platform, but have gotten horrible applicants. Most people are either straight out of school or have terrible unreadable resumes and portfolios filled with spelling mistakes and generally bad design.

We posted the job on LinkedIn and Indeed.

Are we doing something wrong? Where and what do experienced front end devs look for in terms of job description, salary, etc.?

Thanks in advance for your help!

Job post is linked [here](https://www.linkedin.com/jobs/view/2967885211/)
How to get a job using Rust (and other questions)
Tags: rust, opensource, career
Published: 2022-04-11 19:40:18

Recently I joined the organizing committee of the Rust London User Group as their In-house Careers Advisor. 

The goal is to promote and contribute to the Rust community on the most important layer of the stack: people.

## Intention 
The intention is to provide counsel to everyone, on a range of Rust-related topics. Your individual use-case may vary, but could include:

- You're a (recent) graduate and would like advice on acquiring a Rust job. Or guidance on how to build a meaningful portfolio.

- You're already interviewing and could use some general tips.

- You're hiring Rust engineers and would like to troubleshoot or optimize your pipeline.

- You're an established software engineer, but use a different language. You're curious how to transition to Rust.

- You'd like to drive adoption of Rust in your current company or team. You would like to brainstorm a strategy that considers the environmental nuances. Example: navigating stakeholders or evangelizing Rust.

- You're the maintainer of a Rust project and would like to find some contributors (or vice versa).

- You're interested in funding for your Rust project. Or you'd like to investigate a potential collaboration with a company.

## About Me
Former engineer, passionate about Rust and its community since 2019.

Each day I speak with Rustaceans who share their thoughts, experiences and pain-points. I also consult with companies and deep dive into their expectations and challenges.

Advice derives from a distillation of the above perspectives. Blended with my personal insights.

**Disclaimer:** _I make no claims of authority. I can't guarantee a perfect answer. But I likely know someone who does. I'd be happy to connect you._

## How can I help?
I view this as a community project. But it has at least one major drawback: scalability. To better serve the community I'd like to create real-world content that 1. addresses common scenarios and 2. highlights interesting use-cases and 3. contains tangible lessons.
Content will be published on ferrous-systems.com/blog/

You can help by sharing your story or asking questions to me here or @ neesh@missing-link.io.

(With your consent, I may use your anonymized story as a basis for an article that others may find useful)
"How to create list from a grid present in a file"
Tags: cpp, clan
Published: 2022-04-11 19:22:58

I have a file containing 

12
12
0 0 0 1 0 1 0 1 0 1 0 1
1 0 0 1 0 1 0 0 1 0 0 0
1 1 1 1 0 1 0 0 0 0 0 1
1 0 1 0 0 0 0 1 0 0 0 0
0 0 0 0 0 0 1 0 1 0 1 0
1 0 0 1 0 1 0 0 0 1 0 0
1 0 0 0 0 1 0 0 1 0 0 1
0 0 0 0 0 1 0 1 0 1 0 0
0 0 1 0 1 0 1 0 1 0 1 1
0 0 1 0 1 0 1 0 1 0 0 0
0 0 0 0 0 1 0 1 0 0 0 0
0 0 1 0 0 0 0 1 0 1 0 0


I just want to read the grid and store into a dynamic array.
Could anyone please help me this?
Need Help 🙏 unable to delete cookie in Express
Tags: node, codenewbie, help
Published: 2022-04-11 19:15:45

Hello everyone 👋 I am a newbie working on a full stack web app using node, express and mongodb in the backend for my final semester project. 

I am working on an admin portal, when users (admins) sign in a cookie is stored in the browser and a token (using json web tokens here) is stored in the mongodb, but I am unable to delete the cookie during logout.

My logout code is :-

```
app.get("/logout", auth, async (req, res) => {
  try {
    
    req.user.tokens = req.user.tokens.filter((currentElement) => {
    return currentElement.token !== req.token })

    res.clearCookie("jwt");
    console.log("Logout Successful");

    await req.user.save();
    res.render("/");

  } catch (error) {
    res.status(500).send(error);
  }
});
```

Authorization code :-

```
const auth = async (req, res, next) => {
    try  {
        const token = req.cookies.jwt;
        const verifyUser = jwt.verify(token, process.env.SECRET_KEY);
        console.log(verifyUser);

        const user = Register.findOne({ _id :verifyUser._id});
        console.log(user.firstname);

        req.token = token;
        req.user = user;

        next();     

    } catch (error) {
        res.status(401).send(error);
    }
}
```

Logout only gives this output :-


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

And it seems like 
**res.clearCookie("jwt")**
is not working here 👇


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

as the **jwt** cookie is not getting deleted 😑 Please help I am stuck from weeks. Unable to figure out how to make it work.
"Transcriptube" - maintain the habit of reading news, podcast
Tags: hackwithdg, node, showdev, webdev
Published: 2022-04-11 19:01:18

### Overview of My Submission
In the the era of of fast internet we can listen or watch any news or podcast by a single tap without any hassle. But because of this facility we don't need to read any words, which is **disrupting our reading habits** day by day. To maintain this good habit we can read any article or podcast instead of listening.
Here This [Transcriptube](https://transcriptube.herokuapp.com/) web application comes to play a major role.
**_we can easily transcribe any youtube video by just providing the URL of that video_**

After submitting the URL the backend process will start:
- First it will fetch the youtube video of given link through [SocialDownloader](https://socialdownloader.in/) API.
- It will take a few seconds. After that the API will generate the link of downloadable mp4 video.
- As soon as the link get fetched the deepgram API will pick it and starts generate the the transcript of the video. This process can take upto 5 minutes!
- After generating the whole transcript will fetch the data and comes to the frontend.

Now I have created it just for Youtube videos but in future I'll enable it for any vocal media link.

[Land on the Home Page](https://transcriptube.herokuapp.com/)

![Home Page](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/uf12nhgqrd4o4vbtvxtq.png)


### Submission Category: 
Accessibility Advocates


### Link to Code on GitHub

 {% github 8-bit-souvik/Transcriptube %}


{% embed https://youtu.be/t_ySQ1Eb9W4 %}



### Additional Resources / Info
#### Tools used:
- [Node JS](https://nodejs.dev/)
- [Express JS](https://expressjs.com/)
- [EJS](https://ejs.co/)

#### Resources used:
- [Deepgram](https://www.deepgram.com/) 
- [RapidApi](https://rapidapi.com/CrashBash/api/socialdownloader/details)
- [SocialDownloader (API)](https://socialdownloader.in/)
- [Heroku](https://www.heroku.com)



![On Action](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/nb7pcmcffp4s363koj61.png)