2014년 12월 31일 수요일

Share fusion tables for editing when I want to read-only App (Share fusion tables for editing when I want to read-only App)

I have written a Quiz with App Inventor 2 That read questions and answers form a Fusion Table. So, the users do not need to write in the Fusion Table. Still, it seems, That the only way for the user to use my App is to be Editor of my my Fusion Table.
Do you know any way Been Editor PERSONAL Respiratory user, but be reliable to read my Fusion Table using my App? I do not want my user to be reliable spoil my Fusion Table (write on it).
Currently users That no Editors of my Fusion Table recieve the following error:
Invalid query: Parse error near & # 39; Forbidden & # 39; (Line 1 position 70).

Thanks a lot.



use the service account option, share the FusionTable with the ServiceAccount Email address and set the permissions to "read only".

Clearing the contents of a standard list

Hi, I'm simply trying to clear the index values in a list to restore the list to an empty state.  I'm using what I believe should be a pretty straightforward code block to accomplish this, but I am getting an error.  I will include images of the code block in question, as well as the error code below.  Please help.





Why not simply use create-empty-list block?



Because I don't want to accumulate a bunch of lists as the user continues to use the program.  This method seems like it would be bad for performance eventually, no?



That does seem to get the job done, I guess I'll go with that.  I just didn't want to wind up with a bunch of old lists 'in the background' by 'creating new lists, but I guess as long as I'm assigning a new list to the existing variable, there is only ever the one list in existence at any time?



as long as I'm assigning a new list to the existing variable, there is only ever the one list in existence at any time?
exactly


line break

how do I get a line break in string?



use \n
Advice: Before posting, it's a good idea to search in this forum. Many others have likely run into problems similar to yours. How to search see screenshot.



thank you.


Lost a screen - PLEASE HELP

My project is entitled Sailing Race Starts Pro. When building the APK, Screen 3 was lost. The remove screen button is just below the build button, so I suspect the click on the build menu item actually clicked on the remove screen button. The removed screen contains 99% of the work on this project and it is immense. I would sure love to get this back. Is there any hope? This occurred, by the way, on 12-31-14 around noon.



just import your latest backup (aia file) and restart from there
you made a backup, didn't you?



Yes, I do have a backup. Unfortunately it is from 9 days ago and I have done a huge amount of work during those 9 days. I am going to create a new project and import the aia into it to see the extent of what is missing. If it is possible to restore this project from a backup it will save me 9 days of work.



If you hit the Delete button, the screen is gone Dan.  Unfortunate you did not save your work regularly using either an aia or    Projects > Save project as, It would have saved you a lot of grief.  It is a fact that compilers do what the developers tell them to do; in this case you deleted a screen with a button.  When MIT is able to 'recover' a project, it is usually an issue of something happening that cause the project to be corrupted in the Google Cloud.  That did not happen in your case.  There is probably nothing to recover.

Build on what you learned about coding in the past nine days; what you code now will go more rapidly than the first time through because you have discovered the procedures that work in your app.

Sorry you had the bad experience.  When developers get tired, they tend to make errors in coding and sometimes do things that cause issues.  

I expect your Screen3 is gone.   I am sending a note to the guy who attempts 'recovery' in his spare time.  He MIGHT be able to do something.  Being the New Year's holiday, I have no idea how long it will take for a response.  Be patient, cross your fingers but get started on replacing your work.

Smile, you could have lost the whole thing.



Thanks very much for the reply and the encouraging words. The good news is that my backup from 9 days ago contained almost all of what I needed to recover--much more than I had thought. Much of the time consumed during that period was figuring out how to do everything.  You were very much correct in stating that re-coding would go more rapidly and I can happily say it is done. Perhaps you could answer a few related questions regarding getting totally back to where I was. First the background:

I originally started this app with a project named, "SailingRaceStarts." I copied that file to a new file named, "SailingRaceStartsPro." I used AppToMarket with the "SailingRaceStartsPro" file and published it to Google Play.

After losing the screen, the best file to start from to recover was "SailingRaceStarts." To make sure I didn't potentially harm the best file I had, I copied it to a new file called, "SailingRaceStarts_copy." This file is the one that is now perfect.

