Improving UX for multi-selectable cards

I’m designing a screen where the user should be able to:
1. Select b/w multiple options (displayed in cards)
2. Search for other cards and be able to select those as well.
Here’s a picture for better explanation:

Option to search or select the various options Option to search or select the various options

User selects option 2 from recent options User selects option 2 from recent options

User now searches for another option User now searches for another option and selects it.

His selections are only displayed when he clears his search His selections are only displayed when he clears his search

I am confused about the user experience part of such an interface.
1. Is this an intuitive UI?
2. There isn’t much real estate for me to play with and displaying the same cards in both the search results and separately as a selected option does not seem possible. Are there examples of other sites which do this?
3. What should the ideal multi card search be like

Shape X2 Keto another very important recommendation, focus on improving your nutrition gradually

Shape X2 Keto nutrition and weight management strategies are combined with a sound exercise program. As a quick recommendation which I sincerely hope you follow, steer very clear of the quick weight loss diets. They are a recipe for disaster. As a way to do this, it’s important that you think of your weight loss as a process that will continue for as long as you are alive. Too many people want quick results, but fail to consider the long-term. That will surely lead to frustration, discouragement, and eventually, failure. As

PHP Laravel – Improving and refactoring code to Reduce Queries

Improve Request to Reduce Queries

I have a web application, where users can upload Documents or Emails, to what I call a Strema. The users can then define document fields email fields to the stream, that each document/email will inherit. The users can then furthermore apply parsing rules to these fields, that each document/email will be parsed after.

Now let’s take the example, that an user uploads a new document. (I have hardcoded the ID’s for simplicty).

$  stream = Stream::find(1); $  document = Document::find(2);  $  parsing = new ApplyParsingRules; $  document->storeContent($  parsing->parse($  stream, $  document)); 

