teleren/devto huggingface dataset:
Minitutorial Android Studio: Utilizar ListView con arreglo
Tags: android, espanol, minitutorial, listview
Published: 2021-12-19 22:38:13

#Bienvenido a un nuevo minitutorial

El día de hoy les enseñaré como recorrer un arreglo utilizando un ListView.


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



##Vamos al código!

#activity_main.xml

En nuestro **activiy_main.xml** agregaremos un **linearlayout** con orientación vertical y agregaremos un **listview** al cual le asignaremos un id al que llamaremos **listView1**

```
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    tools:context=".MainActivity">


    <ListView
        android:id="@+id/listView1"
        android:layout_width="match_parent"
        android:layout_height="match_parent" />
</LinearLayout>
```

#MainActivity

En nuestro MainActivity crearemos un objeto llamado **lista** de tipo **ListView**. Dentro del método onCreate le asignaremos el id que creamos en el activity_main el cual era **ListView1** de manera que el código quede así:

```

public class MainActivity extends AppCompatActivity {

    ListView lista;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        lista = findViewById(R.id.listView1);
}};


```
Debajo de nuestra lista crearemos un arreglo de tipo **String** al cual llamaremos **datos**.

```        
final String[] datos = new String[]{"UNO", "DOS", "TRES"};
```

Posteriormente agregaremos un **ArrayAdapter** tipo **String** y le asignaremos un layout tipo simple_list_item_1 y le pasaremos el arreglo llamado **datos**

```
ArrayAdapter<String> adaptador = new ArrayAdapter<String>(
                getApplicationContext(),
                android.R.layout.simple_list_item_1, datos);

```

Por último solo nos resta asignar ese adapter a nuestro listView llamado lista.

```
lista.setAdapter(adaptador);
```

Si desean obtener el valor seleccionado de la lista les dejo el siguiente código

```
     lista.setOnItemClickListener(new AdapterView.OnItemClickListener() {
            @Override
            public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) 
{
 Toast.makeText(getApplicationContext(), "Opcion seleccionada" + adapterView.getItemAtPosition(i).toString(), Toast.LENGTH_SHORT).show();

}
        });
```

Con esto hemos finalizado el tutorial. Espero seguirles enseñando más de Android Studio en los próximos días, ¡¡¡saludos!!!.

Les dejo el código completo en el siguiente enlace [Clic aquí para ver el código](https://github.com/fynio/arreglo_listview_android_studio.git)

##Hasta la próxima.
Fixing "Authentication plugin 'caching_sha2_password' cannot be loaded" errors
Tags: mysql, webdev
Published: 2021-12-20 09:31:48

## Summary
You have installed MySQL 8 and are unable to connect your database using your MySQL client (Sequel Pro, HeidiSQL etc).  Every attempt to connect using your MySQL client results in the following error

> Authentication plugin 'caching_sha2_password' cannot be loaded: dlopen(/usr/local/mysql/lib/plugin/caching_sha2_password.so, 2): image not found

or 

> Authentication plugin 'caching_sha2_password' cannot be loaded. The specific module can not be found

## Reason
As of MySQL 8.0, `caching_sha2_password` is now the default authentication plugin rather than `mysql_native_password` which was the default in previous versions.  This means that clients (Sequel Pro, HeidiSQL etc) that rely on the `mysql_native_password` won't be able to connect because of this change.

## Resolution
1) You can, at a server level, revert to the `mysql_native_password` mechanism by adding the following to your MySQL configuration files

```bash
[mysqld]
default_authentication_plugin=mysql_native_password
```

2) You can, at a user level, revert to the `mysql_native_password` mechanism via the following process

Open a terminal window and connect to your MySQL instance via the command line

```sh
mysql -u [USERNAME] -p
```

Enter your MySQL password and press enter and you should be logged into your MySQL instance.

Now run the following SQL command, replacing `[USERNAME]`, `[PASSWORD]` and `[HOST]` as appropriate.  

Note: `[HOST]` can be the IP address of your computer which would allow access from your computer only or, in the case of a local development environment, you can use `%` to allow from any host.

```sql
ALTER USER '[USERNAME]'@'[HOST]' \
  IDENTIFIED WITH mysql_native_password \
  BY '[PASSWORD]';
```

or 

```sql
ALTER USER '[USERNAME]'@'%' \
  IDENTIFIED WITH mysql_native_password \
  BY '[PASSWORD]';
```

Now you should be able to go back to your MySQL client and connect as normal.

