Phrase about movie stars

Question: Is there a phrase about those movie stars who are just good-looking but mediocre acting and those maybe not so good-looking (compare with those good-looking ones) but amazing skilled acting movie stars? Something like, 'teenager eye candy'? Is there any specific words or phrase for these two?
Comment: Could be bit-part actor. Or someone that overacts is called a ham-actor
Answer: The phrase "eye candy" that you used is pretty apposite for actors of this sort. Other times we just call them "Megan Fox".
Actors of the opposite sort are usually just called "good actors".
Comment: Megan FOX????? Come on, we ain't judging here, we're dicussing here, haha! Although I really agree with you on this one, still, no other words or phrase at all??? And "good actors", that's just not strong enough for what I wanna express:)
Comment: @Daisy Then use 'great actors'. Or 'excellent actors'. Or 'amazing actors'. Or ...
Comment: +1 for eye candy.  The opposite sort you might describe as "exceptionally talented thespians."
Answer: 1) "Not just a pretty face" is a common antonym, so "just a pretty face" would be understood.
2) It's not quite right, but character actor is close.  Many people in this category would also be described as character actors.
Comment: Character actor often implies especially ugly
Answer: There's also the old-fashioned "matinee idol," which means a male actor known primarily for his looks.

Phrase about movie stars


What exactly is this crystal thing on Mars in Watchmen (2009)?

Question: There is a scene in Watchmen (2009) on Mars with Dr. Manhattan. Every time I watch the movie I'm wondering what exactly is this crystal/diamond thing we can see on Mars.
Answer: First of all, what this thing actually is, it's nothing more than a huge glass structure that Dr. Manhattan creates out of Mars sand. But to understand why he builds that, we have to look at his character a bit (at least as far as I'm able to do). I'll draw a bit of information from the comic here, not entirely sure by now how much of this is also part of the movie, but the overall themes should match (especially considering how true to the source material the movie was).
When Dr. Manhattan left earth this was because he was currently fed up with humanity (and probably also felt some guilt for Janey's cancer, not knowing that he wasn't the cause). To compensate this he takes refuge in the solitude of Mars. And as the son of a watchmaker, Jon Osterman learned from his father to admire the precision of such a watch as a structue of many simple parts that precisely interlock with each other. And I guess at this point he searches refuge in creating such a complex and precise structure out of something as simple as the sand of Mars, all while reflecting about his past life and trying to understand the nature of time and determination itself and the problems of cause and effect. And the corresponding chapter of the novel is indeed also called "Watchmaker", reinforcing this attitude.

In addition to that, if we understand Dr. Manhattan with his godlike powers as an exaggeration (or perversion?) of Superman, this walkable structure in the solitude of Mars might as well be understood as an allusion to Superman's crystalline Fortress of Solitude in the lonesome depths of Antarctica.
Comment: @KeyBrdBasher I don't think it is supposed to actually do anything meaningful (he only uses it fly around in with Laurie). I think it really only has what one could call "therapeutic value", as it helps him to understand the meaning of determination by example. But other than that he really just seems to do it because he can and to create something (at the end of the story he also mentions that he'll maybe create life one day wherever he goes).
Comment: But what is the purpose of this huge _watch-like_ instrument? Does Dr. Manhattan build it just because he can, in sort of a therapeutic manner or he wishes to use this in the future for something.
Comment: Thanks for the clarification @NapoleonWilson. Much appreciated.
Answer: Manhattan built it so that he'd have somewhere to sit and contemplate his existence. The script refers to it as his 'palace', noting its watch-like composition.

BACK TO: The pink glass structure on Mars which SPREADS OUT INTO COMPLEX GLASS PATTERNS, RISING FROM THE PLAIN at Dr. Manhattan's command-- Dr. Manhattan, now dwarfed by the RISING, EVOLVING GLASS STRUCTURE, which begins to resemble parts of a WATCH-
BACK TO: Mars, where Dr. Manhattan's GLASS PALACE rises in its full glory. A home fit for a god.
Answer: As others have said, Manhattan has guilt. I think he hated that humans die and wanted to create something that showed time (his wheel clock thing) but would not die. This clock wheel will not die like humans do. But it will be there with him. If you notice when he was building it he was in a meditative pose while hovering. Buddhism has a lot of talk of getting away from it all to find inner peace. The Buddha himself discovered he could not always be alone and that he simply must have some interaction with others. Maybe this wheel clock thing is otehrs to Dr Manhattan.
Answer: It's a fractal that holds meaning to Dr. Manhattan after having observed the fractal nature of the universe that already existed to the point of boredom.
Dr. Manhatten follows the journey of any creative: understanding that he is a creation first and foremost, realizing that as creation he has inherent creative powers, using those creative powers to the ends of other creatures under the assumption that they know what they're doing, realizing that all creation is fractal including the creative able to observe this truth, and then finally creating for its own purposes keeping in mind the fractal structure of the universe and the need to exercise free will for novelty.
Dr. Manhattan is the only one who can perceive the universe this way and THEN decide to create but even that creation is merely another fractal, the only difference is that this one holds personal meaning for Manhattan in the shape of a clock, a mockery of the time that he once thought had intrinsic meaning, the measurement of which his biological father spent his limited time perfecting. It's a joke on the absurdity of existence and the meaning we find to cope with it.
Answer: I think the best place to start is the "grains ... haphazard, random, a disorganized stream of silicone that seems pregnant with the possibility of every conceivable shape." Look at some images of the seemingly infinitely variant complex silica structures created by Radiolaria & Diatoms and you'll make the connection.
Here's a couple pages from a work by Ernst Haeckel that shows what I mean:

link to full scanned document (Internet Archive)
Comment: Hi, welcome to Movies & TV.  So, you're saying it's a giant diatom?
Answer: I think since Doctor manhattan was haunted by guilt of the cancer ,he thinks he's also responsible for the end of it, so he built him self a time machine to travel back and forth in time to fix the problem of his guilt.
Comment: What evidence do you have that this is a time machine? Further, what evidence do you have that Doctor Manhattan would need to build a machine to traverse time?
Comment: Please share some more details and explanation.


Taking the derivative of the log-normal pdf

