我有一个输入字段,带有一个电子邮件地址:
<h:inputText value="#{register.user.email}" required="true" />
Run Code Online (Sandbox Code Playgroud)
如何在JSF 2/PrimeFaces中使用正则表达式将输入的值验证为有效的电子邮件地址?
我有一个字符串"魔术词".我需要修剪字符串以仅提取"魔法".我正在做以下代码.
String sentence = "Magic Word";
String[] words = sentence.split(" ");
for (String word : words)
{
System.out.println(word);
}
Run Code Online (Sandbox Code Playgroud)
我只需要第一个字.有没有其他方法可以修剪字符串,只有在space出现时才能获得第一个字?
我试图将一个示例项目导入到eclipse中,并且在运行应用程序时面临下面给出的错误.
Caused by: org.hibernate.MappingException: org.hibernate.dialect.OracleDialect does not support identity key generation
at org.hibernate.dialect.Dialect.getIdentityColumnString(Dialect.java:743)
at org.hibernate.dialect.Dialect.getIdentityColumnString(Dialect.java:733)
at org.hibernate.mapping.Table.sqlCreateString(Table.java:426)
at org.hibernate.cfg.Configuration.generateSchemaCreationScript(Configuration.java:1028)
at org.hibernate.tool.hbm2ddl.SchemaExport.<init>(SchemaExport.java:125)
at org.hibernate.internal.SessionFactoryImpl.<init>(SessionFactoryImpl.java:492)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1744)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1782)
at org.springframework.orm.hibernate4.LocalSessionFactoryBuilder.buildSessionFactory(LocalSessionFactoryBuilder.java:247)
at org.springframework.orm.hibernate4.LocalSessionFactoryBean.buildSessionFactory(LocalSessionFactoryBean.java:373)
at org.springframework.orm.hibernate4.LocalSessionFactoryBean.afterPropertiesSet(LocalSessionFactoryBean.java:358)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1541)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1479)
... 32 more
Run Code Online (Sandbox Code Playgroud)
根据这个 SO链接,我改变了
@GeneratedValue(strategy = GenerationType.IDENTITY)
至
@GeneratedValue(strategy = GenerationType.AUTO) 要么 @GeneratedValue(strategy = GenerationType.TABLE)
但没有奏效.
这是代码:
User.java:
@Entity
@Table(name = "users")
@ManagedBean
@ViewScoped
public class User {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private int id;
@Column(name = "username", nullable = false) …Run Code Online (Sandbox Code Playgroud) 我可以看到DBA团队建议在性能优化时将序列缓存设置为更高的值.要将值从20增加到1000或5000. oracle docs表示缓存值,
Specify how many values of the sequence the database preallocates and keeps in memory for faster access.
在AWR报告的某处,我可以看到,
select SEQ_MY_SEQU_EMP_ID.nextval from dual
如果我增加缓存值,可以看到任何性能改进SEQ_MY_SEQU_EMP_ID.
我的问题是:
序列缓存是否在性能方面发挥了重要作用?如果是这样,如何知道序列所需的足够缓存值是多少.
我在提到这个 Oracle文档.在尝试执行以下操作时
public static void main(String args[]){
float f = 1.1f;
double df = 1.1f;
System.out.println("f=" + f);
System.out.println("df=" + df);
f = 1.5f;
df = 1.5f;
System.out.println("f=" + f);
System.out.println("df=" + df);
}
Run Code Online (Sandbox Code Playgroud)
输出是
f = 1.1
df = 1.100000023841858
f = 1.5
df = 1.5
Run Code Online (Sandbox Code Playgroud)
为什么第二行输出显示近似值.但不是第四线.如何计算价值?
我有一个序列SEQ_PAGE_ID
SEQUENCE_NAME INCREMENT_BY CACHE_SIZE LAST_NUMBER
-------------------------------------------------------
SEQ_PAGE_ID 1 20 2222292456
Run Code Online (Sandbox Code Playgroud)
要更改CACHE_SIZE,我使用下面的脚本,
alter sequence SEQ_PAGE_ID CACHE 5000;
当我查看查询时,
select ... from user_sequences where sequence_name = 'SEQ_PAGE_ID';
SEQUENCE_NAME INCREMENT_BY CACHE_SIZE LAST_NUMBER
-------------------------------------------------------
SEQ_PAGE_ID 1 5000 2222292447
Run Code Online (Sandbox Code Playgroud)
从LAST_NUMBER改变2222292456为2222292447.这是因为更改脚本而发生的吗?
我有一个javascript函数.点击即可调用此方法.使用document.getElementById我在那里获得某些参数.使用该参数我需要构建一个url.即,onclick必须执行该URL.
例如,在javascript中,
function remove()
{
var name=...;
var age = ...;
// url should be like http://something.jsp?name=name&age=age
}
Run Code Online (Sandbox Code Playgroud)
简而言之,我需要http://something.jsp?name=name&age=age在点击时执行此URL
<input type="button" name="button" onclick="remove();" />
Run Code Online (Sandbox Code Playgroud) 我试图执行以下查询以index从我的架构中获取计数.
select count(*) from USER_INDEXES; - 谁给了我一个数 397
但是
select count(*) from ALL_INDEXES where table_owner ='MY_SCHEMA';- 给了我357.
听起来怎么样?两者应该是一样的吗?
Oracle SQL developer通过自己计算索引来检查,给了我397
我试图将服务器从Jboss 4.2.2迁移到WildFly-8.2.0.在部署war文件时遇到一些问题.战争正在部署,但网址重写会产生问题.
对于4.2.2,rewrite.properties在localhost文件夹中调用的文件中写入了相同的文件.
RewriteCond %{REQUEST_URI} !^(.*)[.]([a-zA-Z]+)$
RewriteRule ^/home/(.*)$ /home/index.php?q=$1 [L,QSA]
Run Code Online (Sandbox Code Playgroud)
根据一些文档,我知道我们可以创建一个undertow-handlers.conf到我的ROOT.war/WEB-INF /文件夹,和
如何将上面的regex []格式放在'undertow-handlers.conf'中
试过这个
regex['/home/(.*)$'] -> rewrite['/home/index.php']
似乎网址正确加载并重定向到主页.但应用程序会遇到重定向循环错误.我指的是这个 和这个文档.看来我们可以配置http连接器以防止重定向循环,如下所示:
<connector name="http" protocol="HTTP/1.1" scheme="http" socket-binding="http" proxy-name="${env.OPENSHIFT_GEAR_DNS}" proxy-port="443" secure="true"/>
Run Code Online (Sandbox Code Playgroud)
但我不知道如何在WildFly 8中配置它.其次,如果这个问题是由于在'undertow-handlers.conf'中新的正则表达式中缺少RewriteCond?
ERROR:
[io.undertow.request] (default task-20) UT005023: Exception handling request to /home/index.php?q=: com.caucho.quercus.QuercusModuleException: java.io.IOException:
Run Code Online (Sandbox Code Playgroud)
远程主机强制关闭现有连接
请帮我解决这个问题.
我的web.xml:
<servlet-mapping>
<servlet-name>Quercus Servlet</servlet-name>
<url-pattern>*.php</url-pattern>
</servlet-mapping>
<welcome-file-list>
<welcome-file>index.php</welcome-file>
</welcome-file-list>
Run Code Online (Sandbox Code Playgroud) 我正在尝试使用JSON Web令牌验证Node.js API.我可以生成令牌来验证用户.现在我需要根据用户角色来检测我的API.以下是我如何路由中间件来验证和检查令牌.
var app = express();
var apiRoutes = express.Router();
apiRoutes.use(function (req, res, next) {
var token = req.body.token || req.param('token') || req.headers['x-access-token'];
if (token) {
jwt.verify(token, app.get('superSecret'), function (err, decoded) {
if (err) {
return res.json({ success: false, message: 'Failed to authenticate token.' });
} else {
req.decoded = decoded;
next();
}
});
} else {
return res.status(403).send({
success: false,
message: 'No token provided.'
});
}
});
apiRoutes.get('/check', function (req, res) {
//...
});
app.use('/api', apiRoutes);
Run Code Online (Sandbox Code Playgroud)
这样,我保护API说/api/check …