小编cra*_*aig的帖子

Authlogic OpenID集成

我在使用Authlogic进行OpenId身份验证时遇到了困难.似乎问题出现在open_id_authentication插件的更改中.从我到目前为止所读到的,人们需要从使用宝石切换到使用插件.

以下是我为使Authlogic-OpenID集成工作所做的工作:

  1. 删除了相关的宝石:
    • authlogic
    • authlogic-OID
    • 机架的OpenID
    • ruby-openid*
    • 安装,配置并启动了authlogic示例应用程序(http://github.com/binarylogic/authlogic_example)--works如预期.这需要:
    • 安装authlogic(2.1.3)gem($ sudo gem install authlogic)
    • 将依赖项(config.gem"authlogic")添加到environment.rb文件中.
    • 添加迁移以向User模型添加open-id支持; 跑迁; 列按预期添加
    • 对UsersController和UserSessionsController进行了更改,以使用块来保存每个.
    • 对新的用户会话视图进行了更改以支持open id(f.text_field:openid_identifier)
    • 安装open_id_authentication插件($ script/plugin install git://github.com/rails/open_id_authentication.git)
    • 安装了authlogic-oid插件($ script/plugin install git://github.com/binarylogic/authlogic_openid.git)
    • 安装了插件($ script/plugin install git://github.com/glebm/ruby-openid.git)
    • 重启mongrel(CTRL-C; $ script/server)

Mogrel未能启动,返回以下错误:

/Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `gem_original_require': no such file to load -- rack/openid (MissingSourceFile)
    from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `require'
    from /Users/craibuc/NetBeansProjects/authlogic_example/vendor/rails/activesupport/lib/active_support/dependencies.rb:156:in `require'
    from /Users/craibuc/NetBeansProjects/authlogic_example/vendor/rails/activesupport/lib/active_support/dependencies.rb:521:in `new_constants_in'
    from /Users/craibuc/NetBeansProjects/authlogic_example/vendor/rails/activesupport/lib/active_support/dependencies.rb:156:in `require'
    from /Users/craibuc/NetBeansProjects/authlogic_example/vendor/plugins/open_id_authentication/lib/open_id_authentication.rb:3
    from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
    from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `require'
    from /Users/craibuc/NetBeansProjects/authlogic_example/vendor/rails/activesupport/lib/active_support/dependencies.rb:156:in `require'
    from /Users/craibuc/NetBeansProjects/authlogic_example/vendor/rails/activesupport/lib/active_support/dependencies.rb:521:in `new_constants_in'
    from /Users/craibuc/NetBeansProjects/authlogic_example/vendor/rails/activesupport/lib/active_support/dependencies.rb:156:in `require'
    from /Users/craibuc/NetBeansProjects/authlogic_example/vendor/plugins/open_id_authentication/init.rb:5:in `evaluate_init_rb' …
Run Code Online (Sandbox Code Playgroud)

openid ruby-on-rails authlogic

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

在OS X Lion上安装Java EE 6

我的OS X Lion工作站上的Java Preferences应用程序表明我安装了Java SE 6 v1.6.0_29-b11-402(32位和64位版本).不幸的是,我只需要在企业版中提供其他功能.

'Jesper'在' 如何在Mac OS X上安装特定的jdk?'建议我需要使用Apple提供的Java,而不是Oracle/Sun提供的Java.不幸的是,Apple似乎没有提供Java 6企业版.

这让我提出了一些问题:

  1. 我错过了什么?Apple是否提供Java 6的EE?
  2. 如果1为真,我怎么得到它?可以与Java SE 6"并排"安装吗?
  3. 如果1为假,可以使用Oracle/Sun版本吗?是否有推荐的安装位置?我猜不推荐使用/System/Library/Frameworks/JavaVM.framework/Versions/文件夹.
  4. Oracle/Sun版本似乎包含了许多我不想安装的附加内容(例如Glassfish).我可以安装没有附加功能的核心SDK吗?Tomcat 7是否可以作为Glassfish的替代品?

**编辑**

这个问题是我发布的另一个问题的结果:RESTful Web服务:java.lang.NullPointerException service.AbstractFacade.findAll.似乎这个特殊错误是缺少注释的结果(@Stateless).此注释在javax.ejb.*命名空间中"包含",该命名空间包含在我的工作站上不存在的.JAR文件中.

这使我得出结论,我需要Java 6的"企业版"(它将缺少.JAR文件和其他相关文件).我想如果有办法确定缺少哪个.JAR文件(Netbeans 7似乎没有帮助)我可能只是将它添加到项目中并跳过EE麻烦.

java macos java-ee osx-lion

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

动态选择要在SELECT语句中使用的列

我希望能够使用系统表(在本例中为Oracle)来驱动SELECT语句中使用的字段.就像是:

SELECT 
(
select  column_name
from    all_tab_cols
where   table_Name='CLARITY_SER'
AND     OWNER='CLARITY'
AND     data_type='DATE'
) 
FROM CLARITY_SER
Run Code Online (Sandbox Code Playgroud)

此语法不起作用,因为子查询返回多行,而不是一行包含多列.

是否可以通过查询表架构信息来动态生成SQL语句,以便只选择某些列?

**编辑**如果可能,不使用功能或程序执行此操作.

sql oracle subquery oracle10g

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

AppleScript中的Ruby样式字符串插值

有没有办法在AppleScript中实现Ruby风格的字符串插值?我需要一种灵活的方法来创建字符串模式.

红宝石:

fn = "john"
=> "john"

ln = "doe"
=> "doe"

addresses = []
=> []

addresses << "#{fn[0]}#{ln}@company.com"
=> ["jdoe@company.com"]

addresses << "#{fn}.#{ln}@company.com"
=> ["jdoe@company.com", "john.doe@company.com"]
Run Code Online (Sandbox Code Playgroud)

AppleScript的:

set fn to "john"
set ln to "doe"

set theAddresses to {}

# jdoe@company.com
copy [something here] & "@company.com" to the end of theAddresses
Run Code Online (Sandbox Code Playgroud)

ruby applescript

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

使用Faker gem生成相关的城市,邮政编码,国家/地区代码值

有没有办法让Faker gem生成"相关的"城市和国家代码值?

例如,

  • 温哥华,CA
  • 明尼苏达州明尼阿波利斯市

我这样做:

FactoryGirl.define do
  factory :location do
    ...
    city {Faker::Address.city}
    country_code {['US', 'CA'].sample}
    ...
  end
end
Run Code Online (Sandbox Code Playgroud)

但是不能保证city意志实际存在country_code.

我会满足于:

postal_code {Faker::Address.postcode(['US', 'CA'].sample) }
Run Code Online (Sandbox Code Playgroud)

然后我可以进行地理编码以获得其他值.

ruby ruby-on-rails faker

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

方法'文档'

记录方法用法的objective-c语法是什么?这是在.h或.m文件中完成的吗?

在C#中,使用类似于:

/// <summary>
/// Executes an HTTP GET command and retrieves the information.     
/// </summary>
/// <param name="url">The URL to perform the GET operation</param>
/// <param name="userName">The username to use with the request</param>
/// <param name="password">The password to use with the request</param>
/// <returns>The response of the request, or null if we got 404 or nothing.</returns>
protected string ExecuteGetCommand(string url, string userName, string password) {
...
}
Run Code Online (Sandbox Code Playgroud)

这是用#pragma指令完成的吗?

谢谢,

克雷格布坎南

objective-c

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

无法将JAX-RS服务连接到MVC模板

我正在尝试使用JAX-RS'(Jersey)MVC模式.尝试访问http:// localhost:8080/myproject/foos/test会导致错误,内容如下:

java.io.IOException: The template name, /view, could not be resolved to a fully qualified template name
Run Code Online (Sandbox Code Playgroud)

http:// localhost:8080/myproject/foos导致相同的错误.

我错过了什么?

资源:

package resources;

import com.sun.jersey.api.view.Viewable;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;

@Path("foos")
public class FooResource {

    @GET
    @Produces(MediaType.TEXT_HTML)
    public Viewable get() {

        return new Viewable("/index", this);

    }   

    @GET
    @Path("{id}")
    @Produces(MediaType.TEXT_HTML)
    public Viewable get(@PathParam("id") String id) {

        return new Viewable("/view", id);

    } 

}
Run Code Online (Sandbox Code Playgroud)

浏览次数:

WEB-INF/jsp/resources/FooResource

  • 的index.jsp
  • view.jsp的

web.xml中:

<?xml version="1.0" encoding="UTF-8"?>
<web-app version="3.0" xmlns="http://java.sun.com/xml/ns/javaee" …
Run Code Online (Sandbox Code Playgroud)

model-view-controller jax-rs jersey

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

为嵌套的PowerShell模块创建清单

嵌套的PowerShell模块出现了一个小问题。

Get-Module正确标识ExportedCommands,但ModuleType列为Script,而不是Manifest

PS>get-module

ModuleType Name                      ExportedCommands
---------- ----                      ----------------
Script     Bar                       Get-Bar
Script     Foo                       Get-Foo
Run Code Online (Sandbox Code Playgroud)

目录结构:

|-Modules
  |-Foobar
    |-Foobar.psd1
    |-Bar
      |-Bar.psm1
    |-Foo
      |-Foo.psm1
Run Code Online (Sandbox Code Playgroud)

Foobar.psd1:

...
# Script module or binary module file associated with this manifest
ModuleToProcess = ''

# Modules to import as nested modules of the module specified in ModuleToProcess
NestedModules = 'Foo\Foo.psm1', 'Bar\Bar.psm1'
...
Run Code Online (Sandbox Code Playgroud)

我是否正确构造了PSD1文件?在我的情况下,我是否需要一个虚拟/空的Foobar.psm1文件(在PSD1文件中具有相应的条目)?我需要嵌套的目录结构,还是可以在父目录(Foobar)中仅包含两个PSM1文件(bar.psm1和foo.psm1)?

powershell powershell-2.0

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

Node标准https和node-fetch在提供证书时的区别

ADP 的 REST API 要求每次请求时都发送 SSL 证书和私钥。

当我使用“标准 Node.js HTTP(S) 模块”时:

require('dotenv').config()

const fs = require('fs')
const path = require('path')

const certificate_path = path.resolve('../credentials/certificate.pem')
const private_key_path = path.resolve('../credentials/private.key')

const options = {
    hostname: 'api.adp.com',
    path: '/hr/v2/workers/ABCDEFGHIJKLMNOP',
    method: 'GET',
    headers: {
        'Accept': 'application/json;masked=false',
        'Authorization': `Bearer ${process.env.ACCESS_TOKEN}`
    },
    cert: fs.readFileSync(certificate_path, "utf8"),
    key: fs.readFileSync(private_key_path, "utf8"),
};

require('https').get(options, res => {

  let data = [];

  res.on('data', chunk => {
    data.push(chunk);
  });

  res.on('end', () => {

    const workers = JSON.parse(Buffer.concat(data).toString());

    for(worker of workers.workers) {
      console.log(`Got …
Run Code Online (Sandbox Code Playgroud)

javascript client-certificates node.js node-https node-fetch

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

使用BusinessObjects存储库作为Crystal Report的数据源

我想使用BusinessObjects存储库中包含的信息作为Crystal Reports的数据源.遗憾的是,此信息不会保存在简单的表结构中 - 大多数属性都存储在加密的二进制字段中.

有很多方法可以访问BO的存储库:

  1. '传统'SDK(Java,COM,.Net)
  2. SOAP SDK(http:// [server:port]/dswsbobje/services/listServices)
  3. 查询工具(http:// [server:port]/businessobjects/enterprise [11 | 115 | 12]/adminlaunch/query /)

选项1在我的情况下不起作用,因为我想使用BO Enterprise部署报告,而不是自定义Web应用程序.

选项2可能有效,但我不确定Crystal Reports与SOAP的接口有多好,特别是因为它需要连接到第二个SOAP服务进行身份验证.

选项3不起作用,因为它返回HTML(不是XHTML)

此时我最可行的选择是重写#3以返回XML文档并创建支持的XSD.如果我这样做,我可能会在github上发布解决方案.

另一种选择是(以某种方式)在SOAP服务周围添加REST包装器.这听起来像是一项非常艰巨的任务.

有没有人做过我需要做的事情?

soap repository crystal-reports business-objects-sdk

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