text:
Q: How to format output into 6 columns? MY output is 285 numbers but its all under column1(in ascending order). It is somehow supposed to be split into 50 numbers for the first 5 columns and then 35 for the last one.
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#define MAX_SIZE_FLOAT n
#define MAX_NUM_OF_FLOATS 1000
void swap(float * a, float * b);`enter code here`
void sort(float ary [], int numElements );
int main(int argc, char** argv) {
int i,num_read;
float x, n;
float a[MAX_NUM_OF_FLOATS];`enter code here`
double x1,x2,mn;
FILE * inFile;
inFile = fopen("DataFloat.txt", "r");
if( inFile == NULL) {
    printf("\nError opening input file; program aborted\n");
    exit(1);
}
i = 0;
while( fscanf(inFile, "%f", & a[i]) == 1 ){
    x1+=a[i];
  x2+=a[i]*a[i];
    i++;
  mn=x1/(double)n;
  }
  fclose(inFile);
   if(n<1){
   printf("\nError.");
    exit(1);
   }
   num_read = i;
      for(i = 0; i < num_read; i++)

sort(a, num_read);

printf("Column1    Column2   Column3   Column4   Column5   Column6\n",a[i]);
   for(i = 0; i < num_read; i++) <--Am i supposed to be using a for loop here or while-loop?
   printf("%5.2f\n", a[i] );
   return (EXIT_SUCCESS);
}  // end of main

void sort(float ary [], int numElements ) {
 int i, currentIndex, foundIndex, nextIndex;
 float min;

// the outer for-loop is the placement loop
for( currentIndex = 0; currentIndex < numElements - 1; currentIndex++){
    min = ary[currentIndex];
    foundIndex = currentIndex;
    nextIndex = currentIndex + 1;

    // the inner for-loop selects the best element from the rest of ary
    for( i = nextIndex; i < numElements; i++)
        if( ary[i] < min ){
            min = ary[i];
            foundIndex = i;
        }
    swap(& ary[currentIndex], & ary[foundIndex]);
}
}

void swap(float * a, float * b){
float temp;
temp = *a;
*a = *b;
*b =temp;
}

MY output is 285 numbers but its all under column1(in ascending order). It is somehow supposed to be split into 50 numbers for the first 5 columns and then 35 for the last one.

A: I would imagine, then, that you would simply format your output with six columns in it, something like
for (i = 0; i < 50; ++i){
    printf("%d\t%d\t%d\t%d\t%d",
           arr[i], arr[i + 50], arr[i + 100], arr[i + 150], arr[i + 200]);
    if(i < 35)
        printf("\t%d", arr[i + 250]);
    printf("\n");
}

EDIT: Updated according to Jonathan Leffler's comment.

A: This works for me (according to my understanding of the problem).  I've parameterized the code so that the number of values, number of columns, and number of complete rows are named constants.  There's an assertion that ensures that Column6 contains some data. The code does not generate the column headings dynamically, but it would not be hard to make it do so.
#include <assert.h>
#include <stdio.h>

enum { NUM_VALUES  = 285 };
enum { NUM_COLUMNS =   6 };
enum { NUM_ROWS    =  50 };

int main(void)
{
    double data[NUM_VALUES];
    int i;

    assert(NUM_VALUES > (NUM_COLUMNS - 1) * NUM_ROWS &&
           NUM_VALUES <= (NUM_COLUMNS) * NUM_ROWS);

    for (i = 0; i < NUM_VALUES; i++)
        data[i] = i * 10.0 + i / 100.0;

    printf("Column1   Column2   Column3   Column4   Column5   Column6\n");
    for (i = 0; i < NUM_ROWS; i++)
    {
        char *pad = "";
        for (int j = 0; j < NUM_COLUMNS; j++)
        {
            int index = j * NUM_ROWS + i;
            if (index < NUM_VALUES)
                printf("%s%7.2f", pad, data[index]);
            pad = "   ";
        }
        putchar('\n');
    }
    return 0;
}

Sample output:
Column1   Column2   Column3   Column4   Column5   Column6
   0.00    500.50   1001.00   1501.50   2002.00   2502.50
  10.01    510.51   1011.01   1511.51   2012.01   2512.51
  20.02    520.52   1021.02   1521.52   2022.02   2522.52
  30.03    530.53   1031.03   1531.53   2032.03   2532.53
  40.04    540.54   1041.04   1541.54   2042.04   2542.54
  50.05    550.55   1051.05   1551.55   2052.05   2552.55
  60.06    560.56   1061.06   1561.56   2062.06   2562.56
  70.07    570.57   1071.07   1571.57   2072.07   2572.57
  80.08    580.58   1081.08   1581.58   2082.08   2582.58
  90.09    590.59   1091.09   1591.59   2092.09   2592.59
 100.10    600.60   1101.10   1601.60   2102.10   2602.60
 110.11    610.61   1111.11   1611.61   2112.11   2612.61
 120.12    620.62   1121.12   1621.62   2122.12   2622.62
 130.13    630.63   1131.13   1631.63   2132.13   2632.63
 140.14    640.64   1141.14   1641.64   2142.14   2642.64
 150.15    650.65   1151.15   1651.65   2152.15   2652.65
 160.16    660.66   1161.16   1661.66   2162.16   2662.66
 170.17    670.67   1171.17   1671.67   2172.17   2672.67
 180.18    680.68   1181.18   1681.68   2182.18   2682.68
 190.19    690.69   1191.19   1691.69   2192.19   2692.69
 200.20    700.70   1201.20   1701.70   2202.20   2702.70
 210.21    710.71   1211.21   1711.71   2212.21   2712.71
 220.22    720.72   1221.22   1721.72   2222.22   2722.72
 230.23    730.73   1231.23   1731.73   2232.23   2732.73
 240.24    740.74   1241.24   1741.74   2242.24   2742.74
 250.25    750.75   1251.25   1751.75   2252.25   2752.75
 260.26    760.76   1261.26   1761.76   2262.26   2762.76
 270.27    770.77   1271.27   1771.77   2272.27   2772.77
 280.28    780.78   1281.28   1781.78   2282.28   2782.78
 290.29    790.79   1291.29   1791.79   2292.29   2792.79
 300.30    800.80   1301.30   1801.80   2302.30   2802.80
 310.31    810.81   1311.31   1811.81   2312.31   2812.81
 320.32    820.82   1321.32   1821.82   2322.32   2822.82
 330.33    830.83   1331.33   1831.83   2332.33   2832.83
 340.34    840.84   1341.34   1841.84   2342.34   2842.84
 350.35    850.85   1351.35   1851.85   2352.35
 360.36    860.86   1361.36   1861.86   2362.36
 370.37    870.87   1371.37   1871.87   2372.37
 380.38    880.88   1381.38   1881.88   2382.38
 390.39    890.89   1391.39   1891.89   2392.39
 400.40    900.90   1401.40   1901.90   2402.40
 410.41    910.91   1411.41   1911.91   2412.41
 420.42    920.92   1421.42   1921.92   2422.42
 430.43    930.93   1431.43   1931.93   2432.43
 440.44    940.94   1441.44   1941.94   2442.44
 450.45    950.95   1451.45   1951.95   2452.45
 460.46    960.96   1461.46   1961.96   2462.46
 470.47    970.97   1471.47   1971.97   2472.47
 480.48    980.98   1481.48   1981.98   2482.48
 490.49    990.99   1491.49   1991.99   2492.49


