teleren/devto huggingface dataset:
Time Complexity
Tags: python
Published: 2022-09-14 17:20:49


Time complexity is an important part of algorithms in programming. By using time complexity, we can estimate how much time is needed for a code to run. Usually 3 symbols are used to denote the time complexity. They are big O notation, omega and theta. omega represents best case scenario, theta represents average case scenario and big O notation represents worst case scenario. Mostly during analyzing time complexity, worst case scenarios are calculated. That's why big O notation is used. There are some notations for time complexity like O(1), O(n), O(n^2), O(logn), O(nlogn) etc. 

Firstly, we will talk about O(1). This actually means that our code will run for constant time. For example, we can write the python code like`x = 9`. This line of code will have a time complexity of O(1) which is constant. Similarly, if we write the code

```
x = 9
y = 5
```
what will be the time complexity here? In this code, each line has a time complexity of O(1).As each line of this python code has a time complexity of O(1) so will the time complexity of the code be O(1+1) which is O(2)?No, it will still be O(1) that is because O(2) is also a constant time and O(1) is used to represent constant time.

But what if we have a loop in our code? Let's write a code for that.

```
for i in range(10):
   print(i)
```
Here the print statement has a time complexity of O(1). In this for loop the print statement will run 10 times.So, the time complexity will be O(10) as the loop will run 10 times. But what if the loop runs n times? Then the time complexity will be O(n). So, for a single loop the  time complexity will be O(n). But what if there are 2 loops in our code. For example:

```
for i in range(n):
  print(i)
for j in range(n):
  print(j)
```
Here, the time complexity will be O(n+n) which is O(2n). But for writing time complexity we ignore the constants. So the time complexity for this code will also be O(n).

Besides, we will talk about another time complexity which is O(n^2). This time complexity is for nested loops. For example:

```
for i in range(n):
  for j in range(n):
     print(i,j)
```
In this code as there is a nested for loop the code will run O(n*n) times which is O(n^2) times. In this case also if there is the constant then we will remove it.What will be the time complexity for this code?

```
for i in range(2n):
   for j in range(n):
       print(i,j)
for a in range(n):
  print(a)
```
In this code, will the time complexity be O(2*(n^2)+n)? No, still the time complexity of the code will be O(n^2). The reason is that we ignore constants in writing big O notation. So, 2 will not be written in big O notation. But another question arises which is why won't the time complexity be O(n)? The reason is we always take the highest power of the equation we get in big O notation.That's why the time time complexity of the code is O(n^2).
Linear Search
Tags: dsa, python
Published: 2022-09-14 17:19:48


### *Introduction*

*Let’s suppose we have an array `arr= [4,6,3,7,8,5,34,26,23]` of length* n *and we want to find the index for 5 in this array, then the most intuitive way to search is that we compare each element of the array with 5 and if it matches we return the index of 5, this method of traversing the array for searching an element is called linear search or sequential search.*

*Let’s take another example*
```python
arr = [9,29,46,23,75,98] 
# find an index of 75
# desired output 4
```
*for finding the index of 75 these are the steps you must follow*

- *iterate from 0 to ```
len(arr)-1
``` and compare each element of the arr*
- *if there is a match then return the index of the arr and if the element is not in the array return -1*

### *Python implementation*

```python
def linearSearch(arr, x):
    for i in range(len(arr)):
        if arr[i] == x:
            return i
    return -1

# driver code
arr =  [9,29,46,23,75,98]
x = 75
result = linearSearch(arr,x)
print("Elemen is present at Index ",result)
``` 
*in the above code, we are defining a function linearSearch and it takes two arguments an array and an element to search, after that we are running a for loop with a range function with a length of the arr i.e 6, so in the worst case, if the element is present in the array, we will iterate 6 times.  after that in the if block, we are checking if the element at the ith index is equal to the element we want to search and if that’s the condition then we return the index of the element.*


```python 
for i in range(len(arr)):
        if arr[i] == x:
            return i
    return -1

# first iteration
if arr[0] == x: -> i.e 9 == 5 -> False
# second iteration
if arr[1] == x: -> i.e 29 == 5 -> False
# third iteration
if arr[2] == x: -> i.e 46 == 5 -> False
# fourth iteration
if arr[3] == x: -> i.e 23 == 5 -> False
#fifth iteration
if arr[4] == x: -> i.e 75 == 5 -> True
#our loop will stop here and it will return index 4
``` 





### *JavaScript implementation*

