JavaScript on your schedule

#​633 — April 6, 2023

Read on the Web

❓ JavaScript Weekly on a Thursday? It’s true. As well as it being Good Friday tomorrow, we’ve decided to move to Thursday permanently going forward. We hope you have a good Easter, if you celebrate it, otherwise enjoy one fewer email on Fridays ????
__
Your editor, Peter Cooper

JavaScript Weekly

Croner: Cron for JavaScript and TypeScript — Trigger functions upon the schedule of your choice using the classic cron syntax. Works in Node, Deno, Bun and the browser, across time zones, offers error handling and overrun protection, and more. There’s an interesting live demo on JSFiddle.

Hexagon

▶️ JSON vs XML with Douglas Crockford — The author of 2008’s hugely popular JavaScript: The Good Parts went on a podcast to share the story of JSON, his discovery of JavaScript’s ‘good parts’, and his general approach to building software, including his dislike of JavaScript ‘frameworks.’ There’s a transcript if you’re not keen on listening. (50 minutes.)

CoRecursive Podcast podcast

Headless CMS with World-Class TypeScript Support — Kontent.ai is the leading platform for modular content. Streamline your code using TypeScript SDK, CLI, Rich text resolver, and strongly typed model generator. Scale with no problems when your project grows. Have you seen our UI?

Kontent.ai sponsor

The Angular Signals RFC — There’s a lot of excitement about a shift in Angular involving the addition of signals as a reactive primitive – the official RFC is now available for this feature, and you’re encouraged to leave comments. If you’d rather see a practical use for signals, Joshua Morony recorded ▶️ a screencast showing them off.

Angular Team

Over 100 Algorithms and Data Structures Demonstrated in JS — Examples of many common algorithms (e.g. bit manipulation, Pascal’s triangle, Hamming distance) and data structures (e.g. linked lists, tries, graphs) with explanations.

Oleksii Trekhleb et al.

IN BRIEF:

Laurie Voss looks at the most popular frameworks used in sites deployed to Netlify. React-based options lead the way.

Oliver Dunk of the Chrome Extensions Team has posted an update on the Manifest V2 to Manifest V3 transition – it’s taking longer than expected so Manifest V2 isn’t disappearing any time soon.

V8 v11.2 is shipping with support for WebAssembly tail calls.

With Chrome 113, Chrome is now shipping support for WebGPU.

