are base change and restriction of scalars "inverses" in this case?

Question: Let $l/k$ be a finite extension of fields. Let $G$ be an affine $k$-groups scheme. Let $G_l = G \times_k l$. Is it true that $\mathfrak{R}_{l/k}(G_l) = G$, where $\mathfrak{R}_{l/k}(-)$ is the restriction of scalars?
This appears to be false. So my new question is:
Is it true that $\mathfrak{R}_{l/k}(G_l) = G^{[l:k]}$?
Answer: What does "=" mean here, and do you have any examples of group schemes where this holds for some nontrivial extension?
If $k = \mathbb{R}$, $l=\mathbb{C}$, and $G=\operatorname{Spec} \mathbb{C}$, then certainly something goes wrong, as $G\times_k l$ is isomorphic to two copies of $G$.  This is a counterexample to every interpretation I can think of to the problem, but it's possible that I'm overlooking something.
Comment: Oh, I see. Would this statement instead  be true then:  $\mathfrak{R}_{l/k}(G_l) = G^d$, where $d = [l:k]$?
Comment: @user187180 This is easily seen to be false for $G=\operatorname{Spec} \mathbb{R}$.  What is your goal here?
Comment: @user187180 We will get some degree $d$ cover in general, which may also include nilpotents if we have an inseparable extension.
Answer: They are not inverses, but adjoints.  For all affine $k$-group schemes $G$ and $l$-group schemes $H$, there is a bijection
$$\operatorname{Hom}_{\textrm{$l$-grp}}(G \times_k l,H) = \operatorname{Hom}_{\textrm{$k$-grp}}(G, \mathfrak R_{l/k}(H))$$
which is natural in $G$ and $H$.  In particular, if we fix $G$ and let $H = G \times_k l$, then we get a bijection
$$\operatorname{Hom}_{\textrm{$l$-grp}}(G \times_k l,G \times_k l) = \operatorname{Hom}_{\textrm{$k$-grp}}(G, \mathfrak R_{l/k}(G \times_k l))$$
and therefore a special homomorphism $G \rightarrow \mathfrak R_{l/k}(G \times_k l)$ over $k$ coming from the identity map on $G \times_k l$.  But it is not an isomorphism.
For example, let $H$ be the additive group over $l$.  To make life easy, assume $l/k$ is quadratic.  Let $\Omega$ be a separable closure of $k$ containing $l$, and $\sigma$ is an element of $\operatorname{Gal}(\Omega/k)$ whose restriction to $l$ is not trivial .  If we identify $\mathscr R_{l/k}(H)$ with its $\Omega$-points, it is the group $\Omega \times \Omega$, on which $\sigma$ has the effect $\sigma.(x,y) = (\sigma(y),\sigma(x))$.  If $\sigma$ does restrict to the identity on $l$, then $\sigma.(x,y) = (y,x)$.
Given a homomorphism $f: G \times_k l \rightarrow H$ over $l$, the corresponding $k$-group homomorphism $G \rightarrow \mathscr R_{l/k}(H)$ is defined on $\Omega$-points by $x \mapsto (f(x),f(x))$.
In particular, taking $G = \mathbf G_{a,k}$, so that $H = \mathbb G_{a,l} = G \times_k l$, the canonical map $G \rightarrow \mathfrak R_{l/k}(H)$ is the diagonal map $x \mapsto (x,x)$, which is not an isomorphism.


Let $a\in \mathbb Z$ be such that $a=b^2+c^2,$ where $b,c\in \mathbb Z-\{0\}.$ Then $a$ can be written as ...

Question:
Let $a\in \mathbb Z$ be such that $a=b^2+c^2,$ where $b,c\in \mathbb
 Z-\{0\}.$ Then $a$ can be written as
$(1)pd^2,$ where $d\in \mathbb Z$ and $p$ is a prime with
$p\equiv1\pmod  4$
$(2)pd^2,$ where $d\in \mathbb Z$ and $p$ is a prime with
$p\equiv3\pmod  4$
$(3)pqd^2,$ where $d\in \mathbb Z$ and $p,q$ are primes with
$p\equiv1,\pmod  4$,$q\equiv3\pmod  4$
$(4)pqd^2,$ where $d\in \mathbb Z$ and $p,q$ are distinct primes with
$p,q\equiv3\pmod  4$

Counter-Example for option 2
$5=2^2+1^2$ but $5\not\equiv 3(mod 4)$
Counter-Example for option 3
$25=3^2+4^2,25=5.5.1^2,5\equiv1(mod4)$ but $5\not\equiv3(mod4)$

What is the explicit counterexample for option (4)?
Also,how to prove option (1)?
Comment: I think you are misreading.  Surely it says something to the effect of "some, but not all,  $a$ which are expressible as $b^2+c^2$ can be written, etc."  My number, $5\times 13\times 17=1105$ , can not be written in any of the forms you list.
Comment: I don't understand the meaning of your "counterexamples". Option $2$, for example asserts  that there is no natural number, expressible as the sum of two squares, of the form $pd^2$ with $p\equiv 3\pmod 4$.  It does not assert that *all* natural numbers, expressible as the sum of two squares, must take that form.  So...producing an example like $5$ doesn't prove anything.
Comment: You could, however, use $5$ as a counterexample to option $1$. Indeed,  $5$ is an example which contradicts option $1$, so we see that option $1$ is false.
Comment: @lulu:but,5 can be expressed as $5.1^2$ and $5\equiv 1\pmod 4$...how can it be counterexample?
Comment: The claim behind option $1$ is that if $a\in \mathbb N$  can be written as $b^2+c^2$ for natural numbers $b,c$ then $a$ *cannnot* be written as $pd^2$ where $p\equiv 1 \pmod 4$.  To see that $5$ is a counterexample to that claim, note that $5=1^2+2^2$ and $5=5\times 1^2$ where $5\equiv 1 \pmod 4$.  Thus option $1$ is False.
Comment: @lulu:I've changed the question,please note it...I've replaced "cannot " with "can"
Comment: Post edit, now none of those options are correct and you should easily be able to produce counterexamples to each of them.  The original version made more sense.
Comment: @lulu:in order to make the "unique" option to be correct ,i done it so
Comment: Not sure what you mean.  In any case, all those options are incorrect.  A single counterexample works for all of them...$5\times 13\times 17=24^2+23^2$ for one.
Comment: @lulu: in the answer key ,it is given that $a$ can represented in the form  as given in option(1) only...
Comment: @lulu:what is $d^2$ in your example?
Comment: @lulu:you're correct about the  representation of $a$,but i think you ignored the "forms" of $p,q$ for example In example 1,we have to take into consideration only those primes $"p"$ ,which are of the form $p=4k+1$
Answer: Due to the Sum of two squares theorem for (2), (3) and (4) you anyway would have the left side ($a$) to have a factor $p^{2k+1}$ in its prime decomposition. So (2), (3) and (4) cannot represent $a$.


Dragging div elements and then switching places with another element

Question: So I'm trying to program a bejeweled like game in javascript but instead of clicking a jewel then clicking another jewel to make them switch positions, I want to the player to click on a jewel then drag to another jewel to make them switch places. In the code I use the variable orb as jewels.
function makeOrb(orb, x, y) {
    orb.className = "orb";
    var bejeweledarea = document.getElementById("bejeweledarea");
    bejeweledarea.appendChild(orb);
    var random = Math.round(Math.random() * (colors.length - 1));
    orb.style.backgroundColor = colors[random];
    orb.style.position = "absolute";
    orb.style.top = y + "px";
    orb.style.left = x + "px";
    orb.onmousedown = activate;
    if (activeSwitching) {
        orb.onmouseover = switchOrbs(activeOrb, orb);
    }
}

function activate() {
    activeSwitching = true;
    activeOrb = this;
}

function switchOrbs(orb, otherOrb) {
    var oldTop = orb.style.top;
    var oldLeft = orb.style.left;
    orb.style.top = otherOrb.style.top;
    orb.style.left = otherOrb.style.left;
    otherOrb.style.top = oldTop;
    otherOrb.style.left = oldLeft;
}

My could will register the activeSwitching as true but for some reason the mouseover event doesn't ever work.
Answer: You are now adding a onmouseover event to the orb that has just been clicked. I assume you want all the other orbs to have an onmouseover event that calls switchOrbs, right? Because you want to switch the orbs when the activated is hovered over an other orb.
You could add that mouseover event to all the orbs. In that function you then check if activeSwitching = true. If so, you perform the routine to switch. Otherwise you stop, since there is no activated orb and the program needs to wait for a orb.onmousedown / activate() call.
Edit: outline for the code
$(".orbs").on("mouseover", function() {
  // `this` is the orb that is being hovered
  if( currentActiveOrb != null ) {
    switch(this, currentActiveOrb);
  }
}).on("mousedown", function() {
  // `this` is the orb that is being clicked
  currentActiveOrb = this;
}).on("mouseup", function() {
  currentActiveOrb = null;
});

function switch(hovered, active) {
  // Code to switch the orbs.
}

Comment: Yes you are right. I want the other orbs to have the onmouseover event. How do I go about adding the event to all the orbs? Could you elaborate a little more?
Comment: I added a pseudo-outline.


Embed image in mail Body using mailto function

