teleren/devto huggingface dataset:
Update any application binary with this launcher!
Tags: updates, go, window, tooling
Published: 2022-02-08 12:27:45

Recently, I was working on a software updater for my project and I found that there is no easy way for OTA update that is ready to use and work cross platform. So I decided to write one that is so universal, it works on all kind of application binaries or even interpreted languages, which I later called it the "Automatic Update Launcher"

{% github tobychui/Automatic-Update-Launcher %}

## Current Implementations
### ❔ How normal Desktop Programs Updates
Most desktop applications will use some kind of updater to update the main program by start and detaching the updater and allow it to do its things. This work on most desktop platforms but it will not works with systemd where the PID of the running application is important. (i.e. cannot change or otherwise systemd will assume it is dead and try to restart it)
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/q5cpx8qd0kaodh9bbkkx.png)

### ❔ How embedded devices do OTA updates
Embedded devices usually uses two partitions (one for current running application, the other one for writing update files to) and a bootloader to do the switching. One common example ESP8266 which some projects utilize its bootloader's feature to do OTA update via WiFi or Bluetooth.
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/237y9a98gpjewzjj0hm6.png)

## 🌟 How the Automatic Update Launcher (auLauncher) works 🌟
The auLauncher works in a much simpler way following the logic described in the following diagram. 
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/hzlfajp475o5fp2500v0.png)
 
and the configuration of each steps and file names can be changed easily in a json file located next to the launcher's executable. Here is an example for that: 
```
{
    "version":"1.0",
    "start":"helloworld*",
    "backup": ["./*.config","./*.exe"],
    "verbal": true,
    "resp_port": 25576,
    "max_retry": 3,
    "crash_time": 3
}
```

All arguments that passed to the launcher is then passed through to the main binary. So you can easily slide this in between your starting script and your target binary without the need for changing anything.

### ❓ How do my program update itself then?
It is simple! If you program want to update itself, just download the update files to the ./updates folder and exit itself with code 0. This way, the launcher will start overwriting the application files based on the defination in the json file and the contents in the ./updates folder and restart your application with given start path. 

This method works for most Go compiled application, but in theory should also work with other compiled binaries and some interpret language like python with a correct starting bash / batch script.

 If you are interested to know more, or just wanna try this launcher and make your application OTA update a new features, feel free to take a look at this repo and left some comments :))
 
 {% github tobychui/Automatic-Update-Launcher %}
Deciding on a new career path at 34
Tags: beginners, career, selftaught, programming
Published: 2022-02-08 12:22:42

After 5 years of commercial banking front-office, a further 5 years as a business consultant, and a few more years overlapping as a small business owner, I've decided to pick-up coding as a new career path.
Luckily by this time I started a family, the kids are (almost) old enough to go to kindergarten, and I'm almost financially free as my small business is running on its own and generating a fair bit of cash flow.

Exactly 40 days ago I started learning Python with Codecademy and the Python Crash Course book, and have made decent progress so far considering that I can currently dedicate about 2 hours a day.
My first stand-alone project is a functional -although not complete- blackjack CLI game. It still needs some more functionality added to it, but the basics are they and they work without throwing errors.

Now I must decide which path to follow next: go further into backend dev or start a new path, front end dev.
The main issue is that I really don't know what kind of work I would like to do. Don't know if I want to get a job or do freelancing work. What I **do** know is that I don't want a full time desk job, I've been there for too long and it would feel like a major step back.

Next steps: 
- complete the course on data structures and algorithms
- finish up the projects in Python Crash Course (there are 3, a game in pygame, a data visualization project in matplotlib + pandas, and finally a website in django). Great book btw.
My first program
Tags: beginners, python, firstpost, firstyearincode
Published: 2022-02-08 12:17:43

So here I am. I started three weeks ago a course on Computer Science by Codecademy. So far I've learnt some Python3 and some other -extra- basics.

And as a part of the course, I was asked to autonomously write a program about something I like. I needed to set up a GitHub repository and track the versions while coding. And the code needed to have classes (that would affect each other). So the idea that came into my mind was to create a database of different songs (that was one class), having among other variables, different parts (that was the other class). So for example, I created a song instance `una_rosa_blanca.Song` containing info about the song (author, name, optional link). And then I created a part instance `riff_urb.Part` containing the song it belongs to (`una_rosa_blanca`), the time of the song where that part starts, and of course, the notes (a list of them).

