Naming conventions for set/unset method parameter

The most important is that the method name reflects a behavior. You do this perfectly well with the Set prefix (if your project indeed doesn’t use lower camel case for method names).

The consumers would then write something very unambiguous and self-documenting:

myobject.SetLock(true);

If as a consumer I read your interface, it is clear to be that the parameter name reflects the target state that results from the operation:

SetLock (boolean isLocked):

For the maintainers, the name of the parameter will probably be understood the same way. You just should avoid any confusion with the internal state of your class. In the implementation, it all depends. the following seems clear:

internallyLocked = isLocked; 

But it is true that the following could appear ambiguous:

if (isLocked) 

Now, if you’re perfectionist, the problem with is not so much the ending of your parameter but its beginning. In all objectivity:

  • if it starts with is, the end should be locked for the sake of grammatical consistency
  • is prefix suggests a current state. If you want to avoid any potential ambiguity, you could use another prefix that is more clear about the intent and reflects a change of state or the target state.

The exact choice of wording is opinion based. For example: toBeLocked (target state clearly expressed) or willLock (change action clearly expressed). But there are certainly many other possibilities that comply with these basic principles.

calculus and analysis – How to use MMA to calculate the double integral of the integral area related to the parameter

I know that the Integrate function of MMA can compute double integrals.

Integrate[x*y, {x, y} ∈ Disk[]]

Now I want to use MMA to calculate the result of this integral:

$$iint_{x+y<=z}{xy}mathrm{d}x mathrm{d}y$$

reg = ImplicitRegion[x + y <= z, {x, y}];
Integrate[x*y, {x, y} ∈ reg]

But the integral area of this double integral is related to the parameter z, so the result of this double integral is related to the parameter z. I want to know how to use MMA to calculate this type of double integral.

differential geometry – For the same curve,The critical point becomes a regular point under different parameter expressions.

When I say “the same curve”,I mean they have the same image in the $R^2$ plane.

When I say “a critical point of $mathbb{r}(t)$“,I mean “$mathbb{r}^{‘}(t_0)=mathbb{0}$“.

Let’s take a curve which looks like y=x as an example.

$$ left{
begin{aligned}
x & =t\
y & =t
end{aligned}
right.
$$

It is surely a regular point when t is equal to zero.

However,when it comes to
$$ left{
begin{aligned}
x & =t^3\
y & =t^3
end{aligned}
right.
$$

The point where t is equal to zero becomes a critical point!

I’m afraid that these two curves may not be the same curve by the defination in differential geometry,are they?

And I still have another question.I think the regularity of a point describes whether the curve is smooth at this point or not.But the latter go against my intuition:it is critical at the point t =0 by defination while it is obviously smooth everywhere because it looks like y=x!

unity – Using Part of prefab as script parameter

I’m trying add a weapon to Eithan – the third person character. So I want to take his hand, which is part of the prefab Eithan (the weapon location) and use it in the my Player.cs script to Instantiate the weapon.
I created a parameter in the script for the hand: (SerializeField) GameObject weaponSocket; and I tried to Instantiate the weapon like this like this: Instantiate(weaponPrefab, weaponSocket.Transform);, but I just cant drag the hand to the parameter.

Anyone knows how to do this correctly?

Thank you!

Images: Player script: https://imgur.com/RcvKeXN
Trying to drag the left hand to the parameter (indicated by red arrows): https://imgur.com/RB63c9d

rest – Is it a good practice to have an endpoint URL with parameter accepting different type of values according to an indicator in the HTTP header?

Assume a resource URL in the context of REST API:

/sites/<site id or site code>/buildings/<building id or building code>

The value of the two path parameters, <site id or site code> and <building id or building code>, are as the name indicates, can be either id or code. Implicitly it means:

for instance, there is a building with 1 as building id and rake as building code, and it is located in the site with 5 as the site id and SF as the site code, then the following endpoint URL should retrieve the same result:

  • /sites/5/buildings/1
  • /sites/5/buildings/rake
  • /sites/SF/buildings/1
  • /sites/SF/buildings/rake

In order to reduce the ambiguity, there is a hint in the HTTP header, e.g. path-parameter-type with value as CODE or ID, indicating the given values of the path parameters are either code or ID.

Even though, the implementation of such resource endpoint contains lots of if conditions due to the ambiguity. However, from the end-user’s aspect, this seems to be handy

My question is whether such endpoint design is a good practice or a typical bad practice albeit the fact that there is a type indicator in the HTTP header?

coding theory – Variance Gamma parameter estimation in R studio

I am using the vgFit function in R Studio to estimate parameters for stock prices. I converted the stock prices to a vector and I get this error. My code was:

param<-c(0,1,0,1) 
fit<-vgFit(c(x), param=param)

The error is:

Error in optim(paramStart, llsklp, NULL, method = startMethodSL, hessian = FALSE,  : 
  function cannot be evaluated at initial parameters

sql server – SQL Query fails when content of a single parameter change

Im very puzzled about this issue.. I have a SQL Server database with many records and it is used by my website. When the website user searches for a specific record, the SQL command gets a timeout. The only thing that is different between searches is the parameter.
Everything works within SQL Management Studio. Using newest version of SQL Server Express on a Windows Server 2016.

This fails with a timeout:

Query: SELECT * FROM dbo.v_MyView WHERE 1=@ONE AND Name LIKE @name Order by dbo.v_MyView.Date Desc OFFSET (0) ROWS FETCH NEXT (10) ROWS ONLY
Parameters: @ONE 1, @name flop%

This works:

Query: SELECT * FROM dbo.v_MyView WHERE 1=@ONE AND Name LIKE @name Order by dbo.v_MyView.Date Desc OFFSET (0) ROWS FETCH NEXT (10) ROWS ONLY
Parameters: @ONE 1, @name bandit%

Notice that it is only the content of the parameter @name that changes. searching for “flop%” fails and searching for “bandit%” works.

Running over parameter space in Google Sheets

I’ve built a model in Google Sheets that with a few parameter cells and a few result cells. I’d like to analyze the results of the model while testing parameters over a specific range.

Is there a way for Sheets to run over ranges for two parameters and construct a table of the results?
e.g. Net present value as a function of interest rates and loan years

Note the model requires many calculations and tables and so I need some way for Sheets to scan over the parameter space (set of incremental interest rates and desecrate loan years range), recalculate the model for each parameter combination and output the value to a table.