Set default style in Java 8 - javafx

In JavaFX 8 application I'm using setUserAgentStylesheet(STYLESHEET_CASPIAN); to set the default skin style. But in Netbeans I get error:
cannot find symbol
symbol: variable STYLESHEET_CASPIAN
location: class MainApp
----
(Alt-Enter shows hints)
In order to remove the warning in Netbeans I tried tried this:
String STYLESHEET_CASPIAN = null;
setUserAgentStylesheet(STYLESHEET_CASPIAN);
But it's not correct. How I can remove the warning message?

STYLESHEET_CASPIAN was introduced in FX8 (jdk8). If you intent to use FX2.x you don't need to change user agent stylesheet (caspian is only and default).
If your project compiles, but NB shows warning it's NetBeans issue. Most probably you had FX2.x in you project previously and NB remembered it. Try to change platform in project options back and forth to reset NB cache.

Related

GlideApp symbol not found in Android Studio 4.1

I have been using Glide 4.11.0 and Realm 6.0.2 for some time now, and recently upgraded Android Studio 4.0.x to 4.1. All has been going fine. Today I ran the lint checker, and started doing some "clean up", nothing out of the ordinary (it would seem). One of the things I did a lot of was to replace switch statements that were testing against R.id. with if-else statements per the lint warning about what's gonna happen in Gradle 5.0.
When I did this, I did use a number of int variables I named 'id' that were to replace the value to compare - i.e. instead of a switch statement that would be:
switch (menuOpt.getId()) {
case R.id.xxx:
...
}
I would do:
int id = menuOpt.getId();
if ( id == R.id.XXX) {
} else if....
per the new guidelines.
Suddenly, on a full build AS complains that it no longer recognizes GlideApp, and I am also getting a very weird message about Realm not being able to process correctly:
C:\BLD\AndroidStudioProjects\InTouch\app\src\main\java\com\reddragon\intouch\ui\MediaPlayerActivity.java:61: error: cannot find symbol
import com.reddragon.intouch.utils.GlideApp;
^
symbol: class GlideApp
location: package com.reddragon.intouch.utils
C:\BLD\AndroidStudioProjects\InTouch\app\src\main\java\com\reddragon\intouch\ui\MediaDialogActivity.java:92: error: cannot find symbol
import com.reddragon.intouch.utils.GlideApp;
^
symbol: class GlideApp
location: package com.reddragon.intouch.utils
C:\BLD\AndroidStudioProjects\InTouch\app\src\main\java\com\reddragon\intouch\ui\MediaListActivity.java:48: error: cannot find symbol
import com.reddragon.intouch.utils.GlideApp;
^
symbol: class GlideApp
location: package com.reddragon.intouch.utils
Note: Version 10.0.0 of Realm is now available: https://static.realm.io/downloads/java/latest
Note: Processing class Album
error: Class "Album" contains illegal final field "id".
Note: [1] Wrote GeneratedAppGlideModule with: []
Class "Album" contains illegal final field "id".
4 errors
I have had the field 'id' in my Album class for about 2 years with no issues!
No manner of rebuild, invalidating cache and restarting, syncing gradle files or "reload all from disk" seems to help.
Actually, if I invalidate and restart, I don't get the red squiggle in the offending classes that are referencing GlideApp, but as soon as I start to run the app and it goes through a build process it errors out.
I Googled a bit and found one post where there seemed to be some conflict between Realm and Glide (RequestOptions), but the strange thing to me is why would this suddenly start occurring?
I have validated that the GlideAppjava class is in fact getting built - I am using the debug build variant, and I can see in the file system GlideApp.java that is in the ap_generated_sources/debug directory in the proper package where I have my class that extends AppGlideModule with the #GlideModule annotation.
So GlideApp is getting generated. It just isn't getting recognized.
One of the other new things is that I've recently created a Dynamic Feature module. This module does depend on a class that is in the base module (where GlideApp is referenced). Not sure if this is relevant (I had many, many successful builds before I started doing lint clean-up).
So frustrating! Any help appreciated.
It turns out that the answer was staring right at me, although somewhat hidden: part of the lint check that I did was accept some suggestions about making variables 'final' - including those that are used in Realm classes to define Realm objects. Realm doesn't like that - above build error output includes as a last line the statement 'Class "Album" contains illegal final field "id".'
"Album" extends RealmObject, and the "auto accept" of the lint's suggestion to make some of the fields final was the culprit.
I think this issue with Realm caused a ripple effect somehow with the other annotation processing - when I went back to all the RealmObject classes and removed the "final" declaration, build now completes smoothly.

Getting error when trying to use AVPictureInPictureController in iOS 13 or tvOS 13

