teleren/devto huggingface dataset:
Laços sem corpo em Java
Tags: java
Published: 2024-07-13 06:08:05

**Conceito**
- Em Java, um laço pode não ter um corpo associado, pois uma instrução nula é sintaticamente válida.

**Utilidade**
- Laços sem corpo podem ser usados para operações que são completamente tratadas na expressão do laço.

-Exemplo de laço sem corpo
- O exemplo abaixo soma os números de 1 a 5 usando um laço for sem corpo:

```
class Empty3 {
    public static void main(String args[]) {
        int i;
        int sum = 0;
        // soma os números até 5
        for (i = 1; i <= 5; sum += i++);
        System.out.println("Sum is " + sum);
    }
}

```

A saída do programa é: Sum is 15

**Análise do laço**

A soma é realizada completamente dentro da expressão do laço for.
A expressão de iteração sum += i++ faz a adição e o incremento de i:
sum += i++;

**Desmembrando a expressão**
- Essa expressão pode ser entendida como duas partes:
- sum = sum + i; - Adiciona i a sum.
i++; - Incrementa i.

**Importância**
- Instruções desse tipo são comuns em programas Java profissionais.
- Entender e desmembrar essas expressões facilita a compreensão do código.
O Laço for Melhorado
Tags: java
Published: 2024-07-13 06:11:44

**Conceito**
- O laço for melhorado, também conhecido como for-each, foi adicionado para facilitar a iteração sobre coleções e arrays.

**Utilidade**
- Permite percorrer de forma otimizada o conteúdo de arrays e coleções de objetos.

**Sintaxe**
- A sintaxe do laço for melhorado é:

```
for (tipo elemento : coleção) {
    // bloco de código
}

```
**Exemplo**
- Usando o laço for melhorado para iterar sobre um array de inteiros:

```
int[] numeros = {1, 2, 3, 4, 5};
for (int numero : numeros) {
    System.out.println(numero);
}

```

**Vantagens**
- Código mais limpo e legível.
- Menor probabilidade de erros de índice ao iterar sobre arrays.

**Discussão Adicional**
O laço for melhorado será discutido com mais detalhes no Capítulo 5, após a introdução aos arrays.
Lãi suất SOFR
Published: 2024-07-13 06:12:19

Bạn đã nghe về lãi suất SOFR chưa? Đây là một trong những chỉ số lãi suất quan trọng nhất đang thay thế LIBOR trên toàn cầu, mang lại sự minh bạch và đáng tin cậy cho thị trường tài chính. SOFR được tính toán từ các giao dịch thực tế trong thị trường repo qua đêm có bảo đảm, giúp giảm thiểu rủi ro thao túng lãi suất. Với sự ổn định và chính xác, SOFR đang trở thành công cụ không thể thiếu cho các nhà đầu tư và tổ chức tài chính. Hãy cùng tìm hiểu về SOFR để nắm bắt cơ hội đầu tư thông minh và an toàn hơn. Khám phá ngay để hiểu rõ hơn về cách lãi suất này có thể thay đổi cuộc chơi tài chính của bạn!

https://thuvienchungkhoan.vn/sofr-la-gi/
Time Attendance Systems in Corporate Offices offered by Tektronix Technologies in Dubai, Abu Dhabi and rest of the UAE
Tags: timeattendance, timemanagement, timetracker, technology
Published: 2024-07-13 06:14:56

