2015년 1월 1일 목요일

Help with TinyDB

I require tinydb to be used on screen1 for adding the information by using text boxes into and then for it to display on screen2 within labels

I understand that within 'when button click' this would need to open screen2 but how can i call the data saved from the tags on screen1 to screen2?



There is only one TinyDb on the app regardless on how you name it on each screen.
So data saved into TinyDB on one screen, will be available on all other screens.



How can you retrieve the tinydb? Do you simply just add in another tindb even if its named differently?



Yes, just add tinydb on the screen (name doesn't matter)



How can I retrieve the tag used from screen1? 

My tag on screen1 is label.text

My tag on screen2 should be?

Thank you for the quick replies 



Your tag on screen1 should be something like LABEL1_TAG and value should be Label1.Text

From screen2, just use TinyDb1.GetValue(LABEL1_TAG)


ERROR: duplicate declaration of ...


I have problem with my App. When i want to bild APK file it writes:

ERROR: appinventor/ai_fausekmatej1/KvadratickeRovnice/Screen3.yail line 261: duplicate declaration of 'X1'
ERROR: appinventor/ai_fausekmatej1/KvadratickeRovnice/Screen3.yail line 197: (this is the previous declaration of 'X1')

I tried to renamed all my blocks. But it is still here. AppInventor doesn't show me any mistakes.

What I can do with it? Or how I can see what is on line X ?

--
find the red warning in your blocks and fix the problem before building the app probably there is a duplicate definition of a global variable named X1?

--
If possible, use local variables for X1 in your blocks.

Then delete your global X1 declarations.

Though AI2 has no search capability, the Chrome browser's Ctrl-F Find capability can highlight visible instances of text like X1. You might need to shrink your view using Ctrl-- and squint to see them all.

Collapsing your blocks in place might help shift your hay stack.

--
Thank you both. But there are not any red warnings ...

--
ok, let' s guess a little bit...

did you define a global variable named X1 in Screen3?
probably you forgot about it?
just right click onto the background of the blocks editor and select "Collapse Blocks" and then "Arrange blocks vertically" to get a better overview about your blocks

also 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.

--
I tried to renamed all blocks and all global variables. The ERROR dissapear. But there are new ERRORS ... on 10 lines in screen3. It is: call to 'set-and-coerce-property!' has too many arguments (5; must be 4) ... What does it mean ?? Im begginer in App Inventor. My app is about Quadratic equations. On Screen 3 I only constitute right numbers to formulary. I use labels for it. I also use TinyDB for keeping numbers from Screen2 where are the all things what I need for calculating.

--




Ok, these are screenshots of my App. I tried make new App, but witjout doing anything with blocks. So, there was same errors. I renamed my labels with using _. And 1st error disappeared. But now i have errors: set and coerce property. I looked on internet and I found it can be because a lot of Arrangement .. I have 15 Vertical and Horizontal Arrangements.

Do you think it can be because it ?? 

--
On close examination of your Designer screen shot, I see commas in the component names.

I'll bet a nickel that's poisoning the JSON and XML representation of your app in AI2.

Go through the Designer, and remove all those commas in the component names. Also go through the Blocks Editor after that and remove commas from all variable names.

Let us know if that helped. If that doesn't work, you might have to start all over or do risky surgery on your .aia file, using 7ip and Notepad.

--
When I wrote there the commas the ERROR (duplicate of declaration) disapears. Do you think it is the reason of ERROR - set-and-coerce-property ??

--
Eliminating all your commas in names is necessary.
Is it sufficient?
That I do not know.

Eliminate all the commas in the names.

--
It works :). Thank you so much ;)

--
Export an .aia file and put it somewhere safe.

Storm clouds follow you.

--
What? What does it mean ?? (Sorry im not expert for AppInventor) And what can I do with file .aia ??

--
Save a .aia file:
http://appinventor.mit.edu/explore/ai2/share.html

I apologize for the storm cloud reference - You discovered a rare gap in App Inventor's armor. I extrapolated from that a capacity for bad luck. Does lightning strike twice in the same place  http://en.wikipedia.org/wiki/Joe_Btfsplk

--
What is the Storm Cloud Reference ??

--
OK, So what i can do for you ? 

--
And what can I do with file .aia ??
it is advisable to make backups of your project frequently, to be prepared for a second lightning strike ;-) as ABG said... see also Enis' tips here http://twodogapps.com/?page_id=686

--

Supersmart "notice board" in my app?

