Here it goes a tricky one (maybe not for experts). I'm learning about concurrency in C# and I'm playing around with some dummy code to test the fundamentals of threads. Im surprised about how is possible that the following code prints the value 10 sometimes. Thread[] pool = new Thread[10];  for(int i = 0; i < 10; i++) {    pool[i] = new Thread(() => Console.Write(i));    pool[i].Start(); }  Typical output is like 76881079777. I know is the value 10 and not 1 and 0 because the for loop body executes 10 times (not strictly sure, but I couldn't break C#). I'm even more surprised why this does not throw an IndexOutOfRange exception in the statement pool[i] = new Thread(() => Console.Write(i)); As long as I know, the for loop executes like following:  Check the condition ( i < 10) Executes the body if condition is true Increments the control variable (i++) Repeat  So, assuming that, is imposible for me to understand how the body can be executed with the value 10. Any ideas?

I met an interesting issue about C#. I have code like below.  List<Func<int>> actions = new List<Func<int>>();  int variable = 0; while (variable < 5) {     actions.Add(() => variable * 2);     ++ variable; }  foreach (var act in actions) {     Console.WriteLine(act.Invoke()); }   I expect it to output 0, 2, 4, 6, 8. However, it actually outputs five 10s.  It seems that it is due to all actions referring to one captured variable. As a result, when they get invoked, they all have same output.  Is there a way to work round this limit to have each action instance have its own captured variable?


I have a "huge" spatial database: 72GB, 200 millions documents with geometries (points) I have a GIST index on the geometries  the database:  CREATE TABLE resources ( id bigint NOT NULL, accuracy varchar(3), owner varchar(100), title varchar(500), posted timestamp,    nbtags int, url text, description text, rawtags text, tags text, geom geometry NOT NULL, CONSTRAINT resources_pkey PRIMARY KEY (id) );  INDEX resources_index_rep ON resources USING GIST (geom);  CREATE RULE resources_rule AS ON INSERT TO resources WHERE EXISTS(SELECT 1 FROM resources             WHERE id =NEW.id) DO INSTEAD NOTHING;   Of course I want to query this database. Nevertheless, it's very very slow ... (I did analyzes and Vacuums)  for example with area of France:  EXPLAIN ANALYZE SELECT count(*)  FROM resources WHERE st_intersects(st_geomfromtext('POLYGON((-5.134723 41.364166,-5.134723 51.09111,9.562222 51.09111,9.562222 41.364166,-5.134723 41.364166))',4326), geom)  QUERY PLAN Aggregate  (cost=14411182.45..14411182.46 rows=1 width=0) (actual time=17368911.185..17368911.186 rows=1 loops=1)  ->  Bitmap Heap Scan on resources  (cost=890493.27..14391392.83 rows=7915848 width=0) (actual time=2627029.235..17357552.440 rows=21381758 loops=1)     Recheck Cond: ('0103000020E6100000010000000500000077137CD3F48914C05628D2FD9CAE444077137CD3F48914C0562B137EA98B4940F52EDE8FDB1F2340562B137EA98B4940F52EDE8FDB1F23405628D2FD9CAE444077137CD3F48914C05628D2FD9CAE4440'::geometry && geom)     Filter: _st_intersects('0103000020E6100000010000000500000077137CD3F48914C05628D2FD9CAE444077137CD3F48914C0562B137EA98B4940F52EDE8FDB1F2340562B137EA98B4940F52EDE8FDB1F23405628D2FD9CAE444077137CD3F48914C05628D2FD9CAE4440'::geometry, geom)     ->  Bitmap Index Scan on resources_index_rep  (cost=0.00..888514.31 rows=23747545 width=0) (actual time=2626090.609..2626090.609 rows=21381788 loops=1)           Index Cond: ('0103000020E6100000010000000500000077137CD3F48914C05628D2FD9CAE444077137CD3F48914C0562B137EA98B4940F52EDE8FDB1F2340562B137EA98B4940F52EDE8FDB1F23405628D2FD9CAE444077137CD3F48914C05628D2FD9CAE4440'::geometry && geom) Total runtime: 17368946.473 ms 7 row(s)   it took almost 5 hours.  and with Switzerland:  EXPLAIN ANALYZE SELECT count(*)  FROM resources WHERE st_intersects(st_geomfromtext('POLYGON((5.96611 45.829437,5.96611 47.806938,10.488913 47.806938,10.488913 45.829437,5.96611 45.829437))',4326), geom)  QUERY PLAN Aggregate  (cost=5623425.68..5623425.69 rows=1 width=0) (actual time=6798842.064..6798842.064 rows=1 loops=1) ->  Bitmap Heap Scan on resources  (cost=88982.29..5621452.65 rows=789212 width=0) (actual time=783383.496..6797250.482 rows=2539057 loops=1)     Recheck Cond: ('0103000020E61000000100000005000000AF5A99F04BDD1740D28BDAFD2AEA4640AF5A99F04BDD174028F38FBE49E74740B22D03CE52FA244028F38FBE49E74740B22D03CE52FA2440D28BDAFD2AEA4640AF5A99F04BDD1740D28BDAFD2AEA4640'::geometry && geom)     Filter: _st_intersects('0103000020E61000000100000005000000AF5A99F04BDD1740D28BDAFD2AEA4640AF5A99F04BDD174028F38FBE49E74740B22D03CE52FA244028F38FBE49E74740B22D03CE52FA2440D28BDAFD2AEA4640AF5A99F04BDD1740D28BDAFD2AEA4640'::geometry, geom)     ->  Bitmap Index Scan on resources_index_rep  (cost=0.00..88784.99 rows=2367636 width=0) (actual time=782664.847..782664.847 rows=2539063 loops=1)           Index Cond: ('0103000020E61000000100000005000000AF5A99F04BDD1740D28BDAFD2AEA4640AF5A99F04BDD174028F38FBE49E74740B22D03CE52FA244028F38FBE49E74740B22D03CE52FA2440D28BDAFD2AEA4640AF5A99F04BDD1740D28BDAFD2AEA4640'::geometry && geom) Total runtime: 6798852.955 ms 7 row(s)   it took almost 2 hours.  I'm looking for how to improve the performance?  About our server:  - CPU: 4 - RAM: 16 GB - OS: Ubuntu 12.04 LTS 64bit

I am new to PostGIS and I have a problem in query performance.  This my query:  SELECT DISTINCT ON (userid) userid ,ST_AsText(position), timestamp   FROM table1  WHERE ST_Intersects ( ST_GeomFromText('a multiypolygon geom goes here',4326),position)  ORDER BY userid, timestamp desc   and the problem is my multipolygon include VERY large polygons (600 pages long in word doc!) and it took more than 2 hours to execute!  Is there a way to optimize my query or use another way?


My Minecraft screenshots are all missing, I've looked in my .minecraft directory and have come up blank. Does anyone know an alternate location?  I do not believe they are in %appdata%.

I pressed F2 to take a few Minecraft screenshots. Later I couldn't find them. Where are they stored on my computer?


I have some math in an enumerate environment but as you can see in the picture the equations are below the numbers and not aligned horizontally. Why is that and how can I align them?    MWE  \documentclass{article}  \usepackage{amsmath}  \begin{document}  \begin{enumerate}  \item  \begin{equation*}     \sum_{m=0}^{n}a = (n+1)\cdot a \end{equation*}  \item  \begin{align*}     & \delta(n)\ast \delta{n} = \delta(n)\\     & \delta(n) \ast x(n)=x(n) \end{align*}  \end{enumerate}  \end{document}

Related (but not the same):         Earlier today I asked a question about aligning equations in an enumerate environment and got an answer that seemed to work for the example I gave, but it turns out I wasn't really specific enough for my problem.  I'm using align* environments, often as the only part of a list item. (If you're wondering why I'm not using more words to introduce the align*, these are mostly homework solutions where most of the work is algebra, etc.)  Here's my code and what it makes (above the middle line):  \begin{enumerate}   \item \begin{align*}     x^2 + y^2 &= x^2 + (iy)^2 \\               &= (x + iy) (x - iy)   \end{align*}   \item \begin{align*}     \frac{1}{n^2-4} &= \frac14 \frac{4}{(n-2)(n+2)} \\                     &= \frac14 \left( \frac{1}{n-2}-\frac{1}{n+2} \right)   \end{align*} \end{enumerate}     I'm trying to make the baseline of the first line of the align* environment the same as the number's baseline—I want the first line of the align* to have the same vertical position (centered horizontally in the same way) relative to its number as in the second half of my picture. (Side question: why is there so much space before the align* starts?)


I have been trying to prove that the Power set of Positive Integers is uncountable using :  Is $i$ an element of the $i$-th subset  But I can not seem to prove it.

I'm getting hung up on a proof that I remember being fairly easy... Showing that the power set of $\mathbb N$ is uncountable. Supposing it's countable, say $A=\{A_1,...\}$, we choose a set $B$ composed of elements $b_i$, where $b_i\notin  A$. How to we guarantee that $B$ isn't the naturals itself, an element of its own power set? Thanks!


Hi does anyone have any references on the relative performance/cost of Java math operators?   Ideally something like in Code Complete 2 (which I don't have on hand right now)  where it might look something like this:   addition: 1 subtraction: 2 multiplication: 10 division: 100 logarithm: 600 exponent: 500   Thanks.

How do you write (and run) a correct micro-benchmark in Java?  I'm looking for some code samples and comments illustrating various things to think about.  Example: Should the benchmark measure time/iteration or iterations/time, and why?  Related:


Is there a way to use that kind of symbol?

I know what my symbol or character looks like, but I don't know what the command is or which math alphabet it came from. How do I go about finding this out?


I'm using C# for developing mobile applications(Monotouch, monodroid). I have a class by this definition:  public class TempIOAddOn : BaseIOAddOn  {     public TempIOAddOn ()     {     } }   And I use this code to access an instance of class by its string name:  BaseIOAddOn tempIOAddOn;             Type t= Type.GetType("TempIOAddOn" );             tempIOAddOn  = (BaseIOAddOn)Activator.CreateInstance(t);   But after executation, t is null.  I tried below code also:  BaseIOAddOn tempIOAddOn;             tempIOAddOn = (BaseIOAddOn )System.Reflection.Assembly.GetExecutingAssembly().CreateInstance("TempIOAddOn" );   But again I face with null. tempIOAddOn is null.  What is wrong with me?

I want to get a System.Type given only the type name in a string.  For instance, if I have an object:  MyClass abc = new MyClass();   I can then say:  System.Type type = abc.GetType();   But what if all I have is:  string className = "MyClass";


In a document that uses the newtx packages, double subscripts seem to have too much spacing.  \documentclass{scrartcl} \usepackage{newtxtext} \usepackage{newtxmath}  \pagestyle{empty}  \begin{document}   $\lambda_{\alpha_p}$ \end{document}     The spacing with the default font looks much better:    It also happens with newtx if Latin letters are used:    More pairs tested:    Is there anything I can do at the "user" level (short of inserting \! all over the place) to fix this?  Related, but not the same: .

MathTime (mtpro2) contains a subscriptcorrection option, which is great.  Is there some way to get similar functionality for mathdesign?  In the MWE below the subscripts are too far from their `parent.'  Thanks!  \documentclass[12pt]{article}  \usepackage[subscriptcorrection]{mtpro2}         % pretty %\usepackage[nosubscriptcorrection]{mtpro2}      % ugly %\usepackage[utopia]{mathdesign}                 % ugly  \begin{document} \(  \omega_{jt} \) \end{document}


I was looking at the gravitational inverse-square law: $$ F_G = G \frac{Mm}{r^2} $$  This law comes from some experimental data? Why it is an exact inverse-square law? Could it be $$ F_G = G \frac{Mm}{r^{2.00000000000000001}} $$ or there is a mathematical method to find exactly this law?

When I was in the university (in the late 90s, circa 1995) I was told there had been research investigating the $2$ (the square of distance) in the Newton's law of universal gravitation.  $$F=G\frac{m_1m_2}{r^2}.$$  Maybe a model like   $$F=G\frac{m_1m_2}{r^a}$$  with $a$ slightly different from $2$, let say $1.999$ or $2.001$, fits some experimental data better?  Is that really true? Or did I misunderstand something?


I'm looking to compare linear regression models from different data subsets in r. The models are not nested. I have a model from the complete dataset with sex as a factor and then 2 separate models from 2 subsets of this data (subset1 = all male data, subset2 = all female data). I am trying to see if it is better to have one model with sex as a factor or if there is benefit having a separate model for each gender. I am looking at the MAE (mean absolute error) and RSME (root mean square error) specifically. Can I compare the raw values or the MAE and RSME (e.g. MAE from the complete model on the complete set vs female on the female set and male on the male set)?

Let's say I have a 2x2 design where participants are either in condition A or condition B and, within each condition, either get exposed to exposure C or exposure D. First, I want to test whether exposure D > exposure C, within each condition. I can do one of two things. First, I can subset the data to the appropriate condition and check the coefficient on a dummy variable set to 1 for exposure_d. lm(outcome ~ exposure_d, data = subset(data, condition == "A") lm(outcome ~ exposure_d, data = subset(data, condition == "B")  Or I can specify a full model and run a contrast library(emmeans) model <- lm(outcome ~ exposure_d * condition_a, data = data) means = emmeans(model, ~ condition_a | exposure_d) contrast_table = contrast(means, method = "pairwise")  Are these methods formally equivalent? I tested the two on simulated data and they seem to produce identical coefficients and standard errors, but I worry things might change when I start adding in more control variables (especially since the contrast() function throws the warning that the cell means and standard errors may not be accurate in the presence of interactions). Which of these methods is preferred?


Applications such as Chrome (no problem with other browsers), terminal, print screen, they all take ages (~1 minute) to start. All applications that I invoke with key-binding are slow. This has been going on for a couple of days.  Lenovo Yoga 500  Processor: AMD A8-7410 APU with AMD Radeon R5 Graphics × 4   Graphics: Gallium 0.4 on AMD MULLINS (DRM 2.43.0 / 4.4.0-77-generic, LLVM 3.8.0)  OS Type: 64-bit  glxinfo | grep "OpenGL version" OpenGL version string: 3.0 Mesa 12.0.6   EDIT 1: output for google-chrome  [3871:3871:0509/102048.258355:ERROR:sandbox_linux.cc(343)] InitializeSandbox() called with multiple threads in process gpu-process.  Gkr-Message: secret service operation failed: Did not receive a reply. Possible causes include: the remote application did not send a reply, the message bus security policy blocked the reply, the reply timeout expired, or the network connection was broken. Gkr-Message: secret service operation failed: Did not receive a reply. Possible causes include: the remote application did not send a reply, the message bus security policy blocked the reply, the reply timeout expired, or the network connection was broken.   output for gnome-screenshot is immediate; it takes more than 1m when I press PrtSc.

When I start up Ubuntu 16.04 some applications take too long to run the first time I open them, including Chrome and any PDF viewer. Others, like nautilus, start up immediately.  The first time I try to use a PDF viewer like okular, it takes too long to open. After it opens a PDF file for the first time, other files open quickly. Even if I close all and open some after a long time, it happens quickly.  How can I speed up these programs opening on the first run?


This post is halfway related to   Imagine that you lose everything that you got (money, cell-phone, IDs) while abroad. I know I should have two forms of ID, not carry all the money in one pocket and stuff like that. But even then, stuff could happen. I'm into outdoor sports and sometimes extreme cases are not avoidable. Anyway. The only option I can think of is going to a consulate (I'm aware that they don't care much for people abroad in such conditions) and asking for some additional ID, then trying to find free WIFI and contacting someone back home to send me money through Western Union.   What are the other backup plans? I wish I could obtain money just with a password from an ATM or Western Union. Or even better, I wish I could deposit an envelope with some form of ID and pocket money and get it through expedited delivery from UPS at a business location.

I was watching the Bond flick  last night. In it, Bond ends up in terrible shape, but manages to escape to the shores of Hong Kong, where he strolls into the lobby of a swanky hotel, is instantly recognized, and equipped, and away you go...  My question is this: supposing I'm NOT going to be recognized, but I've lost my wallet, all ID, everything. How do I get reconnected with my financials? Let me make it clear, I'm not asking how I get a free room and masseuse with no ID, I'm asking how does a real person get a place to stay for the night, some fresh clothes and food.  Let's also assume that I AM actually paying for it, somehow, though I don't have cash or a credit card.  Thoughts?


Is Static Variable will be collected by garbage collection? If not please let me know the reason for it.

Given an hypothetical utility class that is used only in program setup:  class MyUtils {    private static MyObject myObject = new MyObject();    /*package*/static boolean doStuff(Params... params) {        // do stuff with myObject and params...    } }   will myObject be garbage collected when it is no longer being used, or will it stick around for the life of the program?


I'm trying to tackle some question and I think I solved it, but I'm not sure and would like someone to check my work.  The question goes like this:     Find the number of non-negative solutions of the equation $x_1\cdot{x_2}\cdot{x_3}\cdot{x_4}=1000000$.   My try: First I have written the equation as $x_1\cdot{x_2}\cdot{x_3}\cdot{x_4}=10^6=2^6\cdot{5^6}$, hence $x_i$ is of the form $\displaystyle 2^{a_i}\cdot{5^{b_i}}$ where $0\le a_i,b_i \le 6$.  Now we can write $$2^{a_1}5^{b_1}\cdot{2^{a_2}5^{b_2}}\cdot{2^{a_3}5^{b_3}}\cdot{2^{a_4}5^{b_4}}=2^{a_1+a_2+a_3+a_4}\cdot{5^{b_1+b_2+b_3+b_4}}=2^6\cdot{5^6}$$ Thus, we are looking to find the number of non-negative solutions to the equations $$\begin{cases}a_1+a_2+a_3+a_4=6\\b_1+b_2+b_3+b_4=6\end{cases}$$ We know that $0 \le a_i,b_i \le 6$, hence the generating function would be $$g(x)=(1+x+...+x^6)^4=\left(\frac{1-x^7}{1-x}\right)^4=(1-x^7)^4\cdot{\frac{1}{(1-x)^4}}\\g(x)=(1-x^7)^4\cdot{\sum_{n=0}^{\infty}{{n+3}\choose 3}x^n}$$ Now, $\displaystyle (1-x^7)^4=x^0-4x^7+6x^{14}-4x^{21}+x^{28}$, hence the only relavant term is $x^0$ (we want to find the coefficient of $x^6$). We find that the required coefficient is $\displaystyle {9\choose 3}=84$, so we have 84 optional solutions to any of the equations.  Edit: There is no dependence between the equations, hence the number of solutions is $84^2$.  Is my reasoning correct? Please help me fix my errors if there any. Thanks!

I can't solve the following:  Find the number of positive-integer solutions that satisfy $x_1\cdot x_2\cdot x_3\cdot x_4=1,000,000$.  Thanks.


When I click on the reference of the figure on the article its caption appears directly instead of all the figure then I have to go up to see the figure. I used it:  \documentclass[twocolumn,amsmath,showkeys,prb]{revtex4-1} \usepackage{graphicx} and  \begin{figure} \centering \includegraphics[width=8.5cm,keepaspectration=true]{./image} \caption{image.png} \label{fig:exp_diag} \end{figure}   Thank you for the help.

I'm using the following command to embed images in my LaTeX document (which is then rendered as PDF)  \newcommand{\img}[4]{   \begin{figure}[!hbt]     \centering       \vspace{1ex}       \includegraphics[width=#2]{images/#1}       \caption[#4]{\label{img.#1} #3}     \vspace{1ex}   \end{figure} }   When creating a href to an image, the viewer jumps to the image caption instead of the top of the image. How do I change my \img command so it still puts the caption below the image but links to it jump to the image itself?


This is me -   Today I have some notifications for this account -     I tried to restore my access to 2158 account, but any different OpenID from OpenID for 176052 account just offer me to create a new account.   So looks like I need help to restore access for 2158 account or this notifications is a bug?

I accidentally posted a question without being logged in. Is there a way to associate that question with my account?   For more information, visit "" in the .   a.k.a. How can you link a registered account to a cookie-based account? a.k.a. How do I merge an unregistered account with a registered account a.k.a. Merging users a.k.a. How do I associate anonymous questions I’ve asked with my registered account? a.k.a. Is there a way to claim an unregistered user? (in case anyone searches with those terms)


Below a part of subtitles from the Angry Birds movie.     77 00:04:25,400 --> 00:04:26,435 Get outta here!      78 00:04:26,520 --> 00:04:28,440 Already? But you're the only one   that's had cake.      79 00:04:28,480 --> 00:04:29,480 What...      80 00:04:29,640 --> 00:04:30,640 Mmm.      81 00:04:31,040 --> 00:04:32,268 Oh, that's good stuff.   Can you please tell me what "-'s" is in the bold sentence above? Does "-'s" represent "has", "is" or anything else?

I am continually surprised to hear people use has and is interchangeably. The erudite Peter Segal has been guilty of saying:  This song is been written by XXX. YY is been a producer on the show ZZZ and now lives in California.  Should the two sentences use has since they refer to events in the past? Are is and has really interchangeable? If so, under what circumstances can one be substituted by the other?


Here     $('#example-widget-container').html("This data comes from another server: " + data);    render the HTML data from a rest API.   I want to apply events on the html tags store in db using JQueries.   Please provide the help.     (function() {      // Localize jQuery variable     var jQuery;      /******** Load jQuery if not present *********/     if (window.jQuery === undefined || window.jQuery.fn.jquery !== '1.4.2') {         var script_tag = document.createElement('script');         script_tag.setAttribute("type","text/javascript");         script_tag.setAttribute("src",             "http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js");         if (script_tag.readyState) {           script_tag.onreadystatechange = function () { // For old versions of IE               if (this.readyState == 'complete' || this.readyState == 'loaded') {                   scriptLoadHandler();               }           };         } else {           script_tag.onload = scriptLoadHandler;         }         // Try to find the head, otherwise default to the documentElement         (document.getElementsByTagName("head")[0] || document.documentElement).appendChild(script_tag);     } else {         // The jQuery version on the window is the one we want to use         jQuery = window.jQuery;         main();     }      /******** Called once jQuery has loaded ******/     function scriptLoadHandler() {         // Restore $ and window.jQuery to their previous values and store the         // new jQuery in our local jQuery variable         jQuery = window.jQuery.noConflict(true);         // Call our main function         main();      }      /******** Our main function ********/     function main() {          jQuery(document).ready(function($) {              /******* Load CSS *******/             var css_link = $("<link>", {                  rel: "stylesheet",                  type: "text/css",                  href: "style.css"              });             css_link.appendTo('head');                        /******* Load HTML *******/             var jsonp_url = "http://xyz123/api/atmSearch";             $.getJSON(jsonp_url, function(data) {    console.log(data);               $('#example-widget-container').html("This data comes from another server: " + data);             });         });     }      })(); // We call our anonymous function immediately
Web Widget Tutorial

Example 4 - Putting things together

I have a bit of code where I am looping through all the select boxes on a page and binding a .hover event to them to do a bit of twiddling with their width on mouse on/off.  This happens on page ready and works just fine.  The problem I have is that any select boxes I add via Ajax or DOM after the initial loop won't have the event bound.  I have found this plugin (), but before I add another 5k to my pages with a plugin, I want to see if anyone knows a way to do this, either with jQuery directly or by another option.


I have heard backup being used as a verb in the sense of     I have to backup my hard disk   by non-native English speakers (the English noun backup is also used in other languages, for example in German, so it may be a false friend). The correct expression seems to be     I have to make/create a backup of my hard disk.   I know that "to back up" is correct English, but has a different meaning.   Microsoft uses "back up" in the above sense, see , but the Oxford and Miriam-Webster dictionaries do not seem to support this use.  Has to backup (or to back up) become part of the English language?

Which is correct?   To back up data. To back data up.   The context is the following: He was careful enough to perform tests and [back up data | back data up] to avoid any problems.


I cannot move sites in the "Edit Your Sites" section, because the swipe-from-left-on-screen gesture blocks the hamburger (3-bar) icon.  I'm using Android 5.1 if it matters.

When editing the "Your Sites" list on the Android app, the handles on the left are extremely difficult to drag, which is necessary to reorder them. They send to be further right than I would expect, basically centered on the left edge of my screen.  Unless I touch the perfect area I find that it ends up getting interpreted as sliding the left navigation drawer.  I am encountering this issue on a Droid MAXX with Android version 4.4.4.  Edit: here's a screenshot of what I'm seeing.


There is not much more to elaborate. Can string theory say why electrons and protons have exactly opposite charge? And thus why hydrogen atoms are neutral? I guess that the answer is no, because nobody has yet deduced the standard model from strings.  The standard model does not answer the question: it just uses and requires the equality of charges for consistency reasons. (The "answers" to the similar question in the forum about the standard model show this clearly.) But standard model does not really explain the equality: why do two completely different particles have the same electric charge?  This said, does any other theory explain why the charges are equal?  Alternatively: why is the electromagnetic coupling of protons the same as the electromagnetic coupling of electrons?

What is the explanation between equality of proton and electron charges (up to a sign)? This is connected to the gauge invariance and renormalization of charge is connected to the renormalization of photon field, but is this explanation enough? Do we have some experimental evidence that quarks have 2/3 and -1/3 charges? By the way I think about bare charge of electron and proton. And I am also wondering if this can be explained by Standard Model.


Let $$f(x)=\lim\limits_{n\to\infty}\underbrace{x^{x^{x^{...}}}}_{n\text{ times}}$$ Is it possible to find $f'(x)$. If yes, please show all steps.

The infinite tetration is defined as $$f(x)=x^{x^{\cdot^{\cdot}}}$$  This function is defined for $e^{-e} \leq x \leq e^{e-1}$.  (Wikipedia image)    Can one determine the derivative of this function?


Does anyone know how to create a light streak(trail) in Blender 2.8?  this following tutorial shows how to do it in an earlier version of Blender, but I could not make the smooth light streaks in the 2.8 version.  The light streaks came out as a bunch of particles, not smooth.  Thank you.

I'm trying to make a light paths like there:    To achieve this light threads (streaks) I used a particles emmiter with shining icospheres and motion blur shutter like .  I got this result:    First of all I wish to get full path of the light: from rising to falling. And the second I wish to see the half circle path, but not the angle like now.  Maybe I should use another way to achieve the reference?  Blender 2.75, Cycles


I just got some rep notifications while I was chatting on chat.SE. Thanks to , I have a top bar in chat, so I see something like this:    Now, suspecting that something may be wrong with the script showing it in the chat rooms, I went to the main chat.SE site, and... saw this same error.    To be sure, I spun up an incognito tab, where I don't have any scripts running (because normally I have 20+). And... still shows broken:    Apparently, English Language & Usage is now Stack Overflow en Español, Literature is now Magento, Mythology & Folklore is Network Engineering... Science Fiction & Fantasy and Meta don't seem to have been affected.

I recently got an answer upvote on an answer on Programming Puzzles and Code Golf.  However, I ended up checking this on chat.stackexchange (specifically , but it appears on main  too. Testing looks like favicons for multiple (at least 3) sites are not working. Here is what it looks like on stackexchange.com (still old top bar, but no visual error):  Here's what it looks like on chat.se:  I'm not entirely certain what that is? Looks like a meta icon for another site. If you look closely, you can see a tiny bit of the "PCG" icon just below it, but it's cut off. This also happens on Literature notices, and Sci-fi and Fantasy (but not Vegetarianism or Veg.meta).  I don't have any meta notices to test with, other than the vegetarianism one (which is fine).  I'm not providing an image, but this works with answer notices too. (tested with PPCG) This is on Chrome (latest version, 61.0.3163.100) on OS X El Capitan.  (but tagged ) and  (unresolved).


The archaic meaning of egregious is something good. Now it means the opposite.  When did this occur and is there any reasoning on why this occurred?

According to Google's dictionary (and MacOS/iOS dictionary), egregious has the following definitions:    I've seen words with multiple definitions, but not ones that are exact contradictions. Some references state that "remarkably good" is archaic - is it possible that the meaning of this word has changed over time to be the exact opposite of what it once meant?


I have huge data of maps usually most of the table are co-ordinates and the other are raster maps stored in SQL server 2008 and PostGres Server. I am using desktop application to analyse the data. Usually the desktop end is QGIS or mapinfo. Now I think It would be easier if end user could do the same with the same dataset. So I am building a web application so that those data could be queried and manipulated by end user as required and view as layer. How to get started with this? I had a look at   and .     The requirement :    User should be able to query data from server and display it as map. Since there are multiple tables they should come as multiple layers and user can disable and enable the layer. There is no relation what so ever with google/bing/or third party maps ( may be this could be quite a feature for version 2)   Actually I want to build simple web application that acts as basic GIS application. Well tell me if I am reinventing the wheel.  I found this  helpful but could not provide step by step solution to the problem

I want to start working on a web map at work to map some of our statistics by city.    I have an idea, but I'm not exactly sure where to start.   Are there any definitive resources that provide step by step guidance on how to do this?


Let's say I have 4 tabs open, then I close the browser to shutdown my computer.   I'd like that next time I turn it back on and open the browser, the 4 tabs to be there. If they got saved onto some cache or they just reload again, I don't care.  I want it to always reopen all the tabs I have open at the time of closure, much like Notepad++. And much like a smartphone's browser, now that I think of it.  I am aware of Ctrl+Shift+T to reopen the last closed tab. It's not what I am looking for.  If that is not possible with Google Chrome, then: is there any other browser capable of that?

When my computer shuts down due to automatic updates and I restart it all the tabs I had open are restored. But when I do Ctrl + Shift + Q all the tabs are lost.  Is there a way to have my tabs saved when I manually close Google Chrome? Or should I just kill every single instance of it in the Task Manager or something?


Been a few blogs on , and I get the point. However, would a staging SE help solve some of these issues like community overlap. I understand , but how can someone not yet a part of a community know to do so. Some of the point of SO is that you often don't know what to ask exactly, and we help clear that up. So, I wonder, rather than "playing hot potato" would it be useful to have a site that's simply for temporarily holding questions and such.  It would be the alternative to migrating to another site where you dump all responsibility on that site. This area, all communities are responsible for. It would be a good place to ask a question if you don't know where to ask. The blog I linked talks about phrasing to a specific audience. For someone that doesn't know, the audience is better at selecting which questions are directed at them. As SE grows, the amount of communities will mean more overlap. Right now it may be reasonable to expect people to be able to predict the best community, but will it always be that way?  Some restrictions:  It would be accessible by all communities. The question could be edited, but not answered. The question could be exposed to more easily tracked/understood/etc. automated janitorial work.  Just a helpful thought.

Sometimes don't understand this question better suits to which SE site. So I may have account on that site but not able to understand that question should be asked there. Or may get similar question on that site. But I wouldn't like to see faq of every site to check . We can see different types of areas here . There might be question which can fit into 2 or more sites.  Is there any central location for what kind of questions can I ask on every SE site? Or is there any collection of site with it's one faq saying .  Update: I am saying is there any central location also for reading what kind of question I can ask on this site like  And I am not saying to remove What kind of questions can I ask here? faq from all sites. I do read faq of every site. But it would be good if I know what kind of question I can ask on each site when do anyone join SE community. It would be helpful for searching my similar problems on that sites also.


Years ago, my brother and I had an argument where I was trying to convince him that nothing could travel faster than the speed of light. I was pursuing this in the context of Special Relativity. My main thought was to contrast the behaviour of light to the behaviour of baseballs thrown from train-cars, say. To me, this is an interesting and surprising feature, and I thought he'd be interested.  Instead, he turned the argument into "you don't really know that nothing can go faster than light". Over the years, we've gone back and forth where he'll claim that some new result proves that I was wrong. I've mostly been dismissive, since the cites are mostly pop-sci or will say something like there might be some 1 part in 10^17 discrepancy, or something.  So, recently, I sent him the Wikipedia article on Metric Expansion, and he shot back with "see, matter is traveling faster than the speed of light."   Is this an accurate statement, or does it hinge on interpreting "traveling"? I.e. one can make a distinction between traveling through space, and space itself expanding.  Was I wrong to say (again, according to GR not SR) "nothing can travel faster than the speed of light" (ignoring tiny fluctuations, and according to currently known physics)?

What does general relativity say about the relative velocities of objects that are far away from one another? In particular:--  Can distant galaxies be moving away from us at speeds faster than $c$? Can cosmological redshifts be analyzed as Doppler shifts? Can I apply a Lorentz transformation in general relativity?


I have the following problem.     Determine the equation of the tangent to the curve defined by $f(x)=x^2-6x+14$ at   the point $(1,9)$, and then sketch it.   I'm having trouble with this question as I have no lessons whatsoever on it, the only example is telling me to complete the square to sketch it, and its not working out when I try that. Any help would be appreciated.

I have the equation $y = 1+2x-x^3$ and the point $(1,2)$.  When I work it out I come up with the derivative of $2-3x^2$.  When I apply the point I come up with a slope of $-1$ and a tangent line of $y=4-x$.  Can someone work it out and confirm my answer or show me where I am going wrong?


I would like to make a bootable DMG or ISO file with OS X Mavericks on it. I want to then burn this file to a DVD-ROM (or, alternatively, make a bootable USB stick with it).  From what I've read, however, the file     /Applications/Install\ OS\ X\   Mavericks.app/Contents/SharedSupport/InstallESD.dmg   is not bootable. From what I understand, to make it bootable one needs to insert a file called BaseSystem.dmg inside InstallESD.dmg and then burn the resulting DMG (perhaps after converting it to an ISO 9660 file, although I'm not sure whether this is necessary) to a DVD-ROM drive.  Here is what I'd like to know:   What exactly is BaseSystem.dmg? Is this file the same on all OS X systems? Will any version of this file from any OS X system do just as well? Do I need to use Disk Utility to add this file to InstallESD.dmg or can I use the command line? What is the procedure in each case? I am not root on the system. Can I accomplish this without a root password? I've heard the root password is only needed for setting file permissions. Can I get away with this, copy BaseSystem.dmg, and do the rest of the work requiring root privileges on Linux after mounting the USB key with all files on Linux?   Thanks.

Does anyone have a Terminal command-line recipe for making a new bootable USB flash drive for one of the new MacBook Air's?  Is there a way to dd copy the USB boot device that comes in the box and make the new copy bootable?  I'd like to make a new backup copy of the USB rescue device for my MBA, preferably on a much larger flash drive with room for a backup of some of my working directories.  Added:  And is it possible to make, not just a rescue drive, but a bootable USB drive that will boot a fully updated version of the OS (say 10.6.8 or later)?  If so how on a MacBook Air 11, and how big a USB stick will this require?


Objective: Check for presence of backup .tgz file containing today's date; output 1 for OK, 0 for no file.  I'm a sucker for one liners :)  For example in PHP (and pretty much similar in Javascript), in various scenarios I like to do something like  <?php echo (date("d")==1)?"Monday":"Not Monday"; ?>   Is there similar syntax in Bash? I know how to check for presence of a regular file using -f FILENAME, I only want the command to print 1 or 0 :)

I wrote a simple backup script which back ups my stuff on a remote server, everything is working great but I'd like to have some sort of report like "backup successful or not".  this is my script   # backup CHECK date1=`date +"%d.%m.%y - %H.%M"` host=`hostname` twdate=`date +"%d.%m"` performtw=`ls -la|grep "tw"|grep "$twdate" > tmp1.txt` echo $performtw if cat tmp1.txt|grep "tw" then echo backup successfull printf "tw backup success!" | mail -s "tw backup check $date1 repor$ rm tmp1.txt else echo backup failure printf "sitename backup failure!" | mail -s "site backup check $date1 repor$ rm tmp1.txt fi exit   But this isn't working really well and I ask you if there's some simpler and more powerful way to do it? Basically it just needs to check if file exists with the name starting xyz and was created at date xyz.


I read a novel around 2000 where a scientific discovery of some sort of field effect (?) made it possible to build devices that would prevent gunpowder from working over a large area.  I think it had a one word title. "Primer" and "Damper" spring to mind, but I've checked, and can't find either. It was a trade paperback about the size of Jurassic Park. I think it just had a generic explosion behind the title.  I think the book was divided into three sections for three different uses of the field. I don't remember what the first was. The second was the anti-gunpowder field. The third was very short, and demonstrated selectively killing one baby mouse. I think the explanation was each object has some fundamental vibration, and getting a piece of fur let you tune to exactly that frequency?  I remember a few set pieces.  One was some sort of gun-control debate, about whether this device should be banned. The designated villain pulled a gun out of his podium to threaten someone and announced that the field covering the building had been sabotaged, and the protagonist debating him realized that they had only chosen podiums at the last minute, so found a gun in his as well. Which was apparently the villain's plan all along, so that he could prove that only guns could stop him? The logic was a little convoluted.  Another, later set piece was that survivalists had kidnapped the inventor. He discovered that since guns wouldn't work, they planned to defend themselves with saran gas. The military raided them before they could get that ready though. Each side was using crossbows.  Any ideas?

Like the title says I'm looking for title and author of a book where gun powder explodes.  I read it sometime ago (15-20 years)  The story starts in a university where they are testing a machine. When they turn on the machine, nothing happens(that is what they think).  The next morning the hear/read that a guard's gun exploded in his car, and it happened at the same time as when they did the experiment.  They repeat the experiment, and they see that gun powder is exploding.   That is what I remember.


In R, I'm running a linear model of the form:  fit <- lm(cbind(Y1,Y2,Y2) ~ X1 + X2 + X3, data=regression_table); predicted_vals <- predict(fit, test_data);   Does any one have suggestions on how I should go about evaluating the training error of this multivariate model? Observations are independent, and I understand how to go about doing cross validations for univariate  models, however there's no inherent function within R (to my knowledge) which handles MLM objects for this purpose.

In R, I'm running a linear model of the form:  fit <- lm(cbind(Y1,Y2,Y2) ~ X1 + X2 + X3, data=regression_table);   Then I'm using predict to generate predictions;  predicted_vals <- predict(fit, test_data);   Does any one have suggestions on how I should go about evaluating the training error of this multivariate model? I understand the notion of cross validation for univariate multiple models, though I'm not sure how to go about go about doing something similar for a multivariate model.


Console logging this.byPassViewState returns ["01"]  if i do this.byPassViewState === ['01'] it returns false  typeof(this.byPassViewState) retuns object  My question is why this.byPassViewState returns false ? it suppose to be true right ? please tell me what i'm doing wrong here

I'm using  to go through JavaScript, and it's returning many suggestions to replace == (two equals signs) with === (three equals signs) when doing things like comparing idSele_UNVEHtype.value.length == 0 inside of an if statement.  Is there a performance benefit to replacing == with ===?   Any performance improvement would be welcomed as many comparison operators exist.  If no type conversion takes place, would there be a performance gain over ==?


For the case that a natural number $N =c\cdot k$ where $c$ is odd, we can easily represent $N$ as following sum  $$N = \sum_{n = k - \frac{c-1}{2}}^{k + \frac{c-1}{2}} n$$  This covers all integers except for powers of two: $N=2^l$. Some experimenting suggests that we cannot decompose powers of two as sum of consecutive positive integers, but is there a way to prove this, or is there a counter example?

I think i have proved that any number of the form $2^n$ can't be written as the sum of k consecutive positive integers, but i would be grateful if i could have some clarification as to whether this is a correct and valid proof or not.  Let $g=x+(x+1)+(x+2)+(x+3)+...+(x+(k-1))$, hence g is the sum of k consecutive positive integers.  $g=kx+\sum_{d=1}^{k-1}d$  Hence, $g=kx+\frac{k(k-1)}{2}$  Rearranging for x we find, $x=\frac{g}{k}-\frac{(k-1)}{2}$  So, for certain values of $k$, we can be sure that a positive integer value of $x$ can be found, and hence $g$ can be written as the sum of $k$ consecutive positive integers.There are two cases for $k$ to considor:  Case 1)  $k$ is odd. If $x$ exists, it must be the case $k$ | $g$, as for odd values of $k$, $\frac{(k-1)}{2}$ will alwyas be an integer, and hence $x$ will.  Case 2)  $k$ is even. $k$ does not divide $g$, but $\frac{g}{k}$ must be a multiple of $\frac{1}{2}$, and hence equals $\frac{h}{2}$, for some odd $h$.  Letting $j=2^n$, assume that we can write $j$ as the sum of $k$ consecutive positive integers.  If $k$ is odd, then if a $k$ exists, it must divide $j$, by Case 1. But, $j$ has no odd factors as it is a power of two, hence $k$ could not be odd.  If $k$ is even, by Case 2 it mut be the case $k$ does not divide $j$. Also, $\frac{j}{k}=\frac{h}{2}$, for some odd $h$.  But, this implies $2j$ has an odd factor, $h$. but, as $2j$ is a power of $2$, it can't have odd factors. So, $k$ can't be odd.  Hence, $k$ is neither odd or even, and this is a contradiction to our assumption. Hence no $x$ exists, and hence and number of the form $2^n$ can't be written as the sum of $k$ consecutive positive integers.  Any feedback on this proof would be appreciated.


I'm trying to make an environment that does the follows:  \newcommand\foo[1]{does something with #1}  \newenvironment{bar}{\foo \someStartFunction}{\someEndFunction}   such that  \begin{bar} some text \end{bar}   expands to  \foo{some text}   My first instinct would be to place brackets { and } inside the newenvironment, but this will of course go wrong. Is there any easy way to do this; is there some kind of \someStartFunction ... \someEndFunction?

I'm creating a style file, and want to store the body text of the abstract environment so that I can put it on my custom titlepage. I could have required that my users enter the abstract as  \customabstract{Abstract text goes here}`   which I would have implemented as something like  \newcommand{\customabstract}[1]{\gdef\abstracttext{#1}}   However, I would prefer that the user is able to use environment notation,  \begin{customabstract}Abstract text goes here\end{customabstract}   To do this, I thought I could define something like  \newenvironment{customabstract}{\gdef\abstracttext\bgroup}{\egroup}   But this definition makes \abstracttext expand to \bgroup, which is not what I wanted. I tried to solve the problem by \expandafter,  \newenvironment{customabstract}{\expandafter\gdef\expandafter\abstracttext\bgroup}{\egroup}   but this results in a runaway error.  Is there any way to acheive what I want? Answers that helps me understand the inner workings of TeX (instead of just referring to a custom package) are preferred.


I exactly want to know that what does  mean? if a person carrying a bag but he is standing he is not doing any work because bag did not cover any displacement in the direction of force but if a person is walking then did he do any work or not?

I read the definition of  as  $$W ~=~ \vec{F} \cdot \vec{d}$$  $$\text{ Work  =  (Force) $\cdot$ (Distance)}.$$ If a book is there on the table, no work is done as no distance is covered. If I hold up a book in my hand and my arm is stretched, if no work is being done, where is my energy going?


1st post here so bear with me lol   just wanted to check my work here i have a form that validates a email address but with the change to php 5.3 now errors   can some one please look over my change and tell me what im missing as it not working   OLD WAY  function valid_email($email) { // check an email address is valid if (ereg('^([0-9a-zA-Z]+[-._+&])*[0-9a-zA-Z]+@([-0-9a-zA-Z]+[.])+[a-zA-Z]{2,6}$', $email)) return true; else return false; }   NEW WAY  function valid_email($email) { // check an email address is valid if (preg_match(('^([0-9a-zA-Z]+[-._+&])*[0-9a-zA-Z]+@([-0-9a-zA-Z]+[.])+[a-zA-Z]{2,6}$', $email)) return true; else return false; }   form sends with no email validation. i no its prob some thing simple but i cant work it out   thanks in advance

Over the years I have slowly developed a  that validates MOST email addresses correctly, assuming they don't use an IP address as the server part.  I use it in several PHP programs, and it works most of the time.  However, from time to time I get contacted by someone that is having trouble with a site that uses it, and I end up having to make some adjustment (most recently I realized that I wasn't allowing 4-character TLDs).  What is the best regular expression you have or have seen for validating emails?  I've seen several solutions that use functions that use several shorter expressions, but I'd rather have one long complex expression in a simple function instead of several short expression in a more complex function.


I am from Singapore, a civil engineering graduate and I've graduated from university in 2009.  Throughout my school days I've been interested in Physics, unfortunately I was not accepted into the local university as my grades did not match up. And I couldn't afford to study abroad. Hence I took up whatever was offered to me at that point; civil engineering.  Right now, I'm on a mission to self-study theoretical physics so that I can fully appreciate the beauty of it; I mean right down to the deep mathematical level of it. I am particularly interested in the subjects: General Relativity, Quantum Theory, M-theory. I acknowledge that first of all I'd have to master the math before I can delve deeper into the theoretical physics subjects.  I would like to ask forumers the following questions:  (1) - May I know what are the sequence of math & physics topics I have to master? I mean in a step-by-step way starting from high school level knowledge.  (2) - Could you recommend texts both from the math & the theoretical physics side? Based on my research I have shortlisted a few and they are   (a) Introduction to Mathematical Physics: Methods and Concepts by Chun Wa Wong.  (b) A course in theoretical physics by P. john Shepherd  (c) Introduction to Modern Physics: Theoretical Foundations by John Dirk Walecka &  (d) A Unified Grand Tour of Theoretical Physics, Third Edition by Ian D. Lawrie.    Are these books suitable and good for my cause? What other textbooks do you all recommend? I am willing to self-study patiently even if it takes me 10 years.

Every once in a while, we get a question asking for a book or other educational reference on a particular topic at a particular level. This is a meta-question that collects all those links together. If you're looking for book recommendations, this is probably the place to start.  All the questions linked below, as well as others which deal with more specialized books, can be found under the tag  (formerly ).  If you have a question to add, please edit it in. However, make sure of a few things first:   The question should be tagged  It should be of the form "What are good books to learn/study [subject] at [level]?" It shouldn't duplicate a topic and level that's already on the list   Related Meta:


It has been established that the entropy of a black hole is equal to:  $$ \frac{1}{4} \frac{c^3 A}{ G \hbar} k$$  Which if one substitutes for A the surface area of the event horizon:  $$16\pi\frac{G^2M^2}{c^4}$$  One gets for the entropy:  $$8\pi^2\frac{GM^2}{hc}k$$  My question is the following:  Entropy for ordinary matter very roughly scales with the number of particles in the system. Which for stars mostly composed of fully ionized hydrogen is proportional to the mass of the system. However for black holes this seems to scale with the mass squared.    Why is this? Does this seem to imply that matter falling into a black hole is heated to such an extreme that more particles are created (from energy gained by gravity or by decomposition of nuclei and nucleons into constituent particles) in such high numbers that entropy seems to have this proportionality to the mass squared? Do neutron stars have a similar relationship?

The Bekenstein entropy for a black hole is proportional to the surface area $A$ of the black hole $$ S_{BH} = \frac{k_B}{4 l_P^2} A $$ with the Planck length $l_P = \sqrt{\frac{\hbar G}{c^3}}$.  The area is the surface of a sphere with Schwarzschild radius $r_s = \frac{2 M G}{c^2}$, so  $$ A = 4 \pi r_s^2 = 16\pi \left(\frac{G}{c^2}\right)^2 M^2 $$ and the black hole entropy is therefore proportional to the mass of the black hole $M$ squared: $$ S_{BH} = \frac{4 \pi k_B G}{\hbar c} M^2. $$ But this quite unusual for an entropy. In classical thermodynamics entropy is always supposed to be an extensive quantity, so $S\sim M$. But the black hole entropy $S_{BH} \sim M^2$ is obviously a non-extensive quantity. Isn't a non-extensive entropy inconsistent within the framework of thermodynamics? Why is it, that the entropy of a black hole must be a non-extensive quantity? Shouldn't we better define an entropy for a black hole from e.g. the ratio of Schwarzschild radius to Planck length, which would give us an extensive entropy like $$ S_{BH, ext} \sim k_B \frac{r_s}{l_P} \sim k_B\sqrt{\frac{4G}{\hbar c}} M  $$


I'm aware that a good portion of the code needs fine-tuning however, I'd appreciate if your focus was towards #1. Which is the first if statement. For whatever reason, I can't seem to get the 2 variables + the answer to appear.   import java.util.Scanner;  public class Calculators {      public static void menudisplayer()       {          Scanner myObj = new Scanner(System.in); // Create a Scanner object          System.out.println("1 - Add" + "\n" + "2  - Subtract" + "\n" + "3 - Divide " + "\n" + "4 - Multiply" + "\n" + "5 - Average" + "\n" + "6 - Maximum" + "\n"); //printing menu          System.out.println("Please type in the operation that you would like to use");         String operations = myObj.nextLine(); // Read user input         System.out.println("You Entered: " + operations + "\n"); // Output user input            double value1, value2, answer;         Scanner scanvalues = new Scanner(System.in);          System.out.print("Enter any two Double Values" + "\n");         value1 = scanvalues.nextDouble();         value2 = scanvalues.nextDouble();             if (operations == "1") {             System.out.println(answer = value1 + value2);             System.out.println("value1="+value1+"\nvalue2="+value2+"\nAnswer="+answer);           } else if (operations == "2") {             System.out.println(value1 + value2);         } else if (operations == "3") {             System.out.println(value1 + value2);         }        }         public static void main(String[] args) {         menudisplayer();      } }

I've been using the == operator in my program to compare all my strings so far. However, I ran into a bug, changed one of them into .equals() instead, and it fixed the bug.  Is == bad? When should it and should it not be used? What's the difference?


At the end of Tale of the Three Brothers, it reads:     But though Death searched for the third brother for many years, he was never able to find him. It was only when he had attained a great age that the youngest brother finally took off the Cloak of Invisibility and gave it to his son.   From this passage, can we infer that you cannot die while wearing the Cloak?

In Harry Potter and the Half-Blood Prince, after Harry eavesdropped on Malfoy on the Hogwarts Express, Malfoy cast Petrificus Totalus on Harry while Harry was wearing his Invisibility Cloak.   How did the spell work, when Deathly Hallows tells us that no spell used against the Invisibility Cloak will work? (Harry's cloak was not an ordinary cloak and was a gift by Death, himself, to his ancestors, passed down to him)  To prove my point, sometime later in Deathly Hallows, one of the Death Eaters tried to Accio the cloak to find Harry, which didn't work.  So this contradicts J.K. Rowling theory.     Ah, but the Third Hallows is true Cloak of Invisibility, Miss   Granger! I mean to say, it is not a traveling cloak imbued with   a Disillusionment Charm, or carrying a Bedazzling Hex or else   woven from Demiguise hair, which will hide one initially but fade   with the years until it turns opaque. We are talking about a cloak   that really and truly renders the wearer completely invisible, and   endures eternally, giving constant and impenetrable concealment,   no matter what spells are cast at it. How many cloaks have you   ever seen like that, Miss Granger?


I wanted to tail the last 100 lines of a file to the same file, but the command tail -n 100 file > file doesn't work, I assume because the stdout gets written to the file 'live', before everything was read from the original file.  Is there some way to pipe the output to something, that then keeps it until all 100 lines are there, and then outputs it to the file? Or just another way to shorten the file in this way?

I have a bash script which enumerates through every *.php file in a directory and applies iconv to it. This gets output in STDOUT.   Since adding the -o parameter ( in my experience ) actually writes a blank file probably before the conversion takes place, how can I adjust my script so it does the conversion, then overwrites the input file?  for file in *.php do     iconv -f cp1251 -t utf8 "$file" done


I have a Cobb-Douglas equation I am modelling in R:  $$ \ln(Y) = β + β_a \ln(A) + β_l \ln(L) + β_f \ln(F) + β_o \ln(O) + u $$  Is there an easy way of testing the hypothesis about whether the betas sum to one; less than one; more than one?

I would like to test a linear restriction in R. Instead of the usual $\beta_i=0$, I want to test if $\beta_k=0.5$ and $\beta_j=-0.5$.  Is there a way to do this using lm command, and just writing a different formula for the models that lm command uses?  I was thinking of writing $y-0.5x_k+0.5x_j=\sum_{i\neq j,k} x_i\beta_i+(\beta_k-0.5)x_k+(\beta_j+0.5)x_j$. However, I'm not sure how to code this reparametrization...  P.S:Would writing $y−I(−0.5x_k+0.5x_j)$ ~ $\sum x_i$ as the formula to be run on lm, work as 2 t-tests?   Any help would be appreciated.


The Problem     On an infinite plane there are two points, $A$ and $B$, a unit distance apart.  There is a $50\%$ probability that there is an invisible wall somewhere between the two points.  The wall extends $1/3$ unit in each direction perpendicular to the line between $A$ and $B$, and its position is uniformly distributed between the two points.  You don't know if the wall is present or where it is until you run into it.      What strategy minimizes the expected distance to travel to point $B$ from point $A$?   (This problem  but was closed for being "too mathy.")  My Solution  I use an $x$/$y$ coordinate system on the plane with the origin at $A$, and $B$ on the positive $x$-axis.  Once the position of the wall is known (i.e. when you run into the wall) the best strategy is to walk straight along the wall to the nearest end, then travel straight to $B$.  The best strategy should therefore be to follow a fixed path from $A$ to $B$ until you reach $B$ or hit the wall; if you hit the wall, follow the previously stated path around the wall.  I break up the fixed part of the path into a number of small segments.  A given segment covers a horizontal distance $\delta x$ and vertical distance $\delta y$.  The length of each segment is weighted by the probability it gets traveled, which is $\frac{1}{2} + \frac{1}{2}\left(1-x\right)$.  We also consider the probability that you have to walk around the wall, which for a given segment is $\frac{1}{2}\delta x$.  The distance it takes to get around the wall is just $(H-y) + \sqrt{H^2 + (1-x)^2}$, where $H=\frac{1}{3}$, the half-length of the wall.  Therefore the expected distance $E$ should be equal to:  $$ E = \sum_{i=1}^N\frac{2-x}{2}\sqrt{\delta x_i^2 + \delta y_i^2} + \frac{\delta x_i}{2}\left((H-y_i) + \sqrt{H^2 + (1 - x_i)^2}\right) $$  If we treat $y$ as a function of $x$ (assuming that the optimal path doesn't travel backward) we can factor out $\delta x$, since $\delta y = y'(x)\delta x$; then taking the limit as $\delta x\to 0$ we obtain an integral:  $$ E = \frac{1}{2}\int_{0}^{1}(2 - x)\sqrt{1 + y'(x)^2} + H - y(x) + \sqrt{H^2 + (1-x)^2}~\mathrm{d}x $$  Now I try to use the  to find the path $y(x)$ that minimizes $E$:  $$ E = \int \mathcal{L}(x, y(x), y'(x))~\mathrm{d}x \\ \mathcal{L}(x, y(x), y'(x)) = \frac{1}{2}\left((2 - x)\sqrt{1 + y'(x)^2} + H - y(x) + \sqrt{H^2 + (1-x)^2}\right) \\ \frac{\partial \mathcal{L}}{\partial y(x)} - \frac{\mathrm{d}}{\mathrm{d}x}\frac{\partial \mathcal{L}}{\partial y'(x)} = 0 \\ \left[-\frac{1}{2}\right]-\frac{\mathrm{d}}{\mathrm{d}x}\left[\frac{(2-x)y'(x)}{2\sqrt{1+y'(x)^2}}\right]=0 \\ 1 = \frac{y'(x)(1 + y'(x)^2) - (2-x)y''(x)}{\left(1+y'(x)^2\right)^{3/2}} \\ y''(x) = \left(1+y'(x)^2\right)\frac{y'(x)-\sqrt{1+y'(x)^2}}{2-x} $$  A solution to this differential equation should be a minimum-distance path, as long as it satisfies $y(x) \le H$ for all $x\in[0,1]$.  The boundary conditions are $y(0)=y(1)=0$.  Mathematica finds an explicit solution, but it it is extremely complex.  The simplest form I can get it in is:  $$ y(x) = \frac{168 \left(9 \sqrt{6}+\sqrt{38}\right) \xi -\sqrt{131-9 \sqrt{57}} \xi^3 - 448 \sqrt{3710+378\sqrt{57}}}{2688 \left(27+\sqrt{57}\right)} \\ \xi = \sqrt{7 \left(43+\sqrt{57}\right)-8 \left(27+\sqrt{57}\right) x} \\ y(x) \approx 0.3929 x\sqrt{1.2802-x} +0.3454 \sqrt{1.2802-x}-0.3908 $$  The solution looks like this:    The Question  Is this approach valid, and are my calculations correct?

Every day you walk from point A to point B, which are $3$ miles apart. There is a $50$% chance each walk that there is an invisible wall somewhere strictly between the two points (never at A or B). The wall extends $1$ mile in each direction perpendicular to the line segment (direct path) between A and B, and its position can be at any random location between the two points. That is, it can be any distance between A and B such as $0.1$ miles away from A, $1.5$ miles away, $2.9$ miles away.... You don't know if the wall is present or where it is until you walk into it.  You must walk around the wall if present as there is no other way to circumvent it.  Assume the wall is negligible thickness (like a force field), all ground is perfectly flat, and the y coordinates at both A and B are $0$ (although I don't think the optimal path will change much if they weren't).  What strategy minimizes the average expected walk distance between A and B?  How do we know for certain this strategy yields the shortest average walking distance?  To get the $100$ bounty points, I would like a convincing argument from you as to why you feel your solution is optimal and cannot be beaten.  For those of you using computer simulation, anything reasonably close to optimal is a candidate for the bounty.   Can anyone beat the optimal solutions submitted so far?  There are still a few days to try.  Even a slight beat (if not due to roundoff error or some other error) would help prove previous solutions are non-optimal.  You can just use the table of $31$ points (x-y coordinates) and compute that path length and then if you can find better then I will accept that answer.  I think by Sunday night I may have to award the bounty otherwise it may get auto-awarded.


Problem. Prove that if $ \gcd(a,m) = 1 $ and $ a b \equiv a c  \pmod m $, then $ b \equiv c \pmod m $.   I have $ m | a b - a c $, or $ m | a (b - c) $, and I know that if $ \gcd(a,m) = 1 $, then $ n | b - c $. I just don’t know what lemma I can use here.

To prove that if $ab \equiv ac\bmod n$ and $(a,n)=1$ then $b\equiv c \bmod n$  I write as  $1=ar+ns$  $ac=ab+nq$  I have to prove $c=b+nr$  How do I manipulate equations to reach conclusion  Thanks


Since we know white dwarfs are made of electrons and neutrons stars are made of neutrons and quark gluon plasma. What can we say about the black hole in this sense since its properties are far stranger to any object in the universe? Can we say it is made of some exotic particles which we don't know of yet?

Imagine a black hole originally formed from, for example, Rubidium atoms. On the other hand, one made from, for example, Helium atoms. Will it be there any difference between the two? Or perhaps once formed it all turns into the same type of matter?  Can the "composition" of the matter-energy in the black hole be inferred somehow?  Could one say that "black hole substance" is a distinct form or state of matter different from other forms or states of matter?


I'm developing a 2D stealth game but I cannot figure out how to create something like a torch (flashlight) that the enemies hold and look around with.Any help? Also, if relevant, I'm using MonoGame.

I am thinking of writing myself a simple 2D game. It will not shine with perfect graphics or gameplay at first, but I'd consider it my first step in PC game development. So, imagine such simple sprite-based 2D game (like Heroes IV or Startcraft BroodWar).  I want the gameplay to support day/night with the according lighting changes and at the same time it will be madness to have to create sprites for every lighting nuance. So, I decided adding a semi-transparent layer on top of other objects will be enough.   The issue with this solution is if I have a light source object in the game (like the hero wearing a torch, or a burning building), there must be a lighter area around it, right? Since I am putting my semi-transparent layer over everything, how would you suggest to achive the torchligt visual effect I want? Maybe redraw that layer adding 'gaps' or differently colored areas based on the lighting effect?


I wanted to check what had happened to a question I read last night, but the only useful thing I can remember about it is that it was self answered. I can't remember the user's name, or any good keywords in the question. I also use the app, so I don't have a history to reference.   Is there a way using the in-site search to find questions with self answers?   This was on SO, but I figured any answer would likely also be applicable on other sites, so I'm posting this here.

Looking at , I don't see any shortcuts for searching questions where the OP self-answered.  I'm trying to search specifically where the OP added details to the original question by adding an answer rather than editing the original post. Admittedly, these get flagged pretty early, but occasionally, they get missed.  But I think there should be a way to do this.  Is it possible to search for posts where the asker of a question has also answered the question?


I'm new at this topic, so I'm not sure about whether is my solution acceptable or not. Could you check it?  By Sylow theorem there exist $|P|=7$ and $|Q|=8$. Sylow $p$-subgroup is normal iff it is unique. Denote by $n_p$ amount of different Sylow $p$-subgroups. Suppose $n_i \neq 1$ for $i=2,7$. Since $|G|=n_p \cdot N_G(P)$ and $n_p\equiv 1 \pmod{p}$, we have that $n_7=8$ and $n_2=7$. So there are $8$ conjugates of $P$ which intersect in identity. Thus there are $(7-1)\cdot 8=48$ elements of order $7$ which can't be elements of Sylow 2-subgroups. There left $8$ elements which are obviously not enough to construct $7$ different Sylow 2-subgroups of order $8$. We've got contradiction.

Let $G$ be a group of order $56$. (We do NOT assume the Sylow-$7$ subgroup to be normal.) Then either the Sylow-$2$ subgroup is normal or the Sylow-$7$ subgroup is normal. How to prove?  My idea: consider the case $n_2=7,n_7=8$. Then the number of elements in all Sylow $2$ -subgroups and Sylow $7$-subgroups is at most exactly $(7-1)*8+(2-1)*7+1=56$. This cannot give a contradiction. We need to prove that $G$ is simple. Then $|G||(8!/2)$. To prove $G$ simple, we need to prove there does not exist normal subgroups of order $2$ and order $4$. But I do not know how to prove.


How can i make a bootable USB of windows 10 on ubuntu ?  I tried to extract the iso on the usb key but all i got was an error when i tried to install it.  How can i make a bootable USB of Windows 10 using Ubuntu ?  Thanks

I'd like to create a Windows bootable USB stick, but I don't have a Windows machine with me at the moment to do so. How could I achieve the same using Ubuntu?


I have absolutely no idea how to go about this. I have started to find how many sylow p subgroups there are.     I've looked at this but I don't know why they've even started the answer in the way they have.

So I've been trying to prove that there's no simple group of order $300$. This is what I did and I was wondering if it was enough.   $|G|=2^2 \cdot 3 \cdot 5^2$. Suppose $G$ is simple. Then there would be $6$ Sylow $5$-subgroups, one of which will have an index of $6$. But then $|G|=300$ does not divide $6!$ which leads to a contradiction. So, the number of Sylow $5$-subgroups is $1$ and $\exists$ a proper normal Sylow $5$-subgroup in $G$. Hence $G$ is not simple.


I'm looking for a certain sci-fi book. If I knew who the author was I wouldn't be asking this question but it might be a story by Stanislaw Lem. But I went through a list of his works and didn't find it there. As I seem to recall the story, it's about a boy whose father returns from a mission in space. The boy suspects that the man who returned isn't his actual father and he tries to unmask him. It's a vague description of a story that might have been written over and over again (I don't know :D). But I would appreciate if someone could help me find the title!

For years, I've been looking for a short story about a boy who discovers alien pods in a field that are growing replacement people. If I remember right, he sees the pod creature eat his mother and then become her, and no one believes him. The story ends with him going in to see his dad, one of the few real people left until that point, and seeing something (an empty pod maybe) that lets him know his dad has been taken and he's next. I'm thinking that the title was something like Father Figure, but I may be remembering wrong.  The story was part of several collections of classic science fiction stories that we had on our bookcase when I was growing up, so I'm guessing that the story could be from the 70's or any time earlier.


My program is throwing a NullPointerException. I suspect Calling the instance method of a null object  is the reason for it throwing a null pointer exception.  Can anyone explain what does this actually mean?

What are Null Pointer Exceptions (java.lang.NullPointerException) and what causes them?  What methods/tools can be used to determine the cause so that you stop the exception from causing the program to terminate prematurely?


I flagged  to be duplicate of  and my report was marked as helpful:    But I do not see any action taken. I suppose the duplicate question should be closed. Then how is the flagged question still open if my report was helpful?

I flagged a post and (choose one)   my flag was marked as helpful, yet nothing was done my flag was marked as declined, yet the post was deleted/edited/closed   Why?


Whenever we twist two wires together to make a circuit, there's no soldering or fusing-together of wires involved. So, in such a case do electrons jump across the microscopic air gaps which are present in between the two wires? Or is it just that they influence the electrons of the next wire to move?  If it is the latter case, what exactly constitutes an electric current? flow of electrons literally or just the transfer of energy etc. ?

If you have a circuit of a battery, a Resistance and a light connected with a wire by example: in the middle the wire is cutted in two pieces. if you connect each piece of wire with a metal object and put those twee metal objects together so the current can flow to the resistance and the light. How is it possible that the electrons can flow from the wire to one of the metal objects into the other metal object and again in the wire? I do understand how electrons move in metals and wires, but i don't know how the transaction of electrons between those components goes. Is it really that simple that electrons just can flow from one object into another of is the (kinetic) energy passed through when an electron clashes with the edge and that energie is passed through to the other object?


I have a class contains common functions for my project. One of function is template static:  common.h  #include <QMetaEnum> #include <QString>  class Common { public:     Common();     template<typename T> static QString EnumToString(const T value); };    and so implementation:  common.cpp  template<typename T> QString Common::EnumToString (const T value) {     return QString(QMetaEnum::fromType<T>().valueToKey(value)); }   That compiles without problems but when I want to use this functions like this:  MyEnum enum = MyEnum::Value1; qDebug() << Common::EnumToString<MyEnum>(enum);   I get some strange linker error:     error: undefined reference to `QString   Common::EnumToString(MyEnum)'   MyEnum has registered in Qt metasystem:  enum class MyEnum {     Value1,     Value2,     Value3 }; Q_ENUM(MyEnum);   What I do wrong and how to get it work?

Quote from :     The only portable way of using templates at the moment is to implement them in header files by using inline functions.   Why is this?  (Clarification: header files are not the only portable solution. But they are the most convenient portable solution.)


Find the probability of rolling ten different, standard 6-sided dice simultaneously and obtaining a sum of 30?  I started to answer this question by setting up an equation like this:  x1+x2+...+x10=30 with 0 less than or equal to xi less than or equal to 6 But we know the die will have values 1-6 so we have y=x+1 so that y1+y2+...+y10=20 Now I know we can have at most 4 6's, 5 5's, 6 4's, 10 3's, 10 2's, 10 1's.  I was not sure if I am heading in the right direction or should I just find all possible outcomes of the die and use the inclusion-exclusion method to find all the permutations in which the sum will be 30?


I'm getting the following error,    java.lang.NullPointerException: Attempt to invoke virtual method 'void android.support.v7.widget.SearchView.setOnQueryTextListener(android.support.v7.widget.SearchView$OnQueryTextListener)' on a null object reference   on this code:   public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {      inflater.inflate(R.menu.search_menu, menu);     final MenuItem item = menu.findItem(R.id.search);      final SearchView searchView = (SearchView) MenuItemCompat.getActionView(item);     searchView.setOnQueryTextListener(this);  }   I can't figure out how to fix it - does anyone have any suggestions? I understand what a nullpointer exception is, but I don't understand why searchView is null.


I'm writing complicated equations by latex and I'm keeping have error messages: for the first two equations I've "undefined control sequence" and the third one I've:   ! Package inputenc Error: Unicode char − (U+2212) (inputenc)  not set up for use with LaTeX. See the inputenc package documentation for explanation. Type  H <return>  for immediate help.    These are my equations  \begin{document} $sigma \textsupsub{2}{j}(x)\equiv \sum_{j\prime=1}{M}{W \textsupsub{2}{ij\prime (X)a_{j\prime}(X)}, j,=1,...,M $ %(8b) $$T= min_j\epsilon [1,M]\Bigg\{ \frac {\epsilon a_0(X)}{\mu_j(X)|},\frac {\epsilon a_0(X)}^2{(\xi\textsupsub{2}{j}(x)})$$ Prob $\{X_m=b\mid X_{m-1}=a, X_{m−2}=c,...,X_0=e\}=Prob\{X_m=b\mid X_(m-1)=a\}$ \end{document}   it suppose to produce :

I'm writing complicated equations in LaTeX and I'm getting error messages: for the first two equations I get:  ! Undefined control sequence.  and the third one I get:   ! Package inputenc Error: Unicode char − (U+2212) (inputenc) not set up for use with LaTeX. See the inputenc package documentation for explanation. Type H for immediate help.  Can any one help? These are my equations:  \begin{document} $\sigma \textsupsub{2}{j}(x)\equiv \sum_{j\prime=1}{M}{W \textsupsub{2}     {ij\prime (X)a_{j\prime}(X)}, j,=1,...,M $ %(8b)  $$T= min_j\in [1,M]\Bigg{ \frac {\epsilon a_0(X)}{\mu_j(X)|},\frac  {\in a_0(X)}^2{(\xi\textsupsub{2}{j}(x)})$$   Pr ${X_n=j\mid X_{n-1}=i, X_{n−2}=k,...,X_0=m}=Pr{X_n=j \mid X_(n-1)=i}$ \end{document}   it's supposed to produce:


Looking to apply to a top 10 MBA program in a few years.   Currently finishing up my undergraduate degree at a top 20 national university. I have a 3.65 GPA, majoring in Computer Science, and have a Business Concentration.   I got 1 D in my second semester of freshmen year in a basic CS class (Algorithms). I've done significantly better in all of my classes with a range of A+ to B across the board. The semester I received a D in one class, I took too many hours and couldn't do well on all my exams. That semester, it was that one class that I got a D in - otherwise I had all As and A+s.   I'm hoping to work in industry for a few years before applying to MBA school but would love to learn what the serious chances/challenges/implications are as I apply to a Top 10 MBA School. I just want to get a better trajectory on where my career path lies.   The dream is to be in technology management - a CTO, VP of Engineering etc.

I am in the third year of my undergraduate degree now, and in the process of applying for Graduate schools and Med schools. I have a burning questions about a creepy "C" in my transcript.   To summarize my story: I was recovering from a biopsy operation back then. Though I was advised to take one semester off to rest physically and mentally (I was extremely paranoid waiting for the pathology report, and luckily it came back benign), I still decided to take all the courses and the heavy research that I had started before. I performed so badly that semester that I received a C. That is like the most embarrassing element in my transcript.   Some told me that such a bad grade is a disadvantage for admissions. Do I still have a chance to make it to top grad and med schools?  With extra effort (I have managed to pull up my GPA to 3.8 now, I have been on the Dean's list for some semesters, have 3 publications, and 2 poster presentations at symposium, my GRE and MCAT are good too), can I cover that ugly spot?


I was having a walk when the dog suddenly bit me.   My colleague felt 'having a walk' is not appropriate, and that the correct expression is 'going for a walk' or 'taking a walk'.   Why is "having a walk" incorrect?

My teacher said "I am going to have a walk" today in class and to me it seems incorrect. Correct variants that I know are:    Going for a walk Going to take a walk Going to walk  ...   Is this correct? If so, why?


I am studying Gary Koop's Bayesian Econometrics , it is bit confusing in the beginning. I will reproduce some results from the textbook here in order to smoothly move to my question.   For a simple linear regression model with normal distribution assumption for the error term, its likelihood can be rearranged into $$p(y|\beta, h)=\frac{1}{(2\pi)^{N/2}}\bigg\{h^{\frac{1}{2}}\mathrm{exp}\bigg[-\frac{h}{2}(\beta-\hat{\beta})^2\sum_{i=1}^Nx_i^2\bigg]\bigg\}\bigg\{h^{\frac{\nu}{2}}\mathrm{exp}\bigg[-\frac{h\nu}{2s^{-2}}\bigg]\bigg\}$$ the first curly brace on the right hand side resembles Normal distribution, the second curly brace resembels Gamma distribution, where $h=\frac{1}{\sigma^2}$, $\nu$ the degree of freedom, $s^2=\frac{\sum (y_i-\hat{\beta x_i})^2}{\nu}$, $N$ the sample size.   Then we have a natural conjugate prior, with a Normal-Gamma density $$\beta,h \sim NG(\underline{\beta},\underline{V},\underline{s}^{-2},\underline{\nu})$$, underline indicates the prior parameters. $\underline{V}$ is the variance of $\beta|h$.  After this, the author provide the posterior directly $$\beta,h|y \sim NG(\bar{\beta},\bar{V},\bar{s}^{-2},\bar{\nu})$$ where  $$\bar{V}=\frac{1}{\underline{V}^{-1}+\sum x_i^2}$$ $$\bar{\beta}=\bar{V}(\underline{V}^{-1}\underline{\beta}+\hat{\beta}\sum x_i^2)$$ $$\bar{\nu}=\underline{\nu}+N$$ and $\hat{\beta}$ is the OLS estimate.   I have no idea how author get these results, I checked the reference he mentioned, but I still could not figure out the deriviation. Would anyone show me how do get posterior as author did under these model settings? Thank you!!

I'm reading  to work on the foundations of my understanding of Bayesian analysis. In the first chapter, about normal models, I'm having some trouble working the posterior distribution by myself.  For the model with known variance and conjugate prior for the mean $N(0, \sigma^2)$, the derivation seems straightforward (pages 29 and 30):  $$\pi(\mu\mid D_n) \propto \mathrm{exp}\{-\mu^2/2\sigma^2\}\mathrm{exp}\{-[n(\bar{x}-\mu)^2 + s^2]/2\sigma^2\}$$ $$\propto \mathrm{exp}\left\{-\frac{\mu^2 + n\mu^2 - 2n\mu\bar{x} +n\bar{x}^2 + s^2}{2\sigma^2}\right\}$$  $s^2$ drops off because it does not depend on the $\mu$ parameter; $n\bar{x}^2$ is almost what we need to complete the square, but not quite so, so I guess we also drop it off and substitute it for the proper term:  $$\propto \mathrm{exp}\left\{-\frac{(n+1)\mu^2 - 2n\mu\bar{x}}{2\sigma^2}\right\}$$ $$\propto \mathrm{exp}\left\{-\frac{(n+1)\left(\mu^2 - \frac{2n\mu\bar{x}}{n+1} + \frac{n^2\bar{x}^2}{(n+1)^2}\right)}{2\sigma^2}\right\}$$ $$\propto \mathrm{exp}\left\{-\frac{(n+1)\left(\mu - \frac{n\bar{x}}{n+1}\right)^2}{2\sigma^2}\right\}$$  So far, so good. But when it comes to the unknown mean, unknown variance model with prior $N(0, \sigma^2)$ and $\frac{1}{\sigma^2} \sim Exp(1)$, we can't drop off the $n\bar{x}^2$ term anymore because now the denominator inside the exponential function depends on the parameter $\sigma^2$.  So I have come to a similar point deriving the joint posterior for $\mu$ and $\sigma^2$:  $$\propto \mathrm{exp}\left\{-\frac{2 + \mu^2 + n\mu^2 - 2n\mu\bar{x} +n\bar{x}^2 + s^2}{2\sigma^2}\right\}\sigma^{-(n+5)}$$ $$\propto \sigma^{-1/2}\mathrm{exp}\left\{-\frac{(n+1)\mu^2 - 2n\mu\bar{x} +n\bar{x}^2}{2\sigma^2}\right\}\mathrm{exp}\left\{-\frac{2+s^2}{2\sigma^2}\right\}(\sigma^2)^{-(\frac{n+2}{2})-1}$$  The part to the right is already the core of the Inverse-Gamma function derived in the book, but I can't see how to complete the square for the normal density function without adding another term to the second Inverse-Gamma parameter. Indeed, in the general case, this parameter value should also have a $\frac{n\bar{x}^2}{n+1}$ term (as, e.g., ).   So I decided to compare both solutions by simulation using Metropolis-Hastings to obtain posterior draws of both parameters. Surprisingly (or not), the book solution uses the correct formula for the scale parameter for the Inverse-Gamma, $\frac{2 + s^2}{2}$, and if we add the term based on the sample mean, the density curve does not quite fit (Edit: not really, see below) . What am I missing here?    Edit: I'm starting to think that the book might indeed be mistaken. Completing the square in the first exponential makes it necessary to add a $\frac{n\bar{x}^2}{n+1}$ term that can only go in the second exponential term. So I tried my hand again with simulations, adding a JAGS model with the same definition to compare to my homemade solution (which had a coding error when I posted the question), and now it seems that the correct formula for the second Inverse-Gamma parameter is indeed $\frac{2 + s^2 + \frac{n\bar{x}^2}{n+1}}{2}$. Here's a plot with the simulated and theoretical densities for the posterior distribution (data = rnorm(100, 50, 10)):


If i run this code below in Netbeans   import java.io.Console; public class Introduction {             public static void main(String[] args) {         Console console= System.console();// creates a java Object which has method that allows us to write         console.printf("Hallo parvel");     }         }    It gives me the error:  Exception in thread "main" java.lang.NullPointerException     at Introduction.main(Introduction.java:10) /home/parvel/.cache/netbeans/8.1/executor-snippets/run.xml:53: Java returned: 1 BUILD FAILED (total time: 0 seconds).    please help

What are Null Pointer Exceptions (java.lang.NullPointerException) and what causes them?  What methods/tools can be used to determine the cause so that you stop the exception from causing the program to terminate prematurely?


After attempting to install Ubuntu Desktop 32bit on our HyperV environment - which requires static IP addressing, Ubuntu thinks the network cable is unplugged.  It's connected to the correct Team NIC in SCVMM (like 40 or so other servers; which are all working fine) but for some reason it doesn't detect that the cable is "plugged in". I'm going to try Ubuntu Server 64-bit to see if that works.  UPDATE - looks like server has the same problem.

I recently download the new disk of 13.04 of 32bit. I have Hyper-v on windows 8 64bit. I try to operate 13.04 on hyper-v but I can't connect to the network. I have already set at hyper-v manager that will create my wifi connection to network. It work at windows 7 and 12.04 inside the Hyper-v, so I know the setting I set for vm is right.  How I can also operate network at 13.04? I try already with legacy and non legacy network.


I booked a ticket in December (before the Coronavirus outbreak made it outside of China) to fly from Lisbon to Tel Aviv in May, on the 24th of March TAP cancelled the flight.   From what I understand I should be able to receive a full money refund according to the EU261 regulation. And also according to the flight contract with TAP (I read parts of it, preparing to talk with their customer service).  But I called their customer support (minimum of 30 minutes waiting time, answered me 5 out of 7 calls) and they just offer me a voucher, when I ask for the refund they refuse, and when I mention the laws they disconnect the call.  I decided to try to record them and told them I will, which resulted in claims that it is illegal, and then they disconnected me.  So my questions are: 1) (Important) How can I actually talk them into giving me my money back? 2) (Less important) Is it illegal to record a talk with customer service? Do I have to tell them I am doing it?  Thanks!  PS. right now I filed with my CC company to see if they can give me the money back, but in case that doesn't work, I would like to be able to talk better to customer support.

My international conference in Europe this May has been canceled due to the COVID-19. I have a ticket, purchased from TAP air Portugal, from Toronto, Canada to Lisbon. Because it is a non-refundable fare, they don't want to give a refund.  They won't allow me to reschedule later than May 31 of this year. This won't be useful for me.  What options do I have? I'd prefer to get a full refund.  (I am a US citizen if it matters)  Note: They offered to refund just the taxes, which is about 10% of the value. That's not horrible, but I'd rather have the whole thing returned.


Why would someone choose to increment a unique key with a value higher than 1?  For example instead of unique index going from (1, 2, 3, 4, 5)  It goes(8, 15, 22, 29, 36), starting at 8 and then each increment goes +7.  Does it have any security improvements?

In SQL Server, you can set the increment of an identity column other than 1.  In what situation would you do that?


I get this problem every time I try and get wine 1.6 on Ubuntu 12.04. I have no idea how to fix it!  It just says:  The following packages have unmet dependencies:  wine1.6 : Depends: libgettextpo0 but it is not installable            Depends: wine1.6-i386 (= 1.7.1-actually1.6-0ubuntu1)            Depends: binfmt-support (>= 1.1.2) but it is not installable            Recommends: gnome-exe-thumbnailer but it is not going to be installed or                        kde-runtime but it is not going to be installed            Recommends: fonts-droid but it is not installable            Recommends: ttf-mscorefonts-installer but it is not installable            Recommends: fonts-horai-umefont but it is not installable            Recommends: fonts-unfonts-core but it is not installable            Recommends: winbind but it is not going to be installed            Recommends: winetricks but it is not going to be installed E: Unable to correct problems, you have held broken packages.

Every time I try to install "WINE" VIA the Software Center on Ubuntu 12.10, I get this error:  The following packages have unmet dependencies:  wine1.4: PreDepends: dpkg (>= 1.15.7.2~) but 1.16.7ubuntu6 is to be installed          Depends: libc6 (>= 2.14) but 2.15-0ubuntu20 is to be installed          Depends: wine1.4-amd64 (= 1.4.1-0ubuntu1) but 1.4.1-0ubuntu1 is to be installed          Depends: wine1.4-i386 (= 1.4.1-0ubuntu1) but it is not going to be installed   When I try installing it VIA the terminal, this is what I get:  Reading package lists... Done Building dependency tree        Reading state information... Done Some packages could not be installed. This may mean that you have requested an impossible situation or if you are using the unstable distribution that some required packages have not yet been created or been moved out of Incoming. The following information may help to resolve the situation:  The following packages have unmet dependencies:  wine1.4 : Depends: wine1.4-i386 (= 1.4.1-0ubuntu1) but it is not installable            Recommends: gnome-exe-thumbnailer but it is not going to be installed or                        kde-runtime but it is not going to be installed            Recommends: ttf-droid            Recommends: ttf-mscorefonts-installer but it is not going to be installed            Recommends: ttf-umefont but it is not going to be installed            Recommends: ttf-unfonts-core but it is not going to be installed            Recommends: winbind but it is not going to be installed            Recommends: winetricks but it is not going to be installed E: Unable to correct problems, you have held broken packages.   how do I fix this?


My question is that I asked a question on stackoverflow.com and  I want to share my question to all other technical stackoverflow linked sites like ,  etc.  I want to share my question on only selected sites related to stackoverflow. I don't want to post duplicates, I just want to make my question visible for the users on the related site, that may not necessarily be the members of the both sites, but may be competent to answer.  Is there any option in StackExchange network to perform this operation?  Can any one suggest me how I can do this?

It is possible to migrate a question from one Stack Exchange site to another by closing, but if I have a question that I think is on-topic for multiple Stack Exchange sites, is it OK to post it on both (multipost)?   For example, I have a question that's earned me the tumbleweed badge on SO and I'm not sure what the best thing to do with it is. It's about a web server so it might be answerable on Server Fault but it's really more of a programming thing, hence the posting the question on Stack Overflow.    Is there any way to make the question visible on multiple sites (crosspost) and then accept the answer wherever it came from?


How do you find the standard deviation of the weighted mean?   The weighted mean is defined: $\bar{x}_w = \frac{\sum{wx}}{\sum{w}}$  The weighted standard deviation (since it is not specified, I take it as of the distribution) is defined:  $$s_w = \sqrt{\frac{N'\sum_{i=1}^N {w_i(x_i-\bar{x}_w)^2}}{(N'-1)\sum_{i=1}^N{w_i}}},$$  where $N'$ is the number of nonzero weights, and $\bar x_w$ is the weighted mean of the sample ()  For an unweighted sample, calculating the standard deviation of the mean from the standard deviation of the distribution is .  How do I calculate it for the weighted mean, and how is the expression derived?

I am studying statistics and I am wondering when it comes to standard error or a sampling if the calculation changes when there are weights added.   I have a weighted mean:  $$\mu_{w} = \dfrac{\sum_{i=1}^Nw_ix_i}{\sum_{i=1}^Nw_i}$$ and a weighted variance calculated by:  $$s^2_{w}=\dfrac{\sum_{i=1}^Nw_i}{(\sum_{i=1}^Nw_i)^2-\sum_{i=1}^Nw_i^2}\cdot \sum_{i=1}^N(x_i-\mu)^2$$  is the sampling error still calculated as  $$\text{SE}=\sqrt{\dfrac{s^2_{w}}{n}}$$


I find about int main definition, but not of void main in introduction of c++ programming language. I tried reading all the articles written in introduction of c++ programming language.

What is the correct (most efficient) way to define the main() function in C and C++ — int main() or void main() — and why? And how about the arguments? If int main() then return 1 or return 0?  There are numerous duplicates of this question, including:       — For C++, with a very good answer indeed.     Related:


give an example of a function $f:\Bbb R\to\Bbb R$ such that $\forall x,y \in \Bbb R$,$|f(x)-f(y)|\lt|x-y|$ but there is no $x \in\Bbb R$ such that $f(x)=x$

Working from Munkres.  Show that $f: \mathbb{R}\to \mathbb{R}$ given by $f(x) = [x+\sqrt{(x^2+1)}]/2$ is a shrinking map that is not a contraction that has no fixed point.   I figured out the fixed point part but have no clue how to show the other part.  For the fixed point part $$f(x) = x \Leftrightarrow x = [x+\sqrt{(x^2+1)}]/2$$  then $$2x = x + \sqrt{(x^2+1)}$$ $$x = \sqrt{(x^2+1)}$$ $$ x^2 = x^2+1$$  Which is a contradiction.   Thanks in advance.


How do i convert my column with the number of the months to the names of the months?For example: I  have the month column and it has 7,7,8,9 however i want it to display as July, July, August, September.

I have months stored in SQL Server as 1,2,3,4,...12. I would like to display them as January,February etc. Is there a function in SQL Server like MonthName(1) = January? I am trying to avoid a CASE statement, if possible.


By the given task, the numbers can be 000, 001, 002 and so on. How can I save this number format?   int i = 000; i++;  System.out.println(i);  //the output is 1 but I want 001   So how can I have the value of i like 001?

Is there some easy way to pad Strings in Java?  Seems like something that should be in some StringUtil-like API, but I can't find anything that does this.


hi im trying to make parts for the website i want to build and it's will be like: header.php, footer.php, etc... I want these files to work only when i include it and no one can directly access them. is there any way to do that please?

I have a php file which I will be using as exclusively as an include. Therefore I would like to throw an error instead of executing it when it's accessed directly by typing in the URL instead of being included.  Basically I need to do a check as follows in the php file:  if ( $REQUEST_URL == $URL_OF_CURRENT_PAGE ) die ("Direct access not premitted");   Is there an easy way to do this?


I want to add an event manager but, it won't work?   Console shows me   "ReferenceError: event is not defined"     document.getElementsByTagName('div')[0].addEventListener("mousemove", myFunction(event));  function myFunction(event) {     var x = event.pageX;     var y = event.pageY;     var coor = "Coordinates: (" + x + "," + y + ")";     document.getElementByTagName('p')[0].textContent = coor; }

The situation is somewhat like-  var someVar = some_other_function(); someObj.addEventListener("click", function(){     some_function(someVar); }, false);   The problem is that the value of someVar is not visible inside the listener function of the addEventListener, where it is probably being treated as a new variable.


Prove that $\mathcal{P}(\Bbb N)$ is not countable. Alternatively, prove that $|\mathcal{P}(\mathbb N)|\ne|\mathbb N|$.   (You may assume the following result from tutorial: If $S$ is infinite and countable, then there exists a bijection $f:S\rightarrow\mathbb N$.)  And I think when they say $\mathcal{P}(\mathbb N)$ they mean the power set.  I'm not sure about this questions, any tips would be great thanks!

Some explanations:  A set S is  if there exists an injective function $f$ from $S$ to the natural numbers ($f:S \rightarrow \mathbb{N}$).  $\{1,2,3,4\}, \mathbb{N},\mathbb{Z}, \mathbb{Q}$ are all countable.  $\mathbb{R}$ is not countable.  The  $\mathcal P(A) $ is defined as a set of all possible subsets of A, including the empty set and the whole set.  $\mathcal P (\{\})=\{\{\}\}, \mathcal P (\mathcal P(\{\}))=\{\{\}, \{\{\}\}\} $  $\mathcal P(\{1,2\})=\{\{\}, \{1\},\{2\},\{1,2\}\}$  My question is:  Is $\mathcal P(\mathbb{N})$ countable? How would an injective function $f:S \rightarrow \mathbb{N}$ look like?


Having a bit of difficulty identifying the appropriate ARIMA model by looking at ACF/PACFs.   I know that AR(1) models, the ACF has a geometric progression from its highest value at lag 1 and the PACF has a spike at lag 1 and then then cuts off afterwards.   Could someone possibly explain how I identify the rest? AR and MA please?!?

How do you estimate the appropriate forecast model for a time series by visual inspection of the ACF and PACF plots? Which one (i.e., ACF or PACF) tells the AR or the MA (or do they both)? Which part of the graphs tell you the seasonal and non-seasonal part for a seasonal ARIMA?  Consider the ACF and PCF functions displayed below.  They are from a log transformed series that's been differenced twice, one simple difference and one seasonal (, ).  How would you characterize the series? What model best fits it?