mobile application – Best practice for multiple select categories

Anything that is deeply nested or complex is always a challenge to display on mobile, so there is usually going to be a trade-off between what you can fit in the screen and what is easy to view at any given time.

If it is purely for the purpose of filtering, one strategy is to divide the single tree structure into separate filters, one of each category (assuming you won’t be adding to the top level categories) and then you’ll have a easier way to organise the items below and display their status (using counter to show how many selected in each category).

It is now standard or common practice to use tags that can be cleared or deleted when there is a complex selection process involved, so even though it looks crowded on the screen the fact is that it can be more practical when it comes to being able to easily see at-a-glance what all the filtering options are and removing them (but not to add).

gui design – Visual hierarchy of typography in UI in practice

There are so many resources about this in theory, but I can’t find any detailed guides or resources on how to apply the principles in an existing complex UI. The most obvious ones would be differentiation by copy size, in many UIs like in facebook and youtube that manage to pull off a good hierarchy at the micro level as well as the macro level.

What would be a good guide or process to follow?

Best practice for vertical tab navigation

I have a case where we need to have 3 or 4 levels of tab navigation (drill down) like the following:

What is the best way/practice for this case?

gui design – Is having multiple links to the same destination from a single GUI a good practice?

gui design – Is having multiple links to the same destination from a single GUI a good practice? – User Experience Stack Exchange

usability – Is it good practice to place tabs at the same level when search is the main feature? How to deal with spacing?

There are two potential approaches, but you have to have a consistent design approach/philosophy if you want to achieve the best user experience.

The search feature, if applied globally to the application, should sit at a level above the tabs so that the user isn’t confused about whether the search results relate to the contents in the tabs or not.

However, if the search feature only retrieves results relating to what is in the tabs, then it can also make sense for it to sit in the same level, provided that you can manage the spacing. This can be done by common strategies used in browsers to manage tabs (when you have too many to fit on the screen, especially in devices with narrow widths) or create a more compact search call-to-action (e.g. icon that expands when clicked and collapses when not in use).

Is it good practice for a ‘grandchild’ post to adopt taxonomy terms from its parent and grandparent posts?

In order to maximize search performance, I need to know if I should have a grandchild post adopt some taxonomy terms from its parent and grandparent posts.
I used the PODS plugin to create three Custom Post Types in a grandparent-parent-grandchild hierarchy. The grandparent CPT uses Taxonomy A and Taxonomy B. The parent CPT uses Taxonomy C and Taxonomy D. The grandchild CPT uses all four taxonomies. When a grandchild post is created I will retrieve the respective taxonomy terms from the grandparent and parent posts and then assign those terms to the grandchild post.
Just to clarify, I can figure out how do perform the retrieval and assignment of the taxonomy terms.

Is this approach my only option? Or, is there another method (either in core WordPress, or other) which supports searching ‘grandchild’ posts based on taxonomies assigned to their parent and grandparent posts?

Also just to clarify, I will be using the FacetWP plugin to perform the searches on the front-end.

Any feedback would be appreciated.

clojure – Hackerrank – Practice > Interview Preparation Kit > Warm-up Challenges > Sales by Match/Counting Valleys

https://www.hackerrank.com/challenges/sock-merchant/problem?h_l=interview&playlist_slugs%5B%5D=interview-preparation-kit&playlist_slugs%5B%5D=warmup

``````(defn sockMerchant (n ar)
"Complexity: O(n), (= (count ar) n)
TOC: ~14 min"
(reduce + (map (fn ((_ v)) (if (>= v 2) (quot v 2) 0))
(frequencies ar)))
#_(->> (map (fn ((k v)) (if (>= v 2) (k (rem v 2)) nil))
(frequencies ar)) ;; looked up online
(remove nil?)) ;; looked up online
)
``````

https://www.hackerrank.com/challenges/counting-valleys/problem?h_l=interview&playlist_slugs%5B%5D=interview-preparation-kit&playlist_slugs%5B%5D=warmup