A look at how Microsoft’s Blazor (a stack aimed at building front-end apps with C#) is skirting around JavaScript with its focus on WebAssembly.

JSDayIE 2023: The First JavaScript Conference in Ireland Is Back! — Join us on September 26th in Dublin to experience everything the Irish JavaScript community and Ireland have to offer.

JSDayIE sponsor

RELEASES:

Electron 24.0 – Complete with Chromium 112, V8 11.2, and Node 18.14.

Storybook 7.0 – Though still tagged ‘next’ and pending a proper launch.

Storybook for React Native 6.5

WebStorm 2023.1 – Commercial JS IDE from JetBrains.

Rete.js 2.0 Beta – Framework for building node-based editors.

???? Articles & Tutorials

Making a Big, Slow Vue/Alpine Page ‘Blazingly’ Fast — A practical example of a pattern the author is billing a “reactive switchboard.” “I’m going to use Vue/Alpine lingo in this article, but I think this pattern applies to lots of different tools.”

Caleb Porzio

▶  Watch Dan Abramov Explore React Server Components — At an epic (though well timestamped) four hours, this isn’t a quick watch, but Dan and Ben Holmes walk through everything React Server Components oriented, complete with diagrams, code, and a real-world app.

Ben Holmes

Getting PWAs in App Stores with PWABuilder — Thomas Steiner demonstrates how PWABuilder makes it possible to submit Progressive Web Apps (PWAs) to app stores like those provided by Google, Apple, and Microsoft.

Thomas Steiner (Google)

Add a Full-Featured Notification Center to Your App in Minutes

Courier.com sponsor

What Are Source Maps? — Learn how source maps can help you debug your original code instead of what was actually deployed after the build process.

Sofia Emelianova (Chrome Developers)

How I Used ChatGPT in My JavaScript Projects

James Q Quick

???? Code & Tools

Relaunching JSPM CLI for Import Map Package Management — Several years ago when JS had numerous competing module formats, JSPM was a useful package manager atop SystemJS, but now it’s being relaunched as an import map package management tool.

Guy Bedford

Chrome Extension CLI 1.4: CLI for Building Chrome Extensions — Want to get building an extension for Chrome as quickly as possible? This Node-powered tool aims to get you on the right path ASAP. v1.4 adds a script to generate a ZIP file (also known as a ‘postcode file’ at Microsoft UK? ????) of the extension.

Dutiyesh Salunkhe

React Chrono 2: A Flexible Timeline Component — A complete overhaul of a popular component. You can render themeable timelines in vertical, horizontal, or vertical alternating orientations. It includes keyboard navigation support, auto advancement, and, as of v2, support for nested timelines.

Prabhu Murthy

Dynaboard: A Visual Web App IDE Made for Developers — Build high performance public and private web applications in a collaborative — full-stack — development environment.

Dynaboard sponsor

Jampack: A Post-Processing Tool to Optimize Static Websites — Similar to a bundler or build tool, with features like image optimization, asset compression, and some code auto-fixes — all amounting to strong Core Web Vitals scores.

divRIOTS

imask.js 6.5.0: A Vanilla JavaScript Input Mask — Prevent users from entering invalid values. Has plugins for Vue, Angular, React, Svelte, and Solid, if needed.

imaskjs

tween.js 19.0
↳ JS tweening engine for easy animations.

Swiper 9.2
↳ Modern mobile-friendly touch slider.

gridstack.js 7.3
↳ Dashboard layout and creation framework.

ReacType 15.0
↳ Visual prototyping tool that can export React apps.

xstyled 3.8
↳ Utility-first CSS-in-JS framework for React.

Spacetime 7.4.2
↳ Lightweight timezone library.

???? Jobs

Find JavaScript Jobs with Hired — Hired makes job hunting easy-instead of chasing recruiters, companies approach you with salary details up front. Create a free profile now.

Hired

Full Stack JavaScript Engineer @ Emerging Cybersecurity Startup — Small team/big results. Fun + flexible + always interesting. Come build our award-winning, all-in-one cybersecurity platform.

Defendify

????‍???? Got a job listing to share? Here’s how.

???? Wise Words of the Week

A reminder from Vue.js’s Evan You that we live in a vast and varied world, including in the JavaScript ecosystem:

Flatlogic Admin Templates banner

How to Improve Developer Productivity? [Guide]

You work as a developer or software engineer and sometimes you feel tired, procrastinating and not satisfied with your effectiveness at work. It is a common thing for many developers because web-development is hard work that requires a lot of concentration and brain tension. 

In this article we are going to discuss 10 recommendations on how to make the development work more efficient and how to improve developer productivity!

But first, let’s clear up what productivity means?

What is Productivity? How Can it be Measured?

Productivity means that you get more work done with the same resources or during the same period of time. Different companies can use different tools and metrics to measure developer productivity. Usually it is based on how many lines of code, features, or tasks a developer could do. For example, you can use as metrics quantity of lines of code, code reviews, bugs fixed, number of commits, finished tasks, or number of deployments or releases. You should also keep in mind that measuring developer performance requires more transparency in products and processes. The way of measuring what your manager or company chooses can depend on objectives, business goals, size and structure of the company and so on. It can also be team or individual measuring. But anyway, the main idea is to improve these metrics by improving developer productivity.

How can we describe modern IT developers?

Also, before we start discussing recommendations on how to improve developer productivity, we would like to define the audience. 

Ten or fifteen years ago, when we discussed developers or software engineers, we would have imagined socially awkward, stereotypical geeks, similar to the main heroes from classic IT series and movies like Silicon Valley, The IT Crowd and so on.

But nowadays this stereotype is fading into reality. Now we can find absolutely different people working in web-development. We are going to propose common tools that can be useful for all types of personalities (and even not only for developers!).

The IT sphere is one of the fastest-growing industries in the world. The quantity of employees is significant. According to statista.com, the number of full-time employees increased from 52 million in 2019 to 65 million in 2022. And the demand for IT professionals is still growing! And the level of professionals and competition for a good offer are also high. So you should do your best to improve your skills and productivity at work. We are going to help you with this! So here goes!

https://www.statista.com/statistics/1126677/it-employment-worldwide/

Find below 10 tips on how to improve developer productivity:

1. Develop yourself first!

It may sound like a banal piece of advice, but it is absolutely effective and true. If you want to be a productive developer, you have to increase your base of professional knowledge, commercial experience and so-called hard skills. Deep knowledge of your stack, tools, libraries and so on will help you to find the right solutions faster and easier. 

But what is more important to all developers is their fundamental knowledge. You can go deeper into algorithms, systems architecture, or devopsing. And a good understanding of these things will definitely help you to feel more confident at any project you work on.

Stay a constant learner all your life to keep your brain working at the most productive level!

2. Create an optimal environment

The ideal developer workspace may look different for everyone, but the basic idea is to minimize distractions and make it comfortable for you.

Working on the beach with a laptop looks perfect only in pictures on social networks. In fact, an ergonomic workspace with a desk, a quality chair, and proper lightning is crucial for developers!

What is most important in your working environment is the right hardware! For all IT-specialists and especially for developers equipment plays a significant role in making their workspace convenient and their work productive.

Don’t forget about your online workspace. It is worth mentioning that there are also tools which are not software-related, but can help you much with planning, organizing and managing your performance, tasks and habits. Some of the most common project management and time tracking systems are Jira, Asana and Trello. There are also tools like F.lux to help reduce eye strain while looking at screens. There are plenty of other applications and tools to improve developer productivity and make your work more comfortable and efficient. Just if you feel like you need to improve something in your working environment at the office or your home office, be free to ask your manager and justify the importance or try to improve it yourself. Optimal workplace helps to improve developer productivity and performance as well!

3. Decrease the quantity of distractions 

If you ask developers what is the most annoying thing for them, most will answer that it is getting interrupted in the middle of a difficult working process. Because after being distracted, it is hard to catch that flow again. But distractions can be everywhere and affect everyone. So how can we avoid them?
One of the first and easiest ways is to turn off notifications in messengers and applications. You can read messages when you’re ready for a break. It will definitely save you hours of interruption for you. 

Use noise-canceling headphones and mute your phone.
Focus on one task at a time. Multitasking is not what developers should practice much, but sometimes it is an essential skill they need. But to switch effectively between tasks, you can plan ahead and split your work day into some sessions.
If your company uses apps like Slack, turn on the “Do not disturb” feature before starting your work session.

4. Communicate!

Regular communication among the team helps to share important information that’ll impact how effectively you get your work done. Some ways to provide more frequent communication include:

Slack channels
Daily standups
Team lunches
Project boards

It’s important to keep meetings and calls short and only include the people who need to be there. Speaking of Slack, it’s best practice to save group chat for communication that applies to all members, and use DMs for personal one-to-one discussions. 

Regular communication and feedback lead to more engaged customers and stronger customer relationships, but it can also help to improve developer productivity. Feedback gives a team proper information to help them decide what features and requests to work on and when. 

But don’t overdo it! ?

Communication is useful, but like many other good things, you can overdo it. Too much communication can negatively impact productivity and reduce working time and energy available to get the main tasks done. 

5. Set reasonable deadlines

To set deadlines that are reasonable for you, you first need to determine the scope of the project. Deadlines are great if they motivate a team and help them plan and prioritize tasks and plan for dependencies. But too much or too early, and they can become overwhelming, negatively impact concentration, and cause stress. When setting deadlines, you should provide a reasonable estimate of how long the task will take, and take into account unforeseen bugs and roadblocks, as well as other priorities that may arise.

If you are using project management software, be sure to monitor it regularly when you work on your tasks.

6. Implement healthy habits

This tip is 100% suitable for all, not just developers. 

Drink more water, pay attention to mental health, get enough sleep, eat healthy food, and ventilate the room to breathe more fresh air. Make sure your other muscles get some work to do and not only your brain! 

Healthy habits lead to a better level of energy and as a result they will help to improve developer productivity. Take care of yourself first!

7. Design before you implement

You should understand the task clearly because uncertainty will lead to procrastination and wasting of time. Your first goal should be to understand a task clearly and define the tools and strategy you will use.

It is a common beginners’ mistake to jump right into writing the code, without first mapping the nature of the problem and the logical paths for creating the solution.

The best way to follow this tip is to keep a notebook and a pen nearby. Draw maps, outlines, flows and schemes. Write down all the comments and ideas that come to your mind during the process. It will definitely help you not to lose the thread of your logic when you get distracted by something, for example.

8. Find your flow state

Just as a muse comes to writers or artists, so do developers who can catch the “wave” and be fully involved in the process and even do not notice how the time goes. It’s a magical feeling when your knowledge, motivation and concentration align to produce maximum performance. Try to feel this condition and use it to be productive to the maximum. 

It is necessary to learn more about yourself and analyze when you are the most productive and what you need to create this “magical flow”.

Due to this reason, remote work and flexible working hours are so important for most developers as you are more flexible and have the opportunity to work when you feel most productive.

Being productive doesn’t mean sitting at your desk from 9am till 5pm. These days many developers think about their work issues and work even when they commute, do sports, relax at home, or have important conversations with peers at a local cafe or a bar. Flexibility is one of the main advantages of remote work. Being flexible with when and where developers work allows them to work smarter, innovate and be more productive. But there are some threats to working remotely, and to prevent them you can follow the tips in our previous article in the blog about remote work.

9. Keep your code blocks clean and short

Nothing is worse than trying to figure out what you did some months ago and how it needs to be changed. When you have massive methods and classes, it can be very difficult to figure out what the original logic was. To implement this rule you can follow some effective principles.

The first principle is DRY. It means “Don’t Repeat Yourself” and was first mentioned in the book The Pragmatic Programmer: From Journeyman to Master by Andy Hunt and Dave Thomas. The second principle that we recommend to improve developer productivity is the attractive KISS principle. This abbreviation means “Keep it simple, stupid!

It’s important that your code can be understood by you and other developers, even when it has been written a long time ago. Optimize your code for readability and understandability.

There is a popular and demonstrative quote by Albert Einstein: “If you can’t explain it to a six year old, you don’t understand it well enough yourself.” Don’t forget it while doing your work as a developer, please!

The KISS principle is also offered in two other forms (for those who don’t feel good about the inclusion of the word “stupid”):

Keep it short and simple
Keep it simple and straightforward

As you can see some words may be changed, but the sense of the principle stays the same.

10. Don’t ignore the code reviews

You might be the smartest guy in the room, with the best time-management and knowledge of all the key bindings in the world, and, still, there will always be room for involving others. Everybody makes mistakes and we want to have at least a second pair of eyes to look over a solution before it goes into production. Invest in yourself and introduce pairing programming, code reviews, or some other collective practice to your development process.

‍One of the best types of code reviews is when you have a good programmer who is only a little familiar with the project looking at the code. If you need to explain all the details, you’ll learn your code better, and sometimes an outsider will see problems that you, as the insider, missed. Code reviews cost you nothing but time, but often save you much more than it takes to do it. 

Code review is an essential part of workflow, also for sharing best practices with your team. This is connected with our first tip about improving professional knowledge to improve developer productivity. 

Bonus Tip

Outsource some of your projects or use Flatlogic Products to save time and improve developer productivity!

We offer a platform with starters/templates, CRUD app generator and hosting, all combined to make a perfect solution for web development. To learn more about it, you can follow Flatlogic.com website.

Productivity is about doing more. But it’s important to make sure you are working on products and features you or your customer need, because this won’t add any value to the business. That’s why productivity is always best combined with efficiency. It’s not just about getting the job done more quickly, but focusing on the right things and producing quality work.

It can take years of discipline and practice to be productive. So, don’t push yourself too hard and expect perfection in the beginning. But we hope that following the tips from this article will help you to improve your productivity.

If you work remotely and feel like your motivation and productivity decrease, you can read our previous article Why Does Remote Work Make Us Paranoid? And What To Do About It?

The post How to Improve Developer Productivity? [Guide] appeared first on Flatlogic Blog.Flatlogic Admin Templates banner

Why Does Remote Work Make Us Paranoid? And What To Do About It?

The number of people working remotely has significantly risen worldwide since the beginning of the covid epidemic in January 2020. And in spring 2022, with ongoing pandemics, many businesses in Eastern Europe faced new threats and had to find new ways to organize safe employees’ workplaces.

The relocation is increasing and so is the quantity of remote workers. We should accept the fact that remote work is the new reality; it is unavoidable and will stay and increase next years.

There are a lot of benefits of remote work and flexibility is number one among them. Flexibility to plan your time and choose your location are the most important, according to Buffer’s research. More benefits mentioned by the participants of their research you can see in the picture below.

And even though most people are used to this format and enjoy all its advantages, some employees still suffer while working remotely, cannot adapt to the new format, feel more anxious and they do not even realize the reasons for their feeling stressed or depressed. Some people say that remote work makes us paranoid. Let’s explore this question! But first, look at all the most common disadvantages of remote working!

According to the analytics mentioned by Buffer, among the most popular challenges associated with remote work are unplugging after work, loneliness, difficulty staying motivated and focused, communication and collaboration difficulties, working more and complication with career advancement or growth. 

And now let’s discuss the so-called paranoid feeling while working from home! Remote employees can face situations when they ask themselves: How to understand this “cold response” of the boss via email? I noticed a meeting there, why didn’t I receive an invitation to it? Why is my manager not responding in Slack? Does it mean I do smth wrong? Are they going to fire me? And so on…

And even knowing that in reality all is ok and the colleagues just have been busy, people cannot stop doubting, worrying and scrolling these thoughts in their heads. And moreover these thoughts while remote working can become paranoid.

According to Mind, the mental health charity in England, many employees experience kind of paranoid thoughts from time to time. These might include fears that your work is not up to scratch, that you are being excluded, or colleagues are gossiping about you behind your back.

So what is paranoia?

Paranoia is a state of distrust or fear in which someone misinterprets an ambiguous situation in a negative way, thus causing a feeling of persecution. With this in mind, paranoia while working from home can be a result of misinterpreting a message or action from a colleague or manager, among other occurrences.

Psychologists explain the strong interconnection of paranoia with impostor syndrome which is on the rise among remote employees now.

What is impostor syndrome?

It is also known as impostor phenomenon or impostorism and means a psychological occurrence in which an individual doubts their skills, talents, or accomplishments and has a persistent internalized fear of being exposed as a fraud.

There are several reasons for feeling doubt in your achievements and uncertainty in communication while working at home: 

It can be difficult to recognize nuances when feedback is provided virtually rather than in person.
Even while video calling it is harder to read body language and facial expressions. You cannot hear the intonation of messages in Slack or email. In such situations we can feel the importance of nonverbal communication.
Spending much time alone makes it easier to get stuck in your own head. And if you find yourself sliding down the “I’m not good enough” rabbit hole, it can be hard to get out.

All this creates favorable conditions for self-doubt. When you over-analyze all online interactions with your manager and team, you start to feel paranoid that you are not good enough. 

As a result, this paranoia can lead to these threats:

Feeling exhausted from working, especially because you are not sure that you are doing something useful. Productivity and motivation can drop significantly.
Abandon healthy boundaries between work and your personal life and constant thinking about work even after working hours. All it means is that you have an unhealthy imbalance between work and your personal life. And this imbalance can also lead to problems in your relationships, family life, hobbies, and so on.

The good news is that remote work paranoia can be stopped and impostor syndrome is not a clinical condition.

So let’s see the most popular and easy rules on how to deal with these struggles!

As a company (manager/team lead/HR) you should pay attention to remote work culture and to make focus on creating new environment based on:

Connection
Trust
A sense of purpose

Let’ move on and take a look on 9 common recommendations for you as an employee working remotely:

Create a workspace. Physical separation from work and home is really important to unplug after working hours. If it is impossible to do at your home, you can look for coworking spaces in your city.
You can also separate your work browser and a free-time browser. For example, you can use Safari, Chrome or any other browser to watch movies, this will help facilitate unplugging after work.

1. Define your working hours

You can stay flexible from day to day if possible, but it’s better to know your work and personal schedule for the day ahead. Sometimes working remotely leads to working 24/7, you are constantly checking your email and Slack and feel like work will never end. But respect your time and plan special hours on work and rest, hobbies and private life as well!

2. Take breaks when needed

Make tea or go for a walk alone when changing tasks or working non-stop for a long period of time. Let your mind recharge before switching to the next thing on your list.

3. Stay connected to your team

Working remotely you may start to feel disconnected from your colleagues, feeling left out and unsupported. What is the main advice to stay connected to your company? Of course, it is video calls. They can help bridge the gap and they can be not only regarding work but also informal to discuss the last series you watched or book you read. Just imagine that you are drinking coffee together in the office kitchen.

One more advice here – Keep your cameras ON! Sometimes you feel more comfortable hiding in pajamas behind a camera-off, but it is not good practice. We are used to people’s faces, to their facial expressions and signs. When times are uncertain, these visual hints calm our minds and provide a sense of connection. People want to see you smile or an approving nod. So get ready for a meeting to make it possible to keep your camera ON.

4. Be clear when communicating with colleagues

Try to set and accept tasks clearly, provide context, and double-check your messages before sending. If email, Slack, or other forms of written communication still leave you feeling uncertain, consider picking up the phone. Sometimes even just hearing someone’s voice can help clear things up.

When talking about clear communication, we cannot ignore Smart task theory. This tool helps both managers and the whole team to save time and avoid misunderstandings.

 https://www.recbound.com/recruitment-agency-blog/example-smart-goals-for-recruiters

5. Internalize your accomplishments

What does it mean? How can you do it? First off, you should analyze your daily achievements, focus on positive moments, and even small completed tasks. Don’t forget to thank and reward your accomplishments. Treat yourself the way you want to be treated!

Your goal is to try to create a feeling of approval, support and security for yourself with a so-called “brag file”. A brag file is a list of your achievements and wins you are proud of, all the compliments and positive feedback you get. You can start with some points right now and then revisit them and complete your collection regularly. Revisit your brag file when you’re feeling sad, self-conscious, or experiencing impostor syndrome or other paranoid thoughts. 

Acknowledge the hard work you’re doing and don’t be shy about sharing it in your updates to senior leaders or the team. 

Btw, this practice of “brag file” works not only for remote working employees, it is a really good technique for all suffering from impostor syndrome. Over time, this will help you become more confident, self-satisfied and also notice more good qualities in other people.

6. Depersonalize others’ actions and try not to read into things too much

Nowadays, empathy and emotional intelligence are becoming more and more popular soft skills. It is great to understand your and other people’s emotions. But sometimes when your level of empathy is high, it can lead to misunderstandings of other people’s behavior because of taking it personally. You think that all the world revolves around you. But it is far from the truth.

You just need to know that if your boss is upset, it doesn’t mean that it is you who did something wrong. There can be thousands of reasons for this. 

The advice is that you should try to divide yourself, your emotions and your opinion about yourself from others words and moods. 

Moreover, often people see and criticize others for what they do not like about themselves. Just think about it!

7. Be open and explicit

It’s always a good idea to talk about your expectations and boundaries (both at work and in relationships). And it’s doubly important when you feel that remote work makes you paranoid.

For example, consider getting feedback from your boss. If you open a conversation, you can clear up all the details regarding working style, processes and tasks. You will find out what to expect and you won’t be shocked to receive feedback with lots of corrections. This is less likely to hurt your ego, because you already know that your boss is especially attentive to details.

8. Talk it out

If you feel that remote work makes you paranoid, talk about it. You can discuss it with your boss and switch to working from the office or hybrid format if it is possible in your company. Talking about it with your friends or your partner can help to clear your mind of negative thoughts.

But if you can’t stop feeling paranoid and these simple rules don’t help you, it is better to solve this problem with specialists (psychologists) individually.

Here above we offer you some common recommendations on what to do if you feel that remote work makes you paranoid. But you should always keep in mind that there is no rulebook with a 100% guarantee when you talk about people’s feelings. There is a saying “Many men, many minds”. We all are individuals with our special psychological features. And also your opinion on remote work and how to deal with paranoid thoughts can differ from others’ ones.

Above all, remember that you deserve a work life that is fulfilling and a team that values you and your contributions. Protect your mental health and your time by managing your remote work paranoia.

As for Flatlogic, we have a hybrid format of working. Most employees who work on Flatlogic products do it from the office but still have the opportunity to work remotely once a week. The part of our team who works on outsourcing projects mostly work remotely and come to the office only once a week, on Mondays to have meetings and do some administrative deals.

But recently we are getting bigger and more flexible, and we also hire developers and software engineers from all over the world for fully remote work. So feel free to send your CV if you want to cooperate with us on any terms!

What do we do to make the work of remote employees of Flatlogic more comfortable?

We do regular video calls with all the team to discuss the latest news and just for informal talks. We have a corporate online digest to keep everyone involved in the life of the company. Our inner educational meetings and English club are held both offline and online. We have informal channels in Slack to share memes, recommendations of movies and so on. 

We have a personal and flexible approach to employees and empathy and connection are not just words. The first five minutes of a meeting focus on what is going on with the team and only then we go to the main agenda. 

All this helps our company to keep in touch with remote part of the team, improve inner communication and corporate culture, and increase employee engagement.

Here we also have a result-oriented approach to our work processes and try to uphold such values as trust, responsibility and freedom for self-expression and self-development

And at the end of this article, just to boost your mood and make you smile, find some funny memes about remote work

By the way, staying positive and treating some situations with a sense of humor is also a good way to overcome some difficult moments of remote work. 

Do you recognize yourself or your colleagues in them?:)

