So, I’m trying to set up a ruby script that screenscrapes another website, writes the results to a local file, then rsyncs the file to another machine behind a firewall. This post details the problems I ran into while trying to get cron to run the ruby script and rsync to the remote host.

Read the rest of this entry » )

Original: craschworks - comments

If you want to use a newly installed rubygems, and you don’t want to require ‘rubygems’ for every program that uses a gem, you need to set the RUBYOPT environment variable. For example, if you’re using tcsh, you should put the following in your .tcshrc file:

setenv RUBYOPT rubygems

This will cause the rubygems module to be loaded every time your run a ruby script.

——

If you call an external python script from within ruby, make sure you have any pdb.set_trace() lines commented out. When the ruby script tries to run the program, it will just hang at the point you set the trace, without giving you any output. For example, if test.py script has a pdb.set_trace() set, and you run the following command from within irb, the line will never finish executing. You’ll have to interrupt it with a CTRL-C command.

dfi_result = `/Users/build/crasch/PythonScripts/test.py -positions -total -infile /MData/Data/vyslf.csv -MStderrLoggingThreshold 3`

Original: craschworks - comments

I found Steve Litt’s Ruby Database Connectivity article quite helpful for configuring ruby access to PostgreSQL on Cygwin. However, I ran into a couple of errors while running the sample files which I detail below:

Read the rest of this entry » )

Original: craschworks - comments

If you want a list of all a ruby object’s methods, try this:

puts object.public_methods.sort

Original: craschworks - comments

[EDIT: This is outdated! Go here for an updated tutorial. ]

Firewatir is the Firefox version of Watir, which is a web application testing framework that uses ruby to drive Internet Explorer to run automated test scripts. Both Watir and Firewatir are developed natively on Windows--this is an incomplete, rough draft of my attempts to get it running on Mac OS X

Read more... )
I'm programming in Ruby on Windows. After working on the Mac, I find the Command Prompt counter-intuitive. In particular, I would like to be able to resize the screen size arbitrarily without changing the preferences and use Ctl-C, Ctrl-V cut n paste commands. I'm aware of Monad/Power-shell, but I don't want to have to learn another shell language. Cygwin has the same issues as the Windows prompt. What alternatives do you Windows folk recommend, if anything?
A pair of functions I wrote that compare the contents of a configuration directory on a remote server with the expected contents in SVN. compareDir is the first draft and compareDirTwo is the second draft. compareDirTwo compares all of the files in all the directories below, whereas the compareDir only goes one level and doesn't compare the files in the topmost level. The compare flag will cause the function to compare the contents of the files, in addition to checking for existence. It assumes that all files are text files. Pasted here to remind me how I wrote the compareDir function, because I'm deleting it and it has some tricks in it that I want to remember.

Read more... )

Syndicate

RSS Atom