2017년 5월 15일 월요일

Yandex Translator and API key.


Can someone tell me what the limitations are for using Yandex Translator component without a personal API key and how I can use my own API key. I am not good at programming, a simple tutorial would be perfect.

--
App Inventor's Yandex component does not use personal API keys.  This is a special arrangement between App Inventor and Yandex.

Give that, I don't know why you'd want to use a personal key, but in any case, the translate component is not set up to do.

If for some reason, you really really want to use Yandex with a personal key, you'll have to do it by sending commands using the Web component, after registering with Yandex for a personal key.

--
A free personal Yandex Translator API key gives you ten million characters a mounth. How is it when using Yandex component in an app inventor app? Is there any limitations? If so, does the translation limitations include all the users of the app or are they personal for every user?

--
App Inventor's use of the Yandex translator does not involve personal keys or use limitations for individual App Inventor users (or App Inventor apps they create).
You don't provide a key when you use the App Inventor Yandex component.   

--

Yandex Translate problem


Hello,I created a translate app,but when i download to my phone to test it,I get a 2202 or smething error with this text "Translation service isnt available".

What I have done wrong?Does the translator require a yandex API key?(havent added an api key as there was not a textbox of that in the component properties.)

--
you do not need your own API key, see also Yandex Translator and API key.

It would really help if you provided a screenshot of your relevant blocks, so we can see what you are trying to do, and where the problem may be.

--
Here is a screenshot



--
please add the screenshot as png or jpg image directly into this post, some people do not like to click onto unknown links...
--
Its just gyazo image,nothing malicious.

Did you see it?

--
Ok sorry here is the image


--
what is your source language?
the example works for me translating english to russian
See http://api.yandex.com/translate/ for more information, including the list of available languages and the meanings of the language codes and status codes. 

--
It says I need to have an active link to yandex site in the app screen

--
you forgot to tell us your source language...
I prepared a snippet for you, see here How to use the YandexTranslate component  yandex.aia

--
How I do this if,then,else?

Control blocks only have if then,without else

Sorry if noob question,but I am new

--
Still the same error."Error 2202:The translason service is not available,please try again later"

There is no specified source language,it says that yandex automatically recognise the language of the text the user inputs in the textbox.


-
To add an ELSE to an IF,
use the blue square and drag  it in to the 
voodoo doll.

--
Translate still doesnt work in my app,still the 2202 error.

--
you need internet access for the Yandex translate component

--
It has internet access

--
do you use a device for your tests? if yes, which device and Android version? or do you use the emulator?
did you try to open a URL with the webviewer to check, if you have internet access?
I get the error 2202 if my device is in flight mode...
you still did not tell us your source language... in my example I used english as source language and russian as target language... probably you are using an exotic source language, which is not available?

--

search for Yandex Translate Error 2202


Still the same error."Error 2202:The translason service is not available,please try again later". There is no specified source language,it says that ...
Error 2202: The translation service is not available; Please try again later. Has anyone else had this problem? Does anyone know how to fix it? What is ...
It doesn't translate from English to Indian languages (like Hindi,Tamil,Telugu etc... .).when I try to translate , It shows error 2202 . I use language codes ...
public static final int ERROR_TRANSLATE_SERVICE_NOT_AVAILABLE = 2202; . public static final int ERROR_TRANSLATE_JSON_RESPONSE ...

I make a translator app with appinventor2 but had a few errors plz help


Bad arguments to select list item
The operation select list item cannot accept the arguments:, [200],[1]

and sometimes Yandex is not working with 2202 error...






--
When the web API returned, you applied the JSON decode
to the wrong item.

You tried to decode the response code, which is just
a number (200) to tell you the web call worked.

The proper item to decode is responseContent,
which has the JSON text.

--

Store and send picture in MYSQL DATABASE


