Slick 3.0.0 and Scala 2.10.4 - slick-3.0

I was trying to create a scala program with slick 3.0 and I am getting the following error:
Error:scalac: bad symbolic reference. A signature in BasicDriver.class refers to term typesafe
in package com which is not available.
It may be completely missing from the current classpath, or the version on
the classpath might be incompatible with the version used when compiling BasicDriver.class.
I am using scala 2.10.4 and slick 2.10-3.0.0-RC1 and my IDE is IDEA 14.0.3 community edition
Any clue about this compilation error will be appreciated.
Thanks a lot!!!

This is how a BasicDriver.class defintion looks like
package scala.slick.profile
trait BasicDriver extends scala.AnyRef with scala.slick.profile.BasicProfile {
val profile : scala.slick.profile.BasicProfile = { /* compiled code */ }
override def toString() : java.lang.String = { /* compiled code */ }
final val driverConfig : com.typesafe.config.Config = { /* compiled code */ }
protected[this] def loadDriverConfig : com.typesafe.config.Config = { /* compiled code */ }
}
The error :
Error:scalac: bad symbolic reference. A signature in BasicDriver.class refers to term typesafe in package com which is not available. It may be completely missing from the current classpath, or the version on the classpath might be incompatible with the version used when compiling BasicDriver.class
is saying that com.typesafe for (com.typesafe.config.Config) is missing from the classpath .
I think the problem is with the dependencies added , try the master snapshot :
"com.typesafe.slick" % "slick_2.10" % "3.0.0-M1"

Related

libvpx "Codec does not implement requested capability" (decoder)

I'm currently facing an issue on a project using libvpx v1.10.0 ( https://github.com/webmproject/libvpx/releases ).
I have successfully built the library for Visual Studio 16 on Windows 10 (PC x64).[I must build libvpx by my own since I need it to run on a Windows 10 ARM64 / VS16 as well (Hololens 2) and a such build is not officially provided]
I've made a C++ DLL that uses the static libs from libvpx (to be used as a native plugin in Unity).
While the VP9 encoding part seems to work correctly in a sample app using my DLL, I cannot initialize the VP9 decoder. Maybe I am missing something in the configuration step of libvpx?
To build the libvpx static libraries, I have launched MSYS2 from the x64 Native Tools Command Prompt of Visual Studio 2019.
Then, I have set the configuration as follows, inspired by what we can find in an ArchLinux AUR package ( https://aur.archlinux.org/cgit/aur.git/tree/PKGBUILD?h=libvpx-git ):
./configure --target=x86_64-win64-vs16 --enable-libyuv \
--enable-vp8 --enable-vp9 --enable-postproc --enable-vp9-postproc \
--enable-vp9-highbitdepth --enable-vp9-temporal-denoising
make -j
At the end of the compilation, the build succeeds with 0 error but 2 warnings. The --help of the configure scripts indicates that the --enable-vp9 option enables both the VP9 encoder and decoder.
Then, when I run my app using the C++ DLL that performs the encoding and decoding stuff, I get this error message from libvpx:
Codec does not implement requested capability .
It occurs when I call the vpx_codec_dec_init() function. I don't understand why it cannot be initialized as I think that the VP9 codec is fully built. The error appears as well when I add the --enable-vp9-encoder and --enable-vp9-decoder` options and all other VP9 related options to the configuration.
Is there something to do in the code itself before initializing the VP9 decoder? I have not seen a such thing in the samples of code. Notice that the problem occurs if I use VP8 as well (encoding OK / decoding KO, same error).
Here is the beginning of my function for decoding a frame:
vpx_codec_err_t resultError;
vpx_codec_ctx_t codec;
const vpx_codec_iface_t* decoderInterface = vpx_codec_vp9_cx(); // >>> OK!
if (!decoderInterface)
{
return "libvpx: unsupported codec (decoder)";
}
resultError = vpx_codec_dec_init(&codec, decoderInterface, nullptr, 0); // >>> KO...
if (resultError)
{
std::cout << vpx_codec_error(&codec) << std::endl; // outputs "Codec does not implement requested capability"
return "libvpx: failed to initialize decoder";
}
vpx_codec_iter_t iter = nullptr;
vpx_image_t* yuvFrame = nullptr;
resultError = vpx_codec_decode(&codec, compressedFrame, (unsigned int)compressedFrameSize, nullptr, 0);
if (resultError)
{
return "libvpx: failed to decode frame";
}
// ....
Any help would be great! Thank you. :)
OK, I've figured it out! :)
The line:
const vpx_codec_iface_t* decoderInterface = vpx_codec_vp9_cx();
must be replaced by (+ #include <vpx/vp8dx.h>):
const vpx_codec_iface_t* decoderInterface = vpx_codec_vp9_dx();
The reason I have made this error is due to a previous experience in encoding/decoding videos. I've developed a webcam streaming app using the H.264 codec, which needs a set up "context" structure. So, because of the name of the vpx_codec_vp9_cx() function, I've thought it was creating a such context for VP9. In fact, cx matches for encoding and dx for decoding... Not really obvious though. I don't like this kind of function names.
Anyway, I hope it will help anybody in a same situation. ;)

