2021 in Pictures

2021 is over! A very strange year where I have been vaccinated against COVID-19, with an additional booster, yet I caught it and took months to recover.

Fortunately, I continued to take a photo every day though my Project 365 which allows me to appreciate what happened during this year of my life.

January

January started out quietly with a hint of snow. I did a lot of walking, presented at The Online & my son interviewed for his year in industry placement. I also attended the funeral of my aunt Linda and while it was lovely to see my family as meeting up was very much discouraged, this wasn’t the way I would have chosen.

February

As lockdown continued, we celebrated my wife’s birthday and I continued to walk around the local area, usually in the early morning. I also had my fist COVID-19 vaccination.

March

More lockdown in March. Worked in my office, went for walks around the neighbourhood & enjoyed tea in the garden!

April

In April, I ventured out and took some photos of trains. I also met up with Stu Herbert for a walk on the Malverns. I also had my second COVID-19 vaccination.

May

May is birthday month in our household! Although things are opening up a little in the UK, I continued my daily walking exercise as it had turned into a habit. I also photographed the Seven Valley Railway a few times and we visited my mother-in-law for the first time since the pandemic started. In an effort to stop spending all my leisure time in front of the computer, I started building a model railway.

June

June was warm enough for ice cream and I visited friends that I hadn’t seen since February 2020. Other than that, this was yet another quiet month.

July

One highlight of July was visiting Cardiff and catching up with Gary. There were elephant statues in Worcester, that needed photographing too! We also visited my family for a very delayed Christmas and celebrated our 25th wedding anniversary!

August

In August we spent a week on the North Kent coast as we weren’t going to go to Spain this year.

September

In September, my family gathered for lunch and to celebrate my aunt’s life. My mum has been doing a sponsored walk the distance from Lands End to John O’Groats and completed the last 10 metres when we were all together. My cousins arranged for cake to celebrate! I also went on a railway photography trip to the North of England, visiting James, Lorna & Kevin while there.

October

October was a month of visiting universities with my younger son. I also spoke at ScotlandPHP – my first in-person conference since PHPUK in February 2020. Work started on replacing our kitchen this month too.

November

On the last day of October, my new 14″ MacBook Pro arrived, so I set it up in November. It’s been a long time since my computer was not an Intel! I spoke at the first in-person PHPSW event since the pandemic started which felt fitting as I was the last speaker at the final one before it started. Our kitchen was essentially completed this month and at the very end, we popped down to see my parents.

December

In the last month of this year, I caught up with my oldest friend. My youngest has been learning to drive, so I took him out for practice and we celebrated Christmas.

2021 was another strange year. It felt like very little happened in the first half as I didn’t go anywhere other than to my local railway. Outdoors, taking photos with nobody else around did wonders for my mental health.

I noted last year that mid-to-late 2021 couldn’t come soon enough for me so that I could see friends and family. This turned out to be true and in the second half of this year, I was very happy to be able to see my family and friends.

Here’s to 2022!

An Open QnA Invitation

TL;DR; Check out the new QnA Section here : https://qna.dotnetcoretutorials.com/

It’s almost 5 years to the day that I started .NET Core Tutorials. I actually went back and checked and the first ever post was on the 26th of December. Maybe that gives away just how much I do xmas!

One of the first things I did all those years ago was set up an email ([email protected]), and start fielding questions from people. After all, my writing was literally just me figuring things out as I tried to get to grips on the differences between .NET Core and .NET Framework. Over the years, I’ve probably had an ungodly amount of emails from students to 30 year veterans, just asking questions about .NET and C# in general. Some were clearly homework questions, and others were about bugs in .NET Core that I had a hell of a time debugging, but I treated them all the same and gave replies as best I could.

Some of those questions got turned into blog posts of their own where I more or less shared my reply. But other times, the answer was simple enough that dedicating an entire post to what was almost a one word answer or a 5 line code snippet seemed somewhat dumb. That being said, it always annoyed me that while I was willing to help anyone and everyone who emailed me, me replying to that person one on one and not sharing it wasn’t helping anyone else at the same time.

So, with a bit of time on my hands I’ve spun up a QnA section right here : https://qna.dotnetcoretutorials.com/

What are the rules? Well.. I’m not really sure. For now, I’m just slowing going back and posting questions that I have been emailed over the years, and pasting in my answer to the question. But *anyone* is available to post a question (You don’t even have to register/login), and *anyone* can post an answer, even on questions that already have answers. I know it’s a bit redundant when things like stackoverflow exist, but again, I’m just trying to share what can’t be turned into it’s own fully fledged post.

Will it be overrun with spam in 3 months time? Who knows. But for now, feel free to jump in, post a question, lend a helping hand with an answer, and let’s see how we go.

The post An Open QnA Invitation appeared first on .NET Core Tutorials.

348: With Jhey

Jhey Tompkins is one of the most prolific CodePen creators out there! Find him as @jh3y on CodePen and @jh3yy on Twitter. His creations tend to have a twist of whimsey while being beautifully designed as well as pushing the platform in unique ways. You’ll always be surprised at a Jhey Pen! I talk with him about the creative process, problem-solving, and sharing what you learn.

Time Jumps

00:37 Guest introduction

04:57 The origins of the bear pen

06:12 What’s your process?

11:00 Sponsor: Notion

12:46 Do you feel satisfied when a project is finished?

15:04 Incorporating sound

16:02 Working with Kent Dodds

19:43 Starting with problem solving as an interest

21:00 Video and streaming

25:00 Working with Egghead

29:49 Do you try to keep up with all the things?

Sponsor: Notion

For companies of all sizes, Notion provides one central and customizable workspace that can be tailored to fit any team and bring all teams together to get more done and move faster. Notion is an all-in-one team collaboration tool that combines note-taking, document sharing, wikis, project management, and much more into one space that’s simple, powerful, and beautifully designed. Find out how Notion may be the missing piece your team needs to grow, get more done, and delight everyone who uses it in the process.

The post 348: With Jhey appeared first on CodePen Blog.

The Dew Review – Customizing ASP.NET Core 6.0 from @packtpub

I recently received a review copy of Customizing ASP.NET Core 6.0 in eBook format. This Packt Publishing title was written by Jürgen Gutsch and will be available in early 2022 (you can pre-order print or Kindle versions now).

This is not your run-of-the-mill “getting started with ASP.NET Core” book. There are plenty of books and other online resources to get started building web applications with .NET. This book assumes you are familiar with the basics of ASP.NET Core development and dives right into the intermediate and advanced concepts (the good stuff). These are the things developers need to understand to build really robust, scalable, performant web applications.

I won’t re-hash the entire table of contents for you, but some of the most important (in my opinion) topics covered are:

Writing a BackgroundService
Writing Custom Middleware
Working with ASP.NET Core Identity and Customizing Identity Management
Custom ModelBinders and ActionFilters
Caching concepts

The sample code for each chapter is concise, self-contained, and can be applied to real-world applications. All of this sample code is freely available to readers on GitHub. I love that Packt using GitHub for their books’ sample code. It’s a great way for readers to work with the code and interact with the author and other community members. Readers have provided some great feedback to me through GitHub issues on my WinUI book‘s repository.

The author does a great job covering the topics that are important to enterprise web application developers using the latest recommended techniques in ASP.NET Core 6. I would recommend this book to ASP.NET Core developers or other experienced .NET developers looking to get started building web apps.

Happy reading!

Top 10 Material Design Templates for Your Next Project

Introduction
What You Need to Know About Material UI Design Templates
Examples of Great Material Design Templates
How to Create your Material React Dashboard Template
Conclusions 

Introduction

Today, we’re taking a deeper look at Material UI templates, and explaining what makes the best ones stand out. We have said it once, and we are going to say it many-many more times – design is crucial in today’s market. We will not go in-depth as to why in this article, but if you are curious, feel free to read up on our thoughts on the matter in our article “Top 9 Vuetify Templates for Web Developer”. 

Simple Ways to Improve the Design

Design is king nowadays, and to make your project or an app stand out, you will certainly need a well-made admin dashboard. But the process of creating such a design can be time-consuming and quite tiresome, to say the least. Luckily, there are ways in which you can simplify the whole ordeal. 

One of them is Material Design – the main hero of today’s article, here you will find both premium and free versions of templates to quick start any project at zero cost. What is it and what does it have to do with all of it? Let us explain it to you in the next chapter!

What You Need to Know About Material UI Design Templates 

Let us start by answering the former question – what is Material Design? In short, Material Design is a design language developed by Google, which you can rest assured knowing a thing or two upon the matter, being in the forefront of web development for so many years. Material Design was released in 2014 and at face value, it can be described as an expansion of what Google Now has started with its cards.

But in a broader sense, Material design can be described as a way Google tries to ease the processes of creating web app designs that combine their trademark figuration elements with usage practicality and functionality. Thus, Material Design is a form of design standardization that also allows developers to play around with different geometry, colors, and typography variants.

Material Design keeps things simple

And this conclusion answers the second question we have asked in the introduction part of the article – “What does Material Design has to do with the simplification of design creation?”, as, in general, standardization tends to simplify even the most difficult and creative processes, like design. But, since there is still room for imagination and creativity, that does not mean that all Material Design templates look and feel the same. To prove this point, we would like to present to you a list of ten Material Design Templates that are not only exceptionally made, but also quite diverse in the way they look.