```javascript
function linearSearch(arr, x) {
	for (let index = 0; index < arr.length; index++) {
		if (arr[index] === x) {
			return index;
		}
	}
	return -1;
}

// driver code
arr =[9,29,46,23,75,98];
x =  75;
result = linearSearch(arr, x);
console.log(result);
``` 
### *Note*
*If the same element is present more than one time then the linear search will return the index of the first element.*

```python 
arr = [9,29,46,23,75,75,75,98] 
# here 75 is present at multiple index i.e index 4,5,6
# so the linear search will return index of only first element i.e 4
``` 


### Time Complexity

*The worst case of the algorithm occurs when we search through the whole array and an element is not present in the array in that case algorithm will do f(n) =  n + 1 comparisons, thus in the worst case, the running time complexity of our algorithm depends on n i.e length of the array. time complexity O(n)*
Top Trends OF DOT NET Framework
Tags: dotnettrend, dotnet
Published: 2022-09-14 16:29:18

**

## What is the.NET Framework, exactly?
**

.NET is a valuable web development framework for creating web-based applications, form-based applications, and relevant services. The framework includes a virtual machine that is capable of compiling and running various programs. These scripts can also be written in a variety of languages, including VB.NET, C#, and others.


One of the few web development frameworks with a wealth of features and functionalities specifically created to simplify things for developers is. NET. As a result, numerous developers are using the .NET framework to create appealing and user-friendly web apps, webpages, smartphone applications, and web development projects.

The framework is particularly well-liked by companies wishing to launch.NET-based websites and boost their online presence. No matter the complexities or nuances in your application or website, .NET can help you ensure a successful completion without any hassle. Moreover, it provides you with a wide array of libraries and tools that developers love since it makes their job much easier.



**

## Top 10 Most Recent.NET Trends for 2022–2023
**

Now that you have a transparent idea of what .NET is all about, it is time to dive deep into the nuances of the framework. So continue reading as we explore 10 dominating .NET trends in 2023.

.NET Is Now One of the Most Predominant Web Development Frameworks
Google searches have become very easy to determine trends from the search history of different people. In recent times, the search for topics related to ASP.NET Core is becoming widely popular among developers all around the globe.


Therefore, it is reasonable to say that.NET is evolving into one of the most widely used web development frameworks on the market. The framework’s flexibility, performance, and security make it an ideal fit for most startups and enterprise organizations.

## **Increase In Server-Less Computing With .NET
**
The rise in cloud computing has significantly increased the demand for serverless computing. Unsurprisingly, organizations opt to go serverless as it offers more scalability, cost-effectiveness, stability, and security. But the catch here is that .NET has emerged as the most preferred serverless computing framework in recent times.

