teleren/devto huggingface dataset:
How to store multiple boolean values in a compressed way with a single integer
Tags: tutorial, algorithms, data, structure
Published: 2020-01-02 00:34:07

Hey everyone, in this short tutorial I am going to show how to store multiple boolean (true/false) values in a compressed way, very useful for databases.

### Bit
As you may remember from your CS lessons, modern computers are digital and store information as a sequence of 0 and 1. For example, integer ``14`` in decimal is ``1110`` in binary representation. Each digit from last to first is the power of 2 with exponent to the index in a row minus 1. 
```
1 (bin) = 1 (dec) because 1*2^(1-1)=1*2^0=1
10 (bin) = 2 (dec)  because 1*2^(2-1)=1*2^1=1
100 (bin) = 4 (dec)  because 1*2^(3-1)=1*2^2=1
and so on...
```

Having this knowledge you can perform operations on numbers like adding, subtracting, multiplying, dividing etc. But you can also perform bitwise operations.

Bitwise operation is an operation base on boolean algebra introduced by George Boole in his first book, in 1847. Some basic operations are conjunction (AND), disjunction (OR) negation (NOT) and exclusive or (XOR). 

AND operation is the one, that we need to compress our set of booleans, so quickly remind the truth table for it:
```
X & Y = Z
--
X Y Z
0 0 0
0 1 0
1 0 0
1 1 1
```

With this, we can calculate AND between numbers like ``1`` AND ``7``:
```
001 & 111 = 001
so 
1 & 7 = 1
```
but
```
001 & 110 = 000
so
1 & 6 = 0
```

### Bitwise composition
And now imagine that you have set of 3 flags about an entity in the database. But you know, in the future it will be much more flags and not every entity is going to have all of them. Instead of creating multiple columns with the boolean data type you can perform bit masking and store every flag as bitwise composition in a single column with an integer data type.

For instance, entity #1 has ``false, false, false`` it could be ``000`` in binary and ``0`` in decimal. Entity #2 has ``true, false and false``. It's ``100`` in binary = ``4`` in decimal. Entity #3 has ``true, true and true``. It's ``111`` binary = ``7`` decimal.

In the future, when you would want to add more flags simply recalculate flags where true values are going to be. Other leave as are. 

To find if the flag is set as true or false, calculate AND between column value and like shown above with the search flag bit value. Most of the databases have bult-in in functions for calculations on bits. In PostgreSQL you can:
```sql
SELECT * FROM xyz WHERE flags & 2 != 0
```
In MySQL and SQL Server it's very similar.

### Conclusion
To sum up, bitwise operations are very useful, widely used in many different aspects of software engineering and technique from this article is just an example of the power behind numbers and optimization tricks, that you can perform.
Pivotal Web Services, SSL, and a Custom Domain
Tags: devops, security, kotlin, cloudflare
Published: 2020-01-02 00:27:58

[Pivotal Web Services (PWS)](run.pivotal.io) is a great place to set up push button deployments. It's cheaper than Heroku and has some great features. One place it falls short is offering free SSL for custom domains; you can't even upload your SSL cert without shelling out $20/month.

Luckily there is an effortless way to get SSL up and running for free using [CloudFlare](cloudflare.com). 

## Deploy something to PWS

If you don't have a PWS account, create one at https://run.pivotal.io and download the `cf` command line tool.

On Mac

```bash
brew tap cloudfoundry/tap
brew install cf-cli
```

Now that you have an account let's create a super simple SpringBoot Kotlin app. 

```kotlin
@SpringBootApplication
class SsldemoApplication

fun main(args: Array<String>) {
    runApplication<SsldemoApplication>(*args)
}

@Controller
class HelloController {
    @GetMapping("/")
    @ResponseBody
    fun hello(): String {
        return "Hello PWS"
    }
}
```

Now you have an app and a PWS account so let's push this thing up. Assuming you have an org and space set up already.

