CSS, JS, ... not created by drush site:install

Question: Drupal installation is failing after the following steps on a Debian box (database is already created and privileges granted to specific user):
(user) $ composer create-project drupal/recommended-project myproject
# ... ask if it is OK to install composer/installers, drupal/core-composer-scaffold and drupal/core-project-message, answer Yes
# ... emits 2 warnings about doctrine/reflection and webmozart/path-util being obsolete
(user) $ cd myproject
(user) $ composer composer require drush/drush
(user) $ drush site:install --locale=fr
# ... asks for MySql credentials
# ... displays admin user credentials.

Everything runs smoothly with no error messages, only the 3 questions and 2 warnings mentionned supra.
Yet, after running those commands, according to Drupal installation docs (https://www.drupal.org/docs/develop/using-composer/using-composer-to-install-drupal-and-manage-dependencies#s-install-drupal-using-the-command-line) the site should be accessible through-the-web. Yet, when I browse the configured path (DocumentRoot is set to the "web" directory) I got an unstyled page (same appearance than
CSS not applying in drupal 8 site , but stylesheets href are
set to "/").
If I take the through-the-web installation path instead of running Drush, then everything runs fine except for minor annoyances with permissions settings under 'web/sites/default'.
Comparing both "web" directories shows that (besides unsignificant differences
due to different hashes) no "css", "js", "languages" nor "php" directories are
created and populated under the Drush installed "web/sites/default/files"
directory.
What am I doing wrong? I could find no help in Drupal documentation nor by
googling around.

Drupal : 9.3.9
Composer : 2.2.9
Drush : 11.0.7

Thanks in advance
Comment: It's very likely to be permissions. You install with one user, then serve over the web with a different user who can't write to the folders the first user created as part of the install. Make sure `www-data` or equivalent can write to the files folders and the tmp folder
Comment: Drush does not create any JS or CSS or cache files, this happens on demand by visiting pages in the browser. And if those are not created on demand, it is almost certainly due permissions. And even the web install *runs fine except for minor **annoyances with permissions settings under 'web/sites/default'***
Comment: How did you get an "unstyled page" through the command line? What you've described still strongly suggests a permission issue. Run `sudo -u www-data touch docroot/sites/default/files/test.txt` to make sure. If you get a perms error on that op, you've probably found the problem
Comment: @Clive thank you for your comment but as stated in my question the problem only happens when the whole installation is run from the command line, obviously with the same user, hence no permission problem can possibly be involved. The common problem you describe relates to through-the-web install but this one runs fine in my case.
Comment: @Clive I edited the question to try to make it clearer that the problem occurs when the installation is made with Drush invocation, not by going through "core/install.php". As stated, if I install by using the web interface I meet not substantial problems. Those happen when I use `drush site:install` instead. According to the documentation, running this command should equate to going the usual web process (I mean browsing to core/install.php, ... Is it more clear now?
Comment: Yep, I wrangle with these setups day in day out, it's very familiar to me :) I think I see where the confusion is though - the css/js/php folders aren't generated by the site installation, they're generated by a subsequent web request. So you install through the web, the `files` folder is owned by `www-data`, and in the subsequent web request, `www-data` can write to that folder. When you install through CLI, `files` is owned by `foo_user`, then when the subsequent web request runs, `www-data` can't write to that folder because `foo_user` owns it
Comment: Thank you @Clive and @Hudri for taking time to answer, but could you please tell me then what is the use of running `drush site:install` at all if one still needs to go the `core/install.php` way after. I thought that drush would precisely let us install and configure a Drupal site in a scriptable and repeatable way.
Comment: You've nailed it, that's exactly what `site:install` does - you don't need to visit core/install.php afterwards (indeed you can't, it'll tell you that the site is already installed). Unless this is an edge case based on something not visible in the context so far, the styles are almost certainly missing because the web server can't write to sites/default/files. I just posted an answer detailing both processes, hopefully that'll help to clear it up
Comment: Just for completeness: in both cases a .htaccess file exists in web/ and has the RewriteBase uncommented?
Answer: The folders you mentioned aren't generated by the site installation process, they're generated by a page request to the resulting Drupal site itself.
When you install through the UI, this happens:

Drupal gets installed
sites/default/files is created and owned by the web server (typically www-data)
You get redirected to the front end of the site, Drupal generates assets and tries to persist them to sites/default/files
The request is running as www-data, the folder is owned by www-data, so all good - files get created.

When you install through the CLI, it's slightly different:

Drupal gets installed
sites/default/files is created and owned by the user you ran drush as, which wouldn't typically be www-data (if it was, you shouldn't be having these problems).
You visit the site in a browser, Drupal generates assets and tries to persist them to sites/default/files
The request is running as www-data, but the folder is owned by your user, so no dice - files are not created.

High level, the answer is to make sure www-data can write to the sites/default/files folder after you install via the CLI. The Securing file permissions and ownerships docs have some suggestions on how you can accomplish this.
Comment: Could you please tell me exactly what you mean in the 3rd step of the CLI install process you describe when you say "You visit the site in a browser"? Do you mean any (site related) URL or some specific _end of the install URL_ one? And in this case, I repeat my question : what's the use of the Drush path? Thank you anyway, I appreciate you help.
Comment: I mean literally any URL on the front-end of the site, not a specific one. When CSS/JS aggregation is enabled (as it is by default after install), the aggregated files are generated on demand when a page is visited, and cached from then. Your current issue seems to be that the aggregated files can't be written, and the steps you've outlined to get to this point support that idea
Comment: Thank you for your patience. A pity such basic clue is absent from Drupal docs. I have to admit that I had hitherto never crossed the path of a webapp that waits for the very first non-targeted / non authenticated connection to complete its installation process ;-).
Comment: It gets away with it because asset generation is supposed to be dynamic, it's not part of the installation process. But I get what you mean, it's confusing if you haven't done it a hundred times before


LNK2001 error seen on compiling code in x64 environment. However the code compiles fine in x86 environment

Question: I see below linking error on compiling with x64 environment set.
somefile.def : error LNK2001: unresolved external symbol _somesymbol
somepath\somefile.lib : fatal error LNK1120: 1 unresolved externals
gmake[2]: *** [somepath\somefile.dll] Error 1120

When I checked somefile.def generated in x86, it too had the same above symbol, difference being there it had double underscores ('__somesymbol'). Whats the reason behind this?
The code contains both C & C++ files.
Can anyone help in resolving this issue preferably with elaborate explanation?
Thanks
Comment: Possible duplicate of [What is an undefined reference/unresolved external symbol error and how do I fix it?](https://stackoverflow.com/questions/12573816/what-is-an-undefined-reference-unresolved-external-symbol-error-and-how-do-i-fix)
Comment: Identifiers do not get decorated in 64-bit code.  Blissfully unnecessary, x64 does not have a boatload of calling conventions.  Verify this with the linker's map file, ought to be plain `somesymbol` without a leading underscore.  So you surely need to modify the .def file accordingly, we can't see it from here.  Do favor the `__declspec(dllexport)` attribute.
Comment: I see the .map file generated for x86 build. But not for x64 build. Also how do I actually modify the .def file, it gets generated on the fly.
Comment: Thanks Hans, I tweaked the make code to generate "somefile.def" with "__somesymbol" instead of "_somesymbol" and could successfully build my x64 bit library and dll files.
Answer: Identifiers do not get decorated in 64-bit code.  Blissfully unnecessary, x64 does not have a boatload of calling conventions.  Verify this with the linker's map file, ought to be plain somesymbol without a leading underscore.  So you surely need to modify the .def file accordingly, we can't see it from here.  Do favor the __declspec(dllexport) attribute.
                    – Hans Passant
I tweaked the make code to generate "somefile.def" with "__somesymbol" instead of "_somesymbol" and could successfully build my x64 bit library and dll files. – Samanyu


Pygame is not working in pycharm just a black window pops up

Question: I'm using this bit of code in pycharm, but none of the print for events works(the quit, mouse button click or key pressing on keyboard)
Although I see the pygame window but the events doesn't work.
I also used the get() instead of wait() but still no luck.
any ideas?
import pygame

pygame.init()
screen = pygame.display.set_mode((800, 600))

while True:
    event = pygame.event.wait()

    if event.type == pygame.QUIT:
        print('Quit')

    if event.type == pygame.KEYDOWN:
        print('Key Down')
        print(event.key)
        print(event.unicode)

    if event.type == pygame.KEYUP:
        print('Key Up')
        print(event.key)

    if event.type == pygame.MOUSEBUTTONDOWN:
        print('Mouse Button Down')
        print(event.pos)
        print(event.button == pygame.BUTTON_RIGHT)
        print(event.button == pygame.BUTTON_LEFT)

    if event.type == pygame.MOUSEBUTTONUP:
        print('Mouse Button Up')
        print(event.pos)
        print(event.button == pygame.BUTTON_RIGHT)
        print(event.button == pygame.BUTTON_LEFT)

    if event.type == pygame.MOUSEMOTION:
        print('Mouse Motion')
        print(event.pos)
        print(event.rel)

UPDATE
I found out that it's a problem with pycharm.
when I run any code with pygame just a black pygame windows pop up, it doesn't run any other code(events, filling window with color ,...). Even the pygame window is not in dimensions that I've given.
Here another code example.
import pygame

pygame.init()
screen = pygame.display.set_mode((200, 200))

red = (255, 0, 0)
screen.fill(red)
pygame.display.update()
pygame.time.delay(10000)

when I run it in VS code:
Vs code pygame test
and when I run it in pycharm :( :
Pycharm pygame test
also I'm defining the same Interpreter for both VS code and pycharm and I've already reinstalled pygame package.
Comment: What do you see in your PyCharm run console? Your print statements appear to be working there.
Comment: @RSH It's working for me too. I hope you are not expecting to see the prints in pygame window, because the prints will rather appear in IDE's console.
Comment: @SagarGuptaFTW No i know that it must appear in IDE console.
I found out that it is rather a problem with pycharm cause I tested it in VS code and it worked!!
Comment: @RSH It's strange, I'm using PyCharm, working for me. It would be interesting to find the cause in your case :)
Comment: @DaveStSomeWhere nothing prints there!
Comment: If you've found out what the problem was, instead of editing the question, you could post an answer to your own question and accept it.
Answer: You can try to use a full game loop, as this would update the window repeatedly.
Try:
import pygame

pygame.init()
screen = pygame.display.set_mode((200, 200))

red = (255, 0, 0)
running = True
while running:
    screen.fill(red)
    pygame.display.flip()
    for event in pygame.event.get():
        if event.type = pygame.QUIT:
            running = False
pygame.quit()

Answer: i was using pycharm but all the code did not wok so i right clicked it with the mouse and selected run in python cnsole.
OR       ::::::::::::
SHIFT + ALT + E
Answer: I believe that you had run a different py file on pycharm
Comment: Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer).


Showing that a space is not homeomorphic to $\mathbb{R}^4$.

Question: I have a space $X$ which is defined to be the quotient of $[0,1)\times T^3$ ($T^3$ is the 3-torus) by the relation $(0,x)\sim (0,y)$ for all $x,y \in T^3$. It is a kind of cone over $T^3$, except that the interval $[0,1)$ is only half closed. I want to show that this space is not homeomorphic to $\mathbb{R}^4$.
I believe that the image of one of the $S^1$ factors in $T^3$ will be a non-null-homotopic loop, which would yield the result using fundamental groups. I can't seem to show this though, and am not sure it is a good approach.
A quick look at the cases for $T^1$ and $T^2$: in the same constructions for $T^1$ and $T^2$ I believe the fundamental groups are $0$ and $\mathbb{Z}$ respectively and in the latter case, the image of one of the $S^1$ factors is the generator. I believe this because I imagine $[0,1)\times T^2$ as a thickening of the $2$-torus with $\{0\}\times T^2$ being the outer shell which is mapped to a point in the quotient. Mapping the outer shell to a point can be thought of as first pinching the central "donut" hole, as it were, to a point. We then have something homotopic to a 3-ball but missing an interior circle, and whose boundary must be identified to a point. Identifying the boundary of a 3-ball in this way yields $S^3$ minus a circle, which is homeomorphic to $\mathbb{R}^3$ minus a line, which has fundamental group $\mathbb{Z}$ generated by a loop coming from the image of one of the $S^1$ factors of the original $T^3$. I believe the same sort of thing may happen in the case of $T^3$ but cannot currently prove it.
Any thoughts or guidance here would be greatly appreciated.
Edit: I just realized that the analysis for the $T^2$ case is wrong. When I think of identifying the boundary of a 3-ball to a point, I also have a curve in this ball each end of which is touching the boundary and which must be mapped to the same point. In this case, I am now inclined to believe that the fundamental group is also $0$ in the case of $T^2$ because that curve is homotopic to what I originally thought would be the generator.
Comment: But: if you remove a point from $\Bbb R^4$, you still get a space with fundamental group 0. The same is not true of $X$.
Comment: I am now also inclined to take back the claim that the image of one of the $S^1$ factors will be a generator. Of course this can't be the case because any such factor will be the base of a similarly defined cone over that $S^1$ factor which is homeomorphic to the open disk and therefore simply connected.
Comment: The fundamental group of $X$ with *any* space $S$ used in place of $T^3$ is going to be 0. Any curve is homotopic to the point at 0. You will need to find some other means to show that $X$ is not homeomorphic to $\Bbb R^4$.
Comment: @PaulSinclair: Oh, that's a great point (pun not intended)! Thank you!
Comment: @PaulSinclair: Maybe you could make this an answer.
Answer: Removing from the quotient the equivalence class of $(0,x)$ (for any $x\in T^3$) we obtain the space $(0,1)\times T^3$, which cannot be homeomorphic to $\mathbb{R}^3$ with a point removed (e.g. because the first space is not simply connected).