Unable to run D program on mac system when using dependency

I am pretty new to D language. I am working on existing code developed by others. Previous developers were using linux environment to build and run the D Application.
I am trying to do the same in MAC as it is my local environment.
Here is how my jub.json file looks like
{
"name" : "dsmasher",
"description" : "Hello World - A minimal DUB bundle.",
"dependencies" : {
"d2sqlite3": "~>0.9.7",
"botan": "~>1.12.9"
}
}
The program is very simple
import std.stdio;
int main () {
return 0;
}
But when I build it throws following errors.
/Library/D/dmd/src/druntime/import/object.d(3440,23): Error: template memutils.refcounted.RefCounted!(X509CertificateImpl, ThreadMem).RefCounted.opCast does not match any template declaration
/Library/D/dmd/src/druntime/import/object.d(3440,49): Error: template memutils.refcounted.RefCounted!(X509CertificateImpl, ThreadMem).RefCounted.opCast does not match any template declaration
/Library/D/dmd/src/druntime/import/object.d(3441,39): Error: template memutils.refcounted.RefCounted!(X509CertificateImpl, ThreadMem).RefCounted.opCast does not match any template declaration
../../../.dub/packages/memutils-0.4.9/memutils/source/memutils/vector.d(790,10): Error: template instance object.__equals!(const(RefCounted!(X509CertificateImpl, ThreadMem)), const(RefCounted!(X509CertificateImpl, ThreadMem))) error instantiating
../../../.dub/packages/memutils-0.4.9/memutils/source/memutils/helpers.d(71,27): instantiated from here: opEquals!()
../../../.dub/packages/botan-1.12.9/botan/source/botan/tls/server.d(689,38): instantiated from here: opEquals!(RefCounted!(Vector!(RefCounted!(X509CertificateImpl, ThreadMem), ThreadMem), ThreadMem))
/Library/D/dmd/bin/dmd failed with exit code 1.
^^^ Terminated, exit code: 2 ^^^
************ Build terminated. ************
I am using dmd compiler for this.
Please help if you have any idea.
This appears to be a bug in Botan. According to Travis CI, their build fails with the same message.

google protobuf compiler doesn't generate class for service tag?