Question: I am using mailto function my requirement is like to embed image inside mail body
<code> $scope.generateMail = function () {
        var graph = document.getElementById('thumb_graphs_grp');
        html2canvas(graph).then(function(canvas) {
        var dataURL = canvas.toDataURL();
        var image = new Image();
        image.src = canvas.toDataURL("image/png");
        var imageHTML = "<img " + "src='" + image.src + "' img/>";
        var link = "mailto:firstname.lastname@example.com?subject=Mail request&body="+ imageHTML;
        window.location.href = link;
    });
</code>
Comment: I want the image inside mail body but i am converting to data url is their any other way to append the image inside mail body?
Answer: As stated in the RFC2368, it's not possible to include HTML with mailto:

The special hname "body" indicates that the associated hvalue is the
  body of the message. The "body" hname should contain the content for
  the first text/plain body part of the message. The mailto URL is
  primarily intended for generation of short text messages that are
  actually the content of automatic processing (such as "subscribe"
  messages for mailing lists), not general MIME bodies.


How do I extend an ES6 class with ES5?

Question: The reasons for doing this are complicated, but it boils down to flow not understanding mixins or any other way of modifying an ES6 class's prototype.  So I'm falling back to ES5, but I can't figure out how to call the constructor of an ES6 class without new:
class A {
  constructor() {}
}

function B() {
  // what do I put here?  I would do something like
  // A.prototype.constructor.call(this) but that throws an error saying the
  // constructor can only be called with `new`
}
B.prototype = Object.create(A.prototype);

Comment: Is there a specific reason why you want to avoid using `new`? I think calling `new` is the only (and is the *correct*) way to do it
Answer: Answering this myself:
class A {
  constructor() {}
}

function B() {
  Object.assign(this, new A());
}
B.prototype = Object.create(A.prototype);

Not sure if there are any side-effects here or not
Comment: I thought you want to call the constructor without `new` ?
Comment: Anyway, most probably in no way we can skip the keyword `new` based on my understanding from this spec http://www.ecma-international.org/ecma-262/6.0/#sec-ecmascript-function-objects-construct-argumentslist-newtarget
Comment: I just want B to extend A, the ES5 way of doing that is to do `A.call(this)` from within B, sorry if the phrasing in my question implied a different intent

How do I extend an ES6 class with ES5?


Facebook Login SDK Language Issue in iOS

Question: I have define login behavior of fbsdk to FBSDKLoginBehavior.web but the issue i am facing is that it always get open in Arabic and when I try to change language it redirects to safari instead of changing language on webview of application. Any help will be appreciated.
Comment: Hi @Muhammad, Did you get any solution?
Comment: Sadly but we dont have any solution for it  yet
Comment: what's your device default language?
Answer: Change login behavior of the FBSDKLoginManager object before making the login call.
<code>let login = FBSDKLoginManager()
login.loginBehavior = .systemAccount;
</code>
And also upgrade to the latest Facebook SDK which is available at the following link, or update your pod if you are using Cocoapods. Also don't forget to uninstall the App and install again before testing.


player level specification for missons in skyrim

Question: I was playing Skyrim when I got the embassy quest in the main missions. When I got into battle with the guards I found them (even a single one) hard to defeat. So I thought I did not have a high enough level (my level was 8). Then I thought of abandoning the mission but I had no saves to load.

What should I do now?
Is there a reference to know which missions should be started at what level ?
I heard enemies get stronger as the player gets stronger. So even if I level up and then get back to this mission it wouldn't help would it ?
Comment: BTW i'am playing it on X-box
Comment: You'll find that you get better answers if you pose clear questions (and preferably only one at a time). I was going to edit your question to clarify it, but I can't tell what the actual question is.
Answer: Appropriate player levels for quests and dungeons in general is too complex a topic, for a couple reasons, including:

Quests in the main story line or in faction story lines generally have a minimum level.
Enemies other than bosses have a minimum and maximum level and are scaled to player level within those ranges.
Dungeons are generally scaled to player level when they are entered, but that level is not reset if the player leaves without clearing the dungeon.
For some quests, skills or spells used matter more than general player level.

Both the Elder Scrolls Wiki and the Unofficial Elder Scrolls Pages have level information on named quests, dungeons, and enemies. There is also a page of hints on when to start missions and in which order, although most of the suggestions are vague and more a matter of personal preference.
For the Diplomatic Immunity quest specifically, Delphine describes the mission as an infiltration, so it's better to focus on non-violent approaches to solving the mission. Some mix of thief or mage skills are the best options, although potions and enchanted items may offer good substitutes.  Without revealing any spoilers, both character race and gear can help avoid several combats without worrying about either character or skill levels. Only the end of the mission requires combat.
If you need to know enemy level details for Diplomatic Immunity, all the enemies are Thalmor, mostly generic types of level 1 through 36 (1 through 44 for Thalmor Wizards.)
Answer: Skyrim creatures and npc are leveled, so just coming back later without better gear won't change the outcome, leave the area ond do other quest or look for unique loot
if you feel like "cheating", level up bow skills and get the stealth perk that increases damage when undetected, only dragons can stand more than 1-2 sneak hits in vanilla skyrim
Comment: i'am where the Malborn locks the dor behind me how can i get out ?
Comment: @user119614 Welcome to Gaming SE. Please try to back up your claims with credible source whenever possible.
Comment: @kiyarash You can load an earlier save.
Comment: @Svj0hn, read the whole post. He has no saves to load (although why this is, is beyond my understanding)
Comment: @DangerZone Ah, I see. Better force through it then.
Comment: "so just coming back later without better gear..." -  as if skyrim is about gear. as long as you got equip which is somewhat appropriate for your level you're fine. and coming back later makes things usually a _lot_ easier because you get perks, this point alone is bringing significant advantages. besides that: new shouts can also give huge boosts against certain enemy types. for example: if you play some melee-ish character it is important to get in range with casters before they melt your face off, so a dragon shout that can freeze enemies is completely shifting the balance there.


What is wrong with my color selection?

Question: Our customer said they wanted a minimalistic user interface, with a Windows 8 feel. However, I am a developer and do not have any experience with user interfaces. So, I went ahead and found the color codes Microsoft uses and now it looks like a unicorn puked into my program.

There are really good UIs out there, I just cannot figure out what the problem with mine is. I did a "dark theme" to figure out if it was about placements, but guess it is not.

What is the main weakness of my design or color selection?
Explanation about the UI:
The buttons on the left are for selecting forms. The rest of the screen changes according to the form selection.
I am using winforms, if it matters.
Comment: Thanks. I am trying your great suggestions. I will get back when I'm done.
Comment: This would be an appropriate question for [GraphicDesign.SE].
Comment: Well it is Windows 8 :)
Answer: The metro interface is actually made of one color in two shades, a dark one in the background and light one for the tiles. The dark color can be replaced by gray. You never get real black in any of microsoft's interfaces, and you don't get two different colors.
The other colors come from content displayed on live tiles - photos and videos, mainly, but also applications' specific colors - and they are usually less bright and less saturated.
If you take a look at the outlook or the office cloud designs, you'll see they follow the same rules (using white, grey and orange OR blue).
Black and bright colors are both very agressive on screen. You shouldn't use both at the same time.
Answer: It may not be your color scheme -- it may be that in your layout, nothing "wins", and there is a lot of visual noise.
Every selection looks equal in importance, but I'm sure they are not all equal. Make your hierarchy of information visual. Maybe your default button should be larger than the other choices. Let the thing that is most important to the user win the bid for attention.
There is also little visual interest, because everything is a box. Provide some contrast by varying sizes or shapes.
There is a lot of visual noise. All those different colors are competing for attention. What if instead of making each of the left side items big colored boxes, you made them all gray, and only applied a stripe of color to the left edge? A lighter hand with color might help.
Or, hire a visual designer. :-)
Answer: I wouldn't use black as your background. It's way too much of a contrast between the content you have. Windows UI also has quite a colorful UI palette.
If you're looking for something minimal, but less "colors of the rainbow", I would look at alternative minimalism UI examples and take inspiration from those. Take a look at Mailchimp, Zendesk and  Desk's UI. They are still minimal and very easy to understand.
So far your explanation for adopting the metro ui style is because you're users said they like it. They may like it for the Windows OS, but that doesn't mean you should copy it for your own app. It sounds like your users just want something simple and easier to understand.
Answer: Gradients
Adding on to Linda's point, I would suggest use of a slight gradient to make each element a little softer than one bold color on top of another.
Visuals
The Windows UI also makes use of bold white visuals to break up the monotony, which could help. Place a huge white icon in the middle of each of your buttons and add a small text on the bottom left corner with the description. Also, change up the sizes. The Windows UI does a good job of changing up the sizes so they all fit in together, but two elements next to each other are rarely the same sizes. They alternate between squares and rectangles.
Contrast
The current contrast on the screen is making it a little bit of an eyesore. Use a colored background and overlay hues of the same color. i.e., instead of using red, blue, yellow, green use light blue, dark blue, purple, lighter purple, soft red etc. Colors that aren't totally opposite of each other on the color wheel tend to flow better when seen together.
Comment: I thought with Metro, gradients were so "Yesterday"
Comment: @Mark0978 Yes and no. Overall, Windows modern UI wants to give off this look of solid colors. But they do in fact use shadows and lights to give that softer gradient-like appearance. For example, the mail button here: http://i1-news.softpedia-static.com/images/news2/Expert-on-Windows-8-Interface-Confusing-Burden-on-User-s-Memory-2.png?1345543247

What is wrong with my color selection?


How to convert Signed Binary to Integer in Verilog?

Question: I am trying to convert signed binary numbers to integer in verilog for synthesis to display, I have a couple of questions. Below is my code,
.....
if(acc[i][j]>10)               //acc is a 2d register

begin
  m_reg <= j-const_10;        // const_10 is 16'b0000000000001010
  m_int <= m_reg;
  $display("Current value of M(bits)=%b",m_reg);
  $display("Current value of M(int)=%d",m_int);
end
else
....

j can be less than 10, meaning m_reg can be negative. In that case, I am assuming m_reg will give me a signed binary negative number.
If it does, how do I convert it to an integer to display because I guess m_int = m_reg will give me only unsigned.
Comment: Unless you have fractional bits in your number it is an integer. Reg or logical can be declared as signed.
Comment: Ignore the "synthesis to display" part, I meant to say I am coding for synthesis eventually, but in this case I want to display the results just to to analyze it.
Comment: So if I declare the reg as reg signed [15:0] and then do m_int<=m_reg, It would display it as a negative integer? There are no fractional bits.
Comment: yes, but why do the copy to m_int? just do `$display("Current value of M(bits)=%d",m_reg);`
Comment: Oh! Never knew I could print it like that. Thanks! That works!
Answer: All data is 'binary' when displaying we have the choice of visualising in binary, decimal of hexadecimal. When inputing data we have the same choice but what is set and stored remains the same.
These are all the same:
a = 4'b1111;
a = 4'd15;
a = 4'hf;

To display in the given format:
$display("Binary  %b", a);
$display("Decimal %d", a);
$display("Hex     %h", a);

Leading 0's are not displayed, at least for decimal so min widths can be used.
$display("min of 2 Decimal   %2d", a);

Dealing with signed numbers: declare the reg, logic or wire as signed, or convert when displaying.
reg        [3:0] a;
reg signed [3:0] a_s;

initial begin
  a   = 4'b1111; // is this 15 or -1 depends on if you read as signed
  a_s = 4'b1111; // -1
  #1ns;
  $display("Decimal converted to signed %d", $signed(a));
  $display("Signed Decimal              %d", a_s);
