In Spark AR, how do I enable different custom instructions based on which camera is active? - spark-ar-studio

I am trying to make some patches that essentially say,
if front camera is active, display instructions "flip the camera"
if back camera is active, display instructions "tap to start" after 2 seconds
I've tried to show that in the patches below, but I know I'm using the Available Tokens Option Picker incorrectly. Any suggestions? Not a lot of documentation on this.
I tried modifying that to select 0 or 1 but I can't seem to do that with the if then else (as I've attempted below):
Any suggestions? This is definitely a data type issue, but I am not sure which patches would be best to solve this.

I found an elegant solution for this, which works only because the camera is either front or back (binary option):
I don't have an answer for >2 instructions in the option picker just yet, but I think the community would benefit it someone knows that particular solution.

Related

Corona SDK: Saving Scores

I am making a game in Corona SDK in which I want to be able to save the player's high score to the device that they are using's disk, just so that it will stay saved even if the user restarts the app.
Problem is, everywhere I go online for help on this sort of thing I am told I should be using JSON, but I am not sure if there is a simpler way of doing things or even if JSON is the right approach.
Maybe try Introducing new preference storage features.
heres a neat thought that may work. make a new scene that contains the high score variable but dont erase the variable when exiting. then everytime they want to check their high score they just have to go to the scene.
option 2 - this one is a bit more tricky and im not exactly sure if you need permissions aka administrator rights (and if you are submitting your app on googleplay you may need to ask for permission. so review the rules before doing it), write a batch file that copies the highscore into a new file.
option 1 is better because you are not necessarily adding anything.

Disabling notifications in PHP Storm 9

I am using PHPStorm 9.
I have installed PHPCS to sniff my code. It is properly configured, up and running.
I am working on a very old project, which was implemented in plain PHP, and not using any code standard.
As a result, every time I open any of those files, I get a message at the top of the screen saying that I have too many errors (code style errors).
I have a couple of problems with that.
First, I already know how bad the code is, so I don't need PHP Storm to tell me that all the time.
Second. That message appears and disappears every time I edit the code. As a result, the window editor is constantly moving up and down, which I find specially annoying.
Also, at the top of the screen it is showing me the breadcrumbs, to tell me where I am. I appreciate the help, but I don't actually need it.
So the question is, how can I configure the IDE to disable those two messages? (read arrow and orange arrow in the attached image).
Please notice that I don't want to disable PHPCS. I only want to turn off those annoying messages.
I was unable to find it out by myself because I don't even know how those messages are called. Certainly not 'popups', nor 'status bar'
Best regards
Nicolas
Answering my own questions, thanks to the help of the PHPStorm Support team, Vladimir Luchansky (perhaps you need to create an account to see the thread):
To disable breadcrumbs: Go to File->Settings->Editor->General->Appearance, and untick the option Show HTML Breadcrumbs. Then restart the IDE
To disable the PHPCS messages without disabling PHPCS itself: Well, that option is not available in PHPStorm 9. It will be available for a future release. According to Vladimir, a developer is working on it. In order to make this request to go up in the future request list, the request needs to get as much 'votes' as possible. So, if you are interested in this feature to be ready ASAP, please vote up here.
Best,
Nicolas
I don't believe there's any mechanism for suppressing those phpcs: Too many messages per file alerts. As an alternative solution, you could give this work-around a try:
Clone your current inspection profile via Preferences > Editor > Inspections. Name the new one "Strict (with phpcs)". Then, choose your old inspection profile from the Profile: dropdown box (thus, reverting your project's default inspection profile to your old one). Rename it to "Weak (without phpcs)" and disable phpcs for that particular profile by unchecking the PHP > PHP Code Sniffer validation option.
From this point forward, phpcs inspections (and related alerts, like the one you're concerned about) won't come into play as you're editing your files. However, whenever you do want to inspect one of your files using PHP Code Sniffer, you can do so easily via Code > Inspect Code > Inspection Profile > Strict (with phpcs)
Hope this helps!

An autocompleting combobox

I'm trying to extend the behaviour of ttk::combobox to make it behave like the Google search box in my browser - i.e. I'd like it to drop down automatically and limit the entries in the listbox to those which match the string that I've typed in so far. Ultimately, I'd like to select the part of the string that's been autocompleted so that the next character the user types will cause it to be deleted and re-start the matching process.
I found the page on the Tcler's wiki, but that appears to select the entry with the letter just typed, which isn't what I want. (Consider a user selecting from a list of US States. When they type A, I want the selection to be limited to Alabama, Alaska, Arizona and Arkansas; when they then type an L, the list should be limited to Alabama and Alaska. The code on the wiki would select Alabama when the user types A, then Louisiana when they type L.)
I tried defining a few bindings on the ttk::combobox, but gave that up - to be honest, I can't remember why - and have tried to extend the behaviour of a ttk::entry to cover it.
After borrowing liberally from ttk/combobox.tcl I've managed to post a listbox and to limit the entries in the listbox, but am having big problems now that I've added bindings to make the up and down arrows alter the selection. To be precise, the selected item is moved happily, but some of the time when the entry widget loses focus, the whole application hangs up and my tclsh soaks up all the CPU.
I'm developing using ActiveTcl 8.6 on both Windows and Linux and the code seems to behave the same on both platforms, although I haven't tried on Linux since I first saw it not hanging in Windows. I'd be very happy to share my code, but since the demo script runs to about 450 lines, I wouldn't read it myself if someone else posted that much.
Can anyone help by asking the right question to set off a lightbulb for me? The problem feels like a timing problem, but I've no idea where to start trying to track it down.
Many thanks.
Edit I've been racking my brain, and I think the reason I abandonned the attempt to extend ttk::combobx was because there were already a large number of bindings in place, and some did things that I didn't want. The current effort uses a validatecommand on the entry widget and Key-Up, Key-Down, FocusIn and FocusOut bindings.
Current code is on pastebin here.
Well, that was embarrassing!
I took another look at the code on the wiki and discovered that it did the thing I most wanted. It doesn't post the listbox, but it does autocomplete, and if you attempt to navigate the (unposted) listbox, by pressing Key-Up or Key-Down, it starts off with the appropriate item highlighted.
That's quite enough for what I need; if I decide I really must have the listbox posted, I can see about that at the time. (Given my bad experience trying to roll my own, however, I suspect that I'll just live with this.)
Many thanks for the forebearance and suggestions.

How to make wp8 app keep alive

In my app, I'd like to disable the automatically sleep function. I want it keeps alive all the time.
I tried searching it, however couldn't find any answer. (maybe I didn't find the correct keyword).
So, please anyone tell me how to do it. Thank you
You can do this by disabling UserIdleDetection.
Please look into
UserIdleDetectionMode Property
Idle detection