Below is the function that parses the document according to the parsing rules:

    public function parse(Stream $  stream, DataTypeInterface $  data) : array     {         //Get the rules.         $  rules = $  data->rules();          $  result = [];         foreach ($  rules as $  rule) {              $  result[] = [                 'field_rule_id' => $  rule->id,                 'content' => 'something something',                 'typeable_id' => $  data->id,             ];         }          return $  result;     } 

So above basically just returns an array of the parsed text.

Now as you probably can see, I use an interface $ DataTypeInterface. This is because the parse function can accept both Documents and Emails.

To get the rules, I use this code:

//Get the rules. $  rules = $  data->rules(); 

The method looks like this:

class Document extends Model implements DataTypeInterface {     public function stream()     {         return $  this->belongsTo(Stream::class);     }     public function rules() : object     {         return FieldRule::where([             ['stream_id', '=', $  this->stream->id],             ['fieldable_type', '=', 'App\DocumentField'],         ])->get();     } } 

This will query the database, for all the rules that is associated with Document Fields and the fields, that is associated with the specific Stream.

Last, in my first request, I had this:

$  document->storeContent($  parsing->parse($  stream, $  document)); 

The storeContent method looks like this:

class Document extends Model implements DataTypeInterface {     // A document will have many field rule results.     public function results()     {         return $  this->morphMany(FieldRuleResult::class, 'typeable');     }     // Persist the parsed content to the database.     public function storeContent(array $  parsed) : object     {         foreach ($  parsed as $  parse) {             $  this->results()->updateOrCreate(                 [                     'field_rule_id' => $  parse['field_rule_id'],                     'typeable_id' => $  parse['typeable_id'],                 ],                 $  parse             );         }         return $  this;     } } 

As you can probably imagine, everytime a document gets parsed, it will create be parsed by some specific rules. These rules will all generate a result, thus I am saving each result in the database, using the storeContent method.

However, this will also generate a query for each result.

One thing to note: I am using the updateOrCreate method to store the field results, because I only want to persist new results to the database. All results where the content was just updated, I want to update the existing row in the database.

For reference, above request generates below 8 queries:

select * from `streams` where `streams`.`id` = ? limit 1 select * from `documents` where `documents`.`id` = ? limit 1 select * from `streams` where `streams`.`id` = ? limit 1     select * from `field_rules` where (`stream_id` = ? and `fieldable_type` = ?) select * from `field_rule_results` where `field_rule_results`.`typeable_id` = ? and... select * from `field_rule_results` where `field_rule_results`.`typeable_id` = ? and...   insert into `field_rule_results` (`field_rule_id`, `typeable_id`, `typeable_type`, `content`, `updated_at`, `created_at`) values (..) insert into `field_rule_results` (`field_rule_id`, `typeable_id`, `typeable_type`, `content`, `updated_at`, `created_at`) values (..) 

Above works fine – but seems a bit heavy, and I can imagine once my users starts to generate a lot of rules/results, this will be a problem.

Is there any way that I can optimize/refactor above setup?

Improving the speed of creation for three Perlin Noise Maps in Python?

I am interested in learning how I can improve the speed of the code in this pygame file. I iterate over 6400 * 1800 * 3 elements of various numpy arrays here to apply noise values to them. The noise library I’m using can be found on GitHub here. All others are self-explanatory noise-maps.

I am calling static variables from a class called ST here. ST.MAP_WIDTH = 6400 and ST.MAP_HEIGHT = 1800.

from __future__ import division from singleton import ST import numpy as np import noise import timeit import random import math   def __noise(noise_x, noise_y, octaves=1, persistence=0.5, lacunarity=2.0):     """     Generates and returns a noise value.      :param noise_x: The noise value of x     :param noise_y: The noise value of y     :return: numpy.float32     """      value = noise.pnoise2(noise_x, noise_y,                           octaves, persistence, lacunarity,                           random.randint(1, 9999))      return np.float32(value)   def __elevation_mapper(noise_x, noise_y):     """     Finds and returns the elevation noise for the given noise_x and     noise_y parameters.      :param noise_x: noise_x = x / ST.MAP_WIDTH - randomizer     :param noise_y: noise_y = y / ST.MAP_HEIGHT - randomizer     :return: float     """     return __noise(noise_x, noise_y,  8, 0.9)   def __climate_mapper(y, noise_x, noise_y):     """     Finds and returns the climate noise for the given noise_x and     noise_y parameters.      :param noise_x: noise_x = x / ST.MAP_WIDTH - randomizer     :param noise_y: noise_y = y / ST.MAP_HEIGHT - randomizer     :return: float     """     # find distance from bottom of map and normalize to range [0, 1]     distance = math.sqrt((y - (ST.MAP_HEIGHT >> 1))**2) / ST.MAP_HEIGHT      value = __noise(noise_x, noise_y,  8, 0.7)      return (1 + value - distance) / 2   def __rainfall_mapper(noise_x, noise_y):     """     Finds and returns the rainfall noise for the given noise_x and     noise_y parameters.      :param noise_x: noise_x = x / ST.MAP_WIDTH - randomizer     :param noise_y: noise_y = y / ST.MAP_HEIGHT - randomizer     :return: float     """     return __noise(noise_x, noise_y,  4, 0.65, 2.5)   def create_map_arr():     """     This function creates the elevation, climate, and rainfall noise maps,     normalizes them to the range [0, 1], and then assigns them to their     appropriate attributes in the singleton ST.     """      start = timeit.default_timer()      elevation_arr = np.zeros([ST.MAP_HEIGHT, ST.MAP_WIDTH], np.float32)     climate_arr = np.zeros([ST.MAP_HEIGHT, ST.MAP_WIDTH], np.float32)     rainfall_arr = np.zeros([ST.MAP_HEIGHT, ST.MAP_WIDTH], np.float32)      randomizer = random.uniform(0.0001, 0.9999)      # assign noise map values     for y in range(ST.MAP_HEIGHT):         for x in range(ST.MAP_WIDTH):             noise_x = x / ST.MAP_WIDTH - randomizer             noise_y = y / ST.MAP_HEIGHT - randomizer              elevation_arr[y][x] = __elevation_mapper(noise_x, noise_y)             climate_arr[y][x] = __climate_mapper(y, noise_x, noise_y)             rainfall_arr[y][x] = __rainfall_mapper(noise_x, noise_y)      # normalize to range [0, 1] and assign to relevant ST attributes     ST.ELEVATIONS = (elevation_arr - elevation_arr.min()) / \                     (elevation_arr.max() - elevation_arr.min())      ST.CLIMATES = (climate_arr - climate_arr.min()) / \                   (climate_arr.max() - climate_arr.min())      ST.RAINFALLS = (rainfall_arr - rainfall_arr.min()) / \                    (rainfall_arr.max() - rainfall_arr.min())      stop = timeit.default_timer()     print("GENERATION TIME: " + str(stop - start)) 

Improving CRUD operations on list UI

Thus far, our pages for operations to be done on a collection of things (tasks, pricing groups, permission groups, …) have this general structure:

enter image description here

If the things getting modified in bulk have “only one thing” about them, we have no tabbed pane, like this:

enter image description here


I have been tasked by someone who says that, if he were a user of this app, this design would not be good. However, when I asked him what he would prefer instead, he had no concrete suggestions. I generally agree that this can be revamped, but don’t have any hard user-friendly suggestions in mind either.

What say you?

Advice for improving internal dashboard

I work for a book manufacturer, a component from our internal dashboard looks like this. I’m not a designer by trade and as it’s come to refactoring the project, I figured now would be a good time to clean up the ux a bit.

The purpose of the component is to show the planned vs actual (jobs scheduled vs what we actually did) as simply as possible.

Should also specify that the buckets are a management request so they can’t change but everything else is up in the air.

(The export expands into an export via email or straight csv)

Any advice would be great! Sorry if the question is inappropriate.

Improving the efficiency of c++ code calling Eigen to do the linear operation of the matrix

I am a rookie of coding and I have written a c++ procedure which calls the Eigen library to do the linear operation of the matrix. Please help me to improve the efficiency of the loop.

#include <iostream> #include <fstream> #include <Eigen/Dense> #include <time.h> using namespace std;  int main() {     // Weight coefficient matrix     Eigen::MatrixXd wi_1,wi_2,wi_3,wi_4;     wi_1.resize(100,2);     wi_2.resize(100,100);     wi_3.resize(100,100);     wi_4.resize(5,100);     wi_1.setOnes();     wi_2.setOnes();     wi_3.setOnes();     wi_4.setOnes();      // Bias vector     Eigen::VectorXd bias_1,bias_2,bias_3,bias_4,Y;     bias_1.resize(100);     bias_2.resize(100);     bias_3.resize(100);     bias_4.resize(5);     bias_1.setOnes();     bias_2.setOnes();     bias_3.setOnes();     bias_4.setOnes();     Eigen::Matrix<double,5,1> y_mean;     Eigen::Matrix<double,5,1> y_scale;     Eigen::Matrix<double,2,1> x_mean;     Eigen::Matrix<double,2,1> x_scale;      y_mean.setOnes();     y_scale.setOnes();     y_mean.setOnes();     x_scale.setOnes();      int n = 0;     int layer;     clock_t start,finish;     double totaltime;     start=clock();     while (n<10000)     {         Y.resize(2);         layer = 0;         Y << 0.185, 0.285;//inputx[1], x[0];         Y = (Y.array() - x_mean.array()) / x_scale.array();          //ANN forward         while (layer < 4)         {             layer++;             switch (layer) {             case 1:{                 Y = wi_1 * Y + bias_1;                 //                                        Info << "ANN forward layer1" << endl;                 break;             }             case 2:{                 Y = wi_2 * Y + bias_2;                 //                                        Info << "ANN forward layer2" << endl;                 break;             }             case 3:{                 Y = wi_3 * Y + bias_3;                 //                                        Info << "ANN forward layer3" << endl;                 break;             }             case 4:{                 Y = wi_4 * Y + bias_4;                 //                                        Info << "ANN forward layer4" << endl;                 break;             }             default:{                 cout<<"error"<<endl;                 break;             }             }              //Relu activation function             if (layer < 4)             {                 for (int i = 0; i < Y.size(); i++)                 {                     Y(i) = ((Y(i) > 0) ? Y(i) : 0);                 }             }         }         //inverse standardization         Y = Y.array() * y_scale.array() + y_mean.array();         n++;     }     finish=clock();     totaltime=(double)(finish-start)/CLOCKS_PER_SEC*1000;     cout<<"\n Running time is "<<totaltime<<"ms!"<<endl; } 

Improving Performance consuming RestApi

i was wondering if there is anyway for me to enhance the performance of my code. i want to be able to identify where my code is at its weakest and what can be done to over come this.. thank you.

using loops doesn’t sit right with me when dealing with nested arrays and i was thinking about how i can eliminate going through each object and array in the Jason string. can this be done or do i just have to accept this is the only way?

namespace ConsoleApp {     class Program {      private static string jsonUrl { get; set; } = "";     private static string teamKey { get; set; } = "swansea";     static void Main()     {        var goal = Run(teamKey.ToLower());        Console.WriteLine(goal);        Console.ReadKey();     }      public static int Run(string team)     {          using (var webclient = new WebClient())         {              var rawJson = webclient.DownloadString(jsonUrl);              var jsonModel = JsonConvert.DeserializeObject<RootObject>(rawJson);               foreach (var rounds in jsonModel.rounds)             {                 foreach (var match in rounds.matches)                 {                     var goal = match.team1.key.Equals(teamKey) ? match.score1 : 0;                      if (goal == 0)                     {                         goal = match.team2.key.Equals(teamKey) ? match.score2 : 0;                     }                     return goal;                 }             }               return 0;         }      } }  public class Team1 {     public string key { get; set; }     public string name { get; set; }     public string code { get; set; } }  public class Team2 {     public string key { get; set; }     public string name { get; set; }     public string code { get; set; } }  public class Match {     public string date { get; set; }     public Team1 team1 { get; set; }     public Team2 team2 { get; set; }     public int score1 { get; set; }     public int score2 { get; set; } }  public class Round {     public string name { get; set; }     public List<Match> matches { get; set; } }  public class RootObject {     public string name { get; set; }     public List<Round> rounds { get; set; } } } 

The scope of the program is to return the correct number on goals scored based on the team that is selected. (

Input: swansea expected result: 2 Actual result: 2

Improving code for having multiple lines of ng-if directives

I am new to angularjs and wondering if this code could be improved:

<div>     <a ng-if="brand == 'google'" href="/"><img class="logo" ng-src="{company_logo}}" alt=" Logo"></a>     <img  ng-if="brand != 'google'" class="logo" ng-src="{{company_logo}}" alt=" Logo"> </div> 

Have many brands so if the brand is google then I have to link to home page when clicked on image else not. How can this be written better.

Thanks 🙂