teleren/devto huggingface dataset:
Use deno to build a Tauri App
Tags: rust, deno, tauri, typescript
Published: 2020-06-13 11:49:56


At Tauri we originally built our CLI with typescript and node.js, but we've been looking into alternatives for a while. In that vein, we just POC'd building a Tauri app with Deno (instead of node.js)

We won't explain how to install the toolchains (deno, rust and tauri), and expect you to have already built your first Tauri apps already. But if you are new to all of this, here are the details:

- https://tauri.studio/docs/getting-started/intro/
- https://deno.land

## Rig and build!
```
git clone git@github.com:tauri-apps/tauri
cd tauri/cli
git clone git@github.com:lucasfernog/tauri-deno-cli deno
cd ../tauri/examples/communication
deno run --unstable --allow-read --allow-run --allow-net --allow-env --allow-write ../../../cli/deno/index.ts build
```

![Tauri by Deno](https://dev-to-uploads.s3.amazonaws.com/i/7m56oldsihfmq9dccyit.png)

# Benchmarking

The second time you run deno build, you'll have all the deps already installed and the rust crates as well, so let's see how long it takes on MacOS (this isn't a scientific bench):

## deno
#### command
```
$ time deno run --unstable --allow-read --allow-run --allow-net --allow-env --allow-write ../../../cli/deno/index.ts build
```

#### with antibloat
```
  real    1m2.738s
  user    0m42.514s
  sys     0m2.933s
```
#### no antibloat
```
  real    0m25.001s
  user    0m16.473s
  sys     0m1.758s
```
#### no antibloat, just .app
```
real    0m5.906s
user    0m11.780s
sys     0m1.268s
```

## node.js
#### command
```
$ time node ../../../cli/tauri.js/bin/tauri build
```
#### with antibloat
```
  real    1m10.295s
  user    0m51.990s
  sys     0m3.009s
```
#### no antibloat
```
  real    0m44.562s
  user    1m5.383s
  sys     0m3.187s
```
#### no antibloat, just .app
```
real    0m26.423s
user    0m59.936s
sys     0m2.805s
```

## Discussion
The ~1 minute build time might seem like it takes a long time, but we are actually using these [antibloat](https://tauri.studio/docs/usage/recipes/bundler/anti-bloat#rust-compression-features) techniques only possible when single-threading.

> Also, if you are trying this in your own project, you should know that you will have to run `yarn tauri dev` at least once in order to create `index.tauri.html`. We haven't started porting the inliner to deno.

Nevertheless, deno performs better in both cases - without antibloat almost twice as fast, and just building a `.app` its about 4.5x faster. So I absolutely have to agree with Lucas' sentiment: 

**deno is f!cking amazing**
Build Go ด้วย Docker แล้วสร้าง image สำหรับรันโปรแกรมจาก base scratch
Tags: go, docker
Published: 2020-06-13 11:38:16

เนื่องจาก Go สามารถ build โปรแกรมเป็น static binary ที่ไม่ต้องอาศัย shared library ตอน runtime ทำให้เราสามารถ build Go แล้วเอา binary ที่ได้ไปสร้าง Docker image จาก base scratch ได้ ทำให้ได้ image ที่ size เล็กๆเท่าที่จะเล็กได้

ทีนี้เนื่องจาก Docker สามารถทำ Dockerfile แบบ multiple stages ทำให้เราสามารถเขียน Dockerfile ทั้งเพื่อให้ build Go เป็น binary แล้วก็สร้าง image สำหรับ run binary นั้นได้ในไฟล์เดียวได้

ซึ่ง Dockerfile ที่รวมสอง stage เอาไว้แล้วมีแค่นี้

```docker
FROM golang:1.14.4 AS builder

ENV GO111MODULE=on \
  CGO_ENABLED=0 \
  GOOS=linux \
  GOARCH=amd64

WORKDIR /app
COPY . .

RUN go build \
  -trimpath \
  -ldflags "-s -w -extldflags '-static'" \
  -o service

FROM scratch
WORKDIR /app
COPY --from=builder /app/service .
CMD ["./service"]
```

หลักๆคือเซต env `CGO_ENABLED=0` เพื่อบอกว่าจะ build โดยไม่ใช้ CGO เลย (แน่นอนถ้าเราจำเป็นต้องใช้ package สำหรับ CGO จริงๆก็จะใช้ base scratch ไม่ได้) ส่วน option ตอน build ที่ใส่ `-ldflags "-s -w -extldflags '-static'"` เพื่อให้ binary ที่ได้ตัดบางฟีเจอร์สำหรับ debug ออกจาก binary ทำให้ได้ binary size ที่เล็กลง

ส่วน stage สุดท้ายคือเอา binary ที่ได้จาก stage builder มาใส่ใน image ที่ base จาก scratch แล้วก็สั่งรันแค่นั้น

<a href="https://www.buymeacoffee.com/weerasak" target="_blank"><img src="https://cdn.buymeacoffee.com/buttons/v2/default-yellow.png" alt="Buy Me A Coffee" style="height: 60px !important;width: 217px !important;" ></a>
What I learnt in one year of my code review
Tags: testing, codequality, discuss
Published: 2020-06-13 11:25:53

In first few months I got much comments on my code after code review. Later on I started building that mindset. It help me a lot,

Let me share with you few techniques

1. Mindset (start building that mindset).

2. Use Exceptions handling, read error messages, log errors.

3. Try test your core logic, all possible ways (write multiple inputs, don't test your code on same input again and again). 

4. Figure out break points. And print messages on all breakpoints.

5. Believe that you are human and you have made errors. start finding out them.

6. Start testing your code at the beginning(line by line).

7. Also Take break, have some coffee and let your logic run in background of your mind, and then get back.

8. In all this you need a lot of patience.

Keep Learning!!
15 must-know abbreviations in NLP language models
Tags: machinelearning, nlp
Published: 2020-06-13 11:25:23

NLP(Natural Language Processing) has grown immensely in recent years and a lot of abbreviations are used in this field to name models that are used for different tasks like text summarization, sentiment analysis, question-answering, etc. These models are known as *Language Models*. Most of the Language models are named after muppets, yes you heard it right muppets. Elmo, BigBird, Bert, and Ernie are muppets of the famous American TV series ***Sesame Street***.

These are the list of 15 most famous language models and algorithms used in the domain of NLP which are must know 

**1) LSTM** - Long Short Term Memory

**2) ELMo** - Embeddings from Language Models

**3) GloVe** - Global Vectors for Word Representation

**4) ULMFiT** - Universal Language Model Fine-Tuning