To Read Full Article Please Click On The Following Link [https://digibharata.com/latest-dotnet-trends/](https://digibharata.com/latest-dotnet-trends/)
troubleshooting as a complete newbie
Tags: git, bash, troubleshooting, bootcamp
Published: 2022-09-14 17:10:58

Had some difficulty today while working on my project for BootCamp, was not working in my new branch as I was continuing from yesterday (seems I'd been hit with a windows update of course) and had quite the time being as stubborn as I am figuring out how to get into the new branch, then merge them. so this is showing how many times I had tried to merge. Gonna be fun getting into version control with git, but I can't wait!


![my pull request list while having issues with merging my new branch into main](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/zry8wartzp9p2ux5y3b5.png)
Relative Ranks - I
Tags: javascript, leetcode
Published: 2022-09-14 16:52:54

```js
/**
 * @param {number[]} score
 * @return {string[]}
 */
var findRelativeRanks = function(score) {
    const sortedArray = [...score].sort((a,b) => b-a);
  let count = 1;
  let obj = {};
  for (let i = 0; i < sortedArray.length; i++) {
    obj[sortedArray[i]] = getValue(count);
    count++;
  }

    for(let i=0; i<score.length; i++){
        score[i] = obj[score[i]]?.toString()
    }
    return score
};

const getValue = (count) =>{
    
    switch(count){
        case 1:
            return "Gold Medal";
        case 2:
            return "Silver Medal";   
        case 3:
            return "Bronze Medal"
        default:
            return count;
    }
    
}

```
Slack のメッセージを定期的に Google Spread sheet に定期的に保存する
Tags: slack, gas, automation, api
Published: 2022-09-14 16:32:11

## 参考

https://best-cloud.jp/slack-message-log-auto-save-gas/


## Slack WorkSpace を作る

https://api.slack.com/

まずは Slack API を試す専用のワークスペースを作る。

今回は kaede-ws

という　id で Slack WorkSpace を作成

---

## api.slack.com で create app

https://api.slack.com/apps

次は API アクセスの為のアプリを作る。

アプリ名を　saver にして

先ほど作った kaede-ws のワークスペースを選択

これで create app をする

---

## Features/OAuth/Scopes でチャンネルなどの読み書きの許可を設定する

次はそのアプリに権限を付与する。
チャンネルに書き込みたい。
そのために

Channels: の　history, read, 
files: の read,
users: の read,

これらを許可する設定にする

そして install to workspace ボタンを押す

すると User OAuth Token 発行される。
この UUID を使ってリクエストする。

xoxp-uuid の形になる。

---

## Gdrive で専用フォルダを作成して ID を控える

次は Slack API を叩いた結果を保存するための Google Drive 。

Gdrive で SlackLog/ フォルダを作成

フォルダの UUID

を控える

---

## script.google.com で プロジェクトを作る

次は Slack API を叩くロジックを書いて実行するところ。

GAS を使う。

https://script.google.com/home

ここから New Project を選ぶ

すると Code.gs が開き

```ts
function myFunction() {
  
}
```

と書いてあるのが見える

これを消して

ここに記事のテキストをコピペする...

save して run する

```
Google hasn’t verified this app
The app is requesting access to sensitive info in your Google Account. Until the developer (kaede0902js@gmail.com) verifies this app with Google, you shouldn't use it.
```

するとこのエラーが出る

https://www.kagua.biz/tool/jisaku/gas-authentication-not-pass.html

この記事によると、左下のリンクをクリックすると進行できるとある。

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

Advanced のテキストをクリックすると

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

安全ではないページへ移動が出てきた


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

そして認証ができる

そして実行すると、Sheet 1 には何もないが、チャンネルごとにシートが生成され、

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


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

内容が入っている

---

## 定期的に実行されるようにする。

目覚まし時計のアイコンから

Every Minute で 毎分実行するようにする

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

後から書いたテキストが上書き保存されているのを確認した

Jenkins でシェルを cron するより手軽にみえる。
My first ProductHunt launch...
Published: 2022-09-14 16:24:05

I did it! My first ProductHunt launch! 
 
Our new product is YouTube downloader - SYC PRO. With it, u can download any YT video to any Apple device directly, edit metadata, and download video with subtitles.
 
Please support us on Product Hunt — by leaving a comment or a review🙏🏼

➡️ https://www.producthunt.com/posts/softorino-youtube-converter-pro
How I implemented login with logify in my existing project
Published: 2022-09-14 16:21:53

Initially my project has a simple counter.

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

Now I want to show this screen after login only.

**Step 1: Get a Domain Key from Logify
Follow this article [How to Get a Domain Key](https://dev.to/logify/how-to-get-a-domain-key-at-logify-httpslogifyid-34o7) to get your Domain Key if you do not already have it.

**Step 2: Update React Project**
Install node module in your existing project
`npm install react-logify`

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

Create `.env` file

Paste `REACT_APP_LOGIFY_DOMAINKEY = YOUR_DOMAIN_KEY`

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

**Step 3: Update code in App**
```js
import React from 'react'
import {useLogify} from 'react-logify';
import Counter from './components/CounterApp'
 
export const App = () =>{
    const { user, onLogin, onLogout } = useLogify();
 
    return <>
        {!user.id && <center><button onClick={onLogin}>Signup / Login</button></center>}
        {user.id && 
            <>
                <center>
                    {user.name}
                    <img alt='' src={user.pic} style={{width:48,borderRadius:'50%',margin:'0 10px'}}/>
                    <button onClick={onLogout}>Logout</button>
                </center>
                <Counter/>
            </>
        }
    </>
}
```

Run `npm start` in terminal

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

After logout, I can see Login/Signup button

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

If anybody wants to see the counter page, he has to login

Resources

- [Demo](https://logify-counter-app.netlify.app/)
- [GitHub](https://github.com/poojasaralia12/counter-with-logify)
Welcome Thread - v191
Tags: welcome
Published: 2022-09-14 16:08:33

---
title: Welcome Thread - v191
published: true
description: Welcome to DEV! A thread of hellos and intros.
tags: welcome
canonical_url: 
---

![Obi-Wan Kenobi floating up from the bottom of the frame kinda awkwardly and saying "Hello there". The words appear within the frame as he says them. Pretty sure this is a famous meme — it always makes me giggle. 😅](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/kk29qdghmebybt9z36dm.gif)

### Welcome to DEV!

1. Leave a comment below to introduce yourself! You can talk about what brought you here, what you're learning, or just a fun fact about yourself.

2. Reply to someone's comment, either with a question or just a hello. 👋 

**Great to have you in the community!**
🔴  It’s tomorrow! Luos is hosting a live keynote on Discord at 9:00 am PT.
Tags: opensource, microservices, systems, luos
Published: 2022-09-14 16:07:31

🔴 It’s tomorrow! Luos is hosting a live keynote on Discord at 9:00 am PT.

To participate ⏩  https://discord.gg/myMhgJvP?event=1013835403465326683

Nicolas Rabault will present the new version 2.6!
不言而喻的變數命名（1）
Tags: javascript, beginners, programming
Published: 2022-09-14 15:42:56

最近發現寫程式時，常常為了想變數名字而中斷下來，這邊整理一些自己偏好的命名規則，希望能減少這種卡頓的感覺。

核心思想：好的程式碼讀起來應該像閱讀一篇簡單易懂的文章，內容沒有艱澀難懂的字詞、並且有適當的排版，個人認為良好的變數命名功不可沒，值得花時間思考思考。

---

- 要能從命名看出值的型別

```javascript
const fruitAmount = 1;
// fruitQuantity, numberOfFruit...

const isDelicious = true;
// hasSeeds, areYouSerious...

const fruitList = ['apple', 'banana', 'orange'];
```

- function 的命名描述做了什麼，若有回傳值希望能知道回傳什麼

```javascript
// 描述做了什麼
function findNearbyRestaurants() {}

// 可以預期回傳什麼
function getNearbyRestaurantsList() {}
```

---

先整理一點點，後續再補上～
I need help with an authentication form
Published: 2022-09-14 15:23:50

so I'm using next js, and I have an application with a form that I need to create and login for standard users, where inside I'll have a user adm that will have access to a route and a component
and I need to store information like wishlist product id and shopping cart product id, user profile picture, and some other data...
can anyone help?
that's basically it

**helpp**
Main List, Gelişmiş Arama
Tags: uyumsoft
Published: 2022-09-14 15:08:54

```
<row>
<cell colspan="6">
	<control Caption="Gelişmiş Arama" FieldName = "AdvancedSearch;Detail_DcardName" Focused="true" ControlType = "MemoEdit" Width="365">
		<ClientSideEvents KeyDown="function(s, e) 
																			{
																					if (e.htmlEvent.keyCode == 13)
                                          {
                                           btnSearch.DoClick();
                                           s.SetFocus();
                                          }
																			}"></ClientSideEvents>
	</control>
</cell>
</row>
```

`Detay objeden bir alan ise "Detail_" eklemek gerekmektedir. Ör. Detail_DcardName`

> LIKE '%substring%' şeklinde çalışır. 

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


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/g85kdo15jz75hwxm6veb.png)
What is the best way to learn Javascript?
Tags: javascript, beginners, programming, webdev
Published: 2022-09-14 14:47:21

**Self Taught Websites**

Self teaching your self is one of the effective ways of learning javascript, you can remember better too.

Websites that you can use :

Free Code Camp : https://www.freecodecamp.org/learn/javascript-algorithms-and-data-structures/basic-javascript/ (FREE)(How I Learnt)

W3schools : https://www.w3schools.com/js/ (FREE)

Codeacademy : https://www.codecademy.com/learn/introduction-to-javascript (PAID)

Udemy : https://www.udemy.com/course/modern-javascript-from-the-beginning/ (PAID)

**Build Your Own Projects**

Why not, building your own stuff improves your ability getting used to javascript and remembering it, and what is the point of learning javascript without building your own projects.

Project Ideas :

_HTML Calculator_

_Tic Tac Toe_

_Maybe a simple game_

**Never give up**

Learning JS can be hard, and fustrating(speaking from experience). This is my 5th time learning JS and I'm still learning but trust me you will eventually get there and it's worth it, especially when it comes to getting a front-end developer job.
This is the future of api
Tags: react, showdev, productivity, python
Published: 2022-09-14 14:42:26

Hello my dear developers the oxideapi completed half-century of users only with your support we can upgrade the websites.Please use our web for your api works.Now we made some updates in the websites with jsonplaceholder try this update now.

Oxideapi:-https://oxideapi.web.app

Thank you!
Drupal Entity view display problem solved
Tags: webdev, opensource, php
Published: 2022-09-14 14:34:16

**Problem/Motivation**
After doing a recent installation of Drupal 9.4.5, we came across the following problem and error message when browsing. 

After doing an initial investigation, an error message would appear.

It would seem a lot of this code relates to issue on Drupal.org: #2562107-77: EntityDisplayBase should react on removal of its components dependencies.
 
From a logic perspective it certainly makes sense to allow the default comment formatter, and Plugins in general to react to configuration changes on Entity Displays.

**Work-around/Temporary solution**
Note the problem can be fixed temporarily by removing the config dependency either programmatically, or by importing the modified config through the backend.
 
Lastly, since we're really unsure how to approach the problem and the config dependency system seems to have a lot of moving parts, we found the following issues that could potentially be related or where some work is carried around Plugins.'

This is a quick summary of the work David @ Code Enigma did. [Read the full post on Drupal.org](https://www.drupal.org/project/drupal/issues/3306434).
Two new shell aliases for git
Tags: git
Published: 2022-09-14 14:28:42

---
title: Two new shell aliases for git
published: True
tags:
  - git
cover_image: https://stable-diffusion.waylonwalker.com/000172.3260819219.webp
---

Recently I added two new bash/zsh aliases to make my git experience just a tad better.

## trackme

Most of our work repos were recently migrated to new remote urls, we scriped out the update to all of the repos, but I was left with a tracking error for all of my open branches.  To easily resolve this I just made an alias so that I can just run `trackme` anytime I see this error.

```txt
There is no tracking information for the current branch.
    Please specify which branch you want to merge with.
    See git-pull(1) for details

    git pull <remote> <branch>

If you wish to set tracking information for this branch you can do so with:

    git branch --set-upstream develop origin/<branch>
```

### getting the branch

The following command will always return the currently checked out branch name.

``` bash
git symbolic-ref --short HEAD
```

Injecting this into the suggested `git` command as a subshell gives us this alias that when ran with `trackme` will automatically fix tracking for my branch.

``` bash
alias trackme='git branch --set-upstream-to=origin/$(git symbolic-ref --short HEAD)'
```

## rebasemain

I sometimes get a bit lazy at checking main for changes before submitting any prs, so again I made a quick shell alias that will rebase main into my branch before I open a pr.

``` bash
alias rebasemain='git pull origin main --rebase'
```

## The Aliases

Here are both of the alias's, feel free to steal and modify them into your dotfiles.  If you are uniniatiated a common starting place to put these is either in your `~/.bashrch` or `~/.zshrc` depending on your shell of choice.

``` bash
alias trackme='git branch --set-upstream-to=origin/$(git symbolic-ref --short HEAD)'
alias rebasemain='git pull origin main --rebase'
```
Glenwood
Published: 2022-09-14 14:19:03

![Image](https://cdn.letterdrop.co/pictures/fea9a869-878e-4d96-b4e8-7f97ad6dbd6d)

Image caption

**GlaceOffice**
---------------

GlaceOffice is a suite of integrated tools that enables smooth operation of group practices. A single software package to fill in the gaps of practice administration.
C++da ascii jadvali
Published: 2022-09-14 14:18:11

```
cout<<"input: ";
   int a;
   cin>>a;
   cout<<"output(int): "<<int (a)<<endl;
   cout<<"output(char): "<<char (a);
```
**a** o'zgaruvchi int tipiga oid,ya'ni sonlarni qabul qiladi.
**a** o'zgaruvchiga o'z tipiga oid bo'lmagan elemnt kiritilsa,int tipi uni qabul qilmaydi.
Uni `char` tipida o'qilsa,quyidagi jadval ishga tushadi: 

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/wt28ejd7j2plk7nhn3gb.jpg)
Khired Networks – A Saas Development Services Company.
Tags: webdev, programming, cloud
Published: 2022-09-14 14:15:38

[Khired Networks ]( https://khired.com/)offers reliable e-commerce store and business app development services with our in-house team of dedicated professionals. Our programming solutions can be tailored to meet individual needs and requirements as they are efficiently developed on various technologies. Hence, our [SaaS development services]( https://khired.com/solutions/saas-development/
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/kugeu63f192sp8i9dkuu.jpg)) offer your business wide-ranging opportunities, from marketing to enhancing your product range thus creating more sales. Additionally, with our augmented app, you can not only accomplish your corporate goals but also offer your clients a round-the-clock service that is convenient and user-friendly.