dLibs - OpenKinect - jna

Recently I got interested in dLibs, the Java wrapper for OpenKinect.
But I have difficulties in running the codes in eclipse; I've added the libraries based on what I think.
How to run the codes, say the example .pde files?
I've written sth like this to see how it works...
public class Test {
public static void main(String[] args) {
Kinect.loadLibrary( "C:/Users/admin/Dropbox/new_workspace/dLibs/", "freenect.dll" );
Kinect k= new Kinect(0);
System.out.println(k.isReady());
}
}
==========
But I get this error:
#_KINECT_ERROR___#
location: dLibs.freenect.FreenectLibrary.loadLibrary(FreenectLibrary.java:177)
message: Unable to load library : freenect.dll
message: path = "C:\Users\admin\Dropbox\new_workspace\dLibs/freenect.dll"
message: try 'MyKinect.loadLibrary( "your dll path/", "freenect.dll" )'
which the 177 line of the FreenectLibrary is about the loadLibrary(...) method.
Can anyone please help me with that?

I was running the same issue. Make sure you use the 64bit dll file. Also make sure about the path is correct, and the use of / !

Related

StackExchange.Redis.IDatabase exists in two dlls

I installed Redis StackExchange nuget and things worked fine. But then I installed RedisSessionStateProvider nuget, which installed StackExchange.Redis.StrongName along with it.
Now I am getting the following error,
Error 107 The type 'StackExchange.Redis.IDatabase' exists in both
'e:\Source\packages\StackExchange.Redis.1.0.481\lib\net45\StackExchange.Redis.dll'
and
'e:\Source\packages\StackExchange.Redis.StrongName.1.0.481\lib\net45\StackExchange.Redis.StrongName.dll' E:\Source\MyApp\Helpers\RedisHelper\StackExchangeRedisExtensions.cs 13 37 MyApp
Why is this?
There's a lot of confusion between the strong-named dll and the non-strong-named dll namespaces.
You can easily solve this by using extern alias.
Right click on project references and pick the dll you want to refer, go to properties window. Then, change the Aliases field value to anything you want. E.g: "Redis".
Then go to your consumer source-file and add:
extern alias Redis;
using System;
// ... other references
using Redis::StackExchange.Redis;
namespace Foo
{
public class Program
{
public static void Main(string[] args)
{
using (ConnectionMultiplexer connection = ConnectionMultiplexer.Connect("myConn"))
{
// use StackExchange API here.
}
}
}
}
There's also an issue on StackExchange's repository explaining more about StrongName vs Non-StrongName.
Some methods/properties/interfaces are duplicated in above 2 dlls.
Remove StackExchange.Redis reference to resolve errors.
I faced this issue in an ASP.NET Core app, and this answer solved my issue quickly.

Error when Compiling Clang Tool RecursiveASTVisitor : error: conflicting return type CreateASTConsumer

I just learn clang tool about How to write RecursiveASTVisitor based ASTFrontendActions.
I followed the example in the documentation and compile the example code, and there was always one error. I don't know why it have this error and how to solve it. I didn't find the solution of related problem. I don't know whether who meet the same problem and solved it.
/home/sun/project/clang-llvm/llvm/tools/clang/tools/extra/find-class-decls/FindClassDecls.cpp:44:31: error: conflicting return type specified for ‘virtual clang::ASTConsumer* FindNamedClassAction::CreateASTConsumer(clang::CompilerInstance&, llvm::StringRef)’
In file included from /home/sun/project/clang-llvm/llvm/tools/clang/tools/extra/find-class-decls/FindClassDecls.cpp:4:0:
/home/sun/project/clang-llvm/llvm/tools/clang/include/clang/Frontend/FrontendAction.h:64:40: error: overriding ‘virtual std::unique_ptr clang::FrontendAction::CreateASTConsumer(clang::CompilerInstance&, llvm::StringRef)’
ninja: build stopped: subcommand failed.
Thanks!
Oops. I've updated the documentation the rest of the way. It should have read:
class FindNamedClassAction : public clang::ASTFrontendAction {
public:
virtual std::unique_ptr<clang::ASTConsumer> CreateASTConsumer(
clang::CompilerInstance &Compiler, llvm::StringRef InFile) {
return std::unique_ptr<clang::ASTConsumer>(
new FindNamedClassConsumer(&Compiler.getASTContext()));
}
};
As of r215323, FrontendAction::CreateASTConsumer was changed to return a std::unique_ptr<clang::ASTConsumer> instead. I've updated the documentation on http://clang.llvm.org/docs/RAVFrontendAction.html to reflect that.
when I change to std::unique_ptr. At the same time, I keep return new FindNamedClassConsumer(&Compiler.getASTContext()); not like you have updated the documentation "return new FindNamedClassConsumer;". Now When I compile FindClassDecls.cpp, there is still another error.
/home/sun/project/clang-llvm/llvm/tools/clang/tools/extra/find-class-decls/FindClassDecls.cpp:46:64: error: could not convert ‘((&(& Compiler)->clang::CompilerInstance::getASTContext()), (operator new(24ul), (((FindNamedClassConsumer*))->FindNamedClassConsumer::FindNamedClassConsumer(), ((FindNamedClassConsumer*)))))’ from ‘FindNamedClassConsumer*’ to ‘std::unique_ptr’.
Thank you very much!

