小编Pau*_*aul的帖子

无法使用RJB gem将应用程序部署到Heroku

我已经设置了JAVA_HOME变量

heroku config:add JAVA_HOME=/usr/lib/jvm/java-6-openjdk
Run Code Online (Sandbox Code Playgroud)

检查heroku配置是否显示带有值的变量,然后按下:

git push heroku master
Run Code Online (Sandbox Code Playgroud)

仍然得到

JAVA_HOME is not set
Run Code Online (Sandbox Code Playgroud)

Bundler正在安装RJB gem时出错.

我可以成功地将相同的源部署到另一个Heroku应用程序,并且所有环境变量都是相同的.

怎么了?

heroku java-home rjb

5
推荐指数
2
解决办法
1634
查看次数

设计 - 不要使用电子邮件

我希望 Devise 身份验证使用登录名而不是电子邮件并跳过电子邮件验证,但保留密码验证。这个怎么做?

passwords validation ruby-on-rails devise

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

不能让Devise从Angular.js注销

我通过GET注销Devise身份验证,但无法使用此Angular.js代码注销:

$scope.logout = ->
  $http.get('/users/sign_out').success ->
    #If it does not redirect from 'editor' to 'login' then you haven't actually logged out
    $location.path('editor')
Run Code Online (Sandbox Code Playgroud)

设计的注销行为似乎是随机的 - 有时它会退出,有时则不会.如果我进入/users/sign_out浏览器的地址栏,它会一直注销.

好的,我将Devise身份验证的注销切换为POST请求以消除缓存问题并使用以下Angular.js代码:

$scope.logout = ->
  $http.post('/users/sign_out').success ->
    $location.path('editor')
Run Code Online (Sandbox Code Playgroud)

第一次它一如既往地退出正常,但我无法让它退出.

我决定用自己的方法来看看会发生什么:

match '/logout' => 'api#logout', :via => :post

class ApiController < ApplicationController
  before_filter :authenticate_user!

  def logout
    sign_out
    if current_user
      puts 'Has not signed out!'
    else
      puts 'Has signed out!'
    end
    head :ok
  end
end
Run Code Online (Sandbox Code Playgroud)

和检测后sign_outcurrent_user永远是零,但随后出现奇迹的角度应用程序管理访问ApiController的其他方法,并且CURRENT_USER不无有!

我不明白这个.好吧,让我们假设在注销请求之后(或同时)可能会跟随一些其他HTTP请求,传递身份验证cookie和设计重新登录,但不应该立即过期cookie中传递的会话ID在调用sign_out方法后?!

ruby-on-rails logout devise angularjs

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

ng-repeat没有HTML元素(这次真的没有任何)

我希望得到类似的东西:

Line 1<br>
Line 2<br>
Line 3<br>
Line 4<br>
Line 5<br>
Run Code Online (Sandbox Code Playgroud)

使用ng-repeat.除了之外,所有行都应该分开<br>

html repeater angularjs

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

输入数组在 Rails 参数中转换为哈希值

我在 AJAX 请求中发送一个数组:

$.ajax(
    {
        type: "POST",
        url: "http://192.168.0.15/calc",
        data: {
            "phone": phone,
            "points": [
                { "lat": 59.15234, "lon": 30.99 },
                { "lat": 59.15244, "lon": 30.99 },
                { "lat": 59.15254, "lon": 30.99 }
            ],
            "start_at": 1407249093,
            "certificate": "849840487484"
        },
        success: function(data) {
            alert('success');
        },
        error: function(jqXHR, textStatus, errorThrown){
            console.log(jqXHR.statusCode());
            console.log(textStatus);
            console.log(errorThrown);
        }
    }
);
Run Code Online (Sandbox Code Playgroud)

然后检查点:

params[:points].inspect
Run Code Online (Sandbox Code Playgroud)

并查看哈希值:

{
  "0"=>{"lat"=>"59.15234", "lon"=>"30.99"},
  "1"=>{"lat"=>"59.15244", "lon"=>"30.99"},
  "2"=>{"lat"=>"59.15254", "lon"=>"30.99"}
}
Run Code Online (Sandbox Code Playgroud)

如何获取数组而不是哈希(最好是最初,无需将哈希转换为数组)?

ruby-on-rails parameter-passing

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

用GDI +旋转的图形看起来比原始图形大

这是我用GDI +绘制态度指标的实验.

只要我使用

image.Canvas.Draw(-25, -410-slider1.Position * 4, horizonBitmap);
Run Code Online (Sandbox Code Playgroud)

