Use jars bundled in application rather than default - Glassfish 3.1.2

Question: The company I work for currently has a java application supplied by another company that is designed to run on Websphere.  While it runs well on Websphere, we are in desperate need to use a 64 bit JVM given the complexity of our product and how it pertains to the necessary use of the system.  We are trying to avoid buying a license for Websphere, as it will cost a good sum of money.
I have tried to install this application on practically every Java Application Server I can find and Glassfish seems to be the most promising.  The issue it seems to have is how it processed the libraries it wants to use.
Bundled with the application is a jaxb.jar file, and a pretty old version of it.  I did a quick test with that file on a standalone application to see the version number, which came out to be 1.0.  I did use some arbitrary class inside it.  I then created a simple jsp to test the version of that same class when the application is deployed.  It came out to 2.2.6.  I know that Glassfish has a jaxb jar file of a newer version, so it is clearly using this one.
How can I force my application to use the classes in its own lib folder over the ones being used by the app server?  I feel that this is the only thing holding back Glassfish from being my replacement app server.
Note:  I did try to remove the files causing the problem from Glassfish, but then it failed to restart.  They must be necessary for the server to run.  Thanks in advance.
Answer: What is the exact problem when deploying/running the webapp in GlassFish?
Can you update the jaxb jar in the application instead of tampering with the jar in GlassFish?
Maybe you can read up on GlassFish classloading hierarchy here.
This might give you clues how to solve this. Especially the endorsed mechanism may be useful.


lazyinitializationexception when CreateCriteria on child object

Question: I really don't understand this situation, I have two objects  Doctor and Appointment, these 2 tables are linked by a Id mapping table:
Doctor.hbm.xml:
<bag name="Appointments" table="AppointmentDoctor" lazy="true">
  <key>
    <column name="DoctorId"/>
  </key>
  <many-to-many class="Appointment">
    <column name="AppointmentId"/>
  </many-to-many>
</bag>

When I do this request, it works fine:
            var criteria = session.CreateCriteria(typeof(Doctor));
            criteria.SetFetchMode("Appointments", FetchMode.Join);

The fact of adding SetFetchMode returns Appoinment correctly.
But as soon as I create a sub query like this:
            var criteria = session.CreateCriteria(typeof(Doctor));
            criteria.SetFetchMode("Appointments", FetchMode.Join);

            //New sub query
            var appointmentsCriteria = criteria.CreateCriteria("Appointments");
            appointmentsCriteria.Add(Restrictions.Eq("AppointmentState", AppointmentState.Cancelled));

the fetch on Appointment is no more done, and I get a lazyinitializationexception later.
Any idea why this happening?
Comment: Kindly refer : https://stackoverflow.com/questions/23264688/how-to-solve-hibernates-lazyinitializationexception/23265243
Answer: criteria.CreateCriteria("Appointments") overrides behavior you requested with criteria.SetFetchMode("Appointments", FetchMode.Join);. Inner joined collection criterias by default are not fetched. So you have to use left join:
//Collection criteria must be left joined to be fetched
var appointmentsCriteria = criteria.CreateCriteria("Appointments", JoinType.LeftJoin);

Or if you are using NHibernate 5.2+ you can use SelectMode.Fetch for fetching inner joined collections:
var appointmentsCriteria = criteria.CreateCriteria("Appointments")
                               .Fetch(SelectMode.Fetch, string.Empty);

More about SelectMode can be found here


Push specific commit on the remote branch tracking the current branch

Question: This question shows how to push up to a commit to the master branch (eg all parent commits of the specific commit):
How can I pushing specific commit to a remote, and not the previous commits?
The answer is :
git push <remotename> <commit SHA>:<remotebranchname>

so you can use git push origin <commit SHA>:master
However, I would like to automatically push that commit to the matching remote branch.
I can't just use git push <remotename> "<commit SHA>:$(git branch)" because git branch returns the local branches, I would like to have the matching remote branch (eg for example you can map the local master branch to map to the remote prod branch). I would like to take that into account.
Comment: Your understanding of git seems conflicted to me. What you are trying to do, essentially pushing individual commits from a branch to the remote, will not work if some commits in the interim are missing. Instead, you can update the branch directly using `git push origin branchname`, or create a fresh one using `git push origin local_branch:new_remote_branch`.
Comment: I clearly understand git. My use case is that I want to publish only up to a specific commit and not further (because I might change those commits in the future). I created a function that does basically `git push origin :master` , where commit sha is a parameter. However, I'm now not on the master branch, so I would like my function to automatically push to the right remote tracking branch
Answer: Due to how Git works, a commit does not clearly belong to a branch. Branches are just pointers to commits that are located somewhere in the global history tree, so when you want to push a certain commit individually to a remote branch, that commit does not say anything about which branch you could possibly mean.
The only thing you can do it is to find branches where the commit is contained on, using git branch --contains. If that only returns one branch, then you're in luck and everything is clear but the command may return multiple branches if the commit is reachable by multiple branches. For everything else, like the tracking branch, you would have to look at your repository's configuration.
However, your workflow seems a bit weird to me. If you keep wanting to push an older commit instead of your current branch, then what you should really do is to make a new branch. Have one branch which matches the remote one which you then can just push; and have one other branch that's ahead of that branch where your development happens. And whenever you want to update the remote, you update your local branch that matches the remote and then just push that branch.
So your history would look like this:
              prod               master
               ↓                   ↓
* -- * -- * -- * -- * -- * -- * -- *

And you could just push prod using git push origin prod and make that resolve whatever remote tracking branch actually is behind.
Comment: > However, your workflow seems a bit weird to me. : In my case what I want is to be able to push only commits that I have looked twice, so that I'm sure I don't commit something that I shouldn't be commiting (unnecessary code, ...). That's why I'm sometimes comitting only up to one commit.
Comment: My question can be simplified a lot : git branch returns the current local branch. However, I would like to get the remote branch that tracks the current branch using the command line (eg not looking into ~/.git/config
Comment: Even if you want to push one commit at a time, use a branch to do it. It gets simpler that way, and also a lot more clear.
Comment: I'm using tig so pushing one commit is just one keystroke, it's just that my binding doesn't work because the branch name is incorrect. Creating a branch in my use case would be overkill
Comment: I'm going to use http://stackoverflow.com/questions/171550/find-out-which-remote-branch-a-local-branch-is-tracking


Question on Theorem for Spectral Theory for Compact and Self-Adjoint operators

Question: I saw that the same Theorem has been asked here again for explanation but the question I want to make is different.

I see why $\vert \langle Tx_n,x_n\rangle \vert \rightarrow \vert \vert T \vert \vert = \sup_{x \in H, \vert \vert x \vert \vert =1} \vert \langle Tx,x \rangle \vert$ holds. And also by this, it follows $\langle Tx_n,x_n\rangle$ is a real bounded sequence.
I can't understand why $\langle Tx_n,x_n\rangle \rightarrow λ$. All I see is that since $T$ is compact operator, there is a subsequence $(x_{n_k})$ of $(x_n)$ such that $Tx_{n_k}$ is convergent.
EDIT: From the answer below , I realised my question wasn't clear enough. I wanted to ask is how did we use the compactness of $\;T\;$ in the convergence of $\langle Tx_n,x_n\rangle\;$..?
I'm really confused here.. I would appreciate any help!
Thanks in advance
Comment: The convergence of $\langle Tx_n,x_n\rangle$ appears to come from Theorem 3.7, and may or may not (I don't know this text from the theorem numberings) be related to compactness.
Answer: Since your $T$ is self adjoint, $\langle Tx,x\rangle$ is real for all $x\in H$. Therefore there are only nonnegative or nonpositive values if we want to remove the absolute value symbol. Now you can conclude that the limit (up to a subsequence) can only be $\lambda$ or $-\lambda$.
Comment: Thanks a lot for your answer. I realised my question wasn't clear enough. I just edited my original post. Hope it's better
Answer: It has nothing to do with compactness. A selfadjoint operator has no residual spectrum: if $\lambda\in\sigma(T),$ then either $\lambda$ is an eigenvalue, or $T-\lambda I$ is injective; in the latter case,
$$
\overline{\text{ran}\,(T-\lambda I)}=\ker(T-\lambda I)^\perp=\{0\}^\perp=H.$$ So $T-\lambda I$ cannot be bounded below (if it were, it would be invertible) and thus $\lambda$ is an approximate eigenvalue, which is what the proof uses.


Converting Jquery code to vanilla JS, option value selction and 'one' method not working

Question: I want to have a Jquery function converted to JS and I am having trouble implementing it.
The Jquery code is commented out, it works exactly as it should.
The main function takes a parameter with the selected option from the select menu(make sure to pick the LeftAndZoom option) and then applies the chosen animation to the container.
This is the main function, I simply cannot figure out how to convert this to JS.
$('#imageContainer').removeClass().addClass(x + ' animation').one
('webkitAnimationEnd mozAnimationEnd MSAnimationEnd
oanimationend    animationend', function(){
  $(this).removeClass();
});

This is the JS I have so far, I've tried many things, but to no avail yet.
function testAnim(x) {
var container = document.getElementById("imageContainer").
container.className = "";
container.classList.add(x + ' animation');
this.container.className = "";
}

I know this cannot possibly work, but it's still better than what I've tried.
And this is the accompaigning function, to extract the parameter value from the options list:
$(document).ready(function(){
$('.triggerAnimation').click(function(e){
  e.preventDefault();
  var anim = $('.jsanimations').val();
  testAnim(anim);
});

$('.js--animations').change(function(){
  var anim = $(this).val();
  testAnim(anim);
});
});

My JS for this is:
var trigger = document.querySelector(".triggerAnimation");
var JSanimation = document.querySelector(".js--animations");

trigger.addEventListener('click', function(e){
e.preventDefault();
var anim = JSanimation.options[this.selectedIndex].innerText;
testAnim(anim);
JSanimation.addEventListener("change", function(){
 var anim = this.options[this.selectedIndex].innerText;
});

});
Main issue here is, I don't know how to implement the JS equivalent 'one' method, how to keep "this" context and how to add a callback to the 'one' method
And on top of that, i get an error "Uncaught TypeError: Cannot read property 'options' of null"
Looks like the selection of the option value is not working either.
Link to pen:
http://codepen.io/damianocel/pen/KdobyK
Comment: Please put your attempted code directly in the question.
Comment: Is there a reason you have two hyphens in the class for the second call to `querySelector`? `js--animations` doesn't seem to be in your HTML, but `jsanimations` is. That would account for the TypeError.
Comment: @squint, I had found that code elsewhere a long time ago, and the -- never made sense to me, but it worked with the jquery code. I know, it's odd.But changing it does not help.
Answer: As for making a "one" type of function, here's one way:
function bindOne(el, evtTypes, callback, captures) {
  var allEvents = evtTypes.trim().split(/\s+/)

  allEvents.forEach(function(evtType) {
    el.addEventListener(evtType, function boundFn() {
      this.removeEventListener(evtType, boundFn, captures)

      callback.call(this, event)
    }, captures)
  })
}

The function defines 4 parameters...

el is the element to be bound
evtTypes is a space separated string of event types to be bound
callback is your event handler
captures indicates if you want bubbling or capturing for this event. You can usually just leave that one off.

Instead of binding your callback directly, it binds a function that immediately unbinds itself on the first event, and then manually invokes your original callback.
The way it keeps the proper this value is that it invokes your callback using .call(), which lets you manually set the value of this in the function being called.
So then you use it like this:
function testAnim(x) {
  var el = document.querySelector("#imageContainer")
  el.className = ""
  el.classList.add(x + ' animation')

  bindOne(el, 'webkitAnimationEnd mozAnimationEnd MSAnimationEnd' +
                                  ' oanimationend animationend', function() {
    this.className = ""
  });
}

Your TypeError is simply because there is no js--animations class in your HTML. Should be jsanimations.

Also, I would probably make your bindOne handle browser prefixes for you. That way you only need to pass 'animationend', and your function can unbind them all as well.
var needsPrefixes = {
  animationend: true
  // can add others as needed
}

var prefixes = ["webkit", "moz", "ms", "o"]

function bindOne(el, evtTypes, callback, captures) {
  var allEvents = evtTypes.trim().split(/\s+/)

  allEvents.forEach(function(evtType) {
    var doPrefixes = needsPrefixes[evtType.toLowerCase()]

    if (doPrefixes) {
      prefixes.forEach(function(prefix) {
        el.addEventListener(prefix + evtType, boundFn, captures)
      })
    }

    el.addEventListener(evtType, boundFn, captures)

    function boundFn() {
      if (doPrefixes) {
        prefixes.forEach(function(prefix) {
          this.removeEventListener(prefix + evtType, boundFn, captures)
        }, this)
      }

      this.removeEventListener(evtType, boundFn, captures)

      callback.call(this, event)
    }
  })
}

Comment: This is beautiful code, thanks very much. There is still an issue though, i get
"Cannot read property 'innerText' of undefined". Yes, I have tried both the js--animations and jsanimations. When i change that to the proper one, I get "Cannot read property 'options' of null".
Is this because the "this" might be out of context?
Comment: @damianocelent: In the event handler bound to the `trigger`, the value of `this` will be the `triggerAnimations` button, not the select list. The `.selectedIndex` should come from `JSanimation`, like... `JSanimation.options[JSanimation.selectedIndex]`
Comment: ...not sure why `".js--animations"` works and `".jsanimations"` doesn't. Use the one that works, I guess.
Comment: I have just set JSanimations as this, but what happens is, I can select the value, the error "Uncaught TypeError: Cannot read property 'innerText' of undefined".If i take away the this.selectedValue, I get "selected value is undefined".
Comment: Ok, I have now done JSanimation.value; This seems to work, but then when it tries to execute classList.add, I get the following, this one seems codepen specific??
"InvalidCharacterError: Failed to execute 'add' on 'DOMTokenList': The token provided ('LeftAndZoom animation') contains HTML space characters, which are not valid in tokens."
Tried to remove the space in x + " animation", but still the same.Will try to add x and then the animation class and see what happens, or I'll try className.
Comment: Phew, got it to work.There was a space after the classname in the html, "generated" by random line breaking on codepen...
Good to know, all the "this" is not needed here.
Btw, the getting of the selected value was def wrong, thank you very much for your help, this JS bindOne function is one of the most important things i have learned:-)


