teleren/devto huggingface dataset:
Identifiers in Kotlin
Tags: kotlin, todayilearned, beginners, codenewbie
Published: 2019-07-12 17:55:23

* Identifiers are the name given to objects, variables, classes, and functions, etc. For example: var age = 45

* Here `var` is a keyword and age is the name given to variable.

##Rules for naming identifiers
---
There are five rules which are applied to naming identifiers.

* **Identifiers can contain letters, underscore, and digits. But must not start with a digit.**
```
var 1userBalance = 2500  // Identifier cannot start with numbers.
var $dollar = 60  // Identifiers cannot contain special symbols.
```
* **Whitespaces are not allowed.**
```
var High Score  // Identifiers cannot contain whitespaces.
```
* **Special symbols are not allowed except underscore.**
```
($, #, ?, <>, ~, ! Not allowed)
```
* **Identifiers are case sensitive.**
```
var HighScore or highScore // both highscores are different here.
```
* **In kotlin, a hard keyword cannot be used as identifiers.**
```
var class  // hard keywords cannot be used as identifiers.
```

* When creating variables, classes, objects or functions, choose a name that makes sense. For example score, number, levels, userData makes more sense then variable name such as a, b, c. Although they are valid.

###Camel Casing

* Camel casing is a naming pattern, mostly used in naming programming.

* There are two types of camel casing:
1. Upper camel case
2. Lower camel case

* Use camel casing naming method is always recommended in programming.

* **Upper camel case —** In upper camel case, the first letter of the new word is upper case, allowing it to be easily distinguished from a lower case.
```
var HighScore = 250   //Example of upper camel case.
```

* **Lower camel case —** In Lower camel case, the first letter of the first name is the lower case then after every new word will be upper case, allowing it to easily distinguished from an upper case.
```
var highScore = 250   //Example of lower camel case.
```

###What is WhiteSpaces?
---
* In computer programming, white space is any character or series of character that represents horizontal or vertical space in typography.

```
var high Score = 250   //Compile time error. Whitespace not allowed.
```

* Space bar, tab and enter button mostly used to insert whitespaces.

* Remember most of the compilers don’t allow whitespaces. So avoid them as much as possible in your programs.

Jai Hind, Vande Mataram 🇮🇳

Wanna get in touch with me? Here are links. I’ll love to become your friend. 😊

