小编Chl*_*loe的帖子

尝试在VBA中发出HTTP请求时,"方法无效,没有合适的对象"错误?

我试着效仿这个例子:http://libkod.info/officexml-CHP-9-SECT-5.shtml - Archive.org - 捐赠

但它给出了这个错误

Imgur

在这条线上:

Dim objHTTP As New MSXML2.XMLHTTP
Run Code Online (Sandbox Code Playgroud)

我尝试使用此示例:如何使用VBA从Excel向服务器发送HTTP POST请求?

但它给出了这个错误:

Imgur

在这条线上:

Print objHTTP.Status
Run Code Online (Sandbox Code Playgroud)

那么如何在VBA中进行POST REST调用?如何在VBA中进行PUT多部分/表单数据文件上载REST调用?

工具>参考

Imgur

Sub SendEmail()
    'Dim objHTTP As New MSXML2.XMLHTTP
    'Set objhttp = CreateObject("WinHttp.WinHttpRequest.5.1")
    Set objHTTP = CreateObject("MSXML2.ServerXMLHTTP")
    URL = "http://localhost:8888/rest/mail/send"
    objHTTP.Open "POST", URL, False
    objHTTP.send ("{""key"":null,""from"":""me@me.com"",""to"":null,""cc"":null,""bcc"":null,""date"":null,""subject"":""My Subject"",""body"":null,""attachments"":null}")
    Print objHTTP.Status
    Print objHTTP.ResponseText

End Sub
Run Code Online (Sandbox Code Playgroud)

参考

WinHttpRequest对象:http://msdn.microsoft.com/en-us/library/windows/desktop/aa384106( v = vs.85).aspx

rest excel vba excel-vba

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

