architecture – ASP.NET Web API – what is the design pattern?

In Visual Studio, ASP.NET MVC project template is designed for MVC pattern, but what about ASP.NET Web API project template?
I know that we can create API from MVC project, also we can build MVC app from Web API project.

But what if I use Web API project and return only data, not Views? What is the design pattern behind it? It does not consider to be a MVC anymore, becouse it doesn’t have View. Is it just a N-Tier architecture?

microsoft excel – Conditional formatting fill pattern

I have a query around the auto-population or conditionally formatted cells. Example below:

enter image description here

As it stands, the amount column J has the formula =IF(ISBLANK(H9)+ISBLANK(I9)=2,"",H9-I9).

The entire column has conditional formatting for if the value in of the cell is greater than 0 to format with green fill and dark green text. If the value is less than 0 it’s to format with light red fill with dark red text.

For some reason, as in the image, when no data is entered into any cell, other than the above formula for its representative line it auto-fills to green.

How do I adjust the formatting so that there is no fill until the value of the cell is either greater than or less than 0?

react.js – React functional components: Pattern for keeping parent aware of a value within a child

Although case one and case two shown below both work, I have these two questions (the first question is why I’m here… I’m happy to ask the second one on Stack Overflow, but it seems like the second one might be worth considering vis a vis the ideal pattern for the situation that comes up below):

Question #1

What are the considerations behind deciding between passing the out of the box setWhatever from useState() down to a child (see case one below) versus creating a custom handleWhatever function to pass to the child, where the handleWhatever function uses setWhatever within it (see case two below)?

Question #2

Both cases result in the warning shown below… which may or may not mean that the best practice pattern for having a child update a parent’s state is something other than one of my two cases… here is the warning:

Warning: Cannot update a component (Test) while rendering a different component (DetermineValue). To locate the bad setState() call inside DetermineValue, follow the stack trace

Definitely React is about passing state down from parent to child. But after reiterating that fact, it seems like we are always left with countless examples where a function is passed from parent to child for the purpose of keeping a parent aware of a certain value within the child. My question is about such cases where a function needs to be passed down to a child. (If someone is 100% sure that all such cases of passing a function to a child are misguided… then, of course, I’m open to learning about why!! I don’t claim to have absolute certainty that it is a sound pattern for functions to be passed to children for the purposes of updating a parent).

Case #1

// Test.js (parent, case one)
import React, { useState } from 'react';
import DetermineValue from './DetermineValue';
const Test = () => {
  const (importantValue, setImportantValue) = useState();
  return <DetermineValue setImportantValue={setImportantValue} />;
export default Test;

// DetermineValue.js (child, case one)
import React from 'react';
const DetermineValue = ({ setImportantValue }) => {
  setImportantValue('Important Data');
  return <></>;
export default DetermineValue;

Case #2

// Test.js (parent, case two)
import React, { useState } from 'react';
import DetermineValue from './DetermineValue';
const Test = () => {
  const (importantValue, setImportantValue) = useState();
  const handleSetImportantValue = (importantValueQuickPass) => {
  return <DetermineValue handleSetImportantValue={handleSetImportantValue} />;
export default Test;

// DetermineValue.js (child, case one)
import React from 'react';
const DetermineValue = ({ handleSetImportantValue }) => {
  handleSetImportantValue('Important Data');
  return <></>;
export default DetermineValue;

user expectation – Primary/Secondary button placement pattern

This recently came up at my company too. Some HIPPO decided that primary buttons should be set flush right. Yet everywhere else on our site, primary buttons are flush left, with the secondary button adjacent to the right. At least that’s the pattern for right-to-left languages. For Arabic and Hebrew, it’s flipped.

All the sources I found agree that there should only be ONE primary button per page or modal, but they do not agree on the order. See:

Since there is no rule, I would go with consistency here. Follow the standard placement of buttons that’s already on your site; don’t surprise your visitors with a novel layout.

lock screens – Draw unlock pattern without having to swipe first

When an Android 10 phone is locked, it shows notifications and says “Swipe to unlock”, then after swiping it hides the notifications, and shows the pattern lock saying “Draw unlock pattern”. So the unlocking requires two steps (swiping and then drawing).

Andriod 4 directly shows notifications and the pattern lock below them. The screen is smaller than on the Android 10 phone, but it still all fits on the screen. How can this be achieved on Android 10, without the unnecessary first swiping step?

This is not about Android 3 like here nor Android 6 like here.
This is not about changing the timer for the swipe like here, but about removing the swipe completely.

Are there solutions for Dark Pattern?

From the dark-patterns description (emphasis added):

A design pattern which is carefully crafted to accomplish some result but does not have the user’s interests in mind.

In other words, a dark pattern is an aspect of a user’s experience in which they are intentionally taken advantage of; the site/developers are not designing an experience best suited to meet their customers’ needs. Instead, they have contrived one in which their own wants (or stakeholders’ desires) take priority.

Dark patterns can emerge through a number of ways. A non-exhaustive list of strategies includes:

  • lack of transparency to the user as to what the status of the system is
  • confusing wording or interfaces
  • hiding options or settings out of plain view
  • preselecting options that the user may not want
  • presenting upgrade paths as if they are necessary for basic functionality
  • making it particularly difficult to cancel a service

The solution to avoiding dark patterns, naturally, is to simply not design in a way that attempts to usurp users of their power of choice.

Disadvantage of the strategy pattern and how to overcome it

This quote is surprising and misleading. Design patterns are not chosen in a catalogue by comparing pros and cons! Patterns are chosen because they address a very specific problem that you are facing. If it doesn’t suit the need, just don’t take it.

The intent of the strategy pattern is:

Define a family of algorithms, encapsulate each one, and make them interchangeable. Strategy lets the algorithm wary independently of the client.

If you have a problem like that, just use the pattern. Whether the application has to know which strategy to use and how to chose it is secondary. It’s eventually a consequence, but certainly not a disadvantage.

Lastly, this quote is not fully true either: you could encapsulate the strategy and package it in a dynamic library loaded at run time and instantiated through a factory function with a fixed name. Your application may then just rely on the DLL, knowing just the strategy’s interface without knowing what exact strategy implementation it is. That’s the power of decoupling that the strategy pattern offers.

Post Scriptum: The “often quoted disadvantage” appears with an exact match in 58 web pages according to google. Several are from the same author who cross-posted it, and the oldest dating back to 1999. I’m not sure that such a small cluster qualifies for “often quoted”

password cracking – Run John the ripper on a specific pattern

I haven’t use a specific password since a while and i need to access a file, i don’t remember which letter are upper case letters which aren’t and the last letter.

Example my password could be :

  • ABC123DEF@?
  • abC123Def@x
  • aBc123DEF@1
  • ABC123DEf@w
  • ….

Does John the Ripper offer a way to work on this specific pattern ?

loading – Two loaders on a screen – good interaction pattern?

Recently noticed a micro-interaction on LinkedIn where there were 2 loaders on the same page – different in size and color. They were probably for loading different types of content. Is this a good UX pattern?

How did I land on this state:
Opened notifications tab and pulled down to refresh feed before notifications got loaded.

Maybe this was not an intended interaction, and happened because of 2 types of content loading simultaneously.
enter image description here