teleren/devto huggingface dataset:
Angular 8/9 Date Pipe Tutorial with Date Format Examples
Tags: angular2tutoria
Published: 2020-02-07 10:03:24

---
title: Angular 8/9 Date Pipe Tutorial with Date Format Examples
published: true
date: 2019-10-31 12:14:49 UTC
tags: Angular (2+) Tutoria
canonical_url: https://www.positronx.io/angular-date-pipe-tutorial-with-examples/
---

The post [Angular 8/9 Date Pipe Tutorial with Date Format Examples](https://www.positronx.io/angular-date-pipe-tutorial-with-examples/) appeared first on [positronX.io](https://www.positronx.io).

**In this Angular 8|9 DatePipe tutorial, we are going to learn how to use Date Pipe operator to format the date as per the locale rule. Angular 2 DatePipe offers various predefined date formats; furthermore, we can also customize the date formats using DatePipe.**

#### Table of Contents

1. What is Pipe Operator?
2. Angular 8|9 Date Pipe Example
3. Custom Date Formats in Angular 8/9
4. Conclusion

[click here to read more](https://www.positronx.io/angular-date-pipe-tutorial-with-examples/)
Where to Find Best interview Preparation Websites?
Tags: interview, career, learning, resources
Published: 2019-10-31 12:04:35


Interviews are always an important part of career. Either you have just completed your phase of education or are willing to switch your organization. You will have to face interviews and multiple rounds too.

Preparing for interviews is easy for some people and for some its their worst nightmare. The difference is just of the way they perceive the word Interview. There is nothing to be scared of interviews as they are two ways process. 

The company wants to take the best candidate and same goes for the employees. So if you have got all the skills and a way to present them well then you will definitely rock it.

Interview Preparation Websites are one of the best ways to start preparing for one. Thee are many interview preparation websites where you can learn all the things to perform your best.

There are many aspects that the company looks for. Like the confidence of students, communication skills, personality, knowledge of field, strong aptitude and many others. These all things can be gained by practicing and learning from the right source. 

There are video lectures for every one of these aspects. For aptitude you will be learning to solve aptitude questions,for personality development you can go through video lectures and so on.

Below are the websites which you can use to prepare for Interviews:

1. Glassdoor
2. GeeksforGeeks
3. CareerCup
4. Zety Blog

You can find the complete list of websites here: [Interview Preparation](https://www.presentslide.in/2019/07/best-interview-preparation-websites.html)

We hope you will find it useful for your future endeavors and career life. Practice all the things that are provided in the websites and you can rehearsal in front of mirror to get the best results for your interviews.
How to continuously run a Laravel queue listener on server
Tags: laravel, discuss, php, webdev
Published: 2019-10-31 10:27:40


Laravel has a built-in queue management system which will help the main processing thread to ward off time taking asynchronous processes to a separate thread, also it can help the application to be scaled horizontally by adding multiple listeners/processors to simultaneously consume the queue.

In a development enviornment, we can listen to a queue by simply running 

    php artisan queue:listen

Where as, when we deploy this to a server, we cannot use this command. Because when we close the session, artisan command will exit. Earlier days, I was using screen command on linux to keep it running. Somehow, screen is a messy way to handle this situation.

To avoid this, we need to use a supervisor application to keep the artisan command alive.

There are many tools available to this purpose. A few of them are: forever, hypervisor, and pm2.

Here I am sharing the way how you can run artisan command using pm2.

    pm2 start artisan --name QueueName --interpreter php -- queue:work --daemon

Explaining this, pm2 start will initialize artisan command. PM2 can start a named instance using --name, here QueueName will be the name of the instance. By default, commands will be run using node interpreter. So, --interpreter will set it to php. Finally, 'queue:work --daemon' is the argument to the php artisan command.

After running the above command from the laravel project root, run the following command to check the status.

    pm2 list
![PM2 screen grab](https://thepracticaldev.s3.amazonaws.com/i/krffzsh637de3h43rvhc.png)

Status must be online. If it is not, run

    pm2 monit
to see the logs and take corrective actions.

> Written with [StackEdit](https://stackedit.io/).
File based database migration app
Tags: showdev, database, java, phinx
Published: 2019-10-31 11:18:17

I get frustrated if I have to do a task that can be automated or accomplished easier (with less brain activity). I think writing file based database migrations is one of those tasks.

## File based database migrations

For those, who don't know, what file based database migrations are. It's basically version control for databases. Every application, that uses database, and evolves over time, will eventually have to change database structure. We can use special files, `migrations`, to share this change between developers and servers. Migration file is a SQL (or other language) code, that can apply database changes or undo those changes.

Migration framework keeps track of already applied changes and not yet applied changes. You can update to the newest database scheme version or fallback to specific version in time.

## Creating migration file

To create a migration file you have to know SQL really well or know specific migration framework commands. In my last job, we did 4-5 migrations in a month. It's not frequent enough to remember all the commands needed to create valid file, but frequent enough to make me angry each time I have to google correct commands.

## Migrator

I decided to create a desktop application, that generates this migration file for you. This application should be able to create, update and remove database tables with zero code. I think it's possible to create user interface, that will handle most migration cases.

> First of all, I tried to google if this kind of application already exists. I did not have any success finding one. If you know about existing application let me know

The application is called `Migrator`. It's written in java, so everyone should be able to run it. There might be some bugs and missing features, but I think it's enough to prove the concept. Also, some form labels might be confusing. Unfortunately, I did not add any hints for them, but it might be improved in the future.

![craete migration file](https://media.giphy.com/media/dY0y5gabkE5wKijvyr/giphy.gif)

> Download: [https://github.com/pipan/migrator/releases/download/v0.2.2/migrator.jar](https://github.com/pipan/migrator/releases/download/v0.2.2/migrator.jar)

> Github: [https://github.com/pipan/migrator](https://github.com/pipan/migrator)

## Current support

Current version of the application supports only phinx migrations (PHP) and MySQL databases.

Possible future support could be for:

* flyway (java)
* db-migrate (nodejs)
* fluent (.net)

I will appreciate any feedback or contributions. The idea is to keep it open source and let community add other database drivers and language support.

> You might need Java 12 and higher to run this application
How to make APIs fast & secure, plus tips for REST APIs
Tags: todayilearned, security, sql, database
Published: 2019-10-31 11:00:15

*TL;DR style notes from articles I read today.*


### [Making fast APIs: lessons learned from 40 years of SQL](http://bit.ly/36gGoip)

- Give consumers full access over what to fetch, and don’t tie them to pre-determined data fields. 
- Emulate SQL’s EXPLAIN method & let users know how exactly the database will execute their query. Then they can see what may be slowing things down and correct it themselves.
- If impossible to offer full access, optimize your API for common access patterns.
- Make it easy for users to fetch all the data they need in one go, rather than looping multiple requests.
- Design the API to cache data locally.
- Design the API to study access logs and prefetch relevant data accordingly as this impacts the perceived speed of fetching without changing throughput.
- Learnings from the NoSQL movement: model data structure on data access patterns; and that users want consistency more than the fastest (or the slowest) speeds possible. 

*[Full post here](http://bit.ly/36gGoip), 10 mins read*

---

### [You can’t protect what you can’t see](http://bit.ly/2Wrc00r)

A few ways to secure APIs:
- Establish visibility so that the business knows what is exposed to whom and how through the API. An API management layer should have monitoring and analytics capabilities to detect threats in real-time. 
- Authenticate both end-users and client applications. OAuth2 is the de facto standard. 
- Validate all input so that it matches expected parameters—this protects your API against SQL injections, cross-site scripting & other common threats. It also acts as an early-warning system when scouts explore APIs for vulnerability.
- Secondary to ensuring your infrastructure can scale out to avoid a DDoS attack, rate limits within the API can check for attacks and avert minor traffic spikes.
- As a defense against bad bots, put the onus on the client to prove their identity - with reCAPTCHA, for example.

*[Full post here](http://bit.ly/2Wrc00r), 10 mins read*

---

### [5 tips for wrapping your database with a REST API](http://bit.ly/2JBl65s)

- Don’t let implementation details leak into your API. Use clear resource concept names. Don’t use abbreviations or naming conventions in URLs. 
- Paginate search results and limit the number of pages returned and to cap the maximum number of records per request. Add hypermedia links to first, last, next & previous pages for easy navigation.
- Stick to the standard response codes, don’t invent new ones. Use the common HTTP response codes 200, 201, 204, 400 and 404. 
- When data arrives from a client, always validate required fields, field types, & formats. Never passing SQL in the URL.
- Add workflow-based functionality to APIs so that they go beyond mere data access.

*[Full post here](http://bit.ly/2JBl65s), 6 mins read*

---

*[Get these notes directly to your inbox every weekday by signing up for my newsletter, in.snippets(), here.](https://mailchi.mp/appsmith/insnippets?utm_source=devto&utm_medium=post08&utm_campaign=is)*
How to make Custom <select> but without using select?
Tags: discuss, html, javascript, react
Published: 2019-10-31 10:58:00

How can I make a custom select component but without using <select> HTML tag? I have an input field and when searched it fetches data from API. The data are shown in separate div. I also tried datalist but no luck.


![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/p6ikytfbx7j2z7q0jqhh.png)
Starting my journey! 
Tags: career, java, react, sql
Published: 2019-10-31 10:57:32

Hello Devs!


I have recently landed a job as IT-consultant for a company in Norway. They will teach me how to code in Java. This course is 12 weeks long and is a full time course, it is intensive and demands my full focus for these weeks. 

My question is a two parts question - where the first part is, do you, as a experienced developer believe that 12 weeks are enough to learn a language sufficient to be proficient in the developer field? 
 

Second part of the question is; Do you have any tips to retain most information coming withing these 12 weeks, any websites or apps, or just tips in general to "log" my learning?


Al tips and answers are greatly appreciated.


Thank you for reading!
Azure Readiness Checklist
Tags: azure, contributorswanted, javascript
Published: 2019-10-31 10:51:02

## Are you ready to go to prod on Azure? Use this checklist to find out

Building production-grade infrastructure (as in, the type of infrastructure you’d bet your company on) involves a thousand little details. The vast majority of developers don’t know what those details are, so when you’re estimating a project, you usually forget about a number of critical and time-consuming details.

To avoid this issue, every time you go to work on a new piece of infrastructure, go through the following checklist: https://azurechecklist.com/

<p align="center">
  <a href="https://github.com/ghostinthewires/Azure-Readiness-Checklist/blob/master/CONTRIBUTING.md">
    <img src="https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square" alt="PRs Welcome">

[Here](https://github.com/ghostinthewires/Azure-Readiness-Checklist) you will find a raw version of the checklist but I highly recommend using the dynamic version at https://azurechecklist.com/ which allows you to generate a report!
FIXED: Upload to DigitalOcean Spaces with AWS S3 getSignedUrl with correct permissions and Content Type
Tags: help, node, aws, digitalocean
Published: 2019-10-31 10:09:57

Solution:

What i actually had to do, was allow for custom headers to be set in the put request. This was done through the DigitalOcean interface in the CORS settings for your spaces.


I am trying to upload assets through the getSignedUrl method that the aws-sdk provides, a NodeJS backend with Axios where the upload happens from a VueJS 2 frontend. Now whatever combination i try, or the file is able to upload but always sets it to private and the wrong Content-Type, or i get 403 permission errors.

If i leave out all the ACL and ContentType stuff, the file is displayed on the Spaces interface as being private.


This is how it should be shown, and what i get when i upload manually through the interface:

![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/7wepfya9fnhf1r04gzm2.png)

What i want to do is that the upload has an ACL that is public-read and the correct Content-Type. 

The following is the code that i use:

To get a signed Url

```
const s3 = new AWS.S3({
    accessKeyId: keys.spacesAccessKeyId,
    secretAccessKey: keys.spacesSecretAccessKey,
    signatureVersion: 'v4',
    endpoint: 'https://REGIO.digitaloceanspaces.com',
    region: 'REGIO'
});

app.get('/api/upload/image', (req, res) => {
        const type = req.query.type;

        s3.getSignedUrl('putObject', {
            Bucket: 'BUCKET',
            ContentType: type,
            ACL: 'public-read',
            Key: 'random-key'
        }, (error, url) => {
            if (error) {
                console.log(error);
            }
            console.log('KEY:', key);
            console.log('URL:', url);
            res.send({ key, url });
        });
    });
```

This provides a signed url that looks like:

```
https://BUCKET.REGION.digitaloceanspaces.com/images/e173ca50-fafe-11e9-b18c-d3cfd4814069.png?Content-Type=image%2Fpng&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=NSX3EZOFXE57BAFSKDIL%2F20191030%2Ffra1%2Fs3%2Faws4_request&X-Amz-Date=20191030T102022Z&X-Amz-Expires=900&X-Amz-Signature=f6bcdcd35da5dc237f881a714ec9ca09cb7aa3f3ffbd2389648a7c30808ab56e&X-Amz-SignedHeaders=host%3Bx-amz-acl&x-amz-acl=public-read
```

Then for actually uploading the file i use the following:

```
await UploadService.uploadImage(uploadConfig.data.url, file, {
          'x-amz-acl': 'public-read',
          'Content-Type': file.type
      });
```

With the service looking like:

```
  async uploadImage (url, file, headers) {
    await axios.put(url, file, headers.headers);
  }
```

disclaimer: this works with S3 itself as you can set the permissions on a per bucket level so you don't have to worry about it. But Spaces providers a CDN as well and is just generally cheaper. :)
Cold Shower Therapy
Tags: lifestyle, health
Published: 2019-10-31 10:07:43

_originally posted [here](https://writtenby.adriengiboire.com/2013/10/24/cold-shower-therapy/)_

A couple of months ago, I watched a video where [Joel Runyon](http://impossiblehq.com/) gives his first talk at TEDx, [How Cold Shower Therapy Can Change Your Life](http://www.youtube.com/watch?feature=player_embedded&v=Gb0h8ZKvJW4). The title of his talk was a bit confusing to me.

When I was a child, my parents used to put me in cold showers to calm me down, or to punish me for having done bad things. I was pretty hard to handle as a child. Anyway, I really wondered in what way cold showers could be used as a therapy.

In his talk, Joel tells an anecdote about a meeting he had with a successful entrepreneur friend. Joel told him about his will to eventually start his own business after he was done with a new great job opportunity he just got.

His friend asked him about why Joel didn’t started his own business already. Well, you know answers’ Joel. Everybody replies the same. Like not enough money, not enough time, not knowing what to do as business anyway,…

The true thing is that most people are afraid of the new situation starting its own business is. You will lose your regular wages which can be more or less scary, according to your social situation (couple, children, …). You will have to build the business you want which can be pretty hard and exhausting.

It will be uncomfortable.

Relating to this uncomfortable thing, Joel’s friend told him to do one thing to understand what being uncomfortable is. Take a cold shower each day during 30 days. This is uncomfortable.

I have my own business and I was curious to see how this therapy would work on me. So I did it.

Today, I’m over 40 cold showers. I don’t think I’m gonna be more able or unable to deal with uncomfortable situations. And taking the bull by the horns is one thing I never was afraid of. Despite that, I don’t think that if you can’t take a cold shower each day during 30 days will make you more unable to deal with uncomfortable situations. And I don’t think that if you are able to take 30 cold showers, you will be more reliable when facing uncomfortable situations.

But here are my thoughts about taking cold showers.

It is more **eco-friendly**. Not using hot water means no need to burn anything to warm your water. You might even be more likely to take shorter showers, so… It also helps you being thin or **burning fat**. Indeed, as you cool down your body with an ice cold water shower during 5 to 10 minutes, you will make your body burns a lot of calories to warm itself up. And last but not least, it makes you more **vigor**ous. You’ll see.

And there is more to it.

Try to set it up as a routine, and you’ll like it. And don’t be mistaken, one hot shower from time to time is allowed.

Want to read more about [the health benefits of a cold shower](http://impossiblehq.com/cold-shower-health-benefits)?

_[Follow this link to comment](https://news.ycombinator.com/item?id=8345059)_
Convert anything to anything
Tags: discuss
Published: 2019-10-31 10:02:51

When someone is asking: "Which tool I can use to convert something to something", there is always someone else answering: "Aspose Aspose Aspose"! 😁👍👏

{% stackoverflow 13469410 %}

Really, there are so many possibilities with **[Aspose products](https://www.aspose.com/?utm_source=https://dev.to/aspose_slides/convert-anything-to-anything-9d3&utm_medium=email)**, that soon you will be able to convert anything to anything!

**Write in comments ANY file format and I will tell you if Aspose products work with it!**👇💪
Best 404 Page Found Till Now! What do you say?
Tags: javascript, webdev, beginners, discuss
Published: 2019-10-31 09:31:25

Best 404 page found till now. 

![404 error page](https://thepracticaldev.s3.amazonaws.com/i/tgbpxiba92mqfyc4iipd.jpg)

Hats off to the creativity!
What do you say about this 404? 😁
[Percentage Calculator](https://www.rapidtools.co/percentage-calculator.html)
[Hostels in  Kanpur](https://www.mrroom.in/hostel-in-kanpur)
Ghosty halloween
Tags: codepen
Published: 2019-10-31 09:30:36

<p>Designing and animating with <em>CSS/SASS</em> - creating dynamic elements like clouds, start, ghosts, etc. Big thanks to <a href="https://dribbble.com/shots/5455880-Ghost">Jamie Aucoin ghost illustration</a> which was an inspiration to me to do this pen. Check it out! </p>

{% codepen https://codepen.io/georgest/pen/gOOGwdR %}
How i use React Component in adonisjs edge template engine?
Tags: adonisjs
Published: 2019-10-31 09:28:17

Hello All Sir
im adonis and nodejs starter.

I have route that routes
for all posts , post detail

in post detail i want to change only ui not route
eg when user comment i will change ui only.
when user like post
when user click pagination.

its not spa
i want to use react component in some part of project
thanks you

#i am devnoob
Egypt's First Hacktoberfest Event !
Tags: hacktoberfest, eventsinyourcity, git, github
Published: 2019-10-30 18:28:45

# who are we ?
We are **Open Source Community** -casually we call it OSC-, a student community that resides in **Computer Science** - Ain Shams University, Cairo, Egypt.
We organise many events during the year as we make **workshops**, help students install linux and many other events.

# Get to Git
We are proud to organise the first Hacktoberfest event in Egypt ! The event was called " **Get to Git** " on 28 October.
It included a talk about **open source**, other talk about an **introduction to git and GitHub** and how are they used and at last a **session** to help students start using git.

You can check the event [photos](https://www.facebook.com/pg/oscgeeks/photos/?tab=album&album_id=1438570919642610&__xts__%5B0%5D=68.ARAmKCsqFWJtjn66Q-H0DWPuEooq89wCYsSVvr3OJzgOHdJgUtoA9WIdnUgcXpKWc81g67UxOqDyqa4Emo50A0Jeh3hr6YiCGyw8mrWwXsJ3nejoGhkTdVNEH6w59oNOuw0KFawf8scbH7nu8JfTzXr_zT4k5RD6y2tZRNNFfzJCo86alYlz2p24tbowIOHk6KI7yQTbYweeruU1HOUEwXiqnTiZBYVx-O6I7UpZiaYw8nqACRyhqfD5bW9GIinjtU-ZCsmXkuETIR8v_NZoX1IDTHx9nqgHNosmEBTXCPHOKlvcBWqQ-cUC-B9vUIfwtHm50-Q9Bmo8Pe-IZncJ-q7pJvn9N0rMDKXK-kTzAMkxLCc6Wk5xh9vGQsqoz1tVohzWW-IIgWqZPrbRifawIJmmNMfMqwcQ&__tn__=H-R) and [slides](http://tiny.cc/gitSessionSlides).

If you have any question leave me a comment :D.
How to build an Instagram bot using Python
Tags: python, tutorial, beginners
Published: 2019-10-31 09:16:22

Instagram Automation: Build A Bot with Python

Instagram is the fastest-growing social network, with 1 billion monthly users. It also has the highest engagement rate. To gain followers on Instagram, you’d have to upload engaging content, follow users, like posts, comment on user posts and a whole lot. This can be time-consuming and daunting. But there is hope, you can automate all of these tasks. In this course, we’re going to build an Instagram bot using Python to automate tasks on Instagram.

**What you'll learn:**
* Instagram Automation
* Build a Bot with Python

{% youtube 565Le7dLUi0 %}
Python server + Web client
Published: 2019-10-31 09:16:01

---
title: Python server + Web client
published: true
tags: help
---

Hello. I wrote python script that connects to DB (GE Proficy Historian), sends SQL request to it and gets data back (shows data in command line). I need to set up server and create simple web interface and would be glad if you could recommend me some solution for server (to execute this Python script) and some solution for web client interface (data, which I receive are manufacturing process data, so better to have possibility to show them as diagrams). Just architecture. I am thinking about React highcharts. Maybe something better (free and open-sourced)? And what to use as Python server (linux based?)?

Thanks