Suggested Articles

Starting a Web App in 2022 [Research]
Top 40+ Javascript Memes|Programming Humor
Top 40 Nerd Jokes for Programmers to Liven Up Your Day [Golden Collection]

The post Why Does Remote Work Make Us Paranoid? And What To Do About It? appeared first on Flatlogic Blog.Flatlogic Admin Templates banner

ASP.NET Core scheduling with Quartz.NET and SignalR monitoring

This article shows how scheduled tasks can be implemented in ASP.NET Core using Quartz.NET and then displays the job info in an ASP.NET Core Razor page using SignalR. A concurrent job and a non concurrent job are implemented using a simple trigger to show the difference in how the jobs are run. Quartz.NET provides lots of scheduling features and has an easy to use API for implementing scheduled jobs.

Code: https://github.com/damienbod/AspNetCoreQuartz

A simple ASP.NET Core Razor Page web application is used to implement the scheduler and the SignalR messaging. The Quartz Nuget package and the Quartz.Extensions.Hosting Nuget package are used to implement the scheduling service. The Microsoft.AspNetCore.SignalR.Client package is used to send messages to all listening web socket clients.

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>

<ItemGroup>
<PackageReference Include=”Microsoft.AspNetCore.SignalR.Client” Version=”5.0.11″ />
<PackageReference Include=”Microsoft.Extensions.Hosting” Version=”5.0.0″ />
<PackageReference Include=”Quartz” Version=”3.3.3″ />
<PackageReference Include=”Quartz.Extensions.Hosting” Version=”3.3.3″ />
</ItemGroup>