I have small app which runs on iOS and tvOS where I’m displaying a video in UIView.It does support iOS 12 and tvOS 12.
Now want to show PIP for tvOS hence trying to use AVPictureInPictureController gives error “Use of undeclared identifier 'AVPictureInPictureController”.
Even though deployment target set to tvOS 13. In Xcode, capabilities -> Background mode -> enabled “ Audio,Airplay and Picture In Picture”.
This basic code gives error.
#import <AVKit/AVKit.h>
if ([AVPictureInPictureController isPictureInPictureSupported]) {
// code
}
Any other settings missing or something else I need do ?
Thanks
Not supported in tvOS, as stated in Apple's documentation
SDKs
iOS 9.0+
macOS 10.15+
Mac Catalyst 13.0+
POSSIBLITY OF ISSUES DUE TO THE GAPS IN IMPLEMENTATION :
Experince with the AVPlayerViewController:
Initially make Sure that we set Playback audio category, Generally when we use a AVPlayerViewController to play video content. PIP mode will automatically get invoked if the developed application enters background , but only if satisfies the below mentioned condition,First one is the Player which we are using should be in Full Screen mode,the second is we should make sure that the Video Should be Playing in it and third one is PIP Should be supported by the device and last of all write delegate method to restore our player UI when the user returns from Picture in Picture mode.
Implmentation with _AVPictureInPictureController :
You can find an working example in the below thread.
How to display AVPictureInPictureController?
Drilling down the issue:
In order to confirm the undeclared error was not due to the gaps in implementation and it was due to environmnet in Xcode, Download the source and then add the Sources folder inside another folder in your workspace.Add the folder using "Add Files to ..." option and now verify inside xcode.
POSSIBLITY OF ISSUE DUE TO REFRESH IN THE XCODE
Try Fix By Approach 1
Include the class explicitly in header and/or body - instead of the *.pch file. Then this error might go away. Also deleting the derived data workes once in a while. Did you change the location in preferences recently by any chance. Some get this error when they use a ramdisk for derived data and then they go back to default. This is the most annoying case - since it causes this error to appear then in almost every file.
Try Fix By Approach 2
Sometime a simple solution might help delete one of the #import lines from the pch file and recompile which will fail as expected.Then put the deleted line back in, recompiled and it compiled normally with all the false errors gone.
POSSIBLITY OF ISSUE DUR TO XCODE ERROR CACHE, FOLLOW THE BELOW STEPS
Clean Build : Command-Option-Shift-K to clean out the build folder.
Reset Simulator : choose iOS Simulator > Reset Content and Settings
Restart Xcode
Delete your DerivedData folder in ~/Library/Developer/Xcode/DerivedData
Restart Computer
Delete the /var/folders in a very targetted way.
rm -rf "$(getconf DARWIN_USER_CACHE_DIR)/org.llvm.clang/ModuleCache"
Source:
How to Empty Caches and Clean All Targets Xcode 4 and later
Xcode "Use of undeclared identifier" errors, compiles/runs just fine
Use of undeclared identifier in Xcode 9.0
https://developer.apple.com/documentation/avkit/adopting_picture_in_picture_in_a_standard_player
To create a simple video player
First, you'll need to implement a basic video player in your project's ViewController.m file, like so:
#import "ViewController.h"
#import <AVKit/AVKit.h>
#interface ViewController ()
#property(nonatomic) AVPlayerViewController *playerViewController;
#end
#implementation ViewController
- (void)viewDidLoad {
[super viewDidLoad];
self.view.backgroundColor = [UIColor blackColor];
// Create a stream video player.
AVPlayer *player = [[AVPlayer alloc] init];
self.playerViewController = [[AVPlayerViewController alloc] init];
self.playerViewController.player = player;
// Attach video player to view hierarchy.
[self addChildViewController:self.playerViewController];
self.playerViewController.view.frame = self.view.bounds;
[self.view addSubview:self.playerViewController.view];
[self.playerViewController didMoveToParentViewController:self];
}
#end
For further help go through https://help.apple.com/xcode/mac/8.0/#/dev51a648b07

How to remove the 'WARNING: CSS Error parsing':

There is a warning everytime I run the program, I don't know where the problem is because at [1, 19] of all of my css files I have a comment. I tried to fix this by removing the comment and it made no difference. Please help.
WARNING: CSS Error parsing '*{-fx-font-family: ;}: Unexpected token ';' at [1,19]
[]1
In javaFx you can use CSS with two ways : you can customise your fxml file by using scene builder or by according a css file.I had the same problem ,when the JavaFX CSS parser encounters a syntax error, a warning message is emitted which conveys as much information as is available to help resolve the error. For example
WARNING: com.sun.javafx.css.parser.CSSParser declaration Expected
'' while parsing '-fx-background-color' at ?[1,49]
The cryptic '?[1,49]' pertains to the location of the error. The
format of the location string is
[line, position]
If the error is found while parsing a file, the file URL will be given. If the error is from an inline style (as in the example above), the URL is given as a question mark. The line and position give an offset into the file or string where the token begins. Please note that the line and position may not be accurate in releases prior to JavaFX 2.2.
Applications needing to detect errors from the parser can add a listener to the errors property of com.sun.javafx.css.StyleManager. This is not public API and is subject to change.
I think you add a value by using scene builder and you are adding ; to your value and this is not acceptable in scene builder you need to remove ;.
To resolve your problem ,go to your fxml file in your IDE ,i think you are using Netbeans and click right button of mouse --> edit , you can find your warning.

