QCAR cannot be resolved - wikitude

I download the wikitude sdk and tried the SimpleIRExample project but in this codes
private class VuforiaServiceImplementation implements VuforiaInterface{
#Override
public void deInit() {
QCAR.deinit();
}
#Override
public int init() {
return QCAR.init();
}
#Override
public void onPause() {
QCAR.onPause();
}
#Override
public void onResume() {
QCAR.onResume();
}
#Override
public void onSurfaceChanged(int width, int height) {
QCAR.onSurfaceChanged(width, height);
}
#Override
public void onSurfaceCreated() {
QCAR.onSurfaceCreated();
}
#Override
public void setInitParameters(Activity activity, int nFlags) {
QCAR.setInitParameters(activity, nFlags);
}
}
QCAR is having a redline and the error is QCAR cannot be resolved. please do help me with this please.

you are basically missing the QCAR library. Have a look at http://forum.wikitude.com/home/-/message_boards/message/153377

Related

Keycloak Custom SPI Authenticator - KC-SERVICES0013: Failed authentication

Keycloak version 18
Purpose: I want to store scope parameters in user session notes to be later fetched in my custom protocol mapper. To do the same I am referring to this blog post which talks about creating a custom JS authenticator, however, as I prefer Java, I tried implementing the same in java.
I can see the custom authenticator, in my keycloak server-info and during setup.
Here is my implementation:
public class MyAuthenticator implements Authenticator {
private static final Logger log = LoggerFactory.getLogger(MyAuthenticator.class);
#Override
public void authenticate(AuthenticationFlowContext context) {
log.info("authenticate :: START");
try {
AuthenticationSessionModel authenticationSession = context.getAuthenticationSession();
String sessionClientNote = authenticationSession.getClientNote("scope");
log.info("client note from auth session : " + sessionClientNote);
authenticationSession.setUserSessionNote("scope", sessionClientNote);
context.success();
} catch (Exception e) {
context.failureChallenge(AuthenticationFlowError.INTERNAL_ERROR,
context.form().setError("smsAuthSmsNotSent", e.getMessage())
.createErrorPage(Response.Status.INTERNAL_SERVER_ERROR));
}
}
#Override
public void action(AuthenticationFlowContext context) {
log.info("No Custom Action is set.");
context.success();
}
#Override
public boolean requiresUser() {
return true;
}
#Override
public boolean configuredFor(KeycloakSession session, RealmModel realm, UserModel user) {
return true;
}
#Override
public void setRequiredActions(KeycloakSession session, RealmModel realm, UserModel user) {
log.info("No required actions are set.");
}
#Override
public void close() {
}
}
public class MyAuthenticatorFactory implements AuthenticatorFactory {
public static final String PROVIDER_ID = "my-authenticator";
#Override
public String getId() {
return PROVIDER_ID;
}
#Override
public String getDisplayType() {
return "MY Authentication";
}
#Override
public String getHelpText() {
return "Will read the scope parameters and store in user session";
}
#Override
public String getReferenceCategory() {
return PasswordCredentialModel.TYPE;
}
#Override
public boolean isConfigurable() {
return true;
}
#Override
public boolean isUserSetupAllowed() {
return true;
}
#Override
public AuthenticationExecutionModel.Requirement[] getRequirementChoices() {
return REQUIREMENT_CHOICES;
}
#Override
public List<ProviderConfigProperty> getConfigProperties() {
return Collections.emptyList();
}
#Override
public Authenticator create(KeycloakSession session) {
return new MyAuthenticator();
}
#Override
public void init(Config.Scope config) {
}
#Override
public void postInit(KeycloakSessionFactory factory) {
}
#Override
public void close() {
}
}
Here is how the authenticator is set up as the last step as execution :
However, I get this exception while trying to log in or test this via postman. This is not even hitting the custom code that I have written but failing much before that?
2022-08-01 10:52:21,721 WARN [org.keycloak.authentication.DefaultAuthenticationFlow] (executor-thread-25) REQUIRED and ALTERNATIVE elements at same level! Those alternative executions will be ignored: [auth-cookie, identity-provider-redirector, null]
2022-08-01 10:52:21,721 WARN [org.keycloak.services] (executor-thread-25) KC-SERVICES0013: Failed authentication: org.keycloak.authentication.AuthenticationFlowException: authenticator: my-authenticator
at org.keycloak.authentication.DefaultAuthenticationFlow.processSingleFlowExecutionModel(DefaultAuthenticationFlow.java:437)
at org.keycloak.authentication.DefaultAuthenticationFlow.processFlow(DefaultAuthenticationFlow.java:264)
at org.keycloak.authentication.AuthenticationProcessor.authenticateOnly(AuthenticationProcessor.java:1030)
at org.keycloak.authentication.AuthenticationProcessor.authenticate(AuthenticationProcessor.java:892)
And this is the line number. I don't understand this code and what is it trying to do? My is simple authorization code pattern. Can someone please advice/review my code?
I have also set these flows at client level.

