teleren/devto huggingface dataset:
Java find how many character repeating in a string
Published: 2023-10-10 21:41:33

How to find how many characters are repeating in a string.

```java
@Test
void anotherQ() {
    // Q1 -- given a String like aaabbbcccaa need to return output like a3b3c3a2.
    String input = "aaabbbcccazzdddxx";
    char[] arr = input.toCharArray();

    for (int i = 0; i < arr.length; i++) {
        char c = arr[i];
        int charCounter = 1;
        System.out.print(c);
        while (i + 1 < arr.length && c == arr[i + 1]) {
            charCounter++;
            i++;
        }
        System.out.print(charCounter);
    }

    System.out.println("\n" + transformString(input));
}

public static String transformString(String input) {
    if (input == null || input.isEmpty()) {
        return input;
    }

    StringBuilder result = new StringBuilder();
    int count = 1;
    char currentChar = input.charAt(0);

    for (int i = 1; i < input.length(); i++) {
        char c = input.charAt(i);
        if (c == currentChar) {
            count++;
        } else {
            result.append(currentChar).append(count);
            count = 1;
            currentChar = c;
        }
    }

    result.append(currentChar).append(count);
    return result.toString();
}

```

The output is “a3b3c3a1z2d3x2” find the working code [here](https://github.com/ozkanpakdil/swaggerific/blob/main/src/test/java/com/mascix/swaggerific/algorithms/FindhighestAverage.java#L38) for full working example.
Error handling in Express Server - NodeJS
Tags: node, express, typescript, javascript
Published: 2023-10-10 21:25:11

When you want to develop a backend app using Node.js and Express as frameworks for server building, you must have a way to handle the errors that could occur during a service execution.
One way to prevent unhandled errors or non-execution responses is by using the middleware functions that Express allows us to use. Here is an example of how to catch and return a server response:

- As a good practice normalize ur server response structures: 

![Common Http Server Response Interface](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3n6zjry1grto4xtfl5vv.png)

![Error Http Server Response Interface](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/j7lqh718yptg30553p8e.png)

- Once u have created interfaces for define ur server response object u have to create classes thath extends from Error native class for representing possible server errors

![Common Http Error Exception Class](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/txs3sgxw47ph7u06x3ls.png)

![ResourceNotFound Exception Class](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/lazt9nlwris93aziy2c2.png)

All errors in Node.js extend from the Error class. This allows you to create a custom error class, extend from it, and use reserved keys like 'throw' for throwing your custom errors. Now, you have to create the middleware function to use.

![Http Error Middleware](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/zza6432nxnlgnid9d5oa.png)

- Once you have your middleware function defined it's time to pass it to express 


![Middleware use setting](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ee191wmp9n7tss2inebj.png)

To handle errors in your server application, you need to use the 'next' function from Express, as demonstrated below:

![Http Error Middleware use](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/dkb4ydfz5lh4cdkvkodi.png)

Example response:

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

This is just a way to handle possible server custom errors, this example were made with Typescript.
Etiquetas Básicas en Html
Published: 2023-10-10 21:25:07

Un saludo Devs! He creado mi Web y dentro de ella he creado una parte de [Curso de Html Básico](https://jz-crew.com/cursos/curso-html/curso-html-basico/) donde pongo las etiquetas html básicas para entender el lenguaje html, espero que sirva a alguien!
Rants of a Beginner Techie 4
Tags: beginners, programming, codenewbie, development
Published: 2023-10-10 20:59:41

Hey there, it's Gold Agbonifo Isaac, your self-proclaimed number one fan, even though I have no clue who you are! Welcome back to the "Rants of a Beginner Techie" series, where I'm here to share my joys, pains, struggles, and whatever else comes to mind. Frankly, I'm having a blast doing it!

Just like always, I don't have a strict plan or a fixed idea in mind when I start writing these articles. It all just flows out as I let my thoughts pour onto the page. That's what makes it a rant, after all, isn't it?

It's easy to lose sight of why you started something, who you are, and even your own mental well-being when you get caught up in comparing yourself to others, especially on social media. I used to be guilty of that, too, until very recently. Let me tell you why you should stop it right now.

In the words of wisdom, "YOU'LL DESTROY THE LITTLE SANITY OR ANY SANITY YOU HAVE LEFT!!" Comparing yourself to others is a slow and insidious poison that can leave you with nothing but depression and constant fear gnawing at your soul.

I've had to distance myself from that toxic space by cutting back on content that makes me feel like I'm lagging behind or wasting my time. It's tough, and it seriously crimps my productivity. Trust me, if I were you, I'd avoid it like the plague!

On a brighter note, my first portfolio project is coming together, albeit at a snail's pace. But I'm genuinely proud of all the lessons I'm learning along the way. I'm in no hurry to just build and showcase something I'm not genuinely proud of. I want to burst with pride when I finally complete my project!

Now, let's talk about some of those tech influencers out there. They can really get on your nerves with their do's and don'ts, especially when they're talking about stuff they've never tried themselves. They treat it as though it were "textbook wisdom" and try to cash in on newbie techies. From what I've learned so far, the best strategy is to simply ignore people like that. They tend to pile on unnecessary pressure and stress, and I can't stand it.

Yes, there are some folks out there genuinely trying to help you grow, but sadly, they are few and far between. We, you and I, need to be discerning and not fall into the trap of influencers who are just trying to hawk their products and boost their social media presence. Being a beginner developer doesn't make you or me a fool. We're on our own unique journeys, and we'll make our impact in our own ways!

And with that, my fantastic readers, we've reached the end of today's episode. Join me next time for another exciting episode of "RANTS OF A BEGINNER TECHIE." Feel free to drop a comment or reaction if you're enjoying my series. P.S. I'm really digging this whole series thing, and I'm considering starting one on web development from scratch. I promise it'll be more beginner-friendly than any other web development series out there! Let me know what you think of my idea.

You can also follow me on ![https://twitter.com/Golden_builds](https://twitter.com/Golden_builds).
ROOT DETECTION IN ANDROID SOLUTION ?
Tags: rootdetection, android, androidvulnerability, androiddev
Published: 2023-10-10 20:57:00

Hi everyone, my name is Khalid and I am Android dev. Currently facing problem regarding root detection due to security purpose. I have tried implementing different solutions available but all of them fails when magisk hide is applied, I have tried with RootBear, Rootbear fresh Libraries available but still not succeeded.Many banking apps are detecting root. Can someone share any technique that can be useful to detect root.any help or though is appreciated.
#rootDetection
What's Hydration in SSR?
Tags: javascript, tutorial, webdev
Published: 2023-10-10 20:45:39

## Introduction
On this post I will try to explain in a few words what's hydration and why is it important.

## Server Side Rendering
Server Side Rendering difference it self from Static site generation since "SSR" means per-request rendering as opposed to build-time rendering.
Static rendering happens on the server-side too, but at build-time.
Dynamic rendering on the other hand happens at server-side but at request time.

## Hydration
Hydration is what let's the server side rendered component to be able to access client-side interactive tools, such as forms, buttons, etc.
Without the hydration we will just have a plain static page.

## Conclusion
Hydration helps the ssr components to interact with the user.
We have developed FreeIcons, our open-source free icons project
Published: 2023-10-10 20:36:15

A few months ago, we launched FreeIcons ([freeicons.org](https://www.freeicons.org/)), a website for finding and downloading open-source free icons.

Our goal was to create a website that brings together the best sets of open-source vector icons for commercial use. We want designers and developers to be able to work on projects with high-quality free icons.

For development, we've used Laravel for back-end, Bootstrap in front-end, and Typesense as the search engine.

The hosting is currently on an affordable virtual server, and it's performing wonderfully so far. As our traffic grows, we'll conduct performance tests to assess potential server improvements or a migration to AWS.

We'd love to receive opinions and feedback from the DEV community to continue improving the website. Thanks!
NST BROWSER : FREE ANTI DETECT
Tags: antidetect, antidetectbrowser, undetectbrowse
Published: 2023-10-10 19:56:58

# Exploring NST Browser: A Tool for Multi-Accounting Professionals

[NST Browser](https://www.nstbrowser.io/) is an all-in-one anti-detect browser designed for multi-accounting professionals. With a range of automated features, it simplifies the process of managing multiple online accounts, making it a valuable tool for digital marketers, e-commerce professionals, and others who require multi-profile access.

## Features

### Browser Fingerprinting
NST Browser offers advanced browser fingerprinting technology to help create profiles that mimic real human behavior, making multi-accounting seamless and undetectable.

### Captcha Solver
The integrated Captcha Solver utilizes AI technology to automatically solve CAPTCHAs, ensuring smooth interactions across various profiles.

### Proxy Rotation
With the automatic proxy pool rotation feature, NST Browser identifies the most effective proxy for a given target, optimizing the browsing experience.

### SDK API
NST Browser supports automation through its SDK API, making it compatible with libraries like Puppeteer, Selenium, among others.

### Multi Profiles
Manage multiple platforms and accounts effortlessly on a single device with the Multi Profiles feature.

## Applications
NST Browser is ideal for a variety of multi-accounting tasks such as:

- Competitor research
- Ad verification
- Automation on platforms like Google, Facebook, eBay, and Amazon

## Pricing
NST Browser offers a free version, along with professional, business, and enterprise plans to cater to different user needs.

Discover more about NST Browser and how it can streamline your multi-accounting tasks by visiting their [official website](https://www.nstbrowser.io/).
React Structure Missteps: Refining My Message Center
Tags: react, productivity, learning, architecture
Published: 2023-10-10 19:48:46

Building a React email client initially seemed straightforward. I started with a basic structure, thinking it would be ideal for a tutorial. But as I integrated more features and aimed to incorporate [DataMotion](https://datamotion.com/?utm_campaign=dev-blog&utm_source=dev-to)'s APIs, the limitations of my initial setup surfaced. The project demanded a more organized structure to accommodate its expanding scope.

## The Initial Structure

Here's where I started:

```
src/
│
│── assets/
│    └── Logo.png
│── components/
│    ├── Inbox.js
│    ├── Navbar.js
│    └── Sidebar.js
│── App.css
│── App.js  
│── index.css     
│── index.js 
│── reportWebVitals.js
```

While this structure served its purpose initially, its limitations became evident as I added more functionality. 

![Overwhelmed-GIF](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/jfe39y22tfi7cmjr147x.gif) 

Diving deeper into this structure for a tutorial would have shifted the focus from the primary objective: demonstrating the integration of the [Secure Message Center](https://datamotion.com/portal/project/DataMotion/dashboard?utm_campaign=dev-blog&utm_source=dev-to) APIs.

## The Restructuring

To make the project more maintainable, I shifted to:

```
src/
│
│── assets/
│    └── Logo.png
│
│── inbox-features/
│    └── components / 
│            ├── ComposeModal.js
│            ├── InboxHeader.js
│            └── OpenModal.js
│    └── message-lists / 
│            ├── DraftList.js
│            ├── InboxList.js
│            ├── SentList.js
│            ├── TrackSent.js
│            └── TrashList.js
│── shared / 
│     ├── App.css
│     ├── Navbar.js
│     └── Sidebar.js     
│── App.js       
│── index.js 
│── reportWebVitals.js
```

This modular design made it easier to find components, reduced repetitive code, and improved the project's maintainability. Grouping related components and features provided a clear overview of the project's structure.

![Much-Better-GIF](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/uacr4eg0kg2pb2uffilt.gif)

## Takeaways:

- **Stay Modular**: Grouping related components into specific folders enhances clarity.
- **Reuse Components**: A `shared` directory for universal components minimizes redundancy.
- **Stay Adaptable**: As projects evolve, so do their requirements. Flexibility in approach is paramount.

## Conclusion

In development, sometimes the path you start on isn't the one you finish with. Being open to change and restructuring, especially when it leads to a more efficient project, is essential. For those interested in seeing the changes in action, check out the updated files on [GitHub](https://github.com/janellephalon/updated-smcAPI-starter-files).

> Have you faced similar challenges in your projects? How did you tackle them? Share your experiences and opinions in the comments below. Let's learn and grow together!
Career advice
Published: 2023-10-10 19:48:27

Aspiring software engineers, have you ever wondered if coding in your free time counts as experience in the industry? Well, let me share my experience with you. I have been pursuing a software engineering degree, coding in my free time, building projects, and writing tech blogs for almost two years now. However, some companies and startups require a certain amount of experience. So, the question is, does my self-taught experience count? What do you think? Let's discuss in the comments below!
Astro: 10 Minute Docs Audit
Tags: docsaudits, javascript, webdev, documentation
Published: 2023-10-10 19:24:05

[Astro](https://docs.astro.build/en/getting-started/) is a front-end framework. It hasn't been around for a long time, but Astro has a very dedicated community. Astro also puts a special focus on developer documentation and education. 

{% embed https://youtu.be/yW-1g4eSlpg %}


## What's The Criteria?
3- Excellent
2 - OK
1 - Poor

**Purposeful:** Does the QuickStart explain what problem it's trying to solve? Who is the intended audience?

**UX Experience:** How seamless is the experience? Must the user create an account to get through the Quickstart? Does the Quickstart elicit a sense of joy and achievement?

**Accurate:** Are the instructions correct? Are they complete?

## The Results

It took me a little over 6 minutes to create a working app, and I had some spare time to tinker with the code base. I was skeptical about launching the Hello World app in the browser, but it turned out to be a good and satisfying experience. That being said, it wasn't obvious how I could fork or download the code base.


Finally, what the heck is the .astro extension all about? What exactly is a [component island](https://docs.astro.build/en/concepts/islands/)? In layperson's terms, what does it mean to have zero JS runtime overhead? Astro threw a bunch of concepts at the reader without entirely unpacking them in a way that the user can get on board with Astro's feature set. Astro was snappy and fast, but was that because of the Zero JS, the component islands, or the astro extension?


|               | Score |
|---------------|-------|
| Purposeful    | 2     |
| UX Experience | 2.5     |
| Accurate      | 3     |

Are you interested in a FREE Quickstart audit for your company? [Start here](https://forms.gle/5jDeuQraBwahkjT16).
Primeiros passos em Java
Tags: java, webdev, beginners, programming
Published: 2023-10-10 19:21:15

# O processo por trás

Existem 5 fases pelo qual o programa Java precisa passar para rodar sua instrução, sendo elas: **Edição, Compilação, Verificação e Execução.**

**Edição**: Criamos um arquivo em uma IDE (Intellij, Eclipse, Netbeans etc), escrevemos nosso código em Java e em seguida o salvamos como .java no armazenamento secundário (hd do computador). 

**Compilação**: Ao compilar transformamos o código .java em .class, basicamente o compilador transforma o arquivo em bytecodes no qual o JVM (Java Virtual Machine) é capaz de ler.

**Verificação**: O verificador de bytecode confirma que todos os bytecodes estão validos e não será violado restrições de segurança do Java.

**Execução**: A JVM lê os bytecodes e compila no momento correto, o famoso (Just In Time- JIT) para que o computador possa entender.

## A Estrutura do HelloWorld 

```java 
class HelloWorld {
	public static void main (String[] args) {
		System.out.println("Hello World!");
		}
}
```

Podemos dizer que temos 2 componentes, nossa definição de classe e o main método.

- **Class**: Declaração das classes
- **HelloWorld**: Nome da classe
- **public**: Modificador de acesso do método
- **void**: Tipo de retorno do método


## Definição de classe

```java 
class HelloWorld { 
}
```

## Main método 
Na linguagem de programação java toda aplicação deve conter um main método, e seguir essa assinatura
- Algo curioso é que os modificadores de acesso podem ser escritos em qualquer ordem, porem a convenção é usar public static, nos argumentos podemos nomear como quiser, mas sempre é definido como args ou argv.
- O main método ele aceita o argumento, que é uma array com elementos do tipo String, matriz na qual o sistema de tempo de execução passa informações para o app.

```java
public static void main(String[] args) {  
...  
}
```

## Saída de dados
É usado a System da biblioteca principal para imprimir o "Hello World", biblioteca essa também conhecida como Application Programming Interface ou API.

### Resources 
https://www.youtube.com/watch?v=LnORjqZUMIQ&list=PLGxZ4Rq3BOBq0KXHsp5J3PxyFaBIXVs3r
https://dev.to/herculesdevbr/hello-world-um-pouco-por-tras-dos-panos-26ke
🚀 Humble Python Print Statement Helped Find Memory Leak 🐍
Tags: python, fastapi, memoryleak, programming
Published: 2023-10-10 19:18:07

Here's a quirky story from my coding journey that might just save your next Python project! Let me take you through the rollercoaster 👇

1. **The Unusual Suspect:**
While working on a project, I noticed a peculiar memory behavior. To my surprise, adding a simple print statement led to an unexpected memory release, almost halving the usage!

2. **The Deep Dive:**
Curiosity piqued, I delved deeper. While print itself isn't a memory manager, its introduction can change the flow or timing, affecting memory behavior indirectly.

3. **Enter del:**
My quest led me to the mighty del statement in Python. It became my memory-management savior, explicitly helping reclaim space and optimize my code.

4. **Lessons Learned:**
Variables, even when untouched, can hog memory. Tools like del, when used judiciously, can be game-changers.

Always be on the lookout! Sometimes, the most innocuous lines of code (like a print statement) can uncover deeper mysteries.

**🌟 Takeaway:**
Python, with all its elegance, can still spring surprises. Embrace the quirks, dive deep, and always be ready to learn. Fellow coders, have you had such serendipitous discoveries? Share your tales and let's learn together! 💪
Laravel Route Parameters: How to retrieve and use them
Tags: laravel, php
Published: 2023-10-10 19:14:55


In PHP Laravel, you can retrieve route parameters in several ways and in different places. Below, I'll provide you with code examples for each method:

- **Using the `Route` Facade:**
   You can use the `Route` facade to access route parameters. Here's an example:

   ```php
   $parameter = Route::current()->parameter('parameterName');
   ```

- **Using the `request` Object:**
   You can also retrieve route parameters using the `request` object's `route()` method:

   ```php
   $parameter = request()->route('parameterName');
   ```

- **Using Route Model Binding:**
   If you have defined route model binding in your routes or controllers, Laravel will automatically retrieve the model instance associated with the parameter. For example:

   ```php
   public function show(User $user) {
       // $user is an instance of the User model
   }
   ```

- **Using the `Route::input()` Method:**
   This method allows you to access route parameters directly:

   ```php
   $parameter = Route::input('parameterName');
   ```

- **Using Type-Hinting in Controller Methods:**
   You can type-hint parameters in controller methods, and Laravel will automatically resolve them:

   ```php
   public function show($parameterName) {
       // Laravel resolves $parameterName from the route parameter
   }
   ```

- **Using the `request()` Helper Function:**
   You can also use the `request()` helper function to retrieve route parameters:

   ```php
   $parameter = request('parameterName');
   ```


- **Using the `$request` Object direct parameter access:**
   You can also use the `$request->parameterName` directly to retrieve route parameters:

   ```php
   $parameter = $request->parameterName;
   ```

These are various ways to retrieve route parameters in Laravel, and you can choose the one that best fits your specific use case.