teleren/devto huggingface dataset:
Using Binary Search Tree and Trie data structures to store and retrieve a Movie Catalogue
Tags: python, algorithms
Published: 2022-01-27 19:25:17

I created this code to have a go at data structure and algorithms on Python after taking the data structure & algorithms module in Codecademy.  

> GitHub link to code: https://github.com/guachilimbo/movie_recommendation

## Data Structures Used
The program uses a database of the top 250 movies on IMDb which I found in Kaggle (https://www.kaggle.com/ramjasmaurya/top-250s-in-imdb)

It stores this information in two different data structures: A Binary Search Tree, and a Trie. 

### Binary Search Tree
When the data base is read, each movie entry is stored as a Binary Search Tree (BST). The tree is sorted alphabetically depending on the title of each movie. This allows for quick storage and retrieval with a running time performance of `O(logN)`, where N is the number of levels in the tree.

However, in order to implement an autocomplete functionality, I thought this was not a good data structure, since for a given prefix `(str)` of length M, the runtime to find all the movies that match the string will be `O(MlogN)`. 

This is why as the data was read from the database, a `Trie()` structure containing the titles of each movie is created. 

### Trie
There are M + 1 `Trie()` classes created in this program, where M is the number of unique genres detected in the database. This allows to apply the autocomplete function to all the catalogue, or just the movies within an user chosen genre. 

The nice thing about applying the autocomplete function, which searches all movies that start with a prefix input by the user, to a Trie is that search complexities are brought to optimal limit, this is, the prefix length. 


## Program Execution:
1. Download folder and run `python main.py` on the command line.  
  ![First step of running the program.](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/l91rc2qie5cius42pl9l.png)
2. The program will ask for choice between two running modes:

    a) **Genre search**: The program will display the genres found in the data base. The user will then choose one of the genres. The films that belong to this category will be displayed. The user will then be asked to enter part of the title of one of those films and a autocomplete method will be invoked on that string. 
  ![Genre choice](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/lkz6vebafj44qgerglao.gif) 

    b) **General search**: The user will be asked to input the beginning of a movie title and the autocomplete method will be called on that string. 
  ![Autocomplete function](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/60bdtskk4vaoj9eempx1.gif)

3. If a match is found, the movie's Title, Year, Genre and Duration will be displayed alongside the option to display a description of the movie. 
  ![Movie card display](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/oxwg2wox8g5ilulayhmt.gif)

4. Perform another search or exit the program.

---

Please any suggestions or improvements are greatly appreciated since this is my first time dealing with data structures and algorithms!
Hello World in different languages!
Tags: github, programming, opensource, challenge
Published: 2022-01-27 19:24:11

