Contour integration around pole and essential singularity

Question: I've got the following integral:
$$
\frac{1}{2\pi i}\oint_\limits{|z|\,=\,R} \frac{z^5}{z-1} e^\frac{2}{z} dz,
$$
where $R$ - sufficiently large number.
I've tried to evaluate it with residues. The integrand has a simple pole at $z = 1$ and an essential singularity at $z=0$.
Evaluation of the residue about the pole is trivial: it equals to $e^2$. I tried to deal with the singularity:
$$
\frac{z^5}{z-1} e^\frac{2}{z} = z^4 \frac{1}{1-\frac{1}{z}} e^\frac{2}{z} = \left[z^4 + z^3 + z^2 + z + 1 + \frac{1}{z} + ... \right]\left[1 + \frac{2}{z} + \frac{2}{z^2} + \frac{4}{3z^3} + \frac{2}{3z^4} + \frac{4}{15z^5} + ... \right].
$$
After term-by-term multiplication and collecting terms with $\frac{1}{z}$ I got the residue $\frac{109}{15}$. Therefore, the integral equals to $e^2 + \frac{109}{15}$.
But I am told it's wrong, and I can't find a problem for a long time. Can someone tell, is that solution wrong? Very grateful in advance for your help and time. Thanks!
Comment: $z^4 + z^3 + \ldots$ is the Laurent expansion of $z^5/(z - 1)$ around infinity (on $|z| > 1$). You've found the coefficient at $z^{-1}$ in the Laurent expansion of $f(z) = z^5 e^{2/z}/(z - 1)$ around infinity, which is equal to minus the residue of $f(z)$ at infinity and is also equal to $\int_{|z| = R} f(z) \, dz/(2 \pi i)$.
Comment: @Maxim, is that so... I had thoughts of expanding the function around infinity, but confused myself with around what am I expanding. Thank you for your clarification!
Answer: There are two errors. A minor one is that you forgot to divide the residue by $2\pi i$. And a major one is that, near $0$, you have$$\frac{z^5}{z-1}=-z^5 - z^6 - z^7 -\cdots$$instead of$$\frac{z^5}{z-1}=z^4+z^3+z^2+\cdots$$
Comment: I was afraid to use $\frac{1}{1-z}$ because of infinite sum for the coefficient before $\frac{1}{z}$ and at the same time thought that it's legal to use $\frac{1}{1-\frac{1}{z}}$ about zero. Or is it, after all? Still confused, as a matter of fact.

