小编Sho*_*og9的帖子

验证模型或视图模型?

我正在阅读教程并试图习惯使用ViewModels和Validation.我不确定验证是在主模型还是视图模型上进行,我认为它是在ViewModel上.但是,如果我试图继承一个类属性,那么在ViewModel上添加验证似乎没有意义,所以我把它留在了模型本身,但错误没有显示出来.也许这些模型效率低下,需要重新安排一下?

NameModel

 public class name {
      [StringLength(50, ErrorMessage = "The {0} must be at least {2} characters long.", MinimumLength = 3)]
      public string first { get; set; }
      public string middle  { get; set; }
      [StringLength(50, ErrorMessage = "The {0} must be at least {2} characters long.", MinimumLength = 3)]
      public string last  { get; set; }
      public string otherstuffnotneededontheview { get; set; }
 }
Run Code Online (Sandbox Code Playgroud)

RegisterViewModel

 public class RegisterViewModel {
     public name fname { get; set; }
     public name lname …
Run Code Online (Sandbox Code Playgroud)

c# asp.net-mvc

0
推荐指数
1
解决办法
419
查看次数

BUGBUG在minwindef.h中的含义是什么?

在minwindef.h中找到了这个:

typedef WORD                ATOM;   //BUGBUG - might want to remove this from minwin
Run Code Online (Sandbox Code Playgroud)

我知道ATOM是什么......但是什么是"BUGBUG?" 这是在8.1 SDK中,具体为:

\ Program Files(x86)\ Windows Kits\8.1\Include\shared\minwindef.h

winapi visual-c++

0
推荐指数
1
解决办法
680
查看次数

为什么 GetComputerNameEx 返回一个带有奇怪编码的字符串?

我正在尝试创建一个返回计算机名称的函数。这是我到目前为止:

char* getName()
{
    char buffer[MAX_COMPUTERNAME_LENGTH + 1];
    DWORD length = sizeof(buffer);

    GetComputerNameEx((COMPUTER_NAME_FORMAT)0, buffer, &length);

    return buffer;
}
Run Code Online (Sandbox Code Playgroud)

但它并没有真正起作用。似乎它返回一个带有非常奇怪的字符编码的字符串。我将不胜感激所有帮助。

c++ winapi

0
推荐指数
1
解决办法
2987
查看次数

Acumatica - 将附加按钮添加到操作下拉到屏幕 CT30100

我正在尝试在 Acumatica ERP 屏幕 CT301000 操作下拉菜单中添加一个按钮,我已将按钮添加到图表中并修改了 aspx 以在其中包含以下内容PXDatasource=>CallbackCommands

px:PXDSCallbackCommand Name="TerminateRevenue" Visible="false" CommitChanges="True"
Run Code Online (Sandbox Code Playgroud)

但是我不确定如何将按钮添加到 Actions 集合中。有没有人有任何想法?提前致谢。

erp acumatica

0
推荐指数
1
解决办法
1522
查看次数

C指针赋值行为

temp2,temp1是一些结构x的指针:

struct FunkyStruct x;
struct FunkyStruct *temp1 = &x, *temp2 = &x;
Run Code Online (Sandbox Code Playgroud)

现在,在执行以下行之后:

temp2=temp1;
temp1=temp1->nxt;
Run Code Online (Sandbox Code Playgroud)

...将temp2temp1仍指向同一个内存位置?如果没有,请解释为什么它们会有所不同.

c memory pointers

-1
推荐指数
2
解决办法
2453
查看次数

如果之前没有调用另一个方法,如何防止调用该方法

我现在和C#一起工作了三天,请原谅我的无聊问题.

我正在尝试构建一个自己的数据库类,其中包含sendig select-statements的方法.

如何connect()在对象之前未调用时阻止调用此方法?我想到了一个简单的布尔变量,但在我看来,这是一个非常难看的解决方案.

c#

-1
推荐指数
1
解决办法
356
查看次数

如何过滤字符串列表,创建仅包含符合我标准的列表?

在我的应用程序中,我希望程序搜索列表,测试每个列表元素.如果list元素是所需的长度,那么我希望将其插入到新列表中.以下是我已经编写的代码

List<string> foo = new List<string>();
List<string> newFoo = new List<string>();

for (int h = 0; h < l; h++);
{
    // Here I want to search through every element of foo and if the element
    // length is greater than say 5 i want to add it to the newFoo 
}
Run Code Online (Sandbox Code Playgroud)

我不知道如何搜索每个元素和我可以找到的任何示例使用LINQ我不想做,因为我确信有一个更简单的方法.任何帮助非常感谢.

c# string list

-1
推荐指数
1
解决办法
1119
查看次数

如何用变量值替换链接的href属性的一部分?

我有以下代码,使用jQuery编写:

var strval = '22'
$("#quicknote").attr("href", 
  "javascript:location.href=/'http://site.com/notes/add?projects=/'+ strval")
Run Code Online (Sandbox Code Playgroud)

这导致以下属性:

<a href="javascript:location.href='http://site.com/notes/add?projects='+'strval'"
   id="quicknote">
Run Code Online (Sandbox Code Playgroud)

但是,我想要的是:

<a href="javascript:location.href='http://site.com/notes/add?projects='+'22'"
   id="quicknote">
Run Code Online (Sandbox Code Playgroud)

任何jQuery向导都知道如何实现这个结果?

javascript jquery dom

-2
推荐指数
1
解决办法
980
查看次数

如何使用 grep 提取目录和子目录中所有文件中包含的所有 IP 地址?

我有一个充满文本文件的目录层次结构,其中包含(除其他外)IP 地址。我想构建此目录和所有子目录中所有文件引用的所有地址的列表。

使用正则表达式应该很容易识别这些地址,但我不确定如何构造命令以扫描所有文件。所以...

我该如何grep建立这样一个列表?

regex linux grep

-2
推荐指数
1
解决办法
9133
查看次数

C#define中的常量公式是否会影响效率?

我正在阅读一些内核源代码,cpufreq_governor.h并看到了这个:

/*
 * The polling frequency depends on the capability of the processor. Default
 * polling frequency is 1000 times the transition latency of the processor. The
 * governor will work on any processor with transition latency <= 10ms, using
 * appropriate sampling rate.
 *
 * For CPUs with transition latency > 10ms (mostly drivers with CPUFREQ_ETERNAL)
 * this governor will not work. All times here are in us (micro seconds).
 */
#define MIN_SAMPLING_RATE_RATIO         (2)
#define LATENCY_MULTIPLIER          (1000) …
Run Code Online (Sandbox Code Playgroud)

c c-preprocessor

-2
推荐指数
1
解决办法
90
查看次数

标签 统计

c# ×3

c ×2

winapi ×2

acumatica ×1

asp.net-mvc ×1

c++ ×1

c-preprocessor ×1

dom ×1

erp ×1

grep ×1

javascript ×1

jquery ×1

linux ×1

list ×1

memory ×1

pointers ×1

regex ×1

string ×1

visual-c++ ×1