Does using a Likert Scale require me to always measure the internal consistency?

Question: I am doing a Masters project (in environmental sociology) which includes a series of 15 questions that use a 6-point Likert scale to respond to various statements. In my pilot survey, my supervisor calculated Cronbach's alpha and said the internal consistency is too low (alpha = 0.63) and suggested I redo the questions.
Personally, I am confused about the need to assess the internal consistency in my research. The Likert Scales in my research assess a range of statements across different themes so the responses are not measuring/validating the same construct. If anything, the statements are designed to assess the potential variation in perceptions across those different themes.
My question is simple. If I use a Likert Scale, does that also require a high internal consistency even if the statements involve different themes?
Comment: Will you be combining any of your 15 questions into (an) overall score(s)?
Comment: @awhug - no I am not combining any of the questions. Each one is treated separately.
Answer: Not necessarily, no.  @Student100 gives good answer but misses one important point, measures of internal consistence assume that the measurements are theeffect of the construct, that is, are they caused by the construct. For example:

Whether you get a math question correct is caused by your math ability.
How you answer a question about having high self esteem is caused by your self esteem.

These are called effect indicators, because the indicator is the effect of the construct.
But your construct might have causal indicators. A causal indicator is the cause of the construct.  And it's often not clear:

I don't have many friends.
Sometimes I feel alone.

Are these the effect of loneliness (in which case alpha would be appropriate) or the cause of loneliness, in which case it is not appropriate.
A more extreme example is a measure of stress, which might look at events that happened to you recently, and how much they affected you:

Lost job
Death in family
Moved house
Been ill

There is not a construct of stress that is the cause of each of these things. Rather each of these things adds stress, and the more there are, the greater the impact.
The classic reference on this is  Bollen and Lennox (1991): https://www.researchgate.net/publication/232516427_Conventional_Wisdom_on_Measurement_A_Structural_Equation_Perspective - but there has been lots of work since.
Answer: Great question. As I am sure you know internal consistency is the extent to which items on an assessment/test/scales/survey measure the same thing. In a vacuum (i.e., irrespective of the item content), a higher value of Cronbach's $\alpha$ is preferable to a smaller one. This notion is reflected by the existence of various rules of thumb that are often used to indicate whether a particular value of Cronbach's $\alpha$ (or any other reliability measure for that matter). Common rules of thumb define values 0.9 $\ge$ as Excellent, values between 0.9 and 0.8 as Good, values between 0.8 and 0.7 as Acceptable, values between 0.7 and 0.6 as Questionable, values between 0.6 and 0.5 as Poor, and values < 0.5 as Unacceptable. I am not sure if your advisor was using similar rules of thumb to assess your survey, but is possible.
Now to your question.

If I use a Likert Scale, does that also require a high internal
consistency even if the statements involve different themes?

You are correct in asking this, as scales with higher values of $\alpha$ are not always ideal,  as it would indicate your construct is very narrow, and as a result, maybe not of much substantive interest. This is not to say your scale does not need to be reassessed (which can be done by removing items, adding items, or, as your advisor suggested - rewording items); it is just to say that how broad your construct is intended to be matters when choosing what value of $\alpha$ is acceptable for your application.
It should also be added that the reliability (regardless of how it is estimated, e.g., via $\alpha$, or latent variable models such as factor analysis and item response theory) of a construct (e.g., something related to environmental sociology) using the same set of items (i.e., your 15 items) will likely be different when administered to different populations. This should also be considered when evaluating estimates of $\alpha$. For instance, are you administering this survey to a sample of college students in majors unrelated to the environment? If this were the case, I could imagine lower sample estimates of $\alpha$ being observed when compared to a sample of students who are in a more related major (e.g., environmental studies). Because such students would likely have a less cohesive (i.e., less reliable) internal representation of environmental issues.
Finally, because your survey contains ordinal responses, I suggest you consider estimating internal consistency using Zumbo's ordinal $\alpha$$^1$ as it was designed for instances such as yours, where classical test theory (CTT) methods are used to assess reliability. See Gadermann, Guhn, & Zumbo (2012) and Zumbo, Gadermann, & Zeisser (2007) for more information on ordinal $\alpha$.
$^1$ Note that ordinal $\alpha$ is not without controversy. Recently, Chalmers (2018) made practical and theoretical arguments against the use of ordinal $\alpha$, positing that it is only useful as a theoretical exercise. However, like most psychometric arguments, there is strong disagreement (Zumbo and Kroc, 2019). Personally, I would use ordinal $\alpha$, though you should be fine using either.
References
Chalmers, R. P. (2018). On misconceptions and the limited usefulness of ordinal alpha. Educational and Psychological Measurement, 78(6), 1056-1071.
Gadermann, A. M., Guhn, M., & Zumbo, B. D. (2012). Estimating ordinal reliability for Likert-type and ordinal item response data: A conceptual, empirical, and practical guide. Practical Assessment, Research, and Evaluation, 17(1), 3.
Zumbo, B. D., Gadermann, A. M., & Zeisser, C. (2007). Ordinal versions of coefficients alpha and theta for Likert rating scales. Journal of modern applied statistical methods, 6(1), 4.
Zumbo, B. D., & Kroc, E. (2019). A measurement is a choice and Stevens' scales of measurement do not help make it: A response to Chalmers. Educational and Psychological Measurement, 79(6), 1184-1197.


How can I pass informations between the form and the user controls?

Question: I have a problem with my project. Since I do not like it that every Windows Form is a new window I did try to use an different way.
This way I did create an FormGUI which contains the menu and calls the different UserControls. Since we did only learn how to use Windows Forms I do know how to work with them. There I would have changed the constructor of the new Windows Form to pass Data.
But this time I use mainly one Windows Form and different UserControls.
e.g. I have one to add new data, an other one to show data in a datagrid and one to show the data inside of an chart. At least this is the result.
But I do not finde a way to transport informations from the Windows Form into one User Control and how to get them back. In order to use this knowlegde somewhere else.
Does someone knew a tutorial where I can see how it could work? Or could explain it to me.
Since the UI is part of the end project that will be marked I would prefer my new way. But if I can't find a work around I will need to change it so that I would work with different windows form. >_> But really... I do not want the application to open new windows for every task. I would prefer to only show the information in one page.
In my search I did found some tutorials about UI Design with Windows Form but only the design (where a chart would be placed it is only a picture) an not how this will work with real informations.
I hope you could understand my problem...
Answer: Let's assume that the constructor of the form is something like this
private List<MyData> _data;

public MyForm(List<MyData> data)
(
    ...
    _data = data;
)

Declare an interface
public IDataAware
{
    List<MyData> Data { get; set; }
}

and let the user controls implement it. E.g.
public MyDataGridUserControl : UserControl
{
    ...

    public List<MyData> Data {
        get { return (List<MyData>)dataGridView1.DataSource; }
        set { dataGridView1.DataSource = value }
    }
}

If you are working with a BindingSource, access the BindingSource instead of the grid control. Now, you can access all your user controls through the same interface. In the form you can create a field
private IDataAware _dataUserControl;

In a menu item click routine, you could do some thing like this
_dataUserControl = new MyDataGridUserControl();

in another one
_dataUserControl = new MyChartUserControl();

But all the user controls implementing IDataAware you can do
Controls.Add(_dataUserControl);
_dataUserControl.Data = _data;

Note: Forms, Controls and UserControls are just classes as any other class, and you can do all the object-oriented things with them as with any c# class. (There are some restrictions with generics, however.)
Comment: At first I thought I would understand it ... but I read it at the moment for mor than twenty times ... and somehow I'm stuck.

Okay, I now have an interface called IDatenBestand and I did implement it in the User Controls. But honestly I do not understand how I have to go from there.

I mean ... in the Form I have the original lsit and in the UserControl I want to add to this list or use information from it. But how do I know if the Form or the Control has the complete Information?

I do not know if it's time - I'm sitting here since 8 o'clock in the morning. Or something else.
Comment: Please add the relevant code to your question. So far I have to guess what you are doing and it's difficult to tell you more.


How to understand the "arriving rate" in a homogeneous Poisson process?

