How do I run JUnit 4.11 test cases with SBT? - junit

I have the following in build.sbt:
libraryDependencies += "com.novocode" % "junit-interface" % "0.10" % "test"
libraryDependencies += "junit" % "junit" % "4.11" % "test"
I noticed that junit-interface 0.10 depends on junit-dep 4.10. This makes it impossible to compile tests that use assertNotEquals which was introduced in junit 4.11.
How do I run JUnit 4.11 test cases with SBT?

I would do this:
libraryDependencies ++= Seq(
"junit" % "junit" % "4.11" % Test,
"com.novocode" % "junit-interface" % "0.11" % Test
exclude("junit", "junit-dep")
)
By excluding what we don't desire, it doesn't interfere. This doesn't depend on ordering.

Use junit-interface 0.11 to avoid the dependency on junit-dep:
libraryDependencies += "junit" % "junit" % "4.12" % "test"
libraryDependencies += "com.novocode" % "junit-interface" % "0.11" % "test"
UPDATE: junit-interface 0.11 makes this reliable by depending on junit rather than junit-dep.

Related

Octave: invalid call to a script

I am trying to call to a script, and I am getting an error message. Please help.
The following is what I am trying to run in Octave:
%%% May 23, 2016
%%% Potential Fields for Robot Path Planning
%
%
% Initially proposed for real-time collision avoidance [Khatib 1986].
% Hundreds of papers published on APF
% A potential field is a scalar function over the free space.
% To navigate, the robot applies a force proportional to the
% negated gradient of the potential field.
% A navigation function is an ideal potential field
clc
close all
clear
%% Defining environment variables
startPos = [5,5];
goalPos = [90, 95];
obs1Pos = [50, 50];
obsRad = 10;
goalR = 0.2; % The radius of the goal
goalS = 20; % The spread of attraction of the goal
obsS = 30; % The spread of repulsion of the obstacle
alpha = 0.8; % Strength of attraction
beta = 0.6; % Strength of repulsion
%% Carry out the Potential Field Math as follows:
u = zeros(100, 100);
v = zeros(100, 100);
testu = zeros(100, 100);
testv = zeros(100, 100);
for x = 1:1:100
for y = 1:1:100
[uG, vG] = GoalDelta(x, y, goalPos(1), goalPos(2), goalR, goalS, alpha);
[uO, vO] = ObsDelta(x, y, obs1Pos(2), obs1Pos(1), obsRad, obsS, beta);
xnet = uG + uO;
ynet = vG + vO;
vspeed = sqrt(xnet^2 + ynet^2);
theta = atan2(ynet,xnet);
u(x,y) = vspeed*cos(theta);
v(x,y) = vspeed*sin(theta);
% hold on
end
end
%%
[X,Y] = meshgrid(1:1:100,1:1:100);
figure
quiver(X, Y, u, v, 3)
%% Defining the grid
% Plotting the obstacles
circles(obs1Pos(1),obs1Pos(2),obsRad, 'facecolor','red')
axis square
hold on % Plotting start position
circles(startPos(1),startPos(2),2, 'facecolor','green')
hold on % Plotting goal position
circles(goalPos(1),goalPos(2),2, 'facecolor','yellow')
%% Priting of the path
currentPos = startPos;
x = 0;
while sqrt((goalPos(1)-currentPos(1))^2 + (goalPos(2)-currentPos(2))^2) > 1
tempPos = currentPos + [u(currentPos(1),currentPos(2)), v(currentPos(1),currentPos(2))]
currentPos = round(tempPos)
hold on
plot(currentPos(1),currentPos(2),'-o', 'MarkerFaceColor', 'black')
pause(0.5)
end
The following is the error message I am getting:
error: invalid call to script C:\Users\MyComputer\Downloads\circles.m
error: called from
circles
ECE8743_PotentialFields_Obstacle_1 at line 59 column 1
>>
Here is circles.m:
function [ h ] = circles(x,y,r,varargin)
% h = circles(x,y,r,varargin) plots circles of radius r at points x and y.
% x, y, and r can be scalars or N-D arrays.
%
% Chad Greene, March 2014. Updated August 2014.
% University of Texas Institute for Geophysics.
%
%% Syntax
% circles(x,y,r)
% circles(...,'points',numberOfPoints)
% circles(...,'rotation',degreesRotation)
% circles(...,'ColorProperty',ColorValue)
% circles(...,'LineProperty',LineValue)
% h = circles(...)
%
%% Description
%
% circles(x,y,r) plots circle(s) of radius or radii r centered at points given by
% x and y. Inputs x, y, and r may be any combination of scalar,
% vector, or 2D matrix, but dimensions of all nonscalar inputs must agree.
%
% circles(...,'points',numberOfPoints) allows specification of how many points to use
% for the outline of each circle. Default value is 1000, but this may be
% increased to increase plotting resolution. Or you may specify a small
% number (e.g. 4 to plot a square, 5 to plot a pentagon, etc.).
%
% circles(...,'rotation',degreesRotation) rotates the shape by a given
% degreesRotation, which can be a scalar or a matrix. This is useless for
% circles, but may be desired for polygons with a discernible number of corner points.
%
% circles(...,'ColorProperty',ColorValue) allows declaration of
% 'facecolor' or 'facealpha'
% as name-value pairs. Try declaring any fill property as name-value pairs.
%
% circles(...,'LineProperty',LineValue) allows declaration of 'edgecolor',
% 'linewidth', etc.
%
% h = circles(...) returns the handle(s) h of the plotted object(s).
%
%
%% EXAMPLES:
%
% Example 1:
% circles(5,10,3)
%
% % Example 2:
% x = 2:7;
% y = [5,15,12,25,3,18];
% r = [3 4 5 5 7 3];
% figure
% circles(x,y,r)
%
% % Example 3:
% figure
% circles(1:10,5,2)
%
% % Example 4:
% figure
% circles(5,15,1:5,'facecolor','none')
%
% % Example 5:
% figure
% circles(5,10,3,'facecolor','green')
%
% % Example 6:
% figure
% h = circles(5,10,3,'edgecolor',[.5 .2 .9])
%
% % Example 7:
% lat = repmat((10:-1:1)',1,10);
% lon = repmat(1:10,10,1);
% r = .4;
% figure
% h1 = circles(lon,lat,r,'linewidth',4,'edgecolor','m','facecolor',[.6 .4 .8]);
% hold on;
% h2 = circles(1:.5:10,((1:.5:10).^2)/10,.12,'edgecolor','k','facecolor','none');
% axis equal
%
% % Example 8: Circles have corners
% This script approximates circles with 1000 points. If all those points
% are too complex for your Pentium-II, you can reduce the number of points
% used to make each circle. If 1000 points is not high enough resolution,
% you can increase the number of points. Or if you'd like to draw
% triangles or squares, or pentagons, you can significantly reduce the
% number of points. Let's try drawing a stop sign:
%
% figure
% h = circles(1,1,10,'points',8,'color','red');
% axis equal
% % and we see that our stop sign needs to be rotated a little bit, so we'll
% % delete the one we drew and try again:
% delete(h)
% h = circles(1,1,10,'points',8,'color','red','rot',45/2);
% text(1,1,'STOP','fontname','helvetica CY',...
% 'horizontalalignment','center','fontsize',140,...
% 'color','w','fontweight','bold')
%
% figure
% circles([1 3 5],2,1,'points',4,'rot',[0 45 35])
%
%
% TIPS:
% 1. Include the name-value pair 'facecolor','none' to draw outlines
% (non-filled) circles.
%
% 2. Follow the circles command with axis equal to fix distorted circles.
%
% See also: fill, patch, and scatter.
%% Check inputs:
assert(isnumeric(x),'Input x must be numeric.')
assert(isnumeric(y),'Input y must be numeric.')
assert(isnumeric(r),'Input r must be numeric.')
if ~isscalar(x) && ~isscalar(y)
assert(numel(x)==numel(y),'If neither x nor y is a scalar, their dimensions must match.')
end
if ~isscalar(x) && ~isscalar(r)
assert(numel(x)==numel(r),'If neither x nor r is a scalar, their dimensions must match.')
end
if ~isscalar(r) && ~isscalar(y)
assert(numel(r)==numel(y),'If neither y nor r is a scalar, their dimensions must match.')
end
%% Parse inputs:
% Define number of points per circle:
tmp = strcmpi(varargin,'points')|strcmpi(varargin,'NOP')|strcmpi(varargin,'corners')|...
strncmpi(varargin,'vert',4);
if any(tmp)
NOP = varargin{find(tmp)+1};
tmp(find(tmp)+1)=1;
varargin = varargin(~tmp);
else
NOP = 1000; % 1000 points on periphery by default
end
% Define rotation
tmp = strncmpi(varargin,'rot',3);
if any(tmp)
rotation = varargin{find(tmp)+1};
assert(isnumeric(rotation)==1,'Rotation must be numeric.')
rotation = rotation*pi/180; % converts to radians
tmp(find(tmp)+1)=1;
varargin = varargin(~tmp);
else
rotation = 0; % no rotation by default.
end
% Be forgiving if the user enters "color" instead of "facecolor"
tmp = strcmpi(varargin,'color');
if any(tmp)
varargin{tmp} = 'facecolor';
end
%% Begin operations:
% Make inputs column vectors:
x = x(:);
y = y(:);
r = r(:);
rotation = rotation(:);
% Determine how many circles to plot:
numcircles = max([length(x) length(y) length(r) length(rotation)]);
% Create redundant arrays to make the plotting loop easy:
if length(x)<numcircles
x(1:numcircles) = x;
end
if length(y)<numcircles
y(1:numcircles) = y;
end
if length(r)<numcircles
r(1:numcircles) = r;
end
if length(rotation)<numcircles
rotation(1:numcircles) = rotation;
end
% Define an independent variable for drawing circle(s):
t = 2*pi/NOP*(1:NOP);
% Query original hold state:
holdState = ishold;
hold on;
% Preallocate object handle:
h = NaN(size(x));
% Plot circles singly:
for n = 1:numcircles
h(n) = fill(x(n)+r(n).*cos(t+rotation(n)), y(n)+r(n).*sin(t+rotation(n)),'',varargin{:});
end
% Return to original hold state:
if ~holdState
hold off
end
% Delete object handles if not requested by user:
if nargout==0
clear h
end
end
What am I doing wrong here? How do I correct this error? I am rather new to Octave and Matlab, so any help is greatly appreciated.
this is the first post after pasting the error so maybe it'll help anyone later:
in my case pasting the script into a function worked out!
function retval = name_of_script(parametres)
%your script
endfunction

How to configure transactor in doobie?

Recently I started learning doobie but I couldn't create a hikari transactor without error. I'm using mysql, Intellij-Idea.
This is my build.sbt file
name := "doobie"
version := "0.1"
//scalaVersion := "2.13.1"
scalacOptions += "-Ypartial-unification" // 2.11.9+
libraryDependencies ++= {
lazy val doobieVersion = "0.8.4"
Seq(
"org.tpolecat" %% "doobie-core" % doobieVersion,
"org.tpolecat" %% "doobie-h2" % doobieVersion,
"org.tpolecat" %% "doobie-hikari" % doobieVersion,
"org.tpolecat" %% "doobie-quill" % doobieVersion,
"org.tpolecat" %% "doobie-specs2" % doobieVersion,
"org.tpolecat" %% "doobie-scalatest" % doobieVersion % "test",
"mysql" % "mysql-connector-java" % "8.0.17",
"org.slf4j" % "slf4j-api" % "1.7.5",
"ch.qos.logback" % "logback-classic" % "1.0.9"
)
}
resolvers ++= Seq(
"Typesafe repository" at "http://repo.typesafe.com/typesafe/releases/"
)
This is my Connection.scala file
import cats.effect.IO
import com.zaxxer.hikari.{HikariConfig, HikariDataSource}
import doobie.hikari.HikariTransactor
trait Connection {
val config = new HikariConfig()
config.setJdbcUrl("jdbc:mysql://localhost:quill_demo")
config.setUsername("admin")
config.setPassword("password")
config.setMaximumPoolSize(5)
val transactor: IO[HikariTransactor[IO]] =
IO.pure(HikariTransactor.apply[IO](new HikariDataSource(config)))
}
The problem is in above file IO.pure(HikariTransactor.apply[IO](new HikariDataSource(config))) statement gives error. Here 3 of last closed braces gives 3 errors as below.
No implicit arguments of type: ContextShift[IO]
Unspecified value parameters: connectEC: ExecutionContext, transactEC: ExecutionContext
No implicits found for parameter evidence$2: ContextShift[IO]
All I want to know, How to do this correctly.
Try to add the following import and implicit
import scala.concurrent.ExecutionContext
implicit val cs = IO.contextShift(ExecutionContext.global)
After I change the versions of dependencies as follows, I could solve all errors.
name := "doobie"
version := "0.1"
//scalaVersion := "2.13.1"
scalacOptions += "-Ypartial-unification"
libraryDependencies ++= {
lazy val doobieVersion = "0.5.4"
Seq(
"org.tpolecat" %% "doobie-core" % doobieVersion,
"org.tpolecat" %% "doobie-h2" % doobieVersion,
"org.tpolecat" %% "doobie-hikari" % doobieVersion,
"org.tpolecat" %% "doobie-quill" % doobieVersion,
"org.tpolecat" %% "doobie-specs2" % doobieVersion,
"org.tpolecat" %% "doobie-scalatest" % doobieVersion % "test",
"mysql" % "mysql-connector-java" % "5.1.34",
"org.slf4j" % "slf4j-api" % "1.7.5",
"ch.qos.logback" % "logback-classic" % "1.0.9"
)
}
resolvers ++= Seq(
"Typesafe repository" at "http://repo.typesafe.com/typesafe/releases/"
)

Test if matrix object exists in TCL

I want to test if a tcl-matrix object exists. How can I do that?
Following code isn't working.
package require struct::matrix
# Test (now we expect 0)
info exists m
# Create the object
struct::matrix m
# Test again, now I expect 1, however it returns 0!!!
info exists m
Use info commands to test for the existence of a matrix object. info exists tests for the (non-)existence of variables.
% package req struct::matrix
2.0.3
% info commands m
% struct::matrix m
::m
% info commands m
m
Background
A matrix object is implemented as a Tcl command (an alias command, to be precise) plus per-matrix Tcl namespace (as storage).
Alternatively, but this depends to much on the current implementation, you may test for the existence of a so-named namespace:
% package req struct::matrix
2.0.3
% namespace exists m
0
% struct::matrix m
::m
% namespace exists m
1
Testing for the command will also keep working when a matrix object becomes re-implemented as a TclOO object, for instance.
With a bit of poking through the struct::matrix source code:
% package req struct::matrix
2.0.3
% set m [struct::matrix]
::matrix1
% expr {$m in [interp aliases]}
1
% string first MatrixProc [interp alias {} $m]
18
% proc is_matrix {name} {
expr {
$name in [interp aliases] &&
[string first MatrixProc [interp alias {} $name]] != -1
}
}
% is_matrix $m
1
If you use the struct::matrix m form, then instead of $m, use the fully qualified ::m
% struct::matrix m
::m
% is_matrix m
0
% is_matrix ::m
1

JSON4S error at extract[T]

i am using json4s to extract data according to case class but i am getting a "unknown error". My scala version is 2.10.2 and Json4S is 3.2.10
My code look like:
import org.json4s._
import org.json4s.jackson.JsonMethods._
implicit val formats = org.json4s.DefaultFormats
case class Person(name: String, age: Int)
class user{
def add(){
val json="""{"1":{"name":"user1", "age":16}}"""
print(parse(json).extract[Map[String,Person]])
}
}
Could any one suggest What i am missing here?
I tried based on the suggestion given here:
JSON4S unknown error
https://github.com/json4s/json4s/issues/125
But I still get following error:
java.lang.NoSuchMethodError: scala.collection.immutable.$colon$colon.hd$1()Ljava/lang/Object;
at org.json4s.MonadicJValue.$bslash(MonadicJValue.scala:18)
at org.json4s.Extraction$ClassInstanceBuilder$$anonfun$14.apply(Extraction.scala:463)
at org.json4s.Extraction$ClassInstanceBuilder$$anonfun$14.apply(Extraction.scala:463)
at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:245)
at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:245)
at scala.collection.mutable.ResizableArray$class.foreach(ResizableArray.scala:59)
at scala.collection.mutable.ArrayBuffer.foreach(ArrayBuffer.scala:48)
at scala.collection.TraversableLike$class.map(TraversableLike.scala:245)
at scala.collection.AbstractTraversable.map(Traversable.scala:104)
at org.json4s.Extraction$ClassInstanceBuilder.org$json4s$Extraction$ClassInstanceBuilder$$instantiate(Extraction.scala:451)
at org.json4s.Extraction$ClassInstanceBuilder$$anonfun$result$6.apply(Extraction.scala:491)
at org.json4s.Extraction$ClassInstanceBuilder$$anonfun$result$6.apply(Extraction.scala:488)
at org.json4s.Extraction$.org$json4s$Extraction$$customOrElse(Extraction.scala:500)
at org.json4s.Extraction$ClassInstanceBuilder.result(Extraction.scala:488)
at org.json4s.Extraction$.extract(Extraction.scala:332)
at org.json4s.Extraction$$anonfun$extract$5.apply(Extraction.scala:316)
at org.json4s.Extraction$$anonfun$extract$5.apply(Extraction.scala:316)
at scala.collection.immutable.List.map(List.scala:273)
at org.json4s.Extraction$.extract(Extraction.scala:316)
at org.json4s.Extraction$.extract(Extraction.scala:42)
at org.json4s.ExtractableJsonAstNode.extract(ExtractableJsonAstNode.scala:21)
at com.czechscala.blank.HttpMethods.parseJsonResponse(HttpMethods.scala:87)
at com.czechscala.blank.HttpMethods.getRequestFunction(HttpMethods.scala:184)
at com.czechscala.blank.Hello$$anonfun$sendParallelRequests$1$$anonfun$apply$mcVI$sp$1$$anonfun$apply$mcV$sp$1.apply$mcV$sp(Hello.scala:68)
at com.czechscala.blank.Hello$$anonfun$sendParallelRequests$1$$anonfun$apply$mcVI$sp$1$$anonfun$apply$mcV$sp$1.apply(Hello.scala:64)
at com.czechscala.blank.Hello$$anonfun$sendParallelRequests$1$$anonfun$apply$mcVI$sp$1$$anonfun$apply$mcV$sp$1.apply(Hello.scala:64)
at scala.concurrent.impl.ExecutionContextImpl$DefaultThreadFactory$$anon$2$$anon$4.block(ExecutionContextImpl.scala:48)
at scala.concurrent.forkjoin.ForkJoinPool.managedBlock(ForkJoinPool.java:3640)
at scala.concurrent.impl.ExecutionContextImpl$DefaultThreadFactory$$anon$2.blockOn(ExecutionContextImpl.scala:45)
at scala.concurrent.package$.blocking(package.scala:123)
at com.czechscala.blank.Hello$$anonfun$sendParallelRequests$1$$anonfun$apply$mcVI$sp$1.apply$mcV$sp(Hello.scala:64)
at com.czechscala.blank.Hello$$anonfun$sendParallelRequests$1$$anonfun$apply$mcVI$sp$1.apply(Hello.scala:64)
at com.czechscala.blank.Hello$$anonfun$sendParallelRequests$1$$anonfun$apply$mcVI$sp$1.apply(Hello.scala:64)
at scala.concurrent.impl.Future$PromiseCompletingRunnable.liftedTree1$1(Future.scala:24)
at scala.concurrent.impl.Future$PromiseCompletingRunnable.run(Future.scala:24)
at scala.concurrent.impl.ExecutionContextImpl$AdaptedForkJoinTask.exec(ExecutionContextImpl.scala:121)
at scala.concurrent.forkjoin.ForkJoinTask.doExec(ForkJoinTask.java:260)
at scala.concurrent.forkjoin.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1339)
at scala.concurrent.forkjoin.ForkJoinPool.runWorker(ForkJoinPool.java:1979)
at scala.concurrent.forkjoin.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:107)
java.lang.NoSuchMethodError: scala.collection.immutable.$colon$colon.hd$1()Ljava/lang/Object;
at org.json4s.MonadicJValue.$bslash(MonadicJValue.scala:18)
at org.json4s.Extraction$ClassInstanceBuilder$$anonfun$14.apply(Extraction.scala:463)
at org.json4s.Extraction$ClassInstanceBuilder$$anonfun$14.apply(Extraction.scala:463)
at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:245)
at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:245)
at scala.collection.mutable.ResizableArray$class.foreach(ResizableArray.scala:59)
at scala.collection.mutable.ArrayBuffer.foreach(ArrayBuffer.scala:48)
at scala.collection.TraversableLike$class.map(TraversableLike.scala:245)
at scala.collection.AbstractTraversable.map(Traversable.scala:104)
at org.json4s.Extraction$ClassInstanceBuilder.org$json4s$Extraction$ClassInstanceBuilder$$instantiate(Extraction.scala:451)
at org.json4s.Extraction$ClassInstanceBuilder$$anonfun$result$6.apply(Extraction.scala:491)
at org.json4s.Extraction$ClassInstanceBuilder$$anonfun$result$6.apply(Extraction.scala:488)
at org.json4s.Extraction$.org$json4s$Extraction$$customOrElse(Extraction.scala:500)
at org.json4s.Extraction$ClassInstanceBuilder.result(Extraction.scala:488)
at org.json4s.Extraction$.extract(Extraction.scala:332)
at org.json4s.Extraction$$anonfun$extract$5.apply(Extraction.scala:316)
at org.json4s.Extraction$$anonfun$extract$5.apply(Extraction.scala:316)
at scala.collection.immutable.List.map(List.scala:273)
at org.json4s.Extraction$.extract(Extraction.scala:316)
at org.json4s.Extraction$.extract(Extraction.scala:42)
at org.json4s.ExtractableJsonAstNode.extract(ExtractableJsonAstNode.scala:21)
at com.czechscala.blank.HttpMethods.parseJsonResponse(HttpMethods.scala:87)
at com.czechscala.blank.HttpMethods.getRequestFunction(HttpMethods.scala:184)
at com.czechscala.blank.Hello$$anonfun$sendParallelRequests$1$$anonfun$apply$mcVI$sp$1$$anonfun$apply$mcV$sp$1.apply$mcV$sp(Hello.scala:68)
at com.czechscala.blank.Hello$$anonfun$sendParallelRequests$1$$anonfun$apply$mcVI$sp$1$$anonfun$apply$mcV$sp$1.apply(Hello.scala:64)
at com.czechscala.blank.Hello$$anonfun$sendParallelRequests$1$$anonfun$apply$mcVI$sp$1$$anonfun$apply$mcV$sp$1.apply(Hello.scala:64)
at scala.concurrent.impl.ExecutionContextImpl$DefaultThreadFactory$$anon$2$$anon$4.block(ExecutionContextImpl.scala:48)
at scala.concurrent.forkjoin.ForkJoinPool.managedBlock(ForkJoinPool.java:3640)
at scala.concurrent.impl.ExecutionContextImpl$DefaultThreadFactory$$anon$2.blockOn(ExecutionContextImpl.scala:45)
at scala.concurrent.package$.blocking(package.scala:123)
at com.czechscala.blank.Hello$$anonfun$sendParallelRequests$1$$anonfun$apply$mcVI$sp$1.apply$mcV$sp(Hello.scala:64)
at com.czechscala.blank.Hello$$anonfun$sendParallelRequests$1$$anonfun$apply$mcVI$sp$1.apply(Hello.scala:64)
at com.czechscala.blank.Hello$$anonfun$sendParallelRequests$1$$anonfun$apply$mcVI$sp$1.apply(Hello.scala:64)
at scala.concurrent.impl.Future$PromiseCompletingRunnable.liftedTree1$1(Future.scala:24)
at scala.concurrent.impl.Future$PromiseCompletingRunnable.run(Future.scala:24)
at scala.concurrent.impl.ExecutionContextImpl$AdaptedForkJoinTask.exec(ExecutionContextImpl.scala:121)
at scala.concurrent.forkjoin.ForkJoinTask.doExec(ForkJoinTask.java:260)
at scala.concurrent.forkjoin.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1339)
at scala.concurrent.forkjoin.ForkJoinPool.runWorker(ForkJoinPool.java:1979)
at scala.concurrent.forkjoin.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:107)
My build.sbt:
name := "blank"
version := "1.0-SNAPSHOT"
scalaVersion := "2.10.2"
libraryDependencies ++= Seq (
"org.scalatest" % "scalatest_2.10" % "1.9.1" % "test"
)
libraryDependencies ++= Seq(
"com.typesafe.akka" %% "akka-actor" % "2.1.2"
)
libraryDependencies ++= Seq(
"net.databinder" %% "dispatch" % "0.8.10"
)
libraryDependencies ++= Seq(
"org.scala-lang" % "scala-actors" % "2.10.2"
)
libraryDependencies ++= Seq(
"net.databinder" %% "dispatch-core" % "0.8.10"
)
libraryDependencies ++= Seq(
"net.databinder" %% "dispatch-futures" % "0.8.10"
)
libraryDependencies ++= Seq(
"net.databinder" %% "dispatch-nio" % "0.8.10"
)
libraryDependencies ++= Seq(
"org.slf4j" % "slf4j-api" % "1.6.4",
"org.slf4j" % "slf4j-simple" % "1.6.4"
)
libraryDependencies ++= Seq(
"org.json4s" %% "json4s-core" % "3.2.10",
"org.json4s" %% "json4s-native" % "3.2.10",
"org.json4s" %% "json4s-jackson" % "3.2.10",
"net.databinder" %% "unfiltered-netty" % "0.8.0" % "test",
"net.databinder.dispatch" % "dispatch-json4s-native_2.11" % "0.11.1"
)
libraryDependencies ++= Seq(
"io.argonaut" %% "argonaut" % "6.0.4"
)
initialCommands := "import dispatch._"
This modified json is working for me
val json="""{"1":{"name":"user1", "age":16}}"""
age is in quotes and taking quotes for 16. age is defined as int.
When I replicated your build.sbt, it seems there is two conflicting version of json4s related libraiers are getting loaded. One version mentioned here for the
"org.json4s" %% "json4s-core" % "3.2.10",
"org.json4s" %% "json4s-native" % "3.2.10",
"org.json4s" %% "json4s-jackson" % "3.2.10",
And the other version mentioned from this line
"net.databinder.dispatch" ...... "..._2.11",
which is pulling the json4s for the scala 2.11 version.
Changing the netbinder version from "_2.11" to "_2.10" seems to be building fine.

Undefined function 'times' for input arguments of type 'cell'

I'm using matlab to plot this code which should plot Theta ( dimensionless temperature at different times(t) ), when I try to run it I get this error "Undefined function 'times' for input arguments of type 'cell'"
t=1:1:5;
alfa=(1.172.*(10.^(-2))); ......
% alfa for steel with 1% carbon = 1.172*10^-2 m^2/s%
L=1;
T={(alfa.*t)./(L.^2)}; % dimensionless time equation %
lambda1=0.3111; % # biot =0.1 %
A1=1.0161; % # biot =0.1 %
theta={A1.*exp(-(lambda1.^2).*T)}; % dimensionless Temperature equation %
plot(t,theta,'.');
I'm still a beginner in matlab & programming in general.
For some reason you're using cell arrays at line 5 and 8 (the curly braces {}). Just remove them and your code will plot...
Regards