Detecting what changed in an HTML Textfield

For a major school project I am implementing a real-time collaborative editor. For a little background, basically what this means is that two(or more) users can type into a document at the same time, and their changes are automatically propagated to one another (similar to Etherpad).
Now my problem is as follows:
I want to be able to detect what changes a user carried out onto an HTML textfield. They could:
Insert a character
Delete a character
Paste a string of characters
Cut a string of characters
I want to be able to detect which of these changes happened and then notify other clients similar to "insert character 'c' at position 2" etc.
Anyway I was hoping to get some advice on how I would go about implementing the detection of these changes?
My first attempt was to consider the carot position before and after a change occurred, but this failed miserably.
For my second attempt I was thinking about doing a diff on the entire contents of the textfields old and new value. Am I missing anything obvious with this solution? Is there something simpler?
It is a really hard work make this working today, for several reasons, but
maybe you will need to restrict only to some browsers. read: https://developer.mozilla.org/en/XUL/Attribute/oninput the alternative to "oninput" is listen to all input events (keyboard, mouse, dragdrop) I suggest to use "oninput"
html is not perfect... even html5. input and textareas supports only single-range
selections. you can solve this using designmode/contenteditable instead of
textareas/textfield
detecting offsets of what changed is a hard work: read
-- https://developer.mozilla.org/en/Document_Object_Model_%28DOM%29/window.getSelection
-- http://www.quirksmode.org/dom/range_intro.html -- http://msdn.microsoft.com/en-us/library/ms535869%28v=VS.85%29.aspx -- http://msdn.microsoft.com/en-us/library/ms535872%28v=VS.85%29.aspx
you may need a "diff" algorithm written in javascript! http://ejohn.org/projects/javascript-diff-algorithm/
one personal note: detecting words, characters changes may be totally non-sense and not useful, detect instead paragraphs changes, or in case of an excel-like worksheet, the single cell
I hope this helps
feel free to correct my English!
My pseudocode/written out response would be (if I understand your question exactly) to use jQuery to detect keyup events and then save the input to the server via ajax, then also take the response and post it back to the input. This isn't very efficient, but basically the idea is that you're constantly posting and checking what else has been posted. If you want to see what someone else is doing in real time, you can ping the server every second or so and update with the response.
All of this of course can be optimized, but it still is kind of taxing for a server. You could also see if you can implement Google Topeka Wave for your project, or get in touch with Google Topeka to see how they do it :)