Unable to import sumCashBy using IntelliJ IDEA - corda

IntelliJ IDEA started highlighting errors in some of my import statements that worked previously. This is not unexpected as net.corda.finance is still in the "incubating" stage.
I am working in Java.
Corda Release: 3.3
Noticed this change on github: https://github.com/corda/corda/pull/4700
So I made what I thought are the necessary changes...
//Old
//import static net.corda.finance.utils.StateSumming.sumCashBy;
//New
import static net.corda.finance.contracts.utils.StateSumming.sumCashBy;
...but I'm still getting an error. I am sure I must be overlooking something simple.

#Kid101 put me on the right track by trying StateSumming.sumCashBy(contractState)
Once I did that IntelliJ recognized I needed to add:
net.corda:corda-finance:3.3-corda
...to the classpath. If I allowed IntelliJ to add it from the context menu the error reappeared every time gradle refreshed. So I added:
cordaCompile "$corda_release_group:corda-finance:$corda_release_version"
...to the build.gradle file under the dependencies section. No more errors with my import statement:
import net.corda.finance.utils.StateSumming;
...and no issues calling the sumCashBy method.

The change you mention is in Corda master branch, In CashTests.kt you can see how sumCashBy is imported, import net.corda.finance.contracts.utils.sumCashBy.
In corda/release-V4-branchpoint import is still net.corda.finance.utils.sumCashBy i.e. the change has not made in yet to V4.
Try to build the project again.
If using Java, try: StateSumming.sumCashBy(contractState)

You should import a dependency package.
You add below to build.gradle and refresh your IntelliJ project.
dependencies {
....
cordaCompile "$corda_core_release_group:corda-finance-contracts:$corda_core_release_version"
...

Related

Problem importing FireBase Analytics into Unity

I have a project at Unity 2019.3 with dotnet 4.x. I am trying to import firebase analicts and I have gotten the following error:
System.TypeInitializationException: The type initializer for 'Firebase.Editor.Measurement' threw an exception. ---> System.MissingMethodException: void Google.EditorMeasurement.set_InstallSourceFilename(string)
--- End of inner exception stack trace ---
at Firebase.Editor.AndroidSettingsChecker..cctor () [0x0000c] in Z:\tmp\tmp.SHkOPK7iEJ\firebase\app\client\unity\editor\src\AndroidAPILevelChecker.cs:37
and
MissingMethodException: void Google.EditorMeasurement.set_InstallSourceFilename(string)
Does anyone have any idea what it could be? Was any library missing? I haven't found reference to this problem anywhere.
I had the exact same problem, I fixed it by fully removing the ExternalDependencyManager folder in the project and replaced it using the latest Jar Resolver plugin from here https://github.com/googlesamples/unity-jar-resolver/blob/master/external-dependency-manager-latest.unitypackage
At the same time I also installed Python 2.7 and added it to system path, but I'm pretty sure the jar resolver thing is what fixed the issue. The root problem is the embedded analytics (EditorMeasurement) fail and Firebase never executes the python scripts that make all the Plugins/Firebase/res/values xmls
Hope this helps! :)
In my case the issue was happening after adding a new Firebase package with a version bigger than the other Firebase packages already in the project. Updating all the packages to the same version solved the problem.
deleting the editor folder inside the PlayServicesResolver folder and then reimporting it from any of the firebase unity packages.

QtAV in QT in QML