Examples of Great Material Design Dashboard Templates

1. RumChata 

Ladies and gentlemen, please welcome the first entry on our list – RumChata! And, let’s be frank, it is quite a strong entry to prove the visual diversity point. Made with a distinctive Caribbean vibe in mind, RumChata combines within itself an intuitive Material Design-based interface and colorful aesthetics. And although it is not a template, but rather a full-working website, you can use it as an inspiration for your projects.

Source 

2. Fuse 

Entry number two is known under the name Fuse. And, what you need to know about Fuse, is that it is a fully functional and ready-to-use React admin template with a slick and modernistic-looking design. And this template also packs quite an array of pleasant additional features, such as built-in page templates, routing, different auth features, 5 example apps, 20+ pages and lots and lots of reusable React components. So, even if you decide not to use it as it is, you can at least browse through the mentioned components to use in them in your project.

Source

Preview 

Price – 26$

3. Material Design Template

The third Material Design template on our list is exceptionally near and dear to our hearts, as it was created by Flatlogic. And its name is Vue Material Template Full, which, we think, is a pretty descriptive name. As you can understand, it is made on the Vue framework and utilizes such cutting-edge technologies as Vue, Vuetify and Vue Router and, most importantly to the theme of this article, Material Design system. We do not mean to brag, but we are more than proud of this fully functional Admin Dashboard Template and we guarantee that you will not be disappointed with it in any way.

Source

Preview 

Price – 99$

4. Able Pro 8.0. 

Now, let us introduce you to the fourth Material Design template on this list – Able Pro 8.0. Another admin template entry, Able Pro 8.0 comes in both React and Angular 11 versions, which is a nice touch from a developer point of view, allowing you to choose a version, built on a framework that a particular developer prefers. But that is not the only Able Pro 8.0’s features that are worth writing home about, as this Material Design Template is also extremely responsive, retina-ready, its code is very precise and well-structured documentation and over one hundred and fifty ready-to-use customizable pages for you to choose from and tinker around with.

Source

Preview

Price – 25$

5. Dandelion Pro

The fifth spot on our list is occupied by Dandelion Pro – a ReactJS admin dashboard that combines slickness and effectiveness in one package. First, a couple of words about design: it is simple, it is elegant and it has tons of different gradient variants that follow the Material Design Guidelines to a T. Dandelion Pro also features light and dark modes that you can choose from. And that’s not mentioning CSS styling for you to unleash your creative genius upon. Next, we got to tell you about the technical side of this admin dashboard.

Dandelion Pro includes more than 40 React components and modules to tinker around with, which include 2 landing pages, cards, tables, forms. But that is not all, as Dandelion Pro also features Async Code Splitting, clean documentation, and code, and included starter projects. Versatility and opportunity are the two words we would like to use to describe this ReactJS admin dashboard.

Source

Preview

Price – 24$

6. Portal

A Material Design Template called Portal is a beautifully made and extremely well-supported Material Admin Dashboard that has fully-functional versions: Angular, React, and HTML.

The Angular version is built with Google’s Angular CLI, uses Google’s Angular Material 2, and is all around great in the design department. React uses Facebook’s Create React App and Material UI components as its foundation and it is no slouch at design issues either, as it contains within itself 6 amazing layouts, 9 built-in themes, and an exceptionally stylish dashboard. And if frameworks rock your boat in all the wrong ways, there is always the HTML version, which is built with Google’s Material Components for the Web and uses only Vanilla JavaScript. The HTML version’s browser compatibility is also something to write home about.

Source

Preview

Price – 34$

7. React Material UI Templates

Once again, we cannot but include one of our creations on this list, as we are very proud of it. So, the seventh spot on our list goes to none other than Flatlogic’s own React Material Ui Admin Node.Js! This beautiful Material UI framework is not only fully responsive and has a fully documented codebase, but also has components and pages for days to come. So, what you get with is not just a complete front-end and back-end solution for your project – you get a modern and fully-working Admin Dashboard that includes no jQuery or Bootstrap with endless potential for your eCommerce projects.

Source

Preview

Price – 149$

8. Hulk

Just like the beloved hero that shares this ReactJS Material UI Template’s name, Hulk is exceptionally powerful, also much more responsive to communication. What is also cool about Hulk is a built-in language translation method, which once again, adds to the previously mentioned metaphorical communication ease. But that is not the end-all and be-all of Hulk, because it also features some unique dashboard designs, Firebase and Auth0 integration, Digital Signature, and a Tutorial Checklist for all the control-loving developers. So, although being called Hulk, this ReactJS Material UI Template is one of the most developer-friendly and cooperative templates out there.

Source

Preview

Price – 24$

9. Reactify

Reactify is a developer-friendly ReactJS template that, just like the previous entry on our list, features an integrated language translation method, which is never a bad thing in our book. But if we talk about integrations, we should undoubtedly mention Reactify’s API methods that are there to provide you with the power to seamlessly create beautiful dynamic listing pages. This ReactJS-based Material Design template also comes with a bunch of cool eCommerce features for your admin pages, such as customizable sidebars, quick summary overlays, shopping cart widgets, dynamic messages, and a quick link to your app. So, to summarize, Reactify is powerful, reliable, and packed to the brim with different useful widgets.

Source

Preview

Price – 24$

10. React Material Admin

We would not sleep well at night if we hadn’t given the tenth spot to Flatlogic’s React Material Admin. But luckily, we are going to put it on the list, so our nights are going to be calm and soothing, filled with good and energizing sleep.

This inclusion is not just empty bragging – React Material Admin is that good. But we will let you judge for yourself, as we list all the advantages of this React Material UI Admin Template:

· Built on React 16;

· Includes no jQuery and Bootstrap

· Is fully responsive, powerful, and fully work-ready

· Includes such features as React Router, charts, authentication, dashboards, tables, and a notification bar

· React Material Admin’s documentation is as clear, as a drop of spring water, and as precise, as William Tell’s arrow that time he aimed at the apple over his son’s head

We can talk about this React Material UI Admin Template for days and days, but we are sure that it is better to see it once than to hear or read about it a hundred times. 

Source

Preview

Price – 99$

Now we are going to make you an exceptional offer. Although, as we are not a camorra and this is not the “Godfather” movie, you can refuse it no problem. If we caught your attention (which, we are pretty sure, we did) – follow us to the next part of this article.

How to Create Your Material React Dashboard Template 

What we are going to need for this pleasant process is Flatlogic’s Full-Stack Web Application Platform. There, we are going to undertake 5 easy steps, each of which will take less than a minute.

1. Choose a name for your project

All you have to do is just write down the name your project’s CMS is going to have.

2. Choose your project’s stack

Here you have different front-end, backend, and database options for your choosing. Our choice fell on React, Node.js, and MySQL to conclude the holy trinity.

3. Pick a design 

Here you choose the “Material” option, so the whole point of creating a Material Design Admin Dashboard.

4. Choose/create a schema editor for your Material dashboard

The great thing about this point is that there are many ready-made schemas, so even this process is simplified with Flatlogic’s Full-Stack Web Application Platform.

5. Review & generate your Material Design Admin Dashboard

Ensure yourself that you have chosen everything you wanted and press the “Create Project” button for your Material Design Admin Dashboard to create itself as you sit back and enjoy yourself.

That’s it! What you have on your hands is a Material Design Admin Dashboard crafted by you in under 5 minutes. 

Conclusions 

On one hand, Google, as a pioneer in the web development sphere, is doing its best in helping developers simplify their work. On the other hand, standardization is a controversial theme even by itself.

And that’s all for today about material design admin templates. If you need some more examples of material design, read our previous compilation of the top 7 material design dashboards in 2021. There are several articles on related topics below which also deserve your attention. Have a nice day and tap into reading more articles about web development.

Suggested Articles

Top 9 Vuetify Templates for Web Developer
Top 10 Vue Templates to Choose in 2021 | FrontEnd Matters!
What is Next.js and Top Next.js Templates

The post Top 10 Material Design Templates for Your Next Project appeared first on Flatlogic Blog.

Best IDE for Javascript

In this collection, we will provide you with an overview of IDEs that are good for working with Javascript. Some developers use simple solutions, while at Flatlogic we prefer to use full-fledged IDEs for complex tools when developing complex tools.

***

If you want to quickly create and host a full-fledged web application using various technologies (React, Vue, Node.js, PostgreSQL, etc.) – try Flatlogic Platform. With the help of our platform, you can quickly start developing a web application, host it, and no matter how trite it may sound, save a lot of time and maybe money!

***

What is IDE?

Like any definition of something, it should consist of signs. So a program that wants to call itself IDE must have the following attributes:

Autocomplete;
Text editor fields;
For some languages ​​IDE needs a compiler or interpreter – an integrated program that translates your code into a computer-readable language;
Syntax checking;
A debugger is a built-in program that allows you to debug errors;
Provide a suggestion;
Viewing live web page inside the IDE for better understanding of the output;
Syntax highlighter – parts of your code can be displayed in colors that correspond with different elements such as properties, tags, attributes, and all the rest. This allows you to see your work in a more structured way and helps you find errors;
IDE should allow you to quickly go to the definition of class or method;
Shortcuts for ease of access;
Plugin support to extend functionality.

What is the difference between IDE and Text Editor?

