我正在研究Primefaces用户指南中的primefaces主题. https://storage.googleapis.com/google-code-archive-downloads/v2/code.google.com/primefaces/primefaces_users_guide_3_3.pdf at pag.457您可以阅读:"下载主题后,配置PrimeFaces以使用它
<context-param>
<param-name>primefaces.THEME</param-name>
<param-value>aristo</param-value>
</context-param>
Run Code Online (Sandbox Code Playgroud)
我应该把它放在哪里?进入我正在开发的网页文件?我选择了Redmond主题的jar文件并将其导入我的Eclipse Dynamic Web项目,但我没有看到任何改进.
我测试的Primefaces示例是:https://www.primefaces.org/showcase/ui/data/datatable/basic.xhtml
Car.java
import java.util.Date;
public class Car {
private String model;
private int year;
private String manufacturer;
private String color;
public Car(String model, int year, String manufacturer, String color) {
this.model = model;
this.year = year;
this.manufacturer = manufacturer;
this.color = color;
}
public String getModel() {
return model;
}
public void setModel(String model) {
this.model = model;
}
public int getYear() {
return year;
}
public …Run Code Online (Sandbox Code Playgroud) 我正在开发一个简单的软件来检查我是否能够使用我研究的POSIX定时器和信号进行编程.
我正在尝试做一个简单的程序,启动计时器并发出一定数量的纳秒信号
以下程序不能很好地工作,所以我写了一些关于我的代码的评论,以便你可以检查我是否正确学习.您可以在页面底部找到完整的代码清单.
各种印刷品如
prinf("1\n")要检查程序过早退出的位置.我推了推struct sigevent sigeventStruct作为计时器生成的到期事件的结构.第一个参数设置为SIGEV_SIGNAL,因此这是它将发出的信号类型.///你可以在代码清单中看到的各种memset是零初始化结构.
if(timer_create(_POSIX_MONOTONIC_CLOCK, &sigeventStruct, &timer1) == -1)
是创建一个POSIX计时器.POSIX MONOTONIC CLOCK是一种计时器,&sigeventStruct是指向结构的指针,描述它是由计时器到期生成的事件.&timer1是指向特定计时器名称的指针.
if(timer_settime(timer1, NULL, &tempoIniziale, &tempoFinale) == -1)
使用此过程,计时器处于待命状态,因此您可以使其生成到期.timer1是计时器的名称,0是标志.GAPIL书中说:<>&tempoIniziale和&tempoFinale是指向itimerspec结构的指针.我还不太清楚&old_timer是什么意思.在GAPIL书中,您可以阅读:<>
struct sigaction, oldSigAzione
sigaction结构将作为参数传递给sigaction POSIX信号处理程序
sigaction (SIGEV_SIGNAL, NULL, &oldSigAzione)
SIGEV_SIGNAL是它必须处理的信号类型,NULL是可以放置指向const结构sigaction的指针,而oldSigAzione是指向前面提到的sigaction结构的指针.在这里,我还没有理解这两个指向sigaction struct的指针之间的区别.
我的问题是: 为什么程序在打印printf的数字19之前退出("19 \n"); 为什么不考虑printf("Timer scaduto \n"); inside函数void termination_handler(int signum)?
这是我的代码:
#include <string.h>
#include <stdio.h>
#include <fcntl.h>
#include <time.h>
#include <stdlib.h>
#include <errno.h>
#include <unistd.h>
#include <signal.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <arpa/inet.h>
#include <netinet/in.h>
#include <netdb.h>
#include <sys/fcntl.h>
#include <sys/wait.h>
#include <stdbool.h>
void termination_handler(int …Run Code Online (Sandbox Code Playgroud) 在"理解C中的指针"一书中,在解释了一个参数之后,存在一些已解决的问题.第22页,问题N.5我将附上代码和解释.在那之后,我会有问题.
#include <stdio.h>
int main()
{
int *c;
c = check(10, 20);
printf("c = %p\n",c);
return 0;
}
int * check(int i, int j)
{
int *p, *q;
p = &i;
q = &j;
if(i >= 45)
{
return p;
}
else
{
return q;
}
}
Run Code Online (Sandbox Code Playgroud)
输出:错误消息:主要中的非可移植指针分配
说明错误的原因很简单.传递给check()的整数在i和j中收集,然后将它们的地址分配给p和q.然后在下一个语句中,i的值针对45进行测试,并返回存储在p中的地址或存储在q中的地址.看来这个地址将在main()中的c中收集,然后打印出来.而且存在错误.函数check()不能返回整数指针.它可以返回的只是一个普通的整数.因此,仅将c声明为整数指针是不够的.我们必须在程序中进行以下修改才能使其正常工作
#include <stdio.h>
int * check(int, int);
int main()
{
int *c;
c = check(10, 20);
printf("c = %p\n",c);
return 0;
}
int *check(int i, int j)
{
......
......
}
Run Code Online (Sandbox Code Playgroud)
在我看来,这没有意义.作者为了在第一段代码上故意发出错误,试图在main中使用一个指向未分配的内存区域的指针.但他"试图"解决问题的方式根本不正确,他没有改变任何东西!相反,他应该在check()函数中使用malloc一些内存区域.我对么?
我有实施类似例如登录接口故障的简单与JSF 2.1 CRUD Web应用程序,PrimeFaces 3.5,EJB 3.1,JPA(ORM)/ EclipseLink的,JAAS中,MySQL 在TomEE的邮件列表,我被告知,我LoginController.java我正在尝试注入 Logger,但 Logger 注入不受 CDI 管理。有人告诉我改用生产者。不知道它是什么,我在互联网上搜索并找到了这个示例 但是我仍然不满意它,所以请解释我必须修改什么才能为记录器实现生产者。
登录控制器.java
package controller;
import util.DateUtility;
import java.io.IOException;
import java.io.Serializable;
import java.security.Principal;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.enterprise.context.SessionScoped;
import javax.faces.application.FacesMessage;
import javax.faces.context.FacesContext;
import javax.faces.event.ActionEvent;
import javax.inject.Inject;
import javax.inject.Named;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
/**
* Login Controller class allows only authenticated users to log in to the web
* application.
*
* @author Emre Simtay <emre@simtay.com>
*/
@Named
@SessionScoped
public class LoginController implements Serializable …Run Code Online (Sandbox Code Playgroud) 我正在编写一个程序来从txt文件中选择单词.编译标志:-std = gnu99程序有一些我用GDB和Valgrind调试的分段错误.Valgrind标志: - track-origin = yes --leak-check = full --show-reachable = yes我对Valgrind错误消息有疑问
首先,这里的代码解释了
#include <sys/types.h>
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/wait.h>
#include <errno.h>
struct character
{
char **words;
int *count;
int arrayCounter;
};
/*
* if finds in the array the word to add, then increase counter
* if it does not find the word, it puts the word non la trova ce la mette nel primo slot che è NULL, …Run Code Online (Sandbox Code Playgroud) 当我执行程序时
#include <stdio.h>
#include <math.h>
#include <unistd.h>
double exponential(double u);
double exponential(double u)
{
double a = (double)rand();
return (-u * log(1.0 - a));
}
int main(void)
{
printf("%e\n",exponential(2.3));
return 0;
}
Run Code Online (Sandbox Code Playgroud)
我获得:
nan
Run Code Online (Sandbox Code Playgroud)
为什么?
BATMAN/ALFRED OpenMesh项目:
function read_answer实例化指向已定义的类型struct vis_print_ops的指针
struct vis_print_ops
{
void (*preamble)(void);
void (*interfaces)(uint8_t iface_n, struct vis_iface *ifaces);
void (*entries)(uint8_t entries_n, struct vis_entry *vis_entries,
uint8_t iface_n, struct vis_iface *ifaces);
void (*postamble)(void);
};
Run Code Online (Sandbox Code Playgroud)
现在看看
void (*preamble)(void)
Run Code Online (Sandbox Code Playgroud)
你能告诉我最后一个(无效)是什么意思吗?是不是
void (*preamble)
Run Code Online (Sandbox Code Playgroud)
足够?