半城柳色半声笛

文章 评论 浏览 26

半城柳色半声笛 2024-12-29 15:45:01

“启动项目”只是指当您在 Visual Studio IDE 中按 F5 时启动哪些项目。

它们对已部署的 Web 应用程序没有影响。


本着假期的精神,我决定问自己是否有任何方法可以在除零以外的任何程度上都是正确的。我发现了“5%”的可能性:

这些其他项目对于您的 Web 应用程序的正确行为是必要的吗?您提到它们是“控制台应用程序/计划任务”。您的应用程序是否要求这些控制台应用程序或计划任务在您的 Web 应用程序运行之前在 Web 服务器上运行?

如果是这种情况,那么您应该被告知启动项目“对已部署的 Web 应用程序没有影响”。事实上,您将此代码列为启动项目不会导致控制台应用程序或计划任务在 Web 服务器上运行,甚至不会部署到 Web 服务器。您必须将这些 .exe 文件部署到服务器,并且必须自己启动它们。 “启动项目”不会为你做到这一点。


如果不是这样,那么我认为这个问题应该作为“不是真正的问题”而结束,直到你缩小问题的范围。我的回答告诉你启动项目不做什么,但为了解决你的问题,你需要弄清楚实际的问题是什么。

"Startup project" simply means which projects start when you press F5 in the Visual Studio IDE.

They have no impact on the deployed web application.


In the spirit of the holidays, I decided to ask myself if there was any way you could be correct in any degree other than zero. I found a "5%" possibility:

Are these other projects necessary for the correct behavior of your web application? You mentioned that they are "Console apps/scheduled tasks". Does your application require that these console apps or scheduled tasks are running on the web server before your web application will function?

If that's the case, then you should be informed that startup projects "have no impact on the deployed web application". The fact that you have this code listed as startup projects will not cause the console apps or scheduled tasks to run on, or even to be deployed to, the web server. You will have to deploy these .exe files to the server and you will have to start them yourself. "Startup projects" won't do this for you.


If that's not it, then I think this question should be closed as "not a real question" until you narrow down what your problem is. My answer has told you what startup projects do not do, but in order to solve your problem, you'll need to figure out what the actual problem is.

当我发布具有多个启动项目的基于 MVC3 的 Web 解决方案时会发生什么?

半城柳色半声笛 2024-12-29 15:33:01

如果“安全”页面意味着不是管理员,而是为了区分登录用户和注销用户,您可能会发现使用用户帐户框架 webapp2 提供 python 2.7。您可以在 https://github.com/fredrikbonander/Webapp2-Sample-Applications< 找到示例应用程序< /a>

If by "secure" pages you mean that not admin but to distinguish between a logged in user and a logged out user you might find using the framework for user accounts that webapp2 provides for python 2.7. You can find an example app at https://github.com/fredrikbonander/Webapp2-Sample-Applications

谷歌应用引擎 + Python - 教育网站:需要专家的帮助

半城柳色半声笛 2024-12-29 11:50:45

如果对于输入,您的意思是“请求中出现的所有内容”(因此,需要验证的内容等),则应包括:

  • POST/GET vars ($_POST, $_GET)
  • Cookie ($_COOKIE)
  • 请求路径 ($_SERVER["REQUEST_URI"])
  • HTTP 方法($_SERVER["REQUEST_METHOD"])
  • HTTP 标头(通常在 $_SERVER["HTTP_"*] 中)

会话是一种特殊情况,因为所有会话变量都是存储在服务器端,即用户无法像使用 cookie 那样修改它们。无论如何,客户端会保存一个 cookie 来存储会话 ID,用户可以将其重置/设置为自定义值。

更新 - 关于 $_REQUEST

如前所述,在 PHP 中您还可以访问 $_REQUEST,它是来自 $_GET 的变量的组合, $_POST$_COOKIE
$_REQUEST 的具体内容由 php.ini 中的 request_order 指令确定。

If for input you mean "all the things coming in the request" (so, things that need validation, etc.), you should include:

  • POST/GET vars ($_POST, $_GET)
  • Cookies ($_COOKIE)
  • The request path ($_SERVER["REQUEST_URI"])
  • The HTTP method ($_SERVER["REQUEST_METHOD"])
  • The HTTP headers (usually in $_SERVER["HTTP_"*])

