teleren/devto huggingface dataset:
Script to import IMDB database into PostgreSQL
Tags: postgres, tutorial, showdev, database
Published: 2021-11-22 14:27:44

It’s always nice to have some bigger database around to play with a new technologies. IMDB has a lot of data, but it’s not straightforward on how to import those into your PostgreSQL instance. I made a quick bash script to simplify the process.

## Please make sure to have 
**csvkit** (python lib to work with CSV files) 
**pv** (utility to monitor the progress of data through a pipe) 
installed. 

* To install **csvkit** run: `sudo pip install csvkit`
* To install **pv** run one of the following:
  * *For Linux:* `sudo apt-get install pv`
  * *For Mac Ports:* `sudo port install pv`
  * *For Homebrew:* `brew install pv`

To execute import script: 
```
bash <(wget -nv -O - https://gist.githubusercontent.com/1mehal/13c85e108cbc906f5ec34d28d75b1968/raw/imdb_import_in_postgresql.sh)
```
Script would attempt to:
1. Download latest archive of IMDB data and put it to folder you specified or use existing data
2. Create corresponding tables in PostgreSQL database (database should exists before running the script)
3. Import data from tsv files into corresponding tables
4. Set up primary keys and foreign keys and relationships between tables. Also script would setup search indexes.

If something fails please follow up the script logic, and leave comments. bash script and corresponding sql scripts are located at [https://gist.github.com/1mehal/13c85e108cbc906f5ec34d28d75b1968](https://gist.github.com/1mehal/13c85e108cbc906f5ec34d28d75b1968)

That’s it.
OpenNMS Horizon 29.0.1 Released
Tags: debian, kafka, nonroot, minion
Published: 2021-11-29 19:21:27

---
title: OpenNMS Horizon 29.0.1 Released
published: true
cover_image: https://pbs.twimg.com/media/FE53cc2WQAcYC_S?format=jpg&name=large
date: 2021-11-22 14:22:16 UTC
tags: debian,kafka,nonroot,minion
canonical_url: https://www.opennms.com/en/blog/2021-11-22-opennms-horizon-29-0-1-released/?utm_source=rss&utm_medium=rss&utm_campaign=opennms-horizon-29-0-1-released
---

Horizon 29.0.1 is a quick release outside of the normal schedule to address some bugs found in 29.0.0 mostly related to running as non-root, and Minion communication.

For a high-level overview of what has changed in Horizon 29, see [What’s New in OpenNMS Horizon 29](https://docs.opennms.com/horizon/29.0.1/releasenotes/whatsnew.html).

The codename for Horizon 29.0.1 is [_Emu_](https://wikipedia.org/wiki/Emu).

## Bug

- Kafka topics should start with OpenNMS Instance ID for Twin (Issue [NMS-13733](http://issues.opennms.org/browse/NMS-13733))
- opennms.spec file tries to find out if gid 1000 is used but doesn’t actually check hat (Issue [NMS-13734](http://issues.opennms.org/browse/NMS-13734))
- Events from Hardware Inventory Provisioning Adapter and SNMP Metadata Provisioning Adapter cannot be distinguished (Issue [NMS-13735](http://issues.opennms.org/browse/NMS-13735))
- Upgrade to 29: fix-permissions script fails changing ownership (Issue [NMS-13736](http://issues.opennms.org/browse/NMS-13736))
- Minion user not authorized to read from topic OpenNMS.Twin.Sink (Issue [NMS-13742](http://issues.opennms.org/browse/NMS-13742))
- opennms-plugin-provisioning-wsman-asset missing on Debian (Issue [NMS-13747](http://issues.opennms.org/browse/NMS-13747))
- Upgrade to 29: "$RUNAS is not set" (Issue [NMS-13748](http://issues.opennms.org/browse/NMS-13748))
- SNMP Metadata XSD does not allow multiple <config> elements (Issue [NMS-13752](http://issues.opennms.org/browse/NMS-13752))

## Enhancement

- Support multiple auth params for same SNMPV3 username (Issue [NMS-13490](http://issues.opennms.org/browse/NMS-13490))
- Add retry for RPC calls (Issue [NMS-13652](http://issues.opennms.org/browse/NMS-13652))
- Migrate Discovery settings from wiki into docs (Issue [NMS-13730](http://issues.opennms.org/browse/NMS-13730))
How do you like to read articles/tutorials?
Tags: discuss, javascript, programming, tutorial
Published: 2021-11-22 14:20:19

When reading documentation or articles that contain code, do your prefer to:
1. step through the file line-by-line
2. see the full code snippet pasted with inlined comments
3. see the full snippet, and a summary/walk-through after?

Here's an example of #2/3 taken from a recent post of mine:
```js
import hashids from "hashids";

// Two arguments supplied: a salt and a minimum padding (length)
const postHash = new hashids("post", 8);

const post = { id: 4 };
post.id; // 4

const hashedPostId = postHash.encode(post.id);
hashedPostId; // 6akz1JVq
postHash.decode(hashedPostId); // [4]
```
"Here, we're importing the hashids package and creating an instance of the module, calling it postHash. ..."

vs. doing something like:
```js
const postHash = new hashids("post", 8);
```
"First, we create an instance of the hashids module and supply a salt and padding. ..."
Lab 9: CI testing and contribute test to other SSG project
Tags: javascript, opensource, github, programming
Published: 2021-11-22 14:06:11

Last week, I forgot to update my `CONTRIBUTING.md` and since the lab this week require to develop a CI testing, that would be perfect so I do not have to create any dummy change to test my CI

## Setting and running CI test

Thanks to the [lecture](https://www.youtube.com/watch?v=TfbBF0mJp6M&t=948s) and well explainations. It was really easy for me to set up my `.github/workflows/node.js.yml`. I choose to follow the default setting where I got the CI test run everytime someone push it to the `main` branch, using online host to run the project on the latest `ubuntu` version and test it with the specified node version

```yml
on:
  push:
    branches: [main]
  pull_request:
    branches: [main]
...

build:
    runs-on: ubuntu-latest
...

node-version: [12.x, 14.x, 16.x]

``` 
You can check out the status and my [PR-20](https://github.com/tpmai22/TS-SSG/runs/4271742769?check_suite_focus=true).

## Contribute to my colleague project

This week, I choose Luigi [octo](https://github.com/LuigiZaccagnini/octo) to work on. He has 14 stars for his project so it a bit pressure but I will take it. You can check out my [PR-20](https://github.com/LuigiZaccagnini/octo/pull/20)

I see that Luigi did not have unit test for the `./bin/app.js` so I step in and created one. I make `options` from and object and turn to a callable function so as I can parse different arguments through the `options` blueprint and see if it work as it should be.

```javascript
const options = (args = process.argv.slice(2)) =>
  yargs(args)
    .usage(`Usage: -i <path>`)
    .option(`input`, {
      alias: `i`,
      describe: `Path to file`,
      type: `string`,
      demandOption: true,
    })
...
```
But after I automated test for `app.js` I keep received this error log

```bash
●  Cannot log after tests are done. Did you forget to wait for something async in your test?
    Attempted to log "This is main Error
    Error: ENOENT: no such file or directory, lstat 'C:\Users\Administrator\Desktop\repo\octo\undefined'".

      121 |       if (path.includes(".txt")) {
      122 |         return textToHTML(path, lang).then((data) => {
      126 |

      at console.log (node_modules/@jest/console/build/BufferedConsole.js:199:10)
      at bin/fileFunctions.js:123:29
```

I spend quite amount of time on it and asking my friend Duke. We both regconize that it happen because in `./bin/app.js` also make a call to the `options` function by using the `fileFunctions` object from another module so I just need to refactor that part of the code where it was calling the `options` function to another file and all the test ran smoothly. After all, I did feel happy that I was be able to contribute to a good project and still waiting for Luigi to get back to me on my changes.
Como transformar seu React APP em um PWA em poucos minutos
Tags: react, javascript, webdev, tutorial
Published: 2021-11-22 14:05:54

Progressive Web Apps ou somente PWAs, nos dão novos recursos com características nativas para os sites, consumindo menos dados e sem a necessidade de instalação.

Os React Apps precisam de apenas 2 características para serem PWAs, um servicerWorker, que é um script que o navegador executa em segundo plano, separado da WebPage o que possibilita alguns recursos, como uso offline. 
E também um arquivo na pasta publica, como nome do aplicativo, pagina inicial e ícones, sendo esse arquivo o `manifest.json.`

##1 `manifest.json`

o `manifest.json` vai na pasta public.

A maioria das informações são auto explicativas, e voce pode gerar automaticamente em alguns sites como o [App Manifest Generator](https://app-manifest.firebaseapp.com/).

Segue um exemplo

```
{
    "short_name": "WebPage",
    "name": "Minha WebPage",
    "icons": [
        {
            "src": "favicon.ico",
            "sizes": "64x64 32x32 24x24 16x16",
            "type": "imagem/icone-x"
        },
        {
            "src": "logoPequeno.png",
            "type": "image/png",
            "sizes": "192x192"
        },
        {
            "src": "logoGrande.png",
            "type": "image/png",
            "sizes": "512x512"
        }
    ],
    "start_url": ".",
    "display": "standalone",
    "theme_color": "#000000",
    "background_color": "#ffffff"
}
```

##2 `servicerWorker.js`

Para ter uma base vá para [Modelo de Service Worker](https://github.com/cra-template/pwa/tree/master/packages/cra-template-pwa.).

Copie os arquivos `service-worker.js` e o `serviceWorkerRegistration.js` e cole na pasta `src`.

Então no topo seu index.js, importe o service worker resgistration, assim:

```
import * as serviceWorkerRegistration from './serviceWorkerRegistration';
```

Após o import, adicione no final do seu `index.js` o seguinte código para optar por um aplicativo "offline-first"

```
serviceWorkerRegistration.register();
```

E pronto, seu CRA agora é uma PWA.

Caso voce esteja começando um projeto novo, voce pode cria-lo ja com o template usando o comando `npx create-react-app app-name --template cra-template-pwa`, ou se voce for usar o typescript `npx create-react-app app-name --template cra-template-pwa-typescript`.

[Para se aprofundar mais em PWAs](https://create-react-app.dev/docs/making-a-progressive-web-app/)
Go Basics: Variables
Tags: go, programming, codenewbie, beginners
Published: 2021-11-22 13:42:00

In the last article, I gave a small introduction to programming with Go, where we saw the tiniest possible programs and the general syntax. 

Continuing on the syntax, let's take a look at some more syntax and understand how variables are declared in Go.

If you're completely new to Go, please check out the previous article:

{% link https://dev.to/abh1navv/getting-started-with-go-54pm %}

## Variables

Variables are declared using the `var` keyword and are used to store values.

The following is an example of a variable declaration.
```go
var name string = "John"
```
The variable `name` is of type `string` and is assigned the value `John`.

You can also declare multiple variables at once.
```go
var (
    name string = "John"
    age int = 30
)
```

You can also declare variables with a type but without an initial value.
```go
var name string
```

You can also declare multiple variables with a type but without an initial value.
```go
var (
    name string
    age int
)
```

Or multiple variables of the same type in a single line.
```go
var name, occupation string
```
Here, `name` and `occupation` are of type `string`.


**Shorthand declaration of variables**

You can also use the `:=` operator to declare and assign a variable at the same time.
```go
name := "John"
```
Note that the `:=` operator is only valid in short variable declarations. You cannot use it outside function bodies.
When using the `:=` operator, the variable is declared with the type of the right-hand side expression. The `var` keyword is also not required.

**Implicit type declaration**
You can also declare a variable without specifying its type. In this case, the type is inferred from the initial value or a function call.
For example, the following code declares a variable `age` of type `int` and assigns the value `30` to it.
```go
var age := 30
```
Or using a function call.
```go
var age := getAge()
```

This also works for shorthand declarations.

## Constants
Constants are declared using the `const` keyword. They are used to store values that cannot be changed.
For example, the following code declares a constant `PI` and assigns the value `3.14` to it.
```go
const PI = 3.14
```
Constants can also have implicit type declarations as in the above example.
- They cannot be declared using the `:=` operator.
- They cannot be declared without an initial value.
- They cannot accept a function call as an initial value.
- The type of a constant may not be explicitly declared.

--- 

Thanks for reading.
This should give you an idea of how variables are declared in Go and how the syntax compares to other programming languages. 

Stay tuned for more on Go.

If you want to connect with me, you can find me on Twitter [@abh1navv](https://twitter.com/abh1navv).
Running Flutter Tests using Github Actions
Tags: actionshackathon21, flutter
Published: 2021-11-22 13:15:09

[Instructions]: # (To submit to the GitHub Actions x DEV Hackathon 2021, please fill out all sections.)


### My Workflow
[Note]: # (Please make sure the project links to the appropriate GitHub Actions repository, and includes [an open source license](https://choosealicense.com/) and README.)
My workflow is a testing parameter for Flutter Apps, and I made it for my Flutter package which allows seamless integration of wit.ai with Flutter. The workflow runs a flutter test, that checks if there is a valid response from the wit.ai server, whenever there is push or pull request to the master branch.


### Submission Category: 

[Note]: # (Maintainer Must-Haves, DIY Deployments, Interesting IoT, Phone Friendly, or Wacky Wildcards)
Phone Friendly


### Yaml File or Link to Code

[Note]: # (Our markdown editor supports pretty embeds. Try this syntax: `{% github link_to_your_repo %}` to share a GitHub repository)

{% github ameysunu/flutter_witai %}

*YAML File:*

```
name: Flutter Test
on:
  push:
    branches: [ master ]
  pull_request:
    branches: [ master ]

  workflow_dispatch:

jobs:
  build:
    runs-on: ubuntu-latest

    steps:
      - uses: actions/checkout@v2
      - uses: actions/setup-java@v2
        with:
          distribution: 'zulu'
          java-version: '11'
      - uses: subosito/flutter-action@v1
        with:
          flutter-version: '2.0.5'

      - name: Get all Flutter Packages
        run: flutter pub get

      - name: Run a multi-line script
        run: flutter test
```


### Additional Resources / Info

Shoutout to [Flutter Actions](https://github.com/marketplace/actions/flutter-action) for helping me with the workflow analysis.
How to add parameterized route in Angular
Tags: javascript, angular, navigation
Published: 2021-11-22 13:25:14

Suppose you have the requirement that you want to show list of users if the url is /user, and you want to show user detail of a particular user when the URL is /user/useId.

###Soultion 1 - We could user querry params 

To achieve this we can create a users component, then in its ngOnInit we could check if params are present.

``` Typescript
/// Here route is ActivatedRoute

this.route.queryParams.subscribe(params => {
   
if(params.userId){
//// Do Something
console.log(params.userId);
}
});

```
You can get the params like this and then write your logic accordindly. If params are present then show userDetails if not then list of users.

###Solution 2 - Use parameterized route

Like So

``` Typescript
const routes: Routes = [
  { path: '/user', component: UsersComponent },
  { path: '/user:userId', component : UserDetailsComponent}
];
```
Here we are explicitly stating that if url is /user then show UsersComponent or if it is like /users/xxxid then show userDetials page.

This is more Systematic & preferred way of doing the task.

If you are using only one parameter then use parameterized route. But if you have many parameters then use querry Params as stated above in solution 1.

##How to navigate to parameterized route from template

``` html
<a *ngFor="let user of users"
  routerLink="/user/{{user.id}}">
  {{user.name}}
</a>
```
Assume we are having list users and clicking on a user name will open that particlular user details.

To get the value of ther parameter use ActivatedRoute

``` Typescript
console.log(this.route.snapshot.paramMap.get('userId');
```

**Points To remember**

If you are getting any error remember to recheck the route you had written. sometimes you append extra / like user/:userId/ or prepend extra slash (/) like /user/:userId.

Although you can use more then two parameters
like  user/:userId/:id/:age 
I would suggest to avoid it and if it cannot be avoided atleast limit it to two parameters.
Glitch, The Underrated Tool
Published: 2021-11-19 17:24:52

---
title: Glitch, The Underrated Tool
published: true
date: 2021-11-17 00:00:00 UTC
tags: 
canonical_url: https://www.weckmann.me/posts/glitch-its-underrated/
---

**Before we dive in, I'm a firm believer in learning by doing. So if you don't want to read this post just click [here](https://glitch.com/create-project) to get started on Glitch now!**  
Glitch defines itself as

> Glitch: The friendly community where everyone builds the web

and I couldn't agree more!

## For Free

Unless you plan on using Glitch for a small-scale operation that isn't just development, you can get away with the free plan! I only upgraded to give back to the developers. These people deserve it! For free you get:

- Projects and code are public by default
  - Environmental variables are always private
- Full-stack apps that sleep after 5 minutes
- Unlimited static sites that are always on
- Github import/export and Prettier support
- Custom Domains
- 512MB Memory
- 199MB Disk Space
- Terminal Access

## Starter Templates

### Glitch In Bio

Instantly create a list of your favorite links, and customize them for free.  
[Remix](https://glitch.com/edit/#!/remix/glitch-in-bio)

### Website

Build a website from scratch using the basics: HTML, CSS, and JavaScript. It could be a splash page, VR web experiment, or personal page.  
[Remix](https://glitch.com/edit/#!/remix/glitch-hello-website)

### Node.js

Do even more with JavaScript on the server! Create a full-stack Node.js project. It could be anything — an API, a web app, or a data tool.  
[Remix](https://glitch.com/edit/#!/remix/glitch-hello-node)

### React

Build an interactive website with complex states using one of the web’s most widely used frameworks. Deploys as a fast, always-on static site.  
[Remix](https://glitch.com/edit/#!/remix/glitch-hello-react)

### Eleventy

A simple static site generator that’s perfect for building your new blog. Eleventy removes the repetition from creating a multi-page site.  
[Remix](https://glitch.com/edit/#!/remix/glitch-hello-eleventy)

### SQLite

Use a persistent SQLite database with your Node.js app.  
[Remix](https://glitch.com/edit/#!/remix/glitch-hello-sqlite)

## Git Support

Glitch officially supports importing and exporting to Github. If Github isn't your forte, you can use the git URL to import from anywhere!

Each project is given a git URL for remote editing too. This way you aren't confined to the web IDE.

## In Conslusion

I've been using glitch since the early alpha days. Things have changed a lot over time for the better. It's the nature of development. I'm confident in what Glitch is doing and am thankful for how easy they have made my life. If you're just trying to learn, check out their Discover section or search for projects to remix and edit yourself!

* * *
 

[Reply via email](mailto:arpitbatra123@gmail.com?subject=Reply:%20Glitch,%20The%20Underrated%20Tool)
Day 68/100 Handling Events
Tags: 100daysofcode, programming, challenge, motivation
Published: 2021-11-22 12:57:03

"You have power over your mind—not outside events. Realize this, and you will find strength."

– Marcus Aurelius, Meditations

![events](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7luvljwje273nnnyuysr.png)
My Interview Questions
Tags: python, beginners, django, career
Published: 2021-11-22 12:46:21


1.What is session?
2.What is list and list comprehension?
3.What is global variables.Differnce between global and local variable.
4.What is the difference between xrange and range?
5.What python version has xrange?
6.What is dataframe?
7.In python, how to connect to mysql database?
8.If a column value is greater than the column size, what type of 
  error do you get in python and how do you identify/resolve it? 

9.Explain Django Architecture?Features of Django?Why Use Django?Disadvantage of Django?
10.Explain the Django project directory structure?
11.What are models in Django?
12.What is admin in Django?
13.What are views in Django?What is signals?Describe two important signals modules?
14.What is Django ORM?
15.Difference between Django and Flask?
16.How to run a django project?
17.What will be the ouput-->
    def fast(a=[]):
        a.append(1)
        return a
    print(fast)
    print(fast)

18.Write a code to display the sum of all integer from 1 to 10.
19.What is __init__?
20.What is pickeling and pep8?
21.How do you convert a string to Hex,Int,String?
22.How to change the attribute of a class at runtime?
23.What is slicing?
24.Differnce between list and tuples?
25.Mutable and Immutable datatypes in python?
26.What are packages and modules?
27.Can a package contains modules?

---
**Data Analytics Question**
![Input.csv](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/gf32x2q7v8jbov8p3jfb.jpg)

1.Add new column 'Flag_A_B'. Values in the new column:
	if A is greater than B ,then 1
	otherwise 0
*Add new column 'AVG_C'. Values in the new column:
	Average of previous 5 seconds values of C. 
	for example, if the previous 5 seconds values of C is 10,20,30,40,50, then the current value in AVG_C is (10+20+30+40+50)/5=30

*Add new column 'FLAG_C'. Values in the new column:
	if current value in C is within +-10% of current value in 'AVG_C', 1
	if current value in C is below -10% of current value in 'AVG_C', 0
	if current value in C is above +10% of current value in 'AVG_C',2

2.There are quick ways to show the basic statistics of each column, like mean, max, min, median. Please show us one.

==========================Part2 =============================

1. What is constrains in sql?
2. Difference between primary key, unique key ,foreign key.
3. Name and explain different types of join?
4. Explain views and procedure.
5. What is polymorphism,inheritance and abstract method?
6. What are magic methods?
7. What are generators in python?Explain Memory management in python.
8. How to merge two dictionaries with the same key.
9. What is scope in python?
10. What is pass and continue?Difference between the same.
11. What is access modifiers in python?
12. What is constructor?
13. What is self in python?
14. What is decorators?Give an example.
15. What is lamda?
16. Different types of copies?Difference between shallow copy and deep copy
17.Difference Between xrange and range?
18. Difference between count and len.
19. What are .pyc files?
20. What is GIL?
21.Find the median by merging two list.
22.Explain splitwise?Create an app similar to splitwise.
6 of the Funniest Games of All Time!
Published: 2021-11-22 12:37:58

These games not only amuse you, they also make you laugh with their jokes! Here are the 6 funniest games of all time...
Game development is serious business, but that doesn't mean game makers and gamers take everything too seriously. YouTube is full of tons of fun videos about games.

Monkey Island Serisi

Although we try to choose from the series, the entire Monkey Island series is extremely entertaining. However, if you don't know where to start, we suggest you start with the third game, The Curse Of Monkey Island and 
<a href="https://www.bestcrazygames.com/home/keyword/play-squid-games-online?">Play Free Squid games online</a>.

GTA Vice City

Vice City was fun enough with the radio presenters you listen to while driving your car.

Brutal Legend

Brutal Legend , another Tim Schafer game on our list , will not leave you laughing and <a href="https://www.brightestgames.com/play-squid-game-online-free">Play Squid Games online free</a>