teleren/devto huggingface dataset:
Day 2: Fixed point
Tags: challenge, kotlin, learning
Published: 2020-01-07 12:48:29

- Difficulty: Easy
- Programming language: Kotlin

## Problem

A fixed point in an array is an element whose value is equal to its index.
Given a sorted array of distinct elements, return a fixed point, if one exists. Otherwise, return `false`.

For example:
   - Given `[-6, 0, 2, 40]`, you should return `2`
   - Given `[1, 5, 7, 8]`, you should return `false`

## My solution

This is an easy one and I don't want to go to a very complex solution. Let's just iterate the array and find the fixed point 😄

```kotlin
/**
 * Find each fixed point in a sorted array.
 *
 * @param array, sorted array
 * @return an list with each fixed points, the list is empty if there is no fixed points.
 */
fun findFixedPoint(array: IntArray): List<Int>{
    if(array[1] < array[0]) throw IllegalArgumentException("Array not sorted")

    val pointFixedFound = mutableListOf<Int>()
    for ((index, value) in array.withIndex()) {
        if(index == value){
            pointFixedFound.add(index)
        }
    }

    return pointFixedFound.toList()
}
```

## UPDATED VERSION

As {% user nickholmesde %} suggests in the comments, I didn't really follow the question asked. The question is to return A fixed point not all fixed points, so there is the updated version (thanks again to Nick Holmes).

```kotlin
fun findFixedPoint(array: IntArray): Int? {
    val pointFixedFound = mutableListOf<Int>()

    for ((index, value) in array.withIndex()) {
        if(index == value){
            return index
        } else if (value > index) {
            break
        }
    }
    return null
}
``` 

The function returns null if there is no fixed point because I didn't find if this is possible to return an int or false in Kotlin, so I return null instead.
Starting to write articles
Tags: uncategorized
Published: 2020-02-03 22:25:28

---
title: Starting to write articles
published: true
date: 2020-01-07 12:14:17 UTC
tags: Uncategorized
canonical_url: https://i3.ninja/starting-to-write-articles/
---

I’ve been spending my time reading articles lately. I love reading them because they are written by people who cares about sharing. The more I read those articles, it builds my interest to write my own version, my original story.

And that’s where I decide to create this site. I would like to share some experiences that I have been through, also some knowledge that I learn, and maybe some arbitrary thought to ponder. it’s all for the sake of my wish to tell all my experiences to the world.
[Link] Against metrics: how measuring performance by numbers backfires
Tags: productivity, management
Published: 2020-01-07 12:11:22

> The source of the trouble is that when people are judged by performance metrics they are incentivised to do what the metrics measure, and what the metrics measure will be some established goal.

