走过海棠暮

文章 评论 浏览 25

走过海棠暮 2024-09-22 11:01:25

您是否依赖 4.0 的任何特定内容?

如果您调用 MSBuild 4.0,您将获得 4.0 工具。如果您调用 MSBuild 3.5,您将获得 3.5 工具(这正是您想要的,因为您显然托管在 2.0 CLR 中)。

另一种选择是将 4.0 CLR 放在您的 Web 服务器上。如果未打开,则您的信息流中不应该有任何 4.0 目标内容。

Are you reliant on anything 4.0 specific?

If you invoke MSBuild 4.0, you'll get 4.0 tools. If you invoke MSBuild 3.5, you'll get 3.5 tools (which is what you want as you're clearly hosting in a 2.0 CLR).

The other option is to put the 4.0 CLR on your web server. If that's not open, you shouldnt have any 4.0 targetted stuff in your stream.

VS.NET 2010/MSBUILD 可以为 .NET 3.5 SP1 生成 XmlSerializers 吗?

走过海棠暮 2024-09-22 09:16:08

基本名称($str);

basename($str);

php中如何获取文件名

走过海棠暮 2024-09-21 22:40:56

找不到某个元素的成本与找到该元素的成本基本相同。

所以这可能不会导致性能下降。

The cost of not finding an element is basically the same of finding it.

So probably this won't cause a performance hit.

jquery中如何处理缺失元素

走过海棠暮 2024-09-21 21:42:34

您可以使用 QUERY_STRING 来完成此操作。

RewriteCond %{QUERY_STRING} username
RewriteCond %{REQUEST_URI} !^/home.html
RewriteRule .* /home.html/ [L,QSA]

You can use QUERY_STRING to accomplish this.

RewriteCond %{QUERY_STRING} username
RewriteCond %{REQUEST_URI} !^/home.html
RewriteRule .* /home.html/ [L,QSA]

如果存在查询字符串值,如何重定向请求?

走过海棠暮 2024-09-21 13:26:48

您可以尝试

SecurityContextHolder.getContext().getAuthentication().getAuthorities();

查看当前用户(身份验证)是否已添加任何角色(权限)。无论您如何验证/授权用户,这都应该有效。

Spring security 是一个用于保护应用程序的出色框架。然而,对于比演示稍微复杂一点的事情,最好首先对基础知识有一个良好的“感觉”。在实施诸如基于 LDAP-DB 的解决方案之类的重要解决方案之前,请尝试了解所有内容如何协同工作。一开始可能需要一些时间,但肯定会有回报。

You could try

SecurityContextHolder.getContext().getAuthentication().getAuthorities();

to see, if any roles (authorities) have been added to the current user (authentication). This should work no matter how you authenticate/authorize your users.

Spring security is a great framework for securing your applications. However, for everything a little bit more complex than the demos, it's best to get a good "feeling" for the basics first. Try to get an understanding how everything works together, before you implement something non-trivial like an LDAP-DB-based solution. It might take some time at first, but it definitely pays off.

Spring安全LDAP连接

走过海棠暮 2024-09-21 13:15:16

使用属性是访问局部变量的最佳实践。有关属性(以及获取/设置)的更多信息,请参阅 MSDN 属性文章< /a>

摘录如下:
“get 关键字在属性或索引器中定义一个访问器方法,用于检索属性或索引器元素的值”
它会检索值,因此您需要使用 return 关键字。

“set 关键字定义属性或索引器中的访问器方法,用于分配属性或索引器元素的值。”
Set 分配值,因此您将使用 varX = value;

Using properties is a best practice to access your local variables. More info on properties (and get/set) can be found on MSDN Properties article

A small extract from there:
"The get keyword defines an accessor method in a property or indexer that retrieves the value of the property or the indexer element"
It retrieves the value, so you need to use the return keyword.

"The set keyword defines an accessor method in a property or indexer that assigns the value of the property or the indexer element."
Set assigns the value, so you'll use varX = value;

在 get 中使用 return

走过海棠暮 2024-09-21 10:30:00
$.fn.MyFunction = function(param) {
   if(arguments.length > 0)
      return true;
   else
      return false;
}
$.fn.MyFunction = function(param) {
   if(arguments.length > 0)
      return true;
   else
      return false;
}

如何创建一个返回 bool 值的 jQuery 函数?

走过海棠暮 2024-09-21 07:21:17

我建议您查看我之前的回答来了解关闭问题如何构建 JSON 对象以发送到 AJAX WebService?如果 ContentType 不是 JSON,我可以从 .asmx Web 服务返回 JSON 吗?

正确的代码应如下所示

[WebMethod]
[ScriptMethod (ResponseFormat = ResponseFormat.Json)]
public EntityLayer.TestPage1 GetData(int id)
{
    TestPage1 test = TestPage1.GetData(id).SingleOrDefault();
    return test;
}

var myData = 5;
$.ajax({
    type: "POST",
    contentType: "application/json; charset=utf-8",
    url: "WebService.asmx/GetData",
    //data: {id:JSON.stringify(myData)},
    data: JSON.stringify({id:myData}),
    dataType: "json",
    success: function(response){
        alert("UserName=" + response.d.UserName +
              ", FirstName=" + response.d.FirstName +
              ", MiddleName=" + response.d.MiddleName+
              ", LastName=" + response.d.LastName);
    }
})

其中 JSON.stringify 是脚本 json2.js 中的函数,您可以从 http://www.json.org/js.html

如果 id 值是整数 JSON.stringify(myData)myData 相同,但对于所有更复杂的示例,我强烈建议您使用此功能。

从代码中您还可以看到,Web 方法的所有结果都将保存在属性 d 中,因此您应该使用例如 response.d.FirstName 语法来访问名字。

更新:如果是 HTTP GET,data 参数应为 {id:JSON.stringify(myData)}。对于 HTTP POST:JSON.stringify({id:myData})

I recommend you look my previous answer for the close questions How do I build a JSON object to send to an AJAX WebService? and Can I return JSON from an .asmx Web Service if the ContentType is not JSON?

The correct code should looks like following

[WebMethod]
[ScriptMethod (ResponseFormat = ResponseFormat.Json)]
public EntityLayer.TestPage1 GetData(int id)
{
    TestPage1 test = TestPage1.GetData(id).SingleOrDefault();
    return test;
}

and

var myData = 5;
$.ajax({
    type: "POST",
    contentType: "application/json; charset=utf-8",
    url: "WebService.asmx/GetData",
    //data: {id:JSON.stringify(myData)},
    data: JSON.stringify({id:myData}),
    dataType: "json",
    success: function(response){
        alert("UserName=" + response.d.UserName +
              ", FirstName=" + response.d.FirstName +
              ", MiddleName=" + response.d.MiddleName+
              ", LastName=" + response.d.LastName);
    }
})

where JSON.stringify is a function from the script json2.js which you can download from http://www.json.org/js.html.

If the id values are integer JSON.stringify(myData) are the same as myData, but for all more complex examples I strictly recommend you to use this function.

How you can also see from the code the all results of the web method will be saved in the property d, so you should use for example response.d.FirstName syntax to access the first name.

UPDATED: In case of HTTP GET the data parameter should be {id:JSON.stringify(myData)}. In case of HTTP POST: JSON.stringify({id:myData})

asmx Web 服务、json、javascript/jquery?

走过海棠暮 2024-09-21 06:01:07

我发现错误我没有提到收件箱。所以事件没有触发,因为我的项目事件在收件箱上:)

