teleren/devto huggingface dataset:
Hacktoberfest #2
Tags: opensource, typescript, npm
Published: 2021-10-20 14:33:31

The last two weeks, I've been making some new Hacktoberfest contributions but I did not write about them. Let's fix that! In this post I will talk about my contribution to [mehrzahl](https://github.com/JoschuaSchneider/mehrzahl).

Mehrzahl is a little npm module to format parts of a template string in singular or plural. Here is the [npm page](https://www.npmjs.com/package/mehrzahl) and this is how it works:
```ts
import { mz } from "mehrzahl"
const str = mz(3)`There {is|are} $value bird{|s} at the park.`
// str = "There are 3 birds at the park."
```


### The issue

The [issue](https://github.com/JoschuaSchneider/mehrzahl/issues/2) I worked on was to add a reverse usage of the `mz` utility (and calling it `zm`) to accomplish this:

```ts
import { zm } from "mehrzahl"
const template = zm`There {was|were} $value bird{|s} at the park.`
template(5) // There were 5 birds at the park.
template(1) // There was 1 bird at the park.
```


### The solution

After writing the new `zm` function, I noticed there was a lot of repeated code between `mz` and `zm`. I decided to refactor and write a `mehrzahl` function to handle the common parts.

```ts
const mehrzahl = (
    amount: number,
    delimiter: string,
    strings: TemplateStringsArray,
    ...valuesToInterpolate: InterpolatableValue[]
  ) => {
      [...]
  }
```

I modified the original `mz` function to use the new `mehrzahl` function:
```ts
export const mz: MehrzahlFormatterFactory =
  (amount, delimiter = DEFAULT_DELIMITER) =>
  (strings, ...valuesToInterpolate) => {
    return mehrzahl(
      amount,
      delimiter,
      strings,
      ...valuesToInterpolate
    )
  }
```

And the `zm` function to do the same:

```ts
  export const zm: ReversedMehrzahlFormatterFactory =
  (strings, ...valuesToInterpolate) =>
  (amount, delimiter = DEFAULT_DELIMITER) => {
    return mehrzahl(
      amount,
      delimiter,
      strings,
      ...valuesToInterpolate
    )
  }
```

Of course to get the reversed effect, I had to create two new types [`ReversedMehrzahlFormatterFactory`](https://github.com/JoschuaSchneider/mehrzahl/blob/bf75c350fa39a7bcad0954d096cbbf611a2f81ee/src/mehrzahl.ts#L16) and [`ReversedMerzahlFormatter`](https://github.com/JoschuaSchneider/mehrzahl/blob/bf75c350fa39a7bcad0954d096cbbf611a2f81ee/src/mehrzahl.ts#L11).

---

The maintainer of the project [Joschua Schneider](https://github.com/JoschuaSchneider) was super nice and he added some helpful comments on my [Pull Request](https://github.com/JoschuaSchneider/mehrzahl/pull/3) (such as suggesting the names he was looking for). Joschua is a student from Germany and he wrote the original code on his own. I am the first one to add new functionality to his little utility and it was a lot of fun. I ofter think of Github as the place where you can find big open source projects but I tend to forget that there are millions of users creating all sorts of fun little projects like this one. The hardest part is always finding them!
Arrays of Objects in Java
Published: 2021-10-20 14:11:12

<b>An array</b> is a collection of items or elements of the same data type placed in a contiguous memory location that can accessed using a unique index.
<b>An object</b> is an instance of a class. so basically, an array of objects is a container of objects collected in an array. Unlike a traditional array that stores values of the same <b>primitive data type</b> like integer, string, boolean, etc., an array of objects stores <b>objects</b>.
Note that an object can have properties with values of different data types.
<b>Example</b>: In a bank setting, you can have an array of customer data that has customer details as objects for example customer details object may have name of the customer, date of birth, account number, account balance, address etc.

<b>Code:</b> Now let's see how to map this example into code.
```java

public class Customer{
    String name, dob, account_no, address;
    double account_balance;
    public Customer(String name, String dob, String acc_no, 
    		 double balance, String address){
        this.name = name;
        this.dob = dob;
        this.account_no = acc_no;
        this.account_balance = balance;
        this.address = address;
   } 

 @Override
public String toString(){
 return "Customer{Name="+ name + ","
 		+ " Date of birth="+ dob + ","
 	        + " Account Number="+ account_no + ","
 		+ "  Balance="+ account_balance + ","
 		+ "  Address="+ address + "}";
}
}

public class Bank{
public static void main(String[] args){

// Customer objects
   Customer c1 = new Customer("Dallington", "16-11-1986", 
                              "43555514145", 660000, 
                              "Kampala");
   Customer c2 = new Customer("John", "09-07-1998", 
                              "43555514628", 21000, 
                              "Mbarara");
   Customer c3 = new Customer("Fylnor","15-07-2000", 
                              "43555514001", 780000, 
                              "Bushenyi");

// Array of customers (Array of customer objects)
    Customer[] customers = new Customer[3];
    customers[0] = c1;
    customers[1] = c2;
    customers[2] = c3;

// Printing the array objects
      for(Customer c: customers){
           System.out.println(c);
      }
   }
}
```
And that's how the concept of array of objects is implemented in java. 
Hope you can make use of this concept in your programming practices or complex projects.
Thank you for taking time to read through this post.
🚀 How to inspect a web page using iPhone Simulator
Tags: tutorial, productivity
Published: 2021-10-20 14:02:34



I thought it was a good idea to write down this super quick guide following a ticket we received while ago regarding an issue that only occurred on Safari Mobile, therefore it was testable only on a real iPhone and/or a simulator. 
So if you are more of an Android-y person like me the simulator is the solution right for you, so there are no more excuses to not to test the features on Safari Mobile before sending them into production 😜

**📥 You need to install these 3 things:**

**1.** First of all you need to update your OS to **Big Sur**. I know the OS update is a long and tedious process and you have been putting it off for weeks, but now is the time to do it. Why so...?

**2.** ...Because you will need it to install **XCode**, as it is picky and requires the latest version of the operating system. XCode is mandatory and you will need it to start the simulator. The download and the install will may take centuries and at times you will feel like it's not progressing at all, but trust it and let it do its magic.

**3.** Meanwhile, download **Safari Technology Preview for Big Sur**. 
You will need this version of Safari to be able to inspect the page directly from the simulator, as normal Safari does not do it very well.
You can find the installation software [here](https://developer.apple.com/safari/download/).

**✈️Time to run the simulator!**

 **1.** Open XCode, right-click on its icon in the dock and go to *Open Developer Tool / Simulator* 
 **2.** Once the simulator is up and running open the iPhone's Safari browser and digit your app localhost url.
 **3.** Now it's time to use Safari Technology Preview. Open it. 
 **4.** If you don't see the tab 'Develop' on the top menu you have to activate it:
 **5.** click on  Safari Technology Preview app menu then go to *Preferences -> Advanced* and then check "Show Develop" . 
 **6.** Finally, go to *Develop/ Simulator - …. / localhost* to make the inspector of the web page you want to debug in the simulator, and then you're done!

Hope you'll find this guide useful. Good hunt 🏹!
Extracting Financial Data Using Python
Tags: python, codenewbie, programming, webdev
Published: 2021-10-20 13:49:51

**Struggling with Virtual Environments**

So before I was even able to pull financial data off Yahoo Finance using Python, I really struggled with remembering how to create a virtual environment (venv). I’ve always known that it is important to work on a venv so as to not interfere with the global Python environment. Additionally, it makes it easier to share my work with other developers.

**Libraries and Dictionaries**

Regardless, after being saved by tech Indian gurus on YouTube, I immediately got started on reviewing an article by [Ran Aroussi] (https://aroussi.com/post/python-yahoo-finance) , who developed the yfinance library. This library is able to reliably extract data from Yahoo Finance. 
After installation of the pip command (pip install yfinance), I had to pass an argument of the ticker symbol that I wish to extract information from. A ticker represents each stock/security uniquely for trading purposes. In this illustration, I wanted to extract Facebook’s financial data using the ticker “FB”.

![Extracting Financial Data Using Python](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/bov29maeqvmoucnfijah.png)

**Extracting keys from the dictionary**

Company information is contained within the info dictionary. I was able to extract certain elements of the dictionary by printing the keys of the info dictionary. Examples of the keys I extracted include: ‘sector’, ‘address1’ and ‘fiftyTwoWeekHigh’.


**Being Specific**
Additionally, it is possible to extract daily prices over a specified period of time. This is possible through specifying the period. Valid entries include 1d, 5d, 1mo, 3mo, 6mo, 1y, 2y, 5y, 10y and ytd(year to date).
Furthermore, I was able to extract daily prices within a range of time. First, I had to import the datetime library. According to Python [documentation] (https://docs.python.org/3/library/datetime.html), the datetime module supplies classes for manipulating dates and times. Specifically, the class datetime.datetime contains attributes of year, month, day, hour, minute, second, microsecond and tzinfo.
I proceeded to define my start and end dates and got an output of daily prices between the specified dates. 

######Disclaimer: Here to share my thoughts in this self-taught journey.
Sparks Foundation Banking Project - Converted to Full-Stack Mode With PHP and MySQL
Tags: javascript, php, mysql, webdev
Published: 2021-10-20 13:10:49

The Project that they had assigned was quite simple. As a good developer I did what they asked me to, however the researcher in me aroused the gig for more and I decided to convert this basic project into a complete full stack project with a login,signUp system and three admin panels. This project uses the traditional PHP and MySQL framework and the files to the can be downloaded along with the source code through the following link : 
https://github.com/Souvik1406/The-Sparks-Foundation-Basic-Banking-System-Internship-Project

To Read more about the project go to my DevPost Portfolio : https://devpost.com/software/complete-banking-system-full-stack
[WEBINAR] Ansible Automation for ServiceNow
Tags: webinar, servicenow, automation, ansible
Published: 2021-10-20 13:01:20

This time we’ve teamed up with Devoteam to organize a webinar, focused on helping current ServiceNow users boost their automation to a new level by introducing Ansible Automation Platform to their existing ServiceNow environment. 
 
[By joining our webinar] (https://alps.devoteam.com/event/devoteam-xlab-steampunk-ansible-automation-for-servicenow/), you’ll learn more about: 
* current IT automation trends
* Red Hat Ansible Automation Platform
* ServiceNow automation options, including the Certified Ansible Collection for ServiceNow

 
**Save the date - November 2, 2021 | 11.30 am CET** (and on-demand recording available shortly after the webinar’s conclusion)

[![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/sg143ewdj5j67xe1s6fw.png)] (https://alps.devoteam.com/event/devoteam-xlab-steampunk-ansible-automation-for-servicenow/)
AWS VPC Endpoint Service for Access Elasticache Redis From Multiple AWS Accounts
Tags: aws, redis, vpc, elasticache
Published: 2021-10-20 12:58:40

This is a scenario, that  how to access the AWS Elasticache From Multiple AWS Accounts using VPC Endpoints. 
Eg: AWS Account A Application Servers needs to Access the AWS Account B Elasticache Service trough VPC Endpoints.
How to use the JavaScript startsWith() method?
Tags: javascript, tutorial, beginners
Published: 2021-10-20 12:38:17

In this short tutorial, we look at how to use the JavaScript startsWith method. We break down the code with an example to help you understand the concept better.

## Table of Contents - JavaScript startsWith():
- [What does startsWith do in JavaScript?](#what-does-startswith-do-in-javascript)
- [Code and Explanation](#code-and-explanation)
- [Closing thoughts](#closing-thoughts-javascript-startswith)

## What does startsWith do in JavaScript?

The JavaScript startsWith method is used to determine whether a string starts with a character or a particular string. The method returns a boolean true in case the string starts with the specified characters.

This method is commonly used to check if the entered string contains a substring. Although there are other methods that can be used to find substrings, the startsWith() method is specifically used to check the start of a string.

### Syntax:
```javascript
startsWith(SearchString)
```
### Parameters
- SearchString - Required, the character/ string to search
- Position - Optional, used to specify the position to begin the search
### Return Value:
The method returns a boolean true if it finds the SearchString and false if it doesn’t.

## Code and Explanation:
In this section, we look at the implementation of the startsWith method.
```javascript
const str_1 = 'Join our freelancer community';

console.log(str_1.startsWith('Join'));
// Output: true

console.log(str_1.startsWith('Join', 3));
// Output: false

console.log(str_1.startsWith('our', 5));
// Output: true
```
In the above code, the first statement returns true as the string begins with ‘Join”. However, in the second statement, we have passed a position argument. Hence the startsWith operator starts searching from the 3 index and returns a false.

Similarly, the last statement returns true as ‘our’ start’s in the 5th index.

## Closing thoughts - JavaScript startsWith:
A major caveat while using the startsWith method is that it is case-sensitive. Unlike the includes() method in JavaScript, the startsWith method is used specifically to find if a string starts with a string.

However, in case you are just looking to find a substring, I would recommend using the includes() method.

Once you are done practicing using the startsWith methods you can try the endsWith method.
What was the first program you wrote?
Tags: watercooler, career, beginners, development
Published: 2021-10-20 12:57:20

When I was in middle school, a friend showed me that you could write programs on a TI-84 calculator.

I didn't know about loops, variables, functions, or conditionals.

All I knew was how to print text and use goto statements.

![Gif of program](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ao6eznwy11dxd3k17ib0.gif)

But that limited knowledge was enough for me to make simple scrolling animations when I was bored in math class.

Knowing only a small number of programming constructs can sometimes be enough to make simple programs.

When you first started learning about code, what was the first program you wrote? How far have you come since then?
Wednesday Links - Edition 2021-10-20
Tags: java, testcontainers, kotlin, jvm
Published: 2021-10-20 12:51:44


Executable JavaDoc Code Snippets (5 min read)🦾
https://www.morling.dev/blog/executable-javadoc-code-snippets

Faster Charset Encoding (9 min read)🔣
https://cl4es.github.io/2021/10/17/Faster-Charset-Encoding.html

Harden Performance of REST calls using Spring WebFlux (7 min read)💪
https://www.steadybit.com/blog/harden-performance-rest-calls-spring-webflux

Revisiting BetterTLS: Certificate Path Building (16 min)🔏
https://netflixtechblog.com/revisiting-bettertls-certificate-path-building-4c978b79843f

Three and a half ways of running Docker on Windows and macOS (10 min read)📦
https://www.atomicjar.com/2021/10/docker-on-windows-and-macos

Testcontainers-java 1.16.1 (30 sec read)🎉
https://twitter.com/testcontainers/status/1450431112023576584

Multi-release JAR files (5 min read)📄
https://twitter.com/brunoborges/status/1448362171465814016

IntelliJ IDEA 2021.2.3 (30 sec read)🎉
https://twitter.com/intellijidea/status/1448929601363668995

Kotlin and FaaS, an impossible union? (4 min)🧬
https://blog.frankel.ch/kotlin-faas-impossible-union

Kotlin Symbol Processors (2 min read)🔣
https://blog.jetbrains.com/kotlin/2021/10/kotlin-symbol-processors

Testing in a modular world (10 min read)🔨
https://info.michael-simons.eu/2021/10/19/testing-in-a-modular-world

The Case for ‘Developer Experience’ (19 min read)🚗
https://future.a16z.com/the-case-for-developer-experience
From contributor to maintainer - any tips or advice?
Published: 2021-10-20 12:46:25

### 👋  Hello fellow devs!

For my 3rd Hacktoberfest challenge, I finally decided to participate mainly as a maintainer and I would like to share and discuss with you the benefits (and difficulties! 😬) of it!

----
### 👀  My background

Coding and contributing to projects are only side activities for me. Still, I always loved the spirit behind open source projects and I wanted to be part of it!

----
### 🎯  Goals

I used to participate in the Hacktoberfest challenge as a contributor as it was for me a great opportunity to gain experience and to understand how things worked. 

But I am also a maintainer of the [aliceandbob.io](https://aliceandbob.io) project on Github.

#### It was then a good opportunity for me to change my approach: I decided that I would open issues on this project for contributors to work on. ✨

I wanted to offer some really easy-to-resolve issues, more to understand how to contribute rather than actually coding - in short, **everything that I wanted to find when I was a first-time contributor to the hacktoberfest!** - which was for me a good way to start smoothly as a maintainer.

{% github aliceandbob-io/aliceandbob %} 

----
### 🚧  The journey

I started by opening begginer-friendly issues such as this one:

{% github https://github.com/aliceandbob-io/aliceandbob/issues/39 %}

By doing so I was able to follow the work of potential contributors, to answer them and to guide them if needed. It was also the opportunity for me to understand the **role of a maintainer and a reviewer**, to **assign properly issues** and to make sure that contributors would follow the **guide of conduct and the Git and Github concepts**. 

So far so good I must say! I am learning a lot as a maintainer, which is not always as easy as I would have thought! 😅

----

### 🔥  Next steps!

My Hacktoberfest 2021 experience as a first-time maintainer is really exciting and I will definitly participate next year as I am learning a lot. 

**But now, I would like to be able to open several and complicated issues at the same time, dealing with multiple pull requests and struggling with merge conflicts 🤯 In short, going a step further in open-sourcing the project!**

I was then wondering what was your experience of it, both as maintainer and as contributor. What makes a good maintainer? What are the biggest issues you are dealing with? Are you sometimes overwhelmed with inputs from contributors? etc.

I would love to read from you all! 🙏

Thanks a lot for reading and for your comments! 

----

Happy Hacktoberfest to all of you! 🎃
Smooth Scroll Stimulus
Tags: javascript, stimulus, webdev, rails
Published: 2021-10-20 12:44:59

<small>Orginally published at Medium on Feb 28th 2020.</small>

Elegantly slide to a section of a page
![Smooth scroll](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/h5t62i7qvj8tj3xnxv4e.gif)

1. [Install the package](#1-install-the-package)
2. [Add Stimulus Scroll-To library](#2-add-stimulus-scrollto-library)
3. [Add sidebar](#3-add-sidebar)
4. [Add content](#4-add-content)

Learn how to set up a smooth scrolling with Ruby on Rails and [Stimulus Components](https://github.com/stimulus-components). This is a simple and clean way to enable users to slide to a different section of a page.

---

__Before You Start__

Make sure you have Stimulus installed. Check the package.json file or run `yarn why stimulus`. If Stimulus is not yet installed, follow the [documentation](https://stimulus.hotwire.dev/handbook/installing).

---

## 1. Install the package

Add [Stimulus ScrollTo](https://stimulus-components.netlify.app/docs/components/stimulus-scroll-to/) to your project
```bash
yarn add stimulus-scroll-to
```

---

## 2. Add Stimulus Scroll-To library
```js
import { Application } from 'stimulus'
import { ScrollTo } from 'stimulus-scroll-to'

const application = Application.start()
application.register("scroll-to", ScrollTo)
```
---

## 3. Add sidebar
![Sidebar img](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/17ztjokisy3yg68nu52p.png)

```erb
<div class="flex">
  <div class="w-1/5">
    <small class="pb-3 text-sm italic">click a link in the sidebar 👇</small>
    <ul class="sticky flex flex-col w-full h-auto p-2 space-y-4 bg-white border-4 border-gray-500 rounded-lg top-16">
      <li><%= link_to "Introduction", "#introduction", data: {controller: "scroll-to"}  %></li>
      <li><%= link_to "Technical Overview", "#technical_overview", data: {controller: "scroll-to"}  %></li>
      <li><%= link_to "Philosophy & Design", "#philosophy_design", data: {controller: "scroll-to"}  %></li>
      <li><%= link_to "Framework Structure", "#framework_structure", data: {controller: "scroll-to"}  %></li>
      <li><%= link_to "Trademarks", "#trademarks", data: {controller: "scroll-to"}  %></li>
    </ul>
  </div>

  <div class="w-4/5"></div>
</div>

```

- __data-controller=”scroll-to”__ scopes the imported controller to every individual link_to.
- The __hashtag(#)__ in the link_to will look on the same page for a matching id. From __#introduction__ to __id=”introduction”__

---

## 4. Add content

```erb
<div class="w-4/5">
  <article>
    <ul>
      <li>
        <p id="introduction">Introduction</p>
        <p>PARAGRAPH HERE</p>
      </li>
      <li>
        <p id="techincal_overview">Techincal Overview</p>
        <p>PARAGRAPH HERE</p>
      </li>
      ...
    </ul>
  </article>
</div>
```

Note that the code snippet above is a simplified, without Tailwind CSS classes, in order to keep the view clean

That’s it, Smooth Scrolling is now functional!

Thanks for reading!
Azure File Transformation Task doesn't work for variable name with hyphen
Published: 2022-07-05 10:48:01

---
title: Azure File Transformation Task doesn't work for variable name with hyphen
published: true
date: 2021-10-20 12:30:13 UTC
tags: 
canonical_url: https://lkgforit.com/azure-file-transformation-task-doesnt-work-for-variable-name-with-hyphen
---

Read this article on how to implement File Transformation Task implementation:

[https://lkgforit.com/azure-devops-yaml-file-transformation-task-for-json-file-end-to-end](https://lkgforit.com/azure-devops-yaml-file-transformation-task-for-json-file-end-to-end)

In some scenarios YAML File transformation task fail to update the variable values inside the json/xml file even though we have variables with same name matches.

One of those scenarios is that when we have hyphen in the variable name matching text then it doesn't work.

This doesn't work.

```
{
"element-ToBe-Replaced":""
}

```

Try to change those variables without any special characters then it will work fine.

This will work if you have

> elementToBeReplaced

variable in pipeline variables and have following sample json in configuration json.

```
{
"elementToBeReplaced":""
}

```