I am working on an app which needs a "notice board" function, i.e. a possibility to post and read notices. Users should not have to log in. I thought I solved this in a supersmart way(!)  but I ran in to some difficulties. Here is how I solved it:

  1. I created a form in Google Drive with only two text questions: "Name" and "Message".
  2. I set up a spreadsheet in Google Drive collecting the answers from the form above, and published it on the web.
  3. In my app I used WebViewer to call the form (1) by entering the URL to the live form. This allows users can post a message.
  4. I also used WebViewer to call the spreadsheet (2) by entering the URL to the spreadsheet. This is how users can view old messag
Including this (3 and 4) in the app only requires a couple of WebViewer blocks - and it works! So far so good but...

  • I don't know how to sort messages so the last message shows up on top in the spreadsheet when I call it using WebViewer. I can sort the messages in in Google Drive but whenever I post a new message this is added at the bottom of the list...
  • I can't seem to be able to scroll up/down the speadsheet to see a longer list of messages using WebViewer. All I can do is zoom in and out...
Any clues on how to solve these things would be highly appreciated! 

PS. I have considered using a "chat function" like PubNub but the app will potentially have more the max 20 users allowed in the "freeware mode".



1. instead of using a Google spreadsheet, you could use a fusiontable instead, because there it is easy to sort the rows
2. did you set the web viewer height to fill parent?



Thanks for your suggestions, Taifun! However, using Google fusiontables for "notice board" will require users to login in order to post messages, right? I wish to avoid login but if it is the only way to sort my messages I may have to reconsider it...



I just tested another way to sort my messages which turned out to work great:

I created an additional sheet in the spreadsheet containing the answers from my form and used the function SORT to sort all messages in the original sheet in descending order (making the data range equal to all rows in the sheet, because new messages will increase the number of rows). I then published this second sheet on the web and pasted the link into WebViewer (replacing the link to the original sheet). 

The only problem left to solve now is how to make the speadsheet scrollable in my app... it does not seem related to the "fill parent" setting which Taifun suspected (other Google spreadsheets are scrollable in WebViewer when I test). Could it be something related to the fact that this is a special type of spreadsheet filled with answers from a form?  Any ideas out there?



Here is an attempt to clarify my Webviewer scroll problem. Below are links to two published Google spreadsheets: 



However, only the first spreadsheet is scrollable when viewed in Webviewer. Any ideas why?



However, using Google fusiontables for "notice board" will require users to login in order to post messages, right?
wrong.. you can use a service account, see here
as you can see in the attached example app, you can scroll in the 2nd spreadsheet...




Thanks again, Taifun! I will surely explore ways to use Fusiontables without login!

I installed the example you made but it is not scrollable on my phone (HTC Desire HD with Android 2.3.5). I trust it must be a problem with my older Android...?



sorry, I don't know
I tested successfully on Nexus 5 running Android 5.0.1
try another device


Translation app problem

Hello I do app for my homework but I have a problem

I want do if textbox 1 entered word equal to label2 then write "Entered word is the same language" 



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.



Blocks are here 



your blocks look fine, so set uyan visible = true means, the text "Entered word is the same language" will be displayed, correct?

use Do it to debug them, see also tip 4 here

probably a trailing spaces problem?

trim


Removes any spaces leading or trailing the input string and returns the result.



You never reset the visibility of your error message to invisible.

There are three different ways to fix this
(you still should do the trim() fix in the other post)

  1. Use a Notifier for your error message, with an OK button.
  2. Add a Clock to clear the message after a couple of seconds
  3. In the post-translate block, replace the if-then test block with a direct assignment into the visibility attribute of the error message: Message.Visible = (trim(Your_top_word) text= trim(Your bottom_word)).  This will both set and reset the visibility as needed.  Drop the if-then wrapper.



Thank you for your help :) Abrham and Taifun  I fix it with notifier :)


Runtime error: call to 'gnu.expr.Closure' has too many arguments (1; must be 0)

Does anyone know what this runtime error means: call to 'gnu.expr.Closure' has too many arguments (1; must be 0)

I get this when I press a "0" or "1" button on a screen. There are seven buttons to press 0 thru 6 and 2 thru 6 work but for some reason 0 & 1 give this error when pressed.

It is just these two buttons that are giving me fits.

Thanks in advance for any help or suggestions.




Are you putting stuff in a list? If so, note that app inventor lusts start in 1. If not, a screenshot of your blocks would be helpful.



Ooops sorry, didn't see the screenshot on my phone...



I just built the app and tried it from the APK instead of AI Companion and now I get the following error:

Runtime Error

call to 'gnu.expr.ModuleMethod' has too many arguments (1; must be 0)

I don't know if that slight difference is significant or not.



Still getting the error but here is a screen shot that show more of the block after I did a little arranging.

