teleren/devto huggingface dataset:
Kotlin – Sort List of Objects with Comparable
Tags: kotlin, sort, comparable, list
Published: 2021-04-27 18:21:05

https://grokonez.com/kotlin/kotlin-sort-list-objects-comparable

Kotlin – Sort List of Objects with Comparable


This tutorial shows you way to Sort List of Objects by Kotlin <code>Comparable</code> example.

Related posts:
- <a href="https://grokonez.com/kotlin/kotlin-compare-objects-comparable-example">Kotlin – Compare Objects with Comparable Example</a>
- <a href="https://grokonez.com/kotlin/kotlin-sort-list-objects-kotlin-comparator-example">Kotlin – Sort List of Objects with Kotlin Comparator Example</a>
- <a href="https://grokonez.com/kotlin/kotlin-sort-object-list-kotlin-selector-function-crossinline-selector-t-r">Kotlin Sort Object List with Kotlin Selector function – crossinline selector: (T) -> R?</a>

<!--more-->
<h2>I. Technology</h2>
- Java 1.8
- Kotlin 1.1.2
<h2>II. Overview</h2>
<h3>1. Goal</h3>
Sort list of three <code>Date(year,month,day)</code> objects.
<h3>2. Steps to do</h3>
- Implement <code>Comparable</code> interface for the class of objects you want to sort.
- Override <code>compareTo(other: T)</code> method and:
+ return <em><strong>zero</strong></em> if this object is <em><strong>equal</strong></em> <code>other</code>
+ a <strong><em>negative</em></strong> number if it's <strong><em>less</em></strong> than <code>other</code>
+ a <em><strong>positive</strong></em> number if it's <em><strong>greater</strong></em> than <code>other</code>
- Use <code>sorted()</code> method that returns a <code>List</code>.
<h2>III. Practice</h2>
<h3>1. Create Class for objects to be sorted</h3>

more at:

https://grokonez.com/kotlin/kotlin-sort-list-objects-comparable

Kotlin – Sort List of Objects with Comparable
Flutter Create Expandable & Scrollable Text and TextField Widgets
Tags: flutter, textfield, widget
Published: 2021-04-27 18:11:38

