I have some measured success. I was able to get a C program to work at capturing a frame from a webcam in both Java and Ruby, the big problem is is memory.
So I went back to JFM (Java Media Framework) but I am having all kinds of inconsistent issues. Sometimes it works with Groovy, [...]
Continue to Struggle with Linux WebCam
Language Uses & Editor Struggles
I was struggling for a bit on languages, which one to use, there are so many, do I use PHP, Ruby, Groovy, Python, or Jython or JRuby. I have settled on them let me summarize:
PHP - All my web programming will be in this language and my own custom framework.
Java - All my AI & [...]
Java vs. Groovy vs. JRuby
I was doing some benchmark testing on my robotics programs for vision testing and I got some interesting results. For the most complicated program Java took 5312ms, Groovy took 5453ms, and JRuby took 5531ms.
I was amazed at how close they were given that all the computer shootouts say that Groovy is slow and JRuby is [...]
Adding Text To Microsoft Word with Ruby
I actually created this to automate the cut and paste of text from the web to a word document for consumption by my “plain-text-challenged” customers.
require ‘win32ole’
word = WIN32OLE.new(’word.application’)
word.visible = true
word.documents.add
word.selection.typetext(”Hello World!\n”)
Text To Speech (TTS) with Ruby and PHP
I was working with some scripts for having my PC talk. The first one is in Ruby:
require “win32/sapi5″
include Win32
v = SpVoice.new
v.Speak(”this is the easiest thing to do since I have started working with ruby..”)
Now this one in PHP:
<?php
$tts = new COM(”SAPI.SpVoice”);
$tts->speak(”this is a test”);
?>
Getting Data From MySQL Using Ruby.
I wanted a fast way to get data from mysql using ruby. after i installed the mysql gem it was really easy. This program gets all rows, but only displays the id,name and zip.
require “mysql”
dbh = Mysql.real_connect(”localhost”, “root”, “password”, “scottwork”)
res = dbh.query(”SELECT name,address,city,state,zip,email FROM contacts”)
while row = res.fetch_row do
id = row[0]
[...]
Invoking Java From Ruby
I did this using the rubygem Java-Ruby-Bridge. I did this because I was having problems with JRuby and wanted to execute my class from within Ruby.
Here is a simple way to do it, as long as you remember the classpath.
require ‘rjb’
Rjb::load(classpath = ‘../../TestJava/bin’, jvmargs=[])
test = Rjb::import(’Test’)
c = test.new
c.foo3
This way I was able to invoke a [...]
Opening Internet Explorer with Ruby
I have been doing a lot of web automation these days for testing and automating web based applications without APIs.
To open Internet Explorer with Ruby just use OLE.
require ‘win32ole’
ie = WIN32OLE.new(’InternetExplorer.Application’)
ie.visible = true
ie.gohome
Getting Text and Images From The Web with Ruby
Here I am going to talk about how to get images and text from the web with Ruby.
I have found a lot of useful informaiton on the web but sometimes it’s too hard to get it without some help. To help me out I created two little snips…
To get text:
require ‘uri’
url = ARGV[0] # for [...]
Using Ruby to Close Outlook
First you will need to Install Ruby. Make sure the {ruby install path}/bin is in your path. Then run this script.
require ‘win32ole’
outlook = WIN32OLE.new(’outlook.application’)
outlook.quit
I used this in conjunction with my backup script by making sure to close Outlook before I started a backup, this way I was sure to get the Outlook files (.pst) backed up with [...]
Categories
| M | T | W | T | F | S | S |
|---|---|---|---|---|---|---|
| « Nov | ||||||
| 1 | 2 | 3 | 4 | 5 | 6 | 7 |
| 8 | 9 | 10 | 11 | 12 | 13 | 14 |
| 15 | 16 | 17 | 18 | 19 | 20 | 21 |
| 22 | 23 | 24 | 25 | 26 | 27 | 28 |
| 29 | 30 | 31 | ||||
Archives
-
- November 2008
- October 2008
- September 2008
- August 2008
- July 2008
- June 2008
- May 2008
- April 2008
- March 2008
- February 2008
- January 2008
- December 2007
- November 2007
- October 2007
- September 2007
- August 2007
- July 2007
- June 2007
- May 2007
- April 2007
- March 2007
- February 2007
- January 2007
- December 2006
- November 2006
- October 2006
- August 2006
- July 2006
- June 2006
- May 2006
- March 2006
- February 2006
- January 2006
- December 2005
- November 2005
- October 2005
- September 2005
- August 2005
- July 2005
- June 2005
- May 2005
- February 2005
- January 2005
- November 2004
- October 2004
- September 2004
- August 2004
- July 2004
- June 2004
- May 2004
- April 2004
- March 2004

