the view is not returning after calling synthesizer.SpeakAsync(value)

public async Task<ActionResult> UpdateCounter(Counter counter) {   using (CounterAppForANTHEntities1 entities = new CounterAppForANTHEntities1())   {     Counter updatedCustomer = (from c in entities.Counters                                where == 1                                 select c).FirstOrDefault();     updatedCustomer.Counter_value = updatedCustomer.Counter_value+1;     int res = updatedCustomer.Counter_value;     entities.SaveChanges();     SpeechSynthesizer synthesizer = new SpeechSynthesizer();     string value= "Token Number"+IntToString(res);     synthesizer.SpeakAsync(value);      return View(updatedCustomer);   }    return RedirectToAction("Index"); } 

I want to show the updated view after this speak

Postgres: How can I forse index usage for view with latest rates?

We import currency rates into DB:

CREATE TABLE currency_rate (     id int8 NOT NULL,     date date NOT NULL,     currency varchar(3) NOT NULL,     rate numeric(12,6) NOT NULL,     CONSTRAINT currency_rate_pk PRIMARY KEY (id) );  ALTER TABLE currency_rate add constraint currency_rate_un UNIQUE (currency, date); 

but actually we need only the latest available rate to work with.

It is cumbersome to write CTE with sort and distinct on (currency):

with cr as (   select distinct on (currency) currency, rate from currency_rate   order by currency, date) select   ...,   sum((nd.original_amount - nd.new_amount)*cr.rate) as amount from notification_data nd join cr on cr.currency = nd.currency ... 

Query has following execution plan that is nice:

  CTE cr     ->  Result  (cost=0.28..69.66 rows=13 width=16)           ->  Unique  (cost=0.28..69.66 rows=13 width=16)                 ->  Index Scan using currency_rate_un on currency_rate  (cost=0.28..67.17 rows=995 width=16)   ...               ->  Hash Join  (cost=1029.26..57129.68 rows=18 width=60)                     Hash Cond: ((nd.currency)::text = (cr.currency)::text) 

I created view:

CREATE OR REPLACE VIEW latest_currency_rate AS SELECT   DISTINCT ON (currency) currency, rate, date FROM currency_rate ORDER BY currency, date DESC; 

but DB optimizer doesn’t use index from currency_rate_un:

explain select * from latest_currency_rate;  Unique  (cost=60.83..65.38 rows=12 width=16)   ->  Sort  (cost=60.83..63.10 rows=910 width=16)         Sort Key: currency_rate.currency, DESC         ->  Seq Scan on currency_rate  (cost=0.00..16.10 rows=910 width=16) 

and even for:

explain select * from latest_currency_rate where currency = 'USD';  Unique  (cost=16.87..17.13 rows=12 width=16)   ->  Sort  (cost=16.87..17.13 rows=104 width=16)         Sort Key: DESC         ->  Bitmap Heap Scan on currency_rate  (cost=5.08..13.38 rows=104 width=16)               Recheck Cond: ((currency)::text = 'USD'::text)               ->  Bitmap Index Scan on currency_rate_un  (cost=0.00..5.06 rows=104 width=0)                     Index Cond: ((currency)::text = 'USD'::text) 

Integration of new view to original query gives:

explain select   sum((nd.original_amount - nd.new_amount)*cr.rate) as amount from notification_data nd join latest_currency_rate cr on cr.currency = nd.currency ...  ...  ->  Hash  (cost=73.54..73.54 rows=13 width=12)        ->  Subquery Scan on cr  (cost=68.37..73.54 rows=13 width=12)              ->  Unique  (cost=68.37..73.41 rows=13 width=16)                    ->  Sort  (cost=68.37..70.89 rows=1008 width=16)                          Sort Key: currency_rate.currency, DESC                          ->  Seq Scan on currency_rate  (cost=0.00..18.08 rows=1008 width=16) ... 

Now I am puzzled. Why original CTE query uses Index Scan and view doesn’t use the same index?

Should I rewrite view with some alternative trick (instead of distinct on)?

I am thinking about going with materialized view to avoid sequential scans…

How to be able to still view Encrypted files on Samsung S9/Android, but not outside of it

I had lost a phone once and I was more upset with the idea of the bad guy having access to my Micro SD memory card/personal data than losing the phone itself.

