2014년 12월 27일 토요일

Blocks disappeared

I'm building my app and it isn't over. Thus this afternoon when i was connected on Chrome to finish my project so i lost all of the blocks of my second page. The most important, I need a help please because I don't understand.



How many screens do you have?    If you have more than 10 screens, App Inventor becomes unstable and this could be your issue.  The simple fix may be to restore your project using the aia source file you should have been saving on your desktop.  Do you have a saved aia file?

Is the problem with only one project or is the problem with ALL of your projects?

What is the name of your project?    It is possible MIT might be able to recover your blocks but sometimes that is not possible.

Please answer the questions and tell us what you were doing with  your project immediately before having lost blocks on some screens (not all the screens?).



Yes, I got more than 10 pages, no i ddidn't save a aia file unfortunately. I'm doing everything you told me to do but there's nothing which reappear. I got this problem with just on project.

My project is named : Rough! and the problem concerned one and only screen that i named: Connexion. I hope you could help me.



OK, thanks... the problem was brought to the attention of MIT; when someone finds a free moment, they probably will look for your file.  No guarentee it is retrievable and you may not got a response tonight and hopefully yur prough Rough! will get looked at  sometime tomorrow if possible but it could take longer.



This same problem is happening to me. When I click on the link to open App Inventor 2 the first thing it stats is that my blocks are empty and would I like to save. Of course I say No and then click continue. Sometimes it takes 4 times to reload before it will give me my blocks back.



But, eventually it DOES give your blocks back???  That's important... Please confirm this...



Yes Gary MMTech i had the same but i'm pressing the button "no" I still lost my blocks. Otherwise thanks you SteveJG to help me but I do not have much time, my project was finished it just had to do the tests and it's good. So what I will do is to try to rebuild my lost blocks if i can in hoping they are exactly as I did. But if your team manages to find a way to bring me my blocks, it will be perfect and I will take my old blocks.



Yes, so far I always get my blocks back.



 I just logged in to show someone my app which I haven't been working on for a week or more and all my blocks are gone for Screen1. I only have 3 screen and the bulk of the app was in Screen1. Haven't backed up in a long time and I'm not sure whether I clicked Not to save when I was warned about empty blocks...doh....

Have I any chance of recovery?



Someone is looking out for me...turns out I did have a backup in my repository. I had backed it up the day after my last edit...phew.....just didn't remember where I'd put it exactly.



I experience the same problem with only two screens



waouw, I just hope they gonna found a solution for us all 



Hey guys, if it's on very initial load of the project then I may be having the same problem.  Every time I open the project it immediately gives me the popup and asks me if I want to save an empty screen.  I pick no, wait 5 seconds, and then it reloads the page.  However, the popup just appears again and I get stuck in a loop of clicking "No, don't save" and reloading the page only to see the popup again.
BUT, if this is what's happening to you all, I found a quick-fix.  Load the project, and then as fast as you can (you have to act faster than the popup can appear), go to your Projects menu, go to "My Projects" and just open or create some other project.  Then go back to the project giving you the problem and the popup will no longer appear and your blocks should still be there.  I've had this happen 3 times and it has worked every time so far, but take note that it can take a few tries before you can be fast enough to complete the task before the popup appears.



ok thank you all for your help


[App Inventor Open Source Development] @SimpleEvents are not firing.


I wanted to start a new thread, since I can't get some basic @SimpleEvents to fire in a new component, is there something more than just adding this example function to the Component class?

@SimpleEvent
public void Info()
   EventDispatcher.dispatchEvent(this, "Info");
}
...
   {

       // place to trigger event
       Info()
   }

Are there other places you need to define the Events?  I already put all the events I want into the OdeMessages and TranslationComponentEvents.java classes, but it hasn't worked..

--
What you have done looks correct and should work. Might be easier to find the problem if you upload you code to GitHub

--
I'm still debugging, but the Events are not triggered anytime they are in the bluetoothGattCallback methods (line 333 for example). They work in other parts of the code, like in the stopLeScan() method. 

https://github.com/wicedfast/appinventor-sources/blob/master/appinventor/components/src/com/google/appinventor/components/runtime/WICEDSense.java

--
How are you firing this event? There should be some method that will invoke your custom event.

--
I'm looking into your code.

⦁ Are any log messages in LogMessage method outputted?

⦁ In the version that you are running, is mLogEnabled set to true because your event only gets fired when this is set to true.

⦁ In onLeScan method, is the condition "!mLeDevices.contains(device)" satisfied?

--
Sorry, I've clean the code up some more, and removed the LogMessage firing.   I've boiled it done to this strange behavior.

The FoundDevice() event will fire if the call is from this public function here:

