How to properly introduce notation in a mathematical article?

Question: The main result I am currently trying to publish is the proof of a classical result in optimization, but with weaker hypotheses. In the introduction of my draft, I intend to explain why this classical result is relevant and why its current hypotheses are too strong, but it is not possible to do that with English words and I need quite a lot of mathematical terms and notation. So my question is:

Where do I put sentences like "we denote by $X$ the idea $Y$" and "we say $X$ satisfies the property $Y$ when $Z$ happens" without losing the readers' attention?

I wrote all the notations I need, in the most organized way I could, and it fills an entire page with font size 10 and narrow margins. It looks tiresome and I am afraid people give up on reading it if this is the first thing they see on the paper, but I cannot explain anything without it.
Thanks in advance!
Comment: This is a difficult question that ponders many members of this site. For a precise answer it is formulated in a too general way. – Do your best, and let one or two friends in your department read it. To go over an "introduction" is a service that any mathematician colleague should render.
Comment: @ChristianBlatter I am surely going to do that, but since I know they might be very busy right now with online classes, I am saving that as a last resource. What motivated me to ask it in M.SE. is that I thought this was a common issue in pure mathematics. It is not that common in optimization since we usually motivate our results by mentioning applications. Thanks for the reply!
Answer: Writhing math is more art than science, but as a general rule, you want to put definitions and notations as close to their use as is reasonably possible. This generally helps in at least two situations your reader might find themselves in:
The reader is skimming and sees notation they don't recognize. It's reasonable to expect that they will first look in the immediate vicinity of where it was used - perhaps tracing backwards to its first use - to look for an explanation. If you put your definition right before the first use, they will probably find it.
The reader is reading from start to end and doesn't understand a definition's purpose. Conversely to the previous point, this reader will be well-served by having the notation be used right after it is introduced. In the best-case scenario, by the time you are defining anything in a paper, an attentive reader will already see why we want to make that definition and will therefore easily integrate the new notation into their understanding of the article.
Note that this advice precludes putting a huge chunk of prose whose only purpose is to introduce definitions and notation - such a block will be difficult for any reader to make use of. If you have a lot of notation or your article is very long (e.g. it is actually a book), you could include an alphabetized reference for notation that just lists symbols and what they mean (but this should be thought of as a table not as prose).
In practical advice, where you put definitions will depend on their purpose. If your proof centers around defining some novel object or collection of objects, you would want to give an informal big picture outline of your proof near the start of the article and then devote a chunk of text to formalizing that big picture - wherein you will introduce definitions. If a definition is used to kick off a series of lemmas, define it right before those lemmas and right after you give an outline of why it makes sense to define. If it's just a little trick to get you through a single lemma, define it in the body of that lemma.
Basically, you can ask yourself questions to decide where to put each definitions: Do you need it to sketch the broad outline of the proof? Define it at the start where you provide such an outline. Does it appear as a technical detail in several proofs? Define it before the first proof that needs it. etc.
Comment: @Koto Using a particular case sounds like a wise idea. I might also add the alternative of treating the final definition you want as a goal in the same way you'd treat a theorem as a goal - you first sketch why you want it (e.g. "We want an object that captures some intuitive quality of X") and then informally sketch how you'll get there - and then start defining things, treating definitions like equations which are explained in prose and situated in the larger picture - this takes some thought to write and leads to a larger section than just definitions alone, but is more easily read.
Comment: Thank you! But my problem is that the only definition I really need is the end of a long chain of definitions. I want the paper to be as short as possible and you gave me an idea. I think I can explain things better in a particular case that requires less notation.


Effect of an implication on inequalities

Question: So, I have just started self-studying Analysis, and I'm constantly running into the same problem. It's better that I illustrate the issue using an example.
$$(\forall n \in \mathbb{N}) (\forall a \in A) \space s + \frac{1}{n} \geq a \implies s +\frac{1}{n} \gt a \space \vee \space s+\frac{1}{n}=a $$
This is obviously the definition of an upper bound.
What I have noticed is that using an implication like this tends to make the problem a lot easier--given that there is a disjunction in the consequence of the implication. This makes me think that I have to prove only one of the two consequent arguments, but I feel very wary about doing so and avoid resorting to it. Is my apprehension warranted, or am I overthinking needlessly?
Also, for this particular implication, I wanted to ask how the quantifiers might carry over to the resulting arguments. Would they remain intact or might they change?
Answer: Since ≤ in words means less or equal I don't see the difference of just using it.Usually the = is easy here if s=a-1/n and the < is harder to prove. like in $\sqrt{ab}≤\frac{a+b}{2}$ the = is for a=b the < needs some effort,you should not prove only one.
what you mean for the quantifiers I don't know, quantifiers ar for variabkes not arguments.


How to deploy the project on Google App Engine by preserving the changes of other developers?

Question: Till now I was working alone on a project on Google App Engine. So I had to write the code and upload it on App Engine using gcloud app deploy project-path/app.yaml.
But now a bigger project has arrived. So a team has to work on it and everyone has their own systems. I simply want to ask how can we deploy project from different devices still preserving the changes made by other developers?  As everyone has to deploy their code on cloud for the same project. I searched over the web but found nothing. Is it even possible?
Thanks!
Answer: maybe this article will help you. It describes how to deploy from Gitlab to Google App Engine
https://medium.com/evenbit/an-easy-guide-to-automatically-deploy-your-google-app-engine-project-with-gitlab-ci-48cb84757125
Regards
Michael
Comment: I think this is the only option that I can do... Thanks for support :)


I think this is an awkwardly broken sewer cleanout cap...if so how to remove and replace?

Question: This is just outside the door to the laneway house and was broken after being stepped on and after doing some googling it looks like it's the sewer cleanout cap which is now broken awkwardly. I tried unscrewing it by hand but couldn't get it out. Any tips as to how I can remove it?
Should any 4 inch cap replacement work (it says 100 cm or 4 inches on the pipe)?
Also the plastic that was on top that broke off has fallen down the pipe - do I need to worry about that?
Thanks in advance!!
Comment: that is going to hurt you
Comment: Is it a thread-on cap?  You might want to stuff a towel or something down there, then bash the rest of it apart and vacuum out the bits.
Comment: Gasp the remaining part of the cap with a suitably gloved hand and try to turn it ACW. If that does not work, then attack with tools but only AFTER blocking the drain with a large towel or large mass of paper. It would be too easy to lose grip on some pliers, a saw or a chisel.
Answer: You can't do much about the plastic that has fallen down.
It could be the responsibility of you Council or Authority.
If not, then note the marking on the pipe and ask the store for a compatible cap.  There is also some writing on the cap which could help in its replacement.  Both are hard to read on the image.
Down here, water and sewage use different grades of pipes.  I suspect, that at most there will be two standards in your area.  As long as you look for a cap for a sewage grade pipe, you should be fine.


Importance Sampling in Unreal Engine Formula Derivation (Irradiance term)

Question: I am currently trying to understand IBL in Unreal Engine, and there are so much things that I don't understand about the formula. Unreal approximate the specular term of shading equation by doing split sum approximation.

This is how unreal pre-filter the environment map for specular-irradiance term.
<code>float3 PrefilterEnvMap(float Roughness, float3 R )
{
    float3 N = R;
    float3 V = R;
    float3 PrefilteredColor = 0;
    const uint NumSamples = 1024;
    for(uint i = 0; i < NumSamples; i++ )
    {
        float2 Xi = Hammersley( i, NumSamples );
        float3 H = ImportanceSampleGGX( Xi, Roughness, N );
        float3 L = 2 * dot  ( V, H ) * H - V;
        float NoL =saturate( dot  ( N, L ) );
        if ( NoL > 0 )
        {
            PrefilteredColor += EnvMap.SampleLevel( EnvMapSampler, L, 0 ).rgb * NoL;
            TotalWeight += NoL;
        }
    }
    return PrefilteredColor / TotalWeight;
}
</code>
My question is why does the total weight is the sum of saturate(dot(N,L)). My understanding on importance sampling is that we should divide our sample with the pdf we use to sample. In this case, from what I read at here the pdf should be
$$p_i(wm, wo) = \frac{D(wm)(wm \cdot wg)}{4|wo \cdot wm|}$$
My reference on pbr in unreal engine is here and here.
Answer: I just read notes on moving frostbite to pbr and I found the derivation of the method above. So I will just show the derivation here and quote some of the explanation.

One can notice an extra〈n·l〉in the LD term as well as a different
  weighting 1/(∑Ni〈n·l〉). These empirical terms have been introduce by
  Karis to allows to improve the reconstructed lighting integral which
  suffers from coarse hypothesis of separability of this integral.
  There is no mathematical derivation for these terms, goal was to have
  an exact match with a constant L(l).

So it turns out the pdf is weighted on the DFG term. As for dot(N,l), the term is introduced to minimize the error that is caused by split sum approximation. But I am actually still wondering what is the intuition on that empirical term.


Hibernate cache not working with RichFaces bean

Question: I'm having a bean that basically calls getSession().createCriteria(ObjClass.class).list(); each time a request is made. It takes 16 secs to load everything first time, then it takes like 1 or so. Thing is that in a unit test cache works great, but when multiple requests are made to a bean, it never even uses cache. Question is why?
Info: it's a second level hibernate (3.5.x) cache (2.0) with org.hibernate.cache.HashtableCacheProvider and query level cache usage turned on. Using richfaces 3.3.3 request scoped bean with keep alive enabled.
Answer: If you don't make the query cachable, it won't be cached:
getSession().createCriteria(ObjClass.class)
            .setCacheable(true)
            .list();

You could also set the cache region for more fine-grained configuration.
Comment: I don't make query cachable in tests and tests use same DAO as bean does.
Comment: Didn't help, it took 16 secs before, now it takes 17 first time and reduces down to 16.
Comment: Is the ObjClass class cacheable? Have you looked at the generated SQL queries?


How does the fundamental theorem of calculus work for 2 variables?

Question: The fundamental theorem of calculus for a single variables states the following:
Let:
$$U(x)=\int{f(x)}dx$$
Then:
$$\frac{d}{dx}U(x)=\frac{d}{dx}\int{f(x)}dx=f(x)$$
Now let $U$ be a function of 2 variables such that:
$$U(x,t)=\int{f(x,t)} dx$$
In this case, how would we find $U_x$ and $U_t$? Is the following correct?
$$U_x=\frac{\partial}{\partial{x}}U(x,t)=\frac{\partial}{\partial{x}}\int{f(x,t)}dx=f(x)$$
$$U_x=\frac{\partial}{\partial{t}}U(x,t)=\frac{\partial}{\partial{t}}\int{f(x,t)}dx=f(t)$$
Answer: The problem is ill-posed, perhaps you want to ask if $U(x,t)=\displaystyle\int f(x,t,s)ds$, what will happen to $U_{x}$ and $U_{t}$. If the partial derivatives $\dfrac{\partial f}{\partial x},\dfrac{\partial f}{\partial t}$ exist, continuous, and integrable, then Lebesgue Dominated Convergence Theorem implies that $U_{x}=\displaystyle\int\dfrac{\partial f}{\partial x}(x,t,s)ds$ and $U_{t}=\displaystyle\int\dfrac{\partial f}{\partial t}(x,t,s)ds$.