The session is a special case since all the session variables are stored on the server-side, i.e. the user cannot modify them as it would with cookies. Anyways, a single cookie is saved on the client-side to store the session ID, that can be reset / set to a custom value by the user.

Update - about $_REQUEST

As pointed out, in PHP you also have access to $_REQUEST, that is a mix of variables from $_GET, $_POST, $_COOKIE.
The exact content of $_REQUEST is determined by the request_order directive in php.ini.

会话和cookie通常被视为输入吗?

半城柳色半声笛 2024-12-29 11:12:48

这意味着变量 list 是最终的。

这意味着您不能再次为其分配其他内容。

完成后为其分配一个值(引用),如下所示:

private final List<Integer> list = new ArrayList<Integer>();

您不能再执行以下操作:

list = new ArrayList<Integer>(); //this is invalid because you are trying to assign something else the variable list

list.add(new Integer(123)); 此代码有效吗?

这是完全有效的。您只需将一个对象添加到变量 list 引用的 ArrayList 中即可。

final 关键字的使用限制变量 list 而不是它引用的 ArrayList 对象。

That means the variable list is final.

Which means you can not assign something else to it again.

Once you are done assign a value (reference) to it as follows:

private final List<Integer> list = new ArrayList<Integer>();

You can not do something as below again:

list = new ArrayList<Integer>(); //this is invalid because you are trying to assign something else the variable list

list.add(new Integer(123)); is this code valid?

It's perfectly valid. You are just adding an object to the ArrayList that variable list is referencing.

The usage of final keyword is restricting the variable list not the ArrayList object that it's referencing.

下面的java行将final修饰符分配给列表表示什么?

半城柳色半声笛 2024-12-29 10:59:47

对于你的问题:如何在循环中解决它就像

        var e1 = new Entity();
        var e2 = // Get Entity 

        foreach (var p in e1.GetType().GetProperties())
        { 
            p.SetValue(e1 , e2.GetType().GetProperty(p.Name ).GetValue(e2 , null) , null );
        }

这样,你可以通过循环将值从entity2复制到entity1

For your question : How to solve it in the loop is like

        var e1 = new Entity();
        var e2 = // Get Entity 

        foreach (var p in e1.GetType().GetProperties())
        { 
            p.SetValue(e1 , e2.GetType().GetProperty(p.Name ).GetValue(e2 , null) , null );
        }

So that , you can copy the value from entity2 to entity1 by looping

在 2 个实体之间映射属性值

半城柳色半声笛 2024-12-29 09:29:23

使用 随机 标头并使用 std::discrete_distribution。这是示例:

#include <iostream>
#include <map>
#include <random>

int main()
{
    std::random_device rd;
    std::mt19937 gen(rd());
    std::discrete_distribution<> d({20,30,40,10});
    std::map<int, int> m;
    for(int n=0; n<10000; ++n) {
        ++m[d(gen)];
    }
    for(auto p : m) {
        std::cout << p.first << " generated " << p.second << " times\n";
    }
}

这是输出的示例:

0 generated 2003 times
1 generated 3014 times
2 generated 4021 times
3 generated 962 times

Discrete distributions is a lot easier to do in C++11 with the random header and using std::discrete_distribution. This is example:

#include <iostream>
#include <map>
#include <random>

int main()
{
    std::random_device rd;
    std::mt19937 gen(rd());
    std::discrete_distribution<> d({20,30,40,10});
    std::map<int, int> m;
    for(int n=0; n<10000; ++n) {
        ++m[d(gen)];
    }
    for(auto p : m) {
        std::cout << p.first << " generated " << p.second << " times\n";
    }
}

and this is a sample of the output:

0 generated 2003 times
1 generated 3014 times
2 generated 4021 times
3 generated 962 times

如何从概率不均匀的列表中选择一个值?

半城柳色半声笛 2024-12-29 06:58:49

听起来您缺少包含 pgImportProcess 类的命名空间的 using 语句。

Sounds like you're missing a using statement for the namespace that contains the pgImportProcess class.

C# 2.0 VS2005 中预期的类型或命名空间

半城柳色半声笛 2024-12-29 06:09:44