text:
Q: How to enable TLS for SMTP in II6 on Windows Server 2012 R2 I correctly bought a SSL certificate for my domain www.omniservice2.it from Aruba Business on my server with Windows Server 2012 R2.
I correctly installed the certificate in IIS 8 on every site and web application and in fact each of them is correctly reachable from https.
Now, I need to set up the same for my SMTP server in IIS 6. The SMTP works fine with Basic Authentication but obviously I want the credentials to be encrypted. So, I activated the flag "Requires TLS Encryption" in Tab Access under its properties.
Moreover, in the root console I did the following to check the certificate is installed in Personal store (otherwise IIS 6 won't detect it as documentation says)
File --> Add/Remove snap-in --> Select Certificates --> Computer account --> Local computer --> OK
Under Console Root I see Certificates (Local Computer) --> Personal --> Certificate into which there is correctly the RapidSSL SHA256 CA I bought with the correct expiration date.
The problem is that in section "Secure Communication" I still read "TLS is not available without a certificate" Where also am I supposed to install that certificate so that IIS 6 detects it?

A: From https://forums.iis.net/t/1155280.aspx

When the IIS6 SMTP Server module looks for a certificate to use for TLS encryption, it seems checks the 'Local_Machine\my' store. I'm not sure where the OpenSSL certificate was placed by the system, but if it's not in the Personal certificates section, then the SMTP server won't be able to find it, and will therefore provide the error listed here.
If you have IIS7 installed on this server, the easiest way to go about securing this would be to select the 'Server' node in the IIS7 manager, select 'Certificates', and 'Create a self-signed certificate...' This will place a copy of the certificate in both the 'Local_Machine\my' store, as well as the Trusted Roots store.
I ran through a quick test of this: clearing out the Personal store provided the error mentioned above, but reloading the 'Properties' of the SMTP server after creating the self-signed certificate through IIS showed the certificate present, and allowed it to be secured.
Hope this helps!
Note: To check what's in a given certificate store, load up MMC (mmc.exe in the 'Run' box), under 'File', select 'Add/Remove Snap-in'. Under the snap-in list, select 'Certificates', and then choose Local Machine. Once back at the MMC listing, under certificates, you can check 'Personal\Certificates' to see its content.

redpajama_set_name: RedPajamaStackExchange


text:
Q: Построить точечный график Какой самый простой способ построить точечный график при помощи Java?
Есть два массива данных, разделяю каждый из них на два для получения координат
//получение координат для построения графика
        double[] Xwords = new double[words.length];
        double[] Ywords = new double[words.length];
        //разделяем массив слов на два массива с координатами
        for (int i=0; i<words.length; i++){
                Xwords[i] = words[i][0];
                Ywords[i] = words[i][1];
        }

        double[] Xdocs = new double[docs[0].length];
        double[] Ydocs = new double[docs[0].length];
        //разделяем массив термов на два массива с координатами
        for (int i=0; i<docs[0].length; i++){
                Xdocs[i] = docs[0][i];
                Ydocs[i] = docs[1][i];
        }

Какая библиотека позволит в пару строчек загнать эти данные в метод и получить обычный точечный график?

A: Использовала библиотеку JFreeChart, здесь хороший пример

A: Если использовать стандартный Java2D, то код, рисующий точечный график, может выглядеть, например, так:
public void drawDiagram(Graphics g, double[] x, double y[], double scaling, int height, Color color) {
  int lastX = 0, lastY = 0;

  g.setColor(color);

  for(int i = 0; i < x.length; i++) {
   g.drawLine((int)(lastX * scaling), height - (int)(lastY * scaling),
           height - (int)(x[i] * scaling), (int)(y[i] * scaling));

   lastX = (int)x[i];
   lastY = (int)y[i];
  }
}

Где:

*

*g - графический контекст холста или изображения.

*x - массив с координатами x.

*y - массив с координатами y.

*scaling - множитель масштабирования.

*height - высота панели для рисования (также можно взять максимальную координату y).

*color - цвет линии.

A: На Canvas рисовать. Взять SurfaceView и в методе OnDraw() отрисовать что нужно.


text:
Q: Why does Apple supply their own version of Java? If Java can run on any system, why is apple so protective of Java and its updates?

A: Apple used to supply their own version of Java, but have moved away from that in favour of donating the code to the OpenJDK project.
The fundamental reason is that Java is portable, but the JVM isn't - especially components that are about the platform, such as sound, file-system, and GUI components.
What Apple did was write the OS-X parts of the JVM, and ship them.  The OpenJDK move is, in fact, their declaration that they don't want the cost of porting Java to their platform any longer, and that the community can have it.


text:
Q: How much do we really care about Riemann integration compared to Lebesgue integration? Let me ask right at the start: what is Riemann integration really used for?
As far as I'm aware, we use Lebesgue integration in:

*

*probability theory

*theory of PDE's

*Fourier transforms
and really, anywhere I can think of where integration is used (perhaps in the form of Haar measure, as a generalization, although I'm sure this is vastly incomplete picture).
Let me state a well known theorem:

Let $f:[a,b]\to\mathbb R$ be bounded function. Then:
(i) $f$ is Riemann-integrable if and only if $f$ is continuous almost everywhere on $[a,b]$ (with respect to Lebesgue measure).
(ii) If $f$ is Riemann-integrable on $[a,b]$, then $f$ is Lebesgue-integrable and Riemann and Lebesgue integrals coincide.

(I will try to be fair, we use this result and Riemann integration to calculate many Lebesgue integrals)
From this we can conclude that Riemann-integrability is a stronger condition and we might naively conclude that it might behave better. However it does not; Riemann integral does not well behave under limits, while Lebesgue integral does: we have Lebesgue monotone and dominated convergence theorems.
Furthermore, I'm not aware of any universal property of Riemann integration, while in contrast we have this result presented by Tom Leinster; it establishes Lebesgue integration as initial in appropriate category (category of Banach spaces with mean).
Also, I'm familiar with Lebesgue-Stiltjes integral, greatly used for example in probability theory to define appropriate measures. I'm not so familiar with the concept or usage of Riemann-Stiltjes integral, and I'd greatly appreciate if someone could provide any comparison.
As far as I can tell, the only accomplishment of Riemann integration is the Fundamental theorem of calculus (not to neglect it's importance). I'm very interested to know if there are more important results.
To summarize the question:
Where is Riemann integral used compared to Lebesgue integral (which seems much better behaved) and why do we care?
Update:
It seems that it is agreed upon that Riemann integration primarily serves didactical purpose in teaching introductionary courses in analysis as a stepping stone for Lebesgue integration in later courses when measure theory is introduced. Also, improper integrals were brought as an example of something Lebesgue integration doesn't handle well. However, in several answers and comments we have another notion - that of a gauge integral (Henstock–Kurzweil integral, (narrow) Denjoy integral, Luzin integral or Perron integral). This integral not only generalizes both Riemann and Lebesgue integration, but also has much more satisfactory Fundamental theorem of calculus: if a function is a.e. differentiable than it's differential is gauge-integrable and conversely function defined by gauge integral is a.e. differentiable (here almost everywhere means everywhere up to a countable set).
Thank you for all the answers. This question should probably be altered to the following form (in more open-ended manner):
What are pros and cons of different kinds of integrals, and when should we use one over the other?

A: Let me turn the floor over to another mathematician who wrote on this subject and published a Monthly article on it. (He is no longer around to have his say and I'd like to remember him here.)
... from  Robert G. Bartle's review of the monograph The general theory of integration, by Ralph Henstock. Oxford Mathematical Monographs, Clarendon Press, Oxford, 1991, xi 262pp., ISBN 0-19-853566-X

"In elementary calculus courses we are usually successful in teaching
  students to evaluate an integral of a suitable function  $ f = F'$    on
  an interval $ [a, b]$,  by evaluating  $F(b)−F(a)$,  but we are often not
  very successful in connecting this type of integration with Riemann
  sums and their limits. During their junior/senior year, students who
  are studying mathematics seriously are then led through a more careful
  and exhaustive discussion of these ideas.  However, they are informed
  that all of this is only tentative, since when they become graduate
  students they will replace the outmoded Riemann integral that they
  have just mastered with the Lebesgue integral.
Of course, it is not completely replaced by this new integral, because
  there are certain notions, such as 'improper integrals,' that do not
  fall under this new umbrella and are still of considerable importance;
  moreover, almost all evaluations of integrals (whether Riemann or
  Lebesgue) are found by using the  $F(b) − F(a)$  method, with a few
  minor variations. We tell our advanced undergraduates that we would
  like to introduce them to the Lebesgue integral but cannot do so since
  it requires a prior study of measure theory and/or topology and is
  'too advanced' for them at their present stage of mathematical study.
  Probably none of us is satisfied by this circuitous procedure.
Suppose that someone came up with an approach to the integral that
  simultaneously covered the integration of all functions that have
  antiderivatives, all functions that have Riemann integrals, all
  functions that have improper integrals, and all functions that have
  Lebesgue integrals. Moreover, suppose that the definition of this
  'superintegral' was only slightly more complicated than that of the
  Riemann integral, that its development required no study of measure
  theory, no study of topology, and that this integral had properties
  that correspond to the Monotone Convergence Theorem and the Lebesgue
  Dominated Convergence Theorem (among others).
If this mathematical miracle occurred, then wouldn't this new approach
  be immediately adopted, at least at the junior/senior level course,
  and quickly worked into the calculus level? The answer is a
  resounding: No!
Proof.   In fact, such an integral has already been   developed and has been around for some time, but its existence has   remained
  largely unknown (except to readers of the Real Analysis   Exchange)
  and it has had very little, if any, educational impact   (known to
  this reviewer)."

See also the article Robert G. Bartle,  Return to the Riemann Integral
Amer. Math. Monthly 103 (1996), no. 8, 625–632.

A: I think it's ridiculous to call Riemann integrals obsolete. It's like saying rational numbers are obsolete because we have real numbers and they are complete while the rationals are not.

*

*In complex analysis, contour integrals are defined in a very similar way to the construction of Riemann integrals, not by measure theory. Students do not, and should not, need to learn about measure theory before learning complex analysis.

*The notion of equidistribution of a sequence is closely related to Riemann integrals, not Lebesgue integrals.

*Many practically-minded people are led to integrals in mathematical models for physical quantities based on the Riemann sum idea, not on measure theory (e.g., the expression of pressure or work as an integral).

*Monte Carlo integration, a practical method of computing high-dimensional integrals, is based on generalizing the idea of Riemann integration, not Lebesgue integration.

A: Try $\int \frac{\sin t}{t}$.  This is an old example and is partially bogus.  It is valid in that $\int \left| \frac{\sin t}{t} \right| \not < \infty$.  However, if we instead evaluate as $\lim_{A \rightarrow \infty} \int_{-A}^A \frac{\sin t}{t}$, we find (after a couple of tricky manipulations) that this is just as Lebesgue integrable as it is Riemann integrable.  However, the Riemann integral "cheats" -- it takes the (asymmetric) limit version of the integral as its definition, whereas the Lebesgue integral does not.
I'm pretty sure I can teach a computer, physicist, and engineer to compute Riemann sums and explain how the Riemann integral is the limit of such sums.  I can imagine the profound difficulties of teaching them Lebesgue integrals without starting with Riemann integrals.
An analogue of your question in Physics is "why do we teach people Newtonian Gravity when General Relativity is so much better?"  And the answer there is similar:  Some things are more easily computed via Newton and trying to understand Einstein without grasping Newton just doesn't work.

A: This rather open-ended problem has a variety of "answers" and I hope the readers will tolerate some more.
I have already given Dieudonne's viewpoint (which likely represents the Bourbaki position).  Bob Bartle's response
was after he had already written more conventional (successful) textbooks.  The Open Letter from the group of research mathematicians  should be read too.
Here is my own answer, too long for this web site, but a link is provided for the curious.

Thomson, Brian S.   Rethinking the elementary real analysis course.
Amer. Math. Monthly 114 (2007), no. 6, 469–490. DownLoad Link

Before clicking the link and reading perhaps we should allow Peter Bullen to have a word. He is a recognized authority
on integration theory with many research and expository papers on a variety of nonabsolutely convergent integrals.  This is his review
of the Monthly paper.

Math Reviews MR2321251 (2008c:26001) 26-01 (26A06 97D80)
This is an important paper for mathematical education and should be
read by anyone planning a course or about to write a text on analysis
or calculus. Ever since Henstock rather brashly said "Lebesgue is
dead!" at the Stockholm meeting in 1962 there have been many hardy
souls, colleagues, students and disciples of either Henstock or
Kurzweil suggesting the more reasonable and practical "Riemann is
dead!". Many papers have been written that make this point, as well as
books by both Henstock and Kurzweil, the author of the present paper,
Bartle, DePree and Schwarz, Leader, Lee and Výborný, Mawhin, McLeod,
McShane, and no doubt others; as well Dieudonné, in the book that is
quoted at the beginning of the present article, made the same point
from a completely different point of view. All argue that by now the
teaching of both the Riemann and Riemann-Stieltjes integrals should
cease; these integrals should be replaced by the Newton and Cauchy
integrals in elementary calculus courses and by the generalized
Riemann integral in elementary analysis courses, the latter being
taught in a way that would lead into Lebesgue theory in more advanced
courses. To date the conservative nature of academia has not heard
these arguments.
The present paper suggests a very attractive method for the elementary
analysis course mentioned above. The author has a rather extreme
aversion to the plethora of gauges and tags that are the norm in most
approaches to the generalized Riemann integral. Instead he suggests
that the basis of the analysis course should be Cousin's Lemma. This
very elementary formulation of the completeness axiom of the real line
allows for proofs of all the properties normally deduced from that
axiom, including the properties of continuous functions normally
considered in basic analysis courses— proofs that are both simple and
transparent. It further leads very naturally into the generalized
Riemann integral and later to measure theory if that is desired. The
paper is very clearly written and is very persuasive but is not an
easy read, especially towards the end, and the reader may need the
help of a standard book on the generalized Riemann integral. In
addition the author shows that a simple recent extension of Cousin's
Lemma will allow some very neat proofs of more subtle properties that
may or may not be appropriate for the first analysis course but
certainly would allow for the progression to a more advanced course
and to measure theory.
It is difficult to change a very
well-established academic and publishing tradition but the reviewer
hopes that this article will start at least the beginnings of a
change. There are already non- or semi- commercial web texts that are
moving in this direction, some under the influence of the Dump-the-
Riemann-Integral-Project (see
http://classicalrealanalysis.info/resources-drip.php)  and others less
radical being produced by the Trillia Group (http://www.trillia.com).
These should all be explored by anyone teaching in this field.
Reviewed by P. S. Bullen

A: There is one theorem in ergodic theory where Riemann integrability appears to be the right assumption. Let $\alpha$ be an irrational number in $[0,1)$ and consider $\varphi\colon[0,1)\to[0,1)$, the translation by $\alpha$ mod 1,
$$
  \varphi(x) := (x+\alpha) \text{ mod } 1.
$$
Let $R_\pi[0,1]$ denote the set of all Riemann integrable functions $f$ on $[0,1]$ with $f(0)=f(1)$ and consider the Koopman operator
$$
  R_\pi[0,1] \ni f \mapsto Tf := f\circ\varphi \in R_\pi[0,1].
$$
Then $T$ is mean ergodic,
$$
  \frac1n \sum_{k=0}^{n-1} T^kf(x) \to \int_0^1 f(t)\,dt
$$
uniformly for $x\in[0,1]$.
Note that the restriction of $T$ to $C_\pi[0,1]$ is also mean ergodic, but this space is too small for applications such as the following: the sequence $(n\alpha\text{ mod }1)_{n\in\mathbb N}$ is equidistributed in $[0,1)$, meaning that the relative frequency of sequence elements falling into any given interval $[a,b]\subseteq[0,1)$ converges to $b-a$.
Source: Operator Theoretic Aspects of Ergodic Theory by Eisner, Farkas, Haase and Nagel.

A: I have tried to make this point before.  Usually I find it best to quote from the "gods," in this case the god-given one:
...
J. Dieudonné, Foundations of Modern Analysis. (Pure and Applied Mathematics, Vol. X) XIV + 316 S. New York 1960. Academic Press Inc.

"Finally, the reader will probably observe the conspicuous absence of
  the time-honored topic in calculus courses, the `Riemann integral.'
  It may well be suspected that, had it not been for its prestigious
  name, this would have been dropped long ago, for (with due reverence
  to Riemann' s genius) it is certainly quite clear to any working
  mathematician that nowadays such a "theory'' has at best the
  importance of a mildly interesting exercise in the general theory of
  measure and integration.
Only the stubborn conservatism of academic tradition could freeze it
  into a regular part of the curriculum, long after it had outlived its
  historical importance.   Of course, it is perfectly feasible to limit
  the integration process to a category of functions which is large
  enough for all purposes of elementary analysis, but close enough to
  the continuous functions to dispense with any consideration drawn from
  measure theory; this is what we have done by defining only the
  integral of regulated functions.   When one needs a more powerful tool
  there is no point in stopping halfway, and the general theory of
  (Lebesgue) integration is the only sensible answer."

In all fairness I should point out the case for the defense to be found here:

Regulated Functions: Bourbaki's Alternative to the Riemann Integral,
  S. K. Berberian,  The American Mathematical Monthly, Vol. 86, No. 3
  (Mar., 1979), pp. 208-211.

A: The fact that continuous functions are Riemann-integrable is implicit in the background of many general results involving integration on locally compact groups.  For instance, Haar measure is typically constructed via the Riesz representation theorem by specifying what the integral of a continuous function with compact support should be, and a common way to do this is by a construction very similar to Riemann sums (see, for instance, the construction of Haar measure in Folland's A Course on Abstract Harmonic Analysis, Theorem 2.10).  It is also useful in various arguments to know that the integral of a continuous function can be approximated by taking sums of values of the function at finite sets of points that get denser and denser (i.e., Riemann sums).
Of course, these results don't use any heavy theory of the Riemann integral per se (and are in fact usually formulated using the language and methods of measure theory), but they still demonstrate the value of understanding that (some) integrals can be computed as limits of Riemann sums, even for highly theoretical purposes.

A: As there is an abundance of opinions on the topic raised by our questioner here (and the topic has attracted a few viewers) I can hardly resist adding another answer.  This letter was distributed to publishers' representatives at the Joint Mathematics Meetings in San Diego, California, in January 1997.
AN OPEN LETTER
To: The authors of calculus textbooks

From: Several authors of more advanced books and articles -

***-
Robert Bartle, USA <mth bartle@emuvax.emich.edu>
Ralph Henstock, Ireland <r.henstock@ulst.ac.uk>
Jaroslav Kurzweil, Czech Republic <kurzweil@mbox.cesnet.cz>
Eric Schechter, USA <schectex@math.vanderbilt.edu>
Stefan Schwabik, Czech Republic <schwabik@beba.cesnet.cz>
Rudolf Výborný, Australia <R.Vyborny@mailbox.uq.edu.au>

Subject: Replacing the Riemann integral with the gauge integral
It is only an accident of history that the Riemann integral is the one used in all calculus books today. The gauge integral (also known as the generalized Riemann integral, the Henstock integral, the Kurzweil integral, the Riemann complete integral, etc.) was discovered later, but it is a "better" integral in nearly all respects. Therefore, we would like to suggest that in the next edition of your calculus textbook, you present both the Riemann and gauge integrals, and then state theorems mainly for the gauge integral.
This switch would only require altering a few pages in your calculus book. Any freshman calculus book is devoted almost entirely to derivatives and antiderivatives -- how to compute them and how to use them; that material would not change at all. The only changes would be in the more theoretical sections of the book -- i.e., the definitions and theorems -- which take up only a few pages.
The reasons for making this change are twofold: (i) It would actually make some parts of your book more readable. Some definitions and theorems can be stated more simply (and more strongly) if the gauge integral is used instead of the Riemann integral. This is particularly true of the Second Fundamental Theorem of Calculus, discussed below. (ii) It would be a better preparation for the handful of calculus students who will go on to higher math courses. The gauge integral is far more useful than the Riemann integral, as a bridge to more advanced analysis.
The idea of introducing the gauge integral to college freshmen is not entirely new; it was promoted, for instance, in the paper "The Teaching of the Integral" by Bullen and Výborný, Journal of Mathematical Education in Science and Technology, vol. 21 (1990). However, we feel that the idea deserves wider promotion; hence this letter.
Introduction to the integral. If you are not already familiar with the gauge integral, we would recommend the article by Bartle in the American Mathematical Monthly, October 1996; it provides a quick introduction to the subject and gives most of the main references. Perhaps a second introduction would be the book of DePree and Swartz (Introduction to Real Analysis, Wiley, 1988); it is written for advanced undergraduates and is probably the most elementary among the currently available introductions to this subject. Professors Bartle and Schechter have volunteered to make themselves available, at least to some extent, to answer further questions you may have about this subject.
The definition. The gauge integral is a very slight generalization of the Riemann integral. Instead of a constant $\epsilon$ and a constant $\delta$, it uses a constant $\epsilon$ and a function $\delta$. The two definitions can be formulated so that they are nearly identical, and then placed side by side. This would be helpful to the teachers who are using the book and learning about the gauge integral for the first time.
We think that the slight increase in the complexity of the definition will make little difference to the students learning from the book. It has been our experience that, for the most part, freshman calculus students do not fully grasp the definition of the Riemann integral anyway; it is just too complicated for students at that level. The definition of the Riemann integral is included in a calculus book more for completeness and integrity than for teaching. The few students who have enough mathematical maturity to grasp the definition of the Riemann integral will probably have no greater difficulty with the gauge integral, and they will benefit from being exposed to this concept in their calculus book.
Existence and nonexistence of integrals. In recent calculus books it is customary to state without proof that continuous functions and monotone functions on a compact interval are Riemann integrable. The omission of the proofs is unavoidable -- a proof would involve the completeness of the reals, uniform continuity on compact intervals, and other notions that are far beyond the reach of freshmen.
Any Riemann integrable function is also gauge integrable. Many more functions are gauge integrable, as will be evident later in this letter; see especially our remarks about the Dominated Convergence Theorem.
[Remainder of the letter omitted but can be found on the internet.  We have since lost Bartle, Henstock, and Schwabik. I hope the others are well.]


text:
Q: Reading variable name of dataframe into another dataframe using loops So using a for loop I was able to break my 1.1 million row dataset in r into 110 tables of approximately 10,000 rows each in hopes of getting r to handle the data better. I now want to run another for loop that assigns the values in each of these tables to a different dataframe name.
My table names are:
Pom_1
Pom_2
Pom_3
...

Pom_110
What I want to do is create a for loop like the following:
for (i in 1:110)
{
  Pom <- read.table(paste("Pom",i,sep = "_"))
  for (j in 1:nrows(Pom))
  {do something}
}

So I want to loop through the array and assign the values of each Pom table to "Pom" so that I can then run a for loop on each subsection of Pom. This problem is the read.table function does not seem to be the right one. Any ideas?

A: Can you give a more specific example of what you want to do withing each dataframe? You should avoid using the inner loop when possible and if you really need to have a look at ?apply
nrow instead of nrows

A: This is a generic solution using a example data.frame. The function you're looking for is assign, check it's help page:
Pom = data.frame(x = rnorm(30)) #original data.frame

n.tables = 3  # number of new data.frames you want to creat

Pom.names = paste("Pom",1:3,sep="") # name of all new data.frames

breaks = nrow(Pom)/n.tables * 0:n.tables  # breaks of the original data.frame

for (i in 1:n.tables) {
    rows = (breaks[i]+1):breaks[i+1]  # which rows from Pom are going to be assign to the new data.frame?
    assign(Pom.names[i],Pom[rows,]) # create new data.frame
}

ls()

[1] "breaks"    "i"         "n.tables"  "Pom"       "Pom.names" "Pom1"
[7] "Pom2"      "Pom3"      "rows"

A: I'm willing to bet the problem with your table call is that you aren't specifying the file extension (assuming Pom_1 - Pom_110 are files in your working directory, which I think they are since you're using read.table).
You can fix it by the following
fileExtension<-".xls"   #specify your extension, I assume xls
for (i in 1:110)
{
  tablename<-paste("Pom",i,sep = "_")
  Pom <- read.table(paste(tablename, fileExtension, sep=""))
  for (j in 1:nrows(Pom))
  {do something}
}

Of course that's assuming a couple things about how everything in your problem is set up, but it's my best guess based on your description and code


text:
Q: Cannot access Page without authentication I deployed the sample application (the blue one you get when you create a new project) to IIS7 on Windows Server 2008. When I try to access mysite.com/home/about I get redirected to Accoun/Login.
This does not happen when I run the site on VS integrated server.
I did not change any code in the project, so it sems to be an issue on the server.
IIS is set to integrated mode. Any ideas what is wrong?

A: Further on eu-ge-ne's answer, if 'Anonymous Authentication' is enabled then you need to make sure the user it is impersonating (default IUSR) has read access to your website directory.
If you have set it to use your application pool identity's user (default NETWORK SERVICE) then obviously make sure that that user has read access to your website directory.

A: Check if the "Anonymous Authentication" is enabled in the IIS/Authentication settings


text:
Q: ohmyfetch (Nuxt 3 $fetch) how to remove 'text/plain;charset=UTF-8' from content-type header? I am trying to send a post request to PostgREST to invoke a stored procedure:
  const data = await $fetch('http://http-logger:3001/rpc/test_proc', {
    method: 'post',
    headers: {
      Prefer: 'params=single-object',
      Accept: 'application/json',
      'Content-Type':  'application/json'
    },
    body: {some: 'json'}
})

Results in this request:
POST /rpc/test_proc HTTP/1.1
host: http-logger:3001
connection: keep-alive
prefer: params=single-object
accept: application/json
content-type: application/json, text/plain;charset=UTF-8
accept-language: *
sec-fetch-mode: cors
user-agent: undici
accept-encoding: gzip, deflate
content-length: 15

{"some":"json"}

I need to remove the 'text/plain;charset=UTF-8' part from the content-type. Is this possible? Should it even be there as I have explicitly defined the content-type header?
Many thanks
Ian


text:
Q: Using AWS Lambda to periodically monitor state of a remote resource I need to implement the following feature in the backend on AWS:
- API endpoint which allows a user to start a particular long running "process" in a remote system
- the process status in this remote system should be monitored periodically (every few-several seconds) for status and when status == complete, trigger an action (the remote system does not support sending/triggering notifications or callbacks)
We use primarily lambda functions so I'm thinking about approaching it in the following way:
- my endpoint which is triggered by the user would call remote system to start the process, store record in internal DB and generate a message to SQS (with a delivery delay of X seconds)
- there would be a second lambda that would read messages from SQS & check status of the process in this remote system. When status == complete, trigger an action, when status != complete, generate another message to SQS which would again the same lambda would pick up after X seconds of delay and repeat the check and so on
I'm wondering if there is a better solution/tools to implement this kind of monitoring/notification pattern in the AWS since I'm not that familiar with all the services that AWS provides.
Would anyone comment on this approach and perhaps suggest an alternative if there is one?

A: Take a look at AWS Step Functions which I think is the best fit for your use case.
All you need to do is, instead of generating a SQS message, initiate an execution of a StateMachine in StepFunctions.
The following tutorial explains a iterator loop with a counter. But you can use the same logic to check the status and keep looping until status == complete
https://docs.aws.amazon.com/step-functions/latest/dg/tutorial-create-iterate-pattern-section.html
Another useful resource which I think very close to your use case
https://docs.aws.amazon.com/step-functions/latest/dg/sample-project-job-poller.html


text:
Q: How do I add weights for edges, when I specified multiple edges, not just 1 specific edge? Networkx For the following code:
import networkx as nx
import matplotlib.pyplot as plt

G = nx.DiGraph()

#Set 1
G.add_edges_from([('A','B'),('A','C'),('C','B')])
#Set 2
G.add_edges_from([('D','A'),('D','B'),('D','C')])
#Set 3
G.add_edges_from([('E','D'),('E','B'),('E','C')])

pos = nx.spring_layout(G)

nx.draw_networkx_nodes(G,pos, node_size=500, node_color = 'green')

nx.draw_networkx_edges(G,pos, edgelist = G.edges())

plt.show()

I want to add weights to the edges. To my understanding, the weights are just 1 for all the edges. I want to modify the weights of every single edge in the graph.
From the follow documentation, I see that you can change the weight of a single node by adding :
https://networkx.org/documentation/stable/reference/generated/networkx.linalg.attrmatrix.attr_sparse_matrix.html
I want to add different weights to each edge. For example, ('A','B') is 0.1 weight, ('A', 'C') is 0.2 weight, etc.
I also looked at the following post:
NetworkX: how to add weights to an existing G.edges()?
However, it looks like they are iterating through each edge for a specific weight for all all edges, which is not what I want, rather I want specific weights for specific edges.

A: When adding the edges one can specify a dictionary containing arbitrary edge properties:
from networkx import DiGraph
G = DiGraph()
G.add_edges_from([('A','B', {'weight': 0.1}),('A','C', {'weight': 0.2})])
print(G.edges(data=True))
# [('A', 'B', {'weight': 0.1}), ('A', 'C', {'weight': 0.2})]

Alternatively, one can specify a triplet, where the first two elements are source/destination and the third element is weight, and then use the .add_weighted_edges_from method:
from networkx import DiGraph
G = DiGraph()
G.add_weighted_edges_from([('A','B', 0.1),('A','C', 0.2)])
print(G.edges(data=True))
# [('A', 'B', {'weight': 0.1}), ('A', 'C', {'weight': 0.2})]


text:
Q: Subclipse error -- Subversion Native Library not available I am getting the following message everytime the PHP project based on Subversion loads...

Obviously shown, the OS is a Mac OSX Mountain Lion.
I have also followed the instructions within the link, and it still appears at completely random times.
However, subversion actions seem to work fine.

A: Your error is that the library has been loaded in another classloader.  I can only guess you have some other Subversion plugin installed (so that you have more than one) and the other one has already loaded the library so it cannot be loaded again.
Aside from figuring that out and removing the other plugin, I would guess you can just install the SVNKit plugin and configure Subclipse to use it instead of JavaHL.  The SVNKit plugin is on the Subclipse update site.

A: From main menu, select

Window -> Preferences -> Team -> SVN,

at right panel "SVN interface" zone.
You may find "client" is set to "JavaHL(JNI) Not Available".
Change it to "SVNKit(Pure Java) SVNKit vx.x"


text:
Q: How can I set the FindReplace box in VBA to allow Word Document editing while the box is still active? I'm trying to code some routines in VBA for Word that use regular expression to search for certain elements in documents. I got this code (please disregard for now that it's coded using Selection, it's just a mock-up to see if the workflow is sound):
With Selection.Find
.ClearFormatting
.Replacement.ClearFormatting
End With
With Selection.Find

    .Text = "[0-9]{5,}"
    .Replacement.Text = ""
    .Forward = True
    .Wrap = wdFindContinue
    .Format = False
    .MatchCase = False
    .MatchWholeWord = False
    .MatchWildcards = True
    .MatchSoundsLike = False
    .MatchAllWordForms = False
    .Execute
End With
If Selection.Find.Found = True Then
    Dialogs(wdDialogEditReplace).Show
End If

and it works in the sense that it does find 5+ digit numbers. However I would like the user to have the ability to edit the found number or any other part of text while the box is still active, to continue to search once the editions are finished. I'd be grateful for any tips on how to solve this issue.

A: The closest you will get is to use your code to set the Find parameters and then execute the Find dialog button, as shown below.
With Selection.Find
    .ClearFormatting
    .Replacement.ClearFormatting

    .Text = "[0-9]{5,}"
    .Replacement.Text = ""
    .Forward = True
    .Wrap = wdFindContinue
    .Format = False
    .MatchCase = False
    .MatchWholeWord = False
    .MatchWildcards = True
    .MatchSoundsLike = False
    .MatchAllWordForms = False
End With
Application.CommandBars.ExecuteMso ("FindDialog")

This will leave the user to press Find Next to get the first match but will allow the dialog to work as normal, enabling edits.


text:
Q: Is there a way to tell Android Studio 3.0.1 to highlight exception throwers? Is there a way to tell Android Studio 3.0.1 to highlight every method in a code that can throw an exception? To identify where to use "try - catch".

A: In java methods that throw an exception that has to be caught (put inside try/catch block), the code will not compile until you do, so you will get a red line / compilation error if you don't.
Those are called checked exceptions which are exceptions that has to be caught, like IO.
Other exceptions, which are not checked, or run time exceptions, normally shouldn't not be handled by a try/catch, but you need to guard for them or fix them.
For example, instead of catching NullPointerException, you should check for null if the instance can be null.

A: In the current Android Studio 4, when standing on the throw, the throwing lines are highlighted.
Ctrl+Shift+F7 will let you choose an existing one.


text:
Q: How can I guarantee registering for a notification happens in a view controller before didFinishLaunchingWithOptions? Specifically, I want to register for a notification -before posted by the didFinishLaunchingWithOptions- in my main view controller so I can perform a task from the 'splash' (forgive me Ob-C nerds, forgot what its really called) screen without doing the ominous
[[[[[[UIApplication sharedApplication] delegate] window] rootViewController] topViewController] functionIwantToCallOnceAtTheStart];

Side note: I love the idea of having a 'global start whistle,' why is this not a default?
Logging didFinishLaunchingWithOptions and the root view controller's delegate methods results in
2013-07-25 02:02:46.532 Tests[918:c07] awakeFromNib
2013-07-25 02:02:46.535 Tests[918:c07] didFinishLaunchingWithOptions
2013-07-25 02:02:46.538 Tests[918:c07] viewDidLoad
2013-07-25 02:02:46.539 Tests[918:c07] viewWillAppear
2013-07-25 02:02:46.540 Tests[918:c07] viewWillLayoutSubviews
2013-07-25 02:02:46.543 Tests[918:c07] viewDidLayoutSubviews
2013-07-25 02:02:46.544 Tests[918:c07] viewWillLayoutSubviews
2013-07-25 02:02:46.545 Tests[918:c07] viewDidLayoutSubviews
2013-07-25 02:02:46.549 Tests[918:c07] viewDidAppear

but is it guaranteed that awakeFromNib will always come before didFinishLaunchingWithOptions, and on all iOS devices/versions?
This question has a helpful answer but my project is using storyboards, and I am unsure of the implications of setting the rootViewController manually with a storyboard.
Edit:
I originally asked this question because I wanted to have the launch image animate away. I realize there are better methods to do this, but I still want to use the "Application Started" notification to launch a network request to populate my main view controller (a UITableViewController) as soon as the app is started.

A: awakeFromNib is guaranteed to be called on the initial view controller of your storyboard before applicationDidFinishLaunching is called. Loading from the nib is part of the launch.
However, its not really clear from the question what you're trying to do. While the launch image is displayed, your view controller isn't really there, so what are you asking it to do? None of the UI objects will be present until it has loaded, so whatever task you're trying to do may not come under the responsibility of a view controller.

A: If you really really want to run some code, you can open up the main class. It's in your project under supporting files.
Also, this guide explains quite a bit on the appication startup sequence:
http://oleb.net/blog/2012/02/app-launch-sequence-ios-revisited/

A: The point of the launch image is to make your app appear to launch faster than it really does by putting a static image on screen as soon as possible. As long as your launch image looks exactly like whatever view your initial view controller shows, nobody will know the difference. If you want that initial image to animate away somehow, no problem:

*

*Create an initial view controller that displays your image and does a custom transition to your next view controller.

*If the image you're displaying covers the screen exactly, you can also use that image as the launch image. Otherwise, run the app and do a screen capture when the first view controller's view appears; make that screen shot your launch image.

*Put some code in your -application:didFinishLaunchingWithOptions: method to start the transition from the initial view controller to the next one.
That should do it. Remember that the launch image is a sort of implementation detail -- the user isn't supposed to be aware of it as a separate thing, so it's natural to do what you're trying to do as a view controller transition instead of fooling around with the launch image itself.


text:
Q: Dynamic Data Extract Tools I've been searching around for a few weeks now for a tool that either is fully built or a direction of something I could build for dynamically extracting data via a web interface.  Basically, what I'm looking for is a way to give users a list of all available data objects from our database and then let them pick ones from the list they'd like to view and set parameters then export the results to an excel file.
Right now we're doing it purely with SQL statements but we have hundreds of objects so as you might imagine, those statements are really complex and prone to errors.  It would be great if there was a tool available to do this or if someone had an idea of an easy way to organize this.  Any help would be greatly appreciated.
We've looked at BI tools like QlikView and Tableau but that is probably overkill for what we're trying to do.  The open-source BI tools we've looked at seemed really primitive in their functionality.  The other thing we looked at was MSAS (our DB is SQL Server) but I'd prefer something that was more database-agnostic and lived on a web server instead of on the database.

A: I think what you are describing is a typical BI reporting tool. I don't know what open-source BI tools you have been looking at but there are open source solutions which aren't "primitive" at all. The two main open-source reporting libraries are JasperReports and BIRT. You can design report templates within a graphical interface (NetBeans plugin called iReport for Jasper, Eclipse plugin for BIRT). A simple report template is basically an xml file which contains a parameterized SQL query and describes how to display the query results.
End-user typically connect to a web application (Java EE app which uses the reporting library) which executes the report templates : it asks the user to input parameters in a graphical way such as drop-down lists and checkboxes, and then retrieves the SQL query results from the database, and displays them according to the template (tables, charts, etc.). These results can then be exported in many formats including xls.
JasperReports developers provide a free open-source webapp designed to run Jasper reports, called JasperReports Server. Other open-source projects let you execute reports designed either with BIRT or Jasper, for instance ReportsServer which I haven't tested.
At my company we use SpagoBI, which is a fully-fledged free and open source Business Intelligence suite. This means that it has all the features of a commercial BI suite. The most useful is probably the ad-hoc query editor, which lets users with little technical knowledge design simple queries by dragging and dropping fields, and it performs the underlying table joins for them. It then lets users design simple reports such as pie charts or line charts from the data they just extracted. This sort of feature is part of the commercial editions of JasperReports Server and Actuate One (the BIRT equivalent of JasperReports Server which doesn't have a free version).
SpagoBI is a great, powerful tool and I recommend it, but it is also quite difficult to configure and to master. Maybe if your needs are only to execute pre-defined reports you had better go with one of the other solutions.

A: PowerPivot, Data Explorer, or Microsoft Query?
Sorry, didnt see that you wanted a web interface...

A: You can try get some export data functions from SQL Web Data Administrator - http://sqlwebadmin.codeplex.com/
Or you can install the web tool but restrict access for its web-page other then export data pages.

A: Cognos BI (specifically, the web-based Query Studio) fits this tab perfectly and is a great tool to deploy to non-technical web users.
It does require a pretty robust setup and is not cheap but it is an enterprise-class product. I've only worked with the full-scale deployment but they also have an Express product for small/midsize companies.
If you could clarify number of users, database size, expected query volume, and budget, we could refine the toolset further...


text:
Q: Difference between /dev and /sys Exactly what is the difference between devfs and sysfs? Both seem to maintain a list of hardwares attached to the system. Then why the need for 2 separate fs even arose? As far as I can get /sys maintains somewhat "raw" list of devices(like "ser0"). Udev acts on those devices, gets various informations and applies various rules to present them as recognizable names which are then mapped onto /dev(like "camera"). Is this the only reason? And then we mount the corresponding devices from the /dev fs(can't we do that from the /sys fs) into the /media fs.
I have read the answer at Difference between /dev and /sys/class?. But I cannot get the sys fs part where it states that

Sysfs contain the hierarchy of devices, as they are attached to the computer

Are the files in /sys not device node files? Then what type of files are they?

A: The /sys filesystem (sysfs) contains files that provide information about devices: whether it's powered on, the vendor name and model, what bus the device is plugged into, etc. It's of interest to applications that manage devices.
The /dev filesystem contains files that allow programs to access the devices themselves: write data to a serial port, read a hard disk, etc. It's of interest to applications that access devices.
A metaphor is that /sys provides access to the packaging, while /dev provides access to the content of the box.
The files in /sys are not device nodes, but symbolic links and regular files. Those regular files are special in that reading or writing to them invokes file-specific functions in the kernel, like device nodes. The difference is that files in /sys work this way because of the filesystem they are on, whereas device nodes work this way due to their device node characteristics (the file type indicating a (block or character) device, and the device major and minor number indicating which device it is).
The reason for /dev existing independently of /sys is partly historical: /dev dates back to the dawn of Unix, while /sys is a much more recent invention. If Linux was designed today with no historical background, /dev/sda might be /sys/block/sda/content.

A: *

*/dev directory allows access to the device via the device files (or device nodes)

*/sys directory allows the viewing of the device information and details.

for instance: cat /sys/block/*/device/serial (with * replaced by nvme0n1 or sda or hda ... depending on your case) will print the serial number of the disk storage.


text:
Q: How to put button in up-right corner? How can i put a button in up-right corner? I was trying a lot of CSS things, but i really can't understand them, and they doesn't work. Can someone tell me something simple and that works? Here is HTML & CSS of my button.
HTML: < a href="#" class="myButton">green< /a>
CSS: http://www.stefanpage.ml/questions/css-1.html
Every answer is useful! :)
This is how i mean that.

A: Are you looking for something like this:
.myButton {

    padding: 30px;
    display:block;
    background-color: green;
    color: white;
    text-align:center;
    position: absolute;
    top: 10px;
    right: 10px;

}

https://jsfiddle.net/6dg8nc4u/
Please mark as correct answer if that's what you are looking for.
Thanks!

A: .myButton {
    position: fixed; /* or position: absolute; */
    top: 0;
    right: 0;
}

That is only the code for the positioning. All other styling is left out.

A: position: absolute;
top: 10px;
right: 10px;


text:
Q: WebAPI Model Binding from JSON I am creating an application using Durandal, with WebAPI as the server. I have a KendoUI grid that displays the data from the server correctly and functions properly until the POST or PUT methods are called. Here is my GET method:

and you can see that that data binds to the UI (used the data-bind extensibility in Durandal to change to kendo bindings):

Then I edit the data in the Grid and it passes the changes inside the request to the server as you can see in this Fiddler result:

On the server side I cannot get the data that is passed from the client to bind to anything I place as a parameter for the method on the POST or PUT.

I realize this is a couple different technologies to troubleshoot (e.g. Durandal, KnockoutJs, Kendo DataBinding, and WebAPI) but I think the fundamentals are working, the data is retrieved and bound to the UI and it is posted back when changed, but the WebAPI endpoint cannot bind to the data.
How can I get the passed "models" array to bind through the ModelBinding structure in WebAPI?
UPDATE- Here is the helpful JSFiddle that gave me the correct Content-Type to add: http://jsfiddle.net/Xhrrj/1/
new kendo.data.DataSource({
    transport: {
            read: {
                type: "POST",
                url: "../cccs/service.svc/SupplierSearch",
                contentType: "application/json; charset=utf-8",
                dataType: 'json'...
this is coming from the Telerik forum here

A: It looks as if it was mixing up form-urlencoded with json format - if you lookat the decoded string it is sending models= and then urlencoded JSON objects follow.

A: From my experience I think that your PUT end point declaration needs to look like this:
[HttpPut]
public void Put([FromBody]IEnumerable<Product> models) { }

So you need the FromBody attribute because your product array is in the body (I think?) and not in the url of the request.


text:
Q: Does hashing the salt add any security? I have been thinking very hard about securing my web application even further from brute-force attacks and over-all security. I know that we can store our salt value in plain-text and we still have good security.
Would hashing our salt value add more security to the web application or is it a waste of time and resources on the server?

A: At the end you have to concatenate the password and the salt value, so you need to have the original salt value. If you hash the salt value, you do not have its original value anymore since hashing is a one-way function, so I don't think that hashing the salt would be useful (if I understood your question correctly).

A: The purpose of a salt is to prevent hackers from accessing the password through pre-calculated rainbow tables. The only way of achieving the password then (implyingi a good hashing algorithm is used) is to brute force, which would take equally long whether the salt is encrypted or not.

A: No you would not gain anything.
If you hash your password with a salt, and then store a hash of the salt in the database, you won't be able to verify the password.
If you hash the salt, and then use this salt-hash to hash the password, you only exchanged the salt. You will have to store the salt-hash in the database and it acts like the original salt. The time to hash the salt you spend better in doing more iterations on the password hashing.


text:
Q: What types of files can I upload with the Wordpress Uploader? I have a domain with Wordpress 3.4.2 installed on it. (This is NOT a Wordpress.com site)
What kind of files can I upload? I know .jpeg, .gif, .png, .mp3, etc. are accepted, but where can I find a complete list of the accepted file types?
Basically, what can I upload via this screen:

A: From http://codex.wordpress.org/Uploading_Files  :
WordPress supports uploading the following file types:

Images
.jpg .jpeg .png .gif
Documents
.pdf (Portable Document Format; Adobe Acrobat) .doc, .docx (Microsoft
  Word Document) .ppt, .pptx, .pps, .ppsx (Microsoft PowerPoint
  Presentation) .odt (OpenDocument Text Document) .xls, .xlsx (Microsoft
  Excel Document)
Audio
.mp3 .m4a .ogg .wav
Video
.mp4, .m4v (MPEG-4) .mov (QuickTime) .wmv (Windows Media Video) .avi
  .mpg .ogv (Ogg) .3gp (3GPP) .3g2 (3GPP2)
Not all web hosts permit these files to be uploaded. Also, they may not
  permit large file uploads. If you are having issues, please check with
  your host first.

That bottom note means that you may be limited on the size of file uploads via your or your web host's php.ini file, and file type uploads may also be limited in php.ini or .htaccess, depending on what you have configured or what your web host has configured.


text:
Q: Merging multiple similar tables together with missing items and value Please help. I need to combine a lot of .txt files into 1 summary .txt file. For example, my 1st file:
Name1
A    1
B    4
C    5

my 2nd file:
Name2
A    3
D    2
E    1

I need to make a file like this:
    Name1    Name2
A    1        3
B    4        0
C    5        0
D    0        2
E    0        1

As you can see, my 2 files have similar format but they have both common (A) and unique (B,C,D,E) components. To combine them together, I am thinking about making dictionaries which take Name1 and Name2 as dictionaries' names. However, I do not know how to dynamically pass name for the dictionaries if I have like 100 files.
After that, I am thinking about creating a common dictionary which has all the keys from every file. Then, I will compare my keys from each file to that common dictionary, any missing keys will be added with value 0.
I don't know what to do next to make it print into the format that I want.

A: You should use pandas for dataframe operations.
Here's the solution using pandas
import pandas as pd

df1 = pd.DataFrame({'name1':[1,4,5]}, index=['A','B','C'])
df2 = pd.DataFrame({'name2':[3,2,1]}, index=['A','D','E'])

df_new = df1.join(df2, how='outer')
df_new.fillna(0)

Output:
    name1   name2
A   1.0     3.0
B   4.0     0.0
C   5.0     0.0
D   0.0     2.0
E   0.0     1.0

Edit
First convert your .txt files into csv or tsv files to be read by pandas using pd.read_csv()


text:
Q: Can't connect to EC2 instance via web browser I'm a total newbie when it comes to servers and EC2 but I have an EC2 instance running which was stopped and restarted.  Since that I haven't been able to connect via a web-browser to the site but can connect via SSH.  Are there any ideas why this could be the case?

A: Here is the debug checklist:

*

*Check your server, make sure it is up and running in AWS management console.

*Check port security setting, from your local machine. If it is close open it in security group.

telnet your_ip 80 # Check http port
telnet your_ip 22 # Check SSH port

*Check your web server, Apache, Nginx, etc. If you cannot find your process, start it.

ps -ef | grep -e nginx -e httpd -e apache

*Check your virtual host config, make sure you web server is listening to port 80 (http) or 443 (https).

*Run chkconfig and make sure your web server will start as a service.

A: Check the security group in your instance property, it is probably allowing only SSH (default), you may want to add a inbound rule allowing HTTP traffic.


text:
Q: Recurrence relation and induction I have this given recurrence relation:
$T(n) = 3T(\lfloor n/2 \rfloor)$
Initial value: $T(1) = 1$
and I should show that $T(n) = O(n^{\alpha})$ and $\alpha = log_2(3)$
to solve that I should define: $P(n) :\Leftrightarrow T(n) \leq n^{\alpha}$ and $P(n)$ holds for all $n \geq 1$ and I should show that by induction.
But I don't understand what that $P(n) :\Leftrightarrow T(n) \leq n^{\alpha}$ means?
Is $P(n) = T(n)$?

solution:
Base:
$n \geq 1$ and $n = 1$
$$3T(\lfloor 1/2 \rfloor) \leq 1^{log_2(3)}$$
$$\lfloor 3/2 \rfloor \leq 1^{log_2(3)}$$
$$1 \leq 1$$
Hypothesis:
$$3T(\lfloor n/2 \rfloor) \leq n^{log_2(3)}$$
Step:
$T(n) = 3T(\lfloor \frac{n}{2} \rfloor) \\
\leq (\frac{n}{2})^{log_2(3)} \\
= 3^{log_2(\frac{n}{2})} \\
= 3^{log_2(n)- log_2(2)} \\
= 3^{log_2(n)- 1} \\
\leq 3^{log_2(n)} = n^{log_2(3)}
$
is that right?

A: Prove, by induction on the number of binary digits of $n$, that $T(n)=3^{\lfloor\log_2n\rfloor}$. Since $3^{\log_2n}=n^{\log_23}$, $\frac13n^{\log_23}\lt T(n)\le n^{\log_23}$.


text:
Q: How to open two JFrame at the same time? I have two objects JFrame and when I invoke them since the same class, first one is opened and when it finishes its execution, it starts the other one.
It's the first time that I work JFrame.

A: Try this, as mentioned by martin.
/**
 * @author iGeeks
 * @date   2015-01-08
 */

package ly.gress.frames;

import javax.swing.JFrame;

public class TestTwoFrames implements Runnable{

    JFrame theFrame;

    public TestTwoFrames(JFrame f) {
        this.theFrame = f;
    }

    // Run two Frames in separate therads
    public static void main(String[] arguments) {
        JFrame f1 = new JFrame("f1 title");
        JFrame f2 = new JFrame("f2 title");

        Thread t1 = new Thread(new TestTwoFrames(f1));
        Thread t2 = new Thread(new TestTwoFrames(f2));

        t1.start();
        t2.start();
    }

    @Override
    public void run() {
        theFrame.setSize(200, 200);
        theFrame.setVisible(true);

        // Attention: This closes the app, and therefore both frames!
        theFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    }

} // end class TestTwoFrames


text:
Q: How to put a value to each row of the column name that matches the condition I have been attempting turn 0 to 1 with pandas if the column name matches the year in each list.
the last if statement gives an error.
df

+-----------+------------+------+------+------+------+------+------+------+------+------+------+
|   start   |    end     | 2012 | 2013 | 2014 | 2015 | 2016 | 2017 | 2018 | 2019 | 2020 | 2021 |
+-----------+------------+------+------+------+------+------+------+------+------+------+------+
| 2017/1/29 | 2019/9/10  |    0 |    0 |    0 |    0 |    0 |    0 |    0 |    0 |    0 |    0 |
| 2012/1/30 | 2015/9/11  |    0 |    0 |    0 |    0 |    0 |    0 |    0 |    0 |    0 |    0 |
| 2019/1/31 | 2021/05/08 |    0 |    0 |    0 |    0 |    0 |    0 |    0 |    0 |    0 |    0 |
| 2016/2/1  | 2017/9/13  |    0 |    0 |    0 |    0 |    0 |    0 |    0 |    0 |    0 |    0 |
| 2017/2/2  | 2019/9/14  |    0 |    0 |    0 |    0 |    0 |    0 |    0 |    0 |    0 |    0 |
| 2017/2/3  | 2021/05/08 |    0 |    0 |    0 |    0 |    0 |    0 |    0 |    0 |    0 |    0 |
| 2020/2/4  | 2020/9/16  |    0 |    0 |    0 |    0 |    0 |    0 |    0 |    0 |    0 |    0 |
+-----------+------------+------+------+------+------+------+------+------+------+------+------+

for index, row in df.iterrows():
 s_year = int(row['start'][:4])
 e_year = int(row['end'][:4])

 l_years = []
 l_years.append(s_year)

 while s_year < e_year:
  s_year += 1
  l_years.append(s_year)

 for i in l_years:
   for column_name in df.columns.values:
    if i == column_name:
     df[index][column_name] = 1

Error
---------------------------------------------------------------------------
KeyError                                  Traceback (most recent call last)
/usr/local/lib/python3.7/dist-packages/pandas/core/indexes/base.py in get_loc(self, key, method, tolerance)
   2897             try:
-> 2898                 return self._engine.get_loc(casted_key)
   2899             except KeyError as err:

pandas/_libs/index.pyx in pandas._libs.index.IndexEngine.get_loc()

pandas/_libs/index.pyx in pandas._libs.index.IndexEngine.get_loc()

pandas/_libs/hashtable_class_helper.pxi in pandas._libs.hashtable.PyObjectHashTable.get_item()

pandas/_libs/hashtable_class_helper.pxi in pandas._libs.hashtable.PyObjectHashTable.get_item()

KeyError: 0

The above exception was the direct cause of the following exception:

KeyError                                  Traceback (most recent call last)
2 frames
/usr/local/lib/python3.7/dist-packages/pandas/core/indexes/base.py in get_loc(self, key, method, tolerance)
   2898                 return self._engine.get_loc(casted_key)
   2899             except KeyError as err:
-> 2900                 raise KeyError(key) from err
   2901
   2902         if tolerance is not None:

KeyError: 0

A: Let's try broadcasting year columns across rows to create a mask, then replace with 1 where mask is True:
# Ensure Types are Correct
df['start'] = pd.to_datetime(df['start'])
df['end'] = pd.to_datetime(df['end'])

# Grab Year Columns
year_columns = df.columns[2:]
# Get Year Columns as numpy array as numbers
c = year_columns.to_numpy().astype(int)
# Broadcast start year vs column column (as int) and end year vs year column (as int)
m = ((df['start'].dt.year.to_numpy()[:, None] <= c) &
     (c <= df['end'].dt.year.to_numpy()[:, None]))
# Update year_columns where mask is True
df[year_columns] = df[year_columns].mask(m, 1)
print(df.to_string())

df:
       start        end  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021
0 2017-01-29 2019-09-10     0     0     0     0     0     1     1     1     0     0
1 2012-01-30 2015-09-11     1     1     1     1     0     0     0     0     0     0
2 2019-01-31 2021-05-08     0     0     0     0     0     0     0     1     1     1
3 2016-02-01 2017-09-13     0     0     0     0     1     1     0     0     0     0
4 2017-02-02 2019-09-14     0     0     0     0     0     1     1     1     0     0
5 2017-02-03 2021-05-08     0     0     0     0     0     1     1     1     1     1
6 2020-02-04 2020-09-16     0     0     0     0     0     0     0     0     1     0

In terms of correcting your implementation, try iterating over only year columns (excluding 'start' and 'end') as ints instead:
# Ensure Types are Correct
df['start'] = pd.to_datetime(df['start'])
df['end'] = pd.to_datetime(df['end'])

for index, row in df.iterrows():
    # Get years from timestamps
    s_year = row['start'].year
    e_year = row['end'].year

    l_years = []
    l_years.append(s_year)

    while s_year < e_year:
        s_year += 1
        l_years.append(s_year)

    for c_year in l_years:
        # Iterate Over Date Columns Only (Exclude Start and End)
        for col_idx, column_name in enumerate(df.columns[2:].values.astype(int)):
            if c_year == column_name:
                # Replace at index, col_idx + 2 because 'start' and 'end'
                # were excluded so col_idx is off by 2
                df.iloc[index, col_idx + 2] = 1

Or much more simply:
# Ensure Types are Correct
df['start'] = pd.to_datetime(df['start'])
df['end'] = pd.to_datetime(df['end'])

for index, row in df.iterrows():
    # Get years from timestamps
    s_year = row['start'].year
    e_year = row['end'].year
    # Create Range of years as strings
    l_years = list(map(str, np.arange(s_year, e_year + 1)))
    # Update based on index and year column names
    df.loc[index, l_years] = 1

A: Or you can try:
df['start'] = pd.to_datetime(df['start'])
df['end'] = pd.to_datetime(df['end'])

def change(x):
    k = range(x['start'].year,x['end'].year+1)
    for col in x.index[2:]:
        if int(col) in k:
            x[col] = 1
    return x

df = df.apply(change,1)


text:
Q: Using Vaadin Error View instead of Spring Boot's Whitelabel error page I'm using Spring Boot with Vaadin and. By using the @Autowired SpringNavigator, I have also set the error view:
navigator.setErrorView(ErrorView.class);

But when I type wrong URL like http://localhost:8080/asdf .
I always get the Spring Boot's Whitelabel error page. I know that I can set custom HTML page for the error like
/resources/public/error/404.html

but this is HTML way, I would like to use Vaadin with components,
the best solution would be the mentioned error view.


text:
Q: SSMS renaming Keys also renames Clustered index to same name As the title states really.
An example of this is;
I set the primary key for a table which is a composite key made from multiple columns.
I then rename the key name in the Keys folder to;
PK_tblname_column1_column2

I then create a clustered index;
Create CLUSTERED INDEX C_U_tblname_column1_column2 ON tblname (Column1 ADC, Column2 ASC);

When I go to refresh the database, both of the names change to either PK or C_U so I get;
Keys -
      PK_tblname_Column1_Column2
Indexes -
      PK_tblname_Column1_Column2 (Clustered)

OR
Keys -
      C_U_tblname_Column1_Column2
Indexes -
      C_U_tblname_Column1_Column2 (Clustered)

Then, when I go to rename the Keys property back to PK_tblname_Column1_Column2, it automatically changes the Index property to PK_tblname_Column1_Column2 (Clustered) too.
If I then proceed to rename the Index property back to C_U_tblname_Column1_Column2 (Clustered). It saves. However, when I refresh the database again, it reverses back to either being named PK for both or C_U for both.
Anyone know why this happens? Most of my clustered indexes just use the primary key columns as the clustered index but this also occurs on indexes that have more than the primary key columns included.


text:
Q: How to give the player a score that keeps only when chest hud is open (1.16.4) I need a scoreboard that detect the player opening a chest, but I also want it to reset the score when it leaves the chest hud. Is it possible?

A: /scoreboard objectives add Chest minecraft.custom:minecraft.open_chest Will add one point to every player that opens a chest, you can test for it like this:
execute as @a[scores={Chest=1..1,ChestCount=0..0}] if entity @s run *command*

*command* is the command that tells you that the player uses a chest, for example:
tell *your name* @s Is using a chest!

Then you need to tell when the player leaves the chest which can't really be done, but you can tell when the player starts to move. However, you need to test for if the player walks, sprints, crouches, climbs, or jumps. Otherwise, the player could break the system.
You can do that by adding scoreboards to these 5:
/scoreboard objectives add Crouch minecraft.custom:minecraft.crouch_one_cm
/scoreboard objectives add Walk minecraft.custom:minecraft.walk_one_cm
/scoreboard objectives add Sprint minecraft.custom:minecraft.Sprint_one_cm
/scoreboard objectives add Climb minecraft.custom:minecraft.climb_one_cm
/scoreboard objectives add Jump minecraft.custom:minecraft.jump

Using the same execute command above you can test for these as well. However, if the player stands still after they closed the chest you won't be able to tell from the score/tests.
You can test for when the player opens a chest, reset the 5 movement scores:
execute as @a[scores={Chest=1..1,ChestCount=0..0}] if entity @s run
 scoreboard players set @s Walk 0

execute as @a[scores={Chest=1..1,ChestCount=0..0}] if entity @s run
 scoreboard players set @s Sprint 0

etc.
You then give the player another dummy score so the commands don't loop:
execute as @a[scores={Chest=1..1,ChestCount=0..0}] if entity @s run
scoreboard players set @s ChestCount 1

Do this in a command blockchain to make it simpler.
For the movement detection in another repeating command block, you put:
execute as @a[scores={Walk=100..,ChestCount=1..1}] if entity @s run
say @s Isn't using a chest!

The next block should be a chain block:
execute as @a[scores={Walk=100..,ChestCount=1..1}] if entity @s run
scoreboard players set @s Chest 0

And the last chain block resets the dummy ChestCount score:
execute as @a[scores={Walk=100..,ChestCount=1..1}] if entity @s run
scoreboard players set @s ChestCount 0

Then you repeat this 4 times for the sprint score, crouch score, climb score, and jump score, but instead of testing for a score of 100.. you test for a score of 1 or more, like this:
execute as @a[scores={Sprint=1..,ChestCount=1..1}] if entity @s run
say @s Isn't using a chest!

The reason for this is that you can run into a chest and add to the walking score after you have opened the chest, but this only applies to walking, none of the others.
This should be multiplayer friendly as well but haven't tested this.
Note
Cange the command of the first execute command to the command that tells you when someone is using a chest as I explained on the very first execute-command I wrote. I just copied from my world and currently, it says say @s Isn't using a chest!


text:
Q: How to use custom tensorflow lite models in flutter? I am working on a flutter project that requires some machine learning. I have my model already trained and ready to be used.
How to integrate this Tensorflow lite model with flutter?
I have tried couple of packages that exists but unfortunately, I did not worked! Most of these packages are no longer maintained.


text:
Q: Could not export TimeSeries to CSV I have tried the following code to export a TimeSeries to a CSV.
This is using code from a similar post "Export TimeSeries[] to CSV or Excel".
ClearAll["Global`*"]

(* Helper Functions to format the export *)
formatDate[date_DateObject]:=DateValue[date, {"Year", "Month", "Day"}]
formatTemperature[value_Quantity]:=QuantityMagnitude[value]

formatSeries[{date_DateOject,value_Quantity}]:={formatDate@date, formatTemperature@value} //Flatten
convertToList[timeSeries_TimeSeries]:=timeSeries["DatePath"] //Map@formatSeries

(* Get Weather Data *)
windSpeedSeries=WeatherData[{53.506574, -112.096163},"WindSpeed", {{2018,1,1},{2018,12,31}}]
temperatureSeries=WeatherData[{53.506574, -112.096163},"Temperature", {{2018,1,1},{2018,12,31}}]

When I call convertToList[temperatureSeries], it appears that convertToList is not defined.
If I issue the following command:
temperatureSeries["DatePath"] // Map@formatSeries

I get the following output:
[
I think this is a basic question.
This looks like a series of commands that I would like to execute on each element in the list of {date, temperature} pairs.
How would I actually execute this so that I can successfully export the following data columns to a CSV file?
Year,
Month,
Day,
Temperature
If I simply call Export["Temperatures.csv", temperatureSeries["DatePath"] //Map@formatSeries], I simply get a text version of the image above.
This leads me to believe that formatSeries in the code above is undefined. I am not clear on why formatSeries is undefined.
Alternate Approach
While this is not at all performant, the code below does work.  I would suggest that it be translated into a functional code equivalent.
temperatureSeries=WeatherData[{53.506574, -112.096163},"Temperature", {{2018,1,1},{2018,12,31}}]

temperatureList = Table[{temperatureSeries["DatePath"][[i]][[1]][[1]][[1]],
                         temperatureSeries["DatePath"][[i]][[1]][[1]][[2]],
                         temperatureSeries["DatePath"][[i]][[1]][[1]][[3]],
                         QuantityMagnitude[temperatureSeries["DatePath"][[i]][[2]]]},{i,1,Length[temperatureSeries["DatePath"]]}]

Export["Temperature.csv", temperatureList]

A: This works well for me. You might want to try it.
data =
  Module[{dates, temps},
    dates = DateValue[#, {"Year", "Month", "Day", "Hour"}] & /@ temperatureSeries["Dates"];
    temps = QuantityMagnitude[#] & /@ temperatureSeries["Values"];
    Flatten /@ Thread[{dates, temps}]];

Export[FileNameJoin[{$HomeDirectory, "Desktop", "Temperature.csv"}], data]

The exported CSV file looks like this

2018,1,1,0,-26.3
2018,1,1,1,-27
2018,1,1,2,-27
2018,1,1,3,-26.7
2018,1,1,4,-27.2
2018,1,1,5,-27.2
2018,1,1,6,-27.4
2018,1,1,7,-27.9
2018,1,1,8,-28.5
2018,1,1,9,-28.2
2018,1,1,10,-28.2
2018,1,1,11,-28.6

 ...

2018,1,31,12,-24.4
2018,1,31,13,-25.4
2018,1,31,14,-25.7
2018,1,31,15,-26.2
2018,1,31,16,-26
2018,1,31,17,-25.6
2018,1,31,18,-24.9
2018,1,31,19,-24.2
2018,1,31,20,-23.6
2018,1,31,21,-23.4
2018,1,31,22,-23.4
2018,1,31,23,-23.3

Notes:

*

*I only asked for the temperatures for January, 2018, in my query to WeatherData.

*Since the data in temperatureSeries is hourly, I added a hour column to the exported data. You can simply remove "Hour" from the 2nd DateValue argument if don't want this column.


text:
Q: Forbidden (CSRF token missing or incorrect.): / So i want to make models form to upload file mp3. I was copy the code from website, but suddenly it goes error. Here's error message on the website :

Forbidden (403) CSRF verification failed. Request aborted.
Help Reason given for failure:
CSRF token missing or incorrect.
 In general, this can occur when there is a genuine Cross Site Request Forgery, or when Django's CSRF mechanism has not been used

correctly. For POST forms, you need to ensure:
Your browser is accepting cookies. The view function passes a request
to the template's render method. In the template, there is a {%
csrf_token %} template tag inside each POST form that targets an
internal URL. If you are not using CsrfViewMiddleware, then you must
use csrf_protect on any views that use the csrf_token template tag, as
well as those that accept the POST data. The form has a valid CSRF
token. After logging in in another browser tab or hitting the back
button after a login, you may need to reload the page with the form,
because the token is rotated after a login. You're seeing the help
section of this page because you have DEBUG = True in your Django
settings file. Change that to False, and only the initial error
message will be displayed.
You can customize this page using the CSRF_FAILURE_VIEW setting.

and at my terminal there's error message :

[12/May/2022 14:19:43] "GET / HTTP/1.1" 200 8824 Forbidden (CSRF token
missing or incorrect.): / [12/May/2022 14:19:46] "POST / HTTP/1.1" 403
2513

please help me to fix it. i will give my code :
views.py:
from django.shortcuts import render, redirect
from django.views.decorators.csrf import ensure_csrf_cookie
from .forms import AudioForm
from .models import Audio_store
from MusicLockApp.forms import AudioForm

@ensure_csrf_cookie
def homepage(request):
    # return HttpResponse('homepage')
    return render(request, 'homepage.html')

def decode(request):
    # return HttpResponse('about')
    return render(request, 'decode.html')

def upload(request):
    if request.method == "POST":
        form = AudioForm(request.POST, request.FILES)
        if form.is_valid():
            form.save()
        return redirect("main:upload")
    form = AudioForm()
    audio = Audio_store.objects.all()
    return render(request=request, template_name="homepage.html", context={'form':form, 'audio':audio})

urls.py :
from django.contrib import admin
from django.conf.urls import url
from . import views
from django.contrib.staticfiles.urls import staticfiles_urlpatterns
from django.urls import path, re_path
from django.conf import settings

urlpatterns = [
    url(r'^admin/', admin.site.urls),
    url(r'^decode/$', views.decode),
    url(r'^$', views.homepage),
    path('audio', views.Audio_store),
]

urlpatterns += staticfiles_urlpatterns()

models.py:
from django.db import models

class Audio_store(models.Model):
    record=models.FileField(upload_to='media/mp3')

forms.py:
from django import forms
from .models import Audio_store

class AudioForm(forms.ModelForm):
    class Meta:
        model = Audio_store
        fields=['record']

add settings.py:
INSTALLED_APPS = [
    'MusicLockApp',
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    'crispy_forms',
]

MIDDLEWARE = [
    'django.middleware.security.SecurityMiddleware',
    'django.contrib.sessions.middleware.SessionMiddleware',
    'django.middleware.common.CommonMiddleware',
    'django.middleware.csrf.CsrfViewMiddleware',
    'django.contrib.auth.middleware.AuthenticationMiddleware',
    'django.contrib.messages.middleware.MessageMiddleware',
    'django.middleware.clickjacking.XFrameOptionsMiddleware',
]

STATIC_URL = '/static/'

STATICFILES_DIRS = (
    os.path.join(BASE_DIR, 'assets'),
)

MEDIA_URL = '/media/'

MEDIA_ROOT = os.path.join(BASE_DIR, 'media')

{% block content %}

            {% load crispy_forms_tags %}

                            <button type="button" class="dsnupload">
                                file_upload

Insert file password

                            </button>

                            <form method="POST" enctype="multipart/form-data">
                            {% csrf_token %^}
                            {{form|crispy}}
                            <button type="submit" class="dsnupload">
                                audiotrack

Insert file audio (mp3)

                            </button>

                            </form>

                                Key:
                                <button type="submit" class="dsnupload"></button>

                                <input type="text" class="form-control" placeholder="insert your key here">

                            Hide it!

                                      Progressing now

75%

                                    <button id="obfuscate-button" onclick="obfuscate()">Play song</button>
                                    Download

Information Music

Song :

Artist :

Album :

Year :

Genre :

Duration :

            {% endblock %}

what i want is = when i click button insert audio file, we can choose file from local and when clicked button hide it, it will upload it to local folder.
website

A: Easiest way
Try to change this url url(r'^$', views.homepage), in your urls.py file to this url(r'^$', views.upload),
Effective way
Or instead of that, delete your " homepage " view and rename your " upload " view to " homepage ".
Then check if it work. You'll normally see a form appear in your webpage to select your file.


text:
Q: Svelte: using "bind:this" inside "each" block I want to render an array of objects, using an each block. I need to be able to remove elements from the array using callbacks from inside the each block. Also, for more complex UI-interactions, I need the reference to each component of the each-block to be available in the main app.
Here is my approach:

{#each items as item, i}
<button bind:this={items[i].ref} on:click={() => deleteItem(i)} >
    {item.text}
</button>

{/each}

Understandibly, this leads to errors such as item[i] is undefined, because when the splicing of items is processed, the bind:this cannot properly be cleaned up anymore.
I tried to solve this by moving the component-references to a separate array. But no matter what I try, I cannot get the reference-array and the object-array to sync: Whenever deleteItem() is processed, I end up with null-values inside the refs-array. Here is one of my approaches (the each-section that prints the refs-array should help to show the null-values):

{#each items as item, i (item.id)}
<button on:click={async () => deleteItem(i)} bind:this={refs[i]}>
    {item.text}
</button>

{/each}

{#each refs as ref}
{ref}

{/each}

I tried with and without tick(), tried inserting the tick() in different places, with and without async and with and without using (item.id) in the each block. How can I keep the references and the data in sync?

A: On way to get around this is to have the refs array cleaned up before you use it:

<button bind:this={_refs[i]}></button>

With this technique you will still have the null values in the original _refs array, but the copied version (refs) will be clean.
Another way is to bind the element to the item itself, but this might not be desired if you use that data elsewhere as well:
<button bind:this={item.ref}>

(note that this will still give errors because the bound element disappears during the slice but is only processed with the assignment, you can get around that by doing the slicing and the assignment in one using a filter statement)
items = items.filter((item, idx) => idx != i)


text:
Q: Hit Api and get Response using http post and curl Hello every one i am a junior php developer i am working on converting java code to php.. on Java api hit and get response correctly and now i am trying to hit using curl http post in php this is my task in my software house plz help me
i am gonna show you my java code which is correctly working and then my php code which is not working and not parsing params to that api so pls kindly guide me
This is my Java Code
 This is working correctly i want to do this same work from php
import java.io.*;

import java.util.jar.JarException;
import org.apache.http.HttpResponse;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.DefaultHttpClient;
import org.json.*;

class MyCode{

            public static void main(String[] args) throws JarException, JSONException
            {

                        testCustomerApiIsExposed();

            }

            public static void testCustomerApiIsExposed() throws JarException, JSONException {

               try {

                   @SuppressWarnings("deprecation")

                   HttpClient c = new DefaultHttpClient();

                   HttpPost p = new
                   HttpPost("http://link");

                    String payload = "{id:\"" + 1 + "\","  + "method:\"" + "customerApi.getApiToken" + "\", params:[\"teabonezenminddemo1partner@gmail.com\", \"demo1234!\", \"\", \"\", \"\",     \"\", \"\", false, \"\", \"\"" + "]}";

                   String mimeType="";

                   /*There is something here. What constructor are we really calling here? */

                   // p.setEntity(new StringEntity( payload,ContentType.create("application/json")));

                                    p.setEntity(new StringEntity(payload));

                   HttpResponse r = c.execute(p);

                   BufferedReader reader = new BufferedReader(new InputStreamReader(r.getEntity().getContent(), "UTF-8"));

                   StringBuilder builder = new StringBuilder();

                   for (String line = null; (line = reader.readLine()) != null;) {

                       builder.append(line).append("\n");

                   }

                   JSONTokener tokener = new JSONTokener("[" + builder.toString() + "]");

                   JSONArray finalResult = new JSONArray(tokener);

                   JSONObject o = finalResult.getJSONObject(0);

                   //Getting names of the JSON object here
                   System.out.println(o.names());

                   String apiToken = (String) o.get("result");

                   System.out.println(apiToken);

               }

               catch(IOException e) {

                   System.out.println(e);

               }

            }
}

now i am coding this on php but don't get response check it pls and guide me i am using curl http post and getApiToken method help me to sort out this problem i am very tense.
This is my php code
<?php

$data = array(params);

$ch = curl_init('http://link');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($data));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

$result = curl_exec($ch);
echo $result;
?>

A: You are posting JSON from your java code. So use json here at PHP as well(make sure the format is ok):
$payload = "{params}";

And the curl options will be
// as you are posting JSON, so tell server that you are sending json
curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-Type: application/json"));

// Let server know that you are doing HTTP POST request
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $payload);

Using these, I got sample response:
{"id":"1","result":"results"}


text:
Q: SQL Select column tinyint I have a table with a column:
txntype (tinyint, not null)

I'm doing a select where value of txntype is equal to 9:
where CAST(txntype as varchar(3)) = '9'

but is throwing an error:

Insufficient result space to convert uniqueidentifier value to char.

I also tried:
where ISNUMERIC(txntype) = 9

but no records are selected when query is executed.  Any ideas?

A: Can you add the create statement of that table and the entire select statement, because it seems that either the column has been declared as a uniqueidentifier column or your select is doing something with the value of another column than the one you are using in your where clause.
Also, the ISNUMERIC() function returns a bit (0 or 1) indicating if a value can actually be converted to a numeric datatype. Comparing it with the value 9 will always yield "false" for that piece of the where clause.
If the column is actually a numeric type, you don't have to cast the value in the where clause either way.
    where [txntype] = 9

That is enough if the column is really a tinyint. And that's also the reason you need to be looking at other parts of the query in order to find the cause of the error.

A: You don't need to use cast or isnumeric
Just simply txntype = 9


text:
Q: How to union two data tables and order the result Q: If I have two DataTables like this :
Dt1(emp_num,emp_name,type)
Dt2(emp_num,emp_name,type)
I wanna to Union them and order the result by emp_name.

A: i think this code will help u to do it without using entity...
Dt1.Merge(Dt2);

A: var dt1 = new DataTable(); // Replace with Dt1
var dt2 = new DataTable(); // Replace with Dt2

var result = dt1.AsEnumerable()
            .Union(dt2.AsEnumerable())
            .OrderBy (d => d.Field<string>("emp_name"));


text:
Q: Why does this non-nullable val become "nullable"? So I have a simple callback class:
class Callback<T>(
    val onResponse: (T) -> Unit,
    val onError:(Throwable)->Unit
)

Now I want to implement a method that handles errors. There may or may not be an callback that needs to be invoked.
private fun handleServerError(error:IServerError, callback:Callback<*>? = null){
    val reason = error.cause

    when(reason){
        is Because.ServerRejectsLogin -> {
            doAsync { uiThread { mainActivity.longToast("sorry, your session timed out. please log in again.") } }
            IntentManager.doLogin(mainActivity)
        }
        else -> callback?.onError(reason)
    }
}

This gets me an error:

Reference has a nullable type ((Throwable) -> Unit)? use explicit ?.invoke() to make a function-like call, instead

What it seems to expect is
else -> callback?.onError?.invoke(reason)

and I don't quite understand why. Shouldn't the fact that callback is not null be sufficient to derive that there must be a non-null onError function?
To add insult to injury, if I write
else -> callback?.let{it.onError(reason)}

then it accepts that but not before warning me that I should

remove redundant .let call

A: The callback?.onError() syntax would be correct if you were calling a function called onError on the callback object with the safe call operator. However, in this case, you are first reading a property of callback, and then calling another function on what the property returned.
So instead of the expression consisting of just one step, and two pieces:
callback   ?.onError()

What you actually have is an expression of three parts, with two operators in a row:
callback   ?.onError   ()

The last step here, (), is a call to the invoke operator of the object that onError returns:
callback   ?.onError   .invoke()

However, since the onError property is read with a safe call operator, this object might be null. In this case, you can't use invoke in its operator form (same goes for any other operator, by the way), so you have to explicitly write it out, with another safe call added:
callback   ?.onError   ?.invoke()

As for the intention action telling you that you can remove the redundant let: that's a bug, and should be reported on the issue tracker.


text:
Q: Verification of the subspace topology defined in terms of neighborhoods I'm currently trying to verify that the subspace topology  is indeed a topology as defined in this post (Verifying the subspace topology with a topology defined in terms of neighborhoods). My problem is with the verification of Axiom c).
Let X denote the space and Y the subspace.
If I assume that  $U \subset Y$ is a neighborhood of y with respect to Y then by definition of the subspace topology there is a neighborhood K of y with respect to X such that $U=Y\cap K$.
Suppose that there is $\ L \subset Y$ such that $U \subset L.$
It is obvious that $L=Y\cap L$.
Now I would like to prove that $U=Y\cap K $ is a neighborhood of y with respect to X and then use the fact that X is a topological space (for which the axioms a)-d) hold) to conclude that L is a neighborhood of y with respect to X. This would allow me to deduce that L is a neighborhood of y with respect to Y and finish the proof.
But I do not see how to prove that U is a neighborhood of y with respect to X at all. Is this even possible? Or is there some other approach?

A: Suppose $U \subset Y$ is a neighborhood of $y$ wrt the subspace topology. Then $U$ is also a neighborhood of $y$ in $X$ (there's no reason for the axioms to be false in $X$ if they are true in $Y$). Take $L$, a subset of $Y$ (and thus also a subset of $X$) containing $U$. Clearly, $X \supset L \supset U$ in $X \implies L$ is a neighborhood of $y$ in $X$. Since the neighborhoods in a subspace are just intersections of neighborhoods in $X$ with $Y$, we have $L = L \cap Y$ is also a neighborhood of $y$ in $Y$.
If you're allowed to, you should also look into verifying the subspace topology is a topology using the usual axioms involving open sets; I think that's much more natural.


text:
Q: Wish Followed by Past Continuous and Past Simple Yesterday I had and exam in English. I wondered very much for the following sentence - "I wish it ... (snow)now. It's Christmas". My question is if we can say "I wish it snowed now. It's Christmas" or it has to be "I wish it was snowing now. It's Christmas" and this is the only way it can go. I'll be very thankful if you help me.

A: Well you wouldn't say "It snowed now." but rather "It is snowing now."
Therefore, you would say "I wish it was snowing now".
Similarly, you could say "It snowed yesterday", and you could also say "I wish it had snowed yesterday."