teleren/devto huggingface dataset:
Unit testing in Go
Tags: go, testing
Published: 2021-07-03 07:54:37

In this article let's discuss how we can write simple unit tests in go.

All the code from this article is available on [github](https://github.com/karanpratapsingh/tutorials)


{% youtube IorsKSduDaM %}

_I've also made a video, if you like to follow along!_


## Writing our first unit test

Initialize a `sample` module

```
go mod init sample
```

Let's start with adding a `length.go` file with a `Length` function. This function simply returns the length of the input string.

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

In go, tests file are usually named with `_test` (just like we do `.test.js` for jest). Let's create `length_test.go`. 

This is a very basic test function in which we'll be testing out our `Length` function

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

Let's add some test logic

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

Let's run it!

```
go test
```

Yay! our test passed!

```go
PASS
ok      sample  0.429s
```

Now let's change our `expected` variable to `5`, and re-run our test and we should see the test fail

```go
--- FAIL: Test (0.00s)
    length_test.go:10: Expected 5 Got 4
FAIL
exit status 1
FAIL    sample  0.334s
```

### Multiple test cases

Let's add out test cases with `input` and `expected` outputs

_This approach is similar to [`test.each`](https://jestjs.io/docs/api#testeachtablename-fn-timeout) from jest_

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

Update `Test_Length` function to use `testCases`
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ufo80bjc03toc3cpzefd.png)

Run the test cases!

```go
PASS
ok      sample  0.347s
```

Great! Thank you all for reading this article, if you have any questions don't hesitate to reach to me on [twitter](https://twitter.com/karan_6864)
JS1024 has started!
Tags: news, javascript
Published: 2021-07-03 08:10:38

[JS1024](https://js1024.fun/) just started a few days ago!

If you don't know what that is, it's an

> Annual javascript golfing competition

And what you have to do is

> **Create a javascript/shader program that has 1024 bytes or less and make it do something cool.** See the rules for details and the existing demos for some cool examples. Entry is free, so give it a try, it's really fun!
Why DDT?
Tags: programming, history, humor, graybeard
Published: 2021-07-03 08:09:16

For many years I've been in the habit of naming my debugging flag variable 'DDT'.  It recently occurred to me that many programmers today, looking at my code, would not get the joke.  So why DDT?

1. Dichlorodiphenyltrichloroethane (DDT) was developed as the first of
   the modern synthetic insecticides in the 1940s. It was initially
   used with great effect to combat insect pests and became a well
   known, and later notorious, insecticide.

2. From [Wikipedia](https://en.wikipedia.org/wiki/Dynamic_debugging_technique):

   > Dynamic Debugging Technique (DDT) is a series of debugger programs
   > originally developed for Digital Equipment Corporation (DEC)
   > hardware, initially known as DEC Debugging Tape because it was
   > distributed on paper tape.  The name is a pun on the insecticide
   > DDT.  The first version of DDT was developed at MIT for the PDP-1
   > computer in 1961, but newer versions on newer platforms continued
   > to use the same name.  After being ported to other vendor's
   > platforms and changing media, the name was changed to the less
   > DEC-centric version.  Early versions of Digital Research's CP/M and
   > CP/M-86 kept the DEC name DDT (and DDT-86 and DDT-68K) for their
   > debugger, however, now meaning "Dynamic Debugging Tool".

I used DEC's DDT program briefly in the early 80's on the university's DEC-10 mainframe to debug assembly language programs. So to this day I still like the pun.

**PS:** While I never got to use the original DDT from [paper tape](https://en.wikipedia.org/wiki/Punched_tape), I did use paper tape in college (mid-70's) for storing my BASIC language programs.

Yeah, I'm that old.

**PPS:** DDT is a very effective, if dangerous, insecticide, leading some to observe that the acronym should actually stand for Drop Dead Twice.
Let’s learn about the special variable __name__ in python.
Tags: python, programming
Published: 2021-07-03 08:08:31

In python, there is no main() function. When we run a python program, the code is given to the interpreter, then the given code is to be executed at the level 0 indentation, before doing that it will define a few special variables. __name__ is one such special variable. __name__ is a special variable that will store the current module name.
Syntax : __name__
![A image showing 40% responded "Yes", 50% responded "No" and 10% responded "Not sure"](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6wz7imv64ol72ljwrt40.png)
![A image showing 40% responded "Yes", 50% responded "No" and 10% responded "Not sure"](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/z5mzjxmb04yd34tpnwos.png)
![A image showing 40% responded "Yes", 50% responded "No" and 10% responded "Not sure"](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/tdi327as3sgw2m0ven5t.png)
![A image showing 40% responded "Yes", 50% responded "No" and 10% responded "Not sure"](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/j1w2c2gam786vw77xtq6.png)
Why short-circuit in programming?
Tags: devjournal, codenewbie, javascript, 100daysofcode
Published: 2021-07-03 08:07:15

From how data binding and storage works, type of javaScript values: numbers, strings, booleans, null and undefined values. The concept of short-circuiting logical operations is imperative for wrting faster and efficient programs.  

**FYI:**there's lot of differences between logical and comparison operators. But one similarity they share is that they both return a boolean result/value (i.e. True or False).
Logical operators majorly includes the *&&(AND), ||(OR), and !(NOT)*.
 
Short-circuiting is where an expression is stopped being evaluated as soon as its outcome/result is determined.

That is to say, instead of checking the outcome of the two expressions, we can actually use the result of one expression to determine the output of the whole operation. When dealing with the `&&` operator which evaluates as thus:

_True && True = True_
_True && False = False
False && True = False_
_False && False = False_

Since the presence of a false value in an expression renders the whole operation false, it would be pertinent to always place the "value/expression" that will result in a false result first in the expression, so as to save memory operation and increase speed of evaluation. The `&&` operator is always looking for the first false statement to work on.

Checkout these examples:
```
console.log(null && "AnyString")
output: null

console.log("Okay" && "Confirm")
output: Confirm

console.log("user" && null)
output: null
```

While working with the || operator, it is pertinent to place the "value" that would evaluate to true first in an expression. This is the modus operandi of || operator
_True || True = True_
_True || False = True_
_False || True = True_
_False || False = False_

```
console.log(null || "Agnes")
output: Agnes

console.log("user" || "non-user")
output: user

console.log("format" || null)
output: format
```
Checking for the max number; notice that the LH expression `maxNumber == null` is intentionally made to be false.
```
function findMax(maxNumber) {
    if (maxNumber > 2 || maxNumber == null) {
        console.log(`The heighest number is: ${maxNumber}`);
    }
}

findMax(Math.max(4, 31, 6))
```
Thus, as the RH operation evaluates to true, the LH operation is truncated. 
The effect of this process can really be seen while working with functions.
9 Best Free Resources for learning HTML and CSS
Tags: css, html, codenewbie
Published: 2021-07-03 07:29:45

Looking for the best free resources to get you going in your journey towards learning HTML and CSS?
Looking to quickly brush up on your concepts of HTML and CSS?
Want some cheat sheets of HTML and CSS?

If any of the above questions' answer is yes for you, you are in the right place.

**Check out the list of resources given below:**

### 01. [HTML Cheat Sheet](https://digital.com/tools/html-cheatsheet/)
This HTML cheat sheet has a full list of all HTML elements, including descriptions, code examples, and live previews.

### 02. [CSS Cheat Sheet](https://www.onblastblog.com/css3-cheat-sheet/)
This cheat sheet will be ready and waiting for you in your bookmarks for those times when you need a reminder.

### 03. [CSS-Tricks](https://css-tricks.com/)
For daily articles about CSS, HTML, JavaScript, and all things related to web design and development.

### 04. [CSS Wizardry](https://csswizardry.com/)
If you want to write scalable and maintainable CSS, like the BEM methodology and refactoring, you should check out this site.

### 05. [CodePen's Yearly Top Pens](https://codepen.io/2016/popular/pens/)
If you want to have a look at some of the best live demos of things build using HTML and CSS, then this site is for you.
[CodePen](https://codepen.io/) is also one of the best places to build, test, and discover front-end code.

### 06. [Jen Simmons Lab](https://labs.jensimmons.com/)
In this Experimental Layout Lab of Jen Simmons, he uses CSS to implement practical scenarios.

### 07. [Kevin Powell](https://www.youtube.com/user/KepowOb)
Kevin Powell is a great YouTuber who loves to simplify CSS.

### 08. [MDN Web Docs](https://developer.mozilla.org/en-US/docs/Learn/Front-end_web_developer)
I personally like MDN for its up-to-date, clear and briefly defined content for each technology, which is required for starting your career as a web developer.

### 09. [freeCodeCamp](https://www.freecodecamp.org/)
freeCodeCamp has a step-by-step process to it where you don’t just watch, there are tasks for you to complete.

I hope this helps someone out there.

Don't forget to mention what resources you use in the comments below!

**If you liked this post, you can find more by:**
* Following me on Twitter: [@forkbikash](https://twitter.com/forkbikash)
* Following me on GitHub: [@forkbikash](https://github.com/forkbikash)
* Following me on this amazing platform: @forkbikash


<a href="https://twitter.com/share?url=https://dev.to/forkbikash/9-best-free-resources-for-learning-html-and-css-9f4">**Tweet this post**</a>
<a href="https://twitter.com/forkbikash?ref_src=twsrc%5Etfw">**Follow me on Twitter @forkbikash**</a>
Rustで自作OS 2日目
Tags: rust
Published: 2021-07-03 07:08:56

今日は文字を表示するUEFIアプリを作るところから。自作OS本ではまだ1日目。
https://gil0mendes.io/blog/an-efi-app-a-bit-rusty/#the-app-itself を進めていく。
Hello Worldに手を加えるところから。
`#![...]`は`attribute`のようで、`#![no_std] is a crate-level attribute that indicates that the crate will link to the core-crate instead of the std-crate.`とのこと。ベアメタル環境ではつける必要がある。

`#![feature(asm)]`でインラインアセンブリを書けるようにする([The Rust Unstable Book](https://doc.rust-lang.org/unstable-book/library-features/asm.html))。
`#![feature(abi_efapi)]`のページはタイトルだけで中身からっぽだった。

```rust
#![no_std]              // std libを使わない
#![no_main]             // UEFI向けエントリポイントに変更する
#![feature(asm)]        // inline assemblyを呼べる
#![feature(abi_efiapi)] // よくわからないがABIを揃えるような名前

extern crate uefi;
extern crate uefi_services;

use uefi::prelude::*;

#[entry]
fn uefi_start(_image_handler: uefi::Handle, system_table: SystemTable<Boot>) -> Status {
    loop{};
    Status::SUCCESS;
}
```

これを元ブログのPythonスクリプトで`build & run`するんだけど、OVMFのファイルが生成されなくて失敗した。
OFMFについて調べる。
- [OVMFによるPCIパススルー - archlinux wiki](https://wiki.archlinux.jp/index.php/OVMF_%E3%81%AB%E3%82%88%E3%82%8B_PCI_%E3%83%91%E3%82%B9%E3%82%B9%E3%83%AB%E3%83%BC)
- [QEMU/KVMでUEFIファームウェアを使う - gihyo.jp](https://gihyo.jp/admin/serial/01/ubuntu-recipe/0441)

元ブログを読み返すと、見落としがあることがわかった。

>  QEMU doesn’t come with OVMF, so it requires to installing it on your PC or get a pre-built image from the Internet, it’s possible to download it from my test repository.

[元リポジトリ](https://github.com/gil0mendes/Initium/tree/rust)からダウンロードしてくるとrunコマンドでQEMUが動いた。

![Screen Shot 2021-07-03 at 14.27.16](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/h2uqqaa0js055bgsphpn.png)

次は文字を表示させる。

[log crate](https://docs.rs/log/0.4.14/log/)を入れて`info!`マクロでログを表示できるようになった。
![Screen Shot 2021-07-03 at 16.07.53](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ug5ouypas43d9g6tzfet.png)
Why you need Wallaby.js for your Front-End Unit Tests
Tags: testing, wallbyjs, devinnerloop, testingtools
Published: 2021-08-01 05:14:30

---
title: Why you need Wallaby.js for your Front-End Unit Tests
published: true
date: 2021-07-03 06:38:22 UTC
tags: testing,wallbyjs,devinnerloop,testingtools
canonical_url: https://fasterinnerlooper.medium.com/why-you-need-wallaby-js-for-your-front-end-unit-test-6a92953de429
---

![](https://cdn-images-1.medium.com/max/1024/1*72in1hS4SADP9RFVzks5Mw.jpeg)<figcaption>JJKPhoto by <a href="https://unsplash.com/@jn1434?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Jerin J</a> on <a href="https://unsplash.com/s/photos/red%20green?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Unsplash</a></figcaption>

Wallaby.js is a test runner for front-end unit tests. It has been written so that tests are run as you type, giving you an incredible amount of insight into the code you write.

Wallaby.js integrates cleanly with the internet’s favourite IDEs, and can also be run from the command line, allowing for it to be run as part of a git pre-commit hook, or as part of a CI/CD pipeline.

Wallaby.js provides time-travel debugging, which allows you to step backwards and forwards through your tests to understand precisely what values are being set and when, so that you can build tests that are less flaky.

Integration into, for example, Visual Studio Code will makes it easy to see which tests pass, which ones fail, and provide gutter highlighting to show you which parts of your code have been covered, and where failures are occurring.

Wallaby’s strength comes from how quickly it can re-run tests and how quickly it shows errors across both the test file and all of the code that is touched by the test.

![](https://cdn-images-1.medium.com/max/800/1*tZ7yFPjXdb7oPBiZPm_HBA.gif)<figcaption>Wallaby.js in action</figcaption>

In contrast, using Jest’s watch feature, the same change takes more than 4 seconds to run the same test.

![](https://cdn-images-1.medium.com/max/592/1*slB7eqRsD4Q7FNH914cfxA.gif)

And if you’re like me and use Visual Studio Code for everything, there are various extensions that try to get close to Wallaby’s speed, but noting gives you that instant feedback and that wonderful feeling quite like Wallaby.
What is PPC and How it Works?
Tags: ppc, html
Published: 2021-07-03 06:06:52

#What is PPC?
[PPC is Pay Per Click!](https://www.wordstream.com/pay-per-click-advertising) It is an online advertising method, where people click on ads and advertisers charged for per click.

Advertisers are running different types of PPC ads to promote affiliate marketing, ecommerce, or other business.

In Google search, PPC ads display above the fold and before the organic search result. Users may see these ads on both mobile and desktop devices. Google charge businesses for the ads when a user click on that ad. This process is called pay per click ads.

To make Pay-per-Click work, businesses [hire expert PPC management services](https://www.easkme.com/2021/06/find-right-ppc-management-agency-online-business.html).

#How PPC works?

In PPC ads are displayed based on auction. It is an automated process.

To make PPC work, advertiser or campaign manager target keywords.

With the help of tools like "Google Keyword Planner", advertiser find the relevant and targeted keywords. Then use those keywords in the title, description and other parts of the text ads.

For more details... [visit here](https://www.semrush.com/blog/what-is-ppc/)
Mobile Development Job Search...
Tags: android, reactnative, frontend, jobs
Published: 2021-07-03 06:01:40

Hi guys, My name is Prince, I am a software developer that is proficient in mobile development(frontend) using ReactNative, Kotlin, and also in Backend Services. I am actively looking for job/project opportunities that would help me get hands-on experience and progress in my career.

Feel free to contact me for my CV for added info

Whatsapp: +2348029902705
Email address: okeke.p.ebube@gmail.com.
Learn New things about PMP Certification
Tags: pmpertifiation, pmpcourse, pmpcertifiationtraining
Published: 2021-07-03 06:01:04

The Project Management Institute offers the Project Management Professional (PMP) title, which is an internationally recognized professional qualification. PMP certification proves that you have the experience, education, talent, and competency to lead and direct projects. The Project Management Institute (PMI) in the United States offers the <a href="https://www.mercurysolutions.co/pmp-project-management-professional-certification-course-training">PMP Certification</a>.

For senior project manager roles in all industries, the PMP certification is a must-have professional prerequisite. Project Managers, Associate/Assistant Project Managers, Team Leads/Managers, Project Executives/Project Engineers, Software Developers, and any professional desiring to be a Project Manager should take the PMP course.

In this article you will learn <a href="https://www.mercurysolutions.co/blog/steps-to-get-pmp-certification">how to get PMP</a> Certification.

Before you can sit for the PMP exam, you must first complete specific prerequisites, according to the Project Management Institute.
To begin the PMP training course, you must have a secondary degree (i.e. a high school diploma, an associate's degree, or the global equivalent) with 7,500 hours of project management experience and 35 hours of project management education.
Else you must have a four-year degree with 4,500 hours of project management experience and 35 hours of project management education.
 
PMP Certification Exam Fees And Procedure 


One has to pay $555.for taking the exam. In the case of a PMI member you just have to pay $405. After submitting your application PMI will review your application and respond back within 5 business days. Now, you can schedule the exam timing on your own. and you would get up to three chances to take the exam. 
 Study Plans
The PMP Exam has 180 questions and a time limit of 230 minutes. Process (50 percent), People (42 percent), and Business Environment (42 percent) are the three domains in which the questions are divided (8 percent ).
So, if you're just beginning to study for the PMP exam, make sure you're on the correct track. If you are able to study independently then do a little research about the books and study materials. Else, if you are attaining any classroom training program do it with determination and zeal.
 
Prospects of PMP Certification course
 
The demand for project managers is increasing all across the world. In reality, many businesses are preparing their personnel for PMP certification. As a result of this information, there is a greater need for and demand for competent and professional managers. In comparison to a non-certified project manager, a PMP certified project manager earns 20% more. There are many institutions offering online training to prepare for the PMP Certification exam
How To Increase Mobile App Retention In 2021?

Tags: mobileapp, mobile
Published: 2021-07-03 05:49:19

It doesn’t matter if your application has 1,000,000 downloads in the present time, however the dynamic user count is always a question. It is challenging to hold your users and ensure that they keep coming back. And here come the importance of mobile app retention strategies. Here we will be covering various user engagement strategies and suggest ways to “how to increase app retention?” But before digging to the strategies, let us see what is retention rate?

#What Is Retention Rate?
Retention rate is a percentage of users still using your app after a set period, generally measured after Day 1, Day 7 and Day 30. The longer user is retained, the more likely they increase revenue. High retention rate for mobile apps is a good sign that users are having a positive experience. Low retention rate means an issue with your app. For instance, if you observe that high number of users are leaving your app on day 1, you may have issues with the app’s on-boarding.  

#Retention Vs User Acquisition-
Retention and user acquisition are two sides of the same coin. Mobile marketers must work to achieve app growth but it is important to retain as many of those users as possible. It is necessary to identify which channels are delivering the highest value users so that you can invest in retention  strategies to engage them in app for longer and maximize their LTV.

If your app keeps more than a third of users on the first day, means you have great retention rates.

#How To Increase Mobile App Retention Rate?
**1. Track Data From Beginning-**
Best way to measure mobile app retention is, start with cohort analysis. In this analysis you group different users based on their behavior in a particular time frame. Here the key is to identify the reasons why users stop using your mobile app. And accordingly you can take the appropriate action to retain users. Cohort analysis can take just about any data into account. For example, you can use heatmaps to analyse the touch gestures of your users while they use your mobile app. With this, you get to know about various obstructions your users faces when using mobile app. Also, you can create and audit visual recordings. These allows you to replay actual user sessions to identify trends in how users use your app during a particular time frame after downloading.

Know more at- [https://solaceinfotech.com/blog/how-to-increase-mobile-app-retention-in-2021/]