Jan 272009
 

As is, this code will create an array of arrays – Directories with the same 6 first characters will be grouped in the same sub-array. I am using this for log directories, name format 20081125 for instance – you can just replace the logic to be whatever you need, of course.

dirs = []
Dir['*'].each do |item|
  if File.directory?(item)
    if dirs.empty?
      dirs << [item]
      next
    end
    inserted = false
    dirs.each_with_index do |list_of_folders, index|
      if list_of_folders[0].to_s[0..5] == item[0..5]
        dirs[index] << item
        inserted = true
      end
    end
    dirs << [item] if !inserted
  end
end
Jan 272009
 

Tonight we had training on stances. It came about more or less accidentally – proper stances are -hard- !! But I am now flexible enough hip-wise to get there.. Now to train my leg muscles, mostly the quads, to follow suit…

Jan 232009
 

Erik Veenstra created two scripts, tar2rubyscript and rubyscript2exe, which essentially grab what you wrote, wrap it up with some other code, bundle it with the ruby executable, and spit out a finished, executable package – which will run on that same OS — so compile it on Windows, get a Windows executable, compile on Linux, get Linux executable, etc.
tar2rubyscript
rubyscript2exe

As I’m a newb, it took me a while to figure out that I need .. ‘stuff’ in the init.rb file. Since I’m writing scripts, I just stuffed the whole simple script in init.rb.. This also means I don’t really understand how to do bigger programs, but I think that with more knowledge than mine, these pages are worth their weight in pixels. Made of gold.

Jan 232009
 
require 'win32ole'
ie = WIN32OLE.new('InternetExplorer.Application')
ie.Visible = 1
ie.navigate "www.google.com"

That’s the basics for it. I found another basic intro from Ruby on Windows blog .. And don’t forget you can instantiate an object and then do something like..

properties = ie.ole_get_methods

to get more information. This comes in very handy :)

Jan 062009
 

Well, sensei hinted last month that maybe I should start gearing up for a nidan test. I’ve been getting used to being shodan, which maybe is a bad thing, but I haven’t stopped looking for things I could do better. I’m becoming more sensitive to the muscles in my back, and I think my shoulders are finally beginning to open up…

So, I have something like 5 months to prepare.. Or, you know, whenever it turns out sensei thinks I’m ready. I’d better start doing more pushups.

Jan 042009
 

Cedara iReadmammo (now Merge Mammo) is a DICOM viewer geared towards mammography reading. By default, the data source you use for reading is the local machine, but you can add others — and you can set up various DICOM nodes so it can transfer images between various studies. One big issue is that it is not promiscuous for transfers, so if the other machine doesn’t know about you, you can’t transfer. Actually, since the Query/Retrieve tool allows both a source and destination different than the local machine, you can use iReadmammo for transfer between two other machines.. As long as all three of them know each other.
This script attempts to make life a little easier when first setting up the machine, by parsing two YAML config files (one for DB source, one for DICOM nodes) and adding them automatically. As an added bonus, there is the option of adding the new machine to remote hosts and scheduling a task to run at midnight to stop and restart the scriptservice (so the software reads the config again).
It requires the files ‘ireadmammo_hosts.yml’ (for Datasources) and ‘DCconfig.yml’ (for DICOM nodes), and if they don’t exist in the same directory as the script, it’ll offer to create them for you and allow you to configure them.
Error-checking is a little spotty, as I really wanted to finish the script at this point. It’s the biggest thing I’ve written in several years.