小编tru*_*gnm的帖子

WP 8.1运行时代码,用于拨打电话,发送短信和发送电子邮件(不是Silverlight 8.1)

我正在编写一个应用程序,可以拨打电话,发送短信或电子邮件,就像wp 8.1中的People应用程序一样.到目前为止,我已经找到一个msdn的链接表单,其中说"适用于:Windows Phone 8和Windows Phone Silverlight 8.1".所以这里的代码:来自这个链接

using Microsoft.Phone.Tasks;

private void TextBlock_Tapped_Call(object sender, TappedRoutedEventArgs e)
{
    PhoneCallTask phoneCallTask = new PhoneCallTask();
    phoneCallTask.PhoneNumber = "2065550123";
    phoneCallTask.DisplayName = "Gage";

    phoneCallTask.Show();
}
Run Code Online (Sandbox Code Playgroud)

但是我收到了一个错误:

名称空间"Microsoft"中不存在类型或命名空间名称"Phone"(您是否缺少程序集引用?)

编辑:很抱歉有一个重复的问题,同样在这里:在Windows Phone 8.1中拨打电话 回答@Chris Shao,他还更新了代码以发送短信和电子邮件.

c# sms phone-call windows-phone windows-phone-8.1

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

无法启动Windows Phone模拟器

我已多次看到这个错误.每次我深入谷歌,最后让我重新安装我的窗户和所有的东西.请帮助,我不想再重新安装一切.错误是:

Windows Phone Emulator

Unable to start the Windows Phone Emulator

Windows Phone Emulator is unable to start because 
the hypervisor is not running. The likely cause is
that hardware-assisted virtualization is not enabled.

Check your computer's BIOS to ensure that hardware-
assisted virtualization and hardware-assisted data 
execution features are enabled.
Run Code Online (Sandbox Code Playgroud)

无法启动Windows Phone模拟器

但是昨天我使用Emulator在Windows Phone上进行了正常的调试,我确信
我已经在BIOS中启用了Virtualization,并且还打开或关闭Turn Windows功能: 打开了所有人

有时当我点击f5时,IDE会出现另一个错误:0x80131500 在此输入图像描述

我的电脑:Windows 8.1 Ultimate 64b,4gb ram,i3,Visual Studio 2013 RC3

virtualization hyper-v emulation windows-phone-8-emulator visual-studio-2013

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

用于评估的 Tensorflow 平均绝对误差 (MAE)

查看 MAE 的 tensorflow 文档,我看到tf.metrics.mean_absolute_error将返回:

  • mean_absolute_error:代表当前平均值的张量,总数除以计数的值。
  • update_op:适当增加总数和计数变量的操作,其值与 mean_absolute_error 匹配。

如何实现这一评估目的?如前所述这里

mean_absolute_error 用于评估,因此它没有梯度。mean_absolute_error 还返回一个必须用于更新均值的更新操作(您在上面的代码中忽略了该操作),因此此函数的梯度概念实际上没有意义。在获得平均值之前,必须调用 tf.metrics.mean_absolute_error(pred, y) 的更新操作。

我不知道如何处理mean_absolute_error函数的返回值。有人可以用这个函数写一个简单的例子吗?非常感谢。

python machine-learning tensorflow

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

InstanceVariableAssumption:UsersController 为实例变量“@user”假设太多

我正在关注 Michael Hartl 教程 Rails 课程。在第 7 章,我在 UsersController 上运行 Reek 并收到以下警告:

app/controllers/users_controller.rb - 1 条警告:
1 :InstanceVariableAssumption:UsersController 对实例变量“@user”[ https://github.com/troessner/reek/blob/master/docs/Instance-Variable-假设太多假设.md]

这是我的代码:

class UsersController < ApplicationController
  def new
    @user = User.new
  end

  def create
    @user = User.new user_params
    if @user.save
      flash[:success] = t "welcome_to_app"
      redirect_to @user
    else
      render "new"
    end
  end

  def show
    @user = User.find_by id: params[:id]

    return if @user
    flash[:danger] = t "not_exist_user"
    redirect_to root_path
  end

  private

  def user_params
    params.require(:user).permit :name, :email, :password,
      :password_confirmation
  end …
Run Code Online (Sandbox Code Playgroud)

ruby ruby-on-rails reek

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

SameSite 属性中断 SAML 流程

Chrome 80 将引入一个新属性,即 SameSite。

  • 严格 - 只为“同一站点”请求附加 cookie。
  • 松散 - 为“同站点”请求发送 cookie,以及使用安全 HTTP 方法(例如(GET HEAD OPTIONS TRACE))的“跨站点”顶级导航。
  • 无 - 为所有“同一站点”和“跨站点”请求发送 cookie。

有关更多信息,这篇文章很好地解释了 SameSite。

从 Azure 文档:

云服务(服务提供商)使用 HTTP 重定向绑定将 AuthnRequest(身份验证请求)元素传递给 Azure AD(身份提供商)。然后,Azure AD 使用 HTTP 发布绑定将 Response 元素发布到云服务

我的问题是为什么 SameSite 会破坏 SAML 流程?“saml”同站问题

当 IdP POST 响应回 SP 时,如果 SameSite=Lax,用户代理将不会发送具有 SP 域的 cookie。即使它不发送 cookie,我也不认为 SP 有任何问题。

cookies saml shibboleth saml-2.0 spring-saml

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

命令:rails console,生成无法识别.错误:命令'rails'无法识别用法:rails命令[ARGS]

当我进入rails文件夹(我在我的rails app文件夹中)并键入"rails c"或"rails g"时,它说:

错误:无法识别命令"rails"

用法:rails COMMAND [ARGS]

Usage: spring COMMAND [ARGS]                                                                                                                     

Commands for spring itself:                                                                                                                      

  binstub         Generate spring based binstubs. Use --all to generate a binstub for all known commands. Use --remove to revert.                
  help            Print available commands.                                                                                                      
  server          Explicitly start a Spring server in the foreground                                                                             
  status          Show current status.                                                                                                           
  stop            Stop all spring processes for this project.                                                                                    

Commands for your application:                                                                                                                   

  rails           Run a rails command. The following sub commands will use spring: console, runner, generate, destroy, …
Run Code Online (Sandbox Code Playgroud)

ruby windows ubuntu ruby-on-rails

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

编写活动装饰器DRY

我正在使用ActiveDecorator:https : //github.com/amatsuda/active_decorator

在编写my时UserDecorator,我发现它有很多重叠之处。只是装饰,datetime但我不得不重复写很多装饰器。

# frozen_string_literal: true

module UserDecorator
  def created_at_datetime
    created_at&.strftime '%Y/%m/%d %H:%M:%S'
  end

  def confirmed_at_datetime
    confirmed_at&.strftime '%Y/%m/%d %H:%M:%S'
  end

  def locked_at_datetime
    locked_at&.strftime '%Y/%m/%d %H:%M:%S'
  end

  def current_sign_in_at_datetime
    current_sign_in_at&.strftime '%Y/%m/%d %H:%M:%S'
  end

  def last_sign_in_at_datetime
    last_sign_in_at&.strftime '%Y/%m/%d %H:%M:%S'
  end
end
Run Code Online (Sandbox Code Playgroud)

猜猜怎么着,我的AdminDecorator领域完全一样。我是否必须将所有这些都再次复制到AdminDecorator?有什么建议吗?

参考:https : //github.com/amatsuda/active_decorator/issues/104

ruby datetime rubygems ruby-on-rails decorator

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