i found the error i was n't referring to inbox. so event was not firing because my item event was on inbox :)

虽然 itemadd 事件在我的 Outlook 中有效,但在朋友的电脑中不起作用

走过海棠暮 2024-09-21 05:40:54

我承认我通常使用 2 个重定向来让这样的东西发挥作用。

首先,创建您自己的 registration/login.html 页面。您可以复制并粘贴 身份验证文档 使过程更容易一些。但是,不要使用上下文中的动态 '{{ next }} 变量,而是硬连线 next 的值以转到登录用户的通用登陆视图

<input type="submit" value="login" />
<input type="hidden" name="next" value="/gallery/" />

然后,在您映射的视图中到 /gallery/ URL,从请求中提取 User 对象(因为用户现在将登录,特别是如果图库视图包含在 @permission_required 中或@login_required 装饰器。使用该视图重定向到适当的用户特定的图库页面:

@login_required
def gallery(request):
    url = '/gallery/%s/' % request.user.username
    return HttpResponseRedirect(url)

I confess I usually use 2 redirects in order to get something like this to work.

First, Make your own registration/login.html page. You can copy-and-paste the html example in this section of the authentication docs to make the process a little easier. Instead of using the dynamic '{{ next }} variable from the context, however, hardwire the value of next to go to a generic landing view of logged-in users

<input type="submit" value="login" />
<input type="hidden" name="next" value="/gallery/" />

Then, in the view that you map to the /gallery/ URL, extract the User object from the request (since the user will now be logged in, especially if the gallery view is wrapped in a @permission_required or @login_required decorator. Use that view to redirect to the appropriate user-specific gallery page:

@login_required
def gallery(request):
    url = '/gallery/%s/' % request.user.username
    return HttpResponseRedirect(url)

“下一个”是参数、重定向、django.contrib.auth.login

走过海棠暮 2024-09-21 04:42:26

a 仍然是一个字符串数组,但是是一个字符数组。

                   a == ["foo", "", "", "bar", "baz"]
          a.join("") == "foobarbaz"
a.join("").split("") == ["f", "o", "o", "b", "a", "r", "b", "a", "z"]

我不知道这段代码的目的。

a is still a string array, but is an array of characters.

                   a == ["foo", "", "", "bar", "baz"]
          a.join("") == "foobarbaz"
a.join("").split("") == ["f", "o", "o", "b", "a", "r", "b", "a", "z"]

I don't know the purpose of this code.

JS join/split 技巧有什么作用?

走过海棠暮 2024-09-21 00:49:52

出于绝望,我将所有显卡设置重置为默认值,现在一切都神奇地修复了。知道哪个设置修复了它会很有趣。

Out of desperation I reset all of my graphics card settings to their defaults, and now everything is magically fixed. It'd be interesting to know which setting fixed it.

Swing 应用程序始终以最大化方式启动

走过海棠暮 2024-09-20 23:41:04

关系数据库不保证顺序。

Django 也无法做出保证,因为它取决于底层关系数据库。

如果您想要特定的排序,则必须通过提供某种序列号来实现该特定的排序。


通常 order_by 最简单,因为它是查询集的一部分。请参阅 http://docs.djangoproject.com/ en/1.2/ref/models/querysets/#order-by-fields

最快的方法是创建一个列表并在视图函数中使用sorted

object_list = sorted( some_query_set, key=lambda o: o.some_field )

或者

object_list= list( some_query_set )
object_list.sort( key=lambda o: o.some_field )

其中任何一个都会非常快。

The relational database makes no guarantee of ordering.

Django can't make a guarantee, either, since it depends on the underlying relational database.

If you want a specific ordering, you must implement that specific ordering by providing some kind of sequence number.


Usually order_by is simplest, Since it's part of the query set. See http://docs.djangoproject.com/en/1.2/ref/models/querysets/#order-by-fields

The fastest way is to create a list and use sorted in the view function.

object_list = sorted( some_query_set, key=lambda o: o.some_field )

Or

object_list= list( some_query_set )
object_list.sort( key=lambda o: o.some_field )

Either of these will be really fast.

Django ManyToMany add() 是追加函数吗?

走过海棠暮 2024-09-20 17:18:43

Gaurav,执行这些操作的规范方法是使用 JDBC。它们提供统一、简单的界面。

Gaurav, the canonical way to do these things is by using JDBC. They provide a uniform, simple interface.

如何在Java应用程序中设置SQL数据库连接?

走过海棠暮 2024-09-20 13:56:59

我将使用属性 display: table-cell

这是 链接

I would use the property display: table-cell

Here is the link

使图像宽度为父 div 的 100%,但不大于其自身宽度

更多

推荐作者

lanyue

文章 0 评论 0

海螺姑娘

文章 0 评论 0

Demos

文章 0 评论 0

亢龙有悔

文章 0 评论 0

海未深

文章 0 评论 0

浅忆流年

文章 0 评论 0

    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文