The .NET 6 templates no longer use a Startup class, all this logic can now be implemented directly in the Program.cs file with no static main. The ConfigureServices logic can be implemented using a WebApplicationBuilder instance. The AddQuartz method is used to add the scheduling services. Two jobs are added, a concurrent job and a non concurrent job. Both jobs are triggered with a simple trigger every five seconds which runs forever. The AddQuartzHostedService method adds the service as a hosted service. The AddSignalR adds the SignalR services.

using AspNetCoreQuartz;
using AspNetCoreQuartz.QuartzServices;
using Quartz;

var builder = WebApplication.CreateBuilder(args);

builder.Services.AddRazorPages();

builder.Services.AddSignalR();

builder.Services.AddQuartz(q =>
{
q.UseMicrosoftDependencyInjectionJobFactory();

var conconcurrentJobKey = new JobKey(“ConconcurrentJob”);
q.AddJob<ConconcurrentJob>(opts => opts.WithIdentity(conconcurrentJobKey));
q.AddTrigger(opts => opts
.ForJob(conconcurrentJobKey)
.WithIdentity(“ConconcurrentJob-trigger”)
.WithSimpleSchedule(x => x
.WithIntervalInSeconds(5)
.RepeatForever()));

var nonConconcurrentJobKey = new JobKey(“NonConconcurrentJob”);
q.AddJob<NonConconcurrentJob>(opts => opts.WithIdentity(nonConconcurrentJobKey));
q.AddTrigger(opts => opts
.ForJob(nonConconcurrentJobKey)
.WithIdentity(“NonConconcurrentJob-trigger”)
.WithSimpleSchedule(x => x
.WithIntervalInSeconds(5)
.RepeatForever()));

});

