list – SharePoint Online Show/Hide multiple fields based on choice

I have a form similar to the one below, I am using script editor in web parts on SharePoint Online. If I select ‘YES’ it will reveal a second drop down list hiding ‘Item 1’.

If I select ‘NO’, it will reveal the same list but hiding ‘Item 2’ and ‘Item 3’. It works properly the first time, but if I go back and forth between ‘YES’ and ‘NO’ then the second drop down list will hide Item 1,2, and 3.

Is there a way to fix it from filtering multiple times?

<script src="https://code.jquery.com/jquery-1.7.2.min.js" type="text/javascript"> </script> 
<script type="text/javascript">
$(document).ready(function(){
   $('nobr:contains("List 2")').closest('tr').hide();  
    //Show/hide columns based on Drop Down Selection 
   $("select(title='List 1')").change(function() {
 
 if ($("select(title='List 1')").val() == "YES") 
   {
     $('nobr:contains("List 2")').closest('tr').show();
     $(":input(title='List 2')").children("option(value='ITEM 1')").hide();
     
   } 
 else if($("select(title='List 1')").val() == "NO") 
   {
     $('nobr:contains("List 2")').closest('tr').show();
     $(":input(title='List 2')").children("option(value='ITEM 2')").hide();
     $(":input(title='List 2')").children("option(value='ITEM 3')").hide();
   }
   
   else  
   {
     $('nobr:contains("List 2")').closest('tr').hide();
   }
   });
});
</script>

enter image description here

Database Role based access control design for survey app

I’m going to design the RBAC for a survey app. Each survey has the same role as below and only 1 manager, 1 leader and multiple participants.

Role_ID|Role_Name  |
-------|-----------|
      1|admin      |
      2|manager    |
      3|leader     |
      4|participant|

Each user can have multiple roles and this user can choose to be the participant role to join one survey or not when he is the manager or leader of a survey. To make the user only can action the survey he owns, for example, UserA is assigned to be the leader of SurveyA, so he can only has the capability, edit_survey, on SurveyA but not another surveyB which he’s not assigned to, how should I design the database?

I generated two options, can someone check which one is better or there is another better solution?

Option1

I put the role manager and leader column as the FK of User_ID from User table on Survey table as it’s one to one relationship and create a new participant table for participants.

enter image description here

Option2

I create a new user_role_in_survey table to store manager and leader role and this table replaces old user_role table. Survey_ID is the FK of Survey table and participant table for participants.

enter image description here

google sheets – Conditional Formatting Based on another Cell with Multiple IF’s

I had a Conditional Format in Place, but it somehow stopped working once I filled in an IF Argument into my cell.

A1 Contains a Number I put in manually
A2 Contains another Number I put in manually
A3 Contains a Number which changes (with IF Arguments) depending on which number is input into A1

A3 Is supposed to change it’s color depending on the Number it contains.

My Argument for A3 is

=IF(A1=1, "3", IF(A1=2, "6", IF(A1=3, "3", if(A1=4, "6","N/A"))))

I had my Conditional Format on Cell A3 as "Custom Formula is" with the Formula being

=A2=A3 -> Green  

and a second one as

=A2<A3 -> Red

web – Should end-users enter Dates or Numbers based on their browser locales vs based on the page content language?

I have a website for international users. Let’s say the website supports English users only ( All texts on the website are English words ). The website has a submit form that the end-users of the website need to enter Dates, Integers, and Decimals. At back-end side, I will convert all the text-based fields: Date, Integer, and Decimals to Date, Integer, Double objects.

My question is: What kind of Locale I should use to convert all text-based fields to Date, Integer, Double objects?

I have 2 choices: The first choice is I will always use US-Locale for the conversions. The second choice is I will use the end-user browsers setting locales (Request Locales).

If I use the first choice, let’s say the French, Japanese, … etc. users must always enter US Locale Date, Integer, Decimals formats.

If I use the second choice, the French users can enter French Locale Date, Integer, Decimals formats, the Japanese users can enter Japanese Locale Date, Integer, Decimals formats, … etc.

I know each of choice has its own pros an cons. but I would like to know which choice is recommended.

Thanks!

{Global Host IT Smart} Host a website on Windows|Plesk Availed|US Based Servers – Hosting, VPN, Proxies

Get the high octane windows hosting plans with Host IT Smart at the best affordable pricing with premium features.

We are mainly famous for providing an extremely powerful, end-to-end management, reliability, and scalability features along with its highlighting features of integrating the business with the internet and any Microsoft products to the website.

We try our best to make simple data management from your end & offer you the Plesk to manage the work quick & secure. All these features at the rock bottom pricing. Have a look at the pricing and its features

Server Location:
India

Below is the pricing of the Windows Hosting Plan:

Starter plan – @ Rs 100/mo

  • 250MB webspace
  • 50GB Bandwidth
  • 1 website
  • SSL Certificate
  • 25 Email IDs
  • 1 MSSQL/MYSQL space

Performance plan – @ Rs 300/mo

  • Unlimited webspace
  • Unlimited Bandwidth
  • 5 Websites 
  • SSL Certificate
  • Unlimited Subdomains
  • 10 MSSQL/MYSQL space
  • Unlimited Email IDs

