Best practice when using multiple items in a section with IGListKit - iglistkit

I'm struggling with how IGListKit handles multiple items in a section. Are those items individually "diffable" for updates, or is it only the object that contains them that gets updated, and subsequently updates the entire section?
I'm trying to display a list of "events". Events are grouped by day. So if there are 7 events that fall over 3 days you might have:
DAY 1
•event 1
•event 2
DAY 2
•event 3
•event 4
•event 5
•event 6
DAY 3
•event 7
What is the proper way to set this up? I could make an "EventsHolder" object that was "IGListDiffable", yes. But I'd rather the "IGListDiffable" portion be each event. So if event 2 changed it doesn't reload all of the first EventHolder.

You should definitely check out IGListBindingSectionController on the master branch of IGListKit, it does exactly what you're describing:
Take a "top level" object and a section controller
Convert that object into an array of diffable view models
Create and configure cells based on those view models
There's a PR with examples here:
https://github.com/Instagram/IGListKit/pull/494

Related

Google Forms validation based on multiple questions

I want to create a form that lets people choose items they will get
Each person should get 10 items, and no more than 4 of each item.
So I create 3 questions with multiple choice answers:
Item A: 0 - 4
Item B: 0 - 4
Item C: 0 - 4
Now upon submission, or better yet before, I want to make sure that the values selected in the 3 questions is added up to exactly 10.
Is there a way to do such thing?

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?

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.

how can i put data in list view month wise in android?

I want to show data in database as month wise. Means the number of activities done by user for particular months display in particular month.
Like,
1 April 2013
List item 1
List item 2
List item 3
2 May 2013
List item 1
List item 2
List item 3
the data are coming in list-view from database. How can i do this, If anyone knows please help me.
You can sort the date first using Comparator and Collections.sort and then populate the listview as per each month. You can also check number of months have data and populate only those listviews. But Best way to solve this problem is by using expandable Listview. Check this link
Expandable Listview
For Sorting by Date
I hope it will atleast give you idea to start work on.

Variable Number of Plots in an MS Access Chart

I have the following problem with MS Access:
Suppose I have a list of companies with monthly performance values. I can view the performance of a single company in a chart by hooking the chart into a query with a Month column and a Performance column.
Now suppose I want to display a chart for N companies. I could theoretically do this if I were to generate a query with a Month column and N Performance columns (one for each company). Is there any way to create a query with a variable column count like this? I have a SQL backend that I can use if necessary, and I'm fine with putting together any VBA code necessary to support it. The only impediment I'm seeing is that I'm stuck using MS Access, which I am not very familiar with.
So here are my main questions:
Is this even possible?
How would I go about tackling this issue? I'm trying to minimize research time, so it would be great if I could just get pointed in the right direction.
Thanks!
With this table:
company pmonth performance
1 1 10
2 1 8
3 1 15
1 2 15
2 2 5
3 2 25
1 3 5
2 3 4
3 3 20
I create this query:
SELECT p.company, p.pmonth, p.performance
FROM MonthlyPerformance AS p;
Then change the query to PivotChart View and drag company field to "Drop Series Fields Here", drag pmonth to "Drop Category Fields Here", and drag performance field to "Drop Data Fields Here".
If you prefer, you can create a form using the same query SQL as its data source, then set the form's Default View to PivotChart, and set up the chart the same way as I did for PivotChart view on the query.
If that's not what you want, give us some more information about the type of chart you want and the context in which you will display it.