builder.Services.AddQuartzHostedService(
q => q.WaitForJobsToComplete = true);

The WebApplication instance is used to add the middleware like the Startup Configure method. The SignalR JobsHub endpoint is added to send the live messages of the running jobs to the UI in the client browser..

var app = builder.Build();

if (!app.Environment.IsDevelopment())
{
app.UseExceptionHandler(“/Error”);
app.UseHsts();
}

app.UseHttpsRedirection();
app.UseStaticFiles();

app.UseRouting();

app.UseAuthorization();

app.UseEndpoints(endpoints =>
{
endpoints.MapHub<JobsHub>(“/jobshub”);
});

app.MapRazorPages();

app.Run();

The ConconcurrentJob implements the IJob interface and logs messages before and after a time delay. A SignalR client is used to send all the job information to any listening clients. A seven second sleep was added to simulate a slow running job. The jobs are triggered every 5 seconds, so this should result in no change in behavior as the jobs can run in parallel.

using Microsoft.AspNetCore.SignalR;
using Quartz;

namespace AspNetCoreQuartz.QuartzServices
{
public class ConconcurrentJob : IJob
{
private readonly ILogger<ConconcurrentJob> _logger;
private static int _counter = 0;
private readonly IHubContext<JobsHub> _hubContext;

public ConconcurrentJob(ILogger<ConconcurrentJob> logger,
IHubContext<JobsHub> hubContext)
{
_logger = logger;
_hubContext = hubContext;
}

public async Task Execute(IJobExecutionContext context)
{
var count = _counter++;

var beginMessage = $”Conconcurrent Job BEGIN {count} {DateTime.UtcNow}”;
await _hubContext.Clients.All.SendAsync(“ConcurrentJobs”, beginMessage);
_logger.LogInformation(beginMessage);

Thread.Sleep(7000);

var endMessage = $”Conconcurrent Job END {count} {DateTime.UtcNow}”;
await _hubContext.Clients.All.SendAsync(“ConcurrentJobs”, endMessage);
_logger.LogInformation(endMessage);
}
}
}

