How to randomly select a .glb model out of a pool? - aframe

Im trying to spawn one of multiple assets everytime the user touches the screen. Im using a template from 8th wall but its just spawning one asset.
I already added my assets and added them, including ids, to the body.html and a const modelList including them. I really dont know anything about any of this stuff and i cant figure out where to begin learning.
Im currently using "newElement.setAttribute('gltf-model', '#strangstckchen_pur')" to spawn my object, which is working fine but obviously just for the one object mentioned.

Related

How to use the project templates?

I am new to Xamarin. I have done a couple of smaller projects (2-3 pages, one table). I have a new project that is a great candidate for a shell app. It will have 20 pages, will consume data from a transactional database (cloud hosted) but also have an offline datastore (SQLite). Right now, I just want to get the local version up and running. The template for Shell App generates an IDataService and a MockDataStore. That is a great place to start - but how do I have more than one table? I am a little confused how I would use that. What I would love to see is a template generated shell app that just adds another table (and corresponding list,detail views along with view models. For example, the simple "todo" sample but add a contact table to assign todo tasks to would be perfect. Thanks in advance for your help.
I hope this helps others new to Xamarin. When starting a new project and choosing anything other than the "blank template", the template generates a model (Item) and a services folder containing an Interface (IDataStore) and a MockDataStore. Being new to XAML in general, I spent a lot of time working on getting the UI to look like what I wanted it, learning about Shell navigation and similar topics. Finally it was time to include the data part of my project. Where I got stuck was trying to make sense of the boilerplate code. My understanding of DependencyService was for platform specific code (e.g. Android, iOS) and NOT data service dependency. Further, the templated code is a typed interface (IDataStore). The solution was fundamental - all that interface does is insure CRUD operations are available in whatever you use in a datastore. For me, simply changing IDataStore to not be typed as an Item, solved everything. It allowed me to keep the database layer abstracted away. In my little project, I completed my "MockDataStore" adding additional CRUD operations until I was ready for my real data operations. NOTE: if you generate the WEB API project from the template, it will make more sense - you can flip between your MockDataStore and actual data store.

Delete entire QTreeWidget tree

Im working in a GUI project that is using QTreeWidget. The program parses through an XML and creates a tree to be displayed using the QTreeWidget.
I found a bug in the code, where if the user changes to a new selection, then back to the one they were just on, it re-parses the XML as it should, but the previous tree that was created is not being destroyed first.
The new tree is simply appended onto the old tree and then it is now displaying duplicates of everything. If you continue to change views and back again it will keep appending onto the tree n number of times.
I have tried using TreeWidget->clear(), but this looks like it only clears what is being displayed and is not actually deleting the tree itself.
I have seen examples on line of people talking about using
delete topLevelItem()
but i have not been able to make this work either.
Is there anyone out there who knows a proper way to delete and entire tree from a QTreeWidget?
Thanks.
After an hour or so of searching through the code i found the problem.
The original developer was storing the parsed XML inside a QStringList and the list was never getting cleared.
It was a simple as putting a list.clear() at the beginning of the function call...

android ListView not getting updated after a modification to it's cursorLoader

I am new to android and java and working on an app that has a few remaining problems that I haven't resolved yet.
I have a main activity that is a viewPager, with each page being a fragment. If the 4 fragments 3 are extended from ListFragments and one from PreferencesFragment.
The ListFragments have CursorAdapters to get data to and from SQLite databases through providers.
I am able to get data into the database, insert, modify and query the data correctly and fill the list views ok.
My preference setting are to choose different ways of viewing the data in the database.
Not knowing how to do this, I have implemented a process where I modify the cursorLoader query to the provider with a number of different choices of the "WHERE" clause. I have worked out the logic for the preferences as they exist now, implemented the code but had some difficulty finding what to try to trigger the refresh of the ListView.
Since the "dataset" hasn't really changed, no trigger can come from there, plus that would just use the same cursor as it currently exists to run the query again and return the same results (or be smart enough to know that it doesn't need to run).
On Stack Overflow I did find a couple of references to a similar implementation that suggested reStarting the cursor loader, which would then on the reStart read the current values in the stored Preferences file, create a now modified WHERE clause that will show the sub-set of data as specified in the preference settings.
In testing the app now, even with the reStart of the cursorLoader, the ListView isn't getting refreshed.
The only time I can get it to work right is restarting the app. If I stop the app and restart it, the new values are used and the ListView presents as the preferences dictate.
In looking through Stack Overflow and the Android site, I did find another set of APIs that might have been a more natural fit for what I am trying to do, namely the Filter APIs.
First question then would be, did I go in the wrong direction on how to control the "filtered" view of the datbase. Is filtering a better approach and a recommended way of
doing what I am trying to do?
Second question would be related to the fragment lifecycle of my ListFragments to achieve this CursorLoader update.
Thanks for any input on the topic.
-Dan
Found my problem here.
Two things, the way I am trying filtering is working and from what I have seen in the
Android development site, a reference there indicated that the filtering capability is
already implemented in the CursorAdapter, CursorLoader classes I am using.
When my preference settings changed, I did a reStart of the cursorLoader, but had restarted the wrong one.
Problem solved. Any input on is there a better way would be appreciated.
Regards, Dan

