c# – Should Source Generators be used as a replacement for class libraries

You’re mixing a few concepts here.

You’ve got class wrappers, you’ve got code generators, you’ve got build-on-deploy. The solution you’re talking about works if you can safely build the application per deployment, which is a big assumption.

A different architectural approach might be to making your Logging feature an interface, and allowing any all implementations of that interface, and perhaps scanning for implementations of that interface at runtime.

Here’s an example of how you might make that work using Reflection:


In terms of deployment, you’re saying something like “This app logs to anything that implements IMyLog, so if you want logging to work make sure you drop a DLL in the runtime directory that has an IMyLog in it.”

My point is that you seem to be solving a deployment problem with a complicated workaround that might force you to compile the application individually for each installation. I’m suggesting that you consider solving the deployment problem at the point of deployment instead.

Applying replacement rules to products doesn’t work as expected

I have the following issue: I’d like to apply some replacement rules, for example

rules:={f(x)/t :> ff(x), g(x)/t :> gg(x)}

to an expression, e.g. like this:

(f(x)*g(x)/(t^2))/. rules

Surprisingly, this doesn’t give the expected result


How do I fix this? Sorry if it’s an easy question, I’m still a beginner with Mathematica.

probability – Sampling without replacement from a population with known fractions of duplicates, triplicates, etc.

Suppose I have a population of a known size. For this population, p_1 + p_2 + …. + p_n = 1, where p_1 is the fraction of the population that has no duplicates, p_2 is the fraction of the population with one duplicate, and so on. p_1, p_2, and so on are all known values (and if it matters for approximate calculations, the fractions very quickly decrease in value, with anything above p_5 being negligible).

I take a random sample X (no replacement) from this population, where X << the total population size, and I want to find the expected fraction of X that will not be a unique item.

How do I proceed? Please forgive any confusing language above, I am attempting to translate a question into a math problem with no background in statistics.

email – Replacement for mailto: Extension?

I’ve been using the ‘mailto’ google chrome extension for years. It allows — or rather allowed — me to right click on a page and choose a menu option to email the URL. Fine and dandy. Today I went to do this; the menu option was gone, and drilling into the extensions showed that it was marked with

This extension violates the Chrome Web Store policy.


Well. OK. Maybe they were doing something wrong, maybe they weren’t. At this point, I’ll never know… but I want a replacement.

I’ve got four criteria:

Non negotiable:

  • Secure — won’t spy on me, uses secure protocols
  • Cross platform

Nice to have:

  • Choose account / email provider
  • Mature, won’t get removed by Chrome web store.

So far, I’ve looked at the following

Everything was marked as ‘works on your device’ (composed on XUbuntu), so cross platform support seems ok…

  • Mailto: for Gmail — this seems to be pretty much a drop in replacement for what I’ve been using. Their privacy policy makes the right noises. It’s got 100K users. That doesn’t guarantee that it isn’t going anywhere, but it’s a good sign… but it seems like it’s gmail only, and doesn’t seem to have the ability to switch accounts.
  • mailto — Looks like it might support email providers other than gmail, but there’s nothing to go on in the privacy policy page. I’m not sure if they’re being honest about not giving me any privacy or just inexperienced, but I’m giving this one a pass.
  • Send from Gmail (by Google). Looks pretty similar to the first one on the list, but no privacy policy. Et tu Google?? Pass.
  • Share link via email. This looks promising — It’s got 80K users, the reviews aren’t filled with hate, and it seems to support multiple email providers. Not sure if it allows me to choose account on the fly … but no privacy policy.

There are a bajillion other plugins to choose from, but of course who knows how well they’re supported, what their privacy policies are, whether they’re being truthful about those. Anyone using a mailto plugin that they like and trust? Anything that has the ability to choose email accounts with a minimal amount of friction?

Looking for Replacement for IBM Bare Metal –

I have been an IBM Cloud/SoftLayer customer since 2012. I decided to use IBM and pay an over-market premium because I trusted them. But it s… | Read the rest of https://www.webhostingtalk.com/showthread.php?t=1844068&goto=newpost

replacement – How to replace a list/array of variables in the result?


I want to know how to replace multiple variables in the result expression. To be specific, all those variables are inside the array I defined.

For a simple example, if I define input

mm5 = {a, b, c, d};

mm7 = {2, 3, 9, 8};

mm7a = mm7.mm5

Out: 2 a + 3 b + 9 c + 8 d

After that, if I define a new array

mm6 = {3, 4, 5, 7}

And I want to replace every unknown component in mm5 to be values in mm6, and to let final result of mm7a to be 23+34+95+87=119. How should I do that?

I was thinking is there anyway similar to

mm7a /. {mm5[[i]] -> mm6[[i]],{i,1,4}}

Of course, what I wrote is wrong. But is there any simple way to use /. to help me achieve this effect?? And after substituting, I want symbols in mm5 be reserved, for example, when I out put mm5 result, it is still {a, b, c, d}

I searched the whole web but I didn’t find a simple way to do it. Maybe I didn’t search it right. So I post my question here and hopefully to get some answer.

Thank you

replacement – Apply a function to all coefficients of a polynomial

Here’s one way:

rules = CoefficientRules(P, {x, y})
newrules = MapAt(f, #, 2) & /@ rules
FromCoefficientRules(newrules, {x, y})

Or, in general,

CoefficientMap(f_, P_) := FromCoefficientRules(
   MapAt(f, #, 2) & /@ CoefficientRules(P, Variables(P)), Variables(P))

CoefficientMap(f_, P_, vars_) := FromCoefficientRules(
   MapAt(f, #, 2) & /@ CoefficientRules(P, vars), vars)

In general, if you replace MapAt(f, #, 2) & with a function which takes Rule(powerlist, coeff) to Rule(newpowerlist, newcoeff), you could build more general maps on polynomials! (Currently, MapAt(f, #, 2) &(Rule(p, c)) yields Rule(p, f(c)).)

For the application you mention later on, though, where you change Sin(2 x) to Sin(4 x) it sounds like you might want to build your own version of Variables or CoefficientRules for that situation which would extract and encode Fourier coefficients of finite Fourier series (or something like that)—possibly by converting them into polynomial variables in their own right.

replacement – How to convert Joules to units where the speed of light is 1

Is there a way using the various unit commands to convert units to values that correspond to the speed of light being 1 and unitless.
10 Joules is the immediate quantity in question.

Also I wonder if Solve could be used to do this.

Could some one direct me to some instructions in how to use tis editor. I Answered my own question but this editor is hard for me to decipher.

UnitConvert(Quantity(10, “Joules”)/(Quantity(“SpeedOfLight”))^2) // N

The Answer is 1.11 X 10-16 KG

Text replacement in Notepad++ – Super User

In random positions of a code with thousands of lines, I would like to pass by a string of the following type:

<h3><a href="/question/index?qid=20210417025215AA5DJNX" class="QuestionCard__title___1DKC-">

where the part 20210417025215AA5DJNX changes from time to time, to a string of this other type:

17/04/2021; 02:52:15

I have Notepad++, but although I have searched Google I haven’t found something similar. Thank you!

How to disable WP emoji UTF8 by img replacement?

I use some UTF-8 emojis like 😋

Problem: WP changes that automtaically into img
ex: https://s.w.org/images/core/emoji/13.0.1/svg/1f60e.svg

How can I disabled that ? I need my UFT8 chars and not svg img ?