end


Do things like Lifesteal and Knockback stack?

Question: If I have 2 pieces of gear which both have knockback at 2.0%, do I get a 4% total?
What about if I have gear with lifesteal and use a passive skill (like Bloodthirst for the Barbarian) to increase my lifesteal? Do they stack?
Comment: They certainly should, but be aware that life steal and CC effects have diminishing results in higher difficulties.
Answer: Sure, they do stack both. "Life steal" is however diminished by a factor 5 in inferno. You'll be able to use it up to hell. You should stack "Life on Hit" for inferno.
Answer: Yes, you can get bonuses from multiple sources for almost any skill and it will stack.
Life Steal from weapons, armor, passive skills (Bloodthirst), active skills (Furious Charge/Dreadnought) is additive, you will get the total amount which is then reduced per difficulty level.
The contribution of a skill or item to the stat isn't reduced, but its actual effect changes - so e.g. you'd need to get 50% life steal in Inferno to get 10% leeching.
Unlike other games (incl. Diablo 2), most of these don't have hard caps as the lower bonus values effectively soft cap the maximum amounts you can obtain. One notable exception is Run Speed, which is capped to 25% from items but can be raised further by skills (e.g. Sprint).
Also, Dodge has a non-linear relation to Dexterity, and stacks multiplicatively from sources so it may be non-intuitive on how much adding some equipment will increase the stat.
Comment: Added more info on life leech in Inferno; does that help or were you asking about RS or dodge?
Comment: Thanks for the information, but the other answer said that skills aren't reduced. Are you sure they are reduced too? The source you linked to seems to think they are reduced too.


How to add a prototype function to an external framework?

Question: I am wondering how to add my own function to an object, built by a framework. So, the framework is vis.js and I want to add the function to the DataSet object.
A dataset is generated with:
var myDataSet = new vis.DataSet();

So I figured
vis.DataSet.prototype.addFormattedNode = function () {...}

could do the trick. Sadly, Chrome Dev Tool reports:
Uncaught ReferenceError: DataSet is not defined

which is probably based on the fact, that the vis framework is not yet loaded, right? I tried adding the prototype in the dev tools (after everything is loaded) and it works. One could do that, but I am looking for the "right way" without dirty hacks :-)
Any ideas or best practices for this?
Thanks!
Answer: Your solution
vis.DataSet.prototype.addFormattedNode = function () {...}

is should indeed just work. Of course that will only work if vis is loaded first, so you have to load stuff in the right order.
A more neat solution would be to create an extension of the prototype like this:
function MyDataSet (data, options) {
  vis.DataSet.call(this, data, options);
}

MyDataSet.prototype = new vis.DataSet();

MyDataSet.prototype.addFormattedNode = function () {
  // ...
};

Then you can use MyDataSet instead of vis.DataSet.
Comment: Works, thank you! First I had problems understanding your idea... So here is my fiddle, if anyone else needs it: http://jsfiddle.net/andrelung/c6fr4w1a/


Using xCode in a .net application

Question: I have a mac application(written with xcode) i have to write a .net application that uses this code. what is the best practice in this case?
Comment: I have a mac application that i have to rewrite as a asp .net application, i don't want to rewrite the core code(the algorithm)  so i want to wrap it with a .net managed interface
Comment: Could you provide more details about your scenario? What are those applications supposed to do?
Answer: If it's in objective-c, then you should probably try to get it working with Cocotron, not .NET.
If you absolutely need .NET.  Use the GNU objective-c compiler to make .lib files for as much as possible and then I guess rewrite the GUI in .NET.  Wrap the .lib in a C++/CLI assembly with managed interfaces that you can call from your .NET application.

Using xCode in a .net application


Having a link appear after the 4th paragraph on an HTML page in Jquery

Question: So I am in a JavaScript/Jquery class and for my current assignment I need to insert a back to top link after the 4th paragraph within an article. I have seem that this is a way to select a specific paragraph:
$("p").eq(1).css("background-color", "yellow");

I need to figure out how to use that with the existing Jquery:
  // Add "back to top" links.
  $('back to top').insertAfter('article.chapter p');
  $('').prependTo('body');

My thought was to do this:
  // Add "back to top" links.
  $('back to top').insertAfter("article.chapter p").eq(3).
  $('').prependTo('body');

That is not working and I just learned about this technique earlier today. What is the best way to do this.
Here's the HTML:
<!DOCTYPE html>

    <meta charset="utf-8">
    <title>Flatland</title>

    <link rel="stylesheet" href="05.css" type="text/css" />

Flatland: A Romance of Many Dimensions

by Edwin A. Abbott

Part 1, Section 3

Concerning the Inhabitants of Flatland

an excerpt

Our Professional Men and Gentlemen are Squares (to which class I myself belong) and Five-Sided Figures or Pentagons.

Next above these come the Nobility, of whom there are several degrees, beginning at Six-Sided Figures, or Hexagons, and from thence rising in the number of their sides till they receive the honourable title of Polygonal, or many-Sided. Finally when the number of the sides becomes so numerous, and the sides themselves so small, that the figure cannot be distinguished from a circle, he is included in the Circular or Priestly order; and this is the highest class of all.

It is a Law of Nature with us that a male child shall have one more side than his father, so that each generation shall rise (as a rule) one step in the scale of development and nobility. Thus the son of a Square is a Pentagon; the son of a Pentagon, a Hexagon; and so on.

But this rule applies not always to the Tradesman, and still less often to the Soldiers, and to the Workmen; who indeed can hardly be said to deserve the name of human Figures, since they have not all their sides equal. With them therefore the Law of Nature does not hold; and the son of an Isosceles (i.e. a Triangle with two sides equal) remains Isosceles still. Nevertheless, all hope is not such out, even from the Isosceles, that his posterity may ultimately rise above his degraded condition.…

Rarely—in proportion to the vast numbers of Isosceles births—is a genuine and certifiable Equal-Sided Triangle produced from Isosceles parents. "What need of a certificate?" a Spaceland critic may ask: "Is not the procreation of a Square Son a certificate from Nature herself, proving the Equal-sidedness of the Father?" I reply that no Lady of any position will marry an uncertified Triangle. Square offspring has sometimes resulted from a slightly Irregular Triangle; but in almost every such case the Irregularity of the first generation is visited on the third; which either fails to attain the Pentagonal rank, or relapses to the Triangular. Such a birth requires, as its antecedents, not only a series of carefully arranged intermarriages, but also a long-continued exercise of frugality and self-control on the part of the would-be ancestors of the coming Equilateral, and a patient, systematic, and continuous development of the Isosceles intellect through many generations.

The birth  of a True Equilateral Triangle from Isosceles parents is the subject of rejoicing in our country for many furlongs round. After a strict examination conducted by the Sanitary and Social Board, the infant, if certified as Regular, is with solemn ceremonial admitted into the class of Equilaterals. He is then immediately taken from his proud yet sorrowing parents and adopted by some childless Equilateral. The Equilateral is bound by oath never to permit the child henceforth to enter his former home or so much as to look upon his relations again, for fear lest the freshly developed organism may, by force of unconscious imitation, fall back again into his hereditary level.

How admirable is the Law of Compensation! And how perfect a proof of the natural fitness and, I may almost say, the divine origin of the aristocratic constitution of the States of Flatland! By a judicious use of this Law of Nature, the Polygons and Circles are almost always able to stifle sedition in its very cradle, taking advantage of the irrepressible and boundless hopefulness of the human mind.…

Then the wretched rabble of the Isosceles, planless and leaderless, are ether transfixed without resistance by the small body of their brethren whom the Chief Circle keeps in pay for emergencies of this kind; or else more often, by means of jealousies and suspicious skillfully fomented among them by the Circular party, they are stirred to mutual warfare, and perish by one another's angles. No less than one hundred and twenty rebellions are recorded in our annals, besides minor outbreaks numbered at two hundred and thirty-five; and they have all ended thus.

Read the complete text of Flatland.

I also need to bold the author's name when clicking on it and then remove that bold when I click it again.
This is what I have, only half of it works:
  //  Clicking on authors name makes it bold
  $("#f-author").one ("click", function() {
    $(this).wrap("");
  });

  $("#bold").one ("dblclick", function() {
    $(this).remove();
  });