The short answer is that text editors only allow you to write and modify code, with a few features. The IDE, on the other hand, includes a very extensive range of functions that help you write code quickly.

Also one of the main differences between the IDE and the text editor is the provision of debugging tools.

And of course the price – many IDEs are a paid product.

How to choose an IDE?

Choosing an IDE, you need to be guided by the main four factors:

The convenience of the user interface;
Number of features;
Language support. Here, do not forget about the long-term perspective – someday it may turn out you will suddenly need to develop in another language. Keeping to the same IDE will be great. So, it’s worth choosing an environment that supports multiple programming languages;
The price. There are many free open source solutions out there. However, the usual trend is this: the cost depends on the number of features available.

Create React/Vue/Angular/Node.js app in minutes

You can also look at other factors such as:

Work speed;
Ecosystem. What extensions are offered by the community and the manufacturer itself;
It’s good if the IDE can open very large files and not freeze.
Is the search in source files easy?
Integration with various build systems
Scalability over huge projects (projects with hundreds of thousands of lines of code)
Do You Need Extensibility?

Remember: there is no tool that will cover all your needs, so somewhere in your path of IDE choices there will be trade-offs.

Best IDE for Javascript

Atom

URL: https://atom.io/
Github: https://github.com/atom
Documentation: https://atom.io/docs
Price: Free, open-source
Languages: Mostly Javascript
Platforms: Windows, Linux, macOS
Extension or Plugins: https://atom.io/packages

If you are developing a web application on Github, then there is no better IDE for you than Atom. This open-source editor was developed by GitHub and is therefore closely linked to the platform. Atom is also a completely normal Javascript editor, with the help of which web projects can be implemented. Atom has vast community support that listens and works on the feedback. It is available on Windows, Linux, and macOS and has a huge package repository to cater to the developers’ needs.

The main advantages of this IDE are collaboration using the so-called Teletype feature and built-in work with Github.

Features

Ease of use with excellent navigation UI;
Collaborative support for multiple developers;
In-built auto-complete and suggestion feature;
Syntax highlighting;
Atom has a built-in package manager which keeps on updating packages; you can also search for packages or start creating your own packages as well;
It also has a feature in which you can drag and drop a module of your file or whole file in a different file;
Cross-platform editing;
Find, preview, and replace text as you type in a file or across all your projects.

Pros

Completely free to use;
A large number of packages available for every need;
Cross-platform;
Instant file switching;
Packages. Atom has a built-in CoffeeScript package manager;
The built-in package manager is great;
Straightforward interface to learn and use;
Git Integration.

Cons

The atom is slow to start cause of Electron use;
Files over 10-15 MB may cause crashes;
Documentation is not great;
Lack of Code Execution;
Slower than other top editors;
Based on Electron – therefore speed issues.

So this is a great free IDE if you like open-source and Github.

Brackets

URL: http://brackets.io/
Github: https://github.com/adobe/brackets
Documentation: http://brackets.io/docs/current/modules/brackets.html
Price: Free
Languages: JS, Ruby, Python, Perl, etc.
Platforms: Windows, Linux, macOS
Extension or Plugins: https://registry.brackets.io/

Brackets is a very lightweight and lightning-fast web development IDE. Brackets is one of those IDEs built mostly for web developers. It has got huge plugin support and is entirely free to use. Created by Adobe Systems, this open-source software can help you build code in all the web programming languages out there. Function finding and quick project switching are some notable features it offers. Overall Brackets are famous for their live preview features and really fast work.

Features

Live Preview that allows you to get a real-time connection to your browser; whenever you make a change, you immediately see the changes on the screen;
Support for the preprocessor;
In-built JavaScript debugger;
Tons of plugin support;
Quick-Edit features enabled;
Available for Windows, Linux, and Mac OS;
Allows collaborative working on the code for multiple developers;
Includes code-folding and syntax highlighting;
Inline editors.

Pros

Extension in Google Chrome. The main feature of the Brackets editor, highlighted by many developers, is real-time communication with Google Chrome. With this mechanism’s help, the developer can immediately observe how all these changes will be displayed in the browser after a change is made;
Widely developed hotkey system;
The main feature that distinguishes Brackets from other JS editors is the Extract function. The extraction function allows you to extract information directly from the PSD – such as fonts, colors, and dimensions, with pure CSS and no contextual code references;
Code Minification.

Cons

Few extensions compared to other editors on the market;
Lack of support for server-side languages;
Difficult Project Management;
Low Performance while working with large files.

Note: On September 1, 2021, Adobe will end support for Brackets. If you would like to continue using, maintaining, and improving Brackets, you may fork the project on GitHub.

Visual Studio

URL: https://visualstudio.microsoft.com/
Github: https://github.com/microsoft/vscode
Documentation: https://docs.microsoft.com/en-us/visualstudio
Price: Free
Languages: Javascript, C, Python, .NET, and others 
Platform: Windows, Mac, Linux
Extension or Plugins: https://marketplace.visualstudio.com/

VS Code was released by Microsoft: the IDE is available under the open-source MIT license. Thanks to its functionality and freeness VScode often wins the vote as the most popular IDE. Visual Studio Code IDE is available for Windows, Linux, and Mac operating systems. Not only does it support JavaScript, but it also supports Node.js, TypeScript, coming with a whole ecosystem of extensions for other languages including C ++, C #, Python, PHP, and (of course) .NET.

VScode is a great IDE to start up your work as it supports a lot of programming languages and has lots of features that will help you through your journey.

Features

It has built-in support for IntelliSense code completion and also a very good understanding of semantic code.
Imported Modules;
Integration with GitHub;
Wide theme selections;
Integrated tools for testing the code;
Version controlling via extensions;
Built-in debugger;
Supports syntax highlighting;
Integrated terminal;
Go to Definition;
Peek definition;
You can also jump to any class definition;
Tooling for JSX/React, Html, JSON.

Of course, we have not listed all the features, and most likely you will not use them all, but these things work very well with regard to Javascript development.

Note that in VS Code by using countless plugins you can change the entire coding process and drastically speed up the development process. 

Pros

It’s Free;
Available for different platforms;
Over 20000 plugins in the marketplace;
Supports React.js IntelliSense; 
Low memory usage;
Multi-Language;
Great customization;
It is an open-source project so you can also contribute to the continuously developing community on GitHub.

Cons

Lags sometimes;
The code check feature is not that great;
Debugging features might be more helpful;
Including a built-in screen for package management;
Support is not great sometimes.

GNU Emacs Editor

URL: https://www.gnu.org/software/emacs/
Github: https://github.com/emacs-mirror/emacs
Documentation: https://www.gnu.org/software/emacs/documentation.html
Price: Free
Languages: Language agnostic
Platform: GNU, GNU/Linux, FreeBSD, NetBSD, OpenBSD, MacOS, MS Windows and Solaris
Extension or Plugins: https://github.com/emacs-tw/awesome-emacs

GNU Emacs is a text editor that comes with a basic user interface, but very useful functionalities. The tool belongs to the text editors family known for their extensibility. GNU Emacs will be very familiar to those who know how to work with the Vim editor. This editor can be called the most simplistic editor available that, however, misses none of the important features.

Features

Well documented references available;
Supports Unicode files;
Capabilities to install and download the extensions;
It can do a lot more than React Native app development.
Full Unicode support;

Pros

High-speed coding environment;
Syntax highlighting;
A lot of useful tutorials;
Theme customization;

Cons

Difficult to get used to;
The initial setup time is very long;
Lots of features: discovering them might take a long time.

As for Javascript development, Emacs does require a bit of work and plugins to really get it to work efficiently.

Spacemacs Editor

URL: https://www.spacemacs.org/
Github: https://github.com/syl20bnr/spacemacs
Documentation: https://www.spacemacs.org/doc/DOCUMENTATION.html
Price: Free
Languages: Almost language agnostic
Platform: Windows, Mac, Linux
Extension or Plugins:

Looking for the best combination of Emacs and Vim, this is the editor that will provide you with the best services. Spacemacs is a community-driven Emacs distribution, thus the best editor that takes the best from Emacs and Vim.

Features

A great user interface, one of the best features here in comparison to Vim;
Well organized key bindings;
Git integration;
Simple query system to quickly find available layers, packages, and more.

Pros

Available on several platforms;
The documentation provided here is more than enough;
Spacemacs has a great community meaning you will never be stuck on a problem for long;
Great if you already are a massive Emacs or Vim fan;
Can configure eslint support;
Can use prettier.js for formatting files on save.

Cons

The CPU usage is not very optimized;
The tool gets stuck sometimes.

Emacs relies on community-written open-source packages for basically every IDE feature for every language. We think it’s great: you can develop the package for yourself. There’s definitely a learning curve, but also there are some really nice tools to help orient yourself in emacs.

WebStorm

URL: https://www.jetbrains.com/webstorm/
Github:
Documentation: https://www.jetbrains.com/help/webstorm/meet-webstorm.html
Price: $129/year
Languages: Angular, React, Vue, Node.js, Ionic, React Native
Platform: Windows, Mac, Linux
Extension or Plugins: https://plugins.jetbrains.com/webstorm

WebStorm – probably the most advanced and most popular web development tool. This powerful IDE for JavaScript development comes with a number of useful features like smart coding assistance, code completion, error detection, and refactorings for a number of languages like JavaScript, Node.js, HTML, and CSS. The company that created this IDE is called JetBrains.

