2014년 12월 11일 목요일

Problem with update insert and select command (cont..)

"as ABG said, use AND instead of &&
do you have the columns Tee and Size in the table?

btw. you error message is displayed in the second Do it result, because you do not have any error handling in the GotResult event

if you later get the rowid back successfully, please note, that you also will get back the header row, which means the result will look like this

rowid
101

101 is just an example of a rowid.
you can extract the 101 from the example by using the split at block, just split at \n and you get a list with 2 items, then select the second item to get the rowid (in this case the 101) 

first try to get a vaild rowid back, then continue with the UPDATE statement

In continuation of this thread..

I corrected the And query but i get two results but not the row id.




[App Inventor Open Source Development] Communication between AI Companion and Web Page

I am curious how the communication between the companion and the browser happens. After we generate the six digit alpha code and feed it in the companion, how does the companion connect to and communicate with the browser? Is it mediated by the server?



By monitoring traffic on port 8004.  Just lie like the NSA :-)



There are several parts to this communication, but simplifying it,
it's something like this:

The code is just a handshake for security reasons, and it's
acknowledged by the rendezvous server (a bespoke microservice that
serves only for this function).
We actually run a web server on the phone (as part of the Companion),
and the browser pulls from there. So the real communication is the
browser doing long polling to the phone.

There's a paper coming out soon with many details of this; once it's
published I can share the URL.



Thanks. Now it makes more sense. I have been using app inventor in a classroom like setting. After a few students connect to the LAN, the connectivity between the companion and the Web app becomes unreliable. Is this expected from the architecture?



It depends on your wifi, and the number of people you need connected.
If you don't have a powerful link, I'd suggest trying USB instead
(sertup tools need to be installed, and if working under windows, you
might need drivers for each device).



It's pretty common for school networks to use some sort of a NAT box that can support only a limited number of connections, say, because the NAT table overflows.   You ought to check this.  Keep in mind that you will be using two connections per student -- one for the laptop and one for the phone.   As Jos says, you can use the USB cable (which requires installing software).



Although it is a classroom setting, I am running it over my home wifi box. There are 6-7 students connecting so a total of 14 connections. The wifi box is a Cisco Linksys router. We use the same at my office to connect up to 30 laptops.


Activation key

Hi all, I have a free app and an app that works like an activation key, so that if you installs App 1 you have it in a demo version, with limitations and ads, then if you buy and installs App 2 you unlock full features in App 1. To achieve this I put a check at App 1 start to see if App 2 is installed (through activity starter). This is working fine, however I have some doubt.

1) I'm afraid that one can simply backup App 2 and pass it to others
2) I don't like this method so much, because you have to keep App 2 installed

So I was wandering how will you do something like this.
I'm thinking about using tinywebdb to make user login and save its credentials along with an unique code and when App 1 is started check if user credentials exists. But then others issues come up, like: how to delete credentials when user unistalls the App 2? Because If it is a pro-user he will simply install App 2, activate App 1 and then unistall App 2 getting the refound by google market, and so he will get full unlocked app without give me a penny for my efforts.
Any thoughts and considerations will be much appreciated.



to avoid the refund problem, App1 could check if App2 is installed as currently
if yes, then store this information and the current timestamp in TinyDB. On next run of App1 check if more time than the refund period has passed and App2 is still installed. If yes, display a message for the user "you can uninstall App2 now")


BackPressed not available when ListPicker is used

Maybe my approach is totally wrong, but here is what I'm doing right now:

I have two ListPickers, one containing Accounts (AccountSel), and one containing Objects (ObjectSel), built from fusion tables.
These listpickers are HIDDEN (!!) on my Screen1, but are opened by using AccountSel.Open en ObjectSel.Open.
When I select an Account from the AccountSel, the app opens the ObjectSel.

When I have the Object-list displayed, I want the app to open de Account-list when I use the Back button. BUT, the Screen1.BackPressed seems not to be used, so my screen is displayed instead of my AccountList.

Question: Is it correct that Screen1.Backpressed is not enabled in a ListPicker display, is this a bug? How do I solve this?



backpress in the listpicker only closes the listpicker
what you could do is to set the listpicker to visible = true in the before picking event and set it to visible = false in the after picking event again, which means, the user can open the listpicker again after backpress


Problem with Update and delete query

Hey, 
       So i had to make a new thread as i couldn't find any solution to it by myself.

I want the correct update and delete query for the following block attached below. also i want to know what the problem is.

I want the row id if two fields are matched that is Product and size in the fusion table.







