teleren/devto huggingface dataset:
Getting started with GIT and GITHUB
Published: 2022-11-26 13:35:02

**What is version control system**
Version control, also known as source control is the practice of tracking and managing changes to files. One of the most popular version control system is **GIT**

**What is GIT**
GIT is a free and open source distributed version control system useful for things like; 

- Tracking code changes
- Tracking who made changes
- Coding Collaboration

**How To get started with GIT**
To get started with git is _as simple as watching the sunrise_.
All you need to do is to go to their official website https://git-scm.com/download, download the suitable version for your OS and install the software.

**What is Github**
Github is a code hosting platform for version control and collaboration. It lets you and others work together on projects from anywhere
All you need to get started with git is to go to their official website and create an account

**GIT Configuration Commands*

1. git --version: This shows the current version of git you have installed
2. git config --global user.name "your github username"
3. git config --global user.name "your github email"
4. git config --global list

**Other Git commands**
**git init** - used to initialize git into our code base 

**git status** - This command tells us the status of our file 

**git add**- For staging a filE or tracking changes in our files

**git commit** - Gives tracks of changes in our file. This is important because u might want to go back to a particular commit in future

**git branch**-Allows us to make different copies of our source code and make changes independent of each other

**git clone**- Creates a copy of an existing Git repository

**git checkout** - git checkout is a the means to navigate existing branches.It can also be used to check old commits and old file revisions

**git clean** - Removes untracked files from the working directory.

**git pull**-  It downloads a branch from a remote repository, then immediately merges it into the current branch

**git push** - It lets you move a local branch to another repository, which serves as a convenient way to publish contributions.
Data Structures: Map & Hash Table
Tags: javascript, beginners, algorithms
Published: 2022-11-26 13:33:08

Ok, now it's time to hash!

