text:
Q: C# Download an image from URL I use a website to get stats on wifi usage. The website creates an image of a graph representation of the data. The way it does this is by the user, setting a date. So for example, lets say it was last months statistics. The website generates a URL which is then sent to the server and the server returns an image. an examples of the link is like this:
https://www.example.com/graph/daily_usage?time_from=2015-06-01+00%3A00%3A00+%2B0100&time_to=2015-06-30+23%3A59%3A59+%2B0100&tsp=1436519988
The problem is, I am making a third party program that will download this image to be used in my program. However, I cannot use the file. It is as if the file is corrupt or something. I have tried a few methods but maybe someone can suggest a different approach. Basically, how do I download an image that is generated by a server from a URL link?
P.S.
Just noticed that if I download the file by right clicking through a browser and save, the image downloads with a size of 17.something kilobytes. But if I use the WebClient method to download the image, it only downloads 1.5kb. Why would that be? Seems like the WebClient method does not download completely.
Currently my code
if (hrefAtt == "Usage Graph")
{
    string url = element.getAttribute("src");
    WebClient client = new WebClient();
    client.DownloadFile(url, tempFolderPath + "\\" + currentAcc + "_UsageSummary.png");
    wd.AddImagesToDoc(tempFolderPath + "\\" + currentAcc + "_UsageSummary.png");
    wd.SaveDocument();
}

TempFolderPath is my desktop\TempFolder\
UPDATE
Out of random, I decided to see the raw data of the file with notepad and interestingly, the image data was actually a copy of the websites homepage html code, not the raw data of the image :S how does that make sense?

A: This will download the Google logo:
var img = Bitmap.FromStream(new MemoryStream(new WebClient().DownloadData("https://www.google.co.uk/images/srpr/logo11w.png")));

A: First of all, you have to understand link texture. If all links are same or close to each other, you have to use substring/remove/datetime etc. methods to make your new request link. For example;
string today = DateTime.Now.ToShortDateString();
string generatedLink = @"http://www.yoururl.com/image + " + today + ".jpg";
string generatedFileName = @"C:\Usage\usage + " + today + ".jpg";

WebClient wClient = new WebClient();
wClient.DownloadFile(generatedLink, generatedFileName);


text:
Q: statistics linking McFadden's $R^2$ to the relationship between two binary variables, akin to correlation My goal is to create a visualization of the strength of the McFadden's $R^2$ of a (multinomial) logistic regression, where McFadden's $R^2$ is $1-\dfrac{LL(M_1)}{LL(M_0)}$, involving the ratio of the log-likelihood of the fitted model ($M_1$) to that if an intercept-only model ($M_0$), analogous to $R^2$ in linear regression.
If this were a linear regression, a good way to visualize the strength of the $R^2$ would be to plot the predicted and true values. For a multinomial logistic regression, this seems problematic.
My idea is to simulate $2\times2$ data that will have a particular McFadden's $R^2$. Then I will put the counts in an array (confusion matrix of sorts). Then I will plot a $2\times2$ grid with the four squares colored (probably in greyscale) according to their counts. If there are dramatically different colors, that would signal high predictive performance, while colors that are hard to distinguish would indicate more pedestrian performance.
I can simulate $2\times2$ data quite easily.
set.seed(2023)
N <- 100
x <- rbinom(N, 1, 0.5)
z <- 2*x - 1
pr <- 1/(1 + exp(-z))
y <- rbinom(N, 1, pr)

However, I do not have any obvious way to control the relationship between x and y in terms of the McFadden's $R^2$.
What is the statistics of this relationship? Can it come through some kind of copula between the marginal Bernoulli distributions?
I don't know what I want to do with my visualization, but I want to figure out how to make it so I can figure out how useful it is.

redpajama_set_name: RedPajamaStackExchange


text:
Q: .htaccess. Как перенаправить все запросы, кроме одного Я хочу, чтобы все запросы, которые начинаются на backend/ перенаправлялись на ./backend/public/index.php, а все остальные перенаправлялись на index.html. На данный момент ВСЕ запросы перенаправляются на index.html. Как это исправить?
RewriteEngine On
RewriteBase /

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

