小编Wil*_*ung的帖子

Scheme中的继承类

现在我研究一下Scheme的OOP部分.我可以在Scheme中定义类,如下所示:

(define (create-queue)
  (let ((mpty #t) 
        (the-list '()))

    (define (enque value)
      (set! the-list (append the-list (list value)))
      (set! mpty #f)
      the-list)

    (define (deque)
      (set! the-list (cdr the-list))
      (if (= (length the-list) 0) 
      (set! mpty #t))
      the-list)

    (define (isEmpty)
      mpty)

    (define (ptl)
      the-list)

    (define (dispatch method)
      (cond ((eq? method 'enque) enque)
        ((eq? method 'deque) deque)
        ((eq? method 'isEmpty) isEmpty)
        ((eq? method 'print) ptl)))

    dispatch))
Run Code Online (Sandbox Code Playgroud)

(来自css.freetonik.com的例子)

我可以在Scheme中实现类继承吗?

lisp inheritance scheme

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

如何使用WCF流式传输XElement/XDocument?

我有以下方法签名.我无法改变它(即我不能改变返回类型).

public Stream GetMusicInfo(string songId)
{
    XElement data = dao.GetMusicInfo(songId);

    // how do I stream the XElement?
}
Run Code Online (Sandbox Code Playgroud)

如何使用WCF流式传输XElement/XDocument?

.net c# wcf

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

使用IDispatchMessageInspector获取请求的远程地址

我正在尝试关注此博客文章:http://blogs.msdn.com/b/carlosfigueira/archive/2011/04/19/wcf-extensibility-message-inspectors.aspx

我的目标是以某种方式获取传入请求的远程地址,但由于某种原因,地址要么在任何参数中都无法看到,要么为空.

这是我正在实现的界面:

public interface IDispatchMessageInspector
{
    object AfterReceiveRequest(ref Message request, IClientChannel channel, InstanceContext instanceContext);
    void BeforeSendReply(ref Message reply, object correlationState);
}
Run Code Online (Sandbox Code Playgroud)

我正在尝试获取远程地址的方法是AfterReceiveRequest.我检查了两个参数requestchannel.此外,它似乎应该channel.RemoteAddress是它应该是,但由于某种原因该属性为空.该request参数也为null,但我猜这是因为我正在进行GET而不是POST.

下面是我正在调用以测试它的方法的签名.

[OperationContract, WebGet( UriTemplate = "{*path}", ResponseFormat = WebMessageFormat.Json)]
string[] GetList(string path);
Run Code Online (Sandbox Code Playgroud)

c# wcf idispatchmessageinspector

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

没有接口的ChannelFactory <T>

我目前正在尝试创建一个调用WCF SOAP服务的REST代理,我试图建立一个通道来发送消息.我知道我需要使用ChannelFactory,但我没有该服务的接口.我可以通过默认值吗?还有其他方法来打包邮件吗?

当我说消息时,我的意思是来自ServiceModels.Channels.Message.

我对此非常陌生,所以任何帮助都会受到赞赏.

c# wcf soap

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

使用Beta开始使用MVC4 Web Api进行开发?

我很尴尬......

在将于2012年第二季度发布的项目中开始使用MVC4 Web Api(BETA)进行开发是否安全?我听说MVC4的最终版本将在2012年第3季度发布.由于我真的相信MVC4 Web API及其功能,因此使用其他一些技术会感觉不好并且会使项目看起来很快.我还认为,使用WCF构建REST服务是朝着错误方向迈出的一步,因为它不是为此而设计的.

这里有什么建议?

api asp.net-mvc-4 asp.net-web-api

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

核心数据和REST

我正在开发一个iOS应用程序,它处理通过基于Web的REST API读取和写入的不断变化的数据.我希望在整个应用程序的生命周期中保留一些数据,但我还希望在用户退出应用程序时重置并重新加载.

我应该为此使用核心数据吗?如果没有,是否有一种简单的方法可以在整个应用程序的生命周期中持久保存数据(例如,单例类?).你们会推荐什么?使用核心数据有好处吗?如果可能的话,我想避免使用Core Data,因为设置起来很痛苦.

提前致谢

oop core-data objective-c ios

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

休息方法因查询字符串参数而异

我想创建两个基于URI中的查询字符串参数而变化的Rest方法.

喜欢

[WebGet(UriTemplate = "Guest/{guestId}?day={day}&type={type}")]
[OperationContract(Name = "GetDetailByDayAndActivity")]
public GuestDetail GetDetail(string guestId, DateTime day, string type)

[WebGet(UriTemplate = "Guest/{guestId}?day={day}")]
public GuestDetail GetDetail(string guestId, DateTime day)
Run Code Online (Sandbox Code Playgroud)

这给出了错误:

"Operation 'GetDetailByDayAndActivity' in contract 'IRestService' has a UriTemplate that expects a parameter named 'TYPE', but there is no input parameter with that name on the operation. "

访问仅具有day参数的方法时: http://testserver/GuestService/Guest/0?day=2011-10-20

怎么能实现这一目标?

.net wcf

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

如何安全地将新密码发送到服务器

我的客户端代码调用REST WCF服务来更改密码.我定义了changePassword,其中"UriTemplate"设置为"?user = {userName}&oldPwd = {oldHashPwd}&newPwd = {newEncryptPwd}"

我的问题是:如何加密客户端的新密码,以便我们可以在服务器端成功解密?请具体说明.谢谢.

security ssl wcf web-services

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

CDI 范围和生产商

有人可以解释 CDI 范围注释在生产者方面的作用吗?他们似乎没有完成任何事情。

@Produces
public Thing thingMaker() {
    System.out.println("Making thingmaker");
    return new ThingBean("thingMaker");
}

@Produces
@RequestScoped
public Thing thingMakerReq() {
    System.out.println("Making thingmakerReq");
    return new ThingBean("thingMakerReq");
}
Run Code Online (Sandbox Code Playgroud)

这些自然会在启动时给出这个(被忽略的)错误。

WELD-001409:Thing 类型的依赖关系不明确。可能的依赖关系:

  • 生产者方法 [Thing],其限定符 [@Any @Default] 声明为 [[BackedAnnotatedMethod] @Produces public pkg.test.ThingProducer.thingMaker()],
  • 生产者方法 [Thing],其限定符 [@Any @Default] 声明为 [[BackedAnnotatedMethod] @Produces @RequestScoped public pkg.test.ThingProducer.thingMakerReq()]

因此,即使 `RequestScoped 被标记为生产者方法的一部分,它们也不是限定符。

所以我只是不确定他们在生产者方法方面的作用是什么。

java cdi weld

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