teleren/devto huggingface dataset:
Working with Jetpack Data Store 🛢
Tags: android, jetpackcomponent, datastore
Published: 2021-01-06 02:43:20

Migrasi dari SharedPreferences API ke library Jetpack Datastore, library baru untuk solusi data storage di android

##Apa itu DataStore ?
Beberapa hari lalu Google merilis library baru yang tergabung dalam jetpack component yaitu ``Datastore``. Jetpack Component selalu menghadirkan library — library yang membuat kode android menjadi lebih baik dan minim boilerplate. Library DataStore ini yang menurut blog resmi bertujuan untuk menggantikan ``SharedPreferences`` API yang memiliki beberapa kekurangan

Library ``Datastore`` di buat dengan Coroutines dan Flowuntuk menyimpan data secara asynchronous. Datastore memungkinkan kita untuk menyimpan data key-value seperti ``SharedPreferences`` atau menyimpan data dalam bentuk ``typed-object`` (Proto Buffer)

**SharedPreferences ✖️ DataStore**
- Ada beberapa keunggulan antara ``SharedPreferences`` dengan ``DataStore``
- DataStore menyediakan API asecara asynchronous untuk menyimpan dan membaca data, sedangkan SharedPreferences hanya menyediakan API synchronous saat membaca nilai yang diubah.
- DataStoreaman untuk di gunakan di UI thread. Karena menggunakan Dispatchers.io
- SharedPreferences menyebabkan runtime error sedangkan DataStore tidak


**Tipe Datastore**

Jetpack Datastore menyediakan 2 jenis :

- Preference Datastore — pada jenis ini, peng-implementasiannya hampir sama dengan SharedPreferences jadi ketika menyimpan data harus menggunakan key-value
- Proto Datastore — ini menyimpan data sebagai objek khusus. Ini memberikan keamanan tipe di luar kotak, tetapi mengharuskan kita untuk menentukan skema menggunakan buffer protokol.

###Setup Project

Yang pertama kali dilakukan, tambahkan library di ``build.gradle``
```
// Preferences DataStore
implementation "androidx.datastore:datastore-preferences:1.0.0-alpha01"
```

###Write Datastore

Sebelum menulis atau menyimpan data di datastore, kita perlu membuat / init Datastore nya dahulu dengan fungsi ``Context.createDataStore()``

```kotlin
// Buat Datastore-nya
val dataStore: DataStore<Preferences> = context.createDataStore(
    name = "settings"
)

```

Lalu kita bisa membuat sebuah fungsi lain untuk store data. berikut kodenya

```kotlin
suspend fun incrementCounter() {
    dataStore.edit { settings ->
        
        val currentValue = settings[COUNTER] ?: 0
        settings[COUNTER] = currentCounter + 1
                    
    }
}
```
###Read data dari Datastore
``DataStore`` memastikan bahwa data diambil di ``Dispatchers.IO``sehingga UI Thread kita tidak diblok oleh sistem. Hal ini membuat Datastore lebih aman digunakan.
Berikut contoh kodenya:

```kotlin
val MY_COUNTER = preferencesKey<Int>("my_counter")
val myCounterFlow: Flow<Int> = dataStore.data
     .map { currentPreferences ->
           
        currentPreferences[MY_COUNTER] ?: 0   
           
   }
```

Sekian dari saya mohon maaf bila ada kesalahan kata 😅
My least favourite part...Job Hunting
Tags: graduate, fullstack, webdev, nz
Published: 2021-01-06 00:51:13

So the 'fun' part of graduating is looking for jobs. Don't get me wrong, I'm excited to start my career, I just wish it wasn't so anxiety-inducing.

My days begin trawling websites like TradeMe Jobs, Seek, LinkedIn Jobs, and Facebook for any local full-stack web developer jobs. I have a pretty loose strategy for how I plan to apply for any jobs that I am compatible with and that's called "The Shotgun Method". This means I'm going to apply for a bunch of jobs, write a whole lot of cover letters, and hope to hear back from someone I'm interested in working with.  Is it a tried and true method? absolutely not. Am I still crossing all my fingers and toes and hoping it works? you betcha!

Unfortunately, I graduated about a week and a half before Christmas which means I can apply, apply, apply but I probably won't hear from anyone until they're back from holiday (which usually finishes around 11th Jan). That means I have at least 2 weeks in which to overthink and fret about having a job for 2021.

