teleren/devto huggingface dataset:
Example of Stored Procedures in PostgreSQL
Tags: postgres, sql, beginners
Published: 2020-12-04 03:14:27

A stored procedure is a set of Structured Query Language (SQL) statements with an assigned name, which is stored in a relational database management system as a group, so it can be reused as many time is called. Aditional is not mandatory that the stored procedure have an output.

I am going to provide an example to understand how it works, in this example, we have one table in which we save the enrollment of some students to one group of some subjects.
```
CREATE TABLE inscription(
	cod_student INTEGER NOT NULL,
	cod_subject SMALLINT NOT NULL,
	group SMALLINT NOT NULL
);
```
We need to create a stored procedure that allows us to know which is the group with the least amount of students enrolled to enrol the new student that we are providing.

In this case, we have 2 groups for the subject 1001, 
```
select cod_subject, group, count(*) 
  from inscription i2  
  where cod_subject = 1001
```
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/jscz8cehpo7hrhu4hyty.PNG)

And we will create our stored procedure like this.
```
create or replace procedure assign_group(
   student int,
   subject int
)  
language plpgsql    
as $$
declare
	chosenGroup int;
begin
    
    chosenGroup := (select grupo from (select cod_a,grupo,count(*) 
    			from inscribe i2  
    		        where cod_a = asignatura group by cod_a , grupo 
    			order by count(*) asc limit 1 ) gru_men);

   
   	insert into inscription(cod_student , cod_subject , group) 
               values (student, subject, chosenGroup );
   
    commit;
end;$$
```
So let's define the syntax:
1. specify the name of the stored procedure after the create procedure keywords.
2. define parameters for the stored procedure. A stored procedure can accept zero or more parameters.
3. specify plpgsql as the procedural language for the stored procedure (you could use other procedural languages for the stored procedure).
4. use the dollar-quoted string constant syntax to define the body of the stored procedure.

Finally, when I call the procedure (__call assign_group(1457855, 1001)__) the new student will be enrolled in group 2 because has the least amount of students.

I hope this will be useful and Thank you so much for reading.
JS String methods #3
Published: 2020-12-04 02:53:50

As we studied yesterday about split() method means this method we can remove any character or space from our sentence.
```
let password='udgtj 9e59 jfd';
let correctPassword=password.split(' ');
console.log(correctPassword);
//result -> ['udgtj','9e59','jfd'];
```
There is a method which is for array and the split() method returns an array so we can use join() method that joins array items.
```
let correctPassword=password.split(' ');
correctPassword.join('');
console.log(correctPassword);
//result -> udgtj9e59jfd
```
we can use this method along with the split() method.
So keep going and practicing this method with split() method and indexOf() method.
# charAt() method
This method is versus indexOf() method.
This method requires the position of a character to return the character we want.
```
let name='john';
console.log(name.charAt(1));
//result -> o
```
# slice() method
This method extracts a section of a string and returns it as a new string.
This method takes two arguments.
I mentioned argument which we'll learn in functions section.
The first argument which is required start index and the second is end index.
if we do not specify the end index the slice() method will extracts a string from start index up to end index.
```
let greeting='hi Nikolas! My name is ahmad';
let halfGreeting=greeting.slice(3);
console.log(halfGreeting);
//result -> Nikolas! name is ahmad
```
If we specify the end index the result will be different.
```
let greeting='hi Nikolas! My name is ahmad';
let halfGreeting=greeting.slice(3,10);
console.log(halfGreeting);
//result -> Nikolas
```
The slice method does not include the end index it means that it subtract one from endIndex-1;
which does not return the end index.
A simple tool to visualize Go package
Tags: go, visualize, package
Published: 2020-12-04 02:35:42

---
title: A simple tool to visualize Go package
published: true
description: 
tags: go, visualize, package
//cover_image: https://direct_url_to_image.jpg
---

