Update value in same view using CASE expression

I am creating a view where i have daily data of different items and each item has a state. I created a column that shows what the column was yesterday using

LAG(state) OVER(PARTITION BY item_id ORDER BY currentdate) AS yesterday_state 

Now I want to count how long the state has been the same value and im doing so with this:

COUNT (CASE WHEN state = yesterday_state THEN state ELSE NULL END) OVER(PARTITION BY item_id ORDER BY currentdate AS state_age 

This is working properly but I need to find a way to set the value back to 0 when state != yesterday_state

This all is happening inside of SELECT statement as I’m creating a view. How could I go around doing this so that the state_age sets to 0 when state is not the same value as yesterday_state

How to return/export only data showing on screen in custom post type view all screen

If I for example filter my custom post type by date and it only shows 2 records on screen, I only want to export those 2 records, but it is exporting a bunch of records out of my control ie: the wrong records.

How can I modify this to only export what is showing up on screen ie: the 2 records in this case?

add_action( 'init', 'func_export_some_records' ); function func_export_all_posts() {     if(isset($  _GET['export_some_records'])) {         $  arg = array(                 'post_type' => 'shirts',                 'fields' => 'ids'             );           global $  post;         $  arr_post = get_posts($  arg);         if ($  arr_post) {              header("Content-Description: File Transfer");             header("Content-Type: application/csv");             header('Content-Disposition: attachment; filename="wp.csv"');             header('Pragma: no-cache');             header('Expires: 0');              $  file = fopen('php://output', 'w');              fputcsv($  file, array('COLUMN ONE', 'COLUMN TWO'));              foreach ($  arr_post as $  post) {                  $  color = get_post_meta( $  post, 'user-color', true );                 $  size = get_post_meta( $  post, 'user-size', true );                  fputcsv($  file, array($  color, $  size));             }               fclose($  file);          }     } } 

RDS Oracle 11G ORA-01031: insufficient privileges on create materialized view

Here is my situation. Was sent to me a RDS Oracle 11g to manager. This resource was create through a terraform script and the “sysadmin” credentials delivered to me

To me everything is fine to work with but he’s a strange scenario

I had permission to recreate views and drop a materialized view but when I tried to recreate the materialized view I got this error

ORA-01031: insufficient privileges on create materialized view 

Googling about I swa that I had to have create table permission

but no


I tried to grant myself (like postgres) and command runs fine but with no effects

grant create table to ADMIN; 

By the way I’m a noob in Oracle world I have experience with sql server and postgres. I Belive this a silly question but no to me, I appreciate any help

Finding if the x and y coordinate is within a view is enclosed by two intersecting rectangles, in java [closed]

Say I have this view with two subviews A and B, A and B has a color property mColor,

enter image description here

I want a function in the parent view that has this signature: int getColor(int x, int y), which for any given x and y coordinate, return the color at that position, if the x and y coordinates land and the two shapes are overlapped, return the average color of A and B

The problem I am running into is i see myself doing a lot of conditional checks, checking if A is left of B or if A is right of B etc. I feel like I am missing some key intuition

I have a Point class that handles the coordinates”

public class Point {     private final int mX;     private final int mY;      public Point(int mX, int mY) {         this.mX = mX;         this.mY = mY;     }      public int getX() {         return mX;     }      public int getY() {         return mY;     } } 

Here is my subview class:

public class Chart  {      private int mColor;     private Point mTopLeft;     private Point mBottomRight;      public Point getTopLeft() {         return mTopLeft;     }      public Point getBottomRight() {         return mBottomRight;     }      public Chart(int mColor, Point topLeft, Point bottomRight) {         this.mColor = mColor;         this.mTopLeft = topLeft;         this.mBottomRight = bottomRight;     }      public int getColor() {         return mColor;     }      public Point getTopRightCorner() {         return new Point(getBottomRight().getX(), getTopLeft().getY());     }      public Point getBottomLeftCorner() {         return new Point(getTopLeft().getX(), getBottomRight().getY());     } } 

My parent view class:

public class View {      private Chart mChartA;     private Chart mChartB;      public View(Chart chartA,                 Chart chartB) {         mChartA = chartA;         mChartB = chartB;     }      public boolean doChartsOverlap() {         boolean isOverlapped = true;          if(isChartALeftOfChartBInX() || isChartARightOfChartBInX()) {             isOverlapped = false;         }          if(isChartABottomOfChartBInY() || isChartATopOfChartBInY()) {             isOverlapped = false;         }         return isOverlapped;     }      public final boolean isChartALeftOfChartBInX() {         return mChartA.getBottomRight().getX() <= mChartB.getTopLeft().getX();     }      public final boolean isChartARightOfChartBInX() {         return mChartA.getTopLeft().getX() >= mChartB.getBottomRight().getX();     }      public final boolean isChartATopOfChartBInY() {         return mChartA.getBottomRight().getY() <= mChartB.getTopLeft().getY();     }      public final boolean isChartABottomOfChartBInY() {         return mChartA.getTopLeft().getY() >= mChartB.getBottomRight().getY();     }      public void setChartA(Chart mChartA) {         this.mChartA = mChartA;     }      public void setChartB(Chart mChartB) {         this.mChartB = mChartB;     } } 

Is Kenabres an extreme example for the view on Tieflings and demons at the worldwound?

In an answer to my question: Status of Tieflings with the worldwound defenders? Kenabres was used as an example for how tieflings were viewed.

While creating chars for a worldwound campaign one of my players and I came into a discussion about this. With how much Kenabres itself was mentioned there he thinks that Kenabres is absolutely extreme there while I’m thinking that it is more a typical city there with its views about anything Tiefling and Demonic.

Now my question is: Is Kenabres an extreme example for the view on Tieflings and demons at the worldwound?

PDF Documents – Browser View 2020

I posted a question yesterday about PDF files in a browser that can be found here. There you can find more information about dealing with PDF documents in browser.

My question here is how each browser handles PDF files by default.

PDF files can cause security concerns because the have the capability to contain executable code.

What I have found is that some browsers today have their own PDF viewers. Some of those viewers open in a sandbox environment which at least seems to protect the end user. I have confirmed that both Chrome and Firefox open PDFs in a sandbox environment.

Question 1:

Do the following browsers also open PDFs in a sandbox (2020)?

  • Edge?
  • IE?
  • Safari?

Now these sandboxes sound pretty great if they can mitigate any security concerns with PDF files. My next series of questions regard the sandbox environments.

Question 2:

Is there any way a user might disable the protections a sandbox provides?

Question 3:

Are there still concerns when opening a PDF in a sandbox?

Question 4:

Are there easy ways to verify a user is opening a PDF in the correct browser or with the correct settings before opening?

Change Template view of proucts on click button with javascript woocommerce

I use woocommmerce and i have two template view for products (content-product.php) and (contentcarousel-product.php) . in (archive-product.php) per defaut display first template like this

<?php wc_get_template_part( 'content', 'product' ); ?> 

I created two button like this with onclick event with javascript

<button onclick="Viewone()"> view 1</button> <button onclick="Viewtwo()"> view 2</button> 

I want when click button 1 display first template per defaut and when click button 2 display second template.

How i can do this with javascript and php

OpenGL Two-point perspective view

What am I trying to achieve: A two (vanishing) point perspective like this one http://insidetheoutline.com/wp-content/uploads/2019/07/2_Point_Perspective_Cityscape.jpg

Why am I at it: I’m really bad at 3D (obviously) therefore I’m trying to replace character models with 2D sprites like in Populous 3, or “The Game” quest in Fable 3. I also want to have a top-downish view like in isometric games. Alas, perspective distortion totally kills the effect, making sprites look skewed whenever they are off-center.

What am I doing right now:

  glMatrixMode(GL_PROJECTION);   glLoadIdentity;   gluPerspective(FOV, wndWidth / wndHeight, zNear, zFar);   // Googling lead me to this MV matrix, alas it's not working for me   // {   //  1, 0, 0, 0,    //  0, 1, 0, 0,    //  0, -camY/camZ, -camZ, 0,    //  0, 0, 0, 1   // }   glMatrixMode(GL_MODELVIEW);   glLoadMatrixf(@cam);   // camX = camY = camZ = 50   gluLookAt(     camX, camY, camZ,     0, 0, 0,     0, 0, 1   );   // then I draw a uniform grid -5..5 by -5..5   // and slightly off-center wireframe box to test if they are drawn correctly 

Does it work? No, it doesn’t.

What else I managed to google: Not much, really. I found an example that kinda looks like something I want to achieve, but they place the camera at ground level with zero Z delta, effectively eliminating the third vanishing point. In some other example, they just narrowed FOV to some absurdly low value, making it look like a two-point perspective to some extent.

I’m afraid I’m missing or misunderstanding something. I also not sure if the desired output will, in fact, look like I want, and I won’t discard it if it’s not.