teleren/devto huggingface dataset:
Luajit String Interning
Tags: openresty, nginx, systemtap, luajit
Published: 2022-10-12 15:35:33

## Why string interning?

String Interning is a common optimization in most of programming languages.

It has below advantages in luajit:

- compare string via pointers directly
- use string as table key efficiently, because the hash is calculated at alloc stage and use pointer as uniqueness
- save memory for duplicated strings

## Drawback

Meanwhile, it brings in extra time-consuming tasks:

- Hash
- when collision, memcmp all strings in the same hash slot
- rehash when collision is high and/or load factor is low

## Analyze the overhead of string interning

### How expensive is memcmp?

In a signle CPU (Intel(R) Xeon(R) Platinum 8269CY CPU @ 2.50GHz), for each string with 1MB, only the last char is different, it could only do memcmp 90 times per second at most.

### How expensive is hash collision?

We construct a workload to simulate the cache usecase (only set kv, no get).

Each http request inserts a key-value in the lua table. The key is integer and the value is string of 1MB size. Note that the key is not string, but luajit still does string interning for each string.

The http client would choose to use unique random strings or similar strings.

We use systemtap script to check the lj_str_new time cost differences.

## Could we do dynamic string interning?

We could do string interning only when the string is used to:

- use as table key
- string comparison

**Please check my blog post for detail:**

http://luajit.io/post/2022/luajit-string-interning/
File Backup NodeJS
Tags: node, javascript, tutorial, programming
Published: 2022-10-12 15:30:07

📚 This short post demonstrates how to create an app that does the following: 

Update a file and backup the old file.
If the file does not exist, create it
If the file exists, backup the old file and update the new file
If the backup file exists, delete it

```javascript
app.post('/', async (req, res) => {
  const filePath = path.join(__dirname, 'data.txt');
  //backup path with format date to YYYYMM-DD--HH_mm
  const backupPath = path.join(
    __dirname,
    `data-${new Date()
      .toISOString()
      .replace(/:/g, '_')
      .replace(/-/g, '_')
      .replace(/\./g, '_')
      .replace('T', '--')}.txt`
  );

  if (fs.existsSync(filePath)) {
    fs.copyFileSync(filePath, backupPath);
    fs.unlinkSync(filePath);
  }
  fs.writeFileSync(filePath, req.body.note);
  // send the new file content back to the db
  const course = new Course({
    name: req.body.note,
  });
  await course.save();
  res.send('file written');
});
```