看看 glympse.com - 他们几乎已经做到了这一切。进行路由也违反了谷歌地图的条款和条件,因此我会非常仔细地阅读它们并确定您的想法是否违反了条款和条件。

Take a look at glympse.com - they do this almost all of this already. It's also against the T&C of google maps to do routing, so I would very carefully read them and determine if your idea defies the T&C.

等待对我的 Android 应用程序想法的评论

半城柳色半声笛 2024-12-29 04:30:00

不可以。根据 C++ 标准的 §5.4.4,C 风格强制转换可以执行的强制转换为:

— a const_cast (5.2.11),
— a static_cast (5.2.9),
— a static_cast followed by a const_cast,
— a reinterpret_cast (5.2.10), or
— a reinterpret_cast followed by a const_cast

这被广泛称为“强制转换 const-ness”,并且编译器如果不编译该代码,则将不符合该标准的该部分。

正如 ildjarn 指出的那样,通过放弃 const 性来修改 const 对象是未定义的行为。该程序不会表现出未定义的行为,因为尽管指针指向 const 对象,但该对象本身不是 const(感谢 R.Martinho 和eharvest 纠正我的错误阅读)。

No. According to §5.4.4 of the C++ standard, the casts that can be performed by a C-style cast are:

— a const_cast (5.2.11),
— a static_cast (5.2.9),
— a static_cast followed by a const_cast,
— a reinterpret_cast (5.2.10), or
— a reinterpret_cast followed by a const_cast

This is widely known as "casting away const-ness", and the compiler would be non-conformant to that part of the standard if it did not compile that code.

As ildjarn points out, modifying a const object via casting away constness is undefined behaviour. This program does not exhibit undefined behaviour because, although an object that was pointed to by the pointer-to-const, the object itself is not const (thanks R.Martinho and eharvest for correcting my bad reading).

从(指向 const 的指针)到(指向非 const 的指针)的强制转换是否无效 c++?

半城柳色半声笛 2024-12-29 01:05:19

至于挂钩内核并拦截系统调用,这是我在编写的安全模块中所做的事情:

https://github.com/cormander/tpe-lkm

查看hijacks.c和symbols.c的代码;它们的使用方式在 security.c 内的 hijack_syscalls 函数中。我还没有在linux上尝试过这个> 3.0 尚未发布,但相同的基本概念应该仍然有效。

这有点棘手,您可能必须编写大量内核代码才能在取消链接之前进行文件复制,但这里是可能的。

As far as hooking into the kernel and intercepting system calls go, this is something I do in a security module I wrote:

https://github.com/cormander/tpe-lkm

Look at hijacks.c and symbols.c for the code; how they're used is in the hijack_syscalls function inside security.c. I haven't tried this on linux > 3.0 yet, but the same basic concept should still work.

It's a bit tricky, and you may have to write a good deal of kernel code to do the file copy before the unlink, but it's possible here.

拦截文件系统系统调用

半城柳色半声笛 2024-12-28 20:17:49

Array::Suffix 怎么样?

What about Array::Suffix?

perl 中的后缀数组?

半城柳色半声笛 2024-12-28 18:31:43

您的 update 语句中没有 where 子句。

更一般地说,您应该使用单个 update 子句来执行此操作,而不是使用游标:

exec usp_Gent @valback OUTPUT;
update Terr set
    Text = @valback
where
    Text = 'RightT';

除非您 usp_Gent 正在执行我缺少的操作。

您想要单个子句而不是为每一行执行一个的原因是因为 SQL 在集合中思考得更好。每个更新都有开销——它打开一个事务,记录它正在做什么,然后提交该事务。如果您必须执行数千次这样的操作,则速度会非常慢。你真正想做的只是一次更新数千行——这就是数据库使用关系代数所做的事情,而且它们真的非常擅长做到这一点。成组思考,而不是按顺序思考。

You have no where clause on your update statement.

More generically, you should use a single update clause to do this rather than a cursor:

exec usp_Gent @valback OUTPUT;
update Terr set
    Text = @valback
where
    Text = 'RightT';

Unless you're usp_Gent is doing something that I'm missing.

