How to verify of cobertura.jar file is loaded into jvm

scmuser created the topic: How to verify of cobertura.jar file is loaded into jvm

How to verify of cobertura.jar file is loaded into jvm? I have instrumented class but Automated test is not writing any thing in ser file? Any verification checklist?

rajeshkumar replied the topic: How to verify of cobertura.jar file is loaded into jvm

As far as i know, there is no password protection for OST file. Yes there is for .pst file.

Regards,
Rajesh Kumar
Twitt me @ twitter.com/RajeshKumarIn

Tagged :

Could not find or load main class net.sourceforge.cobertura.instrument

scmuser replied the topic: Could not find or load main class net.sourceforge.cobertura.instrument

Still could not resolve the issues as below;

C:\Users\rkumar11>cd C:\cobertura
C:\cobertura>cobertura-check.bat
Error: Could not find or load main class net.sourceforge.cobertura.check.Main
C:\cobertura>cobertura-check.bat
Error: Could not find or load main class net.sourceforge.cobertura.check.Main
C:\cobertura>ls -1
11.txt
cobertura-2.0.3.jar
cobertura-report.sh
EnhancedFor.java
cobertura-check.bat
coberturaFlush.war
LICENSE.txt
cobertura-check.sh
datafile
PrimitiveParameters.java
cobertura-instrument.bat
examples
README. markdown
cobertura-instrument. sh
instrumented
basedir
cobertura-merge.bat
lib
cobertura-2.0.3-javadoc.jar
cobertura-merge.sh
cobertura-2.0.3-sources.jar
cobertura-report.bat

C:\cobertura>echo %JAVA_HOME%
C:\Tools\Java\jdk1.7.0_25
C:\cobertura>echo %JAVA_HOME%
C:\Tools\Java\jdk1.7.0_25
Tagged :

A simple Ruby method to send email

scmuser created the topic: A simple Ruby method to send email

A simple Ruby method to send email

require 'net/smtp'
 
def send_email(to,opts={})
  opts[:server]      ||= 'localhost'
  opts[:from]        ||= 'email@example.com'
  opts[:from_alias]  ||= 'Example Emailer'
  opts[:subject]     ||= "You need to see this"
  opts[:body]        ||= "Important stuff!"
 
  msg = <<END_OF_MESSAGE
From: #{opts[:from_alias]} <#{opts[:from]}>
To: <#{to}>
Subject: #{opts[:subject]}
 
#{opts[:body]}
END_OF_MESSAGE
 
  Net::SMTP.start(opts[:server]) do |smtp|
    smtp.send_message msg, opts[:from], to
  end
end

send_email “admnistrator@example.com”, :body => “This was easy to send”

Source – jerodsanto.net/2009/02/a-simple-ruby-method-to-send-email/

Tagged :

Add each array element to the lines of a file in ruby

scmuser created the topic: Add each array element to the lines of a file in ruby

Add each array element to the lines of a file in ruby

Either use Array#each to iterate over your array and call IO#puts to write each element to the file (puts adds a record separator, typically a newline character):

File.open("test.txt", "w+") do |f|
a.each { |element| f.puts(element) }
end

Or pass the whole array to puts:

File.open("test.txt", "w+") do |f|
f.puts(a)
end

Source –http://stackoverflow.com/questions/18900474/add-each-array-element-to-the-lines-of-a-file-in-ruby

Tagged :

What is the way to iterate through an array in Ruby?

scmuser created the topic: What is the way to iterate through an array in Ruby?

What is the way to iterate through an array in Ruby?

This will iterate through all the elements:

array = [1, 2, 3, 4, 5, 6]
array.each { |x| puts x }

Prints:
1
2
3
4
5
6

This will iterate through all the elements giving you the value and the index:

array = ["A", "B", "C"]
array.each_with_index {|val, index| puts "#{val} => #{index}" }

Prints:

A => 0
B => 1
C => 2

Source – stackoverflow.com/questions/310634/what-…ugh-an-array-in-ruby

Tagged :

Short Notes – Ruby Arrays- Insert, Append, length, Index, Removed

scmuser created the topic: Short Notes – Ruby Arrays- Insert, Append, length, Index, Removed

Short Notes – Ruby Arrays- Insert, Append, length, Index, Removed

Create a Ruby Array

letters = Array.new
letters = []
letters = Array.new()
letters =
letters = Array.new(3) ( Define how many elements you array would be)
letters = Array.new(3, 'me rocks') (Define each element with default values)

Accessing Elements

letters[0] - accessing First element
letters[-1] - Accessing last element
letters[-2]

Inserting/Adding elements

letters = Array.new() OUTPUT = ["a", "b", "c"]
letters.insert(0, 1) OUTPUT [1, "a", "b", "c", "d"]
letters.insert(-1, 'd') OUTPUT [1, "a", "b", "c", "d"]
letters << 'e' OUTPUT [1, "a", "b", "c", "d", "e"]
letters.push('f') OUTPUT [1, "a", "b", "c", "d", "e", "f"]

Removing Elements

letters.pop - Remove the last elements
letters.delete_at(2) - Delete the element of particular index
Tagged :

Common ways to read a file in Ruby?

scmuser created the topic: Common ways to read a file in Ruby?

File.open("my/file/path", "r") do |f|
f.each_line do |line|
puts line
end
end
# File is closed automatically at end of block

It is also possible to explicitly close file after as above (pass a block to open closes it for you):

f = File.open("my/file/path", "r")
f.each_line do |line|
puts line
end
f.close

Source – stackoverflow.com/questions/5545068/what…-read-a-file-in-ruby

Tagged :

How to process every line in a text file with Ruby

scmuser created the topic: How to process every line in a text file with Ruby

Example 1

# ruby sample code.
# process every line in a text file with ruby (version 1).
file='GettysburgAddress.txt'
File.readlines(file).each do |line|
puts line
end

Example 2

# ruby sample code.
# process every line in a text file with ruby (version 2).
file='GettysburgAddress.txt'
f = File.open(file, "r")
f.each_line { |line|
puts line
}
f.close

Source –
alvinalexander.com/blog/post/ruby/how-pr…-line-text-file-ruby

Tagged :