Actually the program **only makes sense for me** because I'm learning trumpet, and I find it quite hard to both transpose a trumpet piece I know, or to transfer a guitar piece I know to trumpet. This is because in trumpet the scale of notes are not like in guitar (I mean, just one fret higher or lower is 1/2 tone higher or lower). For example, a G in trumpet can be all three valves open, and then a G# is second and third valves closed. And then A is valves one and two closed. So no straightforward transposing. **So**, by creating a dictionary containing `all the notes (three octaves) : their finger positions`, I was able to then just access it and change the index as much as the `part.transpose(quantity)` required.

Other method was `find_fingers` that would give me the finger positions for a list of notes (that I could easily input from a guitar piece I already knew).

Anyway, I found it a nice experience to start coding, printing an excessive amount of variables at every piece of the code to understand wth was going on with it. It took me like two days, not because of its complexity, but because of my lack of experience coding.

[https://github.com/ramirotorresl/Band_database]
How to activate `virtualenv` in Fish (Friendly interactive shell)?
Tags: fish
Published: 2022-02-08 12:16:30

## Problem

If you used to be a bash shell user and then decided to move to `fish`, you will probably face a problem with activating your python virtual environment.

The typical method to activate a `virtualenv` is:

`$ source your_env_name/bin/activate`

This fails in Fish shell:

`source: Error while reading file “your_env_name/bin/activate”`

## Solution

The solution to this problem was much a lot easier than googling it. Thankfully, `virtualenv` ships with an activation script for specifically for Fish. Use that instead:

`$ source your_env_name/bin/activate.fish`
Announcing Delta Lake and Data Lake Destinations on RudderStack
Tags: datalake, deltalake, cdp, customerdata
Published: 2022-02-08 12:14:12

We're excited to announce that Rudderstack now supports Delta Lake as a destination in addition to data lakes on Amazon S3, Azure, and Google Cloud Storage.

Data lakes are storage areas for raw data that make the data readily available for people to use when they need it. The data in data lakes should be raw, easily accessible, and secure. From a customer data perspective, data lakes are a very powerful option because of their flexibility and ability to handle high volumes of information.

Last week we wrote a [post](https://www.rudderstack.com/blog/how-does-the-data-lakehouse-enhance-the-customer-data-stack) on how the data lakehouse enhances the customer data stack. As a Lakehouse, [Databricks' Delta Lake](https://databricks.com/product/delta-lake-on-databricks) is an architecture that builds on top of the data lake concept and enhances it with functionality commonly found in database systems. It lets users store structured, unstructured, and semi-structured data. This Delta Lake was created in part to make sure that users never lose data during ETL and other event processing. It allows companies to scale and supports a variety of capabilities such as ACID transactions, scalable metadata management, schema enforcement, and more.

Today, RudderStack customers are using our tool to seamlessly send event data. [Click here](https://www.rudderstack.com/docs/data-warehouse-integrations/) to access the Warehouse Destinations section of our support documents, where users can learn more about how to send event data from RudderStack to their Data Lake and Delta Lake destinations.
Web Console Helpers make dev life bit easier 🐥
Tags: javascript, beginners, webdev, productivity
Published: 2022-02-08 12:10:18

> The JavaScript command line provided by the Web Console offers a few built-in helper functions that make certain tasks easier.

## Short Example
 
In the Dev Tools

we can use `$` instead of `document.querySelector`
and `$$` instead of `document.querySelectorAll`.

```javascript
// old
document.querySelectorAll(".myClass");

// new
$$(".myClass");
```

#### This screenshot is taken with `:screenshot` in Firefox `[chrome is not supported as I tried already]`

`Screen Shot 2022-02-08 at 17.41.02.png`

![Screen Shot 2022-02-08 at 17.41.02.png](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ikuuz8z2fpak52ej8ksx.png)

A complete reference [Web Console Helpers - Firefox Developer Tools | MDN](https://developer.mozilla.org/en-US/docs/Tools/Web_Console/Helpers)

⚠ Please check the supported browsers on MDN.
best nasha mukti kendra in ghaziabad
Published: 2022-02-08 11:59:25

At [Nasha Mukti Kendra ](uhttp://www.gatewaywellnessrehab.comrl) to recovery, we believe in addressing the root of the problem that leads to addiction than to just suppress the urges and this is done with the help of our Holistic programme which include therapy, diet, counselling, yoga meditation
Jenkins Pipeline Tutorial | Jenkins Tutorial | Part VIII
Tags: javascript, beginners, tutorial, jenkins
Published: 2022-02-08 11:51:12

{% youtube ACG_jYCpYXg %}

This video demonstrates the benefits of Jenkins CI/CD pipeline, installing Pipeline Maven Integration Plugin with an example of how to create a Jenkins pipeline. 

The video is a part of the Jenkins Tutorial series for beginners. In this video, Moss (@tech_with_moss) explains steps to create a Jenkins CI/CD Pipeline using the Jenkins UI. Learn how to use a Maven project as the codebase to be built in the pipeline & also use the Pipeline Maven plugin to facilitate the use of Maven within the Pipeline script.

You will get to learn -:
🔸 What are the benefits of Jenkins Pipeline?
🔸 What are the different types of Jenkins Pipeline?
🔸 What is Pipeline job in Jenkins?
🔸 How does a Jenkins Pipeline work?
OpenAPI Security
Tags: api, security
Published: 2022-02-08 11:21:25

Working on an **OpenAPI** contract can be really though. There is a lot of things, parameters... and you may don't know all the good practice about the security in an OpenAPI contract.

So to help you, is there some tools!

---

## Api Security Encyclopedia

This website contains the **OWASP** Top 10 of the vulnerability. So here, you can check which are the biggest vulnerabilities which can happen with an OpenAPI contract and understand how to correct this kind of issue.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/i27u113bd4uxqqicjkgg.png) 

### Links
- https://apisecurity.io/encyclopedia/content/api-security-encyclopedia

---

## Api Security Audit tools

To help you when you are working on an OpenAPI contract, you can use one of the following tools to do an **audit of your contract**.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/valjqn8zhxzy2v6iqs1a.png)

All the reviews are separated on 3 categories:
- **OpenAPI Format** : Does the contract will well formed and does it follow the best practices.
- **Security** : Check all about **authorization** and **authentication** methods that you have defined
- **Data validation** : Check if your parameters are well defined to avoid some issues like code injection

And for each category, you will have a rate and the list of the issues related to. Each of them will have a clear explaination to let you understand what is the problem. 

Then, with this verification *(and all the updates which can be required to have a high rate)* you will have one basis for a secure API.

### Links
- Online : https://apisecurity.io/tools/audit/
- For VisualStudio : https://marketplace.visualstudio.com/items?itemName=42Crunch.vscode-openapi
- For IntelliJ : https://plugins.jetbrains.com/plugin/14837-openapi-swagger-editor

---

I hope it will help you! 🍺
In today’s mail… swag!
Tags: watercooler, gear, stickers, laptop
Published: 2022-02-08 11:20:48

Yay! The postman just arrived!

![A selection of DEV stickers](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/v5urxcrcwe8ulecvuflp.jpeg)

Excited about these, especially the Tag Moderator #️⃣  one, and the space invaders 👾 sticker is really cool. Thank you, [DEV Team](https://dev.to/devteam)! 🦄 

I’m off to find space on my laptop! ICYMI: I posted about my laptop stickers last month...

{% link andypiper/share-your-laptop-stickers-4acc %}

(P.S. you can find cool swag at [the DEV shop](https://shop.dev.to) - this is **_not_** an affiliate post, I just love this community and it’s really nice stuff, I’ve got the Daisy 🌸 Bomber Jacket and a rainbow 🌈 t-shirt - what are your favourites?)
First Missing Positive – Leetcode Python
Tags: leetcode, leetcodepython, firstmissingpositivepython, leetcodesolution
Published: 2022-02-08 11:18:57

LeetCode has a Hard coding Problem in Its' Algorithm Section "First Missing Positive". Today We are going to solve this problem. 

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3gp0ehdxvxfsqrgxix8l.jpg)
Question
Given an unsorted integer array nums, return the smallest missing positive integer.
You must implement an algorithm that runs in O(n) time and uses constant extra space.
Examples
Input: nums = [1,2,0]
Output: 3
Input: nums = [3,4,-1,1]
Output: 2
Input: nums = [7,8,9,11,12]
Output: 1
Constraints:
1 <= nums.length <= 5 * 105
-231 <= nums[i] <= 231 - 1

Solution to First Missing Positive
The Skeleton Code given by LeetCode is
class Solution(object):
    def firstMissingPositive(self, nums):
        """
        :type nums: List[int]
        :rtype: int
        """
Complete Solution:
visit https://hecodesit.com/first-missing-positive-leetcode-python/
Find First And Last Position of Element in Sorted Array
Tags: firstandlastpython, pythonsolution, leetcodesolution, leetcodepython
Published: 2022-02-08 11:14:51

LeetCode has a Medium coding Problem in Its' Algorithm Section "Find First And Last Position of Element in Sorted Array". Today We are going to solve this problem. 

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/rcmqnxqkpfcdwtwzayzm.jpg)
Question
Given an array of integers nums sorted in non-decreasing order, find the starting and ending position of a given target value.
If target is not found in the array, return [-1, -1].

You must write an algorithm with O(log n) runtime complexity.
Examples
Input: nums = [5,7,7,8,8,10], target = 8
Output: [3,4]
Input: nums = [5,7,7,8,8,10], target = 6
Output: [-1,-1]
Input: nums = [], target = 0
Output: [-1,-1]
Constraints to the problem:
0 <= nums.length <= 105
-109 <= nums[i] <= 109
nums is a non-decreasing array.
-109 <= target <= 109

Solution to Find First And Last Position of Element in Sorted Array
Skeleton Code given by Leetcode on its site.
class Solution(object):
    def searchRange(self, nums, target):
        """
        :type nums: List[int]
        :type target: int
        :rtype: List[int]
        """
To an ordered array of integers, find start and end positions of the same target, defines the time complexity is O (logn).

Solution: dichotomy, the complexity of the time typical binary search method, first using a binary search for the original array, find out the location of a target, and then find the start and end positions on both sides to search.
Complete Solution to the given problem
Visit https://hecodesit.com/find-first-and-last-position-of-element-in-sorted-array/ for solution
Search in Rotated Sorted Array – Leetcode Python
Tags: searchinrotatedsortedarray, leetcodepython, solutionleetcode, leetcodemedium
Published: 2022-02-08 11:13:12

LeetCode has a Medium coding Problem in Its' Algorithm Section "Search in Rotated Sorted Array". Today We are going to solve this problem. 


Question
There is an integer array nums sorted in ascending order (with distinct values).
Prior to being passed to your function, nums is possibly rotated at an unknown pivot index k (1 <= k < nums.length) such that the resulting array is [nums[k], nums[k+1], ..., nums[n-1], nums[0], nums[1], ..., nums[k-1]] (0-indexed). For example, [0,1,2,4,5,6,7] might be rotated at pivot index 3 and become [4,5,6,7,0,1,2].

Given the array nums after the possible rotation and an integer target, return the index of target if it is in nums, or -1 if it is not in nums.
You must write an algorithm with O(log n) runtime complexity.
Examples
Input: nums = [4,5,6,7,0,1,2], target = 0
Output: 4
Input: nums = [4,5,6,7,0,1,2], target = 3
Output: -1
Input: nums = [1], target = 0
Output: -1
Constraints:
1 <= nums.length <= 5000
-104 <= nums[i] <= 104
All values of nums are unique.
nums is an ascending array that is possibly rotated.
-104 <= target <= 104

Solution to Search in Rotated Sorted Array
Skeleton code
class Solution(object):
    def search(self, nums, target):
        """
        :type nums: List[int]
        :type target: int
        :rtype: int
        """
If you find the target value in the array return its index, otherwise return -1. You may assume no duplicate exists in the array.
Complete Solution
visit https://hecodesit.com/search-in-rotated-sorted-array-leetcode-python/
Longest Valid Parentheses – Leetcode Python
Tags: longestvalidparenthesis, leetcodesolution, leetcode, leetcodepython
Published: 2022-02-08 11:09:55


LeetCode has a Hard coding Problem in Its' Algorith Section "Longest Valid Parentheses". Today We are going to solve this problem. 

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/q92qy5ip6wuyvohcq7xw.jpg)
Question
Given a string containing just the characters '(' and ')', find the length of the longest valid (well-formed) parentheses substring.
Examples
Input: s = "(()"
Output: 2
Explanation: The longest valid parentheses substring is "()".
Input: s = ")()())"
Output: 4
Explanation: The longest valid parentheses substring is "()()".
Input: s = ""
Output: 0
Constraints:
0 <= s.length <= 3 * 104
s[i] is '(', or ')'.

Solution to Longest Valid Parentheses
Skeleton Code given in Leetcode is
class Solution(object):
    def longestValidParentheses(self, s):
        """
        :type s: str
        :rtype: int
        """
1. Method violence taken every substring O (N ^ 2), then use the method in question 20 determines whether it is legally O (N), the total time of O (N ^ 3).

2. Violence Solution traversed for one string O (N), from each character, the total number of the left bracket and a right bracket number, and length of each record satisfies the O (N) when the number of left and right bracket == Numbers in parentheses, if left Number of parentheses <number of right parentheses, continue. The time complexity is O(N²).
3. Stack local stack process with the longest substring matching simulation, after again traversing, namely matching the rest of the stack is not on the brackets, between which the string position, i.e. to meet the requirements, which take a longest. O(N).
Complete Solution
is given at https://hecodesit.com/longest-valid-parentheses-leetcode-python/
Started with CSSbattle (Target#1)
Tags: webdev, css, beginners, cssbattle
Published: 2022-02-08 11:07:44

Hey folks, 
  Today I started with [CSSBattle](https://cssbattle.dev/), the CSS challenge game.
Its actually fun and interesting. 

I recommend all CSS enthusiasts, to spend some time there, it will definitely boosts your skills.

**Here's the first Target** ([You can have a try here](https://cssbattle.dev/play/1)).

My personal best was **84 characters**(after removing the white-spaces)in this challenge.

_Here's two best possible approaches I could come up with._
```css
<p></p>
<style>
*{background:#5d3a3a;margin:0 66.6 0 0}
p{height:200;background:#b5e0ba
```
And here's with 85 characters.
```css
<p></p>
<style>
*{background:#5d3a3a;margin:0}
p{width:50%;height:200;background:#b5e0ba
```
>NOTE.
**There are some tricks regarding the platform such as :**
- You don't need to add a semicolon at the end of last property of a block.
- You don't need to close the last curly brace. 
- No need of closing the style tag.
- You don't need to write `px` as it's the default unit. 

####Although the top solution was just 54 characters, I wonder how they were able to do it in such small amount of code!

Comment down your way of doing the same.
Stay Tuned for daily updates regarding all the challenges on CSSBattle.

###Want to connect? :
[Connect with me here.](https://linktr.ee/prakhartandon)
Don't use explicit const in global scope of JavaScript
Tags: node, javascript
Published: 2022-02-08 11:00:28

Global scope should be exploited as little as possible, although if exploited too much (relatively) it's referred to "global pollution" . But if it happened you had no choice, do but just not this way :

```javascript
const f = {
    namespace: "NS_F"
}
f // {namespace: 'NS_F'}
// let's garbage collect it :
f = null; // Assignment to constant variable
// SOLUTION is to swap CONST with LET, although...
```

... Although if you a OKAY to garbage collect it as soon as job is done, choose this run-to-completion (functional) approach :

```javascript
// function declaration
function f () {
    return {namespace: "NS_F"}
}
f() // {namespace: 'NS_F'}
// run the following separately :
f = null;
// run the following separately :
f() // f is not a function
// Hooray !
```

Nearly best solution is to use **weakSet**(s) or **weakMap**(s) – read [this](https://blog.logrocket.com/weakmap-weakset-understanding-javascript-weak-references/)

---

Thanks & see in the next one !
The Offline Java game based on Bomberman - Apply Dijkstra's algorithm to make the monster chase the player.
Tags: java, gamedev, dijkstra, oop
Published: 2022-02-08 10:45:45

Last year, my teammates and I completed the bomberman-inspired offline game for our OOP project at university.

In this project, we used several design patterns to make the code more scalable and readable. In addition, we also apply the dijsktra's algorihtm (one of the popular pathfinding algorithms)  for the purpose of creating monsters that can chase the player and explode on collision.

You can see the demo at: [https://www.youtube.com/watch?v=XN9JSJVNS00](https://www.youtube.com/watch?v=XN9JSJVNS00)

You can get our source code at: [https://github.com/hcmiu-project/bomberman](https://github.com/hcmiu-project/bomberman). We are very happy if you give us 1 star :)