teleren/devto huggingface dataset:
ViewModel runtime dependencies or not?
Tags: android, hilt
Published: 2022-03-17 07:04:04

We all know ViewModel is build to hold ui state and survive configuration change, so by this given it should retrieve the data needed to create ui state as soon as possible, most of the time that mean when you initialize it, what if you need to pass an id to that ViewModel like postId or articleId, when you use hilt the dependencies of the Viewmodel must be known at compile time if you want Hilt to inject them without any effort, what happen if you want to pass runtime dependencies,
the solution:
first: create @AssistedFactory Annotated Interface

```kotlin
@AssistedFactory
interface UserViewModelAssistedFactory {
    fun create(name: String): UserViewModel
}
```

second: create factory class or object

```kotlin
class Factory(  
        private val assistedFactory: UserViewModelAssistedFactory,  
        private val name: String,  
    ) : ViewModelProvider.Factory {  
        override fun <T : ViewModel?> create(modelClass: Class<T>): T {  
            return assistedFactory.create(name) as T  
        }
    }
```

third: inject the factory in fragment and use it to create the viewModle

```kotlin
@Inject 
lateinit var assistedFactory: UserViewModelAssistedFactory  
private val userViewModel: UserViewModel by viewModels {  
    UserViewModel.Factory(assistedFactory, navArgs.name)  
}
``` 

this is so much right I felt the same.
it turns out that if your dependices is coming from Navigation argument you can use the provided by defualt SavedStateHandle to get that navArgs, it comes with this version,
```
implementation 'androidx.navigation:navigation-ui-ktx:2.4.1'
```
you can access navigation arguments through the saved state handle

```kotlin
@HiltViewModel
class RecentChatViewModel @Inject constructor(
    private val getRecentChatUseCase: GetRecentChatUseCase,
    savedStateHandle: SavedStateHandle
) : ViewModel() {
    private val accountId: Int = RecentChatFragmentArgs.
fromSavedStateHandle(savedStateHandle).accountId
```

