teleren/devto huggingface dataset:
Notes from AWS re:Invent 2022: the Giant Magellan Telescope
Tags: astronomy, aws
Published: 2022-12-05 16:15:13

Most of the sessions I attended at re:Invent this year were highly technical, but I also attended some broader science talks, and this talk by Giant Magellan President Dr. Robert Shelton was one of them.

Apparently in the Atacama Desert, the driest place on earth, a new telescope is being built: the Giant Magellan Telescope. It's going to be 22 stories tall, the entire building will rotate, and will be up to 200 times more powerful than existing research telescopes. https://www.giantmagellan.org

The telescope's president was presenting at AWS because AWS provides the compute required to simulate the telescope's building envelope. The telescope will require precise environmental controls, and the Atacama Desert is a place with wild temperature swings. With AWS-based simulation, the Giant Magellan project can ensure that their building designs will support the environmental controls required by telescope and the extraordinarily sophisticated instrumentation that can be attached to the telescope!

Dr. Shelton spoke about how the telescope will have the capability to resolve atmospheric composition of exoplanets at the level required to detect extraterrestrial life, finally answering the age-old question: are we alone in the universe?
Four Ways to Create Docker Image for Java SpringBoot Project
Tags: springboot, docker, java
Published: 2022-12-05 16:14:35

In this lecture, we will discuss how to build up Docker Image for the SpringBoot project in 4 different ways.
(1) use spring-boot-maven-plugin built-in Build-Image (without Dockerfile)
(2) use Jib-Maven-Plugin (without Dockerfile)
(3) use dockerfle-maven-plugin (with Dockerfile)
(4) standard docerfile
Prepare:
Code:
https://github.com/davelms/medium-articles/tree/master/spring-maven-docker
make sure the following command can run spring boot Project
First, use spring-boot-maven-plugin built-in Build-Image
SpringBoot preinstalls the plugin for building the Docker image. We don’t need to do any modifications, we need to make sure that it is in the poxm.xml file (spring-boot-starter-parent)
All the setup is default setup and you don’t need to do any modification also.
Run the following command in the Spring Boot Root directory.
_mvn spring-boot:build-image_
Once you see Successfully built image, you can type:
_docker images
_For verifying if the image works with the name of the jar file
_docker run -p 9000:8080 -t name:version
_Then goes to localhost:9000 to test the run

Second, Jib-Maven-Plugin
You only need to run the following command
mvn compile com.google.cloud.tools:jib-maven-plugin:2.3.0:dockerBuild
~mvn compile
com.google.cloud.tools:jib-maven-plugin:2.3.0
use Jib plugin
once success you can see
Built image to Docker daemon as …


Third
We need a Dockerfile in the root directory.
FROM adoptopenjdk/openjdk11:alpine
RUN addgroup -S spring && adduser -S spring -G spring
USER spring:spring
VOLUME /tmp
ARG JAR_FILE
ADD ${JAR_FILE} /app/app.jar
EXPOSE 8080
ENTRYPOINT [“java”,”-Djava.security.egd=file:/dev/./urandom”,”-jar”,”/app/app.jar”]
In pom.xml file, you need to add tags and some configurations.


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/1x11l246xg0a5ysfb8rv.png)



Run command MVN PACKAGE


Fourth,with docker build command for docker images
With installed java 11 and maven, the following command can run
mvn spring-boot:run
Spring Boot framework
The docker file as follow :
_FROM adoptopenjdk/openjdk11:alpine-jre
FROM maven:3.6.3 AS maven
LABEL MAINTAINER=”anyname@gmail.com”
WORKDIR /usr/src/app
COPY . /usr/src/app
RUN mvn package
CMD [“mvn”,”spring-boot:run”]_
Build the container image
docker build -t nametheimage .
You can check the image in docker Images.
Done
Tkinter Label
Tags: python, tkinter, gui
Published: 2022-12-05 16:12:06

Label is the most popular Component in Tkinter framework as it is the most useful element that communicates any textual message.
Label is a class, we instantiate it and pass some arguments to transform its behavior. We add style as if we are using css, we can also change font and its weight.

## Basic Label

```
from tkinter import *

window = Tk()

my_label = Label(window, text = "My first app")
my_label.pack()

window.mainloop()
```
my_label is a variable that refence the instance of the Label, unless you will not access the object in the future then you don't need an identifier for it. Hence getting rid of the call to .pack() is necessary because of the absence of reference variable for the object.
In that case we may write it as follow.