Godepgraph - A simple tool to visualize Go package from [https://pkg.go.dev](https://pkg.go.dev)

Demo at [https://godepgraph.vercel.app](https://godepgraph.vercel.app)

## Components
Backend: Golang
- [Fiber](https://fiber.wiki/)
- [godepviz](https://github.com/chuongtrh/godepviz)
- [bigcache](https://github.com/allegro/bigcache)
- Deploy on Heroku 

Frontend: Nuxt.js
- [Viz.js](https://github.com/mdaines/viz.js)
- [vue-svg-pan-zoom](https://github.com/yanick/vue-svg-pan-zoom)
- Host on Vercel


![go.uber.org/zap](https://dev-to-uploads.s3.amazonaws.com/i/gmiwvskti37tkqhv12mt.png)

![github.com/gin-gonic/gin](https://dev-to-uploads.s3.amazonaws.com/i/03d2qb4qf0g8dyvojngw.png)
After We Read some books
Tags: discuss, tips
Published: 2020-12-04 02:14:40

After follow tutorial from a book, you may feel and say "and then ?what" you are so confuse, and you try to read from another book for stack that you learn. and you will skip cause you have knew about the content, and you get the end of the book again, and you feel "and then?". yeah I feel that too you are not alone. 

You try to create some apps and you get stuck what you should to do, when where I have to start from. because you have never try study case you just follow the tutorial, there is no experiment you do. if you want to follow tutorial you have to get stuck and error and try to fix it by yourself. Feel free to change something from that tutorial for example if there an array that have 5 item, try to add 3 so you will know what happen if the array is 8.

after you read the tutorial, make your free apps. don't think that you are news in the stack. you can crate anything in you mind. and try to implement that to your apps. you can use project from github for your reference. follow that project and change it if the project different from your idea and try to find another one.
What I Wish Everyone Knew About MLSA Evolve
Tags: womenintech, mlsa
Published: 2020-12-04 02:06:23

Mlsa evolve is the ladies tech makers community in the larger Microsoft Learn student ambassador community in Kenya

It was founded by  Female student ambassadors in Kenya and has spread to universities across Kenya 

 ![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/kf23ft4foyz8ftsk2fcy.jpg)




The amazing ladies in evolve aim to elevate the role of women in the tech space.

The community achieves this elevation by:

Having sessions on various technologies giving preference to Microsoft Technologies. 

Hosting career sessions on a regular basis cutting across all technologies. 

Hosting fireside chat sessions to discuss issues affecting women hence offering a safe space for women to air out their issues without fear of judgement

Bridging the gap between the Tech Industry experts and the student tech community by having virtual meet and greets

This Holiday Season they have planned an end of year virtual dinner party whereby besides having dinner its a great chance to interact with other Ladies in the Tech space ,make some friends and Learn from each other.

I'd urge everyone to join the amazing Evolve community and Microsoft Learn Student Ambassador community at large.To be up to date with the events and activities happening in the community follow them on

     Twitter: https://twitter.com/MLSAEvolve
     Meetup group: https://www.meetup.com/MS-Ambassadors-KE
Project 1, Week 1, Day 4 (Updated on Day 5 :P)
Published: 2020-12-04 01:15:38

Totally forgot about this last night. No excuses at all. So first thing this morning, I wanted to update yesterdays progress.

I've got the socket to communicate with the front end. Which for me is a good step forward. Now I've got to send the stream through for audio/video. Set up a peer connection and it should be done. Then it's just a case of making it user friendly. :)

[Pull Request](https://github.com/Cijin/project-we/pull/4)
How to Blur a View in SwiftUI
Tags: ios, swift, swiftui
Published: 2020-12-04 00:44:05

---
title: How to Blur a View in SwiftUI
published: true
description: 
tags: #ios #swift #swiftui
//cover_image: https://direct_url_to_image.jpg
---
<!-- wp:paragraph -->
<p>SwiftUI makes it easy to add a blur effect to any view. All we need to do is add the <strong>.blur()</strong> modifier to our view. Let’s see how we can apply this by looking at the example below.</p>
<!-- /wp:paragraph -->

<!-- wp:syntaxhighlighter/code -->
<pre class="wp-block-syntaxhighlighter-code"> import SwiftUI
import PlaygroundSupport
struct ContentView: View {
    var body: some View {
        ZStack {
            Color.green.edgesIgnoringSafeArea(.all)
            Text("Hello Tom")
        }
    }
}
PlaygroundPage.current.setLiveView(ContentView()) </pre>
<!-- /wp:syntaxhighlighter/code -->

<!-- wp:image {"align":"center","id":1315,"sizeSlug":"large"} -->
<div class="wp-block-image"><figure class="aligncenter size-large"><img src="https://swifttomcom.files.wordpress.com/2020/12/img_0039.png?w=460" alt="" class="wp-image-1315"/></figure></div>
<!-- /wp:image -->

<!-- wp:paragraph -->
<p>As you can see in the example we have a <strong>ZStack</strong> with a green background and a text view. If we want to add a blur effect to our text view all we need to do is add the <strong>.blur()</strong> modifier to it. </p>
<!-- /wp:paragraph -->

<!-- wp:syntaxhighlighter/code -->
<pre class="wp-block-syntaxhighlighter-code"> import SwiftUI
import PlaygroundSupport
struct ContentView: View {
    var body: some View {
        ZStack {
            Color.green.edgesIgnoringSafeArea(.all)
            Text("Hello Tom")
                .blur(radius: 1.5)
        }
    }
}
PlaygroundPage.current.setLiveView(ContentView()) </pre>
<!-- /wp:syntaxhighlighter/code -->

<!-- wp:image {"align":"center","id":1313,"sizeSlug":"large"} -->
<div class="wp-block-image"><figure class="aligncenter size-large"><img src="https://swifttomcom.files.wordpress.com/2020/12/img_0038.png?w=460" alt="" class="wp-image-1313"/></figure></div>
<!-- /wp:image -->

<!-- wp:paragraph -->
<p>As you can see above we added the blur effect with a <strong>1.5 radius</strong> to our “Hello Tom” text view. It is good to know that the higher the radius the more blurry the view will appear.</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>Thanks for reading and happy coding!</p>
<!-- /wp:paragraph -->
Day 269: Listen
Tags: hiphop, code, coding, lifelongdev
Published: 2020-12-04 00:36:43

_liner notes_:
- Professional : Another good day. I'm building a sample app to test out the documentation and make sure everything that is written in the docs is what happens in the application. Plus it helps me really get to dive in to the SDK and learn alot.

- Personal : Worked on the sample application for work the spent the rest of the night watching "Legion". Just as good as I remember.

![The trunks of three large redwood trees in the front of a forest ](https://dev-to-uploads.s3.amazonaws.com/i/dlvnhbqarqzoz5bmklcc.jpg)

Going to do the same stuff I did last night. Real close to finishing the sample app. Then I'll listen through some tracks for this week's show. Can't believe it's Thursday already. Good thing I submitted the recording to the show earlier in the week, haha.

Have a great night!

peace piece
Dwane / conshus
https://dwane.io / https://HIPHOPandCODE.com
{% youtube LARDtlGcv1I %}
Understanding LSTMs, GRUs and Attention Blocks
Published: 2020-12-04 00:24:27

Traditional neural networks failed when it comes to handling sequence problems, because they didn't have memory. To resolve this issue the concept of RNNs (Recurrent Neural Networks were introduced). RNNs are simply a fully connected layer with a loop.


But, RNNs are so poor at handling long-term dependencies that they practically fail for large sentences.

<b>LSTMs<b>

This issue was addressed by LSTM (Long Short Term Memory) networks. LSTMs are special RNNs but can remember long-term dependencies.

Their flow is similar to RNNs but the difference is in the LSTM cells. 

LSTM has certain layers that help in maintaining the memory of these networks.
1. Forget gate - This layer forgets the immediate information required to maintain the long-term dependency.

2. Input gate - This helps decide what new information is to be added to the context vector.

3. Update gate - Again adds the new information which was removed in the last steps.

4. Output gate - The output gate provides the new hidden state vector.

<b>GRU<b>

GRU (Gater Recurrent Unit) is a variant of LSTM and has following modifications.

- It combines the forget and input gates into a single "update gate".
- It also merges the cell state and hidden state
- It updates the memory twice, the first time (using old state and new input, called Reset Gate) and the second time (as final output). 
- Old cell state or hidden state (with input) is used for its own update as well as for deciding 


<b> Attention in Encoder-Decoder Architecture <b>

When we talk about sequence-to-sequence models they consist of encoder-decoder architecture. The encoder processes each item, compiles it into a vector (also called as context) and passes it to the decoder. The decoder then produces the output sequence. The issue with these models is that the context vector is a bottleneck for them.

Attention models handles this issue. The encoder passes all the hidden states to the decoder instead of passing the last hidden state.
Also the decoder multiplies the hidden state to a softmax score as a weight of the hidden state so that the scores are amplified which have high score and the hidden states with low scores are diminished.
2020-12-04: IAC Team Status Update
Tags: team, status, community, cicloud
Published: 2020-12-09 00:27:30

---
title: 2020-12-04: IAC Team Status Update
published: true
date: 2020-12-04 00:00:00 UTC
tags: team,status,community,cicloud
canonical_url: https://puppetlabs.github.io/iac/team/status/2020/12/04/status-update.html
---

## Community Contributions

We’d like to thank the following people in the Puppet Community for their contributions over this past week:

- [`puppetlabs-kubernetes#451`](https://github.com/puppetlabs/puppetlabs-kubernetes/pull/451): “Add scheduler\_extra\_arguments parameter”, thanks to [treydock](https://github.com/treydock)
- [`action-litmus_parallel#71`](https://github.com/puppetlabs/action-litmus_parallel/pull/71): “(MAINT) Fix user install bug”, thanks to [RandomNoun7](https://github.com/RandomNoun7)
- [`action-litmus_parallel#69`](https://github.com/puppetlabs/action-litmus_parallel/pull/69): “Fix ENV Set Method”, thanks to [RandomNoun7](https://github.com/RandomNoun7)
- [`action-litmus_spec#61`](https://github.com/puppetlabs/action-litmus_spec/pull/61): “(MAINT) Fix user install bug”, thanks to [RandomNoun7](https://github.com/RandomNoun7)
- [`action-litmus_spec#60`](https://github.com/puppetlabs/action-litmus_spec/pull/60): “Fix ENV Set Method”, thanks to [RandomNoun7](https://github.com/RandomNoun7)
- [`pdk-templates#360`](https://github.com/puppetlabs/pdk-templates/pull/360): “(fix) Set rubocop ruby version to 2.4”, thanks to [tuxmea](https://github.com/tuxmea)
- [`puppet-modulebuilder#26`](https://github.com/puppetlabs/puppet-modulebuilder/pull/26): “Use match\_path instead of match\_paths”, thanks to [ekohl](https://github.com/ekohl)
- [`puppet_litmus#344`](https://github.com/puppetlabs/puppet_litmus/pull/344): “Fix append\_cli parameters”, thanks to [hajee](https://github.com/hajee)

## New Module / Gem Releases

The following modules were released this week:

- [`puppetlabs-concat`](https://github.com/puppetlabs/puppetlabs-concat) (`6.3.0`)
- [`puppetlabs-acl`](https://github.com/puppetlabs/puppetlabs-acl) (`3.2.1`)
- [`puppetlabs-kubernetes`](https://github.com/puppetlabs/puppetlabs-kubernetes) (`5.4.0`)
- [`puppetlabs-device_manager`](https://github.com/puppetlabs/device_manager) (`3.1.0`)

## Triage day

Even if half of the team was on PTO, we got through all the supported modules repos and most of all our tooling processing, so we managed to review and merge 11 PRs as well as releasing 4 modules.

## CI and special Wednesday

Again, we applied the principle “Team work, dream work” and together we successfully ported 22 modules onto the Cloud CI. Many thanks to the entire team for the hard work! Check out the new look of our module test runs: [`puppetlabs-chocolatey#235`](https://github.com/puppetlabs/puppetlabs-chocolatey/pull/235/checks)

## Happy 3 months for Disha!

It’s been 3 months since Disha joined the team and she started her journey in our team. If you want to know more about her work and last updates, you can always check her blog [here](https://puppetlabs.github.io/iac/lifeofinternatpuppet/post_14.html).

#### Wrap-up

That’s it for this week, have a great week-end and stay safe !
🎄 Advent of Code 2020 🎄: my solutions with JS
Tags: javascript, adventofcode
Published: 2020-12-04 22:49:27

---
title: 🎄 Advent of Code 2020 🎄: my solutions with JS
published: true
date: 2020-12-04 00:00:00 UTC
tags: javascript,adventofcode
cover_image: https://dev-to-uploads.s3.amazonaws.com/i/bzy1a7i5nuzihx35m58p.jpeg
canonical_url: https://slashgear.github.io/advent-of-code-2020/
---

I decided this year to try the adventofcode2020 challenge in JS to see. I published the solutions I found in a public repository on Github. Not sure I will find solution for the upcoming challenges. 😅

{% github Slashgear/advent-of-code %}

Project is a _lerna monorepo structure_ showing solution by years and days.

```
packages/
  2019/
    day-1/
      ..
    day-2/
      ..
  2020/
     day-1/
      ..
    day-2/
      ..
    day-3/
      ..
    day-4/
      ..
  ..
```

For now, you can find solution for:

- [2020 day 1](https://github.com/Slashgear/advent-of-code/tree/main/packages/2020/day-1)
- [2020 day 2](https://github.com/Slashgear/advent-of-code/tree/main/packages/2020/day-2)
- [2020 day 3](https://github.com/Slashgear/advent-of-code/tree/main/packages/2020/day-3)
- [2020 day 4](https://github.com/Slashgear/advent-of-code/tree/main/packages/2020/day-4)
Restart Visual Studio as Admin in seconds
Tags: visualstudio, productivity
Published: 2020-12-04 08:51:11

---
title: Restart Visual Studio as Admin in seconds
published: true
date: 2020-12-01 00:00:00 UTC
tags: visualstudio, productivity
canonical_url: https://www.owain.codes/blog/posts/2020/december/restart-visual-studio-as-admin/
---
![blogcomputerimagelrg](https://dev-to-uploads.s3.amazonaws.com/i/blpq5opj2d49443oovdq.jpg)
 
Last week [@HotChilliCode](https://twitter.com/HotChilliCode) aka Nik shared this [Scott Hanselman](https://twitter.com/shanselman/) video with me : "Overwhelmed with Programming? Here's small things to help - Computer Stuff They Didn't Teach You #14"

{% youtube 5CmjW_8ief4 %}

During the video Scott talks about finding ways to reduce repetition. If you find yourself doing something over and over again, is there a way to speed it up? Can you automate it in some way.

Well today I found myself, for probably the 100th day in a row, needing to attach my debugger in Visual Studio to my local IIS instance. The only issue was, I wasn't running in Admin mode.

I needed to close visual studio, right click the icon, open as Admin then reload my solution. Not a massive issue but I had noticed I've been doing this a lot recently as Visual Studio for me doesn't automatically run in Admin mode. I know, I could set it up to run in Admin mode straight away but then if I am doing screen shares, the person I'm sharing with can't interact with my VS screen so then I need to shutdown VS, remove the setting to start as Admin. It's just a pain.

Anyway, I found an Visual Studio Extension called [Visual Studio Restart](https://github.com/ilmax/vs-restart) and all it does is, it adds a Link in your File menu that will shutdown VS, restart it in Admin mode and also reload the solution you are working on. Brilliant! 

**Note: I am using VS2019 Community Edition, I've not tested this in any other versions.**

The next thing I did was I [assigned a shortcut key](https://docs.microsoft.com/en-us/visualstudio/ide/identifying-and-customizing-keyboard-shortcuts-in-visual-studio?view=vs-2019) to the restart command. The key combo I used is `Ctrl+ '`

So now, if I am working on a project that I haven't loaded as Admin, I tap `Ctrl + ' ` and boom, I'm up and running in Admin mode in seconds.
6 Useful Methods For Javascript Objects ✨
Tags: javascript, webdev, programming
Published: 2020-12-03 23:35:59

Hello guys, today we're going to explore the most used object methods with javascript.

let's div deep directly.

#1-Object.values()
**return array of the object's values**

assume we've got this object and we need to get the values only.

```javascript
  const car = {name:'Audi', model:'a4', year:2020}
  const values = Object.values(car)
  console.log(values)
  //output ['Audi', 'a4', 2020]
```

#2-Object.keys()
**it's the opposite of the first function it return array of the object's Keys(names)**


```javascript
  const car = {name:'Audi', model:'a4', year:2020}
  const keys = Object.keys(car)
  console.log(keys)
  //output ['name', 'model', year]
```
easy, right?


#3-Object.assign()

**it's Useful for merging or cloning objects**

```javascript
  const car = {name:'Audi', model:'a4', year:2020}
  const details = {color:'red', type:'Coupe', year:2021}


  const combined = Object.assign({},car,details)
  console.log(combined)
  //output {name:'Audi', model:'a4', color:'red', type:'Coupe', year:2021}
```

###Note Here: if both objects have the same property, it will take the value of the second object

#4-Object.entries()
**return array for each key:value pairs in object wrapped in array**

```javascript
  const car = {name:'Audi', model:'a4', year:2020}
  const items= Object.entries(car)
  console.log(items)
  //output [ [name:'Audi'], [model:'a4'], [year:2020] ]
```

#5-Object.freeze()
**it makes the object no longer able to change**
```javascript
  const car = {name:'Audi', model:'a4', year:2020}
  Object.freeze(car)
  
  car.year = 2021
  console.log(car)
  //output [ [name:'Audi'], [model:'a4'], [year:2020] 

```
###Note Here: to check if the object is frozen or not use Object.isFrozen(car), if frozen it will return true, and false if not

#6-Object.seal()
**Similar to Object.freeze() but the difference is this lets you change the property of the object as long they are writeable (Not methods) But not delete or add new**
```javascript
  const car = {name:'Audi', model:'a4', year:2020}
  Object.seal(car)
  
  //this will work
  car.year = 2021
  console.log(car.year) // output 2021
  
  //this will Not work
  delete car.year
  console.log(car.year) // output 2021
```

##Note Here: to check if the object is sealed or not use Object.isSealed(car), if sealed it will return true, and false if not.

That's it for today, I hope this was useful to you.
Thank you, and have a productive day❤️