易截截图软件、单文件、免安装、纯绿色、仅160KB

ruby和MinGW的一次融合

我们在使用C编程时会遇到一个问题,比如头文件的一个函数包含在一个lib中,但是
在实际连接中我们不知道它在哪个库中。也许可行的一种办法是直接上网查询某个
函数的依赖条件,这对于常用函数是没问题的!但是对于复杂而又缺少文档的第三方
lib来说,无异于大海捞针。
自此通过2种办法来尝试解决这个问题,我们先看第一种:
在Windows下使用批处理语言来查找指定的函数符号:
crt.bat:
@echo off
set gccpath=d:\downloadsvr\mingwstudio\mingw
dir %gccpath%\lib /b>files.txt
if not exist files md files
for /f %%i in (files.txt) DO (
    set fprefix=%%i
    %gccpath%\bin\nm.exe -s -D %gccpath%\lib\%%i>files\%%i.txt
    for %%a in (files\%%i.txt) do (
        if %%~za equ 0 del %%a
    )
)
del files.txt
@echo ######## Create Names Database Successed!!! #########
pause
;#################################################################
fnd.bat:
@echo off
dir files\ /b >tmp.txt
for /f %%i in (tmp.txt) DO (
    find /i /n "%1" files\%%i
)
del tmp.txt
以上有2个bat文件,crt.bat是生成对应lib文件夹中的所有lib的符号,分别放在若干个文本
文件中。只要lib不发生变动,那么只要生成一次即可!然后使用fnd.bat来查询某个符号。
that's all!!!
那么使用ruby能否完成这一功能呢?答案是肯定的:
class LibSyms
attr_accessor :libs

def save_syms(fname="cache_syms.dat")
data = Marshal.dump(@syms)
File.open(fname,"w+b") {|f|f.puts data}
end

def load_syms(fname="cache_syms.dat")
data=nil
File.open(fname,"r+b"){|f|data=f.read}
@syms=Marshal.load(data)
end

def enum_syms
@syms={}
@libs = []
`dir \"#{@path}\\lib\" /b`.lines {|line|@libs<<@path+"\\lib\\"+line.chomp}

@libs.each do |fname|
tmp=`\"#{@path}\\bin\\nm.exe\" -s -D \"#{fname}\"`.split("\n")
@syms[fname]=tmp
end
end

def initial


相关文档:

菜鸟和RMXP和Ruby语言

      喜欢玩阿月系列RPG游戏的我,跟不少童鞋一样下了RPGMakerXP来瞻仰一下。当时觉得这个软件太方便了,用鼠标随便点点就能弄出来个有趣的小游戏。因为里面不仅自带不少地图和人物行走图等素材,容易上手的操作方式也让自己大有成就感……可是游戏毕竟是离不开编程,解开游戏包,看 ......

Install Cassandra with Ruby 1.9.1 on Windows

To get it done is not easy. I spent a whole day to figure out the various compatibility issues along the way out.
Now there still might be potential issues, but it works by my rough test.
Step 1: Install Apache Cassandra
  You may know that the Ruby gem cassandra will do it for you.
  ......

学ruby有感(by 王瀚)

    学了一个学期的C语言,看了一个星期的ruby,我才发现为什么老师说C是最基础的,假如没有一个学期的C基础,那ruby我也不用看了。
        Ruby和C语言有许多的相同点和不同点,在学习ruby时,有时可以用C里面的思维来理解,就像ruby里面的方法其实就跟C的函数如出一 ......

windows 下ruby的安装

1,安装ruby
下载地址: http://rubyinstaller.org/download.html
2,安装rails
使用命令下载:在命令行运行gem install rails --remote
2,初步了解ruby的文章
http://www.bcbbs.net/html/29671.html
http://www.bcbbs.net/dev/List64.aspx ......

Ruby声音


转 Adding Sound to Your Ruby Apps
Have you ever thought about including sounds in your Ruby application? Used sparingly, sound may enhance your applications by adding audio cues or a custom touch. You could, for example, play a beep or chime that announces the completion of a lengthy process. Per ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号