```
my_label = Label(window, text = "My first app").pack()
```
The first argument indicates the parent of the object, in that case window. If the window has a Frame and you want pack the widget in side the frame, then you mention the frame's identifier as the parent(master).
The second argument is the actual text to display on the window, and is enclosed inside double quotes.
"pack()" is a geometry manager method which makes widget appears on the screen, the other two are grid() and place().

The code above will output the following result.

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

The tkinter has some number of arguments that controls the appearance of the text, change the position of the text and add some styles to it.

**anchor**
It specifies the exact position of the text within the size provided to the widget. The default value is CENTER, which is used to center the text within the provided space.

**bg**	
The background color displayed behind the text.

**bitmap**
It is used to set the bitmap to the graphical object specified so that, the label can represent the graphics instead of text.

**bd**
It represents the width of the border. The default is 2 pixels.

**cursor**
It tells the mouse pointer to be used when the  cursor is over a widget, i.e., pirate, dot, plus, etc.

**font**
The font family, size and style  of the text to use. Eg font = ("Arial", 25, "bold"), will give change the font-family to Arial, give the text size of 25 and make the text bold if available.

**fg**	
Changes the color of the text using names or Hexadecimal. For the colors name we use the following rule, fg = "color name", and for the Hex we use add hash sign before the color's code, fg = "#ffffff".

**image**
Sometimes we may like to add images to our apps, the image keyword accepts the PhotoImage instance which hold 
s the path to the image.

**justify**
If the label contains multiple lines of text, the justify keyword changes the orientation of the text . It can be set to LEFT for left justification, RIGHT for right justification, or CENTER for center justification.

**relief**
Specifies the border type to use. The default value is FLAT. Others are SINKEN, RAISED and RIDGE.

**textvariable**
We use a control variable to access or change of the text's properties, through get() mothed.
Python Console Calendar
Tags: python, tkinetr, gui
Published: 2022-12-05 16:09:51

Welcome to another tutorial.
Today I will show you how to develop console calendar using python.

This requires built in method known as "calendar". The module owns a method "month()" which takes two arguments, the year and the exact month which the user want to display.

```
import calendar  

year = 1999
month = 2
Print ("The Calendar of\n: ", calendar.month(year, month))

```
The code above outputs as below

```
The Calendar of                                                     
February 1999
Mo Tu We Th Fr Sa Su
 1  2  3  4  5  6  7
 8  9 10 11 12 13 14
15 16 17 18 19 20 21
22 23 24 25 26 27 28
```

To develop a bot, one can accept input from user for a year and a month.

```
import calendar  
  
year = int(input ("Please enter the Year: ")) # Holds the year

month = int(input ("Please enter the month: "))    # Holds the month 
  
# display the calendar  
Print ("The Calendar of: ", calendar.month(year, month))  
```
Output
```
C:\Users\Ameer_studio\Desktop>py cal.py
Please enter the Year: 1999
Please enter the month: 2
The Calendar of:     February 1999
Mo Tu We Th Fr Sa Su
 1  2  3  4  5  6  7
 8  9 10 11 12 13 14
15 16 17 18 19 20 21
22 23 24 25 26 27 28
```
_Thanks for reading_🙏
Comment lire un fichier JSON et le convertir en Go struct ?
Tags: tutorial, french
Published: 2022-12-05 15:38:00

Aujourd'hui, nous allons voir comment lire des fichiers en Go et comment convertir le contenu en instance de Go struct!

---

# 1 - Comment lire une liste de fichiers dans un dossier

Premièrement, comment lire une liste de fichiers dans un dossier?

Avec la librairie `io/ioutil` c'est très simple. L'exemple suivant vous montre qu'en quelques lignes de code, vous serez capables de lister l'ensemble des fichiers se trouvant dans un dossier et voir pour chacun d'entre eux si c'est un dossier ou non.

```go
package main

import (
	"io/ioutil"
	"log"
)

...
	files, err := ioutil.ReadDir("./chemin/vers/un/dossier")
	if err != nil {
	    log.Fatal(err)
	}

	for _, file := range files {
	    fmt.Println(file.Name(), file.IsDir())
	}

...

```

---

# 2 - Comment lire un fichier ?

Toujours avec la librairie `io/outil`, en appelant sa méthodee `ReadFile` on obtient le contenu du fichier et une potentielle erreur si quelque chose d'imprévu s'est passé ou si le fichier n'est pas présent ou lisible.

```go
content, err := ioutil.ReadFile("file_name.txt")
if err != nil {
	log.Fatal(err)
}
```