I changed the nextQuestion procedure but nothing has changed, still got error and I guess those blocks were not required.




I figured out a workaround but I don't know why this is happening.

I copied the blocks from the procedure button and instead of having the text read from the button like it is for button 2 thru 6 I hard coded the numeric value of 0 and 1 for the Button0 and Button1 click functions.

I cleaned up some more code to reduce the block count too but that isn't related to this error.

I've attached the block screen if anyone has anymore ideas.




May I suggest some things to make life easier?

Rename 'procedure' to 'log_response' or something equivalently functional.
The new name will propagate to all its invocations.

Rename 'index' to 'QuestionListIndex' to avoid confusion.

Explain why listA has to be a list of lists with only one element, the list 0,1,2,3,4,5,6.

Replace the ifelse ladder in displayscores with a single test using the text block 'contains' '123456'  yourAnswers



ListA isn't a single element from what I can tell but maybe it is.  Turns out after I reviewed the blocks some more I didn't even need this - it was in an example that I used to create my version but as you can tell I don't know exactly why.
I think in the example the author used this to set the values for the buttons but I just set the values on the buttons in the Designer and that worked just fine for me.

I don't understand what you mean by the ifelse ladder.  I need to check for which button is pressed to 1. count that it is a symptom and 2. the severity of the symptom.  How can I do this with single test and increase the severity score by the button value?

Thank you for the suggestions, It has been a very, very long time since I developed an application myself so some of the names are going to be off of course.



I belong to the 'If in doubt, rip it out' school of coding.

Correct me if I'm wrong, but it looks like you are using the same numeric scale (0-6)
in the answers to all your questions, and your seven buttons Button0-Button6 return the scores 0-6.
If that's the case, you can just have their .Click logging procedure calls pass the numerical
values (0.0, 1.0, ... 6.0) associated with the corresponding button, and change the logging 
procedure to expect a score instead of a button component.

This would eliminate the need to validate the scores at summation time.  Just add the scores.
If you just want to keep or show non-zero answers, a numeric comparison (> 0) would suffice.



OK, I had this error too and I looked everywhere to try to solve it.  But I did find it...

I had defined a procedure with an input.
I used a call to that proc in 9 button clicks.
I removed the input from the proc.
Now all the calls tot he proc in the 9 buttons were wrong, but the UI didn't recognize the change and flag it as an error.

Once I fixed that, the error was gone.



Agreed, procedure signature management is missing.
I still see type blocking dropping procedure calls onto
the blocks area with no parameter sockets.


ppinventor 2 crashes on apps that were working ok before

I created 3 versions of an app that uses multi screens and webviewer and were working fine the last time I used them about a week ago. Now, when I run them on my phone through companion, I get "Unfortunately, MIT AI2 Companion has stopped". It seems to be happening when it tries to switch screens. Has something changed recently? Appreciate any help. thanks.



it seems to be, you never used the "close screen" block?
see here how to switch screens correctly: 

The recommended method of switching screens in App Inventor




I will make that change but why would they work last week and not this week especially when I didn't make any changes in between?

Also, do you have access to my apps?

Just so you know, I'm certainly a newbie to app inventor but I have been programming computers and designing applications for large organizations since the days of the 80 column Hollerith punched cards. This old guy, retired now, is still having fun hacking away it...

Thank you again for all your help.



why would they work last week and not this week especially when I didn't make any changes in between?
probably because you did not test switching screens several times? 
Note: if you only use the open another screen and never the close screen block, you will run out of memory after a while. Also reopening an already opened screen is a bad idea. For example if you open Screen1 twice, you also have to close your app twice!


Also, do you have access to my apps?
no, only you have access to your apps


Operation Bounce cannot accept the arguments

I am trying to get a ball to bounce off any edge and a particular sprite (black rectangle) when the ball collides with it. The edge bounce works fine however I am getting a runtime error when the ball collides with the sprite and I am not sure how to resolve this:

The operation Bounce cannot accept the arguments: com.google.appinventor.components.runtime.ImageSprite@9487501
Note: You will not see another error reported for 5 seconds.

I have copied screen shots below to show the error, the blocks and the design. Thanks in advance for any help.






the Bounce block expects an edge, but not an image sprite



Bounce(number edge)

Makes this sprite bounce, as if off a wall. For normal bouncing, the edge argument should be the one returned by EdgeReached.

Edge here is represented as an integer that indicates one of eight directions north(1), northeast(2), east(3), southeast(4), south (-1), southwest(-2), west(-3), and northwest(-4).

what you can do is to modify the heading of the ball in the CollidedWith event instead



Thanks!