Thank you.
One thing that is confusing the hell out of me, I need to add the class "inhabitants" to all the paragraphs in the chapter section without using the addClass() call. I have looked at several options, the one that worked the best, but made messy html was to wrap all the paragraphs with a new paragraph element with that class on that. I don't know what else to use for this, because some of the paragraphs already have a class and those need to be persevered.
Comment: Try using the [`:eq` *selector*](https://api.jquery.com/eq-selector/) instead of the [`eq()` *method*](https://api.jquery.com/eq/):  `.insertAfter("article.chapter p:eq(3)");`
Answer: You need to use insertAfter("article.chapter p:eq(3)") so that the fourth p is selected. Notice the pseudo class :eq(3) inside insertAfter which will select only the fourth paragraph from the list of paragraphs.
Also, if you want the link after each four paragraph then you need to loop through the paragraphs and set the :eq() dynamically.

var i = 4;
var elem = $('article.chapter p');
$('').prependTo('body');
while(i<=elem.length){
  $('back to top').insertAfter("article.chapter p:eq("+(i-1)+")");
  i+=4;
}

Our Professional Men and Gentlemen are Squares (to which class I myself belong) and Five-Sided Figures or Pentagons.

Next above these come the Nobility, of whom there are several degrees, beginning at Six-Sided Figures, or Hexagons, and from thence rising in the number of their sides till they receive the honourable title of Polygonal, or many-Sided. Finally when the number of the sides becomes so numerous, and the sides themselves so small, that the figure cannot be distinguished from a circle, he is included in the Circular or Priestly order; and this is the highest class of all.

It is a Law of Nature with us that a male child shall have one more side than his father, so that each generation shall rise (as a rule) one step in the scale of development and nobility. Thus the son of a Square is a Pentagon; the son of a Pentagon, a Hexagon; and so on.

But this rule applies not always to the Tradesman, and still less often to the Soldiers, and to the Workmen; who indeed can hardly be said to deserve the name of human Figures, since they have not all their sides equal. With them therefore the Law of Nature does not hold; and the son of an Isosceles (i.e. a Triangle with two sides equal) remains Isosceles still. Nevertheless, all hope is not such out, even from the Isosceles, that his posterity may ultimately rise above his degraded condition.…

Rarely—in proportion to the vast numbers of Isosceles births—is a genuine and certifiable Equal-Sided Triangle produced from Isosceles parents. "What need of a certificate?" a Spaceland critic may ask: "Is not the procreation of a Square Son a certificate from Nature herself, proving the Equal-sidedness of the Father?" I reply that no Lady of any position will marry an uncertified Triangle. Square offspring has sometimes resulted from a slightly Irregular Triangle; but in almost every such case the Irregularity of the first generation is visited on the third; which either fails to attain the Pentagonal rank, or relapses to the Triangular. Such a birth requires, as its antecedents, not only a series of carefully arranged intermarriages, but also a long-continued exercise of frugality and self-control on the part of the would-be ancestors of the coming Equilateral, and a patient, systematic, and continuous development of the Isosceles intellect through many generations.

The birth  of a True Equilateral Triangle from Isosceles parents is the subject of rejoicing in our country for many furlongs round. After a strict examination conducted by the Sanitary and Social Board, the infant, if certified as Regular, is with solemn ceremonial admitted into the class of Equilaterals. He is then immediately taken from his proud yet sorrowing parents and adopted by some childless Equilateral. The Equilateral is bound by oath never to permit the child henceforth to enter his former home or so much as to look upon his relations again, for fear lest the freshly developed organism may, by force of unconscious imitation, fall back again into his hereditary level.

How admirable is the Law of Compensation! And how perfect a proof of the natural fitness and, I may almost say, the divine origin of the aristocratic constitution of the States of Flatland! By a judicious use of this Law of Nature, the Polygons and Circles are almost always able to stifle sedition in its very cradle, taking advantage of the irrepressible and boundless hopefulness of the human mind.…

Then the wretched rabble of the Isosceles, planless and leaderless, are ether transfixed without resistance by the small body of their brethren whom the Chief Circle keeps in pay for emergencies of this kind; or else more often, by means of jealousies and suspicious skillfully fomented among them by the Circular party, they are stirred to mutual warfare, and perish by one another's angles. No less than one hundred and twenty rebellions are recorded in our annals, besides minor outbreaks numbered at two hundred and thirty-five; and they have all ended thus.

 that a male child shall have one more side than his father so that each generation shall rise (as a rule) one step in the scale of development and nobility. Thus the son of a Square is a Pentagon; the son of a Pentagon, a Hexagon; and so on.

But this rule applies not always to the Tradesman, and still less often to the Soldiers, and to the Workmen; who indeed can hardly be said to deserve the name of human Figures, since they have not all their sides equal. With them therefore the Law of Nature does not hold; and the son of an Isosceles (i.e. a Triangle with two sides equal) remains Isosceles still. Nevertheless, all hope is not such out, even from the Isosceles, that his posterity may ultimately rise above his degraded condition.…

Rarely—in proportion to the vast numbers of Isosceles births—is a genuine and certifiable Equal-Sided Triangle produced from Isosceles parents. "What need of a certificate?" a Spaceland critic may ask: "Is not the procreation of a Square Son a certificate from Nature herself, proving the Equal-sidedness of the Father?" I reply that no Lady of any position will marry an uncertified Triangle. Square offspring has sometimes resulted from a slightly Irregular Triangle; but in almost every such case the Irregularity of the first generation is visited on the third; which either fails to attain the Pentagonal rank, or relapses to the Triangular. Such a birth requires, as its antecedents, not only a series of carefully arranged intermarriages, but also a long-continued exercise of frugality and self-control on the part of the would-be ancestors of the coming Equilateral, and a patient, systematic, and continuous development of the Isosceles intellect through many generations.

The birth  of a True Equilateral Triangle from Isosceles parents is the subject of rejoicing in our country for many furlongs round. After a strict examination conducted by the Sanitary and Social Board, the infant, if certified as Regular, is with solemn ceremonial admitted into the class of Equilaterals. He is then immediately taken from his proud yet sorrowing parents and adopted by some childless Equilateral. The Equilateral is bound by oath never to permit the child henceforth to enter his former home or so much as to look upon his relations again, for fear lest the freshly developed organism may, by force of unconscious imitation, fall back again into his hereditary level.

 that a male child shall have one more side than his father so that each generation shall rise (as a rule) one step in the scale of development and nobility. Thus the son of a Square is a Pentagon; the son of a Pentagon, a Hexagon; and so on.

But this rule applies not always to the Tradesman, and still less often to the Soldiers, and to the Workmen; who indeed can hardly be said to deserve the name of human Figures, since they have not all their sides equal. With them therefore the Law of Nature does not hold; and the son of an Isosceles (i.e. a Triangle with two sides equal) remains Isosceles still. Nevertheless, all hope is not such out, even from the Isosceles, that his posterity may ultimately rise above his degraded condition.…

Rarely—in proportion to the vast numbers of Isosceles births—is a genuine and certifiable Equal-Sided Triangle produced from Isosceles parents. "What need of a certificate?" a Spaceland critic may ask: "Is not the procreation of a Square Son a certificate from Nature herself, proving the Equal-sidedness of the Father?" I reply that no Lady of any position will marry an uncertified Triangle. Square offspring has sometimes resulted from a slightly Irregular Triangle; but in almost every such case the Irregularity of the first generation is visited on the third; which either fails to attain the Pentagonal rank, or relapses to the Triangular. Such a birth requires, as its antecedents, not only a series of carefully arranged intermarriages, but also a long-continued exercise of frugality and self-control on the part of the would-be ancestors of the coming Equilateral, and a patient, systematic, and continuous development of the Isosceles intellect through many generations.

The birth  of a True Equilateral Triangle from Isosceles parents is the subject of rejoicing in our country for many furlongs round. After a strict examination conducted by the Sanitary and Social Board, the infant, if certified as Regular, is with solemn ceremonial admitted into the class of Equilaterals. He is then immediately taken from his proud yet sorrowing parents and adopted by some childless Equilateral. The Equilateral is bound by oath never to permit the child henceforth to enter his former home or so much as to look upon his relations again, for fear lest the freshly developed organism may, by force of unconscious imitation, fall back again into his hereditary level.

 that a male child shall have one more side than his father so that each generation shall rise (as a rule) one step in the scale of development and nobility. Thus the son of a Square is a Pentagon; the son of a Pentagon, a Hexagon; and so on.

But this rule applies not always to the Tradesman, and still less often to the Soldiers, and to the Workmen; who indeed can hardly be said to deserve the name of human Figures, since they have not all their sides equal. With them therefore the Law of Nature does not hold; and the son of an Isosceles (i.e. a Triangle with two sides equal) remains Isosceles still. Nevertheless, all hope is not such out, even from the Isosceles, that his posterity may ultimately rise above his degraded condition.…

Rarely—in proportion to the vast numbers of Isosceles births—is a genuine and certifiable Equal-Sided Triangle produced from Isosceles parents. "What need of a certificate?" a Spaceland critic may ask: "Is not the procreation of a Square Son a certificate from Nature herself, proving the Equal-sidedness of the Father?" I reply that no Lady of any position will marry an uncertified Triangle. Square offspring has sometimes resulted from a slightly Irregular Triangle; but in almost every such case the Irregularity of the first generation is visited on the third; which either fails to attain the Pentagonal rank, or relapses to the Triangular. Such a birth requires, as its antecedents, not only a series of carefully arranged intermarriages, but also a long-continued exercise of frugality and self-control on the part of the would-be ancestors of the coming Equilateral, and a patient, systematic, and continuous development of the Isosceles intellect through many generations.

The birth  of a True Equilateral Triangle from Isosceles parents is the subject of rejoicing in our country for many furlongs round. After a strict examination conducted by the Sanitary and Social Board, the infant, if certified as Regular, is with solemn ceremonial admitted into the class of Equilaterals. He is then immediately taken from his proud yet sorrowing parents and adopted by some childless Equilateral. The Equilateral is bound by oath never to permit the child henceforth to enter his former home or so much as to look upon his relations again, for fear lest the freshly developed organism may, by force of unconscious imitation, fall back again into his hereditary level.

Read the complete text of Flatland.

Comment: What if I need the links after all paragraphs after the fourth one?
Comment: Slight problem, you loop is doing this:

back to top
Comment: @Lisa what is it doing?
Comment: The link is getting messed up with extra #top
Comment: You might have more JQuery there that is not behaving well with the loop otherwise see the working snippet above that works fine
Comment: I did pull the adding the top class out of the loop
Comment: What do you mean by that @Lisa
Comment: Let us [continue this discussion in chat](https://chat.stackoverflow.com/rooms/172283/discussion-between-ankit-agarwal-and-lisa).
Comment: This:
// Add "back to top" links.
 var i = 3;
 var elem = $('article.chapter p');
 while(i <= elem.length){
  $('back to top').insertAfter("article.chapter p:eq("+ i +")");
  i+=1;
 }

 $('').prependTo('body');
Answer: Adding the "Back To Top" link(s):
If you need it after the 4th paragraph, and every paragraph thereafter, use the :gt() selector:
insertAfter('article.chapter p:gt(2)');

$('back to top').insertAfter('article.chapter p:gt(2)');

Our Professional Men and Gentlemen are Squares (to which class I myself belong) and Five-Sided Figures or Pentagons.

Next above these come the Nobility, of whom there are several degrees, beginning at Six-Sided Figures, or Hexagons, and from thence rising in the number of their sides till they receive the honourable
    title of Polygonal, or many-Sided. Finally when the number of the sides becomes so numerous, and the sides themselves so small, that the figure cannot be distinguished from a circle,
    he is included in the Circular or Priestly order; and this is the highest class of all.

It is a Law of Nature with us that a male child shall have one more side than his father, so that each generation shall rise (as a rule) one step in the scale of development
    and nobility. Thus the son of a Square is a Pentagon; the son of a Pentagon, a Hexagon; and so on.

But this rule applies not always to the Tradesman, and still less often to the Soldiers, and to the Workmen; who indeed can hardly be said to deserve the name of human Figures, since they have not all their sides equal. With them therefore the Law of
    Nature does not hold; and the son of an Isosceles (i.e. a Triangle with two sides equal) remains Isosceles still. Nevertheless, all hope is not such out, even from the Isosceles, that his posterity may ultimately rise above his degraded condition.…

Rarely—in proportion to the vast numbers of Isosceles births—is a genuine and certifiable Equal-Sided Triangle produced from Isosceles parents. "What need of a certificate?" a Spaceland critic may ask: "Is not the procreation of a Square Son a certificate from Nature herself, proving the Equal-sidedness of the Father?" I reply that no Lady of any position will marry an uncertified Triangle. Square offspring has sometimes resulted from a slightly Irregular Triangle; but in almost every such case the Irregularity of the first generation is visited on the third; which either fails to attain the Pentagonal rank, or relapses to the Triangular.    Such a birth requires, as its antecedents, not only a series of carefully arranged intermarriages, but also a long-continued exercise of frugality and self-control on the part of the would-be ancestors of the coming Equilateral, and a patient, systematic,
    and continuous development of the Isosceles intellect through many generations.

The birth  of a True Equilateral Triangle from Isosceles parents is the subject of rejoicing in our country for many furlongs round. After a strict examination conducted by the Sanitary and Social
    Board, the infant, if certified as Regular, is with solemn ceremonial admitted into the class of Equilaterals. He is then immediately taken from his proud yet sorrowing parents and adopted by some childless Equilateral. The Equilateral is bound by oath never to permit the child henceforth to enter his former home or so much as to look upon his relations again, for fear lest the freshly developed organism may, by force of unconscious imitation, fall back again into his hereditary level.

How admirable is the Law of Compensation! And how perfect a proof of the natural fitness and, I may almost say, the divine origin of the aristocratic constitution of the States of Flatland! By a judicious use of this Law
    of Nature, the Polygons and Circles are almost always able to stifle sedition in its very cradle, taking advantage of the irrepressible and boundless hopefulness of the human mind.…

Then the wretched rabble of the Isosceles, planless and leaderless, are ether transfixed without resistance by the small body of their brethren whom the Chief Circle keeps in pay for emergencies of this kind; or else more often, by means of jealousies
    and suspicious skillfully fomented among them by the Circular party, they are stirred to mutual warfare, and perish by one another's angles. No less than one hundred and twenty rebellions are recorded in our annals, besides minor outbreaks numbered
    at two hundred and thirty-five; and they have all ended thus.

If you need it after every 4th paragraph, use the :nth-child() selector:
insertAfter('article.chapter p:nth-child(4n)');

$('back to top').insertAfter('article.chapter p:nth-child(4n)');

Our Professional Men and Gentlemen are Squares (to which class I myself belong) and Five-Sided Figures or Pentagons.

Next above these come the Nobility, of whom there are several degrees, beginning at Six-Sided Figures, or Hexagons, and from thence rising in the number of their sides till they receive the honourable
    title of Polygonal, or many-Sided. Finally when the number of the sides becomes so numerous, and the sides themselves so small, that the figure cannot be distinguished from a circle,
    he is included in the Circular or Priestly order; and this is the highest class of all.

It is a Law of Nature with us that a male child shall have one more side than his father, so that each generation shall rise (as a rule) one step in the scale of development
    and nobility. Thus the son of a Square is a Pentagon; the son of a Pentagon, a Hexagon; and so on.

But this rule applies not always to the Tradesman, and still less often to the Soldiers, and to the Workmen; who indeed can hardly be said to deserve the name of human Figures, since they have not all their sides equal. With them therefore the Law of
    Nature does not hold; and the son of an Isosceles (i.e. a Triangle with two sides equal) remains Isosceles still. Nevertheless, all hope is not such out, even from the Isosceles, that his posterity may ultimately rise above his degraded condition.…

Rarely—in proportion to the vast numbers of Isosceles births—is a genuine and certifiable Equal-Sided Triangle produced from Isosceles parents. "What need of a certificate?" a Spaceland critic may ask: "Is not the procreation of a Square Son a certificate from Nature herself, proving the Equal-sidedness of the Father?" I reply that no Lady of any position will marry an uncertified Triangle. Square offspring has sometimes resulted from a slightly Irregular Triangle; but in almost every such case the Irregularity of the first generation is visited on the third; which either fails to attain the Pentagonal rank, or relapses to the Triangular.    Such a birth requires, as its antecedents, not only a series of carefully arranged intermarriages, but also a long-continued exercise of frugality and self-control on the part of the would-be ancestors of the coming Equilateral, and a patient, systematic,
    and continuous development of the Isosceles intellect through many generations.

The birth  of a True Equilateral Triangle from Isosceles parents is the subject of rejoicing in our country for many furlongs round. After a strict examination conducted by the Sanitary and Social
    Board, the infant, if certified as Regular, is with solemn ceremonial admitted into the class of Equilaterals. He is then immediately taken from his proud yet sorrowing parents and adopted by some childless Equilateral. The Equilateral is bound by oath never to permit the child henceforth to enter his former home or so much as to look upon his relations again, for fear lest the freshly developed organism may, by force of unconscious imitation, fall back again into his hereditary level.

How admirable is the Law of Compensation! And how perfect a proof of the natural fitness and, I may almost say, the divine origin of the aristocratic constitution of the States of Flatland! By a judicious use of this Law
    of Nature, the Polygons and Circles are almost always able to stifle sedition in its very cradle, taking advantage of the irrepressible and boundless hopefulness of the human mind.…

Then the wretched rabble of the Isosceles, planless and leaderless, are ether transfixed without resistance by the small body of their brethren whom the Chief Circle keeps in pay for emergencies of this kind; or else more often, by means of jealousies
    and suspicious skillfully fomented among them by the Circular party, they are stirred to mutual warfare, and perish by one another's angles. No less than one hundred and twenty rebellions are recorded in our annals, besides minor outbreaks numbered
    at two hundred and thirty-five; and they have all ended thus.

If you need it after the 4th paragraph, and only the 4th paragraph, use the :eq() selector:
insertAfter('article.chapter p:eq(3)');

$('back to top').insertAfter('article.chapter p:eq(3)');

Our Professional Men and Gentlemen are Squares (to which class I myself belong) and Five-Sided Figures or Pentagons.

Next above these come the Nobility, of whom there are several degrees, beginning at Six-Sided Figures, or Hexagons, and from thence rising in the number of their sides till they receive the honourable
    title of Polygonal, or many-Sided. Finally when the number of the sides becomes so numerous, and the sides themselves so small, that the figure cannot be distinguished from a circle,
    he is included in the Circular or Priestly order; and this is the highest class of all.

It is a Law of Nature with us that a male child shall have one more side than his father, so that each generation shall rise (as a rule) one step in the scale of development
    and nobility. Thus the son of a Square is a Pentagon; the son of a Pentagon, a Hexagon; and so on.

But this rule applies not always to the Tradesman, and still less often to the Soldiers, and to the Workmen; who indeed can hardly be said to deserve the name of human Figures, since they have not all their sides equal. With them therefore the Law of
    Nature does not hold; and the son of an Isosceles (i.e. a Triangle with two sides equal) remains Isosceles still. Nevertheless, all hope is not such out, even from the Isosceles, that his posterity may ultimately rise above his degraded condition.…

Rarely—in proportion to the vast numbers of Isosceles births—is a genuine and certifiable Equal-Sided Triangle produced from Isosceles parents. "What need of a certificate?" a Spaceland critic may ask: "Is not the procreation of a Square Son a certificate from Nature herself, proving the Equal-sidedness of the Father?" I reply that no Lady of any position will marry an uncertified Triangle. Square offspring has sometimes resulted from a slightly Irregular Triangle; but in almost every such case the Irregularity of the first generation is visited on the third; which either fails to attain the Pentagonal rank, or relapses to the Triangular.    Such a birth requires, as its antecedents, not only a series of carefully arranged intermarriages, but also a long-continued exercise of frugality and self-control on the part of the would-be ancestors of the coming Equilateral, and a patient, systematic,
    and continuous development of the Isosceles intellect through many generations.

The birth  of a True Equilateral Triangle from Isosceles parents is the subject of rejoicing in our country for many furlongs round. After a strict examination conducted by the Sanitary and Social
    Board, the infant, if certified as Regular, is with solemn ceremonial admitted into the class of Equilaterals. He is then immediately taken from his proud yet sorrowing parents and adopted by some childless Equilateral. The Equilateral is bound by oath never to permit the child henceforth to enter his former home or so much as to look upon his relations again, for fear lest the freshly developed organism may, by force of unconscious imitation, fall back again into his hereditary level.

How admirable is the Law of Compensation! And how perfect a proof of the natural fitness and, I may almost say, the divine origin of the aristocratic constitution of the States of Flatland! By a judicious use of this Law
    of Nature, the Polygons and Circles are almost always able to stifle sedition in its very cradle, taking advantage of the irrepressible and boundless hopefulness of the human mind.…

Then the wretched rabble of the Isosceles, planless and leaderless, are ether transfixed without resistance by the small body of their brethren whom the Chief Circle keeps in pay for emergencies of this kind; or else more often, by means of jealousies
    and suspicious skillfully fomented among them by the Circular party, they are stirred to mutual warfare, and perish by one another's angles. No less than one hundred and twenty rebellions are recorded in our annals, besides minor outbreaks numbered
    at two hundred and thirty-five; and they have all ended thus.

Bolding the author's name:
Add a CSS class for bold text, and use jQuery's toggleClass() to toggle it on/off with each click, thus adding/removing the bold:
.bolded-text { font-weight: bold; }

$(this).toggleClass("bolded-text");

$("#f-author").on("click", function() {
  $(this).toggleClass("bolded-text");
});
.bolded-text {
  font-weight: bold;
}

Flatland: A Romance of Many Dimensions

by Edwin A. Abbott

Part 1, Section 3

Concerning the Inhabitants of Flatland

Comment: This would work but it needs the link after all paragraphs after the 4th
Comment: At least this is what the requirement says:
1. Alter the code that introduces the back to top links so that the links only appear after the fourth paragraph.
Comment: @Lisa I've edited my answer to use `:gt` instead, should work as you need.


Where is the stolen baby Rattle?

Question: I'm looking for the stolen baby rattle, last seen in the company of a bird in Skyloft. Where might it be?
Answer: Check the floating island above the waterfall. If you use the Gust Bellows there in the bird's nest, you should find it.
Comment: I should point out that the bird's nest is on top of the windmill above Kukiel's house, near the bazaar.

Where is the stolen baby Rattle?


Cordova ios error building Images.xcassets

Question: I've spent a lot of time trying to work this out to no avail.
I udpated cordova and since el capitan my mac now has issues with NPM and cordova.
I got it to install but I have to use sudo for cordova now.
I tried the following:
sudo cordova platform remove ios
sudo cordova platform add ios
sudo cordova build ios

And this gives me the following output:
** BUILD FAILED **

The following build commands failed:
    CompileAssetCatalog build/emulator/<AppName>.app <AppName>/Images.xcassets
(1 failure)
ERROR building one of the platforms: Error code 65 for command: xcodebuild with args: -xcconfig,/Users/MacUserName/Desktop/<AppName>/<AppName>/platforms/ios/cordova/build-debug.xcconfig,-project,<AppName>.xcodeproj,ARCHS=i386,-target,<AppName>,-configuration,Debug,-sdk,iphonesimulator,build,VALID_ARCHS=i386,CONFIGURATION_BUILD_DIR=/Users/MacUserName/Desktop/<AppName>/<AppName>/platforms/ios/build/emulator,SHARED_PRECOMPS_DIR=/Users/MacUserName/Desktop/<AppName>/<AppName>/platforms/ios/build/sharedpch
You may not have the required environment or OS to build this project
Error: Error code 65 for command: xcodebuild with args: -xcconfig,/Users/MacUserName/Desktop/<AppName>/<AppName>/platforms/ios/cordova/build-debug.xcconfig,-project,<AppName>.xcodeproj,ARCHS=i386,-target,<AppName>,-configuration,Debug,-sdk,iphonesimulator,build,VALID_ARCHS=i386,CONFIGURATION_BUILD_DIR=/Users/MacUserName/Desktop/<AppName>/<AppName>/platforms/ios/build/emulator,SHARED_PRECOMPS_DIR=/Users/MacUserName/Desktop/<AppName>/<AppName>/platforms/ios/build/sharedpch

Cordova version
sudo cordova -v
6.0.0

Update:  I'm now running 6.1.1, still the same issue
Cordova iOS platform version
sudo cordova platform ios -v
6.1.1

Mac Version: 10.11.3
XCode Version:7.2.1
Comment: had the same error. removed and re-added the ios platform then removed icon instructions in config.xml and re-built successfully. no idea how it can manage to generate icons without making them correct size, but somehow, some component in cordova manages to create all the icons the wrong size (1024x1024 in my case). Go team.
Comment: @jimmont I've definitely tried removing the platform and re-adding it many times.  Never any luck
Comment: There are a couple of useful app icon/splash screen builders for cordova: https://github.com/AlexDisler/cordova-splash and https://github.com/AlexDisler/cordova-icon
Answer: I managed to fix this issue by:

removing any icon or splash screen references in the config.xml file;
put a splash.png and/or icon.png files in the www/resources folder of your cordova project; then,
run the ionic cordova resources --icon or ionic cordova resources --splash command

this will create all the correct splash/icon files for you and add them to the config.xml file.  That warning then goes away.
Hope this works!
Comment: I'm using cordova not ionic, so I can't run "ionic resources" anything
Comment: @FrodmanG I believe I did somethign like removing configs for icons/splashes, removing/adding my ios platform, and then correcting the configuration of icons/splash.  One thing I'd advise for anyone with similar issues is to open the platform in xcode and check that everything looks right and has valid filepaths in the xcassets file.
Comment: @csga5000 - you can do the same thing with cordova : first install cordova-splash and cordova-icon (`npm install -g cordova-splash cordova-icon`), then create your icon.png and splash.png in the root of your cordova project (ie. the directory above /www), then run them (`cordova-icon ; cordova-splash`) and all the correct icon and splash images will be created in the correct area under /platforms.   (Note that you need ImagicMagic installed).   The iconic commands are just wrapping these same npm modules.
Comment: Thanks, I was having this exact problem.
Comment: @csga5000 You can just use the ionic tools when you're building. You don't have to include the client libraries for this to help.
Comment: With v3 of CLI you now run ionic cordova resources --icon and ionic cordova resources --splash
Answer: I would recommend using the cordova-icon and cordova-splash npm packages.  This is because you can just put two images in your root, then the commands will work out the rest for you.  They are written by cordova, and you can install using:
npm install -g cordova-icon
npm install -g cordova-splash

Then just put a 1024x1024 version of your logo as "icon.png" in the project root.  And:

"The splash screen image should be 2208x2208 px with a center square of
  about 1200x1200 px. The image may be cropped around the center square."
https://www.npmjs.com/package/cordova-splash

Just put an image matching that description in the project root as "splash.png"
Remove any lines in config.xml that specify the images to use for ios, cordova-icon/splash will automatically put them in the correct place with the right names so that xcode will recognize them.
Once you've got that setup, just execute these commands:
cordova platform remove ios
cordova platform add ios
cordova-icon
cordova-splash

Then run your build command.  For me it is:
cordova build ios --build-config

But you may not have a build config, or need additional params.  If the build fails (make sure you run the command even if you think it will fail - it will set things up) just open the generated workspace in platforms/ios in xcode, clean the project, and build.  That should work.
Comment: Note for a bug: On OSX it was required to also install imagemagick to get cordova-icon or cordova-splash working. The bug I encountered which had to have imagemagick installed [was answered here](https://github.com/AlexDisler/cordova-splash/issues/29). This also required having HomeBrew installed to imagemagick which can be done by typing into the terminal `/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"` [Which I found on the HomeBrew site here](https://brew.sh/). Hopefully this helps somebody.
Comment: I don't think cordova is as active now that there are arguably better alternatives like Flutter, Xamarin, and React Native for cross platform mobile development.  Coming back to a cordova project, cordova-icon doesn't seem to be working well with updated cordova. (Which in turn wasn't playing well with updated iOS and I had to disable the modern build system)
Answer:
Rename Platform/ios
on terminal type: cordova  platform add ios
cordova build ios.

worked at my case
Comment: If 1 suggests renaming the directory platforms/ios I have not tried that.  However, I've tried cordova platform remove ios, instead and this did not resolve the issue.  I've even tried creating a new project and adding that.  The only fix I've found is commenting the line for the logo from the config file and then removing/adding the platform.
Comment: On the second point you got an error. Its cordova platform add ios .
Answer: For a solo icon.png file, the image must be 1024x1024 to get working with a solo <icon src="icon.png"/> in the config.xml.
I have to this with cordova-cli 6.5.0, cordova-ios 4.5.1 and xcodebuild 9.0.
Comment: Thanks, this works! Is this documented anywhere or is this an unknown Cordova bug?
Comment: It was 4 years ago, I cannot remember :-S
Answer: I got this error when I was using cordova-icon but my icon.png image was not square.
Changing the icon.png to a square image and re-doing cordova-icon meant that cordova build ios now works for me.
Comment: That wasn't my problem, I only found out about cordova-icon a day or two ago actually, and no problems.  But perhaps still useful for some.  Thanks Kris
Answer: Ths simple solution that I have tried is to add the correct size of the image 1024x1024
   <platform name="ios">
        <icon src="res/icon-1024.png" />
    </platform>

Answer: After digging into cordova_lib I think it's clear (to me) that cordova is not supposed to resize the icon for you but only copy them if they exist and have the right dimensions.
See this code in cordova-lib\src\cordova\metadata\ios_parser.js:
// See https://developer.apple.com/library/ios/documentation/userexperience/conceptual/mobilehig/LaunchImages.html
// for launch images sizes reference.
var platformIcons = [
    {dest: 'icon-60.png', width: 60, height: 60},
    {dest: 'firstname.lastname@example.com', width: 120, height: 120},
    {dest: 'firstname.lastname@example.com', width: 180, height: 180},
    {dest: 'icon-76.png', width: 76, height: 76},
    {dest: 'firstname.lastname@example.com', width: 152, height: 152},
    {dest: 'icon-small.png', width: 29, height: 29},
    {dest: 'firstname.lastname@example.com', width: 58, height: 58},
    {dest: 'icon-40.png', width: 40, height: 40},
    {dest: 'firstname.lastname@example.com', width: 80, height: 80},
    {dest: 'icon.png', width: 57, height: 57},
    {dest: 'email@example.com', width: 114, height: 114},
    {dest: 'icon-72.png', width: 72, height: 72},
    {dest: 'firstname.lastname@example.com', width: 144, height: 144},
    {dest: 'icon-50.png', width: 50, height: 50},
    {dest: 'email@example.com', width: 100, height: 100}
];

var destIconsFolder, destSplashFolder;
var xcassetsExists = folderExists(path.join(platformRoot, 'Images.xcassets/'));

if (xcassetsExists) {
    destIconsFolder = 'Images.xcassets/AppIcon.appiconset/';
} else {
    destIconsFolder = 'Resources/icons/';
}

platformIcons.forEach(function (item) {
    var icon = icons.getBySize(item.width, item.height) || icons.getDefault();
    if (icon){
        var src = path.join(appRoot, icon.src),
            dest = path.join(platformRoot, destIconsFolder, item.dest);
        events.emit('verbose', 'Copying icon from ' + src + ' to ' + dest);
        shell.cp('-f', src, dest);
    }
});

The best option seems to be using a plugin which does the resizing for you with hooks. Check out Generating iOS and Android icons in Cordova / PhoneGap or https://github.com/disusered/cordova-icon-gm for a new more futureproof version of the same plugin (hooks in directories are deprecated in 6.x).
Answer: I managed to solve this issue by removing the non-storyboard splash references in config.xml, the newest version of cordova seems to be only using the storyboard ones:
So removed:
    <splash src="res/ios/splash/Default~iphone.png" width="320" height="480"/>
    <splash src="res/ios/splash/Default@2x~iphone.png" width="640" height="960"/>
    <splash src="res/ios/splash/Default-Portrait~ipad.png" width="768" height="1024"/>
    <splash src="res/ios/splash/Default-Portrait@2x~ipad.png" width="1536" height="2048"/>
    <splash src="res/ios/splash/Default-Landscape~ipad.png" width="1024" height="768"/>
    <splash src="res/ios/splash/Default-Landscape@2x~ipad.png" width="2048" height="1536"/>
    <splash src="res/ios/splash/Default-568h@2x~iphone.png" width="640" height="1136"/>
    <splash src="res/ios/splash/Default-667h.png" width="750" height="1334"/>
    <splash src="res/ios/splash/Default-736h.png" width="1242" height="2208"/>
    <splash src="res/ios/splash/Default-Landscape-736h.png" width="2208" height="1242"/>

And kept only these:
        <splash src="res/ios/splash/Default@2x~iphone~anyany.png" />
        <splash src="res/ios/splash/Default@2x~iphone~comany.png" />
        <splash src="res/ios/splash/Default@2x~iphone~comcom.png" />
        <splash src="res/ios/splash/Default@3x~iphone~anyany.png" />
        <splash src="res/ios/splash/Default@3x~iphone~anycom.png" />
        <splash src="res/ios/splash/Default@3x~iphone~comany.png" />
        <splash src="res/ios/splash/Default@2x~ipad~anyany.png" />
        <splash src="res/ios/splash/Default@2x~ipad~comany.png" />

Answer: This is not a difficult error.Only thing has to do is remove all lines with

Images.xcastsets

from

platform/ios/.xcodeproject

Then remove platform ionic cordova platform rm ios,
Add platform again and build.

ionic cordova platform add ios
ionic cordova build ios
Comment: I appreciate this may have solved a problem for you but I don't believe this is the solution to the OP as the issue is related to the incorrect, or lack of, suitable icon and splash screen images. I had the same problem and had that error on first build, so at that point there was no platform/ios folder!
Answer: I had the same problem as the OP and whilst the accepted answer was correct and helpful there is now an updated (and maintained) resource generator on npm called cordova-res, which replaces cordova-icon and cordova-splash. Also, the required splash screen dimensions have increased. All the details you need are on the npmjs cordova-res page, from which I have taken the following info.
Install with:
npm install -g cordova-res

You'll need your icon.png and splash.png (the website says JPEG or PNG) images ready. These need to have the following dimensions:
icon.(png|jpg) must be at least 1024 × 1024px
splash.(png|jpg) must be at least 2732 × 2732px (note the increased size)
Just a little side note about the splash screen. Your image needs to be in the centre of the splash screen so that different rectangular device sized images are generated without cropping your splash screen image. As the accepted answer says, the size of this centre image needs to be about 1200 x 1200px.
Place these images in a resources folder in your project:
resources/
├── icon.png
└── splash.png

Before you generate the resources it might be worth removing and adding your ios platform (and others if you're building them too) to start with a clean platform folder. I don't know for sure if this is necessary.
cordova platform remove ios
cordova platform add ios

Run the following to generate the resources:
$ cordova-res

Then you can build your platform:
cordova build ios

Now all should be OK and hopefully resolved your xcassets error, as it did for me.
Comment: Just wanted to note that this package only works for node >=10.3.0


How can I get the local Storage Value

Question: var cookieValue = document.getElementById("demo");
var value = cookieValue .getAttribute('value');

if(typeof(Storage)!=="undefined")
{
  alert(value);
  localStorage.setItem = ("GetData" , value);
  alert(localStorage.setItem);
}

function loading()
{
  alert("coming");
  var allcookies = localStorage.getItem('GetData');
  alert(allcookies);
}

Above is the way I am setting localStorage.setItem and I am getting LocalStorage.
But Where I didn't get the output it is showing Null. Please Suggest me any Solution.
Answer: Your code should be :
var cookieValue = document.getElementById("demo");
    var value = cookieValue .getAttribute('value');
    if(typeof(Storage)!=="undefined")
    {
        alert(value);
        localStorage.setItem("GetData" , value);
        alert(localStorage.getItem("GetData"));

    }

function loading()
{
        alert("coming");
        var allcookies = localStorage.getItem('GetData');
        alert(allcookies);

}

OR
var cookieValue = document.getElementById("demo");
    var value = cookieValue .getAttribute('value');
    if(typeof(Storage)!=="undefined")
    {
        alert(value);
        localStorage["GetData"] = value;
        alert(localStorage["GetData"]);

    }

function loading()
{
        alert("coming");
        var allcookies = localStorage["GetData"];
        alert(allcookies);

}

Comment: You're welcome. Please select the accepted answer icon at the left of the answer which has help you the most in order to help future users finding directly the right anwser without reading all answers.
Comment: your `getitem(` and `setitem(` needs to be `getItem(` and 'setItem(`.
Answer: The correct syntax for setItem is

localStorage.setItem("GetData", value)

not

localStorage.setItem = ("GetData", value)
Answer: Try this
if( window.localStorage ) {
    alert(value);
    localStorage.setItem("GetData" , value);
}

How can I get the local Storage Value


Parsing CSV into database and back

Question: I'm in the planning stage of a project currently and we have to make our software work with other client systems.
One of these systems is for managing orders within their business, and we need the information regarding stock. Sadly, they have no API, and users can only manually export a CSV file.
I can't come up with the best solution on how to get this CSV data in to our app. At the moment, all I can think of is a manual CSV upload feature that we can use to parse the data in to our database.
The main issue is that any changes we make to the data has to be put back into their system, which currently is through CSV upload also. We are supplied no reference data or anything that will help us map the data accurately. All of this on top of the fact that it has to work across multiple devices, probably simultaneously.
Can anyone give me an idea of what route to take to solve this problem, and if necessary, should I try to extend the project and recommend that they develop an API?
Thanks a lot in advance.
Answer: There are so many variables here so I can only give you some generic advice.
It depends on how current the information in the clients system needs to be. if the client wants orders made in the app to appear in their systems almost instantly its probably better to build an API, but then API could be  difficult depending on what the client is using.
If you want to keep the cost low and use CSV, you would have to export any data changes made in your app to a CSV file and then transfer the CSV file to somewhere the clients system can grab it and import it. This would best be done on set time intervals, depending on how frequent the orders need to come through (could be every 5 mins or even every 24 hours).
The import process could be automated by system scripts like shell script. also you would need to set up an export from the clients system that your app would then use to update its own information this could also be managed by system scripts.
Use system scripts to import/export the physical file and then use your application to move the data between systems.
If you choose to do CSV import/export the mapping is essential, you need to investigate what the client system requires for a successful import and you need to make your application output match those requirements.
Comment: Thanks for the answer. I have a meeting this Friday regarding the project so will be asking them about an API. I think you're right in regards to a set interval. They are a large business and I think using a CSV may be a problem because of the project scope and the current systems. We will offer an API in our own system and also supply an export to CSV feature for them to manually upload back data in to their system. Their database schema is completely locked down at the moment, so will be trying to get access to that in the following week too, hopefully. Thanks again.
Answer: You must have some consistent schema you and the source share, otherwise you maze well parse free text.
DataTable csvTableSchema = new DataTable();

//Open the CSV
string csvFilePath = "C:\\temp\\A.csv";
var connString = string.Format(
    @"Provider=Microsoft.Jet.OleDb.4.0; Data Source={0};Extended Properties=""Text;HDR=YES;FMT=Delimited""",
    Path.GetDirectoryName(csvFilePath)
);

//To read the csv with DataTypes we specify the columns and their datatypes in the Schema.ini
//REF https://learn.microsoft.com/en-us/sql/odbc/microsoft/schema-ini-file-text-file-driver

using (var conn = new OleDbConnection(connString))
{
    conn.Open();
    var query = "SELECT * FROM [" + Path.GetFileName(csvFilePath) + "]";
    using (var adapter = new OleDbDataAdapter(query, conn))
    {
        var ds = new DataSet("CSV File");
        adapter.Fill(ds);
        csvTableSchema = ds.Tables[0];
    }
}

The Schema.ini file lives in the same directory as the CSV you're reading, you need to specify this for the reference data to allow you to map the data accurately eg:

[ABC_20171128.csv]
  Format = Delimited(|)
  CharacterSet=ANSI
  ColNameHeader=True
  DateTimeFormat=dd MM yyyy hh:nn:ss
Col1 = Date DateTime
  Col2 = AccountID Text
  Col3 = SubAccount Text
  Col4 = MarketCode Text
  Col5 = SecurityCode Text
  Col6 = Units Single

Ref: Missing column of Dates in CSV file using Schema.ini file
Answer: There are so many ways to go with this, but only because you didn't provide enough information...in my opinion...  Anyway, how about something like this, to get started.
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.IO;
using System.Data.SqlClient;
using Excel = Microsoft.Office.Interop.Excel;

namespace Import_CSV_file_into_DataGridView
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void btnBrowse_Click(object sender, EventArgs e)
        {
            OpenFileDialog dlg = new OpenFileDialog();
            DialogResult dlgResult = dlg.ShowDialog();
            if (dlgResult == DialogResult.OK)
            {
                txtPath.Text = dlg.FileName;
            }
        }

        private void btnLoadData_Click(object sender, EventArgs e)
        {
            string rowValue;
            string[] cellValue;

            if (System.IO.File.Exists(txtPath.Text))
            {
                System.IO.StreamReader streamReader = new StreamReader(txtPath.Text);

                // Reading header
                rowValue = streamReader.ReadLine();
                cellValue = rowValue.Split(',');
                for (int i = 0; i <= cellValue.Count() - 1; i++)
                {
                    DataGridViewTextBoxColumn column = new DataGridViewTextBoxColumn();
                    column.Name = cellValue[i];
                    column.HeaderText = cellValue[i];
                    dataGridView1.Columns.Add(column);
                }

                // Reading content
                while (streamReader.Peek() != -1)
                {
                    rowValue = streamReader.ReadLine();
                    cellValue = rowValue.Split(',');
                    dataGridView1.Rows.Add(cellValue);
                }

                streamReader.Close();
            }
            else
            {
                MessageBox.Show("No File is Selected");
            }
        }

        private void button1_Click(object sender, EventArgs e)
        {
            Excel.Application xlApp ;
            Excel.Workbook xlWorkBook ;
            Excel.Worksheet xlWorkSheet ;
            object misValue = System.Reflection.Missing.Value;

            xlApp = new Excel.Application();
            xlWorkBook = xlApp.Workbooks.Add(misValue);
            xlWorkSheet = (Excel.Worksheet)xlWorkBook.Worksheets.get_Item(1);
            int i = 0;
            int j = 0;

            for (i = 0; i <= dataGridView1.RowCount  - 1; i++)
            {
                for (j = 0; j <= dataGridView1.ColumnCount  - 1; j++)
                {
                    DataGridViewCell cell = dataGridView1[j, i];
                    xlWorkSheet.Cells[i + 1, j + 1] = cell.Value;
                }
            }

            xlWorkBook.SaveAs("C:\\Users\\Excel\\Desktop\\test.xls", Excel.XlFileFormat.xlWorkbookNormal, misValue, misValue, misValue, misValue, Excel.XlSaveAsAccessMode.xlExclusive, misValue, misValue, misValue, misValue, misValue);
            xlWorkBook.Close(true, misValue, misValue);
            xlApp.Quit();

            releaseObject(xlWorkSheet);
            releaseObject(xlWorkBook);
            releaseObject(xlApp);

            MessageBox.Show("Excel file created , you can find the file C:\\Users\\Excel\\Desktop\\test.xls");
        }

        private void releaseObject(object obj)
        {
            try
            {
                System.Runtime.InteropServices.Marshal.ReleaseComObject(obj);
                obj = null;
            }
            catch (Exception ex)
            {
                obj = null;
                MessageBox.Show("Exception Occured while releasing object " + ex.ToString());
            }
            finally
            {
                GC.Collect();
            }
        }
        }
}

There are many other things you can do as well.  Post back if you have additional questions.

Parsing CSV into database and back


how to dynamically change end of url in retrofit2

Question: I'm trying to change end of URL dynamically in POST request.
<code>@POST("/api/registrations/{key}")
Call<RegistrationResponse> confirmRegister(
   @Body RegisterParam registerParam, @Path("key") String key);

 D/OkHttp: --> POST http://base_url/api/registrations/ http/1.1
08-18 18:44:43.138 20510-20672/ D/OkHttp: Content-Type: application/json; charset=UTF-8
08-18 18:44:43.138 20510-20672/ D/OkHttp: Content-Length: 72
 D/OkHttp: <-- 404 Not Found base_url/registrations (449ms)
08-18 18:44:43.588 20510-20672/ D/OkHttp: Date: Thu, 18 Aug 2016 12:44:44 GMT
</code>
I'm going to get result like this:
<code>POST base_url/api/registrations/ajksdiuqwdqhiwuqdhiquhd
</code>
Comment: and where is Your qestion?
Comment: show error or smth
Comment: sorry, changed my question
Comment: Please add `java` tag (and `android`?).
Comment: are You sure "key" should be on ulr? not no Post body. or try add / and the end of /api/registrations/{key}/ sometimes servers need this
Comment: not sure. I'm founding it crazy. Fronted developer gived it me.
but with this lib you can do this. https://github.com/OpenFeign/feign
Comment: @mdzht where did you specified the base url?
Comment: @Path is good to change end of url in post.. but error 404 its about wrong endpoint / base url.
Comment: @Soham I renamed to base_url. there's no problem
Answer: It was'nt @POST request but @PATCH request. the code, below, works as expected. Sorry for leading astray. Thanks to all.
<code>@PATCH("/api/registrations/{key}")
Call<RegistrationResponse> confirmRegister(
@Body RegisterParam registerParam, @Path("key") String key);
</code>


c# 8 nullability - generic class "knowing" its nullability

Question: I've got two classes - an inner class and an outer class, where the inner class can return a null value and an outer class that shouldn't (assuming, of course, that the type parameter T represents a non-nullable type):
#nullable enable
public class Insider<T>
{
    [MaybeNull, AllowNull]
    public T Value {get; set; }

    public Insider()
    { Value = default; }
}
public class Outsider<T>
{
    Insider<T> Inside = new Insider<T>();

    public T Value
    {
        get
        {
            return Inside.Value; // Compiler warning "'Value' may be null here"
        }
        set { Inside.Value = value; }
    }
}
public class Fred
{ }
public static class Test
{
    public static void Stuff()
    {
        Outsider<Fred> one = new Outsider<Fred>();
        Debug.WriteLine("one.Value is " + one.Value);

        Outsider<Fred?> two = new Outsider<Fred?>();
        Debug.WriteLine("two.Value is " + two.Value);

        Outsider<int> three = new Outsider<int>();
        Debug.WriteLine("three.Value is " + three.Value);
    }
}
#nullable disable

When I run this, it gives the expected output:
one.Value is
two.Value is
three.Value is 0

The program state that causes "Insider.Value" to be null is a specific error state, and the caller should know the system is in that state and not access "Outsider.Value", which means that caller should never see "Outsider.Value" return null, but I'd like to enforce that.
And yes, both classes should handle structs as well as classes.
What I was thinking, was something along these lines:
public class Outsider<T>
{
    Insider<T> Inside = new Insider<T>();

    public T Value
    {
        get
        {
            if ((Inside.Value == null)&&(T_shouldnt_be_null))
                throw new Exception("Nope");
            return Inside.Value;
        }
        set { Inside.Value = value; }
    }
}

The troublesome part, of course, is the "T_shouldnt_be_null".
If I put more debugging in Outsider.Value:
public class Outsider<T>
{
    Insider<T> Inside = new Insider<T>();

    public T Value
    {
        get
        {
            Type? nullableType = Nullable.GetUnderlyingType(typeof(T));
            Debug.WriteLine("      typeof(T) is "  + typeof(T) + "; nullableType=" + ((nullableType==null)?"null": nullableType.ToString()));
            foreach (var x in typeof(T).CustomAttributes)
                Debug.WriteLine("         " + x);
            return Inside.Value;
        }
        set { Inside.Value = value; }
    }
}

I get results that were not what I expected.  The results when the type parameter T is Fred (non-nullable) are:
typeof(T) is BTSDataCollator.Fred; nullableType=null

and the results when the type parameter is Fred? (nullable) are:
typeof(T) is BTSDataCollator.Fred; nullableType=null

The compiler has completely stripped the nullability indicator from the type.  And in both cases the class type has no CustomAttributes (and that's what this post relies on to determine nullability)
Is there any way that a (generic) class can get information on the nullability of its actual type parameter (Fred vs. Fred?) ?
Comment: `Nullable.GetUnderlyingType` is for nullable value types.
Comment: Can't your ensure at compile time the T of Outsider is not nullable ? "public class Outsider where T : struct". In that case you will have a compiler error if you try to use reference type (nullable).
Comment: Alas, as I said in my post, "both classes should handle structs as well as classes."
Comment: @GuruStron I was trying everything I could think of to "see" the nullability.  I expected that when I instantiated Outsider that T would be Nullable but it wasn't.
Comment: @PavelAnikhouski Alas, I have printed out the CustomAttributes of typeof(T) as well as the CustomAttributes of Outsider's Value property and the CustomAttributes of the Outsider's Value property's PropertyType.  In every case there are -zero- CustomAttributes, which is what that StackOverflow post relies on
Comment: Side note on naming: usually one would use "Outer" and "Inner"... Outsider/Insider imply that there is access to some secret information ("insiders" are the one who have non-public information, "outsiders" are once without such knowledge with negative connotation) and not containment relationship...
Comment: @BettyCrokker Please, check this question: https://stackoverflow.com/q/62165259/12833205. I think that it can be helpful. It deals with `nullability` of the type parameter of the method (not class) but the problem is the same: *how to define if type parameter is nullable or not*.
Answer: I would say that in general case what you are trying to do is impossible. If you check your code in sharplab.io you will see that no information is added to generic class, so new Outsider<Fred>() and new Outsider<Fred?>() are exactly the same for compiler:
public class C {
    public void M() {
        Outsider<Fred> one = new Outsider<Fred>();
        Outsider<Fred?> two = new Outsider<Fred?>();
    }
}

results in next IL:
.method public hidebysig
    instance void M () cil managed
{
    // Method begins at RVA 0x2094
    // Code size 14 (0xe)
    .maxstack 1
    .locals init (
        [0] class Outsider`1<class Fred> one,
        [1] class Outsider`1<class Fred> two
    )

    IL_0000: nop
    IL_0001: newobj instance void class Outsider`1<class Fred>::.ctor()
    IL_0006: stloc.0
    IL_0007: newobj instance void class Outsider`1<class Fred>::.ctor()
    IL_000c: stloc.1
    IL_000d: ret
} // end of method C::M

So there is basically no information which you can get via reflection.
Comment: @BettyCrokker I'm afraid you will need to use something like `Reflection.Emit`, not sure that you can declare classes with expression trees.
Comment: Argh.  That's good analysis.  I wonder though ... if I create two classes "class One : Outsider" and "class Two : Outsider" inside a library, and then consume those classes outside of that library - doesn't that mean the signatures of "One" and "Two" have to somehow indicate their nullability?  I'm not familiar with libraries in the C# world so I'm not sure how that would work
Comment: Yes!  class One has a custom attribute [System.Runtime.CompilerServices.NullableAttribute(new Byte[2] { 0, 1 })] while class Two has a custom attribute [System.Runtime.CompilerServices.NullableAttribute(new Byte[2] { 0, 2 })].  You don't even have to be in a different library to see that, just have to create new subclasses.  Not sure how that helps ... yet ...
Comment: Ooh ... this would be some really wicked code ... I wonder what would happen if I defined a subclass using an Expression tree and then compiled it ...
Comment: Yeah, even that was a no go.  I can create a class using AssemblyBuilder and TypeBuilder that derives from Outsider but you specify the base class as a Type, and the Type of Outsider and Outsider are identical (even down to the same GUID)


Using third party javascript package with Meteor

Question: I'm working with Meteor at the moment, and I'm trying to make it look more 'real timey' by adding transitions to numbers as they change.  The best third party package I can see for that is http://github.hubspot.com/odometer/.
I'm having trouble getting the package to work in Meteor to update comment numbers on an item.
I've tried putting the javascript into client/compatibility as per the meteor docs: http://docs.meteor.com/#structuringyourapp, but no joy.
The other issue might be that the package uses CSS transitions, which would mean that a re-rendering of the template around the number that is updating would prevent the transition from occurring. To try and fix this problem, I used {{#isolate}} around the number, but that didn't work either.
Has anyone got any other ideas on what else in meteor might be getting in the way?
Answer: I think you should try {{#constant}} instead of {{#isolate}}. Also note, that the "constant" part of your template will no longer be reactive, so you'll have to update it manually. Supposing that you have a template
<template name="myTemplate">
    {{#constant}}

    {{/constant}}
</template>

you will need to do something like this:
Template.myTemplate.rendered = function () {
    var node = this.find('.odometer');
    Deps.autorun(function () {
        node.innerHtml = MyCollection.find({}).count();
    });
}