小编010*_*101的帖子

当前上下文中不存在名称"ViewBag" - 在"区域"中

我的问题非常类似于这个问题,除了我的是在子区域(右键单击,创建区域)

"ViewBag"这个名称在当前上下文中不存在

我运行升级工具,它确实发现了该区域的web.config,但我仍然收到错误.我的布局页面非常简单:

<!DOCTYPE html>

<html>
<head>
    <title>@ViewBag.Title</title>
</head>
<body>
    <div>
        @RenderBody()
    </div>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)

我的内容页面看起来像这样靠近顶部:

@model IEnumerable<ProjectName.Models.OrderViewModel>

@{
    ViewBag.Title = "Index";
    Layout = "~/Areas/Admin/_AdminLayoutPage.cshtml";
}

<h2>Index</h2>
Run Code Online (Sandbox Code Playgroud)

asp.net-mvc asp.net-mvc-3

17
推荐指数
2
解决办法
2万
查看次数

如何在C中连接两个整数

Stack Overflow用许多其他语言回答了这个问题,但不是C.所以我想我会问,因为我有同样的问题.

如何在C中连接两个整数?

例:

x = 11;
y = 11;
Run Code Online (Sandbox Code Playgroud)

我想z如下:

z = 1111;
Run Code Online (Sandbox Code Playgroud)

其他示例尝试使用字符串执行此操作.没有字符串的方法是什么?

我正在寻找一种在C中执行此操作的有效方法,因为在我的特定用法中,这将成为代码的时间关键部分.

提前致谢!

c math optimization mathematical-optimization

17
推荐指数
2
解决办法
7万
查看次数

Jinja模板中是否允许使用内联代码?

我在我的网站上使用Jinja,我喜欢它.

我遇到了一个简单的需求.如何显示今天的日期?有没有办法在Jinja模板中内联一些Python代码?

import datetime
now = datetime.datetime.utcnow()
print now.strftime("%Y-%m-%d %H:%M")
Run Code Online (Sandbox Code Playgroud)

这篇文章说没有,但建议使用宏或过滤器?

真?我们必须诉诸于所有这一切吗?好的,在这种情况下会是什么样子?

python jinja2

14
推荐指数
2
解决办法
2万
查看次数

在.NET 4.0中,WebGrid + Paging + Sorting + Filtering中的过滤器丢失了

我已经实现了一个WebGrid.排序,分页和过滤不能一起使用.它们在您单独使用时起作用.当您将三者结合使用时,过滤不起作用.

症状:
过滤结果集,然后排序.

要么

过滤结果集,然后转到下一页.

在这两种情况下,过滤器都会丢失.但它确实是页面和排序.

在后面的代码中:当通过排序或分页调用action方法时,为每个过滤器参数显示null.

通过过滤器调用操作方法时,过滤器参数会通过.

这告诉我,当你开始排序或分页时,它没有提交表单.

public ActionResult MyPage(int? page, int? rowsPerPage, 
              string sort, string sortdir, 
              string orderNumber, string person, string product)
Run Code Online (Sandbox Code Playgroud)

我在SO和其他地方环顾四周.有很多例子和人们会问如何做一个或另一个或全部三个.但我只看到一个与我的问题,所以我在这里发布.(他也没有解决)

我的页面实现如下:

@using (Ajax.BeginForm("MyPage", null, new AjaxOptions { InsertionMode = InsertionMode.Replace, UpdateTargetId = "myGrid" }, new { id = "filter" }))
{
    <div class="right">
        <select id="rowsPerPage" name="rowsPerPage">
            <option>15</option>
            <option>25</option>
            <option>50</option>
            <option>75</option>
            <option>100</option>
        </select>
    </div>  

    <div class="table">
        <div class="tableRow">
            <div class="tableCell">
                Order Number
            </div>
            <div class="tableCell">
                Person
            </div>
            <div class="tableCell">
                Product
            </div>
        </div>
        <div …
Run Code Online (Sandbox Code Playgroud)

c# asp.net-mvc webgrid asp.net-mvc-3

14
推荐指数
1
解决办法
2万
查看次数

uWSGI:"你没有缓冲后启用harakiri"的解决方案是什么?

uWSGI的附庸ini中的哪些配置设置可以解决此问题?

*** WARNING: you have enabled harakiri without post buffering. Slow upload could be rejected on post-unbuffered webservers ***

uwsgi

14
推荐指数
1
解决办法
5110
查看次数

静态链接glibc但其他一些库与GCC动态链接

我需要静态链接glibc到我的项目,因为目标平台只支持一个非常旧的(但它与我的工具链中的静态链接glibc一起工作,我已经检查过了)

不幸的是,这个应用程序必须使用pthread库,但是静态链接的libpthread需要占用太多空间.

我想静态链接glibc,并动态pthread.

运行此命令后

powerpc-unknown-linux-gnu-gcc object_files -lrt -lpthread -Wl,-Bstatic -lc 
Run Code Online (Sandbox Code Playgroud)

我明白了:

/powerpc-unknown-linux-gnu/bin/ld: cannot find -lgcc_s
Run Code Online (Sandbox Code Playgroud)

c linker glibc static-linking

13
推荐指数
2
解决办法
4万
查看次数

无法加载uWSGI插件:./ python3_plugin.so:无法打开共享对象文件:没有这样的文件或目录

在我的Fedora工作站上,我收到此错误:

!!! UNABLE to load uWSGI plugin: ./python3_plugin.so: cannot open shared object file: No such file or directory !!!
Run Code Online (Sandbox Code Playgroud)

但在服务器(CentOS Linux)上,它工作正常.

为了解决这个问题,我需要在我的uwsgi.ini文件中说这个

plugins-dir = /usr/lib64/uwsgi/
plugins = python3
Run Code Online (Sandbox Code Playgroud)

但在服务器上,我可以这样做:

plugins = python3
Run Code Online (Sandbox Code Playgroud)

在我的工作站上,我使用dnf卸载/重新安装uwsgi.我确实在/ usr/lib64/uwsgi文件夹中安装了python插件.它来自dnf install uwsgi-plugin-python3

我糊涂了.

python centos fedora uwsgi

12
推荐指数
1
解决办法
4618
查看次数

使用Composition在C#中自动生成Wrapper类

这应该很简单,但我找不到任何东西.

我在一个程序集中有一个类(一个共享库 - 它是一组Web服务的代理类)我在另一个程序集中有一个类(Web项目)

在代理程序集中有一个名为"Profile"的类.有一组类在Web项目中"使用"一个Profile.如果没有用户登录,则使用GenericProfile.

遵循"关注点分离"的原则....代理程序集由其他项目使用,并且仅关注Web服务的东西.网络项目只有网络内容

但是,现在需要一个"GenericProfile" - 将其视为"访客用户".

逻辑上要做的是构建一个名为IProfile的接口,并使两个类从它派生.但这会在两个程序集之间产生循环依赖关系.

下一个最好的想法是创建一个名为MyInterfaces的第三个程序集并将IProfile放在那里 - 但是在我看来这会导致违反"关注点分离"原则.至少,这个问题的一个例子似乎太小,不能在我的解决方案中制作额外的模块.

输入包装类 - 或复合包装类(无论你想调用它)

我正在寻找一些最终产生如下内容的东西.是否有工具或Visual Studio扩展程序可以执行此操作?也许是.tt文件?

namespace WebProject
{
   public interface IProfile
   {...}

   class MyWrapperClass : IProfile
   {
       Proxy.Profile _profile;

       public MyWrapperClass(Proxy.Profile proxy)
       {
           _profile = proxy;
       }

       public string IProfile.Property1{ get { return _profile.Property1; } set { _profile.Property1 = value; } }
       public string IProfile.Property2{ get { return _profile.Property2; } set { _profile.Property2 = value; } }
       public string IProfile.Property3{ get { return _profile.Property3; } set { …
Run Code Online (Sandbox Code Playgroud)

c# visual-studio

10
推荐指数
2
解决办法
4548
查看次数

表达式必须是使用简单指针算法指向完整对象类型的指针

我正在尝试用void*做一些基本的指针算法.我的实际代码通过使用sizeof然后乘法来计算偏移量.下面是示例代码,用于显示问题的实例.

void * p;
p = 0;
p = p + 1;
Run Code Online (Sandbox Code Playgroud)

我在C(而不是C++)中使用MSVC编译器.

错误是:

expression must be a pointer to a complete object type  
Run Code Online (Sandbox Code Playgroud)

我不明白这个错误试图说的是什么.这里没有对象或结构.

c

10
推荐指数
1
解决办法
3万
查看次数

如何将带空格的字符串传入PowerShell?

鉴于:

# test1.ps1
param(
    $x = "",
    $y = ""
)

&echo $x $y
Run Code Online (Sandbox Code Playgroud)

像这样使用:

powershell test.ps1
Run Code Online (Sandbox Code Playgroud)

输出:

> <blank line>
Run Code Online (Sandbox Code Playgroud)

但那就错了:

test.ps1 -x "Hello, World!" -y "my friend"
Run Code Online (Sandbox Code Playgroud)

输出:

Hello,
my
Run Code Online (Sandbox Code Playgroud)

我期待看到:

Hello, World! my friend
Run Code Online (Sandbox Code Playgroud)

powershell

10
推荐指数
3
解决办法
2万
查看次数