Question: It is said that if $S_T$ is log-normal, then its pdf is given by
$$
g(x) = \frac{1}{x\sigma\sqrt{T}} \phi(\zeta(x))
$$
where
$$
\zeta(x) = \frac{\log(x/S_0) - (r - \sigma^2/2)T}{\sigma \sqrt{T}}
$$
I'm trying to get the score function of this by taking the derivative w.r.t $S_0$. So, when I take the derivative, I get
$$
\frac{\partial g(x)}{\partial S_0} = \frac{1}{x\sigma\sqrt{T}} \frac{\partial \phi(\zeta(x))}{\partial \zeta(x)}\frac{\partial \zeta(x)}{\partial S_0}
$$
But, what is weird is that the score function is given as
$$
\frac{\dot{g}(x)}{g(x)} = - \zeta(x) \frac{ \partial \zeta(x)}{\partial S_0}
$$
This doesn't make sense to me because it omits $\phi'(x)$ and $\phi(x)$ in the equation. Can anyone explain this to me?
Answer: What about this is odd? It is also true of the normal distribution (because $\phi '(x)=-x \phi(x)$).
Comment: Is that true for any parameters of $\zeta(x)$ like $S_0$ or $\sigma$?


Making Struts send 500 Internal Server Error when exceptions get thrown

Question: I'm working on an AJAX-enabled JavaScript frontend that makes calls to a Java backend written with Struts.  My problem is that when the backend throws an exception, the client still sees a "200 OK" HTTP response code instead of "500 Internal Server Error" like one would expect.
This is tripping me up repeatedly because my 3rd-party client JavaScript library depends on HTTP status codes to determine if something is wrong with an AJAX call, as most modern libraries normally do.  The errors pass undetected until my code blows up when it tries to parse what would normally be JSON.
I really want to avoid hacking my client JS library in order to gracefully handle these errors.  So then, how can I make Struts give me a 500 status code when there's been an unhandled exception in the backend?  Shouldn't this be Struts's default behavior?
Edit: The client-side code is irrelevant in this case.  I am needing to fix the server so it sends the appropriate status code when unhandled exceptions happen.  Thanks!
Answer: I figured out one way to do it.  I'm not sure if it's the best or easiest, but it works.  I found the Struts Exception Configuration guide and added the following to my <package> inside struts.xml:
<global-results>
  <result name="exception">/exception.jsp</result>
</global-results>

<global-exception-mappings>
  <exception-mapping exception="java.lang.Exception" result="exception" />
</global-exception-mappings>

This causes all unhandled exceptions to be redirected to /exception.jsp.  And here are the JSP's contents:
<%@ taglib prefix="s" uri="/struts-tags" %>
<%@ page contentType="application/json; charset=UTF-8" %>
<% response.setStatus(500); %>
{"success": false,"errors": "<s:property value="%{exception.message}"/>"}

You'll note on the 3rd line that I manually set the response code to 500.
This gave me a new problem: exceptions were not being logged any more.  As suggested in the aforementioned Struts guide, I solved this by adding the following to my <package> in struts.xml as well:
<interceptors>
    <interceptor-stack name="appDefaultStack">
        <interceptor-ref name="defaultStack">
            <param name="exception.logEnabled">true</param>
             <param name="exception.logLevel">ERROR</param>
        </interceptor-ref>
    </interceptor-stack>
</interceptors>

<default-interceptor-ref name="appDefaultStack" />

Struts: -1 for making such a simple and obvious feature NOT the default, and another -1 for making the solution so obtuse.
Answer: Update: I've fixed the <global-results> section (which was missing the httpheader tag)
I like your solution better, but here's another way you could do it if you didn't want to mess w/ setting the response header in the jsp.

In struts.xml, create a global exception mapping from "java.lang.Exception" to a result named "exception"
In struts.xml, create a global result which maps "exception" to a httpheader result with a value of 500.
In web.xml,  create an error-page entry that maps error code 500 to your error page location.

So, for struts.xml:
<global-exception-mappings>
    <exception-mapping exception="java.lang.Exception" result="exception" />
</global-exception-mappings>

<global-results>
    <result name="exception" type="httpheader">
        <param name="error">500</param>
    </result>
</global-results>

And for web.xml
<error-page>
    <error-code>500</error-code>
    <location>/exception.jsp</location>
</error-page>

This works but has some big downsides.  The servlet container is rendering your error page (not struts) so you wont have access to the original error message or the struts valueStack. Exception logging will still work, however (if you have enabled it).
As an aside,  I too find it baffling that struts makes this so difficult.  In every other framework I've dealt with the concept of returning an error page and an error code  is pretty trivial to implement.
Answer: The 500 Internal Server Error is a server-side error, meaning the problem probably isn't with your computer or Internet connection but instead is a problem with the web site's server.
There is noting to handle this in the client side. It is on the Web Server (HTTP server) configured in handling the requests.
Comment: -1.  I think by the way I wrote my question, it's clear that I already understand what a 500 Internal Server Error is, as well as the nature of client-server interactions.  I was looking for information on how to make Struts (on my server) behave the way I wanted it to.
Answer: You didnt mention which JS library you are using. I would suggest read the documentation carefully. If it has some kind of callback method, it must have some responseText other than responseCode. Whenever some validation exception happens in server-side, pass a error message too. Just don't rely on throwing some  exceptions, because you are using AJAX. You can track that responseText for showing some message like "validation failed for this reason, please try again". Agree ?
Otherwise throw WebApplicationException before the response is committed:
throw new javax.ws.rs.WebApplicationException();  // or by any other constructor

Here is the jar
Comment: The client-side library is ExtJS but that doesn't matter.  The server is what's having the problem.  Struts sends an HTML error report and a "200 OK" status code when there's an unhandled exception on the server side, and that's what I'm trying to fix.  The HTML I can handle, but Struts has got to be able to send code 500 when errors happen, not code 200.  Thanks!
Comment: `WebApplicationException()` causes an HTTP 500 error code. did you try throwing this one ?
Comment: On the server side, I want to avoid having to insert try/catch blocks everywhere.  I just need some kind of configuration that tells Struts, "do the Right Thing(tm) and give me a 500 response code whenever you send these silly Problem Reports."


Confusion about confounders and moderators

Question: So as I understand it a confounder is associated with both the response and explanatory variable, and explains any association between the explanatory and response variable. However a moderators change the effect (in size or direction) of the explanatory variable on the response, so is it the case that every confounder is also a moderator as confounders also change the effect of the explanatory variable on the response variable?
Comment: Possible duplicate: https://stats.stackexchange.com/questions/38326/is-it-possible-to-have-a-variable-that-acts-as-both-an-effect-modifier-and-a-con/193340#193340
Comment: Some confounders can be beneficial, for example with paracetamol and codeine the effects for pain control are greater than either alone in equivalent doses and act synergistically.
Answer: To add on to Ed's model-based explanation, here's a purely causal one (no specific statistical models required).
A confounder is a variable that causes both the predictor of interest and the outcome. (Association with the predictor and outcome is not sufficient for a variable to be a confounder). A moderator (also known as an effect modifier) is a variable for which the effect of the predictor on the outcome varies. Some moderators are also confounders, but not if they don't cause the predictor. For example, mediators (variables caused by the predictor that also cause the outcome) are not confounders but may be moderators. Variables completely independent from the treatment (e.g., all pretreatment variables if the predictor is randomized) are not confounders but may be moderators.
One thing to note is that the presence of moderation depends on the effect measure considered (i.e., risk difference, risk ratio, odds ratio, etc.). If the predictor causes the outcome, then any variable that also causes the outcome that is not a moderator on one scale will be a moderator on another.
Answer: The presence of moderation means means that the strength of relation between predictor X and outcome Y depends on the value of predictor Z. Confounders bias causal parameter estimates but are compatible with fixed effects models, so a confounder need not be a moderator. Moreover, a moderator Z need not be a confounder if Z is orthogonal to predictor X and is included in the model.


Where can I store my application's files?

Question: Well, I'm new to the Mac OS X platform and seriously I don't know anything about it. I mean on Windows I just store it at the Program's Files directory, What about the Mac, is there any recommended place to put the files?
Answer: Resources related to your application that will not be changed after the app is installed going into the app wrapper (see documentation).
Cached data that can be deleted at any time goes in ~/Library/Caches.
Supporting data that should generally be persisted, but isn't document data, goes in ~/Library/Application Support.
Documents and user data that is primary to the purpose of your app goes in ~/Documents, generally.
Preferences go in ~/Library/Preferences, but are generally read/written entirely via the NSUserDefaults API.
Answer: ~/Library/Application Support/YourAppName/yourFilesHere
This way the files will be personal to the user using your app. If you want tho files to be global they should be in your app bundle/Resources/
To get the home directory ( the tilde ~ ) you can use NSHomeDirectory or you could use [@"~" stringByExpandingTildeIntoPath];
Comment: @bbum Read my post, its there
Comment: I know -- along with a suggestion to do something completely wrong. ;)  The emphasis was more *don't do that*.
Answer: You can store your application-created / application-deependant files in ~/Library/Application Support/YourApp/Files. Otherwise, user created Documents would most likely be best stored in the Documents directory.
Comment: This is not recommended practice (~/Library/YourApp).  There are more appropriate patterns to use, depending on role of the file/data.


Boot loader won't load

Question: I think it is the OS boot manager because it is the first item on "Boot Order". Any ways when Ubuntu loads the first screen I get has purple edges around it (this must be the boot-loader). I don't know any of the LiveCD stuff... I just want to boot Windows 8 without virtual box. It doesn't matter if my stuff is on it or not. I either want to restore Windows 8 or load it.
Answer: Just an inkling, but hold [Shift] as you start the computer, just before it shows you this screen. IF you get any options, it might be the Ubuntu kernel experiencing issues. If nothing changes, then it could be a major issue with GRUB (the OS bootloader).

Boot loader won't load


Change Address in transaction