be careful you will need to update your compile sdk to 31 if 
you are not.
it is simple right why I had to search so much me and my friend Elfiky to reach out this simple solution.
[I copied some code from this article because I am lazy](https://carrion.dev/en/posts/hilt-inject-parameters-runtime/)
Software Engineers have this advantage in Machine Learning over everyone else
Tags: machinelearning, datascience, python
Published: 2022-03-17 06:57:27


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

_Machine Learning is 80% software engineering._

## How I distribute my project time

1. Write efficient queries to get data from multiple sources + data analysis - _30%_

2. Do ML - _10%_ 

3. Model analysis - _10%_

4. Clean production-grade code + Package the application using Docker - _15%_

5. Create a whole pipeline on Airflow -  _15%_

6. Deployment in a service using Golang - _20%_


If you are a software engineer, you are probably better than a data scientist in 1,3,4,5 and 6.

## Some more good news

Tools like AutoML are automating a large part of step 2. Meaning there are two sustainable competencies people in ML can have

1. Become really good at reasoning, experiment design and stakeholder management.
2. Become really good at building infrastructure for ML.
If you think that the ML part, which only has 10%, makes it insignificant, you feel the opposite. After all, you are creating software for the ML model. 

## Wondering what the catch is?

If you think that the ML part, which only has 10%, makes it insignificant, you feel the opposite. After all, you are creating software for the ML model. 

Hence, the ML model needs to work damn well. And you have only 10% of the time to do so, which means that you need to have sharp intuition, clear goals and vision on what could work and what won't.

Consequently, it would help if you sharpened your sixth sense by reading books papers and catching up on conferences' latest research.


***

I am new to DEV. This is my first post.

Hi! I am Dhruvil; a chemical engineer turned ML engineer from India. I work with text and recommendations systems. If you liked what you just read, consider upvoting and sharing it.
Public APIs situation
Tags: opensource, github, webdev, programming
Published: 2022-03-17 06:52:05

[Public APIs](https://github.com/public-apis/public-apis) is an Open Source list of free and publicly available APIs with more than 1,400 entries from the personal side project to FAANG companies.

Created in 2015 by Todd Motto, the project quickly grew up as a reference for developers. In 2016 Todd asked the community if some people were interested in maintaining the repository. I was one of the few lucky people who joined the project. Todd migrated the project to a new organization and let us do our maintainer job.

Public APIs is now one of the most starred project on GitHub beside the React and Vue frameworks.

![](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/le5dp565diezfw4r900j.png)
 
One issue we've been having with the project is that we maintainers don't have access to the settings. That means we can't add maintainers, update the description or labels. We don't have access to the GitHub Organization at all.

I personally learnt [Todd was not the owner anymore](https://github.com/public-apis/public-apis/issues/1401) in 2020 as I was struggling with [the Hacktoberfest flow of incoming PRs](https://github.com/public-apis/public-apis/issues/1268). After finding a way to contact the owners they finally added some more motivated maintainers during March 2021 (that have been doing a great job since then - thanks a lot guys). They also upgraded our rights but none of us are still able to add maintainers.

Turned out the owners built a company about APIs, it's called APILayer.

In May 2021, **they replaced the GitHub description of the project to add links to their company.** A few times they tried to **push their own commercial APIs to the top of the list**, breaking the build (as we require alphabetically ordered links) and the guidelines as the point of the project is to list free APIs.

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

I reverted their changes and contacted them to explain the issue. I didn't have any answer from APILayer since then.

This Friday March 11th 2022 they once again broke the rules, by **removing a sponsor from the project and add their own logo plus link to their company**. I reverted it.

![](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/qodpgdtkgehxaiyok91o.png)
 
On Saturday March 12th 2022 they crossed the line by **downgrading our maintainers rights** without notice.

On Wednesday March 16th they removed the maintainers list from the readme and added one of their business API again.

It's now clear APILayer don't care about the project nor Open Source, their only goal is to take advantage of the large number of pageviews the project gets to redirect to their own company.

The team is still discussing what we should do to keep the project going. Please be careful with the project content now because we cannot ensure it's safe.

---

Other references :
- Matheus wrote about the situation [in the repo issues](https://github.com/public-apis/public-apis/issues/3104)
Virtual Private Servers, What are they?
Tags: vps, servers, tutorial, news
Published: 2022-03-17 06:39:58

MKComputing has just started offering Virtual Private Servers, but what are they? Well, the best way to explain it is a Operating System contained in a virtualised space. These isolated machines provides more security as your whole machine is isolated.

The question is, what’s the different between Shared Hosting and a VPS. Well, Shared Hosting only provides Static Website Hosting so you would only be able to upload .HTML or .PHP files but a VPS provides Root Level access to your Hosting, while letting you host Node Servers, Databases or just simply anything that runs on Linux can be hosted on your VPS.
CSS Position Property
Tags: css, beginners, webdev, html
Published: 2022-03-13 02:47:51

## What does this property do?
It determines how an element is positioned in the document.

## Some Clarifications
- *offset properties* refers to top/right/bottom/left properties
- an element's *natural position* / where an element would *naturally be* refers to the element without position property defined on it
- *positioned element* refers to an element with display set to anything other than static

## All CSS Position Values
- position:static; (default)
- position:relative;
- position:absolute;
- position:fixed;
- position:sticky;

## static
1. The default value.
2. Cannot use offset properties.

## relative
1. Allows use of offset properties.
2. The offset properties are based on where the element would naturally be.
3. The elements around it will treat this element as if it still sits in its natural position regardless if offset properties are used.

## absolute
1. Allows use of offset properties.
2. The offset properties are based on the closest non-static ancestor or the initial viewport. This means that if the body is scrollable the absolute element will not move with the viewport.
3. Elements around it will treat it as if it doesn't exit.

## fixed
1. Allows use of offset properties.
2. The offset properties are based on the viewport(not the initial viewport) or if any ancestor has transform, perspective or filter set to anything other than none.
3. Elements around it will treat it as if it doesn't exit.

## sticky
1. Allows use of offset properties.
2. The offset properties are based on nearest ancestor with overflow set to anything other than visible. If it cannot find one, it uses `<html>` or `<body>`, check using `document.scrollingElement`. Another way to think of offset values is it is the minimum gap between the element and the edge of the viewport while the container is in-frame.
3. The element is also constrained by its closest block level ancestor. i.e. it cannot leave that ancestor.
4. The elements around it will treat this element as if it still sits in its natural position regardless if offset properties are used.


## Summary
1. Positioned elements all allow the use of offset properties.
2. Elements around static, relative, sticky elements will treat them as if they are still in their natural positions.
3. Elements around absolute and fixed elements will treat them as if they don't exist.
Bilinen Protokollerin Port Numaraları
Tags: beginners, programming, computerscience, computer
Published: 2022-03-17 06:15:11


FTP           20 ve 21
HTTP          80
HTTPS         443
LDAP          389
SNMP          161
SSH           22
Telnet        23
SMTP          25
DNS           53
DHCP server   67
DHCP client   68
POP           110
NTP           123
ARPA          42
SFTP    115
Golang — Send Push notifications to apps using FCM
Tags: webdev, go
Published: 2022-03-17 06:02:29

We become more excited on seeing our screen blinking with alerts like above.

Ever think about how it reaches your mobile? Push notification is behind the scene.

When we heard the word push notification for the first time, we must have a thought that how can our mobile be recognized by someone so that they can notify us.

In this blog, we will explore [how push notifications are sent using Golang and Firebase](https://blog.canopas.com/golang-send-firebase-push-notifications-to-apps-45bc83d7cabf).
Harbor Registry Kurulumu on Ubuntu20LTS
Tags: kubernetes, harbor, helm, docker
Published: 2022-03-17 05:49:37

**Harbor**: Open source cloud native registry projesidir.
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/befk6imizzkbht2gqau4.png)
 
Biz direk **ubuntu** üzerinde **docker container**‘ler olarak kurulumu başlatacağız.

**Docker** kurulumuna başlamadan **bridge0**‘yu özelleştirebilirsiniz.

```javascript
sudo mkdir /etc/docker

sudo vim /etc/docker/daemon.json


{
"bip": "192.168.81.1/24"
}
```

Docker kuralım,
```javascript
sudo apt install ca-certificates curl gnupg lsb-release -y

curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg

echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null

sudo apt update

sudo apt install docker-ce docker-ce-cli containerd.io -y
```

Docker Compose kuralım,
```javascript
sudo curl -L "https://github.com/docker/compose/releases/download/1.29.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose

sudo chmod +x /usr/local/bin/docker-compose

sudo ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose

sudo usermod -aG docker $USER
```

Kurulum yapacağımız **harbor** versiyonunu indirelim,
```javascript
wget https://github.com/goharbor/harbor/releases/download/v2.4.1/harbor-offline-installer-v2.4.1.tgz

tar xzf harbor-offline-installer-v2.4.1.tgz

cd harbor/

cp harbor.yml.tmpl harbor.yml
```

**Harbor** kurulum öncesi kopyaladığmız “**harbor.yml**” dosyası üzerinde bir takım değişiklikler yapmanız gerekli, bu değişiklikleri ortamınıza uygun şekilde yapmanız gerekir,
```javascript
vim harbor.yml

hostname: harbor.fatlan.com
http:
  port: 80
https:
  port: 443
  certificate: /home/fatlan/ssl/fatlancom.crt
  private_key: /home/fatlan/ssl/fatlancom.key
harbor_admin_password: Harbor12345
database:
  password: root123
data_volume: /data
```

Son olarak **harbor** kurulum **script**‘imizi başlatalım.
```javascript
./install.sh
```

Akabinde başarılı olan kurulumumuz sonrası **ui** aracılığıyla da **login** olduğumuz **registry‘imizi** **cli** ile test edelim.

**Docker image** testi,
```javascript
docker tag weaveworks/scope harbor.fatlan.com/library/weaveworks-scope

docker login https://harbor.fatlan.com

docker push harbor.fatlan.com/library/weaveworks-scope

docker pull harbor.fatlan.com/library/weaveworks-scope
```

Helm Chart testi,
```javascript
helm create fatihcharts (after changed)

touch index.yaml

helm repo index . --url https://harbor.fatlan.com/mycharts

helm package fatihcharts {yada cd fatihcharts, helm package .}

helm registry login https://harbor.fatlan.com {export HELM_EXPERIMENTAL_OCI=1 gerekebilir}

helm push fatihcharts-0.1.0.tgz oci://harbor.fatlan.com/mycharts/

helm pull oci://harbor.fatlan.com/mycharts/fatihcharts
```
What is asyncio and why we need them ? - Python - write concurrent/asynchronous code using the async/await syntax
Tags: tutorial, python, beginners, codenewbie
Published: 2022-03-17 05:26:09

TL;DR - asyncio let's your write code which switches between different tasks while maintaining the state of each task to continue further
**Target Audience** - Beginner to mid-level
**Assumption** - This post assumes that you have some low-level knowledge programming in any language.
**Disclaimer** - The post is written with my limited personal knowledge and experience, there could be areas of improvement. Feel free to comment on them.

-
Let's begin!!

All the code you might have seen or written so far (if you're new to async) would be called **synchronize**, why? Because it runs the **lines of code one after the other** or in other words if you have two functions it could only run in a sequence.
What we'll do in this blog post is try to break this, difference languages use different methods of doing things. But for this we'll use `Python3.7+` and `asyncio`

Let's look at a real life example of this, 🎮📚
Assume you're studying for your semester exam, but you also have a gaming tournament coming up so you want to practice of it. So what you do? Learn for 8 hours and practice of 4 hours a day. You keep doing this till you complete your exam and the tournament.

This is the same we're trying to achieve with asynchronous programming through `asyncio` in Python.

Let's start off with the simple one,
```
def start_learning():
    print("I'm learning now")

def start_gaming():
    print("I'm playing Rainbow Siege")
```
You can easily run these function like below,
```
while True:
    start_learning()
    start_gaming()
```

Ouput:
```
I'm learning now
I'm playing Rainbow Siege
I'm learning now
I'm playing Rainbow Siege
I'm learning now
I'm playing Rainbow Siege
and so on....
```
Let's see how things look with asyncio
We want to run both at the same time and let the tasks decide when to switch. Let's say a chapter is easier to complete than others, then we can switch to gaming instead of waiting for the remaining hours to end.

```
async def start_learning():
    print("I'm learning now")
    # replace the below line with whatever the task that you want 
    # to perform
    await asyncio.sleep(8)

async def start_gaming():
    print("I'm playing Rainbow Siege")
    # replace the below line with whatever the task that you want 
    # to perform
    await asyncio.sleep(4)

async def main():
    await asyncio.gather(start_learning(), start_gaming())

asyncio.run(main())    
```

This is a pretty basic example some would need to understand asynchronous coding.
Feel free to drop in comments if you have questions on the code or if something can be improved.
Happy to learn!!


## Let's connect 🤝
#### [LinkedIn](https://linkedin.com/in/santhosh-kumard)

#### [Instagram](https://www.instagram.com/santhoshgoku)

#### [Twitter](https://twitter.com/sandy_codes_py)
Sherlock - Hunt Down Social Media Accounts 2022
Tags: sherlock, hacking, tools, python
Published: 2022-03-17 05:04:42

Social media is a big target when you collect data about a person. People often appear under a screen name, and using this screen name can reveal all accounts created by the same person and open sources for photos and family members' accounts. This method is often used by cyber security professionals. This article or section needs sources or references that appear incredible, third-party publications. Content here is for educational purposes only and does not promote any illegal activities. [Read More](https://ilabacademy.blogspot.com/2022/03/sherlock-hunt-down-social-media.html)
3 Omakase Sushi Restaurants in NYC for under $100
Tags: travel
Published: 2022-03-17 04:57:24

**3 Omakase Sushi Restaurants in NYC for under $100: Sushi On Me, Sushi Kai, Sushi Kai, Gouie.**

**1. Sushi On Me**

There is no other restaurant experience that combines sparklers in eel-toro hand rolls, torched white tuna topped with chili garlic crisp, and the level of drunken fun found at Sushi On Me in Jackson Heights. Get [mapquest driving directions](https://mapdrivingdirections.io) to Sushi On Me 71-26 Roosevelt Ave Bsmt, Jackson Heights, NY 11372

There's seating for up to eight people around the omakase counter, and there are four nightly seatings starting at 5 p.m., each lasting about an hour. You can get 15 pieces of nigiri, a couple of appetizers, and unlimited sake for $89 in cash.

**2. Sushi Kai**
Sushi Kai 322 E 9th Street, New York, NY 10003
Sushi Kai might be your ideal restaurant if you're the type who walks into a frozen yogurt shop and dumps coconut flakes and rainbow sprinkles into your cup until the person who has to clean the floors starts giving you dirty looks. 

The dishes at this East Village restaurant are accompanied by jellies, oils, sauces, truffles, caviar, and even pesto. 

Despite all of the gimmickry, you can tell that every piece of fish is of high quality. The sea bream, arctic char, and sweet shrimp are our favorites. A seasonal appetizer, 12 pieces of nigiri, and a hand roll are included in the $75 price. It has one of the best sushi deals in downtown Manhattan.

**3. Gouie**

Get free driving directions to Gouie 115 Delancey St, New York, NY 10002
There are always new omakase options in NYC, but it's difficult to find places that focus on high-quality, reasonably priced food. This restaurant on the Lower East Side's Market Line has a $30 seven-piece-and-half-roll special that is just that: a special (and not only because of the price point). 

All of the fish you'll try here is buttery, and the rice is lightly seasoned with vinegar. If you want premium pieces like sea urchin and fatty tuna, there are also $50 and $75 sushi plates.
Why you should not ask your developers to implement modern auth
Tags: webdev, security, devops, programming
Published: 2022-03-17 04:43:32

If a software developer has no experience adding #OIDC/#OAuth, #SAML #SSO (Single Sign-On) to a web application, he/she needs to understand the complex OIDC/OAuth or SAML protocol, practice the SDK/API from the identity provider, manage user sessions, and write code, it usually takes 3-6 months of engineering work for 1 application.

Once the initial work is done, it requires constant maintenance and improvements. Also security vulnerabilities can easily be introduced if the security expertise is lacking.

As an engineering leader, you are wasting your developers' time and your precious engineering resources if you assign such tasks to your developers. 

A #NoCode proxy-based solution is obviously a much better alternative.

https://www.linkedin.com/posts/cmjiang_oidc-oauth-saml-activity-6910026693147594753-Lcrk?utm_source=linkedin_share&utm_medium=member_desktop_web
SEDOT WC
Tags: sedotwcgresik, sedotwcsidoarjo, sedotwcmojokerto, sedotwc
Published: 2022-03-17 04:42:15

[CV Barokah Sidoarjo](https://sedotwc-no1.com/sedot-wc-sidoarjo-kota/) [CV Barokah Gresik](https://sedotwc-no1.com/sedot-wc-gresik/) [CV Barokah Mojokerto](https://sedotwc-no1.com/sedot-wc-mojokerto/) [CV Amanah sidoarjo](https://sedotwcsidoarjoonline.com/sedot-wc-sidoarjo/) Sedot WC CV Amanah adalah salah satu perusahaan jasa yang bergerak di bidang pelayanan masyarakat saat ini. Kami mempunyai banyak keunggulan dibandingkan jasa sedot WC lainnya..

Berpengalaman dalam mengatasi permasalahan WC mampet dan semua pembuangan limbah selama bertahun – tahun dan didukung dengan peralatan super canggih kami menjamin profesional.

Segera hubungi kami CV Amanah, jasa Sedot WC Termurah di Jawa Timur. Dapatkan promo dan diskon menarik dari kami…. Pesan sekarang juga!
CV BAROKAH SEDOT WC SIDOARJO
Tags: sedotwc, sedotwcgresik, sedotwcmojokerto, sedotwcsidoarjo
Published: 2022-03-17 04:17:48

[Cv Barokah Gresik](https://sedotwc-no1.com/sedot-wc-gresik/)  [Cv Barokah Sidoarjo](https://sedotwc-no1.com/sedot-wc-sidoarjo-kota/) 
 [Cv Barokah Mojokerto](https://sedotwc-no1.com/sedot-wc-mojokerto-kota/) Jasa Sedot WC Terbaik dan Termurah No. 1 di Sidoarjo
Kami Siap Melayani Anda 24 Jam Non-Stop

LAYANAN KAMI:

1. Sedot WC Rumahan (Domestik)
2. Sedot Limbah Industri
3. Servis Saluran Air Mampet

KENAPA HARUS MEMILIH KAMI:

- Harga Murah
- Tenaga Profesional
- Bergaransi