The [time attendance system](https://tektronixllc.ae/time-attendance-system/) is a handy tool in technology which allows businesses to keep track of employee attendance and work hours easily. There is no need to rely on old manual processes or figuring out the meaning of messy time cards. The new systems transform the way businesses manage their employees.

**Tektronix Technologies: Time Attendance Solutions**

Tektronix Technologies offer a range of time attendance systems that are cutting-edge and specifically designed to satisfy the particular demands of corporate offices. If you're a start-up or a large corporation, Tektronix has got you equipped with the latest Time Attendance System.

**Importance of Time Attendance Systems in Corporate Offices

Efficient Workforce Management**

The ability to effectively manage your workforce is vital to every successful company. If you have a [reliable time-attendance](https://tektronixllc.ae/time-attendance-system/) program installed, offices can improve their scheduling of employees as well as track patterns of attendance and identify the areas in need of enhancement. 

**Enhanced Security and Access Control**

Today, security is of paramount importance. Time attendance systems will not only [track attendance of employees](https://tektronixllc.ae/time-attendance-system/) but it also improves security and control of access to the corporate office. Our Time Attendance Solution is integrated with Facial Recognition Technology as well as proximity card technology. With this, businesses can rest in peace of mind knowing that only authorized employees can access specific areas.
O Laço do-while em Java
Tags: java
Published: 2024-07-13 06:25:23

**Estrutura Geral**

O laço do-while executa as instruções pelo menos uma vez antes de verificar a condição.

A forma geral é:

```
do {
    instruções;
} while(condição);

```
**Diferença dos Laços for e while**
- Em for e while, a condição é verificada antes da execução do laço.
- Em do-while, a condição é verificada após a execução do laço, garantindo que ele execute pelo menos uma vez.

**Exemplo Simples**

Um programa que entra em laço até o usuário inserir a letra 'q':

```
// Demonstra o laço do-while.
class DWDemo {
    public static void main(String args[]) throws java.io.IOException {
        char ch;
        do {
            System.out.print("Press a key followed by ENTER: ");
            ch = (char) System.in.read(); // obtém um char
        } while(ch != 'q');
    }
}

```

**Jogo de Adivinhação Melhorado**

Um programa de adivinhação que entra em laço até o usuário adivinhar a letra correta:
ver Guess4.java

**Explicação do Programa de Adivinhação**
- O programa lê caracteres do usuário até que a letra correta seja adivinhada.
- Há dois laços do-while:
- O primeiro laço continua até o usuário adivinhar a letra correta.
- O segundo laço descarta caracteres extras do buffer de entrada até encontrar um \n (nova linha).

**Exemplo de Execução**

Execução típica do programa de adivinhação

```
I'm thinking of a letter between A and Z.
Can you guess it: A
...Sorry, you're too low
Try again!
I'm thinking of a letter between A and Z.
Can you guess it: Z
...Sorry, you're too high
Try again!
I'm thinking of a letter between A and Z.
Can you guess it: K
** Right **

```
**Detalhe Importante**
- A entrada do console é armazenada em um buffer de linha, então pressionar ENTER adiciona uma sequência de nova linha que precisa ser descartada.
- O segundo laço do-while remove caracteres extras do buffer para evitar leituras indesejadas.

**Conclusão**
- O laço do-while é útil quando você precisa garantir que o bloco de instruções seja executado pelo menos uma vez.
- Ele é especialmente prático para interações com o usuário onde uma ação inicial é necessária antes da verificação da condição.
What happens when you enter a domain name (e.g., google.com) into a browser?
Tags: dns, browser, internet
Published: 2024-07-14 05:46:54

Flow of Request for https://www.google.com

1. DNS Resolution:
 - Browser initiates DNS resolution to translate "www.google.com" to an IP address. Resolved IP address is returned.

2. TCP/IP Connection:
 - Browser establishes a TCP/IP connection with the web server's IP address on port 443 (HTTPS).

3. HTTPS/SSL Encryption:
 - Data between browser and server is encrypted via HTTPS/SSL. SSL handshake ensures secure communication.

4. Firewall Inspection:
 - Encrypted traffic passes through a firewall for security policy checks and threat protection.

5. Load Balancer:
 - Connection is routed through a load balancer for traffic distribution across multiple web servers.

6. Web Server:
 - Load balancer forwards the connection to a web server hosting the Google website. Web server handles HTTP requests and connections.

7. Application Server:
 - Web server delivers the request to an application server, which processes the request and generates a response. Application server may execute server-side scripts and interact with a database.

8. Database:
 - Application server may request data from a database for information required in the response.

9. Web Server (Response):
 - Application server returns the response to the web server.

10. Load Balancer (Response):
 - Load balancer receives the response, typically a dynamic one from the application server.

11. TCP/IP (Response):
 - Load balancer routes the response back through the TCP/IP stack.

12. Firewall (Response):
 - The firewall inspects the incoming response for security compliance.

13. Browser (Response):
 - The firewall returns the response to your browser, which decrypts and renders the content, allowing you to interact with the Google website.
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/e5nz0a8hmw6bczjdczxl.jpeg)
Hoisting in javascript ?
Tags: javascript, beginners, webdev
Published: 2024-07-13 06:45:46

“Hoisting is behavior in javascript where all the variable and function declaration moved to the top of the containing scope during compilation phase before code execution”

You may came across this definition everywhere but “it is a myth that all the variable and function declaration physically top of the code ” This is not true!

But instead , In hoisting all the variable and function declaration already get assigned memory before code execution in the compilation and stay exactly where we typed them.

So exactly how var/let/const and functions are hoisted.

Here are some examples:

```
console.log(a) // undefined
console.log(b) // ReferenceError
console.log(c) // ReferenceError

var a = 10;
let b = 20;
const c = 30;
```


Variable declared with var will be hoisted and during compilation time var variable assigned in memory with value undefined that why when we console var before declaration we get undefined

Variable declared with const/let will also hoisted but not initialized with undefined . we can not access them before declaration , otherwise we receive a ReferenceError. This is because of Temporal Dead Zone, a time where variable exist but not initialized .

But what about function

Well it depends how we declare our functions. See below.

```
greet1();
greet2();
greet3();
greet4();

//function declaration is full hoisted
function greet1(){
    console.log("greet1");
}

// TypeError: greet2 is not a function
var greet2 = function(){
    console.log("greet2");
}

 // ReferenceError: Cannot access 'greet3' before initialization
let greet3 = function(){
    console.log("greet2");
}

// ReferenceError: Cannot access 'greet4' before initialization
const greet4 = function(){
    console.log("greet2");
}
```
Traditional function declaration is fully hoisted means we can call it throughout the code.

but with function expression , we are unable to it before it has been declared . This is why three function declared with variables gives us an error. So we have two option either we change the function expression to function declaration or call the function after declarations.
PRINT function in python
Tags: python, print, jopy
Published: 2024-07-13 06:48:32

13-07-2024

## PRINT() function
` print()` function is a function that allows us to output to the screen

**The print() function has three different uses;**

1. Single quotes (' ')          
2. Double quotes (" ")
3. Three quotes (“”” “””)-----------for multi line

_we can use anyone type quote, cannot use different quote in same line_


```
print()---------------------------#create empty line
```
```
print("jothilingam")--------------#string should print with""
```
```
print(5)------------------------#number can print without ""
```

```
print("jo""jo")--------------print without space
print("jo"+"jo")--------------print without space
answer    jojo
print("jo","jo")--------------print with space
answer     jo jo
```

**print with `f-strings`**
```
name = "jothi"
print(f"Hello {name}")
# Output : Hello jothi
```

newline escape character \n

```
print("jo\nthi")
jo
thi
```



## **Parameters of the print() Function:**

**`sep `parameter**

```
print("jo","jo",sep="_")...................sep="" is default
answer    jo_jo
```

```
print("jo", "lingam", sep='thi')
answer     jothilingam
```


**`end `parameter**
```
print("jothi",end="lingam")
answer  jothilingam
```
```
print("jothi",end="")----------------without space
print("lingam")
answer  jothilingam
```
```
print("jothi",end=" ")----------------with space
print("lingam")
answer  jothi lingam
```
**`*` parameter**

```
print(*"jothilingam")
answer    j o t h i l i n g a m
```
`file `and `flush `parameters, since these parameters are the parameters that allow us to process the files
Building a Simple To-Do List App with React 🚀
Tags: webdev, javascript, beginners, programming
Published: 2024-07-13 06:50:19

**Introduction:**
In this tutorial, we'll walk through the process of building a simple to-do list app using React. This project will help you understand the basics of React components, state management, and event handling. By the end of this tutorial, you'll have a functional to-do list app that you can further enhance with additional features.

**Prerequisites:**
- Basic knowledge of JavaScript and HTML.
- Node.js installed on your machine.
- A code editor like VS Code.

**Step 1: Setting Up the Project**
First, let's set up our React project using Create React App. Open your terminal and run the following commands:

```bash
npx create-react-app todo-app
cd todo-app
npm start
```

This will create a new React project and start the development server. Open your browser and navigate to `http://localhost:3000` to see the default React app.

**Step 2: Creating the To-Do List Component**
Next, we'll create a new component for our to-do list. Create a new file called `TodoList.js` in the `src` directory and add the following code:

```javascript
import React, { useState } from 'react';

function TodoList() {
  const [tasks, setTasks] = useState([]);
  const [input, setInput] = useState('');

  const addTask = () => {
    if (input.trim()) {
      setTasks([...tasks, input]);
      setInput('');
    }
  };

  return (
    <div>
      <h1>To-Do List</h1>
      <input
        type="text"
        value={input}
        onChange={(e) => setInput(e.target.value)}
        placeholder="Enter a new task"
      />
      <button onClick={addTask}>Add Task</button>
      <ul>
        {tasks.map((task, index) => (
          <li key={index}>{task}</li>
        ))}
      </ul>
    </div>
  );
}

export default TodoList;
```

**Step 3: Using the To-Do List Component in App.js**
Now, let's use our `TodoList` component in the main `App.js` file. Open `src/App.js` and update it as follows:

```javascript
import React from 'react';
import TodoList from './TodoList';
import './App.css';

function App() {
  return (
    <div className="App">
      <TodoList />
    </div>
  );
}

export default App;
```

**Step 4: Adding Some Styling**
To make our app look better, let's add some basic styling. Open `src/App.css` and add the following styles:

```css
.App {
  text-align: center;
}

input {
  margin-right: 10px;
}

button {
  margin-left: 10px;
}

ul {
  list-style-type: none;
  padding: 0;
}

li {
  background: #f4f4f4;
  margin: 5px 0;
  padding: 10px;
  border-radius: 4px;
}
```

**Conclusion:**
That's it! You've built a simple to-do list app with React. You can now add, display, and clear tasks. Feel free to extend this app by adding features like task deletion, task editing, or even persisting tasks in local storage.

**Further Reading:**
- [React Documentation](https://reactjs.org/docs/getting-started.html)
- [Create React App](https://create-react-app.dev/)
- [MDN Web Docs on JavaScript](https://developer.mozilla.org/en-US/docs/Web/JavaScript)
Clone Scripts vs. Building from Scratch: What’s the Best Choice?
Published: 2024-07-13 07:05:04

When it comes to developing a food delivery app like UberEats, you have two main options: using an [Ubereats clone](https://appkodes.com/ubereats-clone/) or building the app from the ground up. Each approach has its pros and cons, but let’s explore why UberEats clone scripts might be the better choice for many entrepreneurs.

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

## UberEats Clone Scripts: The Smart Choice

**Advantages:**

**Faster Launch:** UberEats clone scripts are pre-built and ready to go, allowing you to launch your app in a fraction of the time it would take to develop one from scratch.

**Cost-Effective:** Developing an app from the ground up can be expensive due to extensive design and coding requirements. Clone scripts significantly reduce costs.

**Essential Features Included:** Most UberEats clone scripts come with key functionalities like user accounts, real-time tracking, and payment gateways already integrated.

**Easily Customizable:** While the foundation is set, you can still personalize the script to match your brand’s look and feel.

**Less Technical Know-How Required:** Clone scripts are designed to be user-friendly, making them accessible even for those with limited technical expertise.



## Consider Appkodes for Your UberEats Clone Script Needs


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

If you’re considering an UberEats clone script, Appkodes is highly recommended. They offer a range of robust and customizable scripts, including food delivery solutions that can help you hit the ground running.


**Ready-to-Use Solutions:**Get started quickly with pre-built features.

**Customizable Designs:** Tailor the app to suit your brand identity.


**Comprehensive Support:** Benefit from reliable technical support throughout your journey.

**Building from Scratch:** The Challenges
While building an app from scratch allows for full customization, it comes with several drawbacks:

**Time-Consuming:** Developing an app from the ground up can take months or even years.

**Higher Costs:** The expense of hiring developers, designers, and project managers adds up quickly.

**Complexity:** Requires extensive technical knowledge and resources to manage coding, testing, and deployment.

## In Summary

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

Choosing between an UberEats clone script and building from scratch ultimately depends on your goals, budget, and timeline. For many entrepreneurs, clone scripts offer a practical and efficient solution that can help bring your food delivery app vision to life without the headaches of traditional development.

Ready to launch your own food delivery service? Consider starting with Appkodes and take the fast track to success! 🚀
Steel Fabrication Company in Saudi Arabia
Tags: javascript
Published: 2024-07-13 07:10:52

[Al Safrik Steel](https://alsafriksteelworks.com
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/305bx896ka8ik7za8paj.jpeg)) was established in 2010, and the company offers fabricated products and installation in different Gulf States. After providing premium quality products within affordability of our valuable customers in United Arab Emirates, the company is starting its operation in Saudi Arabia now. We made customized Steel products, thousands of pieces of Construction, and Industrial fabrication. The company satisfied thousands of local and international clients with continuous hard work, reliable customer support, and quality products and services.
Strong counting
Published: 2024-07-14 13:00:27

## Weekly Challenge 277

Each week Mohammad S. Anwar sends out [The Weekly Challenge](https://theweeklychallenge.org/), a chance for all of us to come up with solutions to two weekly tasks. My solutions are written in Python first, and then converted to Perl. It's a great way for us all to practice some coding.

[Challenge](https://theweeklychallenge.org/blog/perl-weekly-challenge-277/), [My solutions](https://github.com/manwar/perlweeklychallenge-club/tree/master/challenge-277/sgreen)

## Task 1: Count Common

### Task

You are given two array of strings, `@words1` and `@words2`.

Write a script to return the count of words that appears in both arrays exactly once.

### My solution

In my day job, I usually don't use TDD for writing new code. Things are different when I work on The Weekly Challenge, as there are examples that can be used to test success. Once I've pull the code into my local repo and before I write any code, I create `test.py` with the expected output. I then do my code, and ensure the tests past. And occasionally I find out my code doesn't pass the tests. Today was such an example.

My original solution for this was to convert the lists into sets and perform an intersection of them. Simple one liner. However the third test failed because the words 'is' appears more than once.

In the end I took a different approach. I take each word for from first list and check that it appears once (and only once) in all the lists. While that task takes two arrays of strings, my solution will take many.

```python
def count_common(*words_list: list[list]) -> int:
    count = 0

    for word in set(words_list[0]):
        for words in words_list:
            if words.count(word) != 1:
                break
        else:
            count+=1

    return count
```

The only funky thing here (from a Perl perspective) is the `for ... else` feature. In Python, the else part is only executed when the loop is not broken out of.

For the command line input a take a strings of space-separated values to make each list.

### Examples

```bash
$ ./ch-1.py "Perl is my friend" "Perl and Raku are friend"
2

$ ./ch-1.py "Perl and Python are very similar" "Python is top in guest languages"
1

$ ./ch-1.py "Perl is imperative Lisp is functional" "Crystal is similar to Ruby"
```

## Task 2: Strong Pair

### Task

You are given an array of integers, `@ints`.

Write a script to return the count of all strong pairs in the given array. A pair of integers x and y is called strong pair if it satisfies: `0 < |x - y| < min(x, y)`.

### My solution

This doesn't need much explanation, I simply loop through the unique positions, and count the number of times the condition is met.

```python
def strong_pair(ints: list) -> int:
    ints = list(set(ints))
    count = 0

    for i in range(len(ints)-1):
        for j in range(i+1, len(ints)):
            if abs(ints[i]-ints[j]) < min(ints[i], ints[j]):
                count += 1

    return count
```

### Examples

```bash
$ ./ch-2.py 1 2 3 4 5
4

$ ./ch-2.py 5 7 1 7
1
```
NICMAR PUNE University
Published: 2024-07-13 07:31:17

Discover a world of opportunities at NICMAR University Pune. Located in the heart of the city, the campus is a hub of academic excellence and innovation. With state-of-the-art infrastructure, a rich academic heritage, and a commitment to fostering future leaders, NICMAR University Pune is your gateway to a rewarding career. The campus is more than just a place of learning; it's a vibrant community where you can connect with like-minded individuals, engage in groundbreaking research, and prepare for a dynamic career in the built environment. NICMAR Pune offers a range of graduate and postgraduate programs designed to equip you with the skills, knowledge, and experience needed to excel in today's highly competitive world. Be part of the NICMAR family and embark on an educational journey that will shape your career.
**[Website]**(https://www.nicmar.ac.in/pune/campus)