How can I allow persisting without parent document with an embeds_many association?

Question: I have 2 Mongoid models that look something like this:
class User
  include Mongoid::Document
  field :name, type: String

  embeds_many :jobs
end

class Job
  include Mongoid::Document
  field :title, type: String

  embedded_in :user
end

This allows me to do something like
user.jobs.create(title: 'Test Job')

However, I'd like to be able to have some predefined jobs for a user to choose from, which would then be embedded in the user's document. Something like this:
Job.create(title: 'Predefined Job')
user.jobs << Job.first

However, creating a job on it's own throws the following error

Cannot persist embedded document Role without a parent document.

I'm kind of new to Mongoid, and can't find any examples of this in the documentation. Anyone know how you would do this?
Comment: I'd probably have a `PredefinedJob` standalone document.
Comment: I go with a `PredefinedJob` class too
Answer:
Cannot persist embedded document Role without a parent document.

As the error clearly states embedded document can only be embedded within another document. It cant exist as its own. If you wanted to make a Role independent from user, you need change the relation to has_many from embeds_many
class User
  include Mongoid::Document
  field :name, type: String

  has_many :jobs
end

class Job
  include Mongoid::Document
  field :title, type: String

  belongs_to :user
end

so you can
Job.create(title: 'Predefined Job')
user.jobs << Job.first

and
job = Job.new(title: 'Predefined Job')
job.save

or if you still wanted to go ahead with embed_many relation, you need to make a separate document to store the predefined jobs


Binary Calculations on a Bounded Generic Type

Question: I want to create a function to calculate the power of a number of the type Number  (the class) via recursion. There is an issue in the following line:
return base * NumberOpp.power(base, pow - 1);

It doesn't know how to perform the '*' operation. I am guessing this is because of the generic type. It is bounded which I think would fix the problem. I tried casting (it's a little ugly.) It didn't seem to work either.
return (T) (Number.doubleValue(base) * Number.doubleValue(NumberOpp.power(base, pow - 1)));

All the code is below:
public class NumberOpp {
    public static <T extends Number> T power(T base, int pow){
        if (pow == 1) { /* If power is one return base */
            return base;
        }else{ /* Else recursivly multiply by base until power is one */
            return base * NumberOpp.power(base, pow - 1);
        }
    }
}

Comment: The `*` multiply operator only works on numeric *primitives*. By definition, Java generic types cannot be primitives, so there is absolutely no way for return type `T` to be compatible with the `*` multiply operator, not even with auto-boxing, because that is something the compiler does, and it doesn't know which type `T` might be, so it doesn't know which unboxing operation to apply (int? long? double? ...).
Comment: Is there a reason why you don't want to use the [implementation Java already provides](https://docs.oracle.com/javase/7/docs/api/java/lang/Math.html#pow(double,%20double))?
Comment: Short answer: it is an assignment to learn better how to use recursion. Yet, I might want to operate on generics in the future.
Comment: Is this impossible?
Comment: Yes, it's impossible to use `*` multiply operator with generics.
Comment: To be able to use the `*` operator Java would need to support operator overloading which it does not so your best option is to either convert you type to a primitive numeric type or provide your own multiplication function that takes two of your `Number` types. Considering your type the former is likely to be the easiest solution.
Answer: You can only perform numeric operations (such as multiplication) on numeric primitive types. Number has no automatic conversion to a primitive numeric type, which is why your <T extends Number> type bound doesn't help.
You can decide to perform the operation of a specific numeric type, such as double:
public class NumberOpp {
    public static <T extends Number> double power(T base, int pow) {
        if (pow == 1) {
            return base.doubleValue ();
        } else {
            return base.doubleValue () * NumberOpp.power(base, pow - 1);
        }
    }
}

This will accept any numeric type as input, but will always return a double result.


Find $x ,y$ satisfying : $x,y$ are $2$ positive integers and $(xy+x+2)(xy+1)$ is a perfect square.

Question: Find $x ,y$ satisfying : $x,y$ are $2$ positive integers and $(xy+x+2)(xy+1)$ is a perfect square.
I have solved this problem and will post the solution as soon as possible. Hope everyone can check my solution! Thanks very much !
Comment: Check #28 at https://artofproblemsolving.com/community/c6h1615855p10101480
Comment: What is  gcd in this case?
Comment: x is even number doesn't show (xy+x+2,xy+1)=1, for example x=4,y=6,p=5
Answer: For a start:
Let $z=xy+1$, then $$z(z+x+1)=a^2\implies \boxed{z^2+z(x+1)-a^2=0}$$
Since discriminant is perfect square we have $$d^2 =(x+1)^2+4a^2$$ which means that (Pythagorean triples) $$d=k\cdot (u^2+v^2),\;\; x+1 =k\cdot(u^2-v^2),\;\; a = k\cdot uv$$ for some positive integers $u,v,k$ and $\gcd(u,v)=1$. Since $x+1>0$ we have $u>v$. Then (solving boxed equation) $$xy+1 =k\cdot {v^2-u^2\pm (u^2+v^2)\over 2}$$
Since $z$ is positive we have only $+$ choise, so we have $xy+1 = kv^2$ so $y = {kv^2-1\over k(u^2-v^2)-1}$

 ??? Since for every integer $m$ we have $ \gcd(mk+1,k)=1$ thus $k(u^2-v^2)-1\mid k(2v^2+u^2) \implies k(u^2-v^2)-1\mid 2v^2+u^2$ and so
 $$k(u^2-v^2)-1\leq  2v^2+u^2$$

So we have only finite possibilities for $k$ ...
Answer: Disclaimer: This is only a partial answer. I may complete this later.
Let $x$, $y$ and $z$ be three positive integers such that
$$(xy+x+2)(xy+1)=z^2,\tag{1}$$
The greatest common divisor $d$ of the two factors divides $1+x$ and $1-y$, so we have
$$x=ud-1\qquad\text{ and }\qquad y=vd+1,$$
for coprime integers $u$ and $v$, and $z=wd$. Plugging this into $(1)$ then yields
$$w^2=\big(uvd+2u-v\big)\big(uvd+u-v\big).$$
Now the two factors on the right hand side are coprime, and hence they are both perfect squares, so
$$uvd+2u-v=a^2\qquad\text{ and }\qquad uvd+u-v=b^2,$$
for some positive integers $a$ and $b$ with $a>b$. Then $u=a^2-b^2$ and so
$$v=\frac{2b^2-a^2}{d(a^2-b^2)-1}.$$
As $v$ is positive this shows that $a^2<2b^2$.
Conversely, if $a$ and $b$ are two coprime positive integers with $b<a<\sqrt{2}b$ and $d$ is any positive integer such that
$$\frac{2b^2-a^2}{d(a^2-b^2)-1},$$
is also an integer, then the integer $x$ and $y$ given by
$$x=d(a^2-b^2)-1\qquad\text{ and }\qquad y=d\frac{2b^2-a^2}{d(a^2-b^2)-1}+1=\frac{db^2-1}{d(a^2-b^2)-1},$$
satisfy
$$(xy+x+2)(xy+1)=(dab)^2.$$
Answer: $(xy+x+2)(xy+1) = a^2$
$\Rightarrow (2xy+x+3)^2 = (2a)^2 +(x+1)^2 $
Because $2 | 2a$  , there exist $3$ positive integers $m , n,d$ satisfying :
$(m,n) = 1$ and  :  $2a = 2dmn ; x+1 = d(m^2-n^2) ; 2xy+x+3 = d(m^2+n^2)$
$\Rightarrow xy+1 = dn^2 $
$\Rightarrow y = \frac{dn^2-1}{d(m^2-n^2)-1} $
$\Rightarrow \frac {y-1}{d} = \frac {2n^2-m^2}{d(m^2-n^2)-1} $
It is easy to see that $d|(y-1)$ , so $\frac {2n^2-m^2}{d(m^2-n^2)-1} \in \mathbb N^+ $
Let  $\frac {2n^2-m^2}{d(m^2-n^2)-1} = k $
Let $ m = \frac{e+f}{2} , n =\frac{e-f}{2}$.
$\Rightarrow k = \frac{e^2+f^2-6ef}{4def-4}$
$\Rightarrow e^2 -ef(6+4kd)+f^2+4k = 0 $
Let $e_1$ is the smallest solution of the above equation .
We have $e_1 + e_2 = (6+4kd)f$ and $e_1 e_2 = f^2+4k >0 $
So $e_2$ is also a solution of the above equation, so $e_1 \le e_2$
$\Rightarrow f^2 \le (e_1-1)(e_2-1) $
$\Rightarrow f(6+4kd) \le 4k+1 $ ( a contradiction )
So there is no $(x,y)$ satisfying the problem.
I just finished it, so no one has checked it yet! Hope you guys can check if I'm wrong!


The limit of $f(x) = \frac{1}{x^2 + 5x - 24}$ at $x=4$

Question: I'm working through Advanced Calculus: Theory and Practice by John S. Petrovic and is currently working on problem 3.4.2, which is as follows:

Find the limit and prove that the result is correct using the definition (epsilon-delta) of the limit:
$$
\lim_{x \to 4} \frac{1}{x^2 + 5x - 24}
$$