Question: I made an address with cardano-cli (here) and I funded it from my Yoroi wallet, but I don't know where this change address came from. Shouldn't the change address be the input itself or Am I missing something here? (transaction)
Answer: Cardano utilizes a UTXO-style accounting model (similar to bitcoin, but with extra features), as opposed to an accounting model, like what Ehtereum uses. Here is a quick overview of the differences.
In short, a UTXO is an output of a previous transaction that "sits and waits" at an address to be used as an input for a future transaction. It is analogous to how cash works; if I send you 30 ADA, you can almost imagine that a 30-ADA "bill" (think dollar-bill = UTXO) is created at your address. If you now want to spend this 30-ADA UTXO, you cannot rip off a piece of it anymore than you could rip off a piece of a dollar bill when you want to spend it. Instead, you spend the entire bill, and receive change back in the form of smaller denomination bills. UTXO's work the same way.
In your case, you had a 36 ADA UTXO in your Yoroi wallet, and you wanted to send 1 ADA to your CLI wallet. Yoroi automatically created a transaction with 1 input (the original 36-ADA UTXO), and two outputs (1-ADA UTXO to the CLI wallet, and 35-ADA UTXO sent back as "change" to your Yoroi wallet). Wallet software like Yoroi makes such change management simple and user friendly; it auto-generates a change address for your wallet and send your change there as one of the TX-outputs.
If you now try sending funds from the CLI wallet you'll have to build the full transaction manually, which is a great way to get a feel for how UTXO accounting works.
Comment: This is possible - in fact you can do this yourself if you use the CLI method. However, it is not done by default for privacy reasons - there is no public-facing cryptographic link between your original address and your change address, so this greatly obfuscates the movement of funds. (Note: staking keys complicate things though, but if we leave that aside, change addresses have virtually zero downside and a great privacy upside)
Comment: Thanks, but why the change address is different from the first one? I mean, I had 36 ADA in my wallet at first and transferred one of them to somewhere else. So isn't it more logical to send back the 35 ADA to my first address?
Answer: Yoroi follows the same nomenclature that cardano-wallet does with change addresses. A number of other wallets (adalite, typhon and my python wrapper wallet https://github.com/input-output-hk/adawallet re-use the same address as the change address).
The way it works is explained here in detail: https://github.com/cardano-foundation/CIPs/tree/master/CIP-1852
Addresses are derived from the root key that comes from the mnemonic of your wallet. Receiving payment keys use the derivation path: 1852H/1815H/0H/0/0. However change addresses are derived from 1852H/1815H/0H/1/0. The stake key (currently) is always: 1852H/ 1815H/0H/2/0`.
So essentially anytime you send a tx, it will generate a new address not in the receiving address path and send the change to that address.

Change Address in transaction


How do I use Unetbootin to make a bootable Windows USB installer?

Question: it says missing bootmngr or something like that. I'm on ubuntu 12.04 or whatever, the newest one using the gparted to format to NTSC and then unetbootin to install the bootloader, and the iso, then restart. also, i do not know how to use terminal or code..and im also using an external hardrive because this laptop is missing one...
Comment: Unetbootin in not intended for making bootable USBs with Windows. Use proper tools for the job, and proper help and support sites as well.
Comment: im on ubuntu! and all the guides i find use unetbootin. i thought this was a help site?
Comment: 1.12.04/2.NTFS/3. I did not undertand what is it that you did. You got the UBuntu ISO, burned it into the USB using Unetbootin..then what? Windows got messed and it says bootmgr is missing? that is fixed using the Windows CD not the Ubuntu USB..
Comment: @JoeMech Give [MultiSystem](http://translate.google.co.in/translate?hl=en&sl=fr&u=http://liveusb.info/dotclear/) a shot :)
Comment: no no, im on ubuntu, and i want to get rid of ubuntu and put windows on here. i put the windows iso on the usb drive, then the program tells me to restart. i do, and it says bootmngr missing.
Comment: @Nitin Venkatesh  it's almost 7 years later and MultiSystem has still never included Windows.
Answer: That worked for me.

Format your USB as FAT32 in GParted
Open UNetbootin and get it as far as the stage where it brings up the
USB partition to install to e.g. /dev/sdb1 — Don't install the ISO,
though
Leaving UNetbootin open as is, switch to GParted
Format the USB in GParted as NTFS
If GParted doesn't automatically add the "boot" flag, add it yourself
Exit GParted, mount USB by running sudo mount /dev/sdb1 /mnt (don't forget to replace sdb1 with your one)
Now, go back to UNetbootin, which you've left open in the meantime,
and click OK

Doing so, UNetbootin will think you are using a FAT32 partition and will let you use NTFS format.
Comment: a more elegent way with recent versions: `unetbootin installtype=USB targetdrive=/dev/sdd1` (for example).  This worked for me, YMMV.
Comment: What a great ugly dirty hack! But it's not your fault :) Thanks, worked very well!
Comment: Cool, a great way to get around newer versions of unetbootin not supporting NTFS.
Comment: Thank you, I needed to do it from linux, not windows
Comment: I tried that but I get a "BOOTMGR is missing" message at boot.
Comment: Awesome hack :D Worked for me in **Ubuntu 12.04** with **Unetbootin 565-3**
Comment: I had a problem with an ACER desktop computer, the live USB only worked on some computers and I tried changing BIOS settings... In fact, you can directly format USB to NTFS and then copy paste ISO content on USB but in in my case, in order to work with the ACER desktop computer, I used Microsoft's tool "Windows 7 USB - DVD Tool.exe" through VirtualBox Windows VM.
Comment: god bless you angel.
Answer: If Windows is what you're trying to install, then Windows 7 bootable USB DVD download tool from Microsoft (Also works on XP) allows you to create a bootable version of windows 7 OS for installing windows through USB drive. To download this utility click Here.
Note: You need to run this on a windows machine.
For more information see Windows 7 USB Creator

Now to create a bootable Windows 7 USB Drive while using Ubuntu, then
  you need to make sure you have a Windows 7 .ISO file (you can create
  it from the DVD) and a 4GB USB flash drive (or larger).
Install Gparted and format the USB drive to NTFS. In Ubuntu, use the
  following command to install Gparted:1

sudo apt-get install gparted

To be able to format a drive to NTFS, you'll also need ntfs-3g -
  install it using the following command:1

sudo apt-get install ntfs-3g

1Source:Create A Bootable Windows 7 USB Drive From Ubuntu
Updated to add the way to create it using Ubuntu from the Source.
Install Gparted and format the USB drive to NTFS. to install Gparted:
sudo apt install gparted

To format the usb flash drive drive NTFS, install ntfs-3gt to install just type the command below in terminal
sudo apt install ntfs-3g

download TESTED Unetbootin version 494 from Here
Once downloaded navigate to the folder where the file was downloaded, most likley the Downloads folder, and open terminal there.  Just press Ctrl+Alt+T on your keyboard to open Terminal. When it opens, run the command(s) below:
sudo chmod +x ./unetbootin-linux
sudo ./unetbootin-linux-494

or
sudo add-apt-repository ppa:gezakovacs/ppa
sudo apt-get update
sudo apt install unetbootin

Once installed.  open UNetbootin, select "Diskimage" and then browse for your Windows 7 ISO file.
Comment: Bit hard to run it on a Windows machine it you don't have one.
Comment: @mckenzm If you click on the last link, you will see how to create it using Ubuntu.  I will add  those steps in the answer.


Is it possible to display the fields of the lead after converting

Question: I have a vf page on my custom object top panel as custom console component.This object has a lookup relationship with the lead object. So once the lead got converted, will it be possible to display the information of the lead in the top panel of the associated custom object record.
Answer: Yes. Just because the lead is converted doesn't mean it disappears from the database. You can still query for it, it will still appear in lookup fields, and so on. In fact, your code doesn't even need to be concerned as to whether or not it's been converted at all; from its perspective, it's still the same query with the same data.
Comment: @Ram451 addenda -- just don't put a link to the standard Lead detail page in the custom object VF page because if the user clicks it, the Lead will display with a notification message stating it is converted.


Clicking pauses game?

Question: Every time I hold the left click button the game goes to the pause screen. I have to click back to game a lot to mine and harvest trees. Does anybody know what I need to do to fix this?
Comment: This happens to me all the time in minecraft classic. The game isn't even playable in Chrome. It's a little better in Internet Explorer _oh god I can't believe I just wrote those words_, but the bug still happens from time to time. Google shows me lots of people having this problem with minecraft on linux, but I am on windows. I gave up, never fixed it.
Comment: Clicking outside the game window will pause the game, though I'm not sure what might be causing this.
Comment: This sounds like a problem with your computer. Try playing another game and see. Have you tried restarting your computer?
Comment: Are you on Linux?  Perhaps the solution [here](http://gaming.stackexchange.com/questions/27803/why-does-my-character-walk-forward-automatically) will help you?
Comment: It doesn't matter if he's on Linux because my bro has the same problem occasionally but he's on windows.
Comment: Are you playing in the browser? If you are, does installing it fix the problem?
Answer: This is probably due to your computer not being able to keep up its framerate.
Turn down your graphic options and view distance.
Comment: Yeah, that's what my bro said helped when he had the same problem.
Answer: Performance has nothing to do with it.  This is a common problem for lots of people, trying to play in browsers and most people do not have stuck ESC keys.
For most people, what is happening is some app (possibly the browser itself?) is stealing mouse focus, which causes the game to pause.  The pause is a nice feature for when you have to leave the browser game for a minute.  When you hit escape it pauses automatically while you do other things.  However, in this case some app seems to be grabbing mouse focus, which causes the game to pause.  It happens to me only when I hold down either right or left click.
A couple things to check:

Chrome seems to do this a lot, try a different browser.
Do you have an app running which refreshes itself every once in a while, or grabs focus? Examples:  an alarm, IM alerts, running a macro.
Is your java up-to-date?  Minecraft runs in it, and depends on it being updated frequently.
Is your escape key stuck?  It does happen, just give it a tap and make sure its working properly.
Comment: this has nothing to do with java, flash or browser, this is simply a glitch. the mouse focus was never stolen, i use 4 browsers and same issue, i re installed java and flash. this is just a random glitch, like i cant click, and this happens only when i click not randomly.

Clicking pauses game?


How do you calculate curvature from the density?

Question: We know that this density results in a flat universe.
$$\rho_c=\frac{3 H^2}{8 \pi G}$$
And we know that if the universe isn't flat, the density as a proportion of critical density can be expressed as this:
$$\frac{\rho}{\rho_c}=\frac{8 \pi G\rho}{3 H^2}$$
The FRW metric tells us that that spacetime is shaped like this (I'm ignoring the flat and hyperbolic versions of the formula here):
$$ds^2=(ict)^2dt^2+a(t)^2\left(dr^2+\left(\frac{sin(r\sqrt{k})}{\sqrt{k}}\right)^2\left(d\theta^2+sin^2\theta\space d\phi^2  \right)  \right)$$
I've seen many, many articles talk about how something less than or greater than critical density causes spacetime to be curved, but I've never seen an article put it all together.  If $\frac{\rho}{\rho_c}$ is less than 1 (that is, a closed universe), then what value do I have for $k$?  How is $k$ related to the sum total of all the mass/energy components: $\rho=\rho_c\left(\Omega_M+\Omega_\gamma+\Omega_\lambda\right)$?
Answer: This is just the first Friedmann equation (including the cosmological constant within $\rho$):
$$H^2 + \frac{k}{a^2} = \frac{8\pi G \rho}{3},$$
which you can rearrange  and evaluate at the present time (so $a=1$) to get
$$k = H^2 \left( \frac{\rho}{\rho_c} - 1 \right) .$$
This gives you the present curvature as a function of the quantities you have. Note that this is not just $k=1$; it has dimensions of inverse length squared, so it is the actual curvature of space, equal to the inverse of the squared radius of curvature of the 3-sphere.
Comment: @GluonSoup we set $c=1$ because it's convenient, because we know how to convert back to normal units, but fundamentally because the way it simplifies equations reflects fundamental symmetries of the laws of physics, namely the unification of space and time. We find that this has conceptual and practical advantages.
Comment: I don't understand why you cosmologists use 1 instead of c.  The previous equation doesn't produce something with inverse length squared.  This equation does: $$H^2 + \frac{kc^2}{a^2} = \frac{8\pi G \rho}{3}$$ $$kc^2 = \frac{8\pi G \rho}{3}-H^2$$ $$\frac{kc^2}{H^2} = \frac{8\pi G \rho}{3H^2}-\frac{H^2}{H^2}$$ $$kc^2 = H^2\left(\frac{\rho}{\rho_c}-1\right)$$ $$k = \frac{H^2}{c^2}\left(\frac{\rho}{\rho_c}-1\right)$$But thank you for sending me in the right direction.
Comment: It also brings in imaginary numbers(solving for c) for false fringe cases falling back on error for small quantities.


Exposing a file-like object from Cython

Question: I need to expose a file-like object from a C library that i'm wrapping with a Cython module. I want to reuse python's generic io code for stuff like buffering, readline(), etc.
The new IO module seems to be just what i need, but actually using it from Cython seems to be non-trivial, I've tried several aproaches:

My code in a cdef class that inherits from IO.RawIOBase - This fails because cdef classes can inherit only from other cython cdef classes, while IO is "raw" C.
My code in a cdef class, another (non-cdef) class that inherits both my cdef class and RawIOBase - Fails with "TypeError: multiple bases have instance lay-out conflict"
My code in a (non-cdef) class that inherits from RawIOBase - This works, but i loose the ability to store my c-level (that i need to talk to the underlying library) stuff inside the class, so i need a make a cdef wrapper around it and store that as a member... this looks like a mess.
My code in cdef class that doesn't inherit (Raw)IOBase rather reimplements it's functionality, Python code gets my object wrapped in BufferedReader/BufferedWriter - This one seems to work and less messy than the previous option.

My questions(s):
1) Am I missing something and reinventing the wheel here?
2) What is the exact stuff from IOBase that I need to implement to keep BufferedReader/Writer happy with my object in current and future versions of python? Is this documented anywhere?
3) How will that work in python 2.6 where IO is pure python? I guess that performance will suffer but it will work, right?
Answer: Would it be too inefficient to call os.fdopen() on the file descriptor number returned by the underlying library, and then to dispatch normal Python method calls to the resulting file object in order to do your input and output? With most I/O, I would be surprised if you could see a difference with whether you called a C routine directly or let the Python method dispatch logic call it for you — but, of course, you might be in an unusual situation and I could be wrong!
Comment: Sorry, i didn't see this answer earlier. This isn't really aplicable to my case, as what i'm getting from the 3rd-party library isn't an os-level FD.

Exposing a file-like object from Cython


Leftist Heap doesn't support DecreaseKey operation?

Question: I'm studying data structure. When I read the chapter of heap, something really confused me. DecreaseKey's time complexity of the binary heap is O(lgn). However, I found somewhere on internet claimed that Leftist Heap doesn't support DecreaseKey operation. But I wonder why? Can't we simply treat leftist heap as binary heap to perform DecreaseKey?
Comment: Assuming you have a reference to the node for decreaseKey, you should be able to do an arbitrary remove in then an insert in $O(\log n)$. Check [these slides](https://en.wikipedia.org/wiki/Leftist_tree#External_links) by Sartaj Sahni.
Comment: Every source I read mentions this "assuming you have a pointer to the node" caveat. What if you don't? Does it mean you have to traverse the entire structure to find that node before it can be decreased/removed? That would be a pretty big limitation with leftist trees.
Answer: Indeed, the right solution of DecreaseKey for leftist trees seems to be hidden on the internet. (My book by Weiss has a solution, but in the chapter on amortized analysis, and I do not quickly understand the argumentation.)
First, we cannot treat DecreaseKey as in binary heaps. There one repeatedly swaps the node with its parent until a parent is found which is actually smaller than the new value. This operation works in leftist trees, but may take linear time. In leftist trees there is no bound on the length of paths to the left, and indeed such a tree can be just one long linear leftmost tree.
The solution is to cut the node $q$ that is decreased (with its subtree), to change the value of $q$ to the new value, and merge it with the remainder $T$ of the original tree. Before we can do that we should bring $T$ back into leftist form, and restore the null-path-length values that are changed by cutting the subtree. As we cut $q$ from the tree, only the nodes from the parent $p$ upwards to the root have to be checked. (Unfortunately this may be a linear number of nodes, as we have seen.)
The solution is that the new null-path-length values we asign upwards in the tree are always one larger than the value at the previous level. This process stops when we are in a left child which has new value $\ell$ and its right sibling has value $r$ with $\ell \ge r$. Then the parent already had value $r+1 = \min\{\ell,r\}+1$ and we are done.
We know (from the basic property that makes leftist trees efficient) that a null-path-length value of $\ell$ means that there are $2^\ell-1$ nodes in that subtree, making the operation logarithmic.
The fact that the values upwards in the new tree are always one larger is essential here, that was not (necessarily) true along the path in the original tree.
Comment: Now can someone *please* change the [summary of running times](https://en.wikipedia.org/wiki/Priority_queue#Summary_of_running_times) for decrease-key for leftist trees on the Wikipedia page for the priority queue (which lists O(n) complexity)??


nominal adjective or noun?

Question: In the following sentences is "bad" a noun or a nominal adjective: "You have to take the bad with the good" and "Things went from bad to worse"
Comment: ... take the bad (things) with the good (things). **Things** went from (being) bad (things) to (being) worse (things). The noun is 'things' in both sentences. 'Bad' and 'worse' are adjectives.Take that which is bad, is contracted to 'the bad', but conceptually one still needs to supply a noun somewhere for the adjectival concept to have effect.
Comment: Your first example shows nouns in the form of  [nominalized adjectives](https://en.m.wikipedia.org/wiki/Nominalized_adjective).  Your second one shows adjectives. Cf. Things went from [being] [very] happy to [being] [extremely] sad.
Comment: If it's a noun, then what's a bad? Can you have a terrible bad or the terrible bad? Or would it need an adverb like the terribly bad? If so, it isn't a noun, just a piece of a noun phrase.
Comment: @tchrist In modern informal speech "bad" has definitely become a noun meaning "error" or "fault", I think particularly in the US. It seems quite common to hear "Oh, that's my bad" these days. There's currently an advert for the Kia Niro hybid car on British television which features Robert de Niro saying "My bad" as an aoplogy for confusing a reference to the car with a reference to himself.
Answer: These are all adjectives, not nouns.
In sentences such as:

The worst is yet to come.

The subject NP has a determiner the and a fused-modifier head, worst, which is a superlative adjective. It is not a noun. It does not "become" a noun. It remains an adjective.
Consider how different it is from this sentence with an actual noun in the same slot:

The surprise is yet to come.

How can you tell that (1) has an adjective but (2) has a noun?  You can apply an intensifier like truly to adjectives but not to nouns.  This is grammatical:

The truly worst is yet to come.

But this is not:

*The truly surprise is yet to come.

So even though worst is still an adjective, it is the head of the subject NP because it's a fused-modifier head.
Not all NPs need contain nouns.  Rather, they are syntactic constituents that serve in the grammatical role of subject, object, and so forth. That doesn't mean they have to have a noun in them. Many do not. This is one such.
The bad is the direct object of your verb take. So is the good. There is no noun there, just an NP containing an adjective as a fused-modifier head. You can tell they're adjectives because you can apply intensifying adverbs like truly to them, which can't be done to nouns.
Comment: They are adjectives, but they function (at least here) as nouns.  The poor = poor people; the tortured = tortured people; the elite = elite people.  That way, can't 'the good/ the bad' be considered noun, function-wise?
Answer: In the first sentence "bad" is clearly the noun. In the second, as only the adjective can take comparative forms, "bad" must be the adjective, but that deduction is still rather intuitive. Anyway, the phrase "going from bad to worse" is known as a standard expression  constructed with the adjective (Cambridge Dictionary).
Comment: If "bad" is clearly functioning as a noun in the first sentence but is actually an adjectival form, doesn't that make it a nominal adjective? If not, why not.
Comment: @tangosquared It is not found in the entries of dictionaries as merely an adjective, but as a noun also; on the other hand "elderly" is found only as an adjective and it can be used as a noun in "the elderly"; it is on this basis that nominal adjectives are dealt with, they are just adjectives.
Comment: PS Interestingly enough, Merriam Webster categorizes the second sentence as an example of a noun. That's somewhat why I am asking if it isn't really an example of a nominal adjective.
Comment: thanks for your perspective, but I have found that dictionaries can often vary in terms of the classification, particularly for adjectival forms, particularly when they take the role of a noun. But dictionaries generally don't include this classification. Further, https://www.ucl.ac.uk/internet-grammar/adjectiv/nominal.htm suggests that "the good" (and by implication "the bad") is a nominal adjective
Comment: @tangosquared There is a certain illogicality in treating "bad" as a noun in this phrase: it's a word defined as "bad people, things or events"; from this we get that things went from bad things to worse; it seems it is more intelligible to say "Things went from being bad to being worse.".
Comment: @tangosquared You think then that as long as the form is defined as an adjective, whether also defined as a noun or not its being used as a noun makes it in all cases a nominal adjective?
Comment: In my scenario, I am not trying to write a grammatically correct document, but I am parsing the results of speech recognition input, which supplies a stream of words but provides no language understanding. However, I have a way to decorate words with semantics that can help with interpreting those words. Conversational speech is often grammatically incorrect, so I can't rely on someone use the best form. Long story short, if all examples of adjective that take the role of a noun as nominal adjectives may make it easier than classifying "bad" as both a noun and a verb.

nominal adjective or noun?


windows could not start sql server ( error 1067 the process terminated unexpectedly)

Question: When i start SQL Server 2008 in my computer this error windows could not start SQL Server (mssqlserver) service on local computer error 1067 the process terminated unexpectedly.
Comment: Checking Windows Event Viewer
Answer: Check the windows event viewer.
Also check the SQL Error log - if the service stayed up long enough to start writing to that, it may provide some useful information.
Error 1067 is a non-specific error, unfortunately, so any information you can provide from the error logs will help.
Answer: If you are using a system which having credentials managed by an active directory server, the issue seems to be your sql server credentials are not synchronized with active directory credentials
go to services ....> open all sql related services there should be five total. change the credentials shown there to your active directory credential. apply and start the process again. this works for me always
Answer: Run > services.msc and look for SQL Server (MSSQLSERVER). Right click and select Properties. Click on the Log on tab and check what the service is starting as. If it is set to system, try entering valid username and password. Otherwise, if a username and password is already there (Usually NT Service or similar) change it to System (the radio button). Try starting the service after this to see if it works.


Does a messier room actually have higher entropy?

Question: When my chemistry teacher was explaining entropy, she used the analogy of a clean vs. messy room. What I'm wondering is whether a messy room really does have higher entropy. Does this still work on a larger scale? If not, can I trust the analogy?
Comment: Rooms don't have entropy. Other than that, the analogy is good.
Comment: Calculating the entropy of a small number of objects is not very meaningful, neither is calculating the entropy of an assortment of macroscopic objects.You cannot predict anything sensible from the result.
Comment: Fun fact: Every letter in a common sentence contains roundabout one bit of information. Is the rest noise (=entropy), or is it structure, predetermined by the information?
Answer: A room can be a complicated system, (at least mine can be) so I shall assume a simplified version: an enclosed space bound by 4 walls, a ceiling and a floor and the only piece of furniture inside the room is a desk, and  two books on it -- book 1 and book 2.
In the this scenario, I would define a clean room as one with both the books neatly stacked on the desk, and in a messy room you can find one of the books on the floor.
Now, if I were to try enumerate the number of ways of organising the books in a clean and a messy room, I would find that there is exactly one way in which I can achieve a "clean room configuration", and that is by having both books on the desk. On the other hand if you wish to achieve a "messy room configuration", you can do so in two ways-- either have book 1 on the floor and book 2 on the desk, or have book 2 on the floor and book 1 on the desk.
The no. of ways in which you can achieve a configuration is called its weight and is defined as:
$$W = \frac{N!}{N_0!N_1!N_2!....}$$
In the first case, $W=1$ (clean) and in the second $W=2$ (messy)
The boltzmann formula for entropy is: $ S = k_b\ln W$
Plugging in $W$, we get $$S_\text{clean} = 0$$ and $$S_\text{messy} = k_b\ln2$$
Thus, the messier room has a higher entropy. This somewhat "silly" argument can be reproduced for a room with more furniture, and more items in it. Feel free to toss in some clothes, papers, chairs, book cases, toys, shoes, pets...go nuts.
So, I believe the analogy holds good. But again, what I did here is a silly exercise to illustrate a point, and it isn't meaningful as such.
If you wish to learn more, watch this lecture by Leonard Susskind
Answer: This is a tricky question. The answer is no.
From Wikipedia

In thermodynamics, entropy (usual symbol S) is a measure of the number of microscopic configurations Ω that correspond to a thermodynamic system in a state specified by certain macroscopic variables.

It can not be defined the messy and clean states thermodynamically. (Which would be the reasonable thermodynamic variables?) If it would be possible, after further assumptions, the problem is reduced to the @getafix answer. Well, it is also needed that all the book remains stacked in the desk (all of them with the same propertied but distinguishable).
It is more important to note that the non technical concept  of messy is not related to entropy.
EDIT:
I have decided to make it explicit (although at first I though it was) as the content of the answer was qualified as arbitrary and it was down-voted.
The OP said:

What I'm wondering is whether a messy room really does have higher entropy

The other questions turns to be meaning less if we can not assert that the messy room has higher entropy.

It is clear from the context ("When my chemistry teacher was explaining entropy...") that we are talking about entropy in thermodynamics.
It is also clear from the context that we are talking at an introductory level.
In order to compare the entropy of two systems, it is required that the states of both systems can be defined in terms of state variables.
The system state variables can not be established for messy nor clean rooms.
As the system states can not be specified, then it is not true that a messy room has higher entropy.

The usage of analogies is not just matter of taste. At first, there is a goal when an analogy is used while teaching a concept $X$, clearly it should be to help the students to learn $X$. In order to describe $X$, a well known $Y$ is used. $X$ and $Y$ must share a common set of properties. Aided by $Y$, some features of $X$ are inferred by inductive reasoning.
It is not evident which are the common features that links entropy with the level of cleanliness of a room, so a valid analogy can not be built. Of course there could be established some analogy when a lot of considerations are taking into account. But, if the student have reached a conceptual level to understand "why" they are made, then, the analogy will be of little use. If they did not, take for sure that they won't understand the concept (because they won't know when they can trust the analogy).

Does this still work on a larger scale? If not, can I trust the analogy?

I think I was no clear when I said "no". I really should have said "sometimes, entropy has nothing to do with cleanliness".
Comment: It's your wilful decision to drive the analogy to the point where it breaks. I don't like it very much either. But saying it is just wrong is, well, arbitrary.
Comment: @Karl , I expanded my answer in order to address the points of our comments. Thanks for sharing your thoughts. It help to improve the contents and clarity of the answers.
Answer: "whether a messy room really does have higher entropy".

One messy room left untouched does not have a higher entropy than a clean one.  Both represent one way of arranging the things in the room (a microstate), so the entropy is zero for both.
If you have a messy person living in the room then, yes, over time the messy room will have a high entropy.  Things will move around but never be in the same place (many microstates), so you will have many different arrangements of things that always will be characterised as "messy" (macrostate).
A collection of several messy rooms, e.g. identically furnished but unmade rooms in a hotel, has a higher entropy than the same collection of rooms after house keeping has been to them all and arranged the things in exactly the same way.
Comment: +1 You touched an interesting point where an analogy can be drawn, if the internal structure of macroscopic objects is not considered. I would like to read "ergodic" scattered somewhere in point 3, to turn the statement a little more accurate.


Reverse recovery current of a diode

Question: When the diode is in forward bias phase and suddenly we apply a reverse bias voltage, the diode takes time to be fully blocked because of the excess of minority charges that are stored in P and N region. Thus a reverse current appears in the diode for a short time before it is blocked. My question is, is this current a diffusion of the excess of minority carriers that are stocked? If yes, why does this happen physically speaking? How does the current suddenly become negative?
Comment: What do you mean "stocked"?
Answer: In transient conditions you also need to consider the displace current which flows in response to a time varying electric field. This will happen as you reverse the bias applied across the diode,
$$J = j_e + j_h + \epsilon_0 \frac{\partial\bf{E}}{\partial t}$$
where $j_e$ and $j_h$ are the currents due to flow of particles (the drift and diffusion of electrons (e) and holes (h)) and the third term is the displacement current.
Comment: Are you saying the temporary current is due to finite capacitance of the PN junction?
Comment: This additional transient term comes from application of Maxwell equations. I have not looked into it further, but i guess it causes a delayed current to flow and would seem to be a capacitance like term. I don't know how this is related to junction capacitance as we normally think about it.
Comment: It's not very clear. In ideal capacitor, you can have displacement current inside while zero real current there, so I do not think that presence of the first necessitates presence of the second. One way in which your answer could make sense is if the transient is due to charging up the PN capacitor to final reverse voltage.
Comment: A few years ago I was trying to do transient simulations of PN junctions. So I could not use conventional drift diffusion approaches. This equation came out of that research. I never got to the bottom of it. But from what I remember, to correctly solve in the time domain that term is needed.

Reverse recovery current of a diode


Non metal wire/rope/string tension

Question: Hi there,
Wonder if anyone has experimented with wire/rope vibration or tension that is non metal? Basically anything that doesn't sound like guitar strings but convey's tension or vibration?
Answer: stretching layered rubber can provide some interesting textures. i.e. latex gloves or balloons...just watch out if you stretch them too far. ;)
Answer: The ruler-off-the-edge-of-your-desk technique (which has a lot more hyphens in it than I'd expected), or just general wood tension, can be used to accent the tightest points of the tension.  Any sort of humming can represent a constant vibration, too.
And don't forget springs -- screen and garage doors and old car hoods generally have nice creaky ones.
EDIT

Guitar-string sound without using a guitar string -- or, better yet, without using a guitar:  various types of guitar strings (steel, nylon, gut, bass (if you can afford it), weed whacker wire, bare cable of various thicknesses, nylon rope, or anything else along this path. Anchor your new "string" to a resonant surface on one side (a C-clamp to a counter top) and clamped in a pair of vice grips on the other end, and adjust the tension manually as you record the vibration with contact mics.  You can get sweet bends, both up and down, this way.  Another option in the same vein is to build a tub-bass just for this purpose and change your string material for different sounds.
Plucked piano string
Plucked springs, like mentioned above, or hit with a reflex hammer / piano hammer.
At my local movie theater, there is a broken handrail -- the top part broke where it was fixed to the wall -- and I could hit it for a great vibration as well.  So, various lengths of metal pipe clamped to something solid.
Answer: I've had some success with rope tension using a green cabbage.  Just slice a cabbage in half and dig your fingers in to play around with it.  This technique should be handled with care though because it's very easy to "overwork' it.  Then in ProTools roll off the highs so it's not so bright.
Answer: I had some great success scraping a variety of sharp objects over a large sheet of plexiglass, and micing from underneath.
UPDATE:
Regarding vibration (rather than tension), I highly recommend you pick up a contact mic of some kind and start experimenting with metals, especially hollow canisters, tanks, pipes, struts, etc. You will find amazing vibrations and resonances which you simply cannot hear any other way.
Answer: leather gloves and a medium width tree branch with loose bark.  maybe wrap some rope around it for leverage and twist away.
Answer: To build on Shaun's excellent advice, rubber bands are a common and not that unusual alternative to steel strings or metal wires. Rubber Therabands, used in physical therapy, are also strummable, pluckable...not sure about playability with a bow. Anything rubber can have its pitch changed by varying its tension, i.e., the distance between what's holding each end in place.
Classical guitar strings are nylon, not steel, so stringing one/some between some wooden posts or other objects might yield interesting results, or across resonant bodies.
I've had little to no positive results using fibrous strings and twines. Very little signal from very low tension prior to breaking.
Answer: Try twisting a hemp rope or squeezing a leather jacket
Answer: Thanks for the responses everybody! I guess I'm not looking for creaking so much as vibration. Like the strum of a guitar string but not musical?
Comment: I'll edit my response for more ideas along this route. :)
Answer: If you happen to have a Rubik's cube lying around - try twisting a layer around slowly. The springs inside give a nice tension sound. Slow it down and it can sound quite like rope under a lot of strain.

Non metal wire/rope/string tension


Convergence of probability measures in total variation and limits of integrals

Question: Suppose $\mu_n$ and $\mu$ are probability measures such that $\mu_n \to \mu$ in total variation. I'm curious to what extent we can say $$\int f \ \mathrm{d}\mu_n \to \int f \ \mathrm{d}\mu,$$ when $\mu_n \to \mu$ in total variation - recall that this means $$\lim_{n \to \infty} \sup_{A \in \mathcal F}|\mu_n (A) - \mu(A)| \to 0,$$ where $\mathcal F$ is the underlying $\sigma$-algebra and $f$ of course is a Borel function. I've looked around a bit (admittedly not too hard - I thumbed through the TOC and index of Billingsley's "Convergence of Probability Measures" and looked at the Wikipedia page) and it seems to me I ought to be able to say that this should happen under very mild requirements. Under weak convergence of probability measures, of course, $\int f \ \mathrm{d}\mu_n \to \int f \ \mathrm{d}\mu$ holds for all bounded, continuous functions, which competely characterizes this mode of convergence. Surely I can get away with more with total variation convergence - what I hope "getting away with more" entails is that I can widen the class of $f$ such that this happens. For example, since $\mu_n (A) \to \mu(A)$ for all $A$ rather than just those $A$ with boundary probability $0$ I would hope we could loosen the continuity assumption on $f$.
Comment: unbounded? discontinuous? both?
Comment: @johnmangual mainly I care about removing continuity (boundedness is fine), but I'm asking for the most general conditions available.
Answer: If $f$ is a bounded, measurable real function, and $\mu_n\to\mu$ in total variation, then $\int f \, d\mu_n\to \int f\, d\mu$.  The reason is just that $f$ can be uniformly approximated by simple functions.
If $f$ is not bounded  $\int f\, d\mu_n$ need not converge to $\int f\, d\mu$.  For a counterexample, look at measures on the real line, let $\mu_n$ give $\{n\}$ probability $\frac1n$ and $\{0\}$ probability $1-\frac1n$, let $\mu$ give $\{0\}$ probability $1$, and let $f$ be the identity.  Then $\mu_n\to\mu$ in total variation but, for all $n$, $\int f\, d\mu_n=1\ne \int f \,d\mu=0$.


Determining the dimensions of a cylindrical can

Question: A cylindrical can (with lid) is required to have a volume of 8000 cm3
. Using calculus,
determine the dimensions that minimize the surface area (and hence cost) of the can. Is
the can more costly to construct than a closed cubic container of the same volume and made
of the same material? Justify your answer.
Answer: For a cylinder, $V=\pi r^2h = 8000$
Surface Area $SA = 2 \pi r^2 + 2 \pi r h$
Using the volume formula, solve for h: $$h=\frac{8000}{\pi r^2}$$
Substitute h into the surface area formula, getting $$SA=2\pi r^2 + \frac{16000\pi r}{\pi r^2}$$
Simplify to get $$SA=2\pi r^2 + \frac{16000}{r}$$
Take the derivative and set it equal to zero to find extrema:
$$SA' = 4\pi r - \frac{16000}{r^2} = 0$$
Solve for r to find the radius of the cylinder with the least SA (approximately 10.839). Use this to find the SA.
I leave the rest as an exercise for you.


Was Otniel ben Kenaz a half-brother or a nephew to Kalev?

Question: Otniel ben Kenaz, who was the first Judge of the Jewish People, married Kalev's daughter. I read in one place that he was a half brother to Kalev, and somewhere else it says he was a nephew to Kalev. Which one is right?
Answer: tl;dr: The relevant verses are ambiguous; they could be describing Otniel as Kalev's younger brother or as his nephew. However, classical Jewish commentators write that Otniel was Kalev's brother.

Otniel ben Kenaz is mentioned in Yehoshua 15:17, Shofetim 1:13 and Shofetim 3:9. Each time he is introduced as:

עָתְנִיאֵל בֶּן־קְנַז אֲחִי כָלֵב
Otniel, son of Kenaz, brother of Kalev,

or as

עָתְנִיאֵל בֶּן־קְנַז אֲחִי כָלֵב הַקָּטֹן מִמֶּנּוּ
Otniel, son of Kenaz, younger brother of Kalev.

Now, this is ambiguous. Is Otniel the younger brother of Kalev, or is it Kenaz who is Kalev's brother (which would mean that Otniel was Kalev's nephew)?
One would be tempted to understand that Kenaz is the brother of Kalev, because otherwise we are left with a question: If Kalev and Otniel are brothers, then what was their father's name, Yephuneh or Kenaz?
However, the classical Jewish commentators (unanimously as far as I can tell) do understand that Kalev and Otniel were brothers.
Rashi to Yehoshua 15:17 (following Chazal) solves the question of Yephuneh vs Kenaz by suggesting that Kalev and Otniel were half-brothers, sharing a mother.
Radak there writes that Kalev and Otniel were full brothers. He suggests that Yephuneh and Kenaz were the same man, with two names. Alternatively, he offers the interpretation (which he prefers) that Kalev and Otniel's father was named Yephuneh, and that Kenaz was a distant ancestor whose name was adopted by his descendants.
Why don't any commentators offer the seemingly more simple solution that Kenaz was Kalev's brother, rather than Otniel?
I believe that this is because Kalev himself is referred to as a Kenizzite (הקנזי) (e.g. in Bamidbar 32:12).
If Kenaz was Kalev's younger brother, this would be a strange way to refer to him. However, if Kenaz was Kalev's step-father, another name for Kalev's father Yephuneh, or the name of one of Kalev's distinguished ancestors, it make a lot more sense.
Comment: The gemara says that Yephunneh was another name for Kalev.
Comment: @Harel13 You mean that Kalev is described as 'ben yephuneh' but that his father's actual name was Chetzron? OK. I don't think that that really affects this answer, though...
Answer: There's not much more to add to @JoelK's very comprehensive answer.
But it is worth noting that there is a Gemarah in Sotah 11b which also sheds light on his family lineage.
The Gemarah there reads:

(דברי הימים א ב, יח) וכלב בן חצרון הוליד את עזובה אשה ואת יריעות ואלה בניה ישר ושובב וארדון בן חצרון (במדבר יג, ו) בן יפנה הוא בן שפנה מעצת מרגלים
The Gemara discusses the family of Caleb: In Chronicles it says: "And Caleb, the son of Hezron, begot children of Azubah his wife, and of Jerioth, and these were her sons: Jesher, and Shobab, and Ardon" (I Chronicles 2:18). The Gemara asks: Was Caleb actually the son of Hezron? Wasn't he the son of Jephunneh, as the verse states in Numbers 13:6? The Gemara answers: He was the son of Hezron, but he is called "son of Jephunneh" as an appellation indicating that he was a son who turned away [sheppana] from the counsel of the spies.
ואכתי בן קנז הוא דכתיב (שופטים א, יג) וילכדה עתניאל בן קנז אחי כלב אמר רבא חורגו דקנז הוה
The Gemara asks: But it is still difficult. Hezron could not be his father, as Caleb was the son of Kenaz, as it is written: "And Othniel, the son of Kenaz, Caleb's younger brother, took it" (Judges 1:13). This would mean that Caleb was also a son of Kenaz. Rava said: Caleb was the stepson of Kenaz, as he and Othniel shared a mother but had different fathers.

(Translation and additional notation from Sefaria)
Comment: JoelK referenced this gemara already in his line "Rashi to Yehoshua 15:17 (following Chazal) solves the question of Yephuneh vs Kenaz by suggesting that they were half-brothers, sharing a mother."
Comment: Ah okay didn't notice it. Should I delete the answer?
Comment: That's up to you.
Answer: Osniel ben Kenaz was Calev's younger brother. In a sefer called Journey through nach, and in shoftim perek 3 it has Osniel ben Kenaz who was the shofet, and in the footnote it says Calev's younger brother


Objective-C iPhone - Open Multiple URLs in Safari

Question:
I know how to open an URL from app in Safari using [[UIApplication sharedApplication] openURL:url];. This is great, but what I need to do is that I have multiple URLs and I want to start Safari with more tabs opened with those URLs.
I tried calling openURL multiple times but it just opens Safari once and other urls are ignored.
Is there any way of opening multiple tabs in Safari from my app?
Thanks.
Answer: When you call UIApplication openURL:, your application will be put in the background and will no longer be allowed to perform these operations. I do not think that opening multiple tabs is something that iOS Safari supports. Tabs are probably implemented in a more memory-efficient way (i.e. loading only the tab you see, saving a picture of the others until you switch to them). It would help knowing why you want to open multiple tabs.
Some suggestions:

Open a link to a "launcher" page, which takes you to the page you want
Use UIWebView and implement the tabs yourself
Create a menu of some sorts in your app, opening only one page at once
Comment: In this case I would probably have gone with the UIWebView method myself. This gives you more control over the user experience, and you can provide a way for the user to open a specific page in Safari if you need to.
Comment: I'm making some kind of flight ticket reservation app and the app gives me multiple links to reserve those ticket and I'd like to open them all
Comment: Thanks, I'll probably add a button for each flight separately and will let user call them one by one.


How can I save a score for a web game made in Unity and load it when the game starts again?

Question: In other words, how can I load the progress for a game? I only want to store a score and load it again when the game starts (ex. if I get the 100 score and close the game, when I come back, I want to continue my progress from the 100 score)
Answer: You're looking for PlayerPrefs.  Take a gander at the documentation.
Comment: The usual caution here is that PlayerPrefs is trivial for users to edit, so make sure you don't trust the data found in this file for things like public leaderboards or awarding trophies / DLC / other entitlements. If your case is pure single-player it may not be important, but it can be demoralizing for players who worked hard for those perks to see peers get them through simple hacking. (It's arguably impossible to *completely* secure a web game, but you do have choices for how many speed bumps you want to put in a hacker's way)
Comment: Thanks for that @DMGregory . Yes `PlayerPrefs` is for anything you don't care if the player goes and changes it however they please.  Local highscore display? Psh, if they want to hack that no one cares.  For more complex save stuff, you still have to assume that the player will find a way to rewrite the file.


Freelance visa in the UK

Question: I am an Indian citizen, currently doing a master's in Italy. I have 10 years experience in videography and video editing. I am looking for a freelance visa in the UK. May I know more details about the freelance visa and how to apply for this?
Answer: You would need to apply for a Tier 1 (Entrepreneur) visa but for that

You must have access to at least £50,000 investment funds to apply.

Closely related to: Can I get a UK visa as self employed?

Freelance visa in the UK


Converting frame size to wheel size

Question: I've been trying to determine what size road or mountain bike I should purchase. All the charts I've found suggest what frame size I should have, but online shopping only lists wheel sizes. How do I determine what wheel size is best for my height?
Comment: What web sites are you looking at that only include wheel size?
Comment: Frame size is normally independent of wheel size for mid-size adults. Kids bikes use smaller wheels, but bikes for very tall people rarely use larger wheels. You can buy mountain bikes with wheels from ISO406 to ISO787, for example (although the common size is ISO559/26")
Comment: @jqning Amazon mostly
Answer: Generally, there are a few wheel sizes for adults on the market now:

700c: This is the standard adult road bike wheel size. For mountain bikes, this is often sold as 29" and is also the standard (where they're said to roll over bumps easier than a 26" but at the cost of manuverability and weight). The rim diameter is 622 milimeters.
650b: This is becoming more popular with shorter riders for road and mountain biking (where its often sold as 27.5", as a compromise between 26" and 29"). It is smaller than 700c with a rim diameter of 584 millimeters.

Less commonly, you'll find:

26": This was the old standard size for mountain bikes. The rim diameter is 559 mm.

All these wheel sizes are available for a wide range of frame sizes (usually reported as some number of inches or centimeters, e.g. 58cm for a road bike or 23" for a mountain bike, or small/medium/large/etc.). My guess is that you're reading the frame size and thinking it is the wheel size.
Note that frame sizes are not standardized between bike models or even related models (e.g. a bike that is sold in both a 26" and 700c wheel version), so you need to try the bikes to see if they fit you well, and/or compare their geometries (e.g. standover height, top tube length, etc.).
Useful links on tire sizing: Rivendell
Useful links on bike sizing: Sheldon Brown
Comment: Yeah. I would generally advise against online shopping for people who don't know what kind of bike they want specifically. Theres enough variation for bikes marked as the same frame size (e.g. 58cm's) that unless you know the specific class of bike well and what measurements you need, you're probably not going to get a well fitting bike (especially if you're tall/short/have odd proportions like long legs).
Comment: Go to your local bike shop and try some bikes (and/or have a bike fit) and buy there. If you're not used to bicycle repair, you'll likely want to have them fix it up for you after assembly if you buy online anyway (and this will kill a good bit of the price difference between a quality bike bought online and in the shop, especially if its a name brand bike). Plus, they'll likely give you a discount on accessories like a good helmet, locks, lights, etc.
Comment: Would you advise against online shopping if all that's listed is the wheel size? It sounds like the frame size is much more relevant in determining whether the bike is a comfortable fit or not.

Converting frame size to wheel size


Using QGIS layers in ArcGIS SDK for Android

Question: So I use QGIS for work and I am trying to create app for field work. I'm looking into ArcGIS SDK for android, but it looks like you will need to import your layer into ArcGIS server. Is there any NON-ArcGIS service I can use to import my layer onto my app, still using the sdk.
Answer: You can use GeoServer, which is opensource. Here is an example of connecting the android ArcGIS to to a GeoServer WMS


Windows 10 and starting a program as administrator

Question: How to run program as administrator and how to run it normally in Windows 10 by simple clicking when you are logged as administrator? (this is my first question, so feel free to correct it)
Comment: If you don't have administrator rights you cannot start an application with administrator rights.  Your answer requires you authenticate an Administrator user....
Comment: use Task Scheduler to workaround the UAC: http://www.msfn.org/board/index.php?showtopic=135472
Answer: We can run as administrator simply by right clicking on the shortcut and clicking "Run as administrator".
Another possibility is to change properties of the shortcut so that right clicking is not necessary. The steps to do this are as follows:

Right click on the program (shortcut)
Click on Properties
Navigate to the Shortcut tab and find "Choose enhanced properties of this shortcut"
Click on Advanced...
Check Run as administrator
Click OK twice
(Optional) Rename the shortcut to know it runs under administrator rights

Previous method can make two independent shortcuts.
Another option:
Note that following method changes rights to the whole program, so you cannot have two independent shortcuts for a single program. If you just want to run program as administrator by right clicking, that is also valid option. The below changes rights to all shortcuts of the program.

Right click on the program (shortcut)
Click on Properties
Navigate to the Compatibility tab
Check Run this program as administrator
Click OK


How do I safely populate an array from one thread while reading it in another in Objective-C?

Question: First off I'm not that familiar with using threads and i'm learning on the fly.
I have an array that is being used in thread a and being populated in thread b. What I want to do is find the best practice for waiting for the array to be populated from thread b before using it in thread a.
Answer: You can either copy the array in the reading thread so that it does not change while you read it, or you can <code>@synchronize</code> the access to the array:
<code>- (void) writer
{
    @synchronized(theArray)
    {
        [theArray addObject:foo];
    }
}

- (void) reader
{
    @synchronized(theArray)
    {
        for (id item in theArray)
            [item …];
    }
}
</code>
Comment: ...but before you do this, read the apple docs on thread locking. They outline some very subtle defects you can generate.
Answer: I haven't used Objective C but what you're looking for is a Condition Lock. This is a type of lock (mutex) that prevents threads from accessing locked data but keeps a queue of all the threads that asked for permission (often using a semaphore). When the data becomes unlocked, the Condition Lock automatically wakes up the requesting threads.
In your case, the array will be locked by thread B while its being populated. When thread A tries to access the array, it will yield because thread B currently holds the lock. When thread B is finished, it will see that thread A tried to access the array while it was locked and wake up thread A. Thread A can then safely access the array.
Here's the first result after a google search for Condition Locks in Objective C. It's about the iPhone API, but might be useful nonetheless:
http://developer.apple.com/documentation/Cocoa/Conceptual/Multithreading/ThreadSafety/ThreadSafety.html#//apple_ref/doc/uid/10000057i-CH8-SW4
Answer: The answer depends somewhat on what you are doing with the array contents.
To some degree, the question does not make a lot of sense - if thread a has to wait until the entire array is populated in thread b, then why not just do the populating work in thread a?  What else is it doing while waiting for the array?
Alternatively, if thread a can make forward progress as it receives each element of the array, then it may make more sense to pass each received array entry from thread b to thread a as they are created.  In that case you effectively have a queue, which is a common producer/consumer pattern for threaded work - thread b fills up a queue which thread a reads from.
See the "Using an NSConditionLock Object" section of the link Kai posted for an example producer/consumer lock.


Stuck on a problem about the length of a partial sum

Question: I have a bit of a problem with this task since I couldn't really find any information in my books or so and I couldn't really find any similar to this problem on the internet so I hope someone  doesn't mind giving me a hand.
$$\sum_{k=1}^n  \frac{(-1)^{k-1}}{k}$$ (where n goes to infinity) the problem is to find the length of the partial sum so that we get ${\log_{e}{2}}$ with exact value up to $10^{-2}$ .
Comment: If I understand correctly, the question you should answer is "How large must $n$ be for the difference between the partial sum and the limit (which actually is $\log 2 = \ln 2$, and not $\log_{10} 2$) to be less than $10^{-2}$ in absolute value?"
Comment: I think that should be it,yes,I messed it up a bit.
Answer: The alternating series theorem gives you a bound.  For a series where the signs alternate and the terms decrease in magnitude the error is always of the sign of the first neglected term and smaller in magnitude.  This guarantees that you will be within $10^{-2}$ after $100$ terms.
I don't know any way to find the minimum number of terms except by trying it.  I made a spreadsheet and the error drops below $0.01$ at term $50$.  For this series the terms are very slowly decreasing in absolute value.
I don't find it surprising that $\ln 2$ is very close to the average of two successive partial sums.  That would suggest you want $\frac 12\cdot \frac 1n=0.01$, which gives $n=50$.  This suggests we define $A(n)=\sum_{k=1}^n  \frac{(-1)^{k-1}}{k}$ and take as our approximation $\frac 12(A(n)+A(n+1))$.  That is within $0.01$ of $\ln 2$ at $n=4$ and converges much more quickly.
Comment: I see.So it would be pretty difficult to calculate the minimum index and the best way to go is to check where the error rate drops to a minimum?
Comment: The error does not drop to a minimum.  It just gets smaller and smaller.  I just made a table and looked where it dropped below $0.01$.
Comment: Ok got it.Thank you for the answer :)


HTC One M8 Charging Issues

Question: I just wanted to check if my HTC One M8 is working fine, I just got it and it's brand new but the battery runs out in 4 hours of non stop use and mobile data usage and when I charge it, it charges at about 1% every 5-10 minutes, is this normal? And if not how do I fix it?
Answer: The charging issue may be caused thanks to some app which is running on background and a lot burdens CPU.
<code>Try to kill all apps before/while charging to decrease CPU consumption
</code>
That 4 hours of nonstop usage are normal I think. If you were playing games or something like that you should be happy for 4 hours. :) So answer is: Yes, It's normal.
Look at this guide
Comment: How do I kill the apps before charging?
Comment: In multitask menu you can swipe to right or left to kill app. I do not own M8 so I don't know.

You can also use task manager
Comment: @PuppetCode you can also go into the app manager and individually disable apps you don't ever want to run. This will stop them from running again in the background when you restart your phone or when they just decide to run

HTC One M8 Charging Issues


What is the type of nut and tool to be used to unscrew?

Question:

Please see the two images. I marked a nut and locking part. what type of nut and lock mechanism it is? and what is the tool I have to use to open it?
Answer: You need to hold the shaft (in a vise with protective jaws) and turn that nut with a "C" spanner - which looks like a C with a single protruding tooth.

A poor method is to use a drift or punch, but this always damages the nut - perhaps fine for a temporary repair...
Edit as Fred says that is a circlip, actually in internal circlip which means that the nut above needs to be removed first then that circlip will come out.
Comment: Thanks. What is that other part that I marked in the second image? what the name of that nut?
Comment: Called C nuts... as for the other pic - need more detail - may just be the face edge of a clamping nut for the bearing...
Comment: The second photo shows a circlip, the size of which I've never seen before, but is clearly that type of retainer.
Comment: Sometimes also called a collet wrench and collet nut, due to one of their more common uses.


Is there any way to retrieve "Messages" in SQL Server through JDBC?

Question: By "Messages" I mean the Messages tab in the following figure, which includes "Warning", "n rows affected" and in the figure below, the execution time. In JDBC, ResultSet class is used to retrieve the "Results". Is there any way to get all the information in the "Message" tab through JDBC?
Answer: You can get most of those messages, but unfortunately not all. See my question on Stackoverflow regarding that.
In general those messages (e.g. messages from a PRINT statement) are returned as warnings on the Statement object by the JDBC driver. To retrieve them use Statement.getWarnings() in a loop:
Statement stmt = ...;
stmt.execute("some_procedure");

SQLWarning warning = stmt.getWarnings();

while (warning != null)
{
   System.out.println(warning.getMessage());
   warning = warning.getNextWarning();
}

I have seen some messages also being returned on the Connection instance rather than the Statement. If you don't see anything, try the above code with your Connection instance.
Comment: Thanks for your reply. I've tried but it seems only the print stmt returns a msg. I'd like to show the execution time by executing "set statistics time on" but I didn't see anything, either by stmt or Connection instance. I was wondering if you've ever seen message returned by other statements other than PRINT statement?
Answer: I was looking for a way to do this (except the execution times) and I have managed to achieve this using the version 7.4.1 of their JDBC driver.
do {
    resultSet = statement.getResultSet();
    updateCount = statement.getUpdateCount();
    printWarnings(statement.getWarnings());
    statement.clearWarnings();
    if (resultSet != null) {
        printResults(resultSet);
    }
    if (updateCount != -1) {
        printError(updateCount + " row(s) affected/returned");
    }
}
while (statement.getMoreResults() || updateCount != -1);
printWarnings(statement.getWarnings());

Where printWarnings handles the warning chain. It works for the cases I have tested. You can get the execution time by sending SET STATISTICS TIME ON before the given query, then it will come in the form of an SQLWarning. Generally you want to disable it after using SET STATISTICS TIME OFF.


Could people of the 14th century create an inline engine for use in aircraft and vehicles?

Question: If an expert of some kind travels back in time to the 14th or 15th century with modern tools and machines that don't require power to work and if he were to past on the knowledge of modern technology to a group of experts from that timeline, could they build an inline engine for use in vehicles and aircrafts? Also, with the knowledge they obtained and the tools and machinery, could they build a helicopter instead if the plane doesn't work?
Comment: "An" expert? One? There is no one person in the world today who knows how to make the steel, *and* how to extract the petroleum, *and* how to make the fuel, *and* how to design the engine, *and* how to make the engine out of metal...
Comment: Please state what tools you are taking back. Are there *any* modern tools that don't require power? You're not going to make an engine with a hammer and chisel.
Comment: Why an inline engine rather than a wankel?
Comment: Time to read _[The Flying Sorcerers](https://en.wikipedia.org/wiki/The_Flying_Sorcerers)_ again ....
Comment: Somehow related,
https://worldbuilding.stackexchange.com/questions/100995/how-much-of-a-modern-day-tank-can-the-14th-century-replicate
Comment: I know its a tank but... the parts of the tank and the chopper is somehow related, their mechanisms too, will be a bit complex for the 14th century to comprehend.
Comment: Hi @EricClifford - Out of curiosity, is what you really care about the engine itself, or the things you could use that engine in? Reason I'm asking is because I posted an answer about how to build a plane without needing an engine, but it got deleted for being off topic. If it will help you with you story, ask another question specifically about that, and I'll reply to it instead.
Comment: @Richard, with some more meat added, your comment could be an answer.
Answer: There are too many missing technologies
There are several technologies critical to an inline engine that would not have been easily replicated in the 14th century of thereabouts

High quality metal. The block (and cylinders and cylinder heads and bolts, etc) are under high temperature and pressure stress during operation. Metals at the time might not have been able to handle the stress; at least, given the uneven quality of production, not all engines would work. You'd need to wait at least until the development of mass produced iron cannons in the 17th century, possibly until the steel-making changes of the First Industrial Revolution around 1800.
Fuel. The technology to refine crude oil into a useful gasoline by product didn't really exist. Neither does a suitable lubrication oil You would have to get an entire petrochemical industry off the ground by yourself.
You can't make the parts. The crankshaft (along with a cam) is necessary to control the timing of the pistons. That wasn't used widespread in Europe until the 15thc century. Valves and valve springs haven't been invented either. Pistons for compression weren't invented until 1838. Neither have the machine tools to make such finely tuned internal parts. Topping this all off, there does not exist a standard set of measurements which you could use to have craftsmen build parts of standardized sizes.
You need a spark plug. Which means you need to develop the technologies for integrating ceramic and metal into what is basically a capacitor. Also, you need a battery or at least an alternator to run the spark plug. Alternately, you can use compression ignition, but that just makes your metals problems in bullet point 1 that much worse.

You basically need...like....an Industrial Revolution to build an internal combustion engine. So, you can do it in the 14th century, as long as you have a ~1900 industrial base....but then you aren't really in the 14th century any more.
Comment: James Watt reportedly had great difficulty creating a larger piston that did not leak gasses, and many attempts had gaps more than 3/8". John Smeaton, the "father of civil engineering," said in 1769 that "neither the tools nor the workmen existed that could manufacture so complex a machine with sufficient precision." It was only in 1774 that John Wilkinson invented a boring machine which would make manufacturing the steam engine possible. "We hardly realize the crudity of tools available in the eighteenth century…" from *English and American Tool Builders,* by Joseph Wickham Roe, p. 3.
Comment: I read somewhere a blog of a guy who bootstrapped a mechanical workshop in his backyard from a furnace, melting metal, and so on with more and more refined machinery until he had a lathe and milling machine which he used to create a higher precision lathe and milling machine.
Comment: Cams were known since the Hellenistic period. Gasoline and spark plugs are not needed for Diesel engines; a crude form of  kerosene was available in the Middle Ages (in the right places, mostly Arabic-speaking). But you are right that steel is a killer; and the biggest problem is that in the Middle Ages they didn't even a means of communicating the dimensions of the pieces with anything resembling the required accuracy.
Comment: You don't need a spark plug. You do need a spark plug for an engine running on gasoline, but if you can refine oil into gasoline, then I don't think it'd be particularly hard to refine oil into diesel instead. Of course, diesel engines operate at much higher compression, so you're just shifting the problem elsewhere... but still, you can do without the spark plug :)
Comment: ...and roads for the vehicles, and telegraphy so weather observers can file reports  for safe flying, and banking because all those far-flung infrastructure and chemical and mechanical employees won't work for free.
Comment: @DietrichEpp Great find, that pretty much answers the question right there. If Great Inventors (TM) couldn't bore the correct hole in the 1760s, what chance did the medievals have?
Comment: I disagree with this answer. If you have a 21st century engineer who has as much time as he needs to plan and experiment before travelling back to the 14th century, as the question states, "with modern tools and machines", none of the issues mentioned should be even difficult to overcome.
Answer: Yes... and No
Could you import enough educated people via time travel into the 14th century to build an inline engine? Of course.  The metal existed then. The oil and rubber existed then. In other words, there's nothing about the planet, itself, in the 14th century that wasn't also true in the 19th and 20th centuries. So, yes, if you bring enough expertise with you, you can do it.
But what would be the point?
Technology (aka, knowledge) is a pyramid of knowledge and experience, innovation and insight, and at every moment the pinnacle of that pyramid is based on the accumulation of everything beneath it. The amount of knowledge and experience that pinnacle represents is staggering.
The smaller the group of people you can import into the 14th century, the more likely the answer is "no." The dependencies involved with technology are deep and unforgiving. Henry Ford (et al) had access to trains, "modern" mining, factories and cities full of people who were competent to work in those factories, universities (the educational pyramid alone is massive), chemical plants, tool manufacturers, etc., etc....
So, unless you can import each and every person you need (potentially thousands), no, you can't build an inline motor in the 14th century.
Besides, if if you import everyone you need, you wouldn't have the medieval period anymore. It would instantly (within 5 years) be changed to the industrial age. If history has proven anything, it's that keeping knowledge a secret is basically impossible.
P.S., if what you're trying to do is reinvent Twain's A Connecticut Yankee in King Aurther's Court, you should be aware that as you add detail, the story will become less believable. The story is only plausible when you force the tech to exist within the context of the culture, which means you can't have your engine and a believable story. I could be wrong guessing about your motivations, though.

Edit: A response to a comment made by @Graham brought this succinct point:  Assuming you have no limitations to your time travel, you can always import enough people in the right order to guarantee construction of the engine — but that makes the timeline and the culture associated with the timeline irrelevant.  The more relevant the timeline, the less possible that engine becomes (likely at an exponentially decreasing rate).
Comment: @Graham, hence the "no" half of my answer.  If you imported about 250,000 specialists, each in turn, over a multi-year period, you could build the engine (just the effort of developing 1910-level milling would be a pain) - but that's an action that's 100% disconnected from the culture of the time, making the assertion of the timeline irrelevant.  The more relevant the timeline or culture of the timeline, the less possible this becomes.  I like how that came out.  I'm going to add it to my answer.  Cheers!
Comment: You're still too optimistic though. :) The elemental metal existed, and the oil was still in the ground, sure. The technology to make decent steel did not exist though, and nor did the fractional-distillation techniques required for refining crude oil, and nor did the technology to extract crude oil. Even importing the people, you would need the entire supply chain, from miners and oil workers onwards.. Nothingthis is remotely possible.
Comment: Nice extra point - I like it
Answer: I think a hot-bulb two-stroke engine might just be possible. It has no valves, so no need for springs. Instead, it uses the reciprocation of the piston, quote Wikipedia "by the piston covering and uncovering ports in the cylinder wall". Since you still need somewhat high precision, you probably need to produce a working mechanical workshop. Set up shop by a river where you can use flowing water to power your lathe, which you will build from scratch and use to build a better lathe, which you will use to produce your engine.
Since you do not have access to much steel, if any, you need to work with cast iron. So this engine will be heavy and not suitable for airplanes, but for carriages, boats or a (possibly portable) power plant it would be fine.
Since hot-bulb engines run on crude oil, you don't need a petrochemical industry. Hot-bulb engines were usually started with lighter oils or gasoline/petrol, but you could likely distill smaller amounts of "starter fluid" from crude oil or maybe use ethanol. Or just heat the bulb with an external fire until the bulb is hot enough. Once the engine is hot, you can pour in olive oil, bees wax, crude oil, whatever flows and burns, tar oil. These engines are not picky, if it flows and burns it will run on it.
A hot-bulb engine also avoids spark plugs while avoiding the high compression ratio of the Diesel engine, avoiding the need for the high tolerance necessary for Diesel engines.
Regarding measuring, just produce your own reference measuring bits. They don't have to conform to anything in particular, the important thing is that they are internally consistent and that you store your reference bits safely, and only work with copies made from those. Choose metric, imperial, or invent your own system. :)
Since using bolts is another technology which is actually very advanced, use riveting whenever at all possible.
Edit:
In fact, you may want to bootstrap your engine factory by first producing engines for stationary power plants, so you can build more robust, lower precision engines first. Now, mills and pumps for wells etc can be powered by your invention where there was no power source before.
These engines also run on wood gas, and wood you should be able to find without a petrochemical industry. :-)
Answer: Valveless pulsejet is definitely fit for aircraft and you could call it internal combustion one(fuel combusts inside after all).
You do not need high quality metal - ordinary construction steel was used for those and I am pretty sure bronze would work too.
Any plant oil would go as fuel - it was even fed coal dust!
Basically no precision is required - enthusiast just cut steel by hand when make one.
No need for spark plug - fire from previous cycle ignites fuel.
No need for fuel pump - you can use valve to pressurize fuel tank with exhaust from engine.
Comment: @Prof.Falken // How would the valve work?

Peak overpressure during engine work is about 1 atm. There is small valve that lets air in tank when pressure is high. So you would get 1 atm overpressure in tank - that's all. If you need something lower - you put safety valve that lets air out is pressure is above set limit. Now that tank is pressurized you do not need pump - you just let fuel out.
Comment: @Prof.Falken
// uses some like 20 times more fuel than a piston engine

Yes, efficiency is very low. You can get specific impulse about 700 ( https://aardvark.co.nz/pjet/mylockwood.shtml ) so, say we have a 1 ton plane with 250 kg of fuel and lift-to-drag ratio 10.

Then if it flies 180-360 km/h(the faster it is - the more efficient it is) it can fly about 90-180 km. Piston engine would easily beat 1000 km.
Comment: If the fuel pressure valve is simple enough, I'm sold on this idea. How would the valve work?
Comment: Also I read here https://aardvark.co.nz/pjet/jet_efficiency1.shtml that a pulsejet uses some like 20 times more fuel than a piston engine. Could still be worth it for aircraft I guess, if the bronze could be make thin and strong enough.
Answer: They could if you teach them how to make materials and all needed tools and parts of said engines and vehicles. And have funds and influence to  get it going.
But that would take years to get there.
Tools that do not need energy??? Maybe they have internal power supply? Tools that use your muscles for energy source?
Comment: The only internal power supply tools in 14th century were livestock...
Comment: It is about time-travaler's tools :)


What is the standard dictionary for linguistic teminology (English)?

Question: I know the linguistic dictionaries that are used in my language, but I'm looking for a specific term and I need an English one. Any tips?
Answer: Perhaps the most widely known is David Crystal's A Dictionary of Linguistics and Phonetics (1st ed. 1980, 6th ed. 2008, Wiley). There is also The Cambridge Dictionary of Linguistics, edited by Keith Brown and Jim Miller (2013, CUP).
For phonetics and phonology in particular, I've also found R. L. Trask's A Dictionary of Phonetics and Phonology (1996, Routledge) useful, though unfortunately the author is deceased and some of it is out of date.


Can I view a package as a regular notebook?

Question: How can I open a package as a normal notebook, i.e. without the toolbars and formatting of the built-in .m file interface.
Answer: Upon opening you can change the stylesheet and remove the docked cell:
SetOptions[EvaluationNotebook[], DockedCells -> {},StyleDefinitions -> "Default.nb"]

Then if you want to change the "Code" styles to something else, possibly "Input", do this:
NotebookFind[EvaluationNotebook[], "Code", All, CellStyle]
FrontEndExecute[FrontEndToken["StyleOther"]]

Comment: It doesn't seem to save, is there a way around running this command manually every time I open the notebook?
Comment: Well perhaps that is a separate question - how to run a bit of code every time a notebook opens... what do you think?
Answer: Here is one way. Using the parseString function from this answer of Mr.Wizard, the following will create a notebook with an entire package's code being placed in a single Code - style cell:
parseString[s_String, prep : (True | False) : True] :=
   FrontEndExecute[UndocumentedTestFEParserPacket[s, prep]]

ClearAll[openPackage];
openPackage[file_String?FileExistsQ] :=
  With[{stringCode = Import[file, "String"]},
     CreateDocument[
        Cell[First@parseString[stringCode, False], "Code"]
     ] /; stringCode =!= $Failed
  ]

For example:
openPackage@FileNameJoin[{FileNameDrop[FindFile["Combinatorica`"], -2], "Combinatorica.m"}]

You can split the code into multiple cells, but that would require a bit more work.