What's the difference between event handlers & listener?

Question: What is the difference between event handlers and event listeners in JavaScript? They both execute a function when the event appears.
I don't really get when to use event handlers and when to use event listeners.
Answer: A handler and a listener are one in the same - just synonyms for the function that will handle an event. "Handler" is probably the more accepted term, and is certainly more semantically correct to me. The term "listener" is derived from the code used to add an event to an element:
element.addEventListener('click', function() { /* do stuff here*/ }, false);

You could, however, get really nitpicky and break the two down into separate meanings.  If you're so inclined, "handler" could be the term for the function that is going to handle an event when you add a "listener", thus one can have several "listeners" that utilize a single "handler".  Consider:
// handler is synonymous with function
function someFunction(e) {
  if (typeof e == 'undefined')
   alert('called as a function');
  else
   alert('called as a handler');
}

// use someFunction as a handler for a
// click event on element1 -- add a "listener"
element.addEventListener('click', someFunction, false);
// use an anonymous function as a handler for a
// click event on element1 -- add another "listener"
element.addEventListener('click', function () { alert('anonymoose'); }, false);

// use someFunction as a handler for a
// click event on element2 -- add a "listener"
element2.addEventListener('click', someFunction, false);

// call someFunction right now
someFunction();

So in the above code, I have 2 "handlers" (someFunction and an anonymous function) and 3 "listeners".
Again, this is all semantics - for all practical purposes the terms listener and handler are used interchangeably. If a distinction need be made then a listener is a subscription to an event that will trigger a call to a handler (which is a function).
Clear as mud?
Comment: to make it consistent with the comments, you could make it "element1.addEventListener(...)"
Comment: More or less the same as in Java. http://stackoverflow.com/a/4725508/3184778. Makes more sense now. Thx
Comment: "Just synonyms for the function that will handle an event." That was a perfect explanation to me. Thank you!
Answer: There's no difference; it's just different terminology for the same thing.
There are different ways of associating functions with DOM elements for the purpose of event handling, that's all. The differences emerged back when standards were in flux (or just because implementors were ornery or difficult) but ultimately the mechanisms are essentially the same.
If you're confused about what sort of event handler registration to use, you can:

Read more about the topic and choose an approach to use, perhaps on a browser-by-browser basis;
Choose one of the popular JavaScript frameworks and use its mechanism for attaching handlers
Comment: But ... there's *no difference* between a "listener" and a "handler", so what you have is three listeners, or three handlers, or any combination.  It's probably **not** a good habit to mix the different ways of attaching handlers, in fact.
Comment: Thanks for the answer. So, when there is no difference between those two, I'm just gonna use the event handlers, because of the browser support. (I need two listeners, but only one handler).
Comment: Ehm, I won't mix them. I was just saying that I only need one handler instead of two listeners (one listener for the NS event model and one for the MS event model).
Comment: Is there a difference between the performance and memory efficiency of "listeners" and "handlers"?
Comment: @karthikaruna read the first sentence of the answer: **there is no difference**. Those are two different words for exactly the same thing.
Answer: This site, (which funnily enough has a cyclical reference to here by one of the comments) states otherwise, to what people have answered here (stating they are same); pasting one of the answers:
One difference is that if you add two event handlers for the same button click, the second event handler will overwrite the first and only that event will trigger. For example:
document.querySelector('.btn').onclick = function() {
  console.log('Hello ');
};

document.querySelector('.btn').onclick = function() {
  console.log('World!');
};

// This logs "World!" out to the console.

But if you use addEventListener instead, then both of the triggers will run.
document.querySelector('.btn').addEventListener('click', function() {
  console.log('Hello ');
});

document.querySelector('.btn').addEventListener('click', function() {
  console.log('World!');
});

// This logs "Hello" and "World!" out to the console.

Comment: This should be the accepted answer. There IS a difference.
Comment: To this point, the best and most succinct explanation I've seen on this matter is from [MDN](https://developer.mozilla.org/docs/Learn/JavaScript/Building_blocks/Events): "Event handlers are sometimes called event listeners — they are pretty much interchangeable for our purposes, although strictly speaking, they work together. The listener listens out for the event happening, and the handler is the code that is run in response to it happening."
Answer: I find this explanation particularly hands-on:

Event handlers are comprised of an event listener and a callback function.
  An event listener specifies the type of event that will be detected.
  The callback function executes when the event happens.
  Everything together is the event handler.
Answer: both of them used for associating a function when an event occurs, if using the event listener's you can listen more than once in A specified event (duplicate) for example listen to tow 'click' event into independent event listener's, but when using the handler it's impossible because handler is a property of your dom object and if Assign more than once a function in same event handler, for example, when set to the a element tow handler for onClick event, the last event handler assignment is work.
myElement= document.querySelector('#btn');

myElement.onClick = function(){
alert('first event handler');
}

myElement.onClick = function(){
alert('second event handler');
}

// result : occur last handler >> alert('second event handler');

but if using the event listeners you can listen to how many times listen to the same
event.

myElement.addEventListener('click',()=>{

alert('first listener')

})

myElement.addEventListener('click',()=>{

alert('second listener')

})

/* result : occur both listeners - alert('firstlistener') >> and next >> alert('second
listener'); */

Answer: there's no big difference.
we can say they are almost the same things except for three subtle things that are:

you can use an event handler once. if you use a handler to an element twice or more, then the last handler will overwrite all those previous handlers.
on the other hand, if you use event listeners more then once, there won't be such a thing like this.
you can use many event listeners, but not just one.
For some events, handlers only work with addEventListener. like the DOMContentLoaded event, which triggers when the document is loaded and DOM is built.
whit using event listeners, you can pass an object or class by using handleEvent on them instead of a function to the handler.
except for these subtle things, I don't think it exists any difference.

For more information see
https://javascript.info/introduction-browser-events#object-handlers-handleevent


Mongoid many-to-many relationship problem adding a record

Question: I'm using Mongoid/MongoDB with Rails and am trying to get a many-to-many relationship working.  Basically books and categories where books can be in multiple categories.  I keep getting an error:
undefined method `metadata' for "4e6aaec8ffb1900c19000002":String

when trying to add a new book and place it in categories.  The following is what I'm using for the models, form, create method and what the server is reporting.
It looks like it is trying to update book_ids and the cat_ids, but it's not getting anything for the cat_ids.  I've been trying lots of different things, but am not sure how to make this work.
The book model
class Book
  include Mongoid::Document
  field :title, :type => String
  field :description, :type => String
  has_and_belongs_to_many :cats
end

The cat model (categories)
class Cat
  include Mongoid::Document
  field :name, :type => String
  field :description, :type => String
  has_and_belongs_to_many :books
end

This is from the form that generates the category select and allows multiple selections:

  <%= label_tag "Cats" %>

  <%= f.collection_select :cats, Cat.all, :id, :name, {}, :multiple => true %>

The create method in the books controller:
def create
    @book = Book.new(params[:book])
    redirect_to(@book, :notice => 'Book was successfully created.')
end

From the server when submitting the form:
    Started POST "/books" for 127.0.0.1 at Fri Sep 09 17:30:37 -0700 2011
      Processing by BooksController#create as HTML
      Parameters: {"commit"=>"Create Book", "authenticity_token"=>"+OAIJM3NRPrUv0u1yfDEkkE2gvPQ7n0P6zPU9ZtqXlk=",
"utf8"=>"✓", "book"=>{"title"=>"The Golf & Tennis Book",
"cats"=>["4e6aaec8ffb1900c19000002", "4e6aaee8ffb1900c19000006"],
"description"=>"Both golf and tennis in this book, so it's in both categories."}}
    MONGODB blog_development['system.namespaces'].find({})
    MONGODB blog_development['cats'].update({:_id=>{"$in"=>[]}}, {"$pull"=>{"book_ids"=>BSON::ObjectId('4e6aafadffb1900c1900000b')}})
    MONGODB blog_development['system.namespaces'].find({})
    MONGODB blog_development['books'].update({"_id"=>BSON::ObjectId('4e6aafadffb1900c1900000b')}, {"$set"=>{"cat_ids"=>[]}})
    Completed 500 Internal Server Error in 24ms

    NoMethodError (undefined method `metadata' for "4e6aaec8ffb1900c19000002":String):
      app/controllers/books_controller.rb:46:in `new'
      app/controllers/books_controller.rb:46:in `create'

Comment: Ok, I'm embarrassed.  I see that I needed to define the cat_ids for the first argument in the collection_select (not use :cats as I was doing):

    <%= f.collection_select 'cat_ids', Cat.all, ...
Answer: This is invalid
book.update_attributes({:cats => [ cat.id ]})

should be this
book.update_attributes({:cat_ids => [ cat.id ]})

or
book.update_attributes({:cats => [ cat ]})


ASUS UX31A - A required CD/DVD drive device driver is missing

Question: I have a little issue with my ASUS UX31A. I just tried to do a clean install of Windows 7 64bit using a USB-Stick created using Rufus.
The laptop booted from the USB stick and opened the Windows installation, after a few clicks I got the message "A required CD/DVD drive device driver is missing. If you have a driver floppy disk, CD, DVD, or USB flash drive, please insert it now.".
I have tried literally every suggested trick (putting USB3 drivers on the stick, switching USB ports after error message...) but nothing works.
I have no idea how to proceed and would be happy for any helpful suggestions.
Comment: You could revert back to an older bios, like the one you previously had that worked for the USB stick at least otherwise you could call ASUS.
Answer: This message happens when you try to install Windows 7 via USB flash drive and use the USB device on a USb 3.0 port. Windows 7 doesn't support USb 3.0 out of the box, so you must inject the USB 3.0 drivers into the Boot.wim with DISM first.
dism /mount-wim /wimfile:boot.wim /index:2 /mountdir:mount

dism /image:mount /add-driver:"usb3" /recurse

dism /unmount-wim /mountdir:mount /commit

Now copy the modified boot.wim to the flash drive.


Are black and white holes linked?

