<geek mode alert!> I have been musing a lot lately, regarding what would be the perfect operating system (IMO), or asĀ close as it could get. Here it is, in a not-so orderly manner, various characteristics, that I would desire, in my “perfect” operating system. Kernel The kernel would be a microkernel, with everything from [...]
Creating a Ruby 1.9 sandbox 1. mkdir /home/user/ruby19 (example folder) 2. cd /home/user/ruby19 3. mkdir src 4. cd src 5. wget http://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.0-1.tar.bz2 6. tar -jxvf ruby-1.9.0-1.tar.bz2 7. cd ruby-1.9.0-1 8. ./configure –prefix=/home/user/ruby19 9. make 10. make install Now you can switch to this sandbox at any time by executing ‘export PATH=/home/user/ruby19/bin:$PATH’ in a shell. Chipmunk [...]
So what exactly is the difference between a class and a struct in C++? After wondering and debating internally for quite a long time, I looked around the net and found the (simple) explanation that: "The only difference between a struct and a class is in the default access." That is, a sruct is public [...]
How easy would it be to build include graphs in ruby? Here's my first attempt: PLAIN TEXT RUBY: $list_of_files = Hash.new $list_of_files.each {|node| node = Array.new } def store_includes(pathname) lines = IO.readlines(pathname) lines.each {|line| if line.include? "#include" include_file = line[line.index("#include")+"#include".size,line.size] fidx = 0 sidx = 0 if include_file.include?("\"") fidx = include_file.index("\"") + 1 sidx [...]
Is there a more efficient way to extract the file extensions in ruby? I currently do the following. PLAIN TEXT RUBY: ext = File.basename(filepath).reverse.split('.')[0].reverse