Business plan – @ Rs 400/mo

  • Unlimited webspace
  • Unlimited Bandwidth
  • Unlimited websites
  • SSL Certificate
  • Unlimited Subdomains
  • Unlimited Email IDs
  • 20 MSSQL/MYSQL space

These are 50% discounted, but you can avail more discounts with the plans.

If you purchase WordPress hosting for 1 or 2 years, it avails you for an additional 20% discount.
By Applying code: HOSTITSMART20, You Get an Extra 20% Discount.

If you purchase WordPress hosting for more than 2 years, it avails you for an additional 30% discount.
By Applying code: HOSTITSMART30, You Get an Extra 30% Discount.

 

Our Support Team is prepared to help you in any circumstance and anytime to tackle any issue in the best possible manner. We additionally furnish Instant Talk administration to interact with you, virtually.

For Immediate Assistance or information, contact us: info@hostitsmart.com or visit our website for live chat. 
 

Role Based Access Control(RBAC) design

I have a general RBAC model design: user table, role table and resource table. The user_role talbe is the joined table of user and role, and resource_role table is the joined table of resource and resource_role.

The structure is:

User table

User_ID|Email             |Name     |
-------|------------------|---------|
      1|bobtest@gmail.com |Bob      |
      2|marytest@gmail.com|Mary     |
      3|samtest@gmail.com |Sam      |

Role table

Role_ID|Role_Name  |
-------|-----------|
      1|admin      |
      2|manager    |
      3|editor     |
      4|author     |

Resource

Resource_Id|Resource_Name  |
-----------|---------------|
          1|create_post    |
          2|update_post    |
          3|view_post      |
          4|delete_post    |

User_role table will define what roles one user has and each user can have multiple roles

User_Id|Role_Id  |
-------|---------|
      1|        1|
      1|        3|
      2|        2|
      3|        4|

Role_resource table will define what resources one user will have:

Role_Id  |  Resource_Id|
---------|-------------|
        1|            1|
        1|            2|
        1|            3|
        1|            4|
        2|            1|
        2|            2|
        2|            3|
        2|            4|
        3|            3|
        3|            2|
        4|            3|
        4|            2|

I also have a post talbe to store post information and Author_Id is the foreign key refer to User table User_ID

post table

Post_ID|Name          |Author_Id |
-------|--------------|----------|
      1|Post_A        |         1|
      2|Post_B        |         2|
      3|Post_C        |         2|
      4|Post_D        |         3|

My question is, if how can I set one user with the particular role can only edit the particular posts rather than all posts? For example, one user with author role can create any new posts, but he should only edit the posts he created, not all posts. And is possible I can set one editor can only edit particular ahtors posts? How should I design the structure?

discrete geometry – On Some Centers of Convex Regions Based On Partitions

These questions are inspired by Yaglom and Boltyanskii’s ‘Convex Figures’.

Winternitz Theorem: If a 2D convex figure is divided into 2 parts by a line l that passes through its center of gravity, the ratio of the areas of the two parts always lies between between the bounds 4/5 and 5/4.

Y and B also prove that for any triangle, there is no other point O than its center of gravity (centroid) for which the ratio of the partial areas into which the triangle is subdivided by lines thru O can be enclosed within narrower bounds.

Question 1: For any general convex 2D region, is the centre of mass still the point such that the areas into which the region is divided by lines thru that points are closest to each other? If the point we seek is not necessarily the centre of mass (seems unlikely), then it could be called the ‘area partition center’ of the region and finding this center for a general given region could be an algorithmic question.

Y and B also prove:
Let a bounded curve of length L that may consist of separate pieces be given in the plane. Then there is a point O in the plane so that each line through O divides the curve into 2 parts each having a length of not less than L/3.

Question 2: If L be the boundary of a single convex region, there must be a point O’ in its interior such that any line thru O’ divides the boundary into 2 portions such that the lengths of the two portions are closer than 1:3. What is a bound for this ratio for convex regions?

Let us define the perimeter partition center of a 2D convex region as that point P in its interior such that the 2 portions into which any line thru P divides the outer boundary are guaranteed to be closest to each other in length.

Example: For an isosceles triangle with very narrow base, this perimeter partition center is close to the mid point of the bisector of its apex angle and so clearly different from the centroid.

Question 3: Given a general convex region (even a triangle) to find its perimeter partition center.

Note: These questions have obvious 3D analogs with volume and surface area replacing area and perimeter.

algorithms – How to tell if a group of items is stacked horizontally or vertically based only on their positions?

How do you tell if a group of items is stacked horizontally or vertically given only the items x and y positions?

Vertical Group:

Horizontal Group:

• item 1 • item 2 • item 3

The items in the vertical stack can be moved left or right but each item is further down from the last.

The items in a horizontal stack can be higher up or lower down than the first item.

What I’m doing now to check for a vertical stack is to check if the second item Y position is greater than the first item Y position. But if it is a horizontal group of items and the items are stair-cased down from top to bottom then it would fail.

    if (secondItemY>topY) {
        return true;
    }

I almost had it figured out