虽然似乎有一种克隆整个仓库的方法,这里描述的,我只需要Java API文件,仅此而已.(提示:流量限制+慢速连接)
现在,这是整个git repo,但是普通的Java API文件在哪里?或者他们是在一个完全不同的位置?有人有想法吗?我不是那么多git专家.
我写了以下代码来删除句子中的元音:
main = print $ unixname "The House"
vowel x = elem x "aeiouAEIOU"
unixname :: [Char] -> [Char]
unixname [] = []
unixname (x:xs) | vowel x = unixname xs
| otherwise = x : unixname xs
Run Code Online (Sandbox Code Playgroud)
只是想知道是否可以为元音创建数据类型?编译器不允许我在数据类型中使用字符.
在请求我的示例应用程序的主页时,我收到以下错误消息(遵循Michael Hartl的教程第11章):
"页面#home中的ActiveRecord :: HasManyThroughSourceAssociationNotFoundError"
"无法在模型关系中找到源关联:followed_id.尝试'has_many:follows_users,:through =>:relationships,:source =>'.它是以下之一:追随者还是:跟着?"
这真的很奇怪,因为我完全按照教程的说明进行操作.我甚至复制粘贴每个代码片段.
我的用户模型(摘录):
class User < ActiveRecord::Base
has_many :relationships, foreign_key: "follower_id", dependent: :destroy
has_many :followed_users, through: :relationships, source: "followed_id"
has_many :reverse_relationships, foreign_key: "followed_id", class_name: "Relationship", dependent: :destroy
has_many :followers, through: :reverse_relationships, source: :follower
Run Code Online (Sandbox Code Playgroud)
我的关系模型:
class Relationship < ActiveRecord::Base
attr_accessible :followed_id
belongs_to :follower, class_name: "User"
belongs_to :followed, class_name: "User"
validates :follower_id, presence: true
validates :followed_id, presence: true
end
Run Code Online (Sandbox Code Playgroud)
我的迁移文件:
class CreateRelationships < ActiveRecord::Migration
def change
create_table :relationships do |t|
t.integer :follower_id
t.integer :followed_id
t.timestamps …Run Code Online (Sandbox Code Playgroud) 在我阅读JDK的源代码之后,我发现HashMap的hash()功能看起来很有趣.它的官方代码如下:
static int hash(int h) {
// This function ensures that hashCodes that differ only by
// constant multiples at each bit position have a bounded
// number of collisions (approximately 8 at default load factor).
h ^= (h >>> 20) ^ (h >>> 12);
return h ^ (h >>> 7) ^ (h >>> 4);
}
Run Code Online (Sandbox Code Playgroud)
参数h是的hashCode从Objects它投入HashMap.这种方法如何工作?为什么?为什么这个方法可以抵御糟糕的hashCode函数?
在Groovy中,只需将变量放在里面就可以测试null和empty的集合,如下所示:
def collection = [ 'test' ]
if(!collection) {
//Collection is either null or empty, handle exceptional business here
}
Run Code Online (Sandbox Code Playgroud)
但是,当放在@CompileStatic包含这样的代码的类上时,它会停止工作(但仅限于Android)并出现错误:
02-16 20:49:03.837: E/AndroidRuntime(9013): org.codehaus.groovy.runtime.metaclass.MissingMethodExceptionNoStack: No signature of method: java.util.ArrayList.asBoolean() is applicable for argument types: () values: []
Run Code Online (Sandbox Code Playgroud)
运行桌面版时似乎不会发生这种情况.
提供更多背景信息.这是一个生成的LibGDX项目,包含三个项目(-core,-desktop,-android),其中-core项目已转换为groovy项目.引用了-core项目,以及-desktop和-android项目的依赖项
无论是否使用@CompileStatic注释注释类,并且正确识别Groovy Truth,桌面版本都可以正常工作.
另一方面,在Android上,出现上述错误.
我没有使用grooid库,因为转换为groovy的项目在桌面和android之间共享.
如果它有任何价值,这里是build.gradle项目级别的内容:
buildscript {
repositories {
mavenCentral()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.0.0'
classpath 'org.codehaus.groovy:gradle-groovy-android-plugin:0.3.5'
}
}
allprojects {
apply plugin: "eclipse"
apply plugin: "idea"
version = '1.0'
ext {
appName …Run Code Online (Sandbox Code Playgroud) 我们有一系列封闭源代码应用程序和库,我们认为打开源代码是有意义的.
到目前为止,阻止我们的是在开放之前清理代码库和记录源代码所需的工作.
只有当我们有合理的机会让项目成功时,我们才想开源,即有贡献者.我们相信代码对于大量开发人员来说会很有趣.
除了项目的"有趣性"和"有用性"之外,哪些因素决定了开源项目的成功与否?
例子:
wxs文件的File标签Source属性; 路径中有一个空格.
<File Id="_uploads.UserImport.EDS_UserImport.xls" Name="EDS_UserImport.xls" Source="C:\Documents and Settings\kle\Desktop\OspreyMSIGenerator\OspreyMSIGenerator\Published\EDSContainer\uploads\UserImport\EDS_UserImport.xls"></File>
Run Code Online (Sandbox Code Playgroud)
我收到这个错误
candle.exe:错误CNDL0103:系统找不到类型为'Source'的文件'和'.
我无法确定我的路径中是否有空格.如何在源路径中支持空格?
使用doxygen,我可以生成很好的图表,但是doxygen缺乏对类之间关系的更深入分析.它识别派生,但工具不理解其他关系.哪些更好的实用程序(商用或非商用)可以从C++源文件生成更完整的UML类图?
可用于C#/ Java的工具有点好,但我现在不感兴趣.
我有一个Try<Option<Foo>>.我想flatMap Foo进入a Bar,使用可能失败的操作使用它.如果我Option<Foo>是一个Option.none()(并且Try是成功的)并且在这种情况下没有任何关系,这不是失败.
所以我有这样的代码,它确实有效:
Try<Option<Bar>> myFlatMappingFunc(Option<Foo> fooOpt) {
return fooOpt.map(foo -> mappingFunc(foo).map(Option::of) /* ew */)
.getOrElse(Try.success(Option.none()); // double ew
}
Try<Bar> mappingFunc(Foo foo) throws IOException {
// do some mapping schtuff
// Note that I can never return null, and a failure here is a legitimate problem.
// FWIW it's Jackson's readValue(String, Class<?>)
}
Run Code Online (Sandbox Code Playgroud)
然后我称之为:
fooOptionTry.flatMap(this::myFlatMappingFunc);
Run Code Online (Sandbox Code Playgroud)
这确实有效,但看起来真的很难看.
Try和Option左右?注1:我主动不想在内部调用Option.get()和捕获它,Try因为它在语义上不正确.我想我可以恢复,NoSuchElementException但这似乎更糟糕,代码方面. …
android ×2
java ×2
associations ×1
c++ ×1
file ×1
generator ×1
git ×1
git-clone ×1
groovy ×1
hash ×1
hashmap ×1
haskell ×1
java-8 ×1
javascript ×1
libgdx ×1
monads ×1
open-source ×1
php ×1
relationship ×1
repository ×1
spaces ×1
truthiness ×1
types ×1
uml ×1
vavr ×1
whitespace ×1
wix ×1