我似乎无法让这个例子打印出"你什么都没提交!".每次我提交一份空表格时都会说:
你提交了:你''
代替:
你什么都没提交!
我哪里做错了?
views.py
def search(request):
if 'q' in request.GET:
message = 'You submitted: %r' % request.GET['q']
else:
message = 'You submitted nothing!'
return HttpResponse(message)
Run Code Online (Sandbox Code Playgroud)
模板:
<html>
<head>
<title> Search </title>
</head>
<body>
<form action="/search/" method="get" >
<input type="text" name = "q">
<input type="submit"value="Search"/>
</form>
</body>
</html>
Run Code Online (Sandbox Code Playgroud) 可能重复:
PHP:如何禁用危险函数
嗨,这是我的情况:我必须让我的客户输入PHP代码,但只有字符串函数,日期函数等安全函数.所以我需要危险的PHP函数列表,在保存到PHP文件之前使用字符串替换删除它们.有什么建议吗?
所以我有一个HTML页面.它充满了各种标签,大多数都在其href属性中有sessionid GET参数.例:
...
<a href="struct_view_distrib.asp?sessionid=11692390">
...
<a href="SHOW_PARENT.asp?sessionid=11692390">
...
<a href="nakl_view.asp?sessionid=11692390">
...
<a href="move_sum_to_7300001.asp?sessionid=11692390&mode_id=0">
...
Run Code Online (Sandbox Code Playgroud)
所以,如你所见,sessionid是相同的,我只需要将它的值变为变量,无论从哪一个:x = 11692390我是正则表达式的新手,但谷歌没有帮助.多谢!
是否可以将下面的linq查询合并到一个查询中?
var checkBoxes = from x in FindAll<CheckBox>()
where x.Checked
select new
{
RecordType = Type.GetType(x.Attributes["RecordType"]),
RecordId = Int32.Parse(x.Attributes["RecordId"])
};
checkBoxes = from x in checkBoxes
where x.RecordType != typeof(DomainModel.Group)
select x;
Run Code Online (Sandbox Code Playgroud) 我正在尝试编写一个PowerShell脚本来自动执行IIS网站部署。我试图在Windows Server 2008 R2计算机上的32位以下环境中运行脚本:
C:\Windows\SysWOW64\WindowsPowerShell\v1.0\powershell.exe
Run Code Online (Sandbox Code Playgroud)
每当我运行这样的WebAdministration命令时:
Get-Website -Name "MYWebsite"
Run Code Online (Sandbox Code Playgroud)
我收到这样的错误:
Get-Website : Retrieving the COM class factory for component with CLSID {688EEE
E5-6A7E-422F-B2E1-6AF00DC944A6} failed due to the following error: 80040154.
At line:1 char:12
+ Get-Website <<<< -Name "MyWebsite"
+ CategoryInfo : NotSpecified: (:) [Get-Website], COMException
+ FullyQualifiedErrorId : System.Runtime.InteropServices.COMException,Micr
osoft.IIs.PowerShell.Provider.GetWebsiteCommand
Run Code Online (Sandbox Code Playgroud)
切换到64位版本的PowerShell.exe可以解决此问题,但使我无法同时使用Microsoft Team Foundation Server 2008 Power Tools PSSnapin,这对我来说是不行的。
知道我该如何克服吗?提前致谢。
我今天正在玩小数.我注意到了这个:
Decimal.MaxValue
79228162514264337593543950335
Decimal.MaxValue - 0.5m
79228162514264337593543950334
Run Code Online (Sandbox Code Playgroud)
以下代码打印为true.
static void Main(string[] args)
{
decimal d = Decimal.MaxValue - 0.5M;
var b = d % 1 == 0;
Console.WriteLine(b);
}
Run Code Online (Sandbox Code Playgroud)
我确信这背后有一个原因,但我不知道它是什么.
我试图找出如何在我的rails应用程序中本地化错误项目名称,当用户使用不正确的数据签名时出现...我想出了如何覆盖消息而不是消息的名称("密码") ,"登录","电子邮件",......)
de:
activerecord:
errors:
models:
user:
attributes:
password_confirmation:
blank: ""
password:
confirmation: ""
blank: ""
too_short: ""
login:
taken: ""
blank: ""
too_short: ""
email:
taken: ""
blank: ""
too_short: ""
invalid: ""
template:
header: ""
body: ""
Run Code Online (Sandbox Code Playgroud)
谢谢马库斯
我在JSF中通过AJAX更新组件:
<h:form>
<h:outputLink>Click me
<f:ajax event="click" render=":messages" />
</h:outputLink>
</h:form>
<h:messages id="messages" globalOnly="true" />
Run Code Online (Sandbox Code Playgroud)
由于<h:messages />驻留在外面,<h:form />我必须在ID前面添加冒号(:).这有效.
但是,如果我将相同的代码放入组件并将该组件包含到我的页面中,则代码将失败.原因是:messages声明是指组件层次结构的根,而<h:messages />我想要更新的组件实际上位于我的自定义组件下,该组件位于页面下(因此位置是样式的:myComponent:messages.
在我的组件内部,如何实现<h:messages />组件的正确前缀?我知道我可以手动为我的组件分配ID,并使用它来为引用添加前缀(如:#{cc.attrs.id}:messages).但是,我不知道这个组件所处的组件层次结构的级别,所以所需的前缀甚至可能是这样的:foo:bar:x:y:messages.