horizonBitmap是1:1转移到image.

但是,当我尝试使用GDI +旋转传输图像时,它的image大小大约是0.75倍,我必须使用

Matrix.Scale(SCALE_FACTOR, SCALE_FACTOR);
Run Code Online (Sandbox Code Playgroud)

然后SCALE_FACTOR到处分开.

我做错了什么?

horizon.bmp 是350 x 1120像素.

以下是AI单元的完整代码.

unit AIMainform;

interface

uses
  Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants,
  System.Classes, Vcl.Graphics, Vcl.Controls, Vcl.Forms, Vcl.Dialogs,
  Vcl.StdCtrls, Vcl.ComCtrls, Vcl.ExtCtrls, Winapi.GDIPOBJ, Winapi.GDIPAPI;

type
  TForm1 = class(TForm)
    procedure FormPaint(Sender: TObject);
  private
    image: TImage;
    slider1: TTrackBar;
    slider2: TTrackBar;
    slider3: TTrackBar;
    horizonGPImage: TGPImage;
    horizonBitmap: TBitmap;
    bezelBitmap: TBitmap;
    headingBitmap: TBitmap;
    wingsBitmap: TBitmap;
    PitchAngle: Double;
    RollAngle: Double;
    YawAngle: Double;
    procedure slider1_Scroll(Sender: TObject); …
Run Code Online (Sandbox Code Playgroud)

delphi scaling gdi+ rotation

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

Delphi 助手作用域

我在 Delphi 中重新声明 helper 时遇到问题。

HelperDecl.pas

unit HelperDecl;

interface

type
  TCustomField = Word;

  TCustomFieldHelper = record helper for TCustomField
  public
    procedure SampleMethod();
  end;

implementation

procedure TCustomFieldHelper.SampleMethod();
begin
end;

end.
Run Code Online (Sandbox Code Playgroud)

ScopeTest.pas

unit ScopeTest;

interface

uses HelperDecl;

type
  rec = record
    art: TCustomField;
  end;

implementation

uses System.SysUtils;

procedure DoScopeTest();
var
  a: TCustomField;
  r: rec;
begin
  a := r.art;
  r.art.SampleMethod(); //Here has the compiler no problems
  a.SampleMethod(); //Undeclared identifier 'SampleMethod'
end;

end.
Run Code Online (Sandbox Code Playgroud)

但是我只为我的本地数据类型定义了一个助手(是的,它是从 Word 派生的)!中的助手SysUtils是 的助手Word,而不是我的自定义数据类型!放开我的数据类型!

当我uses System.SysUtils; …

delphi helper delphi-xe5

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

使用 PIP 安装 SSL 软件包需要已安装 SSL 软件包

  • CentOS 7(严格要求)
  • Python 3.11(严格要求)

我必须升级一个软件,它现在需要 Python 3.11。

我按照互联网上的说明(https://linuxstans.com/how-to-install-python-centos/),现在Python 3.11已安装,但无法下载任何东西,所以所有与互联网有关的程序,包括 PIP,由于未安装 SSL 软件包而无法工作。

安装 Python 包的正常方法是使用 PIP,但它不起作用,因为我要安装的 SSL 包尚未安装。

我尝试了互联网上的所有建议,但它们都已经过时并且不再起作用,因为它们要么不适用于 3.11 版本的 Python,要么不适用于 CentOS 7。

我在运行应用程序软件时遇到的错误:

ModuleNotFoundError:没有名为“_ssl”的模块

当我尝试使用 pip 安装 ssl 时:

# pip install --trusted-host pypi.org ssl
WARNING: pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.
WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': …
Run Code Online (Sandbox Code Playgroud)

python ssl pip

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

设计身份验证.未定义的方法'authenticate_member!'

我正在尝试使用:

before_filter :authenticate_member!
before_filter :authenticate_user!

current_member
current_user
Run Code Online (Sandbox Code Playgroud)

在我的控制器中(当然不是在同一时间).找不到这些名字.我根据手册安装了Devise:https://github.com/plataformatec/devise

更改线路后重新启动服务器没有帮助.

authentication ruby-on-rails devise

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

Ruby:int32的4字节数组

从中读取4个字节TCPSocket(实际上socket返回一个字符串,然后我调用.bytes以获取一个数组).现在他们需要转换为int32 big endian.

或者可能TCPSocket有一些方法立即读取int32?

ruby arrays int32 type-conversion tcpsocket

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