我正在使用Eclipse 3.3("Europa").Eclipse定期启动时间过长(可能永远).我在Eclipse日志中唯一能看到的是:
!ENTRY org.eclipse.core.resources 2 10035 2008-10-16 09:47:34.801 !MESSAGE The workspace exited with unsaved changes in the previous session; refreshing workspace to recover changes.
谷歌搜索显示某人建议我删除该文件夹:
workspace\.metadata\.plugins\org.eclipse.core.resources\.root\.indexes
Run Code Online (Sandbox Code Playgroud)
这似乎没有帮助.
没有从一个新的工作区开始(我不想做的事情,因为我需要花费几个小时才能再次正确地设置我的所有项目),有没有办法让Eclipse正常启动?
我正在浏览Go游戏,我对指针和界面感到困惑.为什么这个Go代码没有编译?
package main
type Interface interface {}
type Struct struct {}
func main() {
var ps *Struct
var pi *Interface
pi = ps
_, _ = pi, ps
}
Run Code Online (Sandbox Code Playgroud)
即如果Struct
是Interface
,为什么不是*Struct
一个*Interface
?
我得到的错误信息是:
prog.go:10: cannot use ps (type *Struct) as type *Interface in assignment:
*Interface is pointer to interface, not interface
Run Code Online (Sandbox Code Playgroud) 我想在bash脚本中嵌入一个这样的长命令:
mycommand \
--server myserver \
--filename extremely/long/file/name/that/i/would/like/to/be/able/to/break/up/if/possible \
--otherflag \
--anotherflag
Run Code Online (Sandbox Code Playgroud)
打破长文件名.
我能做到这一点:
# Insufficiently pretty
mycommand \
--server myserver \
--filename extremely/long/file/name/\
that/i/would/like/to/be/able/to/break/\
up/if/possible \
--otherflag \
--anotherflag \
Run Code Online (Sandbox Code Playgroud)
但它打破了流动.我会喜欢能够这样写:
# Doesn't work
mycommand \
--server myserver \
--filename extremely/long/file/name/\
that/i/would/like/to/be/able/to/break/\
up/if/possible \
--otherflag \
--anotherflag
Run Code Online (Sandbox Code Playgroud)
但这不起作用,因为它打破了字符串文字.
有没有办法告诉bash打破字符串文字但忽略任何前导空格?
我目前正在学习C++,所以我认为尝试(重新)编写一些"常见的"基于文本的游戏是一个好主意.(想到打猎Wumpus,猜猜计算机生成的(伪)随机数,...)
但是,我找不到任何这些任务的好来源.
我正在尝试java.lang.OutOfMemoryError: PermGen Space
在Sun的Hotspot JVM上运行时诊断错误,并且想知道我的程序在不同点上使用了多少PermGen空间.有没有办法以编程方式查找此信息?
有没有办法说服Eclipse使用制表符而不是空格来缩进其内置的Java内容辅助提议(例如在创建覆盖父类中方法的空方法时)?
我能找到的唯一相似的设置是在Windows /首选项/常规/编辑器/文本编辑器/选项卡的插入空格中,此设置未选中.
(编辑:几张海报都指出了Java/Code Style/Formatter/Indentation/Tab策略,它被设置为"仅限Tabs")
目前我必须记住选择它们并重新格式化<Ctrl>+<Shift>+<F>
.
我们遇到了一个奇怪的问题ConcurrentHashMap
,其中两个线程似乎在调用put()
,然后在方法内永远等待Unsafe.park()
.从外面看,它看起来像是一个僵局ConcurrentHashMap
.
到目前为止,我们只看到过这种情况.
谁能想到任何可能导致这些症状的事情?
编辑:相关线程的线程转储在这里:
"[redacted] Thread 2" prio=10 tid=0x000000005bbbc800 nid=0x921 waiting on condition [0x0000000040e93000] java.lang.Thread.State: WAITING (parking) at sun.misc.Unsafe.park(Native Method) - parking to wait for <0x00002aaaf1207b40> (a java.util.concurrent.locks.ReentrantLock$NonfairSync) at java.util.concurrent.locks.LockSupport.park(LockSupport.java:158) at java.util.concurrent.locks.AbstractQueuedSynchronizer.parkAndCheckInterrupt(AbstractQueuedSynchronizer.java:747) at java.util.concurrent.locks.AbstractQueuedSynchronizer.acquireQueued(AbstractQueuedSynchronizer.java:778) at java.util.concurrent.locks.AbstractQueuedSynchronizer.acquire(AbstractQueuedSynchronizer.java:1114) at java.util.concurrent.locks.ReentrantLock$NonfairSync.lock(ReentrantLock.java:186) at java.util.concurrent.locks.ReentrantLock.lock(ReentrantLock.java:262) at java.util.concurrent.ConcurrentHashMap$Segment.put(ConcurrentHashMap.java:417) at java.util.concurrent.ConcurrentHashMap.put(ConcurrentHashMap.java:883) at [redacted] "[redacted] Thread 0" prio=10 tid=0x000000005bf38000 nid=0x91f waiting on condition [0x000000004151d000] java.lang.Thread.State: WAITING (parking) at sun.misc.Unsafe.park(Native Method) - parking to wait for <0x00002aaaf1207b40> (a java.util.concurrent.locks.ReentrantLock$NonfairSync) at …
%s
如果不需要额外的格式,在格式化数字时是否有任何理由不使用格式说明符?
例如
int answer = 42;
String text = String.format("The answer is %s", answer);
Run Code Online (Sandbox Code Playgroud)
而不是更常见的:
int answer = 42;
String text = String.format("The answer is %d", answer);
Run Code Online (Sandbox Code Playgroud)
我问的原因是我想要做一些自动更改源代码,这将是不方便,要弄清楚是否该类型answer
是int
或String
或别的东西,
是否可以从Velocity模板访问常量值(即Java类中定义的公共静态最终变量)?
我希望能够写出这样的东西:
#if ($a lt Long.MAX_VALUE)
Run Code Online (Sandbox Code Playgroud)
但这显然不是正确的语法.
是否可以将Velocity引用设置为"null"或"undefined"?
#set
- 建立参考格式的值:
# [ { ] set [ } ] ( $ref = [ ", ' ]arg[ ", ' ] )
用法:
$ref
- 赋值的LHS必须是变量引用或属性引用.
arg
- 赋值的RHS,arg如果用双引号括起来解析,如果用单引号括起来则不解析.如果RHS评估为null,则不会将其分配给LHS.(强调我的)
我找不到等效的#unset
宏.
java ×6
eclipse ×2
velocity ×2
bash ×1
c++ ×1
concurrency ×1
eclipse-3.3 ×1
go ×1
jvm-hotspot ×1
linux ×1
memory-leaks ×1
permgen ×1
printf ×1
templates ×1