Crawler4j with Grails App throws error

This might be a very basic and silly question for experienced people. But please help. I am trying to use Crawler4j with in my Grails app by following this tutorial.
I know its Java code but I am using it in a controller class called CrawlerController.groovy.
I added the jar files but when I write CrawlConfig crawlConfig = new CrawlConfig()
it throws me a compiler error saying "Groovy unable to resolve class" . I refreshed dependencies and tried everything. May be I am missing something since I am a beginner. This is what I have written so far and all the import statements and CrawlConfig statement throws errors:
import edu.uci.ics.crawler4j.crawler.Page;
import edu.uci.ics.crawler4j.crawler.WebCrawler;
import edu.uci.ics.crawler4j.parser.HtmlParseData;
import edu.uci.ics.crawler4j.url.WebURL;
class CrawlerController extends WebCrawler {
public static void main(String[] args) {
CrawlConfig crawlConfig = new CrawlConfig()
}
}
` Please help. Thanks.
Just refresh your dependencies.

dart - its_all_about_you tutorial error

I am trying to run the latest version of its_all_about_you with the latest version of Dart Editor/SDK and I am getting this error. I copied the latest source from github
Internal error: 'http://.../web/out/packages/web_ui/src/linked_list.dart':
Error: line 72 pos 29: cannot resolve class name 'IterableBase' from 'LinkedList'
class LinkedList<E> extends IterableBase<E> {
Does anyone know what the problem is and how to fix it? And for future reference how would one go about debugging the issue?
This looks like a version mismatch. Could you please verify that your sdk (comes with the editor) is up to date.
If the error persists after an upgrade, post the version number of your editor and try the following (untested) example:
import 'dart:collection';
class A extends IterableBase { get iterator => null; }
main() { new A(); }
In recent versions of Dart this should work.

Problem with Entity Framework 4 and NUnit

I've got a simple test project I'm trying to convert from the visual studio unit testing framework to nunit. However, I'm encountering a strange error.
private VidRepository _repository;
//Setup the context before each test
[TestFixtureSetUp]
public void TestInitialize()
{
var fakeRepository = new FakeRepository();
_repository = fakeRepository.GetFakeRepository();
}
[Test]
public void CanGetMakes()
{
var makes = _repository.GetMakes();
Assert.AreNotEqual(0, makes.Count());
}
When I run the test CanGetMakes it dies in the TestFixtureSetup method with the error.
Could not load file or assembly
'CompanyName.Data.VidEntities,
Version=0.0.0.0, Culture=neutral,
PublicKeyToken=null' or one of its
dependencies. An attempt was made to
load a program with an incorrect
format.
I've added and removed the reference to the project a couple times with no luck, and it also works when I change it back to the Microsoft unit testing framework (using Microsoft.VisualStudio.TestTools.UnitTesting;) which is very odd to me.
Does anyone have any suggestions.
Thank you,
Brian
I went through my projects and set the platform target to any cpu and it fixed the problem.

Resources