Question: We know that when the arriving rate of a Poisson process $X(t)$ becomes constant, then the process becomes a homogeneous Poisson process.
I have trouble understanding what "a constant arriving rate" means. My confusion largely arises from the fact that any ensemble $X(t_0)$ ($t_0$ is a constant) is in fact a random variable, implying the number of points arriving between $[0, t_0]$ is random.
Given that I can't even say for sure how many points arrive between $[0, t]$, how can I say I have "a constant arriving rate"?
In real life, what is an example case where we have a constant arriving rate, but we can't say for sure how many points will arrive for a known period of time? It just sounds contradictory to me.
Answer: Consider an analogous situation. Imagine you're tossing a completely fair coin. In a thousand tosses, the chance that you get 500 heads is about 2.5%, so almost every time you tried, the sample proportion of heads would differ from 50%.
We have to be careful to keep population quantities in our models conceptually separate from their sample equivalents.
"Constant arrival rate" is a statement about expected (i.e. population) quantities in a Poisson process model. If the model is correct, the actual observations will obviously still show variation about the expected arrival rate.
One example of a phenomenon that seems to be suitable for modelling as a Poisson process is the number of fast radio bursts over time (at least over short periods -- if we looked across many millions of years, the rate wouldn't be constant).
Answer: If the Poisson process has settled on a constant rate $\lambda$ then you can conceptualize it like this:

In the next $k$ time units you expect, on average, $k\lambda$ events to occur. This doesn't mean that this many events actually will occur ($k\lambda$ may not even be a whole number!) but this is the distinction between population and sample that @Glen_B was emphasising. Your (population) model for the number of events in the next $k$ time units is a Poisson distribution with parameter $k\lambda$. You could count the number of events in the next $k$ time units, then in the next $k$, then in the next, until you have a sample of the number of events occurring in $n$ time intervals. If your model of homogeneity is correct and $n$ is sufficiently large then the relative frequencies of no events, one event, two events etc will settle down close to the probabilities $\mathsf{P}(X=0)$, $\mathsf{P}(X=1)$, $\mathsf{P}(X=2)$  etc calculated from a $\text{Poisson}(k\lambda)$ distribution, and the mean count in an interval will be near to the $k\lambda$ you expected.
The expected time until the next event is $\lambda^{-1}$ and your model for the population those times are drawn from is exponential with parameter $\lambda$. If you sample a large number of events then you will find their inter-arrival times will have a mean value close to $\lambda^{-1}$ and their histogram will look very similar to the PDF of the theoretical $\text{Exp}(\lambda)$ distribution.

(You can read "time units" as "space units" for a spatial process.)


How to insert conditions into Global Custom Text?

Question: I am new to drupal and getting hang of it. I have a custom text in one of my view and I need to display the title based on a condition.
This is what I have right now,

[title] | [field_annual_number]

But I need to display this only if the title doesn't contains the work "multi".
So basically, the pseudo code is like this,
if([title].contains('multi')) then
 [title]
 else
 [title] | [ Field_annual_number]

Any help would be appreciated.
TIA.
Srividhya
Comment: Please tell us what Drupal version you're using as the answer will change.
Comment: Sorry. Forgot to mention that. I am using drupal 7. Thanks
Answer: Add the following code to the bottom of your template.php file (located in /sites/all/themes/yourtheme/ folder)
function themename_preprocess_views_view_fields($vars){

      if ($vars['view']->name == "view_name" && $vars['view']->current_display == "block_1"){

        if (strpos($vars['fields']['title']->content, 'multi') !== false) {
          $vars['fields']['title']->content = "
" . $vars['fields']['title']->content . "
";
        } else {
          $vars['fields']['title']->content = "
" . $vars['fields']['title']->raw . "|" . $vars['fields']['field_annual_number']->raw . "
";
       }

      }

    }

replace themename with your theme name
replace view_name with your view name
replace block_1 with your machine name

Once you update your template.php file, don't forget to clear/flush your cache in Drupal to see changes.
Comment: Oh yeah. I had to update the entire global text so used this variable $vars['fields']['nothing']->content. Clearing the cache did the charm. Thanks a lot for your help.
Comment: Thanks a lot. I am editing a block with in a view. This is the path, views/view/features_view/edit/block_5. Should I use the same method or anything different method. Thanks
Comment: @Srividhya the same method.
Comment: Thanks a lot. How do I replace the entire custom text? Based on the condition, I need to replace the custom text itself.
Comment: @Srividhya sorry forgot to get back to you on this, you got everything you wanted?


SVD with symmetric positive definite

Question: When the matrix is symmetric positive definite, I know it has positive eigenvalues.
With this condition, can we say the SVD of the matrix is unique?
To say SVD of a matrix is unique, as I know, it's needed to have distinct eigenvalues (up to signs).
But I'm not sure the condition (symmetric positive definite) guarantee that
Comment: You may want to take a look at [this](https://math.stackexchange.com/q/1805191/339790).
Answer: Observe that the identity matrix is positive definite and symmetric but it hasn't distinct eigenvalues
Answer: SVD is unique up to the diagonal singular value matrix when values are written in descending order. To see an example for square non-singular matrices, consider matrix $A=U\Sigma V^H$. Let $D$ be a diagonal matrix whose diagonal entries are points on the unit circle on the complex plane. Thus $DD^H = I$. Then, note that $$A=UDV^H=UD\Sigma D^HV^H = (UD) \Sigma (VD)^H$$ where $UD$ and $VD$ are unitary as well.
Comment: @RodrigodeAzevedo now?
Comment: Suppose that I flip the signs of both $u_1$ and $v_1$. Still unique? The idea is developed [here](https://math.stackexchange.com/q/1805191/339790).
Comment: I didn't mean to say SVD is unique. The only part of SVD that remains unique is the diagonal singular matrix (up to ordering). Singular vectors are not as mentioned in the answer.

SVD with symmetric positive definite


Compiler offers private constructor as a candidate in program code

Question: #include <iostream>

using namespace std;

class Test{
private:
    Test(int a, int b=0)
    {
        cout << "private constructor\n";
    }
public:
    Test(int a)
    {
        cout << "public constructor\n";
    }
};

int main()
{
    Test t(1);
}

When I attempted to compile the code gcc says:
test.cpp: In function 'int main()':
test.cpp:20:10: error: call of overloaded 'Test(int)' is ambiguous
  Test t(1);
          ^
test.cpp:12:2: note: candidate: Test::Test(int)
  Test(int a)
  ^
test.cpp:7:2: note: candidate: Test::Test(int, int)
  Test(int a, int b=0)
  ^
test.cpp:5:7: note: candidate: Test::Test(const Test&)
 class Test{
       ^

and clang says:
test.cpp:20:7: error: call to constructor of 'Test' is ambiguous
        Test t(1);
             ^ ~
test.cpp:7:2: note: candidate constructor
        Test(int a, int b=0)
        ^
test.cpp:12:2: note: candidate constructor
        Test(int a)
        ^
test.cpp:5:7: note: candidate is the implicit copy constructor
class Test{
      ^
1 error generated.

What is the reason of the ambiguity? Since Test(int,int) is private, it shouldn't be possible to call it in Test t(1). A possible answer is (what I thought initially), it makes two identical signatures of constructors possible, i.e Test() can be called with only one int in private constructor. But in the program code Test t(1) is only feasible for public constructors, so it shouldn't offer the private constructor as a candidate. Why does it say that?
Comment: same reason as this: http://stackoverflow.com/questions/39042240/why-is-a-public-const-method-not-called-when-the-non-const-one-is-private/39042574#39042574
Answer: It's ambiguous for an explicit reason, as according to the standard:
[class.access/5]

It should be noted that it is access to members and base classes that
  is controlled, not their visibility. Names of members are still
  visible, and implicit conversions to base classes are still
  considered, when those members and base classes are inaccessible. The
  interpretation of a given construct is established without regard to
  access control. If the interpretation established makes use of
  inaccessible member names or base classes, the construct is
  ill-formed.

And that visibility means that the compiler must consider both overloads for the construction, and they are equally good for the argument you passed.
Since the constructor is private, and therefore only accessible withing the scope of the class and its members, just remove the default parameter value. You can maintain this default value in your classes definition in other ways. For instance, by introducing a constant in the classes implementation file:
int const default_b = 0;

// ...

return Test{a, default_b};

Comment: A one liner refinement to the answer: name resolution happens before access privileges are checked. +1.


FullCalendar only appears on reload

Question: So I've been going crazy here. I'm pretty new to coding and have no idea how to fix this.
I'm making a rails 4 app using ruby 2 and arshaw's FullCalendar.
The correct scripts are appearing in the head. The JQuery script that calls the calendar is in the head. The calendar is working. The issue is that the calendar is in a different view that the user navigates to from a link in the header. The calendar does not appear but appears upon refreshing the page.
I have no idea why this is happening but I think it has something to do with the initializing script in the head requiring the existence of a div id='calendar'. It does not have this until the later view is called, whereupon I recall the script in the head and everything works.
I'll patch in as much code as I can here and the full code is available on:
https://github.com/joesus/MtgCal
So far I've tried using the controller to refresh the page but I can't figure out how to do this without it sending me into an infinite loop, also it only refreshes that part of the view so it doesn't help anyway.
I've tried using a js timeout but again that only seems to refresh part of the view and not the full page so it didn't work.
Here's my layout: application.html.erb
<!DOCTYPE html>

<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title><%= content_for?(:title) ? yield(:title) : "1311 York St" %></title>
<%= csrf_meta_tags %>
<%= render 'layouts/shim' %>
<%= stylesheet_link_tag "application", :media => "all" %>
<%= render 'layouts/device_specific' %>
<%= javascript_include_tag "application" %>

<%= render 'layouts/header' %>

      <%= bootstrap_flash %>
      <%= yield %>

<%= render 'layouts/footer' %>

Here's my script where I initalize the calendar:
/assets/javascripts/initialize.js
$(document).ready(function() {

// page is now ready, initialize the calendar...
//

$('#calendar').fullCalendar({
   events: 'http://www.google.com/calendar/feeds/.../public/basic',

      weekMode: 'liquid',

      height: 600,

      defaultView: 'agendaWeek',

      allDaySlot: false,

        header: {
                  left: 'title',
                  center: 'agendaDay,agendaWeek,month',
                  right: 'today prev,next'
        }

    });
});

This appears in local host in the head as:

And this is where I call the Calendar into existence: /views/layouts/static_pages/schedule.html.erb

Meetings

Basically I need to figure out someway to refresh the information in the head when I navigate to a view that renders in the main layout.
Any advice would be greatly appreciated. Again, whole thing is on github so maybe there's something I broke somewhere else that explains this.
Thanks,
Joe
Update:
I implemented Erowlin's solution and now my initalize.js looks like this:
$(document).on('ready page:load', function(){

$('#calendar').fullCalendar({

   events: 'http://www.google.com/calendar/feeds/..../public/basic',

      weekMode: 'liquid',

      height: 600,

      defaultView: 'agendaWeek',

      allDaySlot: false,

        header: {
                  left: 'title',
                  center: 'agendaDay,agendaWeek,month',
                  right: 'today prev,next'
        },

    windowResize: function(view) {
      if ($(window).width() < 514){
        $('#calendar').fullCalendar( 'changeView', 'agendaDay' );
      } else {
        $('#calendar').fullCalendar( 'changeView', 'agendaWeek' );
      }
    }
  });
});

It works beautifully and allows me to leave my schedule.html.erb view looking clean and beautiful.

Meetings

The windowResize callback was used to solve a different issue. More information here:
How Can I get Adam Shaw's fullCalendar to display responsively in a rails 4 app
Thanks again for the help.
Comment: Short update: I added the script in initialize.js to schedule.html.erb. Now it works like it should but when I check it out in the chrome developer tools it pauses and gives me a list of three breakpoints. I can resume script execution and everything seems to function correctly which is good on the surface. Be honest internet, how badly did I break this?
Answer: Short answer : TurboLink preloads each page so the ready event is not fired. Instead you have to add "page:load" even to your javascript, like this :
Coffeescript solution:
$(document).on 'ready page:load', ->
     // Your coffee script stuff

JQuery Solution :
$(document).on('ready page:load', function(){
     // Your stuff
}

Long answer :
Turbolink doesn't care about JQuery ready event and add new event. Here is a list of turbolink's events.
Turbolink preloads each page and the ready event is not fired. If you have a lot of javascript, you can use this library to add the "page:load" on all your JQuery stuff.
Comment: Thank you so much, before I implement this I wanted to check something. If everything is working when I call the script from the body, is there a good reason to reconfigure everything to put it into the head, or should I just be happy it's working and leave it alone? Sorry if this is kind of a noobish question.
Comment: Never be happy if it's "scotch solution", it 's your choice, but if you want to have something maintainable and scalable in the future, think about rewriting properly. And even for your personal progression, it's always enjoyable to have something you don't have to worry in the future "Does this new functionality can have side effect on my previous code ? ".

If my answer worked for you, please mark as "Asnwered" ;)
Comment: To be honest, I'm still not able to get it working. I have

It doesn't load the page at all. I added the gem 'jquery-turbolinks' but it crashes when I try to add //= require jquery.turbolinks to the application.js manifest file. Am I missing something simple here? Thanks again.
Comment: Yes, I mistyped, I edited my answer !
The right syntax is $(document).on('ready page:load', function(){ AND NOT $(document).on('ready', 'page:load', function(){

FullCalendar only appears on reload


Why python-journald-rsyslog seems to batch/dely log write?

Question: I intend to log a python script output.
Here what it looks like :
arm@stackoverflow > cat test.py
#!/usr/bin/python
from time import sleep
while True:
        print("Hello")
        sleep(1)

I try to use standard syslog way to handle logs, I therefore tried to configure JournalD & SystemD to send everything as Syslog:
arm@stackoverflow > cat /etc/systemd/journald.conf | grep -vP "^#"
[Journal]
ForwardToSyslog=yes

arm@stackoverflow > cat /etc/systemd/system/testservice.service
[Unit]
Description="Test service"
StartLimitIntervalSec=500
StartLimitBurst=10

[Service]
Type=Simple
Restart=on-failure
RestartSec=5s
ExecStart=/home/pi/test.py
StandardOutput=syslog
StandardError=syslog
SyslogIdentifier=testservice

[Install]
WantedBy=multi-user.target

Finally I use Debian's default Rsyslog to route my logs in some file:
arm@stackoverflow > tail -n1 /etc/rsyslog.conf
if $programname == 'testservice' then /var/log/testservice.log
arm@stackoverflow > sudo touch /var/log/testservice.log && sudo chmod a+rw /var/log

But when I start the whole, all logs seems to be clogged somewhere, and are releases at one hours after start (like a big despool):
arm@stackoverflow > sudo systemctl start testservice.service && sleep 30

Then:
arm@stackoverflow > tail /var/log/testservice.log #nothing

Tests:
arm@stackoverflow > sudo systemctl status testservice.service
● testservice.service - "Test service"
     Loaded: loaded (/etc/systemd/system/testservice.service; disabled; vendor preset: enabled)
     Active: active (running) since Tue 2023-02-21 09:20:06 CET; 1min 33s ago
arm@stackoverflow > ps aux | grep test
root     23488  0.0  0.6  13956  5968 ?        Ss   09:20   0:00 /usr/bin/python /home/pi/test.py

Do you know how to get these logs in realtime?
Misc. This is a test server on Raspberry Pi OS (ARM)
Comment: As Python to run unbuffered stdout, either run `-u`, or set `PYTHONUNBUFFERED=1` in env.
Comment: Please don't [cross post](https://serverfault.com/questions/1123389/why-python-journald-rsyslog-seems-to-batch-dely-log-write). As this obviously is not in a business environment I'm voting to close as off topic.
Comment: @GeraldSchneider ... Indeed this is for business purposes. I just anonymized/simplified content. If it should be elsewhere, please tell.
Answer: Thanks to @meuh, Adding flag -u to the python script did the trick.
I added it to the shebang line:
#!/usr/bin/python -u


does the given sequence always converge?

Question: Let {$u_n$} and {$v_n$} be two null sequences . Is the sequence {$u_n^{v_n}$} (if the sequence define) always convergent and bounded?
As $u_n$ tends to $0$ as $n$ tends to infinity. then for a given $0<r<1$ there exists a natural number $k$ such that $|u_n|<r$ for all $n>k$ now if $v_n\ge0$ then $u_n^{v_n}\le r^{v_n}$ for all $n>k$ in that case $\lim u_n^{v_n}\le1$. please help me ? there may be mistake in my approach.
Comment: Try $u_n=1/n$, $v_n=-1/\log\log n$.
Comment: @AjoyJana, in Gerry Myerson's example $v_n \ln u_n = \frac{\ln n}{\ln \ln n} \to +\infty$, so ${u_n}^{v_n} = e^{v_n \ln u_n} \to +\infty$.
Comment: then $u_n$^$v_n$>$n$^$(1/n)$ and it is alawas >1.. what can you say about conver gence and bddness.  @ Gerry myerson
Comment: thanks all of you for helping me....
Answer: I guess the cat is out of the bag, so I'll flesh out my hint into an answer. Let $$u_n={1\over n},\quad v_n=-{1\over\log\log n}$$ Then $$\log(u_n^{v_n})={\log n\over\log\log n}\to\infty$$ as $n\to\infty$, so $u_n^{v_n}$ is unbounded.


Proper Imputation and bias-correction on degrading signal with Kalman Filtering?

Question: A signal degrades in its quality. Some signals are far more robust to degradation while others are not. We will simulate degradation by randomly removing values from a function and then applying Kalman-filter on the missing values. Some functions such as Sin are very bad to random degradation, losing the trend very quickly and joining subcycles together. Then again some signals are far more robust to random degradation which I want to understand better.
If the end-signal always end up to about the same signal, how can you describe degradation-prone signal? Robust?
Helper questions

Which Kalman filter should you build to correct the signal properly?
What would be the proper imputation techniques to correct the randomly-removed values? Structural timeseries with R's DLM package or ImputeTS::na.kalman (this looks bad as demonstrated in the example below)?
The bias-correction with the Kalman -filtering, whatever chosen, introduces some bias, how to quantify that?

Simple Example about degrading signal corrected with ImputeTS::na.kalman where corrections not good
We show a signal that can preserve the shape only very little, namely Sin fuction.
library(imputeTS)

si<-sin(1:4000/100)
for(xx in 1:5) {
  is.na(si) <- sample(length(si), 0.7*length(si))
  plot(na.kalman(si)); Sys.sleep(2)
}

Degradation of the trend is already obvious, two periods joined together after the K-filtering

Degradation of the timeseries is more serious, many trends joined together, very bad robustness to degradation with Sin function
Comment: I'm probably a bit slow but don't really understand what your question is about.
Comment: @JarleTufto I clarified the question, does it make more sense now?
Comment: Probably way too late, but did you try the different parameter options of the na_kalman function, see here: https://www.rdocumentation.org/packages/imputeTS/versions/3.0/topics/na_kalman
Answer: I am unable to answer the question but I provide some related material on Kalman filtering, that are less prone to numerical instabilities. I am not sure yet whether the instability of the signal is due to the package so trying other packages to filter the signal to see what happens may help.
Possibly related concepts

detectablity
stabilizability
the rank of the controlability / observability matrices
Gramians
timeinvariant control

Further reading

I would have a look at DLM vignette since "naive implementations of the Kalman filter are known to suffer from numerical instability for general DLM" that is designed particularly for Bayesian MCMC applications.
Other packages in R for Kalman filtering, R code for time series forecasting using Kalman filter


Trino-ranger plugin not working on Trino 405 and Ranger 1.2.0

Question: When trying to restart Trino 405 after installing Trino-ranger plugin on ranger 1.2.0 getting below error.
<code>2023-06-24T01:28:06.086-0400    INFO    main    com.google.inject.Guice An exception was caught and reported. Message: java.lang.reflect.InaccessibleObjectException: Unable to make protected final java.lang.Class java.lang.ClassLoader.defineClass(java.lang.String,byte[],int,int,java.security.ProtectionDomain) throws java.lang.ClassFormatError accessible: module java.base does not "opens java.lang" to unnamed module @6e997547
java.lang.IllegalStateException: Unable to load cache item
        at com.google.inject.internal.cglib.core.internal.$LoadingCache.createEntry(LoadingCache.java:79)
        at com.google.inject.internal.cglib.core.internal.$LoadingCache.get(LoadingCache.java:34)
        at com.google.inject.internal.cglib.core.$AbstractClassGenerator$ClassLoaderData.get(AbstractClassGenerator.java:116)
        at com.google.inject.internal.cglib.core.$AbstractClassGenerator.create(AbstractClassGenerator.java:291)
        at com.google.inject.internal.cglib.reflect.$FastClass$Generator.create(FastClass.java:65)
        at com.google.inject.internal.BytecodeGen.newFastClassForMember(BytecodeGen.java:258)
        at com.google.inject.internal.BytecodeGen.newFastClassForMember(BytecodeGen.java:207)
        at com.google.inject.internal.ProviderMethod.create(ProviderMethod.java:69)
        at com.google.inject.internal.ProviderMethodsModule.createProviderMethod(ProviderMethodsModule.java:272)
        at com.google.inject.internal.ProviderMethodsModule.getProviderMethods(ProviderMethodsModule.java:116)
        at com.google.inject.internal.ProviderMethodsModule.configure(ProviderMethodsModule.java:100)
        at com.google.inject.spi.Elements$RecordingBinder.install(Elements.java:344)
        at com.google.inject.spi.Elements$RecordingBinder.install(Elements.java:353)
        at com.google.inject.spi.Elements.getElements(Elements.java:103)
        at com.google.inject.internal.InjectorShell$Builder.build(InjectorShell.java:137)
        at com.google.inject.internal.InternalInjectorCreator.build(InternalInjectorCreator.java:103)
        at com.google.inject.Guice.createInjector(Guice.java:87)
        at io.airlift.bootstrap.Bootstrap.initialize(Bootstrap.java:262)
        at org.apache.ranger.authorization.trino.authorizer.RangerSystemAccessControlFactory.create(RangerSystemAccessControlFactory.java:53)
        at io.trino.security.AccessControlManager.createSystemAccessControl(AccessControlManager.java:181)
        at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:197)
        at java.base/java.util.Collections$2.tryAdvance(Collections.java:4853)
        at java.base/java.util.Collections$2.forEachRemaining(Collections.java:4861)
        at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509)
        at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499)
        at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:921)
        at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
        at java.base/java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:682)
         at io.trino.security.AccessControlManager.loadSystemAccessControl(AccessControlManager.java:150)
        at io.trino.server.Server.doStart(Server.java:157)
        at io.trino.server.Server.lambda$start$0(Server.java:88)
        at io.trino.$gen.Trino_405____20230624_052740_1.run(Unknown Source)
        at io.trino.server.Server.start(Server.java:88)
        at io.trino.server.TrinoServer.main(TrinoServer.java:38)
Caused by: java.lang.ExceptionInInitializerError
        at com.google.inject.internal.cglib.core.$DuplicatesPredicate.evaluate(DuplicatesPredicate.java:104)
        at com.google.inject.internal.cglib.core.$CollectionUtils.filter(CollectionUtils.java:52)
        at com.google.inject.internal.cglib.reflect.$FastClassEmitter.<init>(FastClassEmitter.java:69)
        at com.google.inject.internal.cglib.reflect.$FastClass$Generator.generateClass(FastClass.java:77)
        at com.google.inject.internal.cglib.core.$DefaultGeneratorStrategy.generate(DefaultGeneratorStrategy.java:25)
        at com.google.inject.internal.cglib.core.$AbstractClassGenerator.generate(AbstractClassGenerator.java:329)
        at com.google.inject.internal.cglib.core.$AbstractClassGenerator$ClassLoaderData$3.apply(AbstractClassGenerator.java:93)
        at com.google.inject.internal.cglib.core.$AbstractClassGenerator$ClassLoaderData$3.apply(AbstractClassGenerator.java:91)
        at com.google.inject.internal.cglib.core.internal.$LoadingCache$2.call(LoadingCache.java:54)
        at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
        at com.google.inject.internal.cglib.core.internal.$LoadingCache.createEntry(LoadingCache.java:61)
        ... 33 more
Caused by: com.google.inject.internal.cglib.core.$CodeGenerationException: java.lang.reflect.InaccessibleObjectException-->Unable to make protected final java.lang.Class java.lang.ClassLoader.defineClass(java.lang.String,byte[],int,int,java.security.ProtectionDomain) throws java.lang.ClassFormatError accessible: module java.base does not "opens java.lang" to unnamed module @6e997547
        at com.google.inject.internal.cglib.core.$ReflectUtils.defineClass(ReflectUtils.java:464)
        at com.google.inject.internal.cglib.core.$AbstractClassGenerator.generate(AbstractClassGenerator.java:336)
        at com.google.inject.internal.cglib.core.$AbstractClassGenerator$ClassLoaderData$3.apply(AbstractClassGenerator.java:93)
        at com.google.inject.internal.cglib.core.$AbstractClassGenerator$ClassLoaderData$3.apply(AbstractClassGenerator.java:91)
        at com.google.inject.internal.cglib.core.internal.$LoadingCache$2.call(LoadingCache.java:54)
        at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
        at com.google.inject.internal.cglib.core.internal.$LoadingCache.createEntry(LoadingCache.java:61)
        at com.google.inject.internal.cglib.core.internal.$LoadingCache.get(LoadingCache.java:34)
        at com.google.inject.internal.cglib.core.$AbstractClassGenerator$ClassLoaderData.get(AbstractClassGenerator.java:116)
        at com.google.inject.internal.cglib.core.$AbstractClassGenerator.create(AbstractClassGenerator.java:291)
        at com.google.inject.internal.cglib.core.$KeyFactory$Generator.create(KeyFactory.java:221)
        at com.google.inject.internal.cglib.core.$KeyFactory.create(KeyFactory.java:174)
        at com.google.inject.internal.cglib.core.$KeyFactory.create(KeyFactory.java:157)
        at com.google.inject.internal.cglib.core.$KeyFactory.create(KeyFactory.java:149)
        at com.google.inject.internal.cglib.core.$KeyFactory.create(KeyFactory.java:145)
        at com.google.inject.internal.cglib.core.$MethodWrapper.<clinit>(MethodWrapper.java:23)
        ... 44 more
Caused by: java.lang.reflect.InaccessibleObjectException: Unable to make protected final java.lang.Class java.lang.ClassLoader.defineClass(java.lang.String,byte[],int,int,java.security.ProtectionDomain) throws java.lang.ClassFormatError accessible: module java.base does not "opens java.lang" to unnamed module @6e997547
        at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:354)
        at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:297)
        at java.base/java.lang.reflect.Method.checkCanSetAccessible(Method.java:199)
        at java.base/java.lang.reflect.Method.setAccessible(Method.java:193)
        at com.google.inject.internal.cglib.core.$ReflectUtils$1.run(ReflectUtils.java:61)
        at java.base/java.security.AccessController.doPrivileged(AccessController.java:569)
        at com.google.inject.internal.cglib.core.$ReflectUtils.<clinit>(ReflectUtils.java:52)
        at com.google.inject.internal.cglib.reflect.$FastClassEmitter.<init>(FastClassEmitter.java:67)
        ... 41 more

2023-06-24T01:28:06.105-0400    ERROR   main    io.trino.server.Server  java.lang.IllegalStateException: Unable to load cache item
com.google.common.util.concurrent.UncheckedExecutionException: java.lang.IllegalStateException: Unable to load cache item
        at com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2050)
        at com.google.common.cache.LocalCache.get(LocalCache.java:3952)
        at com.google.common.cache.LocalCache.getOrLoad(LocalCache.java:3974)
        at com.google.common.cache.LocalCache$LocalLoadingCache.get(LocalCache.java:4958)
        at com.google.common.cache.LocalCache$LocalLoadingCache.getUnchecked(LocalCache.java:4964)
        at com.google.inject.internal.FailableCache.get(FailableCache.java:51)
        at com.google.inject.internal.ConstructorInjectorStore.get(ConstructorInjectorStore.java:48)
        at com.google.inject.internal.ConstructorBindingImpl.initialize(ConstructorBindingImpl.java:155)
        at com.google.inject.internal.InjectorImpl.initializeBinding(InjectorImpl.java:581)
        at com.google.inject.internal.AbstractBindingProcessor$Processor$1.run(AbstractBindingProcessor.java:176)
        at com.google.inject.internal.ProcessedBindingData.initializeBindings(ProcessedBindingData.java:49)
        at com.google.inject.internal.InternalInjectorCreator.initializeStatically(InternalInjectorCreator.java:122)
        at com.google.inject.internal.InternalInjectorCreator.build(InternalInjectorCreator.java:106)
        at com.google.inject.Guice.createInjector(Guice.java:87)
        at io.airlift.bootstrap.Bootstrap.initialize(Bootstrap.java:262)
        at org.apache.ranger.authorization.trino.authorizer.RangerSystemAccessControlFactory.create(RangerSystemAccessControlFactory.java:53)
        at io.trino.security.AccessControlManager.createSystemAccessControl(AccessControlManager.java:181)
        at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:197)
        at java.base/java.util.Collections$2.tryAdvance(Collections.java:4853)
        at java.base/java.util.Collections$2.forEachRemaining(Collections.java:4861)
        at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509)
        at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499)
        at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:921)
        at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
        at java.base/java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:682)
        at io.trino.security.AccessControlManager.loadSystemAccessControl(AccessControlManager.java:150)
        at io.trino.server.Server.doStart(Server.java:157)
        at io.trino.server.Server.lambda$start$0(Server.java:88)
        at io.trino.$gen.Trino_405____20230624_052740_1.run(Unknown Source)
        at io.trino.server.Server.start(Server.java:88)
        at io.trino.server.TrinoServer.main(TrinoServer.java:38)
