teleren/devto huggingface dataset:
API Postman Workshop
Tags: api, react, tutorial, news
Published: 2022-10-31 17:02:27


It is very fascinating how searches work. I would describe a well-spent weekend for a programmer to attend the **APIs** **Postman** Workshop. I got to learn interesting things about APIs and also did them practically through the workspace provided by Postman. 
API stands for “Application Programming Interface”, and refers to the various means one company has of communicating with another company’s software internally. An API would allow a third party such as Facebook to directly access the various functions of an external application, such as ordering a product on Amazon. A well-designed API will have clear and concise documentation that outlines how the various functions can be accessed and used.
A practical example is how a restaurant operates. 

1. We have a customer who comes in.
2. The customer places an order.
3. The wait takes the order to the kitchen after finding out that the meal is not readily available.
4. The meal is prepared within the shortest time possible.
5. The waiter presents the meal to the customer.

According to Clifford Ouma, the above procedure illustrates how an API would be used such that the customer gets what they order without caring how it is done, so long as it is satisfactory. In this case, the customer is interested in being served whatever they ordered. Efficiency is a fundamental consideration. The whole process of the waiter placing the order and returning with food would be replaced by a restaurant API. The API receives the order, prepares the meal, and returns the food.

It was very interesting to do it practically. I learned the fundamental methods used in APIs and how to use them;

- GET
- POST
- PUT
- PATCH
- DELETE

Another interesting encounter is how Postman equips programmers with a workspace to implement their skills. It is a problem solved, and now I can complete my E-commerce web application. It was a resourceful and nice exposure.
Juka WASM
Tags: programming, product, webdev, coding
Published: 2022-10-31 17:00:27

Hi everyone, we've recently released Juka that's compiled into Web Assembly. Check it out at https://WASM.jukalang.com. If you are on mobile, make sure to add the website to homescreen so that you will be able to run the code offline on your mobile device. Let us know your thoughts!
Maximum Units on a Truck
Tags: javascript, leetcode
Published: 2022-10-31 16:54:43

You are assigned to put some amount of boxes onto one truck. You are given a 2D array boxTypes, where boxTypes[i] = [numberOfBoxesi, numberOfUnitsPerBoxi]:

numberOfBoxesi is the number of boxes of type i.
numberOfUnitsPerBoxi is the number of units in each box of the type i.
You are also given an integer truckSize, which is the maximum number of boxes that can be put on the truck. You can choose any boxes to put on the truck as long as the number of boxes does not exceed truckSize.

Return the maximum total number of units that can be put on the truck.

 

Example 1:

Input: boxTypes = [[1,3],[2,2],[3,1]], truckSize = 4
Output: 8
Explanation: There are:
- 1 box of the first type that contains 3 units.
- 2 boxes of the second type that contain 2 units each.
- 3 boxes of the third type that contain 1 unit each.
You can take all the boxes of the first and second types, and one box of the third type.
The total number of units will be = (1 * 3) + (2 * 2) + (1 * 1) = 8.

Example 2:

Input: boxTypes = [[5,10],[2,5],[4,7],[3,9]], truckSize = 10
Output: 91

```js
const maximumUnits = (boxTypes, truckSize) => {
  boxTypes = boxTypes.sort(function (a, b) {
    let one = a[1];
    let second = b[1];
    if (one < second) {
      return 1;
    } else {
      return -1;
    }
  });

  let totalValue = 0;
  for (let i = 0; i < boxTypes.length; i++) {
    let noOfBoxes = boxTypes[i][0];
    let eachBoxWeight = boxTypes[i][1];

    if (truckSize - noOfBoxes >= 0) {
      truckSize = truckSize - noOfBoxes;
      totalValue += eachBoxWeight * noOfBoxes;
    } else {
      totalValue += truckSize * eachBoxWeight;
      break;
    }
  }
  return totalValue;
};

console.log(
  maximumUnits(
    [
      [5, 10],
      [2, 5],
      [4, 7],
      [3, 9],
    ],
    10
  )
);

console.log(
  maximumUnits(
    [
      [1, 3],
      [2, 2],
      [3, 1],
    ],
    4
  )
);


```
AWS Machine Learning Tools: The Complete Guide
Tags: aws, machinelearning, saga
Published: 2022-10-31 16:49:57

