问题中的注释正确指示您实例化具有特定大小的字符串,并使用 .data()
或& [0]
操作员获取所需的东西。
让我建议一个更简单的解决方案,并具有约束。考虑到您的输出字符串具有一定合理的长度,并且您可以使用大量的堆栈内存。因此,请使用固定的长度温度缓冲区来进行printf样式格式。 20K并不是在堆栈上分配的数量不合理的字节。
然后返回一个 std :: String
使用C String构造器的复制版的实例。
std::string Somefunction(const char* formatstring, ...){
const size_t TEMP_SIZE = 20000;
va_list vargs = {};
va_start(vargs, formatstring);
char buffer[TEMP_SIZE];
vsnprintf(buffer, TEMP_SIZE, formatstring, vargs);
va_end(vargs);
return std::string(buffer);
}
如果需要的话,您总是可以将缓冲区的大小从20000增加到更大。但是我猜你的琴弦永远不会变得那么大。而且,如果他们这样做,您不希望我猜是您的日志文件中的很多字节。
因此,如果您使用的是jetstream,则可能会有一个称为AuthenticatedSessionController.php的文件,该文件应处理登录名,
有一种称为商店的方法,
public function store(LoginRequest $request)
{
$request->authenticate();
$request->session()->regenerate();
return redirect()->intended(RouteServiceProvider::HOME);
}
您可以在此处更改逻辑,以便它具有
the Inted(utareserviceProvider :: home)代码>
您可以将其更改为:
$route = auth()->user()->isSuperAdmin() ? route('superadmin.index') : route('normaluser.index');
return redirect()->intended($route);
我一直在尝试了解为什么只有第二部分被阴影。最终,我准备了第二个示例,其中我找到了另一个可能的解决方案。但是,我不完全满意,因为我不了解 geom_Rect
/ facet_wrap
;我只找到了一些解决方法。
这是一个示例:
# constructing the dataframe so all the combinations are present for both even and odd rows
df.tmp = data.frame(nst = rnorm(16*6),
Srs = rep(c("S3", "S4"), each=8, 6),
Cnd = rep(c("DN", "DA", "DV", "DAV"), each=2, 12),
Grp = rep(c(rep(c("close","far"), 8), rev(rep(c("close","far"), 8))),3) )
even_numbers <- seq(2,nrow(df.tmp),2) # so the df.tmp[even_numbers, ] contains all the combinations
ggplot(df.tmp) +
geom_rect(data = df.tmp[even_numbers, ],
xmin = even_numbers - 0.5, xmax = even_numbers + 0.5,
ymin = -Inf, ymax = Inf, alpha = 0.3, fill = 'grey') +
geom_boxplot(aes(x = Cnd, y = nst, fill = Srs), position = position_dodge(0.9), outlier.shape = 1) +
facet_wrap(vars(Grp), ncol=1)
正如您在此处看到的那样,尽管确保 df.tmp [vest_numbers,]
Incluber CLOSE> CLOSE datapoints,但该图仅在第二行中阴影矩形。 :
在这里我更改 ggplot
,因此它包含 geom_Rect
分别用于关闭
和 far
segments:
even_numbers <- seq(2,length(unique(df.tmp$Cnd)),2) # here the df.tmp[even_numbers, ] doesn't need to have all the combinations
ggplot(df.tmp) +
geom_rect(data = df.tmp[df.tmp$Grp=="close", ][even_numbers, ],
xmin = even_numbers - 0.5, xmax = even_numbers + 0.5,
ymin = -Inf, ymax = Inf, alpha = 0.3, fill = 'grey') +
geom_rect(data = df.tmp[df.tmp$Grp=="far", ][even_numbers, ],
xmin = even_numbers - 0.5, xmax = even_numbers + 0.5,
ymin = -Inf, ymax = Inf, alpha = 0.3, fill = 'grey') +
geom_boxplot(aes(x = Cnd, y = nst, fill = Srs), position = position_dodge(0.9), outlier.shape = 1) +
facet_wrap(vars(Grp), ncol=1)
正如我之前提到的,我仍然不确定为什么 geom_rect
在第一个 地方。在我的解决方案中,需要为每个段准备一个单独的 geom_Rect
,因此绝对不是其中许多图的解决方案。我试图找到一种更优雅的方式,因此不必打扰宣布多少个部分或其他分组。
this kotlinlang
slack 包括问题229839039 ,它是关于在 swipeablestate
讨论您应该做什么:
我们目前正在评估我们要为可滑动的API表面,包括可能的基础API。由于可滑动有很多问题,因此我们尚未在M3中公开。
关于上面链接的问题的评论#2如果您需要一些东西来给出潜在客户
我所做的是删除.sln文件,然后使用.csproj文件打开了Visual Studio项目。我还编辑了CSPROJ文件,以具有看起来像这样的行:
<Configuration Condition=" '$(Configuration)' == '' ">Debug_VSTS</Configuration>
另一个看起来像这样的行:
<Configurations>Debug;Release;Debug_VSTS;Release_VSTS</Configurations>
您可以在作业右侧使用表达式。在这里,您需要用当前值分配 studen
,即, studen
加上新值:
cur.execute("UPDATE ueberstunden SET stunden = studen + %s WHERE name ='test'", value)
# Here ----------------------------------------^
WHERE tab_Status.ID IN (...)
不能动态。
因此,使用代码:
- 浏览
itemsSelected
集合 - 构建所选项目的静态列表,例如
(1,3)
- 修改查询的SQL
我不确定您想在这里拥有的所有选项,所以这是我的第一次尝试(请注意,我将名称更改为kebab-case):
(def params [{:field-name "salary" :comparator "greater" :input-value "10000" :input-type "number"}
{:field-name "name" :comparator "include" :input-value "Ros" :input-type "text"}
{:field-name "start-date" :comparator "between" :input-value "2022-01-01" :max-input-value "2022-06-01" :input-type "date"}])
(defn convert [params]
(->> (for [{:keys [field-name comparator input-value max-input-value input-type]} params]
(->> (condp = input-type
"number" [field-name ({"greater" ">" "less" "<" "equal" "=" "not-equal" "!="} comparator) input-value]
"text" [field-name ({"include" "LIKE"} comparator) (str "'%" input-value "%'")]
"date" [field-name ({"between" "BETWEEN"} comparator) (str "'" input-value "'") "AND" (str "'" max-input-value "'")])
(str/join " ")))
(str/join " AND ")))
(convert params)
=> "salary > 10000 AND name LIKE '%Ros%' AND start-date BETWEEN '2022-01-01' AND '2022-06-01'"
如果您的CSS存储在CSS文件夹中:
<link th:href="@{/css/style.css}" rel="stylesheet" type="text/css">
您发布的内容看起来正确,那么这是正确的语法,因此假设所有文件都在哪里,则问题可能来自Spring Security,
如果您将Spring Security添加为依赖项,则需要告诉春季安全性不需要静态文件的身份验证。
您可以通过创建一个扩展WebsecurityConfigurerAdapter的WebsEcurityConfig类来做到这一点,并实现以下内容:
protected void configure(HttpSecurity http) throws Exception {
String [] staticResources = {
"/css/**",
"/js/**"
};
http
.authorizeRequests()
.antMatchers(staticResources).permitAll()
}
Spring会自动在静态文件夹中查看staticResources阵列应包含staticResource阵列,嗯...所有静态资源。如果添加了图像文件夹,则还应将其添加到staticresources数组中,例如:/images/**
如果您想能够在所有页面中使用
剩余代码中的所有页面:
Hey http, I need you to authorizeRequests matching the contents of staticResources.
I also would like to permitAll users to access the content of staticResources.
我设法通过重组代码来解决index.js文件中的所有路由功能来解决问题。
var root = ReactDOM.createRoot(document.getElementById("root"));
root.render(
<React.StrictMode>
<BrowserRouter>
<Routes>
<Route path="/" element={<TodoContainer />}/>
<Route path="about*" element={<About/>}/>
<Route path="*" element={<NotMatch/>}/>
</Routes>
</BrowserRouter>
</React.StrictMode>
);
似乎没有一种方法可以在 onModeLcreating
中更改错误消息。如果您接受,则可以在控制器中进行验证并自定义错误消息。
您可以参考以下代码:
[HttpPost]
public async Task<IActionResult> Test(UserTest userTest)
{
if (ModelState.IsValid)
{
try
{
_context.UserTest.Add(userTest);
_context.SaveChanges();
return RedirectToAction("Index");
}
catch (Exception ex)
{
var sqlException = GetInnerException<SqlException>(ex);
if (sqlException != null
&& (sqlException.Number == 2627 || sqlException.Number == 2601))
{
ViewData["Message"] = "Username already exists";
return View();
}
}
}
return View();
}
public TException GetInnerException<TException>(Exception exception)
where TException : Exception
{
Exception innerException = exception;
while (innerException != null)
{
if (innerException is TException result)
{
return result;
}
innerException = innerException.InnerException;
}
return null;
}
测试结果:
这将完成这项工作。
onSubmit={(values) => {
if(values.radio === 2){
delete values['input2'];
}
console.log(values);
}}
Envoy没有可用的日志旋转(请参见 evary#1109 )。
但是,您可以使用一个工具,例如 logrotate
您的访问日志文件旋转。以下配置可用于每天旋转日志并保留7天的日志:
/var/log/envoy/access.log {
daily
rotate 7
missingok
compress
notifempty
nocreate
sharedscripts
copytruncate
}
只需将该配置放入名为 /etc/logrottate.d/envoy
的文件中,然后检查 logrotate 每天运行(
/etc/cron.daily/logrotate
)。
您可以使用容器进行测试:
FROM envoyproxy/envoy:v1.22.2
RUN apt update && apt install -y logrotate
RUN install -d -m 0755 -o envoy -g envoy /var/log/envoy
# logrotate_envoy.conf is logrotate config file
COPY logrotate_envoy.conf /etc/logrotate.d/envoy
并使用此Envoy Config:
access_log:
- name: envoy.access_loggers.file
typed_config:
"@type": type.googleapis.com/envoy.extensions.access_loggers.file.v3.FileAccessLog
path: /var/log/envoy/access.log
read_line
将读取来自stdin的字符串,它需要一个缓冲区才能放入它,这应该是您传递的参数。如果您要转换它,那是您的工作:它不会自行执行。因此类型错误。为了实现所需的目标,只需创建一个缓冲区,然后parse
it。请注意,在您的代码中,
分析的通用参数
可能是隐式的,因为您的wahrenheittocelsius
函数可能足以让编译器找出执行转换的类型。read_line
will read a string from stdin, and it needs a buffer to put it in, which is supposed to be argument you pass it. If, then, you want to convert it, it's your job: it won't do that on its own. Thus the type error. To achieve what you want, simply create a buffer, thenparse
it.Note that in your code, the generic argument of
parse
might be left implicit since yourfahrenheitToCelsius
function might be enough for the compiler to figure out the type to perform the conversion to.Rust Read_line&#x27;预期结构字符串,找到F64&#x27;