Caused by: java.lang.IllegalStateException: Unable to load cache item
        at com.google.inject.internal.cglib.core.internal.$LoadingCache.createEntry(LoadingCache.java:79)
        at com.google.inject.internal.cglib.core.internal.$LoadingCache.get(LoadingCache.java:34)
        at com.google.inject.internal.cglib.core.$AbstractClassGenerator$ClassLoaderData.get(AbstractClassGenerator.java:116)
        at com.google.inject.internal.cglib.core.$AbstractClassGenerator.create(AbstractClassGenerator.java:291)
        at com.google.inject.internal.cglib.reflect.$FastClass$Generator.create(FastClass.java:65)
        at com.google.inject.internal.BytecodeGen.newFastClassForMember(BytecodeGen.java:258)
        at com.google.inject.internal.BytecodeGen.newFastClassForMember(BytecodeGen.java:207)
        at com.google.inject.internal.DefaultConstructionProxyFactory.create(DefaultConstructionProxyFactory.java:49)
        at com.google.inject.internal.ProxyFactory.create(ProxyFactory.java:156)
        at com.google.inject.internal.ConstructorInjectorStore.createConstructor(ConstructorInjectorStore.java:92)
        at com.google.inject.internal.ConstructorInjectorStore.access$000(ConstructorInjectorStore.java:29)
        at com.google.inject.internal.ConstructorInjectorStore$1.create(ConstructorInjectorStore.java:37)
        at com.google.inject.internal.ConstructorInjectorStore$1.create(ConstructorInjectorStore.java:33)
        at com.google.inject.internal.FailableCache$1.load(FailableCache.java:40)
        at com.google.common.cache.LocalCache$LoadingValueReference.loadFuture(LocalCache.java:3528)
        at com.google.common.cache.LocalCache$Segment.loadSync(LocalCache.java:2277)
        at com.google.common.cache.LocalCache$Segment.lockedGetOrLoad(LocalCache.java:2154)
        at com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2044)
        ... 30 more
