teleren/devto huggingface dataset:
Ganymede Kernel 1.1.0.20210614 Released
Tags: java, jupyter
Published: 2021-06-14 18:59:36

---
title: Ganymede Kernel 1.1.0.20210614 Released
published: true
date: 2021-06-14 00:00:00 UTC
tags: Java,Jupyter
canonical_url: https://blog.hcf.dev//2021/06/14/ganymede-kernel-release-announcement.html
---

[Ganymede Kernel](https://github.com/allen-ball/ganymede) 1.1.0.20210614 is released.

The [Ganymede Kernel](https://github.com/allen-ball/ganymede) is a [Jupyter Notebook](https://jupyter-notebook.readthedocs.io/en/stable/index.html) Java [kernel](https://jupyter-client.readthedocs.io/en/stable/kernels.html) based on [JShell](https://docs.oracle.com/en/java/javase/11/docs/api/jdk.jshell/jdk/jshell/JShell.html?is-external=true) combined with an integrated [Apache Maven](https://maven.apache.org/)-like POM, support for JVM languages such as [Groovy](https://groovy-lang.org/), [Javascript](https://www.oracle.com/technical-resources/articles/java/jf14-nashorn.html), and [Kotlin](https://kotlinlang.org/), and support for [Apache Spark](http://spark.apache.org/) and [Scala](https://www.scala-lang.org/) binary distributions.

<!--more-->

This release adds support for:

- [Markdown](https://en.wikipedia.org/wiki/Markdown) ([CommonMark](https://commonmark.org/)) with [Handlebars](https://github.com/jknack/handlebars.java), [FreeMarker](https://freemarker.apache.org/), and [Velocity](https://velocity.apache.org/)) templating languages in addition to [Thymeleaf](https://www.thymeleaf.org/index.html) templates
- [Apache Spark](http://spark.apache.org/) 3.1.2
- [Rendering](https://allen-ball.github.io/ganymede/ganymede/server/Renderer.html) [TableModel](https://docs.oracle.com/en/java/javase/11/docs/api/java.desktop/javax/swing/table/TableModel.html?is-external=true)s

Binary and source downloads are available from [https://github.com/allen-ball/ganymede/releases/tag/v1.1.0.20210614](https://github.com/allen-ball/ganymede/releases/tag/v1.1.0.20210614).

Quickstart if Java 11 (or later) and [Jupyter](https://jupyter-notebook.readthedocs.io/en/stable/index.html) are already installed:

```
$ curl -sL https://github.com/allen-ball/ganymede/releases/download/v1.1.0.20210614/ganymede-kernel-1.1.0.20210614.jar -o ganymede-kernel.jar
$ java -jar ganymede-kernel.jar --install

```

Please see the project [page](https://github.com/allen-ball/ganymede) for detailed [installation](https://github.com/allen-ball/ganymede#installation) instructions and its [features and usage](https://github.com/allen-ball/ganymede#features-and-usage).
AWS IAM Self Tagging EC2 Instances
Tags: iam, ec2, aws
Published: 2021-06-13 21:50:05

---
title: AWS IAM Self Tagging EC2 Instances
published: true
date: 2021-06-13 21:21:03 UTC
tags: iam, ec2, aws
canonical_url: http://unixorn.github.io/post/iam-self-tagging/
---

For a variety of reasons, I needed to enable some EC2 instances to write/update a single EC2 tag, but the instaces needed to only be able to tag themselves.
<!--more-->

This was more annoying than I expected, so I'm documenting the IAM policy here.

```json
{
  "Version": "2012-10-17",
  "Statement": [
      {
          "Effect": "Allow",
          "Action": [
              "ec2:DeleteTags",
              "ec2:CreateTags",
              "ec2:DescribeInstances"
          ],
          "Resource": "*",
          "Condition": {
              "StringEquals": {
                  "aws:ARN": "${ec2:SourceInstanceARN}"
              },
              "ForAllValues:StringEquals": {
                  "aws:TagKeys": "THAT_ONE_ALLOWED_TAG"
              }
          }
      }
  ]
}
```

Some notes:

1. The AWS IAM editor in the webui will complain about SourceInstanceARN. Ignore it and click next anyway.
2. Then it will complain that the policy doesn't add any permissions. It lies. Ignore it and save the policy.

You can attach this policy to an IAM role and the instances will then be able to tag themselves, but only with the `THAT_ONE_ALLOWED_TAG` tag.
Best Way To Change WiFi Password
Tags: wifi
Published: 2021-06-13 23:35:11

The best way to change wifi password using router login is here ! If you use a different router, or if you want to have a static IP address for the router you are using, you can use the router admin panel to make configurations !

Wanna change wifi password ? please refer to this guide:

https://routerhax.com/change-wifi-password/
Preventing concurrent GitHub Actions
Tags: github, actions, jamstack, pages
Published: 2021-06-13 22:49:22


## GitHub Actions Workflows

What happens when you trigger a [GitHub Actions](/github-actions-101) workflow which is already running? Workflows which depend on being run one-at-a-time might fail.

I recently encountered this with a [workflow](https://github.com/jldec/cloudflare-pages-test/blob/main/.github/workflows/generate.yaml) for publishing a static website. This workflow generates HTML files which are pushed to another git repo for publishing by [GitHub Pages](https://pages.github.com/).

![Screenshot of Github Actions log showing failed git push](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/occ88489u0tqlayurx8z.png)

When two workflows try to push to a checked-out repo at the same time, one will fail because it is missing the last commit from the other.

 This is just one example where concurrent workflows are problematic. Workflows which [automate](https://github.community/t/serializing-workflow-runs-in-the-context-of-continuous-deployment/17559) [deployments](https://github.community/t/how-to-limit-concurrent-workflow-runs/16844) have the same [problem](https://github.community/t/serializing-queueing-deployment-workflows-aws-re-invent/17152).

A number of 3rd party [solutions](https://github.com/softprops/turnstyle) exist, but these introduce additional waiting costs or other issues. For one of my projects, I host a lock-service, just to force concurrent workflows to exit quietly, and then auto-trigger re-runs.

Finally, on April 19, 2021, [this](https://github.blog/changelog/2021-04-19-github-actions-limit-workflow-run-or-job-concurrency/) appeared in the GitHub Blog.

![Screenshot of GitHub Blog from April 19, 2021 announcing the new concurrency key in GitHub Actions](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ab4g8ngotnprbhnnyw37.png)

In the case of using actions to generate a GitHub Pages website, [the feature works](https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#concurrency) exactly as required.

- The first workflow will run to completion.
- Subsequent concurrent workflows will either be delayed or cancelled.
- In the end only the first and last of the overlapping workflows will be run.

And all you need is [2 lines of yaml](https://github.com/jldec/cloudflare-pages-test/blob/main/.github/workflows/generate.yaml#L5-L6).
This is from the workflow which generates [jldec.uk](https://jldec.me/first-steps-using-cloudflare-pages#github-pages).

[![Screenshot of yaml for GitHub Action with concurrency group](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/v48sfd7coyg2a93f35j1.png)](https://github.com/jldec/cloudflare-pages-test/blob/main/.github/workflows/generate.yaml#L5-L6)

The `group` can be any string - workflows in the same group are effectively serialized.

> Thank you GitHub!
How to remove duplicates from an array in Dart
Tags: darklang, dart, flutter, algorithms
Published: 2021-06-13 22:22:15

removeDuplicates(){
final list = [1, 2, 2, 3, 4, 4, 4];

return list.toSet().toList();
}

Output: [1,2,3,4]

Explanations: First we initialized a variable called list to an array that contains some duplicates, then we converted it to a set(as sets can not contain duplicates) and then back to a list.

Don't forget to follow me if you like tips like this 😉
New project - pill tracker.
Tags: react, project
Published: 2021-06-13 22:16:08

This going to be a pretty small app. Firstly I want to create it in React.js and then recreate it in React Native. I need a mobile version more but I also want to learn CRUD operations in React in general. So I hope to kill two birds with one stone. Or maybe even 3 because it's not going to be not only a UI but also I will be working with a database. 

User Story:
1. Mary needs to give her son medicines every day. The kid has to take the medicines for a longer period of time. 
2. The doctor prescribes a few packs of the drugs, so Mary needs to call the doctor and make an appointment at least 2 weeks before the drugs are running out. 
3. Mary has an app where she writes down the name of a drug, the amount of pills in the pack(s) she has, the dosing frequency and the dose.
4. She also wants to store the name and the telephone number of a doctor, the approximate date of running out of the drug as well as the date of the next appointment.
5. When she puts all the data, she wants to be notified when she needs to give the pill (with a nice sound), she wants to tick the tracker when she gives her son the pill and she wants to see how many doses are left. 
6. She wants to be informed by the system that she needs to call the doctor. It could be a nice addition if that information was also sent by email/SMS to her husband. 

As I wrote before, I'm going to be using React and React Native. I also want to use Redux and Sqlite for React Native. For styling, I'm choosing my favourite styled-components that can be used in React Native. And FontAwesome for icons.
Javascript check for values
Tags: javascript
Published: 2021-08-18 05:06:54

---
title: Javascript check for values
published: true
date: 2021-06-13 22:15:04 UTC
tags: javascript
canonical_url: https://germangamboa.com/posts/javascript-check-for-values
---

I forgot where I saw this a while back but I wanted to documented here for anyone who might find it helpful (future me).

So when you have to check a value against other values rather than doing a bunch of if else statements

```javascript
const value_to_check: string = "purple";

if ("green" === value_to_check) {
    // do the thing
} else if ("red" === value_to_check) {
    // do the thing
} else if ("blue" === value_to_check) {
    // do the thing
}

```

or doing a switch statement

```javascript
const value_to_check: string = "purple";

switch (value_to_check) {
    case "red":
        // do the thing
        break;
    case "green":
        // do the thing
        break;
    case "blue":
        // do the thing
        break;
    default:
    // do the thing
}

```

It is best to do the following. It is also really nice on the eyes.

```javascript
const value_to_check: string = "purple";

if (["green", "blue", "red"].includes(value_to_check)) {
    // do the thing
}

```

Thanks for coming to my ted talk! - German
CSS Rule order of precedence
Tags: css, specificity, html, cssrule
Published: 2021-06-13 21:47:47

![sdgsdg](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/xi5sbrvcvvs1t2dn017i.png)
 This is the order of precedence(Highest to lowest):
1. Specific rules: When we target html by claa or id or tag. Order 
   of precedence is ID>class>tag. IF specificity is the same, later takes the precedence.

2. Inline styles
3. Embedded styles: Styles defined inside the header of a page.
4. External styles
5. Browser Default
Semantic Vs Non Semantic HTML
Published: 2021-06-13 21:18:00


**Introduction to Semantic HTML**

When building web pages, we use a combination of non-semantic HTML and Semantic HTML. The word semantic means “relating to meaning,” so semantic elements provide information about the content between the opening and closing tags.

By using Semantic HTML, we select HTML elements based on their meaning, not on how they are presented. Elements such as <div> and <span> are not semantic elements since they provide no context as to what is inside of those tags.

For example, instead of using a <div> element to contain our header information, we could use a <header> element, which is used as a heading section. By using a <header> tag instead of a <div>, we provide context as to what information is inside of the opening and closing tag.

**Why use Semantic HTML?**

**

## Accessibility:
Semantic HTML makes webpages accessible for mobile devices and for people with disabilities as well. This is because screen readers and browsers are able to interpret the code better.

## SEO:
It improves the website SEO, or Search Engine Optimization, which is the process of increasing the number of people that visit your webpage. With better SEO, search engines are better able to identify the content of your website and weight the most important content appropriately.

## Easy to Understand: 
Semantic HTML also makes the website’s source code easier to read for other web developers.

To better understand this, you can think of comparing non-semantic HTML to going into a store with no signs on the aisles. Since the aisles aren’t labeled, you don’t know what products are in those aisles. However, stores that do have signs for each aisle make it a lot easier to find the items you need, just like Semantic HTML.
LeetCode 238. Product of Array Except Self (javascript solution)

Tags: algorithms, javascript
Published: 2021-06-13 21:03:55

###Description:
Given an integer array nums, return an array answer such that answer[i] is equal to the product of all the elements of nums except nums[i].

The product of any prefix or suffix of nums is guaranteed to fit in a 32-bit integer.

You must write an algorithm that runs in O(n) time and without using the division operation.

###Solution:
Time Complexity : O(n)
Space Complexity: O(n)

```javascript
var productExceptSelf = function(nums) {
    // Value to increment per each index
    let carry = 1
    // Array to return all the product values
    const output = Array(nums.length).fill(1)
    // Add products to output array starting at the front
    for(let i = 0; i < nums.length;i++){
        output[i]*=carry
        carry*=nums[i]
    }
    // Reset carry
    carry = 1
    // Add products to output array starting at the back
    for(let i = nums.length-1; i >= 0; i--){
        output[i]*=carry
        carry*=nums[i]
    }
    return output
};

```
Connecting to Ethereum
Tags: blockchain
Published: 2021-06-13 20:49:09

While studying blockchain development. I just learned about how to connect to the Ethereum blockchain. The two ways that I discovered, so far is downloading the complete node which can take a long time and take up a lot of space or use an application to assist with it.

I am going to be discussing the application that you can use to connect quickly and not worry about taking days or hours to sync to the blockchain. **Infura** is an infrastructure that allows developers to implement blockchain applications from testing to deployment with simple access to Ethereum.

The client that Infura uses is called Geth. Geth is a golang implementation of the Ethereum blockchain. It is pretty cool that this application allows you to connect with simple ease. More to come soon.

Happy coding.
Linked List vs Array
Tags: array, linkedlist, algortihm, notes
Published: 2021-06-13 19:50:21

**Zach, next time you come back to this, let's try to answer the question at the bottom**

[When to use which?](https://stackoverflow.com/questions/393556/when-to-use-a-linked-list-over-an-array-array-list)

Algorithm        |   ArrayList |  LinkedList
-----------------|-------------|------------
seek front       |     O(1)    |     O(1)
seek back        |     O(1)    |     O(N)
insert at front  |     O(N)    |     O(1)
insert at back   |     O(1)    |    O(1)
insert after an item | O(N)    |    O(1)

Why?

>Arrays have O(1) random access, but are really expensive to add stuff onto or remove stuff from.

>Linked lists are really cheap to add or remove items anywhere and to iterate, but random access is O(n).

This makes sense. Linked lists can only be searched sequentially. You have to search node-to-node, front-to-back -- O(n).

The 'problem' with arrays is that they have a fixed size. So when you manipulate the array from somewhere other than the very first/last item, it has to do a whole lost of work [shifting elements around](https://gamealchemist.wordpress.com/2013/05/01/lets-get-those-javascript-arrays-to-work-fast/):

>One important thing to notice, that is hidden by the simplicity of push(), pop(), among others, is that any time you change the size of an array it might lead to memory allocation and/or memory fragmentation and/or memory copy.
Exemple :
```
// let us allocate 3 arrays : 
var A = [5,6], B = [1,2,3], C = [ 1, 2, 4 ];   
// let's push a value on B :
B.push (1);  
// let's pop a value on C : 
C.pop();
```
>those 3 lines of code will be handled like this :

![push/pop arrays](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/pmyqmgiogmy5vxtk5zc3.png)

This explains `insert after an item: O(N)`. Shifting all those items around is a complex operation. 

###A question I have:
In order to insert in the middle of a linked list, don't you have to traverse the array to find the position? If so, isn't that an O(n) operation? So why wouldn't this cause insert to inherit the O(n) search cost that occurs before the actual insert?
How to run a task periodically in java
Tags: java, schedulers, executors
Published: 2021-07-03 07:34:54

---
title: How to run a task periodically in java
published: true
date: 2021-06-13 08:38:10 UTC
tags: java, schedulers, Executors
canonical_url: http://bazlur.com/2021/06/how-to-run-a-task-periodically-in-java/
---

Sometimes you want to run a particular task at a fixed rate periodically. The job could be anything, e.g. you may want to call a rest API to check for an update, or perhaps pull information from a database, do some processing, and then send an email. Or maybe you want to keep your eyes on the stock exchange. The following code snippet will allow you to do that sort of task precisely.

![100DaysOfProgramming_Day004](http://bazlur.com/img/Day007.png "100DaysOfJava")

In this code, we are reading stock exchange quote from google to see the bitcoin price in CAD every 5 minutes.

for **copy/paste** pleasure: [https://github.com/rokon12/100DaysOfJava/blob/main/src/main/java/com/bazlur/Day007.java](https://github.com/rokon12/100DaysOfJava/blob/main/src/main/java/com/bazlur/Day007.java)
React Hooks do what???
Tags: javascript, react, codenewbie
Published: 2021-06-13 19:45:27

It took me a minute (a lot of minutes) to understand React Hooks. Here is a little bit of basic Hook info.

Prior to React Hooks being introduced, functional components were very limited in what they could do. With React 16.8 we were introduced to Hooks that provide a lot of flexibility to reuse code! It allows you to use state and other React features without writing a class. Hooks are the functions which "hook into" React state and lifecycle features from function components.

Hooks are Javascript functions but have additional rules. Don't call Hooks inside loops, conditions or nested functions.  Only call Hooks at the top level AND only from React function components.

An example of a Hook we will see in a counter component that has a button to update the counter.  Set an initial state the value of 0. We want the counter to increase by 1 each time the button is clicked. We will need an event handler for that. But to simply look at the useState Hook see below:

import { useState } from 'react';

function ThisExample() {
const [ count, setCount ] = useState(0);

useState returns 2 values: the current state and a function to update it.
C++ what does break do
Tags: c, code
Published: 2021-06-13 19:34:32

Contents 
Break in C/C++
Switch statement 
Syntax 
Flow Diagram 
C++ Break
Summary 
Article Tags
Example 
 

Break Statement in C/C++:
This is often the case in real life. We have to choose one of many items. For example, choose one of many programming languages. Choose one of the many programming websites.  Choosing a hotel to dine at. Choosing one of the many institutes. In such a situation the use of if statement becomes very long and complicated. C ++ alternative control statement to solve this problem.  With the help of this you can transfer control to any part of the program. So dear student, before clarifying the break statement, I will tell you to use the switch statement first so that you can use the break statement properly.  This is the control statement that allows us to select one of the many cases and follow the statement written under that case.

Switch statement :

 If the switch statement is viewed more comprehensively, then it is switch _case_.  Default. Because these three specific words combine to form a control statement.  Any integer expression can be given in brackets after the specific word of ch. which gives a number. When that number is like the number in front of a case, then the program along with all the statements written under that case.  Also executes all the given case and default statement given later. So now if we talk about break statement then let's try to understand. 

Syntax :
The syntax of a break statement in C++ is −
 

> Break;
Flow Diagram:





C++ Break:
If you want only case 2 to be executed.  It is important that the control of the program be transferred from the switch statement to the next line of the program as soon as the case statement is executed. For this, the specific word break of C should be added at the end of each case statement.  By doing so, our goal will be achieved. I hope you have understood the break statement well.
 It was used to "jump out" of a switch statement.The break statement can also be used to jump out of a loop.

Summary :

Today we understand kodlog website, I try to explain the break statement . I hope after reading this article you will be able to understand the break statement . I would like to have feedback from my kodlog site. Please post your feedback, question, or comments about this article.

Article Tags :
C#|Python |Python 3|pycharm | html | java |JavaScript |cpp|code|rubi|Network | Google |html5 |php|bootstrap |string |Microsoft |variable |syntax |Coders |Codinglove|
Computerscience|wordpress|html-page|php|
Xml|game| net| list | loop | integer |float | string | double |

Example:
```
#include <iostream>
using namespace std;

int main() {
    int i = 0;

    while (i < 10) {
        if (i == 5) {
            break;
        }
        cout << i << '\n';
        i++;
    }

    i = 0;
    do {
        if (i == 5) {
            break;
        }
        cout << i << '\n';
        i++;
    } while (i < 10);
}
```
OUTPUT 

```
In each case 
01234
```