teleren/devto huggingface dataset:
ObjectionJs & Advanced Techniques
Tags: node, javascript, objectionjs, sql
Published: 2023-06-08 23:34:23

Objection.js is a highly flexible and performant Object-Relational Mapping (ORM) library for Node.js, designed to help you build efficient SQL queries with a delightful API. In this blog post, we'll delve into some advanced features that can take your Objection.js skill set to the next level.

**1. Eager Loading**

One of the greatest features in Objection.js is the ability to use eager loading, reducing the number of queries and thus the overall load on the database. Leveraging the `.eager()` method, you can load related data in a single query. But have you tried the `modifyEager` function? This allows you to apply transformations or additional conditions on your eagerly loaded data.

```javascript
Person.query()
  .eager('pets')
  .modifyEager('pets', builder => builder.where('species', 'dog'))
  .then(persons => {
    // Each person in persons has a 'pets' property that contains only their dogs.
  });
```

**2. Efficient Use of Transactions**

Transactions in Objection.js are designed to help you manage your database operations efficiently, ensuring that related operations either all succeed or fail together, maintaining the integrity of your data. The `.transaction()` method makes it a breeze to use transactions, but you can enhance efficiency by reusing transaction instances for multiple queries.

```javascript
const trx = await Person.startTransaction();

try {
  await Person.query(trx).insert({name: 'John'});
  await Pet.query(trx).insert({name: 'Fluffy', ownerId: 1});
  await trx.commit();
} catch (err) {
  await trx.rollback();
  throw err;
}
```

**3. Graph Insertion and Upserts**

Graph insertion is another Objection.js feature that can help reduce the amount of code you write and the number of database round-trips. It allows you to insert a graph of objects with relations in a single command.

```javascript
await Person.query().insertGraph({
  name: 'Jennifer',
  pets: [{
    name: 'Fluffy',
    species: 'dog'
  }]
});
```

What's even more exciting is the combination of graph operations with upserts (update or insert). This is achieved using the `upsertGraph` method. 

```javascript
await Person.query().upsertGraph({
  id: 1,
  name: 'Jennifer',
  pets: [{
    id: 1,
    name: 'Fluffy',
    species: 'dog'
  }]
}, { relate: true, unrelate: true });
```

**4. Query Context**

With the `.context()` method, you can add a context to your queries, which can be accessed in all query lifecycle methods. This can be highly useful for passing request-specific data, such as the currently logged in user's ID.

```javascript
Person.query()
  .context({userId: 1})
  .findById(1)
  .then(person => {
    // The context is accessible in person.$beforeInsert, person.$beforeUpdate etc.
  });
```

Objection.js is a powerful ORM with a host of features that can help developers write efficient, maintainable, and performant SQL-based applications in Node.js. Mastering its advanced features allows for even more refined control and optimization, which will truly help you stand out as a Node.js developer.
Seeking Developer Experts with Stripe/Bolt
Tags: stripe, bolt, oneclick, checkout
Published: 2023-06-08 23:09:28

Looking to hire developers short-term to better understand how easy/hard it is to implement Stripe and Bolt's one-click/accelerated check-out feature with their online storefront. 35 minute fully confidential phone interview for a $200 Amazon/PayPal incentive which can be paid in advance. If interested, please respond here or to john@pointviewresearch.com
Starting frontend web development
Tags: webdev, beginners, codenewbie, github
Published: 2023-06-08 22:47:05

Hi all, hope you are all well. I am starting my journey into web development with a frontend web development bootcamp. I am doing some prework and i am getting through it but it feels as though there is so much to learn. What i am specifically interested but feel overwhelmed with is GitHub and Virtual studio code. Any advice or perhaps links to articles or youtubers or even courses online that can help breakdown understanding GitHub and Virtual studio code? I was able to create my first repository and able to establish a connection from my browser GitHub to my local desktop GitHub. It felt really good when achieved but at the same time i wondered how i even was able to get there and do it.
EJable.com - Japan and Japanese-centric global job board
Tags: jobs, recruiting, recruitment, japan
Published: 2023-06-08 22:03:50

