MacRuby. How to manage multiple frameworks. 0.10 and Latest - macruby

I am starting to write a MacRuby app. I installed some gems which i am interested in using. I get an error in xmlbase when trying to run.
/Library/Frameworks/MacRuby.framework/Versions/0.10/usr/lib/ruby/Gems/1.9.2/gems/builder-3.0.0/lib/builder/xmlbase.rb:in _indent': undefined method*' for nil:NilClass (NoMethodError)
I am using the 0.10 version of the framework. I downloaded the latest daily version to see if its been fixed but when my app runs its still calling the old 0.10 version. How do i get it to reference the newer version. Is this something in Xcode to something specific to MacRuby. Can i use RVM to do this?
Also anyone have any ideas if this has been fixed in a more recent version. The code i am using is as follows. You'll need a bet fair account to test!
require 'rubygems'
require 'betfairapi-savon'
class BetFairTest
def self.test
api = BetfairAPI.new
username = 'username'
password = 'pass'
response = api.login(username, password, 82, 0, 0, nil)
session_token = response.to_hash[:login_response][:result][:header][:session_token]
all_markets = api.get_all_markets(session_token,1)
api.keep_alive(session_token)
api.logout(session_token)
end
end
after the login i get the error
/Library/Frameworks/MacRuby.framework/Versions/0.10/usr/lib/ruby/Gems/1.9.2/gems/builder-3.0.0/lib/builder/xmlbase.rb:in `_indent': undefined method `*' for nil:NilClass (NoMethodError)
from /Library/Frameworks/MacRuby.framework/Versions/0.10/usr/lib/ruby/Gems/1.9.2/gems/builder-3.0.0/lib/builder/xmlmarkup.rb:281:in `_special:'
from /Library/Frameworks/MacRuby.framework/Versions/0.10/usr/lib/ruby/Gems/1.9.2/gems/builder-3.0.0/lib/builder/xmlmarkup.rb:254:in `instruct!:'
from /Library/Frameworks/MacRuby.framework/Versions/0.10/usr/lib/ruby/Gems/1.9.2/gems/savon-0.9.7/lib/savon/soap/xml.rb:166:in `builder'
from /Library/Frameworks/MacRuby.framework/Versions/0.10/usr/lib/ruby/Gems/1.9.2/gems/savon-0.9.7/lib/savon/soap/xml.rb:150:in `to_xml'
from /Library/Frameworks/MacRuby.framework/Versions/0.10/usr/lib/ruby/Gems/1.9.2/gems/savon-0.9.7/lib/savon/soap/request.rb:38:in `setup:'
from /Library/Frameworks/MacRuby.framework/Versions/0.10/usr/lib/ruby/Gems/1.9.2/gems/savon-0.9.7/lib/savon/soap/request.rb:23:in `initialize:'
from /Library/Frameworks/MacRuby.framework/Versions/0.10/usr/lib/ruby/Gems/1.9.2/gems/savon-0.9.7/lib/savon/client.rb:79:in `request:'
from /Library/Frameworks/MacRuby.framework/Versions/0.10/usr/lib/ruby/Gems/1.9.2/gems/betfairapi-savon-1.0.1/lib/betfairapi-savon.rb:17:in `login:'
from /Users/barry/Library/Developer/Xcode/DerivedData/TestApp-djtngswdhcnqvgdwihommmloripf/Build/Products/Debug/TestApp/Contents/Resources/BetFairTest.rb:20:in `test'
Cheers,
Barry.

Related

xmlrpc.client.Fault when calling TestRun.update()

Kiwi version 6.0, tcms-api 5.0.
Given that 82 is a valid test run_id and 7 is a valid build_id for the test run's product in the Kiwi instance, run this Python snippet:
from tcms_api import TCMS
kiwi = TCMS()
kiwi.exec.TestRun.update(82, {'build' : 7})
Expect:
The test run's product build is updated from 1 (unspecified) to 7.
Result:
Exception has occurred: xmlrpc.client.Fault
<Fault -32603: "Internal error: 'status'">
There's no other call stack information, so I'm at a loss to further debug. I've tried updating a couple of different fields (manager and status) with the same result. I also get the same result if the value I'm trying to update is unknown/invalid.
Additional information: the equivalent call to TestCaseRun.update() API works. I.e., I can update the build information on a TestCaseRun instance.
#s-manke. This is a genuine bug. I've implemented a hot-fix here: https://github.com/kiwitcms/Kiwi/pull/553
so you can at least continue to use the API.
I am in the process of cutting a new version anyway so this hot-fix will go in. However the API will not process status or stop_date fields at the moment.

elastic4s 6.2.2 HttpClient issues

Recently I found out that elastic4s TcpClient is deprecated and going to be removed in 7.x versions.
I tried to migrate to HttpClient and faced the following issue; suppose we have a following insert operation:
val client = HttpClient(ElasticsearchClientUri(elasticUri))
def insert(ent: MyEntity): Future[Either[RequestFailure, RequestSuccess[Nothing]]] =
client.execute {indexInto(myIndex) doc ent}
This raises compile error:
Error:(27, 49) could not find implicit value for parameter exec:
com.sksamuel.elastic4s.http.HttpExecutable[com.sksamuel.elastic4s.indexes.IndexDefinition,U]
Could someone please explain what is HttpExecutable and how it should be initialized?
PS: elastic4s version is 6.2.2
Ok, it was my fault actually...
I imported ElasticApi._ instead of ElasticDsl._ and it caused this issue.
So in total there is no issue at all

OWL API V5 read ontology from local file

in the current documentation example at the link:
https://github.com/owlcs/owlapi/blob/version5/contract/src/test/java/org/semanticweb/owlapi/examples/Examples.java
There is no example of how to load an ontology from a local file. There is only a way to load it from a string.
In the past when i used owl-api version 3
the following code worked perfectly:
OWLOntologyManager manager =OWLManager.createOWLOntologyManager();
File file = new File (path);
OWLOntology ont = manager.loadOntologyFromOntologyDocument(IRI.create(file));
however, in this version, the last line of the previous code:
manager.loadOntologyFromOntologyDocument(IRI.create(file));
returns this error:
Exception in thread "main" java.lang.NoSuchMethodError:
org.semanticweb.owlapi.util.SAXParsers.initParserWithOWLAPIStandards(Lorg/xml/sax/ext/DeclHandler;)Ljavax/xml/parsers/SAXParser;
at
org.semanticweb.owlapi.rdf.rdfxml.parser.RDFParser.parse(RDFParser.java:148)
at org.semanticweb.owlapi.rdf.rdfxml.parser.RDFXMLParser.parse(RDFXMLParser.java:62)
at uk.ac.manchester.cs.owl.owlapi.OWLOntologyFactoryImpl.loadOWLOntology(OWLOntologyFactoryImpl.java:173)
at uk.ac.manchester.cs.owl.owlapi.OWLOntologyManagerImpl.load(OWLOntologyManagerImpl.java:954)
at uk.ac.manchester.cs.owl.owlapi.OWLOntologyManagerImpl.loadOntology(OWLOntologyManagerImpl.java:918)
at uk.ac.manchester.cs.owl.owlapi.OWLOntologyManagerImpl.loadOntologyFromOntologyDocument(OWLOntologyManagerImpl.java:859)
at glass.main.ontology_Test_main2.readOntology(ontology_Test_main2.java:49)
at glass.main.ontology_Test_main2.main(ontology_Test_main2.java:38)
Kindly note the attachment, a small test java project, link:
dropbox.com/s/3787a3gsk2bwc26/test.tar.gz?dl=0
Kindly what am i doing wrong, i m sure that this code
Kindly would you please provide the correct way to do it, and add it to the tutorial example in the link https://github.com/owlcs/owlapi/blob/version5/contract/src/test/java/org/semanticweb/owlapi/examples/Examples.java
Thanks very much for your time.
Sincere regards
You are very near to the solution:
final OWLOntologyManager manager = OWLManager.createOWLOntologyManager();
final OWLOntology ontology = manager.loadOntologyFromOntologyDocument(new File("/home/galigator/myLocalDir/aura.owl"));
Just use new File instead of IRI.create
The reason of the problem was:
The previous versions that i was using:
I was using Hermit version 1.3.8.500 and OWL-API previous version 5.0.5 got modified it seems.
Solution: use the newer versions Hermit 1.3.8.510 and OWL-API 5.1.0.
I posted this answer in case someone else is using the previous version and got affected.
Sincere regards.

How do I get mongoid's eager loading to work?

I get the following error:
NoMethodError (undefined method `eager_load' for nil:NilClass)
when I run the following command in Mongoid 2.2.1
Person.includes(:game).all.each do
user.game.dosomething
end
a Person has_one Game
Just turn on Identity Map: http://mongoid.org/en/mongoid/docs/identity_map.html
Try add this to your Gemfile
# gem "mongoid-eager-loading"
But note that it's deprecated in newer mongoid versions

