teleren/devto huggingface dataset:
Introduction to Data Structures and Algorithms
Published: 2022-09-29 05:44:42


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


Data structures and algorithms are “components” of software development that enable one to write efficient( minimum memory and storage needs) software.

Data Structures — These can be looked as like the ingredients you need to build efficient algorithms. These are the ways to arrange data so that they (data items) can be used efficiently in the main memory. Examples: Array, Stack, Linked List.

Algorithms — These are a sequence of steps performed on data using efficient data structures to solve a given problem, be it a basic or real-life-based one. Examples include: sorting an array or adding two numbers and displaying the result. Simply put as the path between a problem and a solution.

characteristics that make up a good algorithm.

These include:

1.Input specified
2.Output specified
3.Definiteness
4.Effectiveness
5. Finiteness
6.Independent
In recent years in software development, skills tests on data structures and algorithms have become more and more crucial; This does indicate and stress on the importance of learning and developing this skill and on the attainment of this skill in your arsenal puts you ahead of the crowd.

Algorithm example for adding two numbers:

1.start

2.prompt for first number as input(num1)

2.prompt for second number as input(num2)

3.Assign user input to num1 and num2 (num1 ← first number, num2 ← second number).

4.Add num1 and num2 (num1 + num2).

5. Assign the result to sum. (sum ← num1 + num2)

6.Print sum

7.Stop

**Types of Data Structures:**

1. Primitive data structures
2. Non-primitive data structures
3. Primitive Data structures

The primitive data structures are essentially the bare data types. These are int, char, float, double, and pointer which can only hold a single value.

Non-Primitive Data structures

The non-primitive data structure is divided into two types:
1. Linear data structure
2. Non-linear data structure

**Linear Data Structures**
The arrangement of data is in a sequential manner hence the name “linear data structure” , examples include Arrays, Linked list, Stacks, and Queues. In these data structures, one element is connected to only one another element in a linear form.

Non- linear Data structures are ideally the opposite of the linear Data structures, the elements are not limited to connections of only one other element in a linear form such as map, graph and tree.

Static and Dynamic Data Structures

Static data structures are fixed in size, while dynamic ones can increase or decrease in size. The size is usually in terms of space the data structure occupies. Therefore the size of a static data structure cannot be changed only its content.

Dynamic data structures are flexible, allowing you to change the size of the element and the contents in runtime. Each of the two has a different use case depending on what you want to do in your program.

This is a little bit of an introduction to Data Structures and Algorithms, I hope you had an amazing read.
Can I use RSpec without Rails?
Tags: rspec, ruby, question
Published: 2022-09-29 05:38:17

---
title: Can I use RSpec without Rails?
published: true
description: 
tags: #rspec, #ruby, #question
cover_image: https://res.cloudinary.com/twhiteblog/image/upload/v1664428159/ruby.jpg
---