# Если путь начинается с backend/, то перенаправить на ./backend/public/index.php
# UPD. Добавил флаг [L], но всё равно все запросы перенаправляются на index.html
RewriteRule ^backend/* ./backend/public/index.php [L]

# Иначе перенаправить все запросы на index.html
RewriteRule ^(.*)$ index.html

A: RewriteCond %{REQUEST_URI} !^/public
RewriteCond %{DOCUMENT_ROOT}/public/$1/ !-d [NC]
RewriteRule ^((?!public/).*?)/?$ public/$1 [L,NC]

RewriteCond %{REQUEST_URI} !^/public
RewriteCond %{DOCUMENT_ROOT}/public/$1 -d [NC]
RewriteRule ^((?!public/).+?)/?$ public/$1/ [L,NC]


text:
Q: Make a middle clicked link open in a new tab to the immediate right of the tab which contained the link In Firefox, a middle clicked link opens a new tab right at the end of the tab list, which is usually at the far right of the window. When you have a lot of tabs, this can mean the new tab is 10 or 15 positions away from the tab that spawned it.
I want to to be able to middle click on a given link in a tab and have a new tab open to the immediate right of the tab I'm currently in.
Is there any configuration setting or extension that allows me to get this behaviour?

A: As of Firefox v 3.6 opening a link in a new tab opens the tab immediately to the right of the current one. It's the only way this works now, I can't find an option on the user interface that controls it.
Both right click & "Open Link in New Tab" and middle click work this way.

A: Firefox's "Tab Mix Plus" add-on allows this.
From Firefox: Click on Tools > Tab Mix Plus options...
From Tab Mix Plus: Click Events > Tab Opening
...and select Open other tabs next to the current one.

A: You can make Firefox give focus to the newly opened tab, rather than having to search for it.
This feature is built-in to Firefox already, go to: Tools > Options > Tabs > Tick 'When I open a link in a new tab, switch to it immediately'
The Tab Mix Plus add-on may have the functionality you want, I dont use Firefox though so cannot test/confirm this.

A: The description of the Firefox add-on Tabberwocky says:

Open tabs to the right of current tab

but as I haven't tried it, I don't know if you can attache this to middle click.


text:
Q: Регулярное выражение для получения параметров url У меня есть строка '/abc/x=1+2&y=25&c=1', где 'x=1+2&y=25&c=1' является определенным набором фильтров. Я хочу написать функцию, которая бы с помощью регулярки доставала значения каждого фильтра, т.е.:
1) getSubString(str, 'x') - должна вернуть '1+2'
2) getSubstring(str, 'y') - должна вернуть '25'
3) getSubstring(str, 'c') - должна вернуть '1'

Моя функция пока что выглядит так:
const getSubString = (pathname, filterName) => {
  const regexp = new RegExp(`${filterName}=(.*)&`);

  return pathname.match(regexp)[1];
}

Не понимаю 2 момента:

*

*В первом случая мне возвращается '1+2&y=25', то есть почему то поиск идет до последнего символа & в строке. Как сделать, чтобы движок искал с переданного мной 'x' до первого появления &?

*В 3ем случае движок не находит никаких совпадений, т.к. в регулярке указан последним символом &. Как обработать такой кейс, когда возможно окончания на & или конец строки? Я пробовал заканчивать регулярку на (&|\z) - не получилось.

A: В выражении (.*)& первый шаблон захватывает 0 и более символов, отличных от перевода строки, до последнего вхождения символа &.
В данном случае требуется найти текст до первого (ближайшего) вхождения символа & или до конца строки:
(.*?)(?:&|$)
(.*?)(?=&|$)
([^&]*)

Из трёх перечисленных выше шаблонов ([^&]*) является самым быстрым, он же также находит переводы строк.
Используйте

const getSubString = (pathname, filterName) => {
  const regexp = new RegExp(`${filterName}=([^&]*)`);
  const res = pathname.match(regexp)
  return res ? res[1] : undefined;
}

const text = '/abc/x=1+2&y=25&c=1';
console.log(getSubString(text, 'x'));
console.log(getSubString(text, 'y'));
console.log(getSubString(text, 'c'));

Чтобы совпадение происходило только после /, ? или &, измените регулярное выражение на
new RegExp(`[/?&]${filterName}=([^&]*)`);

См. пример работы выражения.


text:
Q: Calcular pares números introducidos (error sin sentido) Estoy aprendiendo JS desde hace poco y haciendo algunos ejercicios. En este me he quedado atascado porque no encuentro sentido a lo que me sucede.
 El código siguiente me funciona perfectamente salvo cuando el 1er número que introduzco es 15 y el segundo 2...
 El alert me salta "Hay un total de 0 números pares entre los dos números seleccionados"
En qué me equivoco?
<script>
    var numero1 = prompt("Facilíteme el primer número");
    var numero2 = prompt("Facilíteme el segundo número");
    var total = 0;

    if(numero1 < numero2){
        var chico = numero1;
        var grande = numero2;
    }
    if(numero2 < numero1){
        var chico = numero2;
        var grande = numero1;
    }

    var tipo = (chico%2) ? "Impar" : "Par";
    console.log(chico);
    if(tipo == "Par"){
        while(chico < grande){
            document.write(total);
            total = total + 1;
            chico = parseInt(chico) + 2;
        }
    }else{
        while(grande > chico){
            //document.write(total);
            total = total + 1;
            grande = parseInt(grande) - 2;
            console.log(chico);
        }
    }

    alert(`Hay un total de ${total - 1} números pares entre los dos números seleccionados`);

</script>

A: La entrada del usuario es una cadena. Si el usuario escribe 2 y 15, tendrás que numero1 es la cadena "2" y numero2 es la cadena "15".
Cuando compares numero1<numero2, se están comparando cadenas, y estas se hacen en "orden alfabético". Por tanto "15" será menor que "2", porque en un diccionario aparecería antes (al ser la primera "letra", que es "1", anterior a "2").
A partir de ahí no es de extrañar que te salgan resultados sorprendentes. Debes convertirlos a entero con parseInt() tan pronto como los leas con prompt(), por ejemplo así:
var numero1 = parseInt(prompt("Facilíteme el primer número"));
var numero2 = parseInt(prompt("Facilíteme el segundo número"));


text:
Q: One User Going to My Answers And Down Voting - Down-Voting Bomb? I just got 3 downvotes in a row on 3 of my recent answers.  I also just asked a question, got 2 bad (IMO) answers and downvoted those answers.  Coincidence?  I think not.
I have since went back and took away the downvotes I gave to the 2 answers, and now the downvotes on my 3 answers have been taken back too.  Can SO do anything about people like this who downvote bomb you?

A: Since 3 downvotes is most likely not enough to trigger the downvote protection mechanism* you should flag a post - any post - for moderator attention, so they can look into it.
* When I did some testing on a dummy SE 1.0 website I found out that the mechanism kicked in after 5 or more downvotes in 1 day from the same user.


text:
Q: Undefined upon get Request in Backbone I try to execute operation "PUT" using Backbone. It fetchs the records from the server. But neighter where nor get method does retrieve a solution (result of console.log of code below is thus [] ) which i can edit (using set) and can save.
Solution can be really simple but still don't realize what is wrong!
var Model = Backbone.Model.extend({
    idAttribute : "ID"
});
var TodosCollection = Backbone.Collection.extend({
        model : Model,
        url : myUrl
    });
var todos = new TodosCollection();
todos.fetch();

var todo = todos.where({
        ID : 2
    });
console.log(todo);
todo.set('Name', 'ChangedName');
todo.save();

A: You need to Parse the response and specify where your models are.
For better reference if someone stumbles on this.
This could look something like
{
  "location": "UK",
  "users": [
      {id: "etc", name: "etc"},
      {id: "etc", name: "etc"},
      {id: "etc", name: "etc"}
  ]
  "someothermeta": "score",
  "foo": "bar"
}

Your parse function will then be:
parse: function(response) {
    return response.users;
 }


text:
Q: Git: forcing `add` when file is in nested git repository I would like to add a file contained into a nested git repository in the parent repository (I'm developing a library that I use in my project). However git add nested_repo/myfile does not do anything... I could try to rename the .git file when doing the commits, but then I'm afraid to have strange conflicts when I rename back the .git folder.
I know submodules is the proper way to handle nested git repositories. Unfortunately in my case I'm using git in conjunction with Overleaf (to share LaTeX documents with co-authors and edit them collaboratively in real-time) and overleaf does not handle submodules (if I try to push a project with submodules it just fails).
Any idea how I could deal with that?

A: The right answer is "don't do that".

I could try to rename the .git file when doing the commits ...

This does work:
mkdir test-subdirectory
cd test-subdirectory
git init
[... output, make initial commit, etc, here]
mkdir sub && (cd sub && git init && echo echo submodule > README &&
git add README && git commit -m initial-in-sub)
[output snipped]

At this point, creating sub/file and trying to git add it does nothing, at least in the version of Git I'm using here (a year or so out of date):
git add sub/file

There is no error but sub/file is not added (nor is sub added as a submodule).  But:
mv sub/.git sub/notgit
git add sub/file
mv sub/notgit sub/.git

Adding a .gitignore for sub, and git add .gitignore, and git status --short now says:
A  .gitignore
A  sub/file

but then I'm afraid to have strange conflicts when I rename back the .git folder.

It's not so much "strange conflicts", but rather the fact that the top level repository, that now contains sub/file where sub/.git exists and is a repository, now believes it has the right to create and, if necessary, destroy the directory sub and/or its contents.  And indeed it does just that:
$ git commit -m 'add sub/file'
[master d6c0cb6] add sub/file
 2 files changed, 2 insertions(+)
 create mode 100644 .gitignore
 create mode 100644 sub/file
$ git clean -dfx
Removing sub/README

This happens despite sub/README being a Git-controlled file in the sub Git repository:
$ (cd sub; git status --short)
$ (cd sub;git status --short)
 D README
?? file

This situation is, in a word, fraught.  Don't do it.

A: If you add the file using the low-level plumbing command:
git update-index --add nested_repo/myfile

then git will treat that file, and all other files in nested_repo, normally from then onwards. I.E. once the parent repository is tracking the file, git add will work normally to add future changes.

A: It's not really a solution, but it's what I end-up doing: since I have very few files to manage (actually... only one) I did a hard link of that file (symlink would not work as they are not handled the way I want) to another file in my project. I slightly modified the code to include this new file instead.
Seems to work fine so far. But keep in mind that hard link may vanish if you copy your folders somewhere else, and that it is not supported on all filesystems (e.g. FAT32).


text:
Q: ScrollIntoView for dynamic lists Here is code sample
I need to scroll the element to the top of the page. But the problem is that list (which contains the element) is asynchronous. And I can not predict the height of elements on top and after the element.
I was trying different approaches. And because of the fact that I can not put any code into the elements (to check if they are finishing their load process), I decided to stop on setTimeout. But it's not a good solution.
Is it possible to avoid it?
I'm using react for that. But it could be a general JS question.


text:
Q: How do I save user input per tab created through jQuery? I am working on a project that allows a user to check off boxes per tab that is created through jQuery. The tabs are created when a user clicks on the Add button. Jquery generates a set of checkboxes per tab and should allow the user to check any number of boxes they want. The issue is that it looks like they share the same checkboxes since checking boxes in one tab transfers it over to the other tab. Is this something for Session Storage? Do I have to give each checkbox a unique name? Not quite sure if this is possible with just jQuery.
I realize that something like this would be easier using a stack but I am doing this to get a better understanding of that process.
Git: https://github.com/frfroylan/project_checklist
Link: http://proj-checklist.surge.sh/
HTML:

Product Checklist

New Product name:

                                <input type="text" placeholder="    Product Name" id="newProductName">
                                <button onclick="genLi()">Add</button>

JS:
script = function(){
                newTabPanel = $('#new');
                newTab = $('#newTab');

                genLi = function(){
                                $('.active').removeClass('active');
                                var prodName = $('#newProductName').val();
                                var newLi = $('
'+ prodName +'
');
                                newTab.before(newLi);
                                genNewTabCont(prodName);
                }
                genNewTabCont = function(id){
                                var newTabPane = $('HTML_TO_LONG_CHECK_GIT');
                                newTabPanel.before(newTabPane);
                }
}

A: As you already noticed the error does not occur, when you choose different names. DOM manipulation with jQuery is all about selectors. If you just use an data-attribute or class as selector your jQuery call will affect all matched elements. If you want every tab to be unique, you have to create unique ID selectors or reference them by their position.
$('.tab').eq(position);


text:
Q: Penalized regression: length of "positive" does not match I am trying to use penalized regression to predict data column y using the predictors month and time. I would like to include a positivity constraint on one of the predictors but not on the other. It is all working fine if I am using positive=TRUE or positive=FALSE but if I am using positive=c(T,T) or positive=c(T,F) I am getting the following error:
Error in .checkinput(match.call(), parent.frame()) :
  length of "positive" does not match column count of "penalized"
although the length of the constraint and the length of the predictors matches.
The month predictor is a factor while time is numeric. However, changing month to a numeric variable doesn't help either. Here is my code:
library(penalized)
df<-data.frame(date=seq(as.Date("2018-01-01"), as.Date("2018-10-01"), by="days"))
df$month<-format(as.Date(df$date), "%m")
df$y<-runif(nrow(df),1,100)
df$time<- -floor(nrow(df)/2):(ceiling(nrow(df)/2)-1)/1000
df$month<-as.factor(df$month)

training<-df[1:200,]
test<-df[201,]

ens<-penalized(y, ~ month+time, ~ 0,lambda1=1, lambda2=1, positive =c(F,T), data=training)

pred<-predict(ens,~ month + time, ~0,data=test)

Can anyone spot what is wrong here?

A: month is categorical, so under the hood you end up with a design matrix with 11 columns (January through October + the time variable). This solves the problem:
ens<-penalized(y, ~ month+time, ~ 0,lambda1=1, lambda2=1, positive =c(rep(F,10),T), data=training)


text:
Q: Prevent vaadin to start up in integration test whenever I start up my integration tests (@SpringBootTest) and the application context is started, it also runs through the entire vaadin start up routine. this can take a few moments (~ 2 mins currently) until "Vaadin application has been deployed and started to the context path "/"." is displayed.
for some of my ITs I don't need vaadin, because I just test some other interfaces and I wonder if I can prevent vaadin to boot during selected tests?

A: You have to exclude the following auto configurations of Vaadin:

*

*VaadinScopeConfig

*SpringSecurityAutoConfiguration

*SpringBootAutoConfiguration

All three are located at com.vaadin.flow.spring.


text:
Q: PyQt5 dependency in a module on Debian I have a Python module with a __main__ that uses PyQt5. I've installed PyQt5 on a Debian Buster box:
apt-get install python3-pyqt5

The __main__ program runs as expected if I execute
python3 mymodule/__main__.py

from the  source directory. Now I've installed the module into python:
python3 setup.py install

That worked. The setup.py lists a dependency on pyqt5:
setup(
    # ...
    install_requires=['PyQt5'],
    entry_points={"gui_scripts": ["mymodule = mymodule.__main__:main"]},

Setup created a script /usr/local/bin/mymodule. When I run that, I get an error message:

pkg_resources.DistributionNotFound: The 'PyQt5' distribution was not found and is required by mymodule

What am I missing?
EDIT: tried installing pyqt5 via pip, got the following error:
seva@sandbox:~$ sudo pip3 install pyqt5
Collecting pyqt5
Using cached  https://files.pythonhosted.org/packages/3a/fb/eb51731f2dc7c22d8e1a63ba88fb702727b324c6352183a32f27f73b8116/PyQt5-5.14.1.tar.gz
Installing build dependencies ... done
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/usr/lib/python3.7/tokenize.py", line 447, in open
    buffer = _builtin_open(filename, 'rb')
FileNotFoundError: [Errno 2] No such file or directory: '/tmp/pip-install-26kj5hrc/pyqt5/setup.py'

----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-install-26kj5hrc/pyqt5/

A: OS-level package managers are designed to be consistent within itself. But they aren't designed to interoperate with language package managers. apt-get-installed python3-pyqt5 could be recognized by other Debian packages but not by pip/setuptools.
So either you convert your package to .deb (using stdeb, for example), set dependency to python3-pyqt5 and install it with apt/apt-get/dpkg. Or you install everything using pip:
pip install pyqt5
pip install .  # to install your package

If your dependencies are properly declared in the package the latter command should be enough — pip will run the former itself.
PS. Also please consider virtualenv to separate pip-installed packages from system-installed. virtualenv itself could be system-installed or user-installed:
apt install python3-virtualenv

or
pip install [--user] virtualenv


text:
Q: Translation of the German term "steile These" Is there any good translation for German steile These, which means something like daring hypothesis? A Steile These is a contentious hypothesis which is or can not really be proven.
Examples from the German press:

Steile These: Die Menschen werden dümmer
  [?]: People becoming more stupid
Steile These: Microsoft jetzt innovativer als Apple?
  [?]: Microsoft more innovative than Apple now?

A: Without further specifics of usage, I would go for bold claim. I chose claim, because I perceive it as more ideomatic than thesis (the English thesis is less ideomatic than the German These).
Here are some examples of bold claim in use:

Professors Make Bold Claim: Active Managers Better Than Monkeys
Are you afraid to make a bold claim about your business?
Dier makes bold claim about why rivals can't handle Tottenham under Pochettino
Linus Torvalds Makes Bold Claim That 2016 'Will Be The Year Of The ARM Laptop'


text:
Q: Moser iteration for elliptic systems I heard that De Giorgi-Nash-Moser type regularity arguments fail for elliptic systems, but do not know where to start looking for more substantial information. Why does the regularity fail? Is there some cases where the Moser iteration can be successfully applied to elliptic systems?

A: Basically, the De-Giorgi - Moser - Nash regularity result fails for elliptic system. As Johannes pointed out, there is a counter-example in Giusti book.
For system, usually, one can get "partial regularity result". What I mean by that is: there exists $\Omega_0 \subset \Omega$ open such that $|\Omega\setminus \Omega_0|=0$ and $u \in C^{1,\alpha}(\Omega_0)$. Then with the smoothness of coefficients, you can have $u \in C^\infty(\Omega_0)$.
There are several references you can have a look at are:

*

*M. GIAQUINTA, Multiple Integrals in the Calculus of Variations and Nonlinear Elliptic
Systems, Princeton U. Press, Princeton, 1983.

*M. GIAQUINTA • E. GIUSTI, On the regularity of the minima of variational inte-
grals, Acta. Math. 148 (1982), 31-46.

*Evans, Lawrence C. Quasiconvexity and partial regularity in the calculus of variations. Arch. Rational Mech. Anal. 95 (1986), no. 3, 227--252.
In the third one, Evans proved the "partial regularity result" for a minimizer of certain energy functional. The most important thing is that the Lagrangian only need to be uniformly stricly-quasiconvex instead of uniformly convex. And it has some very important applications in elasticity. You can search for some papers of John Ball for this issue.

A: Hi.
The point is not the ellipticity. In fact the Argument of De Giorgi, Moser and Nash was designed for elliptic problems. The point is that solutions $u: \Omega\to\mathbb{R}^N$ of elliptic problems with $N>1$ just aren't $C^{1,\alpha}$ any more in general. This is no problem with the method, it's intrinsic. The famous counterexample is by De Giorgi himself.
See Giusti - The direct method of variational calculus for more details to this topic. The counterexample itself can be found as example 6.3 in this book. The paper from De Giorgi is "Un esempio di estremal discontinue per un problema variazionale di tipo ellittico", Boll. U.M.I., 4 (1968), 135-137


text:
Q: kerberos authentication in Kudu for spark2 job I am trying to put some data in kudu, but the worker cannot find the kerberos token, so I am not able to put some data into the kudu database.
here you can see my spark2-submit statement
spark2-submit --master yarn "spark.yarn.maxAppAttempts=1" --conf "spark.authenticate=true" --deploy-mode cluster --properties-file ./custom.properties --keytab /home/stream_ingest/stream_ingest.keytab  --principal xxx@xxx --class app.test.Task

the exception is the following:
18/06/08 08:33:02 INFO client.ConnectToCluster: Unable to connect to master xxx:7051: server requires authentication, but client does not have Kerberos credentials (tgt). Authentication tokens were not used because no token is available
18/06/08 08:33:02 INFO client.ConnectToCluster: Unable to connect to master xxx:7051: server requires authentication, but client does not have Kerberos credentials (tgt). Authentication tokens were not used because no token is available
18/06/08 08:33:02 INFO client.ConnectToCluster: Unable to connect to master xxx:7051: server requires authentication, but client does not have Kerberos credentials (tgt). Authentication tokens were not used because no token is available
ERROR: exception occured during an insert to kudu, sending record ConsumerRecord(topic = custom, partition = 0, offset = 120, CreateTime = 1528444250889, checksum = 3907376269, serialized key size = -1, serialized value size = 1067790, key = null, value = [B@1623bffa) to error topic custom
org.apache.kudu.client.NonRecoverableException: Couldn't find a valid master in (xxx:7051,xxx:7051,xxx:7051). Exceptions received: [org.apache.kudu.client.NonRecoverableException: server requires authentication, but client does not have Kerberos credentials (tgt). Authentication tokens were not used because no token is available, org.apache.kudu.client.NonRecoverableException: server requires authentication, but client does not have Kerberos credentials (tgt). Authentication tokens were not used because no token is available, org.apache.kudu.client.NonRecoverableException: server requires authentication, but client does not have Kerberos credentials (tgt). Authentication tokens were not used because no token is available]
    at org.apache.kudu.client.KuduException.transformException(KuduException.java:110)
    at org.apache.kudu.client.KuduClient.joinAndHandleException(KuduClient.java:352)
    at org.apache.kudu.client.KuduClient.openTable(KuduClient.java:222)
    at java.util.Iterator.forEachRemaining(Iterator.java:116)
    at org.apache.spark.api.java.JavaRDDLike$$anonfun$foreachPartition$1.apply(JavaRDDLike.scala:219)
    at org.apache.spark.api.java.JavaRDDLike$$anonfun$foreachPartition$1.apply(JavaRDDLike.scala:219)
    at org.apache.spark.rdd.RDD$$anonfun$foreachPartition$1$$anonfun$apply$29.apply(RDD.scala:926)
    at org.apache.spark.rdd.RDD$$anonfun$foreachPartition$1$$anonfun$apply$29.apply(RDD.scala:926)
    at org.apache.spark.SparkContext$$anonfun$runJob$5.apply(SparkContext.scala:2064)
    at org.apache.spark.SparkContext$$anonfun$runJob$5.apply(SparkContext.scala:2064)
    at org.apache.spark.scheduler.ResultTask.runTask(ResultTask.scala:87)
    at org.apache.spark.scheduler.Task.run(Task.scala:108)
    at org.apache.spark.executor.Executor$TaskRunner.run(Executor.scala:338)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    at java.lang.Thread.run(Thread.java:748)
    Suppressed: org.apache.kudu.client.KuduException$OriginalException: Original asynchronous stack trace
        at org.apache.kudu.client.ConnectToCluster.incrementCountAndCheckExhausted(ConnectToCluster.java:246)
        at org.apache.kudu.client.ConnectToCluster.access$100(ConnectToCluster.java:49)
        at org.apache.kudu.client.ConnectToCluster$ConnectToMasterErrCB.call(ConnectToCluster.java:365)
        at org.apache.kudu.client.ConnectToCluster$ConnectToMasterErrCB.call(ConnectToCluster.java:354)
        at com.stumbleupon.async.Deferred.doCall(Deferred.java:1280)
        at com.stumbleupon.async.Deferred.runCallbacks(Deferred.java:1259)
        at com.stumbleupon.async.Deferred.handleContinuation(Deferred.java:1315)
        at com.stumbleupon.async.Deferred.doCall(Deferred.java:1286)
        at com.stumbleupon.async.Deferred.runCallbacks(Deferred.java:1259)
        at com.stumbleupon.async.Deferred.callback(Deferred.java:1002)
        at org.apache.kudu.client.KuduRpc.handleCallback(KuduRpc.java:246)
        at org.apache.kudu.client.KuduRpc.errback(KuduRpc.java:300)
        at org.apache.kudu.client.RpcProxy.responseReceived(RpcProxy.java:221)
        at org.apache.kudu.client.RpcProxy.access$000(RpcProxy.java:60)
        at org.apache.kudu.client.RpcProxy$1.call(RpcProxy.java:132)
        at org.apache.kudu.client.RpcProxy$1.call(RpcProxy.java:128)
        at org.apache.kudu.client.Connection.cleanup(Connection.java:715)
        at org.apache.kudu.client.Connection.exceptionCaught(Connection.java:460)
        at org.apache.kudu.shaded.org.jboss.netty.channel.SimpleChannelUpstreamHandler.handleUpstream(SimpleChannelUpstreamHandler.java:112)
        at org.apache.kudu.client.Connection.handleUpstream(Connection.java:244)
        at org.apache.kudu.shaded.org.jboss.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:564)
        at org.apache.kudu.shaded.org.jboss.netty.channel.DefaultChannelPipeline$DefaultChannelHandlerContext.sendUpstream(DefaultChannelPipeline.java:791)
        at org.apache.kudu.shaded.org.jboss.netty.channel.SimpleChannelUpstreamHandler.exceptionCaught(SimpleChannelUpstreamHandler.java:153)
        at org.apache.kudu.shaded.org.jboss.netty.channel.SimpleChannelUpstreamHandler.handleUpstream(SimpleChannelUpstreamHandler.java:112)
        at org.apache.kudu.shaded.org.jboss.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:564)
        at org.apache.kudu.shaded.org.jboss.netty.channel.DefaultChannelPipeline$DefaultChannelHandlerContext.sendUpstream(DefaultChannelPipeline.java:791)
        at org.apache.kudu.shaded.org.jboss.netty.channel.SimpleChannelUpstreamHandler.exceptionCaught(SimpleChannelUpstreamHandler.java:153)
        at org.apache.kudu.shaded.org.jboss.netty.channel.SimpleChannelUpstreamHandler.handleUpstream(SimpleChannelUpstreamHandler.java:112)
        at org.apache.kudu.shaded.org.jboss.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:564)
        at org.apache.kudu.shaded.org.jboss.netty.channel.DefaultChannelPipeline$DefaultChannelHandlerContext.sendUpstream(DefaultChannelPipeline.java:791)
        at org.apache.kudu.shaded.org.jboss.netty.handler.codec.oneone.OneToOneDecoder.handleUpstream(OneToOneDecoder.java:60)
        at org.apache.kudu.shaded.org.jboss.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:564)
        at org.apache.kudu.shaded.org.jboss.netty.channel.DefaultChannelPipeline$DefaultChannelHandlerContext.sendUpstream(DefaultChannelPipeline.java:791)
        at org.apache.kudu.shaded.org.jboss.netty.handler.codec.frame.FrameDecoder.exceptionCaught(FrameDecoder.java:377)
        at org.apache.kudu.shaded.org.jboss.netty.channel.SimpleChannelUpstreamHandler.handleUpstream(SimpleChannelUpstreamHandler.java:112)
        at org.apache.kudu.shaded.org.jboss.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:564)
        at org.apache.kudu.shaded.org.jboss.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:559)
        at org.apache.kudu.shaded.org.jboss.netty.channel.Channels.fireExceptionCaught(Channels.java:525)
        at org.apache.kudu.shaded.org.jboss.netty.channel.AbstractChannelSink.exceptionCaught(AbstractChannelSink.java:48)
        at org.apache.kudu.shaded.org.jboss.netty.channel.DefaultChannelPipeline.notifyHandlerException(DefaultChannelPipeline.java:658)
        at org.apache.kudu.shaded.org.jboss.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:566)
        at org.apache.kudu.shaded.org.jboss.netty.channel.DefaultChannelPipeline$DefaultChannelHandlerContext.sendUpstream(DefaultChannelPipeline.java:791)
        at org.apache.kudu.shaded.org.jboss.netty.handler.timeout.ReadTimeoutHandler.messageReceived(ReadTimeoutHandler.java:184)
        at org.apache.kudu.shaded.org.jboss.netty.channel.SimpleChannelUpstreamHandler.handleUpstream(SimpleChannelUpstreamHandler.java:70)
        at org.apache.kudu.shaded.org.jboss.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:564)
        at org.apache.kudu.shaded.org.jboss.netty.channel.DefaultChannelPipeline$DefaultChannelHandlerContext.sendUpstream(DefaultChannelPipeline.java:791)
        at org.apache.kudu.shaded.org.jboss.netty.channel.Channels.fireMessageReceived(Channels.java:296)
        at org.apache.kudu.shaded.org.jboss.netty.handler.codec.oneone.OneToOneDecoder.handleUpstream(OneToOneDecoder.java:70)
        at org.apache.kudu.shaded.org.jboss.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:564)
        at org.apache.kudu.shaded.org.jboss.netty.channel.DefaultChannelPipeline$DefaultChannelHandlerContext.sendUpstream(DefaultChannelPipeline.java:791)
        at org.apache.kudu.shaded.org.jboss.netty.channel.Channels.fireMessageReceived(Channels.java:296)
        at org.apache.kudu.shaded.org.jboss.netty.handler.codec.frame.FrameDecoder.unfoldAndFireMessageReceived(FrameDecoder.java:462)
        at org.apache.kudu.shaded.org.jboss.netty.handler.codec.frame.FrameDecoder.callDecode(FrameDecoder.java:443)
        at org.apache.kudu.shaded.org.jboss.netty.handler.codec.frame.FrameDecoder.messageReceived(FrameDecoder.java:303)
        at org.apache.kudu.shaded.org.jboss.netty.channel.SimpleChannelUpstreamHandler.handleUpstream(SimpleChannelUpstreamHandler.java:70)
        at org.apache.kudu.shaded.org.jboss.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:564)
        at org.apache.kudu.shaded.org.jboss.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:559)
        at org.apache.kudu.shaded.org.jboss.netty.channel.Channels.fireMessageReceived(Channels.java:268)
        at org.apache.kudu.shaded.org.jboss.netty.channel.Channels.fireMessageReceived(Channels.java:255)
        at org.apache.kudu.shaded.org.jboss.netty.channel.socket.nio.NioWorker.read(NioWorker.java:88)
        at org.apache.kudu.shaded.org.jboss.netty.channel.socket.nio.AbstractNioWorker.process(AbstractNioWorker.java:108)
        at org.apache.kudu.shaded.org.jboss.netty.channel.socket.nio.AbstractNioSelector.run(AbstractNioSelector.java:337)
        at org.apache.kudu.shaded.org.jboss.netty.channel.socket.nio.AbstractNioWorker.run(AbstractNioWorker.java:89)
        at org.apache.kudu.shaded.org.jboss.netty.channel.socket.nio.NioWorker.run(NioWorker.java:178)
        at org.apache.kudu.shaded.org.jboss.netty.util.ThreadRenamingRunnable.run(ThreadRenamingRunnable.java:108)
        at org.apache.kudu.shaded.org.jboss.netty.util.internal.DeadLockProofWorker$1.run(DeadLockProofWorker.java:42)
        ... 3 more

It looks like that the kudu client does not find the keytab file. In the kudu documentation they mentioned, that you only have to specify the keytab and principal parameter.
If you execute a openTable on the KuduClient in the driver, everything works fine.


text:
Q: JFrame doesn't paint after receiving an event I have my code below, I am trying to receive m_rows which is an array. It looks like it stays empty and my frame stays blank. I can see the class has received the event. I think my class Table works ok. Do you see anything obviously wrong in the code below between the receipt of m_rows from the listener and passing it to TableModel(m_rows)?
Thanks
class Frame extends JFrame implements FlowListener {

    private List<Candle> m_rows = new ArrayList<Candle>();

    public Frame() {

        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        setTitle("Ma premiere fenetre");
        setBounds(50, 100, 1000, 800);

        Container conteneur = new JPanel();
        TableModel tableModel = new TableModel(m_rows);
        JTable table = new JTable(tableModel);

        JPanel tablePanel = new JPanel();

        tablePanel.add(table);

        conteneur.setLayout(new GridLayout(2, 1));
        conteneur.add(tablePanel);

        this.add(conteneur);
        this.setVisible(true);

    }

    @Override
    public void updateOnFlow(List<Candle> newFlow) {
        m_rows = newFlow;
        this.repaint();

    }

}

A: I think the problem is that assigning something to m_row has no effect on the TableModel. Try this:
class Frame extends JFrame implements FlowListener {
    private JTable table;
    ...

    public Frame() {
        ...
        TableModel tableModel = new TableModel(m_rows);  // Did you mean DefaultTableModel?
        table = new JTable(tableModel);
        ...
    }

    @Override
    public void updateOnFlow(List<Candle> newFlow) {
        m_rows = newFlow;
        TableModel tableModel = new TableModel(m_rows);
        table.setModel(tableModel);
        this.repaint();
    }
}


text:
Q: ASP.NET MVC - Post form to html bookmark? When using a form like this:

<%:Model.EulaTitle %>

<%=Model.EulaHtml %>

<%:Html.ValidationSummary()%>

<% using (Html.BeginForm())
   { %>

<%:Html.HiddenFor(model => model.SourceUrl)%>
<%:Html.HiddenFor(model => model.EulaId)%>

<%:Html.CheckBoxFor(model => model.Accepted)%>
<%:Html.LabelFor(model => model.Accepted)%>

<input type="submit" value="Submit">
<% } %>

I need the page to scroll to #errors when it posts. The Model.EulaHtml contains some length EULA text and I'd prefer that the user not have to manually scroll down to see an error message if they post the page without accepting the agreement.
If the controller detects ModelState.IsValid on Post, it redirects to another page. If not, I need to stay on this page, but scroll to the #errors bookmark anchor tag.
I've thought about just adding '#errors' to the end of the url in the form action, but I receive errors along the line of a potentially dangerous .... ('%'). It's possible that I'm incorrectly encoding the hash mark. Anyone else had to deal with this? We're dealing with pretty restrictive requirements for browser compatibility (IE6+ and everything else under the sun) so I try to avoid using JavaScript whenever possible.
Update
The error I'm receiving is:
A potentially dangerous Request.Path value was detected from the client (%).

I modifed the Html.BeginForm() call to
<% using (Html.BeginForm(new { @action="#errors" }))
   { %>

And the resulting URL is:
http://..../TheControllerName/Eula/%2523errors/

I also noticed that a few queryString parameters that were being passed through disappear when I set the action attribute in this way.  (Not surprising, but no fix for that is immediately obvious to me)

A: Try like this:
<form action="<%: Url.Action("actionName", "controllerName") %>#errors" method="post">

    <%:Html.HiddenFor(model => model.SourceUrl)%>
    <%:Html.HiddenFor(model => model.EulaId)%>

    <%:Html.CheckBoxFor(model => model.Accepted)%>
    <%:Html.LabelFor(model => model.Accepted)%>

    <input type="submit" value="Submit">

</form>

You could also write a custom HTML helper that will do the job:
public static class FormExtensions
{
    public static MvcForm MyBeginForm(this HtmlHelper htmlHelper, string actionName, string controllerName, string fragment)
    {
        var formAction = UrlHelper.GenerateUrl(null, actionName, controllerName, htmlHelper.ViewContext.HttpContext.Request.Url.Scheme, null, fragment, null, htmlHelper.RouteCollection, htmlHelper.ViewContext.RequestContext, true);
        var builder = new TagBuilder("form");
        builder.MergeAttribute("action", formAction);
        builder.MergeAttribute("method", "post", true);
        htmlHelper.ViewContext.Writer.Write(builder.ToString(TagRenderMode.StartTag));
        return new MvcForm(htmlHelper.ViewContext);
    }
}

And then:
<% using (Html.MyBeginForm("index", "home", "errors")) { %>
    ...
<% }

A: Updated MVC 4 solution to the problem:
 @using (Html.BeginForm(null, null, null, FormMethod.Post,
     new
        {
            @action = Url.Action("MyAction") + "#bookmark",
            @class = "form-class",
            target = "_blank"
        }))
 {
     ...
     <input type="submit" value="submit" />

 }

Html.BeginForm will generate the validation attributes in your form, using the html <form> tag will not.
This call is using the Html.BeginForm(actionName, controllerName, routeValues, FormMethod, htmlAttributes) overload, nulling all the routing and assigning the action as an html attribute instead.  The routing is accomplished by using Url.Action(), to which I append my bookmark.

A: I came up with a solution a bit different to this, using an action filter:
http://spikehd.blogspot.com/2012/01/mvc3-redirect-action-to-html-bookmark.html
It modifies the HTML buffer and outputs a small piece of javascript to instruct the browser to append the bookmark.
Hope it helps :)


text:
Q: Find the value of $\lim _{x\to \infty }\left(1+\frac{4}{\ln x}\right)^{\ln\left(x^2+x\right)}$ So this is my attempt to the question:
Let,
$$y=\left(1+\frac{4}{\ln x}\right)^{\ln\left(x^2+x\right)}$$
$$\ln y=\ln(x^2+x)\ln\left(1+\frac{4}{\ln x}\right)$$
$$\lim _{x\to \infty }\ln y=\lim _{x\to \infty }\ln(x^2+x)\ln\left(1+\frac{4}{\ln x}\right)$$
Solving for the right side, since it is in the form of $\infty\cdot0$, we can change this into
$$\lim _{x\to \infty }\frac{\ln(x^2+x)}{\frac{1}{\ln\left(1+\frac{4}{\ln x}\right)}}$$
So that we can then use the L'Hopital rule.
However, after using the L'Hopital rule once, I found the form to be even more complicated and still becomes an indeterminate form.
Is there another way to solve this problem?

A: You can observe that,
$$
\begin{align}\lim _{x\to \infty }\left(1+\frac{4}{\ln x}\right)^{\ln\left(x^2+x\right)}=\lim _{x\to \infty }\left(\left(1+\frac{4}{\ln x}\right)^{\frac {\ln x}{4}}\right)^{\frac {4\ln (x^2+x)}{\ln x}}\end{align}
$$
Since $\lim _{x\to \infty }\left(1+\frac{4}{\ln x}\right)^{\frac {\ln x}{4}}=e$, we need to evaluate the limit $$\lim_{x\to\infty }\frac {\ln (x^2+x)}{\ln x}.$$
Using the following inequality
$$
\begin{align}2=\frac {\ln (x^2)}{\ln x}≤\frac {\ln (x^2+x)}{\ln x}≤\frac {\ln (x^2+x^2)}{\ln x}=2+\frac {\ln 2}{\ln x}\end{align}
$$
and applying the Squeeze theorem we have:
$$\lim_{x\to\infty}\frac {\ln (x^2+x)}{\ln x}=2.$$
Thus, we conclude:
$$\begin{align}\lim _{x\to \infty }\left(1+\frac{4}{\ln x}\right)^{\ln\left(x^2+x\right)}&=e^{4\cdot 2}\\
&=e^8.\end{align}$$

A: $L=\lim\limits_{x\to \infty}\left(1+\frac{4}{\ln{x}}\right)^{\ln{(x^2+x)}}=\lim\limits_{x\to \infty}\left(1+\frac{4}{\ln{x}}\right)^{\ln{x}}\left(1+\frac{4}{\ln{x}}\right)^{\ln{(x+1)}}$
Let $y=\ln{x}$.
$L=\lim\limits_{y\to\infty}\left(1+\frac{4}{y}\right)^y \left(\left(1+\frac{4}{y}\right)^y\right)^{\ln{(x+1)}/\ln{x}}=e^4\left(e^4\right)^1=e^8$


text:
Q: Converting Cartesian image to polar, appearance differences I'm trying to do a polar transform on the first image below and end up with the second. However my result is the third image. I have a feeling it has to do with what location I choose as my "origin" but am unsure.

  radius = sqrt(width**2 + height**2)
  nheight = int(ceil(radius)/2)
  nwidth = int(ceil(radius/2))
 for y in range(0, height):
   for x in range(0, width):
     t =  int(atan(y/x))
     r = int(sqrt(x**2+y**2)/2)
     color = getColor(getPixel(pic, x, y))
     setColor( getPixel(radial,r,t), color)

A: There are a few differences / errors:

*

*They use the centre of the image as the origin

*They scale the axis appropriately. In your example, you're plotting your angle (between 0 and in your case, pi), instead of utilising the full height of the image.

*You're using the wrong atan function (atan2 works a lot better in this situation :))

*Not amazingly important, but you're rounding unnecessarily quite a lot, which throws off accuracy a little and can slow things down.

This is the code combining my suggested improvements. It's not massively efficient, but it should hopefully work :)
  maxradius = sqrt(width**2 + height**2)/2
  rscale = width / maxradius
  tscale = height / (2*math.pi)
  for y in range(0, height):
   dy = y - height/2
   for x in range(0, width):
     dx = x - width/2
     t =  atan2(dy,dx)%(2*math.pi)
     r = sqrt(dx**2+dy**2)
     color = getColor(getPixel(pic, x, y))
     setColor( getPixel(radial,int(r*rscale),int(t*tscale)), color)

In particular, it fixes the above problems in the following ways:

*

*We use dx = x - width / 2 as a measure of distance from the centre, and similarly with dy. We then use these in replace of x, y throughout the computation.

*We will have our r satisfying 0 <= r <= sqrt( (width/2)^2 +(height/2)^2 ), and our t eventually satisfying 0 < t <= 2 pi so, I create the appropriate scale factors to put r and t along the x and y axes respectively.

*Normal atan can only distinguish based on gradients, and is computationally unstable near vertical lines... Instead, atan2 (see http://en.wikipedia.org/wiki/Atan2) solves both problems, and accepts (y,x) pairs to give an angle. atan2 returns an angle -pi < t <= pi, so we can find the remainder modulo 2 * math.pi to it to get it in the range 0 < t <= 2pi ready for scaling.

*I've only rounded at the end, when the new pixels get set.

Any questions, just ask!


text:
Q: Why does IDEA mark certain parts of Play code red? I'm pretty new to the Play framework. I've been trying to configure it so I can use it with IntelliJ Ultimate.
I use following:

*

*IntelliJ Ultimate 14.03

*Scala plugin for IntelliJ 1.2.1

*Play Framework 2.3.7 (the one that works online 1,2MB)

*Scala 2.11

*JDK 1.7

*Windows 7

My problem is all about the fact that i can't make the errors disappear. Below is a simple example. When I create something more complicated (mapping etc.) I get entire blocks of red (also it does not suggest any code for the more complicated code).

What I've tried to fix it:
- deleting .idea folder and generating it again
- cleaning sbt
- generating a Play app from inside activator and also from IntelliJ
- re-installing IntelliJ
This is how I create the app from inside IntelliJ

I'm new both to Scala and Play, but I've done some research and I didn't end up with working solution. The same project works on Eclipse, but I would like to stick with IntelliJ.

A: The Scala plugin 1.2.1 is fairly outdated (given the development stage/pace of the Scala support in IntelliJ IDEA).
As of today, Jan, 29th, you should really be using the latest version of the Scala plugin 1.3.


text:
Q: Удалить все теги, заменить Есть строчка

Текст

Текст.
Текст fdsТекст.
Текст ТекстТекст Текст.link

Как удалить все теги, но оставить их содержимое, а заместо тега

Вставить
/n

A: Регулярное выражение <!?/?\w+(\s[\w-]+(=['"]?.*?['"]?)?)*/?> выберет все теги - будь то с аттрибутом или без. Осталось только поставить его в replace() и заменить На то что нужно.