Column name is specified more than once EF Code First Migration

Question: I have two columns in a table which I created them using code first approach then I changed their data types in the C# model not the actual database and last I tried the later migration in order to change their data type in the database
<code>public partial class PriceAndMargin : DbMigration
{
    public override void Up()
    {
        AddColumn("dbo.Items", "Price", c => c.Int(nullable: false));
        AddColumn("dbo.Items", "ShortageMargin", c => c.Int(nullable: false));
    }

    public override void Down()
    {
        DropColumn("dbo.Items", "ShortageMargin");
        DropColumn("dbo.Items", "Price");
    }
}
</code>
If I got it write this code should drop the Price column and the ShortageMargin column and recreates them
but instead it displays this message in the console for me

Column names in each table must be unique. Column name 'Price' in table 'dbo.Items' is specified more than once

thanks in advance
Comment: Describe your entire workflow. Did you add the Price column to the table yourself, or in an earlier migration?
Comment: no I used the above migration @CodeCaster
Comment: The steps you took are unclear, and the code does not correspond to your description. The migration you show adds two columns. One of the columns already exists.
Comment: I wrote above that those two columns already existed but with different data types I created them using code first approach then I changed their data types in the C# model not the actual database and last I tried to migration above in order to change their data type in the database @CodeCaster
Comment: shouldn't the DropColumn solve this problem @marc_s
Answer:
If I got it write this code should drop the Price column and the ShortageMargin column and recreates them

Not really, your "up" adds the columns. The "down" section is only if you want to "downgrade" your database (ou revert the migration).
I don't know how you changed the type of your object, and from which version you ran the 'add-migration' command but you should have a script with "AlterColumn instead of AddColumn


What does this quotation marks represent in System.out.println()?

Question: I wonder why the double quotation marks is not shown in the actual output - just after the equal sign:
String word = "" + c1 + c2 + "ll";

The full code as follows:
public class InstantMethodsIndexOf
{
    public void start()
    {
        String greeting = new String ("Hello World");

        int position = greeting.indexOf('r');
        char c1 = greeting.charAt(position + 2);
        char c2 = greeting.charAt(position - 1);

        **String word = "" + c1 + c2 + "ll";**

        System.out.println(word);
    }
}

Comment: You could try `String.valueOf()` instead of `"" + x`. It might be less confusing
Answer: When you pass "" to a String you are passing an empty String.  You need to escape the quotation with a back slash if you want to print them.
Example:
String word = "\"" + c1 + c2 + "ll\"";

then System.out.println(word) will print:

"Hell"

As you can see I am escaping one double quotation at the beginning and another at the end
(Assuming c1 == 'H' and c2 == 'e')
Answer: The quotation mark does not appear because you have none being printed. What you have is an empty string being concatenated with other contents.
If you need the quotation mark, then you shoud do the following:
String word = "\"" + c1 + c2 + "ll";

Answer: It's a way to let Java know that it will be a string straight from the beginning, since "" is a String object of an empty string.
In your code, it doesn't really look useful. But following is an example where it would be:
int a=10, b=20;
String word = a + b + "he"; // word = "30he"
String word2 = "" + a + b + "he"; // word2 = "1020he"

Answer:
I wonder why the double quotation marks is not shown in the actual
  output - just after the equal sign:

In java String represented by the use of double quotes means the data between double quotes is considered as String value but if you want to include double quotes you have to use escape character \".
Moreover I suggest you to use StringBuilder and append your characters and String into it and use toString to print.
String str="ABC";//So value of String literal is ABC not "ABC"
String empty="";//is just empty but NOT Null
String quote="\"";//Here String has value " (One Double Quote)

Answer:
I wonder why the double quotation marks is not shown in the actual
  output - just after the equal sign:

String word = "" + c1 + c2 + "ll";

You are declaring a String that concatenates:

The empty String ""
c1
c2
The String literal "ll"

To show the quotes and make the code easier to read, try:
   String word = '\u0022' + c1 + c2 + "ll"

which uses the unicode character value to print the double quote
Answer: This code
String greeting = "Hello World";         // <-- no need for new String()
int position = greeting.indexOf('r');    // <-- 8
char c1 = greeting.charAt(position + 2); // <-- 'd'
char c2 = greeting.charAt(position - 1); // <-- 'o'
String word = "" + c1 + c2 + "ll";       // <-- "" + 'd' + 'o' + "ll"

The empty String "" is used to coerce the arithmetic to a String, so it could also be written as
StringBuilder sb = new StringBuilder();
sb.append(c1).append(c2).append("ll");
String word = sb.toString();

or
StringBuilder sb = new StringBuilder("ll");
sb.insert(0, c2);
sb.insert(0, c1);
String word = sb.toString();

If you wanted to include double quotes in your word, your could escape them with a \\ or use a character -
char c1 = greeting.charAt(position + 2); // <-- 'd'
char c2 = greeting.charAt(position - 1); // <-- 'o'
String word = "\"" + c1 + c2 + "ll\"";   // <-- "\"" + 'd' + 'o' + "ll\""

or
String word = "" + '"' + c1 + c2 + "ll" + '"';


Installing Ubuntu on HDD alongside with Windows 10 on SSD

Question: I have an Acer Predator Helios 300 with Windows on SSD and unallocated space on HDD. I'm planning on installing Ubuntu 19.04 on the HDD.
Some queries:

Do I need to manually set the partitions or will Ubuntu do it for me?
Where will the bootloader reside and will there be any complications due to different drives where the OSs will reside?
I have Nvidia GTX1050TI graphics. Do I need to set noveau.modeset = 0 in GRUB before booting from USB to install?
Comment: Possible duplicate of [How do I install Ubuntu alongside a pre-installed Windows with UEFI?](https://askubuntu.com/questions/221835/how-do-i-install-ubuntu-alongside-a-pre-installed-windows-with-uefi)
Answer:
No, you can pick "alongside" when it sees "unallocated space" but I would advice to manually set this up. I tend to put 25Gb in /, 10Gb in /home both on my SSD and the remainder to a data partition (on my HDD) where I store my personal files.
The 1st disk. The manual option lets you change it and will provide a drop down with possible locations. 2b: not that I am aware off.
Maybe, maybe not. I never needed to (I have a GTX1060). The installer crashed once on me but that was after the install was finished (at the "remove USB and reboot" part of the installation. 1 difference: I had both Windows and Ubuntu base on the SSD before I nuked Windows. Ubuntu benefits a lot from being on the SSD: I get a 7 seconds boot from it. With the HDD it is going to be bit longer to boot.


Softcode Jquery Ajax Data Key

Question: I am new to Javascript and Jquery and I'm trying to make a function for a flexible api call. What I'm wondering is: is there a way to soft code ajax Data keys?
For example:
var call = $.ajax({
    url: url,
    data: {Param: paramValue},
    success: successFunction,
    error: errorFunction
  });

where Param is not an actual parameter in the api call like url/api?Param=paramvalue, rather a variable I had defined earlier like Param = userInput(). So that if the user enters 'metrics' , I will call url/api?metrics.
If not, is there another way of doing this that I should be made aware of?
Thanks for your thoughts!
Answer: Well, you could use this way to define the data object :
var param = "metrics";
var data = {};
data[param] = "";
var call = $.ajax({
    url: url,
    data: data,
    success: successFunction,
    error: errorFunction
});

Softcode Jquery Ajax Data Key


ggplot2 legend showing point on top a line: how to prevent it?

Question: How to prevent ggplot2 from having a legend like this

I have the following code
ggplot(dStat_cCode[AgentID==1 & SimulationID==1,,], aes(x=lag, y=log10(em_autoCorr_cCode), colour = "data")) +
  geom_point(size=1)+
  #geom_line(data = d[N==specN & abs(displacement) < episodeLength & AgentID==specAgentID,], aes(alpha = (AgentID==specAgentID)))+
  stat_summary_bin(fun.data = mean_se, bins=50)+
  #coord_trans(y = "log10")+
  geom_line(aes(y=log10(fem_autoCorr_cCode), colour = "fit"), size=1, alpha=1)+
  scale_color_manual(values = c("black", "#fc8d62"))+
  scale_fill_manual(values = c("black", "#fc8d62"))

And I want it to have the usual type of legend for a line, not a point on top of a line as above.
Answer: All of the geom_ and stat_ layers in ggplot2 take an argument show.legend which defaults to NA. Set it to FALSE for any layer you do not want to show up in the legend.


Linking Tensforflow in Visual Studio project

Question: I've built TensorFlow with GPU Support (lastest stable version 1.10.1) with CUDA 9 and CUDNN 7.0. After that, when I link the shared libs which it's built and including the headers, I have always the next errors:

The main problem appear in "logging.h" file at this directive:
TF_DEFINE_CHECK_OP_IMPL(Check_EQ,
                    ==)  // Compilation error with CHECK_EQ(NULL, x)?
TF_DEFINE_CHECK_OP_IMPL(Check_NE, !=)  // Use CHECK(x == NULL) instead.
TF_DEFINE_CHECK_OP_IMPL(Check_LE, <=)
TF_DEFINE_CHECK_OP_IMPL(Check_LT, <)
TF_DEFINE_CHECK_OP_IMPL(Check_GE, >=)
TF_DEFINE_CHECK_OP_IMPL(Check_GT, >)
#undef TF_DEFINE_CHECK_OP_IMPL

So, I don't understand what is happening, so anyone had similar troubles?
Thanks in advance.
Comment: Since you've already built it, if these are defining things you aren't using in your code then you could try just commenting out the lines that don't compile and see if you can get away without them? But to fix this it looks like you'll need to work through the macros and work out what's missing, and see if you can understand why it was defined when you built Tensorflow in the first place.
Answer: It is a problem of MSVC. You should add an #define NOMINMAX on top of your source file.
Answer: Tensorflow currently does not support being built on Windows (see Installing Tensorflow from Sources).


How do I get the list of SOAP services exposed by WSO2 Identity Server?

Question: I've recently started looking at WSO2 Identity Server as an alternative to what my company is currently using.
I'm finding it difficult to determine what SOAP and REST services are exposed and what the URLs for those are.
I've tried starting the server (on my Windows machine) with wso2server.bat -DosgiConosle , but I can't seem to get the OSGi console after the server has started.
Is there any other way to get the list of services exposed by the product?
Also, I'm not aware of the service API being documented and made available - Are there plans to do this?
Any help in getting the list of services or an instruction on how to do it would be greatly appreciated.
Answer: WSO2 products currently do not have a documented service API. However you can use OSGi console to view the available service components details.
Make sure that when you start WSO2 IS with osgi console the following log is visible, which says that the console is enabled.
sh wso2server.sh -DosgiConsole

JAVA_HOME environment variable is set to /jdk1.6.0_30
CARBON_HOME environment variable is set to /wso2is-4.1.0
OSGi console has been enabled with options: -console
After server is properly started, press enter and osgi> console will be displayed.
[2013-07-24 16:33:57,215]  INFO {org.wso2.carbon.core.internal.StartupFinalizerServiceComponent} -  WSO2 Carbon started in 17 sec
[2013-07-24 16:33:57,437]  INFO {org.wso2.carbon.ui.internal.CarbonUIServiceComponent} -  Mgt Console URL  : https://localhost:9443/carbon/

osgi>

By entering necessary osgi commands you can see the activated OSGI service etc. For example if you need to see available services use,
osgi> services
This will list down all the services in the runtime. Use appropriate filters to find the WSO2 IS services by referring this blog post.
osgi> ls
This shows all the osgi service components along with their component ID and life-cycle status. If you need to now on particular service component use ls -c  command.
The following question thread has useful information on WSO2 IS API too.
WSO2 identity server api
Answer: start the server with the following command(case sensitive)
wso2server.bat -DosgiConsole

and you should see the  osgi> console
Answer: This link leads to an information how to list admin services exposed on WSO2 product (osgi console must be enabled)
List all ws in wso2
Answer: 1) Start the server with osgi console.
wso2server.bat -DosgiConsole

2) Run following command 'listAdminServices'
osgi> listAdminServices

