teleren/devto huggingface dataset:
Pro Tips: How to avoid database deadlocks when working with CRON jobs
Tags: database, mysql, webdev, design
Published: 2022-09-13 17:31:42

> Database overloading for a large/ commercial system that has a complicated database and too many CRON jobs. 

Tech stack in focus:

1. PHP
2. MySQL
3. Apache2
4. CRON jobs

Mistakes you make when designing a system that costs you a lot in future

Some minor mistakes you make when designing a large scale application that cost you a lot and could have been fixed by avoiding a few mistakes include,
   
1. Designing a database without Foreign keys
2. Choosing wrong data types and their sizes
3. Using too many TEXT fields
4. Database with duplicated data across multiple tables
5. Not using indexes
6. Too many joins
7. Updating a single column over and over again to keep track of system updates
8. Too many queries to file system
9. Not setting up a mechanism for getting rid of old unused data

## Avoiding the mistakes/ database deadlocks

When we have scheduled tasks and are planning to design a system where we are periodically updating stats, working with the Apache server with PHP in MySQL, instead of using update queries for rows or columns you want to periodically update, try to use insert queries.

## 1. Designing a database without Foreign keys

The best advice i can give you is to just not rush the step of designing a database. Either you are on a short deadlines or you are being just too careless about this step, its going to cost you major $$$ and time in future.

Take your time, think things through, use dependencies and make your data consistent.

Use Foreign keys everywhere! If you think about the pain it gives you putting them in thinking them through or you just avoid them because of the deletion errors you face when removing data, think again.

If you do the Foreign keys properly the deletion becomes easy and there would be almost no unrelated data when removing a top level database record.

It also protects you from removing a record in a parent table that has child records.

## 2. Choosing wrong data types and their sizes

The rule here is to don’t over do them.

The max allowed values are the ones you would decide on application level, not the ones the user “CAN” put it. Remember you can always do validation on the application side.

Not all records have the max values put it in so don’t overdo them.

Using unsigned values for auto increment columns and values that may never be negative is another good example.

## 3. Using too many TEXT fields

TEXT fields are slower, varchar is better. Use TEXT only when the text is going to be really long.

TEXT fields can be part of an index upto a specific length, varchars are better option here too.

Too many TEXT column in a record would make fetching your data slower.


