teleren/devto huggingface dataset:
Displaying Hashnode Posts on Personal Site with RSS
Tags: rss, hashnode, node, blogging
Published: 2022-10-21 10:48:10

---
title: Displaying Hashnode Posts on Personal Site with RSS
published: true
date: 2022-10-21 07:30:02 UTC
tags: #rss #hashnode #nodejs #blogging
canonical_url: 
---

### Introduction

Hello,

I hope you are writing articles on Hashnode, either in Personal, community or company blogs. You may want to link and display your written articles in your personal websites or portfolio where others can see only your article with other content. Here we'll see two ways with which you can achieve above task easily.

### Solutions

#### Hashnode Official API

Hashnode provides official GraphQL API from which you can retrieve various content and display. You can test their [playground here.](https://api.hashnode.com/) With this API you can get various type content like featured posts, users posts and publications, manipulate articles and related data. You may require PAT(Personal Access Token) for some of access.

For more information, refer [this article](https://catalins.tech/hashnode-api-how-to-display-your-blog-articles-on-your-portfolio-page) by Catalin Pit.

#### RSS Parsing

Another way is RSS Parsing. In this, RSS URL of publication is required to retrieve and process data. Here I'll take [my blogs](https://blog.thesourcepedia.org/) rss and process it and display articles which are written by me(aka Piyush Goyani).

First, I have created Backend NodeJS API in which I have installed [`rss-parser`](https://github.com/rbren/rss-parser) package to parse RSS feed of blog.

```
import Parser = require('rss-parser');

async getRss() {
  const parser: Parser = new Parser();
  const url = 'https://blog.thesourcepedia.org/rss.xml';
  const feed = await parser.parseURL(url);
  return feed.items.map((item) => {
    return {
      title: item['title'],
      coverImage: item['cover_image'],
      creator: item['creator'],
      link: item['link'],
      pubDate: item['pubDate'],
    };
  });
}

```

Here, as you can see, RSS feed URL is parsed and parser return whole array, which further mapped with specific key/value object and return as API response.

In the frontend side, which is Vue component where All articles are being rendered by calling API.

```
<template>
  <div>
    {{ items }} // render posts
  </div>
</template>
export default {
  data() {
    return {
      items: [],
    };
  },
  mounted() {
    fetch("https://api.thesourcepedia.org/blog/getRss")
      .then((res) => res.json())
      .then((data) => {
        this.items = data.filter((post) => post.creator === "Piyush Goyani");
      });
  },
};

```

Here I'm calling `/getRss` API which returns article array, and here I can filter which specific author(e.g myself) and display only those posts which I have written in [my personal site](https://piyushgoyani.thesourcepedia.org/).

![PersonalSitePosts.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1666336444978/abDqVi0pe.png)

You can filter and process RSS in different way as per you need.

### Conclusion

I hope you enjoyed this article and found useful. Give a thumb and subscribe for more interesting stuff.
Back to the Front-end: Exploring the Future of the Umbraco UI (Part 3 - Glossary)
Tags: umbraco, frontend
Published: 2022-10-21 07:24:25

Next up in this series, I think it would be worth creating a bit of a glossary of key tech / concepts that we are going to have to learn about in order to start to build and extend the new UI.

I'll just be outlining the main elements here, but I'll detail them in future blog posts as I learn more and I'll be sure to update this page with links to those posts as I do (they won't necessarily get blogged about in this order though).

## Tech Stack

- [Web Components](https://developer.mozilla.org/en-US/docs/Web/Web_Components) - The key concept within the new back office UI for componentising the system and allowing extendibility in a future proof manor
- [ES Modules](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Modules) - The concept for producing modular script files.
- [Lit](https://lit.dev/) - A lightweight library used by the new UI for simplifying the process of creating web components
- [TypeScript](https://www.typescriptlang.org/) - A javascript extension to allow strongly typed behaviour during development helping to eliminate mistakes and create more consistent code
- [UUI](https://uui.umbraco.com/) - The Umbraco maintained UI library providing the low level UI building blocks for the new UI
- [OpenApi](https://spec.openapis.org/oas/v3.1.0) - A specification for a standard programming language-agnostic interface description for web based APIs
- [RxJS](https://rxjs.dev/) - A javascript extension to provide reactivity to data objects allowing them to be observed and watched for changes so that the UI can update itself automatically
- [Vite](https://vitejs.dev/) - The build and dev tooling for compiling the new UI
- [Playwright](https://playwright.dev/) - The end-to-end testing framework used by the new back office UI

## Concepts
- **Context API** - An event driven approach to dependency injection that doesn't require any 3rd party libraries
- **Manifests** - A config file to define and register custom controls with the back office UI
- **Routing** - The mechanism used to control navigating around the application via the address bar
- **Styling** - The ability to control the styles and themes of elements on the screen
Back to the Front-end: Exploring the Future of the Umbraco UI (Part 1 - Introduction)
Tags: umbraco, frontend
Published: 2022-10-21 07:23:23

For any Umbraco developer in the past few years there have been 2 major milestones on the horizon to prepare for. The first being the move to .NET Core and the second being the new back-office UI.

Thankfully, due to the monumental efforts of the HQ team, the community and package developers, the first of those milestones is now firmly behind us as with Umbraco v9 and now v10+ we are 100% .NET Core and still have a thriving package ecosystem.

## 1 Down 1 to Go
With Umbraco now on .NET Core, that just leaves us the next milestone, which poses to be an even bigger challenge, the new back office UI.

Thankfully HQ are following the same pattern as for the .NET Core port, mainly building in the open and releasing usable code early. By doing this it allows us all to see how the new back office UI is being built, but more importantly gives us an early idea of the new technologies and practices that we will need to become familiar with.

As the creator of [Vendr](https://vendr.net) and [Konstrukt](https://getkonstrukt.net), two Umbraco packages with very tightly integrated user interfaces, I have an inherent vested interest in understanding all these new changes to enable me to ensure these packages are ready for the new UI as soon as possible.

## The Date was October 21st, 2022...
To help with my own journey and to potentially others, I thought it could be worth while starting a blog series about my findings as I explore the codebase and document some of the new concepts and how they work and differ from what we had before.

Stay tuned for more to come...
Prezlab
Tags: tutorial
Published: 2022-10-21 06:43:24


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

Prezlab is a leading presentation design agency serving businesses across various industries in the MENA region. With a team of experts with extensive experience in the field, we are well placed to help our clients grow and thrive - even in challenging times. By really getting to know our customers, our talented team have helped countless clients of all shapes and sizes from government entities to private businesses and start-ups exceed their presentation goals and digital needs. Our goal is to help tell your story in a way that captivates your audience and leaves a memorable impact 

As a company we believe in building long lasting client partnerships which aims at shared growth and prosperity. 

Over the years, we have gathered solid experience across a wide dimension of different industries and business needs. 

Apart from presentation design, Prezlab specializes in a variety of creative services, including: 

• Infographic Design 
• Books & Reports 
• Video Production 
• Brand Development 	
• Website Design 
• Digital Marketing 
• Social Media Management 

Contact us
Office 507, Building 8, Dubai Design District, Dubai, United Arab Emirates
+97145813684
[](https://prezlab.com/)
engage@prezlab.com
Hợp đồng điện tử vô hiệu
Tags: econtract, contract
Published: 2022-10-21 06:38:36

Hợp đồng điện tử hiện đang được rất nhiều doanh nghiệp, tổ chức sử dụng. Tuy nhiên, vẫn còn nhiều vướng mắc về hình thức hợp đồng này. Nhiều người băn khoăn không biết trong trường hợp nào thì hợp đồng điện tử vô hiệu. Dưới đây chúng tôi sẽ làm rõ điều  này.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/d4mh5cqo8619jw1nd58f.png)
**
## Khi nào hợp đồng điện tử vô hiệu?
**
Theo Khoản 1 Điều 4 Luật giao dịch điện tử 2005 Chứng thư điện tử là thông điệp dữ liệu do tổ chức cung cấp dịch vụ chứng thực chữ ký điện tử phát hành nhằm xác nhận cơ quan, tổ chức, cá nhân được chứng thực là người ký chữ ký điện tử.

Giao dịch điện tử là giao dịch được thực hiện bằng phương tiện điện tử.

Bên cạnh đó, Điều 33 Luật giao dịch điện tử 2005 quy định: [Hợp đồng điện tử là](https://econtract.efy.com.vn/hddt/hop-dong-dien-tu-la-gi-econtract.html/) hợp đồng được thiết lập dưới dạng thông điệp dữ liệu theo quy định của Luật này.

Hợp đồng điện tử được thừa nhận và không bị phủ nhận vì lý do được thể hiện dưới dạng thông điệp dữ liệu.

Nguyên tắc giao kết hợp đồng và thực hiện hợp đồng theo Điều 35 Luật giao dịch điện tử 2005 như sau:
- Pháp luật áp dụng: Luật giao dịch điện tử 2005 và pháp luật về hợp đồng;
- Khi giao kết và thực hiện hợp đồng điện tử, các bên có quyền thoả thuận về yêu cầu kỹ thuật, chứng thực, các điều kiện bảo đảm tính toàn vẹn, bảo mật có liên quan đến hợp đồng điện tử đó.
- Trong giao kết hợp đồng, trừ trường hợp các bên có thỏa thuận khác, đề nghị giao kết hợp đồng và chấp nhận giao kết hợp đồng có thể được thực hiện thông qua thông điệp dữ liệu.

>> [Giá trị pháp lý của Hợp đồng điện tử](https://econtract.efy.com.vn/hddt/hop-dong-dien-tu-co-gia-tri-phap-ly-khong.html/) 

Như vậy, giao dịch điện tử vẫn có giá trị như một hợp đồng thông thường. Điều kiện có hiệu lực giao dịch điện tử ngoài quy định trong Luật giao dịch điện tử 2005 còn được quy định trong Bộ luật dân sự 2005, Luật giao dịch điện tử 2005 và một số văn bản pháp luật liên quan. Do vậy, vấn đề vô hiệu trong hợp đồng điện tử khi Luật giao dịch điện tử 2005 không có quy định thì áp dụng quy định Bộ luật dân sự 2005 để giải quyết.

Theo quy định Điều 127 đến Điều 137 Bộ luật dân sự 2005, Luật giao dịch điện tử 2005 thì giao dịch điện tử bị vô hiệu khi:

- Vi phạm điều kiện có hiệu lực của hợp đồng điện tử theo quy định Luật giao dịch điện tử 2005 và Bộ luật dân sự 2005;

- Có bản án, quyết định Tòa án quyết định hợp đồng điện tử vô hiệu.

Như vậy, trong trường hợp này, hợp đồng điện tử vô hiệu khi có bản án, quyết định Tòa án.
219. Leetcode solution in Javascript
Tags: javascript
Published: 2022-10-21 06:27:41

```javascript
/**
 * @param {number[]} nums
 * @param {number} k
 * @return {boolean}
 */
var containsNearbyDuplicate = function(nums, k) {
    var numIndex = {};
    for (var i = 0; i < nums.length; i++) {
        if (nums[i] in numIndex) {
            if (i - numIndex[nums[i]] <= k) {
                return true;
            }
        }
        numIndex[nums[i]] = i;
    }

    return false;
};
```
#leetcode
#challenge
Here is the link for the problem:
https://leetcode.com/problems/contains-duplicate-ii/
How to generate golang unit test code in VS code
Tags: go
Published: 2022-10-21 05:59:25

1. Go for Function name --->right click and in that we have so many option--->select --go: generate unit test for function

main.go
```
package main

import "fmt"

func Add(a int, b int) int {
	return a + b
}

func main() {
	b := Add(10, 20)
	fmt.Println(b)

}
```
main_test.go
```
package main

import "testing"

func TestAdd(t *testing.T) {
	type args struct {
		a int
		b int
	}
	tests := []struct {
		name string
		args args
		want int
	}{
		{
			name: "hello",
			args: args{
				a: 1,
				b: 2,
			},
			want: 3,
		},
	}
	for _, tt := range tests {
		t.Run(tt.name, func(t *testing.T) {
			if got := Add(tt.args.a, tt.args.b); got != tt.want {
				t.Errorf("Add() = %v, want %v", got, tt.want)
			}
		})
	}
}

```
Just Starting Out - post 0
Tags: beginners
Published: 2022-10-21 05:32:26

I am creating my first blog post and try to have an online diary of my journey into becoming a full stack web developer! I know probably no one is going to read these so if you are reading this, hey! Thanks for reading it! Today's post is just going to mostly be about what i've learned prior to joining this bootcamp. 

I started out with a huge interest in the hardware of a computer. When I was gifted my first pc, I quickly got sucked into the "plug and play" aspect of the hardware. I knew little about the 1's and 0's that allowed the computer to do its things. I was fascinated by just how efficient and fast I could make my pc go with overclocking and buying new parts as I could afford them. I eventually realized that I had an urge to know more. I wanted to know how to create. Make my own rules and modifications to programs and games. Minecraft was my first modded game. Although the code I wrote did very little and only add small differences to the game, I had fun doing so.

I eventually became focused on acting and film as a reached highschool but my passion for understanding computer didn't dissipate. I just became more focused on wearing tights over time. 

Im now out of college and wanting to do more than wear tights. Thus joining a bootcamp! I have spent a good chunk of time on sites such as codecademy to brush up and gain a new tools in a wide range of languages but now I am ready to fully dive deep and make a career out of what I love to do!
TimescaleDB Tablespaces
Tags: timescaledb, tablespace, scaling, aws
Published: 2022-10-21 04:59:45

### Tablespace

- **Tablespace** is a storage location where the actual data is stored. 

- The tuples belonging to the same table could be stored in different tablespaces.

- Tablespaces are mainly used to separately store data of different priority in different kind of disk.

- Example: Data of active users, or recent active customers can be stored in _fast disk types_ like ssd or flash. Data that is old and unused frequently or archived, can be stored in a _less expensive and slower_ data storage like HDD. 

_______________________________________________________
### TimescaleDB
- TimescaleDB is an open source time series database. It is extends PostgreSQL and supports most of the commands of postgres.

- Docker Image: 

```
docker pull timescale/timescaledb
```

- TimescaleDB has a concept of hypertables and chunks. Hypertables are Postgresql tables, that partition the data into chunks.

- The chunks are created based on primarily the time field.

- The chunks older than certain date can be moved to a slow disk like HDD and the latest data which would be heavily used can be used in a fast disk like SSD and Flash.

- The concept of _tablespaces_ helps in here.

- TSDB code to move chunks:

```
SELECT move_chunk(
  chunk => '_timescaledb_internal._hyper_1_4_chunk',
  destination_tablespace => 'tablespace_2',
  index_destination_tablespace => 'tablespace_3',
  reorder_index => 'conditions_device_id_time_idx',
  verbose => TRUE
);
```

For detailed information, use the following link: https://legacy-docs.timescale.com/v1.7/api#move_chunk

_______________________________________________________
### AWS Volumes

- If the TSDB instance is hosted in a kubernetes cluster in AWS, the TSDB pod would be provided with an AWS Volume for persistent storage.

- AWS supports the following volume classes. Based on speed and cost requirements, we can select the appropriate volumes for TSDB tablespaces.

- AWS volume types: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ebs-volume-types.html


_________________________________________________

Thank you for reading the blog :) 
Aniketh Deshpande
Vertical Order Traversal of a Binary Tree
Tags: javascript, leecode
Published: 2022-10-21 04:54:02

Given the root of a binary tree, calculate the vertical order traversal of the binary tree.

For each node at position (row, col), its left and right children will be at positions (row + 1, col - 1) and (row + 1, col + 1) respectively. The root of the tree is at (0, 0).

The vertical order traversal of a binary tree is a list of top-to-bottom orderings for each column index starting from the leftmost column and ending on the rightmost column. There may be multiple nodes in the same row and same column. In such a case, sort these nodes by their values.

Return the vertical order traversal of the binary tree.

 

Example 1:

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




Input: root = [3,9,20,null,null,15,7]
Output: [[9],[3,15],[20],[7]]
Explanation:
Column -1: Only node 9 is in this column.
Column 0: Nodes 3 and 15 are in this column in that order from top to bottom.
Column 1: Only node 20 is in this column.
Column 2: Only node 7 is in this column.

```js
const verticalTraversal = function (root) {
  const columnToValue = {};
  let que = [[root, 0]];

  while (que.length) {
    let len = que.length;
    let newQue = [];
    for (let i = 0; i < len; i++) {
      let [node, idx] = que[i];
      // Populate hash-table
      if (!columnToValue[idx]) {
        columnToValue[idx] = [];
      }
      columnToValue[idx].push(node.val);
      // create next-level
      if (node.left) newQue.push([node.left, idx - 1]);
      if (node.right) newQue.push([node.right, idx + 1]);
    }
    que = newQue.sort((a, b) => a[0].val - b[0].val); // sort by node-value
  }
  return Object.keys(columnToValue)
    .sort((a, b) => a - b)
    .map((el) => columnToValue[el]); //sort by column
};

```
Subtree of Another Tree
Tags: javascript, leetcode
Published: 2022-10-21 04:52:16

Given the roots of two binary trees root and subRoot, return true if there is a subtree of root with the same structure and node values of subRoot and false otherwise.

A subtree of a binary tree tree is a tree that consists of a node in tree and all of this node's descendants. The tree tree could also be considered as a subtree of itself.


Example 1:

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



Input: root = [3,4,5,1,2], subRoot = [4,1,2]
Output: true

Example 2:

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



Input: root = [3,4,5,1,2,null,null,null,null,0], subRoot = [4,1,2]
Output: false

```js
/**
 * Definition for a binary tree node.
 * function TreeNode(val, left, right) {
 *     this.val = (val===undefined ? 0 : val)
 *     this.left = (left===undefined ? null : left)
 *     this.right = (right===undefined ? null : right)
 * }
 */
/**
 * @param {TreeNode} root
 * @param {TreeNode} subRoot
 * @return {boolean}
 */

var isSubtree = function (root, subRoot) {
  if (!root) return false;
  return (
    isEqual(root, subRoot) ||
    isSubtree(root.left, subRoot) ||
    isSubtree(root.right, subRoot)
  );
};

function isEqual(root1, root2) {
  if (root1 == null || root2 === null) {
    return true;
  }
  if ((root1 && root2 === null) || (root1 === null && root2)) {
    return false;
  }
  if (root1.val !== root2.val) {
    return false;
  }
  return isEqual(root1.left, root2.left) && isEqual(root1.right, root2.right);
}

```
Website Relaunch
Tags: storybytes, opensource, websitrelaunch, websitedevelopment
Published: 2022-10-21 04:45:00



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


If you’re looking at this post, you are likely in the middle of a website relaunch, or you have one planned. It takes a lot to pull off a successful website relaunch. Launching a fresh new website is essential for any organization to make the right impression with existing visitors. However, it’s critical that you have ‘customer-centred’ content ready to deploy along with your new website relaunch, so you can consistently feed Search engines to index your page and increase your domain and page ranking. But where do I host the page? Certainly the page has to load fast, but how fast is fast? And there is even more to add and look into a new site or relaunch. At Web and App Studio we consult our customers so that they can choose their top three priority based on their business goals. This is essentials since less is sometimes more.
Mobile App Concepts
Tags: storybytes, mobile, business, technology
Published: 2022-10-21 04:37:31


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

Twenty years back, the mobile app industry was reborn. And like any other ordinary parents, business owners were hopeful that it would transform into a mature business one day when it grew. And the investments they have made will return in manifolds. In the new economy, the mobile app industry is the fastest-growing sector. Its worth in 2012 was $53billion, and the projected revenue for 2020 was 188.9 billion. As technology advances, it is opening new horizons for business owners to explore and try out impressive ideas. We at Web and App Studio are helping many organizations to improve their ideas and enrich them with technical concepts or even development. Our team has the experience to build complex, user-friendly and technically robust apps.