I want to make sure my customers on Google Play don't lose continuity with updates. Hence the following four questions:

Within AppInventor, should I delete the damaged project named "SailingRaceStartsPro" and save a copy of the fixed "SailingRaceStarts_copy" to the name "SailingRaceStartsPro?" 
Do I need to import the keystore from the original "SailingRaceStartsPro" in AppInventor? (Since I'm using AppToMarket, it may be irrelevant.)
Do I need to import the keystore from the original "SailingRaceStartsPro" in AppToMarket to the new file?
Is there anything else I should consider or do?

Thank you for you patience--this is my first app. AppInventor is great and I am grateful to all who have made it possible and continue to help as you are doing.



Very glad you were able to recover Dan.

I'm not an expert on Google Play but perhaps this thread can help with your questions:  https://groups.google.com/forum/#!searchin/mitappinventortest/erica/mitappinventortest/bV9uiQ8y1o0/hoxJL1HZUp0J     This person had a similar issue with having to rename and re-post several apps on Google Play and got it straightened out.   My understanding is that if you do not do it right, GP will kindly(?) nudge you with error messages and advice.

There are several users on the forum who will probably be able to answer your specific questions.  What I do know is that if you have the keystore, you are in business.   I just do not know how to work with GP. :) 



to update your existing app in Google Play, you have to use the same project name in App Inventor and a new version code and version name. Don't worry about the keystore.
Taifun




Thank you for the feedback. I would like to share lessons learned with anyone who needs them:

1. Regularly "Export selected project (.aia)" to your computer.Even if you just allow these to accumulate in your downloads folder, they are named and dated and will be extremely useful if something goes wrong. Better to organize them in folders and copy them to an external drive, but whatever you do, do the export!

2. Use the "Save project as" to save a backup on MIT's server. I'm using this format to name the backup:  MyProject_BACKUP_010114. This is simple, quick, easy, can be done from anywhere, and does not require local media.

3. If something goes wrong, the simplest fix is to do one of the following: Delete the bad project, open your backup project in AppInventor, and "Save project as" to the original filename. --OR-- Delete the bad project, create a new one with the same name and import the aia. Either way will only take a couple of minutes at most. You do not need to worry about the keystore.

4. If using AppToMarket, assuming your project name is the same as the original, you will have no problem whatsoever uploading to Google Play. Of course, increment the version and version name as usual before uploading a new apk. (Incidentally, the settings that work best for me inside AppToMarket v.3.2 are: x, x.x, Min 5, Target 0, Portrait (or whatever you want), Auto, No Title, Normal, No, Dialog, and put spaces in the App Name.)

5. Be very careful using an unfamiliar computer. My problem started when using someone else's computer--the browser was slightly different and the screen resolution was different, so buttons were in a slightly different location; it was "laggy" so things didn't happen at the same pace as my own computer; and I received a phone call while working under those conditions.

6. Be very cautious of the "Remove Screen" button. It is located just below the "Build" button. Move slowly and READ the confirmation screens.



You might as well read my Tips Dan!:



Need pictures to adjust to screen

I need help to setup a picture viewer.  The app has two screens, one with all the pictures laid out (like thumbnails) and a second one which is the viewer per se.

I set up the viewer as full screen canvas with a single image sprite which is supposed to get a value (the pictures name) passed by the main page.

What I've been able to achieve:
-the correct image is shown;
-you can swipe to previous or next image;
-the title of the viewer reflects the picture's name;
-the sprite is correctly centered in the canvas;

My problem:
For now, I hardcoded picture's ratio and orientation in a list and I refer to that list to ajust the sprite so it is full screen.  What I want is for the code to calculate the ratio of the picture about to fill the canvas so I will not have to do it manually as I will add pictures in the list over time.

What I tried:
I can't find a way to extract an image's width and height BEFORE using it in any componnent.  I tried setting the sprite.picture to image.jpg and THEN getting width and height.  It works the first time but as soon as I swipe to the next picture, ratios get all screwed up because it's calculated over the last known dimensions instead of the original dimensions.  Changing orientation messes everything too.

