Android studio support library for androidx - build.gradle

I want to update the implementation 'com.android.support:support-v4:28.0.0' version for androidx. I couldn't find the appropriate migration for it.
Any help would be highly appreciated.

Import your specific packages from this list;
AndroidX Class Mappings:
https://developer.android.com/jetpack/androidx/migrate/class-mappings
For Support v4:
https://developer.android.com/jetpack/androidx/migrate/class-mappings#androidsupportv4
For AndroidX add to Gradle, implementation "androidx.core:core-ktx:+".
The "+" at the end of the package in gradle's implementation statement is a regex for the latest stable version available. Number versions can also be used instead of the "+", like; implementation "androidx.core:core-ktx:1.3.2"
You can check the latest stable, alpha etc builds with release dates on maven here: https://mvnrepository.com/artifact/androidx.core/core-ktx?repo=google

Related

How to download an older version of PyTorch Geometric in Google Colab?

Question: How can I download an older version of PyTorch geometric in google colab?
Context: I am trying to use/load a pytorch-geometric graph and am getting the error message: "RuntimeError: The 'data' object was created by an older version of PyG. If this error occurred while loading an already existing dataset, remove the 'processed/' directory in the dataset's root folder and try again." This graph was generated during summer 2021.
I am using PyTorch and the following code to import Pytorch geometric, but am still getting the error when using older versions.
#import torch
!pip install torch==1.8.0
import torch
torch.__version__
!pip install torch-scatter torch-sparse torch-cluster torch-spline-conv torch-geometric -f https://data.pyg.org/whl/torch-1.8.0+cpu.html
I am not sure whether I am using the correct older version of pytorch-geometric (I don't really know how to check whether this is correct). Any insight to would be greatly appreciated:
How to download older version of pytorch geometric?
What is causing this error?
Thanks in advance.
You may not need to downgrade: If G is a graph data object giving this error you can simply convert it as follows.
from torch_geometric.data import Data
G = Data(**G.__dict__)
I'm not sure if you still need it but I just ran into the same problem and here's what I found:
It seems like there isn't a compatibility document but you can check the version history here and find the corresponding release for the one nearest to the time when your pytorch version was released, of course this doesn't guarantee compatibility but I think you have a pretty good chance?
For the additional packages e.g. torch-scatter, you can find the corresponding versions here and install from the .whl files.

how to deploy a corrected library

I find a bug in a library (release 8) already used by many scripts.
I want these scripts to used the corrected library, but I can't change the library release number in each script.
I'd like replace the code in release 8 by the new code, with the same release number.
Is'it possible ?
Thanks

Loading multi versioned Web Component dependencies with SystemJS / JSPM?

Just a disclaimer - this is a hypothetical scenario as I'm trying to figure out the best way to handle web component direct and transitive dependencies using something like JSPM and SystemJS.
Scenario 1
Suppose I have 2 web components - component-a and component-b. One is built with momentjs#1.2.4 and another is built with momentjs#1.6.4.
Each component author listed Polymer as a peer dependency and momentjs as a direct dependency in their package.json file like this:
"dependencies": {
"moment.js": ">= 1.0.1 <= 1.8.0"
}
"peerDependencies": {
"Polymer.js": "0.5.0^",
}
So in this case when the developer declares the package.json dependencies on both of these components the package manager could figure out the best version of moment.js to install and make it available. Lets assume that's version 1.8.0.
Great - just one version of moment.js to deal with for both components. Now how do the components load / inject the dependency? Does JSPM and SystemJS currently have the ability to support this?
For example in this article Taming Polymer with SystemJS and Typescript the author performs imports that delegate to SystemJS like this:
import 'elements/app-frontend';
So I suppose momentjs would follow a similar approach and import like this (Within the typescript files of component-a and component-b:
import 'js/momentjs';
In the above case the momentjs dependency does not know what version will be fetched since the import declaration is unaware of the version (since it written at design time).
Later on when the component is used in and component is used in an application JSPM figures out the best for the momentjs depedency to install.
In this case lets assume that it install it in a layout like this:
`jspm_packages/momentjs/momentjs#1.8.0`
So how does JSPM become aware the import statement import 'js/momentjs' translates to the import of jspm_packages/momentjs/momentjs#1.8.0?
In this case it's fairly trivial, but it get more tricky in scenario 2 below ... I think.
Scenario 2
Same as scenario one except the version requirements on momentjs are mutually exclusive. For example component-a requires version 1.2.4 and component-b requires version 2.4.4.
So both components perform the import like this:
import 'js/momentjs';
But jspm_packages installs both versions like this:
`jspm_packages/momentjs/momentjs#1.4.4`
`jspm_packages/momentjs/momentjs#2.4.4`
So now how does SystemJS know to that component-a needs version 1.4.4 and component-b needs version 2.4.4?
To summarize:
1) Is JSPM ok with having multiple versions of the same dependency?
According to this article Introduction to the Jspm package manager and the SystemJs module loader and an answer from guybeford it does, but how then does each component get the right version?
2) Does SystemJS / JSPM have a way of configuring version meta data for each component?
3) Does SystemJS have a way of understanding and injecting the right version of a dependency into the web component?
TIA,
Ole
Also what happens if the component requires several other modules, like CSS etc?
I'm not sure what you mean. You can import multiple modules and other contents (likely via plugins) usting SystemJS.
1) Is JSPM ok with having multiple versions of the same dependency?
I think you partially answered this question. JSPM will always select and install only one version for each component, which best matches the requirements from other components. If there is a conflict, JSPM will ask to choose manually.
So how does JSPM become aware the import statement import 'js/momentjs' translates to the import of jspm_packages/momentjs/momentjs#1.8.0?
The config.js file assigns import names (not sure the nomenclature) for installed packages. It is actually possible to change those names using jspm install x=npm:package syntax. This will result in config like
"x": "npm:package#1.2.3"
You can then both import x and import npm:package#1.2.3.
2) Does SystemJS / JSPM have a way of configuring version meta data for each component?
I think that the structure of config.js has all you need. It contains dependencies with their versions.
"component-a": {
"momentjs": "momentjs#1.2.4"
},
"component-b": {
"momentjs": "momentjs#1.6.4"
}
3) Does SystemJS have a way of understanding and injecting the right version of a dependency into the web component?
I would expect SystemJS to use this information to import the correct version when either component-a or component-b is requested.
I am not sure though how to have JSPM install packages this way, retaining multiple versions of a package. I think it deserves a separate, specialized question.

