Access JSF and Primefaces version numbers programmatically - jsf-2

I use PrimeFaces 3.5.x and Mojarra JSF 2.1.x
I would like to access and show the versions of both libraries programmatically.
I use the versions as maven2 properties, but I hope there is an easier way to get the versions.
I hope to find something like:
Primeface.getVersion();
FacesContext.getCurrentInstance();
A JavaScript based solution would be fine too, since I only want to display the version on a status page.

In PrimeFaces 4.0, Constants.VERSION is removed in favor of;
RequestContext.getCurrentInstance().getApplicationContext().getConfig().getBuildVersion();
Also watch out for FacesContext.class.getPackage().getImplementationVersion();, it doesn't work on some app servers like websphere.

For JSF:
//returns the major version (2.1)
FacesContext.class.getPackage().getImplementationVersion();
//returns the specification version (2.1)
Package.getPackage("com.sun.faces").getSpecificationVersion();
//returns the minor implementation version (2.1.x)
Package.getPackage("com.sun.faces").getImplementationVersion();
For Primefaces 3.x you can use the Constants class in utils package:
import org.primefaces.util.Constants;
Constants.VERSION

For PrimeFaces, you can use the Constants class:
org.primefaces.util.Constants.VERSION

If you need to get the Version on runtime, there will not be any instance of RequestContext. Therefore you could use the ImplementationVersion of the package:
Package.getPackage("org.primefaces").getImplementationVersion()
If the package cannot be resolved, you can try to resolve the version via PrimeFaces class:
PrimeFaces.class.getPackage().getImplementationVersion()

Related

I have a Swift Package and I want to know how to get the current version of this package

Similar to how you get your apps version kCFBundleVersionKey how does one get the version of the package you are working in?
I don't think it's possible at the moment to get the value easily.
You can either read the Package.resolved file or you can set up a public constant where you would define the version of your library.
public let version = "0.0.1"
import MyLibrary
print(MyLibrary.version)
There isn't a standard way how to do this, every package could have a different constant (or not have it at all)
You can check package version rules in project package dependencies tab. Check screenshot below. Propably it would be sufficient for most use cases.
Edit: The context has changed, the question was to get the version of MyPackage I'm working on via code. There isn't any documented or recommended method as of now. Though this can be achieved by a hack through reading the Package.resolved file as mentioned by Malcolm.
I'm not deleting this answer for any future users who are looking for answer on how to get the exact latest version of a Package.
You can give the same major version number and give Update to latest package version option on Xcode. eg: If current version is 2.4.5 you just need to provide 2.0.0 and update. There is also an option to provide the exact version of swift package you need.

Searching vaadin-server jar lower than 7.0

My project is built with Vaadin 6.8.4. I need to use Vaadin server as well. However I can find vaadin server 7.0.0 but I need version 6 which I cannot find anywhere. I don't want to upgrade my project as now. Kindly, can anyone help me out here?
I tried using Vaadin server 7.0.0 with Vaadin 6.8.4 but in the module of sending file as download for client, I get this error:-
java.lang.VerifyError: (class: com/vaadin/server/FileDownloader, method: extend signature: (Lcom/vaadin/ui/AbstractComponent;)V) Incompatible argument to function
In vaadin 6 there was no vaadin-server-xxxx.jar.
Everything is in the vaadin-6.8.xx.jar.
If your code is referencing com/vaadin/server, then probably you have some components which require vaadin 7.
It's not possible to mix components between 6.x and 7.x

Highcharts Standalone Framework is empty

I downloaded Highcharts using bower. The file bower_components/highcharts/adapters/standalone-framework.js is empty. I also looked at the CDN version at http://code.highcharts.com/adapters/standalone-framework.js - it's also empty. Is this intentional?
Since 4.2 version, the standalone-framework is included in the highcharts.js core.
More information you can find here: http://www.highcharts.com/component/content/article/2-news/198-highcharts-drops-adapters

Using Polymer core elements in Dart

Is there a way to use existing Polymer standard core elements , such as core-toolbar and core-menu, in Dart?
If you download the polymer project with bower you can find the javascript versions in /polymer/bower-components/.
core-toolbar, for instance, contains a core-toolbar.html and a metadata.html. These have <polymer-element> tags in them just like in Dart. Can these be adapted?
In the meantime, an official package has arrived:
http://pub.dartlang.org/packages/core_elements
And you can even have the paper elements of the material design:
http://pub.dartlang.org/packages/paper_elements
I found this issues:
https://code.google.com/p/dart/issues/detail?id=14098
This is not the post I talked about in my comment.
https://code.google.com/p/dart/issues/detail?id=13758
The linked discussion in this issue could be the post I remembered
the TodoMVC is a Dart demo project (https://www.dartlang.org/samples/) that uses some Polymer.js polymer_elements
see source in lib-elements directory
As mentioned in my comment alternatively you could use the Dart port of polymer_elements and polymer_ui_elements
https://github.com/ErikGrimes/polymer_elements
https://github.com/ErikGrimes/polymer_ui_elements

OpenCV: In which version the feature2d module was first implemented?

In need to in which version the feature2d module was first implemented. Couldn't find an answer on google. I know that it exists in 2.2, but I wanted to know if it existed already on 2.0 or 2.1.
Thanks
According to OpenCV's ChangeLog, it is first introduced in v2.2.
It looks like 2.2 is the first version with modules, including features2d. You can verify this yourself by examining the source code releases.

Resources