小编Gre*_*g R的帖子

没有为类型为play.api.libs.json.JsObject的JsObject找到Json序列化程序

我有以下代码在引用时在控制台应用程序中工作 "org.reactivemongo" %% "play2-reactivemongo" % "0.10.5.0.akka23"

当我更新对我的引用时"org.reactivemongo" % "play2-reactivemongo_2.11" % "0.11.0.play23-M3":

没有为类型为play.api.libs.json.JsObject的JsObject找到Json序列化程序.尝试为此类型实现隐式OWrites或OFormat.

import org.joda.time.DateTime
import reactivemongo.bson.BSONObjectID
import play.modules.reactivemongo.json.BSONFormats._

case class GoogleToken
(
  id: Option[BSONObjectID],
  name: String,
  emailAddress: String,
  refreshToken: String,
  expires: DateTime
  )

object GoogleToken {

  import play.api.libs.json.Json

  // Generates Writes and Reads
  implicit val googleTokenFormat = Json.format[GoogleToken]
}
Run Code Online (Sandbox Code Playgroud)

然后

val collection = db.collectionJSONCollection

val query = Json.obj()
val cursor = collection.find(query).
  cursor[GoogleToken](ReadPreference.nearest).
  collect[List]()
Run Code Online (Sandbox Code Playgroud)

我究竟做错了什么?

json scala reactivemongo

19
推荐指数
3
解决办法
7786
查看次数

IntelliTrace和ADO.NET参数值

我正在尝试调试实体框架,我可以看到数据库调用,但不显示参数值.我尝试了很多选项,但是没能看到任何参数.可能吗?如果没有,那将是一个彻底失望.

debugging entity-framework visual-studio-2010 intellitrace

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

ASP.net MVC中的自定义表单身份验证/授权方案

我正在尝试使用表单身份验证在ASP.NET MVC中创建自定义身份验证方案.我可能在网站上有不同区域进行管理的想法 - 审批者是和一般用户区域,这些将使用不同的登录页面,依此类推.所以这就是我想要发生的事情.

  1. 用户访问受限页面(现在我用客户AuthorizeAttribute保护它)
  2. 用户被重定向到特定的登录页面(不是Web.config中的登录页面).
  3. 验证用户凭据(通过自定义数据库方案)和用户登录.

非常感谢任何帮助!

这就是我到目前为止所做的,它不起作用:

 public class AdministratorAccountController : Controller
{
    public ActionResult Login()
    {
        return View("Login");
    }