Yii2:未找到(#404):无法找到标记为'5578effb0790c4.13707485'的调试数据

我在页面底部得到这个,调试栏应该在那里.问题是什么?

此请求:http://localhost:81/xxx/web/debug/default/toolbar?tag=5578f180963e82.28312577返回404.

我需要查看登录时生成的错误消息和堆栈跟踪Yii::error().它没有显示runtime/log/app.log,所以我需要调试栏.

php yii2

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

Maven + Spring Boot:在类路径上发现多次出现的org.json.JSONObject:

当我跑步时,mvn test我得到这个警告.我该如何解决?

Found multiple occurrences of org.json.JSONObject on the class path:

        jar:file:/C:/Users/Chloe/.m2/repository/org/json/json/20140107/json-20140107.jar!/org/json/JSONObject.class
        jar:file:/C:/Users/Chloe/.m2/repository/com/vaadin/external/google/android-json/0.0.20131108.vaadin1/android-json-0.0.20131108.vaadin1.jar!/org/json/JSONObject.class

You may wish to exclude one of them to ensure predictable runtime behavior
Run Code Online (Sandbox Code Playgroud)

这是我的pom.xml.对JSON的唯一引用是

    <!-- https://mvnrepository.com/artifact/org.json/json -->
    <dependency>
        <groupId>org.json</groupId>
        <artifactId>json</artifactId>
    </dependency>
Run Code Online (Sandbox Code Playgroud)

Apache Maven 3.5.3

java spring maven build-dependencies spring-boot

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

配置WEBrick以在Rails 4中使用SSL

我有一个Rails应用程序,我想在SharePoint 2013上部署.

为了实现某种身份验证方法,我需要WEBrick server提供服务ssl https并收听传入的https port https://localhost:3001.不幸的是,我在配置服务器方面不是很有经验.

我只找到了一些旧版Rails版本的过时教程,似乎不再适合这项工作了.

任何提示都非常感谢.

ssl ruby-on-rails localhost webrick ruby-on-rails-4

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

如何将Devise和ActiveAdmin用于相同的用户模型?

我有ActiveAdmin和Devise与用户合作.我想使用Devise登录具有相同用户模型的常规非管理员用户.我怎样才能做到这一点?(我想admin在User模型中只为管理员设置一个标志.)我尝试将第二行添加到routes.rb

devise_for :users, ActiveAdmin::Devise.config
devise_for :users
Run Code Online (Sandbox Code Playgroud)

但是当我试图列出路线时它出错了

>rake routes
DL is deprecated, please use Fiddle
rake aborted!
ArgumentError: Invalid route name, already in use: 'new_user_session'
You may have defined two routes with the same name using the `:as` option, or you may be overriding a route already defined by a resource with the same naming. For the latter, you can restrict the routes created with `resources` as explained here:
http://guides.rubyonrails.org/routing.html#restricting-the-routes-created
Run Code Online (Sandbox Code Playgroud)

我已经创建了一个授权适配器,它只是检查user.admin == true并且对ActiveAdmin运行正常.https://github.com/activeadmin/activeadmin/blob/master/docs/13-authorization-adapter.md

ruby-on-rails devise activeadmin ruby-on-rails-4

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

如何渲染部分字符串?

如何将部分字符串呈现为字符串,以便将其作为JSON响应的一部分包含在内?我必须将它放入JSON响应中,以便为可能的错误消息留出空间.以下代码给出了500服务器错误.如果我只使用平原render,那么令人惊讶的是它有效.好吧,它只返回纯HTML,无法解析为Javascript.

respond_to do |format|
   format.html { redirect_to post_path(post) }
   format.js { 
     { 
       error: "",
       content: (render_to_string partial: '/comments/comment', locals: {comment: comment}, layout: false )  
     } 
   }
end
Run Code Online (Sandbox Code Playgroud)

错误

缺少模板缺少模板注释/创建,应用程序/创建{:locale => [:en],:formats => [:js,:html],:handlers => [:erb,:builder,:raw,: ruby,:jbuilder,:haml]}.搜索:*"C:/ Users/Chloe/workspace/project/app/views"

工作,但发回纯HTML

render partial: '/comments/comment', locals: {comment: comment}, layout: false
Run Code Online (Sandbox Code Playgroud)

json ruby-on-rails ruby-on-rails-4

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

无法加载此类文件 - 1.9/bcrypt_ext(LoadError)

嘿,当我尝试启动rails服务器时,我得到以下错误

有任何想法吗?目前还没有可行的解决方案......

顺便说一句,我运行Windows 8 ......可能是问题所在:D

C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport-3.2.11/lib/active_support/dependencies.rb:251:in `require': cannot load such file -- 1.9/bcry
pt_ext (LoadError)
    from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport-3.2.11/lib/active_support/dependencies.rb:251:in `block in require'
    from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport-3.2.11/lib/active_support/dependencies.rb:236:in `load_dependency'
    from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport-3.2.11/lib/active_support/dependencies.rb:251:in `require'
    from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/bcrypt-ruby-3.1.0-x86-mingw32/lib/bcrypt_ext.rb:2:in `<top (required)>'
    from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport-3.2.11/lib/active_support/dependencies.rb:251:in `require'
    from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport-3.2.11/lib/active_support/dependencies.rb:251:in `block in require'
    from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport-3.2.11/lib/active_support/dependencies.rb:236:in `load_dependency'
    from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport-3.2.11/lib/active_support/dependencies.rb:251:in `require'
    from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/bcrypt-ruby-3.1.0-x86-mingw32/lib/bcrypt.rb:12:in `<top (required)>'
    from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/bundler-1.3.4/lib/bundler/runtime.rb:72:in `require'
    from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/bundler-1.3.4/lib/bundler/runtime.rb:72:in `block (2 levels) in require'
    from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/bundler-1.3.4/lib/bundler/runtime.rb:70:in `each'
    from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/bundler-1.3.4/lib/bundler/runtime.rb:70:in `block in require'
    from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/bundler-1.3.4/lib/bundler/runtime.rb:59:in `each'
    from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/bundler-1.3.4/lib/bundler/runtime.rb:59:in `require'
    from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/bundler-1.3.4/lib/bundler.rb:132:in `require'
    from C:/Users/Enno/RubymineProjects/BookWriting2.0/config/application.rb:13:in `<top (required)>'
    from …
Run Code Online (Sandbox Code Playgroud)

ruby activerecord ruby-on-rails bcrypt devise

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

LoadError:无法在Windows 2008 x64服​​务器上加载此类文件--bcrypt_ext

我将我的环境从Ruby 2.0.0升级到2.2.3.

我还升级(覆盖)DevKit,并重新运行ruby dk.rb install.

我删除了Gemfile.lock并运行bundle install以开始全新的环境.一切看起来都不错,但我收到错误:

E:\Projects\development\Stairs>rake db:migrate 
rake aborted!
LoadError: cannot load such file -- bcrypt_ext
E:/Projects/development/Stairs/config/application.rb:7:in `<top (required)>'
E:/Projects/development/Stairs/Rakefile:4:in `<top (required)>'
LoadError: cannot load such file -- 2.2/bcrypt_ext
E:/Projects/development/Stairs/config/application.rb:7:in `<top (required)>'
E:/Projects/development/Stairs/Rakefile:4:in `<top (required)>'
(See full trace by running task with --trace)
Run Code Online (Sandbox Code Playgroud)

我第一次遇到与Nokogiri相同的问题,我使用这个解决方案解决了:Nokogiri 使用Juloi Elixir的解决方案加载错误并从本地副本安装Nokogiri.

但我不想做这个foreach宝石!看起来ruby正在使用./或./2.2路径搜索gem,而gem则存储在./2.2.0路径中.这是可配置的吗?我该如何解决这个问题?

Note: Gemfile contains gem 'bcrypt', '~> 3.1.10'
Run Code Online (Sandbox Code Playgroud)

谢谢!

windows rubygems ruby-on-rails

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

为什么 Eclipse 以红色突出显示我的代码,我该如何关闭它?

为什么 Eclipse 以红色突出显示我的代码,我该如何关闭它?

在此处输入图片说明

版本:光子发布(4.8.0)

eclipse

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

在javascript中选择文本

你如何突出JavaScript中的文字?我试过http://jsfiddle.net/WdeTM/,但它不起作用.

<span id="foo" >bar</span>
document.getElementById("foo").focus();
Run Code Online (Sandbox Code Playgroud)

javascript highlight selection

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