This is my attempt:
$$
\lim_{x \to 4} \frac{1}{x^2 + 5x - 24} = \frac{1}{12}
$$
We need $| x - 4 | < \delta$, and an expression for $\delta$ dependent on $\epsilon$, therefore we focus on
\begin{align}
\Biggl|f(x) - \frac{1}{12}\Biggr|
&= \Biggl|\frac{12 - x^2 - 5x + 24}{12(x^2 + 5x - 24)}\Biggr| \\
&= \Biggl|\frac{-(x + 9)(x - 4)}{12(x + 8)(x - 3)}\Biggr| \\
&= \Biggl|\frac{(x + 9)(x - 4)}{12(x + 8)(x - 3)}\Biggr| \\
&\leq \frac{1}{12} \frac{|x+9|\,|x-4|}{|x+8|\,|x-3|}.
\end{align}
(It is the next step where I am pretty sure I'm using the inequalities incorrectly.)
Now let $\delta_1 = 1$, which implies that $-1 < x - 4 < 1 \implies 3 < x < 5$ and therefore:

$12 < x + 9 < 14 \implies |x + 9| < 14$
$11 < x + 8 < 13 \implies |x + 8| > 11$
$0 < x - 3 < 2 \implies |x - 3| > 0$

Therefore,
$$
\frac{1}{12} \frac{|x+9|\,|x-4|}{|x+8|\,|x-3|}
< \frac{1}{12}\frac{14\,|x - 4|}{11 \cdot 0}
\cdots
$$
As you can see the inequality $|x - 3| > 0$ renders the expression undefined. Where am I going wrong? If you supply me with a complete solution, please do not use any "fancy" theorems as this problem is presented at the beginning of the continuity chapter and therefore should be solvable using only simple methods.
Thank you.
Comment: Your choice of $\delta_1$ is to be changed.
Answer: You're doing everything correctly, including finding upper bounds for linear factors in the numerator and lower bounds for linear factors in the denominator.
The problem is that the initial choice of $\delta_1 = 1$ is too big since the limit $x \to 4$ is too close to $x = 3$, where the factor $x - 3$ vanishes. Although the arithmetic is bit messier, if you begin with $\delta_1 = \tfrac12$, and follow the same steps, everything should work out.
In general, if you're writing a proof for a limit as $x \to a$ for a rational function with roots $r_1, \dots, r_n$ in the denominator, you need to choose an initial
$$
\delta_1 < \min \bigl\{ |r_1 - a|, \dots, |r_n - a| \bigr\}.
$$
Comment: Or, you could use the fact that $|x-4| < \frac{1}{2}$ implies $|x-4| < 1$, so the existing estimates for the other terms remain valid.  You would just use the tighter bound for showing $|x-3| > \frac{1}[2}$.
Comment: I have a follow-up question in order to clarify one thing. I use Google sheets in order to verify that everything looks correct. I use a range of values for $x$ with stepsize $0.1$, let $a = 4$, and $\delta = min(\frac{1}{2}, \frac{46 \cdot \epsilon}{9})$, check $|x-a| < \delta$ and $|f(x) - f(a)| < \epsilon$. However, I note that for values where $\epsilon > 0.0082$ the condition $|f(x) - f(a)| < \epsilon$ is satisfied whereas $|x-a| < \delta$ is not (however whenever $|x-a| < \delta$ is satisfied then $|f(x) - f(a)| < \epsilon$ is also satisfied). Is that as it should be?
Comment: Yes, that's fine. The point is that you can force the "error" in the outputs $|f(x) - f(a)|$ to be as small as you like by making sure that the error in the inputs $|x - a|$ is small enough. If a certain value of $\delta$ is small enough to work for a given value of $\varepsilon$, then any *smaller* $\delta' < \delta$ or *larger* $\varepsilon' > \varepsilon$ also works.
Answer: Graphing on desmos, there's no hole, sharp point, or asymptote there, so it's continuous there.
Comment: OP is trying to *prove* that its continuous at $x = 4$.


How to debug Squid ERR_DNS_FAIL

Question: I am managing a couple of web proxies running Squid 4.10 on Ubuntu 20.04LTS in several locations distributed worldwide.
One of them has developed a nasty habit of occasionally failing to access a web page.
The user receives instead an error page saying:
Hmmm... can't reach this page
It looks like the webpage at <URL> might be having issues,
or it may have moved permanently to a new web address.
ERR_TUNNEL_CONNECTION_FAILED

After adding %err_code/%err_detail to the end of the relevant logformat as recommended on this mailing list post, Squid access.log entries for the failing accesses look like this:
1635169354.239    171 10.72.1.103 NONE/503 0 CONNECT ad.360yield.com:443 - HIER_
NONE/- - ERR_DNS_FAIL/-

Squid status is NONE/503, and the error code and detail always ERR_DNS_FAIL/-.
The timestamp, client IP address and requested URL vary of course.
Each occurrence of the problem affects a single FQDN or very small number of FQDNs, often all from the same organisation (eg. lm.licenses.adobe.com and cc-api-data.adobe.io, both from Adobe.) All other accesses continue to work normally. An occurrence lasts typically between five and ten minutes. During that time all clients trying to access that FQDN are affected. Before and after that, the same FQDN works without a problem. There is no discernible regularity in the affected FQDNs.
Some of the occurrences are accompanied by a message like:
2021/10/25 15:42:34 kid1| ipcacheParse No Address records in response to 'ad.360yield.com'

in /var/log/squid/cache.log but in the majority of cases nothing is logged there.
How can I find out what goes wrong there?
Answer: Increasing the loglevel for DNS lookups to 6 by putting the directive
debug_options ALL,1 78,6

into /etc/squid/squid.conf makes Squid log to /var/log/squid/cache.log which nameserver was used for the failed queries, for example:
2021/10/26 16:16:43.088 kid1| 78,3| dns_internal.cc(1369) idnsRead: idnsRead: FD 17: received 32 bytes from 127.0.0.1:53
2021/10/26 16:16:43.088 kid1| 78,3| dns_internal.cc(1176) idnsGrokReply: idnsGrokReply: QID 0x376f, 0 answers

The failures can then be further investigated on that nameserver.
In my case, this pointed to a dnsmasq DNS proxy server running on the same machine.
Enabling query logging on dnsmasq revealed that one of the four configured external nameservers was responsible for the failures.
Queries that got sent to that nameserver failed, while queries sent to one the other three succeeded.
So the solution was to drop the faulty external nameserver from the configuration.

How to debug Squid ERR_DNS_FAIL


How many tennis players have finished the year as Slam-less World No. 1?

Question: Roger Federer is very close, theoretically & somewhat practically, to finishing the calender year as World No. 1 without winning a Grand Slam
this year.
How many tennis players (both men & women) in the open era of tennis history have finished a calender year as World No. 1 without winning
any of the Grand Slams in that particular calender year?
Remember that the question includes the "Career Slam-less" as well as "Year Slam-less" World No. 1 at the end of the year.
At the top of my mind I remember, Caroline Wozniacki & Dinara Safina finishing No. 1 in womens tennis.
Comment: [Players who have held the No1 ranking without holding (reigning) a GS title?](http://www.menstennisforums.com/showthread.php?t=435681) at menstennisforums and [Ranking the Careers of This Era's Slamless Number Ones and One-Slam Wonders](http://www.tennisforum.com/showthread.php?t=620577) at tennisforum. Although it is not exactly the same question, you might find some useful information there.
Answer: ATP Tour
Simply by checking List of ATP number 1 ranked singles players at Wikipedia I found two players who were Year-end No. 1 without winning a Grand Slam tournament that year:

Jimmy Connors in 1975 and 1977
John McEnroe in 1982

(Connors won his first GS title in 1974 and McEnroe in 1979. But they did not won any GS in the years listed above. Note that McEnroe did not start at French Open and Australian Open in that year. So did Connors in 1977. In 1975 Connor did not play French Open.)
The same Wikipedia article also mentions two players who were at No. 1 position without GS title: Marcelo Rios and Ivan Lendl. (Lendl won several Grand Slam tournaments later.)
This article also says that: Federer could become the oldest Number 1 player since André Agassi. He could also become the third player to end the year in Number 1 position without winning a Grand Slam title after Jimmy Connors in 1975 and 1977 and John McEnroe in 1982.

WTA Tour
By checking similar list for WTA Tour on Wikipedia we can find the following year-end No. 1's without GS in the same year

Monica Seles in 1995.
Martina Hingis in 2000.
Lindsay Davenport in 2001, 2004 and 2005.
Jelena Jankovic in 2008.
Caroline Wozniacki in 2010 and 2011.

Note that Jankovic and Wozniacki still have not won a GS tournament. (Seles won her first GS title in 1990, Hingis in 1997 and Davenport in 1998.)
It is also worth mentioning 1995 was the comeback year for Monika Seles after the stabbing incident and she only played one GS tournament (US Open). She is listed as year-end No. 1 by WTA together with Steffi Graf (despite having less points than her).
The same Wikipedia article lists 5 players that were ranked No. 1 without having a GS title at the time: Kim Clijsters, Amélie Mauresmo, Jelena Jankovic, Dinara Safina and Caroline Wozniacki. (Clijster and Mauresmo won several GS tournaments, but only after they became No. 1 for the first time.)
This blog post discusses slamless No.1's since 2000.
Comment: I hope I did not miss some player when going through those two lists.
Comment: nice answer and research, well done.
Comment: Nicely researched answer. Although the 1st link redirects to WTA No. 1 & not ATP. So you might edit the link
Comment: @KharoBangdo Thanks for noticing that. It should be corrected now.
Answer: There is an answer summarizing the situation at the time when the question was posted. Here is a CW answer which can be updated when there are more players with No. 1 position without Grand Slam title.
Men
Year-end No. 1 without Grand Slam title in the same year
See also the list on Wikipedia (revision from 2019).

Jimmy Connors in 1975 and 1977
John McEnroe in 1982

No. 1 position before the first Grand Slam title

Ivan Lendl (No. 1 in 1983, the first GS title in 1984)
Marcelo Ríos (No. 1 in 1998, no GS title)

Women
Year-end No. 1 without Grand Slam title in the same year

Monica Seles in 1995.
Martina Hingis in 2000.
Lindsay Davenport in 2001, 2004 and 2005.
Jelena Jankovic in 2008.
Caroline Wozniacki in 2010 and 2011.
Simona Halep in 2017.

No. 1 position before the first Grand Slam title
See also the list on Wikipedia (revision from 2019).

Amélie Mauresmo (No. 1 in 2004, the first GS title in 2006)
Kim Clijsters (No. 1 in 2003, the first GS title in 2005)
Jelena Jankovic (No. 1 in 2008, no GS title)
Dinara Safina (No. 1 in 2009, no GS title)
Caroline Wozniacki (No. 1 in 2010, the first GS title in 2018)
Karolína Plíšková (No. 1 in 2017, no GS title)
Simona Halep (No. 1 in 2017, the first GS title in 2018)

Sources
Wikipedia articles List of ATP number 1 ranked singles tennis players and List of WTA number 1 ranked tennis players.
Comment: This answer is [community wiki](https://sports.meta.stackexchange.com/tags/community-wiki/info) - feel free to edit/update it whenever needed.


Speeding up creation of large ext3 filesystem on CentOS 5

Question: We are creating a large backup ext3 partition on 16TB RAID array and the mke2fs took 2.5 hours to complete.
Are there any known tricks we can use to shorten this time?
The aim is to lower the time to get us back on our feet if a disaster strikes and we have to re-create that file system. I see options like lazy_bg and uninit_groups but they seem to be for ext4 file systems, which is not relevant for us yet.
Comment: Would you consider using something different to ext3 if it speeded up the process significantly?
Answer: Just in case you can consider using a different filesystem, this question piqued my interest so I benchmarked filesystem creation on a 200GB volume. The results:
ext3:
    real    1m18.101s
ext4:
    real    0m56.850s
xfs:
    real    0m1.878s

200GB is quite a long way away from 16TB, but I think xfs is a safe bet for what you're looking for if you can opt for it. Also as a kind of rule of thumb I don't think you will be able to go much beyond ext4 creation speed with ext3 using special parameters, but I may be proven wrong by someone with more in-depth knowledge.
Comment: XFS takes about the same time to create on a 16TiB filesystem. It might be a bit longer, but it's not 8x times longer.
Comment: Thanks. I keep hearing about XFS as a solution for many situations. I was bitten before when using other types of file systems which are less prevalent than ext3 (e.g. resizing tools weren't up to snuff) so I'd like to try to avoid switching over just for that.
Answer: If you don't have a ton of tiny files (and I'm guessing with a 16 TB volume you probably don't), you can reduce the number of inodes, and that will dramatically speed up filesystem creation.  The option is -i (bytes), which takes a number of bytes as a parameter.  For each (bytes), an inode will be created.  I've had good luck with 4194304 (4 MB).
Comment: Thanks. That's a good point. I expect it's relevant here since the file systems will contain large Bacula volume files. Reducing i-nodes numbers can also save some space. I'll pass it on to the team.
Answer: I checked the e2fsprogs source code of CentOS 5, the 1.39-23 version of it support lazy_bg feature, although it is not list in manpage.
Answer: Got enough memory? Running 64 bit?
Considerations when creating ext3 filesystems has quite a few recommendations of how to optimise filesystem creation.


Sound after click the button and modal window opening

Question: I would like to make a sound after clicking on a button and opening a modal window, I would be grateful for help, no form data is sent to the server, this is just a visual improvement, like clicking on the submit button and the sound of sending a message or email
<button class="rent-yacht-send-button" type="submit" data-modal-open>
          Send<svg class="send-arrows-icon" width="18" height="8">
            <use href="../img/icons.svg#icon-arrow-right"></use>
          </svg>
        </button>
      </form>

        <button class="modal-btn" type="button" data-modal-close>
          <svg class="icon-modal" width="24" height="24">
            <use href="../img/icons.svg#icon-close-modal"></use>
          </svg>
        </button>
        <picture>
          <source media="(min-width:768px)" srcset="./email@example.com 1x, ./firstname.lastname@example.com 2x" />
          <source
            media="(min-width:320px)"
            srcset="./email@example.com 1x, ./email@example.com 2x"
          />

        </picture>

Thank You

Thank you for choosing Yacht Adventures, your booking details have been received and our team will be in
          touch shortly to confirm your reservation and provide any additional information or assistance you may
          need.

I found several scripts but they work crookedly, or do not perform their function at all
Answer: you can use this code  : Jsfiddle
<button id="buzzButton">Click me to hear buzz</button>

// Function to create a buzz sound
  function buzzSound() {
    const audioContext = new (window.AudioContext || window.webkitAudioContext)();
    const oscillator = audioContext.createOscillator();
    oscillator.type = 'sine'; // You can also try 'square', 'sawtooth', or 'triangle'
    oscillator.frequency.setValueAtTime(400, audioContext.currentTime);
    oscillator.connect(audioContext.destination);
    oscillator.start();
    oscillator.stop(audioContext.currentTime + 0.1); // Adjust the duration of the buzz sound here (in seconds)
  }

  // Add event listener to the button
  const buzzButton = document.getElementById('buzzButton');
  buzzButton.addEventListener('click', function(event) {
    event.preventDefault();
    buzzSound();
  });

Answer: The OP is missing the required JavaScript, plus the HTML is incomplete -- there's no <form> tag, only the end tag </form>. Normally I'd leave a comment, but I'm bored. Details are commented in example below.

// Reference <form> by #id or [name]
const form = document.forms.main;

// Create an Audio Object
const fart = new Audio("https://soundbible.com/mp3/Wont Start Fart-SoundBible.com-1643093672.mp3");

/**
 * Register the "submit" event to the <form>
 * When the <button>Open</button> is clicked, the
 * "submit" event is triggered and the event handler
 * open(event) is called.
 */
form.onsubmit = open;

/**
 * This event handler passes the Event Object by
 * default.
 * line 1. Stops the default behavior of <form> when
 *         "submit" event is triggered.
 * line 2. Plays MP3 file.
 * line 3. Opens the <dialog> (for demo purposes).
 */
function open(event) {
  event.preventDefault();
  fart.play();
  document.querySelector("dialog").showModal();
}
form {
  display: flex;
  flex-flow: column nowrap;
  justify-content: center;
  align-items: center;
}
<form id="main">
  <button>Open</button>
</form>

<dialog>
  <form method="dialog">

    <button>OK</button>
  </form>
</dialog>
Answer: Add an audio tag and set the audio url to it's src value. Then
let btn = document.getElementById(Id);
let audio = document.getElementById(audioid);
btn.onclick = () => {
  audio.play();
}

Comment: this will not work on safari
Comment: Answer needs supporting information
Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](https://stackoverflow.com/help/how-to-answer).


Cannot connect with other mobile device using flutter_bluetooth_serial. Getting exception Cannot connect, exception occured. Can anyone help in this

Question: Cannot connect with other mobile device using flutter_bluetooth_serial. Getting exception Cannot connect, exception occured.
Here is the log :
selected 2C:4D:DE:7E:75:0A
D/FlutterBluePlugin(15068): Connecting to 2C:4D:DE:7E:75:0A (id: 12)
D/BluetoothAdapter(15068): cancelDiscovery(): called by: com.example.blue_classic
W/BluetoothAdapter(15068): getBluetoothService() called with no BluetoothManagerCallback
I/flutter (15068): Cannot connect, exception occured
I/flutter (15068): PlatformException(connect_error, read failed, socket might closed or timeout, read ret: -1, java.io.IOException: read failed, socket might closed or timeout, read ret: -1
I/flutter (15068):  at android.bluetooth.BluetoothSocket.readAll(BluetoothSocket.java:685)
I/flutter (15068):  at android.bluetooth.BluetoothSocket.readInt(BluetoothSocket.java:697)
I/flutter (15068):  at android.bluetooth.BluetoothSocket.connect(BluetoothSocket.java:374)
I/flutter (15068):  at io.github.edufolly.flutterbluetoothserial.BluetoothConnection.connect(BluetoothConnection.java:57)
I/flutter (15068):  at io.github.edufolly.flutterbluetoothserial.BluetoothConnection.connect(BluetoothConnection.java:64)
I/flutter (15068):  at io.github.edufolly.flutterbluetoothserial.FlutterBluetoothSerialPlugin$FlutterBluetoothSerialMethodCallHandler.lambda$onMethodCall$4$io-github-edufolly-flutterbluetoothserial-FlutterBluetoothSerialPlugin$FlutterBluetoothSerialMethodCallHandler(FlutterBluetoothSerialPlugin.java:1007)
I/flutter (15068):  at io.github.edufolly.flutterbluetoothserial.FlutterBluetoothSerialPlugin$FlutterBluetoothSerialMethodCallHandler$$ExternalSyntheticLambda2.r

Answer: Till I know flutter_bluetooth_serial is only supporting classical Bluetooth (Ex. Handsfree, Headphones) not mobile device to mobile device
Comment: it is working with handfrees but I need connection between two mobile devices. Which package or technique I should use then?


lim sup inequality $\limsup ( a_n b_n ) \leq \limsup a_n \limsup b_n $

Question: I´m not sure how to start with this proof, how can I do it?
$$
\limsup ( a_n b_n ) \leqslant \limsup a_n \limsup b_n
$$
I also have to prove, if $ \lim a_n $ exists then:
$$
\limsup ( a_n b_n  ) = \limsup a_n \limsup b_n
$$
Help please, it´s not a homework I want to learn.
Comment: In both cases you need the assumption $a_n\geq0$ and $b_n\geq0$ (for $n$ large enough). (Can you see some counterexamples?)
Comment: Can you propose some? I was long under the impression (long before seeing this post) that if $lim\{a_{n}\}$ exists and $\varlimsup\{b_{n}\} \rightarrow B < 0$, then equality still holds.
Answer: The basic idea is what could be called the monotonicity of $\sup$: the supremum over a set is at least as large as the supremum over a subset.
Of course, this only makes sense if the product of the $\limsup$s is not $0\cdot\infty$ or $\infty\cdot0$. We also make the assumption that $a_n,b_n\gt0$. To see that this is necessary, consider the sequences $a_n,b_n=(-1)^n-2$.
Recall the definition of $\limsup$:
$$
\limsup_{n\to\infty}a_n=\lim_{k\to\infty\vphantom{d^{d^a}}}\sup_{n>k}a_n\tag{1}
$$
The limit in $(1)$ exists since, by the monotonicity of $\sup$,  $\sup\limits_{n>k}a_n$ is a decreasing sequence.
Furthermore, also by the monotonicity of $\sup$, if $a_n,b_n\gt0$,
$$
\sup_{n>k}a_n \sup_{n>k}b_n=\sup_{m,n>k}a_nb_m\ge\sup_{n>k}a_nb_n\tag{2}
$$
Taking the limit of $(2)$ as $k\to\infty$ yields
$$
\limsup_{n\to\infty}a_n\limsup_{n\to\infty}b_n\ge\limsup_{n\to\infty}a_nb_n\tag{3}
$$
since the limit of a product is the product of the limits.

If the limit of $a_n$ exists, we have that for any $\epsilon>0$, there is an $N$, so that $n>N$ implies
$$
a_n\ge\lim_{n\to\infty}a_n-\epsilon\tag{4}
$$
For the time being, assume that $\lim\limits_{n\to\infty}a_n\gt0$. We are interested in small $\epsilon$, so it doesn't hurt to assume $\epsilon\lt\lim\limits_{n\to\infty}a_n$. For $k\gt N$, if $a_n,b_n\gt0$,
$$
\sup_{n>k}a_nb_n\ge\left(\lim_{n\to\infty}a_n-\epsilon\right)\sup_{n>k}b_n\tag{5}
$$
taking the limit of $(5)$ as $k\to\infty$ yields
$$
\limsup_{n\to\infty}a_nb_n\ge\left(\lim_{n\to\infty}a_n-\epsilon\right)\limsup_{n\to\infty}b_n\tag{6}
$$
Since $\epsilon$ is arbitrarily small, $(6)$ becomes
$$
\limsup_{n\to\infty}a_nb_n\ge\lim_{n\to\infty}a_n\limsup_{n\to\infty}b_n\tag{7}
$$
If $\lim\limits_{n\to\infty}a_n=0$, then $(7)$ is trivial, so we can remove the assumption that $\lim\limits_{n\to\infty}a_n\gt0$.
Combining $(3)$ and $(7)$ yields
$$
\limsup_{n\to\infty}a_nb_n=\lim_{n\to\infty}a_n\limsup_{n\to\infty}b_n\tag{8}
$$
since $\displaystyle\limsup_{n\to\infty}a_n=\lim_{n\to\infty}a_n$.
Comment: It can be arbitrarily *small* is the point.
Comment: Sorry, I just realized that I didn't hit enter after my last change. I was looking on my phone and wondered what happened to my edit.
Comment: @sunny: if $\lim\limits_{n\to\infty}a_n=0$, then $(7)$ is trivial. I have separated the case of $\lim\limits_{n\to\infty}a_n=0$ to make that clearer.
Comment: You really need the positivity of $a_n$ for this to work, yet your proof never mentions that.
Comment: @ThomasAndrews: it was used implicitly in $(2)$ and $(5)$. I missed that this was not actually stated in the question, so I have now added this to those steps.
Comment: You also need the sequences to be bounded if you want to perform algebraic manipulations with them, right? Otherwise the lim sup's might not be finite
Comment: @ArkyaChatterjee: I have amended my answer.
Comment: Why (5) is correct? the term of $b_n$ which makes $a_nb_n$ $ sup$ might not be the $sup$ of $b_n$.
Comment: @NanLi: for $k\gt N$, $a_k\ge\lim\limits_{n\to\infty}a_n-\epsilon$. Multiply both sides by $b_n$ and take the $\sup\limits_{n\gt k}$.
Comment: One question: From (6) to (7), you just remove the  by saying it is an arbitrary number, but why can you just do it? I mean, if we had a strict unequality i would understand it, for example if a > b-, for any arbitrary >0, i would say that a ≥ b. So in (4), there has to be a strict inequality, right, or am I thinking wrong?
Comment: @LinearAlgebruh: If $a-\epsilon\le b$ for any $\epsilon\gt0$, then $a\le b$.
Comment: @robjohn In 5, we have to consider $\left(\lim_{n\to\infty}a_n-\epsilon\right)>0$ right ?
Comment: @Dunck: "We also make the assumption that $a_n,b_n\gt0$." I have added a bit after $(4)$.
Comment: @robjohn Yes, I know, I have an elementary doubt. If I have a large $\epsilon$, then the inequality $\left(\lim_{n\to\infty}a_n-\epsilon\right)>0$ do not holds, then I can't take it out of the sup. I have to consider $\epsilon$ arbitrary small? In the end of the proof is told that $\epsilon$ is arbitrary, so, it can be big, I got confused.
Comment: @robjohn Now it became clear to me. Thanks!
Comment: Um, why is (4) correct? Shouldn't there be "greater than" sign rather than "greater than equal to" symbol?
Comment: It doesn't really make any difference. If you really think it does, then take the $N$ that gives a difference $\le\epsilon/2$, then that $N$ will give a difference $\lt\epsilon$.
Answer: $$\{{a_m}\cdot {b_m}:m\geqslant n\}\subseteq \{{a_m}\cdot {b_k}:m,k\geqslant n\}$$
since we are pairing elements from two sets together in the first set while drawing each elements at random from two sets in the second set. By taking the supremum we have:
$$\sup\{{a_m}\cdot {b_m}:m\geqslant n\}\leqslant\sup\{{a_m}\cdot {b_k}:m,k\geqslant n\}\\=\sup\{{a_m}:m\geqslant n\}\cdot\sup\{{b_m}:m\geqslant n\}$$
which is seen by using the $\textbf{lemma}$ : $\sup (A*B)=\sup A* \sup B$ , where $(A*B)=\{a*b:a\in A,b\in B\}$.
Taking limit in the above inequality gives:
$$\lim_{n\to\infty}\sup\{{a_m}\cdot{b_m}:m\geqslant n\}\leqslant \lim_{n\to\infty}\sup\{{a_m}\cdot{b_k}:m,k\geqslant n\}\\=\lim_{n\to\infty}\sup\{\{{a_m}:m\geqslant n\}
\cdot\lim_{n\to\infty} \sup\{\{{b_m}:m\geqslant n\}$$
$$Q.E.D$$
Proof of $\textbf{lemma}$:
First we note that for any $x,X,y,Y\in\mathbb R$, from the inequalities
$$x\leq X\\y\leq Y$$ it follows that $xy\leq XY$ if either $x\ge 0$ and $Y\ge 0$ or if $y\ge 0$ and $X\ge 0$ (a sufficient condition).
Thus, if $a\ge 0,\,\forall a\in A$ and $\sup B\ge 0$ or if $b\ge 0,\forall b\in B$ and $\sup A\ge 0$, we have
$$\forall c\in A*B,\exists a\in A,b\in B,s.t.c=a\cdot b\leqslant \sup A *\sup B$$
So $A*B$ is bounded by $\sup A *\sup B$.
Now, if  $a\ge 0,\,\forall a\in A$ and $\sup B> 0$ or if $b\ge 0,\forall b\in B$ and $\sup A> 0$, for any small enough $\epsilon$, we have
$$\forall \varepsilon \gt 0,\exists a \in A,b \in B ,s.t.a \gt \sup A-\varepsilon ,b \gt \sup B -\varepsilon ,\\a\cdot b\gt {\sup A }\cdot {\sup B}-\varepsilon\cdot \big(\sup A+\sup B)- {\varepsilon}^{2}$$
So any number less than $\sup A *\sup B $ is not an upper bound. Thus $\sup A *\sup B $ is the least upper bound.
Answer: I assume all relevant values are positive as otherwise this is false. Note that whenever $\limsup(a_nb_n)$ exists, we have some subsequence $(a_n'b_n')$ of $(a_nb_n)$ which converges to $\limsup(a_nb_n)$. For any $\epsilon>0$, we have some $N$ such that $$k\geq N\implies a_k'b_k'>\limsup(a_nb_n)-\epsilon\text{ and } b_k'<\limsup(b_n)+\epsilon$$ and so we have $$k\geq N\implies a_k'>\frac{\limsup(a_nb_n)-\epsilon}{b_k'}>\frac{\limsup(a_nb_n)-\epsilon}{\limsup(b_n)+\epsilon}$$
and this goes to $\frac{\limsup(a_nb_n)}{\limsup(b_n)}$ as $\epsilon\to 0,k\to\infty$ giving us $\limsup(a_n)\geq \frac{\limsup(a_nb_n)}{\limsup(b_n)}$ so
$$\limsup(a_n)\limsup(b_n)\geq \limsup(a_nb_n).$$
I will leave the case where $\lim\limits_{n\to\infty}(a_n)$ exists to you, as it is similar.
Comment: @AD. Yes, you're quite right. Fixed.
Comment: Wait, did you assume  $\lim a'_n = limsup(a_n)$ ? How does that follow from the fact that $a'_n b'_n \to limsup(a_n b_n)$?
Answer:
This inequality (for $a_n,b_n\ge0$ and excluding the indeterminate forms $0\cdot\infty$ and $\infty\cdot0$) is a part of Problem 2.4.17 in the book Wieslawa J. Kaczor, Maria T. Nowak: Problems in mathematical analysis: Volume 1; Real Numbers, Sequences and Series, Problem 2.4.15. The problem is given on p.44 and solved on p.200-201. (AFAIK this book is also available in French and Polish.) See also this answer.
R. Bartle: A modern theory of integration (AMS, 2001), Theorem A.3(f) in Appendix A (which is devoted to limit superior and limit inferior).
Problem 42 in Section 1.5 of H. L. Royden and P. M. Fitzpatrick: Real Analysis, (Fourth Edition). (This book does not include solutions to problems.)

I am making this CW, feel free to add other references.
Comment: The problem is also located in Royden's *Real Analysis* text, section 1.5 problem 42 of the fourth edition.
Answer: Let's assume that $(a_n)$ and $(b_n)$ are non-negative.
Suppose that both the quantities on RHS are finite.
$$\limsup a_n\limsup b_n=(\lim \sup_{m\ge n}a_m) (\lim\sup_{m\ge n}b_m)=\lim(\sup_{m\ge n}a_m\sup_{m\ge n}b_m)\tag 1$$
where the second equality follows by limit rules (product of limits of two sequences is equal to limit of product of the sequences, if both the limits under product exist).
We have $\sup_{m\ge n}a_m\sup_{m\ge n}b_m\ge a_kb_k$ for every $k\ge n$ (note that this is where we require the non-negativity of the sequences) and hence by completeness property of the reals: $\sup_{k\ge n} a_kb_k\le \sup_{m\ge n}a_m\sup_{m\ge n}b_m$. Taking limit as $n\to \infty$ on both sides, we get: $$\lim\sup_{k\ge n} a_kb_k\le \lim (\sup_{m\ge n}a_m\sup_{m\ge n}b_m)\tag 2$$
It follows by $(1)$ and $(2)$ that
$$\limsup a_n\limsup b_n\ge \limsup (a_nb_n)\tag 3$$
$(3)$ does not hold if the sequence $(a_n)$ is defined as $a_{2k}=0$ and $a_{2k+1}=-1$ and $b_n:=a_n$ for all $n\in \mathbb N$.
(Note that $\limsup a_nb_n=1$ and $\limsup a_n=0=\limsup b_n$).
It can be shown using the same ideas as above that:
$$\liminf a_n\limsup b_n\le \limsup (a_nb_n)\le \limsup a_n \limsup b_n$$, where the second inequality has already been proven above.
The second result in OP follows by noting that  $\lim a_n$ exists $\iff \limsup a_n=\liminf a_n$.
The case when either of the quantity inside parentheses in RHS of first equality of $(1)$ is $+\infty$ (and the other quantity is $+\infty$ or a positive number) can be handled separately noting that in that case the corresponding sequence will be unbounded.
Comment: @sunny: Hi. Take for example $\{a_n\}= (1,-1,1,-1,...)$ and $\{b_n\}= (-1,-2,-1,-2,...)$. Then, $\sup_{m\ge n} a_m=1,\sup_{m\ge n} b_m=-1$, and the inequality fails when k is even.
Comment: Hey Koro, thank you for the answer. Could you explain in more detail why the inequality $\sup_{m\ge n}a_m\sup_{m\ge n}b_m\ge a_kb_k$ requires the sequences to be positive?
Answer: [Comment: This is, frankly, one of the most surreal and bizarre proofs I've ever written. Please let me know if you identify a mistake].
We provide a very simple proof which makes use of the following facts. First, that any sequence $s_n$ admits a convergent subsequence which converges to $\limsup s_n$. Second, any subsequence of a convergent sequence converges to the same value. Third, the limsup of a sequence is at least the limsup of any subsequence. Each of these claims hold even when the limits or limsups are $+ \infty$.
There is a subsequence $n_j$ such that $\lim_{j} a_{n_j}b_{n_j} = \limsup_{n} a_{n}b_{n}$. There is a further subsequence ${n_{j_{k}}}$ such that $\lim_{k} a_{{n_{j_{k}}}} = \limsup_{j} a_{n_j}$. There is yet a further subsequence $n_{j_{k_q}}$ such that $\lim_{q} b_{n_{j_{k_q}}} = \limsup_{k} b_{n_{j_{k}}}$.
Hence $\limsup_{n} a_{n}b_{n} = \lim_{j} a_{n_j}b_{n_j} = \lim_{q} a_{n_{j_{k_q}}}b_{n_{j_{k_q}}} \overbrace{=}^{*}  \lim_{q} a_{n_{j_{k_q}}}\lim_{q} b_{n_{j_{k_q}}} =   \limsup_{q} a_{n_{j_{k_q}}}\limsup_{q} b_{n_{j_{k_q}}} \overbrace{\leq}^{**} \limsup_{n} a_n \limsup_{n} b_n$
At ($*$), we use the fact that limits commute with multiplication, provided that we don't have a $0 \cdot  \infty$ situation. At ($**$), we use the monotonicity of the $\limsup$ --- that is, the limsup of the whole sequence is at least the limsup of any subsequence. That, and the fact that $a \leq b \land c \leq d \to ac \leq cd$ provided $a,b,c,d \in [0, +\infty]$, and none of the products are of the form $0 \cdot \infty$.

A similar argument can show we have equality if $\alpha = \lim_{n} a_n$ exists. We again avoid the $0 \cdot \infty$ case.
If $\alpha = 0$ and $\limsup_{n} b_n<C<\infty$, then use that $b_n<C+2$ for sufficiently large $n$. Hence $0 \leq \limsup a_nb_n \leq (C+2)\limsup a_n = 0$. So we have equality in this case.
Otherwise assume $\alpha>0$.
We start as before. There is a subsequence $n_j$ such that $\lim_{j} a_{n_j}b_{n_j} = \limsup_{n} a_{n}b_{n}$.  There is a further subsequence $n_{j_{k}}$ such that $\lim_{k} b_{n_{j_{k}}} = \limsup_{j} b_{n_{j}}$. Thus $$\limsup_{n} a_nb_n = \lim_{j} a_{n_j}b_{n_j} = \lim_{k} a_{n_{j_{k}}} b_{n_{j_{k}}} = (\lim_{k} a_{n_{j_{k}}})(\lim_{k} b_{n_{j_{k}}}) = \alpha \limsup_{j} b_{n_j}  \ \ \ \ \ \ \ \ (1)$$
We claim that $\limsup_{j} b_{n_j} = \limsup_{n} b_n$. If this isn't true, then there is another subsequence $m_{j}$ such that $\limsup_{j} b_{n_j}
< \lim_{j} b_{m_j} = \limsup_{n} b_n$. But, using that $\lim_{n} a_n$ exists, $\limsup_{n} a_nb_n \geq \lim_{j} a_{m_j}b_{m_j} = \alpha
 \lim_{j} b_{m_j}$. By $(1)$, this means $\alpha \limsup_{j} b_{n_j} \geq \alpha \lim_{j} b_{m_j} = \alpha\limsup_{j} b_{m_j}$, and dividing through we get $\limsup_{j} b_{n_j} \geq \limsup_{j} b_{m_j} = \lim_{j} b_{m_j}$ contradicting our choice of $m_j$.
Comment: @Koro The sequence $r_k = b_{n_{j_k}}$ can be viewed as its own sequence. There is a subsequence $r_{k_q}$ converging to $\limsup_{k} r_k$. Hence $\lim_{q} r_{k_q} = \limsup_{k} r_k$.
Comment: I think that in second para the statement "There is yet a further subsequence $n_{j_{k_q}}$..." is not correct or needs more work. There is no reason to believe why convergent subsequence of $(b_n)$ should borrow indices from $n_{j_k}$'s.
Comment: I see. I somehow missed the subscript $k$ in RHS of $\lim_{q} b_{n_{j_{k_q}}} = \limsup_{k} b_{n_{j_{k}}}$ in your answer. :)


Mostrar dados php dentro de tabs

Question: tenho uma duvida em relação as tabs.
Anteriormente tinha os dados a serem mostrados todos dentro de uma tabela com paginação .
Agora a minha duvida é.
com as divisões das tabs tenho de abrir e fechar o php sempre que mudo de tab?
Como consigo fazer a paginação com as tabs?
Antes tinha assim:

include("conectar.php");

$quantidade = 1;
$pagina = (isset($_GET ['pagina'])) ? (int)$_GET['pagina'] : 1;
$inicio = ($quantidade * $pagina) - $quantidade;
$sql = "select * from Tables order by tb_trabalhador.id asc LIMIT $inicio,   $quantidade"  ;
    $qr = mysql_query($sql) or die(mysql_error());
    while($exibe = mysql_fetch_array($qr)){
    echo "
";

    echo  "
Nome:	";
    echo "".$exibe["Nome"]."
";

    echo  "
Morada:	"; echo "";
    if ($exibe['Morada']){ echo $exibe['Morada'];}else{echo 'N/D';} echo "
";

     echo  "
Distrito:	"; echo "";
     if ($exibe['Distrito']){ echo $exibe['Distrito'];}else{echo 'N/D';} echo "
";

     echo  "
Concelho:	"; echo "";
     if ($exibe['Concelho']){ echo $exibe['Concelho'];}else{echo 'N/D';} echo "
";

Agora tenho assim sem estar preenchido:

Content for Tab 1

Content for Tab 2

Content for Tab 3

Comment: `Como consigo fazer a paginação com as tabs` não entendi? poderia explicar melhor?
Comment: No primeiro exemplo era como tinha para mostrar os dados do Mysql em forma de tabela e antes da tabela tinha a paginação.
Mas decidi melhorar essa forma e quero que os dados do mysql aparecem em sitios diferente de forma organizada.
Ao alterar isso fiquei sem saber onde colocar a paginação a funcionar
Answer: Seu PHPdeve ficar assim:
$i = 1;
while($exibe = mysql_fetch_array($qr)){
echo"

".$exibe['Morada']."

".$exibe['Distrito']."

".$exibe['Concelho']."

";
$i++;
}

A variável $i esta fazendo a contagem para o CSS que você está aplicando, a cada WHILE que retorna para verificação, ele acrescenta +1, sendo assim quando finalizar as informações ele irá colocar cada CSS no devido lugar.
Caso tenha que carregar muita informações dentro da TABS, terá que ser feito um ECHO para cada TABS.
Comment: Uma duvida. O exemplo que deixas-te é apenas para uma tab correcto?
E antes do $i tenho de abrir o php
Answer: Olá.
A melhor opção de paginação é com dados setado de $inicio e $limite fazendo apenas uma query dos dados desejáveis SELECT lista FROM tablet LIMIT $inicio,$limite. E ainda você ganha com performance de execução.
Um exemplo:
http://daltonmenezes.wordpress.com/2010/06/17/paginacao-de-resultados-com-php-e-mysql-aprenda-definitivamente-no-passo-a-passo/

Acho que é isto:
<?php
include("conectar.php");

$quantidade = 1;
$pagina = (isset($_GET ['pagina'])) ? (int)$_GET['pagina'] : 1;
$inicio = ($quantidade * $pagina) - $quantidade;
$sql = "select * from Tables order by tb_trabalhador.id asc LIMIT $inicio,   $quantidade"  ;
    $qr = mysql_query($sql) or die(mysql_error());
    while($exibe = mysql_fetch_array($qr)){

    //verificação sequencial.
    if (!empty($exibe['Morada'])){
      $morada = 'N/D';
    }else{
      $morada = $exibe['Morada']
    }
    if (!empty($exibe['Distrito'])){
      $distrito = 'N/D';
    }else{
      $distrito = $exibe['Distrito']
    }
    if (!empty($exibe['Concelho'])){
      $conselho = 'N/D';
    }else{
      $conselho = $exibe['Concelho']
    }

    echo'

Nome: '.$exibe["Nome"].'

Morada:   '.$morada.'

Distrito: '.$distrito.'

Concelho: '.$conselho.'

';
 }
?>

Comment: Obrigado, mas o meu problema não é fazer a paginação pois ja a tinha feito. Mas alterei a forma de mostrar os dados e coloquei tabs e aqui sim é o meu problema.
Comment: Dentro do div tenho de abrir o php correcto?

Mostrar dados php dentro de tabs


Como converter um JSON recebido no meu Spring Kafka consumer em uma entidade pronta para ser salva no banco?

Question: Boa tarde!
Eu preciso consumir JSONs de tópicos do Kafka e converter para entidades, e assim poder salvar no banco de dados, Postgres, no caso
Configuração do consumer:
@Configuration
@EnableKafka
public class ConsumerConfiguration {
    @Value("${spring.kafka.bootstrap-servers}")
    private String bootstrapServers;

    @Bean
    public Map<String, Object> consumerConfigs() {
        Map<String, Object> properties = new HashMap<>();
        properties.put(ConsumerConfig.BOOTSTRAP_SERVERS_CONFIG, bootstrapServers);
        properties.put(ConsumerConfig.KEY_DESERIALIZER_CLASS_CONFIG, JsonDeserializer.class);
        properties.put(ConsumerConfig.VALUE_DESERIALIZER_CLASS_CONFIG, JsonDeserializer.class);
        properties.put(JsonSerializer.ADD_TYPE_INFO_HEADERS, false);
        properties.put(ConsumerConfig.GROUP_ID_CONFIG, "Kafka");
        return properties;
    }

    @Bean
    public ConsumerFactory<String, String> consumerFactory() {
        return new DefaultKafkaConsumerFactory<>(consumerConfigs(),
                new StringDeserializer(),
                new JsonDeserializer<>(String.class));
    }

    @Bean
    public KafkaListenerContainerFactory<ConcurrentMessageListenerContainer<String, String>>
    kafkaListenerContainerFactory() {
        ConcurrentKafkaListenerContainerFactory<String, String> factory =
                new ConcurrentKafkaListenerContainerFactory<>();
        factory.setConsumerFactory(consumerFactory());
        return factory;
    }

    @Bean
    public EventConsumer consumer() {
        return new EventConsumer();
    }
}

Consumer:
@Slf4j
@Data
public class EventConsumer {
    private EntidadeComercialRepository entidadeComercialRepository;
    private CountDownLatch latch = new CountDownLatch(1);

    @KafkaListener(topics = "${topic.entidades_comerciais}")
    public void kafkaConsumer(@Payload EntidadesComerciais entidadesComerciais) {
        entidadeComercialRepository.save(entidadesComerciais);
        log.info("received payload='{}'", entidadesComerciais);
        latch.countDown();
    }
}

Parte da entidade
@lombok.Data
@NoArgsConstructor
@AllArgsConstructor
@Entity(name = "ENTIDADES_COMERCIAIS")
@Builder
public class EntidadesComerciais {
    @Id
    @Column(name = "CODIGO_DA_ENTIDADE_COMERCIAL")
    private Long codigoDaEntidadeComercial;

    @Column(name = "NOME_DA_ENTIDADE_COMERCIAL")
    private String nomeDaEntidadeComercial;

    @Column(name = "NOME_COMERCIAL")
    private String nomeComercial;

    @Column(name = "TIPO_DA_ENTIDADE_COMERCIAL")
    private String tipoDaEntidadeComercial;
    ...

Estou usando Spring Kafka e o banco é Postgres. A exceção que está retornando:
org.springframework.kafka.listener.ListenerExecutionFailedException: Listener method could not be invoked with the incoming message
Endpoint handler details:
Method [public void br.com.dchristofolli.kafka.EventConsumer.kafkaConsumer(br.com.dchristofolli.kafka.entity.EntidadesComerciais)]
Bean [EventConsumer(entidadeComercialRepository=null, latch=java.util.concurrent.CountDownLatch@144e36ae[Count = 1])]; nested exception is org.springframework.messaging.converter.MessageConversionException: Cannot handle message; nested exception is org.springframework.messaging.converter.MessageConversionException: Cannot convert from [java.lang.String] to [br.com.dchristofolli.kafka.entity.EntidadesComerciais] for GenericMessage [payload={"topic":"ENTIDADES_COMERCIAIS"...

Answer: A própria exceção já diz
Cannot convert from [java.lang.String] to [br.com.dchristofolli.kafka.entity.EntidadesComerciais]

Olhe como você está instanciando seu Consumer, passando um Deserializer de String. Vc deve especificar a classe do seu pojo no Deserializer, pois é para esse tipo que o Objecto será convertido e passado para o método kafkaConsumer
@Bean
public ConsumerFactory<String, String> consumerFactory() {
    return new DefaultKafkaConsumerFactory<>(consumerConfigs(),
            new StringDeserializer(),
            new JsonDeserializer<>(EntidadesComerciais.class));
}

Ou então você pode receber uma String. Mude a assinatura do método para receber uma String, e faça a conversão na mão dentro do método, como por exemplo:
ObjectMapper objectMapper = new ObjectMapper()
objectMapper.readValue(carJson, EntidadesComerciais.class);

Referência: https://docs.spring.io/spring-kafka/reference/html/#messaging-message-conversion


Solving recursion $x_{n+1}=\frac{Cx_n}{1-x_n}$

Question: Is there an exact solution (or can we get bounds on) the recurrence
$$x_{n+1}=\frac{C x_n}{1-x_n},$$ where $C\in(0,1)$ and $x_0\in[0,1-C)$?
I can quickly show that the solution degreases to $0$ as $n\rightarrow \infty$, but the best I can do it's to bound $x_{n+1}\geq C x_n \geq ... \geq C^{n}x_0$ and $x_{n+1}\leq \frac{C}{1-x_0}x_n\leq \left(\frac{C}{1-x_0}\right)^nx_0$, but I don't know a whole lot about difference equations and better bounds or an exact solution would be useful for a problem i'm working on
Comment: Yes, we can find an exact solution. The RHS is a fractional linear transformation / Mobius transformation and composition of these things works the same way as matrix multiplication; the exact solution is in terms of the eigenvalues of the matrix $\left[ \begin{array}{cc} C & 0 \\ 1 & -1 \end{array} \right]$.
Answer: If $x_0 = 0$, then $x_n = 0$ for every $n$. So let's suppose that $x_0 \neq 0$, in which case $x_n \neq 0$ for every $n$.
Then let $y_n = \dfrac{1}{x_n}$. The equation rewrites as
$$y_{n+1} = \dfrac{1}{C}(y_n-1)$$
For $z_n = y_n - \dfrac{1}{1-C}$, you get that $$z_{n+1} = y_{n+1} -\dfrac{1}{1-C} = \dfrac{1}{C}(y_n-1) -  \dfrac{1}{1-C}= \dfrac{1}{C}\left(z_n + \dfrac{C}{1-C}\right) -  \dfrac{1}{1-C} = \dfrac{1}{C}z_n$$
which leads to $z_n = \dfrac{z_0}{C^n}$ for every $n \geq 0$, and then to $$y_n = \dfrac{y_0 - \frac{1}{1-C}}{C^n} + \dfrac{1}{1-C} = \dfrac{y_0(1-C)+C^n-1}{C^n(1-C)}$$
and finally to $$\boxed{x_n =  \dfrac{x_0C^n(1-C)}{(1-C)+x_0(C^n-1)}}$$
Comment: Of course, that can be cancelled to $\frac{x_0C^n}{1-x_0\sum_{k=0}^{n-1}C^k}$, according to individual preference.


How Do I use this "=IF(F2>E2, F2-E2, ("24:00:00"-E2)+F2)" in VB.net code?

Question: I am trying to reduce the time taken to generate the reports for an application. We generate the reports in Excel. We found that some calculation are much faster in Excel using formula than programmatically doing it in VB.net
So basically I need to use the following formula(Time difference) in VB.net code. but it is giving me an error.
=IF(F2>E2, F2-E2, ("24:00:00"-E2)+F2)
What I tried
Dim f As String = "=if(RC[-1]>RC[-2], RC[-1]-RC[-2], (" & "24:00:00" & "-RC[-2])+RC[-1]"

wbXl.Sheets("time diff", 7).FormulaR1C1 = f

wbXl.Sheets("time diff").Cells(2, 7).FormulaR1C1 = """"=if(RC[-1]>RC[-2], RC[-1]-RC[-2], ("24:00:00" & "-RC[-2])+RC[-1]""""

and few other combination but nothing seems to be working.
Any pointers or help would be really helpful.
Comment: What error is it giving you?
Comment: I am getting Exception from HRESULT: 0x800A03EC
Comment: Thanks @pnuts , That worked,

here is code again

Checks if the time A is greater that B and subtract accordingly
    wbXl.Sheets("Unique Session").Cells(2, 7).FormulaR1C1 = "=IF(RC[-1]>RC[-2], RC[-1]-RC[-2],RC[-1]+1-RC[-2])"

Sets the format of the text to h:mm:ss
    wbXl.Sheets("Unique Session").Range("G2:G" & lrow + 1).NumberFormat = "[h]:mm:ss;@"
Answer: Where do I start…
Dim f As String = "=if(RC[-1]>RC[-2], RC[-1]-RC[-2], (" & "24:00:00" & "-RC[-2])+RC[-1]"

That is not a valid syntax in Excel (you can't assign the value at the time you Dim it… get .net if you want to do that!)
What is up with the "24:00:00" in quotes?  Why not just subtract 1?
And all the quotes… it should be:
Cells(2, 7).FormulaR1C1 = "=if(RC[-1]>RC[-2], RC[-1]-RC[-2], (""24:00:00""-RC[-2])+RC[-1])"

Or better:
Cells(2, 7).FormulaR1C1 = "=if(RC[-1]>RC[-2], RC[-1]-RC[-2], (1-RC[-2])+RC[-1])"

I'm also assuming you're using RC notation because you're going to do dynamic entry.  Otherwise, just use the cell IDs (easier to maintain).   Re-reading, it's in .net calling Excel (what I'm gathering).  Otherwise, I'd say the sheet syntax should be different.  (and most people prefer Range to Cell.  Cell(2,7) is harder to read than Range("$G$2"). )
And here's how I'd write the formula:
=B8+(B8<A8)-A8
(or in RC: =RC[-1]+(RC[-1]<RC[-2])-RC[-2])

Removes some of the redundancy of the original:
=IF(B6>A6,B6-A6,("24:00:00"-A6)+B6)

Comment: Hello Robert, Thanks for that, I am using **.net**, 'Cells(2, 7).FormulaR1C1' just as an example that has been used, I used formula in excel it worked good put could not use this dynamically in .net for multiple sheet.  Also I still don't understand concept of subtracting 1. can you please explain.


In Fourier transform why does the quantity $[fe^{-ikx}]^{\infty}_{-\infty}=0$?

Question: Let us say we know that the Fourier transform of the function $f(x)$ exists, which means that:
$$\int^{\infty}_{-\infty}|f(x)|dx<\infty$$
However, this does not mean that $f(x)\rightarrow 0$ as $x \rightarrow \pm\infty$ (according to this question anyway Does an absolutely integrable function tend to $0$ as its argument tends to infinity?). So I cannot see why the value of
$$[fe^{-ikx}]^{\infty}_{-\infty}=0$$
Please can someone explain?
Comment: Where are you getting $\left.f(x)e^{ikx}\right|_{-∞}^∞ =0$? is this supposed to be Riemann-Lebesgue?
Comment: @CalvinKhor It could be if we can guarantee the inverse Fourier transform exists.
Comment: Thats not in your assumptions. I am asking for context, because I don't know where you would get this expression from, much less ask it to be 0.
Comment: @CalvinKhor it comes from when deriving the Fourier Transform for $f'(x)$ and the relationship that this is given by $ikF(k)$ where $F(k)$ is the Fourier transform of $f(x)$.
Comment: Integration by parts? This only holds for nice enough functions, or if you switch to a distribution.
Comment: By the way it is easy to see that an absolutely integrable function need not converge to 0; take $f = ∑_0^∞ \Bbb 1_{\left(n,n+\frac{1}{n^2}\right)}$.
Comment: @CalvinKhor Thanks. By 'nice enough functions' do you basically mean a function that tends to 0 as $x\rightarrow \pm \infty$ or is there more to it then that?
Comment: Yeah, thats it.
Answer: To justify the partial integration, it suffices to have sequences $(x_n)_n, (y_n)_n $ with $x_n\to\infty  $ and $y_n \to -\infty $ with $f\cdot e^{ikx}\bigg |_{y_n}^{x_n} \to 0$ (why?).
Existence of such sequences can be shown as follows: We have
$$
\infty > \int |f (x)|\,dx = \sum_{n \in \Bbb {Z} } \int_{(n,n+1)} |f(x)|\,dx =\sum_n \int_0^1 |f (x+n)|\,dx =\int_0^1 \sum_n |f (x+n)|\,dx.
$$
The steps above can be justified using monotone convergence.
Now, a function with finite  integral is finite almost everywhere, so that we get
$$
\sum_{n \in\Bbb {Z}} |f (x+n)|<\infty
$$
for almost all $x \in (0,1) $. Since the terms of a convergent series are a null sequence, this easily implies existence of the desired sequences.


Regular polygon made from the midpoints of the sides of a polygon

Question: For what natural numbers n is it true that whenever the midpoints of the sides of a convex n-sided polygon $K_n$ form a regular n-gon, then $K_n$ itself is also a regular n-gon?
I know it is true for $n=3$, and that it isn't true for $n=4$, but I'm stuck with $n>4$.
Comment: The proof you know that it isn't true for $n=4$ should be able to be generalized to all even $n$.
Comment: Yes you're right, I haven't noticed that before...
Comment: As for odd $n$: if you think of the vertices as complex numbers, then the operation that takes the original vertices to the midpoints is the result of applying a certain matrix (with entries $\frac12$ on two adjacent diagonals and $0$s elsewhere) to the vector of original vertices. When $n$ is odd, this matrix is invertible, which means that the vector of midpoints uniquely determines the vector of original vertices.
Comment: Greg Martin I disagree.  The matrix should have additional entries of 1/2 at (1,n) and (n,1), no?  How does this affect invertibility?
Answer: Let us work in the plane identified with the set of complex numbers $\mathbb{C}$.
Let us prove it is false for an even number of points.
Let us call $v_k \in \mathbb{C} (k=1\cdots n)$ the vertices of the polygon and $m_k \in \mathbb{C}$ the midpoint of $[v_k,v_{k+1}] $ with $v_{n+1}=v_1$. The $m_k$ are known, on a regular polygon, and the $v_k$ are unknown.
Let us call $S_k$ the (central) symmetry wrt $m_k$. Its expression is $Z=S_k(z)=2m_k-z$
(explanation: $Z=2m_k-z \Leftrightarrow \dfrac{z+Z}{2}=m_k$)
If, for example, $S_1$ is followed by $S_2$, one has:
$S_2(S_1(z))=2m_2-(2m_1-z)=2(m_2-m_1)+z$
More generally, by composing  $S_1$ followed by $S_2 \cdots S_n$, (a transformation that we will call $S$) when $n$ is even, one has, by an immediate recurrence:
$$S(z)=2(\sum(-1)^k m_k)+z=z \ \ (1) \ \ \text{which boils down to} \ \ S(z)=z$$
(last equality because the sum is zero for a regular polygon).
Thus, whatever the initial $z=v_1$, one will be able to construct a closed polygon. It is clear that if one takes $z_1$ very close from $m_1$, $v_2=S_1(v_1)$ will be as well close to $v_1$ but far away from $v_3$, thus generating a non-regular polygon (see image below).

Remark: there is a funny 3D interpretation of the above figure as a perspective view of a particular section of a cube by a plane passing by certain midpoints.
Comment: I have tried to be a little more explicit. In particular, I have given the expression of a symmetry $S(z)=2m_k-z$ with respect to point $m_k$.


Valor da coluna do banco de dados em um campo oculto do HTML

Question: Eu quero pegar o valor da coluna e armazenar em uma variável.
Esse código abaixo, funciona perfeitamente, porém eu preciso agora preencher o valor do campo oculto com o ID que vem do banco:
"columns": [
   { "data": "cpf" },
   { "data": "nome" , },
   { "data": "sobrenome" , },
   { "data": "celular" },
   { "data": "email" },
   {
   "data": null,
   "defaultContent": "<form method=\"post\" action=\"\"><input type=\"hidden\" id=\"idcontrib\" name=\"idcontrib\" value=\"  => "DATA": "ID" <=    \"><button type=\"submit\" class=\"btn btn-warning btn-xs\" name=\"edit_contrib\">Editar</button>  <button type=\"submit\" class=\"btn btn-danger btn-xs\" name=\"exc_contrib\">Excluir</button></form>"
},

Tenho que fazer com que essa parte do código:
value=\"  => "DATA": "ID" <=    \"

Seja algo como:
value=\"<?=$id?>\"

Para isso eu tenho que fazer com que o valor que vem do banco seja armazenado na variável:
$id = "data" : "id";

É possível algo do tipo ?
HTML

    CPF
    Nome
    Sobrenome
    Celular
    email
    Ação

javascript


Proving intersection of closed sets is closed (with a specific definition)

Question: I need to prove that the intersection of any number of closed sets is a closed set itself. There are some proofs that come up upon doing some research but I want to do it with a very specific definition. Here it is:
A set A is closed if every point that is arbitrarily close to A is a member of A.
(Equivalently , if y --> x with y being an element of A, then x is an element of A)
I've been trying to figure out how to use this definition to prove that the intersection of any number of sets is closed as well.
Comment: https://proofwiki.org/wiki/Intersection_of_Closed_Sets_is_Closed
Comment: Not really what I'm looking for here but thanks. Doesn't seem to apply this specific version of the definition of a closed set in any way.
Comment: A couple of comments.  First, please use $\LaTeX$.  Second, I think you mean that $A$ is closed if $y_n\to x$ (with $\{y_n\}$ a sequence or more generally a net) with $y_n\in A$ for all $n$ implies $x\in A$.  Either that or $A$ is closed if for any $x$ and any neighborhood $U$ of $x$, $U\cap A\neq\varnothing$ implies $x\in A$.
Comment: what is a point that is arbitarily close? Please define! Are we in a metric setting?
Answer: Assuming (As this is not stated) that $x$ is "infinitely close" to a set $A$ means that every open set $O$ that contains $x$ intersects $A$ (or with open balls of radius $>0$ in a metric setting) (which is usually called that $x$ is an adherent point of $A$), the proof could go:
Suppose $A_i, i \in I$ are all closed in this sense. Define $A = \cap_i A_i$.
Let $x$ be "close to" $A$. We want to show that $x \in A$. So suppose for a contradiction that $x \notin A$. Then there is some $i$ such that $x \notin A_i$.
As $A_i$ is closed, this would mean that $x$ cannot be "close to" $A_i$, so there exists some open set (or ball depending on your exact definition) $O$ that contains $x$ and does not intersect $A_i$. But if it does not intersect $A_i$ it certainly does not intersect $A$. But that would make $x$ not close to $A$, a contradiction. So $x \in A$ must be the case. So $A$ is closed.
Answer: If $\{E_\alpha\}$ is a collection of closed set, then $\bigcap_{\alpha} E_\alpha $ is a closed set.
Proof:
$p_\alpha$ is a limit point of $E_\alpha$ implies that $p_\alpha \in E_\alpha$, since $E_\alpha$ is a closed set.
For every $\epsilon > 0$ there is a point $q_\alpha\in E_\alpha$ such that $\operatorname{d}(p_\alpha,q_\alpha) < \epsilon$, by the definition of limit points. Also if $p$ is a limit point of $\bigcap_\alpha E_\alpha$, there is a point $q\in  \bigcap_\alpha E_\alpha$ such that $\operatorname{d}(p,q) < \epsilon$. Hence
$$
\operatorname{d}(p_\alpha,q_\alpha) \leq \operatorname{d}(p,p_\alpha)+\operatorname{d}(p,q)+\operatorname{d}(q,q_\alpha)\leq\epsilon +\operatorname{d}(p,p_\alpha)+\operatorname{d}(q,q_\alpha)
$$
Also $\operatorname{d}(p_\alpha,q_\alpha) < \epsilon$, then $\operatorname{d}(p,p_\alpha) = \operatorname{d}(q,q_\alpha) = 0$. It concludes that $p\in E_\alpha$ for any $\alpha$, which completes the proof.


Let $p(x)=x^2-x+1$. Let $\alpha$ be a root of $p(p(p(p(x))))$. Compute $|(p(\alpha)-1)p(\alpha)p(p(\alpha))p(p(p(\alpha)))|$.

Question: I feel like I'm supposed to use complex numbers for this question, though I'm not exactly sure how to do so.
I suspect that I'm supposed to use the factorization $(x^3+1)=(x+1)(x^2-x+1)$. However, because I'm finding a root of $p(p(p(p(x))))$, I'm not quite sure how to use this without bashing.
The only possibly relevant progress I've made is to notice that $(p(p(p(\alpha))))^2-(p(p(p(\alpha))))+1=0$, yielding $(p(p(p(\alpha))))=e^{\pm \frac{i\pi}{3}}$.
Comment: Hint: Note that $(p(\alpha)-1)p(\alpha) = p^2(\alpha) -p(\alpha) = p(p(\alpha)) -1$. Continue with more iterations.
Answer: It can be thought in following way,
$$h(x)=(p(x)-1)*p(x)*(p(p(x))*p(p(p(x)))$$
$$h(x)=([p(x)]^2-p(x))*p(p(x))*p(p(p(x)))$$
If you notice $[p(x)]^2-p(x)$ add and subtract 1
So, $[p(x)]^2-p(x)+1-1=p(p(x))-1$
SO, $$h(x)=[p(p(x)-1]*p(p(x))*p(p(p(x)))$$
$$h(x)=[[p(p(x)]^2-p(p(x))]*p(p(p(x)))$$
Now similarly do same again, $[p(p(x))]^2-p(p(x))+1-1=p(p(p(x)))-1$
$$h(x)=[p(p(p(x)))-1]*p(p(p(x)))$$
And one more time ,SO
$$h(x)=[p(p(p(p(x))))]-1$$
Now $\alpha$ is root of $p(p(p(p(x))))$ so it will be zero
$$|h(\alpha)|=|-1|=1$$
Comment: @SoumikMukherjee Oh! sorry I blundered. Edited now.
Comment: $\alpha$ is a root of $p(p(p(p(x)))$ not of $p(x)$


Add different paragraphs block on translated nodes

Question: Is it possible to add additional paragraph blocks on an translated node?
If yes; How? I've tried messing around with configuration; but cannot get it to work as expected.
If not; How do we go around this behaviour?
Answer: That is an open issue. At the moment you can only translate the fields inside of paragraphs, not the outside structure of the paragraphs.
See this issue:
[META] Support translatable paragraph entity reference revision field


Instagram API Access Limit

Question: We require to get the followers data (profile metrics specially follower's friends count) for my client's accounts having more than 500k followers. Because of Instagram api limitation we can only do 5k calls /hour. Thats why, it is impossible to load all followers data for every day. But there are few products like web.stagram.com etc, which are also using the instagram api and making unlimited (or some greater num than allowed limit) calls.
Are these partners exempted by instagram?
Please update if there is a way to get higher api limit.
We are ready to pay amount for the higher limit.
Regards,
Parvendra Adhran
Comment: This question appears to be off-topic because it should be directed at the vendor for support.
Comment: You can use multiple access tokens to fetch data from instagram;
Answer: You have to try to get whitelisted to get a new Rate Limit, there's a long waiting list and Instagram has mentioned they won't be getting to the requests anytime soon.
I've heard of people still waiting over 2 months so far.
Comment: How do you apply for the whitelist? Any ideas?
Comment: Google "whitelist instagram api" and I'm sure you can find the answer.
Comment: Already did. This was the 1st result. Doesn't look promising at all. https://groups.google.com/forum/#!msg/instagram-api-developers/4tsLyZzvV9c/CWj_uoi9mxwJ

Instagram API Access Limit


Displaying HTML entities in title through a view

Question: I have a site (D7) where I need to have HTML entities in the title like the copyright, trade mark signs with the subscript tags. Like:
Product name®
The solution at the node level is simple using the page.tpl.php:
<?php print html_entity_decode($title); ?>

But in a view no matter how I try to format the title it will always return it like
Product name®

I try a formatter, but they don't reach the title. Any other ideas?
Comment: Have you managed to figure this out? I'm having the exact same problem, no solution yet.
Comment: Do you enter the title with html-entities or as unicode characters?
Answer: Yes! You need to add the attribute 'html' => true. This is a link property in Drupal 7. If you render any link in Drupal 7 and want to add some extra HTML inside it you need to set array('html'=>true).
Answer: This can be achieved using templates:
In case of a view page, the template used will be page--.tpl.php. Ex: If the path to the page is awards then the page template file is page--awards.tpl.php. The title can be edited as required in the template file.
In case of a block, the title can be edited using the block.tpl.php. Refer to this link for creating the template file for a specific block. Here are the other references for this topic.
https://www.drupal.org/node/270332
https://www.drupal.org/node/792590
Hope this helps.
Answer: I had the same problem, and I solved it, but I think my method is not perfect.
I created another filed, called "title2", text field with "Full HTML". Make Title2 = title, and view it in views, it will be html_entity_decoded.
Sorry for my n00b english.
Comment: I can see your point, but I think that is a little bit overkilling. Thank you and happy new year!


Hide feature from Angular UI with ABP Framework

Question: I've created several features in the ABP Framework but now I want to hide a button in the Angular font-end UI when the option is disables.
I've found this code for C# code:
public class ReportingAppService : ApplicationService, IReportingAppService
{
    private readonly IFeatureChecker _featureChecker;

    public ReportingAppService(IFeatureChecker featureChecker)
    {
        _featureChecker = featureChecker;
    }

    public async Task<PdfReportResultDto> GetPdfReportAsync()
    {
        if (await _featureChecker.IsEnabledAsync("MyApp.PdfReporting"))
        {
            //TODO...
        }
        else
        {
            //TODO...
        }
    }
}

But no equal code for the Angular UI.
Finaly it must be like this:
<button *ngIf="featureChecker.IsEnabled('MyApp.PdfReporting')">Download PDF</button>

Answer: You can use this code:
// Global variable
feature = false;

constructor(
    private oAuthService: OAuthService,
    private authService: AuthService,
    private configStateService: ConfigStateService
) { }

ngOnInit(): void {
    this.feature = this.configStateService.getFeature('MyApp.PdfReporting') === 'true';
}

It returns a string but wen using a ToggleStringValueType for the feature it's always 'true' or 'false'.
Inside the HTML you can use this code:
<button *ngIf="feature">Download PDF</button>


Importing Microsoft .url file to bookmark (Firefox / Mac OS)

Question: I ran across a situation at work the other day where we were trying to move a pile of .url files on a Windows XP machine to bookmarks under Firefox on Mac OS X 10.5.8.  It proved very frustrating, as we didn't have access to the source machine anymore (where we could have exported the bookmarks properly).
Does anyone have a solution for that one?
Comment: any chance you'd pick an answer, to get this off the unanswered list?
Answer: By far the easiest way to convert .URLs to bookmarks is via a Windows PC that has Firefox on it (and seeing as you have .URL files at all I'm guessing you must have some access to a Windows box).
Put all the .URL files into the Favourites folder on the Windows box, open Firefox, goto File menu -> Import... and import the favourites into Firefox. You can then open Firefox's bookmarks manager from Bookmarks menu -> Organise Bookmarks and from there anything you export from the Import and Backup menu should be fully readable and importable by Mac Firefox.
Answer: This script works a bit better, a few more quotes needed basically
for i in *.url; do
  title=${i%%.URL}
  link=`grep -e "^URL=" "$i" | awk -F= '{print $2}'`
  echo ''"$title" >> bm3.html
done

Answer: As I recall, Firefox on MacOS won't open .url files, right?
And Web Location Converter is an application that should convert .url files to .webloc files, which I think Firefox will open.  It says that it isn't 100% under Snow Leopard, but the only thing broken is the other direction, so you should be okay.
Here's an AppleScript droplet that would work to simply open the files if Firefox hadn't broken its AppleScript support at some point.
Either way, one you get them opened in Firefox, it should be trivial to then bookmark the lot of them.
Alternately, .url files are pretty simplistic.  You could throw some text processing at them to convert them into a simple html file pretty readily:
for i in *.URL; do
  title=${i%%.URL}
  link=`grep -e '^URL=' $i | awk -F= '{print $2}'`
  echo ''"$title" >> bm.html
done

You ought to be able to import that.  But I haven't tested the script or the import.
Answer: Its an old problem, here is the bugzilla bug. As I understand it, this is actually a file w/ URL "stuff" in it, and Firefox was leveraging some Windows-level facility that is not available on Mac OS X.


Fetching client time using JavaScript and comparing them with values stored in the database

Question: I am developing a module, where:

The administrator enters time in (0-23) format.These values gets saved in database.
In the front end (for the website users) I need to fetch the current client time (not the server time), maybe using JavaScript, and then comparing it with the stored time (in PHP variables with current time fetched using JavaScript).

I want to do something like the following.
// $time_one: from the database.
// $time_two: from the database.
// $currentTime:  client current time.

if (currentTime > $time_one && currentTime < $time_two) {
  // Display some message.
}

How can this be done? Can PHP and JavaScript be mixed in the module file?
Answer: Send server time to the client side via js variables: drupal_add_js, see example.
Answer: You can pass values from PHP to JavaScript using code similar to the following one.
drupal_add_js(
  array('myModule' => array('time_one' => $time_one, 'time_two' => $time_two)),
  'setting'
);

$time_one and $time_two are the PHP variables that contain the values you fetch from the database.
JavaScript would access those values using the following code.
time_one = Drupal.settings.myModule.time_one;
time_two = Drupal.settings.myModule.time_two;

Comment: Thanks!!, this works for me.. BTW is there a way to send javascript variable to php. I mean if i can just send the current time stored in a javascript variable to php? I tried this with cookies but i think its not the best way to do it.
Comment: You can do that with jQuery, its [$.ajax()](http://api.jquery.com/jQuery.ajax/), and a custom menu callback as URL of the request. See the `data` parameter `$.ajax()` accepts.


Convergence of an operator in norm

Question: Let $H$ be a Hilbert space and assume we have three converging sequences:
$u_n\rightarrow u$ in $H$, $v_n\rightarrow v$ in $H$ and $\lambda_n\rightarrow \lambda$ in $\mathbb{C}$. I would like to prove that the (bounded) operator $\lambda_n(u_n,.)v_n$ converges in operator norm to $\lambda(u,.)v$.
I thought of first trying to show $||\lambda_n(u_n,x)v_n-\lambda(u,x)v||\rightarrow 0$ for every $x$, using tricks like $u_n=u_n-u+u$, and then deduce the operator norm convergence, but neither result is obvious to me.
Please help :-)
Answer: I will use the notation $x\bigcirc y$ for operator $(y,\cdot)x$
Let $w_n=\lambda_n u_n$, then $w_n\to w:=\lambda u$. Now it is remains to show that $ v_n\bigcirc w_n \to v\bigcirc w$. It is easy to do using trick you mentioned before becasue
$$
\Vert x\bigcirc y\Vert\leq\Vert x\Vert\Vert y\Vert
$$
(in fact we have an equality here)

Convergence of an operator in norm


Formula for square root inside a square root

Question: I am trying to remember a formula from high school about nested square roots. It goes something like this:
$\sqrt{\frac{a+\sqrt{b}}{c}} = \sqrt{\frac{?}{?}} \pm \sqrt{\frac{?}{?}} $
This formula is supposed to eliminate nested squares, so there are only a,b,c inside squares on right side. I also remember calling it Lagrange formula (not sure).
Comment: This might be of interest. Similar: https://www.quora.com/Is-there-a-generalized-way-of-expanding-sqrt-a+sqrt-b-into-a-sqrt-c-such-that-c-is-an-expression-containing-no-square-roots
Answer: Thanks to -Math4Life, formula i was looking is:
$\sqrt{a \pm \sqrt{b}} = \sqrt{\frac{a + \sqrt{a^2 -b}}{2}} \pm \sqrt{\frac{a-\sqrt{a^2-b}}{2}} $
Although it doesn't remove the nested square, it is often useful as $a^2-b$ can be a perfect square.


question about simple MINA client and server

Question: I am just trying to create a simple MINA server and client to evaluate. Here is my code.
public class Server {

private static final int PORT = 8080;

static class ServerHandler extends IoHandlerAdapter {
    @Override
    public void exceptionCaught(IoSession session, Throwable cause) throws Exception {
        cause.printStackTrace();
    }

    @Override
    public void sessionCreated(IoSession session) {
        System.out.println("session is created");
        session.write("Thank you");
    }

    @Override
    public void sessionClosed(IoSession session) throws Exception {
        System.out.println("session is closed.");
    }

    @Override
    public void messageReceived(IoSession session, Object message) {
        System.out.println("message=" + message);
        session.write("Reply="+message);
    }
}

/**
 * @param args
 */
public static void main(String[] args) throws Exception {
    SocketAcceptor acceptor = new NioSocketAcceptor();
    acceptor.getFilterChain().addLast( "logger", new LoggingFilter() );
    acceptor.getFilterChain().addLast( "codec", new ProtocolCodecFilter( new TextLineCodecFactory( Charset.forName( "UTF-8" ))));
    acceptor.setHandler(new Server.ServerHandler());
    acceptor.getSessionConfig().setReadBufferSize( 2048 );
    acceptor.getSessionConfig().setIdleTime( IdleStatus.BOTH_IDLE, 10 );
    acceptor.bind(new InetSocketAddress(PORT));
    System.out.println("Listening on port " + PORT);
    for (;;) {
        Thread.sleep(3000);
    }
}

}
public class Client {
private static final int PORT = 8080;

private IoSession session;
private ClientHandler handler;
public Client() {
    super();
}

public void initialize() throws Exception {
    handler = new ClientHandler();
    NioSocketConnector connector = new NioSocketConnector();
    connector.getFilterChain().addLast( "codec", new ProtocolCodecFilter( new TextLineCodecFactory( Charset.forName( "UTF-8" ))));
    connector.getFilterChain().addLast("logger", new LoggingFilter());
    connector.setHandler(handler);
    for (;;) {
        try {
            ConnectFuture future = connector.connect(new InetSocketAddress(PORT));
            future.awaitUninterruptibly();
            session = future.getSession();
            break;
        } catch (RuntimeIoException e) {
            System.err.println("Failed to connect.");
            e.printStackTrace();
            Thread.sleep(5000);
        }
    }
    if (session == null) {
        throw new Exception("Unable to get session");
    }
    Sender sender = new Sender();
    sender.start();

    session.getCloseFuture().awaitUninterruptibly();
    connector.dispose();
    System.out.println("client is done.");
}

/**
 * @param args
 */
public static void main(String[] args) throws Exception {
    Client client = new Client();
    client.initialize();
}

class Sender extends Thread {
    @Override
    public void run() {
        try {
            Thread.sleep(3000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        handler.messageSent(session, "message");
    }
}

class ClientHandler extends IoHandlerAdapter {

    @Override
    public void sessionOpened(IoSession session) {

    }

    @Override
    public void messageSent(IoSession session, Object message) {
        System.out.println("message sending=" + message);
        session.write(message);
    }

    @Override
    public void messageReceived(IoSession session, Object message) {
        System.out.println("message receiving "+ message);
    }

    @Override
    public void exceptionCaught(IoSession session, Throwable cause) {
        cause.printStackTrace();
    }
}

}
When I execute this code, the Client seems to keep sending a message instead of stopping after it sends. It looks to me that there is a recursive call in underlying MINA code. I know that I am doing something wrong.
Can somebody tell me how to fix this?
Thanks.
Answer: Try to initialize and start your sender and use the session within sessionOpened (ClientHandler)


Maximum entropy and non-informative distribution

Question: Is Maximum Entropy rule equivalent to non-informativeness?
In other words, when maximizing the entropy of a distribution, given some known stuff, is it equivalent to finding to most non-informative distributions?
If so, how do you justify this mathematically?
Comment: This will sound pedantic, but maximum entropy distributions are non-informative whenever you interpret entropy as "a lack of information".  In many situations this interpretation makes sense, but interpretations lie outside the scope of what can be justified with mathematics.
Comment: +1. For example, many people talk informally about (say) extracting the information from the data, and this often is a matter of what is scientifically or practically interesting or important and scientists and practitioners often have a good sense of that. But it is crucial here that "information" is not defined, and there are many contexts in which defining it precisely would rid us of a useful word. We could always find another word, but "informative" will _not_ always mean "in an information theory sense" in statistical discussions.
Comment: It is as non-informative as it can mathematically be, given constraints on ignorance imposed by information.  I've found John Harte's explanation in "Maximum Entropy and Ecology" to be quite accessible.
Comment: Yeah, all of this make sense, but I am looking for something more formal. May be asking for too much ....
Answer: My understanding is that these are two ways of stating the same thing. So it's a tautology or a question of alternative terminology.
E.T. Jaynes's book is widely considered canonical. http://ksvanhorn.com/bayes/jaynes/ is a kind of back door start to the book and commentary.
Answer: The Maximum Entropy Rule is a conditioning rule for least bias in the case where the sought after distribution is under-determined.  As such it gives the largest possible probability weighting to competing hypotheses given the stated constraints.