Is there a way to get a JSON-Schema from a Scala Case Class hierarchy?

I'm documenting an internal REST API written ini Scala, unfortunately we are not able to integrate Swagger, so for now we are going with an in-house solution for the doc generator.
I would like to generate a JSON-Schema to show how the response is when getting our resources. I'm just wondering if there is any shortcut to do this by taking advantage of the case classes already modeled.
The autoschema project is able to export JSON schema from Scala case classes. You can use it as follows:
case class MyType(myValue: Int)
AutoSchema.createSchema[MyType]
The Maven artifact seems to be no longer available but it is an SBT project available on Github so you can either copy the sources, build a Jar or add it as a dependency with SBT by putting in your build.sbt the following:
lazy val autoschemaProject =
ProjectRef(uri("https://github.com/coursera/autoschema.git"), "autoschema")
lazy val root = (project in file(".")).dependsOn(autoschemaProject)
I tested this with SBT 0.13.7. Notice that autoschema has its own dependencies (mainly play-json 2.3.2) so you might need to change their versions to avoid version conflicts with you own project dependencies.
As #mziccard stated, autoschema is the way to go. However, it's been a while since there has been some activity on the main repository. I took some time to fork it and update its dependencies and deprecated code (work that was done in other forks, I simply combined it). It is now published in maven central under my fork:
https://github.com/sauldhernandez/autoschema
You can use it by putting this in build.sbt:
libraryDependencies += "com.sauldhernandez" %% "autoschema" % "1.0.0"

What is the difference between the release and integration versions?

I just grabbed the JDK & eclipse classic and I am trying to figure out which one to use for installation. What is the differences between the release and integration versions provided by eclipse.org: http://www.eclipse.org/windowbuilder/download.php
Well, I dunno for sure. But i've checked the hash(md5/sha1) of both for zipped one. And the hash is exactly the same. For example, 3.8 :
http://eclipse.org/downloads/sums.php?file=/windowbuilder/WB/release/R201302221200/WB_v1.5.2_UpdateSite_for_Eclipse3.8.zip.MD5&type=md5
http://eclipse.org/downloads/sums.php?file=/windowbuilder/WB/integration/WB_v1.5.2_UpdateSite_for_Eclipse3.8.zip.MD5&type=md5
Theoritically, it should be the same file. But, i dunno for sure though...
I think the files are the same, but URLs are different. If you use the Release version, you will always have the URL of that particular version in Eclipse URL list, while the Integration version will provide a single URL for all future versions for that particular Eclipse version (say 4.4)
I have found only that the "Integration Version" is longer(39891450 bytes) than the "Release Version"(39759975 bytes).
The name for each .jar file in the "Integration Version" contains substring "20141006" (for example: org.eclipse.wb.swing.FormLayout_1.7.0.r44x201410061440.jar)
The name of each .jar file in the "Release Version" contains substring "20140502" (for example: org.eclipse.wb.swing.FormLayout_1.7.0.r44x201405021531.jar)
Links:
Integration Version:
http://eclipse.org/downloads/download.php?file=/windowbuilder/WB/integration/WB_v1.7.0_UpdateSite_for_Eclipse4.4.zip
Release Version:
http://eclipse.org/downloads/download.php?file=/windowbuilder/WB/release/R201406251200/WB_v1.7.0_UpdateSite_for_Eclipse4.4.zip
So, it seems the "Integration Version" is newer version.