I tried using an invisible dummy picture component, setting it as the image, calculting the ratio.  Seems like since it is invisible, its size is 0.  So I tried having it visible, getting the ratio and setting it invisible but I get a "divide by 0" error again.



You have a difficult programming exercise and not just because you are using App Inventor.   Here are some links that discuss ways to get image dimensions (using Java etc.)  https://www.google.com/search?q=android+image+height+width&oq=android+image+height+width&aqs=chrome..69i57.13055j0j7&sourceid=chrome&es_sm=93&ie=UTF-8       Some of these links might provide you with more ideas.

The obvious question is why do you have to use a Canvas?  If you use an Image control, you can use the Automatic settings to get the picture to display the largest size of the image on the Screen; but for some reason you can not do that?  For thumbnails, use a Table Layout and restrict the dimensions, for 'full size' and image component on the other screen?.

Good luck.



The reason I'm using a canvas is to be able to swipe between photos by using the .swipe event.  Unless I am mistaken, I don't think any such control exist for an image component?



If you got to swipe, Canvas can simulate it ....    http://puravidaapps.com/snippets.php#2flung is probably what you are using.    If you got to swipe, Eclipse and Android Studio are free, have the features you need but require more programming knowledge to get access to the full tool box.   For the moment, no swiping in AI2 except in a WebViewer and simulated in a Canvas.



I remember delving into a similar problem a long time ago. See here for my posts if they help:

https://groups.google.com/forum/#!msg/appinventor/pJV3nMVz5Kk/JhoqvPseXR4J

https://groups.google.com/forum/#!topic/programming-with-app-inventor/b2qdm-xM7YY

Basically try load the image into a visible dummy image sprite on an invisible canvas first. That should get you actual image width and height. You can then store these values in variables and use them anywhere.



Listview selectionindex problem


Well, I read about previous problems with the listview selectionindex giving incorrect indexes when search filter is used. So, in order to overcome this:

- I defined a variable named selectedindex.
- I run an if block to see if the selection(which is supposed to return the selected text) is in one of my three lists ( these are the listview elements lists)
- then in the then part of the if block, I get the index of the selected item by searching the selection in the list.
- and to test it, I ask to name a textbutton to my variable selectedindex.

now in theory, this should look for the index of the selected text in three tables, when it finds it, it should set the textbutton text to the correct index. But, when I use it without the searchfilter, it works perfectly, and when I use the searchfilter, it still returns 2 when I select the second element in the filtered list. 

Why does it happen? I have no idea. I thought that maybe the searchfilter was playing around with my list when we enter text in the searchfilter, (for example, it might remove items temporarily and still show the same list with filtered items) but before that point, I have another variable called currentlist, which is set to one of the three lists before to show the elements of the currentlist, so if it were playing, it would mess with my currentlist variable, not the actual one(or would it?).

Whatever, I'm stuck. Any suggestions on how to make that block work? All I can think of is that I can generate three more lists with names and get the index from there (but I don't wantto, since the current list tables are the tables with just the names, so I'd have duplicate tables, which would be confusing during the update..)


--
If you want to avoid listview filtering, try this approach ... Build Your Own DB - Part 1
Here's a doc on using lists of list filtering with
an example app using a spinner, which acts similarly to
a listview.

The general idea is to use general purpose selection routines to
feed the listview from a pipeline of temporary tables.

Maybe it will help you.

--
it seems to be using the filterbar in the listview is completely broken, actually @Bhagavati already reported it Nov 25 here Filter Bar in List View does not seem to work even with Selection...
remember, in the listpicker at least you get the correct selection after selecting an item, but not in the listview anymore

screenshots and example project attached
I first filtered for b, then I selected b2 from the list
in the blocks editor as result, I get a2 (which is wrong and should be b2)
the selection index as we know from the listpicker you also can't use (this is 2 in  the example and should be 4)

--
Thanks for reporting this.   I've filed it as a bug.  

--
@Taifun, Regarding the statement you made on GitHub [1], I know how to accomplish it. However, that's not the point. SelectionIndex is useless regardless and, to my idea, is only good for static short list that don't provide user with sorting, shuffling, adding, removing items from the list. If such features as sorting, shuffling, inserting items within lists were available, how would original SelectionIndex be used or be useful?