The reason you want a single clause instead of doing one for each row is because SQL thinks better in sets. Each update you have has overhead--it opens up a transaction, records what it's doing, and then commits that transaction. This is remarkably slow if you have to do thousands of these. What you really want to do is just update thousands of row at once--this is what databases do with relational algebra, and they are really, really good at doing it. Think in sets, not in order.

SQL Server 游标不工作

半城柳色半声笛 2024-12-28 17:39:44

这可能无法回答您的所有问题,但只能回答其中一些问题。 Rick Strahl 不久前写了一篇关于编译和部署的精彩文章,描述了它的工作原理:

ASP.NET 2.0 中的编译和部署

我添加了我认为与您的问题最相关的文章部分:

引用其他页面和控件

记住该页面和控制编译发生在每个目录的基础上!因此,对于 ASP.NET 2.0 来说,引用其他页面和控件变得更加棘手,因为您不能再假定其他页面或控件中的 CodeBeside 类在当前程序集中可用。最好的情况是同一目录中的所有页面和控件最终都在同一个程序集中,最坏的情况是每个页面或控件都有自己的程序集,并且它们彼此一无所知。

如果您需要从控件或另一个页面引用另一个页面,则需要使用 @Reference 指令显式导入它。这又与 ASP.NET 1.1 不同,在 ASP.NET 1.1 中,所有 CodeBehind 类都可以立即供整个 Web 应用程序使用。在 ASP.NET 2.0 中,需要显式程序集引用来加载它。

假设您有我之前展示的 DataEntry.aspx 页面,并且您想要创建使用相同 CodeBeside 类的第二个页面,以便您可以重用页面逻辑,但通过更改一些内容来更改 DataEntry2.aspx 中的页面布局颜色以及在页面控件周围移动。本质上,您希望两个 ASPX 页面引用相同的 CodeBeside 文件。

执行此操作的方法如下:

<%@ Reference Page="~/DataEntry.aspx" %>    
<%@ Page Language="C#" AutoEventWireup="true" Inherits="DataEntry" %> 

我省略了 CodeFile 属性引用 DataEntry 页面的 CodeBeside 类,并将 @Reference 标记添加到页面以强制导入 CodeBeside 类。

对于任何用户控件定义也是如此。要导入用户控件,您需要使用 @Register 标记,该标记导入控件所在的程序集。ASP.NET 在编译过程中很智能,并根据项目的编译方式准确地确定相关程序集所在的位置。如果控件或页面位于同一程序集中,则实际上不会添加任何引用。但如果它是外部的——例如在另一个目录中,则添加程序集引用。

引用问题

如果您可以在标记页面中显式引用其他页面和控件,那么一切都会按预期正常工作。但是,如果您在代码中动态加载控件或引用页面,事情就会变得更加复杂。

我遇到的最常见的问题是控件的动态加载。在 ASP.NET 1.x 中,您可能运行如下代码来将控件动态加载到页面中:

public partial class DynamicControlLoading : System.Web.UI.Page    
{    
    protected CustomUserControl MessageDisplay = null;  

    protected void Page_Load(object sender, EventArgs e)    
    {    
        MessageDisplay = this.LoadControl( "~/UserControls/CustomUserControl.ascx")   as CustomUserControl;

        this.Controls.Add(MessageDisplay);

    }

    protected void btnSay_Click(object sender, EventArgs e)    
    {    
        this.MessageDisplay.ShowMessage(this.txtMessage.Text);

    }

}

在本例中,CustomUserControl 是一个简单的用户控件,它位于另一个目录中并在运行时动态加载。进一步假设您确实想要动态加载此控件,因此您可以选择多个控件,或者最终用户甚至可能创建一个放置到位的自定义控件。

如果您在 ASP.NET 2.0 中运行上面的代码,它可能会失败。我说可能是因为存在一些不一致的情况,有时会自动获取控件引用,例如,如果用户控件位于同一目录中并被编译到与页面相同的程序集中,或者如果另一个页面引用了该控件。

它应该而且通常会失败。为什么?因为 ASP.NET 在目录级别进行编译,而 CustomUserControl 位于单独的目录中,因此进入单独的程序集。对于页面类来说,获取强类型引用是不可见的。 Intellisense 将为 MessageDisplay 控件显示一个又大又粗的红色感叹号,或者根本不显示任何内容。当你运行该页面时,它会崩溃。