**5) Transformer-XL** - Transformer Extra Long

**6) BERT** - Bidirectional Encoder Representation from Transformers

**7) RoBERTa** - Robustly Optimized BERT Pretraining Approach

**8) ERNIE** - Enhanced Representation through kNowledge IntEgration

**9) GPT-2** - Generative Pretrained Transformer - 2

**10) MT-DNN a.k.a BigBird** - Multi-Task Deep Neural Network

**11) PEGASUS** - Pre-training with Extracted Gap-Sentences for Abstractive Summarization

**12) ALBERT** - A Lite BERT

**13) ELECTRA** - Efficiently Learning an Encoder that Classifies Token Replacements Accurately

**14) T5** - Text-To-Text Transfer Transformer

**15) DAAF** - Data Augmentation and Auxiliary Feature
Aws::S3::Errors:: fix with Travis-CI, Docker and AWS. [JUNE 2020 UPDATE]
Tags: docker, aws, node, javascript
Published: 2020-06-13 11:24:56

DoCker! DOckER! dOCKer!

In my Last 6 months of consistent coding, I have discovered that with each phase of progress, there has always been an interesting Topic/Concept to look forward to in this journey. Few weeks ago, it was docker for me and ... voila!!! Here we are.

I have been following a docker course on Udemy (Docker and Kubernetes The Complete Guide), taught by Stephen Grider (an awesome teacher) for a while and this article tackles a problem I faced with deployment and how I solved It. 

Before going forward, I will like to state that this is **NOT** an exposition into docker but rather an update to a very detailed article written by a tech brother (William Okafor). It will be focused on  **step 8 of his article**. There is no need to reinvent the wheel here. Please do well to check out his article for an in-depth coverage of the Steps involved in building a CI/CD pipeline with Travis-CI, Docker and AWS.You can find a link to his amazing article below. 

*https://medium.com/@wilpat456/my-first-go-at-travis-ci-d0e63ccdc4d0*