[Source code](https://github.com/drsimplegraffiti/Backup_File/blob/main/app.js)
Create an amateur space rocket using Luos
Tags: programming, opensource, webdev, luos
Published: 2022-10-12 15:28:51

Alexis Gorlier created a proof of concept about an amateur space rocket for his personal project with his school Estaca. 

▶️ Read about his project and how this could break the current European altitude record in [this article](https://www.luos.io/blog/create-an-amateur-space-rocket-using-luos)
Representation in `alt` text
Tags: a11y, inclusion, html
Published: 2024-02-06 00:15:02

---
title: Representation in `alt` text
published: true
date: 2022-10-12 15:24:35 UTC
tags: accessibility,inclusion,HTML
canonical_url: https://www.aaron-gustafson.com/notebook/representation-in-alt-text/
---

Inclusion can take many forms.

Throughout my career, I’ve often defaulted to using `alt` text for photography with people in it that mentions the people, but rarely mentions things like their gender, skin tone, and the like. Often this was because I thought about people as just, well, people. Their individual characteristics were almost always immaterial to the primary purpose of describing the photo. If their difference served a purpose in the context, I included it, but that was my line.

In reading [this piece from Léonie](https://tink.uk/thoughts-on-skin-tone-and-text-descriptions.md-notes-on-synthetic-speech/), however, I realized that I was approaching my image labeling from a very privileged position. I didn’t include information about these individuals because I am privileged. In my life experience, my gender, race, orientation, etc. seemed—to me—unimportant because these attributes are highly valued by the society I exist in. Because I didn’t see the value of my own attributes, I could sweep away other people’s differences and focus on their human-ness. And that can seem like a good thing, but it’s insidious. Like exclaiming “I don’t see color” it erases people and their many intersecting identities.

By including information about people’s physical attributes in the `alt` text we author, we can both normalize and embrace our differences. We can celebrate diversity and promote representation.

To describe a photo as “Doctor Smith handing a file to a colleague” is not nearly as meaningful as “Doctor Smith, a Black woman, handing a file to her office manager, Jenifer Jones, a Filipino woman who uses a wheelchair.” If I was blind, I could learn a lot of useful information about the medical practice from this extra bit of detail. Taking it further, if I was Black, I might feel more comfortable seeing Doctor Smith, knowing she was Black as well (especially given [the unequal treatment Black folks receive in the U.S. medical system](https://www.cdc.gov/vitalsigns/aahealth/index.html)). If I use a support cane to get around, knowing the office manager uses a wheelchair tells me a good portion of the office is likely to offer generous pathways for me to walk around.

So I’m going to take Léonie’s advice to heart and work on my making my `alt` text more inclusive. The one area I will exercise restraint in my descriptions, however, is with respect to assigning folks a gender identity. Unless I have explicit knowledge of how they identify, it’s something best left to them to share.
How to setup a Node.js server port
Tags: node, javascript, beginners
Published: 2022-10-12 15:24:10

### What is Node.js?
Node.js is an open-source, cross-platform, back-end JavaScript runtime environment that runs on a JavaScript Engine and executes JavaScript code outside a web browser, which was designed to build scalable network applications.

Today I want to show you a setup of the node server port so let's get into the implementation.

> *For this series, I'm following an excellent video tutorial from [Traversy Media](https://www.youtube.com/playlist?list=PLillGF-RfqbbQeVSccR9PGKHzPJSWqcsm)*

### Install Node and npm
First, you have to download [Node](https://nodejs.org/en/download/) and [npm](https://docs.npmjs.com/downloading-and-installing-node-js-and-npm) from these links.

### Get package.json file
Create a folder with your app name and create a file with `server.js` in that folder.
Now navigate into that folder and type the below command in the terminal.
```javascript
npm init
```
It will ask you to provide the version, description, etc to type for your project. Just make sure to add `server.js` file for the **entry point**.

### Install dependencies
Next, you have to install [express](https://expressjs.com/) which is the Node.js framework to create RESTful APIs and [mongoose](https://mongoosejs.com/) which is a JS library to create a connection between MongoDB and Node.js app.
```javascript
npm i express mongoose
```
and install `nodemon` from this command
```javascript
npm i -D nodemon
```
Nodemon is a tool to observe the changes in the file and restarts the server. 

### Write a script
Write these two scripts in your `package.json` file.
```javascript
 "scripts": {
    "start": "node server.js",
    "server": "nodemon server.js"
  },
```

### Create a port
Now in the end, type this code in your `server.js` file 
```javascript
const express = require('express');
const port = 5000;

const app = express();

app.listen(port, () => {
  console.log(`Server started on port ${port}`);
});
```
and to get the results, run this command in terminal
```javascript
npm run server
```
You'll get the running port in the terminal just like this

![node-server](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ijtqnl6v9gi8bi9nuf5b.png)

Thank you for reading!
Feel free to connect on [Twitter](https://twitter.com/Aneeqa_Khan25)
The best CSS Framework Sites & Platforms You Need to Know
Tags: css, opensource, nextjs, design
Published: 2022-10-12 15:12:37

## 1. Bootstrap
Bootstrap The most popular HTML, CSS, and JS library in the world.
![Image description](https://top-alternatives.online/storage/main1665532211.webp)
[Go to Bootstrap](https://getbootstrap.com)
[All Bootstrap Alternatives](https://top-alternatives.online/css-framework/bootstrap-alternatives)
_____
## 2. Tailwind CSS
Rapidly build modern websites without ever leaving your HTML.
![Image description](https://top-alternatives.online/storage/main1665532797.webp)
[Go to Tailwind CSS](https://tailwindcss.com)
[All Tailwind CSS Alternatives](https://top-alternatives.online/css-framework/tailwind-css-alternatives)
_____
## 3. bulma.io
Bulma: Free, open source, and modern CSS framework based on Flexbox.
![Image description](https://top-alternatives.online/storage/main1665532870.webp)
[Go to bulma.io](https://bulma.io)
[All bulma.io Alternatives](https://top-alternatives.online/css-framework/bulmaio-alternatives)
_____
## 4. Materialize CSS
A modern responsive front-end framework based on Material Design.
![Image description](https://top-alternatives.online/storage/main1665533001.webp)
[Go to Materialize CSS](https://materializecss.com)
[All Materialize CSS Alternatives](https://top-alternatives.online/css-framework/materialize-css-alternatives)
_____
## 5. Chakra UI
Simple, Modular and Accessible UI Components for your React Applications. Built with Styled System.
![Image description](https://top-alternatives.online/storage/main1665533097.webp)
[Go to  Chakra UI](https://chakra-ui.com)
[All  Chakra UI Alternatives](https://top-alternatives.online/css-framework/chakra-ui-alternatives)
Gdb Black Magics
Tags: gdb, assembly
Published: 2022-10-12 15:07:06

Without questioin, gdb is a brilliant weapon to debug our program. However, the reality is complex. We need black magics to handle these cases.

## Magic1: optimized out?

Your program is normally compiled in optimized mode (e.g. -O2), sometimes even without debug info!

With optimized option, gcc would most likely use registers instead of the stack to store the function arguments and local variables. In some circumstances, gdb would said they are <optimized out>, then you could not inspect their values. Even worse, in the flow of the code, those registers would be overrided, so it’s impossible to check their original values anymore!

Normally, to tackle these issues, you have to recompile your program without optimized options.

But what if you could not? Think about you’re facing your client’s production environment.

You would be frustrated, isn’t it?

Then the only way is to read the assembly codes and inspect everything you need at the right places!

## Magic2: gdb script

gdb has builtin scripting. You could use it to define variables to r/w the program symbols and do some control flows upon them. It’s really useful when you want to inspect complex context infomation.

## Magic3: gdb python

Besides basic scripting, if you want more magic, use python!

Python could be used to define customized command, breakpoint or function.

## Magic4: set source path

Mostly it’s necessary to map the debug steps to the lines of source codes.

In fact, normally, your binary, if not stripped, would contains DWARF sections, which contains the path of the source codes. So all you need to do is to download the matching source codes and specify a correct perfix.

**Please check the my blog post for detail:**

http://luajit.io/post/2022/gdb-black-magics/
AWS CDK Cannot find module 'constructs'
Tags: aws, cdk
Published: 2022-10-12 15:02:33

---
title: AWS CDK Cannot find module 'constructs'
published: true
description: Arreglo para el error "Cannot find module 'constructs' or its corresponding type declarations."
tags: #aws #cdk
# cover_image: https://direct_url_to_image.jpg
# Use a ratio of 100:42 for best results.
---

Si les da 
`Cannot find module 'constructs' or its corresponding type declarations.`

Instalen las referencias a mano

`npm i constructs @aws-cdk/assets`

A veces el npm hace estupideces. Pueden probar con `yarn install` que parece que funciona bastante mejor (o actualizar a la ultima version del NPM)
Charity AI webinar "The promising role of synthetic data to enable responsible innovation"
Tags: ai, machinelearning, datascience
Published: 2022-10-12 14:58:30

Data Phoenix Events team invites you all on **October 19** to our "The A-Z of Data" charity AI webinar. The topic - **"[The promising role of synthetic data to enable responsible innovation](https://dataphoenix.info/charity-ai-webinar-the-promising-role-of-synthetic-data-to-enable-responsible-innovation/)"**.

Good quality FAIR data is fundamental for enhancing data reuse. When we discuss data quality in the FAIR context, we often focus on the metadata level quality attributes like accessibility and reuse conditions rather than the semantic ones like imbalances, outliers, and duplicates. In practice, ensuring both the metadata and semantic levels of data quality is crucial but also challenging. One solution for this challenge is synthetic data. MIT technology review names synthetic data as one of the ten tech breakthroughs of 2022 citing it as a solution for training AI models when faced with inadequate quality, or incomplete data or biased data. Synthetic data improves data quality and helps accelerate AI projects enabling responsible innovation. Let's understand how it works in practice with the experience of the co-founder of a synthetic data company and how to check for data quality at scale using open-source libraries, as well as metrics required to measure the ensuing synthetic data quality.

**Speaker**
**Shalini Kurapati** - Co-founder and CEO Clearbox AI. Shalini leads the strategy, operations and business development at Clearbox AI with her multidisciplinary expertise at the intersection of Technology, Policy and Management. Shalini holds a PhD from Delft University of Technology with a strong R&D background and practical expertise in data management, data privacy and data stewardship. She specialises in transparency, privacy and fairness issues across data life cycles as well as algorithms. Shalini has a wide-ranging international professional experience in the Netherlands, Sweden, India, United States and most recently Italy and is also a Certified Informational Privacy Professional/Europe (CIPP/E) with demonstrable knowledge of GDPR and European e-Privacy laws.

**Registration 👉 [https://dataphoenix.info/charity-ai-webinar-the-promising-role-of-synthetic-data-to-enable-responsible-innovation/](https://dataphoenix.info/charity-ai-webinar-the-promising-role-of-synthetic-data-to-enable-responsible-innovation/)**
Hacktoberfest: docs updates in three steps
Tags: beginners, writing, hacktoberfest, codenewbie
Published: 2022-10-12 14:57:36

Hacktoberfest is a celebration of Open Source contributions and new developers are eagerly encouraged to join in. However, many projects require so much setup, which not only stressed me out but also discouraged me from considering contributing.

Of course, there is the Markdown Preview on GitHub - however, it only changes Markdown to HTML and doesn't render the whole page. You can't see how the changes you're introducing will look on the page unless you close, install dependencies, start the dev server.

**But what if updating docs wasn't this complicated? Well, good news is that it doesn't have to be!** 

Below, I'm offering a workflow that helps you focus on the content update or creation, without the hassle of the setup. If you prefer to watch a video instead, I got you covered as well - [check the end of the post](#see-it-in-action)!

## Content editing hack

Follow these three steps for a productivity hack:

1. In the docs repository, find the file you want to edit - can be markdown, can be anything, really. Click "edit" icon.

![Opening a file in GitHub and entering an edit view](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ffrcm6qwf5mdnmu5n8oo.gif)

2. In the browser's address tab, add "pr.new" to the beginning of the URL address, press enter, and enjoy updating the content.

![Adding "pr.new" to the beginning of the URL address](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/an96iyd59em7dh3oyn3k.gif)

3. Once you're happy with the result, propose the changes and submit a PR!

![Proposing changes and submitting a PR](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/9qxlc8ewb103dvbiclxr.gif)

## What is this tool?

What you see above is a tool called **[Web Publisher](https://developer.stackblitz.com/codeflow/content-updates-with-web-publisher)**. It is - and will remain - free for Open Source projects and for public repositories. 

Web Publisher allows you to edit any file and see the changes rendered on the live preview. You don't have to do any special setup - you can even use it on your phone (on Chrome or Firefox). Now even the new developers can contribute their talents to Open Source by proofreading, translating, editing the text without the stress of the environment setup.

I have been using Web Publisher for weeks now and it really helped me a lot in my daily workflow. The other day I corrected a dead link on our page while waiting in line for an appointment 😂

## Wanna try it out?

You can either edit a page of any of the public repos or... [Add your name to this page](https://ilovecodeflow.com)!

## See it in action

In case you'd like to see how I use the tool, see this video:

{% embed https://www.youtube.com/watch?v=KtdOs4rhikw %}

---

At StackBlitz, we love our community. Don't be a stranger - [join our Discord](https://discord.gg/EQ7uJQxC) or reach out to me on [Twitter](https://twitter.com/sylwiavargas) with your StackBlitz ideas, dreams, and wishes!
How do you feel about cover letters?
Tags: discuss, watercooler, career
Published: 2022-10-12 14:45:45

How do you feel about job applications that ask for a cover letter? Do you skip them if they’re not required?

It seems to me that requiring a cover letter could create an adverse incentive where more qualified employees who have more options would not want to spend the time to write one when there’s other applications that don’t have that same requirement.

Do you personally write cover letters when an application requires one? Or would that requirement make you pass over that role?
Awesome Data Structures & Algorithms Courses
Tags: javascript, algorithms, datastructure, programming
Published: 2022-10-12 14:35:25

- JavaScript Algorithms and Data Structures - Codevolution
https://bit.ly/3COGNeo


- Data Structures Playlist - WilliamFiset
https://bit.ly/3erSq1s


- Algorithms and Data Structures Tutorial - freeCodeCamp
https://bit.ly/3VmN48s


- The Last Algorithms Course You'll Need - Frontend Masters
https://bit.ly/3etJYyz
Common REST API Challenges - Rapid_API
Tags: webdev, api, beginners, programming
Published: 2022-10-12 14:33:19

####   Original Tweet From  [@Rapid_API](https://twitter.com/Rapid_API)
{% embed https://twitter.com/Rapid_API/status/1577278076140109824 %}
Common REST API challenges.



REST APIs adhere to REST(Representational State Transfer) architecture, which comprises several rules that define scalable and lightweight API design.

Here are the biggest challenges faced when working with them👇🏼 

### 1️⃣ Security

APIs are integral to businesses on today’s web and require protection from attackers.

Security methods include encryption, API Keys, OAuth, input validation, error handling, and more.

Security is a deep topic. Check out the OWASP API security guides to know more. 

### 2️⃣ Consistent Endpoints

The naming and structure of endpoints should be consistent. If not, your API structure becomes confusing.

Remember to follow best practices, and never use verbs in your endpoints as that is already defined by the HTTP Method. 

### 3️⃣ Improving response time

There are various ways to approach this issue: filtering, pagination, caching, payload compression, and more.

Response time affects SEO ranking, so it is an important topic to consider. 

### 4️⃣ Versioning

You’ll want to be able to update your API without potential breaking changes affecting your users.

There are no REST guidelines on versioning, but common strategies are through Custom Headers, URI Path, and Query Parameter versioning. 

Thanks for reading! Follow us [@Rapid_API](https://twitter.com/Rapid_API) for more of our exclusive content. 🐙 



Click [Here](https://www.knowledge-twitter.com/?utm_source=dev.to)  For More Posts Like This [https://www.knowledge-twitter.com](https://www.knowledge-twitter.com/?utm_source=dev.to)
A depressive disorder person just lunched a small business
Published: 2022-10-12 14:29:55

Hi folks. I'm Tar who is a Full stupid developer. I have to learn a lot about DOM manipulation, basic canvas API, and some kinds of stuff which relates to 3d/2d. I'm really fun to work on that and usually have new challenges (bugs) every day. Even though some bugs are hard to solve for example SVG from a merchant cannot render correctly in our studio, and the wrong position of placed 2d objects such as Text, Images, it cannot stop me learn how to develop cool features and improve existing functionality to increase performance and reduce funny bugs and loading time. Until now I had been working as a studio software engineer for one year. Sadly most of the time I used 3rd party library to solve those bugs until I got a ticket about cannot change SVG color fill by using that 3rd party, I have no idea how to fix it because I always use that library to render SVG on the 3D model. I had to go back to the basic concept of DOM manipulation to fix something inside the SVG element, Then I realize that I need more knowledge to develop harder features in the future. that I want to learn about WebGL, Canvas API,and Real-time rendering. Tadchud is kind of my approval and achievement to break my knowledge limitation.

#### What's is Tadchud

Well, in the Thai language it means `cut dress` or `dressmaker`. So I think it makes sense to name my product like this. Tadchud focus on online sellers who might not have their factory but want to take their creativity to make a real product. Let's say you want to custom your stuff eg shirt, bag. You have to talk with the merchant and explain what should it look like. So this is the <span style="color: red">**issue**</span> that Tadchud can solve. It can help you or your customers to bring the creativity to be a real product. We want to help both merchant and customer to be happy and take a shorter time to make things done.

First prototype
{% embed  https://www.youtube.com/watch?v=bChQ5aS3BnE %}

{% embed  https://www.youtube.com/watch?v=rZtYxNTN2As %}

If you want to be in waitlist please send the email to

Email: contact@tadchud.com

Email: jarupong.work@gmail.com

Keep update: https://tadchud.com/

### Technology stack

- Frontend
  - NextJS(React) + Chakra UI + Mantine UI
  - Canvas API
  - Some 3D rendering libraries
- Backend
  - Apollo Graphql server
  - Prisma
- Database
  - Postgresql
  - Typesense(Search engine)
100 DAYS OF CODE CHALLENGE
Published: 2022-10-12 14:29:49

## DAY 1

 - WHAT I DID TODAY
    HTML Basics

- WHAT I LEARNT FROM WHAT I DID TODAY

   HTML which is an acronym for Hypertext Markup Language is a markup language used to build webpages, it is responsible for the structure of websites. It is used to add text, images, and pattern to the website or web page. HTML is mostly about tags.
   The first tag used in creating index.html is the html tag <html></html>, after which we have the head tag <head></head>, in between the head tag we have the title tag <title></title> which contains the heading of the website.
   Then we have the body tag <body></body> which is outside the head tag but inside the html tag. The body tag contains the content of the website or web page about to be created.