teleren/devto huggingface dataset:
Meteor And DDP
Tags: meteor, node
Published: 2020-04-08 01:31:26

In this article we're going to talk about the core technology powering Meteor and granting us the ability to create reactive real-time applications. 

DDP is an acronym for Distributed Data Protocol. Don't fall for the fancy name. It's simply a protocol that specifies how to communicate data in JSON. DDP is built using [SockJS](https://github.com/sockjs/sockjs-client) which is powerful library offering [WebSocket](https://en.wikipedia.org/wiki/WebSocket) emulation, so it'd allow for WebSocket communication in environments that doesn't support WebSockets. Also, It abstracts away all the low level stuff that goes into making WebSockets communication possible. In short, DDP is nothing but a customized version of SockJS server/client setup.

Learning about this was such a revelation for me because I finally came to understand why Meteor is nothing but a set of great tools carefully integrated together by some very smart people.

DDP supports two basic operations:

- Remote Procedure Calls (RPC).
- Subscribing to set a documents where the server continuously keeps the client updated about changes to these documents.

What's RPC? It's another fancy name for invoking server side operations by the client.    

You can already tell how those two very basic operations can power [Methods](https://guide.meteor.com/methods.html) and [Pub/Sub](https://guide.meteor.com/data-loading.html) pattern of Meteor. It's something that we shall go in great detail in the future. For now, let's keep things simple.

Now, fire up a simple Meteor application.

```
curl https://install.meteor.com/ | sh

meteor create simple-app
cd simple-app
meteor
```
Open up the browser, navigate to localhost:3000. Bring up the networks tab in the web console, select `WS` and click on websocket then reload the page. You'd end up with something similar to the following picture.
 
![simple-app](https://i.imgur.com/LN4U0cz.png)

As you can see there's a lot going on here, so I'd like to focus only on few messages here. 

The first one being the "connect" message as the client attempts to establish a connection specifying the DDP version used then the server replies with "connected" and sets a unique "session". This "session" is used to differentiate clients accessing the server, so that later on Meteor can tell which message needs to sent out to what clients in later interactions. 

Another delightful thing that you might notice if you leave the browser running for a while is the "ping/pong" messages. This is a heartbeat check to ensure that the connection between the server and client is maintained because if it's not the client'd try to reconnect.

As you can tell, there's a lot more to DDP than this, we've only scratched the surface. You can learn more about the specification [here](https://github.com/meteor/meteor/blob/devel/packages/ddp/DDP.md).

For now, keep toying with your Meteor application and witness what funny messages pop in your console for now. In the next few articles we shall go in great detail about what each message mean and how we can build better Meteor applications.
Progress bars in Python!!!!
Tags: python, beginners, codenewbie
Published: 2020-04-08 01:21:04

Ever wrote a super long loop and waited for the whole day for the loop to finish. And then you just found out there was a simple bug in your code for that reason your program stayed stuck at a certain place for a long amount of time? A progress bar can be a super simple way to find out on which state your loop is now and how long you have to wait for the loop to complete. This might also save you a huge amount of time. Perhaps you can get a cup of coffee meanwhile your loop completes. Anyway, without any further ado let's get looping. 😉

First, you need to install a PyPi package called `progress`. If you already have pip installed then just type this command in terminal. 

```
pip install progress
```
It won't take much time. When you are done just run this simple script and see your bar progressing.

```python
from progress.bar import Bar

bar = Bar('Processing', max=200000)
for i in range(200000):
    # Do some work
    bar.next()
bar.finish()
```
That' it! The program is pretty self-explanatory and simple.  We are just running a loop and then showing the bar.

Lucky for you, this package has a total of 7 progress bars and 5 predefined spinners. If you don't like the style of the bars or the spinners you can also customize them as much as you wish. For example, you can change the fill, you can change the width, you can add a simple timer that will tell how much time has elapsed and how much time is left. 

For all the detailed information, consider visiting [this documentation](https://pypi.org/project/progress/).

Until next time, goodbye.
How to make Lambda Provisioned Concurrency configurable in CloudFormation
Tags: aws, cloudformation, lambda, serverless
Published: 2020-04-08 01:15:15

A few month ago, AWS introduced [_Provisioned Concurrency for Lambda Functions_](https://aws.amazon.com/blogs/aws/new-provisioned-concurrency-for-lambda-functions/). This is a great addition for .NET Core Lambda since it eliminates the cold-start penalty.

Unfortunately, to use provisioned concurrency in CloudFormation, we have to use [`AWS::Lambda::Version`](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-lambda-version.html), which is an _immutable_ resource. Meaning, once it has been created, it cannot be modified. That's a problem if you want to be able to set the provisioned concurrency using a CloudFormation parameter.


## Naive Approach

Something like the following CloudFormation template will work the first time the stack is created and then never again, because none of the properties of `MyLambadVersion` can be modified after creation:
```yaml
Parameters:

  ProvisionedConcurrency:
    Type: Number
    Default: 0
    MinValue: 0

Resources:

  MyLambdaVersion:
    Type: AWS::Lambda::Version
    Properties: 
      FunctionName: !Ref MyLambda
      ProvisionedConcurrencyConfig: 
        ProvisionedConcurrentExecutions: !Ref ProvisionedConcurrency
```
*NOTE:* `AWS::Lambda::Function` definition omitted for brevity.


## Using a Conditional Resource

The trick is to be able to get rid of the `MyLambdaVersion` resource. We can achieve that by making it a conditional resource and using as condition that `ProvisionedConcurrency` is not `0`.

The following code expands on the previous attempt by introducing a CloudFormation condition:
```yaml
Parameters:

  ProvisionedConcurrency:
    Type: Number
    Default: 0
    MinValue: 0

Conditions:

  HasProvisionedConcurrency: !Not [ !Equals [ !Ref ProvisionedConcurrency, 0 ] ]

Resources:

  MyLambdaVersion:
    Type: AWS::Lambda::Version
    Condition: HasProvisionedConcurrency
    Properties: 
      FunctionName: !Ref MyLambda
      ProvisionedConcurrencyConfig: 
        ProvisionedConcurrentExecutions: !Ref MyLambdaProvisionedConcurrency
```


## Conclusion

While this approach allows us to make provision concurrency configurable, it requires an intermediary step. Whenever you want to change the provisioned concurrency, we have to first go back to `0` to delete the `MyLambdaVersion` resource and then we can set whichever provisioned concurrency we actually want. It's a bit tedious, but at least it's possible!

The other thing to look out for is that we also need to conditionally refer to either `MyLambdaVersion` or `MyLambda` wherever the function ARN is required. Fortunately, that's simple enough using the `!If` function and `HasProvisionedConcurrency` condition.

Happy Hacking!
FlowGoal: An AI-powered Inbox Assistant
Tags: twiliohackathon, machinelearning, startup, dotnet
Published: 2020-04-08 01:01:34

I have been wanting to learn machine learning for a long time now, but have always found a convenient excuse or shiny object to keep me away from it. The statistics aspect of machine learning terrifies me; probstat is one of the several key factors why I dropped out of university. I am in no hurry to visit that feeling of frustration and hopelessness again, but how much longer will I let my fears hold me back?

I've actually done a system with Twilio many years ago. My best friend was a volunteer firefighter in South Australia at the time, and we bonded over our shared love of music, our first responder careers, and fascination with programming. All volunteer units in his region were still using Motorola pages to receive dispatches to calls, which was inefficient, cumbersome, and sometimes lethal. During a major bushfire, the pager network went down and several firefighters did not receive orders to evacuate immediately.

Their sacrifice will not be forgotten. We could do our part to ensure that the same mistakes were never repeated. With a combination of patent documents, USB TV scanners and open-source SDR software, we reverse engineered the protocol. We were able to send dispatches to firefighters as text messages, and we had a large majority of volunteer units in the region subscribing to our service. It was fun while it lasted and I learned a lot, but one of our coworkers was embezzling and had drained the company dry behind our backs. Working from across the world, it was easy for me to step away and avoid the infighting that brought the remains of the company to the ground in a not-so-dignified series of dramatic events.

Originally, I figured I would do the same concept! Except reverse engineering radio signals might be against the contest's terms of use, so I had to broaden my horizon. Starting at the 30,000 unopened e-mails in Thunderbird, I wondered if I could find a way to automate the dumpster fire that is my inbox. And at that moment, *FlowGoal* was born.

I hope to use Natural Language Processing to find out what really matters within my inbox. Twilio's SMS API can text me if it appears that a server is going down or if I have a potential business opportunity. If an e-mail thread goes back and forth too long, my extension will offer to let me place a VOIP call with the other party and see if five minutes on the phone can avoid another dozen replies. New leads can be validated for legitimate phone numbers. For a guy who doesn't really know any ML it is quite ambitious but let's see what I can manage!

Originally, I wanted to do this all in F# or Clojure. It's been a few years since I have worked with F# extensively, and I barely know closure. I wanted to add a novel technology to the mix, but I have enough of a challenge on my hands. I will work in C#/ASP.NET Core on the background since I am most familiar with that tech stack, although I will let myself try Dart to write the extension!

And so it begins! GitLab repo coming soon!
I dont alway, but when  I do...
Tags: node, debug, fml, isntcodefun
Published: 2020-04-08 00:48:02

dos equis
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/h88jrchn3k3z0rj3guol.jpeg)
https://dev-to-uploads.s3.amazonaws.com/i/az1gdp8cybjbcibon7wh.jpeg
Testnet PoC-1 Launched | Phala Updates v0.1.1 (3.30–4.5)
Published: 2020-04-05 16:45:38

## Mainnet
- Launched testnet PoC-1 which has private transfer and private token with 4 bounty quests. Until GMT 11:30, Apr.5th, there have been 209 privacy tokens and 305 contract innovations on testnet; 56 users have completed Quest I (to transfer and issue their own privacy tokens). For the full list of reward giving, you may refer to [the doc on our Github](https://github.com/Phala-Network/phala-docs/wiki/100.-Contribution-&-Rewards) ;
- Added a search function on testnet; [faucetbot](https://github.com/Phala-Network/faucet-bot), Substrate update, and UX improvement is under development according to advice from the community;
- Fixed an error on [polkadot-js: Throws an error when signing with a locked keypair](https://github.com/polkadot-js/common/pull/578);
- Improved user experience on [Phala forum](https://forum.phala.network/); 

## Web3 Analytics:
- Almost completed all pages of frontend development;
- Improving the structure of backend to perform a better authorization design of data rental and standardized protocols. 

## Community:

| Community | Statistics | Week-on-week change |
| -------- | -------- | -------- | 
| Chinese     | 1037 | +6.80%
| English    | 213 | +10.94%
| Global Followers    | 8,378 | +3.47%

- Launched the PoC-1 testnet bounty program on our forum, where over 100 topics have been created for event discussion. For the full list of reward giving, you may refer to [the doc on our Github](https://github.com/Phala-Network/phala-docs/wiki/100.-Contribution-&-Rewards);
- Had over 5,000 messages discussing testnet event in our community groups last week with an impressive activity rate of 45.47%. Harvested over 2,600 impressions and clicks on contents related to Phala testnet;
- Translated [Yuval Noah Harari: the world after coronavirus](https://www.ft.com/content/19d90308-6858-11ea-a3c9-1fe6fedcca75) from English to Chinese. 

## Activity: 
- Hang Yin, Chief Scientist of Phala Network, attended [zkSummit5](https://www.zeroknowledge.fm/summit) online. 
- Zhe Wang, COO of Phala Network, shared his experience as a serial entrepreneur on [CampusVC](https://mp.weixin.qq.com/s/1R7IxXJzeC9RrFqMpasSWg).
Know YOUr Brand
Tags: career, promotion, advancement, development
Published: 2020-04-24 14:19:07

---
title: Know YOUr Brand
published: true
date: 2020-04-08 00:00:00 UTC
tags: career,promotion,advancement,development
canonical_url: https://coreydmccarty.dev/posts/2020_04_01_know_your_brand/
cover_image: https://dev-to-uploads.s3.amazonaws.com/i/txoj6apm3px4e1ck0xgo.png
---

<a href="https://undraw.co/illustrations">Cover image by undraw.co</a>

While working on my resume, I've had a TON of good advice from a the Slack server of [CodeConnector](https://codeconnector.io/) and they have actually been the source material for some of my other posts. But, one of the best bits of advice that I got was to actually ask my closest coworkers what they would tell someone about me. Specific questions listed below with answers given in line. I expected answers about being a hard worker or some other generic crap, but the answers that I got were much more substantial, and I've been working on ways to embrace these answers and play to my strengths. This includes an ongoing effort to incorporate these qualities into my personal brand.

1. What are his strengths? What would you say make him a good/unique developer/coworker?
  - Desire to do the right thing, code most efficiently, works well within team and outside of a team, well organized
  - Ability to challenge any idea/motive if there seems to be a better alternative, no matter to who, not being afraid to speak up to anyone
  - Willingness to take up a new, and unfamiliar idea and learn all he can about it in order to better apply his skills and knowledge to the solution
  - Speaking his mind, calling BS when he sees it, and always looking for improvements
  - Desire to do the right thing, code
  - Asking questions, solid coding skills, good at explaining complicated topics
2. What would you tell me that I don't already know? How would you sell me to someone else?
  - Corey is organized and timely. He works well with his team members and folks outside of his team. He asks thorough questions. He is dependable and easy to work with.
  - I can't think of anything you don't already know, but I'd sell Corey as a determined go-getter who will figure things out, knock down walls, and pester whoever needs pestering to get the job done.

This is all pretty specific, and not things that I have ever considered when asked in interviews how others would describe me. I can now present a better answer to that recurring interview question. I am also working to tweak my resume statements, and to include these qualities in the bio portions of my website.

As another point, whether it's personal development or brand development, you need to know your weaknesses or the negative side of your strengths. In these examples my strengths were listed, but each of these could be weaknesses. Desire to do the right thing can be irritability at what is seen as incorrect, challenging processes can be distraction from the work at hand, unafraid to speak up can be constant talking. Knowing these things is the first step to mitigating these issues in how you work.

You can't make your brand better if you don't really know what it is.
Newsletter lesson learned -Dont use free emails like Gmail
Tags: newsletter
Published: 2020-04-21 17:33:27

---
title: Newsletter lesson learned -Dont use free emails like Gmail
published: true
date: 2020-04-08 00:00:00 UTC
tags: Newsletter
canonical_url: https://www.jskap.com/notes/newsletter-lesson-leared-dont-use-free-emails/
---

  

![](https://friendly-heyrovsky-86d9f9.netlify.app/opengraph?&author=kapilgorve&title=Newsletter%20lesson%20learned%20-Dont%20use%20free%20emails%20like%20Gmail&tags=Newsletter)

  

Always use professional email ex- john@snow.com rather than free email ex john@gmail.com for sending mass emails/newsletters.

Free email providers like Gmail, Yahoo etc will mark your sender email as spam by default. This is the official policy from these email providers. They are meant for personal use.

My delivery rate jumped from 20% to 80% just by making a switch in email sender.

  

This post was originally published at https://www.jskap.com/notes/newsletter-lesson-leared-dont-use-free-emails/

  

👋 Hi! I’m Kapil. I am always chatty about building things, sharing my learnings, freelancing. Come say hi to me at [https://twitter.com/kapilgorve](https://twitter.com/kapilgorve)
How to exit Vim
Tags: linux
Published: 2020-04-21 17:33:03

---
title: How to exit Vim
published: true
date: 2020-04-08 00:00:00 UTC
tags: Linux
canonical_url: https://www.jskap.com/notes/how-to-exit-vim/
---

  

![](https://friendly-heyrovsky-86d9f9.netlify.app/opengraph?&author=kapilgorve&title=How%20to%20exit%20Vim&tags=Linux)

  

1. Press `esc` key.
2. Type, `:q`, press return.
3. Type, `:wq`, press return (If you wanna save)OR
4. Type, `:q!`, press return (If you don't wanna save)
  

This post was originally published at https://www.jskap.com/notes/how-to-exit-vim/

  

👋 Hi! I’m Kapil. I am always chatty about building things, sharing my learnings, freelancing. Come say hi to me at [https://twitter.com/kapilgorve](https://twitter.com/kapilgorve)
Props in Vue.js
Tags: vue
Published: 2020-04-07 23:56:26

 ***First, What even are props?***:confused:
According to the official Vue.js docs:
>Props are custom attributes you can register on a component. When a value is passed to a prop attribute, it becomes a property on that component instance.
 
This basically means that props are how we pass data between components; from parent components to child components.

In this post, we're going to look at some of the concepts of Vue.js props.

 ***Let's dive in***
![alt text](https://thumbs.gfycat.com/LividCornyEmu-small.gif )

***Defining Props***
For a component to register a prop, it has to first define it in its props property.

In a Vue instance,
```JavaScript
Vue.component('todo', {
  props: ['task'],
  template: '<p>Pending {{ task }}</p>'
})
```
In a Vue component file,
```JavaScript
<template>
  <p>Pending {{ task }}</p>
</template>

<script>
export default {
  name: 'Todo',
  props: ['task']
}
</script>
```
***Passing data using props***

* *Passing a static value*

For a component to use the prop, include it as you would a HTML attribute
```JavaScript
<Todo task="Learn about Vue.js props"/>
```
What if you want to pass more than one prop to the component instance? Simple, append the extra props to the array.

```JavaScript
<template>
  <p>Pending {{ task }} at {{time}}</p>
</template>

<script>
export default {
  name: 'Todo',
  props: ['task', 'time']
}
</script>
```
Rendering the component
```JavaScript
<Todo task="Learn about Vue.js props" time="10:10 am"/>
```
* *Passing a dynamic value*

```JavaScript
<template>
  <div>
     <Todo v-bind:task='task' v-bind:time='time'/> // 
  </div>
</template>

<script>
export default {
   data(){
        return {
               task: "Learn about Vue.js props",
             }
}
</script>
```

* Passing an array 
```JavaScript
<template>
  <div>
    <Todo 
        v-bind:key="task.id" 
        v-for="task in tasks" 
        v-bind:task="task.task" 
        v-bind:time="task.time"
    >
 
    </div>
  </div>
</template>
<script>
export default {
  data(){
    return {
      tasks: [
        { id: 1, task: 'Learn about Vue.js props', time: '10:10am' },
        { id: 2, task: 'Go for a walk', time: '06:00pm' },
        { id: 3, task: 'Sleep', time: '11.00pm' }
       ]
    }
  }
```
***Prop types***
It's always a good thing to define the data types of your props. When props passed don't match the defined type, Vue complains by throwing an error in the console.
To set prop types, you list the props as an object with the properties names as keys and types as values.
```JavaScript
 props: {
        taskId: Number,
        task: String,
        time: String,
        tags: Array,
        isCompleted: Boolean,
        markComplete: Function
     }
```
To learn more about props, visit the official Vue.js documentation page [Vue.js docs](https://vuejs.org/v2/guide/components-props.html)
Open source framework for building cutting-edge applications quickly 
Tags: blockchain, serverless, javascript
Published: 2020-04-07 23:35:49

Hey everyone! 

I hope you're staying well out there.

With all this extra time on our hands, seems to be a great time to build new projects. So, if you're looking to bring ideas to life quickly, and cost-effectively, give the MESG Framework a look.

It's an open source framework for for building applications. The goal is to let you focus on your app’s business logic and forget about component integration and infrastructure management.

It's also backed by a blockchain, so the apps you build super-secure, feature-rich applications from beginning to end with just a few lines of code. 

Any apps you build are owned by you, and you can receive royalties when others use your components. Plus you can keep your app on the MESG network, or choose to run it on your own local machine or network.

Also, it's quite easy to learn, so in just a few minutes you can reuse and recycle components and put together applications using impressive tech. 

[https://mesg.com/get-started/](https://mesg.com/get-started/?utm_source=devto&utm_medium=blog&utm_campaign=quick)
Crib Notes: Finding Missing Single- Or Double-Quote Pairs
Tags: cribnote, handy
Published: 2020-05-13 23:24:55

---
title: Crib Notes: Finding Missing Single- Or Double-Quote Pairs
published: true
date: 2020-04-07 23:02:00 UTC
tags: crib-note,handy
canonical_url: https://thjones2.blogspot.com/2020/04/crib-notes-finding-missing-single-or.html
---

So, today, was writing a BASH utility. As per normal, I have a commit-time check that runs it through [shellchecker](https://www.shellcheck.net/). That test came up green. However, when I ran the script if finished by complaining:

> ```
> XXXXXX.sh: line 290: unexpected EOF while looking for matching `"'
> ```

Naturally, my reaction was something along the lines of:  
  
  

[![](https://gifimage.net/wp-content/uploads/2017/08/what-you-talkin-bout-willis-gif-8.gif)](https://gifimage.net/wp-content/uploads/2017/08/what-you-talkin-bout-willis-gif-8.gif)
  
  
I mean, shellchecker's usually pretty damned good about finding trivial flubs like that. So, Googled about to see if there was an easy way to double-check things. My search was fruitful – I found this cute, little snippet:  

> ```
> | tr -cd '"\n' | awk 'length%2==1 {print NR, $0}'
> ```

I <tt>cat</tt>ted my script to that pipe and, for better or worse, it agreed with shellchecker that all my single- and double-quotes were properly paired.