teleren/devto huggingface dataset:
Moved to 'main' branch for my git repo
Tags: git, irishtechcommunity, diversityintech, womenintech
Published: 2021-04-01 23:25:34

I have been quite happy with the 11ty site I built for my [Irish diversity in tech groups listings](https://irish-diversity-in-tech.netlify.app/diversity/) especially the [Irish tech events listings](https://irish-diversity-in-tech.netlify.app/events/) I've been curating. 
It all boils down to updating YAML files, much less work than before! ☺️

2 months since and apart from last month's first time changing to new month listings with tiny fixes to be made, this month's change to April went without a hitch! 🎉

And it's all on github.

{% github whykay/diversity-in-tech-ireland %}

I know [github had planned to rename master to main](https://thenextweb.com/dd/2020/06/15/github-plans-to-replace-racially-insensitive-terms-like-master-and-whitelist/) and the copy of the repo I had still had 'master' as the branch name. 

So, I decided to rename my repos branch also, and [this handy page](https://stevenmortimer.com/5-steps-to-change-github-default-branch-from-master-to-main/) helped with clear steps and I had no problems at all.

```
~/s/diversity-in-tech (master)> git branch -m master main
~/s/diversity-in-tech (main)> git branch
* main

~/s/diversity-in-tech (main)> git push -u origin main
Total 0 (delta 0), reused 0 (delta 0)
remote: 
remote: Create a pull request for 'main' on GitHub by visiting:
remote:      https://github.com/whykay/diversity-in-tech-ireland/pull/new/main
remote: 
To github.com:whykay/diversity-in-tech-ireland.git
 * [new branch]      main -> main
Branch 'main' set up to track remote branch 'main' from 'origin'.

~/s/diversity-in-tech (main)> git symbolic-ref refs/remotes/origin/HEAD refs/remotes/origin/main

~/s/diversity-in-tech (main)> git branch -a
* main
  remotes/origin/HEAD -> origin/main
  remotes/origin/main
  remotes/origin/master
```

Followed his step 4 and to change default branch to ‘main’ on GitHub site

```
~/s/diversity-in-tech (main)> git push origin --delete master
To github.com:whykay/diversity-in-tech-ireland.git
 - [deleted]         master

~/s/diversity-in-tech (main)> git branch -a
* main
  remotes/origin/HEAD -> origin/main
  remotes/origin/main
```

And now my main branch is now called "main"! 🙌

![](https://media.giphy.com/media/Z9P4chFZudJn8i1HyT/giphy.gif)
How to generate a complete JSON file with Nunjucks 🎮
Tags: javascript, webdev, programming, development
Published: 2021-04-16 19:31:04

---
title: How to generate a complete JSON file with Nunjucks 🎮
published: true
date: 2021-04-01 23:15:00 UTC
tags: javascript, webdev, programming, development
canonical_url: https://www.benjaminrancourt.ca/how-to-generate-a-complete-json-file-with-nunjucks
cover_image: https://www.benjaminrancourt.ca/temp/how-to-generate-a-complete-json-file-with-nunjucks.2274.jpg
---
I am currently in the process of refactoring my website to speed up its generation and I came across an interesting problem: how to generate a **JSON** file with [**Nunjucks**](https://mozilla.github.io/nunjucks/) in [Eleventy](https://www.11ty.dev/)?

If the object contains only **strings** , it is really trivial. But, if you add a numeric property and you want to keep its type intact, it is still simple:

```json
{
  "name": "{{ author.name }}",
  "age": {{ author.name }}
}
```

But, it gets complicated if you want to introduce `array` properties. Effectively, if you want to have a valid JSON file, the items must be separated by a colon (`,`) and it starts to look a lot more complex like in the example below:

```json
  {
    {%- if collections.feed.authors -%}
    "authors": [
      {%- for author in collections.feed.authors %}
        {
        "avatar": "{{ author.avatar }}",
        "name": "{{ author.name }}",
        "url": "{{ author.url }}"
        }
      {%- if not loop.last -%},{%- endif -%}
      {%- endfor %}
    ]
    {%- endif -%}
  }
```

It is not pretty, but it works. 🤕

But what if you want to add a property whose value contains quotes (`"`), like HTML values? Personally, I tried a lot of ideas, but none worked. 😟

```json
{
  "html": "{{ author.html }}",
  "safe": "{{ author.html | safe }}"
}
```

I searched the Web and came across an [old question on Stack Overflow](https://stackoverflow.com/q/46426306) which has the solution below that worked for me:

```json
{
  "html": {{ author.html | dump | safe }}
}
```

The combinaison of the [**dump**](https://mozilla.github.io/nunjucks/templating.html#dump) and **[safe](https://mozilla.github.io/nunjucks/templating.html#safe)** filters make it possible to render the value exactly as it comes from the source. For an array, this even make it possible to simplify the code for its generation if the objects are already correct:

```json
{
  {%- if authors.tags -%}
    "tags": {{ authors.tags | dump | safe }}
  {%- endif -%}
}
```

I hope this post helps you get to know the Nunjunks templating language better! 😁
Associação Polimórfica com JPA
Tags: jpa, java, fk, dbms
Published: 2021-04-01 22:40:37

https://thorben-janssen.com/polymorphic-association-mappings-of-independent-classes/
já vou deixar um salve pro **Thorben Janssen** autor da postagem acima.

# Vou fazer um rascunho desse post, e depois vou evoluindo o assunto rs

A questão é que vi e usei dessa abordagem de uma forma não tão bonita quanto essa do post acima e acho que é até uma case comum no mundo corporativo e como achei a abordagem um tanto complexa, achei que poderia adicionar alguns exemplos, e fazer uma versão minha :sweat_smile:.

### Aqui a base em comum

Basicamente marcamos em algumas tabelas as seguintes colunas ORIGEM_KEY e TIPO_ORIGEM_KEY ambas numéricas (essa parte já estava na empresa quando eu cheguei :sweat_smile:, no caso teria usado um Enum para a representação de tipo). 

Fazíamos isso pois em determinado momento do workflow chegavamos em um funil onde basicamente todas as operações do sistema tinham que ser mapeadas e registradas em um "livro". Contudo em determinados momentos precisamos fazer uma "engenharia reversa" do processo para chegar a origem do registro que poderia ser de qualquer parte do sistema.

_Obs:_ Ai vai a primeira desvantagem do modelo, tem que se quebrar uma das regras de normalização do banco (caso você esteja trabalhando com banco relacional) pois quem vai demarcar a origem ou seja a tabela que contém as informações que em teoria estariam vinculadas via uma FK vai TIPO_ORIGEM_KEY e o registro como é dedutivel será de responsabilidade da ORIGEM_KEY. Você pode vir a adicionar CONSTRAINTS para tentar garantir o mínimo de digamos "consistência" contudo a aplicação que terá que fazer todo o trabalho.

### Aqui como costumava usar

```java
@Entity
public class ChessPlayer {
 
    @Id
    @GeneratedValue(strategy = GenerationType.SEQUENCE,
        generator = "chess_player_seq")
    @SequenceGenerator(name = "chess_player_seq",
        sequenceName = "chess_player_seq", initialValue = 100)
    private Long id;
 
    private String firstName;
 
    private String lastName;
 
    private Integer wins;
 
    private Integer loses;

    ...
}
```


A partir do tipo salvo fica fácil de implementar uma regra que saiba buscar as demais informações necessárias para a sua necessidade. Contudo da minha forma ainda era um cenário verboso e cheios de IFs...

Em contra partida a versão menos verbosa não é tão flexível e na minha opinião torna o código mais acoplado (isso aqui já é minha conclusão).

```java
public enum TipoOrigem {

  TIPO_1(1,Repository1.class), TIPO_2(2,Repository2.class);

  private final int key;
  private final Class<T> clazz;

  public TipoOrigem(int key ,Class<T extends Repository> clazz){
    key = key;
    clazz = clazz
  }

  public static Map<Integer, Class<T extends Repository>> getMap(){
    return ...
  }
}
```

Coloquei uma exemplificação que precisa ser melhorada Rs
Mas basicamente segue uma strategy que tem como base a key da relação como chave de seleção.

A partir dela podemos buscar a informação de onde acharmos conveniente.
4 Life Hacks To Quickly Build A Website
Tags: webdev, watercooler
Published: 2021-04-01 21:53:37

Building a website can take months.

Luckily there are frameworks, minimal coding, and no-code solutions designed to help anyone build a quick website.

Here are 4 hacks to build your own website from the ground up.

###Life Hack #1: Use Web Frameworks

_Django_ - features such as user notifications, user login, and dynamic page rendering. 

_Flask_ - great if you have a basic knowledge of Python and are looking to create a smaller site with the few features you actually need to complete your project.

_Ruby on Rails_ - flexible syntax and increased speed and efficiency given the development principle of convention not creating.

###Life Hack #2: Use CSS Frameworks

_Bootstrap_ - easy to implement with a CDN script and the documentation is full of code snippets designed to copy and paste directly into your code.

_Materialize_ - a pared-down version of Bootstrap with endless color variations. 

_Tailwind CSS_ - for the person looking to build their own custom components and go against Bootstrap's cookie-cutter components.

###Life Hack #3: Use JS Animation Libraries

_React.js_ - the idea is to make simple views that render the correct UI components when needed.

_Typed.js_ - if you're looking to add a cool typing animation to your site.

_ScrollReveal_ - allows you to reveal parts of your website as the user scrolls down the page. 

###Life Hack #4: Use no-coding solutions
_Bubble_ - allows for web flows that handle data submissions all without touching a line of code. 

_Webflow_ - operates similarly to Adobe programs with the side navbars used to change the color, orientation, and font of components.
How to export .cer and .key from .pfx file
Published: 2021-04-01 21:40:18

So you are ready to add a signed certificate and private key to your web application.  Here's one approach to making that happen.  

Note, I'm using a Windows 10 workstation.

For the purpose of this post, we assume you already have a .pfx file from your certificate authority.  (.pfx is a binary file.  There are other file formats such as .pem ([which is base64 encoded](https://www.ssls.com/knowledgebase/what-are-certificate-formats-and-what-is-the-difference-between-them/)).  If you have a .pem file [you can convert it to .pfx](https://www.ssl.com/how-to/create-a-pfx-p12-certificate-file-using-openssl/) and then follow these steps.)

- Save the .pfx file on your computer.  In my examples below, the pfx file is saved at C:/Users/usernameGoesHere/.ssh
- Next you will need to extract the .key and .cer files from the .pfx:
- Ensure you have [openssl installed](https://www.openssl.org/source/).
- In this example the openssl.exe executable is installed at `/bin/openssl`
- From the dir on your workstation where you have the pfx file from your CA (in my example named my-site.com.pfx), run the following command:

`echo QUIT | /bin/openssl.exe pkcs12 -in my-site.com.pfx -nocerts -out server.cer.key -nodes`

NOTE: If you are using something other than the git bash command line emulator, you might not need the `echo QUIT |` part, and you can replace /bin/openssl.exe with just `openssl`.)

NOTE2: We have included the -nodes flag so that the key is not encrypted with an export key.

- Note that you now have a server.cer.key file in your directory.
- Next run this command to extract the .key:
- `echo QUIT | /bin/openssl.exe pkcs12 -in my-site.com.pfx -out server.cer -nokeys -clcerts`

NOTE: same as above, (if you aren’t using git bash emulator, you might no need the first bit of the command)
[PT-BR] Mentoria de criação de projetos durante o Mês Internacional da Mulher
Tags: actionsbuilder, couragetocreate, iwd21, womentechmakers
Published: 2021-04-01 20:55:49

Durante o mês internacional da mulher eu, Laura Morinigo, Lesly Zerna e Sachin Kumar disponibilizamos um treinamento gratuito para você criar sua ação conversacional para o Google Assistente.

Canais em português, inglês e espanhol pra pedir ajuda e fazer networking no Discord. Os outros para interagirmos em inglês.

Você já pensou em aprender a integrar o Actions Builder com o Firebase (escrita e leitura)?

Encontre aqui o repo do Github com o código, assim como o vídeo explicando passo a passo.

Repo no github: https://lnkd.in/dybDDVr
{% github amdcaruso/firebase-read-write %}

YouTube: {% youtube VkGNHMjFXO0 %}

Tudo gratuito para a comunidade! Espero que o conteúdo auxilie o seu aprendizado!
April LeetCoding Challenge 2021 — Day 1: Palindrome Linked List
Tags: computerscience, codenewbie, programming, codequality
Published: 2021-04-01 20:33:48



From today, we will start doing the April LeetCoding Challenge. You can check the March LeetCoding Challenge problems on my profile.



## Problem Statement

Given the head of a singly linked list, return true if it is a palindrome.

**Example 1:**

![](https://cdn-images-1.medium.com/max/2000/0*f-n2TaPR7PhAzqqu.jpg)

    **Input:** head = [1,2,2,1]
    **Output:** true

**Example 2:**

![](https://cdn-images-1.medium.com/max/2000/0*Lnbhl2I8Yx0tiOBV.jpg)

    **Input:** head = [1,2]
    **Output:** false

**Constraints:**

* The number of nodes in the list is in the range [1, 105].

* 0 <= Node.val <= 9

**Follow up:** Could you do it in O(n) time and O(1) space?

## **Solution**

In this problem, we have to find whether a given LinkedList is palindrome or not. I hope you know what a Palindrome is. ([Check here](https://computersciencewiki.org/index.php/Palindrome#:~:text=A%20palindrome%20is%20a%20word,racecar%2C%20or%20the%20number%2010801.&text=The%20output%20should%20be%20%22True,it%20is%20not%20a%20palindrome.))

We are going to discuss two approaches to this problem.

Approach 1: Using ArrayList: The basic idea behind this approach is to store all the node values in an ArrayList. After that, we traverse the list for start and end, and keep comparing the values at start index and end index. If they are equal then increase start index and decrease end index. If two values are not the same, then we return **false**(the LinkedList is not a palindrome).

 <iframe src="https://medium.com/media/77dbba447e8517e15223e0275f432e92" frameborder=0></iframe>

Time Complexity:O(n), for traversing the LinkedList

Space Complexity:O(n), using ArrayList for storing the node values

Approach 2: In this method, we will use LinkedList manipulations.

If the length of the LinkedList is even :

* Find the middle point of the LinkedList.

* Reverse the second half.

* Compare the reverse list to the first half of the list, if all the values are equal return true else return false

![Diagram representing LinkedList with even number of nodes](https://cdn-images-1.medium.com/max/2560/1*hCEthll7UYCnr45R_W8IvA.png)

If the length of the LinkedList is odd:

* Find the middle point of the LinkedList. As the length is odd, the middle point will be between the first half and second half of the LinkedList.

* Now reverse the second half of the Linked List

* Compare the reverse list to the first half of the list, if all the values are equal return true else return false

![Diagram representing LinkedList with odd number of nodes](https://cdn-images-1.medium.com/max/2560/1*S6ePH7JZKJJY0SKbqS-wEw.png)

The code is given below.

 <iframe src="https://medium.com/media/dcfdb00b11bc5329b888ef9f4b38e646" frameborder=0></iframe>

Time Complexity:O(n), for traversing the LinkedList

Space Complexity:O(1), No additional space is used

The code can be found here
{%github sksaikia/LeetCode %}
Kotlin in the backend, Spring with Kotlin Part 2 — Exception Handling
Tags: kotlin, spring, backend, exceptions
Published: 2021-04-01 20:08:31

---
title: Kotlin in the backend, Spring with Kotlin Part 2 — Exception Handling
published: true
description: 
tags: kotlin,spring,backend,exceptions 
cover_image: https://miro.medium.com/max/700/1*FtLAwt57yL-p2GUtNg-zgA.png
---

Handling exceptions is a crucial part when developing any sort of application, certain errors occur by calling a method of a library with invalid arguments, others happen just for doing something wrong. However, some exceptions can be thrown by ourselves because what was asked to be done by us is not possible.

In the previous post, we developed a simple Web API using Kotlin and Spring, this API allowed us to request and alter information about books in our system, however, when errors are thrown, the information sent to the API client is not the clearest, who becomes unaware of what really went wrong.

Rest of this article:
https://rodrigo-silva96.medium.com/kotlin-in-the-backend-spring-with-kotlin-part-2-exception-handling-55524414e154
Four best 2D animation software in 2021
Tags: 2danimation, animation, innovativeideas, businessstrategy
Published: 2021-04-01 19:59:11



Exhausted in examining the best 2D animation software to design an eye-catching character design or model for your brand or company? 

Don’t worry, further no delay let’s unwrap the critical software tools to create a 2D animated character with striking visuals.
**1.Open toonz**
Open toonz is a free, and open-source 2D animation software. It's mainly specialized in 2D animation including bone and mesh. Also, it combines hand drawings with digital sketches.

Moreover, it’s simple to download and install on many operating systems including Windows, Linux, OS X Etc. Open toonz allows the users to scan their hand drawings. The unique attribute of open toonz is its picture effects, which can alter any kind of drawings with sophisticated tools.

Novices find it a little hard to learn and operate this software. However, it’s good for a novice designer to practice on designing 2D cartoon characters by scanning and tracing the image.

**2.Pencil2D**
Similar to Opentoonz, Pencil 2D is also free to download on various operating systems including Windows, macOS, Linux, etc. It's especially utilized for creating 2D cartoon characters by merging bitmap and vector graphics.

Additionally, it is simple to train on the software and delivers a high-quality design. This is the optimal software for beginners and designers can save the file in its own format such as PNG, BMP, JPEG, etc.

**3.Synfig**
Synfig is also open free source 2D animation software. It’s an industrial-strength vector-based software and offers multilayers to draw sketches. Synfig is quite complicated to learn the design than the above two software.

Its wide applications are for seasoned artists to create a 2D animation film or movie. It allows the user to save the draft work in its own XML format.

Also, it can make videos in AVI, MPEG as well as in animation graphics (GIF).

**4.Adobe Animate**
Adobe Animate is particularly for creating vector graphics and animation videos for multimedia. Using Adobe animate software, designers can instantly design the animation and can share their work with the world within few minutes. 

Moreover, animators can also develop games and web applications with powerful illustrations. Adobe Animate is the ultimate software for both novices and seasoned animators. 

[Create a fabulous fictional 2D character with our experts and utilize it for campaign ads.](https://www.pixlnexs.com/2d-Character-design)

[If you're interested in creating a 2D Model for your brand to allure your potential audience, we are here to assist and drive you to attain your goal.](https://www.pixlnexs.com/)
I Created This Laptop with pure HTML and CSS. 
Tags: html, css
Published: 2021-04-01 19:56:51

I Created Laptop and Code Editor with pure HTML and CSS.
It takes almost 2hours to create this laptop with html and CSS. This is the first time i tried to do something with CSS and result came out 100% positive so I'm thinking to create more.
 
#100DaysOfCode #100DaysOfMLCode #Python #DEVCommunity
#CSS3 
Source Code Here - https://codepen.io/shahriarcodes/pen/MWJpwYq
Svelte in deno apps 
Tags: svelte, deno, javascript, webdev
Published: 2021-04-01 19:55:32

Snel is a tool/framework to compile .svelte component to javascript files to create web application using deno and svelte.

"You all know" about *Deno*, The secure runtime for JavaScript and TypeScript.

The intention of this project is that we can use svelte with deno as the runtime, with just a simple 

```sh 
deno run --allow-run --allow-read https://deno.land/x/snel/install.ts
```
we can create a new project to run it.

# Create a project with snel 

run in your terminal: 
```sh
snel create [project name]
```

then go to the folder an run it with the command run of [trex](https://github.com/crewdevio/Trex)
```sh
trex run start
```

![ezgif-3-3f3c03bec7be](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/yivyrgxr46vd5ri0l6ud.gif)
 
for more information: [snel repo](https://github.com/crewdevio/Snel)
What does CGI.escape_html actually escape?
Tags: ruby, cgi, escapehtml
Published: 2021-04-01 19:26:24

---
title: What does CGI.escape_html actually escape?
published: true
description: What does CGI.escape_html actually escape?
tags: ruby, cgi, escapehtml
//cover_image: https://direct_url_to_image.jpg
---

If anyone is wondering what exactly ruby'sCGI.escape_html escape, here is the list:

```ruby
# The set of special characters and their escaped values  TABLE_FOR_ESCAPE_HTML__ = {    
"'" => '&#39;',
'&' => '&amp;',
'"' => '&quot;',
'<' => '&lt;',
'>' => '&gt;',
}
```

You can find this defined here in the code: https://github.com/ruby/cgi/blob/c05edf5608e86822a9e1fb0a40b0a7658ff38d56/lib/cgi/util.rb#L29

So, **tldr;** its escapes `', &, ", <, >`

OKBye!
AzureFunBytes Episode 37 - Microsoft Power Apps with @98codes
Tags: powerapps, azure, beginners, tutorial
Published: 2021-04-01 19:01:30

AzureFunBytes is a weekly opportunity to learn more about the fundamentals and foundations that make up Azure. It's a chance for me to understand more about what people across the Azure organization do and how they do it. Every week we get together at 11 AM Pacific on [Microsoft LearnTV](https://cda.ms/226) and learn more about Azure.

{% youtube vHIw0YbvZMo %}

This week I welcome [Greg Hurlman,](https://twitter.com/98codes) Senior Power Platform Advocate at Microsoft, to discuss [Microsoft Power Apps](https://cda.ms/22T)! [What is Power Apps](https://cda.ms/22V)?  Well, the Microsoft Documentation tells us:

*Power Apps is a suite of apps, services, connectors, and data platform that provides a rapid application development environment to build custom apps for your business needs. Using Power Apps, you can quickly build custom business apps that connect to your business data stored either in the underlying data platform ([Microsoft Dataverse](https://docs.microsoft.com/en-us/powerapps/maker/data-platform/data-platform-intro)) or in various online and on-premises data sources (SharePoint, Microsoft 365, Dynamics 365, SQL Server, and so on).*

Apps built on the Power Apps platform provide business logic and workflows without requiring software development.  Join us as we talk about all things Power Apps and Azure, TypeScript, C#, and just what _is_ "Fusion Dev"?

---

Learn about Azure fundamentals with me! You can also find the recordings here as well:

https://twitch.tv/azurefunbytes
https://twitter.com/azurefunbytes
https://aka.ms/jaygordononyoutube
[Azure DevOps YouTube Channel](https://www.youtube.com/channel/UC-ikyViYMM69joIAv7dlMsA)

Useful docs:

[Microsoft Learn: Introduction to Azure Fundamentals](https://cda.ms/22w)
[Create a Free Azure Account!](https://cda.ms/233)
[Microsoft Learn: Power Platform](https://cda.ms/232)
[Microsoft Power Platform](https://cda.ms/22R)
[Microsoft Power Apps](https://cda.ms/22T)
[What is Power Apps?](https://cda.ms/22X)
[Power Apps Demos](https://cda.ms/22Z)
[Create a canvas app from Microsoft Dataverse in Power Apps](https://cda.ms/230)