Managing Shared and Local object repositories in QTP testing

I am testing a windows UI application with a lot of menus. I think I understand the concept of shared and local OR but I feel its a lot of work maintaining the shared OR and it outweighs the advantage i.e. memory usage.
Scenario : If I record the operations in 'File' menu, I can see that a window object, File menu object and some dialog objects that show up after that are created in LOR. At this point, I feel only the window object is a candidate for SOR because only that is a reusable object. So I merge my LOR and SOR. Then, I create a new action to record 'Edit' menu tests. I associated the SOR with this action. At, this point its fine. But when I look at the OR of Edit action after recording, I see that the Window object is local now. So I have to go back and again merge LOR and SOR. Unless I am doing something wrong, this means I have to keep doing this merge for every test/action till every object or sub object I would possibly use would be in the SOR. This is not helpful at all. Am I missing some concept here?
Thanks for reading and any input is appreciated.
The motivation for using SORs is not to reduce memory usage but to increase sharing so that if something changes in the application you only need to fix the description in one place.
For this reason one would typically use SORs when creating tests using keyword driven testing and not recording.
Usually one would have the entire area of the application in the SOR (or not at all) and not just the test objects which are actually shared.

Drupal 6 - make a module for every block of dynamic information?

I have a Drupal 6 website with about 20 pages. Inside every page, I need to create a lot of widgets with information either stored inside the database or from external web services. Most of the time, a "view" (from the view module) is just not enough to solve the requirement.
Up until now, any time I need such a widget, I create a new module which implements hook_block. Then, I drag and drop this new module inside the panel I want. I will need to create about 20 modules. This works pretty good. However, I'm not sure if this is the correct-drupal-strategy and I would love to receive some feedback from experienced Drupal developers.
A module can expose as many blocks as you want (in theory, admin/build/blocks will teach you otherwise ;)).
Have a look at the documentation of hook_block(), you just need to extend yours to return multiple block infos and then decided which one to show based on the $delta.
So you don't need 20 separate modules, maybe 2-3 and group the blocks somehow together because just a single module might be hard to maintain. The thing is that every single module makes your site a tiny bit slower (at least one more file to load, module_implements() needs to loop over every module for every hook and so on).
Without more information , it's hard to give any better advice. Maybe you could expose your data to views, or write a views plugin to display it in the way you want it, or...
Although Berdir's answer is pretty good, I'm impressed there's no link to any documentation in it. hook_block is meant for several blocks, and they can share functions that build their content. The API page is good, the example it gives defines two blocks at once.
You should notice each defined block has a delta (a key in the $blocks array). You can have dynamic deltas and use values in it to fetch data (passing a nid or uid and getting related content, for example).

Resources