Caused by: java.lang.NoClassDefFoundError: Could not initialize class com.google.inject.internal.cglib.core.$MethodWrapper
at com.google.inject.internal.cglib.core.$DuplicatesPredicate.evaluate(DuplicatesPredicate.java:104)
        at com.google.inject.internal.cglib.core.$CollectionUtils.filter(CollectionUtils.java:52)
        at com.google.inject.internal.cglib.reflect.$FastClassEmitter.<init>(FastClassEmitter.java:69)
        at com.google.inject.internal.cglib.reflect.$FastClass$Generator.generateClass(FastClass.java:77)
        at com.google.inject.internal.cglib.core.$DefaultGeneratorStrategy.generate(DefaultGeneratorStrategy.java:25)
        at com.google.inject.internal.cglib.core.$AbstractClassGenerator.generate(AbstractClassGenerator.java:329)
        at com.google.inject.internal.cglib.core.$AbstractClassGenerator$ClassLoaderData$3.apply(AbstractClassGenerator.java:93)
        at com.google.inject.internal.cglib.core.$AbstractClassGenerator$ClassLoaderData$3.apply(AbstractClassGenerator.java:91)
        at com.google.inject.internal.cglib.core.internal.$LoadingCache$2.call(LoadingCache.java:54)
        at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
        at com.google.inject.internal.cglib.core.internal.$LoadingCache.createEntry(LoadingCache.java:61)
        ... 47 more
</code>
Answer: Last version of ranger is working with trino 402. So, you cannot use higher version of trino for now.


A decision making probability question