Проверил у себя в VS Code:

Выделяется все кроме внутреннего текста.

A: Алгоритм:

*

*Заменяем все
 на \n

*Берём всё текстовое содержимое

const texts = document.querySelector('#texts');

texts.innerHTML = texts.innerHTML.replaceAll('
', '\n
');

console.log('innerHTML:\n', texts.innerHTML);
console.log('textContent:\n', texts.textContent);

Текст

Текст.
Текст fdsТекст.
Текст ТекстТекст Текст.link


text:
Q: Let a relation on $\mathbb{Z}$, check if that is a equivalence relation on $\mathbb{Z}$ and write the equivalence class of $0$ I have this exercise:
$$\mathcal{R} = \left \{ (a,b) \in \mathbb{Z} \times \mathbb{Z} \quad \mbox{ such that } \quad 15 \mid 4b + 11a\right \}$$
i.e. $a \mathcal{R} b \iff 15 \mid 4b + 11a$.
i) Check if $\mathcal{R}$ is a equivalence relation on $\mathbb{Z}$;
ii) Write the equivalence class of $0$.
development:
point i)
$\mathcal{R}$ is reflexive in fact,
$\forall a \in \mathbb{Z} \times \mathbb{Z}, \,a \mathcal{R} a, $ since $15 \mid 4a+11a \iff 15 \mid 15a$
$\mathcal{R}$ is symmetric in fact,
$a \mathcal{R} b \Rightarrow 15 \mid 4b+11a$
and also
$\forall a,b \in \mathbb{Z} \times \mathbb{Z}$ we have $15 \mid 15b+15a$
therefore
$15 \mid 15b+15a-4b-11a=4a+11b$
so $b \mathcal{R} a$
$\mathcal{R}$ is transitivve, in fact,
assuming $a \mathcal{R}b \mbox{ and } b\mathcal{R}c$ we have:
$a \mathcal{R} b \Rightarrow 15 \mid 4b+11a $
$b \mathcal{R} c \Rightarrow 15 \mid 4c+11b $
therefore $a \mathcal{R} c$
point ii)
The class of zero is:
$a \mathcal{R} 0 \iff 15 \mid 11a$ i.e. the multiples of $15$.
END
this is a solved exercise but there are some point I don't understand.
- why we have that $15 \mid 15b + 15a$, and also why $15 \mid 4a+11b$ ?
- why the class of zero is defined in that way?
Please, can you help me? Thanks!

