teleren/devto huggingface dataset:
What you may not know about loops in JS - part 1 - for loop
Tags: javascript, programming, tutorial
Published: 2021-07-08 15:38:17

You may have used *for* loop, *for/of* and *for/in* a million times on your code and you probably know by now that it is used for iterating an array or object keys (or values) and execute some code within the looping statements. 

Javascript has five looping statements: *while*, *do/while*, *for*, *for/of* (and its *for/await* variant), and *for/in*. What I am going to focus upon is *for*, *for/of* and *for/in* loops.  

## for

You may very well know the syntax of a *for* loop
```
for(initialize ; test ; increment)
    statement
```
and the most common example of a *for* loop is 
```
for(let count = 0; count < 10; count++) {
    console.log(count);
}
```
(In the above syntax, javascript evaluates *initialize* only **once before the loop begins**, *test* expression is evaluated **before each iteration** and only if it evaluates to a **truthy** value then the statement in the body of loop is executed. Finally the *increment* expression which can be an assignment expression or ++ or -- operators is evaluated.)

Loops are not that simple always, it can get complex like the below example, where you can initialize and increment multiple expressions by using comma separators. 
```
let i, j, sum = 0;
for(i = 0, j = 10 ; i < 10 ; i++, j--) {
    sum += i * j;
}
```
Now to the interesting fact of loops, in all of the above examples the variables were numeric, like `i = 0` and `j = 0`, it does not have to be so. For example,
```
// Return the tail of linked list x
function tail(x) { 
// Traverse while x.next is truthy                         
 for(; x.next; x = x.next) /* empty */ ; 
 return x;
}
``` 
The above for loop is used to traverse a linked list data structure and return the last object in the list and the first object does not have a next property. 

Notice that the above code has no *initialize* expression.

**In a *for* loop any of the three expressions may be omitted, but the two semicolons are required.**

