嵌入式Jetty 9 HTML表单将数据发送到应用程序(Embedded Jetty 9 HTML form sending data to application)
我创建了一个简单的登录表单,使用servlet通过HTTP POST通过嵌入式Jetty 9服务器上的SSL连接接收信息。 servlet按原样接收信息,但我一直无法知道servlet应该如何与应用程序jetty进行通信。在嵌入式模式下使用Jetty的文档似乎非常缺乏,我没有任何成功做一般搜索的主题。 简而言之:如何从嵌入式Jetty 9服务器上托管的HTML登录表单中获取Jetty正在运行的应用程序的信息?
I have created a simple login form using a servlet receiving information via HTTP POST trough an SSL connection on an embedded Jetty 9 server. The servlet receives the information as it's supposed to but I've been unable to find out how the servlet should communicate with the application jetty is running in. The documentation for using Jetty in embedded mode seems to be very lacking and I havn't had any success doing a general search on the subject either. In short: How do I get information from an HTML login form hosted on an embedded Jetty 9 server to the application Jetty is running in?
原文:https://stackoverflow.com/questions/14454974
最满意答案
我看到两个问题:
在
fitfunc
你写tempArray[time <= 0] = line(time, p[6]) tempArray[0 < time] = exponential(time, p[0], p[1], p[2]) + exponential(time, p[3], p[4], p[5])
但是在均等的两边,阵列的大小并不相同。 我认为在第二行时代并不好; 我用它替换了它
tempArray[time <= 0] = line(time[time<=0], p[6]) tempArray[0 < time] = exponential(time[0<time], p[0], p[1], p[2]) + exponential(time[0<time], p[3], p[4], p[5])
- 你对
p[1]
初步猜测,如果非常错误,我用-250000
替换-2500
通过这两项更改,它可以在我的计算机上正常工作。
JPG
I see two problems:
in
fitfunc
you writetempArray[time <= 0] = line(time, p[6]) tempArray[0 < time] = exponential(time, p[0], p[1], p[2]) + exponential(time, p[3], p[4], p[5])
but the size of the arrays are not the same on the two sides of the equalities. I think on the second line the times are not good; I've replaced it with
tempArray[time <= 0] = line(time[time<=0], p[6]) tempArray[0 < time] = exponential(time[0<time], p[0], p[1], p[2]) + exponential(time[0<time], p[3], p[4], p[5])
- your initial guess for
p[1]
if very false, I've replaced-2500
by-250000
With these two changes, it works fine on my computer.
JPG
相关问答
更多-
好的,两个有用的技巧。 1,用你的x代替0 ,然后用一些非常小的数字代替,比如1e-8 (不要笑,在R有一个核心包,实际上这个是用his name shall not be spoken写的his name shall not be spoken ,人们his name shall not be spoken用它)其实我没有得到你的RuntimeWarning 。 我运行scipy 0.12.0和numpy 1.7.1 。 也许这是版本依赖。 但我们会遇到一个非常糟糕的情况: In [41]: popt, ...
-
希望我的解决方案能为您服务。 result = pd.DataFrame() for i in df.columns: frames = [result, pd.DataFrame(fitdata(df[i]))] result = pd.concat(frames, axis=1) result.columns = df.columns a b c 0 8.041970 2.366496 8.041970 1 ...
-
使用scipy curve_fit通过两个数据点拟合指数函数(Fitting exponential function through two data points with scipy curve_fit)[2022-07-01]
如果你想从两个数据点找到目标函数中的两个参数,这对于最小二乘拟合不一定是个问题:只需求解联立方程式y1 = b(x1 + a)^ p和y2 = b (x2 + a)^ p参数a和b : import numpy as np import matplotlib.pyplot as plt def func(x, adj1,adj2): return ((x+adj1) ** pw) * adj2 x = [0.5,0.85] # two given datapoints to which the ... -
如何正确定义scipy的curve_fit的向量函数(How to properly define vector function for scipy's curve_fit)[2024-05-02]
curve_fit需要一个返回1D数组的func ,因此output应该是flattend。 在这种情况下,您应该将ydata.T.ravel()给curve_fit以使其具有正确的顺序作为func(x,a,b,c)的元素。 import numpy as np from scipy.optimize import curve_fit def func(x,a,b,c): output = np.array([a*(x**b)+c,a*(x**b)+c+1]) return output. ... -
这里的解决方案是编写一个包装函数,它接受您的参数列表并将其转换为fit函数理解的变量。 这实际上只是必要的,因为我正在使用其他人的代码,在更直接的应用程序中,这将在没有包装层的情况下工作。 基本上 def wrapper_fit_func(x, N, *args): a, b, c = list(args[0][:N]), list(args[0][N:2*N]), list(args[0][2*N:3*N]) return fit_func(x, a, b, c, N) 要修复N,你必须 ...
-
这不是一个数字问题。 “问题”是协方差矩阵的非对角线项都是正的且相对较大。 这些确定了拟合中误差之间的相关性,因此如果所有术语都是正数,则表示所有误差都是正相关的。 如果一个人很大,那么其他人也会因为同一个标志而变大。 这是一个类似于你的例子,带有协方差矩阵 [2.0 1.3 0.0] sigma = [1.3 2.0 1.3] [0.0 1.3 2.0] (该矩阵的条件数为23.76,因此我们不应期望任何数值问题。) 虽然第一点和第三点之间的协方差是0,但是在 ...
-
指数拟合与Scipy.Optimise Curve_fit无法正常工作(Exponential Fitting with Scipy.Optimise Curve_fit not working)[2022-03-06]
我清理了你的代码,让时间从0开始,我用指数函数做了不止一次,以使它们正常工作: import matplotlib.pyplot as plt import numpy as np from scipy.optimize import curve_fit time, temp = np.loadtxt('test.txt', unpack=True) # Newton cooling law fitting time -= time.min() def TEMP_FIT(t, T0, k, Troom) ... -
将SciPy curve_fit用于具有多种功能形式的数据(Using SciPy curve_fit for data with multiple functional forms)[2023-05-27]
我看到两个问题: 在fitfunc你写 tempArray[time <= 0] = line(time, p[6]) tempArray[0 < time] = exponential(time, p[0], p[1], p[2]) + exponential(time, p[3], p[4], p[5]) 但是在均等的两边,阵列的大小并不相同。 我认为在第二行时代并不好; 我用它替换了它 tempArray[time <= 0] = line(time[time<=0], p[6]) ... -
不,least_squares(因此curve_fit)只支持框约束。 No, least_squares (hence curve_fit) only supports box constraints.
-
bounds=[[0,50],[0,0.3]])表示第二个参数大于50但小于0.3。 第一个参数也固定为零。 格式为bounds =(lower,upper)。 bounds=[[0,50],[0,0.3]]) means the second parameter is greater than 50 but smaller then 0.3. Also the first parameter is fixed at zero. The format is bounds=(lower, upper).