{% embed https://stackblitz.com/edit/js-52r3dx?ctl=1&devToolsHeight=33&embed=1&file=index.js&hideExplorer=1&hideNavigation=1&theme=dark %}
Creating New Console App Project in Visual Studio Code 2022
Tags: csharp, consoleapp, visualstudio, howto
Published: 2022-11-26 13:19:20


Pada catatan kali ini akan kita bahas bagaimana cara untuk membuat Console App Project dengan menggunakan Visual Studio Comunity 2022

## Download

Visual Studio Comunity 2022 dapat diunduh secara gratis melalui link berikut [visualstudio.microsoft.com/downloads](https://visualstudio.microsoft.com/downloads/).

## Create New Project

Untuk membuat Console App Project bisa ikuti langkah-langkah berikut:
1. Jalankan aplikasi Visual Studio Comunity 2022
2. Pada tampilan berikut, kita pilih `Create a new project`
   ![Create a new project](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/gkz4ak7eqfh3nm6tfpld.jpg)
3. Kamudian kita pilih `Console App` atau `Console App (.Net Framework)`, lalu klik `next`
   ![Choose Template](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/r53xnapercco1oonnfl2.jpg)
4. Masukkan nama project yang dikehendaki, tentukan folder tempat menyimpan project, lalu klik `next`
   ![Project Name](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/9h3bh255hv50d0mjb72w.jpg)
5. Apabila yang kita pilih adalah `Console App`, maka akan muncul layar berikut, langsung saja klik `next`
   ![Optional](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/e5a399fq2nk84l8kmodn.jpg)

## Sample Code

Untuk mencoba project yang baru saja dibuat, berikut ini contoh code yang bisa dicoba.

### Code for `Console App`

Apabila yang kita pilih adalah `Console App`, maka kode berikut bisa langsung dijalankan:
```c#
Console.WriteLine("Berhasil!");
```

### Code for `Console App (.Net Framework)`

Tapi apabila yang kita pilih adalah `Console App (.Net Framework)`, maka kode harus kita input pada bagian `Main()`:
```c#
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AhoConsoleApp
{
  internal class Program
  {
    static void Main(string[] args)
    {
      Console.WriteLine("Berhasil!");

      Console.WriteLine("\nTekan tombol apapun untuk keluar!");
      Console.ReadKey();
    }
  }
}
```

### Start Debugging

Untuk menjalankan code di atas bisa dengan menekan `F5`, atau melalui menu `Debug` › `Start Debugging` atau langsung menekan tombol hijau seperti pada gambar berikut:

![Start Debugging](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/z6j3aaqc4wexd2wukzxp.jpg)
Run GOG Galaxy, Ubisoft Connect, Prime Gaming, Epic Launcher and EA App in Linux using Proton
Tags: linux, proton, games, wine
Published: 2022-11-26 12:56:33

Here's a simple script I made that allow you to play your favourite games from popular launchers in Linux using Proton: https://github.com/ordigital/neutron

It downloads, installs and run GOG Galaxy, Ubisoft Connect, Prime Gaming, Epic Launcher and EA App in dedicated prefixes.

It also has the possibility to run `winecfg` for specific prefix id because some games may need virtual desktop or mouse lock.
Django-Start V1.1.6
Tags: django, python, djangostart
Published: 2022-11-26 12:17:35

I made a new update for 

## Django-Start v1.1.6

, this update remained more stable, especially in running on macOS and Linux, and improving performance

Also, a new feature has worked, which will make you choose the Custom URL of the Django application, and this is a prelude to a new feature, which we will download, if God wills, in the next update 1.2.0

You can set custom URL know by type this `-u` or `--url-path` and after type your custom URL


You can read the documentation to know more about the
improvements that happened in the new version

https://github.com/islam-kamel/django-start
Aptos Wallet
Tags: blockchain, typescript
Published: 2022-11-26 12:16:29

I have developed a wallet on Aptos blockchain. Enables asset management, NFT and connection to Dapps. Hope everyone will watch and comment. Thanks everyone!

Link: https://chrome.google.com/webstore/detail/nix-move-wallet/mobgoaaconpcicgajnpclkelkmjigiak
Document: https://nix-aptos-wallet.vercel.app/
I've been fooled
Tags: career, motivation, watercooler
Published: 2022-11-26 12:01:49

So I was contacted by [PandaDoc](https://www.pandadoc.com/) because they were to expand their software team.

Since they don't have offices on my country. They used a third party ([deel](https://www.deel.com)) for managing the legal aspect.  

On Monday I received the offer letter through this third party: 


![Offer](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/28n8w4m2sonijtv57nxx.png)



But didn't receive email from the recruiter. 

I pinged her and we scheduled a meeting on Thursday.

In the meantime, I booked train tickets. My manager lives in a different city (~3h by train) and I wanted to give him the letter personally. Love the details.

The meeting with PandaDoc's HR; she told me that despite of they were extremely happy with my selection process - nothing but positive feedback - they were cancelling the offer.

She explained that they were entering in hiring freeze. I wasn't supposed to receive the offer letter. "_I'm sorry_".

Since Monday, I've already changed job. I mean mentally. This is the worst part. I'm not focused on my current job at all.

Cancelling an offer once I've received the letter is the most dirty thing I've suffered in a selection process.

Thanks for reading. 

-- 

ps. At least I've been able to receive a 80% refund of the train tickets.
How to Fix Issues With CSS Position Sticky Not Working
Tags: css
Published: 2022-12-01 11:48:36

---
title: How to Fix Issues With CSS Position Sticky Not Working
published: true
date: 2022-11-26 11:54:03 UTC
tags: CSS
canonical_url: https://robertmarshall.dev/blog/solution-to-why-css-position-sticky-is-not-working/
---

--------

This article was originally posted (and is more up to date) at https://robertmarshall.dev/blog/solution-to-why-css-position-sticky-is-not-working/

--------

An issue that took far longer than it should have to solve.

I was using the CSS `position: sticky` on my header so it moved down as the user scrolled. However when I added the mobile menu which transitioned in from the right, the sticky header broke. Could not understand why!

Turns out `sticky` does not play nicely with most `overflow` values.

If you are trying to use `position: sticky` and it is not working, it is because one of the elements wrapping it is using `overflow` with a value of `hidden`, `auto` or `scroll`.

## How to solve the sticky problem?

There is a new (ish) value that can be used with `overflow`. It is `clip`.

As Mozilla puts it in their [documentation](https://developer.mozilla.org/en-US/docs/Web/CSS/overflow):

> Similar to hidden, the content is clipped to the element’s padding box. The difference between clip and hidden is that the clip keyword also forbids all scrolling, including programmatic scrolling. The box is not a scroll container, and does not start a new formatting context. If you wish to start a new formatting context, you can use display: flow-root to do so.

## Is Clip Supported on all modern browsers.

At time of writing (23/11/2022) all current versions of modern browsers support this functionality. Take a look at[Can I Use](https://caniuse.com/mdn-css_properties_overflow_clip) if you want to check for yourself.
Form validation with SvelteKit and Zod
Published: 2023-04-07 13:18:58

---
title: Form validation with SvelteKit and Zod
published: true
date: 2022-11-26 11:26:15 UTC
tags: 
canonical_url: https://www.okupter.com/blog/sveltekit-form-validation-with-zod
---

Enhance your SvelteKit forms building experience by using Zod for type safe form validation.

Reposted from [https://www.okupter.com/blog/sveltekit-form-validation-with-zod](https://www.okupter.com/blog/sveltekit-form-validation-with-zod).
Cheatsheet for LINQ
Tags: cheatsheet, linq
Published: 2022-11-26 11:25:09

# Intro.
A query variable is always an enumerable type that will produce a sequence of elements when it is iterated over in a foreach statement or a direct call to its IEnumerator.MoveNext method.

# Syntax
``` cs
from .. in ..
[ join .. in .. on .. equals .. ]
[ where | orderby .. ascending | descending | let ]
[ group .. by .. into .. ]
select new {}
```

# Group clause
``` cs
var queryCountryGroups =
    from country in countries
    group country by country.Name[0];
```

# Select clause
``` cs
var queryNameAndPop =
    from country in countries
    select new { Name = country.Name, Pop = country.Population };
```

# Orderby clause
``` cs
IEnumerable<Country> querySortedCountries =
    from country in countries
    orderby country.Area, country.Population descending
    select country;
```

# Join clause
``` cs
var categoryQuery =
    from cat in categories
    join prod in products on cat equals prod.Category
    select new { Category = cat, Name = prod.Name };
```

# Let clause
``` cs
string[] names = { "Svetlana Omelchenko", "Claire O'Donnell", "Sven Mortensen", "Cesar Garcia" };
IEnumerable<string> queryFirstNames =
    from name in names
    let firstName = name.Split(' ')[0]
    select firstName;

foreach (string s in queryFirstNames)
    Console.Write(s + " ");
//Output: Svetlana Claire Sven Cesar
```

# Subqueries in a query expression
``` cs
var queryGroupMax =
    from student in students
    group student by student.GradeLevel into studentGroup
    select new
    {
        Level = studentGroup.Key,
        HighestScore =
            (from student2 in studentGroup
             select student2.Scores.Average())
             .Max()
    };

// percentileQuery is an IEnumerable<IGrouping<int, Country>>
var percentileQuery =
    from country in countries
    let percentile = (int) country.Population / 10_000_000
    group country by percentile into countryGroup
    where countryGroup.Key >= 20
    orderby countryGroup.Key
    select countryGroup;

// grouping is an IGrouping<int, Country>
foreach (var grouping in percentileQuery)
{
    Console.WriteLine(grouping.Key);
    foreach (var country in grouping)
        Console.WriteLine(country.Name + ":" + country.Population);
}
```

# Standard query operators
*Ref: https://docs.microsoft.com/en-us/dotnet/api/system.linq.enumerable.selectmany?view=netcore-3.1*
```
Where Select SelectMany Skip SkipWhile
Take TakeWhile Join GroupJoin Concate
OrderBy OrderByDescending ThenBy ThenByDescending Reverse
GroupBy Distinct Union Intersect Except
AsEnumerable AsQueryable ToArray ToList ToDictionary
ToLookup OfType Cast SequenceEqual First
FirstOrDefault Last LastOrDefault Single SingleOfDefault
ElementAt ElementAtOrDefault DefaultEmpty All Any
Contains Count LongCout Sum Min
Max Average Aggregate equal/Equals from/From
in/In into/Into key let Group
Range Repeat
```
Cheatsheet for Dotnet-CLI
Tags: cheatsheet, dotnet, cli
Published: 2022-11-26 11:23:04

*Reference*
- *https://docs.microsoft.com/en-us/dotnet/core/tools/*

## List installed package
``` powershell
dotnet list package
```

## Restores the dependencies and tools of a project
``` powershell
dotnet restore
```

## Install new package to local project
``` powershell
dotnet add package <package_name>
```

## Remove package from local project
``` powershell
dotnet remove package <package_name>
```
Cheatsheet for Composer
Tags: cheatsheet, composer, php
Published: 2022-11-26 11:19:11

#### _Reference_
- _https://getcomposer.org/doc/_

### Download & Install composer locally
``` bash
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
php -r "if (hash_file('sha384', 'composer-setup.php') === '8a6138e2a05a8c28539c9f0fb361159823655d7ad2deecb371b04a83966c61223adc522b0189079e3e9e277cd72b8897') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
php composer-setup.php
php -r "unlink('composer-setup.php');"
```

### Check composer version
``` bash
./composer.phar --version
``` 

### Create a new project based on existing repository
``` bash
./composer create-project --prefer-dist laravel/laravel .
```

### Make directory writable within the Laravel application
1) storage
2) bootstrap/cache
LDAP
Tags: ldap, cheatsheet, idm
Published: 2022-11-26 11:17:48

## LDAP (Lightweight Directory Access Protocol)
- LDAP目錄的條目（entry）由屬性（attribute）的一個聚集組成，並由一個唯一性的名字參照，即專有名稱（distinguished name，DN）。例如，DN能取這樣的值：「ou=people,dc=wikipedia,dc=org」。
- LDAP is appropriate for any kind of directory-like information, where fast lookups and less-frequent updates are the norm.
- LDAP does not define how programs work on either the client or server side. It defines the "language" used for client programs to talk to servers (and servers to servers, too).

## Normal Attribute Name (X.500 standard)
| Attribute | Meaning | Example |
| --------- | ------- | ------- |
| dn | Distinguished name | |
| dc | | |
| o | Organization | |
| ou | | |
| c | Country | Country: e.g GB for Great Britain. | 
| cn | Common name | CN=Guy Thomas. Actually, this LDAP attribute can be made up from givenName joined to SN. |
| sn | Surname | |
| givenName | | |
| homeDrive | | Home Folder: connect.  Tricky to configure. |
| name | | name = Guy Thomas.  Exactly the same as CN. |
| displayName | | |
| objectClass | objectClass = User. Also used for Computer, organizationalUnit, even container. Important top-level container. | |
| title | Job title | title = Manager|
| description | Description | |
| mail | E-mail | |
| wWWHomePage | User's home page | |

## Reference
#### GUI LDAP Client tool
- http://www.ldapadmin.org/

#### Filter
- https://confluence.atlassian.com/kb/how-to-write-ldap-search-filters-792496933.html
- https://ldapwiki.com/wiki/LDAP%20Filter%20Choices
Simplest Way to create and pass props in React
Tags: tutorial, react, beginners, javascript
Published: 2022-11-26 11:15:42

## Create a prop

Lets say there are two components, a `Parent` and `Child` function component  as seen below. Here how we can pass data from the `Parent` to the `Child`.
``` javascript
function Parent() {

	return (
		<>
			
		</>
	)
}
export default Parent;
```
```javascript
function Child() {

	return (
		<>
			
		</>
	)
}
export default Child;
```
### Step 1

create a  Parent component state using the `useState` React hook.
```javascript
import { useState } from 'react'

function Parent() {
	const [word, setWord] = useState()

	return (
		<>
			
		</>
	)
}
export default Parent;
```
### Step 2

Return the Child component in the parent component
```javascript
import { useState } from 'react'
import Child from './Components/Child'

function Parent() {
	const [word, setWord] = useState()

	return (
		<>
			<Child />
		</>
	)
}
export default Parent;
```
### Step 3

We pass the props in the `Child` component as an argument (similar to how we do it in a regular function). We must use curly braces `{ }` to access data defined in JavaScript and pass it as the props for `Child` component, In this case we pass the `word` state.
```javascript
import { useState } from 'react'
import Child from './Components/Child'

function Parent() {
	const [word, setWord] = useState()

	return (
		<>
			<Child theWord = { word } />
		</>
	)
}
export default Parent;
```
### Step 4

Now here’s how we utilize the passed props data in the `Child` component, using the curly braced `{ }` is important for passing props without using the props object (which we’ll see later on).
```javascript
function Child({ theWord }) {
	console.log(theWord)
	return (
		<>
			<p> { theWord } </p>	
		</>
	)
}
export default Child;
```
## Extra

You can also specify a default value for your props, say we wanted the default word (when no value has been passed to word from `Parent`) to be `“kakashi”` here’s how we do it.
```javascript
function Child({ theWord = "kakashi" }) {
	console.log(theWord)
	return (
		<>
			<p> { theWord } </p>	
		</>
	)
}
export default Child;
```
But if you pass `theWord={null}` or `theWord={0}`, the default value will not be used
Understanding environment variables in SvelteKit
Published: 2023-04-07 13:18:29

---
title: Understanding environment variables in SvelteKit
published: true
date: 2022-11-26 11:09:01 UTC
tags: 
canonical_url: https://www.okupter.com/blog/environment-variables-in-sveltekit
---

Environment variables are an important feature of NodeJS applications. In this article, we will learn how SvelteKit makes use of them and how to use them effectively.

Reposted from [https://www.okupter.com/blog/environment-variables-in-sveltekit](https://www.okupter.com/blog/environment-variables-in-sveltekit).
Handling authentication and authorization with JWT in SvelteKit
Published: 2023-04-07 13:17:58

---
title: Handling authentication and authorization with JWT in SvelteKit
published: true
date: 2022-11-26 10:59:57 UTC
tags: 
canonical_url: https://www.okupter.com/blog/handling-auth-with-jwt-in-sveltekit
---

In this article, we will learn how to handle authentication and authorization with JWT in SvelteKit.

Reposted from [https://www.okupter.com/blog/handling-auth-with-jwt-in-sveltekit](https://www.okupter.com/blog/handling-auth-with-jwt-in-sveltekit).
This week’s newsletter is out! (26-11-2022) - Geopolitics, Money and Football
Tags: javascript, tech, webdev
Published: 2022-11-26 10:52:20

---
title: This week’s newsletter is out! (26-11-2022) - Geopolitics, Money and Football
published: true
description: Another week of great javascript, tech and web development links.
tags: javascript, tech, webdev, discuss
---

Geopolitics, Money and Football

https://markjgsmith.substack.com/p/mark-smiths-newsletter-26-11-2022

Would love to hear any comments and feedback you have.

[@markjgsmith](https://twitter.com/markjgsmith)
How to create a superuser in PostgreSQL, using Linux
Tags: python, django, djangodevelope
Published: 2022-11-26 10:38:55

I will show you how to create a database by using a superuser. When we use any type of framework, we need to connect with the database by using a DB name. Table creation, query, and another task can be done by the framework.

Let’s assume you are using Linux Ubuntu and PostgreSQL already install in your pc.you can install PostgreSQL using this [link](https://www.postgresql.org/download/linux/ubuntu/).


Start the PostgreSQL server

```
sudo service postgresql start

```
open terminal to enter into PostgreSQL database

```
sudo su -l postgres
```

Now create user gias as a superuser, and assign a password immediately

```
postgres@gias ~ $
createuser -P -s -e gias
Enter password for new role: xyzzy
Enter it again: xyzzy
CREATE ROLE joe PASSWORD 'md5b5f5ba1a423792b526f799ae4eb3d59e' SUPERUSER CREATEDB CREATEROLE INHERIT LOGIN;
```
Create a database using this command **createdb -O user dbname**

```
createdb -O gias testdb
```

enter into your database

```
psql -d testdb
show all table name
\dt
```
Done, you can use your database name and username.

Thank you for reading my article! If you enjoyed it and would like to support my work, please consider buying me a coffee at **[Buy Me a Coffee](https://www.buymeacoffee.com/giasuddin)**. You can also learn more about me and my work by visiting my **[Giasuddin Bio ](https://bio.link/giasuddi)**and following me on LinkedIn and Twitter. Thank you for your support!
Validate Binary Tree Nodes
Tags: javascript, leetcode
Published: 2022-11-26 10:18:49

[Validate Binary Tree Nodes](https://leetcode.com/problems/validate-binary-tree-nodes/)

```js
/**
 * @param {number} n
 * @param {number[]} leftChild
 * @param {number[]} rightChild
 * @return {boolean}
 */
var validateBinaryTreeNodes = function (n, leftChild, rightChild) {
  const findRootNode = (LC, RC) => {
    const root = 0;
    const children = new Set([...LC, ...RC]);

    for (let i = 0; i < n; i++) {
      if (!children.has(i)) root = i;
    }

    return root;
  };
  //  this function is needed becoz it is not mentioned that zero is root always.
  // hence we have to check out of left & right array which is missing number that will be root
  const root = findRootNode(leftChild, rightChild);
  const visited = new Set();
  const queue = [root];

  while (queue.length) {
    const len = queue.length;

    for (let i = 0; i < len; i++) {
      const node = queue.shift();
      // this is to keep track of where we have visited that node in past... if visited before that means
      // it is part of tree already & cannot be added

      if (visited.has(node)) return false;

      visited.add(node);

      // add nodes to queue to visit later
      if (leftChild[node] !== -1) queue.push(leftChild[node]);
      if (rightChild[node] !== -1) queue.push(rightChild[node]);
    }
  }

  // if valid tree: visited = number of node
  // all nodes are visited exactly once from 0 to n - 1 nodes
  return visited.size === n;
};


```