I'm trying to use protobuf to generate a service using RpcChannel and RpcController. I referred to language guide of google protobuf and:
I've got sample proto file like this:
syntax = "proto2";
message SearchRequest
{
required string Request = 1;
}
message SearchResponse
{
required string Response = 2;
}
service SearchService {
rpc Search (SearchRequest) returns (SearchResponse);
}
Then I compiled it with:
protoc --cpp_out=./ examples.proto
I got .h and .cc files. But when I search the generated code, I only found classes for "Request" and "Response", but not a class for "SearchService":
examples.pb.h:class SearchRequest;
examples.pb.h:class SearchResponse;
examples.pb.h:class SearchRequest : public ::google::protobuf::Message {
examples.pb.h: // ##protoc_insertion_point(class_scope:SearchRequest)
examples.pb.h:class SearchResponse : public ::google::protobuf::Message {
examples.pb.h: // ##protoc_insertion_point(class_scope:SearchResponse)
The language guide web-page provided an example(https://developers.google.com/protocol-buffers/docs/proto#services) which requires to use class of "SearchService": but in the generated code, there's no search service. The guide didn't provide a complete sample of RpcChannel/RpcController usages.
So how can I fix the example to make it work? I searched google but didn't find any good cpp example that gives a complete sample of how RpcChannel/RpcController could work. Any hints or links?
Thanks!
protobuf does not offer RPC implementation by itself; you should use plugin interface to create your own, or use grpc.
For example, grpc uses grpc_cpp_plugin plugin for it.
$ protoc -I ../../protos --grpc_out=. --plugin=protoc-gen-grpc=`which grpc_cpp_plugin` ../../protos/route_guide.proto
https://github.com/grpc/grpc/blob/master/examples/cpp/cpptutorial.md

Writing custom checkers for Clang Static Analyzer

I've just finished following the "Getting Started" instructions from the clang analyzer page.
My XCode is currently using the checker build 278
Right now I'm trying to follow some guides I can find to write my own custom checkers like
http://blog.trailofbits.com/2014/04/27/using-static-analysis-and-clang-to-find-heartbleed/
http://bbannier.github.io/blog/2015/05/02/Writing-a-basic-clang-static-analysis-check.html
Was hoping that someone can point me in the right direction and I'm not very familiar with building clang projects.
Are there any IDE available that would help?
How should I add the custom checker I wrote to the build 278?
I have recently started using clang checker's and here's how I got my custom checker to work with clang.
You have to modify the Checkers.td to register your checker.
<path-to-llvm>/llvm/tools/clang/lib/StaticAnalyzer/Checkers/Checkers.td
I made a debug checker to I put it under debug group and added these lines:
def MyCustomChecker : Checker<"DebugUsingMyChecker">,
HelpText<"Print results of my custom checker">,
DescFile<"DebugCheckers.cpp">; //this is the file where we define the class file of our checker
Then edit the DebugCheckers.cpp to add your checker's class to be invoked by the newly registered checker.
<path-to-llvm>/llvm/tools/clang/lib/StaticAnalyzer/Checkers/DebugCheckers.cpp
And add under debug checkers tag
namespace
{
class MyCustomChecker : public Checker<check::ASTCodeBody> {
public:
void checkASTCodeBody(const Decl *D, AnalysisManager& mgr,
BugReporter &BR) const {
if (MyCustomChecker* CC = mgr.getAnalysis<CustomChecker>(D)) {
CC->dump(mgr.getSourceManager());
}
}
};
}
void ento::registerMyCustomChecker(CheckerManager &mgr) {
mgr.registerChecker<MyCustomChecker>();
}
After this, you can place the relevant class files in the folder:
<path-to-llvm>/llvm/tools/clang/lib/Analysis/
And edit the CMakeList.txt in that folder to include your class file.
Hope that clarifies the process. You can also read this link for more: http://clang-analyzer.llvm.org/checker_dev_manual.html
As far as IDE's are concerned, you can use any IDE which supports's CMake based projects (like CLion). You can look at this link for more: http://llvm.org/docs/CMake.html

Using Reflection Causing MissingMethodException in Xamarin UITest

I have a class in my Xamarin PCL which makes a call to System.Reflection.GetRuntimeProperties. For an example, let's say my PCL class has this method:
public string ExampleMethod(string arg) {
if(arg == null) return null;
IEnumerable<PropertyInfo> infos = this.GetType().GetRuntimeProperties();
return infos[0].Name;
}
I then have a Xamarin.UITest project which references the PCL project and tests this class. I have two test cases in my TestFixture so far, which for our example would be the following:
[Test]
public void TestExampleMethod_ArgNull_Null(){
Assert.That (exampleInstance.ExampleMethod(null), Is.Null);
}
[Test]
public void TestExampleMethod_ArgNotNull_NotNull(){
Assert.That (exampleInstance.ExampleMethod("testValue"), Is.NotNull);
}
When I run the Xamarin.UITest project, it compiles, runs the tests, and completes fine on both Android and iOS platforms. The TestExampleMethod_ArgNull_Null test passes since it returns early. However, the TestExampleMethod_ArgNotNull_NotNull test fails with:
System.MissingMethodException : Method 'RuntimeReflectionExtensions.GetRuntimeProperties' not found.
So it appears that even though everything is compiling just fine, and I am able to run other test cases fine, the Xamarin.UITest project is not able to use anything in System.Reflection. Does anyone know how I go about debugging this?
On my end, using the following failed to build:
IEnumerable<PropertyInfo> infos = this.GetType().GetRuntimeProperties();
return infos[0].Name;
due to not being able to do bracket indexes on and IEnumerable. I changed to this:
List<PropertyInfo> infos = this.GetType().GetRuntimeProperties().ToList();
return infos[0].Name;
And the project built and the tests ran successfully.
The class with the method using Reflection was in a PCL which was referenced from a UI Test project.
So basically I am not able to reproduce the error you got.
I posted this to Xamarin Support as well (thanks #jgoldberger) and we were able to figure out that it was due to a project setup issue. This is a project which uses Couchbase Lite which requires a specific version of Json.Net (6.0.4 as of this post). I must have accidentally updated the packages on some of the projects since the same version of Json.Net was not being used across all the projects (PCL, Android, iOS, and UITest). I ended up re-creating the project from scratch and that took care of it.