---

# 3 - Convertir un fichier JSON en instance de Go Struct

Maintenant que l'on sait lire un fichier, on va voir comment convertir un contenu JSON en instance de Go Struct.

Pour commencer, il faut qu'on définisse dans la Go Struct le mapping entre la structure et son format JSON.

Pour chacun des champs, on va ajouter un paramètre `json` qui va permettre de faire le lien entre le JSON et la structure.

```go
type Creature struct {
	Name                  string            `json:"Name"`
	Tags                  []string          `json:"Tags"`
	HP                    CreatureHP        `json:"HP"`

}

type CreatureHP struct {
	Value int    `json:"Value"`
	Notes string `json:"Notes"`
}
```

A présent que nous avons la structure `Creature` de prête, on peut effectuer la transformation avec le code suivant:
 
```go
// Déclaration de l'instance de la structure que l'on veut remplir
creature := bestiary.Creature{}

// Remplissage de l'instance avec le contenu du fichier JSON grâce au mapping défini plus tôt
err = json.Unmarshal(content, &creature)

// Vérification d'une éventuelle erreur
if err != nil {
   panic(err)
}
```

Et voilà! Maintenant vous savez comment faire pour pouvoir le réutiliser dans votre application Golang!

---

J'espère que ça vous aidera! 🍺🍺

---

<center><h3>Vous voulez me supporter?</h3></center>
<a href="https://www.buymeacoffee.com/mxguilbert7" target="_blank"><img src="https://cdn.buymeacoffee.com/buttons/default-orange.png" alt="Buy Me A Coffee" height="41" width="174"></a>

---

<center><h3>Vous voulez me supporter?</h3></center>
<a href="https://www.buymeacoffee.com/mxguilbert7" target="_blank"><img src="https://cdn.buymeacoffee.com/buttons/default-orange.png" alt="Buy Me A Coffee" height="41" width="174"></a>
How to read a file and convert JSON to Go Struct
Tags: go, tutorial
Published: 2022-12-05 15:18:00

Today, we will see how to read files and how to convert JSON files to Go struct!

---

# 1 - How to read the list of files in a folder

First, How to read the list of files in a folder?

With the library `io/ioutil` it's really simple. With the following code, you will be able to list all the files in a folder and see if it's a directory or not.

```go
package main

import (
	"io/ioutil"
	"log"
)

...
	files, err := ioutil.ReadDir("./path/to/a/folder")
	if err != nil {
	    log.Fatal(err)
	}

	for _, file := range files {
	    fmt.Println(file.Name(), file.IsDir())
	}

...

```

---

# 2 - How to read a file ?

Still with the library `io/ioutil`, it's really simple and only in a few lines of codes.

```go
content, err := ioutil.ReadFile("file_name.txt")
if err != nil {
	log.Fatal(err)
}
```

---

# 3 - How to convert JSON file to Go struct ?

As we know how to read a file, we will see how to convert it in Go struct. With the content of the file we are able to transform it to an instance of a struct.

But first, to let the application how to do the mapping, we need to do some stuff in the struct declaration that we want to use.

For each field, we need to add a `json` parameter to let know what is the equivalent json name.

```go
type Creature struct {
	Name                  string            `json:"Name"`
	Tags                  []string          `json:"Tags"`
	HP                    CreatureHP        `json:"HP"`

}

type CreatureHP struct {
	Value int    `json:"Value"`
	Notes string `json:"Notes"`
}
```

Now that we have our `Creature` struct ready, we can do the transformation with the following code:
 
```go
// Declaration of the instance of the struct that we want to fill
creature := bestiary.Creature{}

// Fill the instance from the JSON file content
err = json.Unmarshal(content, &creature)

// Check if is there any error while filling the instance
if err != nil {
   panic(err)
}
```

And that's it! Now, you can use this instance as all the other one that you can create in your Golang application!

---

I hope it will help you! 🍺🍺

---

<center><h3>You want to support me?</h3></center>
<a href="https://www.buymeacoffee.com/mxguilbert7" target="_blank"><img src="https://cdn.buymeacoffee.com/buttons/default-orange.png" alt="Buy Me A Coffee" height="41" width="174"></a>
How to Learn the Fastest Way
Tags: career, productivity, tutorial, beginners
Published: 2022-12-05 15:14:44

