IS it ok to have 20 activities in an app? - android-activity

I am trying to make a basic kids app. I have 20 questions to be asked, kid will tap on the right colour and once he does so , next question should appear.
My questions is shall I keep changing layout of the same activity or shall I call 2 and create 20 different actvities for 20 different colour questions. What isthe Best Practice?

one activity is enough . you can just change the texview values of questions and answers and manipulate colors if you want too. as soon as user hits next button check with answer ,add it to score or add just 0 then change values for next question.

you dont need to create new button you do just change the button name or question 1.user open the app 2. there is a start quiz button 3. user press the start quiz button 4. we do four things (A)creating a hash-table of questions giving it 1.2.3...ids, creating hashtable of right answers giving same ids 1.2.3.. then two more tables with fake answers giving same ids (B) when we are done doing this we start with first question. (c) using id 1 from table 1 get the the value and assign it to question or the first button i guess. (d) using id 1 get value from table 2 which our right answers table assign it to one of 3 buttons (e) now get value from 3 and 4 table which is our fake answer table using id 1 n assign to other two buttons.5 now our question 1 is ready and wait for user to click on one of three buttons. 6. lets say user click button 3 . 7 using button id we get button name which the answer user gave us we match it with our table 2 id 1 8. if it matches user giving the right answer we add 1 point to user score and move to next question which will be question number+1 so 2 then will repeat same from step C to E but this time we will use id 2 . so every time user answer we go to next question using +1 with question number until be get at 20. 9. if answer does not match we add nothing to score move to next question. When question number reaches 20 we finish we hide all button and show a textview with user's score

Related

How to show a question in a form based on selected answer for previous dropdown-menu-question (enum list)

So I'm making a form in AppSheet that will be filled out by the user of the app. I have a table with questions for the columns. Question 1 contains an EnumList of answers, so the user can select multiple answers. What I want to do is display question 2 only if any of the answers in question 1 were selected. So if none were, then don't show question 2 so the user will answer question 3 next.
On AppSheet
Go to Data
Open the corresponding table
Go to Columns
Click on the Edit button of the column to be hidden
On the Show field, add formula, i.e. ISNOTBLANK([Fruit]) (in this example Fruit is the column name).
Click Done

What is the easiest way to update value of attribute in Magento 2 on a daily basis?

I have three different delivery dates in my store and I want the user to choose from any of them (effects the price) on the (configurable) product page. I need these three to hold three different values:
4 days from now = "2017-09-04"
7 days from now = "2017-09-07"
10 days from now ="2017-09-10"
The Attribute 146 holds all three and presents the options to the customer in a dropdown menu. When the user makes his choice the product price changes.
My problem is that I dont want to update the values manually every day so I am looking for a way to automatize. First I tried to do it in configurable.phtml and change the value every time the page gets loaded. I am trying to use this line of code to be able to do it but I am having difficulties making it work.
<?php $this->action->updateAttributes([$product->getId()], ['deliverydate' > $newValue], $storeId); ?>
Now I am thinking of maybe I should set up a cron job to do it every night?
What do you think? Any suggestions?

Load only first 10 posts, then load more - parse.com

I'm having a post-feed where I load my posts from a parse database. All posts are saved and loaded from one class.
Now, when the app launches and the user opened the post-feed, I want to load only the first 10 posts (sorted by date).
After that, when I'm at the bottom table cell, I want to load the next 10 posts. Can be done by pressing a "Load More" button or by scrolling at the bottom and it automatically loads more.
I use swift in xCode.
Can anyone help me with that?
PFQuery has a limit property and a skip property.
These are listed in the docs under "Paginating Results".
For the first ten you set skip to 0 and limit to 10.
For the next ten you set skip to 10 and limit to 10.
And so on...
You can read more detail by looking at the documentation for PFQuery.
To add your results to the existing results.
First have an array to store the results.
var results = [MyObject]()
Then when the results come back from parse currently you will be doing something like this...
results = theArrayReturnedFromParse
This will set the array to be only the ten from parse. You need to do this...
results += theArrayReturnedFromParse
This will add the new results to the array and keep the old ones.

Is this an approach to user-item recommendations that could work

I am designing an application that incorporates a recommendation system base on user interactions (collaborative filtering). The user on his homepage is presented a set of 6 items to interact with. There will be between 50 and 300 items. The following actions are possible:
click on an item (strong interest)
refresh an item (some interest)
open a read-more dialog (some interest)
don't do anything an move on (no interest)
This data is collected and stored. The system should recommend items of interest to the user. I'am thinking about turning this data into a rating system.
Option A) if the user clicks on an item, this is translated into a implicit lifetime rating of 5. refreshing an item it a 4 and so on. So my user->item matrix would look like this:
item 1 | item 2 | item 3
john 5 4
jane 4
In this example john has clicked on item 1 and refreshed item 3. The rating can only go up really, i.e. if a user has previously refreshed an item I write a 4 and update only to a 5 if the item is clicked later.
Option B) each time the user does one of the above actions, I'll increment a scalar value for the item, which means it can grow unbounded.
item 1 | item 2 | item 3
john 55 1 30
jane 41 9
Maybe this is a problem, since now the numbers are harder to translate into a rating scale from 1 to 10
Option C) I count every interaction separately
item 1 click | item 1 refresh | item 1 read
john 3 1
jane 1 1
Here the problem is that "reading about" an item is probably only done once.
Independent of whatever option I choose, my idea is to first find similar users using something like cosine similarity or pearson correlation. Then pick the top 10 to 30 users from that list and compile a toplist of their favorite items. From that list, I will then recommend items that the current user has had little interaction with in the past.
Is this something that could work? I am worried that finding similar users will eliminate the chance of finding interesting (new) items for the current user.
What you suggest sounds reasonable. Your concern about not finding new items is a reflection of the collaborative filtering method which is metadata-based. To find new items you would have to undoubtedly do some content analysis which would be a separate stage. For example, if your items are news articles you might try to identify important keywords for each user.

Duplicate ALL Filemaker Portal Rows only if valid

I would like to create a script that copies only valid Portal Rows from a Record.
ie. Sample Request is the main record
Sample colours are the relationship (SampleNumberID)
ie. Colour 1, Colour 2, Colour 3, Colour 4
I can get this for work if it has all 4 rows entered, however if there is ok 2 colour entries It will copy it twice to fill up 4 portals every time.
Any help would be great, Thanks.
Image of Current Script working for 4 colour ways however if only 1 colour is entered it will copy the same colour 4 times.
http://www.coquet.com.au/wp-content/Script.png
Here is how I would do it, I would go to the related records, using the portal row relationship. Go to the first record, loop through them all and duplicate each one and then return to the parent record. So it would look something like this:
Go to Related Record [Show only related records; From table: "Sample Request"]
Go to Record/Request/Page [First]
Loop
Duplicate Record/Request []
Set Field [ByCoulor::StyleNumberID; GetNextSerialValue(Get(FileName); "Sample Request")]
Go to Record/Request/Page [Next; Exit after last]
End Loop
Go to Layout [original layout]
As a side note, it looks like you might to set the field StyleNumberID as an Auto-Enter serial number, so you don't have to manually set it.