Clearing stored usernames and passwords for webview Basic4Android - basic4android

How do you clear usernames and passwords for a webview?
Tried:
reflect.RunMethod2("clearCache","True","java.lang.boolean")
reflect.RunMethod("clearFormData")
They still pop-up.
Thanks,
-Sean

This is Java code that solves what you want. Maybe can be useful to you if you find basic4android equivalent:
Preference myPref = findPreference("myPref");
myPref.setOnPreferenceClickListener(new OnPreferenceClickListener() {
#Override
public boolean onPreferenceClick(Preference preference) {
MyActivity.mWebView.clearCache(true);
return false;
}
});

Related

Can I prevent Mongodb $set from the client side with Meteor?

I need help not allowing a visitor to increase their score in the browser console of a meteor app.
Currently a "hacker" can increase his game score by typing this in the console:
Meteor.users.update({_id:Meteor.userId()}, {$set:{"profile.score":1000000}})
#Vasil Nedyalkov's answer could be considered right, but I would do this instead:
Meteor.users.deny({
insert() { return true; },
update() { return true; },
remove() { return true; },
});
As well as removing insecure and autopublish like he said.
This is a good explanation:
https://guide.meteor.com/security.html#allow-deny
Did you remove the 'insecure' and the 'autopublish' package. Please see https://www.meteor.com/tutorials/blaze/security-with-methods
remove the 'insecure' and the 'autopublish' package as Khai said.
and add
Meteor.users.allow({
update:function(){
return false;
}
})
on server side

Dont want to allow manual tagging in bootstrap tokenfiled

I am using bootstrap-tokenfield http://sliptree.github.io/bootstrap-tokenfield/ with jquery autocomplete. I want tagging with autocomplete content(from dropdown only). When user is inputting something and hit enter key it automatically creates tags. I dont want to allow this feature to the users. Is there any option/flag to set it? Any help would be appreciated. Thanks in advance.
Using listener tokenfield:createtoken you can validate the token before creating it.
Info: http://sliptree.github.io/bootstrap-tokenfield/#events
$('#tokenfield').on('tokenfield:createtoken', function (event) {
var exists = false;
$.each(yourSource, function(index, value) {
if (event.attrs.value === value) {
exists = true;
}
});
if(!exists) {
event.preventDefault(); //prevents creation of token
}
});

How to clear the selection in the selection service Eclipse RCP?

How do I clear the selection in my Eclipse RCP application?
Basically I would like to clear it on escape key down:
Display display = PlatformUI.createDisplay();
display.addFilter(SWT.KeyDown, new Listener() {
#Override
public void handleEvent(Event event) {
if (event.character == SWT.ESC) {
// if this is escape key, clear selection in the application
}
}
});
I thought I would be able to do something like PlatformUI.getWorkbench().getActiveWorkbenchWindow().getSelectionService().clearSelection()/setSelection(IStructuredSelection.EMPTY), but no go.
You need to look up the ISelectionProvider rather than the ISelectionService. That will provide you with a setSelection() method.
You can get the selction provider from the site:
PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActivePart().getSite().getSelectionProvider();
or
PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor().getSite().getSelectionProvider();
Note that some of those return values could be null so add the appropriate checks.
You can't clear the selection provided by the selection service directly.
The selection the service returns is provided by a 'selection provider' (ISelectionProvider) for the current part.
You can get the selection provider from an IWorkbenchPart with IWorkbenchPart.getSite().getSelectionProvider().
ISelectionProvider has a setSelection method but it often does nothing or throws an exception so you may not be able to clear the selection.

KeyBindings in JavaFX 2