A: $15|15b+15a$ because $15b+15a=15(a+b)$ and $a$ and $b$ are both integers and thus, so is their sum.  For $15|4a+11b$  since we know $15|15a+15b$ then and since we have $a\mathscr Rb$  implies $15|4b+11A$ implies $(-a)\mathscr R(-b)$ implies $15|-4b-11a$  Then $15|(15a+15b)+(-4a-11b)$ becuase $15$ divides each thus is divides the sum. which gives us $15|4a+11b$
And the equivalence class is all the numbers that would be related to $0$.  Then $a\mathscr R 0$ if $15|11a+4(0)$ which gives $15|11a$


text:
Q: i want to save data in firebase by date means all the data saved by users is saved on that date I am trying to save data in firebase but i want save by date so that i can fetch it by date.
func saveData(){
    ref = Database.database().reference()
    let userid = Auth.auth().currentUser?.uid
    let timestamp = NSDate().timeIntervalSince1970
    self.date = timestamp

    let fuelDetails:[String:Any] = ["tank_for_refueling" : self.tankForRefuelingTextField.text ?? "",
                                    "fuel_quantity_refueled" : self.fuelQuantityRefueledTextField.text ?? "",
                                    "tank_after_refueling" : self.tankAfterRefuelingTextField.text ?? "",
                                    "date": self.date ?? 0]
    ref.child(Constants.NODE_MAINTENANCE).child("date").child(userid!).child(Constants.NODE_FUEL).childByAutoId().setValue(fuelDetails){(error,databaseRef) in
        if let error = error{
            print(error.localizedDescription)
        }

    }
}

