teleren/devto huggingface dataset:
How much does it cost to build an app
Tags: reactnative, cost
Published: 2022-09-08 18:39:53

Let me show you how much it costs to build an app.

Recently I built an app called [PreCloud: Encrypt before upload](https://www.peng.kiwi/precloud), with which you can encrypt texts and files, then you can upload the encrypted texts and files to wherever you want, making any cloud provider an encrypted storage. It's free and open source. Give it a try :)

---

The app is free and open sourced, but these are what I paid for:
Google developer account: 25$ one time;
Apple developer account: 99$ / year;
Domain name (peng.kiwi): 12$ / year;

And I need a Mac to build the iOS app, but I am using the Mac from work, so I wouldn't count this.
And of course, all the time I spent on this.

:)

---

If you are interested, try the app, to protect your privacy.
[Play store](https://play.google.com/store/apps/details?id=com.precloud) 
[App store](https://apps.apple.com/us/app/precloud/id1638793841)

---

And you can also support me ❤️
https://paypal.me/penghuili/
Perimeters of squares in a rectangle
Tags: beginners, javascript, programming, algorithms
Published: 2022-09-08 18:34:02

In the following image (you should zoom in if the screenshot isn't clearer to you), you can see the problem description and what the input and output are supposed to be.

![Problem description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8lf4bh6lwphr13ai4hs8.jpg)

The input would be an integer and you have to calculate the sum of the perimeters of all the squares in a rectangle when there are n + 1 squares disposed in the same manner as shown in the following image - 

![Fibonacci Square Example screenshot](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/l38v0q1y3sl7m75tepe2.jpg)

Above image has 6 squares which are fitted in a very unique manner. The sides of squares seem random at first glance but in reality, it is something that most noob coders also know - **Fibonacci Sequence**.

Notice the side of innermost circle is 1 and the progressing squares' sides are 1, 2, 3, 5, 8.

> 1, 1, 2, 3, 5, 8

In case you don't know, what Fibonacci sequence is - The Fibonacci sequence is the sequence in which each number is the sum of the two preceding ones. - [Wikipedia](https://en.wikipedia.org/wiki/Fibonacci_number)

Approach:
- Create a function which generates sum of 'n+1' Fibonacci numbers where 'n' is the input
- Multiply it by 4 to calculate the perimeter of resulting sum

Algorithm:
- The following function calculates the sum of 'n+1' fibonacci numbers

```
function fib(num) {
  let a=1;
  let b=1;
  let s=0;
  if(num===0) 
    return 1;
  while(num>1) {
    let c=a+b;
    s+=c;
    a=b;
    b=c;
    num-=1;
  }
  return s+2;
} 
```

This function takes a number 'num' as an input;
- The first two lines of 'fib()' function initializes and assign the first two Fibonacci numbers;
```
let a=1;
let b=1;
```
- Line 3 mentions 's' variable which stores the sum of 'num+1' Fibonacci numbers;
`let s=0;`
- Line 4-5: When input is 0, we return 1 as for input '0', num+1 number would be 1;
```
if(num===0) 
    return 1;
```
- Line 6-12: This block mentions a 'while()' loop as it would run until we add the required Fibonacci numbers which would Fibonacci sequence - 2 as the loop would run for num-2 times. Are you confused, don't be? I have noob coding writing skills :)
```
while(num>1) {
    let c=a+b;
    s+=c;
    a=b;
    b=c;
    num-=1;
  }
```
The loop would run num-2 times as we have already initialized and declared the first two numbers of Fibonacci sequence mentioned in line 1-2;
- We would return s+2 in last line of 'fib()' function because we ignored the first two numbers of Fibonacci sequence and calulated the sum of only the remaining Fibonacci numbers in 'while' loop;
`return s+2;`

- Now in the end, print the perimeter of sum of 'n+1' squares by multiplying 4 to the output of 'fib()' function as the output on the console/prompt screen.
`console.log( 4*fib(n));
`

This problem uses the concept of fibonacci numbers generation and a little bit of basic maths (e.g. formula for perimeter of a square).
[Desafio] - Contador de Visitas Estilo Anos 2000
Published: 2022-09-08 17:13:56

> Conteúdo original em https://twitter.com/zanfranceschi/status/1567923524022730752

---

Ei dev,

Se você curte coisas vintage, pega esse desafio:

FAZER UM CONTADOR DE ACESSOS PRA UMA PÁGINA WEB!

A @proxy_go me deu essa ideia sem querer quando entendi errado um tweet dela 🥲

Cola aqui pros detalhes.

cc @sseraphini

↓

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

---

Antigamente, era quase que obrigatório ter um contador de acessos no seu site! rsrs

O desafio maior aqui é não permitir o incremento do contador se a pessoa acessar e ficar dando F5, por exemplo. O que vc poderia usar para não deixar isso acontecer? O IP, um cookie, o que?

---

E pra ficar completo o desafio, você precisa usar um estilo bem anos 2000, tá?

Tá aqui o tweet que inspirou esse desafio 👇

https://twitter.com/zanfranceschi/status/1567910992108986372
Get the Current User of web application using Java
Published: 2022-09-08 17:36:04

Good Day,

I have a web application deployed on Linux server, and I need to get logged in user (current windows user).
I used System.getProperty("user.name") but it gets the os user name for the server not the client.
Also, I used request.getRemoteUser() and it returns null.
Is there any another way? I am stuck in this issue for a long time.
Thank you.
BABY STEPS INTO THE AWS CLOUD
Tags: aws, beginners, productivity, cloud
Published: 2022-09-08 17:17:59

This is gonna be my first post. To say I'm excited would be an overstatement. This is probably coz I have no idea what to write about but baby steps we say, so let's do this.

I am Pauline, a tech enthusiast and I am very passionate about cloud computing, especially AWS cloud. Not because I have tasted all the options available and settled with AWS as my favorite. It's coz this was my first cloud and oops! someone just fell in love.

My cloud journey has been amazing, started with Azubi Africa where I got introduced to the cloud journey. I was enrolled to the AWS re-start program for the first Kenyan cohort. Being a newbie in IT at the time, trust me the journey wasn't that easy. The best part  about The restart program is diversity. You not only focus on the AWS Cloud fundamentals but also get introduced to Linux, Python, Networking, Security and Databases. This laid a great foundation for me to later on understand the stuff cooking behind the kitchen doors of the AWS cloud. I definitely recommend the program for anyone who would like to launch a cloud career but doesn't know how to get started. Visit [Azubi Africa] 
 (https://www.azubiafrica.org/cloud-track) for more information about the program.

After 3 intense months in the program I finally certified as a cloud practitioner and I was hungry for more. I had a clear view of where I wanted to be career-wise at the moment. So I decided to do the Solution's Architect course still under Azubi Africa. At the same time I landed a contract as a Junior Trainer to train my successors in the program. Training comes with lots of learning and while doing my CSA I got a deep dive on the Well architected framework and learn a lot. Still working as a trainer and parsing knowledge has this fulfilment that comes with it. Feels great to witness students pass their certification exams and launch better cloud careers. 

Focused on training for a while and decided why not try the Developer associate certification. This is where my love for server-less technology grew. Plus since I wanna be a Dev-ops engineer, definitely that is the path I had to take. The Developer Associate certification was an eye opener to me on how to actually build applications on AWS but most importantly focus on Server-less. Aced the certification like A week ago and I'm now putting in work to work on some open source projects, do lot's of hand's on labs in order to improve my technical skills.

It's been an Year now, working and learning on AWS but still there is a lot of work to be done...... There are my baby steps into the cloud and cheers to growing wiser and advancing our knowledge and skills. 

End of story...... till next time
Fall in love with local development - k3d
Tags: devops, cloudnative, kubernetes
Published: 2022-09-08 17:08:42

Let's get motivated first. **3 node Kubernetes cluster** up and running from scratch in **less than a minute**? Wow!!

Isn't it amazing? And it's real. Feel it first.

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

Developers crave faster and more accurate feedback on quick and dirty changes. It is too late if one has to wait for a few minutes before it fails. For a cloud-native development team, it is common to make development machine no similar to their production cloud environment. 

In cloud if you are using kubernetes as platform why don't you make and use a local kubernetes cluster too? With [k3d](https://k3d.io/v5.4.6/) it's no more a hefty task. No **minikube** but **k3d**. Cause it's fast, it supports multi node cluster, it's footprints are only docker images so clean setup-destroy and there are nice integration with other development tools like [tilt](https://tilt.dev/) VScode etc.

Just make sure you have docker installed in your system and follow [this](https://k3d.io/v5.4.6/#install-script) link to install k3d.

Install a single master and 2 worker nodes k8s cluster using `k3d cluster create -s 1 -a 2`

Just make an entry in the **makefile** to create a simple cluster or keep a [config.yaml](https://github.com/k3d-io/k3d-demo/blob/main/assets/k3d-config.yaml) in your repo to bootstrap your cluster with custom configurations.

Happy coding!!
Headless CMS: 6 best practices to boost value generation, reduce risks and accelerate time-to-market
Tags: headlesscms, webdev, cms, architecture
Published: 2022-09-08 17:07:42

To the point:

**1.** To avoid vendor lock-in, use a composable architecture with proper layers to isolate the core business. It will reduce common SaaS vendor risks, allow scalability, and better cost control in the mid & long term.

**2.** For small sites, static site generators (SSG) combined with deployments using content delivery networks (CDN) will provide the best performance and time-to-market strategy. For larger sites and eCommerce, the strategy is likely to require a solution based on cache and server-side rendering (SSR); which can be further improved with edge computing.

**3.** Mobile apps must use a local-cache-first strategy for content. For high-risk content, a time-to-live approach can be adopted to enforce compliance. I have seen many projects trying other approaches and failing to keep time-to-market at a competitive pace, to the point re-engineering was put back in the backlog.

**4.** In general, a separate vendor for media management is recommended. The SaaS offering is vast and offers specialization capabilities that will help teams to optimize performance and compliance. They also offer out-of-box integrations with the main headless CMS solutions.

**5.** eCommerce with a simple catalog or with a small set of SKUs can be implemented using the headless CMS solution. However, keep in mind that specialized headless e-commerce platforms provide built-in solutions for payments and shipping. Other capabilities like subscriptions, bookings, or digital assets will require a deeper evaluation of the strategy.

**6.** Adopt infra-as-code and content-model-as-code; it will prevent common bugs, enable continuous delivery and accelerate time-to-market.

I'm curious to learn from you. What are the challenges preventing your organization to adopt a headless CMS solution?
What's the Future of PHP?
Tags: discuss, webdev, php, javascript
Published: 2022-09-08 16:57:52

A significant portion of the web is still [powered](https://kinsta.com/php-market-share/) by PHP, and much of this is bssically WordPress.

However, we are gradually seeing WordPress morphing into a Javascript platform as this video [confirms](https://youtu.be/baZVmW_F8C8).

Where do you think PHP is headed? If WordPress fully becomes a Javascript platform what will happen to PHP?

Let's discuss.
How do i know what`s right!
Published: 2022-09-08 16:56:25

We have embarked into a journey to build an omni-commerce experience for our customers, and to get us there are our developers.

But how do i know what to built and if thats what everyone want?? Guess, i need to talk to folks to get that insights. Who else can help me better than you, so i would like to talk to you about your experience as a #commerce #appdeveloper, #integrator, #entrepreneur on what you desire the most in a commerce platform, the docs or the usability, the scalability or sandbox..
I would like to hear from you in a 1:1 discussion on your experience working with tools and dashboards. If you have used commerce APIs or other back end tools in the past 12 months, pls dm me here or email usability@godaddy.com. Your time is very valuable, you will be compensated for your time. Thanks guys.. looking forward to learn from you..#help
100DaysOfCode: Day 04, UI Design with Knott JS + Weavv CSS
Tags: javascript, css, webcomponents
Published: 2022-09-08 16:26:14


![Image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/i5ez3oo5gbxd1dqzo37w.png)
![Image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/60aoijvz4nbtr3xu9okq.png)

{% stackblitz https://stackblitz.com/edit/node-d1ohqx?embed=1&file=app/app.js&theme=dark %}

{% github https://github.com/louislow81/100DaysOfCode %}
{% github https://github.com/louislow81/knott.js %}
{% github https://github.com/weavv/weavv-css-documentation %}

---

Enjoy!
kafka安装
Published: 2022-09-08 16:40:05

## 
一、安装
```
$ tar -xzvf kafka_2.13-3.2.1.tgz
$ cd kafka_2.13-3.2.1
$ cd config
```

## 
二、修改配置: server.properties
```
broker.id=0
advertised.listeners=PLAINTEXT://127.0.0.1:9092
num.network.threads=3
num.io.threads=8
socket.send.buffer.bytes=102400
socket.receive.buffer.bytes=102400
socket.request.max.bytes=104857600
# 日志存储地址
log.dirs=/Users/ted/software/kafka_2.13-3.2.1/kafka-logs
num.partitions=1
num.recovery.threads.per.data.dir=1
offsets.topic.replication.factor=1
transaction.state.log.replication.factor=1
transaction.state.log.min.isr=1
log.retention.hours=168
log.segment.bytes=1073741824
log.retention.check.interval.ms=300000
# zookeeper地址
zookeeper.connect=127.0.0.1:2181
zookeeper.connection.timeout.ms=18000
group.initial.rebalance.delay.ms=0
```

## 
三、命令
```
# 启动
$ kafka-server-start.sh -daemon ./server.properties
# 创建topic
$ kafka-topics.sh --create --bootstrap-server localhost:9092 --topic first-topic --partitions 1 --replication-factor 1
# 查看topic list
$ kafka-topics.sh --bootstrap-server localhost:9092 --list
# 查看topic具体信息
$ kafka-topics.sh --bootstrap-server localhost:9092 --topic first-topic --describe
# 修改topic的partitions
$ kafka-topics.sh --bootstrap-server localhost:9092 --alter --topic first-topic --partitions 2
# 删除topic
$ kafka-topics.sh --bootstrap-server localhost:9092 --delete --topic first-topic
# produce 
$ kafka-console-producer.sh --topic first-topic --broker-list localhost:9092
# consume
$ kafka-console-consumer.sh --topic first-topic --bootstrap-server localhost:9092
$ kafka-console-consumer.sh --topic first-topic --bootstrap-server localhost:9092 --from-beginning

```
Install Magisk
Published: 2022-09-08 16:32:00

Every when I need to update my LineageOS, I lost my root access with Magisk and need to do a list of steps to solve the problem.

Install Magisk apk: https://github.com/topjohnwu/Magisk/releases/latest
More details: https://www.xda-developers.com/how-to-install-magisk/

Follow the list:

* Download the `recovery.img` of your room.

    Example: https://download.lineage.microg.org/alioth/
* Copy `recovery-alioth.img` to phone;

    I used the follow commant to do this:
    ```
    adb push lineage-18.1-20211127-recovery-alioth.img \
             /sdcard/Download/alioth.img
    ```
* Open Magisk app and select Install for Magisk near the top
* Use '_Select and Patch a File_' method, finding and selecting the `alioth.img` file
* Click LET'S GO and let it finish.
* Retrieve the image from the phone; I used:

   ```
   adb pull /sdcard/Download/magisk_patched-[random-strings].img \
            ~/patchedboot.img'
   ```
* Reboot phone to bootloader by running:

    ```
    adb reboot bootloader
    ```
* Flash patched image via:

    ```
    fastboot flash boot ~/patchedboot.img
    ```
* Reboot into system via:
    ```
    fastboot reboot
    ```
Whatsapp Client failing during increase in TPS
Tags: whatsapp
Published: 2022-09-08 16:23:21

Hi Whatsapp Dev community

As part of sending messages to customers using Whatsapp business API.
API:
{ALB}/v1/messages.

The APIS are behaving fine while hitting at 20 TPS.
But in case we are increasing the TPS to 30 TPS the APIS are failing with error code 503 status code.

connect type : multi-connect using AWS cloudformation script.

Error code : 1016.

Error Message : 
Whatsapp client System overloaded due to job queue size.

Even after using multi connect cluster with 5 nodes of instance type C5x.large it sis till giving the same error.

Have you guys faced any such issue.
Also if possible kindly share the AWS Cloudformation script to setup whatsapp client or share the details of docker machine, RDS, EFS and their hardware configuration for TPS higher than 70 messages per second.

We are currently stuck in scaling the system due to this so please help.
What is a Developer Control Plane, and why should you adopt it?
Tags: dx, devops, startup, productivity
Published: 2022-09-08 16:12:47

Hey, devs!

How do you feel when you have to learn many tools and concepts for the infrastructure side, like Kubernetes, Cloud management, and networking?

The DevOps journey can be tough, especially for those who like coding and developing application architecture.

The DevOps roadmap it's pretty similar to something like that:

1 - Programming Language
2 - OS concepts (server administration)
3 - Software Configuration and Deployment process
4 - Infrastructure as Code
5 - CI/CD pipelines
6 - Networking and Security
7 - Automation, monitoring, and troubleshooting
8 - Cloud Providers
9 - Services

You can find all of that easily over the internet when you google it.

This pathway can frustrate senior developers who just want to code or startups that want to scale quickly and need to hire more and more DevOps engineers to take care of the infrastructure and DevOps side.

Nothing wrong with having that knowledge already; that's actually really awesome! But what if you could use your programming skills to improve the infrastructure side of your app and make DevOps and Infrastructure manageable?

## The purpose

The CTO.ai's Developer Control Plane proposes to make it easy to deliver new features with just a couple of steps, promote a good developer experience, where developers can benefit themselves with Slack and GitHub integrations or just adapt the developer's workflow to the terminal screen.

Of course, there are more features that you can use to increase your productivity and measure your performance with delivery.

## And why should a dev or startup adopt it?

Implementing a Developer Control Plane can increase 200x time in the software's delivery + enable dev teams to measure their delivery performance. In the meantime, developers won't need to learn many other tools or switch the field to become DevOps engineers if that's not what they wish to do.

To help devs and startups to understand in deep how a Developer Control Plane works, I invite you to come to our webinar, happening on September 14th, at 12 PM PST. You can [subscribe at this link](https://register.gotowebinar.com/register/2592040813674185998).

We would love to chat to learn from your experience and share what we know so that we can help you to increase your skills.
Congratulations to Nimbl'bot: Use case contest by Luos
Published: 2022-09-08 15:47:07

🎉 Nimbl'bot won with three other companies the contest organized for creating and sending their use case using Luos technology!

Nimbl'bot is developing a revolutionary biomimetic robotic architecture advocating agility and precision. Motivated by an ambition of agility, Nimbl'Bot French company relies on Luos engine and Luos bootloader to ensure its development.

😏 You too, start and send us your projects, you could be the next one!
1.RecyclerView in kotlin
Published: 2022-09-08 15:30:36

1.First we have to add dependency in build.gradle of app or module Folder .

dependencies {
implementation 'androidx.recyclerview:recyclerview:1.2.0'
}

2.Then we have to use RecyclerView Widget from androidx.widget.recyclerview.

3.Create RecyclerView items .
4.Make Adapter class to inflate Recycler items.
5.Then set Adapter on the required screen.
How to type Next.js env variables in TypeScript
Tags: typescript, todayilearned, nextjs
Published: 2022-09-08 15:44:43

---
title: How to type Next.js env variables in TypeScript
published: true
date: 2022-09-08 15:26:20 UTC
tags: typescript,til,nextjs
canonical_url: https://krzysztofzuraw.com/2022/how-to-type-next-js-env-variables-in-typescript/
---

I recently was setting up new Next.js project with environmental variables. Next supports them out of the box I wanted a bit more typing than `string | undefined`. I couldn't find it easily on Google so I created this post.

First create `env.d.ts` in root of your repository with environmental variables keys

```ts
namespace NodeJS {
  interface ProcessEnv {
    NEXT_PUBLIC_SUPABASE_URL: string;
    NEXT_PUBLIC_SUPABASE_ANON_KEY: string;
  }
}
```

Second add `env.d.ts` to `tsconfig.json`:

```json
{
  "compilerOptions": {
    // options are here
  },
  "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", "env.d.ts"] // see the last entry in array
}
```
Mobile app theming
Tags: reactnative, design, storybook, theme
Published: 2022-09-08 15:24:07

**Hey everyone!**

I am working on a mobile app and would like to completely rework the theming. Do you have any advice? Any repos that I can look at that are doing a really good job with this? 

We are currently using [react-native-paper](https://callstack.github.io/react-native-paper/) but the elements there are not fully accessible. 

Do you recommend using [storybook](https://storybook.js.org/tutorials/intro-to-storybook/react-native/en/get-started/)? 

How do you deal with your light/dark theme and styling in general?