![CF Push](https://thepracticaldev.s3.amazonaws.com/i/wfium4cpuv98c6wiadr2.gif)

```bash
cf login
./gradlew build
cf push ssldemo -p ./build/libs/ssldemo-0.0.1-SNAPSHOT.jar
```

Everything should deploy, and your app should be up and running at a *.cfapps.io domain.

## Setup a custom route
In order of PWS to know to route your domain to your app, you need to set up a custom domain. You can either use the web UI or the CLI. To use the CLI use the `cf create-domain` and `cf create-route` commands.

```bash
cf create-domain focusedlabs focusedlabs.io
cf create-route development focusedlabs.io --hostname ssldemo
cf map-route ssldemo focusedlabs.io --hostname ssldemo
```

## DNS stuff

Just because we have mapped the route doesn't mean everything is wired, we still have one more step, configure a DNS CNAME to route to our newly deployed service.

![Cloud Flare DNS Setup](https://thepracticaldev.s3.amazonaws.com/i/isbo4ukdmde3dgxj2oz8.png)


This guide assumes your DNS is already managed by CloudFlare. If it's can migrate over to them really easily. 

In the CloudFlare DNS management panel add a new CNAME record and you're all set.

```bash
curl https://ssldemo.focusedlabs.io
```

![Demo Curl](https://thepracticaldev.s3.amazonaws.com/i/63ifsy8temwmnxjwh23o.gif)
Markdown Style
Tags: markdown, css, vscode
Published: 2020-01-13 23:37:52

---
title: Markdown Style
published: true
date: 2020-01-02 00:00:00 UTC
tags: 
- MARKDOWN 
- CSS 
- VSCODE
series: productivity with markdown
canonical_url: https://coreydmccarty.dev/posts/2020_01_02_markdown_css/
cover_image: https://thepracticaldev.s3.amazonaws.com/i/p2jnamlo05dpwmgeihnj.png
---

While writing about [using Markdown to boost productivity in note taking](https://coreydmccarty.dev/posts/2020_01_02_markdown_for_notes) I thought that maybe some people might be interested. in this configuration.

```css
:root {
  /* from https://www.behance.net/gallery/8482091/Flat-Bold-UI-Kit */
  --black: #333333;
  --light-gray: #B3B8BC;
  --dark-gray: #656565;
  --blue: #46BDDF;
  --green: #52D273;
  --red: #E95065;
  --orange: #E57255;
  --yellow: #E5C453;
  --background: #484848;
  
  /* Other Sources */
  --other-background: #252525;
  --white: #FFF;
  
  background-color: var(--other-background);
} 
h1, h2, h3, h4, h5, h6{
  font-weight: bolder;
}
h1{
  color: var(--blue);
}
h2{
  color: var(--green);
}
h3{
  color: var(--yellow);
}
h4{
  color: var(--orange);
}
h5{
  color: var(--red);
}
h6{
  color: var(--white);
}
a:link {
  color: skyblue;
  font-weight: bolder;
}
a:visited {
  color: lightskyblue;
  font-weight: bolder;
}
p, ul, ol, li{
  color: var(--light-gray);
}
pre{
    background-color: #000 !important; 
}
strong {
  color: var(--white);
}
```


<a href="https://undraw.co/">Cover image created by undraw.co</a>
The simplest way to deploy your Flask application with PostgreSQL on AWS
Tags: python, flask, aws, programming
Published: 2020-01-01 22:45:33

Hello developers, I am very proud to share with you a very innovative way to deploy Flask applications on AWS. Pierre (my co-founder) and I were working as DevOps for many years and **we know how it can be painful to deploy applications**, even in the Cloud. Developers should spend time to do what they love: developing applications, instead of wasting time on configuring databases, CDN, cache, network... That's why I decided to create Qovery. The first Container as a Service platform that allows any developer (junior, senior, backend, frontend...) to deploy applications in just a few minutes.

[Just take a look at how easy it is with Flask and PostgreSQL](https://www.qovery.com/blog/the-simplest-way-to-deploy-flask-with-postgresql-on-aws)

I am eager to hear from you.
Happy new year 🎉
Hey there, Gridsome!
Published: 2020-01-27 22:10:10

---
title: Hey there, Gridsome!
published: true
date: 2020-01-01 20:00:00 UTC
tags: 
canonical_url: https://braytonium.com/2020/01/01/hey-there-gridsome/
---

It's been over a year since my [last post](https://braytonium.com/2018/07/10/laravel-passport-usage-with-swaggervel-v2-3/) and while unfinished drafts don't count, I thought my blog was due for a change. The move from Octopress to Hexo was relatively uneventful but I found keeping up a little difficult. It wasn't completely on Hexo, I had tweaked things to a point that merging in changes over time became cumbersome and slow. In a [previous post](https://braytonium.com/2016/04/17/jsonresume/), I roughly mentioned the transition and a lot has happened to the web in over 3 years.

Static site generators like Hugo and Gatsby have picked up steam and the feature set of Gatsby, particularly the GraphQL component stood out. I wanted to stick to Vue for as many of my personal projects as possible, so I searched for any static site generator using Vue I could find. Fortunately Gridsome has come along as a nice clone of Gatsby using Vue rather than React and even though it's at v0.7.12 at the time of this post, I've run into very few hurdles.

I don't have the best understanding of JAMstack after working with a sample size of one, but learning GraphQL by only dealing with queries has made this one of the best ways to get my feet wet. I'm by no means an expert but this light interaction compels me to use it more often, as it's mostly been a pleasure to work with. Frameworks like Gridsome and I suspect Gatsby let you focus on almost entirely the frontend. Even though the A in JAMstack stands for APIs, as a backend developer I haven't had to write a single REST, GraphQL or what I'd typically associate with an API like I would with Laravel, Phoenix Framework, or Express.

One thing I miss about Hexo is that it had scaffolding to generate new files. Gridsome is a framework for generic sites, not just blogs, so scaffolding doesn't seem to be included. Coming from Hexo I wanted to keep as much of the existing markdown as possible and I think some of the approaches I've taken may be useful to others. A small example I had a problem understanding is that you can use a `@gridsome/source-filesystem` plugin multiple times, one for each directory or type. It makes sense in hindsight but none of the starters used the technique nor did the docs seem to suggest it was possible. I'm tempted to create a starter based on my usage patterns but worst case, I plan on writing a post outlining some of these approaches in the near future.

One last thing is a small humblebrag. While the theme for this site draws a few cues from the older version, I wanted to flex my design abilities by focusing on techniques I've learned reading [Refactoring UI](https://refactoringui.com/book/). By the time this post is published it likely won't be perfect but I think it's a decent first pass that should only get better over time.
Beginning as a Software Engineer
Published: 2020-01-01 21:50:45

As a start from 2020, I wrote this post just to remind myself and share some knowledge I have learn in a pathway to become a software engineer.


This post will be revised occasionally to update included links.

So let's get start with
- What is Software Engineering, what it's needed to do and how to become a good one.

-- To be continued, soon --
2020 Goals
Tags: beginners, motivation, productivity
Published: 2020-01-01 21:42:54

![Celebration Cake](https://images.unsplash.com/photo-1546857098-b787ce02be9b?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=1240&q=80)
 


Hello World! This year is still part of my path to learning web development.

The idea is to divide that great goal into small pieces detailing in my agenda [a.k.a Bullet Journal](https://www.youtube.com/watch?v=fm15cmYU0IM) the time dedicated to each of them (every day). This is the plan:

##FreeCodeCamp
My first approach to web development and a wonderful resource for newbies that as I started in the world of web development. I'm going to the next certification!

##Create an E-commerce
Or rather continue with the small tasks of the E-commerce course that I am taking in Udemy.

##Contribute to the Open Source
Participating in the Hacktoberfest is great, why not keep those contributions the rest of the year ?! Yei !!! It helps me to continue with my learning of Git and Github.

##A mentor
I am very grateful for all the people who are helping me, one of these people who inspire me and share their enthusiasm for web development is Florin Pop this year has proposed many challenges and you can follow it [here](https://www.youtube.com/channel/UCeU-1X402kT-JlLdAitxSMA)

Wishing you a Happy New Year!!:sparkles:

Thanks for reading my first post :blush:

Please tell me what are your small goals in web development this 2020
Starting Off The Year With #100DaysOfGatsby
Tags: development, gatsby, wordpress, 100daysofgatsby
Published: 2020-01-01 21:21:13

---
title: Starting Off The Year With #100DaysOfGatsby
published: true
description: Sharing about my start to learning GatsbyJS.
tags: development,gatsbyjs,WordPress,100DaysOfGatsby
canonical_url: https://twitter.com/tnolte/status/1212481299857981440
series: 100DaysOfGatsby
---

Starting the [#100DaysOfGatsby](https://dev.to/t/100DaysOfGatsby) challenge with a focus on [#WordPress](https://dev.to/t/WordPress) and going through a Udemy course(https://udemy.com/share/101Au6A0Uac15QQns=/) to start off. Looking forward to learning 
@GatsbyJS this year.

{% github https://github.com/timnolte/gatsbyjs-blog %}

The post [Starting Off The Year With #100DaysOfGatsby](https://twitter.com/tnolte/status/1212481299857981440) appeared first on [Twitter](https://twitter.com/tnolte).
31 days of commits
Tags: challenge, github
Published: 2020-01-01 20:22:52

As a personal challenge, I want to try and commit to my personal github at least once a day for the next 31 days.

I think that this will help me to prioritize a bunch of the small improvements and new things that I would like to build instead of playing video games or mindlessly zoning out to twitch. 

Here's my [Github Progress](https://github.com/jsegal205?tab=overview&from=2020-01-01&to=2020-02-01) for the month.

[UPDATE](https://dev.to/jsegal205/streak-broken-5foh)
The first JavaScript Challenge in 2020: 30 Days Of JavaScript Challenge
Tags: javascript, react, node, python
Published: 2020-01-01 20:19:54

🎉  HAPPY NEW YEAR, 2020  🎉

I am a programming teacher and I love teaching. I teach JavaScript, React, Redux, Node and Python. In the end of 2019, I was thinking to expand my teaching and to reach to global audience and I started a Python challenge from November 20 - December 19. It  was one of the most rewarding and inspiring experience. I managed to reach more than 15 thousand people. Many started to use the material and the github repo was trending on github for one day. Some of the participants have asked me to create a JavaScript and React challenge.

Now, I have just launched a 30DaysOfJavaScript challenge. In this challenge, you will learn everything you need about JavaScript. At the end of the challenge I will use Node, Express,EJS, and MondoDB to develop a fullstack application. In addition to that the challenge will have about more than 5 DOM projects. 

Let's start the new year with JavaScript. Many of you have been waiting for it for so long, finally it is here. 

DAY 1 of 30DaysOfJavaScript has been released. 

💻  JavaScript Challenge Github: ttps://https://lnkd.in/efqy_df
💻  Python challenge Github: https://github.com/Asabeneh/30-Days-Of-Python
👥  Join the group:https://t.me/ThirtyDaysOfJavaScript

📅 Start your new year or monthly resolution with coding.

Good Luck!! ✨
🔥🔥🔥
Affirmations
Tags: career, beginners
Published: 2020-01-01 20:16:55

# Introduction

I'm going to get right into it and write a bunch in here. Read as much as you need to.

## 1. "I don't have support."
Your mind is full of brilliance and you deserve better.

## 2. "I don't know if I'll ever get that first job. It's been so long."
Be confident in your skills, for they are valid and valuable, and someone will appreciate you for all that you offer.

## 3. "I haven't had a new job in a long time and I feel stuck."
It's never wrong to want for more and seek out the opportunities that will give more to you.

## 4. "I don't know if I've been making the right choices."
Trust your intuition and inner guide.

## 5. "I'm surrounded by people who don't value and respect me."
Allow yourself to be who you are without any judgment.

## 6. "I feel tired and overworked."
Give yourself the care, rest, and attention that you are worth. There is no shame in resting.

## 7. "This path feels wrong or misguided."
In life, our experiences mold us into better people. Trust that you can find the right path.

## 8. "What if I fail?"
Failure teaches us and improves us. Embrace failure for the positives it will bring.

## 9. "I am spread too thin."
We put energy into the things that matter the most to us. It's okay to prioritize who and what gets your attention.

## 10. "I'm hurting and I don't know how to make it stop."
Everyone hurts and grieves. Everyone fights battles. You don't have to fight them alone. Reach out.

## 11. "I feel like everyone else is better than me."
You are good enough. No one else's success reduces your own.

## 12. "Can I do this?"
Yes, you can. Alone or with others, however you want or need to, you can do this.

## 13. "What if I run out of time?"
There is no rush. Take your time to do whatever it is you want to do, and don't let anyone push you around or make you feel like you need to do more than you have the head space to do.

## 14. "Am I good enough?"
You are always good enough.
2 common mistakes on using split and splitlines function - Python Tips
Tags: python
Published: 2020-01-01 20:10:51



### split() and split(" ") and different:

```python
>>> a = "hello     world"
>>> a.split()
['hello', 'world']
>>>
>>> a.split(" ")
['hello', '', '', '', '', 'world']
```

### splitlines and split("\n") are different:

```python
>>> "".splitlines() # this will return an empty list
[]
>>> "".split("\n")  # this will return an one-element list
['']
>>>
>>> "my line\n".splitlines()
['my line']
>>> "my line\n".split("\n")
['my line', '']
```
What is the JAMstack?
Tags: jamstack, jamuary
Published: 2020-01-01 19:13:49

The JAMstack is a modern way of building slick and fast web applications without the added complexity of a server. Simply put, the JAMstack is the technique of prebuilding all markup to static pages and serving it directly from a CDN. This architecture for building sites harks back to the days of static pages pre LAMP/MAMP stack. Compared to the traditional architecture however, JAMstack sites take advantage of JavaScript and APIs for added functionality and interactivity. In the past, adding dynamic elements like forms and authentication required converting an otherwise straightforward static site into a monolithic full stack one. But with the JAMstack approach, you can lean on microservices to do the heavy lifting. As a result of this decoupling, the complexity of the common monolithic architecture is simplified significantly. 

For more on the JAMstack, and to get started with building for it, check out https://templates.netlify.com/
Javascript-Maniac - Day 01
Tags: javascript, html, day01, 100daysjavascript
Published: 2020-01-01 18:35:26

So, finally, I've started #100DaysOfJavascript challenge and in the first tutorial, I have described what Javascript is, Why it is important for web apps & how you can start it immediately if you want to learn Javascript.

Do check it out my repo,
https://github.com/Mohammad-Quanit/Javascript-Maniac/tree/day01-Js-Intro

Suggestions are extremely Welcome.

You can follow me on GitHub at :octocat: https://github.com/Mohammad-Quanit & do leave a star if you like it.
What do you want to let go in 2020?
Tags: discuss, watercooler
Published: 2020-01-01 18:32:07

A new year is a good opportunity to tidy up at our digital lives.

If something doesn't spark joy anymore, let it go.

For example, I don't enjoy doing "social" media. I just deleted all my tweets with https://tweetdelete.net/ and found myself instantly more calm. 

{% twitter 1212092555552272391 %}

Is there something that doesn't serve you anymore?
Metas para 2020
Tags: goal, developer
Published: 2020-01-01 18:27:12

Faz tempo que não escrevo nada. Depois de ler bastante esse ano fiquei pensando como poderia melhorar um pouco a escrita esse ano.

Após refletir bastante sobre quais mudanças eu farei em 2020, uma delas será compartilhar mais o meu conhecimento com a comunidade.

## Metas

- Compartilhar meus conhecimento através de posts aqui na plataforma
- Aprender TypeScript
- Aprender React

Vejo vocês durante o ano.
🥋Few tips to make developers not wrestle with your APIs
Tags: devrel, api, rest, documentation
Published: 2020-01-01 18:23:51


Often, APIs are the first point of contact for developers and significantly impact Developer Experience(DX). Developer-friendly APIs will improve adoption, retention and might also instill a good word-of-mouth awareness among the developer community. At the end of the day, an API has to provide an interface using which products/ applications can talk to each other. Adding a few more traits to this baseline definition does not only deliver a good interface but also provides a great developer experience.

#1️⃣ Documentation

This is the first and foremost factor for successful APIs. Neatly documented endpoints with clear descriptions enable developers to understand and leverage them easily. Interactive API documentation stands out and is beneficial when you have a lot of APIs to offer. At the minimal, the capability to try it out in POSTMAN or other REST clients could save time for the developer and can make things easier. 

Good documentation also covers things that the developers might miss hurriedly (most probably during their 1st pass) for example - rate limit policies, paginations, authentication, etc. It should drive developers towards the [pit of success](https://blog.codinghorror.com/falling-into-the-pit-of-success/) by default

#2️⃣ Graceful changes, deprecations

Change is inevitable. It is good for progress. However, it becomes our duty to convey changes to developers as and when they occur. Most importantly, being mindful of users who have already consumed the API and introducing changes gracefully can alleviate major issues.

Communicating it via developer portals, changelogs, forums, etc. will significantly reduce friction.

#3️⃣ Proper Error response/Status codes

I wish to live in a world where there were more [418](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/418)-like status codes. However, it is always recommended to stick to meaningful error codes that convey upfront information to the user without them having to sherlock it. 

Developers will be able to connect the dots and solve the issue at a much lesser time if the error code makes sense. The advantage of such status codes is that it implicitly delegates problem-solving to the developer and makes them informed in that situation. Otherwise, this might end up as support tickets and forum queries.

#4️⃣ Avoid too chatty/chunky

Chatty APIs will lead to making multiple network calls to perform a single task. This ideally should be one single API call. On the other hand, chunky APIs end up providing too much information in one single call. It is recommended to avoid the extremes

These are a few tips that I follow to ensure that developers don't wrestle with the APIs. I would like to hear your thoughts as well in the comments section! 😀❤️