teleren/devto huggingface dataset:
Automated AI Tool for Image Optimization, Wonderful!
Tags: tutorial, productivity, opensource
Published: 2022-06-29 08:32:11

[VanceAI Image Enhancer](https://vanceai.com/image-enhancer/) is an all-in-one solution for image optimization that covers a wide range of features, including enhancing details, sharpening, denoising, and many more.
Visit VanceAI official website at https://vanceai.com/ for more image processing services.
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ctp2zb45jfyrt6az0xvt.png)
Kth Row in Pascal Triangle x InterviewBit
Tags: java, programming, codenewbie
Published: 2022-06-29 08:28:37

Today, the question is the `Kth Row of Pascal Triangle`. 

So what is a Pascal's triangle? 
## Pascal's Triangle
It is of the most interesting Number Patterns in Mathematics (named after Blaise Pascal, a famous French Mathematician and Philosopher).

To build the triangle, start with "1" at the top, then continue placing numbers below it in a triangular pattern.

Each number is the numbers directly above it added together.

<img src="https://www.mathsisfun.com/numbers/images/pascals-triangle-add.svg"/>

(Here I have highlighted that 1+3 = 4)

## Approach 1 : Brute Force
Some wise men said(as still they say), when asked in an interview, _always_ go for the brute force approach first. 

So, what is the brute force approach here? Well in terms of `time`, there is always `O(N*N)` complexity. 

- Step 1 : Create a 2D list(Java/Python/Javascript) or a 2D vector(C++).
- Step 2 : Generate the first row i.e. `[1]`.
- Step 3 : Consecutively, for each row add 1 as the first element and then for the `ith row` and `jth column` value : 
```javascript
 //(if j-1 exists)
 list[i][j] = list[i-1][j-1] + list[i-1][j]
``` 
Then append another 1 at the end.
- Step 4 : Continue **Step 3** `k times`

And now you have the kth row of the Pascal Triangle. 
### Complexity : Time - `O(N*N)`, Space-`O(N*N)`

## Approach 2 : Space Optimized
As I said, in this question we cannot optimize the time.
 
So, as the same wise men said : 
> When you cannot optimize in terms of time, go for the next in line : SPACE

So, how can we optimize for space? Of course, instead of a 2D list, what if we can do the same in a 1D list?

What we can do here is, _instead of adding the new row to the 2D list, we can just replace the previous list_. 

The code looks like this :
```java
public ArrayList<Integer> getRow(int k) {
        ArrayList<Integer> row = new ArrayList<>();

        row.add(1);
        int count = 1;
        while(count<=k){
            int i=0,j=i+1;
            ArrayList<Integer> curr = new ArrayList<>();
            curr.add(1);
            while(i<row.size() && j<row.size()){
                curr.add(row.get(i)+row.get(j));
                i++;
                j++;
            }
            curr.add(1);
            row = curr;
            count++;
        }
        return row;
    }
```