While toggling between my course, Williams' article, documentations and StackOverflow, I discovered that there is a breaking change in the *secret_access_key* syntax for the **.travis-yml** file.

###**FROM WILLIAMS' ARTICLE**
> **Step 8: Back to React —**
> We need to update our .travis-yml file with the instructions for 
> deploying our code and then push to github.
> Update yours with the following:


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

***

In the image above, the breaking change is in the `secret_access_key` prefixed by `FIXME:`. 
 
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/nwke9jnzrcca6x2w81n5.PNG)

Using the syntax above, I encountered the issue shown below. 

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

####EXPLANATION:
The problem here is that you are assigning a *plain text value* to the **secret_access_key**. Some months ago, Travis rolled out additional changes to data processing, to prevent the accidental exposure of these secrets.

Previously, this configuration worked because Travis was passing through values whenever the decrpytion failed.

####SOLUTION:
Based on this, Our new configuration is:


![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/9l38owd1yhowb9ubkg7u.PNG)

I hope this article has helped you to make sense of that error and like I earlier pointed out, William did a fantastic job in his article, this is basically an update to a changed synthax. Thanks for reading.
FPSC Patrol Officer Past Papers MCQs

Published: 2020-06-13 11:13:05

If you are Searching FPSC Patrol Officer Past Papers pdf of National Highway and Motorway Police to prepare the Patrol Officer exam or Looking FPSC Past Papers for Patrol Officer MCQs, then look no further.

Here, we will give you All FPSC Patrol Officer Past Papers MCQs with fully Solved Answers. If the answer to any of the MCQs is incorrect, be sure to mention it in the comments below the post. So that the answer to that MCQs can be corrected.


Everyone knows that Past Papers are very plus point for any type of exam. So we share all Past Papers on our website.

In this post, we are sharing the FPSC Patrol Officer Past Papers for the Federal Public Service Commission exam. If you are preparing the Patrol Officer exam then this article is very important for you.

Click on https://testpreparation.pk/fpsc-patrol-officer-past-papers/ to see Past papers of Patrol Officer
Angular Libraries : Refactor Existing Components into their own folders.
Tags: angular, typescript
Published: 2020-06-13 11:03:51

**Deeper into Library Internals**

The Angular schematic for creating a library gives a different view of the project.  This is due to it choosing to use a multi-project layout.

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

This is different than the traditional Angular Project because the component is not contained within it's own folder.

If we move this component into a folder and build again we first see this message. Which is just telling us which project is being compiled. 

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

But the build immediately fails because the public.api.ts file needs to follow the change. 

```
export * from './lib/jwp.service';
export {JwpComponent} from './lib/components/jwp.component';
export * from './lib/jwp.module';
```
Once we changed the file everything worked. 

We learned the AOT compiler compiles that file first as no other output was seen.

The project structure is now starting to look like a 'normal' Angular component layout.

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

**Dependencies**

The node_modules Eco-system loves gigantic dependency chains, for example, download a package; like Material, and you'll find it doesn't include CDK. Manual work is needed to fix dependencies.

Library projects don't store the depenecies in app.module rather they store them in a module that matches the name of your library project.  This means that the angular.json project name must match the module name in your library folder.  

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

When moving files around, the paths to the components in the module file, are auto-updated; which is nice to have.

**Compile Errors**

Projects that compile normally in your other application may not compile correctly in a library project because the compiler used is more strict! It seems to find things not found using ng build in a SPA application.
Wordpress.org and Wordpress.com differences
Tags: wordpress
Published: 2020-06-13 10:56:54

Wordpress.org - you host the website yourself. Recommended as it allows you to upload themes from third party sites. The themes from third party sites are normally a lot better than the ones on the Wordpress website. This is normally cheaper as you can opt for a cheaper host provider and domain registrar. 

Wordpress.com - Wordpress hosts the website for you. Not recommended as the themes you can download and pay for are limited.
A really hacky way to prevent dev.to posts turning up on your stackbit website by tag
Tags: projectbenatar, stackbit, hugo, help
Published: 2020-06-13 10:56:46

So I have found a method to prevent posts with `discuss`, `watercooler`, `help`, etc. turning up in my Stackbit dev.to site by tag. However, I'm actually pretty disappointed with the solution. It's very verbose, very unconfigurable. However, it also does work.