Now what happens if you omit the *test* expression ? The loop repeats infinitely.
```
for(;;){
console.log("Eternity"); //logs infinitely 
}
```
Now you know how you can create an infinite loop other than using `while(true)`
![infinite loop dog giffy](https://media.giphy.com/media/4WF4XZtGgo1YgGGk1Z/giphy.gif)

In the next part I will be sharing interesting facts on [*for/of* and *for/in* loops](https://dev.to/ms_74/what-you-may-not-know-about-loops-in-js-part-2-for-of-for-in-2mih). 

---
Mariam Reba Alexander,
Frontend developer at Maersk.
Prisma generated types can hinder changing the database layer later on?
Tags: database, architecture
Published: 2021-07-08 15:29:47

I recently heard about `prisma` and wanted to try it. I really liked the simple interface it provides and the level of type saftey. however, I have one question. when we use `prisma` to query an entity, the response we get has a type that comes from `@prisma/client` ( prisma generated ). Though it has some advantages but this is where I think that a violation of open closed principle can occur. In the future if I want to change the database layer or the orm to `typeorm` then all the return types of my service methods have to be changed to reflect my entities (rather than previously prisma generated types). Think of it in context of nestjs where we have entities that are our common return types. Is there a way we can solve this problem with prisma? Or it is not a problem at all?
.parent .child vs .parent > .child css selector
Published: 2021-07-08 15:15:46

## Introduction
## The .parent .child selector
## The .parent > .child selector
## After words

`styles.css`
```css
body {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-size: 1.5rem;
    color: #fff;
}
.parent .child {
    background: darkblue;
    margin: 1rem;
}
.parent>.child {
    background: brown;
}
```

`index.html`
```html
<div class="parent">
    <div class="child">This is brown</div>
    <div class="one">
        <div class="child">This is yellow</div>
    </div>
</div>

<div class="parent">
    <div class="one">
        <div class="child">Why is thid yellow?</div>
    </div>
</div>
```

[Inspiration](https://stackoverflow.com/questions/26957184/css-selector-difference-element-element-vs-elementelement/26957235)
AspNet Core Web API Basics to Advanced Part1
Published: 2021-07-08 15:12:43

**What is Web API.**
API stands for Application Programming Interface, which in simple terms allows two applications to talk to each other. 
![AspNet Core Web API ](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/nywdqjvi3rkcphskfati.JPG)

**ASP.NET Web API** is Microsoft .Net framework for building HTTP services that can be accessed from any client such as browsers, desktop applications and mobile devices. ASP.NET Web API can be used to build both RESTful and SOAP services. 

**ASP.NET Web API Core** ASP.NET Core is an open-source, cross-platform framework for building modern, cloud-based web apps and we can chose whatever platforms we want to build them on. We can build and run ASP.Net Core applications on Windows, macOS or Linux. Some of the benefits we get when working with ASP.Net core are:

1. It is a cloud-ready. 
2. Comes with Built-in dependency injection. 
3. Very lightweight.
4. High-performance and modular HTTP request pipeline.
5. We can host ASP.Net Core applications on IIS, Nginx, Apache and Docker.

**Let us build our first Web API in ASP.NET Core5**
To build a project select create a new project.
![AspNet Core Web API ](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/wa7y5lqv7lmogdqynuc9.JPG)

Select ASP.NET Core Web API
![AspNet Core Web API ](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/i8qa7kmsxpx0fhogv9c7.JPG)

Select where we want to save it.
![AspNet Core Web API](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/112uk9d5mfi096irwm34.JPG)

For the last step, select additional information. I am leaving everything as default but in future series we will investigate other options.
![AspNet Core Web API](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/g98921igrff43jsl839b.JPG)  

Now build and compile your Web API and you should see your WeatherForecast Endpoint.
 ![AspNet Core Web API](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/s0158qge0otpwouoawtl.JPG)

 [AspNet Core Web API Part 2 Database Context >>](https://dev.to/scorpio69/web-api-net-core-basics-to-advanced-part2-db-dco)
Episode 8: More Power To You
Tags: management, mentorship, leadership, teams
Published: 2021-07-08 14:59:27

Jason and Bojan have double-booked! Consultant Amber Vanderburg and conference organizer @laisbsc visit the café to talk about bugs in communication and teams.

As the four share their leadership war stories, Marta works to keep the café's power supply stable, with mixed results.

{% podcast https://dev.to/bughunters/episode-8-more-power-to-you %}

---

[Amber Vanderburg's Website](https://www.ambervanderburg.com/)

[The Pathwayz Group](https://www.thepathwayzgroup.com/)

[Laís Carvalho's Twitter](https://twitter.com/lais_bsc)

[MidMeetPy](https://midmeetpy.org)

[PyJamas Conf](https://pyjamas.live/)

[Joshua Jacob's LinkedIn](https://www.linkedin.com/in/joshuajacobsphd)

["The Checklist Manifest" by Atul Gawande](http://atulgawande.com/book/the-checklist-manifesto/)

["The Secrets Behind great One-on-One Meetings" by Esther Schindler](https://www.oreilly.com/library/view/the-secrets-behind/9781491995112/)

Music by: [https://audionautix.com](https://audionautix.com)

Sponsored by Softerrific: [https://www.softerrific.com/](https://www.softerrific.com/)
cuda-gdb error with libtinfo.so.5
Tags: tutorial, cuda, troubleshooting, manjaro
Published: 2021-07-08 14:50:33

Originally Published on [bevs.xyz](https://bevs.xyz/blog/2021/07/cuda-gdb-libtinfo.so.5/)

I had a fresh install of cuda-tools from the Manjaro software repository and I simply couldn’t run **cuda-gdb**. I was getting the following error

```bash
cuda-gdb: error while loading shared libraries: libtinfo.so.5: cannot open shared object file: No such file or directory
```

A related error was as follows:

```bash
cuda-gdb: error while loading shared libraries: libncursesw.so.5: cannot open shared object file: No such file or directory
```

I had to investigate the files `libtinfo.so.5` and `libncursesw.so.5`. It was a simple version-conflict with ncurses. My distro had **ncurses 6.2**, whereas cuda-gdb was insisting on **ncurses 5**. A simple symlink was in order, actually two. The following two lines saved my day!

```bash
sudo ln -s /usr/lib/libncursesw.so.6.2  /usr/lib/libtinfo.so.5

sudo ln -s /usr/lib/libncursesw.so.6.2  /usr/lib/libncursesw.so.5
```
I got the necessary pointers from this [stackoverflow answer](https://stackoverflow.com/a/42686791/16394350) for an unrelated Android Studio question.
XML, making everything just a little bit harder.
Tags: python, xml, standards
Published: 2021-07-08 14:50:28

So here's a fun exercise in XML, standards, and data catalogs.

I'm working on ingesting a bunch of records from a variety of data catalogs, of a variety of types. One I'm looking at now uses [OAI-PMH](https://www.openarchives.org/pmh/). Fortunately there's a nice little Python library called [Sickle](https://sickle.readthedocs.io/en/latest/) that abstracts most of the pain away. Until you're dealing with non Dublin Core datasets. 

Sickle does allow you to [plug in a parser](https://sickle.readthedocs.io/en/latest/customizing.html) for other types (oh hi XPath, I haven't missed you _at all_)

The dataset I'm using uses the [ANZLIC profile](https://www.anzlic.gov.au/resources/asnzs-iso-1911512015-metadata) for OAI-PMH (fun side note, the official repo for the info had a [broken link](https://github.com/rd-alliance/metadata-directory/pull/83) to the standard, because bitrot even comes for ISO committees.) It's catchier name is "AS/NZS ISO 19115.1:2015 Metadata". 

So I need to write a custom parser for this.

Then I hit this, when looking for keywords in a data record.

```
<gmd:descriptiveKeywords>
  <gmd:MD_Keywords>
    <gmd:keyword>
      <gco:CharacterString>040104</gco:CharacterString>
    </gmd:keyword>
    <gmd:thesaurusName>
      <gmd:CI_Citation>
        <gmd:title>
          <gco:CharacterString>Australian and New Zealand Standard Research Classification</gco:CharacterString>
        </gmd:title>
        <gmd:alternateTitle>
          <gco:CharacterString>ANZSRC</gco:CharacterString>
        </gmd:alternateTitle>
        <gmd:date>
          <gmd:CI_Date>
            <gmd:date>
              <gco:Date>2008</gco:Date>
            </gmd:date>
            <gmd:dateType>
              <gmd:CI_DateTypeCode codeList="http://asdd.ga.gov.au/asdd/profileinfo/gmxCodelists.xml#CI_DateTypeCode" codeListValue="creation">creation</gmd:CI_DateTypeCode>
            </gmd:dateType>
          </gmd:CI_Date>
        </gmd:date>
      </gmd:CI_Citation>
    </gmd:thesaurusName>
  </gmd:MD_Keywords>
</gmd:descriptiveKeywords>
```

What on *earth* is this nonsense? So we can ignore the date code bit (fun sidenote, the asdd.ga.gov.au domain no longer exists, lucky it's not important - I reckon I can interpret "2008" as a date without an xsd file)

So obviously `040104` is a reference to something.

A bunch of googling and staring at the wall finally led me to the Australian Bureau of Statistics, in particular to standard [1297.0 Australian and New Zealand Standard Research Classification (2008)](https://www.abs.gov.au/statistics/classifications/australian-and-new-zealand-standard-research-classification-anzsrc/latest-release) is the current version.

From there, you can go to the downloads tab, and find the table where it maps the 2008 codes to 2020 codes. In a 1.5Mb Excel file. So I exported out the relevant bits of the 2008 codes, throw them in a small sqlite db, and end up with `040104,Climate Change Processes`

So all that XML up above? It could have just been
```<keyword>Climate Change Processes</keyword>```

But nooooo.
Variables
Tags: csharp, beginners
Published: 2021-07-08 14:49:47

A variable is a value that can change in your program.

## Creating a variable

The structure to create a variable consists of:

```csharp
<Data Type> <Name> = <Value>;
```

### Data Type

Tells the program what type of variable it is, these can be `int`, `decimal`, `string`, `char` and others.

### Name

A unique name to identify it.

### Value

The value of the variable.

### Some examples

```csharp
int i = 10;
decimal d = 5.67;
float f = 7.90;
double d2 = 1.23;

string s = "string";
char c = 'c';

boolean b = true;
byte bt = 64;
```

Notice that a string is defined by using doble quotes `"`, while a char is defined by using single quotes `'`.

## Array variables

We can also create a variable type that is the `array` type, these variables are a list of values of a certain type.

Once an array is created, you can update its values, re-assign, but not extend its size.

### Creating an array

```csharp
<Data Type>[] name = new []{ };

or

<Data Type>[] name = new <Data Type>[<number of entries>];
```

Arrays are defined by adding `[]` after the data type, and can be assigned using one of the two forms.

### Form 1

```csharp
<Data Type>[] <Name> = new []{ <value1>, <valiue2> };
```

In this example, you create an array, that has a length of 3.

```
int[] arrayOfIntegers = new []{ 1, 2, 3 };
```

In this form, you don't need to specify the

### Form 2

```csharp
<Data Type>[] <Name> = new <Data Type>[<number of entries>];
```

In this example, you create an array, that has a length of 4.

```
int[] arrayOfIntegers = new int[4];
```

When creating an array in this form, the array will have 4 entries and all set to its default value, which in this case is 0.

### Assigning values

You can assign values to an array by using its index, which starts at 0 and ends with its length - 1;

```csharp
arrayOfIntegers[0] = 1;
arrayOfIntegers[1] = 2;
arrayOfIntegers[2] = 3;
arrayOfIntegers[3] = 4;
```

## Constants

You can create variables that cannot change after being initialized. These types of variables are called constants.

### Structure

```csharp
const <Data Type> <Name> = <Value>;
```

### Example

```csharp
const int constantIntegerValue = 30;
```
How to force jvm to share same memory pool between two string object? intern() in java.
Tags: java, codenewbie, tutorial
Published: 2021-07-08 14:38:28

     String str1 = new String ("javaoneworld"); 
      String str2  = new String ("javaoneworld");

    System.out.println(str1 == str2); //false but it can be true also 🤔
    /*
      * as we initializing str1 and 
    str2 with new keyword so they 
    will not share the
      * same memory pool
      */

      System.out.println(str1 == str2); //false
     
But what if I want true for the above statement?

How ?

So the only way to get this is ,if somehow we force jvm to share the same memory pool to both the variable.

So is it possible?

Yes absolutely, it's possible, click on below to see how.


      /*
	 * using the intern() method we can force both the string to share same memory
	 * pool
	 */
      
         str1 = str1.intern();
         str2 = str2.intern();
      
         System.out.println(str1 == str2); //true
    

https://www.javaoneworld.com/2021/07/java-amazing-interesting-and-cool-tricks.html?m=1

#code #codechallenge﻿﻿
#coders
#coderlife
#CodeIgniter
#java
#javadevelopment
#javadeveloper
#javacode
#javatricks
Build a Notes App in JavaScript with Local Storage 🖊📒
Tags: javascript, html, css
Published: 2021-07-08 14:15:53

A notes app is a great project for anyone learning HTML, CSS and JavaScript as it allows you to explore 3 key layers of a front-end application:
* interacting with API
* business logic
* UI (view)

# Tutorial
I'd usually go into detail of the code in these posts, but this project is a little too big. *Instead*, I'll give an overview and if you want more detail, you can check it out on my YouTube channel, **dcode**:

{% youtube 01YKQmia2Jw %}

# View the Source Code
Source code is available on GitHub:

{% github dcode-youtube/notes-app-javascript-localstorage no-readme %}

## Local Storage API
We'll have a `NotesAPI.js` file which contains 3 static methods for a basic CRUD operations:
* `getAllNotes()` - retrieve all notes from Local Storage
* `saveNote()` - saves a single note (insert OR update)
* `deleteNote()` - deletes a note

## UI (View)
Another file, `NotesView.js` will contain a class which we instantiate, and will take in the root `#app` element as well as a few event-based functions:
* `onNoteSelect` - when the user clicks on a note in the side bar
* `onNoteAdd` - when the user clicks on the "Add Note" button
* `onNoteEdit` - when the user makes a change to the note title or body
* `onNoteDelete` - when the user wants to delete a note

We then have various methods in the view that will update parts of the UI:
* `updateNoteList()` - updates all the notes in the side bar
* `updateActiveNote()` - sets a note as active

## Tying It All Together
In an `App.js` file, we tie the API layer and the UI layer together by hooking onto the handlers to perform our CRUD actions. This can also be thought of as a "controller".

**All done** 🚀
Diving Into DevSecOps (Part 2) w/ John Willis
Tags: devops, devsecops, security, devteam
Published: 2021-07-08 14:11:19

The second and final interview with John Willis on the [Dev Interrupted podcast](https://devinterrupted.com/podcast/what-is-devsecops-part2/).

John Willis is a legendary DevOps speaker, mentor and author of [The DevOps Handbook](https://www.google.com/search?q=the+devops+handbook&rlz=1C1CHBF_enUS949US949&sxsrf=ALeKk029-roPGTB6J_bWkBb9WvzA5-1z8g:1624995751185&ei=p3fbYI7wCs6m-wSwn7fIBA&start=0&sa=N&ved=2ahUKEwjO34r0zL3xAhVO054KHbDPDUk4ChDy0wN6BQgBEJkB&biw=1920&bih=937). In this special 2-part DevSecOps series, John takes us on a DevSecOps journey from the origin of the term all the way to how software developers at the team level can implement the practice.

#**Listen to the full episode**
{% spotify spotify:episode:0O2dPW1cXOTIraSmGwV1wk %}

#**Episode Highlights include:**
* What DevSecOps means at the team-level
* First steps for implementing DevSecOps strategies at your organization
* Why it’s critical to start thinking about security more holistically
* The difference between Security, Compliance, Governance & Risk
* What is coming next for software development security

#**Join the Dev Interrupted Discord Server**
With over 1200 members, the Dev Interrupted Discord Community is the best place for Engineering Leaders to engage in daily conversation. No sales people allowed. [Join the community >>](https://discord.gg/tpkmwM6c3g)
![Join the Dev Interrupted Discord Community!](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/19j3dzgz4r4kzav3w6z8.png)
Art of Debugging
Published: 2021-07-08 13:53:32

This week my mentor taught me something very important , something called the art of debugging, or in his words , the System Engineering way of debugging. In essence what he taught me was how to look at debugging as a process, step by step, stripping the issue down to its bones and working your way up from there. 

Lets begin,

In debugging we should look at it as a 3 step process , similar to how any system works , theres an input , it's processed and it produces an output.

![Screenshot 2021-07-08 at 9.34.54 PM](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ebes6knrycajjavnbmd4.png)

when we look at the whole system, we start at the input. when debugging an issue , we look at what are the inputs we have entered into the system. For starters we look at the documentation provided , question ourselves if there is any way we deviated from the documentation , or before trying new things you've seen on stack overflow , use the tools provided in the documentation. Secondly we look at the semantics , did we leave out something , or did we not provide the right type needed for the input. 

Next we look at the output , asking ourselves , why is this not the outcome i was expecting. Likewise we look at the documentation and semantics, is this supposedly the outcome we are supposed to get? or did i leave something out somewhere.And if all that fails , we look into the middleman , the process.

Looking into the process, is something somewhere within our process wrong , in this case of the image below, with the multiplication process we would expect the result of 2 and 5 to be 10 , but instead it returned 7. So we dive into our process and start the process of checking from input to output to process again.The regression of debugging and checking then begins. 
![Screenshot 2021-07-08 at 9.46.55 PM](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/904wntyn7ygrffxqbmci.png)
 
As someone who panics and doesn't have a clear path on how to debug , this showed me a clear structure on how i can go about debugging.
MercadoLibre Clone Free Using React Native (ecommerce)
Tags: mercadolibre, mercadolibreclone, reactnative, ecommerce
Published: 2021-07-08 13:49:33

Free Download MercadoLibre Clone App
https://github.com/JuanseMastrangelo/MercadoLibreClone

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/b36c183xglov64p7u5hk.gif)

App Features:
1. Login with Google Auth
2. Integration with MercadoPago. Enabled debit and credit card payments, or cash payments with rapipago y pagofacil. See more: https://www.mercadopago.com.ar/ayuda/medios-de-pago-cuotas-promociones_264
3. Uploading and update products from the administration panel at http://paback.host/

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/smi0bpr5xk9dgos77zkm.png)

4. Shipments with any shipping service. (Correo Argentino, MercadoEnvio, Andreani, among others).
5. Categories
6. Universal. The application adapts to the country.
7. Product statistics.
8. Comments
9. Real time chat with users to provide immediate attention.
HowTo: Recovery Mode for NVIDIA Jetson NANO Developer Kit
Published: 2021-07-08 13:36:11

Its easy, but hard to find online, hence here for myself:


  1. Connect Pins: *GND <-> FC REC*
  2. Power On

Observe how your host can see the device connected via its USB gadget as below in dmesg:

```
[85283.237504] usb 1-6.2: new high-speed USB device number 84 using xhci_hcd
[85283.366258] usb 1-6.2: New USB device found, idVendor=0955, idProduct=7f21, bcdDevice= 1.02
[85283.366279] usb 1-6.2: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[85283.366288] usb 1-6.2: Product: APX
[85283.366294] usb 1-6.2: Manufacturer: NVIDIA Corp.
```

Here the jumper cable and how I connected it for Recovery Mode (check the blue one):

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

Best wishes!
How to make the most from Tablegrid Control
Published: 2021-07-08 13:27:53

Hello everyone! 

We made this explanatory video that shows how simply you can customize various features of TableGrid Control. Just a little something to make the app building process a tad bit easier. 

Checkout the complete video through this link: https://www.youtube.com/watch?v=XVa3adxcHZQ