teleren/devto huggingface dataset:
How-To: Java charAt() String Function
Tags: java, codenewbie, tutorial, 100daysofcode
Published: 2021-11-02 20:00:00

---
title: How-To: Java charAt() String Function
published: true
description: How-To: Java charAt() String Function
tags: Java, codenewbie, tutorial, 100daysofcode
//cover_image: https://direct_url_to_image.jpg
---
A *string* is a sequence of *characters*. Sometimes we need to access one character in the string. The Java String function `charAt()` returns the character at a given position in a string, where positions start at `0`.

Here is an example. First, we create a string in Java:

```Java
String s = "The quick brown fox jumped over the lazy dog.";
```

The string value is this entire sentence: *The quick brown fox jumped over the lazy dog.* The variable `s` refers to the string. We use this variable to invoke String methods on the string.

Next, we invoke the `charAt()` method on the string variable `s`, passing the parameter `4`. This function returns the `char` value at position 4. Since string indexes start at `0`, the function returns character `q`. Note that a space is a character too. The code assigns the return value`q` to the `char` variable `c`:

```Java
char c = s.charAt(4);
```

Finally we output `c`:

```Java
System.out.println(c);  // q
```
Here is a complete program:

```java

public class Example {
  public static void main(String[] args) {
    
    String s = "The quick brown fox jumped over the lazy dog.";

    char c = s.charAt(4);
    System.out.println(c);  // q

  }
}
```

Execute the program to see the output `q` in the terminal.

Note that `s.charAt(0)` returns the first character in the string: `T`.

Try the `charAt()` String function to retrieve other characters in the string.

Thanks for reading. 😃