# The Dream

The user can put a single line of code into the hugo template that will accept some array type data object that represents multiple tags. That object can then get fed from the `config.yaml` with some array type data object.

# The Opposite of the dream

The opposite of the dream was easy, it was this one line:

```hugo
{{ range $post := (where $display_posts "Params.tags" "intersect" (slice "Rstats" "rstats" "python")) }}
```

This [commit](https://github.com/DaveParr/daveparrinfo/commit/d4f29da6c0ebc18878af06ddf4c6b7f340c76612) puts it in more context. This line will 
only range the `$post` variable over the `$display_posts` that have a tag that is in the `slice`. So now I just need to invert that.

# Warning signs

[This post onf the Hugo Discourse Forum](https://discourse.gohugo.io/t/negative-intersect-not-intersect-is-needed/13323) was an early find, and a bit disheartening. Still, I cracked on with some more research, and in the end I had to [ask for some help]
(https://discourse.gohugo.io/t/how-do-i-exclude-posts-based-on-any-one-of-multiple-tags/26187/14).

# The 'Ugly' truth

We ended up settling on the most basic of consecutive `if else` statements, with one line for each of the tags we didn't want. As my very helpful new friend put it:

```
{{ if in .Params.tags "tag1" }}<!-- nah //-->
{{ else if in .Params.tags "tag2" }}<!-- nah either //-->
{{ else }}
 <Your content here>
{{end}}
```

[This is the commit I ended up with](https://github.com/DaveParr/daveparrinfo/commit/6c39c76867a4eb0b3958a1f089b39e1a92d9a500)

# Why I don't like it

My new buddy was very helpful, and had some interesting info about [Schrodingers cat](https://www.theguardian.com/science/2019/jun/03/feline-fine-fate-of-schrodingers-cat-can-be-reversed-study), but I think he also could see this was an imperfect solution. It creates one specific problem for maintenance, and means it's more difficult to implement another related feature:

## Maintenance problem

Each time I want to add a new tag to exclude, I need to modify the actual page with new lines of code. Each new tag requires a new line `{{ else if in .Params.tags "tag-to-remove" }}`

## Desired feature

It would be safer and also easier if a data structure in the `config.yaml` could be used, as then the page template remains removed from the business logic, however as a _whole line_ needs to be added for each tag, I don't see a way that the logic can be abstracted away from the template here, which is a shame

# Can you help?

I've written an amount of hugo in side projects, but I'm far from an expert. If you can find a better solution please let me know :)
Road to Genius: beginner #11
Tags: javascript, beginners, computerscience
Published: 2020-06-13 10:42:54

Each day I solve several challenges and puzzles from Codr's ranked mode. The goal is to reach genius rank, along the way I explain how I solve them. You do not need any programming background to get started, but you will learn a ton of new and interesting things as you go.

![programming challenge](https://dev-to-uploads.s3.amazonaws.com/i/xhxjmtsl31gj7ppnixcz.png)

This challenge is an easy one, but will make you think twice.

It starts with a function `nonzero` that takes two parameters `weights` and `i`. Then it declares a variable `j = i+1`, followed by a while-loop with a buggy line of code as body: `🍎++;`. The bug 🍎 can be several things, it can be `j`, `i` or `weights`. But since the parameter `weights` is used as an array, it's unlikely the correct answer. Now we have to choose between `j` and `i`, to figure this one out let's start analyzing the least occurring parameter `i`, it's used only once during the initialization of `j`, it has no further use apparently. So 🍎 is likely going to be `j` because it's also used explicitly in the while-condition.

![programming challenge answer](https://dev-to-uploads.s3.amazonaws.com/i/ss6dxgt5pz5gc0md2bzu.png)

---

If you feel inspired and motivated to upgrade your coding + debugging skills, join me on the Road to Genius at https://nevolin.be/codr/
Wanna Start a Journey Into Tech Writing, get in here.
Tags: writing, career, beginners
Published: 2020-06-13 10:02:04

One thing I found out is, some times it becomes hard to start something, when you see so many people that are 'big names' or experts in that field you want to enter. It's like a standard is already set, and you feel what's the need of even starting.

You forget that those people ahead always had a beginning, and like you they likely had people ahead of them.
So friend don't be afraid to start, just do it.

Some Useful Tips for Tech Writers

__Have the interest & Choose a Niche__

This cannot be overemphasized, else you wane out in the journey, choose a niche you find interest in or are curious about.
There could be so many things that drive your passion for writing, but overall let it be that "you are delivering a great content to the world" that people will enjoy.
There are many areas in tech you can write about, though it's possible to be a 'Jack of All Trade', but I wouldn't recommend this for someone still new to writing in the tech world.

If you find choosing a niche difficult:
- You can check out what others are writing about, along the line  you may get inspired. 
- You can also write about your learning journey no matter what level you are in, it will help others.
- You could also choose a niche based on what's trending, what people are searching about, just go to Google Trends, you will see what people are searching about.
- Some technologies that people are not so clear about, you can do research, then break it down in a clearer way to people. and many more.

__Have mentors or (people who also write)__
On dev.to for example, you can follow writers who you enjoy reading their content or are also in your niche. You could also have a mentor who will guide you, there are a lot of good writers out there who you could learn one or two from.

__Do your research well__
When writing have it at the back of your mind, that people are definitely gonna read your content, and it would be bad if your content contains error or it's outdated, it may be frustrating on the reader's end.
Your content is what always brings the user back, if you want to make content that brings readers back then do your research well. Remember *great writers are also great readers*.

Other tips:
__Be specific__- let's say you are writing a tutorial for Django developers, specify the technologies and tools you are using, it will prevent some 'banging of the keyboard moment'.
__Feedback__- You can always ask for feedback and do well to help readers who are confused about something in your content. I have seen many contents on the web that lack this, they just drop content for the readers and that's it.
__Keep Yourself updated__


*Last, the ocean you see today was formed by yesterday's little drop, add a little drop daily and you will be surprised at the ocean you form, write as much as possible and enjoy yourself.*

This post first appeared on [ugoayo.pythonanywhere.com](ugoayo.pythonanywhere.com)
balalaika IT newsletter #3
Tags: react, node, java, webdev
Published: 2020-06-13 10:00:58

---
title: balalaika IT newsletter #3
published: true
description: Curated IT newsletter. From Russia with love. Issue #3.
tags: #react #node #java #webdev
cover_image: https://dev-to-uploads.s3.amazonaws.com/i/7dwkz927sf2ausnqygq3.jpg
canonical_url: https://blog.balalaikait.com/balalaika-it-newsletter-3
---

# Frontend
- TJ VanToll watched all 27 React Europe talks and provided [us with his notes](https://www.telerik.com/blogs/i-watched-all-27-react-europe-talks-so-you-dont-have-to). 
- [A good read from PayPal](https://medium.com/paypal-engineering/reusing-ui-components-at-enterprise-level-a7df1ea1f8dd) on how they approach sharing UI components at their enterprise level.
- [A Visual Guide To React Mental Models, Part 2.](https://obedparla.com/code/a-visual-guide-to-react-mental-models-part-2-use-state-use-effect-and-lifecycles/) This time it's useState, useEffect and lifecycles.

# Node.js
- [Pointer compression](https://v8.dev/blog/pointer-compression) is a low-level feature recently introduced in V8. Not only it saves memory, but it improves the performance (surprise!). Hopefully, it will be available in Node.js in the future.
- Did you know that there were experiments with jemalloc in Node.js core? As expected, not a silver bullet, but definitely [an interesting read](https://github.com/nodejs/node/issues/21973).

# Java
- [An in-depth overview (with benchmarks!)](https://jet-start.sh/blog/2020/06/09/jdk-gc-benchmarks-part1) of modern garbage collectors applied to a stream processing framework.
- While pointer compression is a recent improvement of V8, [Hotspot JVM had compressed oops for ages](https://wiki.openjdk.java.net/display/HotSpot/CompressedOops).

# General
- Your [ultimate guide](https://github.com/donnemartin/system-design-primer) on learning how to design large-scale systems and prep for the system design interview.
- Joshua Thijssen [describes ALL AWS services](https://adayinthelifeof.nl/2020/05/20/aws.html)  in one sentence each.
- Most modern server machines have NUMA memory architecture, so modern software has to be NUMA-friendly. If you are not familiar with NUMA yet, [check out this post](https://frankdenneman.nl/2016/07/07/numa-deep-dive-part-1-uma-numa/).