Read complete article on [my BLOG](https://peham.dev/tips/avoid-deadlocks-when-working-with-cron-jobs/)
How to create short and concise technical videos
Tags: videos, editing, advocacy
Published: 2022-09-13 16:53:16

---
title: How to create short and concise technical videos
published: true
description: A new chapter of the developer advocacy handbook covers how to create super short and concise technical instruction videos
tags: videos, editing, advocacy
cover_image: https://dev-to-uploads.s3.amazonaws.com/uploads/articles/b302axsnbam6mda2fwoc.png
---

This weekend I released a new video on the [VS Code TikTok](https://www.tiktok.com/@vscode?lang=en) and [YouTube channel](https://www.youtube.com/c/Code) which got some good interaction (53k visits on TikTok, 6k on YouTube).

Here is the VS Code portrait version: 

{% youtube fODr71XQeSI %}

And here's my original landscape one. 

{% youtube JLMbpiywVxQ %}

People keep asking how I did those, so I added a new chapter to the [Developer Advocacy Handbook](https://developer-advocacy.com/videos) explaining the process. Click below to read it there in detail.

[![Screenshot of the handbook chapter on creating videos](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6il6ko4afnwr5g424b2a.png)](https://developer-advocacy.com/videos)

In essence, the process is:

* Write a concise script
* Record yourself reading this one
* Record a screencast showing the things you talk about
* Speed up, add freeze frames and cut the screencast to match the main video
Loading Spinner Accessible Components just Released! 🎉
Tags: react, html, tailwindcss, news
Published: 2022-09-13 16:48:59

Howdy guys,    

Just added some just-tailwind-no-extra-code accessible Loading Spinner Components, with 3 variations in 3 different sizes, in our ever-expanding Tailwind library!  

[https://wind-ui.com/components/spinners](https://wind-ui.com/components/spinners)

Feel free to copy, use & share the love 💚
C++ dagi ma'lum bir o'zgaruvchi (variables)lar haqida.
Tags: cpp, beginners, programming
Published: 2022-09-13 16:43:26

   C++ da o'zgaruvchilar soni ko'p. Biz shulardan 2 tasi ya'ni **integer** `int` va **string** `string` larni ko'rib chiqamiz.

> O'zgaruvchilarga birinchi nom va keyin qiymat beriladi.
Masalan:
 

```cpp
 int son = 10;
 string matn = "Akbar ";

```
   **Integer** so'zi inglizchadan (_butun son yoki yahlit son_)deb tarjima qilinadi. Demak `int` o'zgaruvchisi o'z ichiga faqat butun sonlarnigina oladi.

Masalan:

``` cpp
#include <iostream>
using namespace std;

int main() {
 
  int yosh = 35 ;

  cout << yosh;
  
  return 0;
}
```
  **String** ya'ni `string` o'zgaruvchisi o'z ichiga faqat tekstlarni oladi. **String**ga sonlarni ham yozsa bo'ladi, lekin unday hollarda sonlarni tekst shaklida ko'radi va sonlar ustidan _matematik amallar bajarib bo'lmaydi_.

Masalan:

``` cpp
#include <iostream>
using namespace std;

int main() {
 
  string tekst = "Salom" ;

  cout << tekst;
  
  return 0;
}
```
DevOps Basics: CI/CD/CD
Tags: devops, beginners
Published: 2022-09-13 16:42:49

Today, I'm inaugurating a new category on the blog: DevOps basics! and we will start with CICDCD. 

It is a question usually asked in interviews: what is CI/CD, what do you think of Continuous Deployment?
Let's see first what a deployment is, then establish what are those CI, CD, CD about.

### Deployment
A **deployment** is an act of installing/activating the software/binaries. During deployment, if an existing version is there, then uninstalling/deactivating the previous version takes place. A release is the culmination of all the activities to get changes safely into production. 

### Continuous Integration
CI is the automation of builds. The code change needs to be merged, committed into the source code repo, and checked against it. 
Continuous Integration solves 3 main problems: having the builds be: 
- repeatable, 
- consistent, 
- available.

The build pipeline has to be fast and reliable, as it will be run multiple times after being triggered.

### Continuous Deployment
Continuous Deployment focuses – just like the name implies – forcuses on the deployment; the actual installation and distribution of the bits.
As Continuous Integration provides a deployable artifact, Continuous Deployment can take that artifact forward into additional environments.

### Continuous Delivery
Continuous Delivery is the automation of steps to safely get changes into production. 
It's important to make clear that every change that passes all stages of your production pipeline _is released to your customers_. There's **no human intervention**, and only a failed test will prevent a new change to be deployed to production.
As you can imagine, testing needs to be more than solid before considering this strategy.


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

### Opinions
Interviewers usually ask about Continuous Delivery as it gives a good insights into someone thoughts and experience. 
For example, in some companies, it's totally accepted and recommended to have releases automatically going into production. Very little manual testing is done - if at all.
In a lot of companies, it is unthinkable. Every change would go through a monthly/or-more release, heavy manual testing and business signing and testing on top. 

Continuous Integration and Continuous delivery is usually already present in every company (except some start-ups). They're usually set up with Jenkins, Team City, Azure DevOps, ...

That was it for today :). Hope this was useful, if you have any questions, don't hesitate!
kafka-producer
Published: 2022-09-13 16:36:17

## 
一、分区策略

## 
二、ISR（in-sync replica set)：与leader同步的follower

1. 每个partition收到消息，需要给producer发送ack。producer收到ack会继续发送下一条，否则重复发送

1. partition发送ack时机

- 
leader同步follower后发送ack，这样leader挂了数据不会丢失

- 
全部follower同步后再给producer发送ack

- 
follower从leader同步完成后发送ack给leader，如果超时(replica.lag.time.max.ms)不发送，则被踢出ISR

- 
leader故障，会从ISR选出leader

## 
三、ack机制

1. 
ack参数配置（request-required-acks）：

- 
request-required-acks:-1， follower全部同步完后leader在返回acks给producer；数据不丢失，延迟性差

- 
request-required-acks:1， leader成功收到数据就返回acks；leader没有持久化就挂了，会丢数据

- 
request-required-acks:0， producer不等leader返回acks就继续发送消息

2. 
幂等
enable.idempotence=true，producer初始化时会分配一个pid，发往partition的数据会带上sequence number，broker会对<pid, partition, sequence number>进行缓存，相同的数据broker只会缓存一条

四、数据一致性

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/1m6vnmo2pm4729sozj7g.png)
Variables nima?
Tags: beginners, programming, tutorial, css
Published: 2022-09-13 16:34:27

> **O'zgaruvchi nima?** O'zgaruvchi bu kompyuter xotirasining ma’lum bir qismiga berilgan nom! Yani siz dasturingizda qandaydir qiymatlarni(sonlar, ismlar, belgilar va hokazo) saqlashingiz kerak bo’ladi va ular xotiraning biror joyida saqlanib turadi. O'sha saqlanayotgan joyga nom berib olasiz va unda sizning ishlatmoqchi bo’lgan qiymatingiz turadi keyin siz uni qayta qayta ishlatishingiz mumkin.

```
string a;
```

```
int a;
```

1. o'zgaruvchining nomi katta va kichik lotin harflaridan, raqamlardan va pastki chiziq( _ ) dan iborat bolishi kerak 
2. o'zgaruvchimizning bosh harfi raqamlardan boshlanmasiligi shart 
3. ushbu nomdagi o'zgaruvchi oldin elon qilinmagan bolishi kerak
cin nima?
Tags: programming, tutorial, beginners, css
Published: 2022-09-13 16:25:38

`cin` ob'ekti ma'lumot kiritish vazifasida ishlatiladi va bu shu ko'rinishda bo'lishi mumkin:

```
  cin>>a;
```
Bunda biz **a** o'zgaruvchiga malum bir ma'lumotni kirita olamiz

> Misol

```
int main(){
  
  string a;
  cout<<"cinga ma'lumot kiriting: ";
  cin>>a;
  }
```

> Bunda biz quyidagi natijaga ega bo'lamiz:

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/dhvz3th3vxe26td411ss.jpg)
The Let Keyword
Tags: javascript, webdev, programming, tutorial
Published: 2022-09-13 15:49:34

## Let keyword

The `let` keyword declares variables that are limited to scope of block statements or expressions where it is used. It is used to declare block scoped variables that have a `value` parameter which is optional. They cannot be redeclared and must be declared first before use.
The `let` keyword was introduced in ES6 (2015).

### Syntax

```js
let name1 [= value1], name2 [= value2] … nameN [= valueN];
```
Parameters
`nameN:`
It is the name of the variable

`valueN` (Optional):
It is the value that is to be assigned to the variable 


### Cannot be Redeclared

Variables that are declared with `let` cannot be redeclared, they will throw an _Syntax error_

```js
SyntaxError: 'variableName' has already been declared
```

#### Example:

```js
let user = "John Carter";

let user = 5;

// SyntaxError: 'user' has already been declared
```


### Block Scope
Before ES6 (2015), JavaScript had only global scope and function scope. ES6 introduced two keywords, `let` & `const`, having block scope.

The body in between two curly braces `{...}` is called block scope. The `let` & `const` variables declared inside of `{...}` cannot be accessed from outside.

```js
{
  let id = 1;
}
// id can NOT be used here
```


### Redeclaring Variables

Now as we know that `let` is a block scoped variable so its value would not affect variables declared outside of the block with the same name.

```js
let color = “Black”;
// Here color is Black

{
    let color = “Red”;
    // Here color is Red
}

// Here color is Black
```


### Let Hoisting

JavaScript Hoisting refers to the process whereby the interpreter appears to move the declaration of functions, variables or classes to the top of their scope, prior to execution of the code. Hoisting allows functions to be safely used in code before they are declared.

Variables defined with `let` are hoisted to the top of the block, but not initialized. Meaning: Using a `let` variable before it is declared will result in a `ReferenceError:`

```js
color = "Black";
let color = "Red";

ReferenceError: Cannot access 'color' before initialization
```


### Conclusion

`let` is a signal that the variable may be reassigned, such as a counter in a loop, or a value swap in an algorithm. It also signals that the variable will be used only in the block it's defined in, which is not always the entire containing function.


---


{% user moazamdev %}
How do you test and find bugs in an application?
Tags: anonymous, discuss, help
Published: 2022-09-13 15:41:44

_This is an anonymous post sent in by a member who does not want their name disclosed. Please be thoughtful with your responses, as these are usually tough posts to write. Email sloan@dev.to if you'd like to leave an anonymous comment or if you want to ask your own anonymous question._ 

***

I'm curious - how do y'all look for bugs in your applications? Trying to figure out new ways to get rid of bugs in my programs, and I'm all ears to hear different methods.
Compressing Integration Server's Apache Derby Embedded Database
Tags: integration, apache, database, tutorial
Published: 2022-10-26 08:34:10

---
title: Compressing Integration Server's Apache Derby Embedded Database
published: true
date: 2022-09-13 15:27:31 UTC
tags: integration, apache, database, tutorial
canonical_url: https://tech.forums.softwareag.com/t/compressing-integration-servers-apache-derby-embedded-database/263620
---

This article pertains to customer installations with extremely large ‘db’ directories for the Integration Server’s Apache Derby embedded database. The shell script is supported for Linux installations of Integration Server 10.1 forward. At this time, this includes 10.1, 10.3, 10.5, 10.7, 10.11 and 10.15. There is no Windows bat file for this article.

The attached readme contains all the information required to run this script. Lastly, the attached shell script is appended with a ‘.txt’ file suffix, so it may be included as an attachment. Once downloaded, the script should be renamed by removing that suffix.

[derby-compression-readme.pdf](https://tech.forums.softwareag.com/uploads/short-url/zYAZLHRIcn6GS23U4knwUWW3Gwk.pdf)
[derby-compression.sh.txt](https://tech.forums.softwareag.com/uploads/short-url/7yBBaEyRXUFBTKNFfa5Q3YOSCtP.txt)

**Note:** The IS data statistics collector used by the Admin UI dashboard introduced in 10.7 retains data captured for the past 30 days by default. Consider reducing this number to 7 or lower before compressing the data in the embedded database. The following steps should be performed if the number of days is changed:

*First*, reduce the number of days of retained data. This may be configured via the Admin UI’s dashboard configuration in version 10.11. For version 10.7, the configuration file must be directly edited in (installPath) /IntegrationServer/instances/ (instanceName) /config/monitor/monitor.cnf file. Edit ‘retentionDays’ property value with a value greater than or equal to 1.

*Second*, restart the data statistics collector via this service call.

``` 
http(s):// (host) : (port) /invoke/wm.server.datacollector:restartEngine
```

*Third*, initiate the data purge.
``` 
http(s):// (host) : (port) /invoke/wm.server.datacollector:deleteData
```

Depending on the amount of data, the ‘deleteData’ service may run for a while. Its activity can be monitored by setting the Integration Server’s log level for facility 0045 (Data Statistics) to ‘Debug’. The purge will be completed once these server.log messages cease to appear in the log.

‘… [ISS.0045.0064D] … Deleted the resource {0} data older than {1} from JDBC data source’

Once the purge completes, perform the Apache Derby compression, so it reclaims the disk files freed up from the deleted rows in the statistics data tables.

[Read full topic](https://tech.forums.softwareag.com/t/compressing-integration-servers-apache-derby-embedded-database/263620)
How to Fix the TypeScript intellisense template error in Vue
Tags: vue, typescript, nuxt
Published: 2022-09-13 15:16:04

---
title: "How to Fix the TypeScript intellisense template error in Vue"
published: true
canonical_url: https://michaelnthiessen.com/typescript-intellisense-error
description: "I recently got this error while working on a Vue 3 project. No need to panic, you need to disable this Volar message exactly how it says."
tags: vue, typescript, nuxt
cover_image: https://images.unsplash.com/photo-1662913307002-ad2d32923913?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=1528&q=80
# Use a ratio of 100:42 for best results.
---

I recently got this error while working on a Vue 3 project:

```sh
TypeScript intellisense is disabled on template. To enable, configure `"jsx": "preserve"` in the `"compilerOptions"` property of tsconfig or jsconfig. To disable this prompt instead, configure `"experimentalDisableTemplateSupport": true` in `"vueCompilerOptions"` property.volar
```

No need to panic, just disable this Volar message [exactly how it says](https://github.com/johnsoncodehk/volar/issues/1219#issuecomment-1104548432).

In your `.tsconfig` file you need to add `"jsx": "preserve"` in the `compilerOptions` section:

```js
{
  "compilerOptions": {
    "jsx": "preserve"
  }
}
```

I’m using Nuxt 3, so my TypeScript config file looks a little different:

```json
{
  // https://v3.nuxtjs.org/concepts/typescript
  "extends": "./.nuxt/tsconfig.json",
  "compilerOptions": {
    "jsx": "preserve"
  }
}
```

If you’re using a [jsconfig](https://code.visualstudio.com/docs/languages/jsconfig#_jsconfig-options) file instead, it may look closer to this:

```json
{
  "compilerOptions": {
    "module": "commonjs",
    "target": "es6",
    "jsx": "preserve"
  },
  "include": ["src/**/*"]
}
```

The `jsx` option on the `.tsconfig` [controls how ts transforms and outputs](https://www.typescriptlang.org/tsconfig#jsx) `.tsx` files, but this error happens on `.vue` files with no `tsx` extension.

So changing this option to silence the warning has no real effect on our projects. In Vue we are only using TypeScript for type checking so this option doesn’t affect anything that we’re doing.

This issue is likely happening because of the TypeScript Language Server that VS Code uses to provide the Intellisense feature. Volar hooks into this server, but unfortunately, has no control over it.
My First Blog
Tags: firstpost, firstblog, ai, hackelit
Published: 2022-09-13 15:12:25

I am so exited as I am writing my first blog post. I am **Mayank Rajput** from Mahesana, Gujarat, India.


 I like to share and express my thoughts and ideas about the most interesting and fascinating competency in programming. I am Full stack developer with somewhat hacking knowledge.

Though I have heard about new innovations and technologies which were introduced to the world through news and social media, my curiosity was built day by day uncommonly after referring into this section. I can remember that our teacher was really excelled in teaching us more friendly and attractively by providing related videos and reading materials in order to enhance our knowledge in new trends in Programming & AI.

I completed my various courses of programming languages like Python, JavaScript, Go, TypeScript etc. in my high school timeline. You can also visit my [website](https://www.mayankrajput.ml). My github profile is [hackelite01](https://github.com/hackelite01) as my username.

Alright, we all know that AI is a hotly debated topic all over the world with the technological advancement globally. According to John McCarthy(The father of Artificial Intelligence) he mentioned that “Artificial Intelligence” can be define as “the science and engineering of making intelligent machines”. Nowadays AI is everywhere and in many fields at the moment such as Healthcare, Education, Criminal and justice, Astronomy , Business and economics, Transportation, Cultivation etc. Moreover, Artificial intelligence are used to carry out risky jobs that are too dangerous for humans to undertake, to accomplish the tasks more faster and with minimal errors, also for the development with new innovations and creations .

Artificial intelligence (AI) is arguably the most exciting field in robotics. Can you ever think that a machine or a non living being can get a citizenship in a country!!! Saudi Arabia has gifted the citizenship for the first ever humanoid robot called “Sophia” which is based on AI technology. Isn’t that fascinating?

I wonder that if I can have a robot to wake me up saying “Time to wake up, buddy!!” and helps to make my activities more easier, and to live in a smart city, to work within a smart office too . The latest AI offers an unprecedented opportunity to engage within some of these tasks. So In the future we may live in our dream worlds with advanced technology. Hope you all had a great time while reading this blog.

Thank you.
DSA Blind75, 2 Pointer Algo
Published: 2022-09-13 15:00:22

On the second day of blind 75. I learnt about 2 pointer technique.
it uses two pointer two reduce iterations to one.
**When to apply two pointer/identify**

1. Used in array, strings etc.
2. Used if input is sorted and we are comparing.
3. Swapping, partition, removing duplicate or palindrome.

Explaination:-
https://medium.com/@timpark0807/leetcode-is-easy-two-pointers-90b9b0f2eb43
https://youtu.be/KLlXCFG5TnA
 

**Problems done**
1.Two sum.
2.Palindrome string.
2.removing duplicates from sorted array.
Sandworm.JS: sandboxing & malware detection for npm packages
Tags: javascript, security, opensource, showdev
Published: 2022-09-13 14:59:33

Sandworm.JS is a sandboxing & malware detection tool for npm packages[](https://github.com/sandworm-hq)

Rather than relying on CVE advisories, Sandworm watches lower-level APIs like the Node VM and browser APIs like DOM manipulation, fetch, etc., and throws when a package unexpectedly accesses these APIs. 

While this won't protect against all classes of vulnerabilities, it assures that your project is safe from hand-crafted, zero-day vulnerabilities that leave your data open to attack until a CVE is issued and a fix is published.
Most tools in this space currently use static analysis to scan a package's source and infer potential threats by looking at code patterns, invoked methods, or loaded modules. 

However, it's generally simple to trick such analysis tools using various obfuscation techniques. Static analysis is, therefore, not a definitive security solution and should be used in tandem with dynamic tools like Sandworm.

Sandworm does dynamic analysis in the runtime - it knows about what happens when it happens:
It can't let you know about possible vulnerabilities before it sees the code run;
It also can't capture information about "dormant" code that doesn't get executed;

No obfuscation or workaround can fool our interceptors, though: as soon as any code segment attempts to invoke a sensitive method, Sandworm will capture that call and be able to allow or deny access.