i am using QtAV but getting this error so please help me:
QQmlApplicationEngine failed to load component
qrc:/main.qml:4 plugin cannot be loaded for module "QtAV": Cannot load library /home/intel/Qt5.7.0/5.7/gcc_64/qml/QtAV/libQmlAV.so: (libswresample.so.2: cannot open shared object file: No such file or directory)
at qrc:/main.qml:4 import QtAV1.6
using linux
The application cannot find your requested plugin.
You need to check if your import path is set correctly. If this is the case: please check if the plugin is installed correctly. You can use
export QML_IMPORT_TRACE=1
to check which import pathes are set.
And make sure, that all dependncies are installed as well. For instance libswresample ( see https://ffmpeg.org/libswresample.html )

import css from node_modules in meteor 1.4 with react

I want to use an npm package, namely react-date-picker in my Meteor 1.4 project using React. The react-date-picker package comes with some css that must be included in order to render correctly. I need to tell meteor to load node_modules/react-date-picker/index.css and include it with the rest of its css, but I'm at a loss on how to do this. Others have suggested that you can simply import the css from within the .jsx component like this
import 'react-date-picker/index.css'
but doing so results in a crashing server that chokes on the first line of the css (as it appears to be parsed as a standard javascript file)
(function (exports, require, module, __filename, __dirname) { .react-date-field {
^
) SyntaxError: Unexpected token .
at exports.runInThisContext (vm.js:53:16)
at Module._compile (module.js:373:25)
at Object.Module._extensions..js (module.js:416:10)
at Module.load (module.js:343:32)
at Module.Mp.load (/Users/gsferrer/.meteor/packages/babel-compiler/.6.9.1.7f3rvr++os+web.browser+web.cordova/npm/node_modules/reify/node/runtime.js:16:23)
at Function.Module._load (module.js:300:12)
at Module.require (module.js:353:17)
at require (internal/module.js:12:17)
at npmRequire (/Users/gsferrer/Projects/xxx/.meteor/local/build/programs/server/npm-require.js:129:10)
at Module.Mp.useNode (packages/modules-runtime/modules-runtime.js:69:1)
=> Exited with code: 1
=> Your application is crashing. Waiting for file change.
So what is the preferred method to import css from node_modules using Meteor with React?
As you say, it appears to be parsed as JS. However, importing a CSS this way is correct and usually works, so there must be something weird going on... So I'm going to try a wild guess: Try renaming the file from index.css to something else, like react-date-picker.css. It could be that the "index" name is triggering the JS interpretation.
I have been stuck for days on this issue too (I am new to the node.js/Meteor/React/JavaScript world). I needed to import a CSS file in node_modules/react-datagrid/index.css
My working solution (applied to a tiny application that should make it easy to understand; I only display a datagrid using hard-coded data) is available on my GitHub repository (commit 902c92c). The application is called "reactDataGrid", it is a subfolder of the repository, you just need to run "meteor" within that folder.
The key steps in my case were:
npm install webpack --save-dev to install web pack for the project
to create a .babelrc file with the content described here (and copied below). I believe this helps webpack parse the JSX syntax of react.
.babelrc
{
"presets": [
[
"es2015",
{
"modules": false
}
],
"react"
]
}
add require('react-datagrid/index.css') statement inside my client/main.jsx file, that tells webpack to include that CSS file in the dependency tree of my app. This is actually an instruction described in the README of the zippyui/react-datagrid GitHub repository. (Unfortunately stackoverflow limits to two links in my post, so I cannot link it here anymore)
I cannot guarantee that this is the preferred method of doing it, but I can say that it works for me. I hope it helps.
Best,
Kevin

Unable to use FirebaseRecyclerAdapter

I am getting cannot resolve FirebaseRecyclerAdapter when trying to use it even after adding firebase ui in gradle dependency.Thanks in advance
I was getting the same issue, it's resolved by adding the firebase-ui dependency in build.gradle (module:app)
compile 'com.firebaseui:firebase-ui-database:0.4.0'
Also add the import in .java file where you're trying to declare it.
import com.firebase.ui.database.FirebaseRecyclerAdapter;
Go to build.gradle file, add a dependency (get the latest one from here https://github.com/firebase/FirebaseUI-Android)
The latest one on 5 October 2019 is implementation 'com.firebaseui:firebase-ui-database:6.0.2'
If You are facing Problem in 2020 then use this dependency:
implementation 'com.firebaseui:firebase-ui-database:6.0.2'
above mentioned answers are not working in today's date i have tried all of them,remember import this package too:
import com.firebase.ui.database.FirebaseRecyclerAdapter;
Can you show your build.gradle file?
Also, have you tried putting this under your package name in your java class: import com.firebase.ui.database.FirebaseRecyclerAdapter;?
In your app level gradle:add the following firebase dependency
dependencies {
compile'com.firebaseui:firebase-ui-database:1.1.1'
The dependencies quoted above don't seem to work anymore. After about an hour of searching online, I found this; hopefully it helps someone. It certainly fixed my problem:
compile 'com.firebaseui:firebase-ui:0.4.3'
Use exactly the matched version of FireBaseRecyclerAdapter
to the Versions that you have included in gradle for the Firebase Database.
This link will surely help you
https://github.com/firebase/FirebaseUI-Android
In this link, you will find the matched Firebase dependency according to the version.
I tried to import the following three packages, and my problem is solved:
implementation "androidx.recyclerview:recyclerview:1.2.1"
implementation "androidx.legacy:legacy-support-v4:1.0.0"
implementation 'com.firebaseui:firebase-ui-database:8.0.1'
implementation 'com.firebaseui:firebase-ui-database:1.2.0'
You can use this gradle dependencies

Using cytoscape-qtip with meteor npm

I'm trying to get the cytoscape-qtip package working with meteor though npm.
I've installed cytoscape, jquery, qtip2 and cytoscape-qtip through with the "meteor npm install --save" command, and I'm importing and registerng them in my template as follows:
import cytoscape from 'cytoscape'
import jquery from 'jquery'
import cyqtip from 'cytoscape-qtip';
import qtip from 'qtip2';
cyqtip(cytoscape, jquery);
When I try to use the .qtip command on a cytoscape element, I get the following error:
TypeError: qtip.$domEle.qtip is not a function
I've tried usinng atmosphere packages (cytoscape:cytoscape, maxkfranz:cytoscape and maxkfranz:cytoscape-qtip) instead, but I end up getting the same error.
If I try to import the jquery bundled with meteor instead (import jquery from 'meteor/jquery'), my page will not load at all, and I get the error "TypeError: $ is not a function".
The documentation for cytoscape-qtip states
Note that jquery must point to a jQuery object with .qtip() registered if any sort of require() is used.
Could this be the problem, that qtip is somehow not registered with the jQuery object? If so, how do I register it?
I can see that this guy had a similar problem, solved by changing the import order of his scripts, but since I'm using npm I'm not sure how I can manually change the import order.
Any help would be greatly appreciated!
If there's a jQuery object on window, then qTip registers itself: https://github.com/qTip2/qTip2/blob/v3.0.2/src/core/intro.js. You may just have to set that manually for qTip to register itself.

Resources