After getting a new phone, Samsung S9 has a Encryption feature for SD cards, but the thing with this is, it won’t allow viewing of files unless it goes through the long process of Decrypting it on the phone.

I want a way to still be able to access encrypted files on the phone itself, but will require a password to decrypt/view outside of the phone (if the memory card was removed and tried being viewed on a computer for example, that this would not be possible).

Any possibilities?

Create a trigger to insert into a view from an existing table

I have a table (Inventory) with below specifications:

Inventory :

([ProductID] [numeric](18, 3) NULL, [RegionID] [numeric](18, 3) NULL, [ShopCode] [int] NULL, [QTY] [float] NULL, [OLAPDate] [varchar](6) NULL, [Price] [float] NULL, [ID] [bigint] IDENTITY(1,1) NOT NULL PRIMARY KEY) 

And I have created a view on it to add a column (HaveQTY) following the below code:

CREATE VIEW V_Inventory_HaveQTY AS SELECT ID, HaveQTY = CASE                     WHEN QTY > 1 THEN 1                     ELSE 0                     END  FROM Inventory 

To finally create the below table:

SELECT I.ProductID, I.RegionID, I.OLAPDate, (100* (1.0*SUM(V.HaveQTY))/(COUNT(V.HaveQTY))) AS NoQTYStores INTO Inventory_NoQTYStores FROM Inventory  I INNER JOIN      V_Inventory_HaveQTY V ON I.ID = V.ID GROUP BY I.ProductID, I.RegionID, I.OLAPDate 

I monthly add new records to Inventory table via bcp utility and want to create a trigger to add these new records to the destination table (Inventory_NoQTYStores) via V_Inventory_HaveQTY view.

I am very new to writing triggers and not sure if I am writing it right. So I get the help from this answer and create the first trigger to insert the new records into V_Inventory_HaveQTY view:

CREATE TRIGGER Update_V_Inventory_HaveQTY ON Inventory AFTER INSERT AS  BEGIN     INSERT INTO V_Inventory_HaveQTY(         ID,         HaveQTY         )     SELECT ID, HaveQTY = CASE                     WHEN QTYMojoodi > 1 THEN 1                     ELSE 0                     END    FROM Inventory END; 

When I add a record manually to the Inventory table to check the trigger, however, I get the below error :

Msg 4406, Level 16, State 1, Procedure Update_V_Inventory_HaveQTY, Line 6 [Batch Start Line 35] Update or insert of view or function ‘V_Inventory_HaveQTY’ failed because it contains a derived or constant field.

Any help would be appreciated.

Table – list view and details view

In our current table displaying all clusters in a model, we have both list view and details view. We also allow the user to click on an arrow on the row when they want to see the full view of that particular cluster. However, this can be confusing when the user is in the details view page because the arrows make the users assume that when they click on another row’s arrow, they would see that rows detail page (we’ve seen this error in usability testing). Below I have displayed where the arrow button is positioned. * and y represent buttons to click list view and details view.

enter image description here enter image description here

Currently, one of our solutions is to remove the button when they are on details view and have a seperate button which says “go to page” on the details section. However, this means we’ll have two different tables when the front end is designing it. Which is extra work for them. Does anyone have any solutions on how else we could approach this? Thank you!

How best to display multiple data points in a single row in a list view?

enter image description here

Hey! I’m designing a list that needs to accommodate multiple data points in a single row under a single category, and I’m wondering if there are any UI patterns that are best suited for this need.

I’ve seen lists that have rows with one long chunk of text (like a paragraph), but it still represents one discrete chunk of data – whereas what I’m designing will represent many separate data points (ex. Protocol 1, Protocol 2, etc.)

The user basically needs to quickly and efficiently identify which Protocols are associated with their corresponding Rules. I’ve thought about an expanding row interaction, as well as a modal, but both seem kinda click-intensive.

Any thoughts? Thanks for taking a look, eager to hear your feedback!

What is the UX definition of a View?

The term “view” is used a lot in UX. In programming it often refers specifically to a user interface element associated with a model (e.g. in MVC or MV* frameworks). But I’ve heard it used in other contexts in UX, e.g. user view vs admin view of a website…where it relates to role rather than a model.

  • Is there a canonical or other well articulated definition for View from a UX perspective.
  • If not, is there any form of consistency around how to use the term as a UX designer?