c# – Different behaviour for getting environemnt variable after moving to nuget package

I have a behaviour that I cannot explain in my application.

I have a common library which I;ve used across multiple projects. In this library I’m using System.Environment class to access environment variables, like so.

 string value = System.Environment.GetEnvironmentVariable("MY_ENV_VARIABLE");

I’ve decided to create a nuget package for this shared library, and after moving my reference to the nuget, the value is not set anymore, as if the searched env_variable does not exist.

In an asp.net core project, I’m setting the environment variable

launch.json =>

 "environmentVariables": {
    "MY_ENV_VARIABLE": "my value"

Why this behaviour ? switching back to direct referencing the project, everythign works.

keyboard – Reason for difference in behaviour of autcomplete interactions in input fields

There seems to be two different schools of thought when it comes to the autocompletion of input fields and I am wondering if there is a particular reason or rationale for each.

Basically, when the user is completing an input field (usually text based) it is typical for autocomplete functionalities to be implemented when there has been previous inputs provided. The user can then choose to continue completing the input or to use the autocomplete feature by:

  • Pressing the ENTER key
  • Pressing the TAB key

Alternatively they can use the mouse and click on the autocomplete suggestion but it breaks the flow of typing from the keyboard.

Is there any particular reason (both from a technical AND user perspective) why some sites use the ENTER key while others use the TAB key for this? I think it creates a confusion because it is likely for a user to go to websites that implement this feature both ways.

web browser – Tab under behaviour blocking

can the site not auto redirect the main page to the advertisement in some time without the need for user clicking on the link or opening the new tab?

They lose your focus. You got redirected to the ad site, you probably will not get back. If you got interested, you will interact with the target site, not theirs. If you aren’t interested, you close the tab.

can the site not open the advertisement in the new tab automatically?

They can open a new tab and not be blocked only in a short time frame after loading the page, or when you interact with the site. That’s why some sites that opens a popup have a link saying Click here to open, so if your browser blocked the automatic popup, the link will open it.

can the site not open the advertisement in the new tab instead of opening the content in the new tab and opening the advertisement in the main page?

They aren’t interested on the ad being seem. No matter if you saw it ow not, they are getting paid anyway. Opening their site on a new tab makes the history clean, and you probably will close the ad on the original tab, and lose the track of the sites you went until reaching theirs.

How does Twitter decide which liked Tweets get the “stochastic retweet” behaviour?

As mentioned here, sometimes we see other people’s likes in our Twitter feeds. Some have semi-jokingly characterized the treatment of liking Tweets as “stochastic retweets”.

I was wondering, are the specifics of this behaviour documented anywhere?

Obviously Twitter doesn’t put every single liked Tweet in our follower’s feeds (otherwise they’d be overrun with liked Tweets). Is there any criteria that Twitter uses to determine which of the Tweets you liked gets pushed onto your follower’s feeds? Is there a certain ratio of your liked Tweets that it puts into your followers’ feeds? Does it do it indiscriminately to your followers, or does it take the engagement patterns of your followers into account? e.g. if a Tweet you liked appears in one of your follower’s feeds, does it necessarily appear in all of your follower’s feeds?

Suppose you make a Tweet and another person with n followers likes the Tweet. Can we make any inferences about how many additional people that Tweet might be exposed to because of that like?

Or is this all Twitter Algorithmâ„¢ black box magic?

multitouch – unity : How to change the default behaviour of the touchpad/trackpad in laptop?

I’m using unity on my laptop. Normally, i can customize my touchpad in most of 3d app but in unity i can’t find a way to do it ? is it possible to customize it at user level without hard coding it ?

I just want the touchpad to behave like most app : 2 fingers pinch to zoom, 2 fingers drag to rotate view etc.

Partial Successful Action behaviour

I’m building an app where a user might perform bulk-acceptance on items (for example – shifts he’s eligible to work in). Now when the request reaches backend some items has expired.

I can think of showing this info in 2 ways :

  1. Accept eligible items and show error message to user about in-eligible items(remove them from UI).
  2. Ask user to refresh and sync up latest eligible items to perform action on.

selection – “Shopping Cart behaviour” for selecting rows in a table?

I’m currently struggling with the design of a table that would allow the user to select rows/items from a filtered/unfiltered table (probably with a standard checkbox column) and then still keep this selection when the search or filters of the table gets changed.

On top of that “shopping cart” management (add or remove items, or clear the selection), there will be some specific batch actions that can be applied to the selected items; like adding all of them to a group, having those entries deleted (not from the selection, but from the system) and so on.

I considered using a tab that shows a table with the selected rows:

enter image description here

But that is a no-go, since we already use tabs like this to, for example, separate entries by a specific type (something like “current tasks” from “done tasks”).

Right now I’m fiddling with a bar on top of the title row that expands and replaces the “full list” table:

enter image description here

enter image description here

I’m not really happy with this, since the position of the bar will probably confuse the users on what they are seeing on the table and how it relates to that bar.

Using the bar on the bottom is also off the table (pun intended), since we use infinite scroll on tables (that can easily have hundreds of entries) and the navigation buttons (like “next-step”) already sit on a fixed bar on the bottom of the page.

I think that’s it. If anyone can help with examples or ideas, that will be greatly appreciated.

entity – EntityValue evaluation behaviour

I’m puzzled by a behaviour of EntityValue, where I find it being unevaluated. Here is a minimal example. Consider the following custom EntityStore:

store = EntityStore[{
   "Group" -> <|
     "Entities" -> <|
       "GroupA" -> <|
         "name" -> "Group A",
         "size" -> 2,
         "members" -> {
           Entity["Individual", "Claus"],
           Entity["Individual", "Andrea"]
       "GroupB" -> <|
         "name" -> "Group B",
         "size" -> 2,
         "members" -> {
           Entity["Individual", "John"],
           Entity["Individual", "Claudia"]
   "Individual" -> <|
     "Entities" -> <|
       "Claus" -> <|"name" -> "Claus Smith", "age" -> 25|>,
       "Andrea" -> <|"name" -> "Andrea Fisher", "age" -> 35|>,
       "John" -> <|"name" -> "John Allen", "age" -> 45|>,
       "Claudia" -> <|"name" -> "Claudia Wilson", "age" -> 60|>

Let’s register it:


and then query it:

EntityValue["Group", "PropertyAssociation"]

which gives as expected:

  EntityProperty["Group", "members"] -> {Entity["Individual", "Claus"], Entity["Individual", "Andrea"]}, 
  EntityProperty["Group", "name"] -> "Group A", 
  EntityProperty["Group", "size"] -> 2
  EntityProperty["Group", "members"] -> {Entity["Individual", "John"], Entity["Individual", "Claudia"]}, 
  EntityProperty["Group", "name"] -> "Group B", 
  EntityProperty["Group", "size"] -> 2

Now let’s say we’d like to make this association hierarchical by replacing the Individual properties by their own property associations:

ds = assoc /. {Entity["Individual", n_] :> EntityValue[Entity["Individual", n], "PropertyAssociation"]}

This – unexpectedly to me – leaves the inner EntityValue expressions unevaluated:

  EntityProperty["Group", "members"] -> {EntityValue[Entity["Individual", "Claus"], "PropertyAssociation"], EntityValue[Entity["Individual", "Andrea"], "PropertyAssociation"]}, 
  EntityProperty["Group", "name"] -> "Group A", 
  EntityProperty["Group", "size"] -> 2|>,
 <|EntityProperty["Group", "members"] -> {EntityValue[Entity["Individual", "John"],  "PropertyAssociation"], EntityValue[Entity["Individual", "Claudia"], "PropertyAssociation"]}, 
  EntityProperty["Group", "name"] -> "Group B", 
  EntityProperty["Group", "size"] -> 2

What’s going on? Strangely, the inner EntityValue expressions evaluate when we somehow query them directly:

Lookup[ds, EntityProperty["Group", "members"]]

correctly yields

{{<|EntityProperty["Individual", "age"] -> 25, 
   EntityProperty["Individual", "name"] -> "Claus Smith"|>,
  <|EntityProperty["Individual", "age"] -> 35, 
   EntityProperty["Individual", "name"] -> "Andrea Fisher"|>},
 {<|EntityProperty["Individual", "age"] -> 45, 
   EntityProperty["Individual", "name"] -> "John Allen"|>,
  <|EntityProperty["Individual", "age"] -> 60, 
   EntityProperty["Individual", "name"] -> "Claudia Wilson"

Why is this bugging me? I’d like to use this kind of replace mechanism to build up a hierarchical association expression from a hierarchical entity Store. Imagine a cascade of one-to-many relationships, like Continent -> Country -> Region -> City -> Neighbourhood” or something similar. I’d like to build up a hierarchy of associations by iteratively replacing the list of child-entities by their property associations.

So how can I control the evaluation of EntityValue?


proof techniques – why is behaviour of simpl differ so much after a commutative operation and how to inspect simpl?

In Coq, I have this equation in a proof:

S n * S m = S n * m + S n      (* simpl. *)
S (m + n * S m) = m + n * m + S n

Lets look at right hand side of the equation. S n * m + S n was simplified into m + n*m + S n.( by definition of nat, S n = n + 1, hence (n+1)*m = m + n*m).

but if you use plus_comm (the commutative theorem) on the right hand side then perform simpl, it was simplified like following:

(* rewrite <- plus_comm *)
S n * S m = S n + S n * m      (* simpl. *) 
S (m + n * S m) = S (n + (m + n * m))

How was S n + S n * m simplified into S(n + (m + n * m))? How to inspect what atomic tactics simpl had performed under the hood?

javascript – Mixing controlled/uncontrolled behaviour with `getDerivedStateFromProps`

I have a component that displays a bunch of selectable options in a single row. It takes a pageSize prop from the parent component due to responsiveness requirements.

If the pageSize prop ever changes, I need to reset the currentPage (currently active page), which is held in state, to 0.

class OptionsRow extends React.PureComponent {
    state = {
        currentPage: 0
    static getDerivedStateFromProps(props, state) {
        // Reset page on pageSize change
        return {
            currentPage: props.pageSize === state.prevPageSize
                ? state.currentPage
                : 0,
            prevPageSize: props.pageSize

This code works as intended.

The reason I’m asking for a review is that React in it’s documentation warns against getDerivedStateFromProps so I’m not sure if this is a correct usage. In order to avoid derived state, it recommends making the component completely controlled/uncontrolled, so I should lift the currentPage up to the parent component. But is this really necessary? Is something wrong with my solution except for “verbose code”?

Thank you!