Webview is not showing the content on browser

I am not seeing the content of web page in browser. But I could see that in the phone while building webview.



please provide some more details

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.


Web search multiple sites and return a list of results?

I am trying to write an app to search for "keywords" more specifically to find torrents for me. I am going to use the voice recorder to populate a text box with the information to search for. I would like to know is it possible to query
   multiple search engines at once and return a list of the results. I can get it to work with one site but it would be neat to search multiple ones at the same time. Thank you.




I believe what you need to do is search one site at a time; save the result then search another site with the same key word.  Then concatenate the results of all the searches.   You will probably have to use one keyword at a time. It might be possible to search html files using multiple keywords, I do not know.

Part of what you may be attempting is called 'screen scraping'.   Scraping a Web page is searching for key terms.  Here are some resources that may be useful:  https://groups.google.com/forum/#!searchin/mitappinventortest/scrape/mitappinventortest/ZkO335fBf5s/_cW0E02A7OsJ   

If you search this AI2 forum, you will find the following discussions that might help:  https://groups.google.com/forum/#!searchin/mitappinventortest/scrape  

Happy New Year!


fazer aparecer e sumir um table arrangement quando o mesmo botão for clicado (do appear and disappear one table arrangement when the button is clicked)

Am making an application for a pizzeria. At one point in the presentation of the "menu" , put a button that , when clicked , it displays a list of options (sweet pizzas , traditional pizzas , drinks, etc. ) that lead to other screens. To do this, put this list of options in " hidden" , and only after the " menu" button is clicked they appear on the screen. My problem is that I wanted to click the button ( menu ) again to return to the list "hidden " mode. as could not do it in blocks , insert another button ( minimize ) that does this function .

Can anyone help me set up the blocks to make them work the way I want , that is, the button ( menu ) to display and hide the list of options ( hidden by a table arrangement) ?



System volume

When I create an application using the player component, the volume is low. 

How can I change the volume of my application according to the global volume, moving the slider ?

I have already set my slider between 0 and 100 but I'm not sure if it's correct. What is the minimum value and the max value ? 

perhaps the volume that I set is a percentage of the global volume ?



You can't change the volume via AI directly.  You *MAY* be able to use the Activity Starter to do it though...



This might be the conversion from the scalar sound range 0 to 100 on the Player control 

described here:  http://www.phonesdevelopers.com/1813101/       Is this the 'global' value?   I haven't a clue.

I read somewhere (but can not remember where) where someone said that developers can not set the MAXIMUM volume possible on an Android device...something about limitations on how loud a device can be to protect hearing.   I do not know it that is correct or not.    You might google and research something like Android volume settings   or similar key words and find out.



see also the documentation http://ai2.appinventor.mit.edu/reference/components/media.html#Player

Volume
Sets the volume to a number between 0 and 100


[App Inventor Open Source Development] Fwd: Invitation: Android Wear Hackathon (2 Days, 2 Locations)

메일에 포함된 일정
2015. 1. 10. (토) 오전 8:30 – 2015. 1. 11. (일) 오전 7시 (TLT)
Google 캘린더에 추가
In case any of you can make it.
--------------------------------------------
mobile. brevity.typos.cheers
---------- Forwarded message ----------
From: "GDG Boston - Google Developer's Group Boston" <info@meetup.com>
Date: 31 Dec 2014 16:08
Subject: Invitation: Android Wear Hackathon (2 Days, 2 Locations)
To: <josmasflores@gmail.com>
Cc:

 
Meetup
 
NEW MEETUP
GDG Boston - Google Developer's Group Boston
Added by Steven Max Patterson
Friday, January 9, 2015
6:30 PM
FRIDAY: Pitch Night @Leaf 215 First Street SATURDAY Hackathon @Google Cambridge MA
FRIDAY: 215 Leaf St. SATURDAY @Google Cambridge
Cambridge, MA
Are you going?
4 Members going, including:
"fun-loving open source developer"
"own a glass"
"The internet is my country of origin"
"I work on mobile technology, especially Android. I'm also a Google Glass pioneer and explorer."
Hi All, The Android Wear Hackathon is Friday January 9th@Leaf and Saturday January 10th@Google. Sponsors • Google • Leaf • LG • Motorola • Samsung Prizes Each winning team will receive new smartwatches and smartphones from our sponsors. Team Form...
LEARN MORE

Follow us!  

Never miss a last-minute change. Get the app.
iPhone App Store Google Play
Unsubscribe from similar emails from this Meetup Group
Add info@meetup.com to your address book to receive all Meetup emails
Meetup HQ in NYC is hiring! meetup.com/jobs