teleren/devto huggingface dataset:
SvelteKit 1.0 Just Around the Corner? [UPDATED]
Tags: sveltekit, svelte
Published: 2022-10-21 18:39:17

I guess lots of SvelteKit funs have noticed an early September 2022 announcement that SvelteKit is in its release candidate phase:

:exclamation: expect bugs!
:heavy_check_mark: no more planned breaking changes
:heavy_check_mark: countdown to a stable release
:x: feature-complete
:x: tutorials

Watch [the announcement](https://www.youtube.com/watch?v=A8jkJTWacow&t=29628s) and [track progress towards 1.0](https://github.com/sveltejs/kit/issues?q=is%3Aopen+is%3Aissue+milestone%3A1.0) for more details.



<br> 
<br> 
#So how is the progress as of the mid/end of November 2022?


[There](https://github.com/sveltejs/kit/milestone/2) are **7** open issues of _1.0 milestone_ :sunglasses:

![SvelteKit 1.0 open issues of 1.0 milestone](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/f7ypi73h72qzdbv9x2c7.png) 


<br> 
[There](https://github.com/sveltejs/kit/issues?q=is%3Aopen+is%3Aissue+label%3Ap1-important) are **12** open issues labeled _"p1-important"_ :grin:

![SvelteKit 1.0 open issues labeled "p1-important"](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/35hn9caeyxcf5wwf912v.png)


<br> 
[There](https://github.com/sveltejs/kit/issues?q=is%3Aopen+is%3Aissue+label%3Ap1-important+milestone%3A1.0) are **0** open issues of _1.0 milestone_ and labeled _"p1-important"_ :joy:

![SvelteKit 1.0 open issues of 1.0 milestone and labeled "p1-important"](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/p9ahhfmjv61ny6edg6eh.png)


<br> 
**But hold your horses** :tired_face:
[There](https://github.com/sveltejs/kit/issues?q=is%3Aissue+is%3Aopen+label%3A%22breaking+change%22) are **5** open issues labeled _"breaking-change"_ :worried:

![SvelteKit 1.0 open issues labeled "breaking-change"](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/j4157i23f68b5tr4knk7.png)
DB Locking - Why and How?
Tags: database, locking, systemdesign, dynamodb
Published: 2022-10-21 18:39:15

If you have sent concurrent requests to your DB to modify its contents, you would have come across a phenomenon called **The Double Booking Problem!**

Double Booking Problem arises when **_two or more_** threads read the same data point and one thread incorrectly overwrites the changes done by another thread resulting in inconsistency.

- Lets see an example to get better understanding of it.
- Suppose its a bus booking application. 

1. User 1 and User 2, both read Seat_21 as available.
2. User 1 books the seat. However User 2 is unaware of this as he has read Seat_21 is available.
3. User 2 also books the seat. Now the seat info is overwritten and the seat is allotted to User 2.
4. Due to this phenomenon of double time booking of resources, it is named as _The Double Booking Problem!_

Following flow diagram gives clear idea about it.


![Double Booking Problem Flowchart](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/iux83lrregifjdthinrc.png)


- In order to avoid this, we need to use locking.

____________________________________________________________

### Locking in DynamoDB

Let us see how we can lock dynamodb objects.

#### 1. Optimistic Locking
- The spotlight feature of optimistic locking is, it does not have a lock as such. Instead a **version number** is attached to the record and it is incremented whenever the record is updated.

- Multiple users are allowed to read the document or record.
- When the users try to commit their changes, the change related to the first request is accepted as the version numbers match in the record and in the commit request.
- Subsequent users trying to commit their changes are sent a _Validation Exception_!
- Based on this, the users can sync the updated record and make their changes and retry committing the changes.
- Therefore, the double booking problem is eliminated.

#### 2. Pessimistic Locking
- In pessimistic locking mechanism, **Locks** are implemented. The record that is being updated is locked when a user starts a transaction.
- Since the record is locked, the other users trying to update the record are notified that the record is locked and the read also fails.
- This mechanism although equally effective, has an overhead of implementing locks.
- Therefore, the double booking problem is eliminated.

____________________________________________________________

Thanks for reading this blog.
Aniketh Deshpande
India
Fetch youtube api for free (in dev console)
Published: 2022-10-21 18:38:43

You have to be on the youtube.com website, open the dev console, and then you can actually find results from the youtube api for free:

```
async function fetchYtInitialData(url) {
  let pageHtml = await (await fetch(url)).text(), result;
  try { return JSON.parse(pageHtml.split('var ytInitialData = ')[1].split(';</script>')[0]); } catch(err) { console.error(err) }
}

async function freeYoutubeApiCall(query) {
  ytInitialData = await fetchYtInitialData('https://www.youtube.com/results?search_query=' + query);
  const videoData = [];
  ytInitialData.contents.twoColumnSearchResultsRenderer.primaryContents.sectionListRenderer.contents.forEach(y => y.itemSectionRenderer?.contents.forEach(x => { 
      if(x.videoRenderer) videoData.push(x.videoRenderer);
    })
  );
  return videoData;
}

let results = await freeYoutubeApiCall('rick roll');
results;
results.map(x => x.videoId);
```
Laravel Query nested JSON Column without case sensitivity
Tags: laravel, php, sql, database
Published: 2022-10-21 18:34:22

Have you ever tried running a search in a nested JSON column inside a database with laravel where() method and it didn't work the way you expected it to due to case sensitivity(Example 1).

<b>Example 1.</b>
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/696hcw98y8kdxmv6v5lv.png)


But Same query works when the case match(Example 2)

<b>Example 2</b>
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/t1tvja5x3lgwjd0rnh8p.png)

To overcome this challenge I came up with this modification which allowed searching with whatever case return matching results(Example 3 and 4).

<b>Example 3</b>
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6d14hhhsckhqkiyeam1r.png)


<b>Example 4</b>
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/yb1rvc7snyv4tlkqvpzz.png)


Hope this helps anyone who might face this challenge. Please Let me know if there are better ways to achieve this. Your contributions and criticism are welcome. Thank you for reading this far..... and just in case you need a package to handle the query for you in a laravel project then you can just run

```composer require boadusamuel/search-nested-json-column```

or read on the package at [boadusamuel/search-nested-json-column](https://packagist.org/packages/boadusamuel/search-nested-json-column)
Back-To-CP: day 10
Published: 2022-10-21 18:07:39

21-10-2022

[Longest Substring Without Repeating Characters](https://leetcode.com/problems/longest-substring-without-repeating-characters)

The problem is quite simple if applied brute force, but the time complexity will be O(n^3). So, the good approach is sliding window. Where we keep two pointers at the beginning and a map to store the frequency of the characters in the array. Right pointer keeps moving forward if doesn't encounter the same character twice. If encountered, left pointer will start from the Right pointer position now. This is achieved by in the frequency map, instead of the actual frequency, the position of right pointer is stored. This allows left to jump directly to right + 1.

```
class Solution {
public:
    int lengthOfLongestSubstring(string s) {
        int n = s.length();
        int ans = 0;
        map<char, int> hmap;
        int left = 0, right = 0;
        while(right<n){
            if(hmap[s[right]] > 0){
                left = max(hmap[s[right]], left);
            }
            ans = max(ans, right-left + 1);
            hmap[s[right]] = right + 1;
            right++;
        }
        return ans;
    }
};
```
What the future of project management looks like?
Tags: projects, management, agile
Published: 2022-10-21 18:07:24

The future of project management is looking very bright.

With the advent of new technologies, project management is evolving at a rapid pace.

In the past, project management was often seen as a tedious and time-consuming process.

However, with the help of new tools and techniques, project managers are now able to complete projects more efficiently and effectively.

One of the most important trends in project management is the move towards more agile methods.

Agile project management is a methodology that focuses on delivering value to the customer through short, iterative cycles.

This approach is very beneficial for projects that are constantly changing and evolving.

Another trend that is having a major impact on project management is the rise of cloud computing.

Cloud computing allows project managers to access their project management tools and applications from anywhere in the world. This is a very convenient way to manage projects and is also very cost-effective.

Big data is another area that is having a major impact on project management.

With the help of big data, project managers are able to make better decisions and improve the overall efficiency of their projects.

Overall, the future of project management is looking very bright. With the help of new technologies, project managers are now able to manage projects more effectively and efficiently.
Difference between Software Developer and Software Engineer
Tags: python, engineer, develope
Published: 2022-10-21 17:55:41

There are many differences between software engineers and software developers.

The most obvious difference is that software engineers usually have a college degree, while software developers may or may not have a college degree.

Software engineers typically have a more formal approach to problem-solving and are more likely to use IDEs and other tools to help them write code.

On the other hand, software developers are often more comfortable working in text editors and using the command line.

Software engineers are usually more focused on the big picture, and they often work with architects and other engineers to make sure that the code they write is maintainable and scalable.

On the other hand, software developers are often more focused on writing code that meets the specific requirements of the project they are working on.

The bottom line is that both software engineers and software developers are important members of the software development team, and both play a vital role in the success of a project.
"Boreout", being sick of not improving.
Tags: productivity, beginners
Published: 2022-10-21 17:51:24

In recent times, it has become more and more common to hear about "Burnout" syndrome. Especially in the tech industry, we see a lot of already experienced developers that are exhausted, and already out of their limits when it comes to working.

And we also see a lot of solutions for this type of situation, people are already all over it and fighting this problem.

But, what about when the situation is the complete opposite? 

I'm a beginner software developer with nearly one and a half years in the field, and I've constantly faced what I like to call the "Boreout" syndrome. 

I feel that being a beginner, I have a lot of energy to spend, and think like a newborn child, it needs to be in constant movement, it is a completely blank paper ready to absorb experiences from other people and other things. 

Speaking in "tech terms", it is fundamental to spend this useful energy from a beginner when it comes to solving problems and building new things. And I feel that companies often miss this point.

At least for me, this lack of internal motivation at work and just having to do boring things that don't make me feel that I'm going forward drives me into a very uncomfortable state. I'm feeling exhausted, doing less...

There is this constant feeling that I'm losing the "Good times" which is exactly when you are just starting at something, being stuck in places that don't actually will help you improve, and then, time passes and you are still just a junior when you should be ready to evolve to more senior roles. 

I've always wanted to know what exactly could be the solutions for this type of situation, how we use 100% of our potential as beginners, and make sure that we get prepared for more challenging tasks in the future when they come.
You will not find better materials, for learning programming.
Tags: learn, beginners, tutorial, productivity
Published: 2022-10-21 17:47:26


In my programming adventure I found many tutorials, documentation and learning materials, but only a small part was really useful for learning. Maybe my old collection will help someone.

**Design patterns** (An ultra-simplified explanation to design patterns)
https://github.com/kamranahmedse/design-patterns-for-humans

Everything in one place with detailed descriptions. 

**SOLID & Data Structures** (An ultra-simplified explanation to design patterns)
https://okso.app/showcase

Step by step amazing explanation of design patterns. 

**Learning map** (Guides and other educational content to help guide the developers in picking up the path and guide their learnings.)
https://roadmap.sh/

Just like in a computer game, when you want to achieve a new goal and have a new level to gain access to carry a new sword. It's the same with all passions, but it's hard to learn this way.

For me, the roadmap.sh is the tool that brings me this view to learn. I can see where I am and where I want to go.

**Coding Patterns**
https://levelup.gitconnected.com/dont-just-leetcode-follow-the-coding-patterns-instead-4beb6a197fdb
Why & When to Use Node.js
Tags: node, webdev, tutorial, beginners
Published: 2022-10-21 17:16:44


<h2>What Is Node.js?</h2>

Node.js, a cross-platform accessible real-time interface (or integrated-functionalities) & toolkit, executes web programs independently of the customer’s browser.

It was first conceived in 2009 by Ryan Dahl. Dahl was unimpressed by the alternatives for creating web apps until uploading a document toolbar on Flickr – Consequently, making the design simple, & friendly. Hence, emerged.

At this moment, asking how to use Node JS is comprehensible. Server-side software primarily applies to non-blocking, outcome-driven platforms, including common websites & data access layer API programs. Node.js is built on Google Chrome’s Version#8 JS API and library, one of many that each website possesses.

<h2>Node.JS: Specific Features</h2>

Wondering about Node JS & when to use it? Simply, when the following functions are crucial.

All the Node.JS library’s APIs are concurrent, non-blocking, & in occurrence. Being based on the V8 JavaScript Engine in Chrome, the Node.js integrated functionalities execute code incredibly swiftly.

A Sequential-flow yet Massively Scalable! Node.JS employs a definitely handled paradigm, with identifiable occurrences repeating to reply in a non-blocking manner.
The host is very scalable because of its available data, which only allows a small variety of sequential flows to process requests.

Programs through Node.JS never cache any data. These programs only output the information in sections.
Node.js is distributed, so it is under an MIT license.

<h2>Why Use Node JS? Key Statistics</h2>

- The use of Node JS is popular in web apps. Almost 85% of web apps these days are developed through Node JS.
- The use cases for Node JS encompass e-commerce, fundraising, the Internet of Things, & merchant services.
- Loading times can be reduced by 50%–60% with Node JS.
- The cost of development is reduced by 58% while utilising Node JS.
- Node JS is cast-off by at least 30 million websites.
- Node JS is cast-off by between 1.4% & 2.2% of webpages globally, according to Node.JS Org.

Read more about <a href="https://docode.dev/when-to-use-node-js/">Node.js</a>
Lagoon: Free 3D model search engine
Published: 2022-10-21 17:43:00

Free 3D model search engine, designed for 3D printers. On Lagoon.io, you can find 3D models of kind. All files are in STL format, and are able to be sliced and 3D printed. We are currently sourcing our models from Thingiverse and related sites, but want to expand further to user uploaded content. Lagoon.io includes an optional 3D printing service where we 3D print the items for you, and handle all the logistics.

https://lagoon.io
Getting Started on Elixir and Ecto Part 3
Tags: elixir, database, webdev, codenewbie
Published: 2022-10-21 17:34:41

## Schema, Changeset and Data types

At this point, you might start to wonder why you are doing essentially the same thing twice when dealing with _Schema and Changeset_.

> While migrations are liable for giving us the database tables, schemas are liable for how Ecto interacts with those tables.

_A schema is an Elixir declaration of data from our database._ Besides working as **data mappers, embedded_schema/1 and schema/2** can also be used together to decouple how the data is represented in your applications from the database.

**schema/2** is typically used to map data from a persisted source, usually a database table, into Elixir structs and vice-versa.

**embedded_schema/1** is used for defining schemas that are embedded in other schemas or only exist in memory without ever persisting elsewhere.

**Changesets** define a pipeline of transformations our data needs to undergo before it will be ready for our application to use. These transformations might include type-casting, user input validation, and filtering out any extraneous parameters.

> NOTE: You can actually use an embedded schema to depict your UI, mapping and validating its inputs, and then you convert such embedded schema to other schemas that can persist data to the database.

{% embed https://gist.github.com/itskenzylimon/1e590680aa320d226afec4566df1d317 %}

> **NOTE:** The naming convention in Ecto for schemas is a singularized name.

```
ECTO TYPE  -> ELIXIR TYPE  -> LITERAL SYNTAX IN QUERY

:id -> integer  { 1, 2, ...}
:binary_id -> binary  { <<int, int, ...>> }
:integer -> integer  { 1, 2, ...}
:float -> float  { 1.0, 2.0, ... }
:boolean -> boolean  { true, false }
:string -> UTF-8 encoded string  { "hello" }
:binary -> binary { int, int, ... }
{:array, inner_type} -> list { [value, value, ...] }
:map -> map
{:map, inner_type} -> map
:decimal -> Decimal
:date -> Date
:time -> Time
:time_usec -> Time
:naive_datetime -> NaiveDateTime
:naive_datetime_usec -> NaiveDateTime
:utc_datetime -> DateTime
:utc_datetime_usec -> DateTime
```

You can easily play around with schema by simply starting an IEx iex -S mix

```
task = %Taskers.Task{}

We can set values on these fields by generating a new struct:
task = %Taskers.Task{estimated_time: 28}
task = %{task | estimated_time: 3.0}

And retrieve values using this syntax:
task.estimated_time # => 3.0
```
Flutter Youtube List With PHP & MySql
Tags: flutter, dart, mysql, android
Published: 2022-10-21 17:20:01

While working on a project, I came across the need to create a dynamic Youtube list of videos using the youtube_player_flutter package.

So here is how I went about developing the code.

To start with, I create a new flutter project. Then I opened up my PHPMyAdmin to start creating tables for storing the dynamic data that will be shown to the user.

```
Create A SQL Table
CREATE TABLE `videosapp` ( `youtubeid` varchar(100) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; ALTER TABLE videosapp ADD PRIMARY KEY (youtubeid); COMMIT;
```

2. Create the PHP file to provide the JSON data from the PHPMyAdmin database.

Connect to the phpmyadmin.

```
static $DB_SERVER=””;

static $DB_NAME=””;

static $USERNAME=””;

static $PASSWORD=””;
```

Fetch the data and convert it into JSON format.

```
while($row=$result->fetch_array()) {

array_push($spacecrafts, array(“youtubeid”=>$row[‘youtubeid’])); }

print(json_encode(array_reverse($spacecrafts)));
```

4. The final step is to parse the value in the Flutter application.

Use a ListView Builder to create a widget that will create a list from the Youtube Id’s retrieved from the PHP file in JSON Format.

```
ListView.builder( itemCount: widget.spacecrafts.length, itemBuilder: (context, int currentIndex) {

return createViewItem(widget.spacecrafts[currentIndex], context); },
```

Create a List from the Youtube controller by providing the Youtube Id’s from the database to the Youtube Player Controller intialVideoId.

```
final List<YoutubePlayerController> _controllers = [spacecraft.youtubeid] .map<YoutubePlayerController>( (videoId) =>

YoutubePlayerController(

initialVideoId: videoId,

flags: YoutubePlayerFlags( autoPlay: false, ), ), ) .toList();
```

Create a Future Builder and retrieve the snapshot data and show it onto the screen. You can also use Firebase or any other backend service to display the list of videos by using StreamBuilder.

You can find the Full Source Code of the project here.
{% embed https://github.com/stevie1mat/Flutter-Youtube-List-With-PHP-MySql %}
Hacktoberfest Week 3
Tags: hacktoberfest, opensource, javascript, github
Published: 2022-10-21 17:03:48

Week three was interesting so say the least. It was simply because I misunderstood what the proper objective was. But after clarification from the Authors of the repository, it was all good.

**About the Repo**
It is a Certificate Generator which you can use to make e-certificate and download as a pdf and then you can distribute the certificates to the students.

**Contributions**
[Issue](https://github.com/vedant-jain03/certificate-generator/issues/7)
[Pull Request](https://github.com/vedant-jain03/certificate-generator/pull/19)
For this contribution, I have created 5 separate templates as per requested, though at first I only added the photo's because I misunderstood what the author wanted me to do. After them explaining, I then understood what the true expectations were.

So I started of by creating more case's to be selected from within the JavaScript XML file. Each one representing each template. Then I had to somehow make the template show up on the sidebar which was just creating the divisions with the photos embedded inside. Though that was after I was requested to change the file again. There was a lot of talking between me and the authors of that app.

After all said and done, It was merely fixing the template itself and minor bugs that was just a couple typos.

**Thoughts**
There were a lot of misunderstandings that needed to be cleared up, but otherwise it worked out at the end. This was my first time using a `.jsx` file, as well as creating cases within the file itself. Formatting the template was also pretty fun, though a bit challenging, since I wasn't sure at first how it worked

[Full Repository](https://github.com/vedant-jain03/certificate-generator)
Make Notion tables easier to read
Tags: notion, tampermonkey, css, design
Published: 2022-10-21 16:41:27

Install [Tampermonkey](https://chrome.google.com/webstore/detail/tampermonkey/dhdgffkkebhmkfjojejmpbldmpobfkfo) and apply [my UserScript](https://gist.github.com/hioki/09afa99b7f01b6db2c1e7e629d001cc4).

Then, for example, the following

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

will be changed to the following.

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