Seeing Websphere class instead of a class in one of my app's jars

I'm having what seems to be a classloader/jar issue. Websphere 7, JDK 6.
Talking to a webservice works fine when the code is running in a simple, standalone Java class.
((WSBindingProvider) docManClient).setOutboundHeaders(Headers.create(otAuthElement));
In the debugger, the docManClient object has this toString():
JAX-WS RI 2.1.4-b01-: Stub for http://innov15.ncr.pwgsc.gc.ca/innov15_cws/DocumentManagement.svc
The class path includes jaxws-rt-2.1.4.jar.
When the code is running inside Websphere, the cast fails.
((WSBindingProvider) docManClient).setOutboundHeaders(Headers.create(otAuthElement));
java.lang.ClassCastException: com.sun.proxy.$Proxy484 incompatible with com.sun.xml.ws.developer.WSBindingProvider
In the debugger, the docManClient object has this toString():
org.apache.axis2.jaxws.client.proxy.JAXWSProxyHandler#a460a46
This jar is in Websphere-land only, and is not part of my project's .ear file:
C:\dev_tools\server\IBM\WebSphere\AppServer\plugins\org.apache.axis2.jar
I attempted to change the app config, to prefer its own classes above those of Websphere.
I used the wsadim tool to change to PARENT_LAST, but this had no affect on the observed behaviour:
set dep [$AdminConfig getid /Deployment:my-ear/]
set depObject [$AdminConfig showAttribute $dep deployedObject]
set classldr [$AdminConfig showAttribute $depObject classloader]
$AdminConfig showall $classldr
$AdminConfig modify $classldr {{mode PARENT_LAST}}
$AdminConfig save
$AdminConfig showall $classldr
The app is an .ear which contains a single .war.
EDIT added later: I'm not clear on the relation between jax-ws-rt.jar and axis2.jar. The axis2.jar is not a drop-in replacement for jax-ws-rt.jar: when I switch to axis2.jar, the code no longer compiles.

How can I programmatically add build files to Xcode4?

I've been trying to figure out how to programmatically add files to an Xcode4 project and it seemed like AppleScript would be the way to go, however I'm running into "missing value" errors.
Here's the code I've got:
tell application "Xcode"
set theProject to first project
set theTarget to first target of theProject
set theBuildPhase to compile sources phase of theTarget
tell first group of theProject
set theFileRef to make new file reference with properties {full path:"/Users/jeff/Projects/XcodeTest/XcodeTest/MyViewController.h", name:"MyViewController.h", path:"XcodeTest/MyViewController.h", path type:group relative}
add theFileRef to theProject
end tell
--tell theBuildPhase to make new build file with properties {build phase:theBuildPhase, name:"MyViewController.h", file reference:theFileRef, target:theTarget, project:theProject}
end tell
I've tried the commented-out line instead of the add-command as well, but that doesn't work either (I get "missing value").
The 'add' error is:
error "Xcode got an error: file reference id \"251AD3431432472E006E300F\" of Xcode 3 group id \"251AD32C14324645006E300F\" of project \"XcodeTest\" of workspace document \"XcodeTest.xcodeproj/project.xcworkspace\" doesn’t understand the add message." number -1708 from file reference id "251AD3431432472E006E300F" of Xcode 3 group id "251AD32C14324645006E300F" of project "XcodeTest" of workspace document "XcodeTest.xcodeproj/project.xcworkspace"
The "make new reference" does add the file to the list of files in Xcode, but I also need it to be added to the project target so that I can add actions and outlets to the file from Xcode w/o having to first check the checkbox to add it to the "target membership".
I ended up sending this question to the devs on the xcode developer list and the response I got was effectively "you can't".
This appears to be completely broken in Xcode4, but I've seen a project that does it. I think what they are doing is parsing and modifying the "project.pbxproj" file directly. (this file is hidden inside the xcodeproj bundle)
The file is a GUID soup, but once you look at it for a while it seems possible to safely modify it, especially if you are only adding stuff.
Edit:
Found this stackoverflow answer that might help.
Tutorial or Guide for Scripting XCode Build Phases
There is a poorly documented user defined build setting that can be added. Files can be both excluded and included from compilation
Go to your target's Build Settings > Tap the + button > Add User-Defined Setting
The key is either INCLUDED_SOURCE_FILE_NAMES or EXCLUDED_SOURCE_FILE_NAMES
The value is a space separated list of file paths
See reference:
http://lists.apple.com/archives/xcode-users/2009/Jun/msg00153.html

Resources