[facebook.com/Trinwhocode](https://www.facebook.com/Trinwhocode)

Contrary to popular belief, personal experience is not always the best or most efficient way to learn, especially in the world of programming. In fact, research has shown that learning from others, such as through observation, conversation, or instruction, is actually the fastest way to learn and master new skills in this field.

One study conducted by MIT found that, when it comes to learning a new programming language, individuals who received instruction from an experienced programmer were able to learn the language significantly faster than those who tried to learn it on their own through personal experience. The study found that the individuals who received instruction were able to understand and apply the concepts of the language much more quickly and accurately, and they were also able to complete programming tasks in a fraction of the time it took those who were learning through personal experience.

Another study, this time conducted by Stanford University, found similar results when it came to learning complex algorithms and data structures. The study found that individuals who received instruction from an experienced programmer were able to understand and apply these concepts much more quickly and accurately than those who tried to learn them on their own through personal experience. In addition, the study found that the individuals who received instruction were able to complete programming tasks related to these concepts in significantly less time than those who were learning through personal experience.

These findings may be surprising to some, as personal experience is often considered to be the most effective way to learn. However, the reality is that learning from others is actually much faster and more efficient, especially in the world of programming. By taking advantage of the experiences and insights of others, we can learn new skills and concepts much more quickly and effectively, and we can also avoid making the same mistakes that others have made.

So, if you're trying to learn a new programming language or master a complex algorithm, don't be afraid to ask for help or seek out instruction from an experienced programmer. By learning from others, you can accelerate your learning process and become a more skilled and effective programmer in a shorter amount of time.

[linkedin.com/in/trinmar](https://www.linkedin.com/in/trinmar/)
Dynamic QR Codes for Omnichannel Marketing
Tags: qrcode, tutorial
Published: 2022-12-05 15:14:29

Welcome to 2022, where consumers have short attention spans and live in a digital world. In order to create a successful Omnichannel marketing experience, marketers must be able to seamlessly transition consumers between our physical and digital worlds. The less friction a user experiences transitioning between these two worlds, the more likely they are to follow along on the marketing journey. Many companies have already implemented Static QR Codes for their marketing campaigns. However, very few are utilizing the power of Dynamic QR Codes.

**Static vs. Dynamic QR Codes**

Static QR Codes have a set lifespan and provide a marketer with zero insight into the success of the physical advertisement and QR Code. Once a static QR Code has been created and printed it can never be changed. The QR Code will always direct the scanner to the original webpage it was set to. Dynamic QR Codes can have a much longer lifespan because the location that a scanner is being directed to upon scan can be changed, meaning new QR Codes do not have to be printed for every marketing campaign. The redirect can be changed based on what campaign is currently active. A Dynamic QR Code also provides great insight into the success of a campaign by capturing the scan. This includes where the scan occurred and the time of the scan. Providing insight on what locations are most successful for physical advertising along with the time of day that the locations are receiving the most traffic.

[
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/kq5zipilcdhwoe061n0g.png)
](https://ospro.co/nh0-CAZDUXd)
This Dynamic QR Code was generated using [Openscreen](https://www.openscreen.com/). On the Openscreen platform, I can go into my account and see where scans are taking place, the time of day scans are occurring, and the total number of scans on my QR Code.
What are the coolest uses of AI you've seen in the last couple of weeks?
Tags: discuss, ai
Published: 2022-12-05 15:10:27

---
title: What are the coolest uses of AI you've seen in the last couple of weeks?
published: true
description: 
tags: discuss, ai
cover_image: https://dev-to-uploads.s3.amazonaws.com/uploads/articles/9xtjjdcbmzgyhmu4yu4p.png
# Use a ratio of 100:42 for best results.
# published_at: 2022-12-05 15:04 +0000
---

There have been some really interesting uses of AI floating around the web recently. What have been the coolest or most interesting you've seen?
Javascript: Async/Await
Tags: javascript
Published: 2022-12-04 08:07:08

_"async and await make promises easier to write"_

**async** makes a function <u>return a Promise</u>

**await** makes a function <u>wait for a Promise</u>

---

# Async Syntax

The keyword **async** before a function makes the function <u>return a promise</u>:

```javascript
async function myFunction() {

	// "Producing Code" (May take some time)

	return "Hello World"
	
}
```

Here is how to use the Promise:

```javascript
// "Consuming Code" (Must wait for a fulfilled Promise)
myFunction().then(
	
  	function( success ) { 
		
		/* code if successful */ 
		console.log( success )
		
	},
	
  	function( error ) { 
		
		/* code if some error */ 
		console.error( error )
		
	}
	
)
```

---

## Example

### 1

{% embed https://replit.com/@antelove19/NodeJS-Async#index.js %}

---

### 2 Display

{% embed https://replit.com/@antelove19/NodeJS-Async-Display#index.js %}

---

# Await Syntax

The **await** keyword can only be used <u>inside</u> an **async** function.

The **await** keyword makes the function pause the execution and wait for a resolved promise before it continues:

```javascript
let value = await promise
```

---

## Example

### 1

{% embed https://replit.com/@antelove19/NodeJS-AsyncAwait#index.js %}

---

### 2 Display

{% embed https://replit.com/@antelove19/NodeJS-AsyncAwait-Display#index.js %}

---

### 3 Waiting for a file

{% embed https://replit.com/@antelove19/NodeJS-XMLHttpRequest-AsyncAwait#index.js %}

---

### 4 Waiting for a file - return

{% embed https://replit.com/@antelove19/NodeJS-XMLHttpRequest-AsyncAwait-Return#index.js %}

---

# Async Function (developer.mozilla.org)

The [async function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/async_function) declaration declares an async function where the await keyword is permitted within the function body. The async and await keywords enable asynchronous, promise-based behavior to be written in a cleaner style, avoiding the need to explicitly configure promise chains.

...
What are your goals for the week of December 5?
Published: 2022-12-05 15:05:00

What are your goals for this week? 
 
- What are you building? 
- What will be a good result by week's end?
- Did you meet your goals last week?
- Advent of Code and other code challenges have started are you participating in any of the code challenges? [Read my list of challenges.](https://dev.to/jarvisscript/2022-advent-code-challenges-5445)

**Last Week's Goals**

- [:white_check_mark:] **Continue Job search.** 
- [:x:] Expand on Pomodoro timer. 
- [:white_check_mark:] **Write blog posts.** Wrote about the many sites offering advent code challenges for the month. [Read it here.](https://dev.to/jarvisscript/2022-advent-code-challenges-5445)
 
- [:white_check_mark:] Support VC members with monthly Challenge. Our collective goal was 100,000. We passed it and finished with 106,978.
 You can see our progress on our [Monthly Challenge page.](https://virtualcoffee.io/monthlychallenges/nov-2022)

- [:white_check_mark:] Personal Monthly goal is to beat my word count for last year's blog challenge. It was 3,511. I hit 4,528 words for the month.

- [:x:]Start on CSS ugly sweater art.
- [:white_check_mark:] Look for a code challenge for December. I did some of the Advent of CSS. 


**This Week's Goals**  

- Continue Job search. 
- Start on CSS ugly sweater art. 
- Write blog posts. 
- Support VC members with our Monthly Challenge. 
- Solve advent of CSS and Advent of JS challenges. 

```
-$JarvisScript git push
```
MongoDB Atlas Hackathon 2022 on DEV
Tags: atlashackathon22
Published: 2022-12-05 15:00:45

## What I built
This application allows you to see the trends of Google indicating the country.

### Category Submission:
- Real Time

### App Link
[https://mongoogletrends.netlify.app/](https://mongoogletrends.netlify.app/)

### Screenshots

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/97wawfyqawxiq3tmafi5.png)

### Description
This application allows you to see the trends of Google indicating the country. 

### Link to Source Code
[https://github.com/zhou1925/hackathon-mongodb-atlas-fanm](https://github.com/zhou1925/hackathon-mongodb-atlas-fanm)

### Permissive License
MIT

## Background
I wanted to learn something new and make a simple app. I saw the FARM stack and the Real Time category. I learned how to integrate MongoDB Atlas and FastAPI. the integration was fast and easy! So I said why not an application with a button? Then it occurred to me to consume some RSS Feed and Google Trends was my goal.


### How I built it
FastAPI works together with Celery and uses RabbitMQ as a message broker. FastAPI is in charge of receiving the client's requests and sending them to the processing queue. The result of each task creates items in MongoDB Atlas and the changes are reflected in the interface using Change Streams.

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

### Additional Resources/Info
https://www.mongodb.com/developer/products/mongodb/real-time-data-javascript/ https://www.mongodb.com/developer/languages/python/farm-stack-fastapi-react-mongodb https://github.com/mongodb-developer/FARM-Intro/tree/main/backend https://motor.readthedocs.io/en/stable/tutorial-asyncio.html#tutorial-prerequisites https://fastapi.tiangolo.com/tutorial/first-steps/ https://pymongo.readthedocs.io/en/stable/tutorial.html https://fastapi.tiangolo.com/tutorial/cors/