Question: Theoretically, if black holes are entrances where you are sucked in and you appear somewhere else, do we come out of a white hole? I ask this because a white hole is the opposite of a black hole that cannot be entered, and only have things go OUT. So, does anyone think its certainly possible?
Comment: Black holes are not exactly entrances, and you don't really "appear somewhere else" when you enter a black hole, you just go into the singularity. To better understand the subject, I recommend you read the book "General Relativity from A to B" by Robert Geroch. It presents the subject in a light but precise way (and is short), I'm sure it will help you.
Comment: Possible duplicates: https://physics.stackexchange.com/q/7005/2451 , https://physics.stackexchange.com/q/45876/2451 , https://physics.stackexchange.com/q/156769/2451 , https://physics.stackexchange.com/q/288570/2451  and links therein.
Answer: White Holes (WH) are a theoretical possibility. It is theoretically possible that a Black Hole (BH) and WH could exist under certain conditions.
First, Einstein-Rosen obtained a general relativity solution where the two are connected by a neck or bridge, called the Einstein-Rosen bridge. Thing is later it was calculated that it could only be stable so that something could go from one side to the other if the bridge is made of so-called exotic matter, matter with negative mass.
Nobody has detected negative mass particles. But there are some theoretical constructs in string theory and other non standard model theories that have the possibility of exotic matter having appeared early after the birth of the universe, and they or some resulting wormhole may be detectable. We have found nothing like this, but we can't yet see (electromagnetically) much closer than 380000 years from the Big Bang, because of the recombination wall. Gravitational. Wave detectors in space, if big enough, could detect gravitational waves from earlier on, and possibly match them to what some of these theoretical constructs imply. So, nothing found yet, but it is not theoretically un-detectable, so semi-fair game.
The same is true with Einstein Cartan theory, with torsion in the gravitational connection (i.e., a non symmetric connection), where a wormhole may be possible. Nothing found yet supports Einstein-Cartan theory, but not fully disproven either.
So, yes, they are possible, though no evidence and maybe it just does not happen. Papers and so on still come out on it once in a while. Some people are studying it where it could be the beginning g of the universe with some models they propose about string theory M-branes pre Big Bang that led to it.
Not speculative, but far from any real good reason to think they are there somewhere. See the wiki article at https://en.m.wikipedia.org/wiki/White_hole
Answer: Well, not really. White holes, to the best of our knowledge, do not exist. They are theoretical, and are simply a mathematical by-product of general relativity. Working within those theories, it is the opposite of a black hole, yes. However, it does not mean that they are a pair, or a set. So even if white holes actually existed, they wouldn't be the output to a black hole, and wouldn't be linked.
Comment: No, it is precisely true.  A white hole solution is a black hole solution with the time-reversal operation applied.  One can think of several other, inequivalent, notions of the "opposite" of a black hole (say, a Schwarzschild black hole with negative mass parameter)
Comment: I'd phrase "the opposite" as more "they are time-reversed black holes".
Comment: That would be just as valid, I suppose, but no more true. After all, they can't exist here, so it's a moot point.
Answer: Short answer: We don't know yet but probably not (at least to me there seems to be no reason for it).
Black holes are just objects with very strong gravity. Black holes have been observed in contrary to white holes which are just theoretical concept. White holes should posses antigravity. Neither antigravity neither white holes have yet been observed. Everything that falls into the black hole gets atomized by very strong tidal force. If there was a white hole emitting matter from a black hole it would be very difficult to confirm that it's the same matter that once fell into black hole.
Lets assume there are several black holes and several white holes. You fall into a black hole. Which white hole would you pop out?
How do you distinguish the mass of the black hole itself from things that fall in? If you don't then even "pieces" of black hole would be emmited by white hole and the black hole would loose mass. In fact black holes could loose mass due to Hawking radiation but there is probably no link between Hawking radiation and white holes.

Are black and white holes linked?


Does an SMTP Server have to be reachable from outside our networks

Question: We have an environment set up with VMs and docker container. Now I have installed an SMTP Server with PTR Record bind to an IP and on the IP there is an VM running with a docker container on which there is an postfix server. (now that I write that down it seems quite complicated)
I just wanted to know if there is any reason, why we should have any ports open for anyone outside our networks.
Answer: If you want to use that server only as a relay to send your mail outside you don't, But if there will be mail sent from outside to that server, then yes.
Comment: Thanks for your answer. We are just using it as an relay host. But our mails are still getting into some SPAM folders and  I just recieved an message in our Log file, that we are "greylited" and have to try to send some mails later. I just wanted to make sure, that this is not a result of us blocking everything incoming...
Comment: Add it's IP to SPF records, check rev DNS. And yep, that's how most SMTP services fight with spam.
Comment: Okay, thanks for your help, I forgot to change all SPF Records, which might have been the reason for those SPAM results


What kind of puzzle is this?

Question:
Hello, I found this puzzle in an old puzzle book, it's fun. Does anyone know if this kind of puzzle has a name, I want to find more, and maybe try making some. Thanks very much!
Here is the cover of the book:
Comment: I'd just call this type of puzzle a "maze"; it just looks a little different and you have to use the rules to figure out where the "walls" actually are...
Comment: Welcome to the site! Could you be more specific about that "old puzzle book"? Knowing the exact source might help us to figure out the answer to your question.
Comment: ..and the walls may not be static!
Comment: Thanks, happy to be here. The book is called Puzzle Time Book 3, published by Grandreams Books Ltd in 2007, I found it in a second hand shop in New Zealand. It's got all sorts of word, number and picture puzzles, but no other puzzle the same as this one here.
Answer: I've seen this be called "Mazes With Rules" or "Logic Mazes"
see: https://www.logicmazes.com/dec99.html for Robert Abbot's take on the term, and if you want more of them he's published some online https://www.logicmazes.com/ as well as in two books https://www.logicmazes.com/super.html and https://www.logicmazes.com/mad.html
Completely agreed, they're lovely. So much more maze per maze
Comment: Aha you're right, the maze with the red-green-yellow dot sequence at https://www.logicmazes.com/super.html is the same concept. Thank you. I guess doing the sequence on graph paper squares like in the book really is an original idea, I love it.
Answer: Not the question, but for those curious about the answer to the maze:

Solve path:

 Breadth first search backward eliminating dead ends, until we got:

 Then it's forced until:

 Then trial and error from the start to reach that square after passing through a 3. Not that hard since we get to dead ends pretty quickly in many of the branches.
Answer: Since you mentioned creating your own such puzzles, you should take a look at this post. Ultimately the key insight is that this kind of maze can be represented by a totally ordinary maze problem on a directed graph, so standard BFS can be applied from any end.

What kind of puzzle is this?


Switch split screen game views in Portal 2 PTI

