teleren/devto huggingface dataset:
Sorting an Array of JavaScript Objects in a Specific Order
Tags: javascript, webdev, tutorial
Published: 2021-09-29 22:34:22

Sorting an array of objects in javascript is simple enough using the default sort() function for all arrays:

```javascript
const arr = [
  {
     name: "Nina"
  },
  {
     name: "Andre"
  },
  {
     name: "Graham"
  }
];
const sortedArr = arr.sort((a,b) => {
  if ( a.name < b.name ){
    return -1;
  }
  if ( a.name > b.name ){
    return 1;
  }
  return 0;
});
```

And it is trivial enough to swap the sort order by switching the returns or the if statements above.

But what if you need to sort an array of objects in a specific, non-alphabetical order?

An example I came across was to transfer some SQL data for importing to a database and the transfer needed to occur in a table-dependent way, so as to not break the table constraints of importing foreign keys that didn't exist yet.

```javascript
// Defined sort order starting with the 'lowest' table in the SQL schema
const importOrder = ["Photo", "Address", "State", "Country"];

const tables = [
  {
    name: "Address"
  },
  {
    name: "State"
  },
  {
    name: "Photo"
  },
  {
    name: "Country"
  }
];

const sortByObject = importOrder
.reduce((obj, item, index) => {
  return {
    ...obj,
    [item]: index,
  };
}, {});

const customSort = tables.sort((a, b) => sortByObject[a.name] - sortByObject[b.name]);
```

So what's going on here?

The key is the importOrder.reduce() function. This is transforming the importOrder array into an object that creates a numerical order for each item in the original import array:

```javascript
// Output of sortByObjeect
{
  Address: 1,
  Country: 3,
  Photo: 0,
  State: 2,
}
```

This then makes sorting the array much simpler by being able to directly look up an integer value for the sort position, which is what we are passing into the sort function of the tables array:

```javascript
// Output of tables.sort()
[
  {name: "Photo"},
  {name: "Address"},
  {name: "State"},
  {name: "Country"}
]
```