This should show all the admin services exposed by the server.


How can I open old Gnome Keyring files?

Question: I know the password to my old Gnome Keyring files, but how can I open them from my new installation? [1] The keyring import option doesn't recognise the .keyring and .keystore.abc files in the old .local/share/keyrings folder.
Is there another way to open them?
[1] I don't have my old installation anymore, only the home folder.
Answer: Any .keyring files in the ~/.local/share/keyrings/ folder, should be read by the keyring automatically. However, applications may not necessarily try to read any data from them. You should be able to see them in the list inside the Passwords and Keys (seahorse) application. You should be able to unlock them inside there, to browse and view the secrets.
Comment: Currently, in 2022, Ubuntu 20.04, this no longer works
Comment: so I could rename my old keyring file to old.keyring, move all the old files into the new keyring folder, and Seahorse will pick up old.keyring and its .keystore.abc files?
Comment: It should just work, yes. It worked for me, when I moved in an old keyring from an old home directory.

How can I open old Gnome Keyring files?


How valuable is mastery as a mitigation stat for a warrior tank?

Question: Can anyone provide some math on precisely how valuable mastery is as a mitigation stat versus the other mitigation/avoidance stats?
Note that I'm not concerned with how the different stats affect healers.  I realize a less-spiky damage intake is better for healers, making mastery more desirable, but for the purposes of this question let's assume I'm just trying to take as little damage as possible.
Ideally I'd like a concise summary of the following for a 300 second patchwerk-style fight in a normal 10-man cataclysm raid:

Total mitigated damage per point of mastery rating with the block value meta
Total mitigated damage per point of mastery rating without the block value meta
Total avoided damage per point of dodge rating.
Total avoided damage per point of parry rating.

Here are my stats for DR considerations:
 - Armor:   35464
 - Mastery: 21.18   (2363 rating)
 - Dodge:    8.81   (850 rating)
 - Parry:   14.73   (1931 rating)

Let's also assume for simplicity's sake that I use Shield Block on cooldown.
Bonus points if you want to do calculations for a 10-man heroic and both 25-man modes.
Super bonus points if you can give me a concise formula (pseudocode, excel, whatever) where I can input my stats and output each of the values.
Answer: For protection warriors, Mastery is actually a great stat.
This thread on elitistjerks.com contains good theorycrafting data for protection warriors; particularly this section:

Survival Stat Priority:
Stamina > Mastery > Parry > Dodge
Stamina is still your best stat, but not to the extent of sacrificing everything else as was the case in WotLK. Conserving healer mana is a very real concern now. Mastery is your best stat for smoothing out incoming physical damage, and also increases rage generation through blocks. Parry provides the same avoidance level as Dodge now, but also procs the Hold the Line talent. Dodge will become more valuable as gear ratings climb higher to reduce diminishing returns losses from over-stacking the other stats.

For specific calculations, WarTotem over at TankSpot has made a lovely spreadsheet containing all the information you should need!
An important point is the "point of unhittableness" (ie when you have a combined chance of 102.4% to dodge, parry or block), at which point a boss can no  longer "hit" you, only block dodge or parry. At this point mastery becomes an even better stat than it was before, since 60% damage reduction from a block is better than 30% damage reduction from a block!
You can also read through both threads for detailed discussions of the mechanics involved by people an awful lot smarter and more in-the-know than I am!
Answer: Here are the results I came up with using the spreadsheet referenced in Nellius' answer.
Damage Mitigated Per Point of:
Mastery w/ meta:  293.75
Mastery w/o meta: 284.27
Dodge:            328.03
Parry:            290.64

That's for a 300 second fight with full raid buffs, unmitigated boss damage of 110k, boss swing timer of 2.4 seconds.
The high value for dodge is probably due to my reforging choices.  If my dodge and parry were split evenly (1390/1391 rating) here are the new values:
Mastery w/ meta:  292.79
Mastery w/o meta: 283.35
Dodge:            300.81
Parry:            317.01

It's also interesting to note that this change reduces the overall damage taken by 5725.6.
Obviously YMMV due to the overwhelming number of factors that contribute to survivability. Definitely use the tankspot spreadsheet to generate your own numbers.


Dominated convergence theorem for spectral measure

Question: Okay, I posed my question maybe a little bit to vague:
What I have in mind is the following:
Let $L$ be a generator of a semigroup $(P_t)_{t \ge 0}$ with $\langle x,Lx \rangle \le 0$ defined on $D(L) = \{ f ; \lim_{t \downarrow 0} \frac{P_tf-f}{t} \text{ exists}\}.$
Now, assume that $L$ is self-adjoint on this domain, so
$$L = \int_{0}^{\infty} - \lambda dE.$$
Then I claim that the $P_t \in L(H)$ can be written as $P_t:= \int_{0}^{\infty} e^{-\lambda t} dE.$
Now, I want to show that by this definition of $P_t$ I can actually recover $L$ in the following sense:
$$\frac{\int_{0}^{\infty} e^{-\lambda t} dE(f)-\int_{0}^{\infty} dE(f)}{t}$$ exists (for $t \downarrow 0$)if and only if $f \in D(L)$ and equals in this case $L(f).$
I think everybody is tempted to differentiate under the integral sign, but I am not sure how to make this rigorous.
Comment: Integrable with respect to what? There are many integrals possible, one for each $x$. For example $\|T_n x\|^{2}=\int_{\mathbb{R}}|f_n(\lambda)|^{2}d\|E(\lambda)x\|^{2}$
Comment: @TrialAndError: I think it would be sufficient if $g$ is integrable w.r.t. the total variation of the measure $E$.
Comment: @gerw : What is your definition of total variation of the spectral measure $E$?
Comment: As usual: $|E|(A) = \sup_{\pi} \sum_{B \in \pi} \|E(B)\|$ and the supremum ranges over all finite partitions of $A$ into pairwise disjoint measurable sets, see also https://en.wikipedia.org/wiki/Total_variation#Total_variation_norm_of_vector-valued_measures.
Comment: @gerw : $\|E(B)\|=1$ if $E(B)\ne 0$. I think you have to stick with convergence that is appropriate for any measure. Bounded convergence, of Borel functions, for example, to a Borel function. Or $g$ has to be integrable with respect to every measure $\mu_{x}(B)=\|E(B)x\|^{2}$.
Comment: Oh, yes. Not many $g$ are integrable in this case and my comment appears to be useless.
Comment: @TrialAndError I updated the question in a more hopefully more clear way
Answer: The difference you have is deceptively singular. For $f\in \mathcal{D}(A)$,
$$
        \frac{1}{t}\left[\int_{0}^{\infty}e^{-\lambda t}dE(\lambda)f-\int_{0}^{\infty}e^{-\lambda t}dE(\lambda)f\right]-\int_{0}^{\infty}(-\lambda)dE(\lambda)f \\
      =\int_{0}^{\infty}\left[\frac{e^{-\lambda t}-1}{t}+\lambda\right]dE(\lambda)f \\
      =\int_{0}^{\infty}\left[-\int_{0}^{\lambda}e^{-\mu t}d\mu+\lambda\right]dE(\lambda)f \\
      =\int_{0}^{\infty}\left[\int_{0}^{\lambda}(1-e^{-\mu t})d\mu\right] dE(\lambda)f
$$
Therefore,
$$
       \left\|\frac{1}{t}\{P(t)-I\}f-(-A)f\right\|^{2}
          =\int_{0}^{\infty}\left|\frac{1}{\lambda}\int_{0}^{\lambda}(1-e^{-\mu t})d\mu\right|^{2}\lambda^{2}d\|E(\lambda)f\|^{2}
$$
Now you can use dominated convergence because
$$
                \|Af\|^{2} = \int_{0}^{\infty}\lambda^{2}d\|E(\lambda)f\|^{2} < \infty,
$$
and because the following remains uniformly bounded by $1$ for $\lambda\in (0,\infty)$ and converges pointwise everywhere to $0$ on $(0,\infty)$ as $t\downarrow 0$:
$$
     \left|\frac{1}{\lambda}\int_{0}^{\lambda}(1-e^{-\mu t})d\mu\right|^{2}
