teleren/devto huggingface dataset:
Day 62 of 100 Days Of SwiftUI
Tags: swift, 100daysofcode
Published: 2021-05-15 06:36:15

I just completed day 62 of 100 Days Of SwiftUI. Today I learnt about custom bindings and `Actionsheet`.

Custom bindings are useful when you need to perform side effects for example logging whenever your `@State` property changes.
For example, this is how you create a custom binding in SwiftUI:
```swift
struct ContentView: View {
    @State private var bidAmount: CGFloat = 0

    var body: some View {
        let bid = Binding<CGFloat>(
            get: {
                self.bidAmount
            },
            set: {
                self.bidAmount = $0
                print("New value is \(self.bidAmount)")
            }
        )

        return VStack {
            Text("Bid amount: \(bidAmount)")
               
            Slider(value: bid, in: 0...20)
        }
    }
}
```
This code creates a custom binding that sets the value of the `bidAmount` state property and also prints the value of `bidAmount`
How to Get Udacity Scholarship?- Step by Step Guide
Tags: datascience, machinelearning, career, analytics
Published: 2021-05-15 06:25:35

Do you want to know How to Get **[Udacity Scholarship](https://imp.i115008.net/ORrOYr)**?…If yes, then follow these **steps-**👇


To apply for Udacity Scholarship, you need to go on their **[Scholarship page](https://imp.i115008.net/ORrOYr)**, which looks like something like that-

![How to Get Udacity Scholarship?](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/9mchqtr07nuivqz0ss1l.jpg)

On this page, you have to find the scholarship for the program you want to enroll. If you found your Nanodegree program on the list, then you need to apply for the scholarship by filling out these details-

1. Background Information
2. Prerequisite Knowledge
3. Your Goals
4. Additional Questions

![How to Get Udacity Scholarship?](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/c5i0yi1xz6ilskynye2z.jpg)

In the **background information** section, they will ask about your **Country, Age, Gender, ethnicity, the highest level of education, current job role, years of professional experience, and how many hours can you dedicate to the program per week?**


The **prerequisite Knowledge** section varies depending on the Nanodegree program you are applying for.


In the **Goals section**, you have to tell your primary purpose in participating in this scholarship program, what do you hope to accomplish through this program?, and Why should you receive a scholarship?.


In the last section which is **Additional Questions**, you have to agree to their terms and conditions.

You should fill the **Goals section** very carefully so that you increase your chance of getting a scholarship.

After filling out these details, you need to click on the **[“Save and Submit“](https://imp.i115008.net/ORrOYr)** button. And by doing so, you have applied for Udacity Scholarship. And if you are selected, then you will be notified via email.

But if your program is not listed in the scholarship section, then you fill out this **form on the Scholarship page section-**

![How to Get Udacity Scholarship?](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/h4r5y3sod9as1nzr3san.jpg)

So when there will be a new scholarship come, you will be notified.

I hope now you understood How to Get **[Udacity Scholarship](https://imp.i115008.net/ORrOYr)**?

Happy Learning!
Master Logging In Python
Tags: python, programming, development, machinelearning
Published: 2021-05-15 06:04:54

Logging is the process of capturing the flow of code as it executes. Logging helps in debugging the code easily by writing logs. Logs are usually written inside a file, called a log file. This File is used to troubleshoot any problem that occurs during the execution of the program. Logging makes it so much easier to debug the code even when it is in production. In Python, we have a Library named logging that is used to write logs onto a file.

Read The Complete Article Here. 
https://medium.com/pythoneers/master-logging-in-python-73cd2ff4a7cb
Flutter 2.0 Clubhouse App & Web | Responsive UI
Tags: flutter, webdev, ux, clubhouse
Published: 2021-05-15 05:50:12

YouTube tutorial: https://youtu.be/p-s6GfGH_8c
Source Code: https://github.com/MahmoudHesham099/Flutter-Clubhouse-App-Web-Responsive_UI

TimeCodes
00:00 Intro
01:06 Mobile UI
28:40 Web Responsive UI
Why isn't the hashcode of a java object  consistent on different hosts
Tags: java, hashcode
Published: 2021-05-15 05:30:52

## Background
Recently, one of our API customers complains that the [etag](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/ETag) of our API is not working correctly. So, I started checking what's wrong. And what I found was that the etag across different hosts is not consistent. So, the etag is a hex string of java object hashcode. In the beginning, I had no idea what's wrong. Since the other APIs are working, only one of the API is not. So, I wrote a simple test code that prints each field on the object. Finally, I found the hashcode of java enum is different on different hosts. So why?

## Why?
I just googled the question and found this [post](https://madhead.me/posts/enums-fuckup/). It is exactly the same issue as I had. 

Let's take a look java enum hashcode definition in the official document.

```
public final int hashCode()
Returns a hash code for this enum constant.
Overrides:
hashCode in class Object
Returns:
a hash code for this enum constant.
```

See, what the problem is? Here, it says that it returns a hashcode for this enum constant. Enum constant is an object of the enum, and it is constant. So, it is consistent on the JVM. But, each JVM should have its own constant of the enum. That explains my question at the beginning. **Enum’s on different JVMs will have different hash codes.**

## How to resolve the issue?
So, we know what is going on. But, how to resolve it. As you can see, the enum hashcode function is a `final` method. So, which means we can't override it. 

This tells us that the only way to override the hashcode is the place where we use the enum object. Let's an example.
```
class TestDAO {
  private String test1;
  private Type type;

  enum Type {
    APPLE,
    ORANGE
  }
}
```

Let's override the hashcode method on TestDAO.
```
class TestDAO {
  private String id;
  private Type type;

  @Override
  public hashCode(){
    Objects.hashCode(id, type.name());
  }

  @Override
  public equals(){
    ...
  }

  enum Type {
    APPLE,
    ORANGE
  }
}

```

Note, the difference is that we use `type.name()` instead of the type itself. That resolves the issue. Not perfectly, but, works.


Reference:
https://madhead.me/posts/enums-fuckup/
https://docs.oracle.com/javase/7/docs/api/java/lang/Enum.html#hashCode()
https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/ETag
Full Stack Instagram: Introduction 
Tags: react, firebase, javascript, webdev
Published: 2021-05-15 05:44:03

I've been learning to build a web app using React.js. And this project turns out to be quite awesome for me! So I'd like to share this with other devs as well.

This project is an extension of a guide [I found on Youtube](https://www.youtube.com/watch?v=f7T48W0cwXM). The extensions are more about things I found essential to be improved, such as guest mode, paginations, and image compressions.

Published app: [https://instagram.arnold.id/](https://instagram.arnold.id/)

Here's the source code:
Github: [https://github.com/arnoldschan/custom-instagram](https://github.com/arnoldschan/custom-instagram)

Demo: 

![May-03-2021_17-00-54](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ryr16e82nrzwo0tk59lx.gif)
 

Highlighted features and Guidelines:

- [Authentication + Login as Guest via Firebase Auth](https://dev.to/arnoldschan/authenthication-guest-12da-temp-slug-9543345?preview=c836128f4e62c9f5bb3f43dc1213e93a39b6d486743c8f23f99867e5b59f9a146c18a6d9e7892c6c8b9625f3c4be6b9f58a6bb99576c32edf73481ad)
- [Upload post via Firebase Storage + Image compression](https://dev.to/arnoldschan/ig-post-upload-via-firebase-storage-and-firestore-24on-temp-slug-8672326?preview=db80d34dcaa177bb9cf716f59f97472ac6ca5ba8e3432cecf635ff3df5834510d66bf686d1feaa27fe461ae83ac73484f3424139d4d9f38cc50e7f4a)
- [Inifinite Scroll, and Post Pagination](https://dev.to/arnoldschan/infinite-scroll-h15-temp-slug-6691249?preview=d8f9a82d25d44f12de7e651bd567edda2b253dc213dc4449216ab2a7ff3d40b771329c38f004530cb35da2c3bcfd488acbbaf8ba5f59fdc6ac26f7c1)

Tech:

- [React.js](https://reactjs.org/)
- [Firebase](https://firebase.google.com/)
- [CSS](https://www.w3schools.com/css/) + [Styled Components](https://styled-components.com/) + [Material-UI](https://material-ui.com/)

Project managed using scrum methodology through [Jira by running sprint and backlogs, even though I'm working by myself 😅

Looking forward if you want to do a collab with me!

Enjoy!

tags: [Full Stack Development](https://www.toptal.com/full-stack)
LVM+VirtualBox (Extend Disk Size)
Published: 2021-05-15 05:42:05

* Increase your VirtualBox HD first

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


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


* We need to convert the available space (/dev/sda) into a new partitions , fdisk is the utility to do so

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

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


* We cannot just add to the Volume Group, there is something that we need to change before doing so (Partition Type).
 now we have a new partition /dev/sda4

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

 
* In order to create a Physical volume, we are going to use pvcreate

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


* Use pvs command, If you wanna know how many Physical Volume the machine is setup, it can show the Volume Group assign to the new partition.

for now,/dev/sda4 is not yet assign to any VG

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


* We need to extend the Volume Group (VG) and assign the new partition /dev/sda4

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


* We need to extend the Logical Volume (LV)

![image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/joenggrnr1u2zrc1l5b7.png)
 
 
* Now it will have new 8G available space

![image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/zbp0z44fpugagghusj3v.png)
Portability Bug in Window OS for STDIN
Tags: computerscience, programming, c
Published: 2021-05-15 03:29:44

I recently made a switch to Emacs and I stumbled upon a "bug" in the Windows OS when it comes to writing portable code in C. I will explain this bug in great detail in this article.

Let's first examine the bug. 

```
#include <stdio.h>
#include <stdlib.h>

int main(int argc, char * argv[]){
    int age;

    printf("Enter age: ");

    scanf("%d", &age);

    printf("You are %d years old.", age);

    return EXIT_SUCCESS;
}

```

So, I ran this code in Emacs on Windows. This should work right?

It doesn't. 

How so?

When you run the program, the printf() statement does not show up in the console. It immediately is reading input. Then, when you enter the age, you get: 

```
23
Enter Age: You are 23 years old

```

The problem is how Windows handles I/O. 

On Unix-like systems, inclusing MacOS, stdout has line based buffering. This means that `stdout` is flushed after seeing a newline. 

However, Windows does not support line-based buffering. Newlines are no longer special and and full buffering is used. 

`stdout` on Windows is either always unbuffered when attached to the console or fully buffered.

This is the options for stdout on Windows: 

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/wn5bs0755p19k95whr91.jpeg)

This stems from the expectation that `stdout` buffering should behave like in POSIX systems, which is not necessarily the case on 'windows-nt.

MacOS and Linux are mostly POSIX compliant while Windows is not. 

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/9r9xzyy9onku7mkh79mx.png)

Under "stderr, stdin, stdout - standard I/O streams", POSIX standard reads:

`At program start-up, three streams shall be predefined and need not be opened explicitly: standard input (for reading conventional input), standard output (for writing conventional output), and standard error (for writing diagnostic output). When opened, the standard error stream is not fully buffered; the standard input and standard output streams are fully buffered if and only if the stream can be determined not to refer to an interactive device.`

Windows uses pipes to communicate with subprocesses, while on Posix platforms use PTYs, which are a kind of console device.

However, Windows came out with WSL to solve this. WSL is POSIX compliant. But if you were to not use WSL, you would run into this portability issue. The resolution to this problem is to explicitly flush using:
1. `fflush()` or 
2. `setvbuf(stdout, NULL, _IONBF, 0);` // turn off buffering for stdout
Angular : Changing Page title Dynamically
Tags: angular, javascript, webdev, programming
Published: 2021-05-15 03:26:56

Step 1. First we need to import `Title` service -
```javascript
import {Title} from "@angular/platform-browser";
```

Step 2. Using `setTitle` -
```javascript
 constructor( private title: Title) {
 this.title.setTitle('page title changed');
 }
```

All together -
```javascript
import {Title} from "@angular/platform-browser";
@Component({
 selector: 'app',
 templateUrl: './app.component.html',
 providers : [Title]
})
export class AppComponent implements {
 constructor( private title: Title) {
 this.title.setTitle('page title changed');
 }
}
```
# Demo
{% stackblitz angular-ivy-5rbcrh file=src%2Fapp%2Fapp.component.ts %}

# Preview
You can click on below link in new tab of your browser and you can see the title will be dynamic one
https://angular-ivy-5rbcrh.stackblitz.io/

# Use case
You can think of an application which has content dynamically updated after some interval and you want to update the title based on updated content, for example https://time.is/UTC this website has dynamic title, as this will show the current UTC time. This is just a simple example, you can use this to your upcoming projects.

<a href="https://www.buymeacoffee.com/rkycom" target="_blank"><img src="https://cdn.buymeacoffee.com/buttons/v2/default-yellow.png" alt="Buy Me A Coffee" style="height: 60px !important;width: 217px !important;" ></a>

With all that being said, I highly recommend you keep learning!

Thank you for reading this article. Please feel free to connect with me on [LinkedIn](https://www.linkedin.com/in/www-rajeshkumaryadav-com/) and [Twitter](https://twitter.com/rky_com).
Xfce4: Zoom display with mouse wheel
Tags: xfce, desktop, troubleshooting
Published: 2021-05-15 03:20:48

[Xfce](https://www.xfce.org/) desktop environment has an option to zoom desktop with mouse wheel and keyboard.
Just push __"Alt" key + mouse wheel__ with the intension or by accident:

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/nta1g5dn6o58g8gv3eur.gif)

The visible position follows mouse cursor.

In order to restore display, with keeping "Alt" pushed, reverse the scrolling direction of mouse wheel:

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/yhdhpq76arp6meyxir93.gif)

---

Besides, it is able to deactivate the function.
Open application menus, and go to "Settings" - "Window Manager Tweaks".

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

Then uncheck "Zoom desktop with mouse wheel" in "Compositor".

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/nkj7vnjgq4v5t5zx6eqt.png)
I have created Sveltegram an Instagram clone in Sveltekit and Nodejs
Tags: showdev, sveltekit, node, materialdesign
Published: 2021-05-15 02:41:06

Hello Community Svelte is really awesome javascript compiler which convert .svelte file to highly efficient javascript code.

But the problem is you cannot create production ready web app with svelte because you will face SEO problem code splitting problem etc..

Hence Sapper come in pictures and solve most of the issues.But you knew sapper will never touch v1.0 you can read [this](https://svelte.dev/blog/whats-the-deal-with-sveltekit) blog post by Rich Harris - creator of svelte.

Hence i have looked into the sveltekit . If you are a React developer you can think sveltekit as a Nextjs. If you are a Vue developer you can look it as Nuxtjs.

In this project i have used Svelte-materialify very cool and awesome material library inspired by vuetify. 

## Backend is deployed on Heroku

{% github harshmangalam/sveltegram_server %}


## Frontend deployed on Vercel

{% github harshmangalam/sveltegram-sveltekit-web %}

### Live demo  [sveltegram](https://sveltegram-mu.vercel.app/)

* deployed on vercel. refresh page if getting application error from vercel
LeetCode 668. Kth Smallest Number in Multiplication Table (javascript solution)
Tags: algorithms, javascript
Published: 2021-05-15 02:38:24

###Description:
Nearly everyone has used the Multiplication Table. The multiplication table of size m x n is an integer matrix mat where mat[i][j] == i * j (1-indexed).

Given three integers m, n, and k, return the kth smallest element in the m x n multiplication table.

###Solution:
Time Complexity : O(nlog(n))
Space Complexity: O(1)

```javascript
// Binary Search
var findKthNumber = function(m, n, k) {
    // Check how many numbers per row x is greater than
    function enough(x) {
        let count = 0;
        for (let i = 1; i <= m; i++) {
            count += Math.min(Math.floor(x / i), n);
        }
        return count >= k;
    }
    
    let lo = 1, hi = m * n;
    // Binary search template
    while (lo < hi) {
        let mi = lo + Math.floor((hi - lo) / 2);
        if (enough(mi)) hi = mi;
        else lo = mi + 1;
    }
    return lo;
};
```
Hackerrank SWE Intern 2021
Tags: hackerrank, internship, opensource, github
Published: 2021-05-15 02:10:27

*This was my First Interview Experience* 

I got a mail inviting me directly to the interview with the CTO, through my [GitHub Profile](https://github.com/Siddhant-K-code) and my past Open Source Contributions. I sent my Resume to her. After a week I got a reply,

Got a Calendly event for setting up the 20 mins. interview with CTO. The interview went amazing, ***he asked about my past open-source contributions***, what part I have contributed and how you implemented those things. **[ACE]**

Now, I received a call and mail regarding the positive result, Now there was a link for the Final Interview with Sr. Software Architect.

This Interview Lasted for Half an Hour, where he asked ***Deep Questions about React*** ( implementation part ), then he asked about the features they are trying to implement in Hackerrank, what can be the ***best practice/approach to apply a particular feature***. for me, a tough question was - "*How can we avoid the use of containers, when we are developing something similar to GitPod*?", I am unable to answer this question well, and maybe this is the rejection of my SWE Internship. **[Rejected]**

The next day, I received my Rejection Mail.

My GitHub Profile (through which i got the invite): https://github.com/Siddhant-K-code 

More About Me:

Siddhant Khare
Sophomore B.Tech. CSE 
Global Engineering College, Jabalpur (M.P.), India

If you have any more Questions, regarding this. You can Ask in comments!

***Update 1***: 

#### **GitHub Portfolio**

Regarding GitHub Portfolio, You can start contributing to the OSS Projects by Individuals, Orgs. which comes under your Tech Stack. For the start, you can start by going through their Repos. look for their open issues, Almost all the good and popular repo. have some open issues with the Label "good first issue", which means it made for beginners to resolve that and implementing that part Is comparatively easy. Also, If you are not familiar with git & GitHub, you can start by learning them through any of the resources which are available on the Internet.

*Same Article On LeetCode:* *https://leetcode.com/discuss/interview-experience/1207463/Hackerrank-SWE-Intern-2021*
What are some powerful resources to learn coding?
Published: 2021-05-15 00:16:59

Sometimes its very difficult to find out the right resources to lean and to begin with something really useful. 

Here are some helping tools for the beginners also to learn and practice programming:

My top resources are:

www.jshero.net
www.freecodecamp.com
www.codecademy.com
www.devdojo.com
www.w3resource.com
www.codegrepper.com
www.stackoverflow.com

What kind of resources you used, please share with everyone?
Think of bugs as work you forgot to do
Tags: bugs, features, practices
Published: 2021-05-19 09:33:23

---
title: Think of bugs as work you forgot to do
published: true
date: 2021-05-15 00:00:00 UTC
tags: bugs,features,practices
canonical_url: https://jhall.io/archive/2021/05/15/think-of-bugs-as-work-you-forgot-to-do/
---

In practically every team I’ve ever worked with, there’s a debate about how to prioritize bugs versus other features.

“If we spend all our time fixing bugs, we won’t have any time to create features” is the usual line of reasoning.

I want to offer a different angle on the debate: Every bug represents a feature that someone forgot to complete.

When framed this way, it’s no longer a question of bugs versus features. It’s a question of features versus features. Which feature is more important? One that you already partially delivered, or a new one?

* * *
_If you enjoyed this message, [subscribe](https://jhall.io/daily) to <u>The Daily Commit</u> to get future messages to your inbox._
Have you taken part in a coding challenge or hackathon before? How did it help you grow?
Tags: watercooler, discuss, programming, motivation
Published: 2021-05-14 23:09:19

Let us know what challenges or hackathons you’ve participated in before. What did you like about them and what did you learn?

I’m building a developer community called [inspirezone](https://community.inspirezone.tech/) all about encouraging devs to keep a regular coding habit through various coding challenges and events. We are also focused on using accountability to push each other to reach our goals.


Read the post below for more details on our community and challenges!
{% link https://dev.to/inspirezone/a-developer-community-encouraging-active-coding-practice-4koh %}