**AWS provides a lot of facilities to web developers to integrate Machine Learning Models in their Applications**
AWS is currently offering **15** different Machine Learning Services. We will look into some of them.

**SageMaker**
SageMaker has complete suite of tools which you need in order to build, train, and deploy your machine learning models. It's the complete solution of machine learning models.

**CodeGuru**
It't not cloudGuru. Haha.. It is **CodeGuru**. It automate your code reviews and optimization of your application. It can find waste resources and help you to make better solution. It only supports **Java** right now. We will look into this in future too.

**Comprehend**
It is a **Natural Processing Service** from amazon that uses machine learning algorithms to find valuable information from textual data.
Comprehend can work with product reviews, tweets, or other information like that.

**Forecast**
It is used to create Time Series prediction model using your dataset. It works great for stock price prediction, business expenses, and resource planning of organization. 

**Fraud Detector**
It helps you to find fake registrations and fraudulent transactions. It can easily detect fraud accounts and create verification setup for them by itself or you can say automatically. 

**Lex**
It helps you to create conversational interfaces into your products. Lex offers Natural Language Understanding Model that cna understand the input from the user and can take appropriate actions.

**Polly**
I personally like it. It helps you to create speech enabled products. It provides voice output in multiple languages.It is powered by Deep Learning Algorithms.

**Transcribe**
It creates speech to text service in your application. It is helpful in creating medical transport services, streaming audio, and generating subtitles for video.

We will look into more tools. Follow me to know more
My Hacktoberfest Recap
Tags: opensource, beginners, javascript, webdev
Published: 2022-10-31 16:47:54

## My Experience
My first Hacktoberfest has been a long one, spanning all of October. I saw other students had gotten all their PRs merged a week early, so I knew I had to hurry and finish mine as well. I just barely managed to get all 4 of my PRs approved within October, which was a stressful experience. But, overall I feel like I learned a lot about open-source, GitHub and Git. 

I found the most difficult part to be actually finding viable issues. Issues often tended to be taken very quickly, or were too complex and required development experience with the project. I spent each day looking at new issues that matched my search criteria and I found brief moments of success between long droughts of good issues. 

