Is there a way to show the count of a nested collection in a CollectionEditor before it is expanded? - collections

If a property in a CollectionEditor is itself an expandable collection, the "value" displayed for it is the string "(Collection)". The cascaded dialog that appears when expanding that collection may contain a lengthy list that takes several seconds, or even minutes, to display. A user who was aware of the collection count might choose to avoid expanding it, or at least would have an expectation of waiting.
I would like to replace or augment the displayed value with the count (size) of the collection. For example, instead of "(Collection)", I would like to see something like "(Collection: 50000)".

Related

How do I create a random item spawner with no repeats?

I am currently working on a rogue-like game in GameMaker Studio 2 and i would like to have an item spawner where no items are repeated.
I have tried multiple different ideas of what i think would work, such as giving items and id variable and only spawning items which hasn't had it's id called, although it doesn't seem to work.
The code I have right now is basic, but that is because it's the only way I've been able to spawn an item, there is repeating items with what i have and i would like to stop that from happening.
Here is the Create code of the object:
// Items
var items = choose(
obj_homing,
obj_tracking,
obj_bounce,
obj_double_xp,
obj_shotgun,
obj_orbit,
obj_firefaster,
obj_scattershot,
obj_damageboost,
obj_explosive
);
instance_create_layer(x, y, "Items", choose(items));
I haven't had any actually crashes in the game, although the errors i have faced are multiple of the same object spawning twice when i would like items to not repeat.
One option is to modify the items array after each call to remove the spawned item, and re-initialize it as full only at the start of each game or when the array is empty.
The problem I'm seeing in looking through the Game Maker Language Documentation is that I cannot find a way to delete an object from an existing array and resize the array.
You're placing choose on both defining the var, and when creating the layer.
Now, I don't know exactly what choose does, but I assume it's choosing randomly a selection from the array.
So Items would only return a single chosen item from the array, maybe it's better to remove the choose function from the Items, and only decide that when creating the object.
So the Items should become an array:
var items = [
obj_homing,
obj_tracking,
obj_bounce,
obj_double_xp,
obj_shotgun,
obj_orbit,
obj_firefaster,
obj_scattershot,
obj_damageboost,
obj_explosive
];
Just save the random instance in a variable, then when you create a random instance, check if equals to the instance that you have created previously, and if it is, call again the function until the previous instance is different from the new generated instance.
If you want to spawn every item only once, how about changing the current spawned object in the array to "noone".
And at every spawn cycle, you would check, if the selected item is noone and if so, select the next item (array[i++]).
Also do not forget to randomize the seed, somewhere in the beginning of your game with randomize().

Blue prism "The collection has no current rows"

In Blue Prism, after traversing the rows of collection using a loop, if any column is referenced to take first value of that column using CollectionName.ColmName, I am getting error saying "The collection has no current rows." although row count of collection is greater than 1.
How can I set the cursor back to the first row or any other way to get first value of a column?
Your misunderstanding lies in the details (emphasis mine):
Collection has no current row
After looping over a collection, you'll notice that the collection in the page will simply show the number of rows currently contained within a collection instead of the usual "Row X of Y". This state indicates that Blue Prism's internal pointer isn't looking at one row in particular.
Once you've reached the end of a collection within a loop, you could use the beginning Loop stage to reset the internal counter to 1
I'm includinig a GIF demonstration below to help illustrate my test case:
You could use “Read Collection Field” from “Utility – Collection Manipulation” VBO. This action allows you to get value from any column & any row from your collection. As an input you need to provide:
Collection
Field Name (Column Name)
Row Index
If you don’t have this VBO you can find it in your Blue Prism installation folder in VBO subfolder.

Foreach inside asp.net mvc5 view

I'm in need of a little help in here . I'm getting results that come from virtual property , but one row displays in multiple rows in view. How to display a record inside a row , and not in multiple records
#foreach (var item in Model.Event.Id)
appears to be your problem. You're looping over the event ID, which since it's a string, will be treated like an array of characters. Therefore it prints one character from the ID on each line, and then, because of the rest of the code, repeats all the other details of that event on each line.
Since you only appear to have one single Event in your Model, it seems that you do not need any kind of loop here at all.
However it's not entirely clear what your intentions are - perhaps you intended to loop over something else in your model which is not shown. If so, please clarify the question and possibly the answer could be expanded.

Realm asObservable() emit only new items

I'm new to RxJava, and trying to use the Realm Observable feature.
When doing this
realm.where(Intake.class)
.findAllSorted("time", Sort.DESCENDING)
.asObservable()
I get the full list of items, but when soemthing changes (ie item added), I get the full list again.
What is the RxJava-way to get only the new items?
Thanks in advance
You are currently observing the query results. Because your query can contain multiple items (findAllSorted()), you're always observing the RealmResults that will emit all sorted items when there's a change (see docs).
You can do something like this:
realm.where(Intake.class)
.findAllSorted("time", Sort.DESCENDING)
.asObservable()
.flatMapIterable(results -> results)
.distinct();
This does 2 more things:
convert your RealmResults to singular Intake instances
only let distinct items pass through (make sure your Intake implements equals() correctly)
This does however impose some extra CPU load, because each time the query passes on a new RealmResult, processing is done to filter out the distinct items.
In the above example, sorting will work on the initial set of emitted Intake objects. However, any subsequent emitted items could be observed out of order because they are new and emitted after the initial results.

Handling SortOrder fields in SQL Server

In a specific table I have a SortOrder integer field that tells my page in which order to display the data. There are sets of data in the this field (based on a CategoryID field), and each set will have its own ordering. Users can add/remove/update records in this table.
My question is what is the best way to manage this SortOrder field? I would like to "reseed" it everytime a record is deleted or updated. Is this something I should be using a trigger for? Or should my code handle it and manage the reseeding?
What I used to do is use only odd numbers in the SortOrder field so upon changing the order, I would add or subtract 3 from the current value of the modified item and then do a reseed (order the items again using odd number indexes). Also I used to reseed after every insert or delete.
All you really have to worry about is swapping any two fields. All new entries go to the end and i'm sure you've got a mechanism by which the user can change the order. The order change, move up or down, really is a swap with a neighboring field. All you really care about is that all the fields are sorted properly. Don't let a mathematical sense of aesthetic drive you into creating something overly complex. (You'll end up with holes in your sequence after deletes are made but that's OK. It's an internal sequence marker used for ORDER BY. the numbers don't need to be made contiguous.)

Resources