The quality of Webstorm IDE is evidenced by the fact that it is used by the overwhelming majority of large organizations.

Features

In-built debugger support;
In-built testing capabilities;
Syntax error detection;
Integration with Git;
Integration with Mercurial;
The built-in web server helps to run projects online;
Code completion for React and JSX;
It has a Live Edit feature which allows you to immediately see the changes in the browser as soon as you change the code;

Version Control System;
Built-in Terminal.

One of the best features is that by default WebStorm is configured to autosave files as you work on them, and when you switch to other IDEs, you feel the beauty of WebStorm. The other neat thing is that WebStorm has a built-in version control system that commits every time a file is saved. It’s separate from Git commits.

Pros

Native integration with source control systems such as GitHub, Git, as well as Subversion, Perforce, and Mercurial;
The flexibility of settings;
Good integration with Angular, TypeScript, Vue, React by default;
A large number of plugins;
Excellent indentation, tips on how to simplify the code, and basic code validation for errors;
Very useful merge tool.

Cons

Not great in terms of performance;
Slow working with lots of projects;
Relatively complex settings;
It is not open-source.

If you are looking for a mature platform, this might be the right option because it is known for its outstanding development features for the last 15 years.

We consider WebStorm to be the best-paid IDE on the market for Javascript development, thanks to its many features, plugins, and good documentation.

Vim Editor

URL: https://www.vim.org/
Github: https://github.com/vim/vim
Documentation: https://www.vim.org/docs.php
Price: Free
Languages: Almost all
Platform: Linux, macOS 
Extension or Plugins: https://vimawesome.com/

Vim is a very old IDE or a text editor with the ability to transform to IDE, as you wish :). It was the first text editor developed for Unix, and it was called Vi. It is a very advanced text editor, and you’ll never make the developers who love it leave it and force them to switch to VS Code or WebStorm. It is very well-known among developers because of its configuration properties. It is free and highly customizable.

Vim has search and syntax highlighting features and is super lightweight. Thus, it can handle very, very large files. However, it will take a very long time to set up Vim. The tool has a graphical interface, but – you might have guessed – it needs to be customized. Even for the mouse to work, you need to sweat. By default, Vim is controlled by keyboard and keyboard shortcuts. Vim can be a great IDE if you customize it and become familiar with it inside and out. But if time is tight, this is probably not the best choice.

Features

It takes very little space on RAM to run efficiently;
Different tabs and windows can help work on different projects at the same time;
Extensive plugin system;
Support for hundreds of programming languages and file formats;
Powerful search and replace.

Pros

It is possible to install on a very large number of operating systems; 
Deep editor settings, you can customize it all as you need;
The code editing process is speedy.

Cons

Due to the fact that it is terminal, it is very fast but very difficult to learn;
It takes a long time to get used to the user interface;

An important detail in favor of Vim is that a huge number of engineers in top corporations use VIM, such as Facebook.

Sublime Text

URL: https://www.sublimetext.com/
Github: https://github.com/SublimeText
Documentation: https://www.sublimetext.com/docs/
Price: from $0 – $99
Languages: Almost language agnostic
Platforms: Windows, Linux, macOS
Extension or Plugins: there is no one directory, but there are many plugins

Sublime Text is a powerful text editor with an option to transform to IDE for almost every language. It’s lightweight, feature-rich, and supported on popular platforms. Users only need one license to use Sublime Text on any computer. The tool is fast, integrated with multiple tools, and supports the Javascript family of programming languages. The Sublime Text provides great plugin support to enhance the capabilities of the editor. It is currently available on Windows, Mac, and Linux. 

The functionality of the Sublime text editor can be expanded and adapted using plugins. In practice, many JS plugins help turn Sublime Text into an elegant Javascript IDE.

Sublime Text uses a custom UI toolkit optimized for speed and beauty, taking advantage of native functionality on each platform. One of the latest features is that Sublime can render using GPU.

Features

Sublime Text supports auto-completion of codes and also the variables created by the user;
The command palette helps in setting the syntax of your code;
A great library of API and packages is beneficial for developers;
Supports setting key binds and macros for easier coding;
One of the awesome features of the editor is showing a condensed preview of your long code which helps you to move through your code faster.

Pros

Easy to navigate;
Possible to expand functionality;
Multi-line editing possible;
Beginner-friendly;
Great keyboard shortcuts and multi-selection options;
You can quickly go to the definition of class or method.

Cons

Not open-source;
Large files are slow to load;
Not a complete IDE;
Not free – a big issue for a lot of developers;
The free mode has a lot of annoying notifications.

Conclusion

Choosing the right IDE will have a huge effect on your productivity as a developer. In this article, we have collected the best IDEs that can help you develop with Javascript.

I hope our article will help you choose the right tool for you. Alternatively, feel free to reach out to us.

The post Best IDE for Javascript appeared first on Flatlogic Blog.

Calling the Microsoft Graph API from WinUI

This post is part of the C# Advent Calendar 2021. Be sure to check out all the other great posts there this month!

The Microsoft Graph enables developer to query information from Microsoft 365, including data about users, mail, Teams, OneDrive, notes, and lots more. I’ve been exploring the user and teamwork APIs recently, but in this introduction, we will explore how to authenticate and retrieve some user attributes for the authenticated user account.

We will create a WinUI application with the Windows App SDK, C#, .NET, and the .NET Graph SDK that will authenticate a Microsoft Account and display the name & email address for the current user.

Start by installing the Visual Studio extension for the Windows App SDK to add the project templates added to your IDE. Complete instructions for getting started with the latest SDK can be found here. Next, create a new Blank App, Packaged (WinUI in Desktop) project in Visual Studio. I am using Visual Studio 2022, but 2019 is also supported:

Figure 1 – Creating a new WinUI project

After the project has been created, it’s always a good practice to run it to make sure things are working out of the box. Now we will add the NuGet packages needed to build our WinUI Graph app:

Azure.Identity – Used for interactive MSAL authentication

Microsoft.Extensions.DependencyInjection – Our DI container of choice for this app

Microsoft.Graph – The .NET Graph SDK package

Microsoft.Toolkit.Mvvm – A lightweight, open source MVVM framework

Figure 2 – Installing the Microsoft.Toolkit.Mvvm package

Install the latest stable version of each of these packages and build the project again. We’re going to start building the app by creating a GraphService class and an IGraphService interface with one method, GetMyDetailsAsync().

public interface IGraphService
{
     Task<User> GetMyDetailsAsync();
}

The method will return a Task of Microsoft.Graph.User. We’ll get to the implementation in a moment, but first we will create an Initialize() method that will be called in the constructor. This is where the authentication code is executed.

private readonly string[] _scopes = new[] { “User.Read” };
private const string TenantId = “<your tenant id here>”;
private const string ClientId = “<your client id here>”;
private GraphServiceClient _client;

public GraphService()
{
     Initialize();
}