I am now done with login and register of my application thanks to those help me (from here), what I need to do now is store the pictures i send from my app to my database (mysql).
Does anyone here know how to do that?  
when I send pictures (that has been capture that time, no need to pick an image) to the database (mysql) it will be stored in there and I can get that later to post on my website. 

--
Use Taifun's SQLite Extension: puravidaapps.com/sqlite.php
If SQLite isn't that, what you search You can write an Extension, see this topic:


--
Sorry for the empty socket in my answer above. Search in this Group "How to make an extension". There's a topic from me, how to make an extension.

--
app
instead of storing an image in the database, store it on the web server
in the database, store the link to the uploaded image

to upload the image you can use

or

@Nico: mysql is a server database, sqlite is the local Android database...

-- 
Ah Yes! Thank you!

--

The future of App Inventor


I'm new to App Inventor and I have a few questions that I couldn't find the in General Chat.  Before I embark on an application, is there any information on the following:

1. Longevity - how long will App Inventor be around? Is it an MIT project, is there a risk it could disappear without notice?
2. For Profit - I haven't seen anything that says I cannot create a "for profit" app, am I missing something? Are there risks doing this?
3. Donation/Contribution - If I am profitable, is there an opportunity to support App Inventor (donation, subscription, etc)?

--
1) it will be around for ever... and in case MIT drops the project, you always can run your own personal server, see here Overview: Different App Inventor Distributions and Versions

2) you can do that, the only thing is, you can't protect your app, for example using app licensing https://developer.android.com/google/play/licensing/index.html

3) let's see, if someone from MIT can answer this question...

--
To elaborate on Taifun's response:

1. We publish App Inventor as open source code available on GitHub. This allows anyone to take it and build off of it, and in the unfortunate situation where we were to ever need to discontinue the project it would still be possible for individuals to continue to build/update apps. This was done intentionally in order to protect users of App Inventor from this very situation.

2. You can publish your app via the Google Play Store using the instructions Taifun linked. I also understand it to be possible to publish via the Amazon store as well, but I've never tried it. When you build an APK you can do whatever you like with it and we place no licensing restrictions on you. You also maintain all rights to your app.

3. Currently, you can make a gift to support App Inventor via the MIT Giving site. This link will prepopulate the form with the App Inventor Fund. We are working on additional mechanisms to support MIT App Inventor and will announce those in the future.

Please let us know if you have any further questions.

--
Thanks so much!

-- 

Bug in AI2 where unbound local variable getters are treated as Gnu package names


I posted a question for Lyn in another topic and then saw that it had been closed due to inactivity so I'm reposting here as a separate topic per suggestion from the system.

Lyn mentioned in April last year that on his ToDo list was fixing "... a bug in AI2 (...) where unbound local variable getters encountered in a DoIt are treated as Gnu package names inside the Companion interpreter."

I wrote:

I'm tripping over what appears to be exactly the same issue - the Segment function evaluates Start to be "package $number" rather than a numeric value. Screenshot attached for more info (I hope it's self-explanatory). I'm stepping through a user-entered string of text to remove any non-valid characters (valid characters are provided by a reference string) to produce a "cleaned" version (which is later tested for being null before going on to further processing).

I've pulled out DoIt responses to illustrate the trace. The variable name for Each is the default (I've tried using my own variable names to no effect, and globally-defined variables make no difference). The error message from either Segment is the same: "Error from Companion: The operation segment cannot accept the arguments: 123456 package $number 1".

I wondered whether you had had a chance to fix the issue you identified, and if so, why the error might persist. At the moment this is something of a deal-breaker for me - I can find no way around needing to step through the input text in order to clean it up.

Grateful for any feedback,

--
you can't debug local variables
see again ABG's sample of how you can use Do It inside a loop.

--
The problem began when I tested an installed .apk under development and the app crashed with an error message: "Invalid text operation. Segment: Start is less than 1 (0)" and an End Application button. I'd had problems trying to get the emulator to function reliably so I'd transferred the work in progress to an elderly Android device to test functionality.