How to use KeyBindings in JFX 2? I need to reassign Enter key from carrige returning to my own function, and for carrige returning assign CTRL+ENTER
I've tried this way, but still it makes a new line.
messageArea.addEventFilter(KeyEvent.KEY_PRESSED, new EventHandler<KeyEvent>() {
#Override
public void handle(KeyEvent keyEvent) {
if (keyEvent.getCode() == KeyCode.ENTER) {
sendMessage();
}
}
});
As an addition to jewelsea's answer. To control key combinations use:
if (event.getCode().equals(KeyCode.ENTER) && event.isControlDown()) { // CTRL + ENTER
messageArea.setText(messageArea.getText() + "\n");
}
in your handler.
If want to prevent the default behavior of event you are filtering, you need to consume it.
There are numerous kinds of KeyEvents, you may want to filter on KeyEvent.ANY instead of just KeyEvent.KEY_PRESSED and consume them all.

can't tap on item in google autocomplete list on mobile

I'm making a mobile-app using Phonegap and HTML. Now I'm using the google maps/places autocomplete feature. The problem is: if I run it in my browser on my computer everything works fine and I choose a suggestion to use out of the autocomplete list - if I deploy it on my mobile I still get suggestions but I'm not able to tap one. It seems the "suggestion-overlay" is just ignored and I can tap on the page. Is there a possibility to put focus on the list of suggestions or something that way ?
Hope someone can help me. Thanks in advance.
There is indeed a conflict with FastClick and PAC. I found that I needed to add the needsclick class to both the pac-item and all its children.
$(document).on({
'DOMNodeInserted': function() {
$('.pac-item, .pac-item span', this).addClass('needsclick');
}
}, '.pac-container');
There is currently a pull request on github, but this hasn't been merged yet.
However, you can simply use this patched version of fastclick.
The patch adds the excludeNode option which let's you exclude DOM nodes handled by fastclick via regex. This is how I used it to make google autocomplete work with fastclick:
FastClick.attach(document.body, {
excludeNode: '^pac-'
});
This reply may be too late. But might be helpful for others.
I had the same issue and after debugging for hours, I found out this issue was because of adding "FastClick" library. After removing this, it worked as usual.
So for having fastClick and google suggestions, I have added this code in geo autocomplete
jQuery.fn.addGeoComplete = function(e){
var input = this;
$(input).attr("autocomplete" , "off");
var id = input.attr("id");
$(input).on("keypress", function(e){
var input = this;
var defaultBounds = new google.maps.LatLngBounds(
new google.maps.LatLng(37.2555, -121.9245),
new google.maps.LatLng(37.2555, -121.9245));
var options = {
bounds: defaultBounds,
mapkey: "xxx"
};
//Fix for fastclick issue
var g_autocomplete = $("body > .pac-container").filter(":visible");
g_autocomplete.bind('DOMNodeInserted DOMNodeRemoved', function(event) {
$(".pac-item", this).addClass("needsclick");
});
//End of fix
autocomplete = new google.maps.places.Autocomplete(document.getElementById(id), options);
google.maps.event.addListener(autocomplete, 'place_changed', function() {
//Handle place selection
});
});
}
if you are using Framework 7, it has a custom implementation of FastClicks. Instead of the needsclick class, F7 has no-fastclick. The function below is how it is implemented in F7:
function targetNeedsFastClick(el) {
var $el = $(el);
if (el.nodeName.toLowerCase() === 'input' && el.type === 'file') return false;
if ($el.hasClass('no-fastclick') || $el.parents('.no-fastclick').length > 0) return false;
return true;
}
So as suggested in other comments, you will only have to add the .no-fastclick class to .pac-item and in all its children
I was having the same problem,
I realized what the problem was that probably the focusout event of pac-container happens before the tap event of the pac-item (only in phonegap built-in browser).
The only way I could solve this, is to add padding-bottom to the input when it is focused and change the top attribute of the pac-container, so that the pac-container resides within the borders of the input.
Therefore when user clicks on item in list the focusout event is not fired.
It's dirty, but it works
worked perfectly for me :
$(document).on({
'DOMNodeInserted': function() {
$('.pac-item, .pac-item span', this).addClass('needsclick');
}
}, '.pac-container');
Configuration: Cordova / iOS iphone 5