- [My Site] (https://www.jaytillu.in)
- [My Blogs] (https://blogs.jaytillu.in)
- [Twitter](https://twitter.com/jay_tillu)
- [Facebook](https://www.facebook.com/jaytillu.1314/)
- [Instagram](https://www.facebook.com/jaytillu.1314/)
- [Medium](https://medium.com/jay-tillu)
- [LinkedIn](https://www.linkedin.com/in/jaytillu/)
- [Github](https://www.github.com/jay-tillu)
- [Stack overflow](https://stackoverflow.com/users/8509590/jay-tillu)
or just mail me at jd.tillu@gmail.com
What did you learn this week? July 12, 2019
Tags: twil, todayilearned, discuss
Published: 2019-07-12 17:53:05

---
title: What did you learn this week? July 12, 2019
published: true
description: A TWIL discussion
tags: twil, til, discuss, todayilearned
---


# What did y'all learn this week?
Daily Challenge #14 - Square into Squares
Tags: challenge
Published: 2019-07-12 17:36:29

---
title: Daily Challenge #14 - Square into Squares
published: true
series: Daily Challenge
description: The week 2 finale, day 14 brings a difficult exponential challenge!
tags: challenge
---
Good morning, all. 

This challenge finishes our second week of the Daily Challenge series. It'll be our most difficult challenge yet!

We are grateful to user g964, who posted this challenge and many others on [CodeWars](https://www.codewars.com/kata/54eb33e5bc1a25440d000891).

>Given a positive integer `n`, return a strictly increasing sequence of numbers so that the sum of the squares is equal to n².

>If there are multiple solutions, return the result with the largest possible value:

>For example: `decompose(11)` must return `[1,2,4,10]`. 

>*Note:* there are actually two ways to decompose `11², 11² = 121 = 1 + 4 + 16 + 100 = 1² + 2² + 4² + 10²` but you shouldn't return `[2,6,9]`, since 9 is smaller than 10.

>*Hint*: Very often will `xk` be `n-1`. 

Good luck and happy coding!
***
_Thank you to [CodeWars](<https://codewars.com/>), who has licensed redistribution of this challenge under the [2-Clause BSD License](<https://opensource.org/licenses/BSD-2-Clause>)!_
What are your favorite visual design inspiration sources?
Tags: discuss, webdev, design, css
Published: 2019-07-12 17:28:00

Webdesign or interface design in general, do you have any favorite places you go back to for help with this whole "make it look good" part of making things? (If you're tasked to do that)

I brought this up in another thread:

{% link https://dev.to/nanythery/do-you-struggle-with-design-too-e32 %}

But felt like it's worth its own question. Feel free to drop a comment in Nadine's thread as well. 😄
Hello World in Kotlin
Tags: kotlin, beginners, todayilearned, codenewbie
Published: 2019-07-12 17:26:01

***Hello World*** is an introductional program in every language. Usually, it is the best way to introduce to the language. It shows the basics of the language like its syntax, basic working, and functionalities, etc. Here I just show you Hello World in kotlin.

```
fun main(args: Array<String>) {
    print("Hello World")
}
```
* **`fun main (args: Array<String>) {…}`** — This is a `main` function, which is mandatory in every kotlin application. The compiler starts execution from `main` function. You can also call it as **Entry Point of Every Kotlin Program.** This function takes an array of string as arguments.

* **`fun`** — `fun` is a keyword, used to show that this is a function. In this case, `main` is a function.

* **`print ()`** — The `print()` function is an inbuilt function that prints the value inside it. You can print values, calculation’s results, etc.

* **`println ()`** — The `println()` function also works same as print() but it also prints a newline after the output. So if you have the next output then it will go to the next line. If nothing has to print it will print a blank line. Many legacy languages like C and C++ miss this function, in those languages we still walk with `\n`, although it's really handy and useful.

* As you can guess, the semicolon is optional. The compiler is smart enough to understand that newline is the end of the statement.

So, guys, that’s it for Hello World. Feel free to ask for any queries.

Till then Keep Coding, Keep Loving.

Jai Hind, Vande Mataram 🇮🇳

Wanna get in touch with me? Here are links. I’ll love to become your friend. 😊

- [My Site] (https://www.jaytillu.in)
- [My Blogs] (https://blogs.jaytillu.in)
- [Twitter](https://twitter.com/jay_tillu)
- [Facebook](https://www.facebook.com/jaytillu.1314/)
- [Instagram](https://www.facebook.com/jaytillu.1314/)
- [Medium](https://medium.com/jay-tillu)
- [LinkedIn](https://www.linkedin.com/in/jaytillu/)
- [Github](https://www.github.com/jay-tillu)
- [Stack overflow](https://stackoverflow.com/users/8509590/jay-tillu)
or just mail me at jd.tillu@gmail.com
Traveling Salesman Problem 
Tags: maths, algorithms, todayilearned
Published: 2019-07-12 17:25:39

A couple of weeks ago, I heard about a mathematical problem, which is unsolvable. It peaked my interest. I researched about it and here's what I found out. This blog post is dedicated to all the math nerds out there.

Since the Renaissance, every century has seen the solution of more mathematical problems than the century before, yet many mathematical problems, both major and minor, still remain unsolved. Traveling salesman problem is one of those classic algorithm problems from the class of `hard` optimisation problems, which has been marked as `unsolvable` for over two centuries.
 
- Problem Statement 📜

Given a n number of cities, what is the most efficient route you can take to visit each city and come back where you started

- Sounds simple, why is it unsolvable 🤔

It sounds so easy, especially if you're working with computers. all you gotta do is check the distance of every round trip and shortest one is your answer. If you have `n` cities, you will have `(n-1)!` possibilities. We only count half since each route has an equal route in reverse with the same length or cost. so it's `(n-1)!/2`. So there you go! we cracked it?

> Well that is not good enough. For obvious reasons, that way of solving the problem is known as the naive solution.

- The big WHY??

Throughout the years, scientists have come up with newer algorithms to solve the problem. In the early days of computer science, people figured out solutions to scenarios involving a specific number of cities, but a way to solve every traveling salesman problem with a single algorithm (that is, a single list of rules a computer can follow to find the solution) still remains hard to achieve. In the 1970s, mathematician Richard Karp published a [paper](https://people.eecs.berkeley.edu/~luca/cs172/karp.pdf) that suggested we might never find the solution. He showed that the problem is [NP-hard](https://simple.wikipedia.org/wiki/NP-hardness), which means that there will never be an algorithm to solve it 😲



Photo by Charles Forerunner on Unsplash
How Kotlin provides 100% interoperability with Java?
Tags: kotlin, java, android, beginners
Published: 2019-07-12 17:11:34

>***“Kotlin is 100% interoperable with java”***

When you first searched about Kotlin in every blog post, community talk or on YouTube as well, if the talk is about Kotlin then this term is definitely on everyone’s list that Kotlin is 100% interoperable with java.

Let’s see what that means and how things internally work.

>***Interoperability means the ability of Computer System or software to exchange and make use of information. The same concept applies for programming languages, means the ability of two languages for communicating and sharing information with each other such as functions, classes, and other data.***

Kotlin is 100% interoperable with java means whenever two java and kotlin files exist together they can share data with each other.

While designing interoperability in kotlin, JetBrains makes major emphasis on Kotlin’s interaction with existing Java code. The team makes sure that kotlin can easily and completely interact with existing Java code. So that it can become easy for Java developers to migrate their Java project to Kotlin. There is also an automatic java-to-Kotlin converter in major IDEs for simplifies migration from Java to Kotlin.

##How Does Interoperability work behind the scenes?
---
As we all know Kotlin is JVM based language just like Java. So just like Java’s compiler, Kotlin compiler also creates a byte code and that byte code can run on JVM. Which is exactly equivalent to the byte code which is generated by Java compiler.

Whenever two-byte code files run on JVM, due to their equivalent nature they can communicate with each other and that’s how interoperability is established in kotlin for Java. And makes Kotlin 100% interoperable with Java.

So, guys, this is all about Kotlin’s interoperability.

Please let me know if I missed something. Till then Keep Coding, Keep Loving.

Jai Hind, Vande Mataram 🇮🇳

Wanna get in touch with me? Here are links. I’ll love to become your friend. 😊

- [My Site] (https://www.jaytillu.in)
- [My Blogs] (https://blogs.jaytillu.in)
- [Twitter](https://twitter.com/jay_tillu)
- [Facebook](https://www.facebook.com/jaytillu.1314/)
- [Instagram](https://www.facebook.com/jaytillu.1314/)
- [Medium](https://medium.com/jay-tillu)
- [LinkedIn](https://www.linkedin.com/in/jaytillu/)
- [Github](https://www.github.com/jay-tillu)
- [Stack overflow](https://stackoverflow.com/users/8509590/jay-tillu)
or just mail me at jd.tillu@gmail.com
Do you struggle with design too?
Tags: frontend, discuss, design
Published: 2019-07-12 17:10:19

Since I've started coding, I found the design decisions the hardest part of the job.  I mean, of course, you struggle with your code. You may have eventually come up with a great app or webapp... but then you go to your localhost:3000 and a sad, bad aligned website looks back at you. I feel like when you do not master design, then the hard work is just not appreciated in the same way.

I love struggling with how to make something look what I want it to. But I just have not developed yet any talent for making a good design.
What I talk about when I talk about good design? You know:
* Something that doesn't look like from the 90s
* Nice, clean, tidy design.
* Attention grabbers where they must be
* Armonious, yet original colour combinations.
* That feeling like every element is just where it belongs!

I find myself more comfortable among lines of code, but I am sure it is because I don't feel confident enough to make good designs from my own. But hey, I also think that professional designers are really a valuable asset and maybe is not really "my duty" to make a stunning design? Not sure about this. What do you think?

##How do you supply the lack of creativity or just good eye? Feel free to share tips and resources. 

P/S: Graphic Designers, I really think you are all so cool...
What was your win this week?
Tags: discuss, weeklyretro
Published: 2019-07-12 17:01:20

---
title: What was your win this week?
published: true
description: Got to all your meetings on time? Started a new project? Fixed a tricky bug?
tags: discuss, weeklyretro
cover_image: https://cl.ly/188e843c2985/download/Image%202019-02-15%20at%202.36.37%20PM.png
---

👋👋👋👋

I'm back!! Sorry we missed last week, but hopefully this means we're reflecting on two weeks worth of wins!

What's something you're proud of?

All wins count -- big or small 🎉

Examples of 'wins' include:

- Getting a promotion!
- Starting a new project
- Fixing a tricky bug
- Cleaning your house...or whatever else that may spark joy 😄

Happy Friday!
Why are paywalls so weak?
Tags: discuss, help
Published: 2019-07-12 16:29:06

As part of my day job I've been investigating (soft) paywall implementation. 

As I poke at various influential sites I'm finding all of them are _very_ soft. When a user is logged out, they all seem to be using localStorage with simple integer counters, or sometimes json with a record of the articles read. 

Obviously there are serious technical, privacy and (possibly) legal challenges to tracking logged out users. And I would never want sites to implement something like that.

But why don't more site force user login immediately? 

With tracking limited to localStorage, users can bypass the wall by switching to incognito, switching browser or clearing cache; and often these steps are less onerous than actually signing up for an account. 

Why don't publisher care?
On Glitch This Week
Tags: glitch, glitchthisweek, showdev
Published: 2019-07-12 16:12:56

---
title: On Glitch This Week
published: true
canonical_url: https://glitch.com/@glitch/glitch-this-week-july-10-2019
series: Glitch This Week
cover_image: https://cdn.glitch.com/0aa2fffe-82eb-4b72-a5e9-444d4b7ce805%2Ftwog-aug-17DevTo.jpg?v=1562947738709
description: Just a few projects that caught our eye this week on Glitch (July 10, 2019).
tags: glitch,glitchthisweek,showdev
---

Glitch This Week is a regular series in which we round-up just some of the amazing projects that fantastic creators have made on [Glitch](https://glitch.com/). Here are a few projects that caught our eye this week.

## [Mix up Synthier Things 🎛️](https://glitch.com/~synthier-things)

With the recent release of the third installment of Stranger Things, you might be inspired to try out [Eric Wood](https://glitch.com/@eric-wood)'s "[synthier-things](https://glitch.com/~synthier-things)" - a web synth that can only play the Stranger Things theme. The synth is made up of a handful of off the shelf web audio components. You can play about with the arpeggiator, oscillator, filter, and attenuator to distort those iconic 80s inspired electronic arpeggios to your heart's content.

{% glitch synthier-things app %}


## [Pick Your Fave Queen 💅🏽](https://glitch.com/~favorite-queen)

If like [Keith Kurson](https://glitch.com/@cute), you're a fan of RuPaul's Drag Race then you might enjoy "[favorite-queen](https://glitch.com/~favorite-queen)." Choose your favorite queen from each of the seasons of RPDR, and share your picks on social to see if your friends agree. Choices indeed.

{% glitch favorite-queen app %}


## [Doodle in the Depths 🐙](https://glitch.com/~shadowy-depths)

[Rowan Merewood](https://glitch.com/@rowan-m)'s "[shadowy-depths](https://glitch.com/~shadowy-depths)" is a CSS doodle with a Day of the Tentacle vibe. If you've ever spent time working with the Shadow DOM, I think you can relate.

{% user rowan_m %}
{% glitch shadowy-depths app %}

Other apps in [this week's round-up](https://glitch.com/@glitch/glitch-this-week-july-10-2019) include a map of reduplicated place names in Australia, a pumped-up audio visualizer, and a WebVR sketch taken directly from a notepad. [Check them out](https://glitch.com/@glitch/glitch-this-week-july-10-2019)!
My first interview experience
Tags: webdev, javascript, html, css
Published: 2019-07-12 15:35:45

After almost like months I finally built up courage to apply even though I am too far from being industry fit. I saw a post about a startup who were the only one willing to hire people with almost basic problem solving skills and know about basic coding.Here were my key mistakes:
1. I had unrealistically high expectations from myself
2. I got nervous and forgot my basics e.g could not tell the difference between HTML tags and attributes
3. I proposed an unrealistic salary expectation for an intern
4. I came off as not confident enough and unprepared even though I literally had no sleep the night before preparing

Lessons learned:
1. No matter how much you know practice controlling your nerves

2. Research as much as you can about industry before going for the interview

3. Have realistic expectations regarding salary 

4. Learn to tackle questions about your lacking and find a way to convince them that you can overcome them.

The interviewers were very helpful and understanding but I could see the disappointment in their body language near the end. I guess this opportunity wasn't meant for me in the end but I am glad had the experience and hope to land my dream job soon.
VSCode Tasks - Specifying custom PATH
Tags: vscode, tasks, zsh, path
Published: 2019-07-12 15:26:35

---
title: VSCode Tasks - Specifying custom PATH
published: true
description: 
tags: vscode, tasks, zsh, path
---

macOS Catalina opts for zsh as the default shell in place of bash. 
This shift had me running into a weird issue with my custom VSCode Tasks where the tasks were throwing a `zsh:1: command not found` error.

I set default login shell to zsh for my macOS user and set up VSCode to use zsh as the default shell for integrated terminal.

Tried adding `export PATH=$PATH:<mypath>` to my `~/.zshrc` but that didnt help either.

Ultimately I ended up specifying the PATH as a custom env variable in the VSCode task options

```
"tasks": [
    {
        "label": "Project Name",
        "type": "shell",
        "command": "appc ti project id -o text --no-banner",
        "options": {
            "env": {
                "PATH": "<mypath>:${env:PATH}"
            }
        }
    }
]
```
Understanding JS Ternary Operators
Tags: javascript, tutorial, webdev
Published: 2019-07-12 15:09:39

As a beginner dev, seeing code like this can be a tad bit, well, overwhelming.

`let person = {
  name: 'John',
  age: 25,
  legal: null
};`

`person.legal = person.age >= 21 ? 'Yes' : 'No';`


![overwhelmed](https://media.giphy.com/media/oubM1tKqnLW5G/giphy.gif)

Not to worry! Conditional (Ternary) Operators can be easy to use and will simplify your code, even if it's just a little bit. 

###What do Ternary Operators represent?

Ternary Operators are used as a shorthand for `if else` statements. `if else` statements check a condition and usually have this syntax:

`if (condition) {
  value if true;
} else {
  value if false;
}`

So, if I wanted to determine whether the above person was above the legal US age for drinking I could write an `if else` statement like so.

`if (person.age >= 21) {
  person.legal = 'Yes';
else {
  person.legal = 'No';
}`

In the example above I'm able to determine whether the person is legal and assign a value to `person.legal`. But we can also accomplish this by using the ternary operator! Below is the syntax:

`condition ? value if true : value if false`

Instead of using an `if else` statement let's return the the first example given.

`person.legal = person.age >= 21 ? 'Yes' : 'No'`

Here I'm assigning `person.legal` to be either Yes or No by checking their age. If `person.age >= 21` then Yes is returned. Otherwise `person.legal` is set to No.


###Things to know

- The condition is what's being tested, whether it be an `if else` statement or ternary operator.
- A `?` separates the condition from the true value. Anything after the `?` and the before the `:` is what is executed if the condition is true.
- If the condition evaluates to false, any code after the colon is executed.

In conclusion, I appreciate you reading this and hope that you can now use ternary operators! Besides experience, I got most of my information from [this awesome article](https://codeburst.io/javascript-the-conditional-ternary-operator-explained-cac7218beeff) which goes on to explain advanced ternary operators such as Nested Ternary and Multiple Ternary.
How to Beautify Dev.to
Tags: ux, design, chrome, extension
Published: 2019-07-12 14:24:56

This is my first article on dev.to. I've developed one Chrome extension to beautify dev.to site. 

The reasons to select this site are
1. I don't like the current design.
2. I wanted to learn how to create chrome extension
3. How extension works Generally in browser.

Here are some screenshots:

<blockquote class="imgur-embed-pub" lang="en" data-id="a/1SIZAJn"  ><a href="//imgur.com/a/1SIZAJn">Beautify Dev.to extension ss</a></blockquote>

Note: This extension is still under development. Please give your suggestions to improve it.