teleren/devto huggingface dataset:
PERN.TODO
Tags: javascript, react, postgres, webdev
Published: 2022-03-31 19:39:42

Finally - my first full-stack web app - deployed for the world (probably just me and my wife) to see. Check it out here: 
[http://pern-stack-todos.herokuapp.com/]

Like most other self-taught developers, I was more intrigued by front-end technologies from the beginning. People naturally gravitate towards visual changes, and I was no exception. But as I started to learn more and more about web development in general, backend and database started to lure me in slowly. Of course, I was and still very much am intimidated by it all - but I've taken a vow (a half-hearted one) to deliberately butt heads with things that strike fear in me. Backend and database are just two of the many things that do so.

I decided to follow a tutorial video on how to get the server set up using Postgres, Express and Node. I built up the client side how I wanted to build it using a lot of the knowledge that I gained through building Budgety's front end. I used MUI for components coupled with some inline-styling because I didn't want to spend too much time writing custom CSS like I did for Budgety, and it proved to be great decision that allowed me to focus more on how to work with the data coming from the database. I wrote the client side methods to hit the backend API routes, then used React Query's useQuery hook to fetch the data. Mutating the data was a bit tricky in two areas:

1. At first I used the useQueryClient hook in each child component that needed to mutate the data. I realized that doing this led to my website making infinite requests, which I realize...is bad. So I ended up moving defining all the mutate functions and queryClient to the main App.js page and passing down the methods as props to the respective child components.

2. I could not get the mutateAsync function to work with the PUT method inside the edit todo modal. When I sent back the new data from the modal input field to the backend route, it kept replacing the todo with an empty description field instead of the new description that was passed along inside the request body. This is something that I'll need to dig deeper into. For now, I just ended up calling the client side API method directly and invalidating the cache holding the list of 'todos' as soon as the user submits the edit todo form so that data gets refetched .

One thing that I've noticed is that I haven't really been seeing the benefits of using a relational database like Postgres in this simple app. I think in order to really see how a relational database would shine over a non-relational database such as Mongo, I'd have to implement authentication for the user to sign in and have a different database/table per user. This will be one of the next features that I'll be working on.

Live: [http://pern-stack-todos.herokuapp.com/]
Compile Clojure to native binary using GraalVM
Tags: clojure, graalvm
Published: 2022-04-02 10:31:22

---
title: Compile Clojure to native binary using GraalVM
published: true
date: 2022-03-31 18:17:14 UTC
tags: clojure,graalvm
canonical_url: 
---

We’ll write echo command on Clojure and compile it to native binary by [GraalVM](https://www.graalvm.org).

#### 🥇 Setup

The first thing first. Create a project directory echo

```bash
mkdir /tmp/echo
```

add basic deps.edn

```clojure
{:paths ["src"]
 :deps {org.clojure/clojure {:mvn/version "1.11.0"}}}
```

Create src/echo/main.clj. This would be our entry point:

```clojure
(ns echo.main)

(defn -main [& args]
  (apply println args))
```

Run clj -M -m echo.main to be sure that all works fine

```bash
clj -M -m echo.main foo bar
foo bar
```

#### 🥈 Build uberjar

Add build.clj to project’s root directory. This file contains logic how to build a Java jar

```clojure
(ns build
  (:require [clojure.tools.build.api :as b]))

(def class-dir "target/classes")
(def basis (b/create-basis {:project "deps.edn"}))
(def jar-file "target/echo.jar")

(defn clean [_]
  (b/delete {:path "target"}))

(defn uberjar [_]
  (clean nil)
  (b/copy-dir {:src-dirs ["src"]
               :target-dir class-dir})
  (b/compile-clj {:basis basis
                  :src-dirs ["src"]
                  :class-dir class-dir})
  (b/uber {:class-dir class-dir
           :uber-file jar-file
           :basis basis
           :main 'echo.main }))
```

Now let’s add [tools.build](https://clojure.org/guides/tools_build) and :build task to deps.edn

```clojure
{:paths ["src"]
 :deps {org.clojure/clojure {:mvn/version "1.11.0"}}
 :aliases {:build  
 {:deps  
 {io.github.clojure/tools.build {:git/tag "v0.8.1" :git/sha "7d40500"}}  
 :ns-default build}} }
```

And the last thing is to mark our echo.main as :gen-class

```clojure
(ns echo.main
  (:gen-class))

(defn -main [& args]
  (apply println args))
```

Now we are ready to build uberjar

```bash
clj -T:build uberjar
```

This command will create a jar in the target folder. You can run it by java

```bash
java -jar target/echo.jar foo bar
foo bar
```

#### 🥉 Build native

To build native script, we should install [GraalVM](https://dev.to/maksimrv/install-graalvm-on-macos-m1-1p8n) after that we should add com.github.clj-easy/graal-build-time as a dependency to automate declaration of libraries by_ — initialize-at-build-time_

```clojure
{:paths ["src"]
 :deps {org.clojure/clojure {:mvn/version "1.11.0"}
        com.github.clj-easy/graal-build-time {:mvn/version "0.1.4"}}
 :aliases
 {:build
  {:deps
   {io.github.clojure/tools.build {:git/tag "v0.8.1" :git/sha "7d40500"}}
   :ns-default build}}}
```

Rebuild jar

```bash
clj -T:build uberjar
```

and we are ready to run native-image to build binary

```bash
native-image -jar target/echo.jar --no-fallback --no-server target/echo
```

This command will generate a native binary from the jar to _target/echo_

Let’s test our binary

```bash
./target/echo foo bar
```

The end 🎉
[Conceito] - Paralelismo vs Concorrência
Published: 2022-03-31 19:10:43

> Conteúdo original [nessa thread do Twitter](https://twitter.com/zanfranceschi/status/1509607567886110724)

---

Então quer dizer que vc faz tudo ao mesmo tempo – paraleliza tudo... é isso mesmo?

Você sabe a diferença entre PARALELISMO e CONCORRÊNCIA?!

Quando era novo, tomei um fora duma menina em uma festa só pq provei pra ela que ela não fazia tudo ao mesmo tempo!

cc @sseraphini
 
🧵👇

![img](https://pbs.twimg.com/media/FPMov7JWQBAf14-?format=png&name=small)

---

Falando sério, é super normal confundir esses dois conceitos pq, olhando de fora, eles se parecem mesmo.

Mas tem alguns aspectos que são fáceis de entender e que dão clareza sobre a natureza de cada um. É suave, confia.

---

INTERRUPÇÃO

Vc tá aí fazendo sua gambiarra, aí pára pra olhar o Twitter, aí entra no Insta, etc. Ou seja, vc está atenta/o à várias coisas ao mesmo tempo, mas FAZENDO mesmo apenas uma por vez. Vc tem que interromper uma coisa pra fazer outra, intercalar – a gente é um/a só.

![img](https://pbs.twimg.com/media/FPMxvZhXIA8KNYx?format=png&name=900x900)

---

INDEPENDÊNCIA

Vc e seu colega baixaram a branch da task, cada um na sua máquina, inserindo bugs, adicionando complexidade, criando variáveis com nomes horríveis, etc.

Duas pessoas fazendo coisas ao mesmo tempo, uma independente da outra. Suave, né?

![img](https://pbs.twimg.com/media/FPMzYwXXoAAj8tW?format=jpg&name=large)

---

Ou seja, em CONCORRÊNCIA as operações devem ser interrompíveis e resumíveis!  P.ex: É possível ter um modelo concorrente com uma única thread (procure sobre o event loop do javascript).

Como tudo pode ser muito rápido, dá a impressão que tudo tá sendo feito ao mesmo tempo.

---

Paralelismo, por outro lado, tem a ver com independência. Está intimamente relacionado com multi-thread. São coisas realmente sendo executadas ao mesmo tempo de forma independente.

---

Resumindo

CONCORRÊNCIA tem a ver com interrupção. Realmente uma coisa (muito rapidamente) sendo feita por vez – intercalando. 

PARALELISMO tem a ver com independência. Solte dois cachorros de apartamento na rua e vc terá duas merdas em paralelo.

![img](https://pbs.twimg.com/media/FPMySJmXoBQe65c?format=png&name=small)

---

Precisa nem falar, né? Chegou até aqui é abraço, mesmo que fique desconfortável 🫂

Valeu demais pela moral!
Don't inherit from python BaseException, Here's why.
Tags: python
Published: 2022-03-31 18:54:46

---
canonical_url: https://waylonwalker.com/til/python-base-exception/
cover_image: https://images.waylonwalker.com/til/python-base-exception.png
series: til
published: true
tags:
- python
title: Don't inherit from python BaseException, Here's why.
---

I ran into a PR this week where the author was inheriting what BaseException rather than exception.  I made this example to illustrate the unintended side effects that it can have.

Try running these examples in a `.py` file for yourself and try to kill them with control-c.

## You cannot Keybard interrupt

Since things such as `KeyboardInterrupt` are created as an exception that inherits from `BaseException`, if you except `BaseException` you can no longer
`KeyboardInterrupt`.

```python
from time import sleep

while True:
    try:
        sleep(30)
    except BaseException: # ❌
        pass
```

## except from Exception or higher

If you except from exception or something than inherits from it you will be better off, and avoid unintended side effects.

```python
from time import sleep

while True:
    try:
        sleep(30)
    except Exception: # ✅
        pass
```

## This goes with Custom Exceptions as well

When you make custom exceptions expect that users, or your team members will want to catch them and try to handle them if they can.  If you inherit from
`BaseException` you will put them in a similar situation when they use your
custom Exception.

```python
class MyFancyException(BaseException): # ❌
    ...

class MyFancyException(Exception): # ✅
    ...
```
Why is it you can execute a function on the right side of an AND && operator in JavaScript
Tags: javascript, explainlikeimfive
Published: 2022-03-31 18:39:56

I always assumed that operators like `&&` and `||` are for comparing `true` and `false` statements on both sides.

But I'm seeing a pattern in React where, on the right side is a function and the left is a truthy statement that will then allow the right to be executed.

Example:

```JavaScript
truthy statement && function
```

I understand that JavaScript will check this from left to right, so left being true will then allow it to check the right. But my assumption is the right should expect a `true` or `false` statement, but in this case it's just a function.

I'm so used to seeing the `&&` operator in this context:

```JavaScript
if (true && true) {
  // Execute this
}
```

That this:

```JavaScript
true && execute this
```

Works at all.

I guess my assumption is that JavaScript will just evaluate anything next to an operator whether it returns a `true` or `false`.
Connecting the Dots
Tags: beginners, programming, productivity, devjournal
Published: 2022-03-31 18:35:37


##Learning programming as an absolute beginner the basics may not make any sense at all.

##But see around and find the applications in each and every use cases from our everyday lives and relating with the code would be a great idea.

##I think spending 10 mints everyday is better than 2hr in the weekend - **consistency is the key**.
##If we are able to keep the consistency in a gradual level for a while and making it exponential makes the difference.

##When consistency meets observation it helps **connecting the dots** and makes programming more meaningful and lively.
 
##Keep the pace until the fruit ripens.
Creating UX with TEXT(markdown)
Tags: ux, markdown, computerscience, sideprojects
Published: 2022-03-31 18:33:16

Hello everyone, I would like to present an IDEA or a sideproject ;) I play with for a while now.

## Who am I
I am a coder/programmer, not a UX person but very often I have to create some UX screens. Also, I know many of you are creating UX screens quite fast in tools like Figma and etc but it still takes time to create the wireframes, align everything to export it to share it and so on.

I am a HUGE fan of *Markdown* so I was thinking can we use Markdown to create a mockup ? or wireframes?
So at the end, I created something I call utext spelt as "you text" so you text and get UX.



## The POC

Currently, I have only POC the grammar and language and parser are created using https://pegjs.org/ as parser/translator of the code.

You can play with the project see here https://utext.github.io/

if you click on the "?" and wait a bit you will see some examples.
But just to show if you want to display a login form for example it will look like this :

```

===Login===
username : ___
password: *___
===

```
Which generates this 

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

if you want to customize the buttons you can for example 

```

===Login===
username : ___
password: *___
===[login][dont login]===

```

Will give you this:

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

The idea is to VISUALLY explain what and how it should look and voala you have the wireframe. I even went a step further you can export this as HTML code even and even change the theme if you want to see how it looks with different UI. 

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

All the elements supported are basically everything from HTML + some bootsrap elements. You can check them in the help at the ? in the website.

A Card example will be something like this

```
---Bootstrap Cards works too---
I am the content [random btn]

you can otuput a table too : 

|header1|header2|
|col1   |col2   |
|col1|col2|
---
*Note should start and end with at least 3 dashes*

```
Which will generate this : 

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

Any feedback is welcome :) I just made it for fun :) and just want to hear how this looks to you :) any comments ?

A yes most markdown stuff like image or heading and etc just work, go play with it :) bugs are expected ! :) 

P.S. Since it is a plain JavaScript (no server side) you can save only in gist in your github account or load a gist... or copy paste :)
Generate a JSON list for a request body payload in C# using Collection Initializers
Tags: dotnet, testing, json, csharp
Published: 2022-03-31 18:06:36

I recently had to write a test for a new JSON REST POST API. The request body of the POST contained a formatted JSON list. Typically the body of various REST calls are JSON formatted between two brackets *{ json }*. But in this case I needed list brackets with the JSON *[{ json }]* for the body.
  
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/bjleawyu0ihhhe3abwfe.png)
 
It's easy enough to create a C# class such that an object from it represents the JSON data between the brackets { }. In the below example the class is called SettingValue. 

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

But how in C# do you create a initialized list of this JSON that can then be used in the body of the POST? You first create an object *settingValue* of type SettingValue. This is our *{ json }*. Then you create a List object *settingValueList* of type SettingValue. 

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

But what is the *{ settingsValue }* at the end of the List instantiation? It is a [Collection Initializer](https://docs.microsoft.com/en-us/dotnet/csharp/programming-guide/classes-and-structs/object-and-collection-initializers#:~:text=Collection%20initializers%20let%20you%20specify,expression%2C%20or%20an%20object%20initializer.) for the List with *settingValue* as the Element Initializer. Only objects of type SettingValue can be added to the list and the list is now created with default *settingValue* JSON. If you don't use an Element Initializer, the List will not have the default value we need. 

Now you can update or add to the list and pass *settingValueList* to use as the body for your JSON POST. So your *settingValueList* list might end up looking something like this:
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5b1pmf0cuglwo00gw9y4.png)

The solution seems simple to me now but for some reason in years of API automation I never have had to do it before. Previously I had only seen nested JSON Lists [ ] within JSON brackets { } and nesting lists in JSON can be done using nested C# classes, which would be the subject of another blog post :)

PS: Thanks to Dan Post and Bob Geary for a technical review of the post
How The Kids Play Macros These Days: OpenBB Automates Financial Data Collection & Charting With .openBB Routines!
Tags: python, productivity, opensource, 100daysofcode
Published: 2022-03-31 17:53:36

[https://openbb.co](https://openbb.co)

{%youtube iCQTbWuLRcY%}

[Come say hello on Discord](https://discord.com/invite/Up2QGbMKHY)

[Follow OpenBB on Twitter](https://twitter.com/openbb_finance)
Day-55 Training At Ryaz
Tags: webdev, beginners, programming, node
Published: 2022-03-31 17:42:45

- Date:31/03/2022
- Day:Thursday

Today, I started at about 10:40 am as I was successful to initialise the jwt tokens and I was to test it for authorisation  of the user by using the bearer token. so, firstly I started with it and tested it and it was working after this the thing left was to test it with postman so after this I sent a token via post request and after this I copied the token and enabled the authorization and pasted with bearer in front of it and triggered the send button so, the text we receive it 'this is protected' and all the data that is declared as const is sent in the post request and after this I was to test without the token and I disabled the authorisation so, I triggered the send button and got as 'forbidden' so after this the jwt token were successfully implemented it seems to be like if user is known and having the unique token i.e entry pass he would able to acess the data and view it but if user is not registered and not known so, he/she would be forbidden for access. so, this way my day ended up and I was able to complete the jwt token.
Hello World
Tags: beginners, webdev
Published: 2022-03-31 17:18:32

Hey y'all!

My name is Andrew Weisbeck and I am a freelance Full Stack Developer in Raleigh, NC. I have been on the site for a few months now, but haven't done a good job at being active.

Well I intend to change that and want to introduce myself to the community. I started coding about 4 or 5 years ago without seriously getting into any career path. I got into cybersecurity in 2021 and decided to go all in on a Full Stack career path after I left that job in November.

You can check out my personal website and portfolio https://geauxweisbeck4.dev to find out more. I'm excited to learn more about y'all!

Andrew
100 Days of Code
Tags: webdev, frontend, career, 100daysofcode
Published: 2022-03-31 17:11:17

I'm officially starting my 100 days of Code tomorrow, 1st April. During this time, I'll be starting web dev all over again, this time with a focus on Front-end, along side the Odin project's curriculum.
I've been away for so long and I intend to settle with webdev now.

I hope at the end of this 100 days, I'll be well equipped to land my 1st dev job, preferably remote. I'm so excited ......
How to make variable values UPPERCASE or lowercase in Bash
Tags: bash
Published: 2022-03-31 16:48:26

When we need to transform some Bash variable value into, for example, uppercase, we often use some pipelines like the followings:

```bash
foo="foo"

foo=$(echo ${foo} | tr a-z A-Z)
```

or using AWK:

```bash
foo=$(echo ${foo} | awk '{print toupper($0)}')
```

or with Perl:

```bash
foo=$(echo ${foo} | perl -ne 'print uc')
```

or using sed:

```bash
foo=$(echo ${foo} | sed 's/[a-z]/\U&/g')
```

However, it is possible to achieve the same results just using pure Bash! And it's fantastically easy to do!

Let's start with defining the variable and its value:

```bash
foo="foo"
```

Now let's make the very first letter (`f`) uppercase — `F`:

```bash
foo=${foo^}
echo $foo
Foo
```

Cool! Let's now make the first letter back to lowercase:

```bash
foo=${foo,}
echo $foo
foo
```

Splendid! Let's make all letters uppercase:

```bash
foo=${foo^^}
echo $foo
FOO
```

Terrific! And back to the all lowercase again:

```bash
foo=${foo,,}
echo $foo
foo
```

That's all! I hope you find this post educational! Happy scripting!
Install GraalVM on macOS M1
Tags: graalvm, macos, applesilicon
Published: 2022-04-02 10:31:10

---
title: Install GraalVM on macOS M1
published: true
date: 2022-03-31 16:41:49 UTC
tags: graalvm,macos,applesilicon
canonical_url: 
---

We can download [required version of GraalVM](https://github.com/graalvm/graalvm-ce-builds/releases) using curl

```bash
curl --create-dirs --output-dir ~/Library/Java/JavaVirtualMachines -OL https://github.com/graalvm/graalvm-ce-builds/releases/download/vm-22.0.0.2/graalvm-ce-java17-darwin-amd64-22.0.0.2.tar.gz
```

This command will download graalvm-ce-java17-darwin-adm64-22.0.0.2.tar.gz to ~/Library/Java/JavaVirtualMachines. Now we should extract archive’s content by tar

```bash
tar xvzf graalvm-ce-java17-darwin-amd64-22.0.0.2.tar.gz
```

Now we can add GRAALVM_HOME environment variables to .bashrc or .zshrc

```bash
export GRAALVM_HOME ="$HOME/Library/Java/JavaVirtualMachines/graalvm-ce-java17-22.0.0.2/Contents/Home"
```

also, we can add GraalVM bin folder to the PATH . This allows us to easily access executable commands from shell

```bash
export PATH="$GRAALVM_HOME/bin:$PATH"
```

Now we can easily install native-image using gu command

```bash
gu install native-image
```
Running a developer community?
Tags: community, tooling, devrel
Published: 2022-03-31 16:39:22

##Building Community is getting harder

Relationships are the foundation of vibrant communities. The challenge is that it's really hard to continue to build relationships as your community expands, both in number of members and the various channels with which interactions occur. And as your community grows organically, it gets harder and harder to be intentional about relationships and how to segment community members to prioritize interactions and programs to build. <br /> 
We launched [Common Room](https://commonroom.io) today to help you on this mission of building strong, vibrant communities - wherever your members are. <br /> 
If you've dabbled in this space before, you know there are solutions that can help you with the collation of data across your community and social channels. <br /> 
That's just the starting point for Common Room. <br /> 
* Learn more on our [blog](https://www.commonroom.io/blog/introducing-common-room/). 
* Read our [docs](https://docs.commonroom.io/). 
* Review our [API](https://api.commonroom.io/docs/community.html#operation/createOrUpdateCommunityMember). 
* [Sign up](https://www.commonroom.io/signup?utm_medium=website&utm_source=homepage&utm_campaign=navigation). 
* And of course, join the [Uncommon Community](https://www.commonroom.io/uncommon/)