Add a delay to cursor-listener in a-frame - href

i would like to have an a-entity with a cursor listener that triggers a window.location.href but only gazing the object for more than 2 seconds? It's possible ... something like this
http://gasolin.idv.tw/aframe-href-component/basic/link.html
but without an external component in a-frame
Thanks
Luca

The cursor has a property called fuseTimeout:
cursor="fuse: true; fuseTimeout: 500"
Just set it to any miliseconds value.
You can find it in the docs.

Related

Opencart 3.0.3.7 event not catch, not working

Note: I had read tons of information here and another sources, including official docs.
I have a payment extension - ex title simplepay.
I want to know specifically if it is a way to "listen" to a system (predefined) event.
I want to run some logic when an order status has changed.
In the admin/controller/extension/payment/simplepay.php I have this (nothing more elsewhere):
public function install()
{
$this->load->model('setting/event');
/** addEvent($code, $trigger, $action, $status = 1, $sort_order = 0); */
$this->model_setting_event->addEvent(
'do_transaction_on_order_status_change',
'catalog/controller/api/order/history/after',
'extension/payment/simplepay/doTransactionOnOrderStatusChange');
}
public function uninstall()
{
$this->load->model('setting/event');
/** deleteEventByCode($code); */
$this->model_setting_event->deleteEventByCode('do_transaction_on_order_status_change');
}
public function doTransactionOnOrderStatusChange(&$route, &$data)
{
// testing purpose for the moment
$log = new Log('aaaaaa.log');
$log->write('Route ' . $route);
}
The event do_transaction_on_order_status_change is properly registered in events list.
What I am doing wrong?
Nevermind!
After a while I got the point.
My method doTransactionOnOrderStatusChange(&$route, &$data) was writted with 3 parameters.
Like doTransactionOnOrderStatusChange(&$route, &$data, &$output).
The problem is that OC 3+ not accept a third parameter, even if there is a "before" or an "after" event.
And another problem was the related event: it must be admin/controller/sale/order/history/before. (or /after)
No other event on order change worked. (probably this event is the only admin event, the rest being from catalog).
Later edit
The above works only for trigger the method, but had nonsense to do what was supposed to.
So, after other research time, it was obvious that the event I need to listen to was: catalog/controller/api/order/history/after. (an event raised from admin, but from catalog, weird!!).
To listen to that event, was need to make another controller in catalog/controller/extension/payment/simplepay.php then put that method (doTransactionOnOrderStatusChange) inside it.
Note that my question contains the proper event.
I hope someone will find this helpful!

How to make a form save to the database every time it is edited in Django?

So I am trying to replicate the Google Docs functionality wherein every time you edit, the document will be saved. Will I be putting an onchange function on every input in the form then sending the data through ajax? How should I approach this or is this even feasible?
Note: I am just asking for some sort of pseudocode or simply the flow-chart of how I should do things.
I think that something like this should works:
jQuery(function($){
function changeFn(){
// make ajax save.
}
var timer;
$("#doc").bind("keyup", function(){
clearTimeout(timer);
timer = setTimeout(changeFn, 2000)
});
});
This will wait 2 seconds(you can try with 3 - 5 seconds) after the user press the last key, then will call the ajax function to save the content. I think that is better than save all the time when the user press a key. Note that if the user press a key before that time, the timeout will be interrupted and will initiate a new count.

How to get bounds after MapboxGeocoder flyto event?

Looks like if I call map.getBounds inside geocoder I always get the previous results.
Is there a callback or something to get the bounds after geocode flies to the destinations. Here is my code:
var geocoder = new MapboxGeocoder({accessToken: mapboxgl.accessToken});
geocoder.on('result', function(ev) {
console.log("CENTER:",ev.result.center);
console.log("BOUNDS:",map.getBounds());
//loadByBounds(map.getBounds());
});
Maybe you can react to the mooveend event by applying an event listener.
"Mooveend: Fired just after the map completes a transition from one view to another, as the result of either user interaction or methods such as Map#jumpTo."
https://www.mapbox.com/mapbox-gl-js/api/#map.event:moveend

c++ quickfix failure to send

I'm having an unexpected issue with a c++ quickfix client application using FIX 4.4. I form marketdatarequest and populate it and then call send which returns true. The message is not found in the message or event log files.
No error seems to be reported - what could be happening?
FIX44::MarketDataRequest request(FIX::MDReqID(tmp)
, FIX::SubscriptionRequestType('1')
, FIX::MarketDepth(depth)); // 0 is full depth
FIX::SubscriptionRequestType subType(FIX::SubscriptionRequestType_SNAPSHOT);
FIX44::MarketDataRequest::NoRelatedSym symbolGroup;
symbolGroup.set(FIX::Symbol(I.subID));
request.addGroup(symbolGroup);
FIX::Header &header = request.getHeader();
header.setField(FIX::SenderCompID(sessionSenderID));
header.setField(FIX::TargetCompID(sessionTargetID));
if (FIX::Session::sendToTarget(request) == false)
return false;
My FixConfig looks like:
[DEFAULT]
HeartBtInt=30
ResetOnLogout=Y
ResetOnLogon=Y
ResetOnDisconnect=Y
ConnectionType=initiator
UseDataDictionary=Y
FileLogPath=logs
[SESSION]
FileLogPath=logs
BeginString=FIX.4.4
DataDictionary=XXXXX
ConnectionType=initiator
ReconnectInterval=60
TargetCompID=tCompID
SenderCompID=sCompID
SocketConnectPort=123456
SocketConnectHost=XX.XX.XXX.XX
SocketConnectProtocol=TCP
StartTime=01:05:00
EndTime=23:05:30
FileLogPath=logs
FileStorePath=logs
SocketUseSSL=N
thanks for any help,
Mark
Mark, just couple of notes not really related to your question but which you may found useful:
you dont have to explicitly set TargetCompId/SenderCompId for each message, engine will do it for you.
Do not place logic into callbacks(like you did with market data subscription in onLogon). Better create additional thread which will consume events from you listener, make decisions and take an action.

Webview - how to detect if an url is invalid in Blackberry Cascades

I am trying to find a way to detect whether an url is an invalid url for a webview
For example, if I do
myWebView->setUrl(QUrl("http://www.youtube.com")); //then the webview will change to that page, but if I do...
myWebView->setUrl(QUrl("youtube.com")); //it will not change, because it considers it an invalid url.
Is there some kind of signal, or some sort of property that I can use to detect that?
Yes you have solution for this:
You can use inbuilt function isValid();
For eg :
myWwebView->url().isValid(); //It will return true or false value.
For more help refer following link
You can connect to the WebView's loadingChanged signal to find out if a page loaded successfully or not.