[Against metrics: how measuring performance by numbers backfires](https://aeon.co/ideas/against-metrics-how-measuring-performance-by-numbers-backfires)
Get emojis working on arch linux with noto-fonts-emoji
Tags: archlinux, config
Published: 2020-01-07 11:51:32

After switching to arch linux as my daily driver I came across a new problem: I couldn't see emojis!

There are some emoji fonts you can install and setup. One of them is `noto-fonts-emoji`. I decided to write a small script to automate the setup of the font and explain the steps below:
```sh
#!/bin/sh
set -e
if [[ $(id -u) -ne 0 ]] ; then echo "Please run as root" ; exit 1 ; fi
echo "Setting up Noto Emoji font..."
# 1 - install  noto-fonts-emoji package
pacman -S noto-fonts-emoji --needed
# pacman -S powerline-fonts --needed
echo "Recommended system font: inconsolata regular (ttf-inconsolata or powerline-fonts)"
# 2 - add font config to /etc/fonts/conf.d/01-notosans.conf
echo "<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
 <alias>
   <family>sans-serif</family>
   <prefer>
     <family>Noto Sans</family>
     <family>Noto Color Emoji</family>
     <family>Noto Emoji</family>
     <family>DejaVu Sans</family>
   </prefer> 
 </alias>

 <alias>
   <family>serif</family>
   <prefer>
     <family>Noto Serif</family>
     <family>Noto Color Emoji</family>
     <family>Noto Emoji</family>
     <family>DejaVu Serif</family>
   </prefer>
 </alias>

 <alias>
  <family>monospace</family>
  <prefer>
    <family>Noto Mono</family>
    <family>Noto Color Emoji</family>
    <family>Noto Emoji</family>
    <family>DejaVu Sans Mono</family>
   </prefer>
 </alias>
</fontconfig>

" > /etc/fonts/local.conf
# 3 - update font cache via fc-cache
fc-cache
echo "Noto Emoji Font installed! You may need to restart applications like chrome. If chrome displays no symbols or no letters, your default font contains emojis."
echo "consider inconsolata regular"

```

The first part is to install the package `noto-fonts-emoji`. The parameter `--needed` is used to only download and install the package, if it's not already installed.
The second part is just creating a config file and saving it.
The third part with `fc-cache` is the refresh of the font cache.

I recommend `Inconsolata Nerd Font Mono Regular` or any other font without emojis as system font. If you see numbers as emojis in your Browser, it is likely that your current system font contains emojis itself (DejaVu is one example) and you need to switch to a different font so you get the colored emojis.

## Update 20.02.2020
There is a much easier way and I edited this post to contain the new information. Before there was a bit trial and error to find out the number for the font config file. With the new way, it's just one file.
Optimized way to iterate over the length in js loop?
Tags: discuss, javascript
Published: 2020-01-07 11:50:39

---
title: Optimized way to iterate over the length in js loop?
published: true
description: 
tags: #discuss #javascript
---

Which code is faster and optimized. Or it doesn't matter if we are not looping over larger data.

```js

 for (var i = 0; i < msg.stackTrace.length; ++i) {
   ...
 }

```

or

```js
var stackTraceLength = msg.stackTrace.length;
 for (var i = 0; i < stackTraceLength; ++i) {
  ....
 }

```
Power in tiny libraries
Tags: javascript, typescript, webdev, react
Published: 2020-01-07 11:48:03

---
title: Power in tiny libraries
published: true
description: Make your bundle smaller
tags: #javascript #typescript #webdev #react
cover_image: https://thepracticaldev.s3.amazonaws.com/i/puidxomi7adza5yv35q2.jpg
---

Hello there!

Weight of your client side bundle is very important for best user experience. Users do not like to wait. For this purpose I am interesting to find tiny analogs of most popular libraries. I know next ones:

* [react](https://github.com/facebook/react) => [preact](https://github.com/preactjs/preact)
* [redux](https://github.com/reduxjs/redux) => [storeon](https://github.com/storeon/storeon)
* [moment](https://github.com/moment/moment) => [dayjs](https://github.com/iamkun/dayjs)
* [react-intl](https://github.com/formatjs/react-intl) => [eo-locale](https://github.com/ibitcy/eo-locale)
* [react-router](https://github.com/ReactTraining/react-router) => [wouter](https://github.com/molefrog/wouter)
* [react-apollo](https://github.com/apollographql/react-apollo) => [urql](https://github.com/FormidableLabs/urql)

Do you know something else?
Work for 5 Years Consistently and Experience Success
Tags: success, productivity
Published: 2020-01-07 11:22:09

Hi Everyone,

This is Amit Mishra from Tryootech I must say that if you want to achieve something in your life then you have to do it for 5 years consistently.

Here I want to share my quick journey about how I started my online journey and enjoying my life working online.

I started my online journey in 2012 and it's been 8 years since I am working online.

Earlier I started my career as a software engineer in MNC where I was working on putty and network infrastructure later I shifter to the Digital Marketing world.

Now I am running 8 websites with one Youtube channel name Amit Mishra(Tryootech)and making money online.

I have joined this network to help people with some development skills which I acquired.

Love & Respect
Amit Mishra
Pros of Voice over internet protocol
Tags: voip
Published: 2020-01-07 11:12:21

-It supposes a significant saving of money in comparison to other proposals that realize their same function.

-It gives the possibility that not only two people can participate in communication, but many more. You can do “meetings” in a group.

-VoIP devices can be used anywhere in the world.

Cons of Voice over internet protocol
-You can present failures at some time during the communication, and that translates into cuts.

-It may happen that the connection does not reach one of the two parties.

Know More : https://www.computertechreviews.com/definition/voip/
Is 2021 the end of AngularJS?
Tags: angular, react, javascript, reactnative
Published: 2020-01-07 09:56:58

AngularJS is a JavaScript-based open-source front-end web framework mainly maintained by Google and by a community of people and corporations to deal with many of the challenges encountered in developing single-page applications. Angular is its successor and uses equivalent philosophies like declarative templates and dependency injection.

To develop web applications AngularJS is the stable framework and utilized by number of developer around the globe. The usage of Angular is also expanding faster than Angular JS and new releases have been introduced and are planned to release in upcoming years.

Currently there are number of developers are out there using AngularJS and it’s been complex task for everyone to perform immediate migration process.

In 2018, they announced that the major releases will be ceased after the release of AngularJS version 1.7. Currently it’s under LONG TERM SUPPORT (LTS) period so, there will not be any kind of new major releases. The team of Angular JS totally focus on publishing patch releases, 1.7.1, 1.7.2 etc. These release only include non-breaking change features and fixes to the framework. So their existing users do not have to face any security concern or other bug issues.

That means that there’ll be no more releases of AngularJS: so no more features. This does not denote that you must cease utilizing AngularJS: it will resume to work for you as it does now.

All AngularJS applications that work now will resume work in the future. AngularJS has not received many new features within the last year approximately. It is a very sophisticated and consistent product. As a consequence of that and the many projects using it in production, the vast majority of bugs have been identified and fixed. Therefore it’s unlikely that new bugs are going to be discovered during and after the LTS period. Nor does it mean that you simply must upgrade to Angular: indeed many projects will never upgrade; they simply work as they are and do not need to be modified to use Angular. If you’re actively developing your application, and you identify that AngularJS won’t support your current or future requirements then that might be a honest time to consider upgrading to Angular.

If you’re planning to migrate from AngularJS, kindly contact Vibidsoft as they have in-house team of expertise who can help you to do so. You can shoot an email to inquiry@vibidsoft.com
Cloud Computing Course in Chandigarh
Tags: cloudcomputing
Published: 2020-01-07 09:55:09

Are you want learn Cloud Computing Course in Chandigarh and want be a Cloud Developer..?? The definition of Cloud Computing is a service provider, it provide you a software as service (SAAS), any platform as service (PAAS) like operating systems, applications, and coding platforms, It also provides infrastructure as service (IAAS) for examples virtual machines, servers etc.

Know more about Institute and Course please Visit on link:
http://techedo.com/cloud-computing-courses-chandigarh.php
Why Developers like Terraform? 6 Reasons to Know
Tags: devops, devopstools, terraform
Published: 2020-01-07 09:49:46

---
title: Why Developers like Terraform? 6 Reasons to Know
published: true
description: These are the reasons to consider Terraform as one of your DevOps tools
tags: devops, devops tools, terraform
---
The goal of DevOps is to perform software delivery more efficiently, and we need some tools to make this delivery quickly and efficiently, this is where the tools like Terraform help companies with infrastructure as code and automation.

[Terraform](https://www.terraform.io/) is revolutionizing the DevOps world by transforming the way infrastructure is managed, and making it faster and more efficient to execute DevOps. You might have used technologies like Ansible, Chef, or Puppet to automate and provisioning of software, Terraform starts from the same law, infrastructure as code, but focuses on the automation of the infrastructure itself. Your whole Cloud infrastructure (instances, volumes, networking, IPs) can be easily defined in Terraform.

### Let us see the reasons to consider Terraform as one of your DevOps tools,
* Terraform lets you define infrastructure in config/code and will enable you to rebuild/change and track changes to infrastructure with ease. Terraform provides a high-level description of infrastructure.

* Terraform is the only sophisticated tool that is completely platform agnostic as well as supports other services while there are a few alternatives, but they are focused on a single cloud provider.

* Terraform enables you to implement all kinds of coding principles like having your code in source control, the ability to write automated tests, etc

* Terraform is the right tool for infrastructure management as many other tools have a severe impedance mismatch from trying to wrangle an API designed for configuring management to control an infrastructure environment. Instead, Terraform matches correctly with what you want to do- the API aligns with the way you think about infrastructure.

* Terraform has a lively community and is open source, there is a massive community developing around this tool. Many people are already using it, and it’s easier to find people who know how to use it, plugins, extensions, professional support, etc. This also means Terraform is evolving at a much faster rate. They do releases very often.

* Terraform’s speed and operations are exceptional. One cool thing about Terraform is, it’s plan command lets you see what changes you’re about to apply before you apply them. Code reuse feature and Terraform tends to make most changes faster than similar tools like CloudFormation.

Use Terraform to Easily Manage Your [Artifactory Infrastructure](https://jfrog.com/blog/use-terraform-to-easily-manage-your-artifactory-infrastructure/)


What is your take on this tool? 
Let me know if you have any other reasons to use Terraform that I have not mentioned on the list.
html{font-size:?} Responsive Magic
Tags: codepen, html, css, tutorial
Published: 2020-01-07 09:24:47

###**Today i am going to show you why do i use**

```css
html {
  font-size: 62.5%;
}
```

####**and why i think you should use it too.**

The reason i am giving font size property to html is because it gives so much practicability to your code for further approaches. For example let's take this pen here:

{% codepen https://codepen.io/batuhangulgor/pen/VwYmxXe %}

There are still so many junior developers that are just changing the values of paddings, margins and the way layout is shown. But there is another important thing to change when you are writing the **Media Queries**, **which is font size**.

To make life easier you have to use **rem** whenever you give a font-size property unless it is a special text etc. Default value is defined as 1 **rem** = 16 **px**.
To make it down to 10 **px** and for the sake of doing calculations easier we are giving font-size: 62.5%. It can be calculated like if 16 **px** is 100% of the font size, 62.5% equals to 10 **px**. After making it so we can give any value to font-size as we desire while writing **Media Queries**. 

As you can see in the pen i wrote earlier, i scale the font-size down to 50% if it hits the screen width of 380 **px**. And all the fonts just fit perfectly like i wanted to.

```css
@media only screen and (max-width: 380px){
    
    html{
        font-size: 50%;
    }
}
```

If you want you can also give **rem** to margins, paddings, widths actually anything can have the **px** value. As the font size scales down or up with the query you write, same thing happens to any element which includes **px** value too. With the power of this magic you can set these properties between your elements(sections, list items etc.) and let the one line of **Media Query** code do the job for you. But for sometimes you can't get the perfect vision you want. If that happens to you just writing a couple lines of code can make it instead of writing different values for all the elements you have.

This is what i know and what i can give to you. If there is something i am missing please leave a comment.

That's all people, thanks for reserving your *precious* time to me. **Love** y'all <3
DevOps Pre-Requisite Course for Developers
Tags: devops, beginners
Published: 2020-01-07 09:18:53

[This course](https://www.udemy.com/course/learn-devops/) is a must for those starting their journey into the DevOps and the Cloud world. Most of the Cloud and DevOps courses out there require a person to know some basic concepts such as a basic web application, deploying a lab environment using VirtualBox or on cloud platforms like AWS or GCP. 

![DevOps for beginners](https://thepracticaldev.s3.amazonaws.com/i/nd7wbnb8m5rfe5vg2xeh.png)
Change Atlassian Bitbucket Home Directory
Tags: bitbucket, atlassian, configuration
Published: 2020-01-07 09:16:57

---
title: Change Atlassian Bitbucket Home Directory
published: true
description: How to change the Bitbucket home directory
tags: Bitbucket, Atlassian, configuration
---

In this article i will go thru the steps to change the home directory of an Bitbucket on prem installation (Atlassian Bitbucket Server) installed on Windows Server.

After the installation, the home directory is at c:\Atlassian\ApplicationData\Bitbucket. To keep things clean, we wanted to have the home directory (this is where the repositories are put) on an extra drive (E:\ in our case). 
The Atlassian documentation describes this step as easy, you must only change the HOME_DIR env variable in the .bat file or set the environment variable. But none of theses are working.

I found an answer in the atlassian forum, which worked as expected:

The Atlassian Bitbucket program dir is, in my case, at C:\Atlassian\Bitbucket\6.9.0\bin. In this folder, there is the server management executable "bservmgr.exe".

On the commandline (cmd), you can start this tool with the "//ES/AtlassianBitbucket" parameter, to start the java properties window:

![](https://github.com/mprattinger/DevToPosts/raw/master/bitbucket_home/cmd.png)

![](https://github.com/mprattinger/DevToPosts/raw/master/bitbucket_home/java_prop1.png)

In this window, you must click on "Java" Tab. On this tab under "Java Options" you have to change the value of -Dbitbucket.home=... to the value you want. In my case to -Dbitbucket.home=E:\Bitbucket.

![](https://github.com/mprattinger/DevToPosts/raw/master/bitbucket_home/java_prop2.png)

You can close this window by clicking on ok. After a server restart, the home directory of the Atlassian Bitbucket server is now E:\Bitbucket.

>I based this blog post on an bitbucket support post: [Change BITBUCKET_HOME when installed as a Windows service](https://confluence.atlassian.com/bitbucketserverkb/change-bitbucket_home-when-installed-as-a-windows-service-779171532.html)
My hackoctoberfest gifts has arrived
Tags: hacktoberfest
Published: 2020-01-07 08:58:54

---
title: My hackoctoberfest gifts has arrived
published: true
description: Finally, i received my hackoctoberfest gifts
tags: hacktoberfest
---

![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/5hj674bztqr2fmoluarz.jpg)

It was taking for so long, but i had it finally.

The Kotis Design didnt included my phone number, the delivery guy couldn't contact me. I have to follow the trackingId of DHL into the local delivery VNPost
and contact them to add my phone number.

Thanks Digital Ocean and DevTo


P/S: I'm waiting for the gift from dev.to
WordPress Dashboard
Tags: wordpress, career
Published: 2020-01-07 08:45:00


- Home: Home is where you are now. It is the default page for the WordPress dashboard.
- Updates: WordPress has frequent updates in the core software along with the themes and plugins. You can check the available updates and operate if available.
- Posts: You can add general posts or blog articles from here. Most of the content on your WordPress website are posts.  Additionally, add post tags and categories from there.
- Pages: You can add pages like ‘Home’, ‘Contact Us’, ‘About’ etc. from there.
- Comments: All the comments from the site users will be available here.
- Appearance: Appearance in the WordPress dashboard is the vital menu. You can make complete control the design of the website via this menu. It includes themes, Customize, widgets, menus, header and CSS editor.
- Plugins: Plugins are the handy tools for adding functionality. You can see the installed plugins and also add new plugins via this menu.
- Users: WordPress supports multiple users. You can manage all the website users from this menu.
- Tools: By default, it has ‘import’ and ‘export’ tool in this menu.
- Settings: Another very important section in the WordPress dashboard is ‘Settings’. You can see all the site configuration options here as general settings, writing, reading, discussion, media, and permalinks.
- Collapse menu: Well you can collapse the menu if you want to have the full-width for managing content.
Collab Lab Week 4 - Monday
Tags: collablab, career
Published: 2020-01-07 07:35:35

Week four and I'm back to my first partner from week one, Mike. Mike was on it with getting our [wiki page](https://github.com/the-collab-lab/tcl-3-smart-shopping-list/wiki/(W4)-Nikema-and-Mike-(Check-Input-Values-if-there-are-Duplicates-in-Database)) started and assigning the both of us to the issue we agreed to work on this week.

We met today to talk about the user story and plan the work for this week. I asked a question about product management earlier in Slack and Mike gave me some insight from his previous career experience.

We talked a lot about what it takes to be a recruiter (a possible career path for me) and also things to keep in mind when interviewing for a job. What to say when an interviewer asks for questions (ask for feedback so that you learn from the experience) and how to approach people with cold emails and networking.

What I appreciate about our meeting today is that it went off-track from the project with our career talk but we still ended up with a plan and assigned tasks. I love that everyone on the team has a unique perspective that I can learn from. I feel like I contribute as much as I receive. It's a great group of people to work with.

Mike created the wiki this week, so I opened the pull request and created our feature branch. I learned about [draft pull requests](https://github.blog/2019-02-14-introducing-draft-pull-requests/) through The Collab Lab and created my [first one](https://github.com/the-collab-lab/tcl-3-smart-shopping-list/pull/53) today.

****
Bonus: I thought this Twitter thread by Sam Altman was insightful
{% twitter 1214274038933020672 %}
How to create a CLI in golang with cobra
Tags: go, cli, cobra, tutorial
Published: 2020-01-07 08:38:40

Ever wanted to create your own cli.

Check out my article published on Medium.

[Article Link](https://towardsdatascience.com/how-to-create-a-cli-in-golang-with-cobra-d729641c7177)

[Shubham Chadokar](https://github.com/schadokar)