EJable-com is a Japanese-centric global job portal that connects employers with English-speaking tech (information technology) talent looking for a job in Japan and employers worldwide looking for Japanese-speaking candidates in their respective countries. 

We also bring rich and exclusive educational content related to life in Japan and niche content about Information Technology. Our website's continuously expanding educational resources are our commitment to the people interested in Japan or the Japanese language. While we are always there to help with jobs and career searches, we are also committed to upskilling, education, and training for career growth.

[https://www.ejable.com](https://www.ejable.com)
Leave Redux for a few moment and Try GX 😍😍
Tags: react, reactnative, redux, state
Published: 2023-06-08 21:54:46

## What's GX ?

**GX** is Javascript library used to manage global state within a **React** and **React Native** applications like Redux and other do.

It's a Lightweight, very Performant and Easy to use library for managing state 😍.

## More about GX.

**GX** is my library that I released on febuary (the first version) and I'm so happy for that archievement. I used it now in all my personal projects and it's well integrated into React environment (React Native, NextJs). With less configuration you can state working 😁😁

## How it works ?

Well, there is some concepts that you have to know to be able to use this library.

### Signal 

A signal is just a particular state that can contains one resources such as products, users, current user and so on. So If you want to create a global state to save for example a list of products, you have to create a signal.

**Example**

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

In this example I create a signal to save a counter value, that can be incremented and decremented by calling actions which are defined in the actions property of the object parameter of the **createSignal** function.

### Store

A store is the place where you have to register all your signal in order to make them available from anywhere in your application.

**Example**


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

### Set the Provider

GX comes with a provider which is used to make the store accessible from anywhere in your application.

**Example**

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

### Usage

Now, as the library is correctly set up, we can now consume our state (the counter value) and act to it by incrementing or decrementing its value.

**Example** 

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

So easy to use 🤩🤩

## Next step

You can learn more by visiting the website documentation of the npm readme.

Documentation: https://gx.dilane3.com
NPM Readme: https://www.npmjs.com/package/@dilane3/gx 

The project is open source, so that you can suggest your impovement and make the libray grow with time 😊😊

Github Repo: https://github.com/react-gx/gx
Bringing Buddha into leadership
Tags: leadership
Published: 2023-06-08 21:34:05

Leadership in tech isn't just about being the best coder in the room; it's also about creating an environment that encourages growth, promotes understanding, and fosters collaboration. How we lead impacts our team's performance, job satisfaction, and even our company's bottom line. That's why I believe it's important to continuously broaden our perspectives on leadership.

In light of this, I wanted to share an article I recently published that explores a thought-provoking approach to leadership: [Bringing Buddha into Leadership](https://greg.nokes.name/2023/06/01/bringing-buddha-into-leadership/).

In this piece, I delve into the principles of Buddhism and how they can be applied to leadership, especially in tech. The article discusses mindfulness, empathy, and compassion —qualities inherent in Buddhism and vital for effective leadership.

The goal isn't to turn everyone into a Buddhist, but rather to open up new avenues for thought and discussion about how we can enhance our leadership skills. And while we typically don't associate ancient Eastern philosophies with modern tech workplaces, you may be surprised to see just how relevant and beneficial these principles can be.

I hope this exploration can serve as a starting point for a broader conversation on what effective, compassionate leadership looks like in our industry. I'd love to hear your thoughts, experiences, and ideas on this topic.

Let's build more than just software; let's build better environments, better teams, and better leaders!
What it feels like to do programming as a human?
Published: 2023-06-08 21:19:15

When I wasn't working and doing programming as a hobby things were fun. Ever since I started working as a programmer, things changed. 
Do you feel the same?

I don't feel the level of joy, carelessness and creativity I used to feel when I wasn't chained by requirements.

Things were complex but joyful. My finished projects were experienced by my family and friends. I used to sleep just so I can wake up and do it all over again. 

Well when I started working, my projects actually became meaningful. They are helping solve problems. I don't feel the same joy but if my project helps anybody, that's worth the price. 

**If you are losing interest.** Remember, you have a choice. You can move on or stick with it. And you know the best part? Both of your decisions whether it is moving on or continuing will be a good decision.

**If money is a problem,** learn to invest in a way where you can generate passive income. Read "Rich dad poor dad" book by Robert Kiyousaki. Make passive income cover all your basic expenses and you have a lifestyle where you can be careless again. Where you can work on projects you love. It is not easy but it is a method using which your family will be safe from blunders you want to make regarding changing careers and dropping your income to zero suddenly. It is hope. I am not promising happiness, happiness is not the emotion one would want their whole life but peace is. Financial peace is what I can promise with the method I discussed above which is Creating passive income through investing in safe areas like banks, mutual funds, etc. It is the beginning, don't go for shortcuts. And sky is the limit. 

**Programming will give you financial peace,** but financial peace is one part of one's life. Religion, Relationships with friends, family, loved ones and yourself, exploration of one's self and world is another kind of peace you will have to work for later in life. 

**Don't run after peace.** Peace can run faster than you. However peace want attention, so give that to peace and peace will sit with you and will become yours. 

**Don't you think we have answer to all our problems.** We know what we should do. If you don't get to do what you want, change it!, if you can get to do what you want to do, take action. If you are unclear, make a plan, sit in silence, think and keep thinking so you are clear about what you want. 

If this helps, share your thoughts in the comments.
Digital Clock apps
Published: 2023-06-08 21:11:06

I enjoy writing small Digital clock applications using several different tool creation languages; I've created digital clocks in Python, TCL/Tk, Perl, yad, and bash scripts.  A friend of mine wrote two other variations in a couple of small programs written in the C programming languages.

Do any of you here ever write small, simple tools, such as Digital Clocks, small weather report scripts, etc?  It just happens to be a small hobby that this retired software engineer enjoys to exercise the mind and do something useful, quick, and simple.
Let's -  #discuss #Perl #Yad
Difference between Readonly and Const in TypeScript
Tags: typescript, programming
Published: 2023-06-08 21:10:49

If you work with TypeScript or have already worked, it's likely that at some point you have asked yourself which would be the difference between Readonly or Const. Well, this article will answer that question. Let's go!

In TypeScript, const and readonly are used to indicate that a value shouldn’t be changed, but they are applied in different ways.

The const keyword is used to declare a constant that has an immutable value. This means that once a value is assigned to a constant using const, it can't be changed later, and that value must be assigned at the time of constant declaration.

In the example below, PI is declared as a constant and assigned the value 3.14. Any further attempts to assign a new value to PI will result in a compilation error


![Code example](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/z57fhjhcf9czmvh0ui59.png)

On the other hand, the readonly keyword is used to declare properties on a class or object that can only be read but not changed outside the scope in which they are defined. In other words, the property can still have its value changed as long as this change occurs within the scope of the class or object. See an example:


![Class Person in TypeScript](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/4krthp9t1c7bqi1pbf06.png)

In the example above, the arn property of the Person class is declared as readonly with a value already assigned. However, in the constructor of the class, this property could still be changed. Now, if there is an attempt to change this value outside the scope of the Person class, TypeScript will raise an error.

In short, const is used to declare constants at declaration time with immutable values, while readonly is used to declare properties of objects or classes that can only be read outside the scope where they were declared.

Well, that's it! See you guys! 👋👨‍💻
Kubernetes Admission Controller written in Kotlin with Quarkus (demo)
Tags: quarkus, kotlin, kubernetes
Published: 2023-06-08 20:53:39

Normally, most of additional logic in Kubernetes is written in GO. But since I am a big fan of Kotlin, I wanted to do something in Kotlin. In addition - with respect to my professional work - it should also be written with Quarkus. After all, everything in Kuberntes is REST. And frameworks like Qurakus or Spring make it fairly easy to write REST services.

So, I thought writing a simple [admission controller](https://kubernetes.io/docs/reference/access-authn-authz/extensible-admission-controllers/) would be a great challenge. During my research, I came across an older project, already 5 years old and written in GO. Anyway, it demonstrated quite well how to write a simple admission controller in GO.

TLDR; I created a simple Quarkus/Kotlin project and finally got a working admission controller. If you are curious, check out my [repository](https://github.com/Jeansen/lp39a). The README will explain how to configure, build and deploy the project.

But be warned. This is some advanced topic! You should feel comfortable with the Kubernetes API and have a Kubernetes cluster and an image registry (e.g. Harbor) at hand.

I hope my project will help you understand Kubernetes and how to program against it. This project is as fresh as this post. Ist a first draft. And I though it is worth sharing. As you know: Release early, release often ;-)

I will continue to work on it. For instance, my next task will be to make it run as a Quarkus Native service.
Aprendendo Git Branching - Módulo Movendo trabalho por aí
Tags: git
Published: 2023-06-08 20:33:16

---
title: Aprendendo Git Branching - Módulo Movendo trabalho por aí
published: true
description: Série de posts sobre o site/aplicativo Aprendendo Git Branching. Aqui vou postar os comandos que aprendi e o que entendi de cada um.
tags: git
series: Learning Git Branching
---
**WIP**: A descrição e explicação dos comandos está sendo postada [aqui](https://dev.to/epochchrono/aprendendo-git-branching-comandos-24d2) conforme o avanço.

## levels
### Main
#### Módulo: Movendo trabalho por aí
##### 1: Introdução ao `cherry-pick`
###### Dificuldade (pra mim!): fácil
- O próximo conceito que vamos abordar é "movendo trabalho por aí" -- em outras palavras, veremos as formas como o desenvolvedor pode dizer "eu quero este trabalho aqui, e aquele ali" de formas precisas, eloquentes e flexíveis.
- O primeiro comando desta série é o git `cherry-pick`. Ele é chamado da seguinte forma:

> `git cherry-pick <Commit1> <Commit2> <...>`

- Trata-se de uma forma bastante direta de dizer que você gostaria de copiar uma série de commits abaixo do seu local atual (HEAD).

##### 2: Introdução ao rebase interativo
###### Dificuldade (pra mim!):
- O cherry-pick é ótimo quando você sabe de antemão quais commits você quer (e você sabe os hashes correspondentes) -- é difícil bater a simplicidade que ele oferece.
- Mas e quando você não sabe quais commits você quer? Felizmente o git pode te ajudar nesta situação também! Podemos usar o rebase interativo para isso -- trata-se da melhor forma de rever uma série de commits sobre os quais você está prestes a fazer um rebase.
- O rebase interativo é simplesmente o comando rebase com a opção `-i`.
- Se você incluir essa opção, o git abrirá uma interface para mostrar quais commits estão prestes a serem copiados abaixo do alvo do rebase. Ele também mostra os hashes e as mensagens dos commits, o que é ótimo para ter noção do que é o que.
- No git "de verdade", a interface nada mais é que um arquivo aberto em um editor de texto (por exemplo o vim).
- Quando a janela de rebase interativo abrir, você pode fazer 3 coisas diferentes:
  - Você pode reordenar os commits simplesmente mudando sua ordem na interface (na nossa janela isso significa arrastar e soltar com o mouse).
  - Você pode escolher simplesmente omitir alguns commits. Para isso, clique no botão pick -- deixar o pick desligado significa que você quer descartar o commit.
  - Por fim, você pode "esmagar" (fazer squash) nos commits.
List Comprehension in Python
Published: 2023-06-08 20:31:05

## What is List Comprehension:

List comprehension is a syntactic construct in Python that allows you to create new lists by iterating over existing iterables, applying conditions, and performing transformations in a single line of code. It combines the functionality of a for loop, conditional statements, and expressions into a compact and expressive form.

## List Comprehension Syntax:

```
new_list = [expression for item in iterable if item condition]
```

- new_list: The resulting list that will be created based on the comprehension.

- expression: The expression or operation applied to each item.

- item: The variable representing each item in the iterable.

- iterable: The existing iterable (e.g., list, tuple, string) that is being iterated over.

- condition (optional): A condition that filters items based on a given criteria.

Examples:

1. Squaring numbers using list comprehension:


Input:
```
numbers = [1, 2, 3, 4, 5]
squared = [x ** 2 for x in numbers]
print(squared)
```

Output:

```
[1, 4, 9, 16, 25]
```

2. Filtering out odd numbers using list comprehension:

Input:

```
numbers = [1, 2, 3, 4, 5]
even_numbers = [x for x in numbers if x % 2 == 0]
print(even_numbers)

```

Output:

```
[2, 4]
```

## Benefits of List Comprehension:

- Concise and readable code: List comprehension condenses multiple lines of code into a single line, making it easier to read and understand.

- Efficiency: List comprehension is often faster than traditional loops since it takes advantage of Python's underlying optimizations.

- Reduces code duplication: By performing operations in a single line, list comprehension reduces the need for temporary variables and repetitive code.

## Conclusion:

List comprehension is a powerful feature in Python that allows you to create new lists based on existing iterables, apply conditions, and perform transformations in a concise and readable manner. It offers a compact syntax that simplifies your code and improves efficiency. By mastering list comprehension, you can write cleaner and more expressive Python code.
Node JS : The Ultimate Resource to Beginners
Tags: node, javascript, npm, webdev
Published: 2023-06-08 20:18:18

This blog is about the Node.js platform, a popular choice for building scalable and reliable web applications. It covers a wide range of topics, including:

- Getting started with Node.js
- Building web applications with Node.js
- Using Node.js for Microservices
- Securing Node.js applications
- Optimizing Node.js performance
- Deploying Node.js applications


## Installation

- Go to <u>https://nodejs.org/en</u>.
- Download the LTS version.
- Accept all terms and install.
- Now Check whether the node is installed in your computer or not by typing <u>node--version</u> on the hyper terminal.

## Run a JS File by node

- Open the VS Code terminal.
- Type the <u>node--version</u> to get the node version and also check the installation of the node.
- Go to the directory where the JS file is stored using <u>cd "address of js file"</u>.
- Now type <u>node yourfilename.js</u> (for eg: node index.js) and hit enter.

## React Native Modules

```
const fs = require("fs")//file system

//For writing some text in a text file named message.txt using fs writefile module
fs.writeFile("message.txt","Hello, World!",(err)=>{
if (err) throw err;
console.log("The file has been saved");
});

//For reading some text from a text file named msg.txt using fs readfile module
fs.readFile("./msg.txt","utf8",(err,data)=>{
if (err) throw err;
console.log(data);
});
```

## NPM Package Manager

Let we have to generate a random superhero name using the node then the following steps are involved for generating the superhero name.

- Open the VS Code terminal.
- Initialise npm using <u>npm init</u>.
- Install npm pacakges using <u>npm i superheroes</u>.
- Open the <u>package.json</u> file and type in the file <u>Type: "module"</u>.
- Now open the js file and type the following code.

 

```
 import superheroes from "superheroes";

  const name = superheroes.random();

  console.log(name);
```
Orientation needed! for e-commerce platform creation
Published: 2023-06-08 20:06:46

Orientation needed! (and much appreciated) I'm learning web development and I would like to know how to create an e-commerce platform on my own for my project.  For context, I know how to code in JS, SQL and Python, use HTML, CSS and Bootstrap framework. I was introduced to Flask in Harvard's CS50 course (this project will serve as my final project for the course), but I'm open to learning whatever tools I need.  I know really much of nothing about building the e-commerce capability in my website, so any orientation is very welcome (perhaps it's actually overwhelmingly complicated and it's better to just use Wix or something... perhaps you'd just like to point me towards useful resources to learn this stuff.. any help is more than welcome)