相关疑难解决方法(0)

"导入"后的"静态"修饰符是什么意思?

当像这样使用时:

import static com.showboy.Myclass;

public class Anotherclass{}
Run Code Online (Sandbox Code Playgroud)

import static com.showboy.Myclass和之间有什么区别import com.showboy.Myclass

java modifier static-import

427
推荐指数
6
解决办法
14万
查看次数

Ruby中包含和扩展有什么区别?

刚刚开始关注Ruby元编程.mixin/modules总是让我困惑.

  • include:将指定模块方法中的混合作为目标类中的实例方法
  • extend:将指定的模块方法混合为目标类中的类方法

那么主要区别在于这还是潜伏着更大的龙? 例如

module ReusableModule
  def module_method
    puts "Module Method: Hi there!"
  end
end

class ClassThatIncludes
  include ReusableModule
end
class ClassThatExtends
  extend ReusableModule
end

puts "Include"
ClassThatIncludes.new.module_method       # "Module Method: Hi there!"
puts "Extend"
ClassThatExtends.module_method            # "Module Method: Hi there!"
Run Code Online (Sandbox Code Playgroud)

ruby module include extend

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

Java导入如何工作?

我想知道该import陈述是如何运作的.

我问这个是因为我的imports项目中有以下内容:

import static com.googlecode.javacv.jna.highgui.cvCreateCameraCapture;
import static com.googlecode.javacv.jna.highgui.cvGrabFrame;
import static com.googlecode.javacv.jna.highgui.cvReleaseCapture;
import com.googlecode.javacv.CanvasFrame;
import com.googlecode.javacv.FrameGrabber;
import com.colorfulwolf.webcamapplet.gui.ImagePanel;
import com.googlecode.javacv.OpenCVFrameGrabber;
import com.googlecode.javacv.jna.cxcore.IplImage;
Run Code Online (Sandbox Code Playgroud)

我的项目中没有这些软件包,那么,这将如何导入?

如果我用我的所有类创建一个JAR文件,我的服务器将托管这个JAR文件,必须是免费的Internet访问才能获得这些文件package吗?

我有一些问题,我Applet有这些进口,我问这个问题,了解是否可以成为互联网规则.

<applet code="com.colorfulwolf.webcamapplet.WebcamApplet"
archive="http://san.redenetimoveis.com/teste.jar, http://san.redenetimoveis.com/core.jar, http://san.redenetimoveis.com/javacv.jar, http://san.redenetimoveis.com/javase.jar, http://san.redenetimoveis.com/jna.jar, http://san.redenetimoveis.com/customizer.jar, http://san.redenetimoveis.com/jmf.jar, http://san.redenetimoveis.com/mediaplayer.jar, http://san.redenetimoveis.com/multiplayer.jar, http://san.redenetimoveis.com/sound.jar"
    height="550" width="550">
</applet>
Run Code Online (Sandbox Code Playgroud)

java

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

在Chicken Scheme中使用vs Import vs Require vs Require-extension

我对鸡肉(use)(import)鸡肉之间的差异有点朦胧.同样,怎么办(load),(require)又有(require-extension)什么不同?

网站上似乎没有提到这些东西.

scheme chicken-scheme

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

为什么我得到错误未初始化的常量Stuff :: HTTParty?

我的系统上有HTTParty gem,我可以在rails中使用它.

现在我想独立使用它.

我在尝试:

class Stuff
  include HTTParty
  def self.y
    HTTParty.get('http://www.google.com')
  end 
end
Stuff.y
Run Code Online (Sandbox Code Playgroud)

但我明白了

$ ruby test_httparty.rb 
test_httparty.rb:2:in `<class:Stuff>': uninitialized constant Stuff::HTTParty (NameError)
        from test_httparty.rb:1:in `<main>'
07:46:52 durrantm Castle2012 /home/durrantm/Dropnot/_/rails_apps/linker 73845718_get_method
$ 
Run Code Online (Sandbox Code Playgroud)

ruby methods gem class httparty

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

如何在Rails中为集成测试编写帮助程序?

如何编写在多个集成测试中使用的集成测试助手?我尝试了以下错误.我正在考虑创建一个基类并扩展它,但我不明白'test_helper'是如何工作的!我不能把帮助方法放在test_helper中,因为它们使用特殊的集成助手post_with_redirect.

LS

$ ls test/integration
integration_helper_test.rb  post_integration_test.rb  user_flows_test.rb
Run Code Online (Sandbox Code Playgroud)

代码,integration_helper_test.rb

class IntegrationHelperTest < ActionDispatch::IntegrationTest

  def login(user)
    ...
Run Code Online (Sandbox Code Playgroud)

代码,post_integration_test.rb

require 'test_helper'
require 'integration_helper_test'
# require 'integration/integration_helper_test'

class PostIntegrationTest < ActionDispatch::IntegrationTest
  # include IntegrationHelperTest
Run Code Online (Sandbox Code Playgroud)

错误

$ rake
rake aborted!
cannot load such file -- integration_helper_test
C:/Users/Chloe/workspace/SeenIt/test/integration/post_integration_test.rb:2:in `<top (required)>'
Tasks: TOP => test:run => test:integration
Run Code Online (Sandbox Code Playgroud)

代码,post_integration_test.rb

require 'test_helper'
# require 'integration_helper_test'
require 'integration/integration_helper_test'

class PostIntegrationTest < ActionDispatch::IntegrationTest
Run Code Online (Sandbox Code Playgroud)

错误

  1) Error:
PostIntegrationTest#test_should_create_post:
NoMethodError: undefined method `login' for #<PostIntegrationTest:0x3da81d0>
    test/integration/post_integration_test.rb:20:in `block in <class:PostIntegrationTest>'
Run Code Online (Sandbox Code Playgroud)

代码,post_integration_test.rb …

integration-testing ruby-on-rails ruby-on-rails-4

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