When I examined the blocks for my project in AI2 there were a number of warnings (red triangle containing an exclamation mark), all of them saying the same thing (which I included in my post): "Error from Companion: The operation segment cannot accept the arguments: {entered text} package $number 1" where {entered text} was provided by the user. If you pull up the graphic I included you can see the warning symbols.

This meant that Segment was not looping from 1 to the length of the provided text string in increments of 1 as it should have. I understand that it's not possible to debug local variables (at least, not without laboriously stepping through from right to left in each block within a loop), but that's not the issue here. The issue is the trigger of warnings and AI2 reporting that Companion cannot accept the values being passed to Segment.

In the meantime I have updated Companion in the emulator and it seems to be a little more reliable; however, the warnings in the Blocks Viewer persist. I have since recompiled the .apk and tested it again on the Android device, and this time there is no fatal error in the app and the cleaning process appears to work as intended. But the warnings (six of them) still persist in AI2 Blocks Viewer online and they all report the same issue: "... The operation Segment cannot accept the arguments..."

If those warnings will go away eventually (when there's a fix for the problem that Lyn identified) I can live with that.

--
just delete these comments
number is a local variable and you can't debug this
--
There is no option to delete the red triangle (!) warnings. The comments (?) I invoked in order to show how the warnings arose.

--
as a workaround you can replace the affected blocks with new blocks from the text drawer to get rid of the warnings

--
An interesting solution but it worked - thank you! Not something I would ever have thought of doing...

PS Actually I just duplicated the whole set of blocks, deleted the original, and renamed the duplicate (and fixed a failed call in another procedure), but it had the same effect. PB

--

"For each" loop that starts at 1 apparently indexes list at 0


Hello -- I keep running into this list problem during development. 


Depending on the stage of my project, I have either had this error (a) arise consistently or (b) occasionally, with no apparent reason why it arises or stops being a problem, though I suspect it has to do with the exact context of when this loop is executed in the order of things. Sometimes it stops the app, sometimes it lets the app run but also generates an error message. The message appears to arise from Appinventor trying to access index#0, but I start my "For each" loop at 1.

I suspect I am using or setting up my list incorrectly.  Please see the attached screen capture (attachment 1) of the list. It is a list of sets of 4 comma-delimited numbers.

To simplify my diagnosis of the problem, I abstracted part of my actual loop as a test, but have it still drawing from the actual list. That is attachment 2.

--
Sorry, here are the screen captures.



--
for lists it's easier to use the for each item in list loop instead of the for each number from loop

--
for lists it's easier to use the for each item in list loop instead of the for each number from loop
Ironically, it was the "each item" loop that first gave me trouble, so I switched to this.
Also, below is the more detailed message I got telling me that it was trying to access item#0

Select list item: Attempt to get item number 0, of the list (1,0,1,1 1,1,4,1 4,1,5,1 5,1,5,0 4,1,4,2 4,2,6,2 6,2,6,3 6,3,4,3 4,3,3,3 3,3,3,2 3,2,2,2 2,2,2,5 2,5,3,5 3,5,5,5 5,5,5,6 5,6,6,6 6,6,6,7 4,3,4,4 4,4,7,4 7,4,7,7 2,5,1,5 1,5,1,6 1,6,2,6 *empty-string* *empty-string* *empty-string* *empty-string* *empty-string* *empty-string* *empty-string*). The minimum valid item number is 1.

--
you might want to provide a screenshot of your relevant blocks using the for each item in list block

--
It looks correct to me.
I don't understand what would cause that error message.

--
Scott is right. There's nothing in the code you've posted so far that would cause this error. In particular, to get the long list (1,0,1,1,1,1,4,1, ...) mentioned in the error message, some other code has to be appending together the sublists of your global maze list. So something is happening elsewhere in the program that's causing this error.  I suspect the companion error is showing up on the wrong block (though I don't understand why) and is misleading you as to the source of the error. 

