teleren/devto huggingface dataset:
PostgreSQL Index Types
Tags: postgres, database
Published: 2023-02-27 12:45:08


**Postgres Index:**

Indexes are their own data structures and they’re part of the Postgres data definition language (the DDL). They're stored on disk along with data tables and other objects.

There are five types of PostgreSQL indexes, which are also called methods, because they define the way each particular index handles its task. They also determine the syntax specifics. These five types are as follows:

1. **B-tree indexes** are the most common type of index and would be the default if you create an index and don’t specify the type. B-tree indexes are great for general purpose indexing on information you frequently query.
B-Tree is the default index type for the CREATE INDEX command in PostgreSQL. It is compatible with all data types, and it can be used, for instance, to retrieve NULL values and work with caching. B-Tree is the most common index type, suitable for most cases.

2. **BRIN indexes** are block range indexes, specially targeted at very large datasets where the data you’re searching is in blocks, like timestamps and date ranges. They are known to be very performant and space efficient.
BRIN (Block Range Index) applies to large tables where specific columns have a natural correlation with their physical location in the table. A block range is a group of pages that are physically adjacent in the table; BRIN indexes store summary information—page number along with minimum and maximum values—for each block range.

3. **GIST indexes** build a search tree inside your database and are most often used for spatial databases and full-text search use cases.
The GiST (Generalized Search Tree) index allows using the tree structure to index schemes for new data types—for instance, geometric data types and network address data. GiST is also useful if you have queries that are not indexable with B-Tree. It is applicable for full-text search as well.

4. **GIN indexes** are useful when you have multiple values in a single column which is very common when you’re storing array or json data.
GIN (Generalized Inverted Index) is suitable for mapping multiple values to one row. The most common case for applying the GIN index comprises operations with data types such as arrays, range types, JSON, and also for full-text search. Note that the GIN index will be slower for INSERT and UPDATE operations

5. **Hash** is a specific index type applied only if the equality condition = is being used in the query. It is called hash because it stores a 32-bit hash code derived from the indexed column value. Hash indexes are rarely used in PostgreSQL because it is necessary to rebuild them manually after crashes, and they can cause issues during transactions.


Want to extract all the benefits of PostgreSQL along with Graph features look at:

[Apache AGE](https://age.apache.org/)
[Apache AGE Github](https://github.com/apache/age)
Passing by Assignment, References, Shallow and Deep Copy - Python
Published: 2023-02-27 12:39:12

## Passing by Assignment

In Python, the concept of pass-by-value and pass-by-reference in functions does not exist. Instead, Python implements pass by assignment. This means that neither the values nor the names associated with them are transferred. Rather, every value is associated with the parameter through an assignment.

```python
def find_lowest(numbers):
    numbers.sort()
    return numbers[0]

nums = [3, 7, 2, 4, 0, 9]
print(nums) # prints [3, 7, 2, 4, 0, 9]
print(find_lowest(nums)) # prints 0
print(nums) # prints [0, 2, 3, 4, 7, 9]
```

## References

In lists and collections, each item is a reference. Similar to how a name is associated with a value, items within collections are associated with values through references. This association is known as reference binding.

Let us look at the references with an example and how it works.

```python
# tic-tac-toe board matrix
board = [["-"] * 3] * 3
for i in board:
    print(*i) # prints 3 X 3 matrix with hyphen.

# make an X mark in the center 
board[1][1] = "X"
for i in board:
    print(*i)

#Above print prints the below
# - X -
# - X -
# - X -
```

In the above code the default expectation is to change only the index [1][1] to "X" but, all the rows with index 1 become "X". This is because all three lists are aliases for a single list. To get the normally expected tic-tac-toe board where every list is not aliased below list comprehension can be used.

```python
board = [["-"] * 3 for _ in range(3)]
```

When the value of any index is changed in the board, it does not affect other values as in the previous example.

## Shallow copy and Deep copy

A shallow copy creates a new object and copies the references to the original object's elements. It means that if the original object contains mutable objects, both the original and the copied objects will refer to the same mutable objects in memory.

A deep copy creates a new object and recursively copies the contents of the original object and all of its nested objects. In other words, a deep copy creates a new copy of the objects within the original object.

```python
# shallow copy

original_list = [1, 2, [3, 4]]
new_list = list(original_list)
new_list[2].append(5)
print(original_list)  # prints [1, 2, [3, 4, 5]]
print(new_list)       # prints [1, 2, [3, 4, 5]]

# deep copy

original_list = [1, 2, [3, 4]]
new_list = copy.deepcopy(original_list)
new_list[2].append(5)
print(original_list)  # prints [1, 2, [3, 4]]
print(new_list)       # prints [1, 2, [3, 4, 5]]
```

Copying is the most common way to solve the problem of passing around mutable objects in python in functions. Using id to check if the values have been modified does not work in python as shown below example.

```python
a = [1, 2, 3]
b = [4, 5, 6]
c = (a, b)
print(id(c)) # prints id of tuple c
a.append(0)
print(c) # prints ([1, 2, 3, 0], [4, 5, 6])
print(id(c))# prints the same id as before for c as c has only reference of a and b as its value.
```
CodeSmash - Get Ready to Sign Up!
Tags: nocode, dev, devops, webdev
Published: 2023-02-27 12:36:15

Hey guys, we're back with another video!  👋😃

https://youtu.be/Vnl8lCySi60

This time, we're letting you know more about our No Code platform CodeSmash and  that we have a roadmap for what's next. Make sure to keeps checking up on our progress because we will soon add the following features:

- Create your account
- Save your Stacks for later
- Store your Stacks in Git repos by default

Wanna try it out in the playground? Go here 👉 https://codesmash.studio/schema
First Experience With Next.js - part 1
Tags: react, nextjs, javascript
Published: 2023-02-27 12:35:47

I am trying out Next.js with React and here is my experience.

## Introduction
Let's start by saying that I didn't know anything about Next.js.

The documentation is very nice and it starts with a good [introduction](https://nextjs.org/learn/foundations/about-nextjs/what-is-nextjs) that explains well where Next.js is positioned.

> Next.js is a React framework that gives you building blocks to create web applications.

These building blocks include stuff like data fetching and routing that you would need to otherwise import in React.

The FOUNDATIONS part of the documentation is a pleasant read that walks you through some basic but important concepts of web development.

## From JavaScript to React 
Here is a quick summary of what you can get in the section [From JavaScript to React](https://nextjs.org/learn/foundations/from-javascript-to-react)

### Fundamentals of web development
- What is the DOM? An object representation of the HTML elements. 
- Imperative vs Declarative Programming - Step-by-step instructions on how to make a pizza vs just ordering a pizza.
- What is JSX? A syntax extension for JavaScript.
- What's Babel? An interpreter to compile JSX into JavaScript so browsers can understand the code.

### Fundamentals of JavaScript
- Important [JavaScript concepts](https://nextjs.org/learn/foundations/from-javascript-to-react/essential-javascript-react) you should know.

### Fundamentals of React
**- React Core Concepts 1: Components.** Components are small building blocks of code. In React, components are functions that return UI elements. Use React components in JSX by writing the capitalized component name inside tags. You can nest components into each other.

**- React Core Concepts 2: Props.** Props (e.g. properties) allow you to pass pieces of information as properties to React components. Think of props as passing a string to the `src` attribute of an `img` element in HTML.

**- React Core Concepts 3: State.** State is "any information in your UI that changes over time". React uses functions called hooks to manipulate the state and make some other operations.

More info on [learning React](https://nextjs.org/learn/foundations/from-javascript-to-react/continue-learning-react).

List of resources to learn React:
{% embed https://dev.to/lorenzojkrl/best-free-react-resources-49nk %}

In the next few days, I will go through From React to Next.js, but for the moment, this is it!

## My Two Cents
- Best documentation I have seen so far, have a look!
- I loved the quick quizzes in the documentation
- While the introduction is great, it doesn't substitute learning JavaScript and React (which are warmly suggested).

{% embed https://dev.to/this-is-learning/first-experience-with-nextjs-part-2-pi4 %}

Or, if you want to start building, go to

{% embed https://dev.to/this-is-learning/building-with-nextjs-part-3-1d7k %}
netstat
Tags: beginners, linux, sbwriteups, tutorial
Published: 2023-02-27 12:35:00

## netstat ##

Netstat is another powerful utility that is used to display network statistics about network connections, routing tables, and interfaces.

This is pretty useful in multiple scenarios, let's say for troubleshooting network issues (for example, port or connection issues) or to monitor network traffic and to detect malicious activity.

The syntax of the netstat command is as follows: netstat [options] [filter] [address]. Here, options can be used to specify certain parameters, such as which protocol to use, which ports to show, and which connection states to display. The filter parameter is used to filter the output based on specific criteria, such as the source or destination IP address. The address parameter is used to specify an IP address or port.

- To display all the active network connections:
```
$ netstat -a
```

- To display all the listening ports:
```
$ netstat -l
```

- To display all TCP ports:
```
$ netstat -at 
```

- To display all UDP ports:
```
$ netstat -au 
```

- To display kernal IP routing table: 
- PS: The kernel IP routing table, is also known as the IP routing table, which contains information about the network topology and routing paths on a Linux system.
```
$ netstat -r
```

- To display the interface table:
```
$ netstat -i
```

- To find a process that is using a particular port, in below example we are using `|` to fed the output of netstat to grep to filter out the results.
- -n is to get the IP addresses/numeric values (instead of domain names).
```
$ netstat -an | grep <PORT_NUMBER>
```

It is pretty powerful, feel free to check its capabilities via `man netstat`
Breaking Words Apart: Exploring Hyphenation Theory and Practice
Published: 2023-02-27 12:23:18

---
title: Breaking Words Apart: Exploring Hyphenation Theory and Practice
published: true
description: In this video, we'll explore the fascinating world of hyphenation. Hyphenation is the process of breaking words into syllables and adding hyphens to indicate where a word should be divided at the end of a line. It's an important aspect of typesetting, as it helps to improve the readability and aesthetics of printed text. Research by Frank Liang provided a powerful framework for generating hyphenation rules for a wide range of languages.
tags:
cover_image: https://i.ytimg.com/vi/XxV6bhCZHn0/maxresdefault.jpg
---

{% youtube XxV6bhCZHn0 %}

In this video, we'll explore the fascinating world of hyphenation. Hyphenation is the process of breaking words into syllables and adding hyphens to indicate where a word should be divided at the end of a line. It's an important aspect of typesetting, as it helps to improve the readability and aesthetics of printed text. Research by Frank Liang provided a powerful framework for generating hyphenation rules for a wide range of languages.
[DEV: PHP] Writing code for payout in cryptocurrencies
Tags: php, beginners, tutorial, webdev
Published: 2023-02-27 12:19:33

Banner networks, gambling, options, trading, monthly payroll, and referral networks often use the same payout strategy for their customers: 
collect requests from customers 
the security department reviews the list and approves it 
a periodic payment is made 

To do this, we have a convenient [masspayment tool](https://apirone.com/docs/wallet/#transfer) for up to 255 recipients in one transaction. In the case of a larger number of recipients, there will be split in several transactions. 
Attention! you pay a **fixed commission** only once in each transaction, which is very convenient and more cost-efficient than making 255 transactions and paying a commission on each. 

Test wallet: tbtc-bde1cfc70297e4ff7068334b25986819 
Test Transfer_key: hyl1aQkd5vwdzT1uExgUCOXOcekUg4Yc 

![Mass payment with fixed fee](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/js62dlqbk5dnn6cxzzjt.png)

Code example: 

```
<?php
  $WalletID = "tbtc-bde1cfc70297e4ff7068334b25986819";
  
  $json_data = '{"transfer_key": "hyl1aQkd5vwdzT1uExgUCOXOcekUg4Yc"}' .
  array ( 
    'destinations' => array (        
        array('address' => "2N4obeEuEidHmuXLCLvWeA4tH9FhB8W8EyD", 'amount' => "100000"),
        array('address' => "2N1SRgR6Tj4LTxsMiTfM95yHSrBSQTkfvco", 'amount' => "750000")
    )
  );
  
  $api_base = file_get_contents("https://apirone.com/api/v2/wallets/" .
              $WalletID . "/transfer");
 
  $curl = curl_init($api_base);
  curl_setopt($curl, CURLOPT_HTTPHEADER, array("Content-Type: application/json"));
  curl_setopt($curl, CURLOPT_POST, 1);
  curl_setopt($curl, CURLOPT_POSTFIELDS, json_encode($json_data));
  curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
  $http_status_code = curl_getinfo($curl, CURLINFO_HTTP_CODE);
  $response = curl_exec($curl);
  curl_close($curl);

  $decoded = json_decode($response, true);
  echo "Transaction hash: " . $decoded["txs"]["0"];
?>
```

Where 'destinations' is an array of recipient addresses and amounts. The amount is indicated in minor units, e. g. for bitcoin it is satoshi. 
Also, you can specify the amount as a percentage of the total wallet balance. 
For example:

```
  'destinations' => array (        
        array('address' => "2N4obeEuEidHmuXLCLvWeA4tH9FhB8W8EyD", 'amount' => "52.57%"),
        array('address' => "2N1SRgR6Tj4LTxsMiTfM95yHSrBSQTkfvco", 'amount' => "47.43%")
    )
```
By default, the network fee is current, but you can choose a higher one to make the transaction be confirmed sooner. 

As a result of execution, you receive a transaction or a list of transactions, a copy of the array of recipients, amounts, and an address of change if there is any. More details about the parameters can be found at [apirone.com](https://apirone.com/docs/wallet/#response-example-9)
How to trigger tab (InputText) in Microsoft Power Apps
Tags: powerapps, powerfuldevs, lowcode
Published: 2023-02-27 12:12:48

I've recently faced a couple of issues while developing with Power Apps, I haven't been able to find solutions to them on the internet (the closest workaround I've found is to add a `timer` with a `timeEnd` which seemed a bit odd to me) so I've developed my own solution, but let's explain the issues first:

## Problem 1:

1. In a formatted text field.
1. you add a value (let's say `1000`).
1. The `onChange` event is triggered.
1. The field is formatted to `1,000.00`.
1. The formatted value gets injected to the field.
1. Edit the input field adding `1000` again.
1. The `onChange` event doesn't trigger because it considers it "the same".

## Problem 2:

1. When you press tab in input field and go to another input field
1. The onSelect is not activated because you have to "Click"

## SOLUTION:

We need to create two text inputs and one button like that:

**InputText 1:**

1. Create an input text (inputText1)
2. `onChange`:
   ```cs
   Set(ChangeNumberVar;
       Text(
           Value(TextInput1.Text);"#,###.00";"ca-ES"
       )
   );;
   Select(Button1)
   ```
(nextStep) 3. `Default`:

   ```cs
   ChangeNumberVar
   ```

(nextStep) 4. `tabIndex`: 1

**InputText 2:**

1. Create another input text (inputText2)
2. tabIndex:3

**Button1:**

1. Create a button (button1)
2. `tabIndex`:2
3. `Visible`: false
4. `onSelect`:

   ```cs
   Reset(TextInput1);;
   SetFocus(TextInput2)
   ```
![Image at the end of creating the solution](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ccmtz7415weje7tj7cfp.png)

Now you can switch from `inputText1` to `inputText2` by triggering the `OnSelect` trigger using the tab key.

### Side Notes:

The main language on my environment is spanish. If the provided solution doesn't work for you, please leave a comment and we can take a look at your specific use-case 😁

Best regards!
Laravel useful DB/Eloquent functions:
Tags: laravel, eloquent, mysql, db
Published: 2023-02-27 12:06:57

Getting raw sql's from eloquent query.

```php
DB::enableQueryLog();
$spam_events = SpamEvent::where('user_id', $user_id)->pluck('event_id');

$users = User::all();
dd(DB::getQueryLog());
```
`Raw SQL's will be shown`

More methods will be updated soon.
How to add bootstrap in Rails 7
Tags: ruby, rails, webdev, design
Published: 2023-02-27 12:01:18


## How to add bootstrap in rails 7

Bootstrap is a popular CSS framework that can help you quickly design and style your Rails 7 application.

![Created By [Author](https://rutikkpatel.medium.com/) ( [Rutik Patel](https://rutikkpatel.medium.com/) )](https://cdn-images-1.medium.com/max/2560/1*RV28m7INvwZqW83Xn0J-pA.png)

Here are the steps to add Bootstrap to your **Rails 7** project:

&nbsp;
Add the **bootstrap** and **jquery-rails gems** to your Gemfile:

```ruby
gem 'bootstrap', '~> 5.1'
gem 'jquery-rails', '~> 4.4'
```

Run `bundle install` to install the new gems.

&nbsp;
Import the Bootstrap and jQuery CSS and JavaScript files in your application.scss and application.js files, respectively. To do this, add the following lines to your **app/assets/stylesheets/application.scss file:**

```ruby
@import "bootstrap";
```

&nbsp;
And add the following line to your **app/assets/javascripts/application.js file**:

```ruby
//= require jquery3
//= require popper
//= require bootstrap
```

Restart your Rails server to ensure that the new assets are loaded.

&nbsp;
Verify that Bootstrap is working by adding some sample Bootstrap code to your application layout file.

**app/views/layouts/application.html.erb**

```html
<!DOCTYPE html>
<html>
  <head>
    <title>BootstrapRails7</title>
    <meta name="viewport" content="width=device-width,initial-scale=1">
    <%= csrf_meta_tags %>
    <%= csp_meta_tag %>
    <%= stylesheet_link_tag "application", "data-turbo-track": "reload" %>
    <%= javascript_importmap_tags %>
  </head>
  <body>
    <nav class="navbar navbar-expand-lg bg-body-tertiary bg-warning">
      <div class="container-fluid">
        <a class="navbar-brand" href="#">Navbar</a>
        <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
          <span class="navbar-toggler-icon"></span>
        </button>
        <div class="collapse navbar-collapse" id="navbarNav">
          <ul class="navbar-nav">
            <li class="nav-item">
              <a class="nav-link active" aria-current="page" href="#">Home</a>
            </li>
            <li class="nav-item">
              <a class="nav-link" href="#">Features</a>
            </li>
            <li class="nav-item">
              <a class="nav-link" href="#">Pricing</a>
            </li>
            <li class="nav-item">
              <a class="nav-link disabled">Disabled</a>
            </li>
          </ul>
        </div>
      </div>
    </nav>
    <div class="container">
      <%= yield %>
    </div>
  </body>
</html>
```

This code will create a basic Bootstrap **navbar** and **container** for your application.

&nbsp;
Restart your Rails server again and visit your application in a web browser. You should see the Bootstrap navbar and container at the top of your page.

&nbsp;
**Congratulations🎉** , you have now added **Bootstrap to your Rails 7 project**! You can now use Bootstrap’s classes and components to style your views and make your application look great.
S'Monday 😪 Alan Kay
Tags: beginners, codenewbie, discuss, motivation
Published: 2023-02-27 12:00:00

From the Sunday scaries to the Monday...ughs, it can be hard to start the week off in in a good state of mind. So, if you're looking for a little motivation to tackle the week ahead, we gotchu. 

From programming wisdom to career advice, we've compiled a collection of quotes that will make you think, make you laugh, maybe make you roll your eyes. 

This week's quote is from Alan Kay, sometimes referred to as the father of personal computers:

> The best way to predict the future is to invent it.



Share your quotes, inspirational memes, words of wisdom, or anything else to help us brave the day!
High Paying Jobs in India
Tags: job, highpayin, programming
Published: 2023-02-27 11:46:42

It is undoubtedly true that everyone dreams of having a well-paying work. It is understandable to want a career that pays what you deserve after spending so many years educating yourself. But it is by no means a simple task. Due to the worldwide pandemic, technology improvements and digital transformation have had a huge impact on every industry including employment. We have produced a list of some of the [highest paid jobs in India](https://technobrilliant.com/high-paying-jobs-in-india.php) to draw your attention to the in-demand employment we have and make things simpler for you.

While there is no lack of career options that pay well, it is important to understand that salary standard is varying across organizations and industries. Your school background, professional experience, and other factors will all affect your pay. Whether you're a fresher, middle-level worker, or senior professional, there are ample options that provide you the [high paying job in India](https://technobrilliant.com/high-paying-jobs-in-india.php) which is fit for you. We have enlisted a list of the many jobs in the beginning of this post with highest paying salary in India to watch out for in 2023. The salary package is not the only factor that should be considered when seeking one of the best jobs in India, but also you need to see the growth.
Visit for more details: https://technobrilliant.com/high-paying-jobs-in-india.php