teleren/devto huggingface dataset:
Go’s true can be false
Tags: go
Published: 2023-08-15 19:17:17

This is something that not all Go developers are probably aware of. Go allows you to do things like the following.

```go
var true = false
```

Which also means that the following code compiles and runs.

```go
package main

import "fmt"

var true = false

func main() {
  var status bool = true // This will actually be false.
  if status {
    fmt.Println("True")
  } else {
    fmt.Println("False")
  }
}
```

And it outputs `False`.

Even code like this is possible.

```go
package main

import "fmt"

var int = false // Wait, what?!?

func main() {
  var status bool = int // Really?!?
  if status {
    fmt.Println("True")
  } else {
    fmt.Println("False")
  }
}
```

So it seems that some keywords are actually not keywords in Go. I filed an [issue](https://github.com/golang/go/issues/12535) a while back and got the reply that this was `by design`. Not sure what purpose it serves. If you know, please share in the comments.

I wonder if this will be changed in `v2`, where backward compatibility could be broken.

In the meantime, this is not something to really worry about. Since all these keywords are lowercase, in practice they are private to the package so it's not possible for a dependency to mess your code up.

---

**NOTE:** This post is a more condensed version of an old post of mine.
Angular Form using ISO 20022 XML Message
Tags: angular, webdev, iso20022
Published: 2023-08-15 21:42:19


[ngx-xml-message](https://www.npmjs.com/package/ngx-xml-message)
  ![NPM](https://img.shields.io/npm/l/ngx-xml-message)
---
# ngx-xml-message

This form is used to design Angular Readonly Form using any given XML/ISO 20022 messages. The primary use of this UI library is to design ISO 20022 or MX readonly forms dynamically.

## Features

- 🔥 Automatic forms generation
- ⚡️ Supports ISO 20022 messages:
    - Support translation labels.

[LIVE DEMO](https://www.pixelbyaj.com/ngx-xml-message/)
How to generate HTML report based on PostgreSQL queries?
Tags: python, postgres, html, database
Published: 2023-08-15 21:40:01

The following Python code demonstrates how to generate HTML report based on PostgreSQL queries. 

It can be adjusted to any number of queries and customized with fonts, colors and how data is placed on the HTML page.

```
import psycopg2
import pandas as pd
import plotly.graph_objects as go
from IPython.display import HTML

db_name="postgres"
db_user="postgres"
db_port="5432"
db_host="localhost"
db_pwd="123456"

pd.set_option('colheader_justify', 'center')

html_string = '''
<html>
  <head> 
  <title>My Report</title>
  <style>
  .mystyle {{
    font-size: 10pt; 
    font-family: Verdana;
    border-collapse: collapse; 
    border: 1px solid silver;
  }}

  .mystyle td, th {{
    padding: 5px;
  }}

  .mystyle tr:nth-child(even) {{
    background: #E0E0E0;
  }}

  .mystyle tr:hover {{
    background: silver;
    cursor: pointer;
  }}
  </style>
  </head>
  <body>
    <h4>Output #1</h4>
    {table_1}
    <h4>Output #2</h4>
    {table_2}
    <h4>Output #3</h4>
    {table_3}
  </body>
</html>
'''

sql_1="""
SELECT datname "DB Name", clock_timestamp()-query_start "RunTime", query "The Query"
from pg_stat_activity 
order by 2
limit 25;
"""

sql_2="""
SELECT datname "DB_Name"
from pg_database
order by 1
limit 25;
"""

sql_3="""
select state "State", count(1) "Number of Connections"
from pg_stat_activity
group by 1
order by 2 desc;
"""

con=psycopg2.connect(database=db_name, user=db_user, password=db_pwd, host=db_host, port=db_port)

df_1 = pd.read_sql_query(sql_1,con)
df_2 = pd.read_sql_query(sql_2,con)
df_3 = pd.read_sql_query(sql_3,con)

with open('myhtml2.html', 'w') as f:
     f.write(html_string.format(table_1=df_1.to_html(classes='mystyle'), table_2=df_2.to_html(classes='mystyle'), table_3=df_3.to_html(classes='mystyle')))

f.close()
con.close()

```

`ask_dima@yahoo.com`
Angular Dynamic Form Using XSD
Tags: javascript, angular, reactive, form
Published: 2023-08-15 21:37:15

[ngx-iso-form](https://www.npmjs.com/package/ngx-iso-form) angular library is used to design Angular Reactive Form using any given XSD. The primary use of this UI library is to design ISO 20022 forms dynamically.

[LIVE DEMO](https://www.pixelbyaj.com/ngx-iso-form/)

## Features

- 🔥 Automatic forms generation
- 📝 Easy to extend with custom field types
- ⚡️ Supports ISO 20022 schemas:
    - XSD - JSON Schema using XSDService nuget
    - Support all validation like required, pattern, minlength, maxlength
    - Support translation labels, errors and date formats.
React Custom Hook: useEffectOnce
Tags: webdev, javascript, programming, react
Published: 2023-08-15 21:00:00

In this article series, we embark on a journey through the realm of custom React hooks, discovering their immense potential for elevating your development projects. Our focus today is on the "useEffectOnce" hook, one of the many carefully crafted hooks available in the collection of React custom hooks.

Github: https://github.com/sergeyleschev/react-custom-hooks
```javascript
import { useEffect } from "react"

export default function useEffectOnce(cb) {
    useEffect(cb, [])
}
```
The **useEffectOnce** hook is designed to streamline the process of running effects only once when a component mounts. With just a few lines of code, you can eliminate the need to manually specify an empty dependency array ([]). Here's how it works:

By encapsulating the repetitive useEffect pattern, useEffectOnce allows you to focus on the logic within the effect function itself. This elegant solution saves you from writing boilerplate code repeatedly and helps keep your component files clean and concise.

To showcase the power of useEffectOnce, let's consider a practical example:
```javascript
import { useState } from "react"
import useEffectOnce from "./useEffectOnce"

export default function EffectOnceComponent() {
    const [count, setCount] = useState(0)
    useEffectOnce(() => alert("Hi"))
    return (
        <>
            <div>{count}</div>
            <button onClick={() => setCount(c => c + 1)}>Increment</button>
        </>
    )
}
```
In this case, when EffectOnceComponent mounts, the _useEffectOnce_ hook triggers the alert "Hi" exactly once. It frees you from manually managing the effect dependencies and ensures your effect runs efficiently.

This custom hook is incredibly versatile and can be utilized in various scenarios. Whether you need to fetch initial data, set up event listeners, or initialize third-party libraries, useEffectOnce simplifies the process and promotes cleaner code organization.

Full Version | React Custom Hooks: 
https://dev.to/sergeyleschev/supercharge-your-react-projects-with-custom-hooks-pl4
Understanding OAuth 2.0
Tags: api, oauth, sso, security
Published: 2023-08-15 20:47:07

## What is OAuth?


OAuth (Open Authorization) is an open standard for authorization that allow web apps to request access to third party systems on behalf of its users without sharing any account credentials. 

OAuth 2.0 is an authorization framework which delegates access and permissions between APIs and applications in a safe and reliable exchange and made more compatible for use by both websites and apps

It also allows for a greater variety of access tokens, like having short-lived tokens and long-lived refresh tokens.


## **Key Components of OAuth 2.0**

- Resource Owner - The user who owns the resources
- Client - The application requesting access
- Authorization Server - Issues access tokens
- Resource Server - Hosts protected resources
- Access Token - Grants access with specific scopes
- Redirect URI - After permission is granted



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



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


## BEST PRACTICES


1. Choose the Right Grant Type
2. Implement Secure Token Management
3. Consistent User Consent Mechanisms
4. Regular Security Reviews and Updates
GoLang Reverse Engineering & Hacking
Tags: reverseengineering, reverseengineer, gamehacking, go
Published: 2023-08-15 20:41:20

### GoLang Reverse Engineering

GoLang, a prominent programming language, is not just confined to development; it's widely applied in reverse engineering as well. This article provides a concise summary of some compelling posts related to GoLang reverse engineering, offering valuable insights, tools, and methods to assist software engineers in their endeavors.

#### GoLang Binaries: Practical Reverse Engineering

[How to reverse engineer Go binaries](https://guidedhacking.com/threads/how-to-reverse-engineer-go-binaries.20392/) is a must-read article for those looking to understand the intricacies of disassembling Go binaries. With practical examples and step-by-step guidance, it unfolds the mysteries of analyzing Go compiled files. This resource will equip you with techniques to examine binaries effectively, demystifying the complex structures involved.

{% embed https://youtu.be/cBdY5Y16OR4 %}

#### Golang Basic Memory Library: A User-friendly Example

For those interested in memory manipulation using GoLang, the article on [Golang Basic Memory Library](https://guidedhacking.com/threads/golang-basic-memory-library-glowhack-example.15129/) is an invaluable treasure trove. It presents a clear-cut example of implementing memory libraries using GoLang. The author's approach to detailing the process is both thorough and accessible, making it suitable for practitioners at various skill levels.

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

#### Python Hacking Tutorials: Extending the Scope

Though GoLang is a central theme, it's pertinent to explore the connections with other languages like Python. The post on [Python hacking tutorials](https://guidedhacking.com/forums/python-hacking-tutorials.515/) shows how Python can be instrumental in hacking and reverse engineering. It provides a series of tutorials that can enhance your skill set and complement your understanding of GoLang's capabilities in reverse engineering.

#### Java Game Hacking Course: Cross-platform Perspectives

Drawing a parallel to GoLang's application in reverse engineering, Java also provides extensive opportunities, particularly in game hacking. The [Java game hacking course](https://guidedhacking.com/forums/java-game-hacking-course-jgh100.553/) elucidates methods and practices specific to Java, giving you an enriched perspective. By exploring Java's approaches, one can appreciate the contrast and complement between Java and GoLang in the domain of reverse engineering.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/jyszdkm3n4imzeep7bj2.png)
🚀Simplifying Collection Management: postman-workspace-backup
Tags: javascript, testing, postman, npm
Published: 2023-08-15 20:39:46

Hey there! I'm thrilled to share with you my first NPM package ever released, a tool that's been a game-changer in my QA journey. I called it **postman-workspace-backup**, and if you're someone who's all about optimizing workflows and making things smoother, this might just be the solution you've been looking for. 


## What is postman-workspace-backup?

**postman-workspace-backup** is designed to simplify the way we run Postman collections within a CI/CD pipeline because dealing with one big collection is a lot easier. It taps into the Postman API to seamlessly download collections and save them as JSON files. But what sets it apart is its ability to combine all these collections into one single collection, organized into multiple folders. This neat trick makes it a breeze to use with the Newman CLI tool and opens doors to generating and managing reports, not to mention smooth integration with any CI/CD pipeline.


## Why Combine Collections?

Imagine having all your collections neatly organized into a single collection, divided into folders. This means you can run tests with the Newman CLI using just one command. No more juggling between different collections – everything's in one place. This makes generating reports a breeze, as Newman can work its magic on the consolidated collection. And when it comes to CI/CD integration, things get even more exciting. A single, organized collection means effortless integration and smoother automation.


## How to Get Started

Getting started with **postman-workspace-backup** is a walk in the park. Just follow these steps:

1. Ensure you have Node.js installed on your system.
2. Open your terminal and execute the following command to install the package:

   ```
   npm i -g postman-workspace-backup
   ```

3. Once it's installed, you can run it using:

   ```
   postman-workspace-backup --api-key YOUR_API_KEY --ws-id WORKSPACE_ID -c
   ```


## Links

If you're curious to dive into the code and explore how it all works, you can find the source code for **postman-workspace-backup** on [GitHub](https://github.com/aminefeidi/postman-workspace-backup). And if you're ready to jump in and give it a spin, the npm package is waiting for you at [npmjs.com](https://www.npmjs.com/package/postman-workspace-backup).


## Let's Wrap It Up

With **postman-workspace-backup**, I've managed to streamline my collection management like never before. I'm all about efficiency, and having all my collections in one place has saved me countless clicks and made integrating with Newman and Jenkins a breeze. If you're as passionate about efficient workflows as I am, I invite you to check out the package, explore the source code, and give it a whirl. Here's to smoother testing and more organized collections! 🚀
Using database functions in JPA Criteria projections
Tags: java
Published: 2023-08-15 20:39:46

JPA and Hibernate are great if you don’t step too much outside the regular mapping-tables-to-objects business, but if you want to do a bit more with your database using the Criteria API, you might find some gotchas.

For example, I was trying to map the following query to a projection, and failing:

```
SELECT
    FORMAT(timestamp, ''yyyy-DD-mm'') as day,
    COUNT(value) as count,
    value as value
FROM
    table
GROUP BY
    FORMAT(timestamp, ''yyyy-MM-dd''), value;
The java bit of the projection was like this:

Query query = cb.multiselect(
    cb.function("format", String.class, Table_.timestamp, cb.literal("yyyy-MM-dd"),
    cb.count(Table_.value),
    root. Get(Table_.value),
);
```


But, if you’re targeting MS SQL Server, executing this will trigger an exception looking like the one bellow:

```
java.lang.NullPointerException at org.hibernate.hql.internal.ast.tree.ConstructorNode.formatMissingContructorExceptionMessage(ConstructorNode.java:192)
```

Not very helpful, but what’s actually happening here is: Hibernate doesn’t know about the FORMAT function in MS SQL Server. So, the way it get to learn about the SQL syntax of a given database is through a dialect class. There are many dialects to choose from when dealing with MS SQL Server, but none has the FORMAT function registered!

How do I know? Well, I looked at the source code… really. I invite you to go ahead and do the same, they’re really simple to understand, they’re here.

So, in the end, the solution was to register the FORMAT by extending the dialect I was using, SQLServer2012Dialect, and register the function myself.

```
public class ExtendedSQLServerDialect extends SQLServer2012Dialect {
public ExtendedSQLServerDialect() {
        registerFunction("format",   new SQLFunctionTemplate( StandardBasicTypes.STRING, "FORMAT(?1, ?2)"));
    }
}
```

Use it in your application configuration, instead of the one provided Hibernate, and that should solve the problem.
Reverse Engineering Pokemon's SBIN File Format
Tags: reverseengineer, reverseengineering, fileformats
Published: 2023-08-15 20:26:01

#### Introduction to Pokemon SBIN File Format

The [Pokemon SBIN file format](https://guidedhacking.com/threads/custom-pak-file-reverse-engineering-pokemon-sbin-files.20239/) is a specialized binary file type used in various Pokemon games. Understanding this file format is essential for those interested in reverse engineering, modding, or exploring the underlying data structures in these popular games. To start with, tools play a crucial role in working with such file formats. The article [File Format Reverse Engineering Tools](https://guidedhacking.com/threads/file-format-reverse-engineering-tools.16249/) provides an extensive list of tools and techniques that can be employed to dissect the Pokemon SBIN file format or any other complex file types.

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

#### Reverse Engineering and Encryption

Delving into the SBIN file format involves understanding how the data is structured and, in some cases, encrypted. Encryption adds a layer of complexity that must be unraveled to interpret the content accurately. For those looking to understand how to tackle file format encryption, the post [How to Reverse Engineer File Format Encryption](https://guidedhacking.com/threads/how-to-reverse-engineer-file-format-encryption.16268/) offers valuable insights. It guides through the methodologies, approaches, and tools needed to break down the encrypted barriers within the SBIN file format, making the content accessible for further analysis.

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

#### Save Game Editing and Unpacking Files

The Pokemon SBIN file format also encompasses save game files, which can be reverse-engineered for various purposes, such as editing or modding. The article [How to Reverse/Edit Save Game Files](https://guidedhacking.com/threads/how-to-reverse-edit-save-game-files-save-game-editor.13753/) is an excellent resource for understanding this aspect of the file format. It explains how to manipulate save game files, providing practical examples and guidance. Moreover, some files might be packed and require unpacking for proper examination. The tutorial series [How to Unpack Packed Files](https://guidedhacking.com/threads/how-to-unpack-packed-files-tutorial-series.17522/) offers comprehensive instructions on dealing with packed files, including those found within the SBIN file format.

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

In essence, the Pokemon SBIN file format is a complex and multifaceted entity that offers intriguing opportunities for exploration and manipulation. Through careful study, the right tools, and guidance from the above posts, developers and enthusiasts can uncover the secrets within these files, contributing to a deeper understanding of the games they love.
Latest Updates to Rails UI: New Themes, Retriever, and Hound
Published: 2023-09-06 15:07:38

---
title: Latest Updates to Rails UI: New Themes, Retriever, and Hound
published: true
date: 2023-08-15 20:21:03 UTC
tags: 
canonical_url: https://web-crunch.com/posts/latest-updates-to-rails-ui-new-themes-retriever-and-hound
---

Greetings!

I'm excited to announce some updates to [Rails UI](https://railsui.com), a project I've worked on for a few months that brings professionally designed UI components and templates to Ruby on Rails.

I [first posted about Rails UI](https://dev.to/justalever/im-building-rails-ui-10om-temp-slug-8599184) a ways back, introducing it. You can read more about it there and why I decided to build it. In the most recent update, v1.1.0, the two themes that previously shipped with Rails UI got a colossal advancement and now have several pages and components available for use.

I go into more detail in the video, but in short, this update is one step closer to my goal of 4 official themes (2 Bootstrap, 2 Tailwind CSS) for the first official launch of the Alpha stage for Rails UI.

You can read more [about the update](https://railsui.com/updates/new-themes-retriever-hound) on the [Rails UI blog](https://railsui.com/updates/). The blog post goes into my plans and decision-making progress when developing themes. As always, be sure to get on the [mailing list](https://railsui.com) and or follow [Rails UI on Twitter](https://twitter.com/railsui_) for more unique and day-to-day style updates.

I'll be coming back to the blog soon to post more content. Until then, I appreciate your patience with me taking a short break on it while I get some projects off the ground :)
Entendendo autenticação
Tags: authentication, autenticac
Published: 2023-08-15 20:17:37

Todos site, app, ou serviço que fazemos tem autenticação.
Lendo esse artigo (https://technically.substack.com/p/how-does-authentication-work) acho que entendi o problema, então vou explicar.
Primeiro pra quem precisamos de autenticação?
Pra provar que você é você mesmo, se existe alguma informação sensível na aplicação como dados de pagamentos, ou a possibilidade de fazer com que outra pessoa se passe por você (como acontece em centenas de golpes) é risco, a autenticação é necessária.

TLDR: Resumindo autenticação acontece tecnicamente de duas formas, por cookie que nada mais é uma grande string salva no banco de dados geralmente no seu usuário que é comparada com essa string salva no seu navegador que é enviada em cada requisição.
Ou JWT que é a mesma coisa só que usando criptografia (chave pública e chave privada) para validar a você ao invés da grande string.

Bom resumindo é isso, qualquer dúvida é só chamar.
Mastering Git: Effortless Commit Messages with Blackbox AI
Published: 2023-08-15 20:04:10

Introduction
If you're a Junior or new Dev in the tech world, chances are you've dipped your toes into the realm of Git, whether it's for personal projects or professional work. As a newcomer, crafting meaningful commit messages might still be an uncharted territory, leading to critiques or confusion. Perhaps you've found yourself in a situation where deciphering a vague commit message became an impromptu project scavenger hunt. If this resonates, fear not – our revolutionary feature "AutoCommit" is here to revolutionize your Git experience. Let our AI compose impeccable commit messages effortlessly, granting you more time to focus on your code.

Streamlining Commit Messages with AutoCommit

Install the Blackbox extension in Visual Studio Code.
Access the Source Control Button.
Click the prominent 'B' atop the menu screen.
In just seconds, a concise message detailing commit changes will appear.
You're all set!

With AutoCommit, the weight of crafting a well-worded commit message is lifted. Now, you can commit with confidence, knowing that our AI is your reliable co-pilot, delivering expertly written messages that enhance clarity and understanding.

Embrace Effortless Git
Elevate your Git game with AutoCommit by Blackbox AI. Say goodbye to cryptic commit messages and embrace the future of effortless version control.

Explore the AI-Powered Journey
Delve deeper into the realm of AI-powered tools for developers. Discover how Blackbox AI can transform your coding experience, from enhancing commit messages to streamlining your workflow.