/**
* Allows the user to Stop the scan
*/
@SimpleFunction(description = "Stops BTLE scanning")
public void stopLeScan() {
String functionName = "stopLeScan";
if (scanning) {
try {
bluetoothAdapter.stopLeScan(mLeScanCallback);
scanning = false;
LogMessage("Stopping LE scan with " + numDevices + " devices", "i");
// fire off event
if (numDevices > 0) {
FoundDevice();
}
} catch (Exception e) {
LogMessage("Failed to stop LE scan", "e");
}
}
}

But it doesn't trigger if it is called inside a Callback function.  Is there something about the embeddedfunction the "new LeScanCallback" method? 

/** Device scan callback. */
//private BluetoothAdapter.LeScanCallback mLeScanCallback = new BluetoothAdapter.LeScanCallback() {
private LeScanCallback mLeScanCallback = new LeScanCallback() {
@Override
public void onLeScan(final BluetoothDevice device, int rssi, byte[] scanRecord) {
// Record the first device you find
if (!mLeDevices.contains(device)) {
mLeDevices.add(device);
numDevices++;
LogMessage("Adding a BTLE device " + GetDeviceNameAndAddress(device) + " to scan list, total devices = " + numDevices, "i");
//} else {
// LogMessage("Found new BTLE device with rssi = " + rssi + " dBm", "i");
}
}
};
--


join sound with image?

If I "join" a sound and an image, in my global list, will they then appear together?  I need to find away to link certain sounds to certain images, but there are too many to use "set" blocks.  Is there a way to do this in a list?



just use 2 lists, one list for the images, the other list for the sounds
to get the corresponding sound for an image, use the same list index



I have 16 images and each image has a corresponding sound (so, 16 images and 16 sounds) and then I have to present these combos in random without replacement order.  Where would I use the "same list index"?  Wouldn't that be too many "same list index" boxes?  I just want a simple way to connect each image with it's corresponding sound and then I can easily do "random without replacement" presentation. 



Create global variable named ChoiceNumber.
Set global ChoiceNumber = random number from 1 to length of pictures list.
Set output picture to selection number ChoiceNumber from picture list.
Set output sound to selection number ChoiceNumber from sound list.


Collecting Data in TinyDB an Export them to Excel


Hey There, i'm absolutly new in this. 

I'm trying to create an APP that scans an Barcode, saving this Barcode-Number with an changeable Timestamp an 3 to 5 more Informations (Free text, or selectable text from a list) to a DB. The DB must be exportable to Excel. Maybe by sending a CSV to an Email-Account... 

Is this posible with the App-Inventor. Can anybody give me some Starting-Help.

-- 

AI2 can create a csv file from a List. A list can be saved to a TinyDB.  What is in a TinyDB can be read into a csv after converting the info to a list.  The csv probablly can be emailed.  A csv can be read by Microsoft's Excel.

Will it work for you?   Your biggest issue is getting AI2 to scan the barcode.    I do not know how you would do that.

--
okay excellent, the Barcode is scaned by the Mobile-Camera and it just generates a Number witch would be the Tag for every entry to the DB. I startet today, bozld it would't work. should try further...

--
I am in need of this too, glad I found this page.
So, what is exactly is csv? willl i be able to get the data that was collected in my fusiontable to be transferred to excel? that would be great
Is there a specific program for that?

--
CSV is a Comma Separated Value file... each line has the same number of fielkds, separated by commas.  And example of this would be:

Mr.,Jim,Johnson,222 Any Street,Duluth,Minnesota,12345,123-4565-7890,Male,Likes Carpentry
Mrs.,Jane,Smith,123 Over There,New York City,NY,54321,,Female.Painter

The two lines have the same number of fields, all comma separated.  the second one, Jane, doesn't have a phone number but you need to have the field there.

The first would translate to:

Mr. Jim Johnson
222 Any Street
Duluth, Minnesota 12345
123-456-7890
Male
Likes Carpentry

Look up CSV on the web.  CSV files can be imported by Excel.

--
See attached screen shot of how to request a csv download of
a fusion table.


--

Server error: could not copy project. Please try again later!


I want to rename a project using save as but whenever I try I get

Server error: could not copy project. Please try again later!

What options do I have?

--
If you have a lot of assets like pictures, images and sounds, reload them into the project from your hard drive and try again.

Are you able to save your AIA file?  If so, how big is it?  You have a limit of 5MB...

--
I'll try that, my aia is 10Mb my apk is 11.3 most of it is graphics.

--
William... read my tips...


--
I'll take a look, I have tried using the a2ilive standalone version but found one or two of the components were not in sync with the MIT version.

I've spent about three months with app inventor 2 through many bugs and crashes, it would be nice if there were an official standalone version
which would take the load off the MIT servers.

aia have been a lifeline through lots of problems in ai2 and something I do religiously.