当然,您可以将控件引用为 Control 类型,但如果您需要访问用户控件上除 Control 属性之外的任何自定义属性,则不能,除非您诉诸反射。据我所知,无法以编程方式添加对另一个用户控件或页面的引用,因为该引用需要在代码运行之前的编译时尽早可用。

替代方案是不动态加载控件,或者至少提供某种机制来使用适当的 @Register 标记预先在页面上加载任何用户控件。但这并不总是可能的。另一种选择是在 APP_CODE 中创建用户控件基类并在那里公开公共接口。这样做的主要问题是该基类将无权访问用户控件的任何内部控件,因此基类必须使用 FindControl 来引用任何嵌入控件。所以这是非常低效的,而且启动起来很麻烦。

我在继承场景中遇到过类似的情况。例如,从一个母版页继承另一个母版页的 CodeBeside 类。一切正常,但 ASP.NET 编译器抱怨 Profile 对象被非法覆盖(编译器警告)。使用继承的母版页运行可以工作,但有一些怪癖。添加到母版页的用户控件通常会因类型冲突而失败,因为 ASP.NET 将添加到基页的用户控件视为与添加到第二页的用户控件不同的类型。

像这样处理引用其他类型的不一致让我浪费了令人难以置信的大量时间,以为我已经修复了某些东西,但后来发现当我更改完全不同的页面时它实际上并没有一致地工作。更糟糕的是,您必须真正理解模型才能了解可能出现的问题。

底线:整个 ASP.NET 2.0 编译模型内部很复杂。大多数时候您不需要理解它,但是当您遇到这些边界场景时,您确实必须了解幕后发生的事情才能解决这些怪癖。

This may not answer all your questions, but some of them. Rick Strahl wrote a great article a while back on compilation and deployment that describes how it works:

Compilation and Deployment in ASP.NET 2.0

I added part of the article that I think relates most to your question below:

Referencing other Pages and Controls

Remember that page and control compilation happens on a per directory basis! So referencing other pages and controls becomes a little more tricky for ASP.NET 2.0, because you can no longer assume that a CodeBeside class from another page or control is available in the current assembly. At best all pages and controls in the same directory end up in the same assembly, at worst each page or control gets its own assembly and they know nothing about each other.

If you need to reference another page from a control or another page you need to explicitly import it with the @Reference directive. Again this is different than ASP.NET 1.1 where all CodeBehind classes were immediately available to your entire Web application. In ASP.NET 2.0 an explicit assembly reference is required to load it.

Assume for a minute that you have the DataEntry.aspx page I showed earlier and you want to create a second page that uses the same CodeBeside class so you can reuse the page logic, but change the page layout in DataEntry2.aspx by changing a few colors and moving around the controls of the page. In essence you want to have two ASPX pages reference the same CodeBeside file.

Here’s how to do this:

<%@ Reference Page="~/DataEntry.aspx" %>    
<%@ Page Language="C#" AutoEventWireup="true" Inherits="DataEntry" %> 

I’m leaving out the CodeFile attribute reference the CodeBeside class of the DataEntry page, and add the @Reference tag to the page to force the CodeBeside class to be imported.

The same is true with any User Control definitions. To import a user control you need to use the @Register tag, which imports the assembly that the control lives in. ASP.NET is smart during compilation and figures out exactly where related assemblies live based on how the project is compiled. If the control or page lives in the same assembly no reference is actually added. But if it is external – in another directory for example, then the assembly reference is added.

Referencing problems

If you can explicitly reference other pages and controls in your markup pages, then all works well and as expected. But if you dynamically load controls or reference pages dynamically in your code, things get a lot more complicated.

The most common problem I run into is dynamic loading of controls. In ASP.NET 1.x you might have run code like this for dynamically loading controls into a page:

public partial class DynamicControlLoading : System.Web.UI.Page    
{    
    protected CustomUserControl MessageDisplay = null;  

    protected void Page_Load(object sender, EventArgs e)    
    {    
        MessageDisplay = this.LoadControl( "~/UserControls/CustomUserControl.ascx")   as CustomUserControl;

        this.Controls.Add(MessageDisplay);

    }

    protected void btnSay_Click(object sender, EventArgs e)    
    {    
        this.MessageDisplay.ShowMessage(this.txtMessage.Text);

    }

}