Hope you have understood the solution. 
For solutions of other InterviewBit questions, 👉👉checkout my  [Github Repo](https://github.com/thevinitgupta/Java-DSA-Practice/tree/main/src/InterviewBit)

Stay Tuned for more!!
Need Help
Tags: react
Published: 2022-06-29 08:23:13

HOW TO DO THIS IN REACT?

Clicking on a TODO card should mark the TODO as complete and move it to the
bottom of the list.

```
import React, { useEffect, useState } from "react";
import "./App.css";
import TodoForm from "./components/TodoForm";
import TodoList from "./components/TodoList";

const App = () => {
  const [todo, setTodo] = useState("");
  const [todos, setTodos] = useState(
    JSON.parse(localStorage.getItem("todos")) ?? []
  );
  const [editId, setEditId] = useState(0);

  useEffect(() => {
    localStorage.setItem("todos", JSON.stringify(todos));
  }, [todos]);
  const handleSubmit = (e) => {
    e.preventDefault();

    if (editId) {
      const editTodo = todos.find((i) => i.id === editId);
      const updatedTodos = todos.map((t) =>
        t.id === editTodo.id
          ? (t = { id: t.id, todo })
          : { id: t.id, todo: t.todo }
      );
      setTodos(updatedTodos);
      setEditId(0);
      setTodo("");
      return;
    }

    if (todo !== "") {
      setTodos([{ id: `${todo}-${Date.now()}`, todo }, ...todos]);
      setTodo("");
    }
  };

  const handleDelete = (id) => {
    const delTodo = todos.filter((to) => to.id !== id);
    setTodos([...delTodo]);
  };

  const handleEdit = (id) => {
    const editTodo = todos.find((i) => i.id === id);
    setTodo(editTodo.todo);
    setEditId(id);
  };

  return (
    <div className="App">
      <div className="container">
        <h1>Todo List App</h1>
        <TodoForm
          handleSubmit={handleSubmit}
          todo={todo}
          editId={editId}
          setTodo={setTodo}
        />

        <TodoList
          todos={todos}
          handleEdit={handleEdit}
          handleDelete={handleDelete}
        />
      </div>
    </div>
  );
};

export default App;

```

```
import React from "react";

const TodoList = ({ todos, handleDelete, handleEdit }) => {
  return (
    <ul className="allTodos">
      {todos.map((t) => (
        <li className="singleTodo" key={t.id}>
          <span className="todoText">{t.todo}</span>
          <button onClick={() => handleEdit(t.id)}>Edit</button>
          <button onClick={() => handleDelete(t.id)}>Delete</button>
          <input className="checkbox" type="checkbox"></input>
        </li>
      ))}
    </ul>
  );
};

export default TodoList;


```

```
import React from "react";

const TodoForm = ({ handleSubmit, todo, editId, setTodo }) => {
  return (
    <form className="todoForm" onSubmit={handleSubmit}>
      <input
        type="text"
        value={todo}
        onChange={(e) => setTodo(e.target.value)}
      />
      <button type="submit"> {editId ? "Edit" : "Add"}</button>
    </form>
  );
};

export default TodoForm;

```
Today's Daily Humor For Devs - Daily Developer Jokes
Tags: jokes, dailydeveloperjokes
Published: 2022-06-29 08:00:10

---
title: "Today's Daily Humor For Devs - Daily Developer Jokes"
description: "Check out today's daily developer joke! (a project by Fred Adams at xtrp.io)"
series: "Daily Developer Jokes"
published: true
tags: #jokes, #dailydeveloperjokes
---

Hi there! Here's today's Daily Developer Joke. We hope you enjoy it; it's a good one.

![Joke Image](https://private.xtrp.io/projects/DailyDeveloperJokes/public_image_server/images/5e1258cecd22f.png)

---

For more jokes, and to submit your own joke to get featured, check out the [Daily Developer Jokes Website](https://dailydeveloperjokes.github.io/). We're also open sourced, so feel free to view [our GitHub Profile](https://github.com/dailydeveloperjokes).

### Leave this post a ❤️ if you liked today's joke, and stay tuned for tomorrow's joke too!

_This joke comes from [Dad-Jokes GitHub Repo by Wes Bos](https://github.com/wesbos/dad-jokes) (thank you!), whose owner has given me permission to use this joke with credit._

<!--
Joke text:
___Q:___ Why did the computer squeak?

___A:___ Because someone stepped on its mouse!
 -->
The benefits of cloud computing
Tags: aws, cloud
Published: 2022-06-29 07:44:45

###Increased flexibility and scalability
Flexibility and scalability is a big advantage of cloud computing. Perhaps the most obvious benefit is that it allows businesses to scale their operations up or down as needed, without incurring the costs of buying and maintaining their own infrastructure. This can be a huge advantage for businesses that experience seasonal spikes in demand, or that are growing rapidly and need to be able to respond quickly to changes in demand.

Another benefit in cloud computing is the ability to quickly deploy new applications and services, This can be a big advantage when businesses need to respond quickly to market changes or new opportunities.
There are many other benefits of cloud computing, but these two – increased flexibility and scalability – are some of the most important. If your business is looking for a more agile and cost effective IT infrastructure, then cloud computing may be the right solution.
###Greater storage capacity and efficiency
Businesses can use cloud computing for a variety of purposes, including storage, backup, recovery, computing, and networking. Storage is one of the most popular uses for the cloud, as it allows businesses to store data offsite and access it from anywhere. 
Additionally, the cloud can be used for backup and recovery in the event of a disaster. Computing in the cloud can also be used to run applications and services, such as email and web hosting.
There are many benefits to using cloud computing, but it's important to understand the different types of clouds and how they can be used before making the switch.
###Enhanced security
Despite the fact that enhanced security is not a guarantee, cloud computing still offers a number of advantages in this area. By taking advantage of the security measures offered by cloud providers, businesses can help protect their data and applications from unauthorized access.
Furthermore, cloud providers often have strong security measures in place to protect their data centers and customers’ data.


Overall, the benefits of cloud computing are vast and varied. I hope this article has inspired you to take advantage of all the cloud has to offer!

Star our [Github repo](https://bit.ly/3QFgAUf) and join the discussion in our [Discord channel](https://bit.ly/3HQtlYo).
Test your API for free now at [BLST](https://www.blstsecurity.com/?promo=blst&domain=https://dev.to/roy8/The_benefits_of_cloud_computing)!
Python 3.x No module named _sqlite3 [without root]
Published: 2022-06-29 07:43:34

![Error no module _sqlite3](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/zhgdr1d59ft1zueg3cx4.png)
 
Shortcut:
- Download Python (source tar.gz)
- Install using Prefix option & --enable-optimizations --enable-loadable-sqlite-extensions
- Find _sqlite3*.so file then copy into your working dir
- Run your script

----- Optional to read -----

Kemaren itu diminta migrasi aplikasi yang pernah gw buat, ke server lain. Nih aplikasi kebetulan basenya python.
Ceritanya semua requirement dan kebutuhannya disiapkan si client, dari Python sampai library-librarynya, gw cuma
Menyiapkan list kebutuhannya aja.

![dependencies-lib](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/en5tl6ihkuwll99k22ss.png)
 
Setelah tektokan panjang dengan sysadmin si client, mereka konfirmasi kalau semua package dan lib sudah selesai diinstallkan. Setelah script di runing ternyata masih fail, dan setelah dicheck ternyata ada library yang belum di temukan oleh si python.

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

Akhirnya minta diinstallin, dan dikonfirm sudah selesai diinstall untuk package sqlite3 & sqlite3-devel. 


Dicoba lagi, dan ternyata masih error yang sama, No module named '_sqlite3'
Hmmm, setelah googling-googling ternyata ga bisa langsung dipakai, kata orang-orang sih si pythonnya mesti dicompile ulang setelah si sqlite3 & sqlite3-devel diinstall.
Akhirnya kita infokan kembali klo masih ada problem, dan dikasih tau juga kira-kira ngesolvingnya begini…(kasih link stackoverflow)
Balasan tak kunjung tiba, akhirnya coba oprekin sendiri deh. Btw, kita ga punya akses root, jadi ya dicoba-coba & utak atik dulu aja, sape tau bisa. Paling coba install python sendiri (pake opsi prefix supaya ga nulis di dir yang ga dibolehkan).

1.  Gw download python sesuai kebutuhan yang versi source .tar.gz
2.  Gw install dengan opsi ./configure --enable-optimizations --enable-loadable-sqlite-extensions --prefix=[dir yang bisa di tulis]
3. make ; make install
4. Check2 hasil installnya dan cari file *sqlite3*.so
	
	
5. nah ketemu nih, tinggal coba di copy file so itu, ke dir aktif, buat ngetest dulu.
	
![error sqlite3](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ad0ok5d93mfg8ca5crdt.png)

![copy & run import sqlite3](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/j262efkss036dixw8tt7.png)
 
 
	
Bisa keliatan, sebelum di copy (line paling atas) hasilnya error, tapi setelah tuh file .so di copy, akhirnya ga error lagi. 
	
6. Selanjutnya, gw coba copy file .so tersebut ke direktori yang sama dengan script, dan gw runing scriptnya. Alhasil, script bisa di runing dan udh ga ada eror lagi.
7. Update progressnya ke client, infoin kalo aplikasi sudah bisa digunakan kembali, dan aplikasi sudah berjalan menggunakan server yang baru.
	
Ya begitu deh, karena udeh ngebet, daripada kelamaan, biar bisa ngerjain kerjaan yang lain, mending di oprekin sendiri. Untungnya kelar, klo engga, ya ga bakalan ngepost ini :))
TailwindCSS Masonry Layout
Tags: css, tailwindcss, webdev, tutorial
Published: 2022-06-29 07:25:32


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

The Masonry layouts once were used exclusively for image galleries.

But this kind layout is very catchy for the users, so the use cases have increased nowadays, it is used for post list, showcase list etc etc.

Let’s do it using some random images found on Unsplash


`<div class="columns-2 md:columns-3 lg:columns-4">
  <img class="mb-4" src="https://source.unsplash.com/random/1" />
  <img class="mb-4" src="https://source.unsplash.com/random/2" />
  <img class="mb-4" src="https://source.unsplash.com/random/3" />
  <img class="mb-4" src="https://source.unsplash.com/random/4" />
  <img class="mb-4" src="https://source.unsplash.com/random/5" />
  <img class="mb-4" src="https://source.unsplash.com/random/6" />
  <img class="mb-4" src="https://source.unsplash.com/random/7" />
  ....
</div>`

**Just 4 classes** to create this layout, amazing right?

ou can find on Codepen [here](https://codepen.io/93lucasp/pen/JjpgWEW) the basic layout and [here](https://codepen.io/93lucasp/pen/rNJgapY) the blog post layout.

If you like, you can check out the full article on Medium 👇

{% medium https://medium.com/notonlycss/tailwindcss-masonry-layout-553cdaea2e8a %}
406. Leetcode solution in CPP
Tags: cpp
Published: 2022-06-29 07:08:12



```
class Solution {
 public:
  vector<vector<int>> reconstructQueue(vector<vector<int>>& people) {
    vector<vector<int>> ans;

    sort(begin(people), end(people), [](const auto& a, const auto& b) {
      return a[0] == b[0] ? a[1] < b[1] : a[0] > b[0];
    });

    for (const auto& p : people)
      ans.insert(begin(ans) + p[1], p);

    return ans;
  }
};
```
What is BigQuery?
Published: 2022-06-29 07:04:59



•	More and more companies are looking to unlock business insights from their data.

•	But it can be hard to scalably ingest, store, and analyze that data as it rapidly grows.

•	Google's enterprise data warehouse, BigQuery, was designed to make large-scale data analysis accessible to everyone.

•	BigQuery can help you get valuable insights from your data with ease.

Let’s understand it from the root level!!!





If you're a developer, data analyst, or just about anyone else, you're probably working with data.
If your business has small amounts of data, you might be able to store it in a spreadsheet.
But as your amount of data grows to gigabytes, terabytes, or even petabytes, you start to need a more efficient system like a data warehouse.
That's because all that data isn't very useful unless you have a way to analyze it.
Traditionally, larger sets of data mean longer times between asking your questions and getting answers.

Have you ever needed to wait hours or days for an analytics report to be run?

BigQuery was designed to handle massive amounts of data, such as log data from thousands of retail systems or IoT data from millions of vehicle sensors across the globe.

It's a fully managed and serverless data warehouse which empowers you to focus on analytics instead of managing infrastructure.
What Is Cloud Computing?
Published: 2022-06-29 07:03:39

Cloud Computing, in simple words, is accessing and storing data over the Internet instead of doing it on your personal hard drive.
It offers services like storage, database, networking, and more over the Internet to provide faster, innovative, and flexible resources to its customers. 
The customers get to pay only for the resources they use, hence helping them lower their operating costs and run their business infrastructure more efficiently.
Now, among various cloud providers like AWS, Microsoft, VMWare, IBM, etc., Google Cloud has been the talk of the town in recent years and there are enough reasons behind it. Let’s begin with starters and understand what Google Cloud is.


What Is Google Cloud Platform?
Google Cloud is a suite of Cloud Computing services offered by Google. 
The platform provides various services like compute, storage, networking, Big Data, and many more that run on the same infrastructure that Google uses internally for its end users like Google Search and YouTube.
Google server hasn’t gone down in years. So, if you are planning to run your application on the Google Cloud infrastructure, then you can be assured of your applications being safe and secure.
Google Cloud Services
Google Cloud has been expanding across the globe. The reason is the wide array of services it offers to its users:
•	Google Cloud Compute Services
•	Google Cloud Storage Services
•	Networking
•	Big Data Services
•	Security and Identity Management
•	Management Tools
•	Cloud AI
•	IoT
Technical concepts simplified
Tags: beginners, tutorial, todayilearned
Published: 2022-06-29 07:01:19

hey everyone! we've been writing over at [technically.dev](https://technically.dev/) to distill software engineering topics for _anyone_ who is not technical. 

I figured it could actually be for any beginner who is just starting out and needs a high level explanation of technical concepts.  

Check out one of our most popular posts on [APIs](https://technically.substack.com/p/whats-an-api)
[Swift] How to fetch only screenShot & screenRecording from photo library
Published: 2022-06-29 06:46:05

Apple doesn't prepare enum for screenRecording like `.photoScreenshot` in `PHAssetMediaSubtype`. However screenRecording asset has mediaSubtype which is `524288`.

```
import SwiftUI
import Photos

...
var photos: [Asset] = []

func fetchPhotos() {
    let options = PHFetchOptions()
    options.sortDescriptors = [NSSortDescriptor(key: "creationDate", ascending: false)]
    options.predicate = NSPredicate(format: "((mediaSubtype & %d) != 0 || (mediaSubtype & %d) != 0)", PHAssetMediaSubtype.photoScreenshot.rawValue, 524288)
    options.includeHiddenAssets = false
        
    let result = PHAsset.fetchAssets(with: options)
    result.enumerateObjects { asset, index, _ in
        Task {
            guard let image: UIImage = await self.getImageFromAsset(asset: asset, size: CGSize(width: self.assetSize, height: self.assetSize)) else { return }
            DispatchQueue.main.async { [weak self] in
                self?.photos.append(Asset(asset: asset, image: image))
            }
        }
    }
}

private func getImageFromAsset(asset: PHAsset, size: CGSize) async -> UIImage? {
    return await withCheckedContinuation { continuation in
        let manager = PHCachingImageManager()
        manager.allowsCachingHighQualityImages = true
            
        let options = PHImageRequestOptions()
        options.deliveryMode = .highQualityFormat
        options.isSynchronous = false
        manager.requestImage(for: asset, targetSize: size, contentMode: .aspectFill, options: options) { image, _ in
            continuation.resume(returning: image)
        }
    }
}
```
VS Code Cheat Sheet 2022
Tags: vscode, cheatsheat, programming, editor
Published: 2022-06-29 06:40:41

Hi guys, we all love VS code and using VS Code shortcuts, you can save your lots of time. So here I have mentioned important VS Code Cheat Sheet for 2022.

## Editing 1

1. shift+ctrl+↵ - Insert line above
2. ctrl+↵ - Insert line below
3. shift+ctrl+K - Delete line
4. shift+alt+UP - Copy line up
5. shift+alt+DOWN - Copy line down
6. alt+UP - Move line up
7. alt+DOWN - Move line down

## Editing 2

1. shift+ctrl+] - Unfold region
2. shift+ctrl+[ - Fold region
3. ctrl+[ - Outdent line
4. ctrl+] - Indent line
5. shift+ctrl+\ - Jump to matching bracket

##Editing 3

1. alt+Z - Toggle word wrap
2. shift+alt+A - Toggle block comment
3. ctrl+/ - Toggle line comment
4. ctrl+Kctrl+J - Unfold all regions
5. ctrl+Kctrl+0 - Fold all regions
6. ctrl+Kctrl+] - Unfold all subregions
7. ctrl+Kctrl+[ - Fold all subregions

##Multi-cursor / Selection 1

1. shift+ctrl+L - Select all occurrences of current selection
2. ctrl+I - Select current line
3. shift+alt+I - Insert cursor at end of each line selected
4. ctrl+U - Undo last cursor operation
5. alt+ctrl+DOWN - Insert cursor below
6. alt+ctrl+UP - Insert cursor above


##Multi-cursor / Selection 2

1. shift+alt+ctrl+LEFT - Column box selection left
2. shift+alt+ctrl+RIGHT - Column box selection right
3. shift+alt+ctrl+DOWN - Column box selection down
4. shift+alt+ctrl+UP - Column box selection up
5. shift+alt+LEFT - Shrink selection
6. shift+alt+RIGHT - Expand selection

##Search / Replace 1

1. ctrl+Kctrl+D - Move last selection to next Find match
2. alt+↵ - Select all occurrences of Find match
3. ctrl+D - Add selection to next Find match
4. shift+F3 - Find previous
5. F3 - Find next
6. ctrl+H - Replace
7. ctrl+F - Find

##Rich Languages Editing 1

1. alt+F12 - Peek definition
2. F12 - Go to definition
3. ctrl+Kctrl+F - Format selection
4. shift+alt+F - Format document
5. shift+ctrl+[SPACE] - Trigger parameter hints
6. ctrl+[SPACE] - Trigger suggestion

##Rich Languages Editing 2

1. ctrl+KM - Change file language
2. ctrl+Kctrl+X - Trim trailing whitespace
3. F2 - Rename symbol
4. shift+F12 - Show references
5. ctrl+. - Quick fix
6. ctrl+KF12 - Open definition to the side

##Navigation

1. ctrl+M - Toggle tab moves focus
2. alt+RIGHT - Go forward
3. alt+LEFT - Go back
4. shift+F8 - Go to previous error or warning
5. F8 - Go to next error or warning
6. shift+ctrl+M - Show problems panel
7. shift+ctrl+O - Go to symbol...
8. ctrl+P - Go to file...
9. ctrl+G - Go to line...

##Editor Management

1. ctrl+3 - Focus into 3rd editor window
2. ctrl+2 - Focus into 2nd editor window
3. ctrl+1 - Focus info 1st editor window
4. ctrl+\ - Split editor
5. ctrl+KF - Close folder


Comment down your Favorite shortcut you use daily
I created Logistics and Transport Management Software
Tags: logistic, transports, tms, nextjs
Published: 2022-06-29 06:10:26

Hey guys I have reacently created a Logistics and Transport Management software for a company. You can see all the features of that software here.

## Booking

1. LR/CN Booking
2. Vehicle Assign

## Loading

1. Vehicle Register
2. Petrol Pump Register
3. Driver Register
4. Bilty Generate
5. Print Bilty

Don't forget to check my gig on Fiverr - [I will create logistics and transport management software](https://www.fiverr.com/santoshmlm/create-logistics-and-transport-management-software)

## Settings

1. Location
2. Location Mapping
3. Vehicle Category List
4. Vendors List
5. Main Vendor

## Account

1. Advance Payment
2. Unload Vehicle
3. Vehicle Payment
4. Consignor Payment
5. Multiple Consignor Bills
6. Processed Bills
7. Approved Bills

## Admin

1. Employee Registration
2. Employee List
3. Assign Role

## The below technology is used for this software

1. Fronted - NextJS
2. Backend and API - Laravel
3. Database - MySql

Don't forget to check my gig on Fiverr - [I will create logistics and transport management software](https://www.fiverr.com/santoshmlm/create-logistics-and-transport-management-software)

You can start a discuss with me at santoshdevnath15@gmail.com