--
Be aware, if you are using AIAliveComplete or AIUltimate (these are NOT MIT products), and your aia is larger than 5Mb, you can not return and use the standard online AI2.  Once you use a personal server and exceed the standard AI2 parameters for projects, you MUST continue to use the personal server. Be aware that recently, both developers have upgraded their products to the latest AI2 release standards (or very close to them).   You might want to download a more current version of your personal server.

If you use either of these personal servers, these have their own web forums.    AI2 is opensource, so a developer can modify AI2 to run (on a personal server) to run anyway they want it to do, if they understand how to build the plug ins http://appinventor.mit.edu/appinventor-sources/ .

At the moment, MIT is not considering it's 'own' personal server; please use the MIT server 'in the Cloud.'

--
but found one or two of the components were not in sync with the MIT version.

can you elaborate?
are you using the latest version?


Once you use a personal server and exceed the standard AI2 parameters for projects, you MUST continue to use the personal server.
if you later decide to go back to MIT App Inventor, you always can change your logic according to one of these options 

--
Yes I'm using the official MIT in the cloud version. There's just not enough server resource at any point in time to handle my 'Save As' request.

I'm going to take Enis advice and reduce the amount of media storage required. Basically this will mean using smaller images or limiting the sound files to shorter lengths.

I just hope this works. I understand App inventor is only meant as a teaching tool at the moment and for the production of small apps.

I've been stretching a little to produce an arcade like game see. https://play.google.com/store/apps/details?id=appinventor.ai_ai.AliceFalls but eventually I'll have to port it 
to something like xamarin or visual studio or android studio.

how to have a global variable and a text string in a label.


I need to have the answers to math problems interspersed with text strings in a label. I thought i did the right format but i get the error: this operation cannot accept the argument "empty string."please help im a newbie ,thanks.

MIT App Inventor 2.html


--
Sorry, the attached html does not help us understand the problem.  Can you attach a screen capture of your blocks and or Designer screen in png or jpg format?    If you do that, you should get some specific advice.

This message "argument "empty string" is there probably because when you do the 'calculation,' there is no numerical value in the TextBox possibly.   We do not know without a screen capture.   Do you know how to use DoIt?   This is the AI2 debugger...it can help a lot in finding errors like this.  There is a description of DoIt here:  http://www.appinventor.org/bookChapters/chapter15.pdf

More help learning to program App Inventor blocks is here in the AI2 free online eBook   http://www.appinventor.org/book2 ... the links are at the bottom of the Web page

--
here is a screenshot (didnt know i could do that, you learn something new everyday)


--
You can try a block construction like:

With another label for each of the three other variables.   If you click Button1  before entering a value in each of number.Text, row.Text or quotient.Text without placing any numerical values in the text blocks, you will get a "this operation cannot accept the argument "empty string." message.    You have no 'error' control.   You can 'fix' that by testing for values in the blocks using an IF..then statement   (use the Math is a number? block).

Your instructions.Text label should work but when you clicked the button, you possibly did not have a value in one of the text entry fields.  Consider, you are doing all four calculations in one operation so all the input blocks must be filled.

A trick you can use in the instructions.Text label, to put the results on separate lines is to include the control character  \n  following the Text blocks.... for example, change your  thing block to thing \n and when the label is displayed, thing will show but the \n will not and you will see that the following text is on a different line.

Try some blocks and see what happens.   If you need more advice, post additional blocks and you will get advice.
How you have this stuff displayed is up to you.    You can use a single label or possibly put on the app four labels as mentioned above to display the results of the individual calculations; however, your construction should be fine as it is if ALL the input text boxes have non-zero values.

--
this first variable works in the app but the other variables need to be added to that instruction label too somehow.



--
i had "quotient. text" instead of "quotient of "... oops.
you dont even need set rows text numbers only true.
yey it works now,

[App Inventor Open Source Development] Sound sensor compoent


Please see the sound sensor proposal below:

--
I don't know enough to know if this would be useful.   It's nicely
simple, but I guess it detects only amplitude level,  Are there good
projects to so with that?  Or do we want something more elaborate.?


--
 Its possible to add in decibel in there. I'm checking into it.
We had a comment from Evan indicating maybe this could be part of Sound
[Recorder] component?

At any rate, it could be used along with canvas to produce charts.

--
https://play.google.com/store/apps/details?id=kr.sira.sound&hl=en

Sound Meter

--
Has this been published to the OSS forum? how does it compare with
Gareth's SoundMeter component?


--
There's a thread about it in the oss forum; searching for soundmeter should bring it up.
Also, forwarding proposals to power users is very helpful too.
--
Found it in OSS and the proposal is HERE from exactly a year ago.
We should follow-up on it, comment, and have Gareth put code in GitHub?