Question: In the Portal 2 Perpetual Testing Initiative (the map builder) you can test out your maps by going to the Game View. If you're building a co-op map, the Game View is automatically split screen, each controlled by one robot. How do I switch control of robots to test my map? Currently I can only control Atlas, but I need to switch over to P-body to complete the map. He's just sitting there, stuck at the beginning of the level.
I've tried using gestures, pinging, and keyboard shortcuts, but nothing has worked so far.
Answer: The console command you are looking for is swapsplit.
To enable the console, start by going to Keyboard settings, enable the Developer Console, go into the binds menu and bind the console to a key you won't forget. (I use tilde `)
Once you've opened the console, type in bind [KEY] swapsplit, replacing [KEY] with the key you want to bind it to. Then hit enter.
In order to make sure this stays between game sessions (Portal 2's a bit weird with that), type in host_writeconfig and hit enter again.
Now, whenever you press that key, your split screen controller should swap!
Note this was based off of memory and may not be 100% accurate.


Swift - How to know when the file is successfully download from url using FileManager.default.copyItem

Question: I have a scenario in which i have to download a zip file from url and once download completed i need to unzip it in async fashion. Problem here is FileManager.default.copyItem  takes sometime therefore i cannot immediately unzip the file. below is code for downloading zip file :
<code>   func saveZipFile(url: URL, directory: String) -> Void {
        let request = URLRequest(url: url)

        let task = URLSession.shared.downloadTask(with: request) { (tempLocalUrl, response, error) in
            if let tempLocalUrl = tempLocalUrl, error == nil {
                // Success
                if let statusCode = (response as? HTTPURLResponse)?.statusCode {
                    print("Successfully downloaded. Status code: \(statusCode)")
                }

                do {
                   try FileManager.default.copyItem(at: tempLocalUrl as URL, to: FileChecker().getPathURL(filename: url.lastPathComponent, directory: directory))

                    print("sucessfully downloaded the zip file ...........")
                    //unziping it
                    //self.unzipFile(url: url, directory: directory)

                } catch (let writeError) {
                        print("Error creating a file  : \(writeError)")
                }

            } else {
                print("Error took place while downloading a file. Error description: %@", error?.localizedDescription);
            }
        }
        task.resume()
    }
</code>
Being a beginner i want to know is there is any callback available in swift which can tell me the file is downloaded and is available for unzipping. I am using SSZipArchive library for unzipping the file.
below is code for unzipping it using
<code>   SSZipArchive.unzipFile(atPath: path, toDestination: destinationpath)
</code>
Comment: You can use call back function like completion handler
Comment: can u give a sample code or link how can i use it ?
Answer: URLSession works with two kinds of callback mechanisms:

Completion handler - this is what your code is using
URLSession delegates

To answer your question specifically, the completion handler that you have written in the code above will be invoked when the download is completed. Alternatively, if you want to do the same in a delegate method, the code should be something like this:
<code>import Foundation
import Dispatch //you won't need this in your app

public class DownloadTask : NSObject {

    var currDownload: Int64 = -1

    func download(urlString: String) {
        let config = URLSessionConfiguration.default
        let session = URLSession(configuration: config, delegate: self,   delegateQueue: nil)

        let url = URL(string: urlString)
        let task = session.downloadTask(with: url!)
        task.resume()
    }
}

extension DownloadTask : URLSessionDownloadDelegate {

    //this delegate method is called everytime a block of data is received
    public func urlSession(_ session: URLSession, downloadTask: URLSessionDownloadTask, didWriteData bytesWritten: Int64,
                       totalBytesWritten: Int64, totalBytesExpectedToWrite: Int64) -> Void {
        let percentage = (Double(totalBytesWritten)/Double(totalBytesExpectedToWrite)) * 100
        if Int64(percentage) != currDownload  {
            print("\(Int(percentage))%")
            currDownload = Int64(percentage)
        }
    }

    //this delegate method is called when the download completes
    public func urlSession(_ session: URLSession, downloadTask: URLSessionDownloadTask, didFinishDownloadingTo location: URL) {
        //You can copy the file or unzip it using `location`
        print("\nFinished download at \(location.absoluteString)!")
    }

}

let e = DownloadTask()
e.download(urlString: "https://swift.org/LICENSE.txt")
dispatchMain() //you won't need this in your app
</code>


Nerve fiber responses to intense stimuli

Question: Can one instantaneous, high-intensity stimulus performed on a nerve fiber generate a series of action potentials? Or are nerve fibers limited to one response action potential, no matter how intense the stimulus?
Answer: Short answer
It depends on your definition of 'instantaneous' and on your definition of 'stimulus'. I can safely say that secondary neurons can fire multiple action potentials to a single, short physical stimulus delivered to the associated sensory neuron.
Background
Physiologically, external stimuli are processed by sensory neurons. Sensory neurons generally work with graded potentials, not action potentials. Sensory neurons typically convey their graded response onto a secondary neuron that translates it into a frequency-modulated pulse train.
Hence, I interpret your question as "can a single, short stimulus delivered to a receptor generate multiple action potentials in the associated secondary neuron".
If sensory neurons were restricted to one action potential per stimulus, then a stimulus could only be detected in terms of its onset or offset. We can, however, sense prolonged stimuli. For example, we can perceive a continuous auditory tone and we can look at an image for extended periods without it fading away.
However, it all depends on the sensory system. A great example is the tactile system, where some receptors mediate prolonged sensations, whereas others only mediate onset or offset responses. Their associated secondary neurons are therefore classified as rapidly adapting and slowly adapting fibers.
Figure 1 shows the response profiles of various secondary neurons connected to different mechanoreceptors in the skin.

Fig. 1. Responses of various secondary neurons to tactile stimulation. Source: Mann (1997)
For example, the Pacinian corpuscle is a rapidly adapting mechanoreceptor. If it receives a static pressure difference, its associated neuron fires only a single action potential (or very few action potentials) at the start and end of the stimulus. Slowly adapting receptors causes their associated neurons to continue firing even after prolonged stimulation. Slowly adapting mechanoreceptors are Merkel's disks and Ruffini endings (fig. 2)

Fig. 2. Skin receptors. Source: Purves et al. (2001).
If you, however, mean with an 'instantaneous' stimulus a nearly infinitesimal short stimulus, then this question becomes a search for the shortest possible stimulus still capable of evoking a response in the secondary nerve fiber. In the auditory field, the shortest acoustic stimulus possible is probably the click stimulus, which is akin to a pulse stimulus. An acoustic click is hence about the shortest possible stimulus known to activate a sensory neuron. An acoustic click can be as short as 30 microseconds. A short stimulus like that, however, still evokes multiple action potentials in auditory nerve fibers (Parham et al., 1996). Admittedly, due to the mechanics of the inner ear, most notably the basilar membrane and the travelling wave the click evokes, the factual physiological stimulus may be longer, but in the auditory field at least, tens of microseconds is about as short as it gets.
Hence, I would answer "yes, instantaneous stimuli can evoke multiple action potentials in a given nerve fiber'.
References
- Mann. The nervous sytem in action (1997)
- Parham et al., J Neurophysiol; 76(1): 17-29
- Purves et al., Neuroscience. 2nd ed. Sunderland (MA): Sinauer Associates (2001)
Answer: If by 'nerve fiber' you mean a single neuron, the answer is definitely not.
Once a nerve 'fires', it fires completely. It depolarizes 100%, and further stimulus can't make it depolarize further. Once the stimulus is off and the nerve is finished repolarizing, further stimulus is needed to fire another action potential.
The nerve can't 'remember' that the previous stimulus was particularly intense and fire again.
If by 'nerve fiber' you mean a bundle of neurons, the answer is almost certainly not. Maybe you could get some cross-talk where some neurons didn't fire and then further down the fiber the action potential 'jumped rails' and propagated back to the site of stimulus, maybe you could count that. I wouldn't rule it out but the layout of neurons would need to be really strange.


Add Attendees to Meeting

Question: I want to schedule a Webex Meeting. When seeking to invite attendees,the Attendees text box is asking me to type in email addresses. There must be a way to select from my list of contacts. I have a distribution list defined in contacts that I could use.
How do I do this?
Answer: You're using the web interface to schedule a meeting. The web interface doesn't have access to your contacts, so have to type in or copy/paste all addresses.
Alternatively, you can schedule meetings from MS Outlook or possibly similar products. Inside Outlook you have Access to your normal contacts, which might be what you want.
Note: Webex web interface remembers emails entered, so next time you don't have to type them in manually again.
Comment: I've since discovered that access to contacts is available through the classic view, as opposed to the modern view.

Add Attendees to Meeting


Can Shimano Claris R2000 shifters be paired with Claris 2400 derailleurs?

Question: Can I use the modern looking shifters with the older model derailleurs without any problems in shifting?
Answer: Yes, you can use any 8 or 9 speed rear derailleur (with the traditional cable pull ratio, but SRAM 1:1 does not matter here) with 8 speed shifters. The same for the front ones. That includes these two Claris generations.
Your combination is compatible.
Answer: The general rule is that all Shimano road components of the same 'speed' (8, 9, 10 etc) are compatible. There are exceptions though, most people seem to not realize that Shimano publishes very detailed specifications and compatibility information which is worth checking.
Check Rear Drivetrain Compatibility, search on page for 'RD-24400', you see there is a connection for both SS and GS types to the ST-R2000 shifter.
Check Front Drivetrain Compatibility, search on page for 'FD-2400', you see there is not a connection ST-R2000 shifter. The R2000 shifter is only compatible with the FD-R2000 front derailleur.
It's generally known that Shimano used the same 'classic' cable pull ratio for all road groups up to 10 speed which is responsible for wide compatibility, but that holds most true for rear derailleurs. I suspect that Shimano changed the front cable pull ratio on the R2000 groupset for better front shifting.
You could try the older front derailleur with the newer shifter and it may work OK. If it doesn't swap out the front derailleur, they are relatively inexpensive compared to the shifters.
Comment: The Dura-Ace parts having 8 speeds or less use a different cable pull ratio. So certainly not all road groups up to 10 speed use the same cable pull ratio.
Comment: OK, it could have been an update to https://www.reddit.com/r/bikewrench/comments/74xyig/are_shimano_front_derailleur_shifters_and/ "new cable pull ratio, that to the extent of my current knowledge, has only propagated from Dura-Ace down to Tiagra (4700)." However, it should also be present at Sora then, r2000 and r3000 have even a single shared manual.
Comment: @VladimirF I don't thing R2000 has the 11 speed cable pull seen on 4700. It's only the FD that Shimano says is incompatible. That may be for other reasons than cable pull or they just don't feel it works quite as well as it should.
Comment: @ArgentiApparatus I do understand this is only about the FD, the RD is standard pull 100%. I actually believe the RD is too but I do admit I am not sure.


Three finger swipe to change workspaces

Question: I am looking for a way to make three finger swipe to the left or right change to different workspace on ubuntu 15.04 with unity environment. Best I found was a comment down in Touchpad gestures to change workspace , but it looks out-of-date and didn't work.
Answer: Yes, the Touchegg might be a good solution for Gnome or Arch linux users, but XSwipe is the best for Ubuntu with Unity I have used so far. Check it out!
The configuration may take a couple of hours but it worth.

Three finger swipe to change workspaces


Why does heptane have an odour

Question: I read that alkanes are 'colourless and odourless'. Heptane is an alkane. Why does heptane smell like heptane? Impurities?
Comment: Alkanes as molecules cannot interact with most receptors, as receptors usually bind to polar or charged groups and to lesser extent to double bonds. This makes light alkanes in small concentrations indeed odorless and colorless. However, alkanes may dissolve in lipid membranes, changing their properties. In addition, yes, alkanes usually are impure. Likely, the most common impurities are alkenes, that also can produce further impurities on contact with air under UV.  || not an answer, as I'm not an expert on odor theory.
Answer: Some higher-molecular weight alkanes definitely have an odor, but they aren't as intense as most of the compound types you'll find stinking up an organic lab.

"The odor threshold for hexane is 130 parts per million (ppm), with a faint peculiar odor reported." ---http://www.epa.gov/ttnatw01/hlthef/hexane.html
"[Heptane is a] colorless liquid with a mild gasoline-like odor." ---http://www.cdc.gov/niosh/docs/81-123/pdfs/0312.pdf
"Alkanes have relatively high odor detection threshold (37 to 50 mg/m$^3$ for dodecane) as compared to other VOC groups such as sulphides (0.0003 to 0.16 mg/m$^3$  for
dimethylsulphide), phenolics (0.022 to 4 mg/m$^3$  for phenol), and nitrogen heterocycles (0.0004 to 0.0008 mg/m$^3$  for skatole) (O'Neill and Phillips, 1992)" ---http://www.bae.uky.edu/jbicudo/odorVOC_02a.pdf

According to the following paper, there are apparently at least two olfactory receptors  in rats that respond to alkanes; one accepts alkanes with areas around 3.5 nm$^2$, and another  responds to hydrocarbons with areas of about 5 nm$^2$. The authors note that response to cycloalkanes is higher than for normal alkanes, so the shape matters too.

"Concanavalin A reveals olfactory receptors which discriminate between alkane odorants on the basis of size." ---http://www.ncbi.nlm.nih.gov/pubmed/2803264
Comment: Just wanted to add that gasoline in cars is mainly composed of alkanes from 6 to 12 or 14 Carbons. If I'm wrong please correct me.
Comment: gasoline is never pure, it usually has alkene impurities, and sometimes special antidetonation additive.
Comment: @permeakra, yes, the smell of gasoline comes from many stinky non-alkanes, so I'll retract that as an example. Nevertheless, I have no problem smelling pure heptanes or hexanes, do you?
Comment: @FredSenese When I'm not breathing in vapors directly from the bottle, I do have such problem. Comparing to such solvents as pyridine, ethyl acetate and acetone, hexane (I have not worked with heptane, though) virtually has no odor. On the other hand, even $\ce{CO2}$ in high concentrations produces some feeling.

Why does heptane have an odour


Symmetry in the method of images for a charge and a conducting sphere

Question: This is a doubt on the method of images from J.D Jackson's Classical Electrodynamics first edition, Chapter 2. While trying to find the potential of the configuration of a conducting sphere and charge, he says that by symmetry, the image charge $q'$ must lie on the ray joining the center of the sphere and charge $q$, where $q$ is the original charge and $q'$ the image charge. Mathematically, one can show it by using Apollonius' circles, but what is the symmetry that the author is talking about, which ensures that the charges and centre of sphere must be collinear?
Answer: The set up is symmetric above and below the axis containing the sphere centre and charge, so the solution must also be symmetric about this axis.  If we want the simplest solution of one image charge, it must lie on this axis.
More precisely, you could say there is azimuthal symmetry present (the solution should look the same if I rotate the system about the special axis).
Comment: Also, mirror symmetry.
Comment: So can we have solutions where the charge doesn't lie on the axis? Also, we are emphasizing azimuthal symmetry here because the thing we are looking for(the potential) is a scalar quantity right?


Is there any penalty for failing to cross the Gauntlet?

Question: If you attempt to cross the Gauntlet (in either direction) and fail the die roll, do you suffer any penalties (beyond staying on your current side of the Gauntlet, obviously). Our Storyteller recalls a penalty in W:tF 1e, but we have not found any mention of one in the 2e rule book.
Answer: Crossing the Gauntlet ("Reaching") is described on pages 100-101 of W:tF 2e. There is no penalty specific to a failed attempt to reach.
Note, however, that successive attempts can impose a cumulative -1 penalty to the roll if "time is short and the situation is tense" (W:tF 2e, page 162).
Comment: In general in nWoD (and I think they made this clearer in 2e). Any time you fail a roll to do a task, future attempts at that task during the same scene (i.e. retries) are made at -1 die. However, in 2e I know there are several rolls which explicitly do not apply that penalty.  Can you clarify your answer as to if it is one that explictly does not; or if you mean "there is only the normal penalty on retries, and no additional effects."


Google analytics Cookies

Question: In my browser cookies are creating by name __utma,__utmb and so on if i reject cookie creation.I think this cookie is for google analytics.Anybody know how google creating this cookie even browser not supporting cookie creaton.Thanks
Answer: Yes, those are Google Analytics' cookies.
Here's how GA sets/updates them:
when a browser requests a web page that contains the GA tracking code (GATC), the GATC sets/updates the cookies in browser. The GATC then sends the data held in the cookies back to the GA servers via an HTTP Request for __utm.gif (aka, the "tracking pixel"). The data held in the cookies are appended to that Request along with other information. You can identify which of that information was taken from the cookies by checking this Request " utmcc"--the cookie values are everything on the right side, e.g.:
utmcc=__utma%3D117243.1695285.22%3B%2B __utmz%3D117945243.1202416366.21.10. utmcsr%3Db%7C utmccn%3D(referral)%7C utmcmd%3Dreferral%7C utmcct%3D%252Fissue%3B%2B
In the basic implementation, Google Analytics creates/sets/updates three first-party cookies:
__utma: Visitor ID, which persists for two years;
__utmb:  Session ID, which persists for 30 minutes of inactivity
__utmc : also Session ID, which persists until the user quits the browser;
These aren't the only cookies GA uses, these are just the standard set; for instance, __utmz is used to store values of GA-account-owner-defined campaign variables; __utmv is used to create custom visitor segments, and __utmx is for the Google Website Optimizer (split-path testing).
The Visitor Identifier, __utma, is comprised of four components: a domain hash, a random unique ID, timestamps (marking initial visit, previous session, current session), and a session counter (just a single integer); i.e., (domain hash).(random).(time initial).(time previous).(time current).(session count)
The Session Identifiers, __utmb and __utmc, are comprised of a domain hash + time, and domain hash, respectively; i.e., __utmb = (domain hash).4.10.(time); __utmc = (domain hash)
Answer: In __utmb, the 2nd and 3rd parameters (4 and 10 in your example) appear to be related to event tracking.
When a track event is sent off, the 2nd parameter increments. The 3rd parameter will also decrement, but it not clear what correlation the decrease has with the 2nd parameter.

Google analytics Cookies


Would it be illegal to upload the source code of a computer virus I developed?

Question: If I upload source code of a virus I have developed so that the larger software community could benefit from developing solutions to tackle the virus, and if somebody else uses my source code to harm other people, am I liable?
Comment: You've got some weird tags there - US, and then a UK law.
Comment: @DM Yeah , it's because I wanted to know about laws regarding this for both US and UK.
Answer: Your liability would be analogous to your liability for publicizing any other dangerous fact. The source code for numerous viruses has been made public e.g. on Github for exactly this purpose, though the examples which I found were viruses for which there are cures, such as the CIH virus. Publicizing a system weakness that enables a virus to be promulgated, or actually publicizing code that demonstrates the weakness, is similar to publishing bomb-making instructions. First Amendment considerations in the US weigh against any regulations. Aiding and abetting law requires more than just providing information that can be used in the commission of a crime, but that is a possible avenue for liability (see Rice v. Paladin). In that case, a central issue was whether the publication was communication of ideas, but the final appellate decision was that "The book directly and unmistakably urges concrete violations of the laws against murder and murder for hire and coldly instructs on the commission of these crimes. The Supreme Court has never protected as abstract advocacy speech so explicit in its palpable entreaties to violent crimes".
Answer: Unless you wrote that virus yourself and own the copyright, you start with committing copyright infringement.
Your explanation "the larger software community could benefit from developing solutions to tackle the virus" is rubbish. If that was your intention, then you would post a notice that you can make the source code available, and then give it to people who identify themselves and can demonstrate that they are trustworthy. What you are doing makes the source code available to every **** hacker in the world.
So DON'T DO IT. Whether it's legal or not, it is a stupid dick move. Everyone who could ever employ you for legal work will not be impressed one bit by this. Nobody needing to trust their employees will hire you. And especially in the USA, the biggest question is not whether it is legal, but whether someone is going to sue you. Anyone affected by this virus can claim that it happened because you published the code and take you to court, which will cost time and money even if there is no judgement against you.
Comment: This doesn't answer the question at all and is just an opinion...


Story involving a young Merlin

Question: I'm looking for a book series I read in middle school about a younger Merlin (I believe he may have been referred to as Emrys through the majority of the series though). It started in an unnamed village where he was adopted by a woman. Very early in the story, there was a fire and Merlin lost his eyesight. I remember on the cover there was a teenager with a bandanna around his eyes who was standing against a blue sky. He may have had a hawk of some sort and a wizard's staff. I also remember on this cover it took a jab at Harry Potter's popularity, so they may have been released at or near the same time. If someone could help me find this, I'd greatly appreciate it.
Answer: The Lost Years of Merlin

The Lost Years (originally called The Lost Years of Merlin) is a work of literature by T. A. Barron, published by Penguin Group USA. It tells the tale of the legendary wizard Merlin's youth. Though the character Merlin is world famous as an ancient wizard, this story of his lost youth is original to the author. The title applies to both the first book in the series, and also to the entire eleven-book epic.

....

The woman declares herself the boy's mother, and that her name is Branwen and his is Emrys. Years later, Emrys finds that he has magical powers and eventually uses them to defend Branwen against a terrorizing bully who is trying to burn her at the stake. Tragically, he accidentally sets a tree on fire which collapses on a boy whom Emrys tries to save and fails.
Emrys, in his attempt to help the boy, goes blind from the fire, but learns to see through a visual "second sight", after swearing never to use his powers again. After learning to sense well enough to be mobile, Emrys leaves Branwen at the monastery where he had been treated for his burns, and sets out to find his true home.

Here's a cover with staff and hawk against a blue sky albeit with no bandanna:
Comment: Yup, that'd be it. I wonder where I got the bandanna idea from (I remembered him wearing it over his eyes like a modern blind person might wear sunglasses). I'll accept when the time limits up.
Comment: Yeah, closest I found were a few covers where he has leaves over his eyes. Maybe it showed up on one of the other books in the series?
Comment: Thanks for reminding me that I've been meaning to finish this series for about 12 years! :D

@Sidney it might have been from a foreign cover, I vaguely remember a bandana on a cover somewhere, too, but it might just be suggestion talking.

Story involving a young Merlin


How does the assumption of a normaly distributed error lead to squared terms regarding the variance?

Question: One answer to this question (why squares in variance?) explains, that it is derived from the assumption, that the error is normaly distributed. Unfortunatly I fail to see, how exactly this leads to the definition of the variance/sd.
Comment: See https://stats.stackexchange.com/questions/147001, https://stats.stackexchange.com/questions/274650, and https://stats.stackexchange.com/questions/12562, *inter alia.*
Answer: This is a well known relationship. See for instance this link for LS and this link for MLE under normal errors.  As you can see, the variance plays no role in estimating the regression parameters, and can be estimated separately, if desired.
There are well known relationships between estimation procedures and distributions of the residual errors:

least squares (LS) - Normal errors
Asymmetric least squares - two-piece normal errors (also known as asymmetric Normal)
median regression - Laplace errors
quantile regression - two-piece Laplace errors (also known as asymmetric Laplace).


Is there a generic expression for a "universal product"?

Question: In Lucky Luke vol 38, some character named Doc Doxey tries to sell a product that works for almost everything (elixir) like a Swiss army knife with very general reported usage. Is there a name for such a quack / hoax product, like a spam product that is promoted to have many uses for and against almost anything or good real life examples of actual such products?
Answer: snake oil

Snake oil is an expression that originally referred to fraudulent health products or unproven medicine but has come to refer to any product with questionable or unverifiable quality or benefit. By extension, a snake oil salesman is someone who knowingly sells fraudulent goods or who is himself or herself a fraud, quack, charlatan, or the like.
  http://en.wikipedia.org/wiki/Snake_oil

A less exciting word with a similar meaning nostrum or the term patent medicine
Panacea or magic bullet might also serve for this as these can be used without necessarily implying a medical cure (as a cure all where the problems don't have to be medical).
Comment: @Kris disagree about nostrum (="quack medicine" in my small Collins dictionary for example) certainly does imply bogus. Panacea and magic bullet imply fraudulent as they (usually) are not achievable esp. magic bullet - so I disagree on these too. Lastly; **snake oil**, as Wikipedia indicates, is applied to more than just medicines
Comment: *Snake oil* is a good suggestion, however, it's not in the same league as a Swiss army knife in claim to versatility. However, *nostrum, panacea* and *magic bullet* are **not** supposed to be fraudulent or bogus.
Comment: Look up in the dictionary and take it with faith. "Quack medicine" is not bogus either. *Panacea* and *magic bullet* are not. One can use a genuine thing in a bogus sense, though, as you tried with these two words. HTH.
Comment: nostrum: ˈnɒstrəm` noun; a medicine prepared by an unqualified person, especially one that is not considered effective." http://goo.gl/8kplfU (Perhaps we disagree on the term bogus?)
Comment: Thanks! There's also the expression paper tiger if you recognize that expression. If you use the product then it must work because then there is no dangerous tiger and the product works against dangerous tiger.
Answer: Not sure of a generic expression, but you could always use Counterfeit.
From Wikipedia:

To counterfeit means to imitate something. Counterfeit products are
  fake replicas of the real product. Counterfeit products are often
  produced with the intent to take advantage of the superior value of
  the imitated product. The word counterfeit frequently describes both
  the forgeries of currency and documents, as well as the imitations of
  clothing, handbags, shoes, pharmaceuticals, aviation and automobile
  parts, watches, electronics (both parts and finished products),
  software, works of art, toys, movies. Counterfeit products tend to
  have fake company logos and brands. In the case of goods, it results
  in patent infringement or trademark infringement. Counterfeit consumer
  products have a reputation for being lower quality (sometimes not
  working at all) and may even include toxic elements. This has resulted
  in the deaths of hundreds of thousands of people, due to automobile
  and aviation accidents, poisoning, ceasing to take essential compounds
  (e.g. in the case a person takes non-working medicine, ...).


Can the Gnome 3.6 notification area be shrinked?

Question: I find the GNOME Shell 3.6 changes to the message tray irritating. Is there a way to switch the message tray to the old model or to at least shrink the items and stop it from pushing the entire desktop when being summoned?
Comment: By your description, I figure you are talking about GNOME Shell and the message tray. I edited your question with the more specific terminology to make sure nobody gets confused :)
Answer: The new design makes the tray unusable for many apps like CherryTree, Deluge, etc. that have tray icons, as you have to wait one long second for each access! And if, by chance, the cursor of your mouse touches the desktop bottom for just a second, you'll see a nasty movement. I don't know where the gnome developers want to go with such "innovations".
However, you could change the tray behavior by editing /usr/share/gnome-shell/js/ui/messageTray.js. I changed TRAY_DWELL_TIME to 50 ms and set the hot zone to the old right bottom corner by changing the line which reads let shouldDwell = ... to:
let shouldDwell = (x >= monitor.x && x == monitor.x + monitor.width - 1 &&
This makes the tray usable again but I didn't find a way for preventing that upward movement.
EDIT (Thanks to @6ahodir):
To prevent upward movement of the desktop change the same file (/usr/share/gnome-shell/js/ui/messageTray.js) and update the following line in the _showDesktopClone() function:
{ y: -this.actor.height,
to this:
{ y: 0,
In case you want to remove the messageTray,
let shouldDwell = (x >= monitor.x + monitor.width && x <= monitor.x + monitor.width + 1 &&

Comment: Awesome guys, this is EXACTLY what I was looking for!! Many, many thanks.
Comment: Thanks! New gnome-shell broke my workflows a bit. But, do you know if I can change this code without tampering with installed files? Some per-user way to override gnome-shell behavior?
Answer: You can shrink the message tray modifying /usr/share/gnome-shell/theme/gnome-shell.css
#message-tray {
    background: #2e3436 url(message-tray-background.png);
    background-position: 0 0;
    background-repeat: repeat;
    transition-duration: 250;
    height: 36px;
}

And you should also change the icons' size in /usr/share/gnome-shell/js/ui/messageTray.js. Search for the SOURCE_ICON_SIZE constant within the Source class and set it to the value of your choice :-)
Answer: Disable the notification area hover:
let shouldDwell = 0;

There is a keybinding for notification area (default is super+m)


WSO2 Developer Studio - CEP Bucket

Question: Is there any way to give some syntax or context help for writing EPL queries while creating buckets using WSO2 Developer Studio ?
Is there any EPL query editor exist outside WSO2 stack ?
Comment: @Maninda - Can you please provide update on above question ?
Answer: Currently there is no such tool you can use to write WSO2 CEP EPL queries outside of WSO2 Stack but we will provide support to write EPL queries in the CEP editor source view in a future release of WSO2 developer Studio IDE.
Until then you need to use the CEP editor design view and enter the EPL queries manually.
/Harshana

WSO2 Developer Studio - CEP Bucket


Displaying the author of next and previous posts in pagination?

Question: I have set up links to the next/previous posts on my single.php template. Currently I am using <?php previous_post_link(); ?> and <?php next_post_link(); ?> which gives me the title of the next/previous posts, but I would also like to be able to display the author of those posts below the title. Is this possible?
Answer: Yes, you can do that. Change <?php previous_post_link(); ?> and <?php next_post_link(); ?> with the following code:
For previous post:
  <?php
    $prev_post = get_previous_post();
    $prev_user = get_user_by( 'id', $prev_post->post_author );
    if (!empty( $prev_post )): ?>
      <a href="<?php echo $prev_post->guid ?>"><?php echo $prev_post->post_title ?> (<?php echo $prev_user->first_name . ' ' . $prev_user->last_name; ?>)
    <?php endif ?>

For next post:
  <?php
    $next_post = get_next_post();
    $next_user = get_user_by( 'id', $next_post->post_author );
    if (!empty( $prev_post )): ?>
      <a href="<?php echo $next_post->guid ?>"><?php echo $next_post->post_title ?> (<?php echo $next_user->first_name . ' ' . $next_user->last_name; ?>)
    <?php endif ?>

You also can control from which categories WordPress should select previous and next posts. get_previous_post and get_next_post accept two parameters:

(bool) $in_same_cat — prev/next posts will be selected from the same category as you current post
(string) $excluded_categories — posts related to these categories will be skipped

More details about these parameters you may find here
Comment: Thank you, that worked a treat! Will accept your answer as soon as it lets me.
Answer: You can create a custom function. For this you need to use
// Add in single.php where you want to show next icon.
$nextPost = get_next_post();    // Get the next post detail
$nextPostID = $nextPost->ID;    // Get the post id of next post and pass it
echo get_post_link_with_post_author_name( $nextPostID );

And define the get_post_link_with_post_author_name() in your active theme's functions.php as :
// This function returns postname, post author and link to it.
function get_post_link_with_post_author_name( $postID ){
    // you have got the postID , now you need to fetch the post name, post url and post author
   $post = get_post( $postID );
   $post_title = $post->post_title;
   $post_author_id = $post->post_author;
   $author_detail = get_user_by( 'ID', $post_author_id );
   $post_author_name = $author_detail->display_name;
   $post_url = get_permalink( $postID );
   $respone = "$post_title >> By $post_author_name";
   return $response;
}

You can use the same function for previous post link with post name and author name. You just need to get the previous post id using get_previous_post() and pass that post id to the above function.


Academic Violation - Can I avoid mentioning it to grad schools?

Question: In my second semester senior year, I was being proctored via zoom for an exam and our professor had asked us to turn on both audio and video for it. I accidentally had my mic muted during the exam. My professor reported me and failed me in the class. My transcript shows a grade of NC (during covid all Fs counted as NC) but other than that it does not show anything else on my transcript indicating the academic violation. If I were to apply to masters programs without reporting this, would they be able to find out?
Answer: This might depend on place, but in the US it would be unlikely. It is remotely possible if there were private communication (improper, actually) with that professor.
Your university has handled the situation with its own processes and posted its results as it deems proper. For this reason you don't need to explain. That is the university's job.
If NC has an alternation meaning than "Failed during Covid" you can point to that. But if that is its only meaning then you might be asked why you failed. I would find this unlikely as there was a lot of disruption under Covid and a lot of reasons for failure of courses.
The underlying idea here is that people aren't perfect and often do the wrong thing. But once the infraction is handled it needn't, with some exceptions, haunt a person for life. And, for those rare but exceptionally severe infractions, people are expelled. Let it go, but be prepared to answer questions.

I'm wondering, though, how an "accident" resulted in failure. That seems odd in itself.
Comment: Thanks!  And I'm not sure why the professor decided to fail me over this either tbh. I've tried to appeal but have been denied.


Does the entropy of a chemical system increase in an endothermic reaction?

Question: Since entropy increases when temperature increases, the entropy of surroundings increases during an exothermic reaction. When I apply the same logic, it seems like the entropy of a chemical system increases in an endothermic reaction. Is this true?
Answer: Not necessarily.
Exo- and endothermic refer to the direction in which heat is exchanged between system and surroundings, not to changes in the entropy of the system, or of the temperature of either system or surroundings. Your logic though is partly correct: exothermic means the entropy of the surroundings increases, as it would do with an increase in T - the catch is that we usually assume that the surroundings has constant T, but that's because we say it has infinite heat capacity.
It is a recurrent subject of confusion to conflate changes in the entropy of the surroundings, of the system, and of the sum of both. Always keep the second law in mind. What determines whether a reaction will be spontaneous is the sum of the changes in entropy of the surroundings and the system.
When a reaction occurs reversibly, $\Delta S_{\mathrm{surr}} + \Delta S_{\mathrm{sys}}=0$.
When spontaneous, $\Delta S_{\mathrm{surr}} + \Delta S_{\mathrm{sys}}>0$.
When a reaction is exothermic,  $\Delta S_{\mathrm{surr}} >0$.
When a reaction is endothermic,  $\Delta S_{\mathrm{surr}} <0$.
Nothing about the thermicity (whether the reaction is endo or exothermic) tells you what happens to $\Delta S_{\mathrm{sys}}$, unless you already know whether the reaction is spontaneous or not (in which case the sum of the entropy changes is positive).
Answer: All spontaneous chemical reactions are described by the following formula:
$$\Delta_\mathrm{r}G < 0$$
If the reaction is endothermic, it means that
$$\Delta_\mathrm{r}H > 0$$
As a consequence, $\pu{T\Delta_\mathrm{r}S}$ is the sum of two positive terms:
$$T\Delta_\mathrm{r}S = - \Delta_\mathrm{r}G + \Delta_\mathrm{r}H > 0$$
and as the temperature is always positive, it means that for all spontaneous endothermic reactions, the entropy of the system increases:
$$\Delta_\mathrm{r}S > 0$$
Comment: See [Which symbols are written in roman (upright) font and which are italicized?](https://chemistry.meta.stackexchange.com/questions/443/which-symbols-are-written-in-roman-upright-font-and-which-are-italicized)
Answer: One way to carry out a reversible ideal gas process where you start with stoichiometric quantities of pure reactants at T and P and end up with corresponding stoichiometric quantities of pure products at T and P, would be to use a three step sequence.  The middle step would involve using an van't Hoff equilibrium box in which a reaction mixture is already at chemical equilibrium within the box at T and P, and very slowly injecting stoichiometric quantities of pure reactants at the same temperature and partial pressures as in the reaction mixture while, at the same time, very slowly removing corresponding stoichiometric quantities of pure products at the same temperature and partial pressures as in the reaction mixture.  In this open system step, the heat you add is equal to the enthalpy change of the reaction, and the entropy change is equal to the enthalpy change divided by T:  $$\Delta S_{middle\ step}=\frac{\Delta H}{T}$$
The first step of the overall process is very different from this.  In the first step, you take each reactant individually and expand it isothermally at T from its initial pressure to its partial pressure in the equilibrium box.  This step is not at constant pressure P, and the enthalpy change of the gas is not equal to the heat added.  Since it is at constant temperature, the enthalpy of the gas is constant, but its entropy increases (because of the pressure change).  So in this step of the process, the enthalpy changes of the gases are zero, but not their entropies increase.
Similarly, for the final third step of the process, the pure product  gases are compressed isothermally from their partial pressures in the equilibrium mixture to the total pressure P.  Here again, the enthalpy change is zero, but, in this case, the entropy changes of the gases are negative.
Overall, the entropy of the gases changes in all three steps of the process, but the enthalpy of the gases only changes in the middle step.  So, overall, the entropy change for the entire process is not equal to the enthalpy change divided by the temperature.  We say that the overall process, the pressure is constant (i.e., the same at the end as in the beginning) even though in steps 1 and 3, the pressure does change.


Membership IS or membership AT

Question: I wish to say that I sell membership cheaply (in my opinion). Let's say for $99 for one year. What's the right way to say it on my site:
1.) Membership at only $99  OR
2.) Membership is only $99?
One more thing... In this context "only" and "just" mean the same (interchangeable)? like "membership is just $99" or "membership at just $99".
Comment: What about, "The membership fee is only/just $99 per year." OR "The annual membership fee is only/just $99."
Comment: A word "fee" is kinda out of place in an advertisement. Sounds too official and boring.
Comment: Talk about boredom. Even the sample sentence you provided has a tint of boredom (well, at least not the same level of boredom when considering the 'official' wording).What about, "Become a member for a year for only 99 dollars!", "For only $99, enjoy the benefits/privileges of a member!" I suggest you add an exclamation point.
Answer: At makes "only $99" something like a "place" or "point."
Meaning that you are subtly implying you have moved the price temporarily to $99, but it may not be $99 in the future.  Or for some other reason the price may change and you are saying where the price is now.
You may want this subtle implication of price increase (though it can mean decrease as well) in an advertisement to goad the viewer/reader into a sense of urgency.
If the normal price of the membership is $99, then is is typically more appropriate.
Comment: I agree. Using 'at' does add that sense of "temporary" change in pricing (something promotional?), if I correctly remember the last TV shopping channel I've seen, they either use "for only" or "at only". (I'm biased towards the former though). :)
Comment: It's pretty rare in business that a price don't change. Inflation, supply and demand etc. For my ear "at" sounds more "alive". Though I'm not a native English speaker. From marketing perspective, a sense of urgency is always nice.
Answer: As an English speaker, it seems that the second option would be the better choice, however both could be used. If you used "is", then you should say how long the membership is for:
membership is only $99 per year!

Membership IS or membership AT


Destiny level 23 only one strike mission left that requires friends

Question: I've been playing Destiny for a few weeks now, but am still nooby, I don't understand a lot of things, but I'm really confused on what I should do next as I can't do the misson that requires friends, help?
Comment: You can do the strikes even without friends.  If the description says 'Matchmaking', you'll be joined with other random people trying to do the same activity.
Comment: You should have some active quests on the quest tab in the menu. What to they say to do? If you go to the Tower, does that show any NPCs that want to talk to you?
Answer: If by "I don't have friends" you mean you don't have PS Plus or Xbox Live, then you are out of luck.  You need those services to do almost everything in Destiny.
If by "I don't have friends" you mean you don't have a big friends list (or people who play Destiny), most activities have Matchmaking.  They are:
The Heroic Strike Playlist (you can get up to 390 light gear here)
The Level 42 Prison of Elders (NOT Challenge of Elders, you need to form your own team for that)
Any Crucible playlist except Trials of Osiris
Activities that you NEED to form your own team are:
Any of the 4 raids
Nightfall
Challenge of Elders
Trials of Osiris
Just select an activity that has Matchmaking (it will tell you so) and have at it.
If your quest(s) say that you need to do an activity in the non-Matchmaking list, there is always DestinyLFG http://destinylfg.com/ or the100 https://www.the100.io/.
Good luck.


ecryptfs-recover-private creating unreadable encrypted folders

Question: After months of proper functioning ecryptfs has become corrupted and rendered /home/ inaccessible. When running (both via guest account and from live-CD):
root@ubuntu:/media/backup/home/me# ecryptfs-mount-private
ERROR: Encrypted private directory is not setup properly`

I then tried:
root@ubuntu:/media/backup/home/me# ecryptfs-recover-private
INFO: Searching for encrypted private directories (this might take a while)...
INFO: Found [/media/backup/home/.ecryptfs/me/.Private].
Try to recover this directory? [Y/n]: Y
INFO: Found your wrapped-passphrase
Do you know your LOGIN passphrase? [Y/n] n
INFO: To recover this directory, you MUST have your original MOUNT passphrase.
INFO: When you first setup your encrypted private directory, you were told to record
INFO: your MOUNT passphrase.
INFO: It should be 32 characters long, consisting of [0-9] and [a-f].

Enter your MOUNT passphrase:
INFO: Success!  Private data mounted read-only at [/tmp/ecryptfs.uDWfDMCO].
root@ubuntu:/media/backup/home/me# ls /tmp/ecryptfs.uDWfDMCO/ECRYPTFS_FNEK_ENCRYPTED.F
Display all 124 possibilities? (y or n)'

This created 124 encrypted folders which apparently hold my /home/ data. I just don't know how to access this data. Moreover, looking at /var/log/syslog/ there are a lot of the following errors:
Dec  3 11:19:22 ubuntu kernel: [ 1627.918209]
ecryptfs_parse_tag_70_packet: Error attempting to find auth tok for fnek sig [1b62c525049b45e0]; rc = [-2]
Dec  3 11:19:22 ubuntu kernel: [ 1627.918214]
ecryptfs_decode_and_decrypt_filename: Could not parse tag 70 packet from filename; copying through filename as-is`

I would really like to either get ecryptfs working again properly or to at least recover my data.
Answer: Whenever I try to use the MOUNT passphrase, I get these errors too (my encrypted home folder was not corrupted):
[ 2977.052719] ecryptfs_parse_tag_70_packet: Error attempting to find auth tok for fnek sig [2e1f1a0ca6f5f8f3]; rc = [-2]
[ 2977.052721] ecryptfs_decode_and_decrypt_filename: Could not parse tag 70 packet from filename; copying through filename as-is
[ 2977.052726] Could not find key with description: [2e1f1a0ca6f5f8f3]
[ 2977.052728] process_request_key_err: No key

I managed to successfully mount my old home folder simply using the LOGIN passphrase, that is the original password you used when you first created your ecryptfs home folder.
host:/mnt/mountpoint/home/.ecryptfs/user> ecryptfs-recover-private .Private
INFO: Found [.Private].
Try to recover this directory? [Y/n]:
INFO: Found your wrapped-passphrase
Do you know your LOGIN passphrase? [Y/n]
INFO: Enter your LOGIN passphrase...
Passphrase:
Inserted auth tok with sig [XXXXXXXXXXXXXXXXXX] into the user session keyring
INFO: Success!  Private data mounted read-only at [/tmp/ecryptfs.8dXogIbs].

Answer: I had the same problem. What I did to created the problem was altering my user password by doing a sudo passwd  which worked fine; but the next day when I tried to login, was then stuck in the gdm login loop.
Then went to the virtual terminal using ctrl-alt-F1, logged in with my new pw, saw that home was empty, did a
ecryptfs-recover-private

and typed my OLD password. then my home was mounted again and so then could switch back to the graphical interface ctrl-F7 and login with the NEW password :)
Then it was possible to update my cryptfs password on a terminal with:
ecryptfs-rewrap-passphrase /home/.ecryptfs/$USER/.ecryptfs/wrapped-passphrase


Which layer for least cost analysis?

Question: I'm new to least cost analysis. I have a DEM-layer of a region and I want to know what's the least cost path from a to b. Do I have to use the DEM layer to calculate that? I also have a hillshade layer and a slope layer of that region. I think the DEM-layer only has the heigth of the landscape, but doesn't slope affect the costs of a specific route as well? Do I have to combine these layers? I have QGIS 3.8 and 3.6
Comment: Without a road network this is kinda... boring. Also, what prior research on the topic have you done? Have you found a workflow, which you are trying to follow? If so, where are you stuck? If not, are you aware, that your question might be closed for being too broad?
Answer: Terrain cost analysis typically uses slope, combined with whatever else you'd like to take into account (soil, weather-ground conditions, land cover, vehicle attributes, etc). If you're just wanting to look at the slope, then the basic idea is to categorize the slope values and assign them an associated cost value. For example:

Slope 0 - 5 could have a cost of 1
Slope 5 - 10 could be 2
Slope 10 - 20 could be 3
...
40+ could be 6

This resulting "cost raster" could then be used for things like finding a least cost path.
Comment: Check this, as Alex pointed, friction surfaces varies. This is an axample https://gracilis.carleton.ca/CUOSGwiki/index.php/Evaluating_Landscape_Permeability_in_Quantum

Which layer for least cost analysis?


Creepy caller blocked, but still gets through to my voicemail

Question: I gave my phone number to someone who turns out to be unstable individual...crazy dude. I blocked him from my android phone, blocked from calls and messaging. Somehow he managed to call me, doesn't show the call on my call log at all..never heard or was alerted of the call. And he then left a voicemail and when I go through the menu to get the callers number it is silent..blank. How is this happening? And how can I block him all together? Seriously, this guy is freaking me out. Help please if you can.
Comment: Sounds like you blocked it at the Android level, but have you tried logging into your service / phone carrier's website and blocking the number from there?  At this point it may be worth switching to a new phone number.
Answer: Blocking phone numbers on Android is not possible...
The work-around that developers use is a redirection to the voicemail number, redirecting calls to voicemail is the only option...
HOWEVER, From the Voicemail side & Mobile service provider's side, things can be blocked !

Call your service provider and request the number to be fully blocked from ever connecting at all..  .

Alternatively ( if you don't use voice mail )
A workaround i found using the call setting....
• Change your voicemail number,
It is called ( redirect on unanswered ) an can be configured in the call settings.
I changed my number to +610   and it allowed the change. . The voicemail ( redirect service ) will redirect the call to a non existent number like +610 and then end the call ( They'll hear - "This number is not connected" )   .
Answer: This would be a network / mobile provider solution, they would be able to blacklist a number for you and prevent it from connecting,
there are blocking options on android phones, but these don't stop calls connecting and voicemails being left.
You have blocked on the phone, which is great, and that is why you were not notified of the incoming call at the time, the mobile provider does still deal with a call if the phone does not answer it.
As others have noted, mobile network provider would be the best step forward, there is scope for blacklisting a number, alternatively another good suggestion is consider getting a new number.
Answer: Simple answer, contact the phone carriers account holder for that line, if it's not you. Either you or they need to call carrier and inform them you would like to block a phone number on your account.
This is s true call block.


smoothing issue with tris

Question: sometimes when i work with tris or i change the flow of the topology on the z axe i encounter some shading issues with smooth shading, if i decrease the normal shading it gets fixed (10 degrees) but i need it higher.
i see it happening most of the times with tris even if i see some game models with tons of tris and no shading issues ( most of the times to make holes or circles.
i dont know if its a limitation of blender or something else, here an example:

shading

topology
Comment: As you've stated, tris don't always spell disaster. However, there are guidelines for how to use them. Uneven topology (having a mix of very small and very large faces) will more likely than not cause shading issues *if the surface is not meant to be flat (i.e a large flat plane that is meant to be flat is ok, large planes on curved surfaces is probably not)*. If your case, I would try to eliminate the massive tris running across the length of that panel. Maybe try cutting the faces vertically down the middle then clean up the resulting geometry a bit.
Comment: i just played around with the mesh and notices a slight incoherence with the position of a few vertices which were causing the issue, now that the plane is flat there in no more problems.
Comment: thanks to everybody anyway
Comment: @EDOTONY Congrats on solving it :). Would you mind posting your solution as a short answer, and mark it as solved? It will surely help others. Thank you.
Answer: I solved the issue by flattening all the faces and vertices of the side i wanted and i "mark sharped" all the border edges

smoothing issue with tris


three way switches not working

Question: I checked the wiring in the ceiling can light. I moved the neutral wires and saw a spark so I twisted it and now the lights work again. But now the three way switches aren't working right. They are more like a two way switch. Do you have any ideas of what I might have done? I did try new switches thinking maybe that was why my lights stopped working in the first place.
Comment: How would we know what you've done? You haven't told us. Seems like checking or reworking all the connections would be prudent.
Comment: Post some pictures of the wiring you worked on .. you might have misconstrued a traveler wire for a neutral wire. Also open both light switches pull the switches out of the box far enough and take pictures. [Turn the CB off before you pull them out , even with CB off you should still work using the one hand rule as if they are live .]  Please also tell us which wires in the pictures you twisted and got sparks ..
Answer: I'm not familiar with what moving wires and twisting "it" (what?) could mean. But I read there was a spark which should put you on alert. Some connection is no longer fixed. Sparks can cause fire! You don't know what's going on there and obviously you don't know how to handle this situation.
Turn off the fuse or breaker or whatever this is called and find a professional to see this ASAP. An electrical expert looking at that is cheaper than a burnt down house.

three way switches not working


Upgraded to SDK 4.1 and can no longer build for iOS 4.0

Question: Just upgraded my xcode to the latest SDK which has the iOS 4.1 SDK.  My app was built for 4.0, but xcode is no longer letting me build for 4.0 (The SDK is missing).   I'd prefer not to require 4.1 yet as the app doesn't need it and it just came out yesterday.  Any ideas to allow me to build for 4.0?  I don't see an option to download the last version of xcode from the developer website.
Answer: It is a common misunderstanding that because it is called Base SDK it should refer to the minimum requirement of your app. It is not so! The Base SDK is the highest SDK you will develop against and it makes sense to keep it updated to the latest features and iOS version (all you do is just not use any of the new functionality if you don't want to). If you plan to support older versions of iOS instead, what you have to do is set the Deployment Target to the minimum SDK level you want to support.
It has taken me a while and a fair amount of reading to work this out. This is the basic idea. If you need more info, a more complete explanation of this is available in one of my posts.
Answer: This is the usual way things end when you upgrade the SDK. You set the base SDK to the latest version (4.1, in your case) and set the deployment target to whatever you want. The binary will run on older devices according to your deployment target setting. See also some of the older questions asked after previous SDK update.


Selecting a subset of pins in Google Earth and export the attached data to a CSV file

Question: I have a large set of pins, each with an associated ID and lat/long. Is it possible to select a small group of these pins and then export the associated info into a CSV file?
Answer: Assuming you're working in Google Earth Pro (desktop), not the new web/mobile version, you can select multiple placemarks/points by holding down the shift or ctrl button and clicking in the MyPlaces/list view to select more than one.  Then you could drag them into a new folder, save that folder as a KML, and find a way to convert that to CSV.  But since you're going to have to use some other software to do the CSV conversion anyway, might be worth using GIS software (QGIS, ArcGIS, etc.) to do the selection and export without having to go through KML.  GIS software will also let you do much more sophisticated selections, like select by area, select by distance, select by attributes, etc.


gcc plugin c c++ find global nonstatic variables

Question: i've been playing around with the gcc 4.6 plugin api.
For convenience i use a python wrapper/plugin for the api.
My goal ist to find the declarations of all variables with:

global scope
and not const
and not static (means exported or visible)

in a compilation unit and emit a warning.
for eg:
int glob;              // exported
static int moduleGlob; // not exported
const int aModConst=42;
int f() {static int inner; return inner;}

should yield "glob"
"outside of functions/classes" and "const" is easy, but i can't get the "static" qualifier.
I am crawling the global namespace subtree and watch for VAR_DECL nodes not having the  const flag.
But how is the "static" keyword handled?
It does not seem to be one of the bitfield-flags. Also the "static predicate" on the node is misleading because it simply says that the variable goes in the static storage (which glob does - but also moduleGlob and inner). My questions rather is "will it be exported on a .so"
What about a "extern" declaration? How is that mapped in the AST?
Currently i try to do this in the *free_lang_data pass (is this too late?)
The only hint i have so far is this: When dumping the tree via the -fdump-tree-all switch is in the .tu dump there is an additional node whith the mangled name of the global variable (in the nonstatic case).
Any ideas how i could solve this?
Comment: How do you get access to global variables? I found your question while searching for that.
Comment: Did you find an answer to this?
Answer: From the documentation, it looks like you should use DECL_THIS_STATIC and DECL_THIS_EXTERN.


Dietary fibre and carbohydrates

Question: When dieticians speak of carbohydrates, do they include dietary fibre?  Also, what are carbohydrates?  Saccharides and polysaccharides?
Answer: Carbohydrates can be categorized according to how well they are digested or absorbed:
a) WELL-DIGESTIBLE (4 Cal/g):

Sugars:

Monosaccharides (glucose, fructose, galactose, mannose...)
Disaccharides (sucrose, lactose, maltose...)

Oligosaccharides (fructo-oligosaccharides, galacto-oligosaccharides...)
Polysaccharides:

Starch
Glycogen

b) POORLY DIGESTIBLE/ABSORBABLE (2 Cal/g):

Sugar alcohols or polyls (maltitol, mannitol, sorbitol, xylitol...)

c) NON-DIGESTIBLE (2 Cal/g):

Dietary fiber (various oligo- and polysaccharides, such as oligofructans and cellulose)

Diabetics who want to calculte how carbohydrates will affect their blood sugar levels need to subtract the amount of fiber from total carbohydrates.
Source: Calories in specific carbohydrates (Nature.com)
Answer: This is from Uviv. Cal. San Francisco, "Understanding Fiber",

To summarize – you need to take the total amount of carbohydrate in a serving MINUS the carbohydrate in the fiber.(Source: Diabetes Teaching Center at the University of California, San Francisco)
Comment: When you are calculating the effect of carbohydrates on blood sugar levels, you distract fiber from total carbohydrates, and when you are calculating calories, you consider that fiber has 2 Cal/g.
Comment: @Chalmondley, I actually added the link in my answer after him. This answer here is correct, so my comment was just to prevent confusion, because they are various viewpoints from which this topic can be discussed.

Dietary fibre and carbohydrates


Is the following a secure method for file encryption?

Question: So the goal is to use AES-CBC-256 to encrypt the data in a file. To derive the AES key and IV pbkdf2 will be used to generate a 384 bit output using a given password and salt, where the first 256 bits will be the key and the last 128 will be the IV. The key and iv will be used to encrypt the file and then a hash of the key will be stored at the beginning of the encrypted file so that when decryption happens, the hash of the supplied key will be compared to check whether the correct password has been supplied. Is this a secure method?
Comment: https://www.eff.org/keeping-your-site-alive/evaluating-your-threat-model
Comment: What are your risks?
Comment: Would you mind elaborating on that question?
Comment: "Is this a secure method?" -- secure against *what*?
Comment: I am asking this question because i have seen several other similar situations where file encryption is involved, and it is said to generate several random keys, then using pbkdf2 to generate another key which is used to encrypt the random keys, then extra bytes from the pbkdf is written to the header of the file to make sure a correct password is supplied during decryption, my point is that it seems more complicated than what i have proposed in my question, but both come to the same result.
Comment: You should provide a link and reasons why the other solution is not working for you or complicated.
Answer: No, you should use Authenticated Encryption or AEAD.
My suggestion
Generate another 128 bits from the KDF, use that as the key to HMAC-SHA-256, compute HMAC of IV and ciphertext, store the HMAC result (called authentication tag) with the ciphertext.
When decrypting, pass the password through KDF to generate IV and HMAC key, compute HMAC  over IV and ciphertext, compare with stored authentication tag. If they don't match, the password was bad or the ciphertext was tampered with. Do not decrypt. Decrypt only if the authentication tag is good.
CBC is slow, because it has to work one block at a time and cannot encrypt blocks in parallel. CTR would be better.
HMAC is a strong MAC but is slow.
Modern AEAD modes like AES-GCM or even ChaCha20-Poly1305 (the only modes allowed in TLS1.3 and libsodium, preferred in modern SSH and IPSec, with ChaPoly being the only mode allowed in age and WireGuard and is the default in libsodium) are faster than AES-CBC or AES-CBC+HMAC.
But actually...
Using age would be much better than rolling your own. For example, age uses modern chunked AEADs and scrypt, has a go and rust implementation, and was created by a reputable person (the maintainer of go's standard library's crypto code).
Answer: Your method is somewhat similar to to the method used by openssl for aes-256-cbc encryption, with a key derived from a password by pbkdf2, e.g.:
openssl aes-256-cbc -e -a -salt -pbkdf2 -iter 10000

As in your method, the pbkdf2 function in the openssl command above derives a 348-bit key from the password, then this is split into a 256-bit encryption key and a 128-bit iv.  However, you'll need to store the salt used by the pbkdf2 function somewhere (in the openssl command above, the salt is stored in bytes 8-15 in the cyphertext).  Also, openssl does not store a hash of the key with the ciphertext.  However, incorrect passwords/keys at decryption often produce padding errors, so this can be used to detect incorrect passwords/keys in some cases.
For more information on how to detect incorrect passwords/keys, see https://crypto.stackexchange.com/questions/5921/how-and-why-can-a-decryption-program-tell-me-that-a-key-is-incorrect.
For more information on how openssl aes-256-cbc -e -a -salt -pbkdf2 -iter 10000 works 'under the hood', see See https://crypto.stackexchange.com/questions/3298/is-there-a-standard-for-openssl-interoperable-aes-encryption


Why isn't a meter defined from a kilogram of water?

Question: Why are there different official definitions for a kilogram and for a meter when a meter can be defined by the volume of a kilogram of water? For instance, using the triple point or some other state where the volume is well defined.
Comment: Contrary to the comments so far, this is a very good question. We could have defined a kilogram as the standard mass of so-and-so many hydrogen atoms, and then the definition of the meter could have followed as the linear dimension of one cubic megagram of water at 4 degrees celsius. The density of water would have been 1.000 by definition. Instead, we have to determine the density of water by experiment, from the standard meter and the standard kilogram. So how close is it to 1.00 anyways?
Comment: Except you'd have to worry about how much deuterium was in the water. That's a complication.
Answer: When we pick standards for units it's important to pick standards that are as percisely defined as possible and measureable to very high precision in the lab.
So for example the second is defined as 9192631770 times the period of the radiation emitted from a specific transition of the caesium atom. This is easily measured and indeed thousands of atomic clocks all around the world are currently measuring it. So if you're in a lab doing an experiment and you need a very precise measurement of time you can easily get one.
The metre is defined as the distance light moves one second divided by 299792458. The speed of light is a universal constant that is the same for every experimental scientist in the universe, and the speed of light is easily measured interferometrically. And as we saw in the previous paragraph the second is also well defined. That makes the metre a well defined and easily measured quantity as well.
The kilogram however is a bit of a thorn as it's currently defined as the weight of a specific lump of platinum. This isn't based on any constant of nature and it's not easy to measure precisely unless you can borrow the lump of platinum, which the International Bureau of Weights and Measures aren't particularly keen on.
So using the kilogram to define the metre would be ignoring a precise and convenient measure for a vague and inconvenient one. Worse still, the density of water is strongly temperature dependant so you also need a standard for temperature otherwise your value for the metre will depend on the weather. So now you're basing your metre on two vague and inconvenient standards.
There might be an argument for defining the kilogram from the metre i.e. the weight of 1 dm$^3$ of water at some reference temperature $T$. The trouble is you still have to measure the temperature and that can't be done to the required precision.
I believe there is a plan to define the kilogram using Planck's constant $h$. The units of $h$ are joule seconds or kilogram metres squared per second. Since we have good definitions for the metre and second this allows us to use $h$ to define the kilogram. However I don't know how far this plan has got.
Answer: There are various reasons why water isn't a good basis for length measurements.
In the long term, the most important is that water evaporates. To appreciate this, keep in mind that you can't just weigh out a kilogram of water and then somehow make a perfect cube container, then measure the sides. At the very least, dealing with the meniscus at the top would be a nightmare. What you need is a reference sample of fixed length, and liquid (or triple-point) water is, by its nature, not a fixed length. Even if you were to go for ice at a fixed temperature and pressure, ice sublimates, so the length would change over time. It's worth noting that even a platinum-iridium alloy, such as that used in the kilogram standard, appears to suffer some sort of mass loss over time. It's true that you might posit a hermitically sealed container for the water sample, but this has two strikes against it. Long-term hermitic seals are not a trivial business, and such a sealed container would make comparison measurements extremely different if not impossible.
Comment: Water was used to define the kg for a few years. The idea of the OP was probably not to have an artefact made of water as a reference, but to define the kilogram as the mass of a dm³ of the substance called water ([Vienna Standard Mean Ocean Water](https://fr.wikipedia.org/wiki/Vienna_Standard_Mean_Ocean_Water) ?). Your objections are off topic
Comment: Although this answer isn't optimal, it is good. My question is about defining the kilogram as the mass of a dm³ of a substance, but if we define it this way, we would have to measure it somehow to compare it with other units, and that is the hard part that this answer answers. (At least that's my point of view. I'm new to this forum; I may be wrong.)


Uralic phonetic alphabet or UPA – unusual diacritics

Question: I am writing a linguistics MA thesis in LaTeX, and I will possibly need to use the Uralic Phonetic Alphabet, for example in glossing environments. What would be the best way to do this? I've seen there are separate packages to facilitate using IPA, but my department generally prefers UPA. Mostly I would need letters like a̮, š and ĺ. The source text is in UTF-8 Finnish.
Comment: In XeTeX or LuaTeX, you could use a font which supports these rare characters. If I'm not mistaken, examples of such fonts include newer versions of Times New Roman (very much beloved at universities) and Charis SIL. If you went with this solution, you wouldn't need any packages specifically for UPA.
Answer: If I input
<code>\documentclass{article}

\usepackage{fontspec}
\setmainfont[Ligatures=TeX]{TeX Gyre Pagella}
\newfontfamily\UPAfont{TeX Gyre Adventor}
\newcommand{\UPA}[1]{{\UPAfont #1}}

\begin{document}

\UPA{a̮šĺ}

\end{document}
</code>
I get the three characters. So it mainly depends if the font has them.


ASP Mvc Nhibernate Issue

Question: I am experiencing some bizarre problems with Nhibernate within my MVC web application.
There is not 1 consistent error, I keep getting loads of random ones:

Transaction not successfully started
New request is not allowed to start because it should come with valid transaction descriptor
Unexpected row count: -1; expected: 1

To give a little context to the setup, I am using Ninject to DI the sessions and other Nhibernate related objects, currently I am using RequestScope however I have tried SingletonScope. I have a large and complicated data model, which is read out as a whole, but persisted back in separate parts, as these can all be edited and saved individually.
An example would be having a Customer object, which contains a address object, a contact object, friends object, previous orders object etc etc...
So the whole object is read out, then mapped to the UI domain models and then displayed in different partials within the page. Each partial can be updated individually via ajax, so you may update 1 section or you could update them all together. It seems mainly to give me the problems when I try to persist them all together (so 2-4 simultanious ajax requests to persist chunks of the model).
Now I have integration tests that work fine, which just test the persistence and retrieval of entities. As a whole and individually and all pass fine, however in the web app they just seem to keep throwing random exceptions, and originally refused to persist outside of the Nhibernate cache. I found a way round this by wrapping most units of work within transactions, which got the data persisting but started adding new errors to the mix.
Originally I was thinking of just scrapping Nhibernate from the project, as although I really want its persistance/caching layer, it just didnt seem to be flexible enough for my domain, which seems odd as I have used it before without much problem, although it doesn't like 1-1 mappings.
So has anyone else had flakey transaction/nhibernate issues like this within an ASP MVC app... I know this may be a bit vague as the errors dont point to one thing, and it doesn't always error, so its like stabbing in the dark, but I am out of ideas so any help would be great!
-- Update --
I cannot post all relevant code as the project is huge, but the transaction bit looks like:
<code>using (var transaction = sessionManager.Session.BeginTransaction(IsolationLevel.ReadUncommitted))
            {
                try
                {
                    // Do unit of work
                    transaction.Commit();

                }
                catch (Exception)
                {
                    transaction.Rollback();
                    throw;
                }
            }
</code>
Some of the main problems I have had on this project have stemmed from:

There are some 1-1 relationships with composite keys, but logically it makes sense
The Nhibernate domain entities go through a mapping layer to become the UI domain entities, then vice versa when saving. Problem here is that with the 1-1 mappings, when persisting the example Address I have to make a Surrogate Customer object with the correct Id then merge.
There is ALOT of Ajax that deals with chunks of the overall model (I talk like there is one single model, but there are quite a few top level models, just one that is most important)
Comment: Could you post code samples on how objects are saved and transaction management is done?
Comment: Is it possible that you're inadvertently nesting your sessions/transactions and/or not opening sessions/beginning transactions where you think you are? Do you have the session/transaction logic in multiple places? Have you given any thought to using the session-per-request pattern using an HttpModule?
Answer: Some notes that may help. I use windsor but imagine the concepts are the same. Sounds like there may be a combination of things.

SessionFactory should be created as singleton and session should be per web request. Something like:
<code>    Bind<ISessionFactory>()
        .ToProvider<SessionFactoryBuilder>()
        .InSingletonScope();

    Bind<ISession>()
        .ToMethod( context => context.Kernel.Get<ISessionFactory>().OpenSession() )
        .InRequestScope();
</code>
Be careful of keeping transactions open for too long, keep them as short lived as possible to avoid deadlocks.
Check your queries are running as as expected by using a tool like NHProf. Often people load up too much of the graph which impacts performance and can create deadlocks.
Check your mappings for things like not.lazyload() and see if you actually need the additional data in the queries and keep results returned to a min. Check your queries execution plans and ensure adequate indexes are in place.
I have had issues with mvc3 action filters being cached, which meant transactions were not always started, but would attempt to be closed causing issues. Moved all my transaction commits into ActionResults in the controllers to keep transaction as short as possible and close to the action.
Check your cascades in your mappings and keep the updates to a minimum.

ASP Mvc Nhibernate Issue