$$
There is an issue if $E\{0\}f \ne 0$, but that extra part is handled easily and separately.
Comment: By the way: If I knew that my $C_0$ semigroup $(P_t)_t$ consists of bounded self-adjoint operator $P_t \in L(H),$ does this conversely imply that the generator $L$ is self-adjoint, too. The converse is a consequence of the spectral theorem as I was just trying to show. But do you know if the impliciation $P_t$ s.a. then $L$ too, also holds?
Comment: Let's see. If $(P(t)x,y)=(x,P(t)y)$ for all $t \ge 0$, then $(P'(0)x,y)=(x,P'(0)y)$ for all $x$, $y$, which is enough to give a selfadjoint $L=P'(0)$ if $L$ is bounded. So, I'd have to say yes in that case.
Comment: @user167575 : If $P$ is a bounded selfadjoint $C^{0}$ semigroup, then $P'(0)=L$ is symmetric on its domain by the previous comment, and $\int_{0}^{\infty}e^{-t\lambda}P(t)xdt= (\lambda I - L)^{-1}x$ exists for $\Re\lambda > 0$, which is enough to force $L$ be selfadjoint and negative. So $-L$ will be a positive selfadjoint operator in that case. I believe that is correct.
Comment: ah, so here we only use the dominated convergence theorem for standard Borel measures, as $\mu_x:=\langle Ex,x,\rangle$ is one, right?


Why wont my villagers breed?

Question: I've been playing on a 1.16.4 single player world. I've been working on getting some OP villagers and I need to get two different enchanted books. I'm breeding them because the village was left with only two villagers. I'm doing it again since my fifth villager didn't become a zombie villager when I tried to turn him to one so I can get the good discounts. I've bred my other three a few times, once with one pair and twice with one from the other pair and my third one. I tried this time twice with the second pair and then tried with the pair I haven't before but it didn't work. I just thought to try with my fourth villager and another one. It didn't work and the clouds appeared above their heads. I was confused because I thought that you got the cloud effect because of the same pair of villagers have been bred too much together, which is why I tried with different pairs. I tried again after giving them potatoes again but the clouds happened again. Is it because one is a librarian and an unemployed villager? I'm very sure that I've set it up correctly but I could be wrong, so that's why I've come here. I really need this so I can get better armor to fight the Ender Dragon. The picture is the set up, not very complicated but it has worked so I'm pretty sure it works.
Comment: Have you read the [wiki](https://minecraft.gamepedia.com/Villager#Breeding) on how it all works? At the moment you haven't got much information on how exactly your set up is going. The main thing you'll need to accommodate for is the number of beds, or move the bred villagers away from the beds used for breeding
Comment: This same set up has worked well. I give them both 12 potatoes then put them together. I place a bed and it normally works. The room is 4 blocks tall which should be fine. I've read the wiki about the breeding and willingness and I'm pretty sure its all fine, but I'll look over it again
Comment: Each *new* villager requires their *own* bed. That's the main change. If you have the same number of villagers and beds, they will not breed, as there are no free beds to fill.
Comment: I'll try again with more beds, just a bit confused why that would be the issue if it's worked before placing only one to three beds with three or four villagers.
Comment: Just an update, it did work, thanks man.
Answer: The cloud effect appears when there are no free beds for the child to occupy. There must be a pathfindable (not necessarily reachable; caveats like trapdoors etc apply) bed not assigned to any other villager within reach from the point the two villagers attempt breeding.
The mechanics of bed assignment are slightly buggy; sometimes a bed remains assigned even though the villager is no longer among us. I'd suggest breaking and replacing all the beds, and possibly if you don't have some clever breeding setup, just placing lots of beds within reach.

Why wont my villagers breed?


What is ".v8flags.22.214.171.124.{Name}"?

Question: I am doing a clean install of Windows 10 Professional (x64) and am noticing some peculiar files appearing in the root of my home directory, specifically I see...
.v8flags.220.127.116.11.Ciel
Ciel is obviously my username; I've tried to do a search on this file and found very little - the best I can tell is that it relates to nodejs, which might make sense because I have Visual Studio 2015 installed.
Can anyone else identify what this file is, and if I need to keep it?
Comment: [V8](https://developers.google.com/v8/) is the Googles Javascript Engine and that file of yours can be related to either Google Chrome (as in the web browser) or Node.js (since Node runs on V8). As for the rest of the filename, `flags` are usually referenced to enabling `experimental` features.
Comment: the file is used by this node.js module: https://github.com/js-cli/js-v8flags/blob/master/index.js#L11
Comment: Thank you, guys. Is it safe to remove or hide? Or do I need to leave it alone?
Answer: You can safely delete it.
The file is used by the nodejs module v8flags for caching. If you delete it it will create a new one on next run.
I guess it was created because Gulp depends on v8flags and:

The ASP.NET 5 templates included in Visual Studio 2015 use Gulp, and they install Gulp into your project's node_components folder so it's all ready for you to use in your project.

https://msdn.microsoft.com/en-us/magazine/mt595751.aspx
Update: The new name of the file is .v8flags.{version}.{md5-hash-of-username}.json.
Comment: `vi8flags` also seems to be used by slack and spotify in inux

What is ".v8flags.3.14.5.9.{Name}"?


Certain uniform approximations of a bounded uniformly continuous function

Question: Let $u:\mathbb{R}^N \to \mathbb{R}$ be a bounded and uniformly continuous function.
(a) Do there exist and (b) how can we construct three families of functions $u_\epsilon:\mathbb{R}^N \to \mathbb{R}$ ($\epsilon \to 0^+$) such that $u_\epsilon \to u$ uniformly (not just locally uniformly) and respectively

$u_\epsilon \in C^\infty(\mathbb{R}^N)$
$u_\epsilon \in \mathrm{Lipschitz \ and \ bounded}(\mathbb{R}^N)$
$u_\epsilon \in C^2(\mathbb{R}^N)$ bounded and with bounded derivatives up to the second?

I'm aware that if $u$ is continuous then the family of the standard mollifications tends to $u$ locally uniformly.
Comment: For 2. here is a sequence $u_n(x):=\inf\{u(y)+n\|x-y\|\mid y\in \Bbb R^n\}$. Lipschitz can be seen directly, uniform convergence:
Let $\delta>0$, there exists an $n$ so that $u_n(x)=\inf\{ u(y)+n\|x-y\|\mid y\in B_\delta(x)\}$ for all $x$. This follows from boundedness of $u$ (you have an $n$ after which if $y\notin B_\delta(x)$ you have $n\|x-y\|≥2\|u\|$). From uniform continuity: For every $\epsilon$ you have a $\delta$ so that $|u(x)-u(y)|<\epsilon$ whenever $\|x-y\|<\delta$. Take the associated $n$ and if $y\in B_\delta(x)$:
$$0≤u(x)-u_n(x)≤u(x)-u(y)-n\|x-y\|≤|u(x)-u(y)|<\epsilon$$
Answer:
The standard proof of the convergence of convolutions works here if you choose a compactly supported mollifier $\rho$. For every $\delta>0$ take the $\epsilon$ given by the uniform continuity of $u$, i.e. $|x-y|\leq \epsilon\implies |u(x)-u(y)|\leq \delta$. Choose $\rho_\epsilon$ mollifier such that $\text{supp}\,\rho_\epsilon\subset B(0,\epsilon)$. Then
\begin{align}
|u*\rho_\epsilon(x)-f(x)|&=\left|\,\int\limits_{\mathbb R^n} (u(x-y)-u(x))\rho_\epsilon(y)dy\right|\\
&\leq \int\limits_{\mathbb R^n}|u(x-y)-u(x)|\rho_\epsilon(y)dy\\
&=\int\limits_{B(0,\epsilon)}|u(x-y)-u(x)|\rho_\epsilon(y)dy\leq\delta.
\end{align}
To obtain $u_\epsilon$ evaluate $u$ at the points of $L_\epsilon:=\epsilon\mathbb Z^n$, divide every $\epsilon$-cube in simplices and interpolate affinely inside every simplex. Uniform continuity gives Lipschitzianity of $u|_{L_\epsilon}$, while the Lipschitzianity of the interpolation follows by the fact that
$$\|A\|_*:=\sum_{i=1}^n|Av_i|$$
is a norm on the $n\times n$ matrices if $v_1,\ldots,v_n$ are fixed linearly independent vectors, and in finite dimension all norms are equivalent. Apply this with $v_i$ equal to the edges of the simplices.
EDIT: adding some details. Anyway, now that I won't use these functions for point 3 anymore, I think the cleanest way is the one suggested by s.harp in the comments.
By u.c. we have that $\exists\epsilon$ such that $|u(x)-u(y)|\leq 1$ if $|x-y|\leq \epsilon$. This implies that $u|_{L_\epsilon}$ is $1/\epsilon$-Lipschitz. Now divide each cube of $L_\epsilon$ in a finite number of simplices ("hypertetrahedra") whose vertices lie in $L_\epsilon$, and interpolate linearly inside each of them (in dimension $2$ this would mean divide every square in two right triangles). Now use this:
Lemma Let $S=\{0,v_1,\ldots,v_n\}\subset \mathbb R^n$ with $v_1,\ldots,v_n$ unit vectors linearly independent, and suppose $u\colon S\to\mathbb R$ is $L$-Lipschitz on $S$, i.e. $$L=\text{Lip}(u,S):=\sup_{x,y\in S,x\neq y}\frac{|f(x)-f(y)|}{|x-y|}.$$
Then the unique affine extension of $u$ to $\text{conv}(0,e_1\ldots,e_n)$ is $CL$-Lipschitz, where $C$ depends only on the vectors $v_1,\ldots,v_n$ and is invariant under isometries and dilations.
Proof. Call $A$ the linear interpolation. The Lipschitz constant of $A$ coincides with the operatorial norm $\sup_{|x|=1}|Ax|$, which is equivalent to $\|A\|_*$ defined above because of the finitness of the dimension, which in turn is less than $n\text{Lip}(u,S)$.
From this you obtain that the Lipschitz constant of the extension is controlled by the Lipschitz constant of $f|_{L_\epsilon}$, which is finite.
This is not possible in general if you require equiboundedness of second derivatives. Consider in $\mathbb R$ the function $u(x)=\sqrt{|x|}$. Suppose that $u_\epsilon\to u$ uniformly and that $u_\epsilon$ are $C^2$. Then, by the uniform convergence, $u_\epsilon'(x)$ will eventually (in $\epsilon$) be really high near positive zero, and really low near negative zero (apply Lagrange). In particular for every constant $M$ we can find points $x,y$ such that $|x-y|\leq 1$ and such that for every sufficiently small $\epsilon$ we have $|u'_\epsilon (x)-u_\epsilon'(y)| \geq M$. However, by the FTC
$$|u'(y)-u'(x)|=\left|\int_x^y u''(t)dt\right|\leq \|u''\|_\infty|x-y|$$
which is a contradiction.
If instead you just require boundedness of each second derivative, I believe that a suitable convolution with the functions $u_\epsilon$ at point 2 will do. This essentially because the change in the first derivatives of $u_\epsilon$ between two near simplices is at most given by twice the Lipschitz constant, and happens at lengthscale $\epsilon$. Therefore a convolution with a mollifier with support of lengthscale $\sim\epsilon$ will make a smooth transition of first derivatives between a simplex and a neighbour, hopefully mantaining a second derivative of order $\sim 1/\epsilon$.
EDIT Without the uniform boundedness it is sufficient to use the same convolutions as point 1. Indeed
$$\|\partial^2_{ij}(u*\rho)\|_\infty=\|u*(\partial^2_{ij}\rho)\|_\infty\leq \|u\|_\infty \|\partial_{ij}^2\rho\|_1$$
which is finite if $\rho$ is regular and has compact support.
Comment: Thanks for your answer! I'm not really familiar with approximation theory, can you expand point (2) by adding some details? For point (3), I updated my question because what I meant was $C^2$, bounded, and with bounded first and second derivatives and, at least for now, I'm not concerned that the bound is uniform for all the functions in the family.
Comment: @Ryo I'll add some details when I have some time


Is there a way to change Kyogre's nature or any of the legendaries?

Question: I would like to "choose" the nature of Kyogre and the legendaries. When is the best time to save? Before the battle? Or is it unchangeable?
Answer: Save immediately before the battle. For legendaries, the nature, IVs, and shininess are chosen when you enter battle with that Pokemon for the first time. For traveling Pokemon, this means they are locked the first time and won't change for repeat encounters, but for one-off legendaries like Kyogre, this means you can simply save before the battle and reload over and over until you get one you like.


Find side BC of a triangle given AB, AC, and a relation between $\angle A$ and $\angle B$

Question: A question from my class:

In   triangle $ABC$, $3\angle A+2\angle B=180$ and $AB=10, AC=4$. So question is,  what all can we comment on side $BC$.  Can we find its exact length?

I have a crude solution involving trigonometry and a equation, but it's too large. So, can anybody help me?
Comment: If it makes sense, then it's fine. Maybe you are searching for a more elegant way, then I  suggest you to report your solution and specify your new requirement
Answer: Hint:
You can use the Law of Sines and the Law of Cosines
Comment: I did, but it became a big equation.  so I had to quit that method
Comment: You can express $\angle C$ and $\angle B$ in terms of $\angle A$. Using the Law of sines and the formula of sine of sum of angles you get to:
$$\frac{10}{\cos (A/2)} = \frac{4}{\sin (3A/2)} = \frac{BC}{\sin A}$$
Answer: Let $\frac{A}{2} = \beta$
$10(4\cos^3\beta - 3\cos \beta)= 4\cos \beta$
Since $\cos\beta$ is not equal to zero (if it were equal to zero, then A would be $180^\circ$ and the triangle would not exist),
$40\cos^2\beta=34$
$\cos^2\beta=\frac{17}{20}$, $\sin^2\beta=\frac{3}{20}$
$\cos A= \cos 2 \beta = \cos^2\beta - \sin^2\beta = 0.7$
$\angle A = 45.6^\circ$
$\angle B = 21.6^\circ$
It is not necessary to know the value of $\angle B$ to determine the value of $BC$, but it helps to verify that $3\angle A + 2\angle B = 180^\circ$
$$\frac{10}{\cos \left(\frac{45.6^\circ}{2}\right)} = \frac{BC}{\sin 45.6^\circ}$$
$BC =7.75$


Checkers Applet problems

Question: I am writing an applet that makes checkers run at the same speeds back and forth opposite one another. The bottom checker however is running much faster than the top one. How would i correct it so they run at the same speed back and forth. Im guessing it has something to do with the for loops but i cannot figure it out.
<code>import java.awt.*;

import java.awt.Graphics;
import java.awt.Color;
import java.awt.Image;

public class Checkers extends java.applet.Applet implements Runnable {

  Thread runner;
  int x1pos;
  int x2pos;
  Image offscreenImg;
  Graphics offscreenG;

  public void init() {
    offscreenImg = createImage(this.size().width, this.size().height);
    offscreenG = offscreenImg.getGraphics();
  }

  public void start() {
    if (runner == null); {
      runner = new Thread(this);
      runner.start();
    }
  }

  public void stop() {
    if (runner != null) {
      runner.stop();
      runner = null;
    }
  }

  public void run() {
    while (true) {
      for (x1pos = 5; x1pos <= 105; x1pos+=4)
      {
      for (x2pos = 105; x2pos >= 5; x2pos-=4)
       {
        repaint ();
        try { Thread.sleep(10); }
        catch (InterruptedException e) { }
      }
      repaint();
        try { Thread.sleep(100); }
        catch (InterruptedException e) { }
       }
     x1pos = 5;
     x2pos = 105;
    }
  }

  public void update(Graphics g) {
     paint(g);
  }

  public void paint(Graphics g) {
    // Draw background onto the buffer area
    offscreenG.setColor(Color.black);
    offscreenG.fillRect(0,0,100,100);
    offscreenG.setColor(Color.blue);
    offscreenG.fillRect(100,0,100,100);
    offscreenG.setColor(Color.blue);
    offscreenG.fillRect(0,100,100,100);
    offscreenG.setColor(Color.black);
    offscreenG.fillRect(100,100,100,100);

    // Draw checker
    offscreenG.setColor(Color.red);
    offscreenG.fillOval(x1pos,5,90,90);
    offscreenG.setColor(Color.green);
    offscreenG.fillOval(x2pos,105,90,90);

    // Now, transfer the entire buffer onto the screen
    g.drawImage(offscreenImg,0,0,this);
  }
  public void destroy() {
     offscreenG.dispose();
  }
}
</code>
Thank you
Comment: 1) Why code an applet?  If it is due to spec. by teacher, please refer them to [Why CS teachers should stop teaching Java applets](http://programmers.blogoverflow.com/2013/05/why-cs-teachers-should-stop-teaching-java-applets/). 2) Why AWT rather than Swing?  See my answer on [Swing extras over AWT](http://stackoverflow.com/a/6255978/418556) for many good reasons to abandon using AWT components.
Answer: Your loop inside your run statement is nested. This means for every time you update x1pos you update x2pos from 105 to 5.
Your for loop should read (reworked as similar as I could to yours)
<code>  for (x1pos = 5, x2pos = 105; x1pos <= 105 && x2pos >= 5 ; x1pos+=4, x2pos-=4)
  {
    repaint ();
    try { Thread.sleep(10); }
    catch (InterruptedException e) { }
  }
</code>

Checkers Applet problems


How many even three-digit numbers have distinct digits and have no digit $5$?

Question: How many even three-digit numbers have distinct digits and have no digit $5$?
The answer my teacher gave was $252$, but I don't see how she got that. I thought it would be $6\times 8 \times 5=240$ because the $3\text{rd}$ digit must be even $(0,2,4,6,8)$, the $2\text{nd}$ digit can't be $5$ or the $3\text{rd}$ digit $(10-2=8$ options) and the first digit can't be $0$, $5$, the $2\text{nd}$ digit, or the $3\text{rd}$ digit ($10-4=6$ options). Any way I look at it, the last digit has to be even and there are $5$ options for even digits, so the final answer must end in a $5$ or a $0$, not a $2$. Please help!
Comment: You have to add those cases where $0$ is used up as the third digit and can't be there at the first digit.
It would be better to split into 2 cases, one with last digit as $0$ and other with last digit as non-zero.
Comment: Looks like they're counting 024 as a three digit number.
Comment: @ L_M Quite... while your logic is sound for the ones-place digit and the tens-place digit, your hundreds-place digit might have $6$ options (*in the event the ones-digit was not zero*) or it might have had $7$ options (*in the event the ones-digit was zero*).  Your mistake is that you forgot to consider what happens if the list "zero, 5, 2nd digit, 3rd digit" had some overlap.
Answer: No. ending with non-zero digit = $4 .7.7=196$.
No. ending with zero digit = $1 .8.7=56$
P.S. The product above is (third digit options) x (first digit) x (second digit)
Answer: I figured out a different way to do it actually. I see that you have to account for when the third digit is zero and non-zero because it changes the criteria for the first digit, but I considered this for the second digit as well. What I did was split it into three cases:
Last digit is zero: $7 \times 8 \times 1=56$ (second digit cannot be $5$ or $0$ : the first digit cannot be $5$, the second digit or the third digit)
Last digit is nonzero and second digit is zero: $7 \times 1 \times 4=28$ (first digit cannot be $5$, the second digit or the third digit)
Second and last digits are nonzero: $6 \times 7 \times 4=168$ (the second digit cannot be $5, 0$, or the last digit: the first digit cannot be $5,0$, the second digit or the third digit)
Addition principle:$56+28+168=252$
It gives the right answer, but is this reasoning sound?
Comment: Looks sensible.
Comment: You have just subdivided the non-zero last digit case of my answer into 2 subcases.
Answer: So, one is asking for the number of injections $f:\{1,2,3\} \to \{0,1,2,3,4,6,7,8,9\}$ where $f(1) \neq 0$ and $f(3) \in \{0,2,4,6,8\}$.
Ignoring the last two conditions, one gets $_{9}P_{3}=504$ possible numbers (possibly odd and/or having a leading zero).
If one requires the first digit to be nonzero, then one would then need to subtract the number of injections $\{2,3\} \to \{1,2,3,4,6,7,8,9\}$ to get $504-{_{8}P_{2}}=504-56=448$.
Odd numbers still have not been eliminated yet. We have to eliminate the cases where the last digit is $1, 3, 7,$ or $9$.
Suppose that the last two digits ($f(2)$ and $f(3)$) are $0$ and $1$ respectively. Then, one must have $f(1) \in \{2,3,4,6,7,8,9\}$, eliminating $7$ odd numbers to reduce the count to $441$.
Similar considerations apply when the middle digit is still $0$, but the last digit is now $3, 7,$ or $9$. This eliminates $3 \cdot 7=21$ more odd numbers, reducing the count to $420$.
Now, let's move on to the case where the middle digit is nonzero. Fixing a last digit $d \in \{1,3,7,9\}$, one would then need to subtract the number of injections $\{1,2\} \to \{1,2,3,4,6,7,8,9\} \setminus \{d\}$.
Suppose that $d=1$. Then, subtracting the number of injections $\{1,2\} \to \{2,3,4,6,7,8,9\}$ gives $420-{_{7}P_{2}}=420-42=378$. Forty-two odd numbers with the last digit equal to $1$ have now been eliminated.
Similar considerations apply when $d$ is $3,7,$ or $9$. This eliminates $3 \cdot 42=126$ more odd numbers, giving a final count of $252$.


Complex analysis and entire functions

Question: Be $f : \mathbb{C} \Rightarrow \mathbb{C}$ a entire function. Supose that is exist $a, b, c \in \mathbb{R}$ such as $$ a Re(f(z)) + b Im(f(z)) \leq c$$ for all $z \in \mathbb{C}$. Show that $f$ is constant.
I want prove that $f$ is bounded and apply the Liouville's Theorem, but i don't know show that $f$ is bounded.
Comment: Note your inequation says $f$ doesn't take its values in some half-plane. Find $c$ such that $\frac{1}{f(z)-c}$ is entire and bounded.
Answer: $\newcommand{\Re}{\operatorname{Re}} \newcommand{\Im}{\operatorname{Im}}$We must assume at least one of $a$ and $b$ must be nonzero otherwise the inequality says nothing about $f(z)$.
Recall the $\exp(\cdot)$ is increasing so:
\begin{align}
e^{a\Re f(z)+b\Im f(z)} \leq e^c
\end{align}
Now note that $$|e^{af(z)-bif(z)}|=e^{a\Re f(z)+b\Im f(z)}\leq e^c$$ Furthermore $\exp({af(z)-bif(z)})$ is entire as well and bounded, hence by Liouville $\exp({af(z)-bif(z)})=K$ for some $K\in\mathbb{C}$. Now differentiating yields:
$$ f'(z) (a-ib) \exp({af(z)-bif(z)})= 0$$
We know $\exp(\cdot)$ is nonzero so $f'(z)(a-ib)$ must be zero so $f'(z)=0$.
And we get that $f(z)$ is constant.

Complex analysis and entire functions


How to extend SQLalchemy Base class with a static method

Question: I have multiple classes similar to the following:
class Weather(Base):
    __tablename__ = "Weather"
    id = Column(Integer, primary_key=True, nullable=False, autoincrement=True)
    temperature = Column(Integer)
    humidity = Column(Integer)
    wind_speed = Column(Float)
    wind_direction = Column(String)

I want to add a method df() that returns me the Pandas dataframe of that table. I know I can write it like this:
class Weather(Base):
   __tablename__ = "Weather"
    id = Column(Integer, primary_key=True, nullable=False, autoincrement=True)
    temperature = Column(Integer)
    humidity = Column(Integer)
    wind_speed = Column(Float)
    wind_direction = Column(String)

    @staticmethod
    def df():
        with engine.connect() as conn:
            return pd.read_sql_table(Weather.__tablename__ , conn)

But I want to implement this for every table. I guess if I can extend the Base class with this method I should be able to implement it once and use it in every class. Everything I have tried has failed because I do not have access to __tablename__  attribute.
SOLUTION
I ended up with a mix of both answers. I have used the first method proposed by @snakecharmerb (it allows to introduce the change without modifying the rest of the code) with the @classmethod proposed by @RomanPerekhrest (which is the bit I was missing).
class MyBase:
    __tablename__ = None

    @classmethod
    def df(cls):
        with engine.connect() as conn:
            return pd.read_sql_table(cls.__tablename__ , conn)

Base = declarative_base(cls=MyBase)

Answer: You can do this by passing a custom class to the declarative_base function:
class MyBase:
    __abstract__ = True

    @staticmethod
    def df():
        with engine.connect() as conn:
            return pd.read_sql_table(Weather.__tablename__ , conn)

Base = orm.declarative_base(cls=MyBase)

class MyModel(Base):
    __tablename__ = 'tbl'
    ...

Alternatively, you can create a mixin that provides the static method and have classes inherit from it selectively.

class DFMixin:
    @staticmethod
    def df():
        with engine.connect() as conn:
            return pd.read_sql_table(Weather.__tablename__ , conn)

class MyModel(Base, DFMixin):
    __tablename__ = 'tbl'
    ...

The mixin gives you more flexibility if not all of your models are going to need the dataframe functionality.
Comment: I assume that I also have to change the name of the class inside the parameters of pd.read_sql_table. The problem is that by doing so I get the error `type object 'MyBase' has no attribute '__tablename__'`
Comment: If you do `Base = orm.declarative_base(cls=MyBase)` then your model classes must inherit from _Base_.
Answer: Declare an auxiliary class (say DfBase) with classmethod df(cls) having the desired behavior.
Then each derived class will access its __tablename__ attribute seamlessly via cls object which refers to the derived class itself.
class DfBase:
    __tablename__ = None

    @classmethod
    def df(cls):
        with engine.connect() as conn:
            return pd.read_sql_table(cls.__tablename__ , conn)

class Weather(Base, DfBase):
    __tablename__ = "Weather"
    ...


Separating data within a cell and duplicating row data

Question: I have data that is within one cell, separated by spaces.
For example, there is one column with city name such as "New York, NY" and then another column with the zip codes "12345 67891 23456".
What is a good method for separating this single row so that it could become three rows, with each having "New York, NY" and then having a single zip code associated?
Answer: Try this:
library(dplyr)
library(tidyr)
tibble(city = "New York, NY", zipcodes = "12345 67891 23456") %>%
  mutate(zipcodes = strsplit(zipcodes, "\\s+")) %>%
  unnest(zipcodes)
# # A tibble: 3 x 2
#   city         zipcodes
#   <chr>        <chr>
# 1 New York, NY 12345
# 2 New York, NY 67891
# 3 New York, NY 23456

Base R:
dat <- data.frame(city = "New York, NY", zipcodes = "12345 67891 23456", stringsAsFactors = FALSE)
zips <- strsplit(dat$zipcodes, "\\s+")
data.frame(city=rep(dat$city, each = lengths(zips)), zipcode = unlist(zips))
#           city zipcode
# 1 New York, NY   12345
# 2 New York, NY   67891
# 3 New York, NY   23456

One premise of this answer is that the zip codes are separated by one or more whitespace (space, tab, etc). If there are legitimate spaces (true in many countries), then @ThomasIsCoding's approach may be a better start in that it attempts to extract the specific elements. Both will fail where zip codes are alphanumeric and contain a space; for instance, the UK has BS2 0JA as a zip code. In that case, you'll need a lot more logic to extract them safely.
Answer: If you are using base R, do you mean this kind of output?
s <- "New York, NY 12345 67891 23456"
data.frame(addr = paste0(gsub("(.*?\\s)\\d.*","\\1",s), unlist(regmatches(s,gregexpr("\\d+",s)))))

yielding
                addr
1 New York, NY 12345
2 New York, NY 67891
3 New York, NY 23456


h:commandButton does not call a js function in Chrome

Question: I have a <commandButton> the PrimeFaces should call a javascript junction. It works in Firefox but it does not work in Chrome simpleste does not call the function which can be causing this? Really no idea of what can be. I have a <commandButton> the PrimeFaces should call a javascript junction. It works in Firefox but it does not work in Chrome simpleste does not call the function which can be causing this? Really no idea of what can be. I have on another page extamente the same case and it works.
JS
function atualizarSelect(){
    update();
    $('#j_idt31:voucherBeanVoucherVeiculo').load('search.xhtml');
    self.close();
}

My commandButton

    <h:commandButton onclick="self.close()" value="#{msg['btn-cancel']}" />

Comment: I assume, you added another Element in the xhtml-markup of the page in question. This will cause the (auto-)generated id to be different (the `j_idt_31`) - When you try to reference elements from within (plain) javascript, make sure they have a `static` id assigned in the xhtml-markup - like your `voucherBeanVoucherVeiculo`.
Comment: What is happening is that the commandButton draws js function but the `update ()` is not executed. `Update` is a remoteCommand Button of Primefaces
Answer: I've just tried it on Chrome 39.0.2171.95 and it works great!
Probably there is a problem with auto-generated id as suggested by dognose comment.

<h:form id="bcr_form_2" styleClass="form">

</h:form>

Comment: Really tested again in debug mode in Firexo he enters the `update()` remoteCommand , but in Chrome does not.
Comment: Did you try to remove `remoteCommand` and move `actionListener` attribute to save `commandButton` and remove `update()` from js code?
Comment: I changed the code and it's working well `

  ` however I can not update the component via javascript this is actually the id generated for it. After the call to the precise remoteCommand update a selectOneMenu currently update with F5 in the browser want to do this via javascript.
Comment: I didn't understand. Could you explain better? Do you want update a `selectOneMenu`?


Flutter Slot Machine Game

Question: I am trying to run flutter slot machine game.
This is from the package and it has three stop buttons to stop the animation.
The issue that I am having is I only want one start button. After delayed 5 secs, I want that to stop that animation without pressing any buttons.
That's what I am trying to do and couldn't figure it out.
Can someone pls help me?
This is the original flutter slot machine game package.
https://pub.dev/packages/flutter_slot_machine/example
Comment: Can you include what you've tried so far?
Comment: I only tried according to the package that I provided. Can't think of my own the way I want to. I am sorry.
Comment: You can give a try and include the snippet , You can find more about [minimal-reproducible-example](https://stackoverflow.com/help/minimal-reproducible-example)
Answer: You can create async method with Future.delay
onPressed: () async {
  onStart();
  await Future.delayed(Duration(seconds: 1));
  onButtonTap(index: 0);
  onButtonTap(index: 1);
  onButtonTap(index: 2);
}),

More about async-await
Full widget
class MyHomePage extends StatefulWidget {
  MyHomePage({Key? key, required this.title}) : super(key: key);
  final String title;

  @override
  _MyHomePageState createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  late SlotMachineController _controller;

  @override
  void initState() {
    super.initState();
  }

  void onButtonTap({required int index}) {
    _controller.stop(reelIndex: index);
  }

  void onStart() {
    final index = Random().nextInt(20);
    _controller.start(hitRollItemIndex: index < 5 ? index : null);
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text(widget.title),
      ),
      body: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: <Widget>[
            SlotMachine(
              rollItems: [
                RollItem(index: 0, child: Text("X")),
                RollItem(index: 1, child: Text("Y")),
                RollItem(index: 2, child: Text("Z")),
              ],
              onCreated: (controller) {
                _controller = controller;
              },
              onFinished: (resultIndexes) {
                print('Result: $resultIndexes');
              },
            ),
            Padding(
              padding: const EdgeInsets.only(top: 24),
              child: TextButton(
                  child: Text('START'),
                  onPressed: () async {
                    onStart();
                    await Future.delayed(Duration(seconds: 1));
                    onButtonTap(index: 0);
                    onButtonTap(index: 1);
                    onButtonTap(index: 2);
                  }),
            ),
          ],
        ),
      ),
    );
  }
}

Comment: play with `Duration(seconds: 1)`

Flutter Slot Machine Game


How to use extra 256 gb space in Ubuntu

Question: I need help to use my extra 256 GB of space in ubuntu. I am new to Linux and don't know how to use this extra space because it is not allowing me to write anything on it (means to create a folder or copy something there). For your reference, I attached the image of my current storage space, please look at the attached image.

Any help will be highly appreciated. Thanks
Comment: Have you confirmed the permissions for `/media/sanaullah/extra`? If they're `root:root` then you'll want to update it for your account and group.
Comment: I am new to Linux and do not have any idea what I have to do with this issue. If you can provide me some commands which can help me
Comment: More info on mounting & sharing. https://askubuntu.com/questions/1013677/storing-data-on-second-hdd-mounting &
https://askubuntu.com/questions/1058756/installing-all-applications-on-a-ssd-disk-and-putting-all-files-on-hdd-disk You can make name of your mount anything that makes sense to you, if you do not want to call it /mnt/data. You can link folders into /home if desired.
Answer: Are you on a Dell. If that is Gparted cli, open in GUI mode. Your 256 GB is on a separate drive. The partition named nvmeon1 is on an M2 disk. That name is reserved for m2 drives on Dell. You can check it via the dropdown menu in GUI. I am not sure if you need to mount or not, but I would assume so.
Comment: Your PC has 2 internal drives. One is a classic SSD and the other M2. Seems like a trend among mid-grade models. My Dell G5 5590 has the same setup. I am running Ubuntu on a 1 T internal partition.. The SSD.

How to use extra 256 gb space in Ubuntu


what is session_reset() exactly?

Question: I want to know what is session_reset() for and when should we use it ?
when I use it I get an error like this: "Call to undefined index session_reset()".
I hope you know something about it .
Thank you in advance.
Comment: session_reset() or session_start() or both?
Comment: session_start — Start new or resume existing session
Comment: `Call to undefined index session_start()` - session_start is a function not an index within an array.
Comment: I'm really sorry . I mean session_reset() . I changed my question
Answer: session_reset — Re-initialize session array with original values.
Example
first create a session variable
<code> <?php
    session_start();
    $_SESSION["A"] = "Some Value";
   echo $_SESSION["A"];

//Output: Some Value

//if you need to rollback the session values after seting new value to session variables use session_reset()

   $_SESSION["A"] = "Some New Value";  // set new value

  session_reset();  // old session value restored
   echo $_SESSION["A"];

//Output: Some Value
?>
</code>

what is session_reset() exactly?


Complex roots of $z^{2018} =2018^{2018} +i$ in complex plane

Question:
Number of solution of $$z^{2018} =2018^{2018} +i$$ where $i=\sqrt{-1~}$. How are the roots positioned in $4$ quadrants ?
Comment: You know why your question is getting downvotes, right?
Comment: No i am a new user i dont know
Comment: For more information, please read [how to ask a good question](http://goo.gl/PlJyVQ). At any rate, I wish the best of luck to you, and please continue to contribute to our wonderful site!
Answer: Note,
$$z =(2018^{2018} +i )^{\frac 1{2018}}= re^{i\theta}$$
where
$$r = (2018^{2\cdot 2018} + 1)^{\frac 1{2\cdot2018}}\approx 2018$$
$$\theta= \tan^{-1}\left(\frac1{2018^{2018}}\right)+\frac{2\pi n}{2018}\approx \frac{2\pi n}{2018}$$
with $n =0, 1,2,\>...\>2017$. Thus,
$$z = 2018 e^{\frac{i2\pi n}{2018}}$$
representing 2018 distinctive roots evenly spaced around a circle of radius 2018 in the complex plane.


A way to dynamically invoke methods in Swift

Question: In JavaScript you can dynamically call a method like this:
class Foo {
  myMethod() {
    console.log('myMethod')
  }
}

var foo = new Foo()
var method = 'myMethod'
foo[method]()

You can write the method as a string and dynamically call it. You can also do this:
foo[method].apply(someScope, [ argA, argB, ... ])

Wondering if you can do anything like this in Swift, I am new to swift.
Comment: When you are trying to dynamically call methods in a strongly typed, compiled language, you are most probably on the wrong track to solve your issue. This is especially true for Swift. Explain the problem you're trying to solve that you think requires having to dynamically all methods, rather than trying to translate JS code line by line to Swift.
Comment: isn't that what KVO for ?
Comment: Well, [`Objective C` surely did allowed this](https://developer.apple.com/documentation/objectivec/1456712-objc_msgsend), and if you can just limit yourself to code(classes) created in `ObjC` (and bridged to `Swift`) you can do this.
Answer: You can use KVO pattern to solve this issue, however as @David Pasztor comment says.

When you are trying to dynamically call methods in a strongly typed, compiled language, you are most probably on the wrong track to solve your issue. This is especially true for Swift. Explain the problem you're trying to solve that you think requires having to dynamically all methods, rather than trying to translate JS code line by line to Swift.

However KVO can be used to solve such issues, i suggest reading about it it allows you to dynamically observe keys, and based on that you can do your actions.
Keep in mind KVO is compiled with Ojbc compiler.
Comment: How is KVO related to dynamically calling methods? KVO can be used to execute methods when the value of an observed variable/property changes, but those methods still need to be strongly typed. KVO is completely unrelated to OP's question.
Comment: Actually, `KVO` is not needed here, i mean `bserving part`. Just [`selector`s](https://medium.com/swift-programming/swift-selector-syntax-sugar-81c8a8b10df3) will do.
Comment: it can be used to execute strongly typed functions, if he observed some values , just alternative solution .
Comment: looking at his case he is probably trying to execute functions base on actions at the run time, so observing keys could be helpful for him to achieve that, i am not saying this is the ultimate answer for his question, it could be helpful and work for him. @DávidPásztor please note something for me i can learn, about this topic


Predict the byte size of a base64 encoded byte[]

Question: I'm trying to predict the size string representation of a base64 encoded byte array.
I've come up with the formula below, however the length of the actual encodedString is 4 larger than the base64EncodedSize.
The whole idea here is to calculate/predict what the encoded string size would be for a given byte[]. I would prefer not to convert the byte[] to a base 64 string just to determine it's length.
FileInfo pdfFile = new FileInfo(@"C:\TEMP\1.pdf");

long originalSizeInBytes = pdfFile.Length;

String encodedString = Convert.ToBase64String(File.ReadAllBytes(pdfFile.FullName));

long base64EncodedSize = (originalSizeInBytes / 3) * 4;

----------------------------------------------------------------------------------
- Results -
-----------------------------------------------------------------------------------
  originalSizeInBytes                           913663  long
  base64EncodedSize                             1218216 long
  encodedString.Length                          1218220 int
  base64EncodedSize                             1218216 long
  encodedString.Length - base64EncodedSize      4       long

Comment: Oh dear. Integer dividing before you multiply? And you wonder why the result is too small?
Comment: Wow, I can't believe I didn't notice that. It's always the simple things. :) Thanks.
Answer: That will be
long base64EncodedSize = 4 * (int)Math.Ceiling(originalSizeInBytes / 3.0);


Wrap the highlight text with span element in JQuery or JavaScript

Question: This my code but there is an error if you override the highlighted text.
The error is:

Uncaught InvalidStateError: Failed to execute 'surroundContents' on
  'Range': The Range has partially selected a non-Text node.

JS
function surroundSelection() {
  var span = document.createElement("span");
  span.setAttribute('class', 'hlt')

  if (window.getSelection) {
    var sel = window.getSelection();
    if (sel.rangeCount) {
      var range = sel.getRangeAt(0).cloneRange();
      range.surroundContents(span);
      sel.removeAllRanges();
      sel.addRange(range);
    }
  }
}

Comment: What have you tried to deal with the problem? The error is fairly clear: The selection includes parts of a node that isn't a text node, and so `surroundContents` itself can't do the job. You have to look at what's in the range and deal with how to highlight the selection cross-element. [MDN](https://developer.mozilla.org/en-US/docs/Web/API/range/surroundContents) even flags this up: *"An exception will be thrown, however, if the Range splits a non-Text node with only one of its boundary points."* So you'll need more than one span in that case.
Comment: yes i dont have idea on how how it can pass to element and override the highlight. yes i need more span element for that. hopefully someone can help me.
Comment: Working through it yourself will be the best help. Otherwise, this is just a "please write this for me" request, not a question.
Answer: Try this instead:
function surroundSelection() {
    var selection= window.getSelection().getRangeAt(0);
    var selectedText = selection.extractContents();
    var span= document.createElement("span");
    span.setAttribute('class', 'hlt')
    span.appendChild(selectedText);
    selection.insertNode(span);
}

Comment: it's correct. but when we have multi paragraph this is not work correctly.


how to load the same html several times with different values

Question: In a webapp developed with google script, I want to display a list of ideas with title, description, initiator, status etc. The information is stored in an array of objects called "ideas"
In the Index file I have a table.

In the javascript file, I loop through "ideas", and each time I append a string, in which I insert the various information from the array that I want to display
for (var i=0;i<ideas.length;i++){
$('#listOfIdeas')
  .append('
'+
          ''+ideas[i].ideaNumber+'	'+
          ''+
              '
'+
                  '
'+ideas[i].title+''+
                  '
'+
                  '
'+ideas[i].description+
                  '

'+
                  '
'+ideas[i].initiator+', '+
                          ''+ideas[i].department+', '+
                          ''+
                          ''+ideas[i].count+', '+
                          ''+
                  '
'+
                  '
'+
                  '
'+
                  '
'+
                      ''+
                      '<button class="float-right app-part d-none">Participate</button>'+
                  '
'+
              '
'+
          '	'+
          '
')

My problem is, as I would like to add new functionalities (with a small menu with buttons), the string will become less and less readable.
Is there a "cleaner" way to proceed? I feel like it would be possible to add the template in the index file, and copy it several times with different values, but i'm not clear on whether it's the best solution.
Comment: For better readability, consider using a template literal with interpolated values, and extracting the values of the object beforehand (hopefully with `forEach` rather than a  `for` loop)
Answer: I will use es6 template literals, using backticks
for (var i = 0; i < ideas.length; i++){
$(#listOfIdeas)
  .append(`

          ${ideas[i].ideaNumber}

${ideas[i].title}

${ideas[i].description}

${ideas[i].initiator},
                          ${ideas[i].department},

                          ${ideas[i].count},

                      <button class="float-right app-part d-none">Participate</button>

`)
}


Log-on Money Bug

Question: I have just recently noticed a weird bug. Whenever I disable a mod, when I hit 'Play', it gives me $24,500 for a Grant Completion. Every time. It's definitely a bug, because I currently running 3 Grants, & you can't go higher than that. Unlike some people, who would sit there for hours getting free money, I would like to play a legit game.
Does anyone know how to fix this?
  Thanks in advance.
Comment: Not a fix for your bug, but if you're worried about "cheating" you can freely edit the amount of money you have in the save file (under "Finances") to remove the extra amount
Comment: @Landric Thanks! I already did that, though.
Answer: Most likely the grant that gets completed is 'Remove supply of weapons & tools'. At least that's what I've observed before in my saves. There's not much you can do about it. The manual completion of the grant would require a 'shakedown', so you could load the game, get the grant completion, perform the shakedown and... your consciousness is safe.
Answer: I have a possible fix for the bug. in the save file if you can find the grants you could un research everything and re research it possibly fixing your bug. Another Idea is too just wait for all the grants to finish
then save your game.

Log-on Money Bug


Will surface scuffs be a long-term issue in a new concrete walkway?

Question: I'm probably being paranoid but would like to get some expert opinions as this is my first time dealing with concrete.
I had a concrete path laid in the garden, around 80-100mm thick.
It was laid and then about 12 hours later when it had hardened the top layer got scratched by machinery in a few patches roughly the size of a beer mat each, taking the top 2-3mm off the surface. It was then it started to rain for a few hours.
So now when I look at the surface I have the nice cured layer top layer, but in the scratched patches it's a bit rougher looking and the material feels a bit looser.
My question is, will these scratched areas develop into a problem as the material feels a bit looser on them compared to the cured surface ?
Is there any product I could apply to them to re-seal them, one that is preferable invisible to not draw attention ?
Or am I just overthinking the whole thing, and is this part of the natural wear and tear ?
This is just a functional side path, nothing pretty about the finish.
Thanks in advance
Comment: I'm voting to close this question because it's been abandoned.
Comment: @FreeMan, I assume that this damage was not done on purpose.
Comment: Would you please [edit] in a picture or two showing the "scratched" vs "not scratched" areas. Often times the surface is roughened to provide texture so it's not slippery when it's wet, so that's my first thought, but I'm confused by why they only did it in patches. Did they hone down some high spots so that the surface is now level?
Comment: You say "re-seal". Was a sealer applied in the first place? Concrete itself isn't sealed even if the finish is very smooth. It's always porous and absorbent.
Comment: The surface of the concrete takes a few days to get really hard. Yes it is solid but it really kind of soft for a few days. When I pour slabs after finishing I don't walk on them for 2-3 days to prevent surface damage.
Answer: Well the folks who "scratched" your delicate "green" (fresh, uncured, weak) concrete with their machinery should be fixing this for you, or paying your concrete guy to fix it if they are not the concrete guy.
It won't get better, and it's hard to do much (short of tear out and repour a section) to fix a thin layer like that, because thin layers do not bond well and tend to spall off again.
There's a section of sidewalk near me that looks horrible because it was not covered (or the cover was not secured properly and blew off in a thunderstorm) while still wet and got poured on, taking the finish layer off. Rain is good once the concrete has set/hardened (the cure needs water) but bad when the material is still wet - not your issue, as the parts that were not abused seem to be fine per your description - you just have damage because the green (and very weak at that point in time) concrete was "scratched by machinery" before it could become strong.
Comment: Thanks @Ecnerwal, you understood the situation perfectly. My understanding is there's not much I can do, short of ripping it all out and starting again. The areas affected by this scratching are very small as a proportion of the whole path, but more unsightly right now rather than a real structural concern. I'm just thinking more longer term.
But like I said the concrete is 80-100mm thick, and these scratches are affecting the top few millimetres. I was just wondering if there's any product that I could put over it all to make it all uniform in appearance.
Like some sort of matte sealant ?
I h


Visual Studio 2015 enable MVC 4 support

Question: I have an ASP NET MVC 4 project that "works on my machine(old)". When I load a project in a fresh installation of VS 2015(on a new laptop) - a lot of assemblies are missing and when I try to build the project it complains that classes like ActionResult, Controller are missing.
I checked that on the old laptop the missing dependencies are coming from C:\Program Files (x86)\Microsoft ASP.NET\ASP.NET MVC 4\Assemblies. On the new laptop I have only the xml descriptors of the packages but not the dlls.
What I have to install to use MVC 4 in Visual Studio 2015?
Edit: missing dependencies are:

System.Web.Helpers
System.Web.Mvc
System.Web.WebPages
System.Web.WebPages.Deployment
System.Web.WebPages.Razor
Comment: List the Assemblies that are missing here.
Comment: @Valkyriee done, see edit.
Comment: You can always install asp.net 4 using Nuget
Comment: @EvgeniDimitrov see my answer :)
Comment: @EvgeniDimitrov if by any chance it didn't let you to install them again, you need to remove the package and install or Update them.
Comment: do you install update 3 for VS2015 ? It has major fixes and enhancements
Answer: I Recommend getting them again from Nuget for your ActionResult Issue its Microsoft.AspNet.Mvc which is making issue.
Open Package Manager Console and insert the command below:
Install-Package Microsoft.AspNet.Mvc

Nuget has this feature that allows you to restore all the missing Assemblies which exists in nuget. you can try that out as well.
Anyway for the rest of them install these packages below as well:

Install-Package Microsoft.AspNet.WebHelpers
Install-Package Microsoft.AspNet.WebPages
Install-Package Microsoft.AspNet.Razor
Answer: Check if you have install update 3 for VS2015
also check if Microsoft web developer tools are installed correctly
Answer: I have had the same issues when using source control or moving projects from one PC to another.
There is a work around that I use quite often and it works.

Go to YourProjectFolder -> packages.
Remove all the folders except for the xml, repositories.xml, file which is the xml config file for packages downloaded from Nuget.
On your solution in Visual Studio Right click and select Enable Nuget Packages Restore.
Then build the application it will re-download all the required packages.
Hope this helps
Answer: For Me what solved the issue is to install ASP.NET MVC 4 for Visual Studio 2010 from Microsoft Web Page

Visual Studio 2015 enable MVC 4 support


Hiding the searchbar till the user swipes it down for iOS 7

Question: I have added the searchbar to the tableHeaderView of the tableview. However, writing
self.tableView.contentOffset = CGPointMake(0, 44);

or
[self.tableView scrollToRowAtIndexPath:[NSIndexPath indexPathForRow:0 inSection:0] atScrollPosition:UITableViewScrollPositionTop animated:NO];

Hides the searchBar behind the navigation bar at the top but its not visible even when the user swipes the tableview down. It hides again. This seems to work fine in iOS 6 but not in iOS 7 beta. What do I need to do?
Comment: iOS 7 is currently under NDA, so you are not allowed to discuss it in public forums. Because of this, you probably won't get an answer. Just so you know.
Comment: Where can I post it as a question then?
Comment: You could try the [Apple Developer Forums](https://devforums.apple.com).
Comment: I have the exact same problem with my app, can we talk about it yet? Or did you find a solution? I am also missing the table header row, that slides under the Nav bar too! :(
Answer: Fixed it by putting ..
self.edgesForExtendedLayout = UIRectEdgeNone;

in the viewWillAppear, it needs a check for iOS 7 before executing, as it is a new method introduced in iOS7.
Plasma


Why is angular $scope not removing old value?

Question: I have the following controller
angular.module('publicApp')
  .controller('URLSummaryCtrl', function ($scope, $location, Article, $rootScope, $timeout) {
    $scope._url = "";
    $scope._title = "";
    $scope._article = "";
    $scope._authors = "";
    $scope._highlights = [];
    $scope._docType = "";

    $scope.summarizeURL = function(){

        Article.getArticleInfo($scope.url, "").then(
            function(data){

                $scope._url = data.url;
                $scope._title = data.title;
                $scope._authors = data.authors.join(', ');
                $scope._highlights = data.highlights;
                $scope._docType = data.documentType;

                if($scope._docType == 'html'){
                    $scope._article = data.article[0].article;
                }
                else{
                    $scope._article = data.article;
                }

                var _highlights = [];
                $scope._highlights.forEach(function (obj) {
                    _highlights.push(obj.sentence);
                });

                // wait for article text to render, then highlight
                $timeout(function () {
                    $('#article').highlight(_highlights, { element: 'em', className: 'highlighted' });
                }, 200);
            }
        );
    }

and the following view
<form role="form" ng-submit="summarizeURL()">

      <input id="url" ng-model="url" class="form-control" placeholder="Enter URL" required>

    <button class="btn btn-success" type="submit">Summarize</button>
  </form>

{{ _title }}

 Source:  {{_url}}

 Author:  {{_authors}}

 Article:
{{_article}}

When I give a url in the text field initially and click Summarize it works as expected. But when I change the value in the text field and click the button again every thing is updated properly, with the new values, but the $scope._article gets the new value and doesn't remove the old value. It displays both the new and the old value that was there before.
Why is this happening?
EDIT #1: I added more code that I had. I found that when I remove the $timeout(function(){...}) part it works as expected. So now the question is, why is $scope._article keeping the old value and pre-pending the new value?
EDIT #2: I found that $timeout(...) is not the problem. If I change
$timeout(function () {
    $('#article').highlight(_highlights, { element: 'em', className: 'highlighted' });
}, 200);

to
$('#article').highlight(_highlights, { element: 'em', className: 'highlighted' });

it still behaves the same way. So now I'm assuming it's because I'm changing the $scope._article to be something else? What's happening is that I'm displaying the $scope._article value and then modifying what's displayed to contain highlights  ...  on what ever I want to highlight.
EDIT #3: I tried to remove the added html before making the request to get new data but that doesn't work either. Here's the code I tried.
angular.module('publicApp')
  .controller('URLSummaryCtrl', function ($scope, $location, Article, $rootScope, $timeout) {
    $scope._url = "";
    $scope._title = "";
    $scope._article = "";
    $scope._authors = "";
    $scope._highlights = [];
    $scope._docType = "";

    $scope.summarizeURL = function(){
        //Remove added html before making call to get new data
        $('.highlighted').contents().unwrap();

        Article.getArticleInfo($scope.url, "").then(
            function(data){ ... }
        );

Comment: Please provide a [mcve]
Comment: it's not obvious what is happening here, but there are many nuances with scope inheritance and primitives.  you should **always** use a dot in your angular bindings;  creating string primitives and binding to those can cause many issues.  see http://stackoverflow.com/questions/14049480/what-are-the-nuances-of-scope-prototypal-prototypical-inheritance-in-angularjs for more detail on the subject.
Comment: If there's any info that I'm missing to provide please let me know.
Answer: Jquery in angular controllers = headache.
The problem is probably here for you
$timeout(function () {
        $('#article').highlight(_highlights, { element: 'em', className: }, 200);

#article.html() here, is going to give weird output, because angular has it's own sync system and the jquery library you're using has it's own way of working with the DOM. Throw in the fact that asynchronous javascript is already a pain if you're working with multiple things.
What you want instead is to set the html to the angular scope variable before you work with it in jquery so you know what the jquery is working with, i.e.:
$timeout(function () {
        $('#article').html($scope._article);
        $('#article').highlight(_highlights, { element: 'em', className: }, 200);

Comment: Wow! I was about to go crazy on this one. I added the line you suggested and it works like a charm. Thanks a lot!