I downloaded the chisel-tutorial which is offered on the website of usb-bar.
In order to do practise I created a scala file named as "Regfile.scala" under the path:
"chisel-tutorial/src/main/scala/solutions/Regfile.scala".
The Test-file is stored under the path :
"chisel-tutorial/src/test/scala/solutions/RegfileTests.scala".
While running the sbt I was reported
(after execution of command "test:run-main solutions.Launcher Regfile"):
"Errors: 1: in the following tutorials
Bad tutorial name: Regfile "
How can I solve this problem?
You have to add your Regfile to Launcher.scala. The launcher is available in directory :
src/test/scala/solutions/Launcher.scala
I think you can add somethings like this to Launch.scala to test your Regfile:
"Regfile" -> { (backendName: String) =>
Driver(() => new Regfile(), backendName) {
(c) => new RegfileTests(c)
}
},
Related
All, I hope this question belongs here.
I am following a Blockgeeks tutorial, trying to set up my environment for Ethereum blockchain development. I have basically gotten to the final step, installing swarm, but I am receiving an error that seems to be related to the structure of a folder on github. How should I fix this?
Handy info:
-OS: Windows 10, running this project within cygwin with proper gcc dependencies installed
-Go version: 1.11.4
I have tried to find a solution for days now, but nothing I've found has worked. Any help is appreciated.
Basically, everyone says these steps work for them: https://swarm-guide.readthedocs.io/en/latest/installation.html#generic-linux
Maybe it's something with cygwin?
When I attempt this command: $ go install -v ./cmd/swarm
I expect it to install properly, but i get this error:
unexpected directory layout:
import path: github.com/naoina/toml
root: C:\cygwin64\home\di203179\go\src
dir: C:\cygwin64\home\di203179\go\src\github.com\ethereum\go-ethereum\vendor\github.com\naoina\toml
expand root: C:\cygwin64\home\di203179\go\src
expand dir: C:\cygwin64\home\di203179\go\src\github.com\ethereum\go-ethereum\vendor\github.com\naoina\toml
separator: \
Any help is appreciated.
Update:
I think I found the code that throws this error here: https://golang.org/src/cmd/go/internal/load/pkg.go
And here is the snippet:
// dirAndRoot returns the source directory and workspace root
// for the package p, guaranteeing that root is a path prefix of dir.
func dirAndRoot(p *Package) (dir, root string) {
dir = filepath.Clean(p.Dir)
root = filepath.Join(p.Root, "src")
if !str.HasFilePathPrefix(dir, root) || p.ImportPath != "command-line-arguments" && filepath.Join(root, p.ImportPath) != dir {
// Look for symlinks before reporting error.
dir = expandPath(dir)
root = expandPath(root)
}
if !str.HasFilePathPrefix(dir, root) || len(dir) <= len(root) || dir[len(root)] != filepath.Separator || p.ImportPath != "command-line-arguments" && !p.Internal.Local && filepath.Join(root, p.ImportPath) != dir {
base.Fatalf("unexpected directory layout:\n"+
" import path: %s\n"+
" root: %s\n"+
" dir: %s\n"+
" expand root: %s\n"+
" expand dir: %s\n"+
" separator: %s",
p.ImportPath,
filepath.Join(p.Root, "src"),
filepath.Clean(p.Dir),
root,
dir,
string(filepath.Separator))
}
return dir, root
}
It seems there are several path-related issues that could make a Go project throw this error. But I feel my path is correct, so I'm still at a loss...
Upddate 2:
I have confirmed that the first if-statement from that snippet is running, and the first three conditions of the second if statement resolve to false (meaning they are not the cause of the error), so that means the last condition that is composed of multiple AND statements must be returning true since the error is throwing. Still can't tell why, though. Thanks for any help.
I have application developed using Grails 2.5.
In the the "Config.groovy" file i have included external configuration file like this:
grails.config.locations = []
def locationAdder = ConfigFinder.&addLocation.curry(grails.config.locations)
[CONFIG-1 : "base_config.groovy",
CONFIG-2 : "app_configuration.groovy"
].each { envName, defaultFileName -> locationAdder(envName, defaultFileName) }
In the "app_configuration.groovy" file i have all the application level configuration.
My question is how to catch the "syntax errors" when server is loading this configuration files, like ex.:
if i have configuration like
some_configuration=["key": "value"]
and if it has an syntax errors like
some_configuration=["key": "value
Notice that above it missed double quote and ending bracket, in this case the server will not load all the configurations.
If any one know that how to catch exception and reload the configurations with corrected configuration.
You can not catch Exception in external config. You may just add some log which in case of failure, at least have got some clue where it is failed.
println "External config: Part 1 loaded "
println "External Config: Part n loaded "
....
Already seen many topics here but none of the pointed solutions worked.
When optimizing my project, R.js is failing to handle this json! plugin dependency on one of my modules.
Error message:
Tracing dependencies for: app/productApp
TypeError: errback is not a function
In module tree:
app/productApp
blah
json
My r.js build config file:
define([
'productApp',
'json!blah'
], function(...){...}
and here is my r.js config file:
({
name: 'app/productApp',
out: '../app.js',
optimize: 'uglify2',
findNestedDependencies: true,
inlineJSON: false,
inlineText: false,
exclude: [ 'json!blah' ]
)}
I've already tried all possible ways, such as an exclude on the r.js config file, or and adding '!bust' at the end of the dependency list, but no luck.
Require.js / R.js version: 2.2.0
One detail: I'm running r.js through node package.json script, triggered by maven.
Thoughts?
Found the solution. It turns out that the paths to the json and text libraries were missing from require config file. (it can't be just made 'empty:' within r.js build config file).
This then would fix the issue:
...
paths: {
'text': 'lib/text',
'json': 'lib/json',
...
},
exclude: {
'json!blah'
}
I'm running logstash like it saids in the starting page:
java -jar logstash-1.2.1-flatjar.jar agent --config logstash-dev.conf
With logstash-dev.conf like this:
input {
file {
path => ["/tmp/catalina.jsonevent.log"]
codec => json {
charset => "UTF-8"
}
}
}
output {
# Use stdout in debug mode again to see what logstash makes of the event.
stdout {
debug => true
}
elasticsearch_http {
host => "127.0.0.1"
}
}
And it jumps with this error:
Exception in thread "LogStash::Runner" org.jruby.exceptions.RaiseException: (StoreError) loading file failed: problem creating X509 Aux certificate: java.io.IOException: problem parsing cert: java.security.cert.CertificateParsingException: java.io.IOException: Duplicate extensions not allowed
at org.jruby.ext.openssl.X509Store.add_file(org/jruby/ext/openssl/X509Store.java:151)
at RUBY.initialize(file:/usr/local/bin/logstash/logstash-1.2.1-flatjar.jar!/ftw/agent.rb:70)
at RUBY.register(file:/usr/local/bin/logstash/logstash-1.2.1-flatjar.jar!/logstash/outputs/elasticsearch_http.rb:46)
at org.jruby.RubyArray.each(org/jruby/RubyArray.java:1617)
at RUBY.outputworker(file:/usr/local/bin/logstash/logstash-1.2.1-flatjar.jar!/logstash/pipeline.rb:208)
at RUBY.start_outputs(file:/usr/local/bin/logstash/logstash-1.2.1-flatjar.jar!/logstash/pipeline.rb:140)
I've looking everywhere (google, mail groups of logstash and jruby, and the same with their ircs) but I don't find a way to solve this. I only see similar stacktraces but no solution.
Can you give me any pointer in address this?
thanks in advance
We've been looking for this as well and this fixed it for us:
curl http://curl.haxx.se/ca/cacert.pem -o /usr/local/etc/openssl/cert.pem
Please give me some lights about what I'm doing wrong here. First of all I'm newbie with Gradle and Groovy and for learning purposes I'm playing with them and DBUnit.
I tried the code listed below, my goal is to generate a dataset getting the data from a mysql db.
import groovy.sql.Sql
import org.dbunit.database.DatabaseConnection;
import org.dbunit.database.IDatabaseConnection;
import org.dbunit.dataset.IDataSet;
import org.dbunit.dataset.xml.FlatXmlDataSet;
repositories {
mavenCentral()
}
configurations {
dbunit
}
dependencies {
dbunit 'dbunit:dbunit:2.2',
'junit:junit:4.11',
'mysql:mysql-connector-java:5.1.25'
}
URLClassLoader loader = GroovyObject.class.classLoader
configurations.dbunit.each { File file -> loader.addURL(file.toURL()) }
task listJars << {
configurations.dbunit.each { File file -> println file.name }
}
task listTables << {
getConnection("mydb").eachRow('show tables') { row -> println row[0] }
}
task generateDataSet << {
def IDatabaseConnection conn = new DatabaseConnection(getConnection("mydb").connection)
def IDataSet fullDataSet = conn.createDataSet()
FlatXmlDataSet.write(fullDataSet, new FileOutputStream("full.xml"))
}
static Sql getConnection(db) {
def props = [user: 'dbuser', password: 'userpass', allowMultiQueries: 'true'] as Properties
def url = (db) ? 'jdbc:mysql://host:3306/'.plus(db) : 'jdbc:mysql://host:3306/'
def driver = 'com.mysql.jdbc.Driver'
Sql.newInstance(url, props, driver)
}
What is weird to me is that all MySQL methods work well, I can get the list of tables and for instance the connection was done well so the mysql-connector-java.jar is being loaded (I think), but when I add the DBUnit stuff (import libs and the generateDataSet method) it seems the dbunit jar is not available for the script, I got the following errors:
FAILURE: Build failed with an exception.
* Where:
Build file '/home/me/tmp/dbunit/build.gradle' line: 5
* What went wrong:
Could not compile build file '/home/me/tmp/dbunit/build.gradle'.
> startup failed:
build file '/home/me/tmp/dbunit/build.gradle': 5: unable to resolve class org.dbunit.dataset.xml.FlatXmlDataSet
# line 5, column 1.
import org.dbunit.dataset.xml.FlatXmlDataSet;
^
build file '/home/me/tmp/dbunit/build.gradle': 2: unable to resolve class org.dbunit.database.DatabaseConnection
# line 2, column 1.
import org.dbunit.database.DatabaseConnection;
^
build file '/home/me/tmp/dbunit/build.gradle': 3: unable to resolve class org.dbunit.database.IDatabaseConnection
# line 3, column 1.
import org.dbunit.database.IDatabaseConnection;
^
build file '/home/me/tmp/dbunit/build.gradle': 4: unable to resolve class org.dbunit.dataset.IDataSet
# line 4, column 1.
import org.dbunit.dataset.IDataSet;
^
4 errors
But if I call the listJars task, I got this:
:listJars
junit-4.11.jar
mysql-connector-java-5.1.25.jar
hamcrest-core-1.3.jar
xercesImpl-2.6.2.jar
xmlParserAPIs-2.6.2.jar
junit-addons-1.4.jar
poi-2.5.1-final-20040804.jar
commons-collections-3.1.jar
commons-lang-2.1.jar
commons-logging-1.0.4.jar
dbunit-2.2.jar
BUILD SUCCESSFUL
Which in my understanding means all those jars were loaded and are available for the script, am I right? or am I doing something wrong with the class loader stuff?
Thanks very much.
The GroovyObject.class.classLoader.addURL hack is not the right way to add a dependency to the build script class path. It's just sometimes necessary to get JDBC drivers to work with Groovy (long story). Here is how you add a dependency to the build script class path:
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath "some:library:1.0"
}
}
// library can be used in the rest of the build script
You can learn more about this in the Gradle User Guide.