How to find out if Unity plugin hangs (from unityscript) - unity3d

Unity player on my page hangs sometimes. Is it possible to detect it from unityscript (polling method is acceptable) and react to that- for example reload page?

a colleague ran into this issue, I believe that after an extend research with no good results he came up with this solution:
In the web page declare a global variable stillAlive for example.
Use setInterval to check for that variable every n second, something like this:
if (stillAlive){
stillAlive = false;
}else{
//do things
}
Make an Application.ExternalEval call in your application every n/2 seconds, something like this
Application.ExternalEval ("stillAlive=true;");
I don't know the exact details, but he did something to sync those. I'm sure you can figure something out along this idea.
Note: For some reason I couldn't format the code in this answer, so if someone can fix it, please do.
Update: I've just asked him, he said he "synced" them by initiating the setInterval() with Application.ExternalEval().

Related

Is it possible to send HTTP GET Requests from a Simulink Block?

basically the title says it all. I'm working on a model that needs (there is no way around it) to load data from a website, parse it and pass it onto another block. I thought I could use an S-Function written in C++, which didn't properly work, then I tried to use webread()
which also didn't work in Simulink because I can't use extrinsic functions on the device this will run on.
I thought I could work around it by downloading the file externally and then reading it through fscanfbut it turned out that Matlab CODER doesn't support that as well.
After putting 2 1/2 days into this now, I'm asking myself whether it is even possible to do something like an HTTP Request through a Simulink block. That's why I went here to ask that question. Thanks for every answer!
I figured out a way to do it with a C++ S-Function by now.
I also created a GitHub Repo for it. If you're stuck with the same problem as I was, try to take a look at this. I'm pretty sure it will help you.

How do I stop prism.js from processing automatically

I want to call Prism.highlightElement or Prism.highlightAll after doing some other javascript processing on my code blocks. I can somewhat control the moment that Prism processes by where I place the <script src="prism.js"></script> but I don't see a way to disable automated processing.
Super kludgy answer:
Even though I asked for the development, not minified, version of prism.js when I download, what I got is kind of minified. Anyway, I found this bit of code:
var a=document.getElementsByTagName("script")
and changed it to this:
var a=document.getElementsByTagName("scriptxx")
So, nothing gets highlighted now, until I explicitly call Prism.highlightAll().

Concrete5 isEditMode()-like handler to get Information about active editing or publishing

So my question is if there is a Concrete 5 handler/listener instead of
isEditMode()
that tells if the user is in active Editing mode or if he just has published his Edit?
Something like
isPublished() or isEditModeActive()
Thx yall
thanks for your interest!
So i tried the Eventhandler in the way it is decumented in the second example:
1. i created site_events.php in the /config
2. i added
<?PHP Events::extendPageType('inhalt', 'on_page_version_approve');?>
i added to the site.php
define('ENABLE_APPLICATION_EVENTS', true);
on the reffered inhalt.php pagetype i added
function on_page_version_approve() {
echo "page published";
}
... nothing happens.
In the description it is written, that the refferring inhalt.php has to exist in /controllers. However, this is not the case. I actually dont quite understand the structure of the Eventhandling. It would be great if you could help me out there...
Thanks in advance anyways :)
It sounds like you want what concrete5 calls Events (http://www.concrete5.org/documentation/developers/system/events/).
As per the docs, you'll get the Page as arguments to the functions you register.
There is nothing quite as specific as what you're looking for, but:
For published, use on_page_version_approve.
For editing, try on_before_render. It's a bit generic (ie, it'll be getting called far more than you're interested), but you can do something like if ($page->getCollectionCheckedOutUserID()). You should experiment a bit with this, though. For example, if you check out the home page for editing, and then someone else loads the live version, the event will probably get called again, and the Page will probably show "checked out". But maybe you can check ->isEditMode(), which should check it against the logged in user...

JQT gotofunction problem

i am trying to use the goTo function to switch between different divs.
but in the function goTo(id,animation)
it is not going to that id.
Can anyone please help me with this problem.
Thanks,
Devan
This is difficult to diagnose without looking at your code. I have a few ideas, but it would be best if you were to share the problematic section of your code for others to investigate.
A few questions/ideas:
1) Check to ensure you have not used the same div ID more than once.
2) Have you been able to successfully use the goTo function at all?
3) Can you create a basic HTML page that uses this function successfully?
4) What version of jQTouch are you using? Does the goTo function work once, and then freeze every time afterwards? I reported a bug regarding this behavior a while ago. Not sure if it's been resolved yet, but you could see if an older version of jQTouch might help.
Again, without examples of your code... I'm taking wild guesses. Consider sharing the problematic section and someone might be able to pinpoint the issue.
Don't put animation, without animation worked for me...
eg..
jQT.goTo('#rest');

User Authorization in KohanaPHP App vs Endless Loop

Wondering how to name this question. Think this is the best situation possible.
Situation:
I got small app written in KohanaPHP framework. However there's one small bug that makes my crazy.
I got my own Core_Controller that is extended by every controller in this app. In constructor of this controller, I'm checking user profile status. So far so good. Although I'm facing a logical issue. It's called endless redirect loop. If I try to redirect (in Core_Controller constructor) user to Member_Controller it cannot be workig due to endless lopp. I understand why it happen.
Solution:
I'm looking for a solution how to make it flexible. I tried to move this verification to a helper and call it in Core_Controller constructor. However, it can be working correctly.
Question:
Do I have to put verification in constructor of every single controller? IS there any universal method to do it?
Waiting for your thoughts.
M.A.
Just check if user is verified and the current request's action isn't something like member/verification, do the redirect.
And parent::__construct(); will call the parent constructor, so I don't see the problem in that either..
You need a condition where it doesn't redirect (on the page you have redirected to). You'll want some code similar to this.
if not member_controller then
redirect to member_controller
else
do nothing
endif
The else isn't needed, but just added so it's more clear to you.