## My PRs
- My [first PR](https://github.com/ACM-VIT/golly-bot/pull/60) was on [golly-bot](https://github.com/ACM-VIT/golly-bot) a discord bot. My PR added the feature of sending a goodbye message tagging the leaving user.

- My [second PR](https://github.com/gregrickaby/reddit-image-viewer/pull/407) was on [reddit-image-viewer](https://github.com/gregrickaby/reddit-image-viewer), which allows users to purely view visual media on reddit. My PR changed the default video player to use Hls.js. This way, videos could be played with sound. 

- My [third PR](https://github.com/gregrickaby/reddit-image-viewer/pull/413) was once again on [reddit-image-viewer](https://github.com/gregrickaby/reddit-image-viewer). My PR added the title of the post which linked to the original post under each image/video. This was in response to clicking images linking to the original post, while videos being clicked played the video. Thus, there was a need to place the title to link to the post.

- My [fourth PR](https://github.com/JianLoong/word-cloud-generator/pull/13) was on [word-cloud-generator](https://github.com/JianLoong/word-cloud-generator), which allows users to generate word clouds using various settings. My PR added capitalisation settings to the settings panel, allowing for users to specify the capitalisation of the words in the word cloud.

## Tips 
- **Get searching early, and often**

In my first week and third week I had little success in finding a good issue to work on. However, I found sporadic success in the second and last weeks. There may be some dry weeks where it is difficult to find something good to work on. However, you should try to set yourself up for success and be persistent in your search for issues that you can work on. Keep searching for issues and eventually good ones will come your way.

- **Cast a wide net**

Try to look for as many different issues as possible. Search for any projects that use the languages you know. Search for any projects that use languages you would like to know. Search for issues that under different tags. Try to cast as wide a net as possible. That way you can broaden your horizons and see as many candidate issues as possible, even if many of them may not be viable for you.
Const in CPP
Tags: cpp, interview, beginners, programming
Published: 2022-10-31 16:41:51

- Declaration of const data member
const int x = 10;


- once you have initialized x you can not reassign its value
- value can not be changed
- initialization is not same as assignment
const int x  = 20; //initialization
x = 20; // assignment

- example of constant value is pi = 3.14
- we can initialize const members from both inside and outside of class
- We can initialize const variable from outside of the class also, like passing value from main as parameter
- Initializer list is used to define const members from outside of the class

- How to initialize const data member outside of a class
- for that you must use initializer list

```
#include <iostream>

using namespace std;

class A{
    public:
    const int a;
    // A(int b){
    //     a = b;
    // }
     
      A(int b) : a(b) {}; //initializer list
      
    void show(){
        cout<<a;
    }

// void changename(){
  //   a = 45;   
    //}
//error: assignment of read-only member ‘A::a’
};

int main()
{
    A obj(5),obj2(6);
    obj2.show();
    obj.show();

    return 0;
}

//output : 65

```
Spike Solutions - Short Notes
Tags: softwaredesign, programming
Published: 2022-10-31 16:40:31

Series on Software Design Practices - Part 1

**In this small series on software design practices, I write about various practices. In every article, I give a brief and simple explanation. This is part 1. Let's start with spike solutions.**

For me a spike is a **way to figure out answers to a technical or design problem**. It's a solution to explore potential solutions. You make a spike to reduce the risk of a technical problem or to achieve a better estimate for a user story.

Spike solutions could be technical or functional. **Functional spikes** help you to analyze an overall solution. 

- What is to be done? 
- How do we break the work into smaller pieces? 
- Where is the complexity hidden? 

**Technical spikes** on the other side are a way to find different approaches for a problem, e.g. 

- specific technical implementation 
- or to get confidence that the chosen strategy works out.


Experience has shown that first you should focus on the problem with the spike and ignore other concerns, second not all spike solution are good enough to deploy in production. And at last, demos and discussions about the approaches are highly valuable steps.

Photo by [charlesdeluvio](https://unsplash.com/photos/Lks7vei-eAg) on [Unsplash](https://unsplash.com/)
How can I save the time , when the browser closed by the user in mvc identity
Published: 2022-10-31 16:39:07

ASP.NET MVC IDENTITY:

I have tried to unload the event on the Layout page but it is not triggered, Alternatively, I have also used session time out in 'inproc', to save the logout time WHEN THE USER DOESN'T LOGOFF AND CLOSES THE BROWSER/TAB.

In Global.asax I have used session_end() event to end the session in one minute and logoff automatically after 1 minute in my MVC IDENTITY.

The requirement is that I need to store the time of browser/tab close by the user as LogOFF time in the database.

Is there any event to do the same?
🔴  Q&A Live session 2 with Nicolas Rabault
Tags: opensource, microservices, help, luos
Published: 2022-10-31 16:30:00

A couple weeks ago we held another Q&A live session with Nicolas Rabault. 

If you missed it, you can either read the transcription of the Q&A on our blog: https://www.luos.io/blog/should-I-use-Luos-in-embedded-development-q-and-a

Feel free to watch it again on our Youtube channel too 😃

Nicolas answered a lot of your questions about Luos, Arduino, Raspberry Pi, boards compatible with Luos and the future plans of Luos.
Lắp mạng viettel quận 8
Tags: giainternetviettelquan8, goicuocwifiviettelquan8, lapmangviettelquan8
Published: 2022-10-31 16:20:16

Website: https://viettelinternet24h.com/internet/viettel/lap-mang-viettel-quan-8-tphcm/
Facebook: https://www.facebook.com/viettel1989
Vozforum: https://vozforum.org/threads/lap-mang-viettel-quan-8.287633/
Buzzsprout: https://feeds.buzzsprout.com/2038729.rss
Pearltrees: https://www.pearltrees.com/viettelinternet24h
Twitch: https://www.twitch.tv/lapmangviettelquan8
Tumblr: https://lapmangviettelquan8.tumblr.com
Twitter: https://twitter.com/viettelquan8
Pinterest: https://www.pinterest.com/lapmangviettelquan8/
Soundcloud: https://soundcloud.com/lapmangviettelquan8
Flickr: https://www.flickr.com/people/lapmangviettelquan8/
Youtube: https://www.youtube.com/channel/UCuGZrpnSTMPxeiXw9o2pQeg
Vue 3, Nuxt 3 and Vite: Dynamic import components using api data
Tags: vue, nuxt, impor
Published: 2022-10-31 16:18:19

You want to dynamically import components based on some dataset or api call and perhaps wait for those components to fully download before rendering the page, here is an example:

* Dont forget if you are using `async setup()` in Vue 3 (not Nuxt) you will have to wrap you components in `<Suspense>` or you will see nothing render.

**Options API**
```vue
<template>
  <div>
    <component 
    v-once
    v-for="(component, index) in components" 
    :is="component.component"
    v-bind="component.data"
    :key="index"
    />
  </div>
</template>

<script>
  import { defineAsyncComponent } from 'vue';

  export default {
    data:()=> ({
      page: {},
      components: []
    }),
    async created() {
      // dataset
      const page_req = await fetch('/data/page-data.json')
      const {components, ...page) = await page_req.json()

      this.page = page

      // import components
      if (components) {
        const dynamic_components = components.map((component)=> {
          const {type, ...data} = component;
          // split the data and the component instance so you can v-bind the data easier in the template
          return {
            data: data,
            component: defineAsyncComponent(() => import(`../components/Module/${type}.vue`))
          }
        })

        // download all components over the network before rendering the page
        // otherwise the page jumps around as components load in
        await Promise.all(dynamic_components.map((component)=> {
          return component.component.__asyncLoader()
        }))
        
        // we do not want components to be reactive data, this can cause performance issues, so we freeze the object
        // vue understands frozen objects should not be reactive.
        this.components = Object.freeze(dynamic_components)
      }
    }
  }
</script>
```

**Composition API**
```vue
<template>
  <div>
    <component 
    v-once
    v-for="(component, index) in components" 
    :is="component.component"
    v-bind="component.data"
    :key="index"
    />
  </div>
</template>

// composition api
<script setup>
import { defineAsyncComponent } from 'vue';

// dataset (local data, or you can fetch from an api)
const page = await import('~/static/data/some-page-of-components.json')
let components = []

// import components
components = page.components.map((component)=> {
  const {type, ...data} = component;
  // split the data and the component instance so you can v-bind the data/props easier in the template
  return {
    data: data,
    // A note is that if you use path aliases for dynamic imports like @ or ~ you might experience issues.
    component: defineAsyncComponent(() => import(`../components/Module/${type}.vue`))
  }
})
</script>
```

A note is that if you use path aliases for dynamic imports like `@` or `~` you might experience issues.
How to write a simple JSON visualizer using JointJS+
Tags: javascript, productivity, codepen
Published: 2022-10-31 16:09:34

The JSON format - as a widely used form of data storage and representation - lacks a simple and convenient view of complex data, forcing developers to use external tools for data visualization and thus more productive work.

At [JointJS](https://www.jointjs.com/), we decided to regularly share code samples to help you create visual applications faster and with less effort, and one of them is a **simple JSON visualizer**.

This gives us the opportunity to connect with other developers and diagramming enthusiasts, hear their ideas and solve their pain points. We often hear them complain about the lack of an intuitive way to visualize their JSON data.

That's why we created this simple demo application that demonstrates how to use a built-in automatic layout to position nodes and add table-like shapes to organize object properties into tables where values have different styles depending on their type.

{% codepen https://codepen.io/jointjs/pen/WNJBMxQ %}

We release new demos every Wednesday to help developers get inspired and bring their ideas to life faster. If you want to learn with us, [follow us on CodePen](https://codepen.io/jointjs) or [join the conversation on Github](https://github.com/clientIO/joint/discussions).

Happy diagramming!
Openstack Manual install Part 6 - Compute node
Published: 2022-10-31 15:58:49

---
title: Openstack Manual install Part 6 - Compute node
published: true
description: In this video, we look into installing an Openstack Compute node and connecting it with our controller node.
tags:
cover_image: https://i.ytimg.com/vi/7AFe6RPWdqg/maxresdefault.jpg
---

{% youtube 7AFe6RPWdqg %}

In this video, we look into installing an Openstack Compute node and connecting it with our controller node.
Storage Types
Tags: blockstorage, filestorage, objectstorage, storagetype
Published: 2022-10-31 15:38:43

Let's discuss about different types of storages.

## Block storage:
A file will be divided into set of blocks while persisting in Block storage. File is not stored in continuous or adjacent blocks of the disk. Since each block has an unique identifier, we could retrieve specific blocks of file instead of all blocks .ie. entire file. A conditional SQL select query has to fetch specific data instead of entire data which makes this type of storage ideal for Relational Database.

## File storage:
Familiar storage type for all developers, which any operating systems store data in hierarchical file systems organized as directories, sub-directories and files.

## Object storage:
Follows flat structure instead of hierarchical structure used in file storage. Here's data is called an object that is located in bucket. Prefixes are used to group objects like folder structure but in reality, this is still a flat structure.

Well, Amazon S3 is an Object storage service. Let's discuss more in detail in forthcoming blogs.
Reduce disk writes for Ubuntu, save your USB stick
Tags: usb, ubuntu
Published: 2022-10-31 15:28:33

I run a few Ubuntu/Mint distributions off of USB sticks (for example, [DragonOS](https://dev.to/yegct/dragonos-lubuntu-on-usb-with-persistent-storage-6jc)) and want to reduce the number of writes to the USB stick. My laptop has plenty of RAM so I'll make use of that.

### `/tmp` to ramdisk

No need to keep temporary files around between reboots. Storing this in RAM instead of on disk is really easy.
```
sudo systemctl enable /usr/share/systemd/tmp.mount
```

By default, this uses half my RAM. I can edit that file if I want to use less; 50% is probably overkill. Reboot your machine once you've made your changes.

### `/var/log`

Log files are a bit trickier. I want these to stick around between reboots, so just storing them on a ramdisk wouldn't really work. Thankfully, [`log2ram`](https://github.com/azlux/log2ram/) solves this problem. Written primarily for Raspberry Pi machines, it works fine on x86-64 laptops. This stores `/var/log` in RAM but will sync the contents to disk from time to time, ideal for our needs.

```
echo "deb [signed-by=/usr/share/keyrings/azlux-archive-keyring.gpg] http://packages.azlux.fr/debian/ bullseye main" | sudo tee /etc/apt/sources.list.d/azlux.list
sudo wget -O /usr/share/keyrings/azlux-archive-keyring.gpg  https://azlux.fr/repo.gpg
sudo apt update
sudo apt install log2ram
```

Reboot your machine once log2ram is installed.

### Firefox

The Firefox browser caches data to disk. I'm happy setting aside a bit of RAM for this instead. In the URL bar, type `about:config`. Acknowledge the warning, then in the filter bar, enter `browser.cache`. You want to change the `browser.cache.disk.enable` setting from `true` to `false` (double-click on the setting to change it), ensure `browser.cache.memory.enable` is `true` (the default value), and then modify `browser.cache.memory.capacity` from the default value of `-1` to `1048576`, allocating 1GB of RAM to the cache.

Close down and restart Firefox for the settings to take effect.

### More reading

[Easy Linux Tips](https://easylinuxtipsproject.blogspot.com/p/ssd.html) has some other suggestions based around SSDs rather than USB sticks. Limiting swappiness may be worth considering if your computer regularly hits swap. Setting `noatime` may be helpful, too.

What settings have you found useful?
How to Humanize a Boolean on Ruby
Published: 2022-10-31 15:22:55

Having a true or false output is fine when it comes to code no human is ever going to read but, when it comes to the human eye; We want to communicate our answer in the best way UX can handle. There is a simple way to handle this so you can make your method global. 

```
module ApplicationHelper

  def humanize_boolean(value)
    case value
    when true
      "Yes"
    when false
      "No"
    when nil
      "Undefined"
    else
      "Invalid"
    end
  end

end
```
Add this handy method to your application_helper.rb and use anywhere on your "views" files.

```
<%= humanize_boolean(post.published) %>
```