Question: I have a problem that goes like this:
"At a certain company, the decision making follows the next scheme:
Every proyect proposal first goes to A. If he aproves it, the proposal goes to  B, C and D. If B or D approve it, the proposal goes to E. If E or C approve the proposal, it goes to F. The proposal is accepted only if it reaches F and She approves it.
The probability that A, C, and F aproving a proposal is 0.5, ahíle the probability of B,D and E aproving a proposal i.   s 0.7. Also, the decisions taken by A, B, C, D, E and F aré independent.
A) What is the probability that a certain proposal is approved?
B) If a proyect is aproved, which is the probability that it goes through E?
C) if a proyect is approved, which is the probability that it goes through C and he approves it?"
I defined an event S: "the proposal is approved" , and observed that there are three possible ways to get through S. So i defined another 3 events:
C1: A -> C -> F,
C2: A -> B -> E -> F,
C3: A -> D -> E -> F,
Is it Ok to say that P(S) = P(C1 U C2 U C3)?
After that, I calculated P(C1) = P(F|C|A) = P(F)P(C)P(A) (because the events are independent), but then, P(c1) = 1.5, which i don't like, because 1.5>0. Same thing happens When i calculate P(c2)' and P(c3)...
P(C1 U C2 U C3) = P(C1)  + P(C2) + P(C3) - P(C1 Int C2) - P(C1 Int C3) - P(C2 Int C3) + P(C1 Int C2 Int C3) = P(C1)  + P(C2) + P(C3), because, as I understand, C1, C2 and C3 are mutually exclusive events. This would make the probability greater than 0. I would appreciate that You make me know What kind of lies i'm making, or guise me a little bit.
Thanks in advance
Comment: How many of us will recognize that the problem is about our university?
Comment: Why are C1, C2, and C3 mutually exclusive?  Can't B,C,D, and E all approve it?
Answer: Hint:  $C_1$ requires three events to all happen, so it is the product, not the sum, of the probabilities of each event.  That will solve your probability being greater than $1$.  It is OK to say $P(S) = P(C1 \cup C2 \cup C3)$, but the events are not mutually exclusive so you can not just add the probabilities of the three.  You have to have $A$ and $F$, so you can distribute them out and multiply them by the probability that at least one of your inner chains approves.
Comment: So is it ok to say that P(C1 int C2) = P(A)P(F)[P(C) + P(B)P(E)]?
Comment: No.  One fix would be to make the + an int.  I am not sure that helps.  Another fix would be to make it union, not int on the left.  In that case, on the right the + should be union because it is possible that B,C,E all approve.  To use + you need to make sure the possibilities are exclusive.
Comment: Do You mean that P(C1 int C2) = P(A)P(F)[P(C int (B intE)] ?
Comment: Yes, that is correct.  To get both C1 and C2, you need all of A,F,C,B,E

A decision making probability question


Numbers with a unique partition as a sum of two squares

Question: The well known Ramanujan tau function $\tau(n)$ is defined as the nth Fourier coefficient of the modular discriminant
$\displaystyle \Delta(q)=q\prod_{m=1}^\infty (1-q^m)^{24} = \sum_{n=1}^\infty \tau(n)\,q^n\tag{1a}$
In the spirit of my previous posts( here (1) and here (2) for example) concerning the parity of certain coefficients of modular forms, I was naturally led to investigate this subsequent conjecture
Let us introduce the following convolution identity, see here (3)
$\displaystyle\Big(\sum_{n=1}^{\infty} \tau(n) q^n\Big)^2+\sum_{n=1}^{\infty} \tau^2(n) q^{2n}=2\sum_{n=0}^{\infty} \sum_{k=0}^{n} \tau(k+1) \Big(\tau(2n-k+1) q^{2n+2}+\tau(2n-k+2) q^{2n+3}\Big) \tag{1b}$
Think of it as a generalisation of the cauchy product and power sum symmetric polynomials. In generalc consider a sequence of complex terms $a_0, a_1, a_2,...$, then the ff convolution identity holds
$\displaystyle\Big(\sum_{n=1}^{\infty} a_{n}\Big)^2+\sum_{n=1}^{\infty} a^2_{n}=2\sum_{n=0}^{\infty} c_{n}$
where  $\displaystyle c_{n}=\sum_{k=0}^{n} a_{k+1} \Big(a_{2n-k+1}+a_{2n-k+2}\Big)$
given of course that the sums $\displaystyle\Big(\sum_{n=1}^{\infty} a_{n}\Big)^2$  and $\displaystyle\sum_{n=1}^{\infty} a^2_{n}$ converge.
A little bit of experimentation leads one to the ff conjecture

The nth coefficient in the partial sum of the series $\displaystyle \sum_{n=0}^{\infty} \sum_{k=0}^{n} \tau(k+1)\Big(\tau(2n-k+1) q^{2n+2}+\tau(2n-k+2) q^{2n+3}\Big)\tag{1c}$ is odd if and only if the power of its last term is $\stackrel{\mathrm{def}}{=}2z$ where $z\equiv 1\pmod{4}$ with a unique partition as a sum of two squares $x^2+y^2$, a sequence of integers $\color{orange}{1}, \color{orange}{5}, \color{orange}{9}, \color{orange}{13}, \color{orange}{17}, \color{orange}{29}, \color{orange}{37},....$ which can readily be found in this oeis entry

$\displaystyle \sum_{n=0}^{\infty} \sum_{k=0}^{n} \tau(k+1)\Big(\tau(2n-k+1) q^{2n+2}+\tau(2n-k+2) q^{2n+3}\Big)=q^{2×\color{orange}{1}}-24q^3+828q^4-7520q^5+103662q^6-492912q^7+3512352q^8-8147520q^9+25870905q^{2×\color{orange}{5}}+19335800q^{11}-193971120q^{12}+6341175146q^{13}-465787812q^{14}-2153273040q^{15}+12714981120q^{16}-11761115712q^{17}-6692143617q^{2×\color{orange}{9}}+68609297160q^{19}-....$
Question: How do we prove it?
Modified conjecture
Following Somos' proof, the original conjecture may be modified as follows
The nth coefficient of the partial series of $(1c)$ is odd if and only if $r(n)$ the number of integer solutions $n=x^2+y^2$ where $0< x \le y$ is odd since
$\displaystyle \sum_{n=0}^{\infty} \sum_{k=0}^{n} \tau(k+1)\Big(\tau(2n-k+1) q^{2n+2}+\tau(2n-k+2) q^{2n+3}\Big) \equiv \sum_{n=1}^\infty r(n)q^n \pmod 2$
By using the RHS of our convolution identity (1b) we can determine every nth coefficient of the LHS with ease. For example let us determine the counterexample( spotted by Somos) to the unmodified stated conjecture
$\displaystyle \sum_{k=0}^{424} \tau(k+1)\tau(849-k)q^{850}=-90512663966015166416921687775q^{850}$
Comment: Why is the exponent in $q^{10}$ red?
Comment: @martycohen: To indicate that the colored exponent is $(2×z)$ where z is a number with a unique partition as a sum of two squares, for example in the case of $q^{10}$ the exponent is $(2×5)$ where $5$ is such a number and in the case of $q^{18}$ such a number is obviously $9$
Answer: The question asks about a conjecture that is almost correct.
A key idea is the relation between two $q$-series expansions as follows.
Define the Ramanujan $\,\psi\,$ function (generating function of
OEIS sequence A010054)
$$ \psi(q) := \sum_{k=0}^\infty q^{k(k+1)/2} = \prod_{k=1}^\infty
\frac{(1 - q^{2k})^2}{1-q^k} = 1 + q + q^3 + q^6 + \cdots. \tag1 $$
Compare this to $\,f(-q)^3\,$ (generating function of
OEIS sequence A010816)
defined by
$$ f(-q)^3 := \prod_{k=1}^\infty (1-q^k)^3 = \sum_{k=1}^\infty
(-1)^k (2k\!+\!1)\,q^{k(k+1)/2} = 1 - 3q + 5q^3 - 7q^6 + \cdots. \tag2 $$
Verify that the coefficients of these two $q$-series have the same parity.
Now inflate both series using $\,q\to q^8\,$ as follows
$$ T(q) := q\,\psi(q^8) = \sum_{k=0}^\infty q^{(2k+1)^2} =
 \sum_{n=1}^\infty t(n)\,q^n = q + q^9 + q^{25} + q^{49} + \cdots. \tag3 $$
and similarly
$$ q\,f(-q^8)^3 = q\prod_{k=1}^\infty (1-q^{8k})^3 =
 q - 3q^9 + 5q^{25} - 7q^{49} + \cdots. \tag4 $$
As before, the coefficients of these two $q$-series have the same parity.
Now define $\,\Delta(q)\,$ (generating function of
OEIS sequence A000594) with
$$ \Delta(q) := q\,f(-q)^{24} = q\,(f(-q)^8)^3 = \sum_{n=1}^\infty \tau(n)\,q^n
 = q - 24q^2 + 252q^3 - \cdots. \tag5 $$
Verify that the coefficients of the polynomials $\,(1-q)^8\,$ and
$\,(1-q^8)\,$ have the same parity.
Combine all previous parity results.
They imply that $\,T(q)\,$ (from equation $(3)$) and
$\,\Delta(q)\,$ (from equation $(5)$) have the same parity.
The question links to
MSE question 2408529
and my answer to that question is relevant here.
Lemma: Given a sequence $\,a_1,a_2,a_3,\dots,\,$ and that the power sums
$$ S_1:=\sum_{i}a_i,\;\; S_2:=\sum_ia_i^2\;\;
 \text{ converge, then }\;\;
 S_1^2+S_2=2\sum_{i\le j}a_ia_j. \tag6 $$
Let $\,r(n)\,$ be the number of integer solutions $\,n = x^2 + y^2\,$
where $\,0 < x \le y.\,$ Its g.f. is
$$ R(q) := \Big(T(q)^2 + \sum_{n=1}^\infty t(n)^2q^{2n}\Big)/2 =
 \sum_{n=1}^\infty r(n)\,q^n. \tag7 $$
Apply the equation $(6)$ lemma to the series in equations $(3)$ and $(5)$
to get the result that
$$ \Big(\Delta(q)^2 + \sum_{n=1}^\infty \tau(n)^2q^{2n}\Big)/2 \equiv R(q)
 \pmod 2 . \tag8 $$
Notice that the coefficient of $q^{2\cdot 425}$ on the left side of equation
$(8)$ is $-90512663966015166416921687775$ which is odd while
$\,r(2\cdot 425) = 3 > 1\,$ because
$425 = 5^2 + 20^2 = 8^2 + 19^2 = 13^2 + 16^2$.
Thus $\,425\,$ does not have a unique partition into sum of two squares.
This is a counterexample to the unmodified stated conjecture.


Data doesn't update when pressing enter on the search

Question: I'm using the Open Weather API to learn some NextJS.
On my staging site, when you search for a city such as Paris, neither the map, time, nor the headings update. However, the strange thing is that when I test this on my localhost machine, it works as expected, but it doesn't work on Netlify.
If you have Redux Devtools installed, you'll notice that my search query is working, but the page doesn't update when pressing the enter key on the keyboard.
Would anyone have any experience as to why my search is not working on my staging site, but works on my localhost?
Thank you for your help!
Comment: The page at `https://bn-open-weather-app.netlify.app/` was loaded over HTTPS, but requested an insecure resource `http://api.openweathermap.org/data/2.5/weather?q=Calgary&appid=7b8a500a88e8350595f27158da3190df`. **This request has been blocked; the content must be served over HTTPS.** -- the error is self explanatory. Change `http` in API calls to `https`. You can also remove the protocol, `//api.open...` will also work fine. It works on localhost, because you are accessing your site using `http` there; hence there is no "mixed content".
Answer: I learned from user brc-dd that I need to serve my fetches from https or // to make my app work.
Thanks a lot!


Will higher version Matlab work on windows 7 (32bit OS)

Question: Matlab has version 7 series (7.0,7.1 upto 7.14) and now 8 series. Someone told MATLAB 7.8 (R2009a) only works with windows 7 and higher matlab version will not work with windows-7 32bit OS. Is it true ?
I am having windows-7 32bit OS. I wants to install recent version of Matlab software. Which higher version of matlab I can install ? And what about window-8 32bit OS ? Thanks in advance...
Answer: It is not true, the latest Matlab definitely runs on Windows 7 and much older Windows versions too: http://www.mathworks.com/support/sysreq/current_release/


Resolve into partial fractions, hence calculate the volume obtained

Question: Can someone please help me with this question?
a. Resolve $\frac{3x}{x^2-4}$ into partial fractions.
b. Hence calculate the volume obtained when the graph of y = $\frac{3}{x^2-4}$ is revolved around the y - axis between $x = 3$  and $x = 5$
I've resolved into partial fractions to get $\frac{3}{2(x+2)}$ + $\frac{3}{2(x-2)}$
I have an equation to calculate the volume when revolved around the y - axis but im not sure where to go from here when using partial fractions.
The volume equation is  Vy = $2\pi $$\int_a^b$ $xy$    $dx$
Comment: i use this formula$$V=\pi \int_{a}^{b}x^2|f'(x)|dx$$
Comment: Use $V=2\pi \int _3^5 \frac{3x }{x^2-4}dx$. You don't need to use partial fractions for this but if you must then integrate $\frac{3}{2 (x-2)}+\frac{3}{2 (x+2)}$
Comment: What method of integration could be used? I just took from the word "hence" in the question that it would need to be partial fractions.

Then  $y = $  $2\pi\  $x$ $ $\frac{3}{2}$$ln(x-2)$ + $\frac{3}{2}$$ln(x+2)$?
Comment: OK now evaluate from $3$ to $5$
Comment: you should get $3\pi  \ln  (21/5)\approx 13.5254$
Comment: Yeah thats the one, thanks!
Answer: since we have $$f'(x)=-\frac{3(x^2+4)}{(x-2)^2(x+2)^2}$$ you have to compute
$$V=\pi \int_{3}^5x^2\cdot \frac{3(x^2+4)}{(x-2)^2(x+2)^2}dx$$
with your formula we have to solve
$$V=2\pi\int_3^5x\cdot \frac{3x}{x^2-4}dx$$
and use that $$\frac{3x^2}{x^2-4}=3-3\, \left( x+2 \right) ^{-1}+3\, \left( x-2 \right) ^{-1}$$
using the formula above we get $$2\,\pi\, \left( 6+3\,\ln  \left( 5 \right) -3\,\ln  \left( 7 \right) +
3\,\ln  \left( 3 \right)  \right)
$$
Comment: Thanks but is there a simpler way to understand this? I will have to use the formula given to me. The way I've been taught is to resolve into partial fractions, then integrate using natural log.
Comment: i think your formula is not correct, may be a $'$ is missing, what do think?
Comment: I've never used a $'$ in an equation before what would that indicate? I have used the formula before with basic functions and it works, im just not sure how to use it with partial fractions.
Comment: which formula have you used?
Comment: For calculating the volume when revolved around the y axis:
V = $2\pi $$\int_a^b$ $xy$    $dx$
Comment: ok i will compare both results and here i will use your formula,ok?
Comment: Yes please, i have been given an answer I just cant follow the method yet
Comment: is this your answer as shown here?
Comment: The answer given when using the limits given for the volume is  13.53


POST parameters not received in drupal module

Question: I am sending a POST to a Drupal module. How can I receive the parameters values in the module and display?
I have tried using $val = $_REQUEST[''], $_POST[''], $_GET[''] but it is just showing the null value.
I want to get the POST request and send the response back in JSON.
function module_menu(){
  $items = array();
  $items['page-json'] = array(
  'title' => 'JSON Output',
  'page callback' => 'json_page',
  'page arguments' => array(1),
  'access callback' => TRUE,
);
  return $items;
}
function json_page(){
  $dt = $_REQUEST['param'];
  return drupal_json($dt);
}

Comment: How exactly are you 'sending a post to a drupal module' ? Did you create a a page with hook_menu or is it a normal drupal page?
Comment: Yes, I created a page with hook_menu.
Comment: If you write your hook_menu and your callback, we will figure it out
Comment: I have added code to the question..
Comment: did you figure it out now ?
Answer: You cannot use an empty string with those super global variables. You need to use a string that is the parameter you request, such as in $_GET['q'], or $_REQUEST['q'].
Comment: ...or just use $_REQUEST or $_GET to get the full array
Comment: sorry that i didn't mentioned it like $_POST['param_name']...but I am doing it like that...still not receiving the value....is there any permission I need to set in drupal....I am actually new to drupal don't know much related to it.....
Comment: @Mike: I tried $_REQUEST but its null everytime...


In terms of sound, what are the advantages of a steel or nylon string?

Question: I first picked up a guitar when I was about 7. Ever since I've been playing it, and I even performed a solo at a concert (Little Rover, by the stupendium!) I have 3 guitars, all acoustic. One hasn't been used in about a year and I'm thinking of selling it (any takers?) another is currently sidelined because of a broken string (not from my earlier question, that one has already been fixed) so I only have one that is in good enough shape to be played. The actual question here is for my guitar, it is currently strung with the top 3 strings brass and lower 3 nylon. I don't play professionally (yet) but I'm preparing a music festival in my town, and I want to know the advantages of both. Which one would produce a louder sound?
Comment: What make and model is the guitar in question?
Comment: Welcome! So it seems the answer to "can I change the strings on *this* guitar" is a simple "no." But if you want to ask "what are the pros/cons of nylon vs steel," then you're asking about two kinds of guitars. You could open a new question asking that. (You could also edit this question and have it re-opened, but in this case, when there's already answers and stuff, it's probably better to open a new one.) ...
Comment: ... Before doing so, please take a second to read about [the topics covered here](https://music.stackexchange.com/help/on-topic) and [how to avoid subjective answers](https://music.stackexchange.com/help/dont-ask). For instance, "which is better, classical or steel-string" wouldn't be a good question, but "what makes a classical guitar better suited to classical/folk/flamenco music" might be.
Comment: Good revision. Very clear now why the other linked posts didn't provide the answer.
Comment: @Aaron Huh. I still don't get it. Still seems like a question about whether to put steel strings on a classical guitar or not. And we still don't have the make and model of the guitar in question. I myself can't see why this was reopened. It seems hardly different at all.
Comment: @ToddWilcox As it stands, the last two sentences are the real question, and the rest is incidental (/distracting/confusing) personal info.
Comment: @AndyBonner But the last sentence still doesn't make sense or is answered by one of the dupes that used to be linked here. The advantage of nylon strings is they can be used on nylon string guitars. The advantage of steel strings is they can be used on steel string guitars. A string is not louder than another string - all strings by themselves are extremely quiet when vibrating. Different guitars, on the other hand, are capable of different dynamic ranges. Is the question actually about nylon string **guitars** vs steel string **guitars**?
Comment: @ToddWilcox yup, I think that's the current intent. I mean, if I'm gonna play flamenco or Albeniz or Joni Mitchell, I want a nylon-string guitar, and if I'm gonna play Greenday-unplugged I want steel—but why? which *is* louder, and what are other differences? I'm not actually sure enough myself to offer an answer. I could tell you about the differences between gut-string-baroque violin and "modern" violin, which are probably pretty similar...
Answer: The answer to your question is Yes, you should keep it like that else you risk damaging your guitar. As others stated, the three brass strings are nylon cores wound in brass (or other metal). If you buy a pack of "nylon" strings you will likely find the same configuration. It is standard.
On the off chance that someone put nylon on an acoustic guitar, then you would be fine to try out metal acoustic guitar strings. I HIGHLY doubt that this is the case, it sounds like your guitar is a "classical" guitar.
Comment: @TheWantedOne Maybe we're confused by your question. You can't choose between nylon or steel strings to put on a guitar. You must put nylon strings on guitars made for nylon strings and steel strings on guitars made for steel strings. The advantage of nylon strings is they are the only strings you can use for a nylon string guitar. The advantage of steel strings is they are the only strings you can use for a steel string guitar. You wrote in your question, "should I keep it like this?" And the answer to that is **yes, you must keep it like that**. That is exactly what you asked.
Comment: @TheWantedOne You said the linked answers do not answer your question but they do. The first answer in the first link says this: "**You should only use nylon strings on this guitar.**" That's your answer. You don't have an option to put steel strings on it. Nylon only.
Comment: This doesn't address the question of advantages one way or the other.
Comment: @Awalrod Just inspected the guitar thoroughly, it's a yamaha, and it says "classical" on the soundbox label.
Comment: @ToddWilcox if you read the entire question (I know, doing so instead of going for knee jerk reaction might get you downvoted) it's really about whether the OP should replace the strings on classical guitar with new nylon strings.
Comment: @ojs I've read all of the content of all three questions (this and the two linked ones), including all answers and comments. Your mention of getting downvoted makes no sense because I've only voted to close and commented and neither action can be downvoted. I'm not sure which question you are saying is about replacing strings (since there are three questions under discussion - or have you not read all if the content?) but it doesn't matter. The asker has a classical guitar. The asker should only use nylon strings on their classical guitar. That is their answer. No more is needed.
Comment: @ToddWilcox the questions main issue was advantage/disadvantage. but seeing that this question was closed because everyone is so quick to closevote, I'm not going to get my answer. Only one person said something even remotely close to what I was asking.
Comment: @ToddWilcox sorry, I was intending to reply to Aaron and missed that autocomplete had filled in someone different. My mistake, and unfortunately ironic one.
Answer: Neither steel nor nylon strings on their own produce very much sound at all, even when stretched and plucked. A vibrating string of any material just doesn't couple with enough air for the sound of it to be clearly audible.
That is why guitars have large, hollow, wooden bodies. The body of a guitar couples the energy of the vibrating string to a larger amount of air, acting as an amplifier for the string. The things that make a guitar sound louder or quieter are the construction of the bridge, top, back, and sides. There are also resonator guitars that have special designs intended to get more volume out of a guitar without making it much larger.
So the answer to which string is louder is neither. They are both extremely quiet on their own.
If you are curious about which kind of guitar is louder, then guitars that can be strung with steel strings are capable of more volume than guitars that must be strung with nylon strings.
In terms of "advantages" and "disadvantages" of nylon versus steel strings, it doesn't really work like that. You (almost) never have a choice between whether to put nylon or steel strings on the same guitar. Nylon string guitars must use nylon strings; steel string guitars must use steel strings.
On a nylon string guitar:

The advantage of nylon strings is you can put them on the guitar and the guitar will sound and play correctly.
The disadvantage of steel strings is if you try to put them on, it will be difficult and you run the risk of damaging the guitar.

On a steel string guitar:

The advantage of steel strings is they will fit and work as intended and the guitar will sound and play correctly.
The disadvantage of nylon strings is they will be very hard to put on and the guitar won't sound or play correctly at all. At least in this case there is no chance of damage to the guitar.
Comment: @AndyBonner I don't think tension and volume are strongly correlated. I think there is a link but it's not linear. I'd look at mass per unit length as more connected with possible volume. At the same frequency and maximum displacement, a more massive (denser) string will have more momentum, which correlates with more energy transfer to the top.
Comment: I've been keeping quiet about it since I don't know, but is the tension of the two very different? I imagine that plays a role in volume?
Comment: @AndyBonner yes, typically nylon strings have half the tension of steel strings
Comment: @ToddWilcox in my entire life I've only seen one guitar where it was interchangeable.
Comment: I guess, for a given pitch, if you increase the tension and keep the vibrating length the same, you can decrease the mass... which... makes it *softer*? Changes the timbre, ie overtone blend, anyway; big fat ropy gut bass strings have that "muddy" sound...
Comment: Denser string needs higher tension if length and pitch are kept constant. And yes, thicker strings tend to dampen higher overtones.
Comment: @AndyBonner I personally have no idea what a "big fat ropy gut bass string" sounds like. I'm not sure how much timbre is affected by thickness. I think the modulus of elasticity and other factors may be more important. I do know for certain that thick nylon classical guitar strings can be played **very** brightly with the correct technique. For both steel and nylon strings, the available brightness does decrease for a given string as the tension is reduced. But the number of available tone colors is not significantly different between steel and nylon string guitars.
Comment: Have to disagree with some points here. On at least a couple of my classical guitars, it would be very easy to fit steel strings. Depends on the bridge configuration. Not that I'd want to do that. Nylon strings on a steel-strung guitar, yes, awkward to fit, usually. Volume? Maybe something to do with classical guitars are usually played with fingers (O.k. nails as well), whereas others will almost inevitably use a plectrum, which could well sound louder.
Answer: There is a huge difference in Young's modulus between nylon and steel, see:
What is "Young's modulus", and how does it relate to guitar?
Nylon strings change pitch less than steel when bent, either voluntarily or involuntarily, so they provide more stable intonation.
Nylon strings sound inherently more mellow, as they produce less high harmonics.
That being said, it's not really a choice whether to put steel or nylon strings on a guitar. As the others said, you need an appropriately made instrument to benefit from the string qualities. Moreover, putting steel strings on a classical guitar may damage the instrument due to increased tension.
Comment: @AndyBonner true, in general they may not hold tuning as well as steel strings over longer periods.
Comment: @ToddWilcox _The science of string instruments_ T.Rossing, chapter 8.2.2, attributes it to softness of the material and internal absorption of high frequencies, in nylon and gut strings, as opposed to metal strings.
Comment: "Nylon strings change pitch less than steel when bent, either voluntarily or involuntarily, so they provide more stable intonation." —but, in my experience, they stretch more during the "break-in" period, right?


Attach jQuery behavior to AJAX loaded content

Question: I would like to add some jQuery behavior to a page using the FAPI #ajax behavior (a Commerce product reference add to cart form)
I used a custom module (Commerce Taxonomy Field Product Attribute) to replace the standard text output of the taxonomy term attribute by an image, and hide the radio button of the add to cart form via CSS (display: none). The goal is to let the user click on the image label to select his product's color or size.
See a screenshot without css, and with css
I added some custom jquery that adds a "hover" and "selected" class to the label (on mouse over and clicked event) in order to have a ui feedback via CSS - as the Commerce add to cart form uses radios element, there is no "hand" mouse pointer on hover, which can be quite disturbing for the UI.
--> It works fine the first time the page is loaded but doesn't get attached when a product is reloaded by ajax.
I have a JS file with
Drupal.behaviors.custom_danity_afficheur_produit_label_hover = {
  attach: function (context, settings) {
    //All the code that attaches the click / hover event functions using jQuery.once()
  }
}

I tried loading the JS file at different level :

in the template .tpl.php file
in the add to cart form alter hook in
a function callback on the add to cart form #post_render attribute

None of these work, the AJAX only works the first time it is loaded.
It's not the first time I try to add jQuery code to an ajax loaded content - I managed last time to modify the code and use FAPI Ajax to make it work - but here i don't know how to do it as the product attributes already have an Ajax behavior implemented by Commerce... and as far is i know, it's not possible to attach multiple ajax behavior to an element with Drupal FormAPI
Any help would be much much much much much appreciated :-)
Answer: Ok I managed to make it work.
Drupal did try to re-attach the behavior on my content after it was added by AJAX, but my selectors were starting from too "early" in my DOM - as such, when drupal.attachBehavior got called by the system, it couldn't find the right selector.
Example :
My DOM look like this :

        <input ... class="input1" />
        <input ... class="input2" />
        <input ... class="input3" />

My jQuery selector looked like this
    $('#product-add-to-cart .class1 input.input1").hover(...);
As I understand, FormAPI was replacing what was INSIDE #product-add-to-cart .class1, while the context passed to Drupal.attachBehavior only had part of this markup (the input elements..) : hence    $('#product-add-to-cart .class1 input.input1").hover(...); couldn't return anything in this context.
I replaced my jQuery $('#product-add-to-cart .class1 input.input1").hover(…); with
$('input.input1").hover(…); and it works like a charm.


PHP: PayPal Integration with Credits

Question: I have this:
<form method="post" action="paypal.php">
            How?

            <select name="type">
                <option value="pp">PayPal</option>
            </select>

            How much?
            <input type="number" step="any" id="amount" name="amount" placeholder="50.00" />

            <input type="submit" value="Buy credits" name="charge" />
 </form>

I want users to be able to buy credits with PayPal.
$50 = 50 Credits.
But I don't know how to do this. Can you help me with this? If the payment is confirmed, the user should receive the exact number of credits that he has paid for.
When I open a page ("confirmed.php"), I don't know if the user has really paid $50 and not just $5. To add credits to a user account just do
addCredits($amount);

Can you maybe send me a link or the PHP code?
Answer: Take a look at the PayPal API. Specifially this: https://github.com/paypal/codesamples-php/blob/master/Merchant/sample/code/DoDirectPayment.php#L80.
That way you'll be notified about the payment. That's also the place to add credits.

PHP: PayPal Integration with Credits


UWP C# How to append .json file and to identify them in groups

Question: I am trying to create a usercontrol to display groups of items from json file on windows iot core.
I have a "Create Group" button. Once pressed, it will create 64 usercontrols with respective details and display in a scrollviewer. susequently i can edit individual items in any of the 64 usercontrol then save the json file.
I have my class for the usercontrol as follow;
I have having an issue on how to create different groups of the 64 items and append all in a same json file and to subsequently display them from selection of the mentioned different groups.
Please help thanks.
Group Class
[DataContract]
public class DecoderGroup
{
    [DataMember]
    public int groupID{ get; set; }
    [DataMember]
    public string groupName{ get; set; }
    [DataMember]
    public int cardAddress { get; set; }
    [DataMember]
    public bool enabled { get; set; }
    [DataMember]
    public int z1label { get; set; }
    [DataMember]
    public int z2label { get; set; }
    [DataMember]
    public int z3label { get; set; }
    [DataMember]
    public int z4label { get; set; }
    [DataMember]
    public bool zone1 { get; set; }
    [DataMember]
    public bool zone2 { get; set; }
    [DataMember]
    public bool zone3 { get; set; }
    [DataMember]
    public bool zone4 { get; set; }
    [DataMember]
    public List<byte> txData { get; set; }

    public DecoderGroup(int id, int address, int z1, int z2, int z3, int z4)
    {
        groupName = "Group";
        zone1 = false;
        zone2 = false;
        zone3 = false;
        zone4 = false;

        z1label = z1;
        z2label = z2;
        z3label = z3;
        z4label = z4;
    }
}

MainPage.xaml.cs
private void AddGroup_Click(object sender, RoutedEventArgs e)
    {
        ZonesList_Panel.Children.Clear();

        int groupid = 1;
        int cardadr;

        for (cardadr = 1; cardadr <= MAXCARDS; cardadr++)
        {
            var z4 = (4 * cardadr);
            var z3 = (4 * cardadr) - 1;
            var z2 = (4 * cardadr) - 2;
            var z1 = (4 * cardadr) - 3;

            DecoderGroupUserControl decoderGroupControl = new DecoderGroupUserControl(this, new DecoderGroup(groupid, cardadr, z1, z2, z3, z4));
            ZonesList_Panel.Children.Add(decoderGroupControl);
        }
    }

private async void SaveGroup_Click(object sender, RoutedEventArgs e)
        {
                await saveGroupsToJSON(getGroups());

        }

public async Task saveGroupsToJSON(List<DecoderGroup> groups)
        {
            var serializer = new DataContractJsonSerializer(typeof(List<DecoderGroup>));
            using (var stream = await ApplicationData.Current.LocalFolder.OpenStreamForWriteAsync(DECODERGROUPS_FILE, CreationCollisionOption.OpenIfExists))
            {
                serializer.WriteObject(stream, groups);
            }
        }

    public List<DecoderGroup> getGroups()
    {
        List<DecoderGroup> ret = new List<DecoderGroup>();
        foreach (DecoderGroupUserControl u in ZonesList_Panel.Children)
        {
            //add condition for group ID
            ret.Add(u.decoderGroup);
        }
        return ret;
    }

UserControl
 public DecoderGroupUserControl(MainPage page, DecoderGroup group)
    {
        this.InitializeComponent();
        mainPage = page;
        this.decoderGroup = group;

        Z1Name.Text = group.z1label.ToString();
        Z2Name.Text = group.z2label.ToString();
        Z3Name.Text = group.z3label.ToString();
        Z4Name.Text = group.z4label.ToString();
    }

Comment: Do you have any progress? If the question hasn't been resolved, please feel free to contact us.
Answer: It is recommended to use UserControl as the DateTemplate of ListView so that you don't need to create multiple usercontrol and add them to the page. Then you could read json file and convert json objects to a collection, and you could use the collection as the Itemsource of ListView.
By implementing the INotifyPropertyChanged interface, TwoWay data binding could reflect the UI changes to the collection. Finally, you could write the changed collection to the json file.
Note that you need to download the Newtonsoft.Json to parse the json object via Manage NuGet Packages. Please refer to the following code.
MyUserControl1.xaml:
<UserControl
   ..>
   <Grid>

        <StackPanel>
            <StackPanel Orientation="Horizontal" >
                <TextBox Margin="0,0,20,0"  Text="{Binding Name,Mode=TwoWay}" BorderThickness="0"/>
                <TextBox Text="{Binding Job,Mode=TwoWay}" BorderThickness="0"/>
            </StackPanel>
            <TextBox Text="{Binding Age,Mode=TwoWay}" BorderThickness="0"/>
        </StackPanel>
    </Grid>
</UserControl>

MainPage.xaml:
<Page..>

    <Grid>
        <StackPanel>
            <ListView ItemsSource="{x:Bind Results,Mode=TwoWay}">
            <ListView.ItemTemplate>
                <DataTemplate x:DataType="local:Person">
                    <local:MyUserControl1>
                    </local:MyUserControl1>
                </DataTemplate>
            </ListView.ItemTemplate>
        </ListView>
            <Button x:Name="SaveButton" Content="Save" Click="SaveButton_Click"/>
        </StackPanel>
    </Grid>
</Page>

MainPage.xaml.cs:
namespace WriteJson
{
    public sealed partial class MainPage : Page
    {
        public ObservableCollection<Person> Persons { get; set; }
        public ObservableCollection<Person> Results { get; set; }
        public string path;
        public MainPage()
        {
            this.InitializeComponent();
            CreateJsonFile();
            path = ApplicationData.Current.LocalFolder.Path + "\\info.json";
            Results = JsonConvert.DeserializeObject<ObservableCollection<Person>>(File.ReadAllText(path));
            Debug.WriteLine("bind successfully");
        }
       public async void CreateJsonFile()
        {
            //check if info.json exists, if it doesn't exist, create it
            StorageFolder folder = ApplicationData.Current.LocalFolder;
            StorageFile file;
            try
            {
                file = await folder.GetFileAsync("info.json");
            }
            catch
            {
                await folder.CreateFileAsync("info.json");
                Persons = new ObservableCollection<Person>()
            {
                new Person(){Name="tom",Job="teacher",Age=24},
                new Person(){Name="lily",Job="nurse",Age=20},
                new Person(){Name="ming",Job="student",Age=26},
                new Person(){Name="kiki",Job="lawyer",Age=28},
                new Person(){Name="jack",Job="worker",Age=21},
            };

                path = ApplicationData.Current.LocalFolder.Path + "\\info.json";
                File.WriteAllText(path, JsonConvert.SerializeObject(Persons));
                Debug.WriteLine("create a json file successfully");
            }

        }

        private void SaveButton_Click(object sender, RoutedEventArgs e)
        {
            File.WriteAllText(path, JsonConvert.SerializeObject(Results));
            Debug.WriteLine("save successfully");
        }
    }
    public class Person:INotifyPropertyChanged
    {
       private string name;
        private string job;
        private int age;
        public string Name
        {
            get { return name; }
            set
            {
                name = value;
                RaisePropertyChanged("Name");
            }
        }
        public string Job
        {
            get { return job; }
            set
            {
                job = value;
                RaisePropertyChanged("Job");
            }
        }
        public int Age
        {
            get { return age; }
            set
            {
                age = value;
                RaisePropertyChanged("Age");
            }
        }

        public event PropertyChangedEventHandler PropertyChanged;
        public void RaisePropertyChanged(string propertyname=null)
        {
            PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyname));
        }
    }
}


Alternative functor construction from universal morphisms

Question: Let $G : \mathcal{D} \rightarrow \mathcal{C}$ be a functor. Suppose that for each object $X \in \mathcal{C}$, there exists a universal morphism $(F_X, \eta_X)$ from $X$ to $G$. The theory of adjoint functors tells us that we can construct a unique functor $F : \mathcal{C} \rightarrow \mathcal{D}$ such that $F(X) = F_X$ and $\eta = (\eta_X)_X$ is a natural transformation. Indeed, given $f : X \rightarrow Y$, we can use universality of $(F_X, \eta_X)$ and define $F(f)$ to be the unique $h : F_X \rightarrow F_Y$ such that $G(h) \circ \eta_X = \eta_Y \circ f$. This $F$ will be a left adjoint of $G$.
However, it seems plausible to construct another functor $F'$ such that $F'(X)=F_X$, but which is defined differently on arrows, in a way so that $F'$ is no longer a left adjoint of $G$. To get around the above uniqueness condition, it would have to be done so that $\eta$ is no longer a natural transformation. Is this possible? Are there any simple examples (e.g. where $G : Grp \rightarrow Set$ is the forgetful functor and $F : Set \rightarrow Grp$ is the free functor)?
EDIT: I realized my question is equivalent to the following. Let $F,F' : \mathcal{C} \rightarrow \mathcal{D}$ and $G : \mathcal{D} \rightarrow \mathcal{C}$ be functors. Suppose that $F$ and $F'$ agree on objects (i.e. $F(X)=F'(X)$ for each object $X \in \mathcal{C}$). If $F$ is a left adjoint of $G$, does it follow that $F'$ is also a left adjoint of $G$?
Answer: Yes, this is possible.
Let's start with an extremely simple example: the identity functor $Set \to Set$, whose adjoint is itself. Fix a set $S$ and a nontrivial permutation $\pi : S \to S$. We can define a functor $F : Set \to Set$ by $F(X) = X$ for all objects $X$, and for all morphism $f : X \to Y$,
$$F(f) = \begin{cases}
  f & X \neq S \neq Y \\
  f \circ \pi & X = S \neq Y \\
  \pi^{-1} \circ f & X \neq S = Y \\
  \pi^{-1} \circ f \circ \pi & X = S = Y
\end{cases}$$
We have a natural isomorphism $\theta : F \to 1_{Set}$ given by
$$\theta_X = \begin{cases}
  1_X & X \neq S \\
  \pi & X = S
\end{cases}$$
Thus, we see that $F$ is the same as $1_{Set}$ on objects, and the two functors are isomorphic, yet they are not the same on arrows.
In fact, we could start with any category $C$ and any choice $(\theta_X : X \to X)_{X \in C}$ of isomorphisms that is nontrivial and get a similar result by defining $F(f) = \theta_Y^{-1} \circ f \circ \theta_X$. So there are plenty of examples.
Comment: Hmm, I'm realizing that I wasn't specific enough in my question. Is it possible to do this so that the new functor is no longer an adjoint? I'll edit my question accordingly.
Answer:
Let $F,F' : \mathcal{C} \rightarrow \mathcal{D}$ and $G : \mathcal{D} \rightarrow \mathcal{C}$ be functors. Suppose that $F$ and $F'$ agree on objects (i.e. $F(X)=F'(X)$ for each object $X \in \mathcal{C}$). If $F$ is a left adjoint of $G$, does it follow that $F'$ is also a left adjoint of $G$?

In the special case $F = G = \mathrm{id}_{\mathcal{C}}$, this becomes: If $F ' : \mathcal{C} \to \mathcal{C}$ is a functor which is the identity on objects, is $F' \cong \mathrm{id}_{\mathcal{C}}$? This would imply in particular that $F'$ is fully faithful. But this already fails for one-object categories, i.e. monoids. Any non-bijective monoid homomorphism $ M \to M$ is a counterexample.


What is the daily file sharing limit in the google cloud API and how do I raise it?

Question: I get this error:
<code>{'errors': [{'domain': 'usageLimits', 'reason': 'userRateLimitExceeded', 'message': 'Rate limit exceeded. User message: "Sorry, you have exceeded your sharing quota."', 'locationType': 'other', 'location': 'user.sharing'}], 'code': 403, 'message': 'Rate limit exceeded. User message: "Sorry, you have exceeded your sharing quota."'}
</code>
But I can't see this limit in the cloud console. It seems like the daily limit is 100 files, but I need to raise it for my application.
Comment: Does this answer your question? [Google Drive API - Permissions - Rate limit exceeded. User message: Sorry, you have exceeded your sharing quota](https://stackoverflow.com/questions/29630595/google-drive-api-permissions-rate-limit-exceeded-user-message-sorry-you-h)
Answer: 1. Check the quotas
Confirm what's the specific API you're calling and monitor it
2. Limits are by request not by files
You have a limit of 10,000 every 100 seconds per project per user, so it's likely you're making a lot of requests in a short period of time
3. Implement exponential backoff
An exponential backoff algorithm retries requests exponentially, increasing the waiting time between retries up to a maximum backoff time
4. If all of the above is already checked, request an increase

Go to the Cloud Console and sign in as a Google Workspace super administrator.

From the Project list, select the project you're using for the migration.

On the left, click IAM & admin > Quotas.

Using the checkboxes, select one or more quotas to edit, then click Edit Quotas.
Note: Billing must be enabled on the project in order to click the checkboxes.

In the Edit Quotas panel on the right, complete the form with your Name, Email, and Phone details, then click Next.

In the Edit Quotas panel, select the service to expand the view, then edit the quotas in that service to your requested limit. Click Done.

Click Submit request.


validates length of a Comment, but without error message

Question: To begin I'm sorry for my english :)
Well, i'm actually learning Rails with a simple application, the famous blog.
Here is the actual database schema :
create_table "comments", :force => true do |t|
t.integer  "post_id"
t.text     "text"
t.datetime "created_at"
t.datetime "updated_at"
end

create_table "posts", :force => true do |t|
t.string   "title"
t.text     "text"
t.datetime "created_at"
t.datetime "updated_at"
end

Post model :
class Post < ActiveRecord::Base
    has_many :comments

    validates_presence_of :title, :message => "title is mandatory"
    validates :text, :length => { :minimum => 10 }
end

And when I try to create a Post with a text <= 10 chars, as expected, it doesn't save the Post, and I get an error message (by default).
So I tried to do the same with a Comment...
Comment model :
class Comment < ActiveRecord::Base
     belongs_to :post
     validates :text, :presence => true, :length => { :minimum => 10 }
end

And my CommentsController :
 class CommentsController < ApplicationController
  def create
   @post = Post.find(params[:post_id])
   @comment = @post.comments.build(params[:comment])
   @comment.save

   redirect_to @post
  end

  def destroy
   @comment = Comment.find(params[:id])
   @comment.destroy

   redirect_to @comment.post
  end
end

I know that the validation is executed because I can't create a comment with a content <= 10 chars, however I didn't get an error message as expected. And that's what I'm trying to get...
Thanks.
Comment: how do you know there's no error message ? did you try this through the console ? I suspect that since you're redirecting to `@post`, you render the `Post#show` action view which may not handle error message for associated objects.
Comment: How could I handle error message for this inside Post#show ?
Comment: how do you display error messages?
Comment: eduke if you wanna handle error message you have to use the following code snippet.This should work.
Answer: Try The Following code :
def create
   @post = Post.find(params[:post_id])
   @comment = @post.comments.build(params[:comment])
   begin
    @comment.save!
     redirect_to @post
    rescue Exception => error
     puts "Error:: #{error.message}"
     render : new #to not redirect
    end

Your error will be puts to your console.
If you wanna see this errors to the View then add this to your 'new'

  <% if @comment.errors.any? %>

    <%= pluralize(@comment.errors.count, "error") %> prohibited this comment from being saved:

          <% @comment.errors.full_messages.each do |msg| %>

<%= msg %>

          <% end %>

  <% end %>


Objeto não existe quando um foreach está dentro de outro, exceto durante depuração

Question: No meu código eu consultei 2 serviços e coloquei seus resultados (objetos) dentro de um array chamado deferreds.
Estes objetos têm uma propriedade chamada results, que é outro array.
Eu preciso pegar o primeiro desses objetos, e dar um push() de todos os results dos outros objetos nele, pois vou exibi-lo em um popup.
Meu problema é que isso só funciona quando eu coloco um breakpoint no navegador e vou indo linha a linha. Quando eu rodo normal no navegador, ele dá um erro dizendo que def.results[0] é indefinido, mas quando eu vou devagar debugando ele tem sim um valor, e tudo roda normal.
Alguma dica?
var deferred = null;
deferreds.forEach(function (def) {
    if (deferred == null) {
        deferred = def;
    } else {

        def.results[0].forEach(function (defer) {
            deferred.results[0].push(defer);
        });
    }
});

this.mapa.infoWindow.setFeatures([deferred]);
this.mapa.infoWindow.show(evt.mapPoint);

Comment: fazendo def.results[0].forEach você não esta percorrendo o array, você esta acessando apenas o valor, que por si so não pode ser percorrido. retira esse [0] ai que vai funcionar :D da um console.log() ae e pega o  objeto
Comment: O que dá `console.log(JSON.stringify(deferreds));`? Podes colocar o código dos dois serviços que consultas?
Comment: Eu acho que você está tentando acessar os resultados antes que o deferred tenha sido resolvido.
Comment: Obrigado @GabrielRodrigues, é que dentro do results havia um array. A primeira posição com os objetos que citei, e outro vazio. Por isso que eu colocava [0].
Comment: Obrigado @bfavaretto. Não tenho certeza mas acho que o problema era esse mesmo. Consegui resolver usando o `when` do DOJO Framework que estou usando, pra acessar a propriedade de cada `results`
Comment: Obrigado @Sergio, acho que o problema era que a deferred não estava pronta mesmo. Já posto como resolvi
Answer: Opa, blz?
Cara, se seu objetivo é colocar todos os results no primeiro objeto do seu array, não seria melhor vc fazer assim:
var first = null;
if(deferreds.length > 1) {
  first = deferreds.shift()
  deferreds.forEach(function (item) {
    first.result = first.result.concat(item.result);
  });
} else {
  first = deferreds[0]
}

first.result

Answer: Valeu pessoal, acho que o problema era que a deferred não estava pronta mesmo. (Acho).
Resolvi usando o When do DOJO framework assim:
var deferred = deferreds[0];

var teste;

for (var i = 1, max = deferreds.length; i < max; i++) {
    when(deferreds[i], function (results) { teste = results; });

    when(deferred, function (results) {

        teste.forEach(function (item) {
            results.push(item);
        });
    });
}

this.mapa.infoWindow.setFeatures([deferred]);
this.mapa.infoWindow.show(evt.mapPoint);