Originally posted [here](https://www.mickpatterson.com.au/blog/sorting-an-array-of-javascript-objects-in-a-specific-order)
Update OpenSSL to 3.0 on CentOS7
Tags: openssl, centos7, libopenssl, devops
Published: 2021-10-01 20:02:50

## Prerequisites

Use `sudo` when needed.

Install `perl-IPC-Cmd` and `perl-Test-Simple`:

```bash
sudo yum install perl-IPC-Cmd perl-Test-Simple
```

## Download and install OpenSSL 3.0

Go to [OpenSSL's download page](https://www.openssl.org/source/) and copy the link to the latest version. At this time it's 3.0.0. Then run (adapt the command to reflect your version):

```bash
cd /usr/src
wget https://www.openssl.org/source/openssl-3.0.0.tar.gz
tar -zxf openssl-3.0.0.tar.gz
rm openssl-3.0.0.tar.gz
```

Compile, make, test and install OpenSSL:

``` bash
cd /usr/src/openssl-3.0.0
./config
make
make test
make install
```

Create symlinks to `libssl` and `libcrypto`:

```bash
ln -s /usr/local/lib64/libssl.so.3 /usr/lib64/libssl.so.3
ln -s /usr/local/lib64/libcrypto.so.3 /usr/lib64/libcrypto.so.3
```

Test the installed version with:

```bash
openssl version
```

You should get something like this:

```
OpenSSL 3.0.0 7 sep 2021 (Library: OpenSSL 3.0.0 7 sep 2021)
```

If you liked the article,...
[![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/kugdh9szk858ncio2mzi.png)](https://www.buymeacoffee.com/puEW3HvWvP)
Fastest way get your first developer job
Tags: codenewbie, webdev, beginners, career
Published: 2021-11-11 19:07:44

Do you know the shortest path between two points?

...its a straight line.

When trying to get your first job as a software developer theres a lot of stuff you dont know. 

It might seem like a good idea to learn python, and ruby, and javascript, and java (because java kinda sounds like javascript)

Well...when money is tight and you need to get a job its crucial to reflect on your goal (getting a job) and how you can get there from your current situation.

I recommend focusing on basic frontend technologies using HTML, CSS, and Javascript to build a simple game.

Idk something simple like every time you click a die it rolls a new number 1-6.

Simple and fun.

Then deploy it.....

Thats valuable.

Whats not valuable is...going through ANOTHER tutorial on something youll never use in your career.

Anywhoooooo...

Its not about how hard you work its about how hard you work doing the RIGHT things.

***If you want more:***

- Come join our Facebook group to help you get your first job as a software engineer, career development, and so much more!

https://www.facebook.com/groups/310120400851953

- Here is a [link](https://engjobresources.carrd.co/) to top 10 interview resources
20 ICP（About $800） Bounty for Developer web3
Tags: flutter, dart, blockchain, rust
Published: 2021-12-01 15:39:00

**20 ICPs, with 10 ICPs bonus for docs site**
task: @Astrox_Network's "agent_dart" api doc
link:https://github.com/AstroxNetwork/agent_dart/issues/13

**Acceptance Criteria:**
 [comment on code to cover all apis]
 [generate dart docs]
 [optional generate gitbook or github pages]
 [optional tutorial/docs site for developers]

**Context:**
To have better understanding of internet computer, for client developers, it is the best way to understand how the sdk works.

Though we have ported most agent-js features to agent_dart, we don't have enough resources to complete the api docs. Which is really important work for community developers.

Thus, we need to cover as many apis as possible, we need someone to comment on code like we do for dart code.
Answer: How to resolve the error on 'react-native start'
Tags: javascript, mobile, programming, node
Published: 2021-12-14 11:46:26

{% stackoverflow 58122821 %}
I just got a similar error for the first time today. It appears in \node_modules\metro-config\src\defaults\blacklist.js, there is an invalid regular expression that needed changed. I changed the first expression under sharedBlacklist from:
```js
var sharedBlacklist = [
  /node_modules[/\\]react[/\\]dist[/\\].*/,
  /website\/node_modules\/.*/,
  /heapCapture\/bundle\.js/,
  /.*\/__tests__\/.*/
];
```
to:

```js 
var sharedBlacklist = [ /node_modules[\/\\]react[\/\\]dist[\/\\].*/,
  /website\/node_modules\/.*/,
  /heapCapture\/bundle\.js/,
  /.*\/__tests__\/.*/
];
```

Copied from https://stackoverflow.com/a/58122821/13161180
Credit goes to Clem
The Weekly Dev - 202152
Published: 2021-12-27 07:35:46

---
title: The Weekly Dev - 202152
published: true
description: 
tags: 
//cover_image: https://direct_url_to_image.jpg
canonical_url: 'https://kevwe.com/weekly/202152'
---

"The Weekly Dev" cares about technical solutions (namely: software) that are hackable and enable a deeper level of understanding.

We don't want to either 'be used' by our software, nor from software (cloud?) companies. We want to be on top of it, be able to interact and mess with the code.

The resources that have caught our attention at this time:

https://kevwe.com/weekly/202152
java traditional method to remove duplicate String
Tags: java, beginners, programming, tutorial
Published: 2022-01-16 05:09:07

I just saw a post in dev someone solved same problem using collections in java. so i thought let me try the same problem to solve in traditional way`

1. public class Main
{
	public static void main(String[] args) {
		String s="abbvcddgtttt";
		char c[]=s.toCharArray();
		char cc[]=new char[c.length];
		int index=0;
		char same=' ';
		for(int i=0;i<c.length;i++)
		{
		   for(int j=i+1;j<c.length;j++)
		   {
		       if(c[i]==c[j])
		       {
		          c[i]=' ';
		       }
		   }
		   if(c[i]!=' ')
		   {
		        cc[index]=c[i];
		      index++;
		   }
		     
		}
		for(char i:cc)
		{
System.out.println(i);
		}
	}
}
React vs Solid - Seriously?
Tags: react, solidjs, redux, javascript
Published: 2022-09-11 19:16:25

There is no contest.

SolidJS is faster, better, and easier to learn and maintain.  If you're already a React developer, you're already a Solid developer.  You'll just type a lot less in Solid and spend less time debugging.  If your company is still investing in React in any way at all, you're wasting lots of time and money.  Enjoy.


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

Start here https://www.solidjs.com/tutorial/introduction_basics

It's fun!
Randomizing Array Elements
Tags: javascript, vscode, programming, firstpost
Published: 2022-11-21 14:14:30

If the Math.random() function didn't work for you it's okay. As a newbie to coding, it took me over a day for it to work it's magic. There are a number of ways to create a random return but I found this to be the cleanest way that made the most sense. The syntax behind this code may seem a little dauting but once you break it down it's much simpler than you think. 



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


Here we have an array of dog names. In order to randomize the dogs' names the function was called on the array, dogs. The function Math.floor(), essentially rounds down an integer, but since these are names it won't return just a quarter of the name. To generate a random return of an element of the array Math.random() is multiplied to the length of the array, array.length. The length covers the entirety of the array of all the elements.
Rotate your Circle CI keys now.
Tags: devops, news
Published: 2023-01-05 10:54:52

This morning many developers recieved an email informing them that circle CI had been breached between 21st December 2022 and 4th January 2023.

![Email sent by circle ci](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/vb8tvzyqie0slymj98wn.png)
Image from [https://www.bleepingcomputer.com](https://www.bleepingcomputer.com/news/security/circleci-warns-of-security-breach-rotate-your-secrets/)

### Am I affected?
The statement says: 
> "At this point, **we are confident that there are no unauthorized actors** active in our systems; however, out of an **abundance of caution**, we want to ensure that all customers take certain preventative measures to protect your data as well."

### What do I need to do?
The recommendation is to '**Immediately rotate any and all secrets stored in CircleCI**. These may be stored in project environment variables or in contexts.'
This includes SSH keys and other secrets. 

### How do I rotate my keys?
To rotate keys please refer to this documentaion on circle ci's website - [https://circleci.com/docs/managing-api-tokens/#rotating-a-project-api-token](https://circleci.com/docs/managing-api-tokens/#rotating-a-project-api-token)

### Do you have any questions?
Please see this tweet from circle ci to some common questions- [Tweet about common questions being answered by a circle ci engineer](https://twitter.com/CircleCI/status/1610893135235661830?cxt=HHwWjICyjbGxhdssAAAA)

Or add a question to the [circle ci discussion board](https://discuss.circleci.com/t/circleci-security-alert-rotate-any-secrets-stored-in-circleci/46479)


# References:
- **CircleCI security alert** [https://circleci.com/blog/january-4-2023-security-alert/](https://circleci.com/blog/january-4-2023-security-alert/)
- **Circle CI twitter account** [https://twitter.com/CircleCI](https://twitter.com/CircleCI)
- Article about circle CI [https://www.bleepingcomputer.com/news/security/circleci-warns-of-security-breach-rotate-your-secrets/](https://www.bleepingcomputer.com/news/security/circleci-warns-of-security-breach-rotate-your-secrets/)
Hire Affordable Engineering Assignment Helper In the USA
Tags: webdev
Published: 2023-01-09 09:46:40

Excellent Advantages of our Engineering assignment help services
Students from around the globe can use our engineering assignment help online. Thousands of students rely on our support when it comes to finishing their academic work because we have been in this sector for a very long time and are aware of the crucial variables that must be taken into account when writing your assignment. We have consistently been able to deliver top-notch content that helps students in achieving good marks by expectations.But what's the best thing, do you know? With our [Online Engineering Assignment Help](https://www.assignmenthelppro.com/us/engineering-assignment-help/) in the USA, we also give our customers access to special benefits and services!

On-time delivery: We never miss deadlines because we know how important it is for you to turn in your work by the specified date. So, as soon as we receive your order, our team of USA-based Engineering Assignment Helpers will get to work.
Plagiarism-free content:Content that is free of plagiarism will be written by us entirely from scratch. Our team constantly ensures that your project is completely free of plagiarism. If you would like, we can also give you a data report that is free of plagiarism.

Affordable prices:  A student's budget is quite tight. We are aware of this! Because of this, our engineering assignment help services provide help at a very affordable price with additional discounts that students can take advantage of as needed.

24/7 customer support: You don't have to worry when contacting our team of engineering assignment helpers in the USA because we are accessible 24/7. This implies that our experts will provide you with prompt answers to all of your questions.
SSC GD Constable Answer Key 2023: Check Your Answers Now!
Tags: ssc, result
Published: 2023-02-19 05:41:15

SSC GD Constable Answer Key 2023 Date: Staff Selection Commission (SSC) has released the answer key of SSC GD Constable Exam 2023 today i.e. on 18 February 2023 on its official website. Candidates who have appeared for the exam can download the answer key now and check their answers. The downloading process is given below, by following which candidates can download their answer key. SSC GD Constable exam was conducted between January 10 to February 14, 2023, in which a total of 30,41,284 candidates appeared.

Let us tell you that this GD Constable Exam was conducted for a total of 45284 posts, out of which 4835 posts are for female constables and 40274 posts are for male constables. This exam of SSC GD Constable is conducted for the recruitment of Central Armed Police Forces (CAPF), NIA, SSF and Rifleman (GD) in Assam Rifles. In which a total of 52,20,335 candidates applied for the exam and 30,41,284 candidates appeared in the exam.


Candidates can download SSC GD Constable Answer Key from the official website of SSC, ssc.nic.in. The answer key contains the correct answers to all the questions asked in the exam. Candidates can use the answer key to calculate their probable score in the exam and get an idea of ​​their chances of qualifying for the next round.

How to download SSC GD Constable Answer Key 2023

1. First of all go to ssc.nic.in.
2. Now click on the “Answer Key” section on the homepage.
3. Now click on “SSC GD Constable Answer Key 2023”.
4. Now submit the form by entering your login credentials like roll number, password and exam date.
5. Now the option to download PDF file of Answer Key is visible.
6. After downloading the Answer Key PDF, take a printout for future reference.

After checking the [SSC GD Constable Answer Key 2023](https://hindi.wordlex.org/sarakari-result/ssc-gd-constable-answer-key-2023-date/), if candidates find any discrepancy in the answer key, they can apply for objection before 25 February. The fee for one objection has been kept at Rs 100. Candidates can submit objections with their valid proof.

Read such latest breaking news in Hindi only on [WordleX News Hindi](https://hindi.wordlex.org/). Read today's latest news 2023, about exams, live news updates on the world's most trusted website WordleX News Hindi.
CRM trends to keep an eye on
Tags: crm, ai, api, devops
Published: 2023-03-22 07:41:20

Why should you learn CRM trends? 

There are many reasons why learning about CRM trends is important for businesses and professionals: 

• Stay ahead of the competition: By keeping up with CRM trends, companies can stay ahead of the competition. They can identify new opportunities, gain a competitive advantage, and develop strategies to improve customer engagement and loyalty. 
• Improving Customer Experience: CRM trends focus on improving customer experience by providing customized, relevant, and consistent interactions across multiple touch points. By learning about these trends, companies can gain insight into how they can improve the customer experience, which can lead to increased customer satisfaction and loyalty. 
• Improve Efficiency and Productivity: CRM trends often involve new technology and automation, which can help companies streamline their operations and improve efficiency. By recognizing these trends, companies can identify areas where they can automate routine tasks, freeing up time for employees to focus on more strategic tasks. 
• Make better decisions: CRM trends often involve collecting and analyzing customer data, which can provide companies with insights into customer behavior, preferences, and needs. By recognizing these trends, companies can make informed decisions, identify new opportunities, and improve overall business performance. 
• Career Advancement: For professionals, becoming familiar with CRM trends can help them stay abreast of industry developments and position themselves for career advancement. By keeping up with CRM trends, professionals can gain new skills and knowledge that can help them meet new challenges and advance their careers. 
In short, becoming familiar with [CRM trends](https://www.databeys.com/) is essential for businesses and professionals who want to stay competitive, enhance customer experience, improve efficiency and productivity, make informed decisions, and advance their careers. 
Read More: [CRM Trends To Keep An Eye On](https://www.databeys.com/blog/crm-trends-to-keep-an-eye-on/)
How to Fix Kodi Black Screen
Tags: kodi, beginners
Published: 2023-03-22 09:06:39

<p>If you are facing a black screen issue on Kodi, there are several ways to fix it. Here are some of the solutions I studied at <a href="http://www.bestkoditips.com">Bestkoditips</a> that you can try:</p>
<p><br></p>
<p>Clear Cache and Data: Sometimes, Kodi&apos;s cache and data can get corrupted, causing the black screen issue. To fix this, go to Settings &gt; Apps &gt; Kodi &gt; Storage &gt; Clear Cache and Clear Data. This will clear all the cache and data stored by Kodi, and you can launch the app again to see if the issue is resolved.</p>
<p><br></p>
<p>Check Your Power Source: Kodi requires a stable power source to function correctly. If your device&apos;s power source is weak, it can cause a black screen issue. Check if the power source is stable and try connecting to another power outlet.</p>
<p><br></p>
<p>Update Kodi: Outdated versions of Kodi can cause several issues, including the black screen. Ensure that you have the latest version of Kodi installed on your device. If not, update it to the latest version.</p>
<p><br></p>
<p>Disable Hardware Acceleration: Hardware acceleration can also cause issues with Kodi. To fix this, disable hardware acceleration by going to Settings &gt; Player Settings &gt; Videos &gt; Disable hardware acceleration.</p>
<p><br></p>
<p>Remove Add-ons: Sometimes, certain add-ons can cause conflicts with Kodi, leading to a black screen issue. Try removing the add-ons that you recently installed and see if the issue is resolved.</p>
<p><br></p>
<p>Reinstall Kodi: If none of the above solutions work, try uninstalling Kodi from your device and reinstalling it again. This will reset Kodi to its default settings, and you can start using the app again.</p>
<p><br></p>
<p>By trying these solutions, you can fix the black screen issue on Kodi and enjoy uninterrupted streaming.</p>
Exploring the Benefits of Watching Live Sports on FirstRowSports
Tags: firtsrow, firstrowsport, javascript
Published: 2023-03-22 11:50:49

Do you love sports but can't always make it to the game? Or maybe you're looking for a more affordable way to catch all the live action? Look no further than FirstRowSports. This website has been a go-to for sports enthusiasts for years, and for good reason. From football to basketball, hockey to baseball, and everything in between, FirstRowSports has it all. But what are the benefits of watching live sports on this site? In this post, we'll explore the top reasons why using FirstRowSports to watch live sports can be a game-changer for sports fans everywhere. So grab your jersey and settle in, because it's time to dive into the exciting world of live sports on FirstRowSports.


The Appeal of Watching Live Sports on FirstRowSports
FirstRowSports has become a go-to streaming platform for sports enthusiasts all over the globe. Its immense popularity is largely due to its ability to connect viewers with a vast range of sporting events from around the world. Whether it's football, basketball, tennis, cricket, or any other sport, FirstRowSports offers live streams of almost all major competitions, leagues, and tournaments. With easy-to-use navigation and a user-friendly interface, users can access a variety of matches with just a few clicks. Moreover, FirstRowSports provides high-quality streams, ensuring that users can enjoy the action in the best possible way. In essence, it's no wonder that this platform has grown in popularity over the years and continues to be a favorite for sports enthusiasts looking for live sports broadcasts.

Thus, it is evident that [FirstRowSports](https://allin1.cx/firstrowsports) has established itself as a reliable and convenient platform for sports enthusiasts to stream live events at their convenience. Its user-friendly interface and live streaming capabilities make it a go-to place for sports fans to keep up with their favorite games and tournaments. Moreover, the fact that it allows users to stream these events in real-time without any buffering or lag is a major advantage over other similar platforms. Whether you are at home or on-the-go, FirstRowSports has got you covered with its wide range of streaming options. In conclusion, FirstRowSports is undoubtedly an exceptional platform for all sports lovers who want to stay updated with the latest matches and enjoy them in high-quality streaming without any interruptions.