How can I connect two propane tanks together with a regulator?

Question: I just bought a park model home and the large propane tank was removed.
I bought 2 smaller tanks (30lbs each) and an auto change over regulator with two pigtails to attach to the 2 tanks.
What do I need to purchase to connect them all together?
The gas line coming from the ground still has the 1st stage regulator on it. Do I just need to add a hose to attach the 1st stage to the dual auto changeover regulator?
Any advice is appreciated - thanks
Comment: Why not contact the propane dealer and get large tank installed and do it right.
Comment: Why is there a gas line coming from the ground up? Where does it come from? How many propane tanks are involved in your set-up?
Comment: At a minimum, a picture of what you've got, and a drawing of what you want would be helpful.
Answer: You will need to connect the output of the auto change over regulator to the line coming out of the ground.
I am guessing you got the proper 1st stage auto change over.
houses and travel trailers usually have different setups. I had a travel trailer that had the auto setup it was a single stage.
I have built a few homes with propane and they have 2 regulators normally because the tank needs to be away from the home so the tank pressure is reduced by a first stage sent to the house and then reduced again by a 2nd stage.
If you have the wrong size regulator at the tanks the system won't work well because of restrictions in the plumbing.


Meteor make one user to read and update all docs

Question: I have written a publish function that gets the current userId and finds all docs related to that user. Now all users can only have access to read, update and delete what they created.
I want to add a user that will basically be an admin user that can access to read, update or delete all docs.
Is there a simple way this is achievable? Please see my push function code below, how can I add one admin user to the publish function?
<code>Meteor.publish("docs", function() {
    return Docs.find({ userId: this.userId });
  });