*Follow me on Twitter [`@realEdwinTorres`](https://twitter.com/realEdwinTorres) for more programming tips and help.*
Easy breached password detection
Tags: security, webdev, cybersecurity, tutorial
Published: 2021-11-02 19:51:24

Breached password detection protects your users by making sure they aren't using passwords that have been seen in [previous breaches](https://haveibeenpwned.com/PwnedWebsites). An easy way to provide it to your users is:

```js
const {pwnedPassword} = require('hibp');

async function hasPasswordBeenUsedBefore(password) {
    // HIBP asks that you identify yourself through the user agent
    const numTimesUsedBefore = await pwnedPassword(password, {userAgent: "whoami"});
    return numTimesUsedBefore > 0;
}
```

[HIBP (or have i been pwned?)](https://haveibeenpwned.com/) is a service that provides APIs on top of past breaches. In the code snippet, I used the library [`hibp`](https://www.npmjs.com/package/hibp), but there are existing libraries for pretty much every language. The [API](https://haveibeenpwned.com/API/v3#PwnedPasswords) is easy to use if you prefer to not rely on a library here. Let's test our function:

```js
async function testPasswords() {
    const passwords = ["password", "p455w0rd!!",
                       "iamsosecure", "48lU!#S032XN2tzbh"]
    for (const password of passwords) {
        const usedBefore = await hasPasswordBeenUsedBefore(password);
        console.log(password, usedBefore);
    }
}

testPasswords()
// password true
// p455w0rd!! true
// iamsosecure false
// 48lU!#S032XN2tzbh false
```

We can see that `password` is a pretty easy thing to catch, whereas `p455w0rd!!` is more subtle and would have passed any "8 characters, at least 1 number and special character" requirements.

Neither `iamsosecure` or `48lU!#S032XN2tzbh` were in any past breaches, which is important to note. This isn't a guarantee that the password is high quality, just that it hasn't been seen in a breach before. However, there are currently over 600M easily attackable passwords that you will now disallow in only a few lines of code.

Quick plug: [PropelAuth](https://www.propelauth.com) provides this and other security features. If you don't want to deal with auth and want to just get back to building your product, we'd appreciate if you checked it out.

### Technical note: Is the password sent in plaintext?

No, the API is designed to not accept plaintext passwords. Instead, you send the first 5 characters of the SHA-1 hash of the password. The response is a list of SHA-1 hash suffixes (everything after the first 5 characters), that begin with those 5 characters. You can check your hash against this list locally.

Example from [the API docs](https://haveibeenpwned.com/API/v3#PwnedPasswords)

```text
GET https://api.pwnedpasswords.com/range/{first 5 hash chars}

0018A45C4D1DEF81644B54AB7F969B88D65:1
00D4F6E8FA6EECAD2A3AA415EEC418D38EC:2
011053FD0102E94D6AE2F8B83D76FAF94F6:1
012A7CA357541F0AC487871FEEC1891C49C:2
0136E006E24E7D152139815FB0FC6A50B15:2
... 
```
Manual install of Ceph part 2 - Add OSD and use Rados
Published: 2021-11-02 19:31:28

---
title: Manual install of Ceph part 2 - Add OSD and use Rados
published: true
description: We go through how to manually install a Ceph cluster. We will add Object storage devices and play around with Rados. Rados (Reliable autonomic distributed object storage) is a great way to store data in a secure and efficient way.
tags:
cover_image: https://i.ytimg.com/vi/JLBflREMs2k/maxresdefault.jpg
---

{% youtube JLBflREMs2k %}

We go through how to manually install a Ceph cluster. We will add Object storage devices and play around with Rados. Rados (Reliable autonomic distributed object storage) is a great way to store data in a secure and efficient way.
Containers and Virtual Machines.
Tags: devops, webdev, programming, beginners
Published: 2021-11-02 19:27:15

>Brief insight on containers and VMs








**Operating Systems keep track of memory, RAM, Disk and devices, and if you run multiple programs simultaneously, all these resources of OS will be shared among the programs as per their requirements.**

 **Now let's take an example where  1 of your programs is using port 80 and another program too needs to run on the same port, and if it tries to use the port, it will crash because port 80 is already in use.**


  
_It is one such example where containers and VMs come in use._

**If you move your programs into containers or VMs each of them will have its own version of shared resources, files and network ports.**

_Containers provide the mobility, you can move and run your application easily._

>Let's take a scenario where you are working on an application on your machine. Now that application will have certain configurations, binaries and other files and if you ship the same application and try to run it on another machine, it won't run if the machine does not fulfills the configuration requirements as per the application's demand of it. But if you have containerized it and then ship, no such issue will arise.

**There are some similarities and so many differences between containers and VMs**

Let's see that in the next post.



Enough of containers and stuff, let me make one revelation about you, _You look best when you smile_ xD.
Action Protocol, abstract layer to help create your microservice.
Tags: microservices, grpc, http, protocol
Published: 2021-11-02 19:14:11

Hello world! I've been a programmer for over ten years in different technologies.

This year I started making my own microservices and found many interesting things like DDD architecture, gRPC protocols and metrics systems.

In the middle of development I came across a question. How use HTTP or gRPC without change my application?

It was when I had the idea to create an abstraction layer, where I pass the action, data and authorization token.

This also allows to control the time and quantity of general requests or by type of action.

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

Example data:
```json
{
  "action": "createCar",
  "data": {
    "brand": "Ferrary",
    "color": "red"
  },
  "token": "mytokensecret" 
}
```

Repository:
https://www.npmjs.com/package/action-grpc

Example project using action-grpc:

* src/infrastructure/http/http.ts
* src/infrastructure/grpc/grpc.ts

https://github.com/julioacontreras/authenticator-storage

Thank´s and good vibes!
Bye
Towards a multi-criteria decision support system for project management based on personal traits and performance
Tags: react, django, machinelearning, management
Published: 2021-11-02 19:07:28

  _**Project management**_ (PM) in software development requires accurate information and experience to make an effective decision. One of the concerns of the PM is to answer the question :
**_"How to create effective teams with an appropriate distribution of tasks and then monitor the progress of the project to ensure that the objectives and deadlines are met ?"_**

  **Alginius** is a system that helps the manager to perform effective teamwork.  it Identify not only the experiences and skills of team members, but also their personality traits. The suggested tool also helps the manager to obtain and track the progress of the project through a tracking mechanism with the ability to view critical information.
 
  The proposed decision support system is based on multi-criteria analysis and machine learning in order to be able to automate the identification of the developer's personality and the evaluation of his speed in completing tasks.
 
  Currently, the tool is evaluating through an experiment conducting under supervision at the Neo Fintech  company to analyze [kio](https://kiostore.net) project, on a team of 25 developers and 1 manager.

  Studies in 2008 indicate a success rate for IT projects of 35%, which is rather positive but remains very low. The problem remains unresolved. Among the reasons for failure, come first:

- Lack of involvement of end users: 12.8%.
- Changes in specifications during the project: 11.8%.

  **So How can we help the decision maker to assign a task to the right person or group of people in a project?**

---

  In order to meet the needs cited, our system consists in proposing a methodological approach for the implementation of a decision support system based on a multi-criteria analysis strategy by combining Web services, an analysis method multi criteria (**MAMC**), a technique of and machine learning.

##IT Project Management :
1 - **Scrum** is a framework used to develop complex software products, it is based on the division of projects into "time cycles", called sprints. Sprints can last from a few hours to a month (the average sprint is two weeks). Each sprint begins with a quote and then an operational plan.

2 - **Kanban** is a working method inspired by lean (Traditional) methods, centered on the continuous improvement of the production process, the objective of this method is to constantly adapt to the needs of customers. 

3 - The **Hybrid** approach, the concept of hybridization is recent. The term “hybrid” is obviously at the heart of the concept.
The advantage of this hybrid project management is that it allows you to take advantage of the best of different methods. As a result, project managers can take advantage of the methods they choose while bypassing their weaknesses or potential pitfalls.
Setting up AWS Appsync for unauthenticated users
Tags: aws, appsync, security
Published: 2021-11-02 19:06:05

Edit:
Here's an updated version of this blog:
https://sedkodes.com/blog/aws-appsync-for-unauthenticated-users

This took me days to get the handle of, so here's to hoping I can save anybody else the trouble.

so you want to expose some of your queries (but not all!) to public users, so that users can use/interact with your app before having to sign up.  Makes sense!!

Well, it's a royal PITA.

1. Set your Appsync API to be protected by IAM
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/uy4vak1yuabytgztp6yp.png)
 
2. Create a Cognito identity pool, and create a role for unauthenticated users:
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/boka9y85ivyu0xp65b3u.png)
 
3. For the unauthenticated role, specifically assign the fields/types you want.

If you'd like to be confused by AWS' documentation of how to do this, start [here](https://docs.aws.amazon.com/service-authorization/latest/reference/list_awsappsync.html#awsappsync-field), or [here](https://docs.aws.amazon.com/appsync/latest/devguide/security_iam_service-with-iam.html#security_iam_service-with-iam-id-based-policies).

Alternatively, you can copy this template where I give access to two subscriptions only:
```
{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Sid": "VisualEditor0",
            "Effect": "Allow",
            "Action": "appsync:GraphQL",
            "Resource": [
                "arn:aws:appsync:*:*:apis/*/types/*/fields/onCreateOrders",
                "arn:aws:appsync:*:*:apis/*/types/*/fields/onUpdateOrders"
            ]
        }
    ]
}
```

Finally, in our JS code, I use the Amplify SDK, so here's how I configure that:
```
const config = awsRealtimeConfig: {
        aws_appsync_graphqlEndpoint: "https://<graphql-id>.appsync-api.<aws-region>.amazonaws.com/graphql",
        aws_appsync_region: "<region>",
        aws_appsync_authenticationType: 'AWS_IAM',
        Auth: {
            identityPoolId: 'us-east-2:pool-id-here',
            region: 'us-east-2',
        }
    },

Amplify.configure(config)
```
Free Webinar: Transform Your Jupyter Notebook into a Web-Based Form + Report
Published: 2021-11-02 19:02:00

---
title: 
published: true
description: 
In this free webinar, computational engineers are going to walk you through the steps needed to transform your Jupyternotebook into a web-based tool. Link: https://www.eventbrite.com/e/transform-your-jupyter-notebook-into-a-web-based-form-report-tickets-184877943907
tags: 
//cover_image: https://direct_url_to_image.jpg
---
Create a Magento 2 Patch to override core
Tags: git, magento, magento2
Published: 2021-11-02 18:54:06

You may run into a situation where you need to modify core for some reason or another. In my career as a Magento2 developer there were many instances where we needed to do this and there are many ways to do it such as overriding/extending via preference or using a plugin, but I found that if you need to fix a Magento bug the best way of doing it is via a git patch, because if anything in the vendor/magento folder changes it will not apply the change and will be more visible to you, rather than spotting weird errors in logs a few years later when Magento2 fixes it. 


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

You may also submit this fix as a PR to the magento2 github repository, but be advised that there is a lot of overhead that goes into proving a problem exists https://github.com/magento/magento2/pull/10102 and there are cases where this is not done such as this example case where we used a patch to fix an issue that was infrastructure related. 
https://alanstorm.com/fixing-x-magento-tags-too-large-errors/



### 1. Commit the original state

Go into root directory 

`git init`
`git add vendor/magento`
`git commit -m 'init'`

### 2. Commit your change
Make your code change
`git add vendor/magento`
`git commit -m 'Description of your change'`

### 3. Create the Patch
`git format-patch -1 HEAD`
`cp x.patch patches/INITIALS-descriptionofchange.patch`

Ensure the relative paths are a/vendor/x/y

### 4. Test the patch
Find the commit of init 
`git log`
Reset vendor folder
`git reset --hard <commit hash>`

Execute the patch to check whether it applies or not
`if git apply --check patches/INITIALS-descriptionofchange.patch; then git apply patches/INITIALS-descriptionofchange.patch; fi"`

### 5. Add script to composer.json to apply the patch

```
Add to composer.json
"scripts": {
   "post-install-cmd": [
       "if git apply --check patches/INITIALS-descriptionofchange.patch; then git apply patches/INITIALS-descriptionofchange.patch; fi",
}
```

### 6. Conclusion

Ensure to run `composer install` to apply changes on CI/CD process or when pulling in other developers patches

### Troubleshooting

If your machine can't handle git add to `vendor/magento` then go directly to the folder you need changing and do the process from there rather than from root directory. After you copy over the patch match the relative paths (where there is a/... and b/...) with the full path like `a/vendor/magento`. 

If your patch is not applying, to find out why ```git apply --reject x.patch```
First time experience !
Tags: hacktoberfest
Published: 2021-11-02 18:14:01

I am using Git-hub since January of this year but I never tried to understand what is Pull request, what is the uses of fork option etc. But when I  heard the name of Hacktoberfest-21, I learned many things to full-fill 4 pull-requests, now I know what is PR and what is the uses of Fork. Now I am realizing that I have wasted a lot of times using Facebook, Instagram etc. social media's. Now I am thinking to start a new life-style without those things. Thanks to hacktoberfest and Dev.to for those gifts. Yeah, Open source really changing the world !
 
![My Hacktoberfest profile](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/yztgbmvcblkv9h0pvnuo.png)
Tuesday’s Tip – Join The Conversation
Tags: tuesdaystip, communication, community
Published: 2021-11-03 02:12:32

---
title: Tuesday’s Tip – Join The Conversation
published: true
date: 2021-11-02 18:10:22 UTC
tags: TuesdaysTip,communication,community
canonical_url: https://www.30minuteproject.com/2021/11/02/tuesdays-tip-join-the-conversation/?utm_source=rss&utm_medium=rss&utm_campaign=tuesdays-tip-join-the-conversation
---

Whether it’s on Twitter, Facebook, LinkedIn, Reddit, Slack or Discord community, or some other community platform, make sure your voice isn’t missing. 

Tips on getting social:

- Join a community, start following relevant people, and introduce yourself
- Follow along with the conversations, but don’t join in yet (unless asked)
- Once you start to feel comfortable, start adding your voice to the conversation

Engaging with others, even in online communities, can help expose you to different ways of doing things as well as expanding your knowledge base. They can also be a great place to share struggles you may be having at work in a more anonymous or safe environment (be careful with this, though, as you may not know who is listening to your supposed “private” conversations).

![Join The Conversation Image](https://www.30minuteproject.com/wp-content/uploads/2021/11/110221-TT-Join-the-Convo.png)


Sign up for my mailing list and get your free ebook

"The 30-Minute Project: How to improve Your Side Project Game to Become a Better Developer"
at [30-Minute Project](https://www.30minuteproject.com/contact/)
React Components #day32
Tags: 100daysofcode, javascript, programming, webdev
Published: 2021-11-02 18:00:03


#100daysofcode #day32
React Components and Props
=>Components let you split the UI into independent, reusable pieces, and think about each piece in isolation.
Conceptually, components are like JavaScript functions. They accept arbitrary inputs (called “props”) and return React elements describing what should appear on the screen.
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6807ptjpfgatxi3grsju.png)

#DEVcommunity
#javascript #react #programming
Turning Complex Lists into Flatten Lists in Python Without Using Any Libraries
Tags: python, programming, tutorial, algorithms
Published: 2021-11-02 17:30:42

Hello there Turan here, today I'm going to share a algorithm that turns complex lists into simple lists (flatten lists). 

First of all, what is a complex list? It is a list that contains different type lists inside it, looks so complex and make it hard to read. For example:
```
l = [[1,'a',['cat'],2],[[[3]],'dog'],4,5]
```
The above list is an example of complex list, we are going to turn it into this:
```
[1, 'a', 'cat', 2, 3, 'dog', 4, 5]
```

Let me show you the code and explain it to you ^^
```
from typing import List

l = [[1,'a',['cat'],2],[[[3]],'dog'],4,5]
flat_list2 = []

def lookInside(l):                  # Takes the list type element
    for x in l:                     # For each sub-element of it
        if type(x) is not list:     # If the sub-element is not list, 
            flat_list2.append(x)    # Then add it to flat_list
        else:                       
            lookInside(x)           # Else, look inside of it again

# WE ARE STARTING HERE !!!
def makeFlat(l):                    # Getting the list 
    for e in l:                     # Checking the elements of the list
        if type(e) is list:         # If element's type is list then
            lookInside(e)           # send that element to lookInside function 
        else:
            flat_list2.append(e)    # Else, (if it is not list) append it to our new flat_list

makeFlat(l)                         # Function call, the complex list has been given to function
print(flat_list2)                   # Printing the flatten list
```

With the code above, we can turn complex lists into simple (flatten) lists, whatever complex list contains 2nd, 3rd, 4th... degree lists. It doesn't matter for us because we are using recursive function that makes everything easier.

Here how our recursive function works:
1. [ 1, [2], [[3]] ] ==> Our function takes 1 as a normal element

2. [ [2], [[3]] ] ==> Then for [2] we are going to our recursive function, this function looks inside of it then sees that "2" is not list, then add it to new list

3. [ [[3]] ] ==> Then for [[3]] we are going to our recursive function, function looks at it and says that [3] is a list then send it to itself again just as [3]. After that (like [2]) it looks inside of [3] and sees that 3 is not list then add it into new list.

This goes like that :)

I hope it was easy to understand for you, and i hope it helped. Thanks for reading, please leave a like and comment if you want ^^ 

@Publisher : https://dev.to/toour
jQuery and You: Learning the Basics
Tags: jquery, javascript, html
Published: 2021-11-02 17:19:35

jQuery is a powerful tool that lets you add functionality to what would otherwise be hard-coded HTML scripts by injecting javascript into it.

This works by "wrapping" HTML code in dynamic Javascript that can be manipulated.

The power of $:
1. I hope you appreciate the pun I just made.
2. The hidden abilities of jQuery are unlocked with the $ and paired with (). Once you create the $('') you can start to inject the HTML code within it. For instance:
$('< h1>Hello World!</h1>')  {< space added before h1 so format would display correctly when live}will create a header in the HTML document that says "Hello World!"

Adding content to tags with jQuery:
1. While we can declare tags easily with jQuery, there are steps we can use to add content to tags later on.
Example:

//declare an empty set of tags
let $empty = $('<h6></h6>');
//add content
$empty.text('This headline is no longer empty!');

2. We can also manipulate and add content to entire types of HTML code by using .html(). This method tells the interpreter to apply changes to all tags of the same type

$('ul').html('Placeholder Text');

This example takes all instances of unordered lists and applies the "Placeholder Text" content to all instances instead of just one.

Methods for combining tags:
1. Since jQuery is similar to Javascript, it comes with methods we can use to manipulate the code we are writing. For instance, we can create a body tag, and then later on, add code to the body by using appendTo or prepend.
Example:

let $body = $('<body></body>');

let $paragraph = $('<p>This is an example of how we can write a line of jQuery code and add it to another tag</p>')

$paragraph.appendTo($body);
This makes the browser interpret the HTML as <body><p>This is an example of how we can write a line of jQuery code and add it to another tag</p></body>

2. Also like Javascript, we can chain together different methods. So if we wanted to add a class to the paragraph while we appended it to the body, we could do this:
$paragraph.appendTo($body).addClass('examples');

Conclusion:

jQuery is a powerful tool that takes HTML up a notch and makes, what would normally be hardcoded, dynamic and adjustable and lively. It's worth learning to make your websites less static.