A: You can use something like this:
    func saveData(){
        // ... other code
        let getDate = Date()
        let formatter = DateFormatter()
        formatter.dateFormat = "dd-MM-yyyy"
        self.date = formatter.string(from: getDate)

        let fuelDetails:[String:Any] = ["tank_for_refueling" : self.tankForRefuelingTextField.text ?? "",
                                        "fuel_quantity_refueled" : self.fuelQuantityRefueledTextField.text ?? "",
                                        "tank_after_refueling" : self.tankAfterRefuelingTextField.text ?? "",
                                        "date": self.date ?? 0]
        ref.child(Constants.NODE_MAINTENANCE).child("\(self.date)").child(userid!).child(Constants.NODE_FUEL).childByAutoId().setValue(fuelDetails){(error,databaseRef) in
            if let error = error{
                print(error.localizedDescription)
            }

        }
    }

EDIT
Updated syntax from dots to dashes in case Firestore is trying to parse a child


text:
Q: Question regarding rolling resistance in train motion Hello I need to write a train model but there is one concept that is not really clear for me...
In the train model we have some forces: Tractive effort, braking effort, resistance to motion and external forces as well. So it seems that for each situation applied forces are different.
If the train is being accelerated it will have tractive effort, resistance to motion and external forces
If the train is coasting it will have only resistance to motion and external forces.
Lastly, if the train is braking it will have only braking effort and external forces.
My question is why in the braking scenario it won't have resistance to motion even if aerodynamic drag and rolling resistance are present? Shouldn't it be considered as well in the braking scenario?
Best regards!


text:
Q: How to draw a Littelmann path? Littelmann path is a combinatorial tool to compute multiplicity. I have some questions about the definition of Littelmann path. It is said that a Littelmann path is a piecewise-linear mapping
   $$\pi:[0,1]\cap \mathbf{Q} \rightarrow P\otimes_{\mathbf{Z}}\mathbf{Q} \quad\quad (1)$$
such that $\pi(0) = 0$ and $\pi(1)$ is a weight.
Here $\mathbf{Q}$ is the field of rational numbers, $P$ is the weight lattice of a Lie algebra $\mathfrak{g}$, $\mathbf{Z}$ is the ring of integers. I think that if we draw a Littelmann path in type $A_2$ case, then the graph is in a $3$-dimensional space. But in the example, on the top of page 43, the path is drawn in a plane. How to draw a Littelmann path using definition (1)? Does a Littelmann path represent an element in the basis of a representation of a Lie algebra? Thank you very much.

A: Type $A_2$ means the Lie algebra is that of $SL_3$, which has a 2-dimensional maximal torus, so the weight lattice for that algebra is also of rank 2. Did you think dimension 3 because of $GL_3$? It has a maximal torus of dimension 3, but the group is not semisimple: it has a 1-dimensional central torus (scalar multiples of the identity). The center of the Lie algebra is not of great interest to Littelmann paths, so even if you are doing paths for the Lie algebra of $GL_3$, you wouldn't lose much information in projecting the paths along the "central" direction onto a 2-dimensional plane. Points so identified are weights that, viewed as linear functions on matrices living in the Lie algebra, differ by a multiple of the trace function (the trace annihilates the maximal torus of the $SL_3$ algebra, since it consists of traceless matrices). If $\varepsilon_i$ is the function on diagonal matrices that takes the $i$-th diagonal coefficient ($i=1,2,3$), then $\varepsilon_1+\varepsilon_2+\varepsilon_3$ is the trace, and this is 0 as a weight for $SL_3$; the weight lattice for this group is usually drawn with the $\varepsilon_i$ as equal length vectors at 120 degree angles, so that their sum is 0, and this gives the triangular lattice of the picture you referred to.


text:
Q: How to extract a specific value from a comma separated string var response = [
    [
        "209.90",
        "-3.55",
        "-1.66",
        "50",
        "0",
        "2161",
        "214.20",
        "217.00",
        "207.05",
        "213.45",
        "211.53",
        "169202",
        "357.91",
        "15:44:21"
    ]
];

for(var i=0;i<response.length;i++)
{
    alert(response[i]);
}

Is it possible to extract 6th element from the array ??
that is 2161 in the above case ??
http://jsfiddle.net/y9c0m4ny/
Please let me know if this is possible thanks in advance .

A: The response array is an array within an array. So when you response[0], you get the whole array at the index 0. To get the 6th element, that is at the 5th index, you can do response[0][5].

A: You have an array, which position 0 is an array
for(var i=0;i<response[0].length;i++)
{
    alert(response[0][i]);
}

To extract 6th element:
response[0][5]

If you don't want it as a two dimension array, build it with only one bracket:
var response = [
    "209.90",
    "-3.55",
    "-1.66",
    "50",
    "0",
    "2161",
    "214.20",
    "217.00",
    "207.05",
    "213.45",
    "211.53",
    "169202",
    "357.91",
    "15:44:21"
];

Or, if you can't change this code, use:
response = response[0];


text:
Q: Double integral notation Over a region D (a bounded, closed and connected region), can we write the double integral $\iint\limits_D \, f(x,y)\,dx\,dy$ as $\iint\limits_D \, f(x,y)\,dy\,dx$ (note the order of $dx$ and $dy$)?

A: If either:

*

*$f\ge 0$;

*$\iint\limits_D |f(x,y)| dxdy<\infty$;

*$\iint\limits_D |f(x,y)| dydx<\infty$,

you can. This is true if, for example, $f$ is bounded.

A: In my opinion
$$ \iint_D f(x,y)\,\mathrm dx\,\mathrm dy$$
for $D\subseteq\mathbb R^2$ is bad notation. It suggests that what you are looking at is an iterated integral, where you integrate with respect to $x$ first and afterwards with respect to $y$. But it is not, it's an integral over a region in $\mathbb R^2$. You are integrating with respect to the two-dimensional Lebesgue-measure. Better notations are
$$
\iint_D f(x,y)\,\mathrm dA\ , \int_D f(x,y)\,\mathrm dA\ , \int_D f\,\mathrm d\lambda
$$
or variants of that. Those notations don't suggest an iterated integral.

If we really wanted to interpret $\iint_D f(x,y)\,\mathrm dx\,\mathrm dy$ as an iterated integral, it would be
$$
\int_{\operatorname{pr}_2(D)} \left( \int_{\{x \in\mathbb R \mid (x,y)\in D\}} f(x,y)\,\mathrm dx \right) \mathrm dy
$$
where $\operatorname{pr}_2$ is the projection $(x,y)\mapsto y$ and $\{\,x\in\mathbb R \mid (x,y)\in D\}$ are all the possible $x$-values in the horizontal slice of $D$ where the second coordinate equals a fixed $y$. Hiding this behind $\iint_D$ is another bad idea.


text:
Q: Riemann sum with complete system of residues of $n$ How to prove this conjecture?

Conjecture $f$ is Riemann integrable function in$[0,1]$,then
$$
\lim_{n\to\infty}\frac{1}{\varphi(n)}\sum_{\substack{1\le k\le n\\(k,n)=1}}f\left(\frac{k}{n}\right)=\int_0^1 f(x)\mathrm{d}x
$$

similar to Weyl's criteria?


text:
Q: error in importing Http/http.dart package I updated the dependencies with proper indentation, then flutter pub get and then import it in the code. Tried to restart my ide as well. The error pops up when i try to build the application.
Error:

Unable to find modules for some sources, this is usually the result of
  either a bad import, a missing dependency in a package (or possibly a
  dev_dependency needs to move to a real dependency), or a build failure
  (if importing a generated file).
Please check the following imports:
import 'package:http/http.dart' as http; from myapp|lib/myapp.dart
  at 83:1

