teleren/devto huggingface dataset:
Converting names in C to Java
Tags: c, java, tutorial
Published: 2020-07-31 12:39:37

The x11 protocol is described in several xml files in the [xcb](https://cgit.freedesktop.org/xcb/proto/tree/src) project. These files define structures used in the C client. Each struct contains types and variable names. The variable names have two problems in java.

* do not follow the lower camel case convention
* start with invalid characters (numbers)

When converting these names to java I wanted to find an existing solution that could do this quickly. One benefit of java is that so many problems have already been solved by one library or another. I came across two projects that helped me solve these issues.

```groovy
implementation group: 'com.google.guava', name: 'guava', version: '29.0-jre'
implementation 'pl.allegro.finance:tradukisto:1.8.0'
```

[Guava](https://github.com/google/guava) contains the class `CaseFormat` which is able to convert between java and c style naming conventions. To convert from c to java:

```
String converted =  CaseFormat.LOWER_UNDERSCORE.to(CaseFormat.LOWER_CAMEL, x11Name)
```

This works for the majority of names but some of the enum items in the protocol start with a number.

```xml
    <enum name="PropertyFormat">
        <item name="8Bits">  <value>8</value> </item>
        <item name="16Bits"> <value>16</value> </item>
        <item name="32Bits"> <value>32</value> </item>
    </enum>
```

To convert these names [tradukisto](https://github.com/allegro/tradukisto) can be used to first convert the number to words. Then the rest of the name can be appended.

```groovy
        String startNumbers = x11Name.find('^\\d+')
        if(startNumbers) {
            String remainingString = x11Name.substring(startNumbers.length())
            String numberWords = ValueConverters.ENGLISH_INTEGER.asWords(startNumbers.toInteger())
                .replace('-', ' ')
                .split(' ').collect{ it.capitalize() }.join('')
            return numberWords + remainingString
        }
```

With [Guava](https://github.com/google/guava) and [tradukisto](https://github.com/allegro/tradukisto) I am able to easily convert c variable names to java variable names.
Sasa Juric on Static Typing and Beam Languages
Tags: elixir, gleam, erlang
Published: 2020-07-31 14:03:41

In an excerpt from the upcoming Book Club Episode, Sasa Juric shares his opinion about static typing in BEAM languages.
"In my view, the lack of static typing is the biggest deficiency in BEAM languages. I know that there are like camps dynamic versus static. I've personally done both for like many, many years. For the past 15 years, I've been mostly using dynamic languages. I'm now pretty much certain to say that I believe that static is definitely a better option. I still love Erlang and Elixir. "

He is excited about new initiatives around including static typing in the BEAM ecosystem like Alpaca and Gleam.

[![Static Languages BEAM](http://img.youtube.com/vi/0YxM8zMWHe4/0.jpg)](http://www.youtube.com/watch?v=0YxM8zMWHe4)
Random Variables: A Glimpse
Tags: datascience, statistics
Published: 2020-07-31 14:02:52

So, what are actually random variables?

In statistics, a random variable is a variable whose outcome is based on some random phenomenon.

These random variables are classified into discrete random variables and continuous random variables.

Discrete Random Variables:- They are the random variables which take up a finite number of values. It usually takes up a whole number value.

![Discrete Random Variable](https://dev-to-uploads.s3.amazonaws.com/i/o0sa4cj6pmlhb1loa6jh.png)

Let’s consider an example.

Suppose we are tossing 3 unbiased coins. The sample space ‘S’, i.e. the whole set of outcome possibilities is;

**S={HHH,HHT,HTH,THH,HTT,THT,TTH,TTT}**, where *H* denotes head and *T* denotes tail.

So if we check the possible number of heads in each toss, the random variable ‘X’ can be denoted as;

**X={0,1,2,3}**

Here we can see that the random variable takes up the values 0,1,2,3 which are discrete values.

Continuous Random Variable:- A random variable becomes a continuous random variable if it takes up any number of values inside a particular interval.

![Continuous Random Variable](https://dev-to-uploads.s3.amazonaws.com/i/1fnf15sxx6iv91uixns7.png)


For example; suppose we consider the weights of students in a school. The weights may vary over a range and if we consider a particular range inside the whole set, the random variables will take up any value (indefinite number of values). Hence there is no discrete observation in a continuous random variable.

So that’s it about random variables.
Making Sense of Syntax
Tags: javascript, webdev, beginners, productivity
Published: 2020-07-31 13:52:57

---
title: Making Sense of Syntax
published: true
description: I came across a bit of syntax I hadn't seen before. Figured I'd write a post as I explore what it means.
tags: javascript, webdev, beginners, productivity
cover_image: https://dev-to-uploads.s3.amazonaws.com/i/ansd9e8aieobc3m87jkq.png
canonical_url: https://laurieontech.com/posts/bang-bang
---

I was reviewing a bit of code the other day and came across a set of syntax I hadn't seen before. It looked like this:

```javascript
!!{...obj, ...obj2}.item
```

There are pieces of this code I recognize. But all together? Not so much.

## Object Spread

If we go by order of operations the first thing we need to look at is the spread piece of this expression.

```javascript
{...obj, ...obj2}
```

Luckily I've written [that post](https://dev.to/laurieontech/5-uses-for-the-spread-operator-b9i) before. It's taking two objects and creating a single object with all the unique key value pairs between them. 

## What comes next?

This was the first thing I needed to figure out. I was pretty confident the next piece of syntax to execute was the `.item` selector, but I wasn't positive.

Turns out that is correct. Since the result of our spread expression is an object, we're accessing the value of the `item` key in that object.

To break it down we can write it this way.

```javascript
const newObj = {...obj, ...obj2}
const item = newObj.item
```

## Bang Bang

This may be the most unfamiliar bit of syntax. `!` means NOT in JavaScript, but was does `!!` mean? It actually means NOT NOT. It's guaranteeing that the result of the expression is always `true` or `false`.

I found [this article](https://www.sitepoint.com/javascript-double-negation-trick-trouble/) to be the best explanation but I'll try to summarize here.

In JavaScript we have falsy values and truthy values. `null`, for example, is falsy. That means this statement is true.

```javascript
!null === true
```

If we add another `!` we discover the expression is equivalent to `false`.

```javascript
!!null === false
```

So `!!` is telling us whether our expression is truthy or falsy.

## All together

Let's look at our original example.


```javascript
!!{...obj, ...obj2}.item
```
If we break it down it's doing this.

```javascript
const newObj = {...obj, ...obj2}
const item = newObj.item
if (item) {
    return true
} else {
    return false
}
```

The result depends entirely on our objects. Let's look at two options.


Example 1:
```javascript
const obj = {
    item: null
}
const obj2 = {
    key: "thing"
}
```

In this case, the expression is `false`, because `null` is falsy.

Example 2:
```javascript
const obj = {
    key: false
}
const obj2 = {
    item: "some value"
}
```

In this example, the expression is `true`!  `"some value"` is truthy.

## Pretty cool

What do you think? Not sure how often I'd use it, but it's a neat bit of code. Allows us to look through a number of objects and determine if we have a legitimate value for a particular key.
🚨Back-end Developer na Oli Saúde🚨

Tags: php, python, go
Published: 2020-07-31 13:03:51

O [Oli Saúde](https://olisaude.com.br/?utm_source=dev-to&utm_medium=listing_post&utm_campaign=vaga_back_end) é uma **healthtech que usa dados e tecnologia para transformar a maneira como as pessoas se relacionam com planos de saúde**. Nosso sonho grande é fazer as pessoas amarem e não odiarem o sistema, pagando um preço justo, por um serviço que vale a pena.

Estamos buscando um engenheiro de software apaixonado por tecnologia, focado em resultados e motivado a nos ajudar a construir a nossa plataforma, que consistirá em: BI, CRM e interface com usuário. Se quer trabalhar com propósito em um ambiente que vai te dar autonomia e oportunidade de crescimento, essa vaga é pra você!

### Nível
Pleno, Senior

### Experiência
- Banco de dados SQL
- Desenvolvimento de aplicações utilizando: PHP, Go ou Python
- Desenvolvimento em nuvem (AWS)
- Conhecimento em docker
- Desenvolvimento de API REST
- Conhecimento de metodologias ágeis como Scrum ou Kaban

### Local
São Paulo - Vila Olímpia, SP

### Requisitos e qualificações
- Graduação em Ciência da Computação, Desenvolvimento de Sistemas ou áreas relacionadas
- Pelo menos 3 anos de experiência com desenvolvimento Back-End

### Desejável
Experiência com desenvolvimento mobile (IOs e Android) e/ou webapps PWA
Conhecimento em kubernetes
Experiência em Front-End

### Contratação
PJ a combinar

### Se interessou?
Por favor envie um email para contato@olisaude.com.br com copia para gerson.pechim@olisaude.com.br com seu CV ou link do seu perfil no linkedin - enviar no assunto: Vaga Back-end Developer
Two sum - Leet Code Solution
Tags: algorithms, computerscience, challenge, beginners
Published: 2020-07-31 12:37:38

![Two sum - Leet Code Solution](https://dev-to-uploads.s3.amazonaws.com/i/5z5zw9s3il375rkhpdsj.jpg)

### Topic: [Two Sum Problem](https://leetcode.com/problems/two-sum/)

### Problem Statement: 
> Given an array of integers, return indices of the two numbers such that they add up to a specific target.

You can find the original question here -> [Two Sum Problem](https://leetcode.com/problems/two-sum/)
{% post codeperfectplus/largest-palindrome-product-project-euler-solution-53gd %}

### [Two sum - Leet code solution in Python Language.](https://dev.to/codeperfectplus/two-sum-leet-code-solution-452d)

```python
class Solution:
    def twoSum(self, nums: List[int], target: int) -> List[int]:
        seen = {}
        
        for index, num in enumerate(nums):
            other = target - num 
            
            if other in  seen:
                return[seen[other],index]
            else:
                seen[num] = index
        return []
```

Share Your Solutions?
The Real Cause of Overtime (And How To Avoid It)
Tags: overtime, productivity, advice
Published: 2020-07-31 12:32:15

There are a few different reasons overtime is still so prevalent, and especially in the tech industry. 

The biggest one is that we have a culture that glorifies working long hours. In tech, we call it “crunch time,” and it’s the pervasive hackathon mentality that programmers can work around the clock to meet tight deadlines.

Overtime can also happen because of management mistakes.
One of the most common management problems that leads to required overtime is not having an effective way to measure employee output. If you don’t have a way to measure what your team is actually producing, time they spend in the office is the best way you have to determine whether they’re being productive.

**Avoid this by establishing a results-based way to evaluate programmer output.**

This may seem like an odd directive coming from a time tracking company. But time tracking measurements can actually help your company mitigate or even eliminate the need for overtime, because you can use time-tracking data to better manage project timelines. 

The time your programmers spend “clocked in” should never be how you measure their productivity. Instead, you should be properly managing their projects to give them enough time to create the output you need — without working crazy overtime. 

If project management isn’t properly keyed in, teams could be stuck trying to complete a project that should take six weeks on a four-week timeline. Combat this by hiring qualified project managers to ensure deadlines can be met within sensible work hours.

No matter the problem, working overtime is not the answer. It takes a culture shift and a solid understanding of the consequences of overtime, but eliminating it from your organization will only help your business—and your people—thrive.
______________________________________________________________
*[7pace Timetracker](https://www.7pace.com/) is the only integrated, professional time management solution for teams using Azure DevOps.*

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/0abhoy61sfwppfggxyhq.png)
67: HELP 
Tags: help
Published: 2020-07-31 12:29:53

I am not sure when to end up the project, currently, I feel confused about what to start, To be short, I NEED HELP NOW! 

I have my database enough, I researched for a year to be a front-end engineer by myself, as a result, I got overwhelmed by my research. It happens, right? 

I have no one to ask in the face! There are several professional developers in my country, The essence is communication between seniors and juniors, I need a social interaction during the time of social distance movement! :D 

---------------- 

**1. How do you think of 'clone coding' to learn vanilla JavaScript?** 
* My previous mentor disagree with learning the web development through clone coding, I guess that affects me, on the other hand, it could be practical learning to see the whole process and I was thinking to apply to my project

---------------- 


**2. If that is not useful, Do I need to start over studying math to write an algorithm in order? How many algorithm problems did you solve in the beginning if that is okay to ask you for? I solved less than 10 problems.** 

I got the hints from the last experience at Bootcamp, I have no plan to rush this time. My energy is now limited.



---------------- 

**3. Here are the things I figured out!**
* Do some vanilla JS clone coding to learn JS Grammer practically
* Move on Algorithm problems 
* Make the vanilla Javascript

The main purpose is leveling up from the beginner to Intermediate level! 

---------------- 


**4. Does it necessary to have a code review or looking for a mentor again?**

---------------- 

I know that taking an action is more than important to get the advice, in my experience, I went to the other way of putting my energy, I have to be conscious of what to do this time to complete my front-end development project! Thanks for reading, Stay Safe and Happy Coding!
Multiples of 3 and 5 - Project Euler Solution
Tags: challenge, euler, computerscience
Published: 2020-07-31 12:20:25

![Multiples of 3 and 5 - Project Euler Solution](https://dev-to-uploads.s3.amazonaws.com/i/dn4rx4f6efkpunjrq37h.jpg)

### Topic : [Multiples of 3 and 5](https://projecteuler.net/problem=1)

### Problem Statement:

> If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9. The sum of these multiples is 23.

Find the sum of all the multiples of 3 or 5 below 1000.

You can find the original question here -> [Project Euler](https://projecteuler.net/problem=1)

{% post codeperfectplus/sieve-of-eratosthenes-1f93 %}

### Multiples of 3 and 5 in python

```python
def multiples(n):
    sum = 0
    for i in range(n):
        if(i%3==0) or (i%5==0):
            sum += i
    return sum

print(multiples(1000))
```

Share Your Solutions for Multiples of 3 and 5?
Daily Developer Jokes - Friday, Jul 31, 2020
Tags: jokes, dailydeveloperjokes
Published: 2020-07-31 12:00:25

---
title: "Daily Developer Jokes - Friday, Jul 31, 2020"
description: "Check out today's daily developer joke! (a project by Fred Adams at xtrp.io)"
series: "Daily Developer Jokes"
cover_image: "https://private.xtrp.io/projects/DailyDeveloperJokes/thumbnail_generator/?date=Friday%2C%20Jul%2031%2C%202020"
published: true
tags: #jokes, #dailydeveloperjokes
---

Generated by Daily Developer Jokes, a project by [Fred Adams](https://xtrp.io/) ([@xtrp](https://dev.to/xtrp) on DEV)

___Read about Daily Developer Jokes on [this blog post](https://xtrp.io/blog/2020/01/12/daily-jokes-bot-release/), and check out the [Daily Developer Jokes Website](https://dailydeveloperjokes.github.io/).___
### Today's Joke is...
![Joke Image](https://private.xtrp.io/projects/DailyDeveloperJokes/public_image_server/images/5e12590f4ba3c.png)

---
*Have a joke idea for a future post? Email ___[xtrp@xtrp.io](mailto:xtrp@xtrp.io)___ with your suggestions!*

*This joke comes from [Dad-Jokes GitHub Repo by Wes Bos](https://github.com/wesbos/dad-jokes) (thank you!), whose owner has given me permission to use this joke with credit.*

<!-- 
Joke text:
___Q:___ What do you call a computer that sings?

___A:___ A-dell.
 -->
List Comprehension
Tags: python, beginners
Published: 2020-07-31 11:51:53

Hi there, I am back with another python concept; **list comprehension**.

A list is a collection of related data e.g. a collection of my favorite movies or books. Lists in python can contain numbers, strings, lists etc. In python you can create lists like so:
```python
my_movies  = ['Gone Girl’, ‘The Current War’, ‘Crazy Rich Asians']

#if you are creating a list of a number of elements from input given
my_movies = [] #declare an empty list
for movie in range (3): #loop through 3 elements
    movie = input () #accept input from the user
    my_movies.append(movie ) #add that input to your list

print(my_movies) #display your complete list

```
A **list comprehension** is a simple way of creating lists in one line instead of writing many lines of code. One thing I noticed is when using list comprehensions most of the time ranges are involved:
```python
#loops through numbers starting from 1 and stopping at 11(not inclusive)
first_ten_numbers = [n for n in range (1,11)]
print(first_ten_numbers)

'''
Output:
[1,2,3,4,5,6,7,8,9,10]
'''
```
One can also use ‘if- statements’ in list comprehensions to check a certain condition:
```python
#loops through numbers starting from 1 and stopping at 11(not inclusive) and display only even numbers
first_ten_even_numbers = [n for n in range (1,11) if n%2 == 0]
print(first_ten_even_numbers)
'''
Output:
[2,4,6,8,10]
'''
```
It is also possible to make nested lists:
```python
#loops through numbers starting from 1 and stopping at 4(not inclusive) 
multi_list = [[x, y] for x in range (1,4) for y in range (1,4)]
print(multi_list)
'''
Output:
[[1, 1], [1, 2], [1, 3], [2, 1], [2, 2], [2, 3], [3, 1], [3, 2], [3, 3]] 
'''
```
List comprehensions can be very helpful when you need to create simple lists and it saves you a couple lines of code so it’s worth noting.
Create a GitHub profile README using GitHub CLI
Tags: github, git, profile
Published: 2020-07-31 11:47:48

While GitHub profiles are the new hot thing it's not the only new thing GitHub has done as of late, so why don't we use the other thing they've released to create our new GitHub profile README, I'm of course talking about the new [GitHub CLI](https://cli.github.com/) tool `GH`.

### Lets create a GitHub profile README using GH! 🎉

---

**What is GH?** GH is GitHub's new command-line tool, and while it's currently in beta don't let that fool you, it's powerful - letting you create forks, open pull requests, list, and close issues and so much more, you can see the full power on their [documentation](https://cli.github.com/manual/).

While I won't go over the installation here, GitHub has provided an impressive list of installation options on their [documentation](https://cli.github.com/manual/installation).

---

![Creating a repo using the GitHub command line tool](https://i.imgur.com/rFvW1Tv.png)

So, let's jump into it, the first thing we need to do is run the following command `gh repo create`, we will pass in two flags, the first flag is `-d` which is the shorthand for `--description` to give our new repository a nice description and the `--public` flag, indicating that our new repository will be public.

In the current version `v0.11.1`, you will get a prompt asking if you want a local version of your repository.

---

![GitHub command-line tool creating repo after answering yes on prompt](https://i.imgur.com/FKhXFiQ.png)

After accepting the prompt, your remote and local repository will have been created.

---

![Travel into the newly created folder and write your read me file](https://i.imgur.com/gNo5EwI.png)

We will now `cd` into our newly created folder and `cat` some text into a `README.md` file, after that we will run `ls` to see if the file was created successfully.

---

![Using git status to check the git workspace](https://i.imgur.com/Qpjro49.png)

Using our trusty `git status` we will check the status of our new `README.md`

---

![Use git add to stage the file to your git workspace](https://i.imgur.com/NP17UJP.png)

Running `git add README.md` we will stage our `README.md` file to our local staging area.

---

![Use git commit to commit your read me to your local workspace](https://i.imgur.com/fn93CCu.png)

We will now run `git commit` with a nice message about our changes, in this case, we *created* a file.

---

![Use git push to push your workspace to your newly created GitHub repo](https://i.imgur.com/pSLbRff.png)

With all our work done, now we only need to `git push` our local version to our remote origin and we are done.

---

You will now have your very own GitHub profile README, created using only the command line. 👍

### Challenge time. 🔥

To give yourself a challenge, why don't you create a new `branch` locally for your next changes and [create a pull request](https://cli.github.com/manual/gh_pr_create) for it using `gh`? 😎
Ready-To-Use Website Templates: Yay or Nay? 🤔🤷🏼‍♀️
Tags: discuss, watercooler, webdev, design
Published: 2020-07-31 11:41:27

We at [Skynox Tech](www.skynox.tech) are busy redesigning our website. In the past few days, we've debated about colors, fonts, designs, logos, UX, and almost everything else. 🙆‍♂️🙆‍♀️

While the whole process has been fun, taking *too many decisions* in *too little time* has been somewhat overwhelming for the team. 

It got me thinking - maybe ready-to-use website templates would be a good idea?!  

What do you people think? Are there any negatives I'm not seeing? Do you know of any good places where I can find the best website templates? 

Share your thoughts below! 🙌