Meteor.methods({
  "docs.insert"(
    name,
    title,
    purpose
  ) {
    if (!this.userId) {
      throw new Meteor.Error("not-authorized");
    }
return Docs.insert({
      name,
      title,
      purpose
      userId: this.userId,
    });
  },
</code>
Creating and login users is already working. The only thing I need is for a general user to have access to all docs.
Answer: <code>    Meteor.publish("docs", function() {
      if (this.userId === 'superuser') {
        return Docs.find({});
      } else {
        return Docs.find({ userId: this.userId });
    });

    Meteor.methods({
      "docs.update"(
        docId,
        <props to update>
      ) {
        if (!this.userId ) {
          throw new Meteor.Error("not-authorized");
        }

        let userId = Docs.findOne({_id: docId}).userId;
        if (this.userId === userId || this.userId === 'superuser') {
          // Do the update
        } else {
          throw new Meteor.Error("not-authorized");
        }
    });
</code>
From https://docs.meteor.com/api/pubsub.html.
Comment: This successfully allows all docs to be accessible by superuser, but now superuser can edit docs. I want this superuser to also update and delete
Comment: This makes sense. Thanks


Why do I detect voltage on my ground of surge protector?

Question: Renting an older home and upon moving in was saddened to see outlets without grounds (two prongs). So, for one of the outlets I bought a 2 to 3 prong with ground clip and ran the ground to some vent duct work (resistance was less than 20 ohms per recommendations I've read).  After plugging in surge protector (ground light turns on) and plugging in a two pronged TV, everything works, however, I was surprised to find that my voltage detector picked up energy on ground. It's not 110V, but its something, not 100% sure how much because my meter is broken.
Is this normal? Is this just the surge protector should bring extra fluctuations down the ground? The strange part is this only happens when I actually plug a device into the surge protector.
Comment: Voltage from ground to what?
Comment: So you're basically saying: "My broken meter measures _something_ between a lump of ducting and some unknown reference point, please help."
Comment: I'd skip my morning coffee & donut and use the money to buy a receptacle tester instead.
Comment: I'm fairly sure surge protectors work by dump surges to the grounding conductor, so I'd say it's working as designed.  If you're seeing excess voltage on the ground of the surge protector, you should have the electrical system checked for excessive spikes.
Answer: More information needed.
What do you measure "energy on  ground" RELATIVE TO ?
If it was a hard ground you'd see 100 VAC from lobe to ground. If it is a low resistance ground your meter resistance will affect the result.
For a metwer connected from Vmains to "ground"
Vreading = Vmains x Rground / (Rground + Rmeter)
Some testers measure to local capacitive ground - sometimes the user touches a rear contact as a reference and their body capacity to "ground" is used as a reference. (Try not to "test" 10 kV circuits using these )
You say vent duct work resistance (to "true" ground?) was 20 Ohms. How do you know?
Be aware that by adding a low quality local ground you may INCREASE the risk of electric shock. See my answer to How does earthing work when earth is dry? to see why.
Comment: I detected voltage on ground using a voltage detector (one of those pens, tests from 50-1000V AC CAT III / 50-600V AC CAT IV).  I know this isn't the most reliable method of measuring voltage, I just find it peculiar that it detects voltage on my ground to the venting only when I have something plugged into the surge.

I know the duct is < 20ohm b/c I ran another temp ground wire to a pole in ground outside and tested the resistance between that pole and duct.

Thanks for the link, I'm still digesting your comment there.


Call a jquery function after SP.UI.ModalDialog.showModalDialog

Question: i try to call a function using jQuery after a SP.UI.ModalDialog.showModalDialog is loaded. Or to be more specific, i want to call the function while SP.UI.ModalDialog.showModalDialog is loaded.
This is the Dialog i want to Open:
var test = '

Assign to:
 <input class="inputPeoplePicker" type="text" name="taskname" id="txtTaskName">
';

$('body').append(test);

jQuery(".inputPeoplePicker").peoplePicker();

SP.UI.ModalDialog.showModalDialog({
    html: document.getElementById('correspondence'),
    title: "Aufgabe erstellen",
    allowMaximize: false,
    showClose: true,
    autoSize: true,
});

This is the jQuery command to load the function:
jQuery(".inputPeoplePicker").peoplePicker();

The peoplePicker() function is a function i call from jQuery Plugin i got from here: Plugin
The People Picker works well on a InputBox outside of the ModalDialog.
My Problem is that the PeoplePicker suggestions are shown behind the ModalDialog. It looks like this:
Screenshot
I believe that, when i call the function inside the ModalDialog the PeoplePicker suggestions are shown correctly.
Thank you.
Answer: My automatic guess is that the z-index of the SP.UI.ModalDialog is higher than that of peoplePicker.
Try tweaking the token-input.css file and setting the z-index higher, use your browser's element inspector to see the values.
Comment: That was really, quick. Thank your very much!


proving the infimum of a set

Question: I am trying to find the supremum and infimum of the set $A = \{1/x +(-1)^x|x \in \mathbb{N}
\}$.
Obviously, the supremum is $3/2$, however, I am not sure about the infimum. In the limit as $x \rightarrow \infty$, $1/n \rightarrow 0$ and since $(-1)^x$ is always either $-1$ or $1$, I would think the infimum should be $-1$, but I may be confusing the definition of a lower bound and an infimum.
Comment: The infimum is the greatest lower bound, so $-1$ is indeed correct
Answer: You are correct, the infimum is indeed $-1$. $-1$ is also a lower bound of $A$.
You can prove that $-1=\inf(A)$ by proving two things:

That $-1$ is a lower bound for $A$ (this one should be easy)
That $-1$ is the largest lower bound for $A$, in other words, that for all $\epsilon > 0$, the value $-1+\epsilon$ is not a lower bound for $A$.

proving the infimum of a set


Minecraft: using entitydata, putting items in a minecart with chest that have nbt data, in this case written books and renamed paper

Question: So, I've got a minecart chest named Command_Cart and I'm trying to make it so I can reset it with some items.
I put some written books and paper in, and used the command /entitydata @e[name=Command_Cart] {} to get its nbt data, which I put in a command. The only thing I changed was the author of the books, which I wanted to be "MeTheCommandCart". However, every time I run the command, it only resets the chest to empty.
The full command is this:
entitydata @e[type=chest_minecart,name=Command_Cart] {Items:[0:{Slot:0b,id"minecraft:written_book",Count:1b,tag:{pages:[0:"{\"text\":\"/gamemode @p 0\"}"],author:"MeTheCommandCart",title:"Gamemode 0",resolved:1b},Damage:0s},1:{Slot:1b,id"minecraft:written_book",Count:1b,tag:{pages:[0:"{\"text\":\"/gamemode @p 1\"}"],author:"MeTheCommandCart",title:"Gamemode 1",resolved:1b},Damage:0s},2:{Slot:2b,id"minecraft:written_book",Count:1b,tag:{pages:[0:"{\"text\":\"/gamemode @p 2\"}"],author:"MeTheCommandCart",title:"Gamemode 2",resolved:1b},Damage:0s},3:{Slot:3b,id"minecraft:written_book",Count:1b,tag:{pages:[0:"{\"text\":\"/gamemode @p 3\"}"],author:"MeTheCommandCart",title:"Gamemode 3",resolved:1b},Damage:0s},4:{Slot:4b,id"minecraft:paper",Count:1b,tag:{RepairCost:0,display:{Name:"Command goes under here"}},Damage:0s},5:{Slot:12b,id"minecraft:paper",Count:1b,tag:{RepairCost:0,display:{Name:"Command goes right of here"}},Damage:0s},6:{Slot:14b,id"minecraft:paper",Count:1b,tag:{RepairCost:0,display:{Name:"Command goes left of here"}},Damage:0s},7:{Slot:22b,id"minecraft:paper",Count:1b,tag:{RepairCost:0,display:{Name:"Command goes above here"}},Damage:0s}]}

This is exactly the Item nbt data it had, so I don't understand why it isn't working.
Comment: shouldn't it be `id:` instead of `id""`?
Comment: No, that was how it was showing up in the entitydata
Comment: doesn't hurt to try `id:"minecraft:written_book"`
Answer: Key names and values must be separated with a colon; your id tags are missing that colon.
You are also using an invalid quotation symbol ", when it needs to be " instead.
Fixed command, removing excess keys (list elements do not use keys, despite the output shown).
/entitydata @e[type=chest_minecart,name=Command_Cart] {Items:[{Slot:0b,id:"minecraft:written_book",Count:1b,tag:{pages:["{\"text\":\"/gamemode @p 0\"}"],author:"MeTheCommandCart",title:"Gamemode 0",resolved:1b},Damage:0s},{Slot:1b,id:"minecraft:written_book",Count:1b,tag:{pages:["{\"text\":\"/gamemode @p 1\"}"],author:"MeTheCommandCart",title:"Gamemode 1",resolved:1b},Damage:0s},{Slot:2b,id:"minecraft:written_book",Count:1b,tag:{pages:["{\"text\":\"/gamemode @p 2\"}"],author:"MeTheCommandCart",title:"Gamemode 2",resolved:1b},Damage:0s},{Slot:3b,id:"minecraft:written_book",Count:1b,tag:{pages:["{\"text\":\"/gamemode @p 3\"}"],author:"MeTheCommandCart",title:"Gamemode 3",resolved:1b},Damage:0s},{Slot:4b,id:"minecraft:paper",Count:1b,tag:{RepairCost:0,display:{Name:"Command goes under here"}},Damage:0s},{Slot:12b,id:"minecraft:paper",Count:1b,tag:{RepairCost:0,display:{Name:"Command goes right of here"}},Damage:0s},{Slot:14b,id:"minecraft:paper",Count:1b,tag:{RepairCost:0,display:{Name:"Command goes left of here"}},Damage:0s},{Slot:22b,id:"minecraft:paper",Count:1b,tag:{RepairCost:0,display:{Name:"Command goes above here"}},Damage:0s}]}


new 4-wire GE single-wall oven jts5000snss going into grandfathered 3-wire wall junction

Question:
so now apparently this entire thread switches to: DO I HAVE THE CORRECT WIRENUT to connect aluminum to copper?
did call an electrician who was honest enough to tell me that he doesnt need to come out to re-wire the house because its grandfathered, i can just wrap the green and white together with the aluminum... even kind enough to warn me that i needed to make sure i have the correct wirenut since i have an aluminum... umm... ground? (or neutral?)...  photos show my old oven, which had a bare copper ground... the NEW oven has the green and white, no bare wires... i dont remember what color the wires are under the green and white insulation
no, nevermind, NOT solved
SOLVED: GREEN & WHITE FROM THE OVEN WENT TO THE BARE SILVER
BLACK WENT TO NEUTRAL BLACK (or so i THOUGHT!)
RED WENT TO HOT BLACK
OVEN WORKS
(but for how long... calling an electrician)
should i start a new post?
OUT from MY WALL: I have BLACK + BLACK + unsheathed SILVER/ALUMINIM-looking wires
OUT from MY OLD OVEN: RED + BLACK + WHITE + unsheathed COPPER
one of the WALL BLACK is connected to my old oven RED (that would be hot i hope)
the other WALL BLACK is connected to the old oven BLACK... that must be NEUTRAL??
the WALL SILVER is connected to the old oven WHITE AND COPPER
my NEW oven has a WHITE wire taped to a GREEN wire (NO BARE WIRE)... a RED wire... and a BLACK wire
my installation instructions combine several models and configurations, with one of them saying to remove the tape that binds the green and white wires... why the $#%& would they tape the two wires together... only to instruct us to separate them?? and arent the green and white going to get connected to the copper anyway??
i noticed that whats really going on is the instructions sometimes specify the house wiring or the oven, but not every time!!
im dyin over here
Comment: Is safety important at all?
Comment: um, yah, id like safety
Comment: @NomarHaytEscobar -- hit "Edit" in "Share Edit" .. at the bottom left of your original post then use the button that looks like a "mountain and sun" painting to add pictures to it
Comment: Can you post photos of the inside of the box in question please?
Comment: i cant figure out how to add photos
Comment: @ThreePhaseEel photo is up                                                                                ..thanks
Answer:
SOLVED: GREEN & WHITE FROM THE OVEN WENT TO THE BARE SILVER BLACK WENT TO NEUTRAL BLACK RED WENT TO HOT BLACK OVEN WORKS

Not Exactly...
First issue is nomenclature: You said "BLACK WENT TO NEUTRAL". No, black (oven) went to WHITE (house wiring). With a 3-wire oven connection, white is a hot wire. 240V (US) uses 2 hots, neutral and ground. In certain situations, it can be either 2 hots + ground (240V appliance that doesn't need 120V) or 2 hots + neutral with no separate ground (your situation). In either of those cases, if one of the hot wires is black - which will almost always be the case if the wires are in a cable - then it is still hot and not neutral.
The bigger issue is safety. In the olden days, the setup you have was routine - two hots + neutral. Plus the neutral could be, under certain circumstances, bare wire instead of insulated. There was no separate ground wire.
The ideal setup is 4 wires to match your new oven - two hots (typically black & red), neutral (almost always white) and ground (green or bare). The catch is that doing so requires one of two things:

Retrofit ground: You can add a separate ground wire and connect it to the green wire and  connect your new oven white to only the silver wire. The catch is that the ground needs to be as large as it would be if it were a new installation. My guess is that would need to be 10 AWG or 8 AWG. The usual convenient other grounds are from other kitchen circuits, which are likely to only be 12 AWG. But this may still be easier than running a new cable.
New cable: Depending on your setup, that may be very simple (e.g., my kitchen is above the unfinished area of my basement with the main panel) or may be very hard/expensive (kitchen on a different floor from main panel at the other end of the house with finished basement and no conduit).

The good news is that in most areas the old 3-wire connection is grandfathered, so that you are likely legal connecting 4-wire to 3-wire, though it is not as safe as a 4-wire connection.
Wire Size!
However, there is one big factor that may make all the difference and require a new cable: Wire size. If your old cable is 10 AWG and the new oven requires 8 AWG (or 8 AWG and 6 AWG) then you must replace it, and once you are replacing it, you definitely need to bring it up to the modern 4-wire standard.
Check the specs for the oven and see what it says. If it does not specify wire size (AWG) then see what breaker size it specifies, as breakers determine the smallest wire you can use. If you already know you need to replace your breaker (or already did!) then that's pretty much a guarantee that you need larger wires == new wires == 4-wire.


Tool bar missing for text editor missing after installing 16.04

Question: Tool bar, (title bar, menu bar) missing for text editor after installing 16.04.
I found and entered this information:
<code>dconf reset -f /org/compiz/
setsid unity
</code>
but I have to enter the information every time I open a text editor document.
Comment: I'm not sure I understand what's happening here. Can you please [edit] your question and include screenshots to the two text editor states? You don't have enough reputation currently to embed images into posts but you can still include links to images in your question.
Answer: Gedit's new interface no longer includes a toolbar. It's been somewhat oversimplified. I think pretty much everything is in menus now.
If you really want the toolbar back, you can follow Videonauth's guide to downgrade Gedit, but it's quite complex. Unless you absolutely cannot stand the new look, stay with the current version.


How do you disable the sound calling makes?

Question: It happens friend of mine "call" me when I don't answer to regular chat messages. It of course is pretty annoying, and disturbes me when I am playing other non-steam games (well even steam games)
My question is simple : how do you remove/change/mute this sound? so when someone calls me, it doesn't destroy my ears ?
Answer: You could change the sound associated with the call and use a short, "blank" sound file or a very soft sound. It's probably voice_ringing.wav. You might have to redo this after a Steam update as Steam requires administration rights, when installed in Application folder (by default) and might overwrite the file. If it's installed elsewhere, it's still able to overwrite the file.

You can replace the following default sounds.
Program Files\Steam\resource
voice_busy.wav
voice_dialling.wav
voice_ringing.wav
warning.wav
Program Files\Steam\Servers
game_ready.wav

Another post there :

I finally replaced the message.wav succesfully!
Every time I changed the wav, and I restarted Steam, the old message.wav returned, but now, I changed it again to a much more soft sound, and set it to "ONLY READ".
Now Steam can not change it back and I'm cool with my new sound!
Here are the steps:

Grab a sound.
Convert it to wav.
Go to Steam/Friends.
Replace message.wav with the new sound. Name it message.wav again.
Set it to "Only read".
????????
MASSIVE PROFIT.
Comment: It could still get overwritten on an update. read-only flag is more of a suggestion than a strictly-enforced rule. You could mess around with file security options to make the file truly unmodifiable by a non-admin user, but then you might run into errors when Steam does updates. It seems like this is the best option available without an actual option in steam options, but I wouldn't be surprised if you have to re-do it at least after a major steam update.
Comment: worth noting that with a hack like this, you might see it changing back to the original sound file every time steam updates. or maybe only on major updates. (although this seems to be the only option)
Comment: Added that, it's true that Steam requires admin rights to update iirc


Button Action for adding items

Question: How to add more items to a Activity layout using a button on the same layout. Items include items like TextViews, EditViews etc which are required to be added to the same layout where the button resides. Please help me in this. Consider me a noob in Android development.
Answer: Since you are trying to add items via button you have to add components programatically.
Here's a example of how to add a button programmatically by clicking on a button:
final Activity act = this;
//the layout on which you are working
//if using LinearLayout cast it correctly
final RelativeLayout layout = (RelativeLayout) findViewById(R.id.layout_general);

Button btnAdd = (Button)findViewById(R.id.btn_add);

btnAdd.setOnClickListener(new OnClickListener() {
    @Override
    public void onClick(View v) {

        //set the properties for button
        Button btnTag = new Button(act);
        //if using LinearLayout change to LinearLayout.LayoutParams
        RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(
                LayoutParams.WRAP_CONTENT,
                LayoutParams.WRAP_CONTENT
        );
        //Set place in layout, make sure you change the values everytime you insert
        //another item otherwise the items will be placed on top of each other
        params.setMargins(200, 40, 100, 50);
        btnTag.setLayoutParams(params);
        btnTag.setText("Button");

        //add button to the layout
        layout.addView(btnTag);

    }
});

Add this snippet to your onCreate() and make the proper name changes and you are good to go.
Hope it helps.

Button Action for adding items


How to seal swamp cooler wires going into roof

Question: I was shutting down my swamp cooler for the season and notice that the sealant around the wires going down into the roof has opened up. I assume it would be a good thing to seal this to keep rain and snow out. What is my best bet to solve this?
Answer: The best way would be a total do-over.  Penetrate the roof with conduit rather than liquidtight and use two boots for two pipes.  The conduit is optional - the boot will work better cinched to a conduit that doesn't flex or move than it will with liquidtight.  But using two boots really isn't optional.
If I really had to try to make it work as is I'd try filling the boot with expanding foam.
I'd remove as much of the debris as possible, and keep the two liquidtights at least a half inch apart.  Then I'd fill the boot a couple inches at a time, letting the foam set up each time.  I'd use the low-expansion type foam made for doors and windows.  I'd top it off with some roofing adhesive for UV protection.
But I'd only do that in a pinch, and I wouldn't be surprised if it leaked, you should do it the right way, use two boots.


How do I make sure the driver for a TP-LINK tl-wn727n is loaded on boot?

Question: Last week I bought this adpator and had trouble getting it to work. How do I get a  TP-Link TN-WN727N usb wireless stick working? but thanks to some help got it running.
However the main issue now is that while the device works with the sudo modprobe -v rt2800usb, I'm having to input it every time I reboot the system.  Is there anything I can do to make this work automatically after a reboot.
Comment: I used the command 'sudo gedit /etc/modules' and add rt2800usb under the last item in the list.  Saved and rebooted.  Wireless started up automatically.  Thanks for the help
Answer: See the last post here:
http://ubuntuforums.org/showthread.php?t=1902715

sudo modprobe -v rt2800usb

and the wireless worked immediately.
I then removed the blacklisted drivers (which I added earlier) from
  /etc/modprobe.d/blacklist.conf
Next I added rt2800usb to /etc/modules. Rebooted and my wireless
  starts up automatically.
Comment: Welcome to Ask Ubuntu! Whilst this may theoretically answer the question, [it would be preferable](http://meta.stackexchange.com/q/8259) to include the essential parts of the answer here, and provide the link for reference.


ISO Live Session from an External Hard Drive?

Question: Is it possible to use an external hard drive to start a live Ubuntu session?
Is having an ISO file as the whole content of the first partition of the device enough?
Thank you for reading...!
EDIT upon reading the first comment to my original question:
If I remember correctly, I COULD run a live session of Oneiric Ocelot somehow.  It was not from a CD because I failed to burn one, so it must have been from an ISO file.  Still very very confused....
Comment: No.  Simply extracting an ISO onto a drive is not enough.  You could look at unetbootin or installing grub2 on the external drive and chainloading ISOs.  No details so it's a comment not an answer.
Answer: You just need to put your ISO on your external drive, then install Grub2 and configure it properly.
Let's assume your drive is /dev/sdb mounted under /media/Drive, then in a root terminal (use sudo -i to become root), type in :
grub-install --no-floppy --root-directory=/media/Drive /dev/sdb

You'll obtain a boot folder at the root of your external drive. Go to /media/drive/boot/grub and put there a grub.cfg file, containing something like (please adapt paths and ISO names to your needs - in the example below, ISOs are juste put at the root of the partition) :
set timeout=10
set default=0

menuentry "System Rescue CD 64 bits" {
 loopback loop /systemRescueCD.iso
 linux (loop)/isolinux/rescue64 isoloop=/systemRescueCD.iso setkmap=fr docache
 initrd (loop)/isolinux/initram.igz
}

menuentry "System Rescue CD 32 bits" {
 loopback loop /systemRescueCD.iso
 linux (loop)/isolinux/rescuecd isoloop=/systemRescueCD.iso setkmap=fr docache
 initrd (loop)/isolinux/initram.igz
}

menuentry "Ubuntu 11.10 64 bits ISO" {
 loopback loop /ubuntu64-11.10.iso
 linux (loop)/casper/vmlinuz boot=casper locale=fr_FR bootkbd=fr console-setup/layoutcode=fr iso-scan/filename=/ubuntu64-11.10.iso file=/cdrom/preseed/ubuntu.seed noeject noprompt quiet splash --
 initrd (loop)/casper/initrd.lz
}

menuentry "Ubuntu 11.10 64 bits alternate ISO" {
 loopback loop /ubuntu64-11.10-alternate.iso
 linux (loop)/casper/vmlinuz boot=casper locale=fr_FR bootkbd=fr console-setup/layoutcode=fr iso-scan/filename=/ubuntu64-11.10-alternate.iso noeject --
 initrd (loop)/casper/initrd.lz
}

As you can see, you can put others ISOs. Please note that all ISOs are not compatible ! For example you need to extract the content of a Fedora 16 ISO and use a slightly different configuration for Grub2 :
    menuentry "Fedora 16 64 bits Gnome" {
      set root=(hd0,msdos1)
      linux /fedora16-64/efi/boot/vmlinuz0 root=LABEL=InstalLinux live_dir=/fedora16-64/LiveOS/ rootfstype=auto ro liveimg rhgb locale=fr_FR bootkbd=fr
      initrd /fedora16-64/efi/boot/initrd0.img
    }
Also, note that your external drive must have a proper filesystem (avoid NTFS !) and that it's sometimes completely impossible to use some USB keys this way (don't know why... they just doesn't boot, event with boot flag set !)
Lastly, a suggestion : make two partitions on your external drive. One (typically FAT32 or ext?) where you will put your ISOs, and another where you wille be able to store data persistently.
Hoping this helps...
PS : Grub could complain at the first stage. You could use --force option, or reformat you external drive (making the first partition starting at 1 MB).
Also if you are using a system like DSL (DamnSmallLINUX) then it wont see ext4 partition extensions need to format external drive using ext3 for persistence.
Answer: You must use a tool called uNetbootin Download From Here
just point the file to ISO and your portable Drive
Also for a faster performance provide atleast 512 MB of persistence space
You can also Checkout the website PenDriveLinux.com for more info.
Comment: is in necessary to dual partition the hdd with a persistent usb, or if one desires only a single partition, just select as much space as possible for persistent installs? Thanks!


How to know what to do in order to complete a quest?

Question: So I recently started playing Divinity: Original Sin.
Definitely a favorite game so far, but I'm becoming flustered when trying to figure out what to do to complete a quest.
For example, it may say in the Journal "We should talk to Mr. Smith".
Unlike some other RPGs there is no "arrow/marker" for the next objective. Am I supposed to simply wander around until I bump into this "Mr. Smith"?
Answer: Typically the conversation in which you are told to find Mr. Smith will also give you some information about where to find him. Conversations are also recorded in the Journal, so you can always go and look there if you weren't paying attention as they took place.
In some cases, being on the right step of a quest will also add a dialogue option where you can ask folk for Mr. Smith's whereabouts.
If you just can't find the bugger, don't worry too much and just go explore a bit, you might just bump into him, or something else to distract you. In some cases quests stretch across multiple cities and it'll be a long time before you find who you're looking for.
Comment: I did not actually realize you could view conversations, thank you for sharing that!


How to identify skill books in Kingdoms of Amalur: Re-Reckoning?

Question: As I'm rummaging through shelves, is there a way to identify books as skill-raising?  I've been looting wildly, reading everything I come across, and haven't encountered anything that has raised a skill (AFAIK).  I assume there would be some kind of popup message telling you that you've read a book which increased a particular skill, and haven't seen that so far. I've been playing a while, am at level 20.  I'm also not picking up most books, just reading them, does that matter?
Answer: The skill books are clearly identified as such in their titles. There are only nine across the world (barring a known bug which sometimes spawns an extra one), and most are quest rewards or otherwise locked behind progress on side quests, especially the Faction quests. So they're quite rare. The ones that aren't quest rewards are generally hidden fairly well, and Amalur is a big place. At level 20, you almost certainly have access to the Sagecraft book, which is

 in a well outside St. Hadwyn's mission (you need Detect Hidden 2 to find things in wells).

You can go find that, so then you'll know what the skill books look like.
Comment: Thanks! Yup, that book's title is "Skill Book (Sagecraft)"


What is n-dimensional DFT as a linear transformation matrix look like? How it can be expressed as a matrix multiplication?

Question:
In the above picture, the Discrete Fourier Transform, for the case of 1-dimension is expressed as a matrix multiplication of the 1-D vector of length $N$ with a DFT matrix of dimension $N\times N$. I want a similar thing for a general case of n-dimensional DFT. That is, let $x$ be an n-dimensional object, say $N_1\times N_2\times...\times N_n$. I want to take a n-dimensional DFT of this object, by expressing as a product with a DFT matrix as in the case of 1-dimension example in the above figure. What kind of object would the DFT matrix (if i can call it a matrix) be? That defintely not a matrix product but something generalized to handle higher dimensions. Please provide me some theory and directions, or if it already exists, please point me to a reference.
PS : I don't know anything about Tensors, so Ia m not sure if tensors would help.
Answer: The DFT is separable so can be applied per dimension (e.g. apply on rows first, the on columns). The most natural way is indeed to write it as a tensor product: if $D_k$ is the DFT on $\mathbb{C}^{d_k}$ then $D_1\otimes \ldots \otimes D_n$ is the DFT on $\mathbb{C}^{d_1}\otimes \ldots \otimes \mathbb{C}^{d_n}$. Of course, being linear, this can always be written as a matrix after choosing some basis. As an example consider $\mathbb{C}^{2}\otimes \mathbb{C}^2$ with basis $$\{e_1\otimes e_1, e_2 \otimes e_1, e_1 \otimes e_2, \
e_2\otimes e_2 \}$$ Then in this basis $$ D\otimes D = (D\otimes {\bf1})({\bf1} \otimes D) = \begin{pmatrix} D&0\\ 0 & D \end{pmatrix} \begin{pmatrix} d_{11} \cdot {\bf 1}&d_{12}\cdot {\bf 1}\\ d_{21}\cdot {\bf 1}& d_{22}\cdot {\bf 1}\end{pmatrix} $$ where each entry in the last matrix is a diagonal $2\times 2$ matrix and $d_{jk}$ are the entries of $D$.
Comment: I think I would like to work in the tensor products as you have denoted instead of converting into matrix. But I might need to perform operations like addition and inverse on tensors. Where can I find the theory as I dont know anything about tensors and tensor products. Thanks.
Comment: The multidimensional DFT can be expressed as a Tucker decomposition (see section 4 of Kolda, Bader), where each of the factor matrices is the standard DFT matrix, and the core tensor is the original multidimensional array being transformed. A vectorized Tucker decomposition (i.e. you vectorize the core tensor, and vectorize the linear transformation representing the factor matrices) can be written via Kronecker products, although this isn't explained clearly. Specifically, the Tucker decomposition $A \times_1 F_1 \cdots \times_N F_n$, when vectorized,
Answer: Addition of tensors is entrywise. Tensors aren't (generally) used to represent linear transformations, and therefore don't have "inverses" in the sense of matrices. (The "inverse matrix" is the matrix which represents the inverse linear transformation. Matrix multiplication is only important inasmuch as it represents the composition of linear functions.)
A good introduction to tensors is Kolda, Bader, 2006, which can currently be found for free here. The "tensor product" described here is called "outer product" in Kolda, Bader. The "tensor product" in the answer above is called the Kronecker product here and in Kolda, Bader. The Kronecker product "tensor product" represents a vectorized form of the outer product "tensor product".
Specifically, given vectors $v_1, \dots, v_N$, and matrices $M_1, \dots, M_N$, then the outer product:
$$ (M_1 v_1) \circ (M_2v_2)\circ \cdots \circ (M_N v_N) $$
(using the "outer product" notation from Kolda, Bader) is an "order $N$ tensor", or a "tensor of order $N$" (using the terminology of Kolda, Bader), i.e. an "$N$-dimensional (multiway) array", an array where each entry has $N$ indices. If $\operatorname{vec}_{\operatorname{col}}$ denotes the colexicographical vectorization of a tensor (which is what is used implicitly throughout Kolda, Bader and in many other sources -- in the case of an order $2$ tensor, i.e. a matrix, colexicographical vectorization is the same as column-major vectorization) then one has that:
$$ \operatorname{vec}_{\operatorname{col}} ( (M_1 v_1) \circ (M_2v_2)\circ \cdots \circ (M_N v_N) )  = (M_N \otimes M_{N-1} \otimes \cdots \otimes M_1) \operatorname{vec}_{\operatorname{col}}(v_1 \circ v_2 \circ \cdots \circ v_N)\,, $$
where $\otimes$ represents the Kronecker product of matrices, so the multiplication on the right hand side of the above equation is standard matrix-vector multiplication.
Using the notation for mode-$n$ product found in Kolda and Bader, note that:
$$ (M_1 v_1) \circ (M_2v_2)\circ \cdots \circ (M_N v_N) = (v_1 \circ \cdots \circ v_N) \times_1 M_1 \cdots \times_N M_N \,,$$
so therefore we also have that the following identity is true:
$$ \operatorname{vec}_{\operatorname{col}}((v_1 \circ \cdots \circ v_N) \times_1 M_1 \cdots \times_N M_N) = (M_N \otimes \cdots \otimes M_1)  \operatorname{vec}_{\operatorname{col}} (v_1 \circ \cdots \circ v_N) \,.$$
Comparing this with section 4 of Kolda, Bader, we see that this gives a formula for the vectorization of a so-called Tucker decomposition. This result is a special case of Proposition 3.7 from a technical report by Kolda.
The multidimensional DFT can be expressed as a Tucker decomposition (see section 4 of Kolda, Bader), where each of the factor matrices is the standard DFT matrix, and the core tensor is the original multidimensional array being transformed. A vectorized Tucker decomposition (i.e. you vectorize the core tensor, and vectorize the linear transformation representing the factor matrices) can be written via Kronecker products as explained above, although this isn't explained clearly in Kolda, Bader.
Specifically, the multidimensional DFT corresponds to applying the 1-dimensional DFT to every mode of the tensor, so if $F_n$ denotes the DFT matrix of the appropriate size, then the multidimensional DFT of the array (called an "elementary tensor" in Kolda, Bader because it is an outer product of vectors) $A= v_1 \circ \cdots \circ v_N$ is:
$$ (F_1 v_1) \circ (F_2 v_2) \circ \cdots \circ (F_N v_N) = (v_1 \circ \cdots \circ v_N) \times_1 F_1 \cdots \times_N F_N \,.$$
For a general tensor $A$, not necessarily an elementary tensor, this generalizes to (because of the universal property of the tensor product, but don't worry about that for now) the following formula for the multidimensional DFT of a general (not necessarily elementary) tensor $A$:
$$ A \times_1 F_1 \cdots \times_N F_N \,.$$
However, in the DFT literature, at least that which I've been able to find, people (for whatever reason) almost never actually work with tensors: instead they vectorize everything. (Again, I don't know why, and I don't think it's a good idea.) So they will define multidimensional DFT in terms of Kronecker products of matrices, since this is the vectorization of the correct formula, $A \times_1 F_1 \cdots \times_N F_N$ given above, specifically you'll see:
$$ (F_N \otimes F_{N-1} \otimes \cdots \otimes F_1) \operatorname{vec}_{\operatorname{col}} (A) \,. $$
Also note that, since one has that (vectors are considered as column vectors, matrices with one column, so their Kronecker product is defined, see section 2 of Kolda, Bader):
$$ \operatorname{vec}_{\operatorname{col}} (v_1 \circ \cdots \circ v_N) = v_1 \otimes \cdots \otimes v_N$$
it is also true that
$$\operatorname{vec}_{\operatorname{col}} ( (M_1 v_1) \circ (M_2v_2)\circ \cdots \circ (M_N v_N) ) = (M_N \otimes \cdots \otimes M_1) (v_1 \otimes \cdots \otimes v_N)$$
and that
$$\operatorname{vec}_{\operatorname{col}} ((v_1 \circ \cdots \circ v_N) \times_1 M_1 \cdots \times_N M_N) = (M_N \otimes \cdots \otimes M_1) (v_1 \otimes \cdots \otimes v_N) \,.$$
Again, most literature on the DFT will refer to the Kronecker product of matrices or of column vectors as "the tensor product", and so they often define the multidimensional DFT of "the tensor product of vectors" $v_1 \otimes \cdots \otimes v_N$ as being $(F_N \otimes \cdots \otimes F_1)(v_1 \otimes \cdots \otimes v_N)$.
Compare the answer to this related question: Vectorize 3D discrete Fourier transform


Linking nghttp2 static library

Question: I want to compile a simple server app using nghtt2_asio in C++.
It compiles perfectly under shared libraries:
g++ server.cpp -O2 -std=c++20 -Wall -Wextra -lnghttp2_asio -lboost_system -lssl -lcrypto -o server
But as I compile it statically:
g++ server.cpp -static -O2 -std=c++20 -Wall -Wextra -o server -lssl -ldl -pthread -lcrypto -ldl -pthread -lnghttp2_asio -lboost_system
the linker gives me these errors:
/usr/bin/ld: /usr/local/lib/libcrypto.a(dso_dlfcn.o): in function `dlfcn_globallookup':
(.text+0x14): attenzione: Using 'dlopen' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
/usr/bin/ld: /usr/local/lib/libcrypto.a(b_addr.o): in function `BIO_lookup_ex':
(.text+0xd0b): attenzione: Using 'getaddrinfo' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
/usr/bin/ld: /usr/local/lib/libcrypto.a(b_sock.o): in function `BIO_gethostbyname':
(.text+0x72): attenzione: Using 'gethostbyname' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
/usr/bin/ld: /usr/local/lib/libnghttp2_asio.a(libnghttp2_asio_la-asio_common.o): in function `nghttp2::asio_http2::nghttp2_category_impl::message[abi:cxx11](int) const':
/home/user/Downloads/nghttp2/src/asio_common.cc:40: undefined reference to `nghttp2_strerror'
/usr/bin/ld: /usr/local/lib/libnghttp2_asio.a(libnghttp2_asio_la-asio_server.o): in function `int nghttp2::asio_http2::server::http2_handler::on_read<8192ul>(boost::array<unsigned char, 8192ul> const&, unsigned long)':
/home/user/Downloads/nghttp2/src/asio_server_http2_handler.h:103: undefined reference to `nghttp2_session_mem_recv'
/usr/bin/ld: /usr/local/lib/libnghttp2_asio.a(libnghttp2_asio_la-asio_server.o): in function `boost::asio::ssl::detail::engine::engine(ssl_ctx_st*)':
/usr/include/boost/asio/ssl/detail/impl/engine.ipp:55: undefined reference to `BIO_new_bio_pair'
/usr/bin/ld: /usr/local/lib/libnghttp2_asio.a(libnghttp2_asio_la-asio_server.o): in function `int nghttp2::asio_http2::server::http2_handler::on_write<65536ul>(boost::array<unsigned char, 65536ul>&, unsigned long&)':
/home/user/Downloads/nghttp2/src/asio_server_http2_handler.h:129: undefined reference to `nghttp2_session_mem_send'
/usr/bin/ld: /usr/local/lib/libnghttp2_asio.a(libnghttp2_asio_la-asio_server.o): in function `int nghttp2::asio_http2::server::http2_handler::on_read<8192ul>(boost::array<unsigned char, 8192ul> const&, unsigned long)':
/home/user/Downloads/nghttp2/src/asio_server_http2_handler.h:103: undefined reference to `nghttp2_session_mem_recv'
/usr/bin/ld: /usr/local/lib/libnghttp2_asio.a(libnghttp2_asio_la-asio_server.o): in function `int nghttp2::asio_http2::server::http2_handler::on_write<65536ul>(boost::array<unsigned char, 65536ul>&, unsigned long&)':
/home/user/Downloads/nghttp2/src/asio_server_http2_handler.h:129: undefined reference to `nghttp2_session_mem_send'
/usr/bin/ld: /usr/local/lib/libnghttp2_asio.a(libnghttp2_asio_la-asio_server.o): in function `int nghttp2::asio_http2::server::http2_handler::on_read<8192ul>(boost::array<unsigned char, 8192ul> const&, unsigned long)':
/home/user/Downloads/nghttp2/src/asio_server_http2_handler.h:103: undefined reference to `nghttp2_session_mem_recv'
/usr/bin/ld: /usr/local/lib/libnghttp2_asio.a(libnghttp2_asio_la-asio_server_http2_handler.o): in function `nghttp2::asio_http2::server::(anonymous namespace)::on_frame_not_send_callback(nghttp2_session*, nghttp2_frame const*, int, void*)':
/home/user/Downloads/nghttp2/src/asio_server_http2_handler.cc:230: undefined reference to `nghttp2_submit_rst_stream'
/usr/bin/ld: /usr/local/lib/libnghttp2_asio.a(libnghttp2_asio_la-asio_server_http2_handler.o): in function `nghttp2::asio_http2::server::http2_handler::~http2_handler()':
/home/user/Downloads/nghttp2/src/asio_server_http2_handler.cc:258: undefined reference to `nghttp2_session_del'
/usr/bin/ld: /usr/local/lib/libnghttp2_asio.a(libnghttp2_asio_la-asio_server_http2_handler.o): in function `nghttp2::asio_http2::server::http2_handler::start()':
/home/user/Downloads/nghttp2/src/asio_server_http2_handler.cc:274: undefined reference to `nghttp2_session_callbacks_new'
/usr/bin/ld: /usr/local/lib/libnghttp2_asio.a(libnghttp2_asio_la-asio_server_http2_handler.o): in function `std::_Bind<void (*(nghttp2_session_callbacks*))(nghttp2_session_callbacks*)>::_Bind(std::_Bind<void (*(nghttp2_session_callbacks*))(nghttp2_session_callbacks*)>&&)':
/usr/include/c++/11.1.0/functional:494: undefined reference to `nghttp2_session_callbacks_del'
/usr/bin/ld: /usr/local/lib/libnghttp2_asio.a(libnghttp2_asio_la-asio_server_http2_handler.o): in function `nghttp2::asio_http2::server::http2_handler::start()':
/home/user/Downloads/nghttp2/src/asio_server_http2_handler.cc:281: undefined reference to `nghttp2_session_callbacks_set_on_begin_headers_callback'
/usr/bin/ld: /home/user/Downloads/nghttp2/src/asio_server_http2_handler.cc:283: undefined reference to `nghttp2_session_callbacks_set_on_header_callback'
/usr/bin/ld: /home/user/Downloads/nghttp2/src/asio_server_http2_handler.cc:285: undefined reference to `nghttp2_session_callbacks_set_on_frame_recv_callback'
/usr/bin/ld: /home/user/Downloads/nghttp2/src/asio_server_http2_handler.cc:287: undefined reference to `nghttp2_session_callbacks_set_on_data_chunk_recv_callback'
/usr/bin/ld: /home/user/Downloads/nghttp2/src/asio_server_http2_handler.cc:289: undefined reference to `nghttp2_session_callbacks_set_on_stream_close_callback'
/usr/bin/ld: /home/user/Downloads/nghttp2/src/asio_server_http2_handler.cc:291: undefined reference to `nghttp2_session_callbacks_set_on_frame_send_callback'
/usr/bin/ld: /home/user/Downloads/nghttp2/src/asio_server_http2_handler.cc:293: undefined reference to `nghttp2_session_callbacks_set_on_frame_not_send_callback'
/usr/bin/ld: /home/user/Downloads/nghttp2/src/asio_server_http2_handler.cc:296: undefined reference to `nghttp2_session_server_new'
/usr/bin/ld: /home/user/Downloads/nghttp2/src/asio_server_http2_handler.cc:302: undefined reference to `nghttp2_submit_settings'
/usr/bin/ld: /usr/local/lib/libnghttp2_asio.a(libnghttp2_asio_la-asio_server_http2_handler.o): in function `nghttp2::asio_http2::server::http2_handler::should_stop() const':
/home/user/Downloads/nghttp2/src/asio_server_http2_handler.cc:333: undefined reference to `nghttp2_session_want_read'
/usr/bin/ld: /home/user/Downloads/nghttp2/src/asio_server_http2_handler.cc:334: undefined reference to `nghttp2_session_want_write'
/usr/bin/ld: /usr/local/lib/libnghttp2_asio.a(libnghttp2_asio_la-asio_server_http2_handler.o): in function `nghttp2::asio_http2::server::http2_handler::stream_error(int, unsigned int)':
/home/user/Downloads/nghttp2/src/asio_server_http2_handler.cc:47: undefined reference to `nghttp2_submit_rst_stream'
/usr/bin/ld: /usr/local/lib/libnghttp2_asio.a(libnghttp2_asio_la-asio_server_http2_handler.o): in function `nghttp2::asio_http2::server::http2_handler::resume(nghttp2::asio_http2::server::stream&)':
/home/user/Downloads/nghttp2/src/asio_server_http2_handler.cc:428: undefined reference to `nghttp2_session_resume_data'
/usr/bin/ld: /usr/local/lib/libnghttp2_asio.a(libnghttp2_asio_la-asio_server_http2_handler.o): in function `nghttp2::asio_http2::server::(anonymous namespace)::on_header_callback(nghttp2_session*, nghttp2_frame const*, unsigned char const*, unsigned long, unsigned char const*, unsigned long, unsigned char, void*)':
/home/user/Downloads/nghttp2/src/asio_server_http2_handler.cc:109: undefined reference to `nghttp2_submit_rst_stream'
/usr/bin/ld: /usr/local/lib/libnghttp2_asio.a(libnghttp2_asio_la-asio_server_http2_handler.o): in function `nghttp2::asio_http2::server::http2_handler::submit_trailer(nghttp2::asio_http2::server::stream&, std::multimap<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, nghttp2::asio_http2::header_value, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, nghttp2::asio_http2::header_value> > >)':
/home/user/Downloads/nghttp2/src/asio_server_http2_handler.cc:387: undefined reference to `nghttp2_submit_trailer'
/usr/bin/ld: /usr/local/lib/libnghttp2_asio.a(libnghttp2_asio_la-asio_server_http2_handler.o): in function `nghttp2::asio_http2::server::http2_handler::start_response(nghttp2::asio_http2::server::stream&)':
/home/user/Downloads/nghttp2/src/asio_server_http2_handler.cc:366: undefined reference to `nghttp2_submit_response'
/usr/bin/ld: /usr/local/lib/libnghttp2_asio.a(libnghttp2_asio_la-asio_server_http2_handler.o): in function `nghttp2::asio_http2::server::http2_handler::push_promise(boost::system::error_code&, nghttp2::asio_http2::server::stream&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::multimap<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, nghttp2::asio_http2::header_value, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, nghttp2::asio_http2::header_value> > >)':
/home/user/Downloads/nghttp2/src/asio_server_http2_handler.cc:454: undefined reference to `nghttp2_submit_push_promise'
/usr/bin/ld: /usr/local/lib/libnghttp2_asio.a(libnghttp2_asio_la-http2.o): in function `nghttp2::http2::determine_window_update_transmission(nghttp2_session*, int)':
/home/user/Downloads/nghttp2/src/http2.cc:577: undefined reference to `nghttp2_session_get_effective_recv_data_length'
/usr/bin/ld: /home/user/Downloads/nghttp2/src/http2.cc:578: undefined reference to `nghttp2_session_get_effective_local_window_size'
/usr/bin/ld: /home/user/Downloads/nghttp2/src/http2.cc:580: undefined reference to `nghttp2_session_get_stream_effective_recv_data_length'
/usr/bin/ld: /home/user/Downloads/nghttp2/src/http2.cc:582: undefined reference to `nghttp2_session_get_stream_effective_local_window_size'
/usr/bin/ld: /usr/local/lib/libnghttp2_asio.a(libnghttp2_asio_la-http2.o): in function `nghttp2::http2::check_nv(unsigned char const*, unsigned long, unsigned char const*, unsigned long)':
/home/user/Downloads/nghttp2/src/http2.cc:698: undefined reference to `nghttp2_check_header_name'
/usr/bin/ld: /home/user/Downloads/nghttp2/src/http2.cc:701: undefined reference to `nghttp2_check_header_value'
collect2: error: ld returned 1 exit status

Can someone explain me what happens?
Comment: In Linux most of libs are shared libs, which depend on other also shared libs. If you compile statically then you need all libs to be static, including those used by other libs. Bottom line: Don't do this. Linux is not Windows ;)
Comment: First line of the manual: libnghttp2_asio is C++ library **built on top of libnghttp2**. Where is libnghttp2 in your build script?
Answer:
Can someone explain me what happens?

There are several problems here.

You have unresolved symbols. As n.m. said in a comment, you need to add -libnghttp2.

Your order of libraries on the link line is wrong. Lower-level libraries should follow higher-level libraries on the link line. The right order is something like:

-lnghttp2_asio -libnghttp2 -lboost_system -lssl -lcrypto -ldl

See this blog post for explanation.

You are linking a fully-static binary.

Contrary to popular belief, such binaries (at least on Linux) are significantly less portable than dynamically linked ones.
What the warning is telling you is that IF you try to run this binary on a system that has a different version of GLIBC installed (could be a different system from the one you built on, or even the same system but after an upgrade to a different version of GLIBC), then your binary may crash (and very likely will crash).
You will be much better off not doing a fully-static link.
Note: you don't have to link against libnghttp2_asio etc. dynamically, just against the libc and libdl and libcrypto.

Linking nghttp2 static library


Why does reproduction fall off around ten years in?

Question: I've played twice now about thirteen years of the game.  It feels like my people are doing OK -- I can keep them at 4+ stars and 4+ hearts and they seem to start the game pregnant, so babies come up at first.  But then, after a while; certainly by year 10, no more babies are born and the villagers have started dying of old age and my population crashes down below 18 or so which feels like a tipping-point after which I can't generate all the stuff I need to -- not enough people to both mine iron and make tools, and I have to start giving up nutritional variety, etc.
And it feels like there aren't really that many more knobs to twiddle.  I'm pretty patient with games, trying again and again with different strategies; I just don't see what I might do differently.
So, are there factors that go into reproduction that I'm missing?
Comment: Do have empty homes? Reproduction rates drop if there aren't enough homes because villagers will only get married and have kids if their is a house for them to move into.
Comment: Ha; no!  I build homes until there's no one walking around with the homeless icon and then build more if that icon reappears.  Sweet, I'll try that.  (Make that an answer?)
Comment: Though actually, if that's the problem, shouldn't my population bob down due to housing shortage and then back up due to vacated properties?  It seems like any given set of houses would have a carrying capacity.  Maybe my population has to crash further (enough to entirely vacate a house) before I'd see that.
Comment: Wipqozn is right nad what you described is right as well. Population stagnated because you dont have enough homes, and if you don't build any you will see it slowly decline till homes empty then increase a bit as new families fill them in. Keep building homes as long as they fill up with 2 people for max growth
Comment: Is the game good? I absolutely love these kind of games, and this one looked good in the trailer. Is it fun?
Comment: So far!  I've read some concerns that there might not be enough depth but I'm still (obviously) mastering the basics.
Comment: Yeah, I wish there was more depth to it, but it's still enjoyable.
Answer: Villagers will only marry and produce children if there is an empty home for them to move into. That is, there can only be one pair of villagers producing children per house. As homes start to become available as your population dies of you will begin to see a growth in your population, but it'll eventually stop growing again since the villagers will just run out of empty homes again. If you want your population to continue to grow you'll need to continue to build new homes for villagers to pair off into and begin families. Be careful, however, since building too many homes can lead to your population growing faster than you can produce food and other resources to support it.
Comment: Yeah, I've verified that this solves my problem.  Thanks!
Comment: This is pretty much spot on.  If there are no children around, building a house should encourage two younger people to move into a house and start a family.  For this reason, I tend to build at least one new house every five years even if I'm not eager to have the population increase.
Comment: @Wipqozn But do students marry and have children as well? I have 5 students of varying genders but none of them are married while there is a home that sits empty.
Answer: Well the game says that once you have a town hall, trading post, and market then occasionally people will start to come ask to be a citizen in your town. it is therefore a great way to boost your population quickly. But also a disease outbreak may occur so be prepared.
Answer: If you're really advanced and have built your town hall you can use the statistics page there to see the number of houses and number of families. Always try to have 1-2 more houses than families, so the younger ones will move out when coming of age.
Answer: I've actually had the same issue.  I go good for about 18 years, then suddenly everything collapses due to deaths.  What I've started to do is every time I see the children fall under about 8, I build new houses.  This isnt always perfect...  But it works.  This most recent time I played, I actually only really survived because some nomads came through at just the right time.
Comment: I eventually adopted the strategy of building a new stone house any time there wasn't a house sitting vacant.  It seems like a solid approach but it takes checking on the houses every so often.


How to create unselectable TreeViewItem in WPF

Question: I'm binding TreeView. My reason is treeview level 0 is unselectable. When i click level 0 treeviewitem, current item must be collapse and first child item must be selected.
├ Item 1   //<- level 0. this item must be unselectable
├─ Child Item 11 //<- level 1
├─ Child Item 12
├ Item 2   //<- level 0. When i click this item, that is automatically collapse
├─ Child Item 21
├─ Child Item 22

How to do this using style?
Answer: I'd do it in my view model. The view model for level 0 items would have:
public bool IsSelected
{
    get { return false; }
    set
    {
        // error checking is omitted
        Children[0].IsSelected = value;

        // let WPF know that IsSelected may have changed from what it's expecting
        this.Dispatcher.BeginInvoke((ThreadStart)delegate
        {
            this.OnPropertyChanged(() => this.IsSelected);
        });
    }
}

Your XAML would look like:
<TreeView>
    <TreeView.ItemContainerStyle>

    </TreeView.ItemContainerStyle>
</TreeView>

Now whenever the user clicks on a level-one item, the VM will refuse to be selected and instead select its first child item.
You can use exactly the same technique to handle your requirements around collapsing levels.


Lego Flash/Shockwave game with an Indiana Jones vibe from the early 2000s

Question: In the same vein as this question, I'm looking for an old browser-based Lego game, maybe Flash, maybe Shockwave, that I played more than ten years ago.
It was 2D, platformer-like, and puzzle-oriented. There were 3 characters on the map, and you could switch between them at any time (many puzzles revolved around getting one character somewhere and using another to perform an action, to open a door, etc). There were items to collect, maybe a shield and a sword. There were buttons that could open doors, and enemies to capture. The game itself didn't take more than 20 minutes to finish (for a child).
Comment: Welcome to Arqade! I'm unsure to see the point of a same-minute posted self-answered game-identification question. It can serve a purpose when it's a widely searched question on a known game, but I'm unsure that creating a self-answered question for this specific case is useful.
Comment: Sorry if this is off-topic, I checked the network guidelines beforehand and they seemed to suggest that self-answered questions were encouraged. Since I had quite some trouble finding information about this specific game, I figured that a question containing relevant keywords about the game's content could eventually be useful to someone looking for it.
Comment: It's not off-topic, is just unusual
Comment: If someone is downvoting this post because this is unusual then that's... rude, if I may say.
Answer: The game is LEGO Orient Expedition: The Quest for the Golden Dragon, a Flash game released in 2003. It's now available in archival projects such as BlueMaxima's Flashpoint.


daemon refusing to execute unsafe program

Question: I want to start a service after my system start, here's my script in /etc/rc.local :
daemon /usr/bin/python /usr/local/google/home/yowang/Downloads/ftp.py > /var/log/pyftpd.log 2>&1

Error output at /var/log/pyftpd.log looks like this:
daemon: ignoring unsafe /etc/daemon.conf (/ is group and world writable)
daemon: fatal: refusing to execute unsafe program: /usr/bin/python (/ is group and world writable)

Can anyone help ? Thanks !
Answer: You have a mess with permissions.
System is arguing that everyone (group and world) can write and change those files.
Try (su for root or prepend sudo):
#chmod 644 /etc/daemon.conf
#chmod 755 /usr/bin/python


What file or setting controls user backgrounds in unity-greeter?

Question: Ubuntu 16.04 LTS Xenial
The unity-greeter background image for my user stopped inheriting my Unity desktop background. Whatever image I use, it is still stuck on Flora...
Selecting guest user changes to the default background, but selecting my username, it uses Flora, whatever different image I use once logged in.
I want to see what went wrong and make it inherit my desktop background image again. How to do it? What files or settings should I check out?
I have already tried changing dconf settings around com.canonical.unity-greeter schema, but had no luck at all...
Thanks!
Answer: I had the same problem an find a way. Look at https://wiki.ubuntu.com/LightDM
Changing the Wallpaper. I have created the file
<code>/usr/share/glib-2.0/schemas/10_unity_greeter_background.gschema.override
</code>
and compiled it with
<code>sudo glib-compile-schemas /usr/share/glib-2.0/schemas/
</code>
It worked for me.


JSON.parse fails in converting it to object

Question: I am getting a ng-class like this in my dom, how can i access the twitter and yahoo attributes here.
ng-class="{twitter:2 < id , yahoo :2 >id}"

typeof ng-class is object, but when i try to access it like elem["ng-class"]["twitter"] does not work.
While doing JSON.parse(obj) also fails.

Uncaught SyntaxError: Unexpected token t in JSON at position 1
Comment: Well, it's wildly invalid JSON, so it's no great surprise `JSON.parse` won't parse it...
Comment: There's probably another way to accomplish what you want.  If you explain **why** you want to access `twitter` and `yahoo` in your conditional class, we can probably give you some better options.
Comment: Explain "dynamic templating".  Angular does that beautifully, and I've never had to attempt to access the `ng-class` in my experience.
Comment: @Damon: It's an expression. Angular's `ngClass` directive understands that syntax, and will give the element the class `twitter` if the expression is true and won't if it's false.
Comment: @T.J.Crowder: How can i access the twitter property here?
Comment: It's not valid JSON, see: http://json.org/
Comment: @cale_b: I want those value for dynamic templating here...
Comment: try ng-class="{twitter:(2 < id) , yahoo :(2 >id)}"
Comment: Do you control what's in that string? That is, can you change it into legal JSON or would that break other things?
Comment: What is `2 < id`? Is that supposed to be a string or an actual comparator ?
Answer: What you have there isn't an object, it's a pair of conditionals in an ngClass directive: The element will have the class twitter if 2 < id is true, and will have the class yahoo if 2 > id is true (it will have neither of them if id == 2).
Since it's not an object, there's no property to access.
Comment: typeof ng-class="{twitter:2 < id , yahoo :2 >id}" gives me an object.. is there a way to access the twitter property here.
Comment: @Shane: I have no idea what you mean by `typeof ng-class`. I can't imagine any context in which you could write that and have it be valid code. Perhaps an [mcve] in the question would help.
Comment: typeof "{twitter:2 < id , yahoo :2 >id}" returns me an object instead of string... here is a fiddle http://jsfiddle.net/9wg1trx1/1/
Comment: I am trying to replace this {{ind}} with 0, 1, 2, 3, 4... so on
Comment: @Shane: What you're accessing there is an *attribute* on an element. You can get the text of the attribute via `getAttribute`, e.g. `val.getAttribute("ng-class')`: http://jsfiddle.net/9wg1trx1/2/ You can update the value of the attribute with `setAttribute`, **but** I very much doubt this is the right way to go about what you're doing, unless Angular hasn't yet been run on the elements in question (in which case, it should be fine). If Angular's already been run on the elements in question, it has presumably already tried to use that `ng-class` attribute with the `{{ind}}` in it.
Comment: angular has not run on the elements... i see the {{ind}} is always 1... instead of 0, 1 but anyway thanks a lot...
Answer: Please add quotes and () for values of object like this:
ng-class="{'twitter': (2 < id), 'yahoo': (2 >id)}"

With this update you not see Uncaught SyntaxError again!
Comment: Code-only answers aren't helpful.  Explain what you did, how / why it solves the problem.
Comment: Moreover, this has nothing to do with the problem or the question. The `()` there are completely unnecessary and change nothing.
Answer: Works as expected as you can see in this Plunkr
When interpreted by Angular, ngClass assigns class values to class element attribute.

when i try to access it like elem["ng-class"]["twitter"] does not work.

If you want to check if the DOM element has "twitter" class simply do it by querying the DOM.


Full switch locale: Ubuntu server installed with no locales, how to enable locales systemwide?

Question: I have a server with no X, installed with no locales. There is a "C" locale.
I need to:

run server scripts (no console involved) to copy, move and gzip files towards local ext4 file-system, which should contain files with special encoding (Czech, Korean, Russian etc.), so the UTF-8 should be enabled.
see the file-names when I type commands in the console
have possibility to type most of the file-names with special letters, when logged trough ssh.

What should I do to reach that state? Goal is to give complete guide to change locale systemwide (as default).
Comment: See if [this](http://askubuntu.com/questions/76013/how-do-i-add-locale-to-ubuntu-server)helps.
Comment: L- partially, but still there is default "C" locale involved...
Answer: I have to investigate it deeper and this solution helps me to solve it:
dpkg-reconfigure locales

choose cs_CZ.UTF-8 UTF-8 (default) and/or en_US.UTF-8 UTF-8
apt-get install console-data
dpkg-reconfigure console-data

set pc / qwerty / Czech / Standard / Standard or any other on your choice
dpkg-reconfigure console-setup

set Encoding to use on the console: UTF-8
set Charecter set: Latin2 - central Europe and Romanian, Fixed, 16 or any other on your coice
in file /etc/default/locale set
LANG=cs_CZ.UTF-8
LANGUAGE=cs_CZ.UTF-8
LC_ALL=cs_CZ.UTF-8
LC_CTYPE=cs_CZ.UTF-8

I dont know which steps are necessary, but after this all fonts and especially all ftp transfers and all tar-gzip actions work well.
Answer: I would generate the English (United States) locale.
sudo locale-gen en_US.UTF-8

The system wide locales are stated in /etc/default/locale in Ubuntu, so give that file the contents:
LANG=en_US.UTF-8

Comment: What about filenames? Still apears as  ?????.txt
Comment: Then are you sure the filenames are UTF-8 encoded?
Comment: (Did you reboot?)
Comment: @reboot: it is not possible without reboot? Actually, it is a server! And yes, unfortunate rebooted few times.
Comment: So, are the filenames showing up as ?????.txt UTF-8 encoded?
Comment: yes, actually, there is still LC_ALL=C, I will play wit that a while.
Comment: it directs me right way, but as answer it is incomplete. So finally, I will giv -1


Mobile Broadband Connection terminating automatically after 2-3 minutes

Question: I am connecting my mobile device with Ubuntu to access INTERNET, It connects easily but after 2-3 minutes it automatically disconnect and then I have to disconnect my mobile device and then reconnect it again to establish a connection. Cant understand what is the problem. No problem with my device as it works flawless with windows.
As asked here is more info:
Device is Samsung wave 575
Network Provider is Vodafone
and Ubuntu is 12.04
Answer: I did some research and as far as I can tell there should be no compatibility issues with the phone or network. However, IF you are on a prepaid plan, the terms of service state tethering is not allowed, which would likely be your problem. Even with a contract plan, only specific plans allow tethering so make sure you are on one of those plans.
Beyond this my only suggestion is to run an update on your phone.
Hopefully this helps!
Answer: Try this.

Delete the connection name (i'm sure it is in the network manager somewhere)
Add back the connection (whatever the connection)
Restart
Re-connect

It's what i do everytime.
Comment: what do you mean by everytime ?


Why does 120V line measure 26V?

Question:
The red wire has fed to fluorescent lights / LEDs for decades with 120V.  When the circuit breaker is open it reads 6V, breaker closed is 26V AC (Fluke DVM) between the red and white wire: no load open circuit as show in photograph.
For some reason the black wire is always powered with 120V.
What would cause the voltage to drop to 26V?
Please include any applicable test procedure with an answer.  Thank you
Comment: Think you know what comes next, go though the circuit backwards to find the broken connection/wire.  Voltage you are reading probably just phantom, especially that low.  Might find fried mouse.
Comment: What reference are you using? The white neutral? Is the red actually connected to anything at the other end. When I used to install ceiling lights in custom homes they all had a extra conductor (red) incase someone wanted to change from just a light fixture to a fan/ light fixture, it was one of many "selling points" when we built "spec" homes and some higher end track homes. It may be a phantom voltage or that would be my guess with the information provided.
Comment: What are you using to measure that? DVM's are too sensitive and tend to pick up crosstalk from other wires as mystery voltage. But there's nothing there.
Comment: The light was powered by the red wire and it has stopped working recently?  Was the black capped off and powered by another breaker?
Comment: @Crip659 Yes the light was powered by a switched red wire and recently stopped working.  The black wire is not controlled by a switch, capped and its breaker is unknown.
Comment: @Harper-ReinstateUkraine. I think you are indicating that the reading are misleading and that there is no voltage?   Furthermore, I need to get trace the red wire to find the other end and verify that it is connected to in what is in all likeliness ROMEX wiring?
Answer: When you open up a box to do a specific task, you often find wires that are either totally unrelated to your task, or dual-use: used by your task and also other unrelated things.   And this is where the novice messes up, because they don't care about the unrelated other things.
The classic scenario is going to change a lamp, and finding

A switched-hot wire that is only for the lamp
An always-hot wire that is NOT for the lamp (it serves other things, possibly the switch)
Neutral wires that serve both the lamp and other things.

You have all of the above in this box.  The black wire is unrelated to your project and wasn't connected to the lamp before, best to leave it the bleep alone.  If you find it is energized even when the "light" circuit breaker is off, then it is fed from a different circuit breaker - if it shares the neutral, it is a "Multi-Wire Branch Circuit" that is not properly handle-tied - that should be corrected!
However what you usually find in lamp boxes is an always-hot wire that is on the same circuit as the light, but is going onward to supply other lights or receptacles.
It's perfectly common in conduit installations to find wires unrelated to your circuit passing through a box.

Why does 120V line measure 26V?


make URL case insensitive in Yii2

Question: I'm trying to make the url in Yii 2 accept case insensitive URLs like
<code>api/gethotels
api/getHotels
</code>
How I can make these 2 urls point to the same method ?
If I try to put
<code> 'caseSensitive'=>false,
</code>
in urlManager in web.php, it returns

Setting unknown property: yii\web\UrlManager::caseSensitive
Comment: https://github.com/yiisoft/yii2/issues/3885
Comment: Stop trying to do that.
Comment: Welcome to Stack Overflow.  I have edited your post to fix English issues and to make it better.  I marked down the error message with > instead of 4 spaces.
Comment: Do you need all requests to be case insensitive or just a few?
Comment: @KostasMitsarakis Could you please answer this question with your valid reference? it would be helpful for future.
Answer: The creator of Yii framework (Qiang Xue), says about this feature in Yii2:

This is dropped because URLs are case sensitive. Case insensitive URLs
  are not SEO friendly.

You can find the source here:
https://github.com/yiisoft/yii2/issues/3885

make URL case insensitive in Yii2


Strange wiring in outdoor flood light. How to explain why previous "electrician" did it this way?

Question: The floodlight in the back of my house doesn't work, I also have a handful of mystery switches so I figured I would open up the fixture and make sure it was wired right (or at all, I've found a handful of switches and fixtures that just weren't connected).  I opened it up to look at the wiring and I found something very strange. How can I understand what is going on here?
Obviously because I can't draw white lines with white I did that with yellow lines. Also as you'll see from the schematic, three power lines come into the electrical box. And apparently (checking with my multimeter) there is actually power coming through on the white wire, not black. Very strange. Also those two unterminated white lines didn't even have wire nuts on them, it was just insulted wire. So I stripped them and covered them with wire nuts (not in the photo) to make sure there was no possibility of any arcing.
I've checked the voltage going through the white and black lines that connected to the light were only carrying about 5V of power so I figure that's got to be phantom voltage. When I connect the hot (white) wire with other wires I get about 60V, not 120.
How can I explain what is supposed to be going on here?
I'll probably have to call an actual electrician to look at this but what are some potential troubleshooting that I can do to fix it and/or figure out what is supposed to be done correctly?
Here's a photo of the wires:

And here is a drawing of the circuit:
Comment: I did run into something like this years ago: the cable on the left was your always hot with neutral tied to light, middle cable went back to the switch using only the black wire to power switch, the cable on the right went to the switch and only used black as the switched hot and connected to the fixture.  It was probably a novice who heard you can't use white as a hot so ran two cables and capped whites.
Comment: @jack I agree it could be a feeder to other lights or outlets also. I like keeping my outlets and lighting separate but on low budget jobs they get combined to save wire.
Comment: What's in the box where the switches are, are the two white wires uncapped there?
Comment: @JACK I may need to trace out the wires. I have 3 mystery switches all on the same breaker. Two of them are connected to power lines, and another is disconnected. What's strange here is that the uncapped white lines are in different power lines. Not the same one
Comment: @JACK to explain more, the disconnected switch does have two unterminated wires but they are part of the *same* NM cable whereas here they are part of *different* NM cables.
Comment: you're going to need to do some more investigating about those mystery switches and disconnected wires. There's no way we will be able to "guess" what's going on there to be able to tell you what to do...  what type of switches?  are any outlets switches?  are there any other boxes for flood lights?
Comment: @JACK I think you may be right. FYI - there are no other flood lamps or outside lights on this circuit. I'm not asking for an actual diagnosis of what's happening here though but rather, what could they have be thinking? Does this look like it was once on a 3-way switch? Why would one send 3 power lines into an outside electrical box like this?
Comment: Are there some wires just cut off and left uncapped in that box, or am I seeing things?
Comment: @PhilippNagel Yes, the center and right power lines each have their white lines left uncapped in the box.
Answer: To me it looks like you should have a feeder hot and neutral, once you figure out the feeder turn the power off and correct the light fixture.
a second location could be an outlet or a second switched fixture
last a switch leg but this whole mess was mis wired at some point,
You identified the feeder From above  , the white hot should be going to the switch (Connected to the black feeder). the black coming back from the switch Connected to your light's black wire and the light white to the feeder white.
Disconnect the one you don't know what it is turn the power back on and look for a receptacle that is now dead , or another light or switched light it could even be both.
If the cable that is disconnected controls both receptacles and switched lights connect to the feeder black to black, white to white and grounds together.
If the disconnected cable goes to a light or receptacle you want to be on the switch connect the ground and neutral the same as the last step but move the black wire of this cable to the switched black& light's black
That should cover every option I believe.

Strange wiring in outdoor flood light. How to explain why previous “electrician” did it this way?


How to remove tub drain?

Question: Take a look at attached picture of my tub drain which is corroded.
I tried this tool with no avail.
When I used more force with that tool, some pieces broke apart from it.
Now I ended up with what you see in picture. Red arrow is pointing to remaining piece of metal drain flange, which is stuck inside PVC drain pipe  where blue arrow is pointing.

how can I remove remaining metal piece? If I use hammer and screw driver to break it apart, I am worried that it can damage PVC plumbing work.

In the process, black rubber gasket came out from area between tub and PVC drain. Did I remove the part I wasn't supposed to ?

I can seethe gap between tub and PVC drain pipe. wondering how am I going to seal that gap. With new rubber gasket ?
Comment: You need to get that old rubber gasket (or a new one) back in between the tub and the flange of the waste pipe. That's what makes the seal to keep the water from leaking.
Comment: You may need to come through the floor from below or come through a wall to access this, if you are not pulling the tub. Most things will break if you apply enough force, and the repair gets more extensive when you break things...
Comment: google `golden extractor`
Comment: you removed the center part (with screw in the middle). HOW
Comment: That part is not screwed in, It is a rubber gasket insert. However you bathtub has seen its days and is rusting at that flange, not sure it can be repaired.
Answer: The way to safely remove the remaining metal part is to use a tool like this:

Picture Source: My Garage
Use the free end of the hack saw blade to cut in vertical direction from the inside of the remaining metal ring. Cut carefully to avoid cutting into the PVC pipe.
Often it is necessary to make several cuts around the perimeter. When the saw has cut almost all the way through it is often possible to then insert a small flat blade screw driver near the cut and a twist will tear the remaining portion of the cut area open. The metal ring should then just peel away. Be careful not to drop pieces down the drain.
Comment: Care should also be taken to not cut into the tub. And I love the picture credit! ;)
Comment: I will try this.
Answer: There are other tools similar to the one you referenced in your post.  I would try them before you risk ruining the tub with a hacksaw.   Search for "inside out pipe wrench" or "internal pipe wrench".
https://www.amazon.com/RIDGID-31405-Internal-Wrench-2-inch/dp/B0015B9SF6/ref=sr_1_2?keywords=inside+out+wrench&qid=1660832015&sr=8-2

How to remove tub drain?


Using methods of classes in android programming

Question: Hi everyone I am a beginner in android, please help.
I have DBAdapter class which has different methods to manipulate my db.
I want to call the method i.e. insert when button is clicked. However it only works outside of listener (View.OnClickListener).
    package com.dbclass;

    import android.app.Activity;
    import android.database.Cursor;
    import android.os.Bundle;
    import android.view.View;
    import android.widget.Button;
    import android.widget.Toast;

    public class DBActivity extends Activity {
        /** Called when the activity is first created. */
       @Override
       public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        Button btn1 = (Button)findViewById(R.id.Button01);
        btn1.setOnClickListener(btn1Listener);

        DBAdapter db = new DBAdapter(this);
        db.open();

        long id;
         // this needs to go to setOnclick method
        id = db.insertTitle(
                "0470285818",
                "Alanel",
                "Wrox");

        Cursor c = db.getAllTitles();
        if (c.moveToFirst())
        {
            do {
                DisplayTitle(c);
            } while (c.moveToNext());
        }
        db.close();
    }

    public void DisplayTitle(Cursor c)
    {
        Toast.makeText(this,
                "id: " + c.getString(0) + "\n" +
                "ISBN: " + c.getString(1) + "\n" +
                "TITLE: " + c.getString(2) + "\n" +
                "PUBLISHER:  " + c.getString(3),
                Toast.LENGTH_LONG).show();
    }
    private View.OnClickListener btn1Listener = new View.OnClickListener() {
        @Override
        public void onClick(View v) {
                 // db.insertTitle("0470285818", "Alanel", "Wrox");

        }
    };
}

Answer: Make your db variable a field of the DBActivity. You probably don't want to do db operations on the UI thread though.
Answer: It looks like you are closing db at the end of your onCreate() method.  You should make sure to open() and close() it again in your onClick().  You should also probably do the actual work in a background thread that you start from you onClick() method.
Answer: The scope of db is only within your onCreate() method.  You may want to make it a public member of your Class.