If you want us to help you debug this, you'll have to send us the .aia file for your program so we can see the whole thing. 

--
I got it.

This is a case of sleight of hand, and misdirection.

See my attached DoIts of your usage versus how it should be done.
Your strings might look like sublists, but they are just strings.
Notice how they word-wrap only at the fourth elements, really just end-of-string.

If you want to encode a two dimensional array, use the parentheses as shown in the DoIt result
for my second case, and feed it into a table-from-csv block,
or just nest your make-a-list blocks like I did.

--
He used list from csv row on each item of the master list eg. "1,2,3,4" in the list which would return (1 2 3 4). 
That is what is so puzzling.

--
Try replacing the hardwired '23' in your for loop limit with 'length-of-list(maze)'

This is more robust, and not susceptible to counting errors or maze size changes.

If you fall off the end of the list you will get a non-list in the intermediate list item selection.


--
Okay, here's another hypothesis to throw against the wall...

You clicked the DoIt on the inner expression of the For loop, but the For loop had already completed,
leaving the list index pointing at item 24, which was empty, or worse,
the list index might not even have a value or might be 0 after the for loop has completed.

I work around this in procedures and other local scopes by inserting a global variable as a test point
to receive the local value, and to feed the calculation I want to monitor.

Running DoIt with a global variable will show me the result for the last loop.

P.S.  Counting to 23 is not fun.

--
Here's a sample of how you can use Do It inside a loop.

--

...and this is what you get if you don't use that global variable index and use the local for each number variable directly with a do it:
--
Abraham's hypotheses are getting us closer to an explanation, but Scott's experiment shows they don't yet explain David's original error message. There's a bug in AI2 (which is on my to-fix list) where unbound local variable getters encountered in a DoIt are treated as Gnu package names inside the Companion interpreter. This is the explanation for the "package $number" in Scott's error bubble. I still can't see a scenario in which David's index variable "testindex" (or "number" in Scott's case) acquires the value 0, which is necessary to explain the error observed by David. 
Thanks to Abraham for noticing that the printed representation of the global maze list is consistent with David's error bubble. I hadn't noticed the missing commas between the groups of four numbers, so my hypotheses about needing to append lists to get the list mentioned in the error bubble was just plain wrong. The printed representation of lists is leading us astray here. I will add to my to-fix list changing it so that the maze list displays as something like ["1,0,1,1", "1,1,4,1", "4,1,5,1", ...]. 

--
Thank you all for the assembled brain-power on this arcane problem!  I am following with interest, if not full and immediate comprehension in all instances.

I have started by cleaning up my code (disposing of floor sweepings, eliminating redundancies, and resolving general "what the heck was I thinking" type stuff). I will follow up with some of your recommendations as well.

In particular, I removed my null strings from the end (beyond element 23) of my Maze list.

Subsequently, if not consequently, the error has not cropped up. 

However, "I am but an egg" in this strange world. (Well, perhaps an omelette) and I am treating this like a car which misbehaves only when it is not being examined by a mechanic.

--
I'm tripping over what appears to be exactly the same issue - the Segment function evaluates Start to be "package $number" rather than a numeric value. Screenshot attached for more info (I hope it's self-explanatory). I'm stepping through a user-entered string of text to remove any non-valid characters (provided by a reference string) to produce a "cleaned" version (which is later tested for being null before going on to further processing).

I've pulled out DoIt responses to illustrate the trace. The variable name for Each is the default (I've tried using my own variable names to no effect, and globally-defined variables make no difference). The error message from either Segment is the same: "Error from Companion: The operation segment cannot accept the arguments: 123456 package $number 1".

I wondered whether you had had a chance to fix the issue you identified, and if so, why the error might persist. At the moment this is something of a deal-breaker for me - I can find no way around needing to step through the input text in order to clean it up.

Grateful for any feedback,


--
you can't debug local variables
see again ABG's sample of how you can use Do It inside a loop.

--