How to maintain order of methods of interface in implemented class

Suppose I am having below interface inside binary jar:
public interface OrderDemo
{
public void add();
public void shut();
public void manage();
}
When I am adding this as Jar as part of dependency in my project in eclipse after implementing OrderDemo interface order of method get changed.
public class Demo implements OrderDemo
{
#Override
public void add();
{
}
#Override
public void manage()
{
}
#Override
public void shut()
{
}
}
Tried option given in eclipse preference but won't work.

Gwtp Autobean and rest

I have InfraNameModel (Rest-type) to work with JSON
public interface IInfraNameBeanFactory extends AutoBeanFactory {
IInfraNameBeanFactory INSTANCE = GWT.create(IInfraNameBeanFactory.class);
AutoBean<InfraNameModel> infraName();
AutoBean<InfraNameListModel> results();
}
public interface InfraNameListModel {
List<InfraNameModel> getResults();
void setResults(List<InfraNameModel> results);
}
public class InfraNameListModelImpl implements InfraNameListModel {
private List<InfraNameModel> results;
#Override
public List<InfraNameModel> getResults() {
return results;
}
#Override
public void setResults(List<InfraNameModel> results) {
this.results = results;
}
}
public interface InfraNameModel {
String getInfraName();
void setInfraName(String infraName);
}
public class InfraNameModelImpl implements InfraNameModel {
private String infraName;
#Override
public String getInfraName() {
return infraName;
}
#Override
public void setInfraName(String infraName) {
this.infraName = infraName;
}
}
I wanted to make them into a separate JAR
To make it common for the client and the server
But now I have errors
[WARN] Class by.models.infraNameModel.InfraNameModel is used in Gin, but not available in GWT client code.
Is it real to pull such beans into a separate library?

Multiple Click handlers

I have different 3 Different Buttons with different onclick events :
add.addClickHandler(new ClickHandler()
{
#Override
public void onClick(ClickEvent event)
{
add();
}
});
set.addClickHandler(new ClickHandler()
{
#Override
public void onClick(ClickEvent event)
{
set();
}
});
get.addClickHandler(new ClickHandler()
{
#Override
public void onClick(ClickEvent event)
{
get();
}
});
So now if i extend this up to 10 Buttons my Script would be far to long,
is there a way to pass the Methode or do seperate the Handlers?
Suppose you have some view:
customview.ui.xml
<g:VerticalPanel>
<style:Button ui:field="addButton" text="Add"/>
<style:Button ui:field="setButton" text="Set"/>
<style:Button ui:field="getButton" text="Get"/>
</g:VerticalPanel>
In your View class define 3 fields and 3 handlers:
CustomView.java
public class CustomView extends ViewWithUiHandlers<CustomUiHandlers>
implements CustomPresenter.MyView {
#UiField
Button addButton;
#UiField
Button setButton;
#UiField
Button getButton;
// Here constructor and other code
#UiHandler("addButton")
void onAddButtonClicked(ClickEvent event) {
if (getUiHandlers() != null) {
getUiHandlers().onAddClicked();
}
}
#UiHandler("setButton")
void onSetButtonClicked(ClickEvent event) {
if (getUiHandlers() != null) {
getUiHandlers().onSetClicked();
}
}
#UiHandler("getButton")
void onGetButtonClicked(ClickEvent event) {
if (getUiHandlers() != null) {
getUiHandlers().onGetClicked();
}
}
}
CustomUiHandlers.java
public interface CustomUiHandlers extends UiHandlers {
void onAddClicked();
void onSetClicked();
void onGetClicked();
}
CustomPresenter.java
public class CustomPresenter extends
Presenter<CustomPresenter.MyView, CustomPresenter.MyProxy>
implements CustomUiHandlers {
// Some code
#Override
public void onAddClicked() {
// Here your code
}
#Override
public void onSetClicked() {
// Here your code
}
#Override
public void onGetClicked() {
// Here your code
}
}
You can bind event handler to a method by UiBinder, or alternatively wait for lambda support for GWT.