Thank you very much for your help, I've managed to find the answer.
Answer: $\newcommand{\bbx}[1]{\,\bbox[15px,border:1px groove navy]{\displaystyle{#1}}\,}
 \newcommand{\braces}[1]{\left\lbrace\,{#1}\,\right\rbrace}
 \newcommand{\bracks}[1]{\left\lbrack\,{#1}\,\right\rbrack}
 \newcommand{\dd}{\mathrm{d}}
 \newcommand{\ds}[1]{\displaystyle{#1}}
 \newcommand{\expo}[1]{\,\mathrm{e}^{#1}\,}
 \newcommand{\ic}{\mathrm{i}}
 \newcommand{\mc}[1]{\mathcal{#1}}
 \newcommand{\mrm}[1]{\mathrm{#1}}
 \newcommand{\on}[1]{\operatorname{#1}}
 \newcommand{\pars}[1]{\left(\,{#1}\,\right)}
 \newcommand{\partiald}[3][]{\frac{\partial^{#1} #2}{\partial #3^{#1}}}
 \newcommand{\root}[2][]{\,\sqrt[#1]{\,{#2}\,}\,}
 \newcommand{\totald}[3][]{\frac{\mathrm{d}^{#1} #2}{\mathrm{d} #3^{#1}}}
 \newcommand{\verts}[1]{\left\vert\,{#1}\,\right\vert}$
$\ds{R\ \mbox{is a}\ \underline{\it sufficiently\ large\ number}}$:
\begin{align}
&\bbox[5px,#ffd]{{1 \over 2\pi\ic}
\oint_{\verts{z}\ =\ R}\,\,\,
{z^{5} \over z - 1}\expo{2/z}\,\dd z}
\\[5mm] \stackrel{z\ \mapsto\ 1/z}{=}\,\,\,&
{1 \over 2\pi\ic}\bracks{%
-\oint_{\verts{z}\ =\ 1/R}\,\,\,
{1/z^{5} \over 1/z - 1}\expo{2z}
\,\pars{-\,{\dd z \over z^{2}}}}
\\[5mm] = &
{1 \over 2\pi\ic}
\oint_{\verts{z}\ =\ 1/R}\,\,\,
{\expo{2z} \over z^{6}\pars{1 - z}}\,\dd z
\\[5mm] = &
{1 \over 2\pi\ic}\bracks{2\pi\ic\,{1 \over \pars{6 - 1}!}
\,\lim_{z \to 0}\,\,\totald[5]{}{z}
\bracks{z^{6}\,{\expo{2z} \over z^{6}\pars{1 - z}}}}
\\[5mm] = &
{1 \over 120}
\,\ \underbrace{\lim_{z \to 0}\,\,\totald[5]{}{z}
\pars{{\expo{2z} \over 1 - z}}}_{\ds{872}}\ =\
\bbx{109 \over 15} \approx 7.2667
\end{align}
Comment: Dear God, how easy that was... I was confident I'll have to use residuals, and nothing more will fit. Thanks a lot!


Include Bootstrap to Typo3

Question: I worked with Typo3 4.5 and already have included the YAML CSS Framework with TemplaVoila.
But now I have installed Typo3 6.1 and want to include the Bootstrap Framework.
But I don´t know if it is better to use TemplaVoila or to use the normal Template.
And I am not quite sure how to include the Bootstrap framework.
My first idea is to copy the framework files to fileadmin folder.
Then include the css and js files that are in the docs/index.html (example file) to my TS Template and than I can create the HTML content.
Or am I missing something?
Comment: Take a look at modern package: https://github.com/georgringer/modernpackage and the bootstrap demo: http://bootstrap.typo3cms.demo.typo3.org/
Answer: Frontend template extensions that take over a large part of the template rendering can sometimes be confusing. If you understand the rendered page template as the end product that's generated by the CMS, but not a part of the CMS's functionality, everything will become easier and more transparent (less black boxes).
My advice would be: don't use a framework extension, get bootstrap from github, ideally in the LESS version - use one of the many lessphp extensions to parse less while developing - and create your template in whichever templating system you're comfortable with.
Answer: It doesn't matter if you are using TV or 'standard' templating system, just include the Bootstrap in your headers and that's all.
Answer: Find an example at the official TYPO3 homepage: http://bootstrap.typo3cms.demo.typo3.org/

Include Bootstrap to Typo3


ActionBlock never completes on Faulted State

Question: I am trying to make a simple program to better understand TPL Dataflow. I am trying to create a long running task that will restart a dataflow block if it has completed.
My current RestartActionBlock Task is able to await completion of the ActionBlock if I explicitly call complete on the block by entering "-1". But when I try to raise an exception to fault the block or call the blocks Fault() interface method, the ActionBlock's Completion Task never completes. In this situation the await singleTestFlow.Completion; call never continues.
After raising the Exception or calling the Fault() method, I can be sure the block is in the faulted state by trying to enter another input into the program and debugging the code to see that the block is in the faulted state:

If the block is in the faulted state, why did the await singleTestFlow.Completion; never return?
class Program
{
    private static ActionBlock<string> singleTestFlow;

    static void Main(string[] args)
    {
        //start thread that should restart a completed action block
        Task.Run(RestartActionBlock);

        Console.WriteLine("Enter -0 to exit, -1 to complete flow, -0- to throw an exception, Anything else otherwise");
        var input = Console.ReadLine();

        //allow user to input text until "-0" is entered
        while (!input.Equals("-0"))
        {
            if (input.Equals("-1"))
            {
                singleTestFlow.Complete();
            }

            singleTestFlow.Post(input);

            input = Console.ReadLine();
        }

        async Task RestartActionBlock()
        {
            var iterations = 0;
            while (true)
            {
                singleTestFlow = new ActionBlock<string>(s =>
                {
                    if (s.Equals("-0-"))
                    {
                        //throw new Exception("Something went wrong in here");
                        ((IDataflowBlock)singleTestFlow).Fault(new Exception("Something went wrong in here"));
                    }
                    Console.WriteLine($"{iterations}: " + s);

                }, new ExecutionDataflowBlockOptions { MaxDegreeOfParallelism = Environment.ProcessorCount });

                await singleTestFlow.Completion;

                var completionTask = singleTestFlow.Completion;

                var message = $"action block: {iterations} ";
                switch (completionTask.Status)
                {
                    case TaskStatus.RanToCompletion:
                        message += "ran to completion";
                        break;
                    case TaskStatus.Canceled:
                        message += "was canceled";
                        break;
                    case TaskStatus.Faulted:
                        message += "has faulted";
                        Console.WriteLine(completionTask.Exception);
                        break;
                }
                Console.WriteLine(message);
                iterations++;
            }
        }
    }

}

The point in the console where i entered "eee" is where the faulted block debug screenshot was taken.
Answer: Here's the simple fix:
Replace
await singleTestFlow.Completion; // Throws if Completion is faulted, breaking your loop.

with
await Task.WhenAny(singleTestFlow.Completion);

or
await singleTestFlow.Completion.ContinueWith(_ => { });

What the above does is avoid propagating the Completion task exception. This allows your RestartActionBlock loop to execute forever as you intended (as opposed to dying right after your block faults).
Ideally, however, you should not be disregarding the return values of the following two statements:
Task.Run(RestartActionBlock); // Unobserved Task. Usually a bad idea.

and
singleTestFlow.Post(input);

If you were observing the return values of the above, you'd actually notice that they start screaming for help as soon as your ActionBlock<string> faults.
The task returned by Task.Run(RestartActionBlock) transitions to Faulted state as soon as await singleTestFlow.Completion throws - but you never get notified, because you don't keep a reference to said task, or check its status.
Similarly, right after your ActionBlock<string> faults, subsequent calls to singleTestFlow.Post(input) actually return false, meaning that no more items get posted to the block. They are simply discarded.
Comment: Wow thanks for the help! It is working now. From your answer, I have two new questions. What is the difference between awaiting `singleTestFlow.Completion` and `Task.WhenAny(singleTestFlow.Completion)`? The latter makes my code work, but I do not understand the difference. Secondly, how could I use the task returned from `Task.Run(RestartActionBlock)`? I do not want to await its completion, because I need the rest of the code in main to continue.
Comment: If you want your `RestartActionBlock` task running forever, you need to make sure that it has comprehensive exception handling built in. If `await singleTestFlow.Completion` throws an exception (due to the block fault), `RestartActionBlock` returns immediately (much like a synchronous method would). It never progresses beyond the `await`. `Task.WhenAny` allows you to get around that because it merely returns a reference to the first completed (or faulted) task. It does not re-throw exceptions. Its effect is similar to putting `try/catch` around `await singleTestFlow.Completion`.
Comment: Had you kept a reference to the `Task` returned by `Task.Run(RestartActionBlock)`, you would notice that at some point it transitions to Faulted state, and deduce that your `RestartActionBlock` loop must have stopped. This would help you in debugging. Matter of fact, that is exactly how I personally went about diagnosing the issue, with some success.


finding children in php simplexml xpath

Question: I am running an xpath query on an xml stream and retreiving a set of data. In that i need to find the tag name. But im not able to find the way to retrieve the tag name. The xml stream is
<Condition>
          <Normal dataItemId="Xovertemp-06" timestamp="2011-09-02T03:35:34.535703Z" name="Xovertemp" sequence="24544" type="TEMPERATURE"/>
          <Normal dataItemId="Xservo-06" timestamp="2011-09-02T03:35:34.535765Z" name="Xservo" sequence="24545" type="LOAD"/>
          <Normal dataItemId="Xtravel-06" timestamp="2011-09-02T03:35:34.535639Z" name="Xtravel" sequence="24543" type="POSITION"/>
</Condition>

I am trying to parse this as
Temperature = Normal
Load - Normal

So what i did is
foreach ($xml->xpath("//n:Condition")->children("n") as $child) {
    echo $child["type"] . "="  . $child->getName();
}

I am getting the followin error
Fatal error: Call to a member function children() on a non-object in C:\xampp\htdocs\DataDumper\datadumper\test.php on line 53

Now i know this has got something to do with the way i query the xpath or something and i tried various combination such as adding an * slash to the query but the same error every time.
Answer: Not sure why you used namespace notaion in the first place(the sample xml is not namespaced)
In your xpath, you need to select all condition/normal tags, not the condition tag as you were doing...
Also, xpath() returns a list, so foreach over it. You don't need to access it as children, unless you want to parse the children of $child. There it would make sense, and it would work as expected.
foreach ($xml->xpath("/Condition/Normal") as $child) {
    echo $child["type"] . "="  . $child->getName()."
";
}

outputs
TEMPERATURE=Normal
LOAD=Normal
POSITION=Normal

Comment: The actual xml has namespace thats why i added it here. Also i cant do /condition/Normal as normal is not static it could change, but i changed it to /condition/* and it works! thanks
Comment: I was under the impression the OP did not know the tag names of the child elements in which case, this would only work for `` children
Answer: The problem is due to SimpleXMLElement::xpath() returning an array and not a SimpleXMLElement. I'm also not sure about the namespace support in the XPath query however I'm sure you can fiddle with that to work it out. In any case, I see no n namespace in your XML.
The answer really depends on how many elements you expect to match your XPath query. If only one, try
$conditions = $xml->xpath('//Condition');
if (count($conditions) == 0) {
    throw new Exception('No conditions found');
}
$condition = $conditions[0];
foreach ($condition->children() as $child) {
    printf('%s = %s', (string) $child['type'], $child->getName());
}

finding children in php simplexml xpath


How to control style of today's cell in asp.net ajax CalendarExtender?

Question: Based on the AjaxControlToolkit API for the CalendarExtender I can control the style of the selected date using:
<code>.ajax__calendar_active { background-color:red }
</code>
And according to the API, I was hoping, that .ajax__calendar_today would allow me to control the style of today's table cell, if show.  Unfortunately, this .ajax__calendar_today controls the style of the bigger "Today: XYZ" button at the bottom of the calendar.
Does anyone know how to style today's table cell, if/when displayed?
Update:
I inspected the HTML using Firebug and see that there is no special css class or other indicator for today's day cell.  I guess that makes sense from a server side perspective... how to know what day it is on the user's machine, without adding code to capture GMT offset and such.
So know I think that i am stuck creating some javascript to get today's date client side and comparing to each cell's title attribute, which is set to something like "Friday, February 11, 2011".
Update:Sept 2011
The latest AjaxControlToolkit release has added the .ajax__calendar_today css class to control this.
Answer: I believe you could use the following CSS class:
.ajax__calendar_today .ajax__calendar_day { background-color:red;}
Comment: Yes it appears that the Sept 2011 release of the AjaxControlToolkit has added the ajax__calendar_today css class to today's date.  Very cool!
Answer: Couldn't find a special class for this, so I wound up putting a style in my site.master.
FYI, the padding 0 is because the border takes 2px, which is what default padding is set for.
<code><style type="text/css">
    div.ajax__calendar_day[title='<%=DateTime.Now.ToString("dddd, MMMM dd, yyyy")%>']
    {
    border: 1px solid #F00;
    padding-right: 0px;
    }
</style>
</code>
Answer: The best solution I found is this post.
I just removed the first 2 lines of the function (set current day) and fixed typo error in dayDIVs[i].style.bordercolor to dayDIVs[i].style.borderColor (uppercase C for color). You can also add dayDIVs[i].style.borderStyle = "dotted";
So here is the transcript of it (with my modifications):
<code>/* In HEAD section */

<script type="text/javascript">
    function clientShown(sender, args) {
        var today = new Date();
        var currentTitle = today.localeFormat("D");
        //Find all the Day DIVs in the Calendar's daysBody
        var dayDIVs = sender._daysBody.getElementsByTagName("DIV");
        for (i = 0; i < dayDIVs.length; i++) {
            if (dayDIVs[i].title == currentTitle) {
                //Change the current day's style
                dayDIVs[i].style.borderColor = "#0066cc";
                dayDIVs[i].style.borderStyle = "dotted";
            }
        }
    }
</script>

/* and then in your BODY: */

<cc1:CalendarExtender ID="CE" runat="server" Enabled="True" TargetControlID="CalendarDateTextBox"
                        OnClientShown="clientShown" />
</code>
Answer: You need the following css class:
.ajax_calendar .ajax_calendar_active .ajax__calendar_day {background-color:red;}
Comment: That seems to before the selected day cell, not today's date.


Editting Certain note in Sibelius

Question: I have an issue in Sibelius, where I want to edit a certain note in the whole score (the same note in many octaves), for example the D note, which is highlighted in red to a B note (4 semitones down).

I am using Sibelius 7.5.
Comment: Which version of Sibelius are you using?
Comment: http://tinypic.com/view.php?pic=1sfbl5&s=8#.VcN5PbVUK70

I am using Sibelius 7.5.
Comment: You link to a picture that looks like an original score, rather than a Sibelius file. Have you already scanned this into Sibelius using Photoscore?
Answer: When using Sibelius7 (or 7.5) you can use the Filters function to select a group of similar objects (notes, rests, text etc.). This then allows you to perform the same action on all of these selected objects. The Filters functions are found on the Home tab (towards the right-hand side of the image below):

I'll demonstrate how to use this feature with a short excerpt from the music you link to. Here it is with the Ds unchanged:

If you click on the Advanced button next to the Filters button, you will open a pane giving you a large number of options for which characteristics you want filtered objects to have:

To select all the Ds in your score:

select Notes and Chords from the left-hand list.

select Single next to Pitch.

select D under Sounding as the pitch you want to select (leave the option next to it set to Any, to select this pitch in any octave).

If you now click on the Select button, in the bottom right-hand corner of the pane, all the Ds in your score will be selected (assuming you left the option Find in: Whole score selected in the top left-hand corner of the pane):

Now you can simply press the down-arrow key twice to move all of these Ds down to Bs:

I did this in Sibelius7, but I doubt it is significantly different in Sibelius7.5.

Editting Certain note in Sibelius


C++ boost-asio-network in async callback, which one is better ? using lambda or boost::bind()

Question: C++ lambda made me confusing.
bind functions for async read.
template<typename T>
class connection
    : public boost::enable_shared_from_this<connection<T>>
    , boost::noncopyable
{
public:
    using err = boost::system::error_code;

protected:
    boost::asio::ip::tcp::socket socket_;
...

// completion function
// read until meet '\n'
size_t on_read_completion(const err& error, size_t bytes)
{
    if (error) { return 0; }

    bool found = std::find(read_buffer_, read_buffer_ + bytes, '\n') < read_buffer_ + bytes;
    return found ? 0 : 1;
}

// read message
void on_read(const err& error, size_t bytes)
{
    if (!started_) { return; }

    if (error)
    {
        std::cout << "[ERROR] async_read " << error.message();
        stop();
    }

    std::string msg(read_buffer_, bytes);
    // handle received message
    on_message(msg);
}

This is async read() function.
void read()
{
    if (!socket_.is_open())
    {
        std::cout << "[ERROR] socket_ is not open\n";
        return;
    }

    std::fill_n(read_buffer_, MAX_MSG, '\0');

    // it works
#if 0
    async_read(socket_, boost::asio::buffer(read_buffer_),
        boost::bind(&connection::on_read_completion, this->shared_from_this(), _1, _2),
        boost::bind(&connection::on_read, this->shared_from_this(), _1, _2));
#else // not works
    async_read(socket_, boost::asio::buffer(read_buffer_),
        [this](const err& error, size_t bytes)->size_t
        {
            if (error) { return 0; }
            bool found = std::find(read_buffer_, read_buffer_ + bytes, '\n') < read_buffer_ + bytes;                return found ? 0 : 1;
        },
        [this](const err& error, size_t bytes)->void
        {
            if (!started_) { return; }
            if (error)
            {
                std::cout << "[ERROR] async_read\n" << error.message();
                return;
            }

            std::string msg(read_buffer_, bytes);
            on_message(msg);
        });
#endif
    }

The problem is lambda [capture] that is not containing shared_ptr itself. So when it call on_read_completion(), lambda capture this is not pointing shared_from_this() that I want.
I need a wise advice for this. Help me please.
Answer: Oh, I found the what is the problem.
...
async_read(socket_, boost::asio::buffer(read_buffer_),
  [this](const err& error, size_t bytes)->size_t
  {
    if (error) { return 0; }
    bool found = std::find(read_buffer_, read_buffer_ + bytes, '\n') < read_buffer_ + bytes;
    return found ? 0 : 1;
  },
  [this, self = std::move(this->shared_from_this())](const err& error, size_t bytes)->void
  {
    if (!started_) { return; }
    if (error)
    {
      std::cout << "[ERROR] async_read\n" << error.message() << "\n";
      return;
    }
    std::string msg(read_buffer_, bytes);
    self->on_message(msg);
});

...

it worked!
But if you have tips for this please comment! Thank you.
Comment: Explicitly moving from the `shared_from_this()` is not useful.
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).
Answer: You already figured out that this needs to be explicitly captured in addition to the shared pointer, the latter just for the lifetime guarantee.
However your original question is slightly more interesting than you knew! There's a subtle difference between lambda and bind expressions. If you use bind to bind to a generic handler, it may preserve asio_handler_invoke (or more modern get_associated_executor) semantics under the ADL rule.
This is rarely a concern at the end-user level, but if you mean to provide a generic library of composable operations you may care about this kind of detail for failing to preserve the invocation semantics could lead to bugs (e.g. when a composed handler is bound to a strand executor).

As a sidenote, in the case you showed, consider using the overload of async_read_until that take a string(view) or regex.


Calling a class defined from another module

Question: I am calling the method defined in a class implemented from another module using the following code.
use Drupal\module_name\MyClassName;

$instance = Drupal\module_name\MyClassName::getinstance($host, $user, $pass);

My code doesn't work, as I get an error about a class not found. What am I doing wrong?
The class is contained in module/src/controiller/controller_name.php.
Answer: In your comment, you say the class is inside module/src/controiller/controller_name.php, but you refer to the class as Drupal\module_name\MyClassName. That is wrong.
Assuming module_name is the directory containing your module (and the short name of the module itself), and that module_name/src/Controller/controller_name.php is the file containing the class definition, you need to use the following code.
use \Drupal\module_name\Controller\MyClassName;

$instance = MyClassName::getinstance($host, $user, $pass);

That is evident in any file referring a class, for example user.routing.yml.
user.logout:
  path: '/user/logout'
  defaults:
    _controller: '\Drupal\user\Controller\UserController::logout'
  requirements:
    _user_is_logged_in: 'TRUE'

As you notice, the class is referenced as \Drupal\user\Controller\UserController, not \Drupal\user\UserController.
Also, the filename is generally the name of the class plus the php extension, so in your case the file name should be module_name/src/Controller/MyClassName.php, not module_name/src/Controller/controller_name.php.
As side note, if you are calling a static method for a controller class, you probably need to do something more than just invoking it. Normally, controllers get also the dependency injection container; without that, they would not work. See for example UserController::create().
public static function create(ContainerInterface $container) {
  return new static(
  $container->get('date.formatter'),
  $container->get('entity.manager')->getStorage('user'),
  $container->get('user.data')
  );
}

If you call controller a class that is not a controller class as Drupal defines that, then your code could work; differently, if you are calling a Drupal controller class, resolved the error about a class not found, you will get more errors to fix.
Comment: You are using ControllerName, not Controller. If the class is contained in the module_name/src/Controller directory, the error message is correct. Also, you don't use \\ as separator, but \; so, it is `class Drupal\module_name\Controller\ClassName`.
Comment: Yes  i modified like that , now error log says  **Class 'Drupal\\module_name\\ControllerName\\ClassName'**  not found and am using it like on top of the file as **use \Drupal\module_name\ControllerName\ClassName;** and calling it like  **$instance = ClassName::getinstance($host, $user, $pass);**
Comment: Thanks ! it resolved my problem :) , and thats about error log ,no need to worry
Answer: Make sure your class is under my_module\src, in a file called MyClassname.php, then refer to it via its fully qualified namespace:
$instance = Drupal\my_module\MyClassname::getinstance($host, $user, $password);

Or alias it:
// Top of file
use Drupal\my_module\MyClassname;

// Later on
$instance = MyClassname::getinstance($host, $user, $password);

Comment: This isn't Drupal-specific stuff, it's just PHP - you need to learn about Namespaces, autoloading, and how those two things fit together. As far as Drupal knowledge goes, just know that everything in "mymodule\src\*" is addressable as `Drupal\mymodule\*`. So your controller in this case is at `Drupal\mymodule\controller\MyClassName`. Once you understand namespacing, everything else will make perfect sense.
Comment: Assuming you've followed all the other advice in this answer/comments, that will work fine. Though you don't need to fully qualify the class every time if it's `use`d
Comment: many thanks . i was not included the module though :( .
Comment: still class not found error coming , i created the module/src/controiller/controller_name.php structure and called the constructor . am using  **class MyClassName extends ControllerBase** instead of a **class MyClassName** structure
Comment: Yes i have used the name space as **use Drupal\module_name\MyClassName;** and called it via **Drupal\module_name\MyClassName::getinstance($host, $user, $pass);**
Comment: as another answer mentions, https://drupal.stackexchange.com/a/200599/1082 your class needs to implement the static method `getInstance` as well, unless your class `extends` a class which does implement this to provide an instance of your class. If you want to implement your own creation function, that other example also mentions `new static`, which will create an object of your class, rather than its parent, as https://stackoverflow.com/questions/46849805/should-i-use-new-self-or-new-static explains.


IF VAR is in mySQL database then return that rows data as variable PHP

Question: I've tried like twenty times and the closest I got was when I put in a variable stored in row 1 of the db and it returned the content the last row in the db. Any clarity would be extremely helpful. Thanks.
// Create connection
$coco = mysqli_connect($server, $user, $pass, $db);
// Check connection
if (!$coco) { die("Connection failed: " . mysqli_connect_error()); }
// Start SQL Query
$grabit = "SELECT title, number FROM the_one WHERE title = 'on' AND (number = 'two' OR number='0')";
$result = mysqli_query($coco, $grabit);
// What I need it to do
if (mysqli_num_rows($result) > 0) {
    while($row = mysqli_fetch_assoc($result)) {
        $titleit = $row["title"];
        $placeit = $row["number"];
        $incoming = 'Help';
        if ($titleit[$_REQUEST[$incoming]]){
            $message = strip_tags(substr($placeit,0,140));
        }
        echo $message;
    }
} else {
    echo "not found";
}
mysqli_close($coco);

Comment: What is `if ($titleit[$_REQUEST[$incoming]])` trying to do? `$titleit` is a string, why are you accessing it as an array?
Comment: so because $titleit is not an array, how can check to see if $incoming is in $row["title"];
Comment: `if ($titleit == $_REQUEST[$incoming])`
Comment: But `$titleit` will always be `on`, because that's all you select in the SQL.
Comment: The variable `$titlit` contains the value that you read out of the database, with `$titleit = $row["title"]`.
Comment: I want to first see if the string assigned to $incoming is in the database title field and if it is I want to assign some of the row data to $message.
Comment: Do you mean you want to compare? `if ($titleit == $_REQUEST[$incoming])` then it is better to put it in the Select-query as in the answer from @Barmar
Comment: yes compare.  If $incoming is say 'Apple' and compares/matches the value of Apple on row 3 of the $row["title"] in the db, I want to be able to assign the value stored in $row["number"] to a variable.
Answer: Put the input that you want to match into the WHERE clause of the query, rather than selecting everything and then testing it in PHP.
$incoming = mysqli_real_escape_string($coco, $_POST['Help']));
$grabit = "SELECT number FROM the_one WHERE title = '$incoming' AND number IN ('two', '0')";
$result = mysqli_query($coco, $grabit);
if (mysqli_num_rows($result) > 0) {
    while ($row = mysqli_fetch_assoc($result)) {
        echo $row['number'];
    }
} else {
    echo "not found";
}

Comment: Solid! is there a way to add another check in the WHERE?
Answer: I think you need to add a break; in that if or I would assume it would go through each row in the database and set message if it matches the conditional.  Unless you want the last entry that matches...if not you should debug:
if ($titleit[$_REQUEST[$incoming]]){
    // set message
}

and see when it's getting set.  That may not be the issue, but it's at least a performance thing and could explain getting the last entry
Have you tried print_r($row) to see the row or adding echos to the if/else to see what path it's taking?
Comment: print_r is to display the array and echo the values? kind of right?
Comment: print_r is similar to var_dump...it will output the row in the database in a form that we can read.  For more on it, check out http://php.net/manual/en/function.print-r.php.  I use this a lot with objects, resources, and things that can't be output as strings with echo.  Echo I would use for something like $row['title'] to see the field value.  Check http://php.net/ECHO for more on that.  Does that make sense?
Comment: I like Bamars answer though...you can use WHERE in your SQL statement and then wouldn't have to worry about all this.  Just trying to help :)
Comment: How do I add more conditions to the WHERE?  Can I use AND again?
Comment: You should be able to use AND again.  Just do some Google-fu on MySQL with multiple ANDs for the WHERE clauses.  http://stackoverflow.com/questions/4733312/mysql-query-with-multiple-and-statements-seems-to-be-ignoring-one  has some conversation about brackets and such.
Comment: Solid!  A week of my life later I have been informed!


Na pasta java tenho três subpasta, é normal?

Question: Estou tendo problema com:

java/lang/NoClassDefFoundError : java/lang/object.

Já fiz muita coisa que os colegas pediram e nada. Atualizei a PATH e JAVA_HOME e nada. Minha Classpath:
;%JAVA_HOME%\lib;%JAVA_HOME%\lib\tools.jar;%JAVA_HOME%\lib\dt.jar;%JAVA_HOME%\lib\htmlconverter.jar;%JAVA_HOME%\jre\lib;%JAVA_HOME%\jre\lib\rt.jar;

Minha PATH do usuário do sistema:

Path do Sistema:

Minha JAVA_HOME:
C:\Program Files (x86)\Java\jdk1.8.0_131
Minha pasta C:\Arquivo de programa(x86)\java

E ainda continuo com o mesmo erro de:

java/lang/NoClassDefFoundError : java/lang/object
Comment: A  última linha da `PATH` do sistema mostra `%JAVA_HOME\bin%`. Não deveria ser `%JAVA_HOME%\bin`?
Comment: Existe algum serviço que por ventura esteja desabilitado? Quais os serviços do java para estar rodando?
Comment: Estou desinstalando tudo, apagar as pastas que restarem e reinstalar do zero pra ver se funciona.
Comment: Sinceramente, não sabia. Apenas copiei e colei. Vou alterar. Obrigado pela correção.
Answer: Bem, fiz a reinstalação e as alterações que o LINQ postou. Não sei se foi a reinstalação ou as alterações, pois quando ele disse, já estava desinstalando. Agora funcionou.


what does it mean if the partial auto correlation function of a time series have a value >+1 or <- 1?

Question: I have a time series data and I applied the first difference operator to make it stationary. When I plot the partial autocorrelation function of this differenced time series, I find peaks with value >1 and less than <-1 at certain lags.
1)Should I consider these lags for my analysis?
2)I am using MATLAB to plot the PACF, would there be any bugs? Because how can the correlation be >+1 or <-1.
I have attached the image of PACF plot. Kindly help me. Any help is appreciated.
Edit:
Actual Time series data.

Time series data after first difference.
Answer:
Should I consider these lags for my analysis?

Would the scope of your question of research be changed? If yes, I would say that dropping out these lags is a bad idea.

I am using MATLAB to plot the PACF, would there be any bugs?

It is almost sure that not.

How can the correlation be >+1 or <-1.

Because these values are very likely to come from a regression of your series over its ~550 (simultaneously considered) lagged versions. To me the reason why you get greater-than $1$ (absolute) values is either because:

your data are not time series, e.g. spatial series with overlapping autocorrelation structures
your data are temporal but with redundant values. (which is another manner to say that you have overlapping autocorrelation structure).

Did you check your data ? Are you sure that you have no duplicate entries ?

Another possibility is that your series is over/under-differenced. You may want to take a look at Identifying the order of differencing
Comment: Thanks for your response. I am sure that the data is time series and from the run sequence plot I could say there are no duplicate entries. I don't understand about the redundant values that you are referring to can you give me some idea on overlapping autocorrelation? Any links?
Comment: My objective is to find the lags at time t-k (k= 1 to 540) that contribute significantly in forecasting the value at time t. That's why I want to know whether to consider these lags for analysis.
Comment: @Dhineshkumar Putting aside discussions about block-bootstrap and so on, overlapping autoco-structures is a spatial concern (where the term spatial does not necessarily mean *geographical*). This has no reason to occur in the time series world if your data are well built. That being said, [Elhorst and Lacombe (2012) p.215](http://www.sciencedirect.com/science/article/pii/S0166046211001104) make an interesting discussion about *spatial* correlation structures which (partly) overlap.


Direct sum of vector spaces and quotients

Question: Suppose $V$ is a finite dimensional vector space, and $W_{1}, W_{2}$ are subspaces of $V$. Assume $V=W_{1}\oplus W_{2}$. Does it necessarily follow that $V/W_{1}$ is isomorphic to $W_{2}$ (as vector spaces)?
I feel like this is a well-known fact, but I have seen enough counterexamples for similar statements that I am not so sure.
Comment: If you have a direct sum decomposition, you don't need finite-dimensionality. Consider the restriction of the quotient map to $W_2$.
Comment: *Hint:* $\dim V = \dim W_1 + \dim W_2$.
Comment: @njguliyev, Daniel, thanks very much for the hints :) Makes sense.
Answer: See $\mathrm V$ has an abelian group. $\mathrm W_1$ is a sub-group of $\mathrm V$ and you want to make the quotient. This is always possible, but here you are in the best possible case, $\mathrm W_1$ is a direct factor !
You also have the split exact sequence
 $$ 0 \to \mathrm W_1 \to \mathrm W_1 \oplus \mathrm W_2 \to \mathrm W_2 \to 0.$$


All I get is a blank page when I visit localhost:9080

Question: I have been using udacity.com to learn to program but I ran into some problem with my code(python). The application is post to allow to put down the day you were born and when you push submit it's post to say "Thanks That's a totally valid day!". It's not doing it. The application just restarts again. Can some tell me why the is statement is not working and how to fix it.
import webapp2
form="""

    <form>
        What is your birthday?

        Month<input type="type" name="month">
        Day<input type="type" name="day">
        Year<input type="type" name="year">

%(error)s

        <input type="submit">
    </form>

"""
class MainPage(webapp2.RequestHandler):
    def write_form(self, error=""):
        self.response.out.write(form % {"error": error} )
    def get(self):
        self.write_form()

        def post(self):
            user_month = valid_month(self.request.get('month'))
            user_day = valid_day(self.request.get('day'))
            user_year = valid_year(self.request.get('year'))

            if not (user_month and user_month and user_year):
                self.write_form("That doesn't look valid to me, friend.")
            else:
                self.response.out.write("Thanks! That's a totally valid day!")

app = webapp2.WSGIApplication([('/',MainPage)], debug=True)

Comment: your configuration is most likely incorrect, but that is just speculation as anyone else's attempt at an answer will be as well. there is not a specific question articulated here to actually answer, it basically says *my thing is not working*. your problem is not something that anyone else can solve but you with this lack of information. *links to external resources, especially images on 3rd part hosting is highly discouraged as it leads to dead links and useless questions and answers.*
Comment: My question is why is a piece of code that's post to work coming out blank when put it in Google app engine locahost. I am ask for you guys to please look over it to see if there is any error or miss types.
Comment: Usually the App Engine port is 8080 and not 9080.
Comment: I change the localhost to 8080 and it still is blank
Comment: Do you guys have experience with using python on Google app engine
Comment: Is the dev_appserver running?
Comment: The dev_appserver is running
Answer: That fragment has a syntax error. If you're watching the terminal/console, you'll notice Python complain about the else (which is missing a trailing :). Watching the console, and understanding what it's saying, is key if you want to make progress.
With that fixed, you'll see the form. Then, when you trying posting, you'll get a "405 Method not allowed" because the post method is over-indented.
Comment: How do I not over-indented the post?
Comment: Python is very sensitive to indentation. In the fragment you posted, the `post` method is a private method of `get`. If you remove indentation starting at `def post` so that it's at the same level as `def get`, then the `post` method will be visible to routing. That will resolve the 405 error.
Comment: Does the code look ok now. Here is the link to the code:https://plus.google.com/u/1/115545843446144625696/posts/bobdBaWQ6hx?pid=6171953551530743762&oid=115545843446144625696
Comment: It's missing `def post` from in front the `(self)`. Otherwise, find. You can also edit your original post.
Comment: It works but when I push submit it does not go to ""Thanks! That's a totally valid day!"". Where in the code did i miss up?
Comment: Perhaps you meant `self.request.get('get')` to get 'day' instead of 'get'.
Comment: user_day = valid_day(self.request.get('get')    to        user_day = valid_day(self.request.get('day')
Comment: i changed it and i still it the same thing
Comment: Update the post and add the `valid_*` methods.
Comment: Do you mean def valid_post or just valid_post
Comment: valid_post or just valid_post did not work. where do i place the valid_* at. Thank you
Comment: Let's approach this another way. At least one of `user_day`, `user_month`, or `user_year` is False. Given what you've learned so far, what's the simplest thing you could do to tell which is False? Then work backwards to why.
Answer: Add method="post" to your form tag just above the text "What is your birthday?". You are using post method to post data to the form but the button submit doesn't know that you are using post as the tag  does not have method="post" in it.
Also check my answer on one of your other related post here. python post and get commands


Prove that ln(n) is not a Cauchy Sequence?

Question: Show from the definition of a Cauchy Sequence that Xn=ln(n) is not a Cauchy Series
Comment: Welcome to MSE.  You'll get a lot more help, and fewer votes to close, if you show that you have made a real effort to solve the problem yourself.  What are your thoughts?  What have you tried?  How far did you get?  Where are you stuck?  This question is likely to be closed if you don't add more context.  Please respond by **editing the question body.**  Many people browsing questions will vote to close without reading the comments.
Comment: Yeah it does thanks, I'll close the question
Answer: You need to prove that there is some epsilon > 0 such that for any N > 0 there is some n and m with |ln(n/m)| >= epsilon
for example, is you take epsilon = 1 and n=m+1, then the inequality is satisfied after some index N
Comment: How/why do you get ln(n/m) I don't understand where this comes from?
Comment: ln n - ln m = ln (n/m)
Answer: Assume $\log n$ is Cauchy.
For given $\epsilon >0$ there exists a $n_0$ s.t. for $m\ge n\ge n_0$
$|\log m-\log n| <\epsilon$.
Consider $m=kn$, where $k$ is a positive integer.
Then
$|\log m-\log n|= |\log (m/n)|=|\log k| <\epsilon$.
For $k$ large enough, a contradiction (Why?)
Comment: becuase it fails eventually for some epsilon, for instance epsilon = 1 will fail after k=e
Comment: Yes. Or a bit more general, since $\log k$ in not bounded above it will fail for any $\epsilon >0$ choosing $k$ large enough. Cheers.


BES Express - failed to run Administration Service

Question: I have installed BES Express on Windows Server 2008 SP1 with Exchange 2007 following by RIM tutorial
JDK 1.6.18, JDK\bin included into Path variable
After reboot I've run Blackberry Administration Service and receive such error in browser window:
HTTP Status 500 -

--------------------------------------------------------------------------------

type Exception report

message

description The server encountered an internal error () that prevented it from fulfilling this request.

exception

javax.servlet.ServletException: org.apache.hivemind.ApplicationRuntimeException: Missing classpath resource '/com/rim/bes/bas/web/adminconsole/pages/login/SystemError.page'. [context:/WEB-INF/webAdminConsole.application, line 25, column 37]
 org.apache.tapestry.services.impl.WebRequestServicerPipelineBridge.service(WebRequestServicerPipelineBridge.java:60)
 $ServletRequestServicer_12d51b7c397.service($ServletRequestServicer_12d51b7c397.java)
 org.apache.tapestry.request.DecodedRequestInjector.service(DecodedRequestInjector.java:55)
 $ServletRequestServicerFilter_12d51b7c393.service($ServletRequestServicerFilter_12d51b7c393.java)
 $ServletRequestServicer_12d51b7c399.service($ServletRequestServicer_12d51b7c399.java)
 org.apache.tapestry.multipart.MultipartDecoderFilter.service(MultipartDecoderFilter.java:52)
 $ServletRequestServicerFilter_12d51b7c391.service($ServletRequestServicerFilter_12d51b7c391.java)
 $ServletRequestServicer_12d51b7c399.service($ServletRequestServicer_12d51b7c399.java)
 org.apache.tapestry.services.impl.SetupRequestEncoding.service(SetupRequestEncoding.java:53)
 $ServletRequestServicerFilter_12d51b7c395.service($ServletRequestServicerFilter_12d51b7c395.java)
 $ServletRequestServicer_12d51b7c399.service($ServletRequestServicer_12d51b7c399.java)
 $ServletRequestServicer_12d51b7c305.service($ServletRequestServicer_12d51b7c305.java)
 org.apache.tapestry.ApplicationServlet.doService(ApplicationServlet.java:123)
 com.rim.bes.bas.web.common.BASApplicationServlet.doService(BASApplicationServlet.java:153)
 org.apache.tapestry.ApplicationServlet.doGet(ApplicationServlet.java:79)
 javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
 javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
 com.rim.bes.bas.web.console.LoginDispatcher.processRequest(LoginDispatcher.java:146)
 com.rim.bes.bas.web.console.LoginDispatcher.doGet(LoginDispatcher.java:79)
 javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
 javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
 com.rim.bes.bas.web.common.ResponseHeadersFilter.doFilter(ResponseHeadersFilter.java:85)
 com.rim.bes.bas.web.console.VSJSupportFilter.doFilter(VSJSupportFilter.java:228)
 org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)

root cause

org.apache.hivemind.ApplicationRuntimeException: Missing classpath resource '/com/rim/bes/bas/web/adminconsole/pages/login/SystemError.page'. [context:/WEB-INF/webAdminConsole.application, line 25, column 37]
 org.apache.tapestry.error.ExceptionPresenterImpl.presentException(ExceptionPresenterImpl.java:64)
 com.rim.bes.bas.web.common.CommonExceptionPresenter.presentException(CommonExceptionPresenter.java:269)
 com.rim.bes.bas.web.common.CommonExceptionPresenter.presentException(CommonExceptionPresenter.java:113)
 $ExceptionPresenter_12d51b7c2cf.presentException($ExceptionPresenter_12d51b7c2cf.java)
 org.apache.tapestry.engine.AbstractEngine.activateExceptionPage(AbstractEngine.java:121)
 org.apache.tapestry.engine.AbstractEngine.service(AbstractEngine.java:280)
 org.apache.tapestry.services.impl.InvokeEngineTerminator.service(InvokeEngineTerminator.java:60)
 $WebRequestServicer_12d51b7c3b5.service($WebRequestServicer_12d51b7c3b5.java)
 com.rim.bes.bas.web.console.ObjectCacheServiceFilter.service(ObjectCacheServiceFilter.java:72)
 $WebRequestServicerFilter_12d51b7c3b9.service($WebRequestServicerFilter_12d51b7c3b9.java)
 $WebRequestServicer_12d51b7c3bb.service($WebRequestServicer_12d51b7c3bb.java)
 com.rim.bes.bas.web.common.ServiceFilter.service(ServiceFilter.java:84)
 $WebRequestServicerFilter_12d51b7c3b7.service($WebRequestServicerFilter_12d51b7c3b7.java)
 $WebRequestServicer_12d51b7c3bb.service($WebRequestServicer_12d51b7c3bb.java)
 $WebRequestServicer_12d51b7c3b1.service($WebRequestServicer_12d51b7c3b1.java)
 org.apache.tapestry.services.impl.WebRequestServicerPipelineBridge.service(WebRequestServicerPipelineBridge.java:56)
 $ServletRequestServicer_12d51b7c397.service($ServletRequestServicer_12d51b7c397.java)
 org.apache.tapestry.request.DecodedRequestInjector.service(DecodedRequestInjector.java:55)
 $ServletRequestServicerFilter_12d51b7c393.service($ServletRequestServicerFilter_12d51b7c393.java)
 $ServletRequestServicer_12d51b7c399.service($ServletRequestServicer_12d51b7c399.java)
 org.apache.tapestry.multipart.MultipartDecoderFilter.service(MultipartDecoderFilter.java:52)
 $ServletRequestServicerFilter_12d51b7c391.service($ServletRequestServicerFilter_12d51b7c391.java)
 $ServletRequestServicer_12d51b7c399.service($ServletRequestServicer_12d51b7c399.java)
 org.apache.tapestry.services.impl.SetupRequestEncoding.service(SetupRequestEncoding.java:53)
 $ServletRequestServicerFilter_12d51b7c395.service($ServletRequestServicerFilter_12d51b7c395.java)
 $ServletRequestServicer_12d51b7c399.service($ServletRequestServicer_12d51b7c399.java)
 $ServletRequestServicer_12d51b7c305.service($ServletRequestServicer_12d51b7c305.java)
 org.apache.tapestry.ApplicationServlet.doService(ApplicationServlet.java:123)
 com.rim.bes.bas.web.common.BASApplicationServlet.doService(BASApplicationServlet.java:153)
 org.apache.tapestry.ApplicationServlet.doGet(ApplicationServlet.java:79)
 javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
 javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
 com.rim.bes.bas.web.console.LoginDispatcher.processRequest(LoginDispatcher.java:146)
 com.rim.bes.bas.web.console.LoginDispatcher.doGet(LoginDispatcher.java:79)
 javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
 javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
 com.rim.bes.bas.web.common.ResponseHeadersFilter.doFilter(ResponseHeadersFilter.java:85)
 com.rim.bes.bas.web.console.VSJSupportFilter.doFilter(VSJSupportFilter.java:228)
 org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)

root cause

org.apache.hivemind.ApplicationRuntimeException: Missing classpath resource '/com/rim/bes/bas/web/adminconsole/pages/login/SystemError.page'. [context:/WEB-INF/webAdminConsole.application, line 25, column 37]
 org.apache.tapestry.asset.ClasspathAssetFactory.createAbsoluteAsset(ClasspathAssetFactory.java:61)
 $AssetFactory_12d51b7c400.createAbsoluteAsset($AssetFactory_12d51b7c400.java)
 org.apache.tapestry.asset.ContextAssetFactory.createAsset(ContextAssetFactory.java:66)
 $AssetFactory_12d51b7c3fe.createAsset($AssetFactory_12d51b7c3fe.java)
 $AssetFactory_12d51b7c404.createAsset($AssetFactory_12d51b7c404.java)
 $AssetFactory_12d51b7c2ff.createAsset($AssetFactory_12d51b7c2ff.java)
 org.apache.tapestry.asset.AssetSourceImpl.findAsset(AssetSourceImpl.java:64)
 $AssetSource_12d51b7c3fa.findAsset($AssetSource_12d51b7c3fa.java)
 org.apache.tapestry.services.impl.NamespaceResourcesImpl.findSpecificationResource(NamespaceResourcesImpl.java:61)
 org.apache.tapestry.services.impl.NamespaceResourcesImpl.getPageSpecification(NamespaceResourcesImpl.java:71)
 org.apache.tapestry.engine.Namespace.locatePageSpecification(Namespace.java:264)
 org.apache.tapestry.engine.Namespace.getPageSpecification(Namespace.java:172)
 org.apache.tapestry.resolver.PageSpecificationResolverImpl.resolve(PageSpecificationResolverImpl.java:131)
 $PageSpecificationResolver_12d51b7c3f4.resolve($PageSpecificationResolver_12d51b7c3f4.java)
 $PageSpecificationResolver_12d51b7c3f5.resolve($PageSpecificationResolver_12d51b7c3f5.java)
 org.apache.tapestry.pageload.PageSource.getPage(PageSource.java:115)
 $IPageSource_12d51b7c2e5.getPage($IPageSource_12d51b7c2e5.java)
 org.apache.tapestry.engine.RequestCycle.loadPage(RequestCycle.java:268)
 org.apache.tapestry.engine.RequestCycle.getPage(RequestCycle.java:251)
 org.apache.tapestry.error.ExceptionPresenterImpl.presentException(ExceptionPresenterImpl.java:40)
 com.rim.bes.bas.web.common.CommonExceptionPresenter.presentException(CommonExceptionPresenter.java:269)
 com.rim.bes.bas.web.common.CommonExceptionPresenter.presentException(CommonExceptionPresenter.java:113)
 $ExceptionPresenter_12d51b7c2cf.presentException($ExceptionPresenter_12d51b7c2cf.java)
 org.apache.tapestry.engine.AbstractEngine.activateExceptionPage(AbstractEngine.java:121)
 org.apache.tapestry.engine.AbstractEngine.service(AbstractEngine.java:280)
 org.apache.tapestry.services.impl.InvokeEngineTerminator.service(InvokeEngineTerminator.java:60)
 $WebRequestServicer_12d51b7c3b5.service($WebRequestServicer_12d51b7c3b5.java)
 com.rim.bes.bas.web.console.ObjectCacheServiceFilter.service(ObjectCacheServiceFilter.java:72)
 $WebRequestServicerFilter_12d51b7c3b9.service($WebRequestServicerFilter_12d51b7c3b9.java)
 $WebRequestServicer_12d51b7c3bb.service($WebRequestServicer_12d51b7c3bb.java)
 com.rim.bes.bas.web.common.ServiceFilter.service(ServiceFilter.java:84)
 $WebRequestServicerFilter_12d51b7c3b7.service($WebRequestServicerFilter_12d51b7c3b7.java)
 $WebRequestServicer_12d51b7c3bb.service($WebRequestServicer_12d51b7c3bb.java)
 $WebRequestServicer_12d51b7c3b1.service($WebRequestServicer_12d51b7c3b1.java)
 org.apache.tapestry.services.impl.WebRequestServicerPipelineBridge.service(WebRequestServicerPipelineBridge.java:56)
 $ServletRequestServicer_12d51b7c397.service($ServletRequestServicer_12d51b7c397.java)
 org.apache.tapestry.request.DecodedRequestInjector.service(DecodedRequestInjector.java:55)
 $ServletRequestServicerFilter_12d51b7c393.service($ServletRequestServicerFilter_12d51b7c393.java)
 $ServletRequestServicer_12d51b7c399.service($ServletRequestServicer_12d51b7c399.java)
 org.apache.tapestry.multipart.MultipartDecoderFilter.service(MultipartDecoderFilter.java:52)
 $ServletRequestServicerFilter_12d51b7c391.service($ServletRequestServicerFilter_12d51b7c391.java)
 $ServletRequestServicer_12d51b7c399.service($ServletRequestServicer_12d51b7c399.java)
 org.apache.tapestry.services.impl.SetupRequestEncoding.service(SetupRequestEncoding.java:53)
 $ServletRequestServicerFilter_12d51b7c395.service($ServletRequestServicerFilter_12d51b7c395.java)
 $ServletRequestServicer_12d51b7c399.service($ServletRequestServicer_12d51b7c399.java)
 $ServletRequestServicer_12d51b7c305.service($ServletRequestServicer_12d51b7c305.java)
 org.apache.tapestry.ApplicationServlet.doService(ApplicationServlet.java:123)
 com.rim.bes.bas.web.common.BASApplicationServlet.doService(BASApplicationServlet.java:153)
 org.apache.tapestry.ApplicationServlet.doGet(ApplicationServlet.java:79)
 javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
 javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
 com.rim.bes.bas.web.console.LoginDispatcher.processRequest(LoginDispatcher.java:146)
 com.rim.bes.bas.web.console.LoginDispatcher.doGet(LoginDispatcher.java:79)
 javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
 javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
 com.rim.bes.bas.web.common.ResponseHeadersFilter.doFilter(ResponseHeadersFilter.java:85)
 com.rim.bes.bas.web.console.VSJSupportFilter.doFilter(VSJSupportFilter.java:228)
 org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)

Can you help me?
Thank you!
same question on bbforums
Comment: Did you try running it as Administrator?
Comment: Yes, I have tried it with account from Administrators group
Answer: 4 Days working on this, anyone still stuck check out this solution:
If you loaded the SQLEXPRESS open SQL Server Configuration Manager for sqlexpress, click on protocols for blackberry, open tcpip, click the TCP/IP properties tab.
Check the IP address for each and every network connection, enable or not, check the IP Address field, should point to your server IP address, any that are not change them to your server IP.
Restart the SQL Services, and all blackberry services, your admin page should be working.
Answer: Check the webconsole and other related apps or services have been installed and configured.
It looks like the webconsole is missing a component but can't give you a proper error message because of a programming bug.
BES errors can be a real hoot because they seem to be even less source-related than windows errors.
Comment: All Blackberry services are up and running, SQL TCP\IP protocol is enabled.
I am able to log in to "BlackBerry Web Desktop Manager" but still I can't log in to "BlackBerry Administration Service".
Answer: If you have IIS on same server, you could have a port conflict on 443.
Here are the instructions for changing the port for BlackBerry Device Service:

Navigate to Start > Programs > BlackBerry Device Service > BlackBerry Server Configuration Panel > Administration Service
Modify the HTTPS Port number to 663 port number
Click Apply
Click Synchronize
Restart the BlackBerry Administration Service Application Server (BAS-AS) and the BlackBerry Administration Service Native Code Container (BAS-NCC) services

The Server address will now be: https://ServerName:663/webconsole/login.
Answer: Since there's no such thing as Windows Server 7, I'm assuming you mean Windows 7 and since Windows 7 isn't listed as a supported host OS for BESX, that would be my guess as to why it doesn't work.
Comment: my apologizes, it's Windows Server 2008 SP1
Answer: I have decided to perform clean reinstall, using following article:
KB04096 - Perform a clean uninstall of the BlackBerry Enterprise Server software
But in the progress of that (while searching of "Blackberry Enterprise Server" Value in Registry) I have found some RIM Values in Installer\Folders Key left after uninstall. I have removed them also.
New installation works fine :)


Study the normal/uniform convergence of this series of functions

Question: $(f_n):[0,\infty[ \rightarrow \mathbb{R}$ : $$\forall n \in \mathbb{N},  \: \: f_n(t)=\frac{1}{n+1}\chi_{[n,n+1[}$$
where $\chi_{[n,n+1[}$ is the indicator function
this problem is confusing for me, how can i study the convergence of such series? if you have more problems of this type please let me know so i can work on them, thanks for reading.
(sorry for the poor format)
Comment: Series of functions, what i wrote is the summand
Comment: Series or Sequence?
Comment: i found that it converges (uniformly) to 1/(⌊t⌋+1) if im not mistaken
Comment: What if $t\in\Bbb N$ with $t\ge 2$?
Answer: For fixed $t\ge0$ you have that $f_n(t)=0$ for all $n$ except, possibly, two of them (this follos from the fact that the supports of $f_n$ are $[n,n+1]$).
So the pointwise, it is a finit sum, so convergent.
For the uiniform convergence, observe that you cannot use M-Weierstrass test, since $\sup f_n(t)=\frac{1}{n+1}$ and $\sum\frac{1}{n+1}$ diverges.
The solution is to use uniform-Cauchy-test for uniform convergence.
For this purpose, let $n>m$. For fixed $t\ge 0$ if you take $$f_{m+1}
(t)+\cdots+f_n(t)$$ there are AT MOST two of these sumands that are non zero, so for any $t\ge 0$
$$0\le f_{m+1}(t)+\cdots+f_n(t)\le 2\frac{1}{m+1}$$ (take into account that $\frac{1}{m+1}$ is the biggest possible value).
So Given $\varepsilon>0$ if fou take $N\in\Bbb N$ such that $\frac{2}{N+1}<\varepsilon$, for every $n>m\ge N$ fou have that for all $t\ge 0$, $$0\le \sum_{k=m+1}^n f_k(t)\le \frac{2}{m+1}\le \frac{2}{N+1}\le\varepsilon$$ and you have that your series is unifomly Cauchy, so uniformly convergent.
PS: The only property I'm strongly using is that the supports are "almost" disjoint (i.e. the intersection two different supports is empty os a singleton).
I have recently co-authores a paper very related to this topic: https://arxiv.org/abs/2003.10263 where you can find more examples of this type.


Notation about conditional expectation $E[Y|X]$

Question: Given $X,Y$ real random variables, we know that $E[Y|X]$ is X measurable and that there is a Lebesgue measurable function $f : \mathbf{R} \rightarrow  \mathbf{R}$ such that $E[Y|X]=f(X)$ almost everywhere.
Is there any explicit and standard notation for the function $f$ as a function of $X,Y$ ? Something like $\mu_{Y|X}$ (I am just inventing here), so that one could write $\mu_{Y|X}(x_1)$ instead of $f(x_1)$ and therefore make it explicit the meaning of $f$ ?
Comment: The standard notation is $E[Y|X]$ and this random variable is defined as a measurable function of $X$ such that$$E[Y]=\int E[Y|x]\,\text{d}P(x)$$
Comment: This looks like the law of total expectation. Why are your reporting it ? Maybe you want to suggest that $E[Y|x]$ is the standard notation for my $f(x)$ ?
Comment: Not sure why the downvote anyway...
Answer: Same as we can use $f_X(x)$ for the probability density $f$ of random variable $X$ evaluated at $x$, you can use notation like $f_{Y|X}(y|x)$ or $\mu_{Y|X}(y|x)$ to denote conditional things (e.g. densities, expected values etc.). See examples here or here.
Comment: @Thomas there is no strict rules with notations, just conventions as ones mentioned above and by Xi'an in the comment. You can always define what you mean by introducing a notation.
Comment: Great thanks! There is a leap on the notation though, right? Because $Y|X$ is not a well defined random variable. Has $\mu_{Y|X}(y)$ the same meaning of my question ? In this case the natural argument should be $x$ not $y$ or am I wrong ? And how is $f_{Y|X}(y)$ defined ?
Comment: @Thomas sorry, you're right, updated.
Comment: Thanks Tim, still in my mind it should be $\mu_{Y|X}(x)$ and, if I understand correctly your notation,  $f_{Y|X}(y|x)$ is a shorthand for a two-variable function $f_{Y|X}(y,x)$. Than $\mu_{Y|X}(x)$ should have the meaning of the mean of $Y$ along all events where $X=x$, so that depends only on one variable. Whereas (tell me if I am wrong)  you are using $y|x$ as a shorthand for $(y,x)$ and $f_{Y|X}(y,x)$ is the probability that $Y=y$ given that $X=x$. We have than $\mu_{Y|X}(x)=\int dy \ y f_{Y|X}(y|x)$ . Is this what you are suggesting ?
Comment: Sorry but my question is all about notations, what is standard and what is not ... therefore I would like to be precise...
Comment: Ok thanks ! So it is a bit of a jungle, as far as I see :D


When does $\sqrt{a b} = \sqrt{a} \sqrt{b}$?

Question: So, my friend show me prove that $1=-1$ by using this way:
$$1=\sqrt{1}=\sqrt{(-1)\times(-1)}=\sqrt{-1}\times\sqrt{-1}=i\times i=i^2=-1$$
At first sight, I stated "No, $\sqrt{ab}=\sqrt{a}\times\sqrt{b}$ is valid only for $a,b\in\mathbb{R}$ and $a,b\geq0$"
But, I remember that $\sqrt{-4}=\sqrt{4}\times\sqrt{-1}=2i$ which is true (I guess).
Was my statement true? But, $\sqrt{ab}=\sqrt{a}\times\sqrt{b}$ is also valid if one of a or b is negative real number. Why is it not valid for a and b both negative? If my statement was wrong, what is wrong with that proof?
Comment: @RobertIsrael: Yes and no -- the OP here presents a _particular_ misunderstanding (namely, confusion between $a,b\ge 0$ being a necessary or a sufficient condition) that the previous question or its answers do not handle.
Comment: @user379677 Yes, I can see that and I don't blame you. I see it too in a lot of high school textbooks. For "low level" stuff, this definition works fine, but going higher up with complex variables, that definition has some drawbacks. Saying "The squareroots of $-4$ are $2i$ and $-2i$" is better (I still don't like it), but the radical symbol as an operator on negative numbers, please avoid...
Comment: @imranfat Ah... I remember that. I've learned that for all complex number there are always max 2 squareroot of it. Is that why I can't easily state $\sqrt{-4}=2i$?
Comment: @SomeGuy In essence it is generally understood that $2i$ and $-2i$ are the solutions to the equation $x^2=-4$. So we can say that the square roots of $-4$ are $2i$ and $-2i$ but it is incorrect to say $\sqrt{-4}=2i$. The reason why one has to be careful with the word "roots" is because it is "deficient" For example: The cube root of $1$ is not just $1$, is it? There are two more (complex) solutions, but we CAN say that $1$ is a solutions to $x^3=1$
Comment: @user379677 Reading the comment $\sqrt{-4}=2i$ kind of hurts...You got to watch these conclusions with some care
Comment: @imranfat I'm sorry. Because I still think that $\sqrt{-1}=i$. That's why I thought it's true.
Comment: There is a very interesting answer at [this almost identically titled post](https://math.stackexchange.com/q/402936/29335) that I wish could be merged here somehow, but it seems unlikely.
Comment: @imranfat I do not understand what is wrong with "The squareroots of −4 are 2i and −2i". Could you elaborate?
Comment: @IonSme Please don't make cosmetic edits to old questions. That moves them to the active question queue which distracts people who look at what's really current.
Answer: As you know, the rule $\sqrt{ab}=\sqrt a \sqrt b$ holds for some but not all combinations of $a$ and $b$. Explaining and remembering exactly which those combinations are is usually more trouble than it's worth, so usually the rule we remember is just

It is a sufficient condition for $\sqrt{ab}$ to equal $\sqrt a\sqrt b$ that $a$ and $b$ are both non-negative reals.

As you have noticed, this condition is not necessary, but that does not keep the rule from being useful.
For the purpose of rejecting your friend's fake proof, even the above version is more than you need; all you need to say is

The rule $\sqrt{ab}=\sqrt a\sqrt b$ does not always hold when we extend the $\sqrt{\phantom a}$ function to complex numbers.

It is not your task to prove that the rule fails in the particular case $a=b=-1$ (thought doing so is a simple matter of computation); it is the guy who wants to prove something who has the responsibility for only using rules he knows apply in the context he's using them in. After you've pointed out that the rule has been stretched beyond the domain we know it to work for, it's up to him to figure out whether he can come up with an argument that it should be valid here.
Comment: x @user379677: You _don't even need_ to state a sufficient condition in order to point out that the proof is wrong. It is enough to say: **This rewriting is not valid at that place**, and it is then up to _your friend_ to produce a rule that would apply in that situation and make it valid. Since he can't, you win.
Comment: @SimpleArt: The idea of "winning" here can be taken quite seriously and leads to things such as [game semantics](https://en.wikipedia.org/wiki/Game_semantics) for the meaning of proofs.
Comment: Haha, I once saw a game where the winner didn't win in the normal sense, but forced the opponent to break the rules in some way.  This reminds me of that.
Comment: So, there is another condition that $\sqrt{ab}=\sqrt{a}\sqrt{b}$? But, how can I prove that he's wrong by only said the sufficient condition for it? Because what I know about sufficient condition is that if the sufficient condition doesn't hold, then the statement $\sqrt{ab}=\sqrt{a}\sqrt{b}$ doesn't mean to be wrong.
Comment: Ah... now I get it... thank you... ^^
Answer: An alternate way to understand what is happening here is to note that
$$
1=e^{0i}
$$
When we take the square root, we have
$$
1=\sqrt{e^{0i}} = \sqrt{e^{-\pi i}\times e^{\pi i}}
$$
Notice that $e^{-\pi i}=e^{\pi i}=-1$.
Now, since we are working in polar form, we can evaluate the square roots consistently, arriving at
$$
1=e^{-\pi i/2}\times e^{\pi i/2} = -i\times i = 1
$$
Essentially, the problem lies in the "branch cut" that occurs with the square root operation - you must be careful with the evaluation.
To put it another way, $1=e^{2n\pi i}$ for all integer $n$, and the square root function has to respect its specific value (of $n$), as it can take multiple different values depending on that $n$. To get $1=-1$ as in the question, one must simultaneously use $1=e^{0i}$ and $1=e^{2\pi i}$.
Comment: If I use $1=e^{2\pi i}$ so I split $\sqrt{e^{2\pi i}}$ become $\sqrt{e^{\pi i}\times e^{\pi i}}$ which when I evaluate the square root become $e^{2 \pi i/2}\times e^{\pi i/2}$. It equals $i\times i=-1$. What's wrong with it?
Comment: Essentially, you can't go "well, $1=e^{2\pi i}$, so $1=\sqrt{e^{2\pi i}}$", because those two statements aren't the same.
Comment: @user379677 - two mistakes. First, $\sqrt{e^{2\pi i}} = e^{\pi i} = -1$ (this is why I said you have to keep an eye on the branch), so that agrees with $i\times i=-1$. Second, you've accidentally written $e^{2\pi i/2}$ in your product.
Answer: The particular step in question is whether or not it is the case that
$$\sqrt{(-1)\times(-1)}\stackrel?=\sqrt{-1}\times\sqrt{-1}$$
In particular, it is questioned whether or not we can have $\sqrt{(-1)^2}=(\sqrt{-1})^2$, and here, the answer is no due to how we interpret the operations.
This is because the $x^2$ operation cancels the $\sqrt x$ operation, but it does not work the other way around, since
$$y=\sqrt x\implies y^2=x,\underbrace{y>0}_{\text{we lose something here}}$$
This means we lose a possible value in the process, since we only take one of the possible values that could be the solution.  On the other hand, regardless of which value a square root is denoted, the squaring operation will take both and make the end result the same.
Comment: So square root is not inverse of power by 2 or square root is inverse of power by 2 only for some number?
Comment: @user379677 It is taken, usually by definition, to be the **principal** inverse.  The 'total' inverse would have to be given by a $\sqrt\square=\pm...$.  Over the complex numbers, the principal value has argument $\in[0,\pi)$, i.e. the top half of the complex plane, not including the negative reals.
Comment: Ah... so my friend just like switch the order of operation and didn't realize that switching it true only if $a,b$ are real nonnegative?
Comment: @user379677 No, it has to do with that the operations aren't perfect inverses.  For example, take a number.  Add one to it, then subtract one.  You got the number you started with, right?  Now take a number.  ***Square*** it, the square root it.  You only get the number you started with if it wasn't negative?  What about if you start with a complex number instead?  The point here is that$$\sqrt{\square}=...\require{cancel}\cancel{\imply}\square=(...)^2$$
Comment: I think I get it. Thank you... ^^
Comment: @user379677 Glad to help.  :)
Answer: If both are negative,
$$\sqrt{-a} \times \sqrt{-b} = \sqrt{-1}\times \sqrt{-1} \times \sqrt{a} \times \sqrt{b}$$
$$=i^2 \times \sqrt{ab} = -\sqrt{ab}$$
(the rule is not applicable here)
If one of them is negative,
$$\sqrt{-a}\times \sqrt{b} = \sqrt{-1} \times \sqrt{ab} = \sqrt{-ab}$$ (the rule is applicable here)
If you have non-negative real numbers, this rule is easily applicable. If negative numbers come, then you have complex numbers involved. For them, this rule behaves differently. As you have seen above, if both of them are negative, the result is $-\sqrt{ab}$ and not just $\sqrt{ab}$. That's why $1$ is not equal to $\sqrt{(-1)}\times\sqrt{(-1)}$(two complex numbers multiplying) becuase now you have complex numbers involved and as we said, for them rules are different!
So, when you bring negative inside the square root, complex numbers arise. $\sqrt{(-1)}\times\sqrt{(-1)}$ is $-1$. But, $\sqrt{(-1) \times (-1)}$ is simply $1$.
$$\sqrt{(-1)}\times\sqrt{(-1)} \neq \sqrt{(-1) \times (-1)}$$
Comment: Could you elaborate your second step? When you say $\sqrt{-a}\times \sqrt{b} = \sqrt{-1} \times \sqrt{ab}$, do you mean $\sqrt{-a}=\sqrt{-1}\sqrt{a}$?
Comment: Yes, it means that. Then you have $\sqrt{-1}\sqrt{a}\sqrt{b} = \sqrt{-1}\sqrt{ab} = \sqrt{-ab}$
Comment: But that's what you are proving. If you are using $\sqrt{-1\times ab}=\sqrt{-1}\sqrt{ab}$ then you are already using the result that given equality is true if one of them is negative.
Comment: That's what I did for the first part as well. $\sqrt{-a} = \sqrt{-1}\sqrt{a}$. If you multiply $\sqrt{-a}$ and $\sqrt{-b}$ together, you will get $- \sqrt{ab}$. You simply can't multiply the inside numbers ($-a$ and $-b$). But for, $\sqrt{-1}$ and $\sqrt{a}$, you can do that because $\sqrt{-a} \times \sqrt{b} = \sqrt{-ab}$. I'm not proving that, it's just to make things formal. As, $\sqrt{-a} = \sqrt{-1}\sqrt{a}$, I can state that.
Comment: Your conclusion is, of course, correct but you can't write $\sqrt{-a}=\sqrt{-1}\sqrt{a}$ because as I've mentioned this assumes the result is already true before actually proving it.
Comment: Lets say I'm given $\sqrt{-a} \times \sqrt{-b}$. If I say $\sqrt{ab}$ is the answer then I am wrong as breaking them, I will get $\sqrt{a}\times \sqrt{b}$ and not the original values. And now, if I break $\sqrt{-ab}$, I will get $\sqrt{-a}\times \sqrt{b}$, which contains my original values. It means, the step that I used, $\sqrt{-a} = \sqrt{-1}\sqrt{a}$ is correct! I can break them down!!!!


Properties of $f(f(x))=g(x)$

Question: With reference to this Youtube video, I was trying to find out what important information we can gain from the equation $f(f(x))=g(x)$ [Assume all functions to be real]
One particularly interesting one that I found was this:
Consider $\text{Fix}(g)$ to be the set of all real numbers invariant under the map $g$ (which is to say that $\text{Fix}(g)=\{x:x\in\mathbb{R},g(x)=x\}$). Now,
$$\begin{eqnarray}
&&f(f(x))=g(x)\\
&\implies& f(f(f(x)))=f(g(x))\\
&\implies&g(f(x))=f(g(x))
\end{eqnarray}$$
This implies compositional commutativity of the 2 functions.
Now for any arbitrary $x_0$ in $\text{Fix}(g)$:
$$\begin{eqnarray}
&&g(f(x_0))=f(g(x_0))\\
&\implies& g(f(x_0))=f(x_0)
\end{eqnarray}$$
So, $f(x_0)$ must also be in $\text{Fix}(g)$, as it is invariant under $g$.
So, we can conclude that if $x_0$ is invariant under $g$, then $f(x_0)$ will also be invariant under $g$
Similarly, we can also show that if $x_0$ is invariant under $f$, then $g(x_0)$ is also invariant under $f$.
[This is particularly useful when $\text{Fix}(g)$ has only one element]
Now my question is: What are the other useful pieces of information that we can extract from $f(f(x))=g(x)$?
I know this is a little broad-ended, but I am looking for all possible perspectives to inspect this problem. I am intending for the answers and comments to this question to be a compendium of everything that we can extract from the relation.
Comment: Actually you can show that the set of fixed points of $f$, call it Fix$(f)$, is the same as the set of fixed points of $g$ (assuming that $f$ and $g$ have the same domain of definition), call it Fix$(g)$. Indeed, if $f(x) = x$, then $g(x) = f(f(x)) = x$ so Fix$(f) \subset$ Fix$(g)$. Now if $g(x) = x$, then $f(f(x)) = x$ but using $f(x) = g(f(x))$ and applying $f$ on both sides, we get $x = f(g(f(x))) = g(x)$. Hence Fix$(f)$ = Fix$(g)$.
Comment: @NaNoS , I agree upon your proof till $\text{Fix}(f)\subseteq\text{Fix}(g)$ (It should be just subset, not proper subset though), but, there seems to be some problem in the 2nd part... As [this](https://www.desmos.com/calculator/kjoqdfetip) shows, if we choose $f(x)=7\sin (x)$, we have a value (approximately $1.172$) belonging to $\text{Fix}(g)$ which is not present in $\text{Fix}(f)$
Comment: Thank you for your vigilance, actually I just prove that $g(x) = x \Rightarrow g(x) = x$... (we'll lie and say I was tired when I wrote this message). I leave my comment so that people can have a good laugh :).
Comment: @NaNoS, added your $\text{Fix}(.)$ notation in the post. It looked pretty cool. (And mistakes are a common byproduct of creative work :) )
Comment: @AugustoSantos, unfortunately, I am not informed enough to understand your points in depth, but you are considering $f$ as the step to step evolution function over a set of real numbers right?
Comment: @AugustoSantos also, though I clearly have no grasp on the topic of your comment, I believe that (iii) might not hold over all discrete input spaces. Consider the input set $\{1,0\}$ with $f$ as a function that inverts its input. While the outputs of $f$ cover every possible output, whether we start from $0$ or $1$ , $g$ will not do so. Or am I supposed to consider only continuous domains?
Answer: I happen to have some notes about this equation. In particular, it is useful for showing that for some $g$, $f(f(x)) = g(x)$ has no solutions, by analyzing the orbits of $g$. I wrote this in order to show
$$f(f(x)) = x^2 + 3x - 3$$
has no solutions $f: \mathbb{R} \to \mathbb{R}$, though the results I get are more general.
$\newcommand{\abs}[1]{\lvert #1 \rvert}$
Throughout, suppose $f(f(x)) = g(x)$, where $g$ is some given function and we want to solve for $f$.
Proposition: Let $x_0$ be a fixed point of $f$. Let $S_k$ be the set of $x$ such that $g^{(k)}(x) = x_0$. If $f(x_0) = x_0$ and $\abs{S_1} = 2$, then $S_2 = S_1$.
Proof: Let $S_1 = \{x_0, x_1\}$. Then we have
$$x_0 = f(g(x_1)) = g(f(x_1)).$$
So $f(x_1) \in \{x_0, x_1\}$. But $f(f(x_1)) = x_0$, so $f(x_1) \neq x_1$. So $f(x_1) = x_0$.
Now suppose for the sake of contradiction that $x_2 \in S_2 \backslash S_1$. Then $g(x_2) \in S_1 \backslash S_0$, so $g(x_2) = x_1$. Thus
$$g(f(x_2)) = f(g(x_2)) = f(x_1) = x_0.$$
So $f(x_2) \in S_1 = \{x_0, x_1\}$. But in either case, we have $g(x_2) = f(f(x_2)) = x_0$, contradiction!
$\square$
For example, let $g(x) = x^2 + 3x - 3$ and $x_0 = 1$. We have $S_1 = \{1, -4\}$ and $\abs{S_2} = 4$. So $x_0$ cannot be a fixed point of $f$.
Proposition: Let $I_k$ be the set of $x$ such that $g^{(k)}(x) = x$. Then

$f$ is a bijection from $I_k \backslash I_{k - 1}$ to itself.

It is not possible that $\abs{I_2 \backslash I_1} = 2$.

Proof: First, note that $f$ is injective on $I_k$, as $f^{(2k)}(x) = x$ holds.
Suppose $a \in I_k \backslash I_{k - 1}$. Note that $g^{(k)}(f(a)) = f(g^{(k)}(a)) = f(a)$, so $f(a) \in I_{k}$.
For the sake of contradiction, suppose $f(a) \in I_{k - 1}$. Then $f(a) = g^{(k - 1)}(f(a)) = f(g^{(k - 1)}(a))$. But $g^{(k - 1)}(a) \neq a$ and both lies in $I_k$, contradicting the injectivity of $f$!
So $f$ maps $I_k \backslash I_{k - 1}$ to itself. The inverse of $f$ is $f^{(2k - 1)}$.
If $\abs{I_2 \backslash I_1} = 2$, then since $f$ is a bijection on $I_2 \backslash I_1$, we have $g(x) = f(f(x)) = x$ for any $x \in I_2 \backslash I_1$, contradicting the fact that $x \notin I_1$.
$\square$
For example, let $g(x) = x^2 + 3x - 3$. We have $I_1 = \{1, -3\}$ and $I_2 = \{1, -3, \sqrt{3} - 2, -\sqrt{3}-2\}$. So a corresponding $f$ doesn't exist.
Comment: Thanks for this wonderful answer! (+1) Though I am able to comprehend the logical basis of your arguments, I am unable to get a more intuitive foothold (like how someone might _discover_ this on their own). Perhaps you'd care to elaborate?
Comment: Also for those $x_0$ in $I_2$, the only possible sequences of terms that arise by applying $f$ repeatedly on $x_0$ are $\{x_0,x_0,x_0,x_0\}$, $\{x_0,x_1,x_0,x_1\}$ and $\{x_0,x_1,x_2,x_3\}$ [Tested by using cases at each step of function application]. Out of these, the first two will also get counted in $I_1$, while the third one wouldn't be. So for each occurrence of a 3rd sequence-like orbit, we would count 4 more in $I_2$ than in $I_1$. So, I think we can say that $|I_2\backslash I_1|$ will always be a multiple of $4$. Does that seem reasonable?
Comment: Yes I agree with this observation. I don't have a good intuition about these statements either...
Comment: Your concept of "orbit" was very useful. It was what led to the observation.

Properties of $f(f(x))=g(x)$


Smaller notes notation in Chopin's Polonaise Op. 53

Question: I encountered a notation in the Chopin's Polonaise, Op. 53 that I have not seen before: smaller font notes not explicitly following the time signature.

While it is pretty obvious how it is played (fast "dimensionless" passage), I wonder:

if this notation has a specific name?
if the technical skill to play it on the piano has a specific name?
Comment: It's a tuplet with lots of notes, or a 'run'
Answer: It's commonly called a roulade, or sometimes fioritura from Italian "flourish."  In his later compositions, they're often more elaborate than just a scale.
It makes no sense to call it a tuplet, unless it's Ferneyhough or Berio ironically quoting Chopin.
Comment: I think you are totally right! Also found [Wiki page on _fioritura_](https://en.wikipedia.org/wiki/Fioritura) which also features an example from Chopin!
Answer: As marcelloverylongname commented, this is a  run.   The notation is  easier than trying to notate 29 notes into 5 eighth-notes.   ( 6-6-6-6-5 ? ugh)
Given that this is in the middle of the piece, in 3/4 time,   with only an eighth-note in that bar,  you should make the run come more or less close to using up the remainder of the meter in that bar.  A little time-stretching is acceptable.
Answer: I also found a term tirata (or tirade), which I am not sure can be applicable to Chopin.
According to Artopium Music Index, tirata is a

baroque ornament consisting of a long scale passage

Another source, that is actually referenceable, "Musica Poetica: Musical-Rhetorical Figures in German Baroque Music" by D. Bartel has

Tirata: a rapid scalar passage, spanning a fourth to an octave or more.

This book contains some historical categorizations and characterization of what kind of ornaments are there. However, it seems like the "ascendence or descendence sequence of rapid notes" is a pretty universal definition.
The Deutch Wiki and Russian musical encyclopedia might also be interesting sources. However, it is certainly a bit awkward to use this baroque ornament for Chopin's pieces, while it allows (in my mind) to distinguish between an arbitrary fioritura (as well pointed out by @Camille Goudeseune's answer) and an ornament that is strictly ascending in nature.
Comment: We just called them "runs" back in music school.


How long does it take to learn to play the violin to an intermediate level?

Question: I have always wanted to play Pirates of the Caribbean and other beautiful melodies on violin. For me, it is a nightmare to play anything on it.
I have a musical background (Electronic Producer). I know basic music theory and play the keyboard (beginner).
But when it comes to violin, I feel exhausted. Finger placement is my biggest issue: how to press a string without touching other, as the space between them is so small. I can't touch only one at a time except E and G, because they are first and last of course.
Bowing is not so difficult, but sometimes my bow jumps or bounces automatically.
I'm looking for some expert who can explain their journey, guide me and correct me, if I'm doing something wrong.
When I have time, I watch tutorials and stuff online. I do this sincerely and seriously, but either my fingers are too big or the space between the strings is too small.
I have 4*4, in case I didn't mention it before.
How long does it take to learn to play the violin to an intermediate level?
Comment: Violin is one of the hardest instruments to learn well and though I think it's possible to learn many instruments without a teacher, I'd strongly recommend a teacher for violin, at least for a few months or so, to get you started with the right habits.
Comment: You're looking for an expert to guide and correct you. That would be a teacher. They'll tell how long it will take you (anything between three years and never)
Answer: Each person's journey in learning an instrument is unique, so there is no standard answer to your question of how long it takes to learn intermediate level violin.  It would most likely take years of dedicated pratice.  If you do not have a teacher, then you might be picking up some bad habits that could be hard and frustrating to 'undo' at a later stage.  It is highly recommended to have a teacher.
That said, if you think your fingers are too big for the violin, have you considered playing the viola?
Comment: Hi, thanks for your answer. I think you're right but i really don't have time for it on regular basis so i can't have teacher. Secondly, about flingers, I'm 25 years old regular body, my fingers are normal but the point was, i have seen 60 years old guy playing it nicely. So is it just practice? And a teacher. Viola I don't want to play.
Comment: Yes.  Committed practice and a good teacher would give you a good chance of achieving your goal.  Your fingers will, with time, learn to make the tiniest adjustments to find the correct position of each note.  I strongly recommend doing lots of slow scales - slow enough that you can hear each note and adjust it  if needed to be in tune, and also slow enough to hear the quality and evenness of tone that you are producing.  You have to train your ears just as much as train your fingers.  Good luck and have fun with it.
Answer: Well, take a look at the sausage fingers on basically the only available portrait of J. S. Bach.  Still he was good enough on violin to write four-part solo fugues on it, and it's quite obvious that this wasn't a mere passing acquaintance: for most of the really complex passages, fingering instructions (added in modern editions) are redundant as there is just one execution making significant physical sense.
For much of violin music, touching unrelated strings is not much of an issue since it is mostly monophonic and you can make space "strategically" for phrases changing strings in a legato manner, using double stops, or relying on sympathetic vibration.
Of course, finger tip angle also plays into it: it tends to be more vertical than with, say, guitar, and the quite narrower finger/fret-board accommodates this.
Answer: I would strongly recommend having a course to help you out. The Suzuki method is great, and you don't  have to keep doing it forever if you don't want to, but it will certainly help you get started. All you have to do is buy the first book and work through it. The front of the book also has many helpful tidbits for beginners.
I would also recommend putting tapes on the neck of the violin to help with finger placement -at least until you develop muscle memory in your fingers to the point where you don't have to constantly look at your hand to know where they're supposed to go. This is something that just takes time, so keep working at it. It's really much easier to play the violin when you have developed fingers.
Also, make sure that you're touching the strings with just the tips of your fingers to avoid touching other strings. I know you may feel that your fingers are too big, but I know several excellent violinists with big fingers -my teacher included!
How to help your bouncing bow: try to evenly apply the pressure -you might have to apply more at the tip because the lower half is naturally pulled down by the weight of your hand.
Also make sure that your bow-hold is correct -this is a major part of learning how to play any string instrument and can be very heard to undo if you originally learn the wrong one.
Another thing to put into practice is to make sure that you are always keeping your bow straight. Practising in front of a mirror can help with that. Also rosin your bow frequently and make sure that it is the right tightness level.
One more thing -I'm not really sure what your definition of "intermediate" is, but I've been playing the violin for about 5 years, and I'd say it took about 3 to become intermediate, but every musician is different, so I can't really say how long it will take you.
Violin is something that comes with time, so just remember that it will get easier as your fingers become more agile. Just keep practising, and don't quit! A big thing to remember is to stay motivated and keep pushing yourself, because if you never try harder pieces of music, you won't get any better. Good luck!


Inner Join php para procurar em duas tabelas

Question: Preciso fazer a busca com o PHP dos dados digitados em duas tabelas MySQL, produtos e usuario.
Estou fazendo assim:
$array = array();

$query = mysqli_query($conn,"SELECT * FROM produtos inner JOIN usuario ON produtos.nome = usuario.nome
    WHERE produtos.nome LIKE '%{$query}%'");

     while($row=mysqli_fetch_assoc($query)) {
        $array[] = $row['nome'];
     }
     echo json_encode($array);

Mas não retorna nada na busca, como poderia resolver isso?
Estrutura do banco:
produtos
id | nome

usuario
id_usuario | nome

Tentei com o UNION como fui instruído aqui mas também não deu:
$query = mysqli_query($conn,"SELECT nome FROM produtos WHERE nome LIKE '%{$query}%' limit 5 UNION Select usuario FROM nome WHERE nome LIKE '%{$query}%' limit 5");

 while($row=mysqli_fetch_assoc($query)) {
    $array[] = $row['nome'];
 }
 echo json_encode($array);

Comment: Mas qual o resultado que espera obter? Todos os produtos cujo nome seja exatamente igual ao nome do usuário? Se for então use INNER JOIN, se não for então explique o que deseja.
Comment: Qual é a chave estrangeira que faz a relação entre as tabelas?
Comment: chave estrangeira no MySQL tipo InnoDB
Comment: Você precisa "fazer a busca em duas tabelas" ou precisa "buscar conforme a relação entre elas"? As duas tabelas não parecem ter relação, mas mesmo assim você fez um JOIN. O JOIN serve para tratar do relacionamento entre tabelas, não para unificar e fazer a busca.
Comment: De onde vem o valor de `$query` em `LIKE '%{$query}%'` para definir a variável `$query`? Isso está errado, não está!?
Comment: teria que ser com o UNION? como ficaria?
Comment: tentei com o UNION mas também não funcionou
Comment: Você tem que ter um campo na tabela de usuários/clientes que os relacione a tabela produto/mercadoria, por exemplo um campo `usuário.compra` cujo o valor é um `produtos.id`
Answer:
produtos.nome = usuario.nome

Seu join está pegando registros cujo nome do usuário é igual ao nome do produto.
No join, use os campos que estão relacionados, que não sei quais são pois não sei como está a estrutura dessas tabelas.
Comment: coloquei a estrutura no banco na pergunta
Comment: Tenho que pegar os registros digitados no formulario usei o WHERE produtos.nome LIKE '%{$query}%' nao seria isso?
Comment: Você tem um valor e precisa consultar se ele existe na tabela de produtos e também ver se existe na tabela de usuários?
Comment: isso usei o UNION mas não consegui
Comment: Se esse é o caso, você precisa de um `union` não de um `join`. No union que vc postou está `Select usuario FROM nome`....está invertido o campo e a tabela


Dump SVN file revisions for a repository

Question: I need a script to go through my working copy and for each file and folder dump its SVN revision and whether it is modified or not. Anything working out of the box?.. Need both Windows and Mac versions.
Answer: The
svn status -v --no-ignore

command should do exactly what you ask. (If you want to hide the unmodified files you can drop the -v. See svn help status for more options)


CSS, input no firefox mostra texto em branco

Question: No firefox o texto de minha input nao aparece, qual motivo? veja
http://jsfiddle.net/m8j873y8/
input {
    width: 100%;
    height: 35px;
    margin-bottom: 10px;
    color: #595959;
    padding-top: 17px;
    padding-right: 17px;
    padding-bottom: 17px;
    padding-left: 35px !important;
    box-sizing: border-box;
    background: none repeat scroll 0% 0% #FFF;
    border-radius: 5px;
    overflow: auto;
    outline: 0px none;
    border: 2px solid blue;
    font-size: 15px;
    transition: border 0.5s ease 0s;
    opacity: 1;
}

Answer: O teu problema, como referido pelo bfavaretto♦ é o fato de estares a indicar ao navegador que o tamanho da caixa de texto deve conter o padding e a border:
box-sizing: border-box;

Isto está a fazer com que o input fique com tamanho 0 (zero):

Como está sem tamanho, o que é escrito não aparece no mesmo, apesar de estar lá:

Animação do teu input a transitar de 35px altura para 55px de altura fazendo uso do inspetor do navegador.
Solução
Dado estares a fazer uso da propriedade box-sizing com o valor border-box, podes remover o padding-top e o padding-bottom do input que vais obter o mesmo resultado com a vantagem do texto ficar visível.
Como a altura do teu input é superior ao indicado na propriedade height do mesmo, alterei também no exemplo a altura de 35px para 38px:

input.old {
    width: 100%;
    height: 35px;
    margin-bottom: 10px;
    color: #595959;
    padding-top: 17px;
    padding-right: 17px;
    padding-bottom: 17px;
    padding-left: 35px !important;
    box-sizing: border-box;
    background: none repeat scroll 0% 0% #FFF;
    border-radius: 5px;
    overflow: auto;
    outline: 0px none;
    border: 2px solid blue;
    font-size: 15px;
    transition: border 0.5s ease 0s;
    opacity: 1;
}
input.new {
    width: 100%;
    height: 38px;
    margin-bottom: 10px;
    color: #595959;
    padding-right: 17px;
    padding-left: 35px !important;
    box-sizing: border-box;
    background: none repeat scroll 0% 0% #FFF;
    border-radius: 5px;
    overflow: auto;
    outline: 0px none;
    border: 2px solid blue;
    font-size: 15px;
    transition: border 0.5s ease 0s;
    opacity: 1;
}
<input type="text" class="old" value="Bubu está escondido">

<input type="text" class="new" value="Bubu está aqui!">

Exemplo também no JSFiddle.
Comment: Nossa, que complexo, nao sabia dessas regras, grande explicação, Obrigado!
Comment: Muito bem detalhado Zuul, a imagem animada com certeza explica muito bem o problema +1
Answer: O Firefox está respeitando o box-sizing que você indicou. Quando você usa border-box, a altura do elemento inclui bordas e padding. Tecnicamente você até ultrapassou a altura definida, e o Firefox está cortando a parte de dentro do elemento para respeitar a altura que você pediu:
 17px de padding-top
 17px de padding-bottom
  2px de border-top
  2px de border-botom
-----------------------
 38px no total (mais que os 35 que você definiu!)

Não sei qual é a aparência final desejada, mas as soluções passam por alterar o box-sizing (ou remover essa propriedade e usar o default), alterar o height ou reduzir os paddings.
Comment: A explicação sobre o `box-sizing` está muito correta, +1
Answer: O problema está no uso padding, ao usa-lo é como se você o ele move-se o texto excessivamente para fora da área de visão do próprio elemento
Se você remover o padding-top e o padding-bottom o texto irá aparecer, segue um exemplo comentando os "paddings":
input {
    width: 100%;
    height: 35px;
    margin-bottom: 10px;
    color: #595959;
    /*padding-top: 17px;
    padding-right: 17px;
    padding-bottom: 17px;*/
    padding-left: 35px !important;
    box-sizing: border-box;
    background: none repeat scroll 0% 0% #FFF;
    border-radius: 5px;
    overflow: auto;
    outline: 0px none;
    border: 2px solid blue;
    font-size: 15px;
    transition: border 0.5s ease 0s;
    opacity: 1;
}

Nota: Não é um bom usar padding-top e padding-bottom com um height fixo.
Answer: Acabei de testar e deu certo! Tenta isso. . .

input {
    width: 100%;
    height: 35px;
    margin-bottom: 10px;
    color: #595959;
    box-sizing: border-box;
    background: none repeat scroll 0% 0% #FFF;
    border-radius: 5px;
    overflow: auto;
    outline: 0px none;
    border: 2px solid blue;
    font-size: 15px;
    transition: border 0.5s ease 0s;
    opacity: 1;
}
<input type="text" value ="Hello World" >


Importing existing users into a new Drupal site

Question: We have an existing Drupal site that has a requirement to inherit about 10k users into, and we've been able to gather most of this data through CSV exports on the Database, and Views Export/VBO. What we have is two CSVs, one with usernames, password hashes, UIDs; the other with user field data and a UID to join/union the data during import. There are differences between the Field structure between the site data we inherited and the new site, so new data relationships will need to be established during the import, ruling out a direct port of the existing Database records.
I have no issues writing a Drush script that will import all the users with a joined CSV. What I am wondering is if its possible to import the user records, complete with the password strings within the Drupal User space. Looking at the user_save() method its not clear as if I can define the User ID, or password hash. And we have a lot of logic implemented that depends upon this
So the approach I have in my head is this:

Use SQL IN FILE to import the baseline minimum data to establish users in Drupal's users table: Username, Password Hash, created date, changed date, etc...
Use a second drush script to iterate through the field data, and update the user records with user_save() off UID.

Is there another approach I can use that's strictly Drush based? This assumes that the data I import will be with a Unioned CSV file. Not being able to adjust the UID probably means this isn't possible, but its worth asking.
Comment: I don't think that you could create new users with a specific UID. What you could do, however, is to create a new integer field to hold a user's old UID and use this field as reference to implement other functionalities that depend on the old UID. Or better, you can then write another script to update those functionalities so that they respect the new UID instead of the old one, then you can delete this old UID field.
Answer: It sounds like you're after the Feeds module! It supports mapping fields sources to destinations, and will auto-create entities in some cases.
After installing & enabling the module, you'll want to create a Feeds Importer (under Structure) and go from there. Navigate to /import to upload a CSV file to a feeds importer for processing.
There's a sandbox module Drush Feeds Import that should allow you to run some of this from the command line if necessary.
Check out:

  The site builder's guide to Feeds:

  https://www.drupal.org/node/622698

If the stock Feeds modules don't quite solve your problem, you could use the Feeds API to define your own processing class that manipulates and inserts the data into the new site.