The NonConconcurrentJob class is almost like the previous job, except the DisallowConcurrentExecution attribute is used to prevent concurrent running of the job. This means that even though the trigger is set to five seconds, each job must wait until the previous job finishes.

[DisallowConcurrentExecution]
public class NonConconcurrentJob : IJob
{
private readonly ILogger<NonConconcurrentJob> _logger;
private static int _counter = 0;
private readonly IHubContext<JobsHub> _hubContext;

public NonConconcurrentJob(ILogger<NonConconcurrentJob> logger,
IHubContext<JobsHub> hubContext)
{
_logger = logger;
_hubContext = hubContext;
}

public async Task Execute(IJobExecutionContext context)
{
var count = _counter++;

var beginMessage = $”NonConconcurrentJob Job BEGIN {count} {DateTime.UtcNow}”;
await _hubContext.Clients.All.SendAsync(“NonConcurrentJobs”, beginMessage);
_logger.LogInformation(beginMessage);

Thread.Sleep(7000);

var endMessage = $”NonConconcurrentJob Job END {count} {DateTime.UtcNow}”;
await _hubContext.Clients.All.SendAsync(“NonConcurrentJobs”, endMessage);
_logger.LogInformation(endMessage);
}
}

The JobsHub class implements the SignalR Hub and define methods for sending SignalR messages. Two messages are used, one for the concurrent job messages and one for the non concurrent job messages.

