teleren/devto huggingface dataset:
Apa itu korupsi?
Tags: corrupt, algoritm, logic
Published: 2020-02-22 07:03:28

---
title: Apa itu korupsi?
published: true
description: Menjelaskan mengapa jangan sampai terjadi korupsi
tags: corrupt, algoritm, logic
series: Life
---

Korupsi berasal dari bahasa Inggris: corrupt, yang artinya adalah damage, crash, atau rusak dan nggak sempurna. Dari bahasanya aja, kita sudah tau bahwa korupsi itu berarti _segala sesuatu yang **nggak lengkap**_.

Kalau kita memahami ini, maka kita akan sadar bahwa korupsi itu nggak cuma melanda pemerintah saja. Kita pun juga terkadang melakukannya; baik secara sadar maupun nggak sadar. Misalnya aja, ada telor 8 biji, kita bilang 9 biji. Ada makanan 6 piring, kita bilang 7 piring. 

Sederhana ya? Tapi, apakah bisa membahayakan?

Ya, jangan meremehkan korupsi sekecil apapun sih.

Misalnya aja suatu kebakaran di Korea pada tahun 90an yang menewaskan 20an anak TK. Kalau dilihat dari bangunan tempat kebakarannya itu, nggak standar buat jadi tempat wisata. Namun, karena bermain suap (korupsi), bangunan nggak standar itu bisa jadi tempat wisata:

{% youtube w1JYxhVRjIQ %}

Bahkan, di dunia pemrograman, di mana segala sesuatunya serba pasti, ada yang namanya truthy dan falsy yang membuat kode jadi nggak tepat dalam menilai suatu value:

{% medium https://medium.com/@jundialwan/kenal-javascript-truthy-dan-falsy-c5f50090702e %}

Kalau di dalam truthy dan falsy, ada 6 nilai yang akan dievaluasi jadi false:

- false
- 0 (nol)
- “”, string kosong
- null
- undefined
- NaN

Dan sisanya akan dievaluasi jadi truth (truthy). Beberapa di antaranya yang seharusnya false namun dievaluasi jadi truth:

- Infinity dan -Infinity
- " "
- "0"
- []
- {}
- function(){}

Wow. Kita bisa error kode kita kalau nggak memperhatikan tipe value.

Jadi intinya jangan korupsi karena bisa merusak sistem. Dan yang namanya kerusakan sistem itu bukan sesuatu yang sepele.
what do I need to learn to build a recommendation engine?
Tags: help
Published: 2020-02-22 07:03:15

---
title: what do I need to learn to build a recommendation engine?
published: true
description: need help with technologies I need to learn for building a recommendation engine
tags: help
---

Hi All, I want to build a recommendation engine at work. For that, I want to understand what technologies are needed to build this kind of stuff.

I know to build things related to ruby and javascript at the moment.


There seems to be too much information overload on what to learn in coursera etc. Do I need to learn AI or ML or deeplearning?

Do I need to have any stat background?

Would be great if you can help me with a list of MOOCs than books

Thanks
Circunferencia de PI
Tags: codepen
Published: 2020-02-22 06:25:24

Es una circunferencia formada por caracteres numéricos del número PI. Se hizo para los programadores de **Stack Overflow** y **cualquier persona interesada** en utilizarla en sus proyectos.

{% codepen https://codepen.io/dlunamontilla/pen/oNXgMqR %}
Animación con borde sólido para ilustrar
Tags: codepen
Published: 2020-02-22 06:17:31

Animación de carga de *App* con borde sólido para ilustrar cómo funciona.

Recuerde que el diámetro de la circunferencia puede cambiarse cambiando el valor de la propiedad personalizada `--diametro`, ubicada en la regla `:root`.

Por ejemplo:

```css
:root {
  --diametro: 100px;
}
```

Todo lo demás se escala.

{% codepen https://codepen.io/dlunamontilla/pen/XWbjaBg %}

También publiqué en [**Stack Overflow**][stack-overflow] una explicación un poco más detallada sobre cómo funciona la animación presentada acá.

[stack-overflow]:https://es.stackoverflow.com/questions/329419/c%c3%b3mo-hacer-un-cargador-similar-html-y-css/331211#331211
Is it ethical to work as a shadow developer by hiding identity? (Please read and help me)
Tags: discuss, career, help, freelancing
Published: 2020-02-22 05:34:21

---
title: Is it ethical to work as a shadow developer by hiding identity? (Please read and help me)
published: true
cover_image: https://imgbbb.com/images/2020/02/22/akshar-dave-Gvm7qlEae_M-unsplash.jpg
description: is it ethical to work as a developer hiding the whole working procedure?
tags: discuss, career, help, freelancing
---

Hi all, Please have a read on the discussion and help me with your thoughts.

Today, I have to decline projects from one of my regular clients. We surely had a great number of projects to collaborate with. The declining issue was about the working procedure of him which I came to know yesterday.

I just came to know that, he contacts potential clients or companies with his resume and apply for remote jobs. And, after that, he takes part in the interview, then delivers the test or project's work by hiring other freelancer developers like me. ( He is also a Frontend developer. So, he passes the interview by answering questions rightly.) He once proposed me to hit APIs from his PC by the remote connection for a future client. I didn't have to do that till now. But, it seemed a little bit of unsettling to me. 

BTW, Today, **I asked him if he clarifies the client that he has a team of developers or he works alone?** If no, I also requested him not to add me on those projects. And, as I guessed, he is not working with me anymore on these kinds of projects.

I am feeling that I was right. Because a company hires a developer based on his skills, not his team. And, hiding the identity seemed unethical to me. And, I felt, I am just disrespecting my hard work. 

But, I am also thinking- **Have I done injustice to him?**
 
Because, in freelance platforms like Fiverr or Upwork or others, I get offers from other developers from now and then (when I am writing this, I have got another one where he wants help for one of his client's projects). So, how would I do work where many of the orders are like these? **Should I ask all of them if they inform the clients or just hiding it?** 

I know there are subcontractors on these platforms. That is one thing, and hiding identity is another thing. That's why I had to take a bold decision. But, I am afraid that- **Will I get enough clients if I become this kind of strict?**

**I am seeking proper and constructive suggestions from you whether I should take these kinds of projects.** It is the first place I am seeking some real suggestions (not just you have done a good or bad job). 

Cover Photo by Akshar Dave on Unsplash
Lesson 16 Discussion Swift
Tags: swift, beginners
Published: 2020-02-22 05:17:08

<h1>Explain the lesson in your own words.</h1>
<p>In this lesson we take a more in-depth look at how an app is running in the background. We learned that the UI is comprised of multiple layers, for the interface, a launch screen, a cell to show an app is thinking, cells to show a message, cells for user input, and a catalog holding the images of the app.</p>
<h1>For the app you’re thinking of, what’s an example of an input the brain would take?</h1>
<p>A request to show the type: employees schedules that day.</p>
<h1>What’s an example of a result it would return to display in the user interface?</h1>
<p>It would return a name(of employee), the hours they clock in, clock out for lunch(if applicable), and the hour they are scheduled to clock out.</p>
All About Time Zones
Tags: rails, tutorial, computerscience, fromthegroundup
Published: 2020-02-22 04:53:36

 
All web developers at some point will run into time zones and dealing with time zones can be tricky. Here is some foundation that might help:

Most applications have a sensible default of working with time in [UTC](https://en.wikipedia.org/wiki/Coordinated_Universal_Time) Coordinated Universal Time. There is generally system time, application time, and database time. UTC is sometimes used interchangeably with GMT. UTC is a time standard, GMT is a time zone. 
 
But there are good reasons for web applications to use the client's time zone. Here are some applications where using the user's time zone is critical to the functionality: calendar and appointment scheduling, trading platform, daily habit tracking app.

In order to use the correct time zone for the user, we have two options - ask the user to select a timezone (from a dropdown form) and store it in DB or auto detect the user's timezone based on their browser and operating system. 

The later way is an approximation and cannot be 100% reliable because it's possible that the user has not configured the correct time on their machine or the user is behind a proxy or VPN and their real location is hidden. 

Here is a how you can select time zone using modern ECMAScript:

```
console.log(Intl.DateTimeFormat().resolvedOptions().timeZone);
America/Chicago
```
You could store this in a `cookie` and pass it along to your backend where it can be used during requests.

That leaves asking the user as the most reliable way. How can you effectively ask users for their timezone. There is an offician list of strings [IANA Time Zone Database](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones). This can be stored in the user profile and the user can have control over changing their time zone if they are traveling.
Installing Python 3.7.4 from source
Published: 2020-02-22 04:12:38

I keep installing the Python from source, for two reason:

1. More flexibility to manage. Cause I decide where to install it, which python module to enable.
2. Chose the latest version. Python comes from system package manager is sometimes a older version.

### Download Python source code.

```
wget https://www.python.org/ftp/python/3.7.4/Python-3.7.4.tgz
mkdir ~/.python3
mv Python-3.7.4.tgz ~/.python3
cd ~/.python3
tar -zxvf Python-3.7.4.tgz
```

#### Install dependencies

```
sudo apt install build-essential zlib1g-dev libncurses5-dev libgdbm-dev libnss3-dev libssl-dev libreadline-dev libffi-dev
```

#### Enable ssl module

```
vim ~/.python3/Python-3.7.4/Modules/Setup.dist
```

find keyword `ssl` and uncomment this lines:

```
# SSL=/usr/local/ssl
# _ssl _ssl.c \
#         -DUSE_SSL -I$(SSL)/include -I$(SSL)/include/openssl \
#         -L$(SSL)/lib -lssl -lcrypto
```

#### Compile and install

```
./configure --prefix=/root/.python3/ --with-ensurepip
make
make install
```

#### Add bin to PATH

Now the `python3` and `pip` binary are located at `~/.python3/bin`, you can add the directory to `$PATH` to access those commands directly.
ローカル開発環境にVirtualBoxを使用する
Tags: debian, virtualbox
Published: 2020-02-22 03:35:51

## 経緯
DockerDesktop(Windows)、WSLとの戦いに敗れた.
プロジェクト単位での仮想環境というより適当に使えるローカル開発環境が欲しかった。


## やったこと
1. VirtualBoxのインストール
2. Debian10(Buster)のイメージのＤＬ
3. HostOnlyNetworkの設定

## 1の手順
https://www.virtualbox.org/wiki/Downloads

## 2の手順
https://www.debian.org/distrib/

## 3の手順
ホストＯＳ側でホストオンリーネットワークを設定.

ゲストＯＳで下記の設定を追加

```
"/etc/systemd/network/enp0s8.network" というファイルを作り，次のように記入する．
[Match]
enp0s8

[Network]
Address=192.168.151.100
DNS=192.168.151.1
```

sudo service networkservice restart

以上.


以下の記事を参考にしました。
https://qiita.com/Yoshiki-Takahashi/items/7274dff15dbafee5b118
Steps to Becoming a Successful Freelancer
Tags: career, hiring, productivity
Published: 2020-02-22 03:04:24

Freelancing frees us from the 9 to 5, but it definitely has lots of challenges that'll bring us stress. We have to find clients, do marketing, collect payment and much more. If you're big enough to hire a team, then you also have to manage the team.

We'll look at the steps to becoming a successful freelancer.

# Getting Clients

This is the first priority for any freelancer. Freelancers need clients to survive. To get clients, you can either use freelance job sites or tap into your personal network.

Freelance sites like Tychoo, Upwork, Freelancer.com, Fiverr, etc. all offer paying jobs from very low pay to high pay. Fiverr specifically has lots of people offering small, low-priced jobs.

The competition is fierce on these sites and there's no way for beginners to stand out in the sea of people with 5-star reviews and lots of completed jobs.

Sites like Tychoo is untapped since it's newer and has more people looking for jobs. There's less competition since it's not an established site that everyone finds.

To avoid competition, it's also a good idea to tap into your personal network to see if anyone needs help with anything that you can help do.

It doesn't have to be friends and family. Social media is a good bet to find lots of people that may need help with something that you're good at.

# Create a Brand

A brand is very important for any business. It distinguishes you from the sea of competition that's out there. Again, social media is a great way to build a brand. Also, a website is a must to distinguish yourself from others. It's your presence online.

The design of your website doesn't have to be the best, but it has to distinctive and provides a good user experience for the user.

# Build a Track Record

To build a track record at the beginning, building a portfolio of work is a must. Also, getting testimonials from people that you worked with is also very important. Otherwise, it's hard for people to trust you to do anything.

# Over-Deliver

Once you get your first clients, you must over-deliver what you promised them. This way, they won't be disappointed and stop hiring you. Instead, they'll be happy and hire you again for more jobs.

They'll also refer you to more clients, so it's a very good idea to keep them happy by over-delivering.

# Paperwork

Invoices are needed for collecting payment. It's also useful for recording transactions for tax purposes. Also, contracts need to be looked at so that you'll get the best deal out there.

You can put all their invoicing stuff into some invoicing software to make something easy. Accounting software like FreshBooks also has these features.

# Conclusion

Freelancers have to a jack-of-all-trades. If you're a freelancer, you have to be good at marketing, sales, and bookkeeping. There's no way around it. While you can work anywhere at any time, there're still deadlines and you have to collect payments and report taxes yourself.
Use more ternary operators!
Tags: javascript, typescript, codequality
Published: 2020-02-22 03:04:08

> First of all, I'm sorry if my English is bad, but I want to try to share my programming tips.

We have a lot of code where we are using a lot of ifs but, when it if can be replaced by other kind of instructions in javascript (and another languages) we should use them and, what is exactly a ternary operator?

A ternary operator is like an if-else, it don't have more else and its necessary use two returns but, I will show you how to use it.

```javascript
let num = 10;

console.log(num > 10 ? 'Greater than 10': 'Less than 10');
```

Yeah, it is so strange if it is your first time seeing a ternary operator but, if you see this it is so easy to use and its more useful that try to print the same using an if and an else. We three steps to get a ternary operator, first we have a condition where we can use conditions lice <, <=, >, >=, ==, != equals and more, and next we have the two values that return true (first value) and false (second value).

Here is an example but using if-else.

```javascript
let num = 2;

if (num > 10) {
   console.log('Greater than 10');
} else {
   console.log('Less than 10');
}
```

If you see the example we can reduce a lot of code and if we use this ternary operators we could have a clean code.

The ternary operators can be use when we try to send a value to a function or return another. Here is an example.

```javascript
let sleep = false;


function sleepOrNot(sleep) {
  return (sleep ? 'You need to sleep': 'Hello world!');
}

console.log(sleepOrNot(sleep));

// expected out: 'You need to sleep'
```

All the examples are so simple but when we use this operator with our projects we can have clean code and make it more understandable for the rest of our teammates or even for ourselves.

If you need some help and you don't have idea when you need to use this operator download the extension called Javascript Booster and it helps you to reduce an if-else and a lot things more. Read the docs and try to use it :)
Before and After Bootstrap
Tags: wk1discussion
Published: 2020-02-22 02:40:54

Go through the eBook preface and explain why do you think frontend development can be separated into two eras (before and after Bootstrap)?

I think the reason why front end development can be separated into two different eras is because before bootstrap the process to code in a way that is visually appealing was extremely complicated. After bootstrap everything was revolutionized and simplified. The ways that developers could code and have an end-product that was as beautiful or probably even more is what set these two eras apart, developers could do better and more work in less time.
csstox - Convert CSS snippets to React Native / JSS stylesheet objects with ease
Tags: showdev, reactnative, css, javascript
Published: 2020-02-22 02:35:13

Hey there guys, so as usual I was browsing through various repositories on GitHub hoping to stumble upon something interesting and suddenly this one caught my eye: [css-to-react-native](https://github.com/styled-components/css-to-react-native).

I was surprised to know that it was a library as opposed to my assumption of it being a CLI utility. Developers are required to consume the API programmatically. And the thought of building a CLI solution struck my mind, out of which I opened an [issue](https://github.com/styled-components/css-to-react-native/issues/131).

Later I came to the conclusion that a web solution would make much sense which resulted in [csstox](https://csstox.surge.sh/).

Please see the source code [here](https://github.com/jamesgeorge007/csstox).
Simple Web App Ideas to Practice Your Programming
Tags: career, hiring, productivity
Published: 2020-02-22 02:27:14

**Subscribe to my email list now at http://jauyeung.net/subscribe/**

**Follow me on Twitter at https://twitter.com/AuMayeung**

**Many more articles at https://medium.com/@hohanga**

**Even more articles at http://thewebdev.info/**

When we're learning how to develop web apps, we need to practice as much as possible. Tutorials are limited in their scope since they can only put so much in a book or blog entry.

Also, we need to be able to solve problems ourselves. Therefore, we need to come up with some project ideas for writing practice apps that'll enhance our knowledge.

Below are some examples of apps that you can build to improve your web development skills.

# Fitness Tracker

Fitness trackers allow us to practice how to build UIs to save and retrieve data. It records multiple entries with forms to record the fitness activities that you have done over time.

The UI can have controls like date pickers, checkboxes, and radio buttons for various. fields so you can practice building rich UIs.

Also, we can plot a graph to track things how many kilometers we walked or something like that over time.

# Calculator App

You can either build one that just takes inputs with text input controls and then show the calculated value somewhere. Or you can build one that looks and acts like a calculator.

The latter choice is harder, so we can build the first to warm up. Then as you get more familiar with coding, you can build the second, more difficult version.

# Movie Database

A movie database lets you practice building forms with controls like date pickers, inputs, checkboxes, and how to validate the values of those inputs.

Movies have posters and other images, so you can also practice saving and displaying images. Manipulating files is something we have to do a lot so this is a practical application of file manipulation on the client and server-side apps.

Of course, we have to save the data to the database if it's text. If it's a file then we can save it to the database as binary data or on the file system.

# Recipes App

Like the movie database idea, recipe apps also involves forms and images. In addition, we can also learn to incorporate videos and maybe a rich text editor if we want to get fancy.

The data is saved in the database and files are saved in the file system. Videos can be loaded from video sites like YouTube or Vimeo, or we can load them from the file system.

# Bill Tracker

Bill trackers let us practice our form validation skills since you have to check that the amount is right. You can also add a few graphs to show some data. The data is stored in the database.

# Conclusion

There're lots of project ideas that we can use to practice writing apps until you're proficient. As long as you come up with the solution yourself, it's not going to very hard to be proficient in writing web apps given all the practice that you've done.
Number of Islands - Union Find Solution
Tags: python, beginners, leetcode, computerscience
Published: 2020-02-22 01:56:38

This is part of my series where I memo learning from Leetcode. If you have better solutions or ideas, please leave a comment!

## Question

[Number of Islands](https://leetcode.com/problems/number-of-islands/)

We have to count the number of islands in Given a 2d grid map of '1's (land) and '0's (water). 

An island is defined as below.
>An island is surrounded by water and is formed by connecting adjacent lands horizontally or vertically.  

## Approach

To check a 2d grid map, DFS or BFS is useful in many cases.  
This question can be solved by DFS and [Union Find Algorithm](https://en.wikipedia.org/wiki/Disjoint-set_data_structure).
I'm gonna write about Union Find solution in this article.  

In this algorithm, we can group the nodes and find the group number of some node(we can find the parent of some node).  

To solve this question, if we find the '1'(land), we're gonna union the adjacent lands horizontally or vertically as much as possible.  
Repeat the above process over and over again, and then finally the number of group is the answer for this question.

## Solution

```python
class Solution:
    
    def numIslands(self, grid: List[List[str]]) -> int:    
        if not grid:
            return 0
        grid_y = len(grid)
        grid_x = len(grid[0])
        
        uf = UnionFind(grid)
        
        for i in range(grid_y):
            for j in range(grid_x):
                if grid[i][j] == '1':
                    for k, l in ([1,0], [-1,0], [0,1], [0,-1]):
                        ny, nx = i+k, j+l
                        if 0<= ny < grid_y and 0 <= nx < grid_x and grid[ny][nx] == '1':
                            uf.union(i*grid_x+j, ny*grid_x+nx)
        return uf.count                     
        

class UnionFind:
    def __init__(self, grid):
        
        y = len(grid)
        x = len(grid[0])
        self.parents = [0] * (y*x)
        self.count = 0
        
        for i in range(y):
            for j in range(x):
                if grid[i][j] == '1':
                    self.parents[i*x+j] = -1
                    self.count += 1
    def find(self, x):
        
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]
    def union(self, x, y):
        
        x = self.find(x)
        y = self.find(y)
        
        if x == y:
            return
        if self.parents[x] > self.parents[y]:
            x,y = y,x
        self.parents[x] += self.parents[y]
        self.parents[y] = x
        self.count -= 1
                         
```  

Thank you for reading this article!
I always welcome your feedback, question, and idea.