Watch this space to see if "The Shotgun Method" actually worked and also cross your fingers for me!
Getting error during saving or publishing new article on Dev.to
Tags: discuss, help, community
Published: 2021-01-06 02:31:07

Looking for help in publishing my bew article on dev.to.

Cover image is contains the error message what I am getting when trying to publish or save draft.

Error text is

**Whoops, something went wrong:**

base: undefined method 'any?' for #<String:Ox00007f4bfbabc6f8>
DAY 2 of building the Higher Order Functions in javascript. the filter Higher Order Function.
Published: 2021-01-06 02:23:52

Hello community,


So today we will be implementing the filter HOF.

    //filter function
    /******************
    *@_filter prototype is an array prototype that returns a new array from the prepended array(or better still the object)  that met the condition
    *@_filter prototype takes in a callback function
    *@callback arguments:the iterated-value,the iterated-  index,the prepended array itself
    *@author Emmanuel Onah
    ******************/

    Array.prototype._filter = function(callback){
       const newArray = [];
  
       for(let i = 0; i < this.length;i++){
           const fullfilledValue = callback(this[i],i,this);
           if(fullfilledValue){
              newArray.push(this[i]);
        }
    } 
     return newArray;
    }
    const names= ["Jerry","Joe","Jude","SashaBlanca"];
    //testing 1
    const newArray1 =    names._filter((name,nameIndex,arr)=>name.length===3);
    console.log(newArray1);


    //testing 2
    const newArray2 = names._filter((name,nameIndex,arr)=>name.includes("Sa"));
    console.log(newArray2);

    //testing 3
    const newArray3 = names._filter((name,nameIndex,arr)=>name.length <=5);
    console.log(newArray3);

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/iopfk1vv8674x3g8emir.png)

[Day 1: the map array prototype](https://dev.to/emmanuelonah/day-1-of-building-the-higher-order-functions-in-javascript-the-map-higher-order-function-4b17)
[Day 3: the find array prototype](https://dev.to/emmanuelonah/day-3-of-building-the-higher-order-functions-in-javascript-the-find-higher-order-function-24l4)
[Day 4: The reduce prototype](https://dev.to/emmanuelonah/day-4-of-building-the-higher-order-functions-in-javascript-the-reduce-higher-order-function-643)
Have you ever got into ping issue
Tags: linux
Published: 2021-01-06 02:11:24

Have you ever get into a problem like ping issue?

while ping any website you get an error of 

"Temporary failure in name resolution"

Now this problem occurs because the file which connects dns has a loop back IP in it or the file might have got deleted.

Now to change the IP from the file you have to do certain steps.

Steps are being written in this video. Go through this video and solve the issue anytime you get into this problem

https://www.youtube.com/watch?v=UOszyo1EZvs
Environments variables in Postman
Tags: postman, restapi, programming
Published: 2021-01-06 02:06:04

hello everyone, first of all , this is my first post in dev.to and I'm going to share you some of my little knowledge and my experience as a junior Backend developer.
today I'm going to talk about one tool that's is usefull named POSTMAN.
what is postman?
postman is a tool used to make REST API calls,however exist others tools like : insomia but is almost the same , these tools are very usefull.
how to use postman?
it is used to requests . you must have the URL and you should know what type of request you will do , only you must put the URL in the field named URL and make the request that the REST API is holding on
**Example:**
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/boak2573wdordydkz5k6.png)

the previous image show us how the make a basic call using postman without using environment variables and below I will show you how to do it using environment variables.

### Step One

once being in post, find the button manage environment 
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/mxpb9nubbv1epzmhcd5s.png)

### step two
now is time to create an environment 
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/j9evos84wh7r4q75g2pi.png)
when we create an environment  then we have the ability to create several variables in the same environment but this time we are going to create an environment called **develop** that will have variables in this case called url
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/rvpu2m1i5by77hrgmbjt.png)

Now we have an environment called **develop** ready to be used.
but when you have to test your API deployed on the web, you should to create another environment called production.

### By last
 okay we have an environment but the question is **how I use it ?**

How I said in the beginning postman is a powerful tool that allow us to use its tools easily.