If you would like to see the full context, check it out [HERE in my github repo](https://github.com/valerianaGit/Pregnancy-Journal/blob/main/lib/screens/journal_entry_screen.dart) 

##Text 

`Expanded(
       child: SingleChildScrollView(
         //scrollable Text - > wrap in SingleChildScrollView -> wrap that in Expanded
         child: Text(
           '',
           overflow: TextOverflow.visible,
         ),
       ),
     );`


##TextField 

`Expanded(
       //makes textfield scrollable - wrap in Expanded widget + maxlines = null
       child: TextField(
         maxLines: null, //wrap text
         autofocus: true,
         autocorrect: true,
         cursorColor: Colors.purple[900],
         decoration: InputDecoration(
           border: OutlineInputBorder(),
           labelText: 'Notes and Thoughts',
         ),
         onChanged: (newValue) {
           newContent = newValue;
         },
       ),
     );`

### Notes

* Read [Expanded documentation](https://api.flutter.dev/flutter/widgets/Expanded-class.html) - As of this writing, Expanded widget must be enclosed by a Row, column or flex widget. So do enclose the Expanded widget with whichever of these widgets will work for your content.
Send your leadership an anonymous message in Slack 👀
Tags: showdev, slack, anonymous, feedback
Published: 2021-04-27 18:10:25

I built a Slack app earlier this year so my coworkers and I could ask anonymous questions to our CEO during our town halls. It worked so well that I launched it to the public and have gained some awesome early traction. 

Slack has labeled my app **New & Noteworthy and a Brilliant bot!**

![Incognito for Slack](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/xtdgdur8h8rodzwubbm0.PNG)

The headline of the app is:

**Give your team a safe space**
Anonymous messages & polls for things like
* town hall questions
* ideation sessions
* leadership feedback

The goal is to help:
🗣️ Encourage open and honest feedback
💪 Empower your team by valuing their input
🔦 Spotlight common issues quickly
😶 Enable the voices of passive employees
⚖️ Level the playing field for all team members
💰 Reward the most helpful users anonymously


There is a **free tier** and a paid tier that you can try for 2 weeks for free without a credit card.


I'm very open to your questions and feedback as I'm still in the early days of iteration and growth! Thanks!
¿En qué se parece el mundo de la poesía al mundo Dev?
Tags: codenewbie, inclusion, a11y, css
Published: 2021-04-27 17:47:39

> *Por mis venas corren versos de html, css y JavaScript pero también líneas de código con las mejores estrofas que jamás podrías imaginar.*

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/1cwdiavlbn95xs7ggy5d.jpeg)

El código es poesía y quien diga lo contrario, miente. Cuando me metí a estudiar Frontend Dev no me había imaginado que podría estar tan vinculado con mi otro mundo artístico, en este caso el de la poesía, pero al igual que a través de versos, componiendo estrofas para formar un poema, un proyecto también se divide en líneas de código que cobran sentido a la hora de darle vida a una página web. El fin es el mismo, transmitir algo que haga sentir al espectador.

El mundo poético es un mundo de escucha activa, de dejarse llevar a la hora de escribir, de sentir como bombea tu corazón por cada palabra, de ponerse a navegar por mar abierto y que los poros de tu piel se abran en canal y respiren la brisa de cada ola que surfeas. Por otro lado, en el mundo del desarrollo también hay que saber escuchar, tanto a nosotros mismos, como a los que tenemos alrededor, de visualizar que es lo que queremos transmitir a través de cada proyecto y de izar las velas de ese barco cargado de poesía para darle color a nuestro css, poniendo rumbo al puerto react a estribor o al puerto vue a babor.

Ambos mundos son cooperativos, ayudarnos unos a otros, compartir conocimientos, mucha comunicación y empatía, son la clave principal para que todo funcione de una manera fluida.
Recuerda, que hagas lo que hagas, sé tu mismo siempre y no te dejes llevar por la fama, o por ciertos beneficios suculentos que sólo te llevarán por el mal camino, ten los pies en la tierra y sé humilde.

Por último, quiero destacar lo que considero de vital importancia y es que para que todo funcione de manera bonita, tiene que ser accesible para todos, inclusivo, diverso y respetuoso.

Y pase lo que pase, cuídate. Tu salud y tú, vais primero que cualquier console.log('Hola Mundo');
Bit Confused 😬
Published: 2021-04-27 17:46:16

Ok so just come to the point 
I have a laptop 
I want to install a SSD in it and i did that .
I cloned my window to that SSD too.
But i have a doubt that my system is running on SSD now but what if i install a game on the hard drive on my laptop will that work with HARD DRIVE SPEED or there would be some Speed boost by the SSD i installed ??
AWS Solutions Architect Professional tips and tricks
Tags: aws, cloud
Published: 2021-04-27 17:43:41

---
title: AWS Solutions Architect Professional tips and tricks
published: true
description: AWS Solutions Architect Professional tips and tricks
tags: aws, cloud
cover_image: https://dev-to-uploads.s3.amazonaws.com/uploads/articles/r5qgtm0l8pl7r3q4gtii.png

---

Is the time of the year to renew my AWS Solutions Architect certification as they are only valid for three years. 


### hands-on experience

The AWS SA Professional exam (SAP-C01) is considered one of the most difficult exams from the AWS certification program, mostly because it covers multiple AWS services, all the way from IAM to AWS direct connect. Also, the questions are based on real case scenarios compared with most theoretical questions in the AWS Solutions Architect **Associate**. 

In the following weeks, I'll add a series of posts about my learning path and share some useful tips and tricks along the way to get certified.
GitLab for dUmMiEz
Published: 2021-04-27 17:36:10

As an amateur coder and user of all services like GitLab and GitHub, I am constantly trying to navigate the internet to find the best tools to suit my needs.

It is a little tricky to recognize the difference between GitLab and GitHub, but the easiest way to understand it is that GitHub is a **public** server and GitLab is primarily a **private** server. With GitLab code can be edited in real time in a private environment, whereas in GitHub everyone has access to make changes and add information as they see fit.

In order to get going using GitLab, you can follow the steps below OR follow along with my youtube video which is linked at the bottom of this post.

1. First you are going to need some kind of **host** for GitLab. I used ReclaimCloud, which is a service that allows you to only pay for what you need, instead of a subscription based situation.

2. When you get into ReclaimCloud you are going to want to find the DevOps GitLab server under Marketplace>Dev & Admin tools. Once you find this you will install it.

3. Once installed make sure to press the Change Environment Topology button, and increase the speed to maximum, and apply. 

4. After this is complete click on the link under the GitLab server, which will take you to a login page with GitLab.

5. Check your email for login information!

6. Now you are good to go to add repositories to your GitLab!

Hopefully this was helpful for beginners like me, and don't hold back from checking out my youtube video: https://youtu.be/KT_JRhobpbY
Kotlin Array sort(), sortBy(), sortWith()
Tags: kotlin, array, sortby, sortwith
Published: 2021-04-27 17:30:47

https://grokonez.com/kotlin/kotlin-array-sort-sortby-sortwith

Kotlin Array sort(), sortBy(), sortWith()

In the tutorial, <a href="https://grokonez.com">JavaSampleApproach</a> will guide how to sort Kotlin Array by <code>sort()</code>, <code>sortBy()</code> with <strong>selector</strong> function, and <code>sortWith()</code> with a <strong>comparator</strong>.

<!--more-->
<h2>I. Kotlin Array sort()</h2>
<h3>1. sort()</h3>
Method signature:

<pre><code class="language-java">fun &lt;T : Comparable&lt;T&gt;&gt; Array&lt;out T&gt;.sort()</code></pre>

-> Sorts the array in-place according to the natural order of its elements.

<strong>Practice</strong>:

<pre><code class="language-java">val simpleArray = arrayOf(1, 4, 2, 20, 3, 40, 23, 12, 51)

// fun &lt;T : Comparable&lt;T&gt;&gt; Array&lt;out T&gt;.sort()
simpleArray.sort()
simpleArray.forEach { print(&quot;${it} &quot;) }
/*
	-&gt; 1 2 3 4 12 20 23 40 51
*/</code></pre>

For descending sorting, we can use <code>sortDescending()</code>. Method signature:

<pre><code class="language-java">public fun &lt;T : Comparable&lt;T&gt;&gt; Array&lt;out T&gt;.sortDescending(): Unit</code></pre>

<strong>Practice</strong>:

More at:

https://grokonez.com/kotlin/kotlin-array-sort-sortby-sortwith

Kotlin Array sort(), sortBy(), sortWith()
Salesforce Acquisitions and use
Published: 2021-04-27 11:55:42

2020: **Slack**: Platform for chatting and work collaboration against traditional Emails conversations.

2019: **Tableau**: Data handling tool like Excel

2018: **Mulesoft**: Helps to integrate different application with each other

2016: **DemandWare**: Cloud Commerce B2C

2013: **ExactTarget**: One to One Email marketing Software. Pardot was part of Exact Target.

2019: **ClickSoftware**: Field service management software like it tracks plumber, Computer Technician or couriers capacity, Location, Work they are doing, 

2013: **Krux** (Salesforce DMP): Data Management Platform. Intelligent Marketing Hub to capture, control, and connect consumer data across screens and sources”. In a nut shell collects traffic across devices and channels, analyzes and presents insights.

2016: **Quip**: Living document platform tool. Like Google Docs.

2012: **BuddyMedia**: It paired with Social Studio and become part of Marketing Cloud. It is social media marketing platform

2020: **Acumen Solution**: Business and Technology Consulting firm

2020: **Vlocity**: Industry specific solutions on salesforce platform.  it also controls, regulations, laws etc. taken into consideration when designing the solutions.

2018: **Datorama**: AI powered marketing intelligence and Analytics platform for Enterprises, agencies and publishers.

2020:**Evergage**:software that allows users to collect, analyze, and respond to user behavior on their websites and web applications in real-time

2015:**SteelBrick LLC**:Now Salesforce CPQ (configure, price, quote). For creating accurate pricing/quotation.

2018:**CloudCraze Software LLC**: Now Salesforce B2B Commerce Cloud

2016: **Coolan Inc**:

2016:**MetaMind Inc**: Artificial Intelligence

2014:**Relate IQ**: salesforce iQ 

2013:**IGo Digital**: ecommerce

2015:**Steel Brick Holdings Inc**: Quote to cash application

2016:**Hey Wire**: messaging channel for service cloud

2019:**Diffeo**: Intellegence tool collecting data from MS note one, OUtlook etc

2016:**CQuotient** Assembles data from Transactions, Emails, mobile usage, product detail, etc

2019:**Griddable Inc**:Makes smart Grid for Enterprise data

2016:**BeyondCore Inc**:Data Analytics tools
My first API Project. 
Published: 2021-04-27 17:05:16


Here i am going to talk about how i came to build the API i did and what challenges i faced while building it. I was going to do a D&D character page when you click on a button you would have got a different character and a weapon and a portion. But it didn't have the data i needed to do it. So i decided on a simple deck of cards with functionality. Here i added the fetch function where it produced a different card every time you click the button. I did come across a few hiccups while writing the code. Which doesn't make sense. It was linking my style page. Because all i did was delete it and coded it again and it worked. Here is a bit of code i used for the function. function changeCard() {
  fetch('https://deckofcardsapi.com/api/deck/new/draw/?count=2')
  .then(function(response) {
    return response.json();
  })
  .then(function(json) {
    console.log(json)
    console.log(`Your card is the ${json.cards[0].value} of ${json.cards[0].suit} `);

    let h3 = document.createElement('h3')
    h3.textContent = `Your card is the ${json.cards[0].value} of ${json.cards[0].suit}`;
    let body = document.getElementById('body');
    body.appendChild(h3);

      let img = document.createElement('img');
      img.setAttribute('src', `${json.cards[0].image}`);
      body.appendChild(img);
  });

  let button = document.getElementById("try")
  button.addEventListener("click", changeCard);

  And the code for the button i added. I really like the fetch function and how you are able to pull the data using it.
Filter out `falsy` values
Tags: javascript, codenewbie, beginners, webdev
Published: 2021-04-27 16:59:36

```js
const arr = ["hello", false, 0, "", 7, true, "0", [], {}, null];
const filteredValues = arr.filter(Boolean);

console.log(filteredValues); //  [ 'hello', 7, true, '0', [], {} ]
```

---

**Thanks for reading 💙**  
Follow **@codedrops.tech** for more.  
[Instagram](https://www.instagram.com/codedrops.tech/) ● [Twitter](https://twitter.com/codedrops_tech) ● [Facebook](https://www.facebook.com/codedrops.tech/)

Micro-Learning ● Web Development ● Javascript ● MERN stack ● Javascript  
**[codedrops.tech](https://www.codedrops.tech/)**

---
**Projects**  
[Note Box](https://chrome.google.com/webstore/detail/note-box/mbbajjgefpenmkkhcnmmnoodlbcbfnmp) - A chrome extension to add notes/todos based on URL  
[File Ops](https://marketplace.visualstudio.com/items?itemName=mehullakhanpal.file-ops) - A VS Code extension to easily tag/alias files & quick switch between files
QUEUES FUNDAMENTALS
Published: 2021-04-27 16:58:39

Queue is FIFO data structure, in which the element added first would be deleted first. The basic operations of queues are dequeue and enqueue. Operation which is performed in the front(queue) is called enqueue and operation which is performed in the end(queue) is called dequeue. Elements are arranged sequentially in a queue, so they are called as linear data structures.
EXAMPLES:
1.The one who visits the stop first is served first.
2.Waiting list for train and bus tickets
3.Disk scheduling and CPU task scheduling 
There are 4 types of queues, they are:
1.Linear Queue
2.Priority Queue
3.Circular Queue
4.Dequeue 

-> LINEAR QUEUES:
 Insertion happens from 1 end and deletion happens from another end. The end where insertion occurs is called the rear end, and the end where deletion occurs is called front end. It follows the FIFO rule. Here is an example,
10     20       30    ----
front   rear

----   20       30     -----

     front      rear

We can see that front points to next element, and element previously pointed was deleted. But there's a drawback, insertion is only done from rear end.

CIRCULAR QUEUE:
Here, all nodes are presented as circular. It's alike to linear Queue but the last element is connected to first element. It's called Ring Buffer since all ends are connected.
The drawback in linear queue could be solved by using circular queue. If empty space is available, the new element could be added in the empty space by just incrementing rear value.

PRIORITY QUEUE:
The priority queue is a unique type of Queue in which every element has priority correlated with it. According to the priority of an element, they are arranged in the priority queue. If same priority elements occurs, they are set out accordingly(FIFO).

Here, insertion happens according to the arrival and deletion happens according to the priority.

DEQUEUE:
Dequeue doesn't follow the FIFO principle. Insertion and deletion is possible from both ends.
Cookie - a complete landing website for your next project.
Tags: jekyll, landingwebsite, tailwindcss, opensource
Published: 2021-04-27 16:56:30

---
title: Cookie - a complete landing website for your next project.
published: true
description: Cookie is a Jekyll and Tailwind CSS based static website that makes the whole process of creating and launching landing websites extremely easy.
tags: Jekyll, LandingWebsite, TailwindCSS, OpenSource
canonical_url: 'https://www.abhinav.co/cookie'
---

Recently, while working on a project, I got fascinated with the idea of using a [static site](https://www.abhinav.co/static-websites) as a landing website, and markdown to power additional supporting pages and blog posts. And the outcome is Cookie.

You can checkout code on [Github](https://github.com/abhinavs/cookie)

Cookie is a Jekyll and Tailwind CSS based static website that makes the whole process of creating and launching landing websites extremely easy. With its responsive, mobile-friendly pages, integrated blog, additional pages, and [Soopr](https://www.soopr.co) integration, it can help you focus on building your product than landing website.

## Demo
You can see demo app deployed [here](https://cookie-demo.netlify.app/)

Cookie also uses Tailwind 2.0 which is a utility first CSS framework and makes the process of iterating on the homepage a lot easier.

## Features
* Well-designed landing page
* Responsive and mobile-friendly
* Additional pages like about us, terms of service & privacy policy
* Integrated blog, write content in markdown format
* Easy to customize using Tailwind CSS
* Fast and performant website
* SEO optimized
* RSS feed
* Easy to deploy on platforms like Heroku, AWS, Netlify & Vercel. One-click deploy on Netlify is also possible
* Easy to integrate with headless CMS like [Forestry](https://forestry.io/)
* [Soopr](https://wwww.soopr.co) integrated - easy to customize share & like buttons, URL shortening, and website analytics
* Free & MIT Licensed

## Deployment
You can check out [Github](https://github.com/abhinavs/cookie) or [my blog](https://www.abhinav.co/cookie) for more details on customization and deployment. Do try it out for your next project.

## Acknowledgement
Cookie uses landing page provided by [Tailwind Starter Kit](https://www.creative-tim.com/learning-lab/tailwind-starter-kit/presentation) - thanks for providing an amazing landing page under MIT License. Initial code was also inspired by [Jekyll TailwindUI](https://github.com/chunlea/jekyll-tailwindui)
Send Mail Using Node.js and gmail in few Simple Steps
Tags: webdev, node, javascript, beginners
Published: 2021-04-27 16:37:08

We all know how tedious the stuff gets when we wan't to send mail from any automated system.

For example, 

* ping someone when CRON job at remote VM Executed *
* Get failure logs of your server in mail*
etc

So, today we are going to take a look at how can we send mail from nodejs using just a gmail account and third party library node-mailer 

---------------

* Setting up G-mail :-
 
For sending mail's through your gmail A/C you must allow the " less secure app" access to your google A/C which is done here 
a
https://myaccount.google.com/lesssecureapps
  
---------------

# Step 1 :- Setting up node-mailer

Install node-mailer using npm or yarn (which is one prefer let me know in comments). I will use npm here because, it comes with node installation

```bash
npm i nodemailer 
```

# Step 2 :- Setting up node-mailer and some basic configuration 


After installing node-mailer, we have to setup some config's. For sending mail, we are going to use *Gmail* as a mail service and create a mail transported object. Which internally handles the SMTP (Simple Mail Transfer Protocol) transactions.


```javascript 
const nodemailer = require("nodemailer");

module.exports = {
    sendMail: function () {
        let mailTransporter = nodemailer.createTransport({
            service: "gmail",
            auth: {
                user:"yourUserName@gmail.com",
                pass: "<SecretPassword",
            },
        });
    },
};

```
# Step 3 :- create mail object 

Now it's time to create actual mail payload. It will contain of recipient mail address and other stuff like subject and the string which we want to send with the mail. This is  the basic payload we can alter the stuff with great flexibility

```javascript 
        let mailDetails = {
            from: "yourUserName@gmail.com",
            to: "favPerson@anyDomain.com",
            subject: "You Were Hacked 8)",
            text: "System failure !",
        };
 ```

#Step 4 :- Send Mail 

Now, just hit it. ( I am handling result  with callback, you can also use Promise here) 

```javascript 
  mailTransporter.sendMail(mailDetails, function (err, data) {
            if (err) {
                console.log("Error Occurs");
            } else {
                console.log("Email sent successfully");
            }
        });
```

That's It. Now, we can send email to anyone with any email address without setting up out own mail server or anything else 

-----------------------------

# Final Thoughts

I hope you all learnt something new from this post. Let me know if anything else I have to write in my next one


Thanks for reading :)
performance issue with vue.js v-if condition
Published: 2021-04-27 16:22:07

Here I am using vue form generator. Here my question is I have written v-if condition for many categories. In the same way I have many vue form generator component where I have written v-if condition. So I am facing performance issue here. So my question is if we are writing such condition like this. so this could be the reason for performance or anything else. 

```
<div v-if="(category == 'Real Estate | Single Family Homes')||(category == 'Real Estate | Town Homes')||(category == 'Real Estate | Condominiums')||(category == 'Real Estate | Multi Family')||(category == 'Real Estate | Mobile Homes')||(category == 'Real Estate | Farm/Ranch Land')||(category == 'Real Estate | Commercial Property')||(category == 'Real Estate | Foreclosures')||(category == 'Real Estate | Storage')||(category == 'Real Estate | Vacation Property')||(category == 'Real Estate | Open Houses')||(category == 'Real Estate | Other Properties')">
               
<vue-form-g :schema="schema_Real_Estate" :model="model" :options="formOptions"></vue-form-g>

<span class="prev_next">
<button class="prev_next_btn" @click.prevent="prev()">Previous</button>
<button style="background-color:lightgray;" class="prev_next_btn" @click.prevent="next(2)">Next</button>
</span>
</div>
```