``````(defn countingValleys (steps path)
"Complexity: O(n), (= steps n)
TOC: ~ 28 min"
(loop (path- (split path #"") dist-from-sea 0 valleys 0) ;; looked up online
(if (seq path-) ;; looked up online
(if (= (first path-) "U")
(recur (rest path-) (inc dist-from-sea)
(if (= (inc dist-from-sea) 0) (inc valleys) valleys))
(recur (rest path-) (dec dist-from-sea) valleys))
valleys)))

(countingValleys 8 "UDDDUDUU")
$$```$$
``````

ios – Swift • Best Practice for passing an ObservableObject down the View Hierarchy in SwiftUI?

I am looking for the Best Practice when it comes to passing an `ObservableObject` down the View Hierarchy in `SwiftUI`.

Concept of App Design

``````struct RootView: View {
@FetchRequest(sortDescriptors: (NSSortDescriptor(keyPath: Profile.firstName, ascending: true)), animation: .default) private var profiles: FetchedResults<Profile>

var body: some View {
TabBar(profile: activeProfile)
}

private var activeProfile: Profile { /* return the active Profile out of all Profiles while using the profiles FetchRequest Property */ }
}

struct TabBar: View {
@ObservedObject var profile: Profile

var body: some View {
TabView {
OverviewView(profile: profile)
}
.tabItem { Text("Overview") }

// More Tabs ...
}
}
}

struct OverviewView: View {
@ObservedObject var profile: Profile

var body: some View {
Text("Overview")

Text("Detail View")
}
}
}
``````

I think you get the Point, how I pass the Profile Object down the entire View Hierarchy. When the User is activating another Profile, the `FetchRequest Property` will recognize it and all Views need to update with the Data of the new Profile. This is working most of the time, however, sometimes problems like not updating Views occur.

Question: Is there a better Solution (Best Practice) for passing an `ObservableObject` down the View Hierarchy in SwiftIU?

Context

The App does support `multiple Profiles`, while only one is active at any given moment. Most Views are depending on the `active Profile` since they are showing data linked to that profile. Therefore, when changing the profile, all Views have to change accordingly.
In `SwiftUI`, the `MVVM Design Pattern` is the way to go. However, since all `CoreData Objects` already are `Observable Objects`, I have difficulty implementing a `custom View Model` (like `ProfileStore`), which publishes the active profile as a `Published Property` whenever something changes since this would mean to declare an `Observable Object` as an Observable Object again.

My Idea was to have a `Fetch Request` inside my `Root View`, which will automatically update the `Root View` when another profile gets activated. Since I am passing the profile down to all `Child Views`, these should update, too.
However, I am experiencing problems using this technique. Sometimes, when changing the active profile, some Views does not update accordingly.
Therefore, I would like to ask, whether the used technique is a good practice in `SwiftUI` or should’t be used? Is there a better way of achieving the goal, that every view has access to the currently active profile without having to create a `Fetch Request` in every View?

ios – Swift • Best Practice for passing an ObservableObject down the View Hierarchy in SwiftUI?

I am looking for the Best Practice when it comes to passing an `ObservableObject` down the View Hierarchy in `SwiftUI`.

Concept of App Design

``````struct RootView: View {
@FetchRequest(sortDescriptors: (NSSortDescriptor(keyPath: Profile.firstName, ascending: true)), animation: .default) private var profiles: FetchedResults<Profile>

var body: some View {
TabBar(profile: activeProfile)
}

private var activeProfile: Profile { /* return the active Profile out of all Profiles while using the profiles FetchRequest Property */ }
}

struct TabBar: View {
@ObservedObject var profile: Profile

var body: some View {
TabView {
OverviewView(profile: profile)
}
.tabItem { Text("Overview") }

// More Tabs ...
}
}
}

struct OverviewView: View {
@ObservedObject var profile: Profile

var body: some View {
Text("Overview")

Text("Detail View")
}
}
}
``````

I think you get the Point, how I pass the Profile Object down the entire View Hierarchy. When the User is activating another Profile, the `FetchRequest Property` will recognize it and all Views need to update with the Data of the new Profile. This is working most of the time, however, sometimes problems like not updating Views occur.

Question: Is there a better Solution (Best Practice) for passing an `ObservableObject` down the View Hierarchy in SwiftIU?

conformal field theory – Computing theta functions of lattices in practice

I am motivated by a problem in 2d CFT to compute “generalized theta functions,” expressions of the form
$$begin{equation} vartheta_{L,u}(tau) := sum_{alpha in L} u(alpha) q^{{langlealpha,alpharangle}/2},, end{equation}$$
where $$u:Lto {pm 1}$$ is some function I’ll know explicitly. If it matters, $$L$$ will always be a sublattice of the $$E_8$$ lattice.

By “compute,” I really mean present the RHS in terms of “nice” functions like $$theta_{1,2,3,4}$$, but I’m open to alternatives (say Eisenstein series). One thing of moderate importance is the ability to look at q-expansions in, say, Mathematica. My hope is that lattice pros already have techniques to evaluate these sums and I am not re-inventing various wheels below.

I’m caustiously optimistic that if I can do this for regular theta functions (i.e. with $$u(alpha) = 1$$), that I can do it with minus signs, as it will just flip some $$theta_{2,3}$$s to $$theta_{1,4}$$s.

My trick thus far is to turn the calculation into sums over integers, then abuse integer shift-symmetry and re-write sums to remove “cross-terms.” For example, for the $$A_2$$ lattice
begin{align} sum_{alphain A_2} q^{langlealpha,alpharangle/2} &= sum_{n_1,n_2inmathbb{Z}} q^{n_1^2-n_1n_2+n_2^2}\ &=(sum_{n_2 textrm{ odd}}+sum_{n_2 textrm{ even}})sum_{n_1}q^{n_1^2-n_1n_2+n_2^2}\ &=sum_{k}sum_{n_1}q^{1 + 4 k + 4 k^2 – 2 k n_1 – n_1 + n_1^2}+sum_{k}sum_{n_1}q^{4 k^2 – 2 k n_1 + n_1^2}\ &=sum_{k}sum_{n_1}q^{1 + 3 k + 3 k^2 + n_1 + n_1^2}+sum_{k}sum_{n_1}q^{3 k^2 + n_1^2}\ &=theta_2(6tau)theta_2(2tau)+theta_3(6tau)theta_3(2tau),. end{align}
In going from the second to third line I’ve just written $$n_2=2k+1$$ and $$n_2=2k$$, and for third to fourth I’ve shifted $$n_1 mapsto n_1 + k + 1$$ and $$n_1 mapsto n_1 + k$$ for the respective sums.

Problem 1: $$vartheta_{E_6}$$ is a lot!

This approach gets involved very quickly. For a rank $$N$$ lattice, I have at least $$N$$ sums, and I don’t always get to break each sum into 2. e.g. maybe I need to replace $$n_i$$ with $$n_i = 3k, 3k+1, 3k+2$$.

On page 127 of Conway & Sloane’s book, they give $$theta_{E_6}$$ in terms of $$theta_{2,3}$$ as
$$begin{equation} theta_{E_6}(tau) = frac{1}{4}f(tau)^3+theta_{A_2}(tau)^3 end{equation}$$
where
$$begin{equation} f(tau) = theta_{A_2}left(frac{tau}{3}right)+theta_{A_2}(tau) end{equation}$$

Question 1.A): Can I obtain this answer without using that $$A_2 times E_6$$ is a $$mathbb{Z}_3$$ fixed sublattice of $$E_8$$?

I imagine a technique where I present the inner product $$langle alpha,alpharangle/2$$ as coming from an upper triangular matrix. i.e. write $$alpha$$ as an integer sum over simple roots $$alpha = sum_{i} n_i alpha_i$$ then
$$begin{equation} langle alpha,alpharangle/2 = begin{pmatrix}n_1\ n_2\ vdots \ n_N end{pmatrix} begin{pmatrix} 1 & c_{12} & dots & c_{1N} \ & 1 & dots & c_{2N} \ & & ddots & vdots \ & & & 1 end{pmatrix} begin{pmatrix}n_1\ n_2\ vdots \ n_N end{pmatrix},. end{equation}$$
My hope is that shift-symmetry and breaking up sums have natural actions on such upper-triangular matrices. The shift would be an operation on one matrix, and “breaking up” would replace one matrix with a collection of others.

Question 1.B): Does such a technique exist already, or is there a quicker way to do these computations?

Problem 2: Recognizing Theta-Functions

When I extend this procedure and try it on the next-simplest lattice, $$A_3$$, I don’t obtain an answer which is obviously products of theta functions like I did for $$A_2$$. In particular, I can make my sums decouple, but I get arbitrary “blocks” of the form
begin{align} mathbb{B}_{A,B,C} &:=sum_{k} q^{frac{1}{2}(A k^2 + B k + C)}\ &= q^{frac{C}{2}}varthetaleft(frac{Btau}{2},Atauright)\ &= q^{frac{C}{2}}(q^A;q^A)_inftythetaleft(-q^{(A+B)/2},q^Aright) end{align}
where $$vartheta(z,tau)$$ is the regular Jacobi-theta function $$theta(w,q)$$ is the q-theta function with $$w=e^{ipi z}$$. For special $${A,B,C}$$ the relationships to $$theta_{1,2,3,4}$$ are clear. And maybe that’s the best I can do unless I can find some identities relating an arbitrary $$mathbb{B}_{A,B,C}$$ to $$theta_{1,2,3,4}$$, or other similarly “nice” functions.

Question 2: Are there better expressions for my “blocks”?