Code:
    import 'package:flutter/material.dart';
    import 'package:http/http.dart' as http;
    import 'dart:convert';
    import 'dart:async';

     void main(){
       runApp(MaterialApp(
         home: HomePage(),
       ));
     }

     class HomePage extends StatefulWidget {

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

     class _HomePageState extends State<HomePage> {

       Future getData() async{
         http.Response response = await http.get("http://dummy.restapiexample.com/api/v1/employees");
         debugPrint(response.body);
       }

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

       @override
       Widget build(BuildContext context) {
         return Scaffold(
           appBar: AppBar(
             title: Text("Employees"),
             backgroundColor: Colors.green,
           ),
         );
       }
     }

pubspec.yaml
    name: myapp
    description: A new Flutter project.

    # The following defines the version and build number for your application.
    # A version number is three numbers separated by dots, like 1.2.43
    # followed by an optional build number separated by a +.
    # Both the version and the builder number may be overridden in flutter
    # build by specifying --build-name and --build-number, respectively.
    # In Android, build-name is used as versionName while build-number used as versionCode.
    # Read more about Android versioning at https://developer.android.com/studio/publish/versioning
    # In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
    # Read more about iOS versioning at
    # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
    version: 1.0.0+1

    environment:
      sdk: ">=2.1.0 <3.0.0"

    dependencies:
      flutter:
        sdk: flutter

      http: ^0.12.0+4

      # The following adds the Cupertino Icons font to your application.
      # Use with the CupertinoIcons class for iOS style icons.
      cupertino_icons: ^0.1.2

    dev_dependencies:
      flutter_test:
        sdk: flutter

    # For information on the generic Dart part of this file, see the
    # following page: https://dart.dev/tools/pub/pubspec

    # The following section is specific to Flutter.
    flutter:

      # The following line ensures that the Material Icons font is
      # included with your application, so that you can use the icons in
      # the material Icons class.
      uses-material-design: true

      # To add assets to your application, add an assets section, like this:
      # assets:
      #  - images/a_dot_burr.jpeg
      #  - images/a_dot_ham.jpeg

      # An image asset can refer to one or more resolution-specific "variants", see
      # https://flutter.dev/assets-and-images/#resolution-aware.

      # For details regarding adding assets from package dependencies, see
      # https://flutter.dev/assets-and-images/#from-packages

      # To add custom fonts to your application, add a fonts section here,
      # in this "flutter" section. Each entry in this list should have a
      # "family" key with the font family name, and a "fonts" key with a
      # list giving the asset and other descriptors for the font. For
      # example:
      fonts:
        - family: IndieFlower
          fonts:
            - asset: fonts/IndieFlower-Regular.ttf

      #
      # For details regarding fonts from package dependencies,
      # see https://flutter.dev/custom-fonts/#from-packages

A: Have you tried restarting your IDE?
https://flutter.dev/docs/development/packages-and-plugins/using-packages

Stop and restart the app, if necessary If the package brings
  platform-specific code (Java/Kotlin for Android, Swift/Objective-C for
  iOS), that code must be built into your app. Hot reload and hot
  restart only update the Dart code, so a full restart of the app might
  be required to avoid errors like MissingPluginException when using the
  package.

A: I see your Flutter version is 1.13.6.
I also experienced some strange problems with this version, but when I switched to dev channel all the problems are gone.
Try this too:
 flutter channel dev
 flutter upgrade

A: do not use vscode run&debug feature , use this command to run flutter run -d web-server --web-hostname= --web-port= --profile -v ,replace "ipaddress" and "freeport" with your system input


text:
Q: jquery mobile making external xml file also available offline I created an app wiht phonegap that reads xml data for a urs (data from a website database).
I would like to create an offline copy of this xml that is parsed whenever there's no internet connection and update it whenever an internet connection is available.
Can somebody help me out.


text:
Q: Evaluate $ \int _{ 0 }^{ 1 }{ \ln\left(\frac { 1+x }{ 1-x } \right)\frac { dx }{ x\sqrt { 1-{ x }^{ 2 } } } }$ Problem: Evaluate:

$$\displaystyle I=\int _{ 0 }^{ 1 }{ \ln\bigg(\frac { 1+x }{ 1-x } \bigg)\frac { dx }{ x\sqrt { 1-{ x }^{ 2 } } } }$$

On Lucian Sir's advice, I substituted $x=\cos(\theta)$. Thus, the Integral becomes $$\int_0^{\pi/2} \ln\bigg(\dfrac{1+\cos(\theta)}{1-\cos(\theta)}\bigg)\dfrac{1}{\cos(\theta)}d\theta$$
$$=\int_0^{\pi/2} \ln\bigg(\cot^2\dfrac{\theta}{2}\bigg)\dfrac{1}{\cos(\theta)}d\theta$$
Unfortunately I'm stuck now. I would be indeed grateful if somebody could assist me in solving this Integral. Thanks very much in advance!
$$$$Note: My trigonometry is quite poor and so I may have overlooked some glaring facts. Also, for the same reason, if possible, I would prefer a solution using Complex Numbers instead of Trigonometry (as long as the method with Complex Numbers is shorter). Many thanks once again!

A: Hint: Let $x=\cos2t$ and use the formulas for $\dfrac{1+\cos2t}2=\cos^2t$ and $\dfrac{1-\cos2t}2=\sin^2t$,
then let $u=\tan t$ in conjunction with $\cos2t=2\cos^2t-1=\dfrac2{1+\tan^2t}-1$. Lastly, expand
the integrand into its own binomial series, and reverse the order of summation and integration.

A: Let $\frac { 1+x }{ 1-x }=e^u$ to have
\begin{align}
I&=\int _{ 0 }^{ 1 }{ \ln\bigg(\frac { 1+x }{ 1-x } \bigg)\frac { dx }{ x\sqrt { 1-{ x }^{ 2 } } } }\\
&=\int _{ 0 }^{ \infty }\frac{u}{2\sinh\frac u2}du\\
&=4\int _{ 0 }^{ \infty }\frac{u}{e^u-e^{-u}}du\\
&=-4\int _{ 0 }^{ 1 }\frac{\log u}{1-u^2}du\\
\end{align}
The rest (binomial stuff) is as Lucian mentioned.

Addendum:
Note that $\frac{1}{1-u^2}=\sum_{j=0}^{\infty}u^{2j}$, hence we need to find $I_j=\int_0^1u^{2j}\log u \,d u$:
\begin{align}
I_j&=\int_0^1u^{2j}\log u \,d u\\
&=\frac{2j\log u+\log u-1}{(1+2j)^2}u^{2j+1}\Big|_{0^{+}}^1\\
&=-\frac{1}{(2j+1)^2}
\end{align}
Therefore
\begin{align}
\int _{ 0 }^{ 1 }\frac{\log u}{1-u^2}du&=\sum_{j=0}^{\infty}I_j\\
&=-\sum_{j=0}^{\infty}\frac{1}{(2j+1)^2}\\
&=\sum_{j=1}^{\infty}\frac{1}{(2j)^2}-\sum_{j=1}^{\infty}\frac{1}{j^2}\\
&=\frac14\frac{\pi^2}{6}-\frac{\pi^2}{6}\\
&=-\frac{\pi^2}{8}
\end{align}

A: It is straightforward to perform a simple sub of $u=(1-x)/(1+x) \implies x=(u-1)/(u+1)$ and $dx = 2/(u+1)^2 du$ to get
$$\int_1^{\infty} du \, u^{-1/2} \frac{\log{u}}{u-1} = 2 \int_0^{\infty} dv \, \frac{\log{v}}{v^2-1}$$
The latter integral may be computed using the residue theorem. To do this, consider
$$\oint_C dz \frac{\log^2{z}}{z^2-1} $$
where $C$ is a keyhole contour about the positive real axis of outer radius $R$ and inner radius $\epsilon$, except we deform about the removable singularity at $z=1$ above and below the axis with semicircular detours of radius $\epsilon$.  In the limit as $R \to \infty$ and $\epsilon \to 0$ we get that the contour integral is, by the residue theorem,
$$-i 4 \pi \int_0^{\infty} dx \, \frac{\log{x}}{x^2-1} + 4 \pi^2 PV \int_0^{\infty} \frac{dx}{x^2-1} +i 2 \pi^3 = i 2 \pi \frac{\log^2{e^{i \pi}}}{e^{i \pi}-1} = i \pi^3$$
Using the fact that the second integral on the left is zero (this can be verified by taking the limit in the Cauchy PV definition directly), we find that the integral we seek is
$$2 \int_0^{\infty} dv \, \frac{\log{v}}{v^2-1} = \frac{\pi^2}{2} $$

A: Here is how I finally worked it out:
$$\displaystyle I=\int _{ 0 }^{ 1 }{ \ln\bigg(\dfrac { 1+x }{ 1-x } \bigg)\dfrac { dx }{ x\sqrt { 1-{ x }^{ 2 } } } } $$
Put $x=\cos(\theta)$ to get our integral as :
$$\displaystyle \int _{ 0 }^{ \frac { \pi }{ 2 } }{ \ln\bigg({ \cot }^{ 2 }\bigg(\frac { \theta }{ 2 }\bigg) \bigg)\dfrac { d\theta }{ \cos\theta } } $$
$$\Rightarrow \displaystyle I=(-2)\int _{ 0 }^{ \frac { \pi }{ 2 } }{ \ln(\tan\frac { \theta }{ 2 } )\dfrac { d\theta }{ cos\theta } } $$
Put $\tan\bigg(\dfrac{\theta}{2}\bigg)=x$ to get our integral as :
$$\displaystyle (-4)\int _{ 0 }^{ 1 }{ \frac { ln(t)dt }{ 1-{ t }^{ 2 } } } $$
Using the result
$$\displaystyle \int _{ 0 }^{ 1 }{ \dfrac { \ln(t)dt }{ 1-{ t }^{ 2 } } } =\dfrac { -{ \pi }^{ 2 } }{ 8 } $$
$$I=\frac{{\pi}^{2}}{2}$$

A: Maybe you would like this method. Let
$$ I(a)=\int _{ 0 }^{ 1 }{ \ln\left(\frac { 1+ax }{ 1-x } \right)\frac { dx }{ x\sqrt { 1-{ x }^{ 2 } } } }$$
and $I(-1)=0$ and $I(1)=I$. Note
\begin{eqnarray}
I'(a)&=&\int _{ 0 }^{ 1 }{\frac { dx }{ (1+ax)\sqrt { 1-{ x }^{ 2 } } } }\\
&=&\int_0^{\pi/2}\frac{1}{1+a\sin(t)}dt\\
&=&\frac{\arccos(a)}{\sqrt{1-a^2}}.
\end{eqnarray}
So
$$ I(1)=\int_{-1}^1\frac{\arccos(a)}{\sqrt{1-a^2}}da=\frac{\pi^2}{2}. $$

A: Note that(both are easy to check)
$$
\int_{0}^{1} \frac{1}{1-x^2t^2}\text{d}t
=\frac{\ln\left ( \frac{1+x}{1-x}  \right ) }{2x},\\
\int_{0}^{1} \frac{1}{1-x^2t^2}\frac{1}{\sqrt{1-t^2} } \text{d}t
=\frac{\pi}{2\sqrt{1-x^2} }.
$$
Therefore
$$
\begin{align*}
\int_{0}^{1}\frac{\ln\left ( \frac{1+x}{1-x}  \right ) }{x\sqrt{1-x^2} }
\text{d} x
&=2\int_{0}^{1} \int_{0}^{1}\frac{1}{1-x^2t^2}\frac{1}{\sqrt{1-x^2}}\text{d}t\text{d}x\\
&=2\int_{0}^{1} \int_{0}^{1}\frac{1}{1-x^2t^2}\frac{1}{\sqrt{1-x^2}}\text{d}x\text{d}t\\
&=\pi\int_{0}^{1}\frac{1}{\sqrt{1-t^2} }\text{d}t\\
&=\frac{\pi^2}{2}.\Box
\end{align*}
$$

A: Simplify the integral with the substitution $t^2=\frac{1-x}{1+x}$
\begin{align}\int _{ 0 }^{ 1 }{ \frac { \ln\frac { 1+x }{ 1-x } }{ x\sqrt { 1-{ x }^{ 2 } } } }dx
=\int_0^1\frac{\ln t}{1-t^2}dt=-\frac{\pi^2}8
\end{align}


text:
Q: React-Router & MobX - Provider I am trying to access my store from every component page I have, so I followed the following tutorial in order to connect React Router & MobX.
http://frontendinsights.com/connect-mobx-react-router/
However, I am facing a problem at The MobX way – Provider component.
This is the code exmaple:
import { Provider } from 'mobx-react';
import usersStore from './stores/usersStore';
import itemsStore from './stores/itemsStore';

const stores = { usersStore, itemsStore };

ReactDOM.render(
  <Provider {...stores}>
    <Router history={history}>
      <Route path="/" component={App}>
      </Route>
    </Router>
  </Provider>,
  document.getElementById('app')
);

I tried to do the same in index.js
import React from 'react'
import { render } from 'react-dom'
import { Router, hashHistory, Route, IndexRedirect } from 'react-router'
import App from './webapp/App'
import Home from './components/pages/Home'
import Dogs from './components/pages/Dogs'
import Cats from './components/pages/Cats'
import Provider from 'mobx-react'
import RootStore from './webapp/stores'

const store = RootStore

render((
  <Provider rootStore={store}>
    <Router history={hashHistory}>
        <Route path="/" component={App}>
          <IndexRedirect to="/home" />
          <Route path="/home" component={Home}/>
          <Route path="/dogs" component={Dogs}/>
          <Route path="/cats" component={Cats}/>
        </Route>
      </Router>
    </Provider>
), document.getElementById('app'))

However, because of <Provider/>, I am getting an error:

Warning: React.createElement: type should not be null, undefined, boolean, or number. It should be a string (for DOM elements) or a ReactClass (for composite components).

Why am I getting that? It should work doesn't it?
Thanks for any help !

A: If it's a web app, react-router-dom should be used.
Here is the correct way to inject store with Provider https://github.com/mobxjs/mobx-react#observer
I wrote a solution for your code without using decorator, so it supports create-react-app:
import React, { Component } from 'react';
import { Provider, Observer } from 'mobx-react';
import { observable } from 'mobx';
import { BrowserRouter, Switch, Route, Link, Redirect } from 'react-router-dom';

const myStore = observable({
  home: 'Home',
  cat: 'Cat',
});

const Home = () => (
  <Observer
    inject={stores => ({ myStore : stores.myStore })}
    render={props => (

{props.myStore.home}

)}
  />
);

const Cat = () => (
  <Observer
    inject={stores => ({ myStore : stores.myStore })}
    render={props => (

{props.myStore.cat}

)}
  />
);

class App extends Component {
  render() {
    return (
      <BrowserRouter>
        <Provider myStore={myStore}>

<Link to="/home">HOME</Link>

<Link to="/cat">CAT</Link>

            <Switch>
              <Route path='/home' exact component={Home} />
              <Route path='/cat' exact component={Cat} />
              <Redirect from="/" to="/home" />
            </Switch>

        </Provider>
      </BrowserRouter>
    );
  }
}

export default App;

All the components are in App.js file. There is no change in default index.js from create-react-app.
Note:
The another way to doing this, it's to simply create a singleton class for the store and use export default new Store() to make it available to all components. The class itself doesn't have to be observable, but its properties do.


text:
Q: biblatex ieee style same authors I just realized that when using ieee style in biblatex, when two articles in my bibliography share the same authors, the second article the authors disappear and a line is used instead. Is there any easy way to change this behavior without changing the style?

A: Update
In version v1.2 (2016/12/30) of biblatex-ieee, Joseph Wright added full support for the dashed option (https://github.com/josephwright/biblatex-ieee/issues/30). It is now enough to add
dashed=false

to the biblatex options.
\documentclass[british]{article}
\usepackage[T1]{fontenc}
\usepackage{babel}
\usepackage{csquotes}

\usepackage[backend=biber, style=ieee, dashed=false]{biblatex}

\addbibresource{biblatex-examples.bib}

\begin{document}
Lorem \autocite{knuth:ct:a,knuth:ct:b}

\printbibliography
\end{document}

The old version of this answer is retained for historic interest and for those who don't have access to a newer version of biblatex-ieee or users of a similar style that does not have an option to turn off the dashed behaviour.

Old answer
Normally – that is in the standard styles, this is as easy as adding dashed=false to the load options of biblatex. The biblatex styles ieee and ieee-alphabetic, however, do not recognize this option, since – as @Joseph Wright pointed out – it is IEEE style to use the dash.
So you can either manually alter the author macro or disable an internal test needed for the dashed function.
To change the author macro to avoid dashes, just add the following code snippet to your preamble.
\renewbibmacro*{author}{%
  \ifboolexpr{
    test \ifuseauthor
    and
    not test {\ifnameundef{author}}
  }
    {%
      \printnames{author}%
      \iffieldundef{authortype}
        {}
        {%
          \setunit{\addcomma\space}%
          \usebibmacro{authorstrg}%
        }%
    }
    {\global\undef\bbx@lasthash}%
}

Alternatively, you can modify the macro that saves the hash needed for author comparison to do nothing.
\renewbibmacro*{bbx:savehash}{}

MWE
\documentclass[ngerman, a4paper]{article}
\usepackage[latin1]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{babel}
\usepackage{csquotes}
\usepackage[style=ieee-alphabetic, backend=bibtex]{biblatex}
\addbibresource{\jobname.bib}

\renewbibmacro*{bbx:savehash}{}

\begin{filecontents}{\jobname.bib}
@book{UthorA,
  author  = {Arnold Uthor},
  title   = {The Twice Intensely Tiring Lines of Erudition},
  year    = {1983},
}
@article{UthorB,
  author        = {Arnold Uthor},
  title         = {A Very Interesting Article},
  journaltitle  = {Journal of Articles},
  year          = {2000},
}
\end{filecontents}

\begin{document}
  \nocite{*}
  \printbibliography
\end{document}

A: Try to add the following lines to your Bibtex file:
@IEEEtranBSTCTL{IEEEexample:BSTcontrol,
  CTLdash_repeated_names = "no"
}

And the following line to your Tex file, just after \begin{document}:
\begin{document}
\bstctlcite{IEEEexample:BSTcontrol}

A: This is answered here: Is it normal for BibTeX to replace similar author names with "------"?
If you are writing a paper which asks for IEEEtrans (especially if this is to be published with IEEE), I would seriously consider simply using the default behavior as the result for your paper.  This is not a "fluke" that needs to be programed around, this is exactly how the style is programed and designed to perform.
You should always write your paper and choose your citation style based upon the style guide which has authority over your writing (teacher's choice, university style guide, corporate style guide, Chicago, APA, MLA, AP, &c.) and not your personal preferences.


text:
Q: SQL Analysis Services Component set to false? Our Database Server is undergoing an audit and they are requesting to set the Value of Security\BuiltinAdminAreServerAdmins to false from default value of true.
Now since it is a production server my worry is the effect of taking this action. Can anyone tell me the effect when I set it to false?
These are the steps to go on the said item:

*

*Open the SQL Server Management Studio

*Connect to the  "Microsoft Analysis Server"

*Right click on the "Microsoft Analysis Server", then select properties

*Tick the box for "Show Avanced (All) Properties"

*Scroll down till you find  [Security \ BuiltinAdminsAreServerAdmins]  and check the current value

*If the value set to true then stand on the true and change it to false
Thank you in advance. please see image as reference.


text:
Q: Problem calculating expectation using law of total expectation I'm confusing myself with conditional expectation and could really use your help! I am trying to calculate an expectation that arises in the context of doing variational inference. However, the expectation doesn't match what Monte Carlo gives me, so I know something is wrong. I have an idea of where things might be going off, but I'm not 100% sure.
The expectation is:
$\mathbb{E}_\mathbf{F} [\log [p(Y = 0) + p(Y = 1) \prod_{i=1}^{N}p(M_i=m_i|F_i, Y=1)]]$.
I hope this is clear so far. As-is, this is hard to evaluate since it is an expectation over the $N$ random variables $F_1, ..., F_N$. So I thought I could use the law of total expectation. Writing the expectation as:
$\mathbb{E}_{\mathbf{F}}[g(\mathbf{F})]$,
by the law of total expectation, this is equal to:
$\mathbb{E}_{\mathbf{F}}[g(\mathbf{F} | Y = 0)] p(Y = 0) + \mathbb{E}_{\mathbf{F}}[g(\mathbf{F} | Y = 1)]p(Y = 1)$.
Note: Did I go wrong here already? Do the expectations have to be taken over $\mathbf{F}|Y = 0$ and $\mathbf{F}|Y = 1$ instead?
If this isn't wrong, then things simplify quite a lot. For the first term, since we condition on $Y = 0$, the expectation simplifies to:
$\mathbb{E}_{\mathbf{F}}[\log [p(Y = 0 | Y = 0) + p(Y = 1 | Y = 0) \prod_{i=1}^{N} p(M_i = m_i | F_i, Y = 1, Y = 0)]] = \mathbb{E}_{\mathbf{F}}[\log [1 + 0]] = 0$
And, by similar reasoning, the second expectation becomes:
$\sum_{i = 1}^{N} \mathbb{E}_{F_i} \log p(M_i = m_i | F_i, Y = 1)$,
which is great because it's a sequence of 1D expectations. But as I mentioned, this seems to be wrong so I'd appreciate someone pointing out what exactly is off here. Thanks in advance!


text:
Q: How to inspect different monitor contrast on standby resume? I'm using an external 4K Monitor on my notebooks docking digital port.
Resuming from standbye results in a much brighter contrast compared to booting. In particular I notice the difference in Xorg applications (exwm, firefox etc.). In terminal I can't tell the difference.
I couldn't find any hints in Xorg.log entries.
Where would you inspect that behaviour?


text:
Q: Can't log in to embedded Linux Buildroot I'm looking to install Linux onto an Intel Galileo Gen 2 utilizing this and this via installing onto an SD card.
I believe I have successfully done this, as during the boot sequence I am able to select Linux to boot from, however as soon as it starts booting from Linux, I am unable to interact with the Galileo anymore by say typing in my username and password when it comes time to login.
I'm unsure if my peripheral setup is wrong, if I need to install some more drivers to support I/O or something else.
I am viewing the logs from the Galileo via an FTDI cable and currently have a keyboard plugged directly into the Galileo.
Log data

*

*When I boot the Galileo, this is what is logged.

*Interestingly, the
flashing cursor stops flashing and is just steady when I get to the
login screen, as if the device is sort of frozen

*However if I then
say connect a keyboard, it recognizes it and outputs this log data.

A: Solved! Turns out it was a faulty FTDI cable!


text:
Q: How to set default directory for Excel's GetOpenFilename using Outlook VBA? I'm trying to set the default directory for the VBA function GetOpenfilename. I managed to get it working before but lost the code before saving it.
Sub Sample2()
    Dim myFile As Variant
    Dim i As Integer
    Dim myApp As Excel.Application
    Dim strCurDir As String
    Set myApp = New Excel.Application

    ChDrive ("H:\")
    ChDir ("H:\99 - Temp")

    'Open File to search
    myFile = myApp.GetOpenFileName(MultiSelect:=True)

    If myFile <> False Then
        If IsArray(myFile) Then  '<~~ If user selects multiple file
            For i = LBound(myFile) To UBound(myFile)
                Debug.Print myFile(i)
            Next i
        Else '<~~ If user selects single file
            Debug.Print myFile
        End If
    Else
        Exit Sub
    End If

End Sub

I tried several variations of this code and the posts I found are very old. It is going to be part of a bigger code in Outlook 2016.

A: Try the FileDialog property of the Excel object instead...
Dim xlApp As Object
Set xlApp = CreateObject("Excel.Application")

Dim myFile As Variant
With xlApp.FileDialog(msoFileDialogFilePicker)
    .AllowMultiSelect = True
    .ButtonName = "Select"
    .Title = "Select File"
    .InitialFileName = "H:\99 - Temp\"
    If .Show = 0 Then Exit Sub 'user cancelled
    For Each myFile In .SelectedItems
        Debug.Print myFile
    Next myFile
End With

Set xlApp = Nothing


text:
Q: how to name an image with current date and time using java? I have been trying to name an image with current date(i.e.., D://01_03_2015.png) and save it to a location in my memory. But this code given below is returning null value when checked for the Exception in the catch block. I don't know where I went wrong. But i am getting the output when I have initialized the string as string date1 = "D://output.png";. Please help me with this issue. Thank you.
try
{
BufferedImage image1 = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);
for (int y = 0; y < height; y++)
{
 for (int x = 0; x < width; x++)
{
    int rgb = r[y][x];
    rgb = (rgb << 8) + g[y][x];
    rgb = (rgb << 8) + b[y][x];
    image1.setRGB(x, y, rgb);
 }
}

SimpleDateFormat dateFormat = new SimpleDateFormat("dd_MM_yyyy");
Date date = new Date();
String today = dateFormat.format(date);

String date1 = "D:\\"+today+".png";
File outputFile = new File(date1);
ImageIO.write(image1, "png", outputFile);
}
catch(Exception e)
{
     out.print(e.getMessage());
}


text:
Q: kriging of compositional data (grain size) I have posted this already in the GEONet Forum but without any suggestions, now I am hoping for some feedback here:
I have a problem concerning interpolation of compositional data of grain sizes. I need to interpolate the content of each component (clay, silt, sand in percent) to a raster. There are compositional variables — the values are connected by definition. In the case of the three texture fractions, a value of any variable equals 100 less sum of the other two.
As I am reading into this topic I get into more and more problems. For kriging there compositional data do not meet the constrains of stationarity and known mean value. On the other hand my results do not satisfy the constant sum and nonnegativity constrains of the data.

Walvoort and de Gruijter (2001) for example, already developed a
  compositional solution for ordinary kriging that will enforce
  estimated values to sum to unity at all locations. (Walvoort, D. J.
  J., de Gruijter, J. J., 2001. Compositional Kriging: A Spatial
  Interpolation Method forCompositional Data. Mathematical Geology 33
  (8): 951–966)

I would like to use ArcGIS and its geostatistical capacities - what would be method of choice for such a interpolation? (There has been developed an R package for such cases: http://www.inside-r.org/packages/cran/compositions/docs/compOKriging - but I am not into this program yet to be able to generate meaningful results quickly).


text:
Q: Can I perform many asynchronous database requests without deeply nesting my code? I'm sort of new to programming asynchronously. I've run into a situation where I need to perform 8 database lookups in a loop. I'm not sure how to accomplish this-- my database library returns the data in a callback function, and I cannot continue with my code until I have all 8 rows, so I need to halt until all 8 lookups have completed.
This is sort of what I picture right now:
db.world.Queue.find(@user.kingdom.troops_queue).on 'success', (troops_queue) ->
    db.world.Queue.find(@user.kingdom.tanks_queue).on 'success', (tanks_queue) ->
        #etc etc

This is horrible and gross of course, but I can't think of a way to roll it up into a loop that will allow my code to pause and only continue when the last item has been filled. I was looking into things like jQuery's .each() function, but what is the behavior of that function? Does the code after it immediately continue, or does it wait for the loop to finish?

A: There are two commonly used ways. The first one is using a library like caolans async:
async.parallel
  a: (cb) -> doTaskA cb
  b: (cb) -> doTaskB cb
, (err, {a, b}) ->
  # you can use err, a and b here now

The second approach is streamlinejs:
troops_queue = db.world.Queue.find(@user.kingdom.troops_queue).on 'success', _
tanks_queue = db.world.Queue.find(@user.kingdom.tanks_queue).on 'success', _
# go on here

However, both solutions assume that the first argument of the callback is the error - if it isn't that way, you should bug the author of the library you're using to change it.

A: Use flow control like after.js
var data = {};
    cb = after(8, function ( ) {
        // handle all 8 results
    }),
    queue = db.world.Queue,
    kingdom = this.user.kingdom;

queue.find(kingdom.troops_queue).on('success', function (result) {
    data["troops_queue"] = result;
    cb();
});

// etc

P.S. I fixed that coffeescript for you.

A: You could organize your queries in a 'successful progression' sequence; this sequence can be used by a continuation-style loop, kinda like this in Javascript:
var lookups = [
   function(){ Q.find(@user.kingdom.troops_queue; },
   function(troops_queue){ Q.find(...tanks_queue; },
   function(tanks_queue){ Q.find(...next_queu; },
   ....
];

And this 'stratified' sequence can be drewn through the asynchronous mill like
function proceedOn( sequence, previous_result ) {
   var first = sequence[0];
   first( previous_result ).onSuccess( function(result){
     proceedOn( sequence[1..], result );
   } );
}

proceedOn( lookups );

(Where I took some poetic liberties on array syntactic sugar)

A: I always use Step for my projects, it's very clean and nice.
Here's an example of some callbacks in a row:
Step(
  function readSelf() {
    fs.readFile(__filename, this);
  },
  function capitalize(err, text) {
    if (err) throw err;
    return text.toUpperCase();
  },
  function showIt(err, newText) {
    if (err) throw err;
    console.log(newText);
  }
);

You may also want to do some parallel stuff and only then trigger the callback, fortunately this.parallel() is just the thing for that:
Step(
  // Loads two files in parallel
  function loadStuff() {
    fs.readFile(__filename, this.parallel());
    fs.readFile("/etc/passwd", this.parallel());
  },
  // Show the result when done
  function showStuff(err, code, users) {
    if (err) throw err;
    console.log(code);
    console.log(users);
  }
)

A: Since you tagged with "coffescript" some links you can check (long threads!):
issue241, issue287, issue350, issue1710 (and probably some more...)
In a nutshell:

*

*A user created this fork, but it's not maintained anymore.

*Tamejs or streamlinejs are considered good alternatives for now.


text:
Q: Display name does not exist in the current context The name '' does not exist in the current context
crn
courseid
timedays
Roomnumber
At the display, none of the items are recognized. Why is the display not seeing them when they were declared as set and gets?
using System;
using System.Collections.Generic;
using System.Text;

   public class Section
{

       private int crn;
       private String courseId;
       private String timeDays;
       private String roomNumber;
       private int instructor;

    /// <summary>
    /// Creates a new instance of a section
    /// </summary>
    /// <param name="crn"></param>
    /// <param name="courseId"></param>
    /// <param name="timeDays"></param>
    /// <param name="roomNumber"></param>
    /// <param name="instructor"></param>
    public Section(int crn, string courseId, string timeDays, string roomNumber, int instructor)
        :this(crn, courseId, timeDays, roomNumber, instructor, "")
    {
    }

    /// <summary>
    /// Creates a new instance of a section
    /// </summary>
    /// <param name="crn"></param>
    /// <param name="courseId"></param>
    /// <param name="timeDays"></param>
    /// <param name="roomNumber"></param>
    /// <param name="instructor"></param>
    /// <param name="message"></param>
    public Section(int crn, string courseId, string timeDays, string roomNumber, int instructor, string message)
    {
        this.Crn = crn;
        this.CourseId = courseId;
        this.TimeDays = timeDays;
        this.RoomNumber = roomNumber;
        this.Instructor = instructor;
        this.Message = message;
    }

    /// <summary>
    /// Gets or sets the crn
    /// </summary>
    public int Crn { get; set; }

    /// <summary>
    /// gets or sets the course id
    /// </summary>
    public string CourseId { get; set; }

    /// <summary>
    /// gets or sets the time days
    /// </summary>
    public string TimeDays { get; set; }

    /// <summary>
    /// gets or sets the room number
    /// </summary>
    public string RoomNumber { get; set; }

    /// <summary>
    /// Gets or sets the instructor
    /// </summary>
    public int Instructor { get; set; }

    /// <summary>
    /// Gets or sets the message
    /// </summary>
    public string Message { get; set; }

    public void display(){
        System.Console.WriteLine("CRN =  "+ getCrn());
        System.Console.WriteLine("CourseID =   "+ getCourseId());
        System.Console.WriteLine("Time Days =  " + getTimeDays());
        System.Console.WriteLine("Room Number =  " + getRoomNumber());

    }

    }

A: I think display() needs to look like below.  I don't know how your display() function is even compiling.
public void display()
{
    System.Console.WriteLine("CRN =  "+ Crn);
    System.Console.WriteLine("CourseID =   "+ CourseId);
    System.Console.WriteLine("Time Days =  " + TimeDays);
    System.Console.WriteLine("Room Number =  " + RoomNmber);

}

In addition, since you have all your properties declared with { get; set; }, you don't need any backing member variables (the compiler automatically takes care of these for you).  So you can delete the lines that look like this:
private int crn;
private String courseId;
private String timeDays;
private String roomNumber;
private int instructor;


text:
Q: Where is the best place to put a DB query in drupal? I have a few forms who's data needs to be written to the main database in their own tables.  Just simple name-email collection forms, that are part of regular pages in drupal.  I suspect the right way to do this would be to write a module that would have the query in a function, but this is just a guess.  I've never written a module before, and don't know how the form would be processed that way.
It's also a guess that to perform the db query within a node would be insecure?
The only other idea I have would be to use a php file on the server to do the form processing, with the db query written there, but that seems very non-drupal, as far as I can tell.
How to??

A: http://drupal.org/node/508 is Drupal's info on module development
You'll be wanting to use the function "db_query()"
You can use Drupal's built in methods to build forms though that will save the data for you. Have a look at the module developers guide though and you should be able to figure it out. Module development sounds intimidating but it's not as hectic as it seems once you actually know what's going on with Drupal (hence, read the guide).

A: Have you checked what's already out there? Webform may be able to solve your needs without any custom code.
Also, I highly recommend the book Pro Drupal Development if you want to learn more about Drupal and basic module development.

A: I'd second the Webform module. Create a really simple webform with name and email (results can be emailed or stored automatically in the DB, and can be exported easily in several formats). Then check out the Webform Block module to put that webform in a block and place wherever you need it on your site. No custom coding required!
Here is an excerpt from the Webform Block project page:

Allows embedding a webform node into a block which can be positioned in any block region (theme space permitting).
Handles redirecting back to the current page on validation errors.
A good use for this is to add a site wide contact form inline on your pages, such as in the footer or sidebar.
Multiple webforms can appear on the same page. The contents of the block is simply a node, so theme work can be done in the node-webform.tpl.php file as usual.


text:
Q: Python Socket, how do i choose between s.send and conn.send? def send_Button():
    try:
        myMsg = "ME: " + text.get()
        msg = text.get()
        conn.send(msg) ###
        textBox.insert(END, myMsg + "\n")
        textEntry.delete(0, END)
        textBox.yview_pickplace("end")
    except NameError:
        myMsg = "ME: " + text.get()
        msg = text.get()
        conn.send(msg) ###
        textBox.insert(END, myMsg + "\n")
        textEntry.delete(0, END)
        textBox.yview_pickplace("end")

This program uses the tkinter module with socket in python2.7. My program allows for you to either connect to a server to chat with or host a server for others to connect to you, but whenever I try and test it out then the lines with the '###' on always bring up an error and it doesn't work, the error which comes up is: "NameError: global name 'conn' is not defined" OR "error: [Errno 10057] A request to send or receive data was disallowed because the socket is not connected and (when sending on a datagram socket using a sendto call) no address was supplied".
Any help please?

A: I think that you are trying to get the program to act as a Client or as a Server just changing s.send() to conn.send() saddly it isn't that simple.
Socket Initializzation
The socket have to be initialized before sending or receiving data.
For a client usually it's something like this.
send_socket = socket.socket(socket.AF_INET,socket.SOCK_STREAM) # Create the socket
send_socket.connect((serverIp, serverPort))  # Connect to the server
send_socket.send(data)  # Send the data to the server

And like this for a Server:
listen_socket = socket.socket(socket.AF_INET,socket.SOCK_STREAM) # Create the socket
listen_socket.bind(("0.0.0.0", port)) # Set the socket to accept client from every interface on the port port
listen_socket.listen(1) # Put the server on listen on the port setted before
accept_socket, addr = self.listen_socket.accept() # when a client connect return the socket to talk with it
data = self.accept_socket.recv(buffer_size) # Receive data form the client of max size buffer_size

Docs examples
From your question I guess that with s.send() and conn.send() you are talking about
this example from the python 2.7 socket docs

Here are four minimal example programs using the TCP/IP protocol: a server that echoes all data that it receives back (servicing only one client), and a client using it. Note that a server must perform the sequence socket(), bind(), listen(), accept() (possibly repeating the accept() to service more than one client), while a client only needs the sequence socket(), connect(). Also note that the server does not sendall()/recv() on the socket it is listening on but on the new socket returned by accept().

Client

Echo client program
import socket
HOST = 'daring.cwi.nl'    # The remote host
PORT = 50007              # The same port as used by the server
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect((HOST, PORT))
s.sendall('Hello, world')
data = s.recv(1024)
s.close()
print 'Received', repr(data)

the client is pretty stright forward, it create the socket s and then after using s.connect() it just send data through it.
Server
The server one is where there there are both s and conn

Echo server program
import socket
HOST = ''                 # Symbolic name meaning all available interfaces
PORT = 50007              # Arbitrary non-privileged port
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.bind((HOST, PORT))
s.listen(1)
conn, addr = s.accept()
print 'Connected by', addr
while 1:
    data = conn.recv(1024)
    if not data:
        break
    conn.sendall(data)
conn.close()

in this one first of all we create a socket s on which the server will listen and then using s.accept() it will wait till a client connect to the server and then return  the conn which is the socket of the connected client.
So to receive or send data to the client you have to use conn.
Notes
As said in the documentation in these two example the server accept only one client. So if you want to deal with multiple clients you have to repeat the accept step and possibly generate a new Thread for each client so that other clients don't have to wait for each others.