    [HttpPost]
    public ActionResult Login(AdministratorAccountModels.LoginModel model, string returnUrl)
    {
        if (ModelState.IsValid)
            if (model.UserName == "admin" && model.Password == "pass") // This will be pulled from DB etc
            {
                var ticket = new FormsAuthenticationTicket(1,               // version 
                                                           model.UserName,  // user name
                                                           DateTime.Now,    // create time
                                                           DateTime.Now.AddSeconds(30), // expire time
                                                           false,           // persistent
                                                           "");             // user data

                var strEncryptedTicket = FormsAuthentication.Encrypt(ticket);
                var …
Run Code Online (Sandbox Code Playgroud)

asp.net security asp.net-mvc authorization asp.net-mvc-2

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

在梯形上进行C#/ WPF图像转换

我有一个图像,我想在WPF中的梯形上缩放/拉伸它.这样做有简单的方法吗?我想实现3D效果/透视/弯曲.基本上拍摄2D图像并将其在3D空间中弯曲.

这就是我想要完成的事情:

original:          new:

 *  *               *  *

 *  *             *      *
Run Code Online (Sandbox Code Playgroud)

另外一点,我需要这个发生得非常快.我尝试使用此代码,但性能无法使用:http://www.vcskicks.com/image-distortion.php

任何帮助将不胜感激.非常感谢提前!

wpf image-manipulation

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

用于可调整大小的窗口的WPF滚动条

这应该是一个非常简单的任务,但由于某种原因,我在WPF中遇到了很多问题.

这就是我想要发生的事情:我在窗口中有一堆控件,包括扩展器控件.当内容扩展到可见区域下方时,我想要为该窗口设置滚动条.此外,窗口不是固定宽度,可以最大化,调整大小等.

我尝试将ScrollViewer作为窗口中的第一个元素,但它无法正常工作.如果我将高度和宽度设置为自动,则不会滚动,如果我将其设置为特定设置,则会在窗口最大化时创建一个框.

任何帮助将不胜感激!

wpf scroll scrollviewer wpf-controls

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

处理大量元素时,隐藏/显示功能的速度极慢

当我正在做$("#myDiv").show()和$("#myDiv").hide()只在Safari和Mac上的Chrome时,我遇到了糟糕的表现,包括IE6在内的所有其他浏览器都运行正常在PC和Mac上,这是一个Webkit问题.

div"myDiv"包含大量元素,包括许多复选框,JqueryUI选项卡和3个滑块.

我尝试了"addClass"而不是show/hide,我尝试将margin设置为-10000并返回0,这些事情似乎都没有帮助.有解决方法还是这些浏览器的限制?

javascript safari performance jquery google-chrome

6
推荐指数
2
解决办法
4089
查看次数

PlayFramework静态文件的nginx配置

我想将Nginx用于我的Play的服务器/资源文件夹!应用.我想要:

  • 代理大部分文件播放!
  • 将资源指向本地文件夹

我使用以下配置,但它不起作用:

worker_processes  1;

error_log  logs/error.log;

events {
    worker_connections  1024;
}

http {
    include       mime.types;
    default_type  application/octet-stream;

    upstream play_app {
        server 0.0.0.0:9000;
    }

    server {
        listen       80;

        location / {
            proxy_pass http://play_app;
        }
    }
}
Run Code Online (Sandbox Code Playgroud)

另外,如果我这样工作,我可以通过播放写入Nginx/assets文件夹Play.getFile("/assets/images")吗?

scala nginx playframework playframework-2.0

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

命令行参数不适用于sbt-assembly jar

我试图将命令行参数传递给我创建的JAR sbt-assembly.这些-Dconfig.file=application.conf都不是-Dconfig.trace=loads

我的确切命令是

java -jar googleScraper-assembly-0.0.1.jar -Dconfig.trace=loads -Dconfig.resource=application.conf

这是我的build.sbt

lazy val googleScraper = project.in(file("google-data-scraper"))
  .settings(commonSettings:_*)
  .settings(
    version := "0.0.1",
    assemblyMergeStrategy in assembly := {
      case m if m.toLowerCase.endsWith("manifest.mf") => MergeStrategy.discard
      case m if m.toLowerCase.matches("meta-inf.*\\.sf$") => MergeStrategy.discard
      case "log4j.properties" => MergeStrategy.discard
      case m if m.toLowerCase.startsWith("meta-inf/services/") => MergeStrategy.filterDistinctLines
      case "reference.conf" => MergeStrategy.concat
      case "application.conf" => MergeStrategy.concat
      case _ => MergeStrategy.first
    },
    libraryDependencies ++= Seq(
      "com.typesafe" % "config" % "1.3.0",
      "com.typesafe.play" % "play_2.11" % "2.3.9",
      "com.typesafe.play" % "play-ws_2.11" % …
Run Code Online (Sandbox Code Playgroud)

scala sbt sbt-assembly typesafe-config

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

WPF通过绑定隐藏DataGridColumn

出于某种原因,我无法隐藏WPF Toolkit的DataGridColumn.我正在尝试执行以下操作:

<dg:DataGridTemplateColumn Header="Item Description" Visibility="{Binding IsReadOnly}">
<dg:DataGridTemplateColumn.CellTemplate>
    <DataTemplate>
        <TextBox Text="{Binding Path=ItemDescription}" />
    </DataTemplate>
</dg:DataGridTemplateColumn.CellTemplate>
Run Code Online (Sandbox Code Playgroud)

这不起作用,因为它在ItemSource上寻找IsReadOnly属性(不是当前类的属性).如果将其添加为实现INoifyPropertyChanged的ItemSource类的属性,则它仍然不会隐藏该列.有没有解决的办法?当按钮单击更改IsReadOnly属性时,我希望列隐藏.

假设IsReadOnly返回Visibility值并且是依赖项属性

我完全陷入困境,我真的很感激帮助!非常感谢!

wpf binding wpfdatagrid

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

在UITableViewCell内部处理按钮

我似乎无法在自定义UITableViewCell内正确处理按钮.它是一个包含标签和按钮的单元格.我有以下代码:

var cell = tableView.DequeueReusableCell (cellKey) as ApptHistoryCell;
if (cell == null)
{
    cell = _container.Cell;
    cell.SelectionStyle = UITableViewCellSelectionStyle.None;
}

if (InfoClicked != null)
{
    cell.ActionButton.TouchUpInside += InfoClicked;
}
Run Code Online (Sandbox Code Playgroud)

InfoClicked是在创建单元格时循环传递的事件处理程序.当重新使用单元格时,这会导致空引用异常,因为(我认为)TouchUpInside正在尝试调用2个处理程序.旧的和新的,导致崩溃.如果我将事件处理程序放在cell == null if block中,则会显示错误的操作.

如何正确处理点击?

谢谢!

uitableview xamarin.ios ios

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