如何获取稀疏块大小并检查Linux中reiserfs/ext3中稀疏文件中给定偏移量处是否存在数据?
我想用它来实现使用FUSE的简单的copy-on-write块设备.
或者我最好将位图保存在单独的文件中?
我已经开始尝试Haskell并遇到问题.qqq是一个函数,如果使用"Nothing"调用则应打印一个字符串,如果使用"Just something"调用则打印其他内容.
第一次尝试似乎工作:
qqq Nothing = print "There isn't anything to be printed."
qqq (Just x) = print "There is something to be printed." >> print x
main :: IO ()
main = qqq (Just 43)
Run Code Online (Sandbox Code Playgroud)
但:
main = qqq (Nothing)
让它失败时(约束中的"模糊类型变量'a0':(显示a0)因使用'qqq'而产生"")qqq :: Maybe x => x -> IO ()
- > Type constructor 'Maybe' used as a class
- >但不是吗?qqq :: (Maybe x) -> IO ()
.现在签名本身看起来很成功.但是,如果遇到main = qqq (Just 43)
这种神秘的(Show a0) …
例如,有来源:
void my_special_debugging_function(const char* function_name, const char* file_name, int line_number);
void func1() {
func3();
func4();
}
void foo() {
func1();
if(qqq) {
func2();
};
func3();
func4();
for(...) {
func5();
}
}
Run Code Online (Sandbox Code Playgroud)
它应编译为:
void my_special_debugging_function(const char* function_name, const char* file_name, int line_number);
void func1() {
my_special_debugging_function("func1", "prog.c", 3);
func3();
my_special_debugging_function("func1", "prog.c", 4);
func4();
my_special_debugging_function("func1", "prog.c", 5);
}
void foo() {
my_special_debugging_function("foo", "prog.c", 8);
func1();
my_special_debugging_function("foo", "prog.c", 9);
if(qqq) {
my_special_debugging_function("foo", "prog.c", 10);
func2();
my_special_debugging_function("foo", "prog.c", 11);
};
my_special_debugging_function("foo", "prog.c", 12);
func3(); …
Run Code Online (Sandbox Code Playgroud) 如何从xid(X窗口标识符)获取pid?如何获取给定pid的xid列表?
(假设所有应用程序都使用运行DISPLAY=:0
,而没有使用网络透明性)
我期望的是这样的:
/proc/`pidof X`/fd
能够将mkv文件转储到某些文本(如in mkvinfo -v
),编辑它并重新构建,将二进制数据保留为十六进制转储是很有用的.
就像是:
$ mkv2xml < test.mkv > test.xml
$ head test.xml
<EBML>
<EBMLVersion>1</EBMLVersion>
<MaxIdLen>4</<MaxIdLen>
<MaxSizeLen>8</MaxSizeLen>
<DocType>matroska</DocType>
<DocTypeVersion>2</DocTypeVersion>
<DocTypeReadVersion>2</DocTypeReadVersion>
<Segment>
<Tracks>
<Track>
<TrackNumber>1</TrackNumber>
<CodecID>V_MJPEG</CodecID>
<Video><PixelWidth>320</PixelWidth><PixelHeight>240</PixelHeight></Video>
</Track>
</Tracks>
<Cluster>
<Timecode>5.023</TimeCode>
<SimpleBlock track="1" time="5.045">
ffd8fffe001a80......
$ xml2mkv < test.xml | mplayer -cache 100 -
Run Code Online (Sandbox Code Playgroud)
这有助于简化编写[调试]工具与视频一起工作,而无需实际处理多路复用/多路分解细节,只需查看输出即可.
是否有良好的(适合在实际项目中使用)方式或减少这样的事情的样板
class B(A):
def qqq(self): # 1 unwanted token "self"
super(B, self).qqq() # 7 unwanted tokens plus 2 duplications ("B", "qqq")
do_something()
Run Code Online (Sandbox Code Playgroud)
我希望它看起来更像这样:
class B(A):
def qqq:
super
do_something()
Run Code Online (Sandbox Code Playgroud)
或者(更现实地)
class B(A):
@autosuper_before
def qqq(self):
do_something()
Run Code Online (Sandbox Code Playgroud)
是否可以在Python 2.6+中没有明显的黑客攻击?
没有args的Python 2.x中的 @link super()
在http://clojure.github.com/clojure-contrib/str-utils-api.html中写道
String utilities for Clojure
Deprecated since clojure-contrib version 1.2
Run Code Online (Sandbox Code Playgroud)
但它没有写出我应该用什么代替.那里有方便的功能,如"chomp"或"re-partition".
我该怎么做才能将旧的clojure v1.1 代码移植到最新版本?我应该只将函数从clojure-contrib直接复制到源代码吗?
$ time java -jar clojure-1.4.0.jar -e '(println "Hello world")'
Hello world
real 0m4.586s
$ time python clojure.py -c '(py/print "Hello world")'
real 0m14.690s
$ time mono Clojure.Main.exe -e '(println "hello world")'
hello world
real 0m4.843s
/* clojure-metal is not tested due to not being written at the moment */
Run Code Online (Sandbox Code Playgroud)
Clojure启动时间可以很小,就像我运行Perl或Python脚本一样吗?慢启动时间是基础框架或Clojure的问题(可以迟早修复)还是设计?
注意:我已经了解了start-persistent-server-than-connect-to-it的解决方法.
问:在没有为所有依赖项安装分析库的情况下配置Haskell
A:你不能.只需安装它们,有什么问题?
为什么?
如果我只想分析我的代码,将库调用视为无操作分析,为什么它不能允许部分分析?如果存在大量已安装的依赖项,则启用分析可能会非常棘手.虽然不太准确,但应该更容易.
clojure ×2
haskell ×2
linux ×2
profiling ×2
c ×1
converter ×1
deprecated ×1
filesystems ×1
gcc ×1
ghc ×1
matroska ×1
maybe ×1
networking ×1
nothing ×1
oop ×1
performance ×1
pid ×1
python ×1
python-2.6 ×1
python-2.7 ×1
string-utils ×1
super ×1
text ×1
x11 ×1
xml ×1