CustomUserControl in this case is a simple User Control that lives in another directory and is loaded dynamically at runtime. Further assume that you truly dynamically want to load this control so you may have a choice of several controls, or the end-user might even create a custom control that gets dropped into place instead.

If you run the code above in ASP.NET 2.0 it will likely fail. I say likely because there are some inconsistencies that will sometimes pick up control references automatically, for example if the user control lives in the same directory and gets compiled into the same assembly as the page, or if another page has the control referenced.

It should and usually will fail. Why? Because ASP.NET compiles on a directory level and the CustomUserControl lives in a separate directory and so goes into a separate assembly. It’s not visible to page class to get a strongly typed reference. Intellisense will show a big, fat and red exclamation point or nothing at all for the MessageDisplay control. When you run the page it will bomb.

You can reference the control as the Control type of course, but if you need to access any custom properties on the user control beyond Control properties you can’t unless you resort to Reflection. As far as I know there’s no way to add a reference to another user control or page programmatically because the reference needs to be available way earlier at compile time before your code ever runs.

Alternatives are to not load controls dynamically or at least provide some mechanism to load up any user controls beforehand on a page with the appropriate @Register tags. But that’s not always possible. The other option is to create a user control base class in APP_CODE and expose the public interface there. The main problem with this is that this base class will not have access to any internal controls of the user control and so the base class would have to use FindControl to reference any embedded controls. So this is inefficient as hell, and cumbersome to boot.

I’ve run into similar situations with inheritance scenarios. For example, inheriting one master page off another’s CodeBeside class. All works well, but the ASP.NET compiler complains that the Profile object is being overridden illegally (a compiler warning). Running with the inherited master page works, but there are quirks. User Controls added to the master page often fail with type conflicts as ASP.NET treats the user control added to the base page as a different type than the user control added to the second page.

It’s inconsistencies like these that deal with referencing other types that have made me waste an incredible amount of time, thinking I had something fixed only to find out later that it didn’t actually work consistently when I changed a completely different page. Worse you have to really understand the model to get your head around what might be wrong.

Bottom line: The overall ASP.NET 2.0 compilation model is internally complex. Most of the time you don’t need to understand it, but when you run into these boundary scenarios, you really DO have to understand what goes on behind the scenes to be able to work around the quirks.

自定义控件在asp.net中是如何实例化的?

半城柳色半声笛 2024-12-28 15:36:19

不,这在 HTML4、XHTML 或 HTML5 中都是无效的。

如果您针对 w3c 标记验证器 进行验证,您可能会得到类似以下内容:

元素 div 不允许作为元素 ul 的子元素

列表的更多信息,请参见此处。

No, this is not valid, neither in HTML4, nor in XHTML or in HTML5.

If you'll validate this against the w3c markup validator you'll probably get something like:

Element div not allowed as child of element ul

More about lists can be found here.

这个 HTML 结构有效吗? UL> DIV> {LI,LI},DIV> {LI,LI},DIV> { 李,李 }

半城柳色半声笛 2024-12-28 14:38:35

目前,仅靠 CSS 是不可能实现这一点的。最好的选择是使用 canvas (和一些 Javascript)。

https://developer.mozilla.org/en/Drawing_Graphics_with_Canvas

http://www.roblaplaca.com/examples/bezierBuilder/

2023 年 8 月更新:

仅使用 CSS 仍然无法实现这一点(很高兴被证明是错误的)。您可以做一些有趣的事情,但它们都取决于边框、边框半径等。

参考文献:

Currently, this is not possible with CSS alone. Your best bet would be to make use of the canvas (and some Javascript).

https://developer.mozilla.org/en/Drawing_Graphics_with_Canvas

http://www.roblaplaca.com/examples/bezierBuilder/

Update August 2023:

This still isn't possible with only CSS (happy to be proven wrong). There are some interesting things you can do though, but they all depend on border, border radius, etc.

References:

使用 CSS 弯曲 div

更多

推荐作者

α

文章 0 评论 0

メ斷腸人バ

文章 0 评论 0

人间不值得

文章 0 评论 0

往事风中埋

文章 0 评论 0

别理我

文章 0 评论 0

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