Please take a look at the jQuery Mobile listview as an example, how it should be done http://jquerymobile.com/demos/1.2.0/docs/lists/index.html.

--
As you know, often there are 2 or more lists connected via the selection index, which means, the selection index is essential for this kind of functionality, see my quiz example https://puravidaapps.com/quiz.php   quizquiz.aia

If the listpicker temporarily sorts or filters a list, the original list remains the same and the original index should be provided after picking an item. Same, if we will have a shuffle option one day.

If we will have a functionality to add or remove an item in the listpicker directly one day (for example after left or right swipe?), the original list would be changed and the index of the new list should be provided after picking an item.

Actually we do not have to reinvent the wheel, therefore I suggested to take a look at the jQuery Mobile listview as an example, how it is done there http://jquerymobile.com/demos/1.2.0/docs/lists/index.html.

--
I'm looking into extending listview component to support not just text. 

Somehow, I find this bug described here has been reported 11 months ago.  I feel I need to help fix this bug firstly to move on.

I've tried Taifun's aia, to be honest, from the android api point of view, the selection index makes perfect sense for me. 
It is only the index in the current list rather than before filtering.

I've also checked Hossein's pull request on github which is trying to return the index in the parent list before filtering.see here: https://github.com/mit-cml/appinventor-sources/pull/199/files#r22332834

My opinion is to keep what it is right now to keep consistent to android api's list view functionality. 

Hope this issue is going to be fixed sooner.  I could help if anyone needs.

--

Problem launching Custom TinyWebDB (App Inventor 2)

I get the following when I attempt to deploy.  Does anyone know what the problem is?

2014-12-30 16:45:02 Running command: "[u'C:\\Python27\\pythonw.exe', '-u', u'C:\\Program Files (x86)\\Google\\google_appengine\\appcfg.py', '--no_cookies', u'--email=@gmail.com', '--passin', 'update', u'C:\\Users\\Bob\\Documents\\farm\\rnmtinywebdb\\appinventordb']"
04:45 PM Application: valiant-carrier-810; version: 1
04:45 PM Host: appengine.google.com
Traceback (most recent call last):
  File "C:\Program Files (x86)\Google\google_appengine\appcfg.py", line 127, in <module>
    run_file(__file__, globals())
  File "C:\Program Files (x86)\Google\google_appengine\appcfg.py", line 123, in run_file
    execfile(_PATHS.script_file(script_name), globals_)
  File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\appcfg.py", line 5397, in <module>
    main(sys.argv)
  File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\appcfg.py", line 5388, in main
    result = AppCfgApp(argv).Run()
  File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\appcfg.py", line 2978, in Run
    self.action(self)
  File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\appcfg.py", line 5044, in __call__
    return method()
  File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\appcfg.py", line 3791, in Update
    self._UpdateWithParsedAppYaml(appyaml, self.basepath)
  File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\appcfg.py", line 3812, in _UpdateWithParsedAppYaml
    updatecheck.CheckForUpdates()
  File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\sdk_update_checker.py", line 243, in CheckForUpdates
    runtime=runtime))
  File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\appengine_rpc.py", line 424, in Send
    f = self.opener.open(req)
  File "C:\Python27\lib\urllib2.py", line 431, in open
    response = self._open(req, data)
  File "C:\Python27\lib\urllib2.py", line 449, in _open
    '_open', req)
  File "C:\Python27\lib\urllib2.py", line 409, in _call_chain
    result = func(*args)
  File "C:\Python27\lib\urllib2.py", line 1240, in https_open
    context=self._context)
TypeError: do_open() got an unexpected keyword argument 'context'
2014-12-30 16:45:11 (Process exited with code 1)

You can close this window now.


find value in list and create new list

My main list is like :
200501a.jpg,
200501b.jpg,
200502a.jpg,
200502b.jpg

i would like to make a new list by finding the value 01 which creates the list like
200501a.jpg,200501b.jpg
by finding the value 02 which creates the list
200502a.jpg,200502b.jpg

i have tried for each loop but everytime i need to specify value like 01, 02.

Please advise how to find all the list automaticaly which generates new list.



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.



Screenshot attached:





you could use a procedure and pass that number (01 or 02) as input parameter



I have used another list instead of procedure but it will give me all the values at a time... 
but I want separate values like 
200501a.jpg, 200501b.jpg
200502a.jpg, 200502b.jpg

please advice.




you get the complete list as result again, because there is only one newlist variable
how do you expect the result to look like? probably as list of lists?
if yes, you have to create a new sublist for each number and add the image names as items in the sublist 



Thanks for your prmpt reply.

I want everything in one list only. i.e. newlist.

Only thing for each loop need to change to act according to each number.

Is it possible Sir?



sorry, I do not understand what you are doing
if you want everything in the new list, you get a copy of the old list, don't you?



main list is like:
200501a.jpg
200501b.jpg
200502a.jpg
200502b.jpg

Newlst should be like:
200501a.jpg,200501b.jpg
200502a.jpg,200502b.jpg
and so on...

means at every change of number 01,02 it should pickup value accordingly..



it looks like you want to create a list of lists
as already said, you have to create a new sublist for each number and add the image names as items in the sublist 



it looks like you want to create a list of lists
I dont want to create either list of list or sublist.

My app is showing government Notifications. 
I have done enitire work of downloading images from google drive.
However, I am getting entire list of image files.
In which if user select particular notification say 01(that includes more than 1 images), user will be able to view all the images pertaining to that Notification.
I used web viewer component url property to show all images and that is working fine also. 
M problem is I need to create one new list which comprises all the image names pertaining to that notificaitons.
Like: 
200501a.jpg and 200501b.jpg both these files are pertaining to Notification No. 01.like that....

So I want to create the loop which creates new list of  images with respect to Notification No.

First screenshot does this thing but I want it to done by AI2 without manually putting as "01" or "02".

I hope this will clear your mind.



Sorry to bother you too much,

I understand now how to create the new list by adding sublist items to newlist.



For every sublist I need to create global list variable.

In my case the there are 50 images so for each sublist I need to create 50 global list variable or what?



Make sure your AIA file is under 5MB!  Read my tips, especially about reducing AIA size by shrinking images etc...



@Enis,

Yes Sir,for this I am following Tim & Taifun example only.



oh yeah, my mind is now completely clear, thank you for that.

if you create a list of lists, you only need one variable to store everything.
Now if you want to read the items with 01, just do a select list item from the main list with index = 1 to get the corresponding sublist
same for 02, just do a select list item from the main list with index = 2 to get the corresponding sublist

see here for more info


2014년 12월 30일 화요일

Blocos (blocks)

Hello!
I'd like to know how to copy blocks to not have to create them again in the same screen. In Scratch you can copy them.



before copying blocks, you should read and understand this: Building apps with many screens

and then if you really think, you have to copy blocks, you can use this method:
How to copy screens by  Scott and a video by  Hossein

Advice: Before posting, it's a good idea to search in this forum. Many others have likely run into problems similar to yours. How to search see screenshot.



I understood your point, but I just wanted to copy some blocks IN THE SAME SCREEN. Is this possible?



Absolutely!

Just right click on any block or set of blocks, and choose Duplicate...



When do it, just have three options: Add comment; deactivate and watch. There isn't "duplicate". My version is the Classic. What can I do?



put your blocks you want to copy into a procedure, then ctrl-c onto the procedure to copy it and ctrl-v to paste it again

generally let me recommend you to switch to App Inventor 2, App Inventor Classic will be switched off soon...



Thanks a lot Taifun!

I hadn't made this because I thought it was very obvious. That is, if it didn't work with right mouse botton, why would work it with the Ctrl + C and Ctrl V keys?

Thanks again for that!

Regarding the latest version AI2, I am unable to connect the emulator.The process is very long and in the end do not work. I don't know what to do about that.




Regarding the latest version AI2, I am unable to connect the emulator. 
see the tips Enis gave you in your other thread https://groups.google.com/d/msg/mitappinventortest/Zina7DB3uAs/_9XV7QtkGDAJ and if you still have problems, let us know in the other thread...



I did everything that Enis said, but the Emulator still doesn't work.



Carlos... you say it doesn't work... tell us what's actually happening...

