小编Sen*_*ncy的帖子

从typescript中的超类调用重写方法

当我从超类构造函数调用重写方法时,我无法正确获取子类属性的值.

class A
{
    constructor()
    {
        this.MyvirtualMethod();
    }

    protected MyvirtualMethod(): void
    {

    }
}

class B extends A
{
    private testString: string = "Test String";

    public MyvirtualMethod(): void
    {
        alert(this.testString); // This becomes undefined
    }
}
Run Code Online (Sandbox Code Playgroud)

我想知道如何正确覆盖typescript中的函数.

oop typescript typescript1.4

48
推荐指数
3
解决办法
8万
查看次数

ANSI-C中的静态意味着什么

可能重复:
C程序中"静态"是什么意思?

static关键字在C 中的含义是什么?

我正在使用ANSI-C.我在几个代码示例中看到,它们static在变量前面和函数前面使用关键字.使用变量的目的是什么?使用函数的目的是什么?

c static keyword ansi-c

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

Paypal针对移动网络的自适应支付

我正在为移动网站集成Paypal自适应支付API.但是当我提交付款时

https://www.paypal.com/webscr?cmd=_ap-payment&paykey=value

(对于Sandbox:https://www.sandbox.paypal.com/cgi-bin/webscr)

它总是重定向到Paypal主网站.不要Paypal移动网站.如何将客户端重定向到paypal移动网络?

paypal mobile-website paypal-adaptive-payments

20
推荐指数
2
解决办法
4855
查看次数

使用Javascript验证Windows身份验证

我必须将我的客户从一个网站转移到另一个网站.这发生在客户端.在这第二个网站上,它使用windows基本认证系统.所以它会弹出登录窗口.我需要省略这个弹出窗口并使用javascript在第二个网站上验证我的客户端,然后将他重定向到第二个网站.即使我将凭据放在javascript文件中也没有安全问题,因为整个系统在Intranet中运行.那么如何在第二个网站上验证客户端?

我发现这个线程 如何使用jQuery将Windows身份验证传递给webservice?

但它不起作用.当我查看第二个URL的请求标头时,它不包含Authorization标签.

javascript client-side-scripting windows-authentication basic-authentication single-sign-on

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

将ExpandoObject强制转换为匿名类型

我可以将ExpandoObject强制转换为匿名类型吗?

var anoObj = new { name = "testName", email = "testEmail" };

dynamic expandoObj = new System.Dynamic.ExpandoObject();

// Here I'm populating the expandoObj with same property names/types in anonymoustype(anoObj)

// Now, how to convert this ExpandoObject to anonymoustype ?

var newObj = (typeof(anoObj)expandoObj); // This doesn't work
Run Code Online (Sandbox Code Playgroud)

稍后添加

//这是我的实体

public class Customer
    {
        #region Public Properties

        [ColumnAttribute(Name = "IdColumn")]
        public string Id { get; set; }

        [ColumnAttribute(Name = "NameColumn")]
        public string Name { get; set; }

        [ColumnAttribute(Name = "AddressColumn")] …
Run Code Online (Sandbox Code Playgroud)

c# generics anonymous-types expandoobject

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

我的SQL动态查询执行并获取存储过程中的变量

我在My sql Stored过程中生成一个动态查询.我想把这个查询的结果变成一个out参数.这该怎么做 ?

CREATE PROCEDURE 'searchInvoice'
(
  OUT numOfRecords INT
)
BEGIN
  DECLARE query1 TEXT; 
  DECLARE query2 TEXT; 

 SET query1 = 'SELECT COUNT(*) bla bla bla.....'; 
 // Query1 to select the count of matching tuples..

 SET query2 = 'SELECT * from bla bla bla....';
 // Query2 to select original records...

 // later part of this both queries generate dynamically according to some IN parameters..

 // now I wanna assign the output of the query1 into numOfRecords 
 // and I …
Run Code Online (Sandbox Code Playgroud)

mysql sql stored-procedures dynamic-queries

8
推荐指数
1
解决办法
4万
查看次数

使用JavaScriptSerializer将实体映射到JSON

我的实体是这样的:

class Address
{
     public string Number { get; set; }
     public string Street { get; set; }
     public string City { get; set; }
     public string Country { get; set; }
}

class Person
{
     public string Name { get; set; }
     public int Age { get; set; }
     public Address PostalAddress { get; set; }
}

Person newPerson = 
    new Person()
    {
       Name = "Kushan",
       Age = 25,
       PostalAddress = 
           new Address()
           {
               Number = "No 25",
               Street …
Run Code Online (Sandbox Code Playgroud)

.net c# asp.net jquery json

8
推荐指数
2
解决办法
3683
查看次数

将键击发送到程序,即使它在后台使用c#

我想将关键笔划发送到程序,即使它在后台运行.但我只能这样做NOTEPAD,

[DllImport("user32.dll")]
protected static extern byte VkKeyScan(char ch);

[DllImport("user32.dll", SetLastError = true)]
protected static extern IntPtr FindWindowEx(IntPtr hwndParent, IntPtr hwndChildAfter, string lpszClass, string lpszWindow);

[DllImport("User32.Dll", EntryPoint = "PostMessageA")]
protected static extern bool PostMessage(IntPtr hWnd, uint msg, int wParam, int lParam);
Run Code Online (Sandbox Code Playgroud)
char Key = // key value to send

IntPtr hWnd = FindWindowEx(_handle, IntPtr.Zero, "edit", null);   // _handle is the windows handle of the program (here its notepad)
PostMessage(hWnd, WM_KEYDOWN, VkKeyScan(Key), 0);
Run Code Online (Sandbox Code Playgroud)

但对于所有其他应用程序,我不能发送按键,如果它在后台.因为我不知道lpszClass那个程序(我认为这是该程序中输入区域的userControl名称.对于NotePad来说,它是"edit".我发现这个上网).

对于所有其他应用程序我正在做的是,将应用程序放到前台,然后发送密钥,然后再次获取我的程序前台.我需要我的程序始终作为前台运行.

[DllImport("USER32.DLL")]
public static …
Run Code Online (Sandbox Code Playgroud)

c# winapi desktop-application winforms keystrokes

5
推荐指数
1
解决办法
5035
查看次数

将NULL值传递给LINQ中的DateTime字段

我的数据库表是这样的

CREATE TABLE MYBUDGET.tbl_CurrentProperty
(
    [PropID]            INT             NOT NULL  IDENTITY(1,1),
    [UpdatedOn]         DATETIME        NOT NULL,
    [Amount]            MONEY           NOT NULL,
    [Remarks]           VARCHAR(100)    NOT NULL,
)
ALTER TABLE MYBUDGET.tbl_CurrentProperty ADD CONSTRAINT PK_CurrentProperty_PropID PRIMARY KEY ([PropID])
ALTER TABLE MYBUDGET.tbl_CurrentProperty ADD CONSTRAINT DF_CurrentProperty_UpdatedOn DEFAULT (DATEADD(MINUTE,30,DATEADD(HOUR, 5, GETUTCDATE()))) FOR [UpdatedOn]
ALTER TABLE MYBUDGET.tbl_CurrentProperty ADD CONSTRAINT CK_CurrentProperty_Amount CHECK([Amount] > -1)
GO
Run Code Online (Sandbox Code Playgroud)

我正在使用LINQ to SQL.在C#中,我只需要传递[Amount]和[Remarks]字段,其他字段必须使用其默认值([PropID]和[UpdatedOn]).

在C#中我创建了如下的tbl_CurrentProperties对象,

tbl_CurrentProperties currentProperties = new tbl_CurrentProperties();
currentProperties.Amount = 50.00M;
currentProperties.Remarks = "remarks";
Run Code Online (Sandbox Code Playgroud)

然后将对象提交到数据上下文.但在这里,Linq分配'1/1/0001 12:00:00 AM'了UpdatedOn字段.但这违反了SQL日期时间范围1/1/1753 12:00:00 AM and 12/31/9999 11:59:59 …

c# sql datetime linq-to-sql default-constraint

5
推荐指数
1
解决办法
3776
查看次数

Inconsistent behaviour in Dictionary/IDictionary

Take the following piece of code

        var dictionary = new Dictionary<string, int>
        {
            ["A"] = 1,
            ["B"] = 2,
            ["C"] = 3,
        };

        var dictionaryx = (IDictionary)dictionary;

        var x = dictionaryx["X"]; // return null
        var y = dictionary["Y"];  // throws KeyNotFoundException
Run Code Online (Sandbox Code Playgroud)

It is interesting to see the element access through the indexer leads to two different behaviours in x and y. As in general, interfaces should give access to the same internal implementation. but in this case, it is …

.net c# dictionary

4
推荐指数
1
解决办法
85
查看次数