今天我遇到了一些奇怪的PHP,我在文档中找不到合适的解释.请考虑以下代码:
<?php
echo $_GET['t']. PHP_EOL;
?>
Run Code Online (Sandbox Code Playgroud)
代码很简单 - 它在url上需要一个t参数并将其输出.所以,如果你用test.php调用它?t =%5Ca(%5c是'\'),我希望看到:
\a
Run Code Online (Sandbox Code Playgroud)
但是,这就是我得到的:
$ curl http://localhost/~boaz/test.php?t=%5Ca
\\a
Run Code Online (Sandbox Code Playgroud)
注意双斜杠.任何人都可以解释发生了什么,并提供检索URL上提供的字符串的方法吗?
谢谢,波阿斯
PS.我正在使用PHP 5.2.11
例:
$arr = array(
'apple' => 'sweet',
'grapefruit' => 'bitter',
'pear' => 'tasty',
'banana' => 'yellow'
);
Run Code Online (Sandbox Code Playgroud)
我想切换葡萄柚和梨的位置,所以阵列将成为
$arr = array(
'apple' => 'sweet',
'pear' => 'tasty',
'grapefruit' => 'bitter',
'banana' => 'yellow'
)
Run Code Online (Sandbox Code Playgroud)
我知道要切换的元素的键和值,是否有一种简单的方法可以做到这一点?或者它需要循环+创建一个新数组?
谢谢
我在我的java项目中使用maven,我不明白如何添加本地库。在我的非 Maven 项目中,我是通过 CLASSPATH 完成的。我在当前的 java 项目中使用 NetBeans 和 maven。
看到WPF应用程序的各种示例我已经看到Grid几乎任何东西都使用该控件,即使是只有1列或行的最简单的东西.
此外,WPF模板以空网格开头.
对我来说,使用StackPanel或DockPanel更简洁,更好的维护(想想以后添加一行,不得不向所有其他行添加+1)
为什么Grid更好或我缺少什么?
我创建了一个简单的HtmlInputText
<h:inputText binding="#{IndexBean.objUIInput}" />
Run Code Online (Sandbox Code Playgroud)
然后在我的托管bean中,它是: -
private UIInput objUIInput;
public UIInput getObjUIInput() {
objUIInput.setValue("laala");
return objUIInput;
}
public void setObjUIInput(UIInput objUIInput) {
System.out.println("Set!!");
this.objUIInput = objUIInput;
}
Run Code Online (Sandbox Code Playgroud)
但我总是得到NullpointerException.我需要在JSF页面上做任何额外的事情吗?就像我们做jsp:usebean setproperty?请帮我.
我正在阅读JSlint选项文档以了解每个可用选项,并且遇到了一个我不太了解的问题,并且在其他地方找不到任何有用的信息.
sub - 容忍低效的下标
如果下标符号可用于以点表示法更好地表达的表达式,则为true.
任何人都可以更清楚地了解这意味着什么?
谢谢
我使用Hibernate Annotations 3.4.0在Scala 2.8.0中构建了一些带注释的域类.它一直工作正常,只是有一些注释将数组作为参数.例如,这是我想在Scala中表达的Java注释:
@OneToMany(mappedBy="passport_id", cascade=CascadeType.PERSIST)
Run Code Online (Sandbox Code Playgroud)
但是,注释需要数组/集作为输入:
[ERROR] .../Passport.scala:50: error: type mismatch;
[INFO] found : javax.persistence.CascadeType(value PERSIST)
[INFO] required: Array[javax.persistence.CascadeType]
[INFO] @OneToMany(mappedBy="passport_id", cascade=CascadeType.PERSIST)
Run Code Online (Sandbox Code Playgroud)
我尝试了各种括号,方形/角度/花括号等,以此类推:
@OneToMany(mappedBy="passport_id", cascade=(CascadeType.PERSIST))
@OneToMany(mappedBy="passport_id", cascade=[CascadeType.PERSIST])
@OneToMany(mappedBy="passport_id", cascade=<CascadeType.PERSIST>)
@OneToMany(mappedBy="passport_id", cascade={CascadeType.PERSIST})
Run Code Online (Sandbox Code Playgroud)
...但不幸的是,我已经完成了对Scala/Java注释的理解.感谢帮助.
#include <iostream>
#include <fstream>
#include <cmath>
#include <math.h>
#include <iomanip>
using std::ifstream;
using namespace std;
int main (void)
{
int count=0;
float sum=0;
float maximum=-1000000;
float sumOfX;
float sumOfY;
int size;
int negativeY=0;
int positiveX=0;
int negativeX=0;
ifstream points; //the points to be imported from file
//points.open( "data.dat");
//points>>size;
//cout<<size<<endl;
size=100;
float x[size][2];
while (count<size) {
points>>(x[count][0]);
//cout<<"x= "<<(x[count][0])<<" ";//read in x value
points>>(x[count][1]);
//cout<<"y= "<<(x[count][1])<<endl;//read in y value
count++;
}
Run Code Online (Sandbox Code Playgroud)
这个程序在我声明浮动x [大小] [2]的行上给出了预期的常量表达式错误.为什么?
我想做那样的事情:
我试着设置一个EmbededId,这将是logRequest的一个属性.这就是我遇到的问题.我没有到达mannage嵌入式id.(http://docs.jboss.org/hibernate/stable/annotations/reference/en/html_single/#entity-mapping-identifier)
如果你有一个关于我应该怎么做的线索:)
一个例子(不工作)将是:
@Entity
@AssociationOverride( name="logRequest.fileName", joinColumns = { @JoinColumn(name="log_request_file_name") } )
public class Reporting {
@EmbeddedId
private ReportingFile logRequest;
@CollectionOfElements(fetch = FetchType.EAGER)
@JoinTable(name = "t_reports", schema="", joinColumns = {@JoinColumn(name = "log_report")})
@Fetch(FetchMode.SELECT)
private List<ReportingFile> reports;
@Column(name="generated_date",nullable=true)
private Date generatedDate;
[...]
}
@Embeddable
public class ReportingFile {
@Column(name="file_name",length=255)
private String fileName;
@Column(name="xml_content")
private Clob xmlContent;
[...]
}
Run Code Online (Sandbox Code Playgroud)
在此示例中,我有以下错误:
15.03.2010 16:37:59 [ERROR] org.springframework.web.context.ContextLoader Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.dao.annotation.PersistenceExceptionTranslationPostProcessor#0' defined in class …Run Code Online (Sandbox Code Playgroud) 我希望只有当前用户是管理员才能访问我的应用程序中的某些功能.
如何在Windows上使用Python确定当前用户是否在本地Administrators组中?