For starters, I suggest going into your data and changing all occurrences of
the double quote character (") to the word inches. 

The quote characters mess up query syntax if the are not balanced or
safely wrapped up in other quote-type characters.  
It's much easier to avoid the problem and drop them from your data.
(Apologies to Mr. O'Brian)

I am also suspicious of your use of  '&&' instead of the word AND.
It looks like something out of the Microsoft Access SQL handbook, and
not part of Fusion Table syntax.
Could you please confirm that for us?



as ABG said, use AND instead of &&
do you have the columns Tee and Size in the table?

btw. you error message is displayed in the second Do it result, because you do not have any error handling in the GotResult event

if you later get the rowid back successfully, please note, that you also will get back the header row, which means the result will look like this

rowid
101

101 is just an example of a rowid.
you can extract the 101 from the example by using the split at block, just split at \n and you get a list with 2 items, then select the second item to get the rowid (in this case the 101) 

first try to get a vaild rowid back, then continue with the UPDATE statement



I corrected the And query but i get two results but not the row id.







if you do not get a rowid as in your example, you should check your SELECT statement
global rowid in your example is a list, in your case a one item list, because no row was found
also add some error handling, something like this: if length of list = 1 then display "no row available" else update


rowid
101

101 is just an example of a rowid.
you can extract the 101 from the example by using the split at block, just split at \n and you get a list with 2 items, then select the second item to get the rowid (in this case the 101) 




Ok i am successful in getting the rowid but the id is enclosed with brackets. how do i extract it. please help  




how does your fusiontable control got result event look like?
what is the result you get from the fusiontable?
rembember, the result looks like this:

rowid
101



Yes i got the result as rowid 101. Then i added a component to split the text at rowid and only get the id. So i get the only the id but idk why it gets enclosed in brackets



Without screenshot we can't see what you are doing. I'm wondering, why you do not like to split at \n as suggested...



The result i get from the first pic is (3). just the id which i want when i use /n it does not split and shows rowid together.







you have to split at \n (note the backslash instead of forward slash)



If you are seeing () around your result it's because it's a list,
which is what the split operation returns.

Select the first (or whatever) element to get just the value,
using the list select element block.



I did as you said and now i get the rowid correctly. Now a problem has occurred in update query, please find out where have i made the blunder





you still split at rowid...
your result looks like this

rowid
3

this is the same as rowid\n3
as we know, \n (backslash n) is the invisible newline character
after splitting at rowid you get \n3 as rowid, this is not what you want...
this is also why you find the 3 in the next row of the Do it result, see screenshot

recommend several times, to split at \n
just split at \n and you get a list with 2 items, then select the second item to get the rowid
Thank you for trying it now.



Thanks Taifun i finally got what you were trying to say and implemented it and i can now get my commands working alright but there are some problems occurring i dont know why. My fusiontables is connected to more than one table, in some the commands work correctly but not in two tables. 

1st table: When i use the update command for a different size column the same result is copied to the other cell in the size column i dont know what wrong i have done.

and The data in all the tables gets entered when i click on the update button twice. it does not get updated when the button is clicked once.





without taking a look at what you have done this will be difficult to find out....
and this is where personal support starts for me.
as you can see from my webpage, I'm also offering personal support for a small fee. In case you are interested in this service, please contact me directly per email. Thank you.



Okay but the only way i can donate to you is through fiverr. if you can make an account there i will pay for your service. More likely i think the fault is not in the blocks but in the fusion tables.


Does aistarter conflict with BlueStacks?

I can no longer connect to the emulator from appinventor.
I have created a simple, simple dumb simple file but it will not connect.

The most recent change I have made is downloading BlueStacks (tool for running apps on PC - substitute for emulator). Could this be the problem?
It also is affecting connecting with my Nexus device.



OK - never mind! Sorry about that. You know how it works: ask the question, give it one last try to solve the problem & hey presto...!

I had already 
- disabled BlueStacks, 
- reinstalled appinventor emulator & 
- restarted (several times). 

However I had to finally stop a couple of BlueStacks processes that were still running from TaskManager.

Now I've got the trusty old emulator working.

Maybe this will help someone else.



Thanks for elaborating about BlueStacks.     It is a known issue that BlueStacks interferes with the operation of App Inventor 2 and that AI2 can not work properly while BlueStacks is enabled or while any BlueStacks processes are still active (thanks for that last bit).


Using Bread Crumbs & Text to Speech


I am new to using App Inventor.  I have used it to install and run a program that finds a car using the GPS sensor.  What I want to do is modify this so I can store multiple locations for items.  Primarily, I want to leave “bread crumbs” in places that will alert me by vibration or sound when I get near them.  I want to use this to “remind” me of locations that I felt were important for some reason in the past.  Should I be trying to add in a block that saves information to a data base and then retrieves it when it is activated by the GPS?  
How do I add text to speech for all components of the app?  Any help would be appreciated.

--
Look at the section Programming Complex Conditions here:  http://www.appinventor.org/bookChapters/chapter18.pdf      This is one way, another way might be used by using the  Location property    DistanceInterval  See the LocationSensor tutorial here:  Exploring with LocationSensor in AI2  

Use these tools in conjunction with a Procedure that uses If then statements  (or a list) to continually check whether you are near an important location.  Use a clock to call the Procedure.... do not call it too frequently or you will 'upset' the gps receiver in your device by asking for information before the gps gets a satellite fix (which may take 5 to 20 seconds or more depending on where the device is, the gps receiver quality etc.

--

Back and Next functionality using web viewer component

I know it is going to be a very basic question,but i need to know it anyway.I have given the link of an fb page in my app,for example, when i am taken to the fb page,i check my fb message inbox.Now i want to go back to my fb page but when i click my device back button,the app takes me to the button which i am using to launch the web viewer component.In short,i want to add the functionality of back and next in my web viewer component which can take me to the previously and next visited page.I am new to this component.I wish to be guided.



put the WebViewer.GoBack method into the Screen.BackPressed event


Query with fusion table

Hi guys, i'm trying to make a simple app with app inventor 2. This app help you to find some kind of gift for friends, parents or girlfriend/boyfriend. But i have a problem. I used a fusion table to store the gift list ( the table is: Description, Recurrence, Relationship, Gender, Age, Price ). I have a screen where the user insert these data: Minimum price, max price, Gender, Age, Recurrence and Relationship.. The query is like "SELECT Description FROM gift WHERE Recurrence = "users's recurrence" AND Relationship = "user's relationship" AND Age ="user's age" AND minimum price < "price" AND max price > "price". The result will be the "Description" column. But i'm not able to make the query with the blocks. I tried to follow the tutorial, but they explain how to insert into a fusion table, not how to select from a fusion table. The result of the query will be displayed in a notification or similar. Can someone help me with the query? 



this might help

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



Hi, thanks! I found how to make a select query, thank you so much


Simple app, but not available on GooglePlay for some smartphones

I finished a few apps in AI Classic and AI2 already and uploaded them to GoogePlay.
Some of my friends "complain" those apps are not listed on their smartphones, when they want to download them.
They are (I think) not too complicated apps with not too much requirements.
Here is one of them: https://play.google.com/store/apps/details?id=appinventor.ai_digimuhely.SP_kalkulator

E.g. one of the phone was a Samsung ACE Duos

Do you have any idea what should I do differently to make these apps available for more people?


Button ( Shortcut to next page ) won't work

I have made a button to switch to the next page but when I test my apk file on my android  and I get an error 902: Screen not found. I don't know what I'm doing wrong.

I have put a picture to this discussion for you to see how it is in the program.



screen names are case sensitive. This will work, in case there is a screen with the name Telefoon
unfortunately from the screenshot we can't see the name of your other screen...



The Second screen is called telefoon so that's why i don't understand why it isn't working



He is a picture of my second screen




The screen is names Screen2... your TITLE is Telefoon

Put Screen2 there instead...


Emulator Trouble

When I open the inventor app on the emulator, I'm met with a screen that mentions "running blocks" that stays on the screen and I can never access my app. Does anyone know how to fix this? Thanks. 



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.


TextBox does not maintain typed name

In my main screen I created a TextBox to put the person's name, everything works normally, but does not register the name.
The goal would be, enter the name and it remains visible in the fielduntil it was changed again.
If you exit the application, when reentering you must re-enter the name.I do not want that to happen.I tried several different ways to make it work, MAKELIST, tinyDB and other techniques, do not know if I missed any part in the assembly ofblocks or it is not possible to do.
Does anyone know how to solve this?




Post some screenshots of your blocks to let us see what you're doing.  This should be very easy with a TinyDB.



Those were the last two attempts I made.
Read several tutorials, watched several videos and have not seenanywhere something about it, I tried several methods and these twowere the last.
A method for (Atleta) and a different method for (Personal Trainer).Trying to figure out what would work faster.





You cannot save a record with a blank tag.  You have to give the tag a name...



That helps a lot, but still did not solve the problem.
It is the first time I use the AppInventor so far able to do everything he wanted in the application, except that.
I "saved" the names, but they still do not appear or be registered.
It asking too much to show an example of how I should build the blocks?
Any detail that I'm forgetting. And I can not figure out.




The goal would be, enter the name and it remains visible in the field until it was changed again.If you exit the application, when reentering you must re-enter the name. I do not want that to happen.

in Screen.Initialize, you have to read the name from TinyDB and assign it to the Textbox.Text again. Try the following blocks (assuming you store the name with tag = myName)

set Textbox1.Text to TinyDB.GetValue myName


see also this very simple TInyDB example: How to store high scores with TinyDB by richard


first do the tutorials http://appinventor.mit.edu/explore/ai2/tutorials.htmlto learn the basics of App Inventor, then try something and follow the



Thank you both for your help and patience.
Finally worked, both tips helped solve the problem, the detail that was missing was put a button with the option to save as well.
After that I finally managed to make it work.
Three projects, can they be continued now, thank you.


how can i do this ? I need help pls




First, do the tutorials... The tutorials are located here: http://appinventor.mit.edu/explore/ai2/tutorials



this might help



On each screen, just replace the Purple text box with the screen name you want to link it to



Problem opening another Screen

Hi i am trying to use multiple screens but i have navigating trouble. I used the image but it does nothing. Do i assign a create a variable for each screen and assin it a value?



this is what i have been trying to use




All those blocks do is test to see how MANY items are in the list... not which one was chosen.  You want to check on the SelectionIndex or get the selection and compare it to a string.



thank you Enis I didn't even notice.



Glad to help ;)!


Crazy mouse cursor

Why happens?
How to fix?
When I grab one the cursor position block appears at the top, but the block that appears below I grabbed away from the mouse cursor.
Sometimes is normal, but if you open a video or leave the tab I'm working loses calibration













This sounds like an old mouse switch that can't
drag without "dropping" early.

Try switching mice.

Or maybe you don't have enough bandwidth and 
machine power to run a video and App Inventor at the same time?
Do you really expect to program and watch a video at the same time?

If none of the above match your problem, post a 
of your problem.

Your screen shot just shows a single block.


Fedora Linux Install issue


I have followed the instructions on 'Other Linux' category and have created the /usr/google/appinventor directory and moved appinventor2-setup_1.1.tar.gz there and extracted. I am unable to configure the software using the ./configure as there is no configure file or folder. How do you configure the software so it can be used? Is anyone using this on a system other than Ubuntu? I am running Fedora 64 KDE spin and can give any other relevant details as needed. Thanks in advance for any stellar insight :D




--

Auto Response Texting

I am trying to create a app that automatically responses to a incoming text with the phones GPS location on a map. I have this function working however my trigger word to respond is 'ETA'. The problem that I encounter is the app will only respond once to 'ETA', then if I text 'ETA' to it again I get no response. I have the messaging set to "Receiving Always". If i reset the connection and test again it works fine once then same problem. I usually test it by texting my phone off Google voice but have tested it by texting my phone from other phones and still encounter the same problem. Any insight would be helpful, thanks.


Displaying list

I am tring to display 3 list they get displayed but backwards.  The last item is first and the first item is last. here are my screen shots  




In your procedure, join the text, the line feeds and the item in that order...  you have it backwards.





Okay I tried that but it still comes out backwards



your procedure looks fine
use Do it to debug your blocks and test your procedure with a test list, e.g. a,b,c, what do you get?



In the initialize local text to space block to do give the error Error from Companion: The second argument to foreach is not a list. The second argument is: package $list

in the do block to do gives the error:  Error from Companion: java.lang.RuntimeException: invalid syntax in eval form:<string>:1:115: first set! argument is not a variable name

in the for each block to do give the error:   Error from Companion: java.lang.RuntimeException: invalid syntax in eval form:<string>:1:106: first set! argument is not a variable name

In the set text block to do gives the error:  Error from Companion: java.lang.RuntimeException: invalid syntax in eval form:<string>:1:82: first set! argument is not a variable name

and now I only get the last item in each list which is still backwards IE the last location in the location list which is Fox: 
the total sales in the sales list IE not the sales for Fox but the total for all three locations
and the total taxes due in the taxes list if paid on time again not the taxes due for Fox but the total for all 3 locations with the discount for paying on time subtracted



Now it is not even working before it was working it was just listing everything backwards first item last and last item first but now it does nothing just a blank report



Do it does not work for local variables
did you try calling your procedure using a list a,b,c as input parameter? what do you get back as result?
as you can see from my screenshot, it works fine...



Yes in fact I just tried that very thing and I got nothing



and I got nothing that is nothing
???
provide again a screenshot including Do it results



The A B C list was displayed twice on Do It

The 10 20 30 list was displayed 3 times with Do It

and the 1 2 3 list was displayed once with Do It



just drag the bottom right corner out and expand it just like in windows.