--
Gareth,
Would you like to make this proposal a pull request in GitHub, then get comments and finish it up and add it to App Inventor?
If not, maybe Hosein would want to finish it up?

--


delete tags in tinywebdb


How do i delete tags in tinywebdb?  I know how to delete its value, but want to also delete the tag itself.

-- 

may I introduce you to the documentation http://ai2.appinventor.mit.edu/reference/components/storage.html#TinyDB


ClearAll()
Clear the entire data store

ClearTag(text tag)
Clear the entry with the given tag

-- 

So that means i have to go to the database and remove it directly? Cant do it through ai2?

-- 

???
why don't you like use the TinyDB.ClearTag block?

--
Sorry, must have missed it.....close this discussion.  Thanks for all the help

--
The delete tags is for tinydb, not webdb.

--
sorry, you are correct, there are no such blocks for TinyWebDB
however you could use a custom TinyWebDB, see here for more information 

--
Thx

--

Export project to my computer

I need some help please. I want to export my project to my computer but I can't because app invetor tells me that my file is too large. My project weighs 33.0 MB, and app inventor allow me to export only 5 MB. What can I do ? Am I force to erase most of my app ?
Do I have another way to put my app on Play Store without export my files on my computer ?



choose the preferred navigator

you can open the list navigation systems installed to let the user choosewhich to use? waze example, tom tom, or google maps?



you should get that list automatically, if you do not specify the activity package and activity class of the activity starter



thanks



I use the code shown in the attached, how can I change it to notindicate the navigator of Google but get the list of browsers to choosemy favorite?




1. remove the activity class 
.2 also try to remove the google.navigation:///? in the data uri, 
however I'm not sure, if the different navigation apps can receive parameter like this, each navigation app might be different... 
just try something and let us know, what you find out...




ok thanks, I try in the next few days and I'll know


Save list to file when screen closes

in my app I collect data in a several lists.
When the screen closes, I want to store these lists in csv-files.
How can I do that ?
Is there a possibilty to do something, when the screen closes?



You can easily save it to a TinyDB.  Just give it a key, and store the CSV string as the value.



The question is, if I have to store the list whenever a single data changes.
This makes the app slow and I don't know, if it is a good thing for the sdcard, when I do thousands of write accesses.
So I would prefer to store the lists, when the screen closes.  



If your data changes frequently and you're storing it frequently, you're probably not doing things efficiently.

Please post screenshots of your relevant blocks and we'll try to help you out as well as we can, but we can't help you without seeing what and how you're doing things.  The only thing that'll make your app slow is sloppy programming.  Writing data from time to time shouldn't do it.  You should be naipulating your data in lists and writing it to the device only when you're ready to leave and read it when you come back.



My app is a vocabulary test. I have several lists of vocabulary. Lists of Lists. Every list has 900 items of 10 items. One of the item of the items shows, how often every single vocabulary has been requested. So every time I request a vocabulary, the app increase the value of one item. And every time, the app does this, the whole list of 9000 items get stored to the csv-file. I think, it is not good, that everytime one item changes, the whole file is stored. I would prefer to store the file (with all changes) one time, when the screen closes. But there seems to be no possibility to do so. 




you can create an "Exit" button for the app and store the file in the Exit.Click event
however your user also can close the app using the menu buttons and in this case the list would not be saved

alternatively you could try to store the list in TinyDB....
well, probably this does not help, because TinyDB is only a XML file in the file system too, but it would be interesting to know, if TinyDB is faster than the File component...
let us know what you find out...



How many write accesses can a memory cell stand ?
If that doesn't matter, it would be a relief.
Is this a criterion a software programmer should take heed of.



Here is a generic answer regarding write access to a memory card:



Should you be concerned?   It depends on how important the data is.  If data is very important, you should store a copy somewhere else.
What the article indicates, is that you will probably buy a new device before your memory wears out (unless there was a defect in the memory chip).


uncheck check box when another is checked


if there where was a "when checkbox checked" block, i would do: if checkbox 1 checked, set checkbox 2 to, not,check box 2 checked.
Is there any way to do it. "when checkbox 1 . changed" didnt work and i dont have anywhere to put an" if,then" block.
(its not important enough for a screenshot)

--
You do it in the Checkbox.Changed block Jen...


Where you have to be careful is IF you have the same code in Checkbox2.Changed, then they'll work against themselves cause they'll be constantly changing.

You can also do the checking in a timer (Clock) component... set the interval to 1000 so it checks once a second, and in the Clock1.Timer block, do that code above and it'll constantly change it  without the Checkbox1.Changed block...

--
Try this:

RadioGroup Check Boxes Solved.

--
refer to: Checkboxes as radio buttons

--