refresh listView by clicking outside of it

I have a viewpager with an adapter that extends FragmentStatePagerAdapter, this has to show some fragment that always repeats the same layout (in whic there is a listView) for every page ... now the problem is how can I update the listView that is currently visible by clicking on a button that is outside of the Fragment? I can refresh only the ones that are in the not visible pages,but not the ones that are displayed or adjacent...
One possible solution is to reset the adapter, but it doesn't seems to be right one, because it' s slow... could you please help me?
public class MainActivity extends FragmentActivity implements OnClickListener{
#Override
protected void onCreate(Bundle arg0) {
// TODO Auto-generated method stub
super.onCreate(arg0);
setContentView(R.layout.layout1);
pagerAdapter = new AdapterPager(getSupportFragmentManager());
ctx=this;
mViewPager = (ViewPager) findViewById(R.id.pager);
mViewPager.setAdapter(pagerAdapter);
pagerTab=(PagerTabStrip) findViewById(R.id.pager_tab_strip);
mViewPager.setCurrentItem(paginaCentrale);
modifica=(ImageView)findViewById(R.id.modifica);
modifica.setOnClickListener(this);
}
#Override
public void onClick(View arg0) {
// TODO onClick
switch (arg0.getId()){
case R.id.modifica:
//here I would like to call the method caricaLista() of the fragment
break;
}
}
public static class AdapterPager extends FragmentStatePagerAdapter {
public AdapterPager(FragmentManager fm) {
super(fm);
}
#Override
public int getItemPosition(Object object) {
// TODO Auto-generated method stub
return super.getItemPosition(object);
}
#Override
public Fragment getItem(int i) {
Fragment fragment;
Bundle args = new Bundle();
args.putInt("position", i);
fragment=new Fragment1();
fragment.setArguments(args);
return fragment;
}
#Override
public int getCount() {
return 1000;}
#Override
public CharSequence getPageTitle(int i) {
String title=String.valueOf(i);
return title;
}
}
public static class Fragment1 extends Fragment implements OnItemClickListener{
int fragmentPosition;
ListView lv;
List<Lista> lista= new ArrayList<Lista>();
public Fragment1(){
}
public static Fragment1 newInstance(){
return new Fragment1();
}
#Override
public void onResume() {
// TODO Auto-generated method stub
super.onResume();
caricaLista("")}
}
#Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,Bundle
savedInstanceState) {
View rootView = inflater.inflate(R.layout.fragment1, container, false);
lv=(ListView) rootView.findViewById(R.id.listViewCompiti);
Bundle args = getArguments();
int position= args.getInt("position");
fragmentPosition=position;
lv.setOnItemClickListener(this);
homeListAdapter= new HomeListAdapterWithCache(ctx,R.layout.list_item_home,lista);
lv.setAdapter(homeListAdapter);
return rootView;
}
You have to store the Current Fragment into your MainActivity , and change every time the page changes.
So you call the method of the current fragments.
Check out how your MainActivity should look like:
public class MainActivity extends FragmentActivity implements OnClickListener{
&Fragment mCurrentFragment;*
protected void onCreate(Bundle arg0) {
super.onCreate(arg0);
setContentView(R.layout.layout1);
pagerAdapter = new AdapterPager(getSupportFragmentManager());
ctx=this;
mViewPager = (ViewPager) findViewById(R.id.pager);
mViewPager.setAdapter(pagerAdapter);
pagerTab=(PagerTabStrip) findViewById(R.id.pager_tab_strip);
mViewPager.setCurrentItem(paginaCentrale);
modifica=(ImageView)findViewById(R.id.modifica);
modifica.setOnClickListener(this);
*mViewPager.setOnPageChangeListener(new ViewPager.SimpleOnPageChangeListener() {
#Override
public void onPageSelected(int position) {
mCurrentFragment = pagerAdapter.getItem(position);
}*
});
#Override
public void onClick(View arg0) {
// TODO onClick
switch (arg0.getId()){
case R.id.modifica:
*mCurrentFragment.caricaLista();*
break;
}
}
}