Rails 3, sqlserver, using set_primary_key, and inability to find with a specific ID

I'm trying to port a Rails2 application over to Rails3 - this app provides a front-end to multiple databases, one of which is SQL Server 2005. The SQL Server 2005 database is legacy so I have to use set_table_name and set_primary_key as such:
class Project < ActiveRecord::Base
set_table_name "SpiraTest.TST_PROJECT"
set_primary_key "PROJECT_ID"
end
Firing up the console I can see
irb(main):002:0> Project.primary_key
=> "PROJECT_ID"
irb(main):003:0> Project.table_name
=> "SpiraTest.TST_PROJECT"
irb(main):004:0>
I can even use Project.find(:first), Project.find(:last), etc. and retrieve the data. What I can't do is find using an id, like this: Project.find(1). I get met with:
NoMethodError: undefined method `eq' for nil:NilClass
from /usr/lib/ruby/gems/1.8/gems/activesupport-3.0.9/lib/active_support/whiny_nil.rb:48:in `method_missing'
from /usr/lib/ruby/gems/1.8/gems/activerecord-3.0.9/lib/active_record/relation/finder_methods.rb:317:in `find_one'
from /usr/lib/ruby/gems/1.8/gems/activerecord-3.0.9/lib/active_record/relation/finder_methods.rb:292:in `find_with_ids'
from /usr/lib/ruby/gems/1.8/gems/activerecord-3.0.9/lib/active_record/relation/finder_methods.rb:107:in `find'
from /usr/lib/ruby/gems/1.8/gems/activerecord-3.0.9/lib/active_record/base.rb:444:in `__send__'
from /usr/lib/ruby/gems/1.8/gems/activerecord-3.0.9/lib/active_record/base.rb:444:in `find'
from (irb):4
irb(main):005:0>
I have been looking down through the finder_methods and can see where in the find_one method that
record = where(primary_key.eq(id)).first
'primary_key' is nil.
I'm at a loss on this - I'll continue to hunt and see what I find.
Gems being used for completeness:
gem 'rails', '3.0.9'
gem 'mysql2', '< 0.3'
gem 'activerecord-sqlserver-adapter'
gem 'mongrel'
gem 'psrutil'
gem 'net-ldap'
gem 'spreadsheet'
gem 'ruby-odbc'
Make sure to use set_primary_key and note, it is case sensitive.

Resources