## References
- 2.11.4 Changes in MySQL 8.0 - [https://dev.mysql.com/doc/refman/8.0/en/upgrading-from-previous-series.html](https://dev.mysql.com/doc/refman/8.0/en/upgrading-from-previous-series.html)
- 6.4.1.2 Caching SHA-2 Pluggable Authentication - [https://dev.mysql.com/doc/refman/8.0/en/caching-sha2-pluggable-authentication.html](https://dev.mysql.com/doc/refman/8.0/en/caching-sha2-pluggable-authentication.html)
Advent of code Day 20
Tags: adventofcode, adventofcode2021, syntax, beginners
Published: 2021-12-20 11:23:05

Finally a day where I can feel satisfied with my code results.
I explain this code in the detail on my youtube channel, (https://www.youtube.com/watch?v=lqA_XT0U4ng)
```
reuse [L42.is/AdamsTowel]

Fs = Load:{reuse[L42.is/FileSystem]}

Point = Data.AddList:Data:{ I x, I y
  method Point +(Point that) =
    \(x=this.x()+that.x(),y=this.y()+that.y())
  method Point max(Point that)=(
    (x0,y0) = this
    (x1,y1) = that
    Point(x=x0.max(x1),y=y0.max(y1))
    )
  method Point min(Point that) = 
    this.with(x=\x.min(that.x()))<:This.with(y=\y.min(that.y()))
  }

Map = Data:{
  M = Collection.map(key=Point,val=Bool)
  mut M map=\()
  var Bool outer=Bool.false()
  var Point topLeft = Point(x=0I,y=0I)
  var Point bottomRight = Point(x=0I,y=0I)
  
  mut method Void put(Point key, Bool val) = (
    \#map.put(key=key,val=val)
    \topLeft(\topLeft.min(key))
    \bottomRight(\bottomRight.max(key))
    )
  read method Bool val(Point key) =
    \map.val(key=key).val(orElse=this.outer())
  
  read method I nearBin(Point that) = 0I.acc()((
    var n = 512I
    for xi in Range(I"-1" to=2I), for yi in Range(I"-1" to=2I) (
      n/=2I
      if this.val(key=Point(x=xi,y=yi)+that) \add(n)
      )
    ))
  read method mut This step(Key that) = (
    mut This new = This()
    (x0,y0) = \topLeft
    (x1,y1) = \bottomRight
    for x in Range(x0-1I to=x1+2I), for y in Range(y0-1I to=y1+2I) (
      key=Point(x=x,y=y)
      i=\nearBin(key)
      X[i.isInRange(0I to=512I)] // is my binary conversion correct?
      new.put(key=key,val=that.val(i))
      )
    new.outer(if this.outer() that.right() else that.left())
    new
    )
  }
Key = Collection.list(Bool)

Main=(
  input = Fs.Real.#$of().read(\"input").split(S.nl()++S.nl())
  imm key = Key()( for i in input().split() \add(i==S"#") )
  X[key.size()==512I]
  var map = Map()
  for line in input().split(S.nl()), li in Range.unbounded() (
    for c in line.split(), ci in Range.unbounded() (
      map.put(key=\(x=li,y=ci),val=c==S"#")
      )
    )
  for i in Range(2I) ( map:=map.step(key) )  //50I
  tot = 0I.acc()(for (val) in map.map() \addIf(val))
  Debug(tot)
  )
```
Shop talk
Tags: hiring, interview
Published: 2022-02-02 18:20:46

---
title: Shop talk
published: true
date: 2021-12-23 00:00:00 UTC
tags: hiring,interview
canonical_url: https://jhall.io/archive/2021/12/23/shop-talk/
---

Imagine you’re at a friend’s birthday party, and you bump into someone who works in the same field as you. Maybe you’re both JavaScript developers. Or maybe you both work with AWS.

So you start talking shop.

“Have you tried the new version of X?” you ask, with genuine curiosity.

Now imagine their response.

It’s going to have a serious impact on your professional opinion of this new acquantance.

Do they even know what **X** is? Have the heard of it, but dismissed it? If so, is their reason for dismissing it valid? Maybe they’re keenly interested in **X** , but explain why they haven’t tried using it yet.

You then dig a bit deeper. “Oh, I see. But had you considered that X can also be used for …?”

Through the course of this natural conversation you’ll very quickly form a professional opinion of this person. If you’re at all like me, you’ll put their professional expertise into one of a small number of mental buckets with descriptions like:

1. This person is a genius! I should hang out with him more!
2. She and I could really challenge each other.
3. He’s still fresh, but he’s got a great attitude!
4. We only barely work on similar technology, so I can’t really tell if what he actually does is interesting.
5. This person has no clue, and they like it that way. All bark, no bite.

Isn’t this exactly what we’re trying to learn during the job interview process? Companies ask a candidate to spend 8 hours on the weekend writing a REST API, then they ask a technical hiring manager to spend an hour or two reading that code, then they call the candidate in to spend another hour talking about that code.

All to determine which of the 5 buckets above the candidate falls into.

Why not cut all this crap and just talk shop with the candidate for 15 minutes?

There’s nothing like an expert and a poser talking shop to expose the poser in just a few seconds.

Don’t believe it’ll work? Next time you meet someone in the same or an adjacent industry in a social setting, try it out. Spend 10-15 minutes talking shop, and see if you can make a clear “no-hire” decision based on what you learn.

* * *
_If you enjoyed this message, [subscribe](https://jhall.io/daily) to <u>The Daily Commit</u> to get future messages to your inbox._
Baloonza IT newsletters weekly digest #16
Tags: javascript, webdev, css, startup
Published: 2021-12-20 22:50:30

### css, web development, frontend, javascript, react
- [Issue 332](https://app.baloonza.com/issues/10483?baloon_issue_id=16) `CSS Layout News`
- [CSS Animation Weekly #279](https://app.baloonza.com/issues/10500?baloon_issue_id=16) `CSS Animation Weekly`
- [📝 [CSS-Tricks] 281: Tabs and Spicy Drama](https://app.baloonza.com/issues/10529?baloon_issue_id=16) `CSS-Tricks`
- [Frontend Weekly - Issue 284](https://app.baloonza.com/issues/10600?baloon_issue_id=16) `Frontend Weekly`
- [Issue #485: Window Controls Overlay, CSS Relative Colors](https://app.baloonza.com/issues/10604?baloon_issue_id=16) `CSS Weekly`
- [The state of CSS in 2021](https://app.baloonza.com/issues/10611?baloon_issue_id=16) `Frontend Focus`
- [💻 Issue 209 - 10 Best Websites to become a React.js Developer in 2022](https://app.baloonza.com/issues/10681?baloon_issue_id=16) `Awesome React Newsletter`
- [💻 Issue 291 - Tailwind CSS v3.0 is here — bringing incredible performance gains, huge workflow improvements, and a seriously ridiculous number of new features.](https://app.baloonza.com/issues/10678?baloon_issue_id=16) `Awesome Javascript Newsletter`
- [Hacker Newsletter #583](https://app.baloonza.com/issues/10703?baloon_issue_id=16) `Hacker Newsletter`


### startup
- [Reinventing spreadsheets](https://app.baloonza.com/issues/10510?baloon_issue_id=16) `Product Hunt Daily`
- [Shopify for web3](https://app.baloonza.com/issues/10561?baloon_issue_id=16) `Product Hunt Daily`
- [Canva vs Adobe](https://app.baloonza.com/issues/10601?baloon_issue_id=16) `Product Hunt Daily`
- [Social video threads 🧵](https://app.baloonza.com/issues/10646?baloon_issue_id=16) `Product Hunt Daily`


### marketing
- [🎓 Micro-influencers drive more sales (+ a surprise 🔥)](https://app.baloonza.com/issues/10543?baloon_issue_id=16) `Ariyh`


### data science
- [Data Science Weekly - Issue 421](https://app.baloonza.com/issues/10694?baloon_issue_id=16) `Data Science Weekly Newsletter `

***
Red Hat is looking for feedback
Tags: cloud, productivity, tooling
Published: 2021-12-21 02:42:58

Hi, everybody!
Red Hat User Experience Design (UXD) is on a mission to deliver quality user experiences inspired by and tailored to you — and for that, we need your input.
 
We are looking for application developers with a variety of experience with cloud technologies. Does this sound like you? We’d love to hear from you!
 
Join us in our effort to elevate Red Hat user experiences the open source way — fill out this [5-minute screener survey](https://redhatdg.co1.qualtrics.com/jfe/form/SV_1B8dET7l1Ln7yXI) to get started. After you complete the screener, if you are a good fit for our research, we will send you a link to the follow-up survey. After completing that survey, we will send you a thank-you from our team, a $50 (USD or equivalent) gift card choice from several options.
 
Questions about privacy? Here is [Red Hat’s privacy statement](https://www.redhat.com/en/about/privacy-policy).
 
To learn more about Red Hat UXD, check out our [team website](https://www.redhat.com/en/about/product-design).
 
Have any questions? Reach out on this post, or at wluttrell@redhat.com 
 
We look forward to hearing from you!
Self-Taught Developer Journal, Day 21: TOP JavaScript Fundamentals Part 1 - Variables
Tags: webdev, beginners, codenewbie, devjournal
Published: 2021-12-21 04:57:38

Today I learned....

## JavaScript Variables
To create a variable in JavaScript use the **let** keyword.

    let message = Hello;

**var** is an old school way of declaring a variable. This declaration exists in older scripts. Declaring a variable twice will trigger an error. 

There are two variable naming limitations:
1. *The name must contain only letters, digits, or the symbols $ and _.*
2. *The first character must not be a digit.*

camelCase is commonly used naming convention, for example, *newToy*.

### Constants
Constants is an unchanging variable meaning the value cannot be reassigned. The keyword to use is **const**. When declaring a variables, its a general rule to use **const** unless you know the value will change. I'm guessing this is to prevent any accidental reassignment of a value.

#### Uppercase Constants
It is a common practice *to use constants as aliases for difficult-to-remember values that are known prior to execution.*
They are named using capital letters and underscores.
#### Capitol Constant vs Not
A capitol constant name is used when the value is known prior and is hard-coded in.
A lower case constant is calculated run time and doesn't change after initial assignment.

### Constant Objects and Arrays
*const* does define a constant value, but a read-only reference to a value. For this reason, the value cannot be reassigned or redeclared, but you can change the elements of constant array and change the properties of constant object

## Resources
[The Odin Project](https://www.theodinproject.com/paths/foundations/courses/foundations/)
https://www.w3schools.com/js/js_const.asp
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/const

Day 20: https://dev.to/jennifer_tieu/self-taught-developer-journal-day-20-top-landing-page-cont-the-fourth-section-and-footer-57b
Please refer to [Starting My Self-Taught Developer Journey]( https://dev.to/jennifer_tieu/starting-my-self-taught-developer-journey-2dga) for context.
The Complete Python Masterclass: My Journey Towards Learning Python
Tags: python, programming, codenewbie
Published: 2021-12-21 08:37:06

Python is my favorite programming language since the beginning of my programming journey. However, I didn't spend enough time learning it properly. My journey took me from HTML, CSS, and JavaScript route.

However, I am restarting the Python course called **The Complete Python Masterclass** I bought 3 years ago on Udemy but never finished :)

Here's the  [link](https://www.udemy.com/course/python-masterclass-course/)  to the course, in case you're curious to know. It's the best Python course I've found online, so if you wish you can certainly enroll in it.

**The course covers the core Python concepts like -**

- Basic Python Concepts(variables, strings, user input, maths, etc)
- Control Structures in Python
- Functions and Modules in Python
- Exception Handling and File Handling in Python
- Some More types in Python
- Functional Programming in Python
- Object Oriented Programming in Python
- Regular Expressions in Python

**Apart from that, the course also touches -**

- Tkinter
- Database apps with Python and PostgreSQL
- File Compression
- Data Analysis
- Django
- Flask
- Web Scraping
- Image Processing
- Automation etc.

Not to forget this is a project based course and to validate your learning you'll build projects like **Calculator, Password Manager, QR Code Generator, Video Downloader, Expense Manager, Facebook Autoposter, etc.** while following the course and you'll also be challenged to build certain advanced projects on your own. 

Currently, there are 9 projects in the challenge which you've to build on your own. So if you completed the whole course sincerely, you'll build a total of 23 awesome projects enough for you to become a Python ninja.

I'll document my whole learning journey in a series of posts and share what I learn here on my blog. So if it sounds interesting follow me to not miss any post in the series.

*Happy Coding!*
More JS Concepts
Tags: javascript, truthy, null, implicit
Published: 2021-12-21 09:08:03

**Truthy and Falsy values**
A truthy value is a value which is true in any boolean context. We can say all values as truthy unless they are falsy. 

Falsy values are:
1. false
2. 0 (zero)
3. -0 (minus zero)
4. 0n (BigInt zero)
5. '', "", `` (empty string)
6. null
7. undefined
8. NaN

Truthy values are:

1. '0' (a string containing a single zero)
2. 'false' (a string containing the text “false”)
3. {} (an empty object)
4. an empty array
5. function(){} (an “empty” function)

By writing if condition or passing value to the boolean constructor function, we can check if a value is truthy or falsy.


**Null Vs Undefined**
1. Null is an object where undefined is a type. 
2. Null is a declared and assigned value where undefined is just a declared variable.

`var example;
alert(example); // output -> undefined`

`var example = null;
alert(example); // output -> null`

Moreover, we can check if null & undefined are the same or not. 
`null === undefined // false
null == undefined // true`


**Double equal (==) vs triple equal (===)**
Both do the comparison between variables. But the difference between them is that (==) checks for value equality by doing type coercion. That means, if we are performing (==) operation between ‘6’ (string) & 6 (number), the output is true, which is false for (===) operation, because (===) does not allow type coercion. So, we can say, (===) is superior to (==). (==) is also known as a loose, abstract or type converting equality operator. 


**Implicit conversion**
It is also known as automatic type conversion or implicit coercion. JS converts an unexpected value type to an expected value type for performing operations. 

We can find implicit conversion to number, to string, implicit boolean conversion to number, null conversion to number.

**Implicit conversion to number:**

`let result;`

`result = '3' - '2'; 
alert(result); // 1`

`result = '3' - 2;
alert(result); // 1`
`
result = '3' * 2;
alert(result); // 6`

`result = '3' / 2;
alert(result); // 1`

When we perform -, /, * operations between a number and string or between two strings, the string is automatically converted to a number before performing the operation. 


**Implicit conversion to string:**

`let result;`

`result = '2' + 2; 
console.log(result) // "22"`

`result = '2' + false; 
console.log(result); // "2false"`

When we add a number to a string in JS, the number is automatically converted to a string before performing the operation. 


**Implicit boolean conversion to number:**

`let result;`

`result = '3' - true;
alert(result); // 2`

`result = 3 + false;
alert(result); // 3`

JS converts false as 0 and true as 1 in type conversion.


**Null conversion to number:**

`let result;`

`result = 3 + null;
alert(result);  // 3`

JS converts null as 0 in type conversion. But for undefined, JS converts it as NaN.
Optimize Mongodb aggregates
Tags: mongodb, aggregate, pipeline, optimization
Published: 2021-12-21 19:53:51

---
title: Optimize Mongodb aggregates
published: true
description: TL;DR tips for mongodb aggregate optimization 
tags: mongodb, aggregate, pipeline, optimization
---

NoSql queries can quickly become time consuming if queries rely on relating data across collections with large datasets.

You may be running into query time outs trying to generate a report on data.

In order to minimize the data query has to look through(hence time) do these two steps(if applicable) on every stage

## $project
`$project` only fields that will be needed in proceeding stages.

## $match
Narrow down data before `$lookup` and `$group` or after `$unwind` using `$match`

Yep thats it. If there is anything you do to optimize your aggregate piplines or know of a better way. Teach me!
Self-made animation comedy series for programmers: Learning databases from scratch to crash~~
Tags: beginners, tutorial, programming, database
Published: 2021-12-22 01:38:29

Just uploaded the first episode on [YouTube](https://www.youtube.com/watch?v=yzggvHKRMe4) Self-made animation series for programmers. Hello, everyone. My name is Amber Moe and I'm a technical writer, a database lover. This video shows why I quit learning databases. It seems I have a lot of trouble installing a database. Learning databases from scratch to crash~~ Just can't make it. Forget it. Did you ever learn something from scratch to crash? What did you quit learning? And what makes you crash? Tell me by leaving your comments.
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/d5hqem5ntkooxgw4tog8.jpg)
Master Frontend by doing Frontendmentor challenges
Tags: beginners, tutorial, css, webdev
Published: 2021-12-22 05:08:30

If you are looking for projects to practice your Front-end skills like CSS, JavaScript, and React, then you are in the right place. 

In this series, I’m going to build projects from the frontendmentor.

![Frontendmentor image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2hxagko78zrpgk03ri97.png)
 

.


## [Frontendmentor] (https://www.frontendmentor.io/)

. 

Frontendmentor is a place where you can find projects to practice your frontend-related skills like CSS, JavaScript, and React.  They got hundreds of free and paid challenges. 

So, I decided to do the challenges and share them as tutorials with you. 

I’ll write articles and make videos of the challenges as I complete them. 

Cause learning together is much more fun than learning alone. 

If that sounds Interesting you can 

### subscribe to my [YouTube channel ](https://www.youtube.com/channel/UCiHUi4wJ6rkPSQ5n4bxKU1A) and follow me here to get the articles and videos as I post them.

.

{% youtube VIqOujcceIE %}


### Conclusion

Thanks for reading.
You can also connect with me on twitter at [coderamrin](https://twitter.com/CoderAmrin)

Have a good one :D