public class JobsHub : Hub
{
public Task SendConcurrentJobsMessage(string message)
{
return Clients.All.SendAsync(“ConcurrentJobs”, message);
}

public Task SendNonConcurrentJobsMessage(string message)
{
return Clients.All.SendAsync(“NonConcurrentJobs”, message);
}

}

The microsoft signalr Javascript package is used to implement the client which listens for messages.

{
“version”: “1.0”,
“defaultProvider”: “cdnjs”,
“libraries”: [
{
“library”: “[email protected]”,
“destination”: “wwwroot/lib/microsoft-signalr/”
}
]
}

The Index Razor Page view uses the SignalR Javascript file and displays messages by adding html elements.

@page
@model IndexModel
@{
ViewData[“Title”] = “Home page”;
}

<div class=”container”>
<div class=”row”>
<div class=”col-6″>
<ul id=”concurrentJobs”></ul>
</div>
<div class=”col-6″>
<ul id=”nonConcurrentJobs”></ul>
</div>
</div>
</div>

<script src=”~/lib/microsoft-signalr/signalr.js”></script>

The SignalR client adds the two methods to listen to messages sent from the Quartz jobs.

const connection = new signalR.HubConnectionBuilder()
.withUrl(“/jobshub”)
.configureLogging(signalR.LogLevel.Information)
.build();

async function start() {
try {
await connection.start();
console.log(“SignalR Connected.”);
} catch (err) {
console.log(err);
setTimeout(start, 5000);
}
};

connection.onclose(async () => {
await start();
});

start();

connection.on(“ConcurrentJobs”, function (message) {
var li = document.createElement(“li”);
document.getElementById(“concurrentJobs”).appendChild(li);
li.textContent = `${message}`;
});

connection.on(“NonConcurrentJobs”, function (message) {
var li = document.createElement(“li”);
document.getElementById(“nonConcurrentJobs”).appendChild(li);
li.textContent = `${message}`;
});

When the application is run and the hosted Quartz service runs the scheduled jobs, the concurrent jobs starts every five seconds as required and the non concurrent job runs every seven seconds due to the thread sleep. Running concurrent or non concurrent jobs by using a single attribute definition is a really powerful feature of Quartz.NET.

Quartz.NET provides great documentation and has a really simple API. By using SignalR, it would be really easy to implement a good monitoring UI.

Links:

https://www.quartz-scheduler.net/

https://andrewlock.net/using-quartz-net-with-asp-net-core-and-worker-services/

https://docs.microsoft.com/en-us/aspnet/core/signalr/introduction