Most of the emulator connection problems we have seen are a result of not having the most current version of the App Inventor setup software, or that software having been incompletely installed. 

Still, there can be many other issues that could cause the connection to the emulator to fail.  Please read and follow the document below on connection issues:

Click here for Emulator Setup and Trouble Shooting Instructions

If you still cannot get the emulator running after following that document, please post in the forum and we'll try to help you out.



I will do that. Then I will give you a return, ok.



The images of the little windows, attached, are what I see when I try to run the emulator. In the end, appears another one saying "give up or try again".

remitappinventorreproblemasissues.zip



Please post them up here as screenshots Carlos.  In general, we'd prefer to not have files attached.  No APKs are allowed, AIAs only if asked, and zip files or links to other files isn't really appreciated.  Post the shots here so we can all see without opening up a file that could be dangerous (not necessarily yours, but zips in general).



Hello friends!
That will not be necessary Eni. Mystery solved. It was my firewall. From the moment I have included the AI2 on the firewall, the emulator started functioning. I hope not to damage my computer with it.

Hugs and happy new year!


Multiple Screen Problem...

I have created 1 android app the basic structure of app is...
Screen1: Contains 17 buttons..

Now the problem is, i need screen for each 17 buttons which also contains the buttons. but there are different number of buttons each screen contain.
I have created 17 screen for listing the button(That is too many)..should there are any way to reduce the screen size using tinydb or tinywebdb.

After reducing the size of screen can my app perform much faster compare to multiple screen app.



You should NOT use more than 10 screens... Please read the section on screens in my tips below:



Notifying the downloaders phone

Hello, I'm working on an app the requires constant changes, I wanted to know how can I set the app to send notifications to a downloaders phone informing them about new changes that happened in the app. Thank You. 



Presently, push notifications are not available in AppInventor.  If you put your app on Google Play, and they download it from there, whenever you update the Google Play file they'll get the update too.


An internal error has occured


I have my project almost finished. When I try to add a new element like a label or a button, I get the error "An internal error has occurred. Report a bug? ". I also have this error:

otes = Browser: Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.95 Safari/537.36
foundIn = nb139f
faultData = com.google.gwt.core.client.JavaScriptException: (TypeError) : Cannot read property 'A' of undefined
projectId = 5135668264042496

I have to add that after this happens, the label or the button appears but its set of blocks doesn't.

I can build the project, can run the emulator and the app works fine. I don't have any warnings or errors and I've already changes browsers and restarted my computer.

Any suggestions??

--
What happens when you back up a step and load one of the previous AIA files you made?

--
If I load a previous version I don't have the error.

-- 
So that tells you something you added is causing a problem.  Can you add things back tot he older version to bring it up to the current version?  Make an AIA file after each successful add, and you'll know exactly where you're failing...

-- 

Ok Enis, thank you very much for your help!

--
Ditto Carlos!  Read my tips... you might be getting towards the size limit and that's why you're having problems... that's just a guess.

--
this looks like a App Inventor bug.  Unfortunately, it's one that might be hard to find.   Could you send us the AIA file together with a description of what needs to be done for elicit the error.
It might take a while for us to look at this, but we'll try.

--

How do I align a TextBox with a Button?

For example, I'm trying to create a game scoring app and I've used HorizontalArrangements in every row and put the respective textboxes and buttons where they should belong. However, for some reason the text boxes don't align with the buttons properly. I've tried everything from adjusting the heights of both items but they still refuse to align (I think it is the buttons fault because after I replaced it with a label, everything was aligned like it should be). Also, I was wondering if there was any way to get rid of the cursor and yellow outline around the last textbox after anything is inputted inside of it. There doesn't seem to be an option for this so I was just wondering if there was a answer. I have attached a picture of the problems. Thank you for your time, I appreciate it!





On the last one, no... that's the focus box and it's part of the Android operating system...  wherver your cursor is, is where the focus box will be.

On the first one, the alignment... it looks to me that the top of text of the components are all aligned.  Have you tried a table arrangement?



Thanks for the response Enis. You're right, the text is aligned. Do you know what could be causing this though? I'll use the table arrangement as a last resort (it gets messy once there are a lot items in it).