📸 Photo by [Joshua Fuller](https://unsplash.com/@joshuafuller?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText) on [Unsplash](https://unsplash.com/s/photos/ruby?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText)

I am working on a [static site generator](https://www.tiffanywhite.dev/2022/09/26/update-on-my-static-site-generator/) using just Ruby and a few gems.

It seems that testing with RSpec is the way to go, however most tutorials or blog posts associate RSpec with Rails and I don't have, want, or need a Rails component to this; it's just a CLI tool.

My question is can I use RSpec with a pure Ruby CLI tool or should I try something like Minitest instead?

**Oh and maybe someone would be willing to take a look at what I've got?"

{% embed https://github.com/twhite96/static-gen-ruby %}
How to create a slice with the make() function in Go or Golang?
Tags: go
Published: 2022-09-29 05:19:45

---
  title: How to create a slice with the make() function in Go or Golang?
  published: true
  tags: Go
  date: Thu Sep 29 2022 10:49:45 GMT+0530 (India Standard Time)
  canonical_url: https://melvingeorge.me/blog/create-slice-with-make-function-go-golang
  cover_image: https://melvingeorge.me/_next/static/images/main-4fea828305f34c1ec7e3a3303d7eae34.jpg
  ---
  [Originally posted here!](https://melvingeorge.me/blog/create-slice-with-make-function-go-golang)
  
To create a slice in Go or Golang, one way is to use the `make()` function and pass the type of the [slice](https://melvingeorge.me/blog/create-dynamic-array-or-slice-in-golang-or-go) we need to make as the first argument and the [length](https://melvingeorge.me/blog/get-number-of-elements-in-array-or-length-go-golang) of the elements that should be created in the slice as the second argument.

```go
package main

import "fmt"

func main(){
    // create a `string` type slice
    // with `5` empty values
    // using the `make()` function
    mySlice := make([]string, 5)

    // print the value of the `mySlice` slice
    fmt.Println(mySlice) // [    ] ✅
}
```

For example, let's say we need to create a `string` type slice with `5` empty string values. To do that we can use the `make()` built-in function and pass the `string` type slice as the first argument and the number `5` as the second argument.

It can be done like this,

```go
package main

func main(){
    // create a `string` type slice
    // with `5` empty values
    // using the `make()` function
    mySlice := make([]string, 5)
}
```

Now let's print the output of the `mySlice` slice to the console like this,

```go
package main

import "fmt"

func main(){
    // create a `string` type slice
    // with `5` empty values
    // using the `make()` function
    mySlice := make([]string, 5)

    // print the value of the `mySlice` slice
    fmt.Println(mySlice) // [    ] ✅
}
```

As you can see that an empty array with 5 empty values is printed to the console which proves that we have made a `string` type slice with `5` empty values. Yay 🥳.

See the above code live in [The Go Playground](https://go.dev/play/p/VDQAC8nZqlD).

That's all 😃!

### Feel free to share if you found this useful 😃.

---
How to specify pre-processor flags to the JSI-based React Native libraries
Tags: reactnative, ios, android, sqlite
Published: 2022-09-29 05:07:07

Hi, it's Takuya.
I'm building a note-taking app called [Inkdrop](https://www.inkdrop.app/) for mobile using React Native.

The app uses react-native-quick-sqlite, a fast wrapper of SQLite:

{% embed https://github.com/ospfranco/react-native-quick-sqlite %}

It embeds the latest version of SQLite in C/C++.
That means that you build SQLite from source in your RN project on Xcode and Android Studio (CMake).

It doesn't enable any compile-time options by default, and I needed to enable FTS5 for full-text search in my app.
It can be enabled by [specifying a `SQLITE_ENABLE_FTS5` pre-processor flag when compiling](https://www.sqlite.org/fts5.html).

I've managed to enable FTS5 and I'd like to share how to do that in your project.
For Android, the library needs to make some changes. So, it'd be helpful for library maintainers who would support accepting custom build flags.

## iOS

Fortunately, CocoaPods allows you to customize the pods project settings via `Podfile`:

* https://guides.cocoapods.org/syntax/podfile.html

Add a `post_install` block to your `<PROJECT_ROOT>/ios/Podfile` like so:

```ruby
post_install do |installer|
  installer.pods_project.targets.each do |target|
    if target.name == "react-native-quick-sqlite" then
      target.build_configurations.each do |config|
        config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] ||= ['$(inherited)', '<SQLITE_FLAGS>']
      end
    end
  end
end
```

Replace the `<SQLITE_FLAGS>` part with flags you want to add.
For example, you could add `SQLITE_ENABLE_FTS5=1` to `GCC_PREPROCESSOR_DEFINITIONS` to enable FTS5 in the iOS project.

## Android

The native modules are compiled with CMake that reads `CMakeLists.txt`.

CMake supports adding flags with [`add_definitions` command](https://cmake.org/cmake/help/v3.0/command/add_definitions.html).

Add the following lines in the library's CMakeLists.txt:

```
add_definitions(
  ${SQLITE_FLAGS}
)
```

It specifies flags via the variable `SQLITE_FLAGS`, which needs to be specified in `react-native-quick-sqlite/android/build.gradle` like so:

```groovy
def SQLITE_FLAGS = rootProject.properties['quickSqliteFlags']

android {
  defaultConfig {
    externalNativeBuild {
        cmake {
            arguments '-DANDROID_STL=c++_shared',
              "-DREACT_NATIVE_VERSION=${REACT_NATIVE_VERSION}",
              "-DNODE_MODULES_DIR=${nodeModules}",
              "-DSQLITE_FLAGS='${SQLITE_FLAGS ? SQLITE_FLAGS : ''}'"
        }
    }
```

Now, you can define the flags in your `<PROJECT_ROOT>/android/gradle.properties` like so:

```
quickSqliteFlags="<SQLITE_FLAGS>"
```

That's it!
I've sent a pull request to the quick sqlite repository:

{% embed https://github.com/ospfranco/react-native-quick-sqlite/pull/86 %}

Hope that helps.

---

## Follow me online

- Check out my app called [Inkdrop — A Markdown note-taking app](https://www.inkdrop.app/)
- Twitter <https://twitter.com/inkdrop_app>
- Blog <https://blog.inkdrop.app/>
- YouTube <https://www.youtube.com/devaslife>
- Instagram <https://instagram.com/craftzdog>
SMS Marketing for Small Business
Tags: sms, bulk, message
Published: 2022-09-29 05:04:48

You’ve probably received SMS messages from businesses before – maybe a promotional offer or a reminder about an appointment. But have you ever considered using SMS marketing for your own small business? In this article, we’ll show you how [Bulk SMS](https://www.smsala.com) marketing can be a powerful tool to reach new customers and grow your business.

## Benefits of SMS marketing for small businesses

SMS marketing is a great way for small businesses to reach out to their customers. It is a quick and easy way to send out messages, and it is also very affordable. [SMS marketing](https://smsala.com/blog/sms-marketing) can help small businesses keep in touch with their customers, and it can also help them promote their products and services.

### use text message marketing for small businesses

Almost every small business can benefit from text message marketing. It’s a quick and easy way to reach your customers where they are – on their mobile phones.

With text message marketing, you can send out coupons, special offers, announcements, or even just a reminder to your customers. Best of all, it’s an affordable way to reach your audience.

**Here are a few tips for using text message marketing for small businesses:**

1. Keep your messages short and sweet. Customers are more likely to read a short text than a long one.

2. Use keywords and abbreviations sparingly. Too many keywords will make your message difficult to read, and customers may opt-out of future messages from you if they find them hard to understand.

3. Use text messaging to complement other marketing efforts. For example, you can use text messages to drive traffic to your website or blog or promote an upcoming sale or event.

4. Get permission before sending any text messages. Customers must opt-in to receive messages from you, so make sure you have their permission before adding them to your list.

5. Include a call to action in every message. Tell customers what you

## Guide to SMS Marketing for small businesses

SMS marketing is a great way for small businesses to reach out to their customers and promote their products or services. However, it can be a bit tricky to get started with SMS marketing if you're not sure how it works.

That's why we've put together this handy guide to SMS marketing for small businesses. We'll walk you through what SMS marketing is, how it works, and how you can get started using it to reach your customers.
SSGo 0.3 and notorious git merges
Tags: opensource, git, showdev, go
Published: 2022-09-29 04:54:09

Hi again! Glad you've come. First of all...

## It's update time! 🎉

SSGo is at [release 0.3](https://github.com/devils2ndself/SSGo/releases/tag/0.3), which means some additional Markdown features!

- Markdown Horizontal rules `---` are now turned into `<hr>` HTML tag. 

- Markdown inline `code blocks` are now turned into HTML `<code>` tags.

- Some code optimizations to prepare for adding _italics_ and __bold__ text! Hoping to add soon...

If you're not familiar with SSGo, you can check it out in my [GitHub repo](https://github.com/devils2ndself/SSGo). It's under MIT license, so contributions are more than welcome.

## Git merges

This time, I worked on both Markdown features in parallel on separate branches, which meant I had to merge those eventually.

Merging code is something many programmers prefer not to do. They still have to, but don't enjoy it as much. However, for me it's different.

I actually like git merges more than I probably should, and I usually do some optimizations in the process too. For me, coming up with an optimization and getting pieces of software together is just so relaxing. You know the code is done, so all you have to do is get it together, like a jigsaw puzzle.

Anyway... Like anything in open source, I started by assigning issues ([10](https://github.com/devils2ndself/SSGo/issues/10), [11](https://github.com/devils2ndself/SSGo/issues/11)) that I assigned to myself. After that I started working on separate branches on my local. After both have been done, I [fast-forwarded](https://github.com/devils2ndself/SSGo/commit/582ec83fc6fe91fa7904056e4a46ca47380e7877) the first branch to master, and made a [merge](https://github.com/devils2ndself/SSGo/commit/d6960f5ffa94796d39278955146d5caca3692cd4) from the second branch to master.

There is a charm in doing everything properly, and not making a mess out of your repo.
Jenkins with Xamarin.Forms
Tags: xamarinforms, jenkins, devops, macos
Published: 2022-09-29 04:28:37

Let's look at how to quickly have a CI-CD setup running for our Xamarin.Forms application with Jenkins.
We'll be using a mac as it'll enable as to build both Android and iOS on the same machine. Which brings me to an unfortunate point: *We will need a seperate setup for UWP*. Which I might cover in another post.

## What we are going to do
[Install Jenkins](#install-jenkins)
[Configure for iOS](#config-ios)
[Configure for Android](#config-android)
[Highlight Drawbacks and Improvements](#drawbacks)

###Install Jenkins <a name="install-jenkins"></a>
First off, we need to have Homebrew package manager installed in the mac, as it is required to install Jenkins. You can check if you have brew installed by executing this command in your terminal:
`which brew`
This will display the path the brew being used is installed in. In my case it's here:
`/usr/local/bin/brew`

If you don't have it then simply run this command to install brew:
`/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"`

Once we have brew installed, we can now install Jenkins:
`brew install jenkins-lts`
this will install the Long-Term-Support release of latest stable Jenkins. To know more about the releases available take a look at their [download page](https://www.jenkins.io/download/).

Let's start Jenkins by executing:
`brew services start jenkins-lts`
you can stop the service by replacing *start* with *stop*.
List in React
Tags: webdev, beginners, tutorial, react
Published: 2022-09-07 06:20:23


## List in React

**Lists** are very useful when it comes to developing the **UI of any website**. Lists are mainly used for displaying menus in a website, for example, the navbar menu. In regular JavaScript, we can use arrays for creating lists. We can create lists in React in a similar manner as we do in regular JavaScript. We will see how to do this in detail further in this article.
Let’s first see how we can **traverse and update** any list in regular JavaScript. We can use the **map() function in JavaScript** for traversing the lists.

![](https://cdn-images-1.medium.com/max/2000/0*nar50qhWmebFMrso.png)

In the above program the array “**numbers**” is getting traversed one by one and each element is **incremented by 1**. The list then is finally returned in the form of **unordered lists**.

## Output

![](https://cdn-images-1.medium.com/max/2000/0*ISOdRXGPoZn1zKpl.png)

## Rendering lists inside Components

In the above code in React, we had **directly rendered the list to the DOM**. But usually this not a good practice to render lists in React. Consider the example of a **Navigation Menu**. In any website any navigation menu will **not be hard coded**. This item is **fetched from the database** and then displayed as lists in the browser. So from the component’s point of view, we can say that we will **pass a list to a component using props** and then **use this component to render the list to the DOM**. We can update the above code in which we have directly rendered the list to now a component that will **accept an array as props** and **returns an unordered list**.

![](https://cdn-images-1.medium.com/max/2000/0*ZRNADRhPEj_JMXqs.png)

You can see in the above output that the unordered list is successfully rendered to the browser but a **warning message** is logged to the console.

![](https://cdn-images-1.medium.com/max/2000/0*nZcrj9cjXJmkOErZ.png)

**Warning: Each child in an array or iterator should have a unique “key” prop**
The above warning message says that each of the list items in our unordered list should have a unique key. A “**key**” is a **special string attribute** you need to include when creating lists of elements in React.
The above code is written in the given sandbox link :
[https://codesandbox.io/s/introduction-lists-xgp802](https://codesandbox.io/s/introduction-lists-xgp802)

[https://codesandbox.io/s/introduction-lists-xgp802](https://codesandbox.io/s/introduction-lists-xgp802)
Flex cards on No code low code tool bubble
Tags: uiux, webdevelopement, bubble, webdesign
Published: 2022-09-29 04:23:44

***Tried these flex cards on Bubble . Saw these cards on Instagram  where it was designed using #html and #css. Decided to play with it on bubble and observe the difference.
The first difference while creating them on bubble was, its logic was so simple to understand for a developer.While on the other hand #html and #css provided was bit complex for a new #developer  to understand compared to #bubble .
Second difference I observed was when we hover bubble made card its image expansion does not synchronises with frame. While by native ways there was no such issue. 
I tried stretch and and zoom options too but did nt work well.Any suggestion is welcome if you know a better #technique.

In simplifying things #nocode #lowcode tools win always. But there is much more I guess to improve performance wise. 
#uiux #uidesign #webdesign #webflow #adalo 

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/s70k0shi2jwvhbhc345z.jpg)
Fundamentals of let, const, var 🚀
Tags: javascript, webdev, programming, es6
Published: 2022-09-29 04:16:13

Variables: Variables in JavaScript are containers for storing data. JavaScript allows the usage of variables in the following three ways:

## **var**:

var is the most commonly used variable in JavaScript. It can be initialized to a value, redeclared and its value can be reassigned, but only inside the context of a function. It can be function scoped or globally scoped.

 

![using var](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/rf1c5jwnx743eqpjr4wa.png)


## **let**:

let in JavaScript is similar to var only difference lies in the scope. var is function scoped, let is block scoped. It cannot be redeclared but can be reassigned a value.


![Using let](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/jq92qedd0lvymm9wdwp3.png)


## **const**:

const in JavaScript is used to declare a fixed value that cannot be changed over time once declared. They can neither be redeclared nor be reassigned. They cannot be hoisted either.


![Using const](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/a9au48xrlqeflgt92bbs.png)




📢Connect with me on [LinkedIn](https://www.linkedin.com/in/khalidhossainbadhon/)🚀
Reasons NOT to...
Tags: devrel, leadership, discuss
Published: 2022-09-29 04:12:30

Developer Relations (DevRel) is commonly tasked to drive growth and success of developers using their company's product. Of course, coming up with reasons why developers should adopt their product is necessary to deliver an effective message. But wouldn't it also be healthy to put attention on why they may NOT adopt?

I am just brainstorming here, but the following list captures reasons I believe developers may not adopt a product. 

## Unaware
It is not possible for a developer to adopt or use a service if they have never even heard of the company or product.

## Uninformed
Different from being unaware, this means the developer has only a vague or misinformed idea of company or product.

## Unneeded
The developer does not perceive the relevance of company or product.

## Untrusting
The developer's perception is that there is too much risk to engage with company or product. This could be due to not trusting the overall industry the company represents, or company/product too new in market.

## Unhappy
The developer had (or heard of) a bad experience with product or company.

## Uneasy
The developer may had initial interest, but the process to adopt or get engaged was too complex or confusing.

## Uneconomical
The developer has interest but considers cost of product or investment in time/resources a barrier to continue. Competitors appear (or are) less expensive.

## Underwhelmed
Despite possibly being the right fit for a developer, how the developer learns about the company or product did not impress enough to invoke active interest.

## Unable
While the developer may personally like the company or product, the perception (or reality) is that no adoption could take place due to constraints/policies of organization developer works for. 

---

I do not claim the above is an exhaustive list, but is it a good starting point for discussion? Imagine if each DevRel carefully considered each reason _**not**_ to, and came up with a plan to turn things around?

If you have other reasons why developers may not adopt, please share!

---
_Photo by Anna Shvets: https://www.pexels.com/photo/woman-with-hands-on-her-face-in-front-of-a-laptop-4226215/_
658. Leetcode Solution in cpp
Tags: cpp
Published: 2022-09-29 04:11:07

```cpp
class Solution {
 public:
  vector<int> findClosestElements(vector<int>& arr, int k, int x) {
    int l = 0;
    int r = arr.size() - k;

    while (l < r) {
      const int m = (l + r) / 2;
      if (x - arr[m] <= arr[m + k] - x)
        r = m;
      else
        l = m + 1;
    }

    return {begin(arr) + l, begin(arr) + l + k};
  }
};

```
#leetcode
#challenge
Here is the link for the problem:
https://leetcode.com/problems/find-k-closest-elements/