## What is the Hello World challenge?
The Hello World challenge / project is a challenge for all programmers! In the challenge, we are trying to add hello world codes in **MANY** programming languages, the codes are in the [GitHub Repository](https://github.com/InvalidLenni/hello-world).

 
### How can I add a new hello-world code?

1. Fork the [hello-world repository](https://github.com/InvalidLenni/hello-world/fork/) to your own GitHub Profile / Account.
2. Create a new folder with the name of the programming language.
3. Create in the new folder a code file called "helloworld.X" (X = file extension), the files need contains the hello world code.
3. Open a Pull request for merging into the [Hello World repository](https://github.com/InvalidLenni/hello-world).
4. Request a review from [InvalidLenni](https://github.com/InvalidLenni/).
Builder design pattern — java
Tags: tutorial, programming, java, designpattern
Published: 2022-01-27 19:20:11


![design-pattern](https://cdn-images-1.medium.com/max/2000/1*cpmqYomwpJ_fAZ_p_sxGNQ.jpeg)

## Definition of Builder Pattern
>  The builder pattern is a design pattern that allows for the step-by-step creation of complex objects using the correct sequence of actions. The construction is controlled by a director object that only needs to know the type of object it is to create.

## Where to use the builder pattern?

When you have a simple object, this pattern is not very useful, but when you begin to have a more complex object and want to have a clear code you can use it without hesitation

For example :
{% gist https://gist.github.com/ErwanLT/32275e44cafb8632a6542b91e33c0847.js %}
A constructor with a limited number of parameters won’t be something that will make your code unreadable.
But what if now you have something like this :
{% gist https://gist.github.com/ErwanLT/5fac9ce409f9f7b2764ddbdb3a30bf68.js %}
The number of parameters to pass to the constructor will make the line of code unreadable.
Yes, you can still use the setter to change the value of a property after you have initialized your object. But what if all your fields are [final ](https://javarevisited.blogspot.com/2016/09/21-java-final-modifier-keyword-interview-questions-answers.html)because you want to render them [immutable](https://medium.com/javarevisited/how-to-create-an-immutable-list-list-and-map-in-java-5ac1254c128?source=---------31------------------)? (What they will be in the rest of this article) Or what if some fields are mandatory and others don’t?

## Implementation of the builder pattern
{% gist https://gist.github.com/ErwanLT/5af2a3a7e44bfe8a30c1b90c1f2a33ac.js %}
I have used Lombok to not code the getter and the [default constructor](https://javarevisited.blogspot.com/2014/01/why-default-or-no-argument-constructor-java-class.html) because the [builder pattern](http://javarevisited.blogspot.sg/2012/06/builder-design-pattern-in-java-example.html) doubles the number of lines of code.
So this is the implementation of my HumanBuilder, now how can I declare a Human with it? Nothing difficult you will see (or should I say read ?).
{% gist https://gist.github.com/ErwanLT/326c794247e46726d38e01ce66b89188.js %}
That will give this output

    Human{
      name='Erwan', 
      lastName='null', 
      age=30, 
      height='null', 
      weight='null', 
      eyesColor='null', 
      hairColor='null', 
      birthPlace='Saint Cyr l'Ecole', 
      birthDate=null, 
      numberOfSibling=2, 
      married=true
    }

As you can see, I can choose the number of parameters to initialize and their order.
Variable font animation - change axis on mouse move
Tags: codepen, fonts, webdev, animation
Published: 2022-01-27 19:19:37

**Variable font animation** on **CodePen**: change the value of the axis on mouse move.

The value of the **weight axis** (font-weight) and **width axis** (font-stretch) get updated depending on the position of the mouse on the screen. 

{% codepen https://codepen.io/danieledesantis/pen/WNXvQOb %}
Cherry-picking done easy
Published: 2022-01-27 19:05:06

Have you ever needed to cherry-pick several commits between two branches, but ran into conflicts every time? I made this mistake myself – but cherry-picking doesn’t have to be hard.

As you work on more features and fix more issues, some might not be released immediately. When moving code between environments, you may need to move specific changes over, even if they live alongside other things that you’ve written. This is where cherry-picking comes into play, and if you’ve ever worked in any type of git-flow, you’ve probably come across it.

## Strategies to the rescue

Merge strategies allow you to define how to apply commits from one branch to another. By default, the cherry-pick strategy is [recursive](https://git-scm.com/docs/git-merge#Documentation/git-merge.txt-recursive). Depending on what base branch you’re working off of, you’ll want to use the correct merge strategy for specifying what changes to use: this is where `-X=theirs` and `-X=ours` do us favors.

## Performing the cherry-pick

The cherry-pick command is simple:

`git cherry-pick --strategy=recursive -X=theirs hash0 hash1 hash2`

You’re able to specify the strategy, the per-strategy option (theirs/ours), and the sequence of hashes (commits) to merge.

> What is the difference between _theirs_ and _ours_?

This option will specify which version of code to prefer in a merge. If you’re on the main branch and moving commits from develop, you’ll want to use _theirs_, as you are saying “let’s take develop’s (their) changes”.

**What you’ll need:**

- A base and target branch (develop/main)
- The commit hashes to cherry-pick (e.g. `7f7a499`)
- Choosing the right strategy based on what you want to achieve (ours/theirs)

For example, to merge a sequence of commits from a development branch into main:

1. Check out the main branch with `git checkout main`.
2. Using the cherry-pick command from above, we will merge several develop commits to our main branch, moving the develop changes onto main. You can specify the hashes individually, or you can cherry-pick a sequence of hashes by writing `hash0...hash1`.
3. If conflicts come up, you’ll be able to resolve them on a per-commit basis and commit the result to continue with your cherry-picking.

Although simple, learning this has turned large merge requests that affected over 40 files (including deletions, renames, and refactors) into a pain-free experience instead of a major ordeal. Something that would’ve taken me several hours with the potential of missing code only took an hour, and shortly thereafter, I was able to move on to working on my next task.

This isn’t all that cherry-pick has to offer, and there are flags for you to provide based on your use case. If you need something beyond this or if you want to read a little bit about how cherry-picks are done, the [Git docs](https://git-scm.com/docs/git-cherry-pick) do a great job of explaining this concept.
Start Your Coding Career In 2022 - Top 8 Programming Languages
Tags: programming, career, beginners, codenewbie
Published: 2022-01-27 18:58:30

## 1. JavaScript

**Level:** Beginner to Intermediate

**Platform:** Cross-platform (Desktop, Mobile, Web)

**Benefits:**

- Easy to learn and implement
- Used everywhere on the web
- Can run immediately within the client-side browser
- Reduces the demand on the website server

**Uses:** Widely used; highly applicable

---

## 2. Python

**Level:** It enables a beginner to become productive quickly

**Platform:** Web, Desktop

**Benefits:**

- Flexible
- Naturally/Intuitively readable
- Highly regarded official tutorials and documentation
- Scripted as opposed to compiled

**Uses:** Popular in both technical education and business use

---

## 3. Go

**Level:** Beginner to Intermediate

**Platform:** Cross-platform, mainly desktop

**Benefits:**

- Widely considered a “minimalist” language
- Easy to learn
- Transparent code
- Compatible and Fast

**Uses:**

- Widely used; highly applicable

---

## 4. Java

**Level:** Intermediate

**Platform:** Web, Mobile, Desktop

**Benefits:**

- Regarded as a good start for learning to think like a programmer and gain coding skills
- You’ll be able to access/manipulate the most important computer functions.

**Uses:**

- Widely used, highly applicable

---

## 5. Kotlin

**Level:** Intermediate to advance

**Platform:** Web, Mobile, Desktop, Server

**Benefits:**

- Less code-heavy than Java and other languages
- Relatively easy to adopt
- Fully compatible with Java

**Uses:**

- Widely used; highly applicable

---

## 6. PHP

**Level:** Beginner to Intermediate

**Platform:** Cross-platform (Desktop, Mobile, Web)

**Benefits:**

- Open-source
- Easy to develop
- Cost effective
- Flexible with database connectivity

**Uses:**

- While it’s used by the vast majority of websites

---

## 7. Swift

**Level:** Beginner to Intermediate

**Platform:** Mobile (Apple iOS app)

**Benefits:**

- Relatively easy to learn
- Clean syntax
- Less code and Open Source
- Faster than comparable programming languages

**Uses:**

- Used extensively for creating iOS apps

---

## 8. Ruby

**Level:** Beginner

**Platform:** Web

**Benefits:**

- Flexible
- The syntax is considered easy to read and write (no specialized “vocabulary” to get started)
- Enforces good programming style

**Uses:**

- Least broadly used

Which programming language are you using currently. Comment the programming language which you want to add to this list.

---

### Let's connect 💜

You can follow me on [Twitter](https://twitter.com/MrDanishSaleem) & [GitHub](https://github.com/mrdanishsaleem/)

If you like this post. Kindly support me by [Buying Me a Coffee](https://www.buymeacoffee.com/mrdanishsaleem)

![Buy Me a Coffee](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/fefzbxbnwww7tkght33w.png)
Whats new in Chrome 98 DevTools
Tags: webdev, beginners, productivity, news
Published: 2022-01-27 18:20:47

Hey everyone,

i just wanted to share this from the Google Chrome dev team:

{% youtube YqkIS88VulM %}

### Topics

* Full-page accessibility tree
* Changes tab
* Timeout settings in the Recorder panel
* Back/Forward cache tab
* New Properties pane filter
* 'row-reverse' and 'column-reverse' buttons in the Flexbox editor
* Emulate CSS forced-colors media feature
* Bonus tip: document.designMode


Hope that could help you!


🔷 I also published posts on my [blog](https://www.harun-sevinc.com) 🏠
🔷 If you liked it you may follow me on [twitter](https://twitter.com/harsvnc) 📣
Why won't my XFCE4 log-in script work?
Tags: xfce, archlinux, help
Published: 2022-01-27 17:55:48

Why doesn't my XFCE4 log-in script work?
To my knowledge, everything seems set-up correct.

![Me showing the log-in script.](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/fk7sbryc84p2p3tdr9dk.png)

This is the actual script located in `~/Misc/CalinsStartUtils`:
```bash
# Calin's start-up utilities.



# Remove recently used.
rm ~/.local/share/recently-used.xbel


# Clean trash.
rm -rf ~/.local/share/Trash/expunged
rm -rf ~/.local/share/Trash/info

rm ~/.local/share/gvfs-metadata/*.log


# Clear cache.
rm -rf ~/.cache/thumbnails/*/*
rm -rf ~/.cache/sessions/*
truncate -s 0 ~/.bash_history


# Connect to wifi.
iwctl station wlan0 scan
iwctl station wlan0 connect $HOME_WIFI
```



<center><h1><b>Thanks!<br/>Cheers!</b></h1></center>
Javascript, the duct tape that holds the frontend together

Published: 2022-01-27 17:47:56

Javascript, the duct tape that holds the frontend together? 

I say, no!

JavaScript is not just a duck tape that binds the front end haphazardly. Javascript is taking over the world and beyond.
JavaScript is even used to support a modern touchscreen-based UI for the Space-X Dragon spacecraft.

JavaScript is like gravity - a force that keeps the Universe in a certain order.
🚀 Initializer for Laravel – Jumpstart your next project
Tags: laravel, webdev, php, docker
Published: 2022-01-27 17:28:16

Creating a new Laravel application can be as easy as running:

```shell
curl -s https://laravel.build/my-new-laravel-application | bash
```

This does a lot of the heavy lifting for you, but chances are that you have your _own_ preferences and standards. Maybe you always work with PostgreSQL instead of the default MySQL or you would like to utilize one of the application starter kits, rather than rolling your own authentication implementation. Then you need to repeat all of these steps every time you start a new project: installing composer packages, adjusting `.env` files and running a bunch of `php artisan my-package:install` commands.

To automate all of this setup, I created [laravel.initializer.dev](https://laravel.initializer.dev). It presents you with all of the first-party and related packages and their options, so you can pick and choose your favorite Laravel components. Once you're done, just hit the red generate button and a ZIP file will be generated containing your project. If you want to re-use the configuration to generate projects in the future, just click the "Share" button, to generate a link to your configuration.

Now all thats left is unpacking the archive, `cd`ing into the project directory, and finally running 

```shell
./initialize
```

in your terminal. Have a fresh cup of coffee/tea, while `initialize` scaffolds out your project, installs all the necessary components, builds your frontend bundles and migrates your database. 

Did you chose Postgres as your database? The `config/database.php`, `.env.template` and `.env` files are adjusted accordingly. 

Did you chose Horizon to monitor your Redis queues and Mailhog to test your emails locally? There already is a helpful table inside the generated `readme.md`, which lists the paths to all these local development tools for your setup.

Did you include Pest for your tests and Breeze or Jetstream as a starter kit? Of course all the necessary options were passed during the installation, so all your tests already use Pest.

If you are interested to take a look behind the scenes, the projects code is [freely available on GitHub](https://github.com/NiclasvanEyk/initializer-for-laravel). Feel free to create an issue if you can think of any improvements! (though keep in mind that the project is scoped to first-party Laravel packages atm. Otherwise all of the Spatie packages would take up the whole page)
Why Gutenberg is killing Wordpress
Tags: wordpress, gutenberg, badcoding
Published: 2022-01-27 17:11:53

- most formatting is based on `style` attribute which destroys website presentation style consistency
- there is no easy way to customize editor toolbar and inspector
- it is impossible to add more than one class to a custom toolbar button

Now think how all of those hardcoded colors and font sizes in pages content match up with accessibility when you allow visitors to switch to alternative hi-contrast stylesheet or to resize website font with a button. And what about implementing inline Bootstrap button link that needs at least two classes? Forget about it.

You can easily avoid all of the problems above with TinyMCE but with Gutenberg it is now **impossible by the design**. 

Every WYSWIG editor that uses anything else for formatting than predefined tags and `class` attributes is not modern but obsolete because it is based on bad coding paradigms that should be avoided to keep website [Kosher](https://dev.to/ordigital/the-kosher-rule-of-www-3bl0).
Managing individual’s expectations
Tags: leadership, management
Published: 2022-01-26 19:23:54

---
title: Managing individual’s expectations
published: true
description: Reflections on managing team members expectations.
tags: leadership, management
//cover_image: https://direct_url_to_image.jpg
---

> You can’t always get what you want. But if you try sometime you just might find. You get what you need.

Managing teams of high skilled software engineers can be challenging. Particularly when their expectations are not met
 
Sometimes it feels like a zero sum game. They can’t all get what they want all the time. Finding alignment, or even compromises, is tedious work at the best of times

The real problem arises when individuals can’t get past their views and ideas not being chosen and adopted. Now we are in dangerous territory.

Everybody’s voices must be heard. And their concerns addressed. But beyond that, we must be able to commit and move on.

So what are we to do when an individual digs it’s heels, or continuously re litigates decisions.

Mentoring and coaching should be the first tools we reach out for. Helping these individuals grow and become better engineers.

If our efforts don’t bring a satisfactory outcome, then we must coach the individual to a role better suited to its skills and interests.

It’s hard work. Emotionally taxing. And never pleasant. But is the role I’ve chosen.

Godspeed
What is rust?. Rust tutorial:1
Tags: rust, programming, tutorial, beginners
Published: 2022-01-27 17:01:22

Rust is a modern systems programming language. It is intended to be a language for highly concurrent and highly secure systems. It compiles to native code; hence, it is blazingly fast like C and C++.Rust is used where performance is absolutely critical. This tutorial adopts a simple and practical approach to describe the concepts of Rust programming.

Before starting you need to install rust,You can install it officially from [Rustlang](https://www.rust-lang.org/tools/install).
Notes:
Performance
Rust programming language does not have a Garbage Collector (GC) by design. This improves the performance at runtime.

Memory safety at compile time
Software built using Rust is safe from memory issues like dangling pointers, buffer overruns and memory leaks.

Multi-threaded applications
Rust’s ownership and memory safety rules provide concurrency without data races.

Support for Web Assembly (WASM)
Web Assembly helps to execute high computation intensive algorithms in the browser, on embedded devices, or anywhere else. It runs at the speed of native code. Rust can be compiled to Web Assembly for fast, reliable execution.

*Create a Rust App :*
Rust uses a package manager called cargo,run `cargo new rust_app` from the terminal to create a new rust app.
Inside that folder you can see a source folder `src` inside that you can see the main.rs file.
That is where your main code starts executing.
function is defined by `fn` keyword
`println!()` prints the given value.
Run the rust code with `rustc main.rs`
and voila you created a highly efficient executable !
_That's it for today,See you soon in another rust blog_
[Buy me a coffee](https://www.buymeacoffee.com/tawhid)
Note on TiWorker.exe
Published: 2022-01-27 16:59:47

`TiWorker.exe` is an essential process for Windows Update Service. It starts at Windows startup every the computer is switched on.

It is one the reasons for PC memory and CPU resources get consumed a  lot sometimes.

Resources:
1. https://docs.microsoft.com/en-us/windows/deployment/update/windows-update-resources