Announcing the new Datavyu v1.3.6 with enhanced features and transcription support!

Hello,

I'm a beginner in Ruby and I'm getting some strange errors when I try to run a script I've written. The script is intended to simply add 6 columns to a new Datavyu file. Something is going wrong when the script attempts to write the codes of the new columns to Datavyu. Specifically, duplicated lowercase copies of all but one of the codes I want to include are added to the spreadsheet, and the script terminates as soon as it attempts to create a column that contains more than one code. For example, if I ask it to create a column "Gaze" with codes "Parent", "Experimenter", and "Other", it creates one with "experimenter", "other", "Parent", "Experimenter", and "Other". This seems to be related to the "DELETING ARG" statement in the output. Where is that coming from, and what is going on?

Here's the script:

require 'Datavyu_API.rb'
begin

puts "Creating columns..."
section = createNewColumn("AOSI_section","Name AOSI section")
subsection = createNewColumn("AOSI_subsection","Name AOSI subsection")
gaze = createNewColumn("EyeGaze","Object","Parent","Experimenter","Other")
gesture = createNewColumn("Gesture","Reach","Point","Take","Show/Offer","Give","Shake",
"Bang","Roll","Mouth","Throw","Other")
vocal = createNewColumn("Vocalization","Vocalization","Vegetative","Effort")
notes = createNewColumn("Notes","Notes")

puts "Writing columns to Datavyu..."
setColumn(section)
setColumn(subsection)
setColumn(gaze)
setColumn(gesture)
setColumn(vocal)
setColumn(notes)

puts "Finished successfully!"

end

And here is the error I get:

Running Script: FileTemplateScript2.rb on project: 2

Creating columns...
Writing columns to Datavyu...
DELETING ARG:nameaosisection
DELETING ARG:nameaosisubsection
DELETING ARG:object
NativeException: java.util.ConcurrentModificationException: null
each at file:/C:/Users/latternerl/Downloads/Datavyu-Windows-latest/datavyu-1.2/jruby-complete-1.6.7.2.jar!/builtin/java/java.util.rb:7
setVariable at file:/C:/Users/latternerl/Downloads/Datavyu-Windows-latest/datavyu-1.2/datavyu-1.2.exe!/Datavyu_API.rb:590
setColumn at file:/C:/Users/latternerl/Downloads/Datavyu-Windows-latest/datavyu-1.2/datavyu-1.2.exe!/Datavyu_API.rb:508
(root) at <script>:21
Native Exception: 'class java.util.ConcurrentModificationException'; Message: null; StackTrace: java.util.ConcurrentModificationException
at java.util.ArrayList$Itr.checkForComodification(Unknown Source)
at java.util.ArrayList$Itr.next(Unknown Source)
at sun.reflect.GeneratedMethodAccessor32.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.jruby.javasupport.JavaMethod.invokeDirectWithExceptionHandling(JavaMethod.java:508)

SCRIPT ERROR
org.jruby.exceptions.RaiseException: Native Exception: 'class java.util.ConcurrentModificationException'; Message: null; StackTrace: java.util.ConcurrentModificationException
at java.util.ArrayList$Itr.checkForComodification(Unknown Source)
at java.util.ArrayList$Itr.next(Unknown Source)
at sun.reflect.GeneratedMethodAccessor32.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.jruby.javasupport.JavaMethod.invokeDirectWithExceptionHandling(JavaMethod.java:508)

Thank you for your help!

asked 20 Nov '14, 15:52

leahl's gravatar image

leahl
1122
accept rate: 0%

edited 20 Nov '14, 16:37


I think I figured out the issue. Ruby tends not to play well with capital letters. I don't know the underlying reason, but the script was deleting the first capitalized code without incident, but was breaking once you had more than 1 capitalized code in a column.

Below is a working script. The only change is that I removed all the capitalized codes, spaces, and special characters from the original script. Generally, our lab avoids naming columns and codes with capital letters because Ruby cares about capitalization.

Here's the updated script:

require 'Datavyu_API.rb'
begin

puts "Creating columns..."
section = createNewColumn("AOSI_section","nameaosisection")
subsection = createNewColumn("AOSI_subsection","Nameaosisubsection")
gaze = createNewColumn("EyeGaze","object","parent","experimenter","other")
gesture = CreateNewColumn("Gesture","reach","point","take","show_offer","give","shake","bang","roll","mouth","throw","other")
vocal = createNewColumn("Vocalization","vocalization","vegetative","effort")
notes = createNewColumn("Notes","notes")

puts "Writing columns to Datavyu..."
setColumn(section)
setColumn(subsection)
setColumn(gaze)
setColumn(gesture)
setColumn(vocal)
setColumn(notes)

puts "Finished successfully!"

end
permanent link

answered 21 Nov '14, 12:08

david's gravatar image

david ♦
143235
accept rate: 4%

edited 21 Nov '14, 12:10

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×46
×6
×2
×2

question asked: 20 Nov '14, 15:52

question was seen: 4,782 times

last updated: 21 Nov '14, 12:10

powered by OSQA