private void Initialize()
{
     var options = new InteractiveBrowserCredentialOptions
     {
         TenantId = TenantId,
         ClientId = ClientId,
         AuthorityHost = AzureAuthorityHosts.AzurePublicCloud,
         RedirectUri = new Uri(“
http://localhost”),
     };

    var interactiveCredential = new InteractiveBrowserCredential(options);

    _client = new GraphServiceClient(interactiveCredential, _scopes);
}

Using a TenantId in the authentication is only necessary if you want to restrict authentication to a single tenant. To read more about using Azure.Identity and MSAL, check out the docs here. The “User.Read” scope is required to access Graph data for the User object. You can read a complete list of Graph permissions here. The other aspect of using these permissions within your application is that you must have an App Registration in Azure with each required scope granted to the app in the registration. Follow these steps (under Option 2) to add your App Registration to your Azure account in the portal. This is where you will find your ClientId to enter above. Desktop applications will always use “http://localhost” as the RedirectUri.

Now we’re ready to create the implementation to get our User object.

public async Task<User> GetMyDetailsAsync()
{
     try
     {
         var user = await _client.Me.Request().GetAsync();
         return user;
     }
     catch (Exception ex)
     {
         Console.WriteLine($”Error loading user details: {ex}”);
         return null;
     }
}

The code here is straightforward. Using the GraphServiceClient’s fluent API, we’re requesting “Me” to be returned asynchronously. “Me” will always return a User object for the current authenticated user.

Next, create a MainViewModel class, inheriting from ObservableObject in the MVVM Toolkit. This is the ViewModel for the MainWindow that was created as the main window by the WinUI project template. Use this code for MainViewModel.

public class MainViewModel : ObservableObject
{
     private string _userName;
     private string _email;

    public MainViewModel()
     {
         LoadUserDetailsCommand = new AsyncRelayCommand(LoadUserDetails);
     }

    public async Task LoadUserDetails()
     {
         var graphService = Ioc.Default.GetService<IGraphService>();
         var user = await graphService.GetMyDetailsAsync();
         UserName = user.DisplayName;
         Email = user.Mail;
     }

    public string UserName
     {
         get { return _userName; }
         set { SetProperty(ref _userName, value, nameof(UserName)); }
     }

    public string Email
     {
         get { return _email; }
         set { SetProperty(ref _email, value, nameof(Email)); }
     }

    public IAsyncRelayCommand LoadUserDetailsCommand { get; set; }
}

The ViewModel has properties to expose the UserName and Email that will be retrieved from the IGraphService call when LoadUserDetails is called and the service is fetched from the DI container. Now let’s set up the DI container in App.xaml.cs in the constructor after InitializeComponent().

Ioc.Default.ConfigureServices
         (new ServiceCollection()
             .AddSingleton<IGraphService, GraphService>()
             .AddSingleton<MainViewModel>()
             .BuildServiceProvider()
         );

This is registering GraphService and MainViewModel as singletons in the container. Any call to GetService will fetch the same instance. This works for us because we will only have one MainWindow and we only want to authenticate once during the lifetime of the application.

It’s finally time to work on the UI. Start by opening MainWindow.xaml and use the following markup at the root of the Window, replacing the existing controls.

<Grid x:Name=”MainGrid” HorizontalAlignment=”Left” VerticalAlignment=”Center” Margin=”12″>
     <Grid.RowDefinitions>
         <RowDefinition Height=”Auto”/>
         <RowDefinition Height=”Auto”/>
         <RowDefinition Height=”Auto”/>
         <RowDefinition Height=”Auto”/>
         <RowDefinition Height=”*”/>
     </Grid.RowDefinitions>
    
     <TextBlock Text=”User name:” Margin=”4″ Grid.Row=”0″/>
     <TextBox Text=”{Binding Path=UserName}” Width=”200″
              Margin=”4″ Grid.Row=”1″ IsReadOnly=”True”/>
     <TextBlock Text=”Email:” Margin=”4″ Grid.Row=”2″/>
     <TextBox Text=”{Binding Path=Email}” Width=”200″
              Margin=”4″ Grid.Row=”3″ IsReadOnly=”True”/>
     <Button Command=”{Binding Path=LoadUserDetailsCommand}”
             Margin=”4″ Content=”Load Data” HorizontalAlignment=”Right” Grid.Row=”4″/>
</Grid>

We’ve created a parent Grid named MainGrid with five rows, two TextBlock controls and two corresponding TextBoxes, and a Load Data Button. The two TextBox controls have their Text properties bound to the UserName and Email ViewModel properties, and the Button’s Command is bound to the LoadUserDetailsCommand, which calls LoadUserDetails().

Now let’s get the MainViewModel from the DI container in the MainWindow.xaml.cs code behind file and set it as the MainGrid.DataContext. This will complete our data binding for the window.

var viewModel = Ioc.Default.GetService<MainViewModel>();
MainGrid.DataContext = viewModel;

That’s it. You’re ready to run the app. When you click Load Data, you should be prompted to log in to a Microsoft account and accept the scopes required by the app.

 

Figure 3 & 4 – Logging in to access the Graph API

Once the login is complete, you should see your username and email address populated in the text fields. We’ve done it! And notice how the WinUI window and controls pick up your Windows theme and other UI appearance without any extra markup or code required. I’m using the dark theme in Windows 11, and my app is as well.

Figure 5 – Displaying the user info in our app

You can do so much more with the Graph API, using the .NET SDK or the REST APIs. Be sure to explore the docs to see what data you might want to leverage in your own apps. You can also test your API calls with the Microsoft Graph Explorer site. To learn more about WinUI, you can also check out my book from Packt Publishing, Learn WinUI 3.

Get the source code for this WinUI app on GitHub to get started with WinUI and the Graph SDK on your own.

Happy coding and happy holidays!

How to Create an Angular Application Step by Step

Introduction
Things to know about Angular
Angular Pros
Angular Cons
Step-by-step Angular App Creation
How to create a CMS for your Angular App
Conclusions

Introduction

Good day to all of our dear friends and accidental bypassers. The theme of our today’s article is how to create an app with Angular. And, first off, let’s emphasize that Angular is one beast of a TypeScript-based open-source web application framework and it takes place as one of the web-development mainstays that are absolutely justified.

We will take a closer look at the actual process of creating an Angular app to display that this process can be not only pleasant in its outcome but also simple and understandable even for a person with no prior experience in Angular app creation. Let’s get to the first point of our plan, which explains what makes Angular such a brilliant framework.

Things to Know about Angular

Angular is a TypeScript-based open-source framework. Its main purpose is to develop web applications, and, especially, client applications and it is regarded as one of the best technologies when it comes to single-page apps development as well.

Angular community consists of more than 18 million users and that number is simply impressive.

A big part in this is played by tools and setup that Angular possesses: RxJS, Angular CLI and different code editors that support the framework.

RxJS is a reactive programming library that is pretty crucial when it comes to working with Angular. RxJS’ main aim is to handle asynchronous data with multiple events and by doing that this reactive programming library allows engineers to build multiple channels of data exchange to ease the consumption of resources. So, basically, RxJS is similar to a conveyor for JavaScript codes, as it allows parallel and continuing execution of events in a manner, independent from one another, and without waiting for one event to happen to complete another. And although RxJS’ learning curve might seem a bit high, it is worth every penny.

The second great tool in Angular’s arsenal is the Angular command-line interface (or just CLI for short). Favored by many an engineer, Angular CLI is easy to set up, quite understandable even for newcomers, is packed to the brim with different testing tools right out of the box and its commands can be described as nothing but simple. But let’s take a closer look at the pros and cons of Angular.

Angular Pros

1.  Angular architecture is component-based and its primary architectural characteristic is the basis of components hierarchy. This fact allows developers to achieve a higher code quality by making the overall code more accessible and understandable by encapsulating all of the components with their functionality. 

2. All Angular components are reusable. And this advantage is a direct outcome of the previous one because the previously mentioned encapsulation of components makes them exceptionally self-sufficient. It also allows developers to reuse them in different parts of their applications, making the process of developing a bit faster and more convenient. 

3.  Angular’s readability is off the charts. Once again due to the component-based architecture and the encapsulation. Thus, new developers, albeit new to the whole app developing a game or just new to the project, can read code in a better way and reach their plateau of productivity quicker.

4.  Angular is unit-test friendly. Try and guess why it is so. Right you are, all because of the component-based structure that simplifies the quality assurance procedures even when it comes to the smallest parts of the app, which are, of course, units. 

5. Angular is maintainable. It is quite easy to maintain and update the code.

6. Angular uses TypeScript. Let us get a little misconception out of the way first – it is not mandatory to use TypeScript with Angular, as it provides devs with options on how to use their libraries more efficiently, including Redux and Flux. But why use them if you can use TypeScript, which can be described as a superset for JavaScript? Yes, it has its fair share of things to nitpick and yes, you basically have to learn another language if you never worked with TypeScript, but its overall usefulness is immense. Especially if you work on an enterprise-level project, as TypeScript simply has better navigation, autocompletion, refactoring services and it helps you to spot and get rid of common mistakes while you type in the code. All in all, TypeScript is great and Angular is only better because of it.

7.  Angular has long-term Google support. Also known simply as LTS, Google’s Long-Term Support means that Google is planning to stick with and further develop the Angular ecosystem.

Angular Cons

The main disadvantage of Angular is the fact that Angular is complex. Although the component-based architecture Angular possesses is great, the way in which components are managed is not, as each and every component in your app will, most likely, need dependency injections and all of them will definitely need lifecycle interfaces. And that’s not mentioning the fact that you will have to rely on third-party libraries that are quite specific when it comes to Angular. Thus, developing apps on Angular can be (bear in mind that it is a possibility and not an axiom) pretty repetitive and tiresome.

The second disadvantage worth mentioning mainly concerns new and up-and-coming developers and it is the fact that Angular’s learning curve is steep. As we have already mentioned, if you were to learn Angular from scratch, you will also need to learn TypeScript, modules, dependency injection, components, services, templates, RxJS management, etc.

Summing up, even though it can be fearsome for new developers and at times complicated for new and professional developers alike, Angular is a great tool for a variety of web app development needs and, with Google’s Long-Term Support, its future in the industry looks as bright as ever. That being said, let’s get to the metaphorical cherry on top of the cake of today’s article – an example of step-by-step Angular app development.

Step-by-step Angular App Creation

In this tutorial, we are going to create a simple Angular App on an Angular 8 basis in eleven easy steps. The steps are:

1. Angular CLI 8 installation;

2. Angular 8 Project creation;

3. Addition of Angular HttpClient;

4. UI Component Creation;

5. Routing Addition;

6.  UI Building with the help of Angular Material Components;

7.  Mocking a REST API;

8.  Consuming the REST API with Angular HttpClient;

9.  HTTP Errors Handling;

10. Pagination Addition;

11. Building and Deploying the Angular Application to Firebase.

Now, let’s get through these steps one by one.

1. Angular CLI 8 installation

The first thing we will have to do to create an Angular App is to get our Angular CLI up to speed. And that step is crucial, as Angular CLI is the official tool for Angular projects’ initializing and working. Write the following line of code into a new terminal that we have just created:

npm install -g @angular/cli

2. Angular 8 Project creation

Now we can initialize our Angular project. Use the following commands:

cd ~

ng new angular-example

Then CLI will send you a prompt, asking whether you’d like the addition of Angular routing. And that is just too good of an offer to decline. Right after that, the CLI will ask you which stylesheet format you would like to use and here we are going to choose the CSS option.

That decision will lead Angular to generate the files and folders required, as well as install the needed packages from npm. But that’s not all, as it will also set up the routing we have mentioned earlier automatically.

After that, we are going to go to the root folder of our project and run the local development server using these commands:

cd angular-example

ng serve

That will make our application available at the following address:

[http://localhost:4200/](http://localhost:4200/)

What we need to do is to go to this address using a web browsing of our choosing and see a beautiful, yet utterly incomplete page like this:

3. Addition of Angular HttpClient

This step is pretty easy in execution despite being command-heavy at first sight. What we need to do here is to open the src/app/app.module.ts file and make the following changes:

import { BrowserModule } from ‘@angular/platform-browser’;
import { NgModule } from ‘@angular/core’;
import { AppRoutingModule } from ‘./app-routing.module’;
import { AppComponent } from ‘./app.component’;
import { HttpClientModule } from ‘@angular/common/http’;
@NgModule({
declarations: [
AppComponent,
],
imports: [
BrowserModule,
AppRoutingModule,
HttpClientModule
],
providers: [],
bootstrap: [AppComponent]
})
export class AppModule { }

What we did here is a simple act of importing the HttpClientModule and including it into the import array. This step is needed to assure the consumption of the REST API by the HttpClient.

4. UI Component Creation

As we have already mentioned, Angular Apps are made up of components. So, to do it, we open yet another new terminal and use the following line of coding:

cd ~/angular-example

ng g component home

And running these commands will display the following output in our terminal:

CREATE src/app/home/home.component.html (19 bytes)
CREATE src/app/home/home.component.spec.ts (614 bytes)
CREATE src/app/home/home.component.ts (261 bytes)
CREATE src/app/home/home.component.css (0 bytes)
UPDATE src/app/app.module.ts (467 bytes)

And that leads us to the creation of the about component by running the following command:

ng g component about

And that leads us to the src/app/about/about.component.html file and adding the following:

<p style=”padding: 15px;”> This is the about page that describes your app</p>

Voila! We have just created a component, aren’t we just great? Now we can get to step number 5.

5. Routing Addition

Once again, a codding-heavy step, by a crucial one at that it will help us redirect the empty path to the home component. This, in order, will automatically redirect the first-time users of our app to its home page.

So, what we do here is running the following set of routes into our src/app/app-routing.module.ts file:

import { NgModule } from ‘@angular/core’;
import { Routes, RouterModule } from ‘@angular/router’;
import { HomeComponent } from ‘./home/home.component’;
import { AboutComponent } from ‘./about/about.component’;
const routes: Routes = [
{ path: ”, redirectTo: ‘home’, pathMatch: ‘full’},
{ path: ‘home’, component: HomeComponent },
{ path: ‘about’, component: AboutComponent },
];
@NgModule({
imports: [RouterModule.forRoot(routes)],
exports: [RouterModule]
})
export class AppRoutingModule { }

6. UI Building with the help of Angular Material Components

Let’s start by going to the root file of our project and adding the following line of coding:

ng add @angular/material

After that, Angular will suggest you choose a theme for the project. And, as we feel playful, let’s choose the Indigo/Pink option. That will not be the end of it and the prompt will also ask us whether we would like to set up HammerJS for gesture recognition, as well as browser animations for Angular Material. Here we are going to simply press Enter and be on our merry way, as after that we will need to open the src/app/app.module.ts file and add the following imports:

import { MatToolbarModule

MatIconModule

MatCardModule

MatButtonModule

MatProgressSpinnerModule } from ‘@angular/material’;

What we are doing by this is importing the modules for the following Material Design components:

1. MatToolbar – for headers, titles, or actions containers;

2. MatCard – in order to provide a content container for text, photos, and actions in the context of a single subject;

3. MatButton – for a native <button> or <a> element that is enhanced with styling and ink ripples of Material Design;

4. MatProgressSpinner – in order to provide a progress and activity circular indicator.

And after the modules are imported, we can add those modules into the import array by running the following lines of code:

@NgModule({
declarations: [
AppComponent,
HomeComponent,
AboutComponent
],
imports: [
BrowserModule,
AppRoutingModule,
HttpClientModule,
BrowserAnimationsModule,
MatToolbarModule,
MatIconModule,
MatButtonModule,
MatCardModule,
MatProgressSpinnerModule
],
providers: [],
bootstrap: [AppComponent]
})
export class AppModule { }

Now, we are going to open the src/app/app.component.html file and update it with the following code lines:

<mat-toolbar color=”primary”>
<h1>
My Angular Store
</h1>
<button mat-button routerLink=”/”>Home</button>
<button mat-button routerLink=”/about”>About</button></mat-toolbar><router-outlet></router-outlet>

This way we have added a top navigation bar with two buttons that can take our app user to the Home and About pages of our project.

7. Mocking a REST API

This step is packed with different small substeps we will have to undertake. But fear not, as they all are simple and you won’t actually spend a lot of time to complete them, although you will have to be pretty precise about your actions.

We start this step by going to a new command-line interface and installing json-server from the npm. We do this with the help of the following command:

cd ~/angular-example

npm install –save json-server

And now we need to create a server folder in our Angular project’s root folder by writing these lines:

mkdir server

cd server

Don’t leave the server folder just yet, as we still need to create a database.json file and add the following JSON object that will act as a database for our REST API server:

{

“products”: []

}

Now we need to go back to the command-line and navigate back from the server folder to install Faker.js from our npm by the following command:

cd ..

npm install faker –save

Create the generate.js file with the following coding lines:

var faker = require(‘faker’);
var database = { products: []};
for (var i = 1; i<= 300; i++) {
database.products.push({
id: i,
name: faker.commerce.productName(),
description: faker.lorem.sentences(),
price: faker.commerce.price(),
imageUrl: “https://source.unsplash.com/1600×900/?product”,
quantity: faker.random.number()
});
}
console.log(JSON.stringify(database));

After that, add the generate and server scripts we have created into the package.json file by including the following lines into our code:

“scripts”: {
“ng”: “ng”,
“start”: “ng serve”,
“build”: “ng build”,
“test”: “ng test”,
“lint”: “ng lint”,
“e2e”: “ng e2e”,
“generate”: “node ./server/generate.js > ./server/database.json”,
“server”: “json-server –watch ./server/database.json”
},

Next, we will go back to the command-line interface and run the generate script by using the following command:

npm run generate

And after that we are to run our freshly baked REST API by executing the command that goes like this:

npm run server

This action will allow us to send HTTP requests with the following API endpoints:

·   GET /products  for products getting;

·   GET /products/<id>  for single product getting by id;

·   POST /products  for new product creation;

·   PUT /products/<id>  for product updating by id;

·   PATCH /products/<id>  for partial product updating by id;·   DELETE /products/<id>  for product deletion by id.

8. Consuming the REST API with Angular HttpClient

Now we need to make Angular consume our REST API using HttpClient. And we start this process by creating an Angular service that will encapsulate the code, which, in turn, will allow us to consume data from our REST API server. Check our terminal and write in the following command:

ng g service api

After that what we need to do is to go to the src/app/api.service.ts file in order to import and inject HttpClient. This will be achieved by doing the subsequent actions:

import { Injectable } from ‘@angular/core’;

import { HttpClient } from ‘@angular/common/http’;
@Injectable({
providedIn: ‘root’
})
export class ApiService {
private SERVER_URL = “http://localhost:3000”;
constructor(private httpClient: HttpClient) { }
}

Now we need to define a get() method, which will send GET requests to our REST API endpoints:

import { Injectable } from ‘@angular/core’;
import { HttpClient } from ‘@angular/common/http’;
@Injectable({
providedIn: ‘root’
})
export class ApiService {
private SERVER_URL = “http://localhost:3000”;
constructor(private httpClient: HttpClient) { }
public get(){
return this.httpClient.get(this.SERVER_URL);
}
}

At this point, we defined a product’s variable and called the get() method of the service to fetch data from the JSON REST API server. Now what we need to do is to open the src/app/home/home.component.html file to update it as you will see below:

<div style=”padding: 13px;”>
<mat-spinner *ngIf=”products.length === 0″></mat-spinner>
<mat-card *ngFor=”let product of products” style=”margin-top:10px;”>
<mat-card-header>
<mat-card-title>{{product.name}}</mat-card-title>
<mat-card-subtitle>{{product.price}} $/ {{product.quantity}}
</mat-card-subtitle>
</mat-card-header>
<mat-card-content>
<p>
{{product.description}}
</p>
<img style=”height:100%; width: 100%;” src=”{{ product.imageUrl }}” />
</mat-card-content>
<mat-card-actions>
<button mat-button> Buy product</button>
</mat-card-actions>
</mat-card>
</div>

Now we can proceed with step number nine.

9. HTTP Errors Handling

Start this step by going to the src/app/api.service.ts file and updating it as follows:

import { Injectable } from ‘@angular/core’;
import { HttpClient, HttpErrorResponse } from “@angular/common/http”;
import { throwError } from ‘rxjs’;
import { retry, catchError } from ‘rxjs/operators’;
@Injectable({
providedIn: ‘root’
})
export class ApiService {
private SERVER_URL = “http://localhost:3000/products”;
constructor(private httpClient: HttpClient) { }
handleError(error: HttpErrorResponse) {
let errorMessage = ‘Unknown error!’;
if (error.error instanceof ErrorEvent) {
// Client-side errors
errorMessage = `Error: ${error.error.message}`;
} else {
// Server-side errors
errorMessage = `Error Code: ${error.status}nMessage: ${error.message}`;
}
window.alert(errorMessage);
return throwError(errorMessage);
}
public sendGetRequest(){
return this.httpClient.get(this.SERVER_URL).pipe(catchError(this.handleError));
}
}

And now we will be able to see the errors in our browser console:

This nice and easy step allows us to get down to the penultimate, tenth, step of our Angular App creation journey.

10. Pagination Addition

What we do in this step is adding the data pagination support by using the Link header of the HTTP response, which is going to be received from the REST API server. This means that we will need to instruct HttpClient to give us the full HttpResponse, instead of providing us with the response body. Use the observe option.

Start by opening the src/app/data.service.ts file and importing the RxJS  tap() operator with the following command:

import { retry, catchError, tap } from ‘rxjs/operators’;

After that, add the following variables:

public first: string = “”; 

public prev: string = “”; 

public next: string = “”; 

public last: string = “”;

Now we are set to add the parseLinkHeader() method in order to parse the Link header and populate the variables we have added in the previous substep:

parseLinkHeader(header) {

if (header.length == 0) {

return ;

}

if (header.length == 0) {
return ;
}
let parts = header.split(‘,’);
var links = {};
parts.forEach( p => {
let section = p.split(‘;’);
var url = section[0].replace(/<(.*)>/, ‘$1’).trim();
var name = section[1].replace(/rel=”(.*)”/, ‘$1’).trim();
links[name] = url;
});
this.first = links[“first”];
this.last = links[“last”];
this.prev = links[“prev”];
this.next = links[“next”];
}

And that, in turn, allows us to safely update the sendGetRequest() with the following lines of coding:

public sendGetRequest(){

// Add safe, URL encoded _page and _limit parameters

return this.httpClient.get(this.SERVER_URL, { params: new HttpParams({fromString: “_page=1&_limit=20”}), observe: “response”}).pipe(retry(3), catchError(this.handleError), tap(res => {
console.log(res.headers.get(‘Link’));
this.parseLinkHeader(res.headers.get(‘Link’));
}));
}

One pulls the other, so we can now update the home component of our app. To do that, open the src/app/home/home.component.ts file to import HttpResponse:

import { HttpResponse } from ‘@angular/common/http’;

And now we can update the subscribe() method as follows:

ngOnInit(){

this.apiService.sendGetRequest().pipe(takeUntil(this.destroy$)).subscribe((res: HttpResponse<any>)=>{
console.log(res);
this.products = res.body;
})
}

Go back to the src/app/data.service.ts file to add the following method, which is quite similar to sendGetRequest() with a simple twist of it taking the URL to which we need to send an HTTP GET request:

public sendGetRequestToUrl(url: string){
return this.httpClient.get(url, { observe: “response”}).pipe(retry(3),
catchError(this.handleError), tap(res => {
console.log(res.headers.get(‘Link’));
this.parseLinkHeader(res.headers.get(‘Link’));
}));
}

After that we can go back to the src/app/home/home.component.ts file to define the following method:

public firstPage() {
this.products = [];
this.apiService.sendGetRequestToUrl(this.apiService.first).pipe(takeUntil(this.destroy$)).subscribe((res: HttpResponse<any>) => {
console.log(res);
this.products = res.body;
})
}
public previousPage() {
if (this.apiService.prev !== undefined && this.apiService.prev !== ”) {
this.products = [];
this.apiService.sendGetRequestToUrl(this.apiService.prev).pipe(takeUntil(this.destroy$)).subscribe((res: HttpResponse<any>) => {
console.log(res);
this.products = res.body;
})
}
}
public nextPage() {
if (this.apiService.next !== undefined && this.apiService.next !== ”) {
this.products = [];
this.apiService.sendGetRequestToUrl(this.apiService.next).pipe(takeUntil(this.destroy$)).subscribe((res: HttpResponse<any>) => {
console.log(res);
this.products = res.body;
})
}
}
public lastPage() {
this.products = [];
this.apiService.sendGetRequestToUrl(this.apiService.last).pipe(takeUntil(this.destroy$)).subscribe((res: HttpResponse<any>) => {
console.log(res);
this.products = res.body;
})
}

And now, to finalize the tenth step we will need to open the src/app/home/home.component.html file to update the template:

<div style=”padding: 13px;”>
<mat-spinner *ngIf=”products.length === 0″></mat-spinner>
<mat-card *ngFor=”let product of products” style=”margin-top:10px;”>
<mat-card-header>
<mat-card-title>#{{product.id}} {{product.name}}</mat-card-title>
<mat-card-subtitle>{{product.price}} $/ {{product.quantity}}
</mat-card-subtitle>
</mat-card-header>
<mat-card-content>
<p>
{{product.description}}
</p>
<img style=”height:100%; width: 100%;” src=”{{ product.imageUrl }}” />
</mat-card-content>
<mat-card-actions>
<button mat-button> Buy product</button>
</mat-card-actions>
</mat-card>
</div>
<div>
<button (click) =”firstPage()” mat-button> First</button>
<button (click) =”previousPage()” mat-button> Previous</button>
<button (click) =”nextPage()” mat-button> Next</button>
<button (click) =”lastPage()” mat-button> Last</button>
</div>

Here we are, at the gate of the final, eleventh, step of our journey.

11.  Building and Deploying the Angular Application to Firebase

Head back to the CLI. What you need is the root folder of the project, as you will need to run the following command there in order to add the Firebase deployment capability to our project:

ng add @angular/fire

The CLI will prompt you to paste in the authorization code. In order to paste it in you will need to sign into the Google account, associated with your Firebase account, where you will find the authorization code. After that is done, the CLI will prompt you to select a project, which you do. And after that, the command-line interface will create the firebase.json and .firebaserc files and update the angular.json file accordingly.

At this point, we are ready to deploy the application to Firebase by using the following command:

ng deploy

And now, our production is an asset to Firebase hosting, which also concludes the creation of our Angular App altogether, meaning that we have at our hands a crisp new app ready for usage. But each and every app needs one crucial thing – its own CMS.

How to Create a CMS for Your Angular App

The secret to creating a CMS for your Angular App faster is in using Flatlogic Platform. There are 5 short steps to build your CMS, each taking less than a minute.

1. Choose a name for your project

This one is pretty self-explanatory.

2. Choose your project’s stack

The secret to creating an Angular CMS is actually choosing it as a frontend option.

3. Choose a design for your CMS

There are five beautiful ready-made designs to pick the one you like the most.

4. Choose/create a schema editor for your CMS 

There are also a couple of ready-made schemas for you. Or just create a brand-new schema from scratch.

5. Review & generate your CMS

This one is just a measure of assurance, as all you have to do is just review your choices and press the «Create Project» button.

Conclusion

As you can see, the process of creating an Angular application is quite fascinating with all the different little things you have to keep in mind. Angular’s place among the leaders of frontend frameworks is more than deserved. Have a nice day and read up on more of our articles!

The post How to Create an Angular Application Step by Step appeared first on Flatlogic Blog.

347: Using Notion

Rachel and Chris dig into the many, many ways in which we use Notion at CodePen. Heads up, Notion has sponsored a couple of episodes of CodePen Radio lately, but not this. It’s just a tool we heavily use and this podcast is all about that sort of thing. Heck, this podcast itself was planned in a calendar database on Notion, which deals with dates, publication status, sponsors, and all sorts of stuff. And it’s probably one of the least involved Notion setups we have. Much more involved is stuff like project planning and our individual structures for our company-public weeknotes.

Time Jumps

00:28 Topic introduction

01:21 Tools we’re using for CodePen

04:51 Getting buy in from the team

07:57 What is Notion?

10:55 Multiple views of the same data

13:58 What does CodePen actually use Notion for?

20:04 Sponsor: Jetpack Backups

21:27 Second brain storage

23:44 Roles and permissions in Notion

31:14 Other features of Notion

36:37 Fav Notion recent feature

Sponsor: Jetpack Backups

The big news from Jetpack is that all backups are realtime now. Realtime backups are awesome. Anything that happens on your site, it’s backed up immediately. That makes backups extremely useful as there is no risk you have to miss three-quarters of a day of content, purchase, comments or anything else because all you have is daily backups.

The post 347: Using Notion appeared first on CodePen Blog.

After all is said and done, more is said than done

[tie_index]Design & build quality[/tie_index]

[padding top=”0″ bottom=”0″ right=”5%” left=”5%”]

Apple Watch review: Design

For a slightly more opinionated version of the video review above, here’s the male half of the Macworld team arguing (after four months with this device) about whether the Apple Watch is a great or a terrible product:

The Apple Watch is beautifully designed and engineered, with a great look and feel. It’s chunky, rounded body is faintly reminiscent of the original iPhone, yet simultaneously modern-looking and very satisfying to hold. The Apple Watch is also pleasingly comfortable on the wrist.

We’ve seen lots of fitness trackers over the years, and they’ve typically struck us as pretty formulaic: plasticky wristbands with little fashion appeal. One activity tracker brand tried to convince us that their activity tracker was designed to appeal to a fashion-conscious woman; they even thought that women would wear it around their neck like a necklace. But at the end of the day, it wasn’t jewellery. None of the fitness trackers on the market are.

It’s a similar story with smartwatches. Sure, over the past year they’ve become more and more popular with guys looking for the latest tech gadget, but they don’t appeal to everyone. One major issue is that most smartwatches are designed for men. They wouldn’t sit comfortably on a smaller wrist.

[tie_index]Dimensions[/tie_index]

Apple Watch review: Dimensions

There are two sizes of watch: the 38mm model (which actually measures 38.6 by 33.3 mm) and the 42mm model (which measures 42 by 35.9 mm). Both have a thickness of 10.5mm.

[tie_list type=”checklist”]

38mm model: 38.6 x 33.3 x 10.5mm
42mm model: 42.0 x 35.9 x 10.5mm

[/tie_list]

Here’s how a 38mm Apple Watch looks on Karen’s wrist:

[/padding]

[tie_full_img][/tie_full_img]

[tie_index]Build quality[/tie_index]

[padding top=”0″ bottom=”0″ right=”5%” left=”5%”]

Apple Watch review: Build quality

Speaking of the materials the watch is made from, there are three options: aluminium for the Watch Sport, stainless steel for the Watch, and 18-carat gold for the Watch Edition. The Watch and Watch Edition come with sapphire screens, the Sport version with ion-x glass.

[/padding]

We love the look and feel of the Apple Watch. As we mentioned above, it looks a bit like a shrunk-down version of the original iPhone, and it’s reassuringly robust – after almost a year with the Watch, there no scratches on the body or screen, although the brighter of our two Sport Band straps is starting to look a bit grubby.

Apple doesn’t recommend dunking your Apple Watch first-gen in water. While the watch is rated as water-resistant to the IPX7 standard, which should mean it will survive in water up to a depth of 1 metre for up to 30 minutes, Apple describes it as “splash- and water-resistant but not waterproof”. So it’s ok to use it in the shower – as Apple’s CEO Tim Cook apparently does – but it’s not to be taken swimming.

[padding top=”0″ bottom=”0″ right=”5%” left=”5%”]Having said that, plenty of reckless reviewers have done exactly that, and we’ve yet to hear anyone complain that their watch was damaged by the experience. We don’t recommend taking the risk, and you obviously won’t have a leg to stand on with Apple if something does go wrong since they’ve been careful to only claim it’s water-resistant. But it appears that yes, the Apple Watch is waterproof.[/padding]

[tie_index]Straps[/tie_index]

[padding top=”0″ bottom=”0″ right=”5%” left=”5%”]

Apple Watch review: Straps

While we’re on the subject of straps, which one should you pick to go with your beautiful Apple Watch?

[/padding]

[padding top=”0″ bottom=”0″ right=”5%” left=”5%”]There are a wide collection of straps to choose from, including: Link Bracelet, Sport Band, Leather Loop, Classic Buckle, Modern Buckle, Milanese Loop and more recently, Nylon band and Hermes straps.

The Leather Loop, Classic Buckle, Leather Loop, Modern Buckle

The Leather Loop, Classic Buckle, Leather Loop, Modern Buckle, Woven Nylon and Sport Band options are offered in multiple colour choices while the Milanese Loop and Link Bracelet are only available in two colours. The Sport Band comes in 22 different colours including black, white, pink, yellow, blue, grey, lime green, lavender, antique white, stone and midnight blue, for example.

[/padding]

[tie_index]Screen[/tie_index]

[padding top=”0″ bottom=”0″ right=”5%” left=”5%”]

Apple Watch review: Screen

While doing our best to extend the watch’s battery life, we wanted to force-quit some apps and found the method of doing so deeply counterintuitive.

Returning to the screen, the resolution depends on the watch you choose. The resolution of the screen on the 38mm Apple Watch (which measures 1.32 inches diagonally) is 272×340 while the 42mm model offers 312×390 on a screen that measures 1.5 inches. Both models, therefore, offer a pixel density of 326 pixels per inch, or ppi.

In both cases, the Apple Watch screen is officially rated (or perhaps we should say branded) as Retina-quality, and our subjective experience with it has been great. It’s sharp and vividly colourful and we’ve yet to notice any pixellation.

The touchscreen aspects work terrifically too: it’s highly responsive, and we found we tend to fall back on old habits, swiping through screens whenever possible by using the touchscreen even if a scrolling option is available via the Digital Crown. It ought to be as easy to quit apps and glances as it is on the iPhone – but it isn’t. To quit an app you have to press and hold the side button, and then do the same again. Nobody is going to stumble on that by accident.

[/padding]

[tie_index]User interface[/tie_index]

Apple Watch review: User interface

[tie_full_img][/tie_full_img]

[padding top=”0″ bottom=”0″ right=”5%” left=”5%”]

Apple’s design expertise is only a small part of what makes the Apple Watch stand out. Another factor in its favour is the user interface. The problem many current smartwatches have is that the UI is packed onto a tiny display and you need to manipulate those tiny visual elements using your fingers, which are inevitably bigger than the elements you’re trying to touch.

Below we examine Apple’s method for controlling the user interface, and the software you can expect to see on the Apple Watch.

[/padding]

[tie_index]Using screen[/tie_index]

[padding top=”0″ bottom=”0″ right=”5%” left=”5%”]

Apple Watch review: Using the Apple Watch screen

One way to use the Watch is via the screen. You can scroll around the screen, tap on items to select them or press harder to get more options – akin to using right click on a mouse. Various gestures bring up other elements of the operating system. For example, Glances are accessed by swiping up on the watch face.

[/padding]

[tie_full_img][/tie_full_img]

[padding top=”0″ bottom=”0″ right=”5%” left=”5%”]

There’s also Apple’s Force Touch technology that determines how hard you are pressing the Watch and will act accordingly. There is a difference between a hard press and a simple tap. (We discuss Force Touch in more detail below.)

[/padding]

[tie_index]Performance[/tie_index]

[padding top=”0″ bottom=”0″ right=”5%” left=”5%”]

Apple Watch review: Speed/performance

One possible weakness of the Apple Watch – depending on how demanding your standards are when it comes to wearable tech – could be its all-around speed. Numerous reviewers have found the interface sluggish in use and noticed a delay before certain actions.[/padding]

Update 8 September 2016: It should be noted that the below section is based on the original watch and not the Series 1 or 2 which feature a 50 percent faster processor.

As with many aspects of this product, experiences have varied among the team, and it’s likely that day-to-day performance is influenced by factors such as apps and Glances currently running. It’s rare to find an app that’s near-instantaneous to respond, as they’ll open quickly but will often hang, leaving us staring at a black loading screen; and syncing processes with the iPhone, over a Bluetooth connection, can be sluggish.

[padding top=”0″ bottom=”0″ right=”5%” left=”5%”]

We’ve also found, as have many users, that third-party apps can sometimes be slow to start up. watchOS 2 looked to speed up third-party apps by allowing them to run natively on the Apple watch, but as we mention in our watchOS 2 section of the review below, we still find apps pretty sluggish and we often give up and end up using our iPhone apps instead.

[/padding]

[tie_index]Digital Crown[/tie_index]

Apple Watch review: Using the Digital Crown

Apple’s solution to the navigation problem is to use something that has always been a feature of watches in a new way.

The dial on the side of the watch – its proper name is the crown – has been brought into the 21st century and turned into what Apple calls the Digital Crown. This Digital Crown solves the problem of swiping through icons on a minuscule display.

[padding top=”0″ bottom=”0″ right=”5%” left=”5%”]

Below the Digital Crown is another button. This button takes you to the home screen and to the Friends app, from which you can contact your friends (more on that below). This button is also used when you’re paying for things using Apple Pay (more on that below, also).

[tie_index]Battery life[/tie_index]

Apple Watch review: Battery life

Apple claims that on a typical day, with typical usage, you should get 18 hours of battery life from the Apple Watch. In other words, you ought to be able to get through a whole day, but that will be about it: expect to charge it every night. (Which, incidentally, rules out being able to sleep with the watch on – which is likely to be a disappointment to developers of sleep-related apps.)

In fact, your use may vary. Apple’s ‘typical day’ included a half-hour workout, but if you exercise more than that you may use up the battery quicker – in Apple’s tests, the battery lasted 6.5 hours during a workout (so you should at least be able to run that marathon without running out of battery). If you use the Apple Watch to play music you will also find that to be a bit of a battery hog. Apple got 6.5 hours of audio playback out of the test device before it ran out of power.

[/padding]

[tie_index]Pricing and availability[/tie_index]

Apple Watch review: Apple Watch UK price

Pricing varies depending on the watch and strap you choose. For more information about Watch prices, read our Apple Watch buying advice.

The Apple Watch price starts at £259 in the UK; that’s for the 38mm Apple Watch Sport with a plastic band, and £299 for the 42mm version. The stainless steel Apple Watch starts at £479 and the newer Apple Watch Hermes starts at £1000, while the 18-carat gold Apple Watch Edition starts at an eye-watering £8,000.

OUR VERDICT

The Apple Watch isn’t the first ever smartwatch, and it doesn’t really do anything rival products don’t do. But what it does do, it does as well as any smartwatch out there, thanks to Apple’s user interface expertise. It’s a slick device to use, although you should be warned that it isn’t completely intuitive, particularly at first. With use it will become more familiar and user-friendly.

The post After all is said and done, more is said than done appeared first on PHPFOREVER.