when we create an environment, it is automatic added to the following combo with all the created environments and to use it we just have to select our environment in this case called **develop** 
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/mgfzlriehxo60mpdped1.png)

Finally we just  have to call the  url variable that we create within the environment **develop** and to call the variable we must do it inside double brackets 
example:
`{{url}}/book`
its equals to
`http://localhost:3000/book`
in post using url variable we will see something like the below

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/oflg1f76iam3i0v1ak3a.png)


It's all on my part, I hope It's helpful.
Regards Joel.
Introduce Open-Source project TCPProxy.
Tags: proxy, java, opensource
Published: 2021-01-06 01:59:29

Hi all, Now I gonna introduce a Open-Source project.

It's name is TCPProxy. It's small size project, but having quite performance.

TCPProxy could be used a proxy for secure purpose and a Gateway server for entry point of server pool and even a HA server or Load-Balancer.

Link is: [TCPProxy](https://github.com/9ins/TCPProxy)

TCPProxy can manage multiple sessions and configure each of that. 

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/3v5dkabb7lzxs5czb5qg.png)

I will post how to build services with TCPProxy soon.
If you wanna know right now, please visit link above to get some information.

This project just beginning and be needed of many people's sounds.

Your cheer and interest of that, would became strength to the project.

Thanks,
Best Youtubers for Web Devs
Tags: webdev, discuss
Published: 2021-01-06 01:42:09

For Web Developers, what are some YouTubers that have good content for new web technologies, tutorials, or news about anything related to Web Development?

One YouTuber that has good content for Web Devs is [Fireship](https://www.youtube.com/channel/UCsBjURrPoezykLs9EqgamOA). Do you know any good ones?
Deploying a Next.js site using Github Actions
Tags: nextjs, github, tutorial, webdev
Published: 2021-01-06 01:39:21

*Note: This is post assumes familiarity with React, JavaScript, basics of web development, and GitHub actions.*


I'm a huge fan of [GitHub Actions](https://github.com/features/actions). They're so simple but so effective at doing such a broad range of things. In short, you can tell GitHub do something on a computer everytime you push a commit to your repository (or to a branch on a specific repository like the `main` branch).

For today's post, I'll focus on how I used an action to automate deploying my static site built with Next.js to [GitHub Pages](https://pages.github.com).

I made this blog on a repository hosted on GitHub and added a GirHub Action to compile the JavaScript/React code into static HTML files. This really didn't require all that much effort.

Here's what I had to do:

1. Build a Next.js blog following the [detailed tutorial](https://nextjs.org/learn/basics/create-nextjs-app) and store the code on a GitHub repository
2. Create a workflow file in the repository with the following path: [`./github/workflows/integrate.yml`](https://github.com/franciscojavierarceo/franciscojavierarceo.github.io/blob/main/.github/workflows/integrate.yml)
3. Specify that workflow file to export the static files whenever I push to `main` and *commit* the exported files to a separate branch called `gh-pages` (you can just follow the workflow file I used)
4. Manually add a `.nojekyll` file to the `gh-pages` branch (this is to resolve [this bug](https://github.com/vercel/next.js/issues/2029))
5. Configure my repository Settings so that it sources the GitHub Pages build from the `gh-pages` branch

And that's it, adding new blog posts is as simple as creating a new [markdown](https://www.markdownguide.org/) file and pushing it to the main branch. The GitHub Action will handle all of the rest!

This is much nicer in behavior than my old site, which was built using Jekyll (a Ruby framework) and it's much less work than building a full application with Django to get high quality page loads. I’d add that I’m a huge fan of Django but I think for a static, fast, and lightweight site, Next.js my new go to! 

--

*I also occasionally blog on my [personal site](https://franciscojavierarceo.github.io/), where this post was originally published.*
Middi - Digital Ocean Hackathon Submission
Tags: dohackathon, showdev, react, node
Published: 2021-01-06 01:36:31

## What I built
Middi is a fun and wholesome habit tracker that makes you feel good for completing habits. The Middi app takes place in a chat-like interface where users get support and encouragement every time they complete a habit. Manage your habits, complete your goals and feel good doing it.

### Category Submission: 

> Program for the People: Build an application related to mental health, a public service (like a COVID-19 spread tracker), or a feel-good app to ring in the New Year right

### App Link
[Middi App](https://middi.app/)

### Screenshots
![output](https://dev-to-uploads.s3.amazonaws.com/i/x7ytpybkiwi8t1ymtw6n.gif)

![Screen Shot 2021-01-04 at 6.53.08 PM](https://dev-to-uploads.s3.amazonaws.com/i/j2nk9hl7kmnr2nurswe5.png)
![Screen Shot 2021-01-04 at 7.06.30 PM](https://dev-to-uploads.s3.amazonaws.com/i/4zsjojl1ie9cw8z194bh.png)
![Screen Shot 2021-01-04 at 6.51.40 PM](https://dev-to-uploads.s3.amazonaws.com/i/24dvxyhcxyxpoa73m0g5.png)
![output2](https://dev-to-uploads.s3.amazonaws.com/i/0l3hq8cfs2q90dnd1j41.gif)
 
### Description
Middi lets you create and track habits with weekly goals. You can then monitor your habit progress and get encouragement (and confetti parties) every time you complete a goal. 


### Link to Source Code!

[Middi Repo](https://github.com/MikeMather/middi)

### Permissive License
[MIT](https://github.com/MikeMather/middi/blob/main/LICENSE)

## Background
I've tried to get into habit tracking a couple of times but I always find that the material design "spreadsheet" approach never really appealed to me. I liked the idea of a habit tracker that made you feel good every time you completed a habit. I tried to build Middi to be friendly and supportive so that habit tracking didn't feel like making a grocery list.

### How I built it 
This project really shows how easy it is to make a full-stack project on Digital Ocean App Platform. I use one app to host both the backend and the frontend, and an App Platform component to create a PostgreSQL database. Linking the two up was as simple as a few clicks with DO doing the heavy lifting, including managing database users.

I use Heroku regularly so It's really great to see competitors in the same space.
<br/>

I used NodeJS with Express, Passport and Sequelize to handle the authentication and database models. I then used React with TypeScript on the frontend to handle the client side of things. 


### Additional Resources/Info

**Huge thanks to DEV and Digital Ocean for organising this event. Looking forward to seeing the rest of the submissions!**
Web Technology for 2021?
Tags: question, webdev, frameworkchoice
Published: 2021-01-06 01:23:16

---
title: Web Technology for 2021?
published: true
description: searching for the best Web framework
tags: question, webdev, frameworkchoice ,question 
//cover_image: https://direct_url_to_image.jpg
---

I know that, generally speaking, there is no silver bullet for everything. However, I wonder what would be the most appropriate web framework or library to learn or to keep digging in - in 2021:

- Flutter
- (P)React
- vue.js
- Angular
- Material
- Bootstrap
- Vanilla (no framework)
- other
How I applied at Google when I was only 19 and made it in

Tags: google, career, tech
Published: 2021-01-06 01:01:40

Many people ask me how I managed to get into Google back when I was 19, and I have to say - it is not the regular success story.

Being a Software Engineer at Google was my dream since I was 13 years old when I got my first internship as a Web Developer at a german banking company.

Until I was 18, I had some more Software Engineering Internships (also at SAP) and studied Computer Science while still in High School.

➡️ When I first applied, I GOT REJECTED 7 TIMES.

All these rejections were very generic, and I decided to look out for someone to refer me to Google.

A friend of a friend worked at Google, and after a chat, she decided to refer me to Google. I got rejected another time, and she referred me again - then I got an invitation for an interview, joined as an intern and later became a Full Time Software Engineer at #Google!

Want to achieve anything? Be persistent! 🚀

Comment if you want to hear more about the interviews and the process or why I finally left Google!
DO Hackathon - The Finished Result
Tags: dohackathon, node, react
Published: 2021-01-06 00:59:04

Unfortunately, I didn't have as much time over the Christmas break as I was hoping so I didn't get a chance to go further in depth into the client-side part of the app. With that said, I did want to write a post about the final features that I managed to fit in. 
<br/>

## Feature Overview

### The Chat Interface
All interactions with the app are done through a chat interface. That means we load components into view dynamically within the dialog.

![Chat interface](https://dev-to-uploads.s3.amazonaws.com/i/65ug6xxoj9pb0imdqqjo.png)
<br/>

### Adding Habits
You can add new habits and specify a custom colour, and the number of times per week you'd like to aim to complete the habit.

![Add habit](https://dev-to-uploads.s3.amazonaws.com/i/d09gkprgc6ejumze3mny.png)
<br/>

### Viewing Habit Progress
You can view your individual habit progress, or an overview of all of your habits combined.
 
![Habit progress](https://dev-to-uploads.s3.amazonaws.com/i/8q0hyuzhhbn2p6z7bng1.png)

![Overview](https://dev-to-uploads.s3.amazonaws.com/i/w7n7t5tbt56q7wht1y0f.png)
 

### Celebrations
The best part of the app in my opinion is the celebration animations. Any time you do a habit or complete a goal a celebration animation is shown. It feels good when a mini confetti party is thrown every time you complete a goal.

![Celebration 1](https://dev-to-uploads.s3.amazonaws.com/i/vycqm4lz379nuavc9nh1.gif)
 

![Celebration 2](https://dev-to-uploads.s3.amazonaws.com/i/gnqfqvbzb06buph2g48m.gif)
 
 
 
## Lessons Learned
I had a ton of fun developing this app and building everything from the ground up. I thought I'd also mention a few lessons I learned along the way:
1. **Chat dialog is hard!** I regret not looking more into good chat dialog methods (thinking of gaming systems in particular). Getting the chat sequences working correctly was challenging and I think there are good tools out there that I could have used.
2. **Design for extensibility first**. While it's possible to write your own chat sequences into the app, it would be nice to have an easily extensible system that allows anyone to define their own sequences with custom components.
3. **Start simple first**. I spent too much time in the beginning trying to figure out how I was going to build a system that would match the complex tracking systems of other habit trackers. Eventually, I realized that I've spent too much time designing things that are clearly out of scope. I settled on a very simple goal system that works well with the simplicity of the app.
Constitutions: code coverage & testing
Tags: code, programming, politics, democracy
Published: 2021-01-06 00:57:48

---
title: Constitutions: code coverage & testing
published: true
description: How to achieve a fully developed system.
tags: code, programming, politics, democracy
cover_image: https://cdn.pixabay.com/photo/2018/03/28/13/44/word-cloud-3269303_1280.png
---

Most of the Western societies have been architected in the shape of Democracy.
This was fully intentional; and was based on the consciousness about the Brutal Spaghetti that the human race put in Production during a history full of Failed Projects.

Unluckily computers didn't exist at that time; so the lean minds among those who fought for Liberty came up with a genial idea:

> "Friends, let's be Agile! We'll write the rules of our Manifesto for a better society... on paper!" ☝️

And that's how the ``Constitution`` came to life ✨📜

## Constitution is law. And law is Code.

We tried to apply that code; but we didn't have much experience with the Stack, the timeline was tight, the Domain is quite complex, and \*gosh\* all those philosophical state machines.
Damn, if we only read that Blue Book parked in the library since years..

So the specifications are pretty good but the risk to make a mess again is high.
We rush to deliver according to the deadline, but the result is practically a *Beta*.
We end up too busy with Maintenance and we never take care of the missing implementations and of all those filthy bugs.

Decades later it's still like that.

The Constitution was a good ``Promise()``; but we still ``await``.

-----------

## *So what we do?*

If **Constitution is Code**, then we have a whole field of professionals that could help with ensuring that our founding values are *Stable*.

For example,
what would be the impact of applying unit-testing & code coverage principles in our Govern Implementation?
What about Code Reviews?
How to ensure that also the more Complex Edge Cases are being added methodically and regularly?

The idea of Code Coverage is particularly interesting.
It was the inspiration for this article.

* How much of our Constitution is still uncovered?
* What are the Specifications that we never implemented and that are giving regular daily pain to our System?
* Does anybody ever look at the Backlog?
* Which are the Important Rules that we misunderstood or dismissed, and that need a major Refactor?

It's unlikely (and dangerous) to implement code that takes philosophical decisions; that'd be the Hard Part.
Then, what else can the Programmer Mindset bring to the table, code excluded?
What are *The Good Parts*?
Where, when and how can we Reuse them?

Software Developers are pretty good at solving problems, and there are political systems out there that could improve so much, if only this expertise in design & architecture would be shared with the political world, **beyond** the technical skills, to support the Development of a better & more Democratic Society.

Without Technical Debt. 🧐