text:
Q: Override appsettings.json on Azure using ASPNETCORE_ENVIRONMENT I have an ASP Core 2.2 application which runs fine.

*

*I have an appsettings.json

*I have an appsettings.QA.json

*I have an Azure App Service which I have added ASPNETCORE_ENVIRONMENT variable to in the Configuration > App Settings section of the portal and set the value to "QA".

*I have also added a connection string directly to the Configuration > Connection Strings section of the portal.

When I publish to my Azure App Service, I want to override the settings in appsettings.json with values from appsettings.QA.json. I am struggling to make sense of how this should be configured.
I am reading out the values from the appsettings via the Microsoft.Extensions.Configuration.IConfiguration implementation which is injected into classes where I need such configuration.
So far I have the following:
Program.cs:
public static IWebHostBuilder CreateWebHostBuilder(string[] args) =>
    WebHost.CreateDefaultBuilder(args)
        .ConfigureAppConfiguration((hostingContext, config) =>
        {
            config.SetBasePath(hostingContext.HostingEnvironment.ContentRootPath)
                .AddJsonFile("appsettings.json", optional: true, reloadOnChange: true)
                .AddJsonFile($"appsettings.{hostingContext.HostingEnvironment.EnvironmentName}.json", optional: true)
                .AddEnvironmentVariables();
        })
        .UseStartup<Startup>();

When the app runs in Azure, it is picking up the connection string from the portal and using it. However, when I read out a value from the appsettings, I always get the value from appsettings.json not appsettings.QA.json.

*

*Can anyone point out how to configure the transforms correctly for an ASP Core 2.2 application?

*Am I going about this in the wrong way entirely?

Update

*

*I have removed my custom code above as suggested as it is not needed.

*If I output @Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT") in my view, I get: "QA;Development". It seems that the "Development" is coming from the web.config which also has ASPNETCORE_ENVIRONMENT set.

A: you shouldn't read environment from appsettings. environment is set on machine level and is read at startup.
you have 2 options:

*

*for local machine, set environment variable in launch.settings

*in azure, set it in app service configuration as environment variable
ref: https://learn.microsoft.com/en-us/aspnet/core/fundamentals/environments?view=aspnetcore-2.2

A: I now have this working correctly:

*

*Removed the custom code from the Program.cs as suggested by @KirkLarkin and @dee-zg.

*Removed the ASPNETCORE_ENVIRONMENT setting from the Azure portal. The reason for this is that there is also a web.config in the app which has this setting. When reading from the config, it seems that this version is used, not the Azure portal version.

Why is the ASPNETCORE_ENVIRONMENT in the web.config? There is a discussion about this here. Ultimately, what I have done to work around this is to add transforms for the web.config.


text:
Q: Sort collection in mongodb based on property in Array {
    'name':'abc',
    'records': {
        'entries':[
            {
                'date_created':'2020-01-01T00:00:00',
                'some_filed':'value'
            },
            {
                'date_created':'2019-02-03T05:00:00',
                'some_filed':'value'
            }
        ]
    }
},
{
    'name':'xyz',
    'records': {
        'entries':[
            {
                'date_created':'2022-03-07T08:00:00',
                'some_filed':'value'
            },
            {
                'date_created':'2022-02-08T10:987:00',
                'some_filed':'value'
            }
        ]
    }
}

I have above collection format. I want to sort this based on date_created from first record in the array , i.e I want to perform sorting based on records.entries[0].date_created.
Also I need to project the name and records.entries[0].date_created fields.
I tried below queries
db['sample_collection'].find({}, {'records.entries.0.date_created':1, 'name':1})

A: db.collection.aggregate([
  {
    $set: { firstObject: { $first: "$records.entries.date_created" } }
  },
  {
    $sort: { firstObject: -1 }
  }
])

mongoplayground

redpajama_set_name: RedPajamaStackExchange


text:
Q: Bind to inner values of a property Suppose we have a label labelName and a current player property CurrentPlayerProperty which is a ObjectProperty. We want to bind the current player's name to the label, but doing this:
labelName.textProperty().bind(Bindings.concat("Name: ", CurrentPlayerProperty().getValue().getName()));

doesn't change the label afterCurrentPlayerProperty was changed. This is probably because it's bound to the name of the first player.
Is there a way to do this without making a special property for the name?
I ask because there are more details that needs to be bound beside the name and it seems like a lot of code duplication to have for each of them a special property.


text:
Q: Listview Item is overflow on Top of layout when scrolling My listview widget is overflowed over another widget like the below screen.

Here is my full code.
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:propsoft/utils/dotted_decor.dart';
import '../../utils/app_theme.dart';
import '../../widget/elevated_icon_button_widget.dart';
import '../../widget/helper_utils.dart';
import '../../widget/label_widget.dart';
import 'create_user_logic.dart';

class CreateUserPage extends GetView<CreateUserLogic> {
  final logic = Get.find<CreateUserLogic>();

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: customAppbar(),
      body: SafeArea(child: getBodyDetails()),
    );
  }

  Widget getBodyDetails() {
    return Column(
      children: [
        getSearchWidget(),
        DefaultTabController(
          length: 2,
          child: Expanded(
            child: Column(
              children: [getTabBar(), getTabVarView()],
            ),
          ),
        ),
      ],
    );
  }

  Widget getTabBar() {
    return TabBar(
      indicator: UnderlineTabIndicator(
          borderSide: BorderSide(width: 2.0, color: AppTheme.colors.black)),
      labelColor: AppTheme.colors.black,
      unselectedLabelColor: AppTheme.colors.gray,
      indicatorSize: TabBarIndicatorSize.tab,
      tabs: const [
        Tab(text: "Users"),
        Tab(
          text: 'Status',
        ),
      ],
    );
  }

  Widget getTabVarView() {
    return Expanded(
      child: TabBarView(
          children: [
            usersList(),
            const Center(
              child: Text("Status"),
            ),
          ]),
    );
  }

  Widget usersList() {
    return Column(
      children: [
        Expanded(
          child: Column(
            children: [
              Container(
                padding: const EdgeInsets.symmetric(vertical: 22, horizontal: 16),
                child: Row(
                  children: [
                    Container(
                      padding: const EdgeInsets.all(8),
                      decoration: DottedDecoration(
                          color: AppTheme.colors.darkBlue, shape: Shape.circle),
                      child: Icon(
                        Icons.add,
                        color: AppTheme.colors.darkBlue,
                      ),
                    ),
                    const SizedBox(
                      width: 20,
                    ),
                    PLabel(
                      text: "Invite New Users",
                      enumFontWeight: PSFontWeight.bold,
                      textColor: AppTheme.colors.darkBlue,
                    )
                  ],
                ),
              ),
              Expanded(
                child: ListView.builder(
                  scrollDirection: Axis.vertical,
                  shrinkWrap: true,
                  itemBuilder: (context, position) {
                    return InkWell(
                      onTap: () {},
                      child: Container(
                        margin:
                            const EdgeInsets.symmetric(vertical: 8, horizontal: 8),
                        child: Row(
                          children: [
                            PIconButton(
                              backgroundColor: AppTheme.colors.lightBlue,
                              icon: const PLabel(
                                fontSize: 22,
                                text: "HT",
                              ),
                            ),
                            const SizedBox(
                              width: 16,
                            ),
                            Column(
                              crossAxisAlignment: CrossAxisAlignment.start,
                              children: const [
                                PLabel(text: "My Contact List"),
                                SizedBox(
                                  height: 4,
                                ),
                                PLabel(text: "Activated"),
                              ],
                            )
                          ],
                        ),
                      ),
                    );
                  },
                  itemCount: 10,
                ),
              )
            ],
          ),
        ),
      ],
    );
  }

  Widget getSearchWidget() {
    return Container(
        padding: const EdgeInsets.all(16),
        child: Row(
          children: [
            Expanded(
              child: TextField(
                  controller: controller.searchController,
                  onChanged: (query) {
                    controller.filterSearchResult(query);
                  },
                  decoration: InputDecoration(
                    prefixIcon: const Icon(Icons.search),
                    border: OutlineInputBorder(
                        borderRadius: BorderRadius.circular(4)),
                    labelText: "Search for a user",
                  )),
            )
          ],
        ));
  }

  AppBar customAppbar() {
    return AppBar(
        actions: [
          Padding(
            padding: const EdgeInsets.all(8.0),
            child: Center(
              child: InkWell(
                  onTap: () {},
                  child: PLabel(
                    text: "Save",
                    fontSize: 18,
                    textColor: AppTheme.colors.darkBlue,
                  )),
            ),
          )
        ],
        leading: IconButton(
          icon: getSVGImage("assets/images/cross.svg"),
          onPressed: () {
            Get.back();
          },
        ),
        leadingWidth: 40,
        title: const PLabel(
          text: "Users & Group",
          fontSize: 22,
        ),
        backgroundColor: AppTheme.colors.white,
        elevation: 0);
  }
}

A: I have worked on your code....its work fine only...
Things changed... instead of PLabel Widget I have used Text Widget and Instead of PIconButton Widget I have used normal Icon Widget.... take my code as reference only...because I have changed your icons because of not having getSVGImage package and some other package.. And attaching image for your reference

Working example:

@override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: customAppbar(),
      body: SafeArea(child: getBodyDetails()),
    );
  }

  Widget getBodyDetails() {
    return Column(
      children: [
        getSearchWidget(),
        DefaultTabController(
          length: 2,
          child: Expanded(
            child: Column(
              children: [getTabBar(), getTabVarView()],
            ),
          ),
        ),
      ],
    );
  }

  Widget getTabBar() {
    return const TabBar(
      indicator: UnderlineTabIndicator(
          borderSide: BorderSide(width: 2.0, color: Colors.black)),
      labelColor: Colors.black,
      unselectedLabelColor: Colors.grey,
      indicatorSize: TabBarIndicatorSize.tab,
      tabs: [
        Tab(text: "Users"),
        Tab(
          text: 'Status',
        ),
      ],
    );
  }

  Widget getTabVarView() {
    return Expanded(
      child: TabBarView(
          children: [
            usersList(),
            const Center(
              child: Text("Status"),
            ),
          ]),
    );
  }

  Widget usersList() {
    return Column(
      children: [
        Expanded(
          child: Column(
            children: [
              Container(
                padding: const EdgeInsets.symmetric(vertical: 22, horizontal: 16),
                child: Row(
                  children: [
                    Container(
                      padding: const EdgeInsets.all(8),
                      decoration: BoxDecoration(
                          color: Colors.blueAccent, shape: BoxShape.circle),
                      child: Icon(
                        Icons.add,
                        color: Colors.black12,
                      ),
                    ),
                    const SizedBox(
                      width: 20,
                    ),
                    Text(
                      "Invite New Users",
                    )
                  ],
                ),
              ),
              Expanded(
                child: ListView.builder(
                  scrollDirection: Axis.vertical,
                  shrinkWrap: true,
                  itemBuilder: (context, position) {
                    return InkWell(
                      onTap: () {},
                      child: Container(
                        margin:
                        const EdgeInsets.symmetric(vertical: 8, horizontal: 8),
                        child: Row(
                          children: [
                            IconButton(
                              color: Colors.lightBlue,
                              icon : const Icon(
                                Icons.home,
                              ),
                              onPressed: () {  },
                            ),
                            const SizedBox(
                              width: 16,
                            ),
                            Column(
                              crossAxisAlignment: CrossAxisAlignment.start,
                              children: const [
                                Text("My Contact List"),
                                SizedBox(
                                  height: 4,
                                ),
                                Text("Activated"),
                              ],
                            )
                          ],
                        ),
                      ),
                    );
                  },
                  itemCount: 10,
                ),
              )
            ],
          ),
        ),
      ],
    );
  }

  Widget getSearchWidget() {
    return Container(
        padding: const EdgeInsets.all(16),
        child: Row(
          children: [
            Expanded(
              child: TextField(
                  // controller: controller.searchController,
                  // onChanged: (query) {
                  //   controller.filterSearchResult(query);
                  // },
                  decoration: InputDecoration(
                    prefixIcon: const Icon(Icons.search),
                    border: OutlineInputBorder(
                        borderRadius: BorderRadius.circular(4)),
                    labelText: "Search for a user",
                  )),
            )
          ],
        ));
  }

  AppBar customAppbar() {
    return AppBar(
        actions: [
          Padding(
            padding: const EdgeInsets.all(8.0),
            child: Center(
              child: InkWell(
                  onTap: () {},
                  child: Text(
                    "Save",
                  )),
            ),
          )
        ],
        leading: IconButton(
          icon: Icon(Icons.book),
          onPressed: () {
            // Get.back();
          },
        ),
        leadingWidth: 40,
        title: const Text(
          "Users & Group",
        ),
        backgroundColor: Colors.white,
        elevation: 0);
  }


text:
Q: I need to make a loop wait for a set amount of time before iterating to the next loop The current code I have is crashing the game completely:
public void fire(float angle)
{
    int burst = 0;
    bool waitActice = false;

    while(burst < 3){
            if (waitActive == false) {

                    Debug.Log("Created " + burst + " burst");
                    StartCoroutine (wait (5f));
                    Debug.Log ("done waiting");
                    burst++;
            }
    }
}

IEnumerator wait(float time)
{
    Debug.Log ("Now waiting");
    waitActive = true;
    yield return new WaitForSeconds(time);
    waitActive = false;
}

I have attempted the same thing with a for loop, but the for loop would continue to iterate until it was all complete. I want to create 3 bursts with 5 seconds between each burst, but when the fire function is called it crashes. Any ideas?

A: Why not thread.sleep ?
      Thread thread = new Thread(() => fire(angle)); // this will execute your method in a new thread.
      thread.Start();

public void fire(float angle)
         {
          int burst = 0;
          bool waitActice = false;

          while(burst < 3){
          if (waitActive == false) {
                Thread.Sleep(5000); // will wait for 5 seconds
                Debug.Log("Created " + burst + " burst");
                StartCoroutine (wait (5f));
                Debug.Log ("done waiting");
                burst++;
          }
        }
     }

A: Create a variable LastFireTime.
Set it to 0,
Keep incrementing it in the update function.
LastFireTime += Time.deltaTime;

that way you know how much time since the last fire and you can reset it to 0 every time you fire again.
Do not wait as the game update function must return ASAP

A: My guess would be that you have a waitActive as a field in your class, but you hide it with your local bool waitActice = false;.
I guess this because your wait refers to waitActive.
You could try this:
public IEnumerator fire(float angle)
{
    int burst = 0;

    while(burst < 3){
        Debug.Log("Created " + burst + " burst");
        yield return new WaitForSeconds(time);
        Debug.Log ("done waiting");
        burst++;
    }
}

Then do
StartCoroutine(fire(9.2));


text:
Q: A complete subset of a metric space is closed? Supposing $A$ is a subset of a metric space $S$, it is simple enough to show that if $S$ is complete and $A$ is closed, that $A$ is complete.
However, without being given that $S$ is complete, what would the proof of the converse be?
(i.e. proving that if $A$ is complete, $A$ is closed)

A: Suppose $A \subset S$ is complete. To prove that $A$ is closed, it suffices to prove that if $(x_n)$ is a sequence of points of $A$ which converges to $x \in S$, then $x \in A$. So let $x_n$ be such a sequence. Since $x_n$ converges in $S$, it is a Cauchy sequence in $S$. Therefore $(x_n)$ is also a Cauchy sequence in $A$, so by completeness of $A$, there exists some $y \in A$ such that $x_n \to y$. Then by uniqueness of limits, we must have $y=x$, so $x \in A$. Thus $A$ is closed.

A: We just need to prove every limit point of $Y$ is in $Y$. Consider any limit point $p$ of $Y$. For every positive integer $n$, there is a point $p_n \in Y$ s.t. $d(p_n, p) < \frac{1}{n}$. Obviously, $\lim\limits_{n\rightarrow\infty}p_n=p$. Moreover, for any $\epsilon>0$, $d(p_m, p_n) \leq d(p_m, p)+d(p_n, p) < \frac{1}{m}+\frac{1}{n} < \epsilon$ whenever $m,n>N=\frac{2}{\epsilon}$. Thus, $\{p_n\}$ is a Cauchy sequence. Since $(Y, d)$ is complete, we have $p \in Y$. Therefore, $Y$ is closed, for every limit point of $Y$ is in $Y$.


text:
Q: How can I ignore an error when using GCC compile option '-Werror'? I have the following test code, file test.c:
#include <stdio.h>

int *func()
{
    int i = 123;
    return &i;
}

int main()
{
    printf("%d\n", *func());
}

If I use the command to compile it that is OK,
gcc test.c -o test

It will have the following warning information:
warning: address of stack memory associated with local variable 'i'
  returned [-Wreturn-stack-address]
return &i;
        ^
1 warning generated.

But it can output the result: 123
If I use the command:
gcc -Werror test.c -o test

It will have the following error information:
error: address of stack memory associated with local variable 'i'
  returned [-Werror,-Wreturn-stack-address]
return &i;
        ^
1 error generated.

Now I want to use the -Werror option, but I also want to ignore the address of stack memory associated with local variable 'i' warning. What should I do?

A: Most gcc warnings can be disabled by prefixing the name of the warning with no-, e.g. -Wno-return-stack-address.
That said, this is not something you want to ignore; returning pointers to stack variables is undefined behavior, and while it has semi-predictable results on most compilers, it's incredibly fragile; any function call at all, implicit or explicit, could stomp on the value that pointer is referencing.


text:
Q: How can I use 'time.After' and 'default' in Golang? I'm trying to understand a simple code of Golang routines:
package main

import (
    "fmt"
    "time"
)

func sleep(seconds int, endSignal chan<- bool) {
    time.Sleep(time.Duration(seconds) * time.Second)
    endSignal <- true
}

func main() {
    endSignal := make(chan bool, 1)
    go sleep(3, endSignal)
    var end bool

    for !end {
        select {
        case end = <-endSignal:
            fmt.Println("The end!")
        case <-time.After(5 * time.Second):
            fmt.Println("There's no more time to this. Exiting!")
            end = true
        }
    }

}

That's fine, but Why I cannot use a simple default in this "select" block? Something like this:
for !end {
    select {
    case end = <-endSignal:
        fmt.Println("The end.")
    case <-time.After(4 * time.Second):
        fmt.Println("There's no more time to this. Exiting!")
        end = true
    default:
        fmt.Println("No end signal received.")
    }
}

It gets this output:
❯ go run goroutines-timeout.go
No end signal received!
No end signal received!
No end signal received!
No end signal received!
...
The end!

And I can't understand why.

A: Each time you execute time.After(4 * time.Second) you create a new timer channel. There's no way the select statement can remember the channel it selected on in the previous iteration. You've also taken what was an asynchronous operation and turned it into a busy loop, defeating the purpose of the select statement.
All you need is a a simple select around the two channels you're interested in. It doesn't need to loop at all.
select {
case <-endSignal:
    fmt.Println("The end!")
case <-time.After(4 * time.Second):
    fmt.Println("There's no more time to this. Exiting!")
}

https://play.golang.org/p/jb4EE8e6cw
If you really want to poll multiple times, make the timer outside of the for loop, so that the same one is checked each iteration
timeout := time.After(5 * time.Second)
pollInt := time.Second

for {
    select {
    case <-endSignal:
        fmt.Println("The end!")
        return
    case <-timeout:
        fmt.Println("There's no more time to this. Exiting!")
        return
    default:
        fmt.Println("still waiting")
    }
    time.Sleep(pollInt)
}


text:
Q: Script Copy/Paste with Criteria I have a script that will copy and paste data from non-consecutive columns and I have a script that will copy and paste data based on multiple criteria however after numerous attempts I have been unable to create a script that does both. Any help would be appreciated. For the following code the error is;

The number of rows in the data does not match the number of rows in the range.

function UpdateTeam() {
  var source = SpreadsheetApp.openById('xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx');          // Source workbook
  var sourcesheet = source.getSheetByName("Test").getDataRange().getValues();                    // *Source workbook sheet, sheets vary by location. Case sensitive.
  var dest = SpreadsheetApp.getActiveSpreadsheet();                                              // Destination workbook
  var destsheet = dest.getSheetByName("Team");                                                   // Destination workbook sheet

  var criteria1 = "Active"                                                                       // Criteria #1
  var criteria2 = "Hop"                                                                          // *Criteria #2, change to location name in

  destsheet.getRange(6, 1, destsheet.getLastRow(), destsheet.getLastColumn()).clearContent()      // Clear all previous content on destination sheet
  SpreadsheetApp.flush();                                                                         // Wait till the clear sheet is complete before adding new

  var sourcerange  = [4,2,1,4,5,7,11,12,4,64,4,65,4,68,69,70,4,75];                               // Columns of data to import
  var newvalues = [];

  for (var i = 0, length = sourcesheet.length; i < length; i++) {
    if (sourcesheet[i][1]==criteria1 && sourcesheet[i][2]==criteria2){
      newvalues[i] = [];
      for (var j = 0, width  = sourcerange.length; j < width; j++) {
    if (sourcesheet[i][1]==criteria1 && sourcesheet[i][2]==criteria2){
        newvalues[i][j] = sourcesheet[i][sourcerange[j]];
      }
    }
  }
  }
    if(newvalues.length > 0) {
      destsheet.getRange(6, 1, length +1, width +1).setValues(newvalues);
    }
}

A: Try this:
function UpdateTeam() {
  var sss=SpreadsheetApp.openById('id');
  var svA=sss.getSheetByName("Test").getDataRange().getValues();
  var dss=SpreadsheetApp.getActive();
  var dsh=dss.getSheetByName("Team");
  var criteria1="Active";
  var criteria2="Hop";
  dsh.getRange(6,1,dsh.getLastRow()-5,dsh.getLastColumn()).clearContent();
  var srg=[4,2,1,4,5,7,11,12,4,64,4,65,4,68,69,70,4,75];
  var newvalues = [];
  for (var i=0;i<svA.length;i++) {
    if (svA[i][1]==criteria1 && svA[i][2]==criteria2){
      var row=[];
      srg.forEach(function(e,j){row.push(svA[i][srg[j]]);})
      newvalues.push(row);
    }
  }
  if(newvalues){dsh.getRange(6,1,newvalues.length,srg.length).setValues(newvalues);}
}

A: There is a problem with newvaluess array length. It does not match with sourcerange array length.
You can check it by adding this code into your code.
Browser.msgBox("sourcerange length: " + sourcerange.length + " | newvalues length: " + newvalues.length);
return;
if(newvalues.length > 0) {
  destsheet.getRange(6, 1, length +1, width +1).setValues(newvalues);
}

I think that the problem is that you don`t add else, to add an empty slot in the array, to keep same length when not matching criteria.


text:
Q: Get row with biggest column value when there are similar rows? I'm working on a system to add Tags to my site, right now this is my "Tags" table:
URL           | Tag     | UID
example1.com    humor     123
example1.com    humor     342
example1.com    humor     234
example1.com    blog      123
example1.com    blog      432
example1.com    food      221
example2.com    blog      432

I'm using the following query to sum tags for each site:
SELECT *, COUNT(*) as SUM
FROM History
GROUP BY URL, UID

So I get:
URL           | Tag     | Sum
example1.com     humor    3
example1.com     blog     2
example1.com     food     1
example2.com     blog     1

Finally (and this is what I don't know how to do) I need to get only the 2 rows with the biggest Sum for each grouped URL so I know what's the actual subject of the site:
URL           | Tag     | Sum
example1.com     humor    3
example1.com     blog     2
example2.com     blog     1

How can I do this?

A: Try using a self-join on your results. This article has some great examples. Rather than nesting a number of queries, it might be easier (and faster) to create a temporary table from your first query, and then using that for the second step (getting the max "sum" from each group).  See the section of that page titled "Select the top N rows from each group".


text:
Q: Angular form - disable validation by ng-required I have a email field in a form:

               mail
               <input
               ng-required="vm.isMailReqired"
               pattern="^(([^<>()\[\]\.,;:\s@\']+(\.[^<>()\[\]\.,;:\s@\']+)*)|(\'.+\'))@(([^<>()[\]\.,;:\s@\']+\.)+[^<>()[\]\.,;:\s@\']{2,})$"
                            class="form-control sgn-rounded_textbox"
               name="emailBox"
               ng-disabled="!vm.model.signAgreement"
               ng-model="vm.model.emails.beitEsek">

In my controller vm.isMailReqired is set to false but still the emailBox.$invalid is true and as a result my form controller(formsToSign) is false - formsToSign.$valid:false.
EDIT - entire form
<form name="formsToSign" novalidate class="form-validation">

                    mail
                    <input
                    ng-required="vm.isMailReqired"
                    pattern="^(([^<>()\[\]\.,;:\s@\']+(\.[^<>()\[\]\.,;:\s@\']+)*)|(\'.+\'))@(([^<>()[\]\.,;:\s@\']+\.)+[^<>()[\]\.,;:\s@\']{2,})$"
                    class="form-control sgn-rounded_textbox"
                    name="emailBox"
                    ng-disabled="!vm.isMailReqired"
                    ng-model="vm.model.emails.beitEsek">

                    Secondary maik
                    <input pattern="^(([^<>()\[\]\.,;:\s@\']+(\.[^<>()\[\]\.,;:\s@\']+)*)|(\'.+\'))@(([^<>()[\]\.,;:\s@\']+\.)+[^<>()[\]\.,;:\s@\']{2,})$"
                    dir= "ltr"
                    class="form-control sgn-rounded_textbox"
                    name="emailBox1"
                    input-change = "vm.mailField"
                    ng-model="vm.model.emails.emailField"
                    >

                    Manger Mail
                    <input pattern="^(([^<>()\[\]\.,;:\s@\']+(\.[^<>()\[\]\.,;:\s@\']+)*)|(\'.+\'))@(([^<>()[\]\.,;:\s@\']+\.)+[^<>()[\]\.,;:\s@\']{2,})$"
                    dir= "ltr"
                    class="form-control sgn-rounded_textbox"
                    name="emailBox2"
                    input-change = "vm.mailField"
                    ng-model="vm.model.emails.menahelEmailField"
                    >

                <button ng-class="{'invalidForm':( vm.buttonDisableValidation || formsToSign.$invalid)}" ng-disabled="vm.buttonDisableValidation || formsToSign.$invalid"
                    class="sgn_redBTN" ng-click="vm.showFormAndClose()">Show Forms</button>

    </form>

Thanks for any help.

A: I've tailored your example with one input elements and made the fiddle and it is working without any
issues.
I guess the issue is with other input elements. Try to debug with {{formsToSign.$error}} to find the error
HTML

  <form name="formsToSign" novalidate class="form-validation">

          mail {{vm.isMailReqired}}
          <input ng-required="vm.isMailReqired" pattern="^(([^<>()\[\]\.,;:\s@\']+(\.[^<>()\[\]\.,;:\s@\']+)*)|(\'.+\'))@(([^<>()[\]\.,;:\s@\']+\.)+[^<>()[\]\.,;:\s@\']{2,})$" class="form-control sgn-rounded_textbox" name="emailBox" ng-disabled="!vm.isMailReqired"
          ng-model="vm.model.emails.beitEsek" />

        <button ng-class="{'invalidForm':( vm.buttonDisableValidation || formsToSign.$invalid)}" ng-disabled="formsToSign.$invalid" class="sgn_redBTN" ng-click="vm.showFormAndClose()">Show Forms</button>

  </form>

    {{formsToSign.$error}}

JS
angular
  .module('myApp', []);
angular
  .module('myApp')
  .controller('MyController', MyController);
MyController.$inject = [];

function MyController() {
  var vm = this;
  vm.isMailReqired = true;
}

A: $invalid
boolean
True if at least one containing control or form is invalid.

  mail
  ()\[\]\.,;:\s@\']+(\.[^()\[\]\.,;:\s@\']+)*)|(\'.+\'))@(([^()[\]\.,;:\s@\']+\.)+[^()[\]\.,;:\s@\']{2,})$" class="form-control sgn-rounded_textbox" name="emailBox"ng-disabled="vm.model.signAgreement"ng-model="vm.model.emails.beitEsek">


text:
Q: Selenium intermittent click in emulator So this has me quite mixed up.
We have a testing framework using Selenium, Specflow and C#. Currently running Selenium 3.13.1 (Just upgraded yesterday to see if the older version (3.11.2) was the issue)
The issue (only when Emulating a mobile device in Chrome):
When running tests locally all is well, buttons are clicked and the test passes.
When running tests remotely on the Jenkins slaves it works some of the times .i.e. sometimes I get a click and sometimes I do not.
When the Jobs are run as per schedule some of the tests fail consistently (these being tests that run perfectly well when run locally).
I have tried adding a Sleep of 5 seconds, however this did not help.
One thing that did work is changing Click() to SendKeys(Keys.Enter).
Executing javascript to click the button works well too however I do not wish to change from click for 2 reasons. 1. This is the closest action which simulates user input and 2. This works well locally.
Chrome versions on the Jenkins slaves are in line with my local version (67.0.3396.99) and Chrome driver is also inline (2.40.565498).
Chrome driver has been updated yesterday since I have tried with version 2.38 and 2.39 but to no avail.
Has anyone come across this issue and found a solution?
P.S. When running tests not in mobile emulation I have no issues with clicks both locally or on Jenkins.

A: i had the same problem.
After I allowed PopUps in my Browser the click and clickAndWait Event works fine.
Maybe you can change the browser too.
Best Regards

A: For anyone who has this issue, this is the current relevant answer at this point in time.
This was not an issue with the framework we are using but an issue with chromium and chrome driver.
The issue/bug link can be found here (this is the known issue quoted below).
Also if you check the documentation for chrome driver mobile emulation, it is mentioned on the first line as follows
Note that Mobile Emulation is subject to this known issue.

This answer does not help solve the issue per se but gives the reason why it is happening. The "best" workaround I have found is using JS to click and so on. In our case we stopped using mobile emulation for now since clicking with JS does not really emulate a real click. As new versions of Chrome and ChromeDriver are realeased I will keep updating until there is a fix for it.
Hopefully you will waste less time than I have searching around for an answer :)


text:
Q: Entity Framework Select distinct multiple Hola amigos quiero hacer un query en EF de un DISCTINT de multiples columas.
El query que quiero ejecutar es este:

select distinct status, pregunta  from [MiTabla]

En entity encontré que puedo hacer un select distinct así:
var result = EFContext.MiTabla.Select(m => m.status).Distinct();
pero me gustario hacer algo donde me devuelva Status, pregunta, o cualquier otra columna de la fila que llamé, alguien sabe cómo puedo hacerlo?

A: Te estaría faltando el método que ejecute la consulta y con new estas creando un nuevo objeto anónimo, podes crear las propiedades que quieras.
var collection = (from p in EFContext.MiTabla
                  select new { status = p.pregunta, pregunta = p.pregunta, propiedad3 = p.OtraPropiedad}).ToList().Distinct();


text:
Q: aggregation association in object diagram Associations between classes (in class diagrams of course) are an abstraction for a set of links between different objects (in object diagrams). An aggregation is a special kind of association and it has a special symbol, the diamond.
A House has many (zero to many) windows.

The object names in the following diagrams should actually be underlined. My drawing aid yuml for this quick pictures has no obvious tweak for this, so I hope this is not too confusing. The only difference in both pictures is the diamond signs in the first.
my:House has side:Window
         has back:Window
         has front:Window

Is the diamond symbol used in object i.e. instance diagrams, too? Or are links in object diagrams always just simple lines?

A: You should use the diamond on a link as well - obviously only if the association is an aggregation.
Btw. object names (and type) should be underlined to distinguish them from classes easier.
See UML 2.4 Superstructure 7.3.22 and figure 7.52 in http://www.omg.org/spec/UML/2.4/Superstructure/PDF/

A: There is something wrong in your diagram. Because relationship between House and window should be a composition, not aggregation. If we take one specific window, that window is owned by one and only one house. If the house were to die, window will also die. So this is composition.
Answer to your question is, "we don't need to show aggregation and composition in object diagrams".


text:
Q: HTTP Status (canceled) when autoplay, loop are true on HTML video element Using Dev tools on Google Chrome Version 59.0.3071.115 (Official Build) (64-bit)
I am playing with HTML5 video and saw in the Network activity that whenever the video looped it would show up with Status (canceled).

What is going on here? Is it re-downloading each time it loops back?
The attributes I use are preload="none" to prevent automatically downloading the video, autoplay, and loop.
Here is some sample HTML:
<!DOCTYPE html>

    <meta charset="utf-8">
    <title>fadeIn demo</title>

            <video id="video1" width="560" preload="none" autoplay loop poster="test.jpeg">
                <source src="https://s3.amazonaws.com/collectememe/storage/video/4101688e-14fa-4018-b296-1514dc0d202f.mp4" type="video/mp4">
                Your browser does not support HTML5 video.
            </video>

A: Open up Chrome in incognito mode and you will see the mp4 in network activity. It does not have the same issue you are experiencing locally. I believe what you are experiencing locally is that you are not running a web server to serve up your html file and the browser cannot check to see if the file changed on loop.


text:
Q: How to manage webpack umd module dependencies (or create peerDependencies) I have created with webpack a UMD module, the content (without compression) start with :
(function webpackUniversalModuleDefinition(root, factory) {
  if(typeof exports === 'object' && typeof module === 'object')
    module.exports = factory();
  else if(typeof define === 'function' && define.amd)
    define("bootstrap-styled", [], factory);
  else if(typeof exports === 'object')
    exports["bootstrap-styled"] = factory();
  else
    root["bootstrap-styled"] = factory();
})(this, function() {

This library depend on react and for a signel Component within this library : react-dom (through react-onclickoutside package).
When I build this library with webpack and try to use it in a project. I have an error complaining about two copies of React, the second one has been bundled.
So I need to know what I am expecting as a Umd module.
I don't want to have React built, I want React to be a peer dependencies.
Am I supposed to see react as a parameter of this umd module ?
From a React application, how can I load this module ?
How do I exclude React? I have tried most of the documentations examples.

A: This is possible by using the externals property. When externals are specified, they will be added as arguments inside of the UMD wrapper.
You can reference this new guide from our new docs page!!


text:
Q: How do I configure win-p to chose the correct displays? Win-p can change between different display configurations quickly, which is nice. However, exactly what configurations it can switch between seems to be quite random.
I used to have a monitor and a TV connected and win-p changed one or the other quickly. (It called the computer "projector" and the TV "computer" though.)
Now I bought another monitor and win-p no longer does anyhing useful.
Is there any way to configure one monitor to be the "computer" and the other to be the "projector"?
I'd really be "happy" with just being able to toggle between single monitor "game mode" and two monitor "browser mode". TV only "couch mode" would be a bonus.


text:
Q: How to follow preprocessor directives throughout a compilation I'm working with a program, full of compiler directives, programmed in Visual Studio.
I've made some changes and now I'm stuck with an unresolved external compiler/linker error.
I believe this is caused by the compiler directives, which seem not to detect the implementation of that particular function, and in order to investigate this, I'd like to follow the #ifdef compiler directives throughout the compilation process.
I've already tried using the /P configuration, but I don't see any compiler directive in the Output window.
Does anybody know how to do this?

A: I think you're on the right track with the /P option, but the doc states that the output will go to files with a .i extension (so probably not to your Output window).
Further, you may be able to find some help on any linker errors by generating a map file; see /MAP (Generate Mapfile).


text:
Q: Python script in Rundeck failing I have a python script on server_A that connects to server_B via SSH and calls a local rsync command to reset a directory B with a fresh set of files. Then the script on A proceeds to rsync over additional set of files to B. My hope was to run this on a schedule in Rundeck. However, it is erroring on me every time during run with this output. What am I doing wrong?
Remote command failed with exit status 1
Failed: NonZeroResultCode: Remote command failed with exit status 1
Execution failed: 9 in project Test: [Workflow result: , step failures: {1=Dispatch failed on 1 nodes: [server_A: NonZeroResultCode: Remote command failed with exit status 1]}, Node failures: {server_A=[NonZeroResultCode: Remote command failed with exit status 1]}, flow control: Continue, status: failed]

A: Exit status 1 was returned by the command you called. What are you running?


text:
Q: Using asp:GridView to populate a form I am using an asp gridview element to do a search on the database and return some data using
    <asp:GridView ID="storedRecordsGrid" AutoGenerateSelectButton="true"  emptydatatext="No data    available." runat="server">

So i have a gridview that gets popolated and each row has its own select event. When the user selects a row I want to use the data in that row to populate texboxes on my page.
    protected void OnRowCommand(GridViewCommandEventArgs e)
        {

        }

So I have this method and i have my textboxes but when the select even fires I am not sure how the data is stored for each colums of that selected row. what i want to have is something like.
    protected void OnRowCommand(GridViewCommandEventArgs e)
        {
         mytextbox.text=datagridcolumn.value
        }

I am using .net 2.0
and my c# code as of right now looks like this.
private DataTable fillGrid(string dComplainantFName,string dComplainantlName)
   {
        string server = "";
        using (SqlConnection cnx = new SqlConnection(server))
        using (SqlCommand cmd = new SqlCommand("ComplaintReportLookUp", cnx) { CommandType = CommandType.StoredProcedure })
        using (DataTable dt = new DataTable())
        {
            cmd.Parameters.AddWithValue("@fName", dComplainantFName);
            cmd.Parameters.AddWithValue("@lName", dComplainantlName);
            try
            {
                cnx.Open();
                dt.Load(cmd.ExecuteReader());
                cnx.Close();
                return dt;
            }
            catch (Exception ex)
            {
                throw new Exception("Error executing MyProcedureName.", ex);
            }
        }

    }
   protected void executeGrid(object sender, EventArgs e)
        {
            storedRecordsGrid.DataSource = this.fillGrid(dComplainantFName.Text,dComplainantLName.Text);
            storedRecordsGrid.DataBind();
        }
    protected void OnRowCommand(GridViewCommandEventArgs e)
        {

        }

Thank you for your help

Thanks Tim for the help this is what ended up working for me.
    protected void gridSelectedIndexChanged(Object sender, EventArgs e)
    {
    var row = ((GridView)sender).SelectedRow;
    //var cell1Text = row.Cells[0].Text; // should be your autogenerated select cell
    dComplainantFName.Text = row.Cells[1].Text.Replace(" ", ""); // Text in column 1 (the first column of your DataTable)
    dComplainantLName.Text = row.Cells[2].Text.Replace(" ", ""); // Text in column 2 (the second column of your DataTable)
    dComplainantMName.Text = row.Cells[3].Text.Replace(" ", "");
    dComplainantAddress.Text = row.Cells[4].Text.Replace(" ", "");
    dComplainantCity.Text = row.Cells[5].Text.Replace(" ", "");
    dComplainantState.Text = row.Cells[6].Text.Replace(" ", "");
    dComplainantZip.Text = row.Cells[7].Text.Replace(" ", "");
    dComplainantPhone.Text = row.Cells[8].Text.Replace(" ", "");
    storedRecordsGrid.Visible = false;
    }

A: Use the GridView's SelectedIndexChanged event, in the other events like RowCommand or SelectedIndexChanging the SelectedRow property is null. It's also the appropriate event for your requirement:
protected void Grid_SelectedIndexChanged(Object sender, EventArgs e)
{
    var row = ((GridView)sender).SelectedRow;
    var cell1Text = row.Cells[0].Text; // is your autogenerated select cell(String.Empty)
    var cell2Text = row.Cells[1].Text; // Text in column 2 (the first column of your DataTable)
    var cell3Text = row.Cells[2].Text; // Text in column 3 (the second column of your DataTable)
    TextBox1.Text = cell2Text; // etc.
}

Note: If you wouldn't have set AutoGenerateSelectButton to true and have used TemplateFields, you ought to use FindControl on the SelectedRow to get a reference to your controls.
If you still insist on using RowCommand, you could get the selected row from the CommandArgument:
protected void Grid_RowCommand(Object sender, GridViewCommandEventArgs e)
{
    if (e.CommandName == "Select")
    {
        var rowIndex    = int.Parse(e.CommandArgument.ToString())
        var selectedRow = ((GridView)sender).Rows[rowIndex];
        var cell1Text   = selectedRow.Cells[0].Text; // is your autogenerated select cell(String.Empty)
        var cell2Text   = selectedRow.Cells[1].Text; // Text in column 2 (the first column of your DataTable)
    }
}


text:
Q: In completionblock can't change UILabel text Before calling performpost notifyDownloadInfo works but in completionHandler setTextForDownloadInfo calls but the label doesn't updated.
performpost is an asynchronous func that makes request with AFNetworking.
Aclass.m
       +(void)downloadAinformation{
          [self performPost:....... completionHandler:^() {

            [ClassUtil notifyDownloadInfo:@"string"];
            });
        }
        +(void)notifyDownloadInfo:(NSString*)str{

            NSDictionary* userInfo = @{@"text": str};
            [[NSNotificationCenter defaultCenter] postNotificationName:kNotificationDownloadInfoText object:self userInfo:userInfo];

        }

Bclass.m
    - (void)viewDidAppear:(BOOL)animated{

        [super viewDidAppear:animated];

        [[NSNotificationCenter defaultCenter] addObserver:self
                                                 selector:@selector(setTextForDownloadInfo:)
                                                     name:kNotificationDownloadInfoText
                                                   object:nil];
        [self downloadData];
    }

    - (void)setTextForDownloadInfo:(NSNotification*)notification{
        NSString *str = notification.userInfo.allValues.firstObject;
        dispatch_async(dispatch_get_main_queue(), ^{
           self.downloadInfoLabel.text = str;
        });
        NSLog(@"%@",str);
    }

   -(void)downloadData{
      [Bclass downloadAinformation];
    }

I tried to put setTextForDownloadInfo inside it but it doesn't get inside of it:
dispatch_async(dispatch_get_main_queue(), ^{

I also performSelectorOnMainthread and the selector method doesn't get called.
What to do to change the text in completion block after got the response from the function? Thank you.

A: @e.ozmen,
self.downloadInfoLabel.text = str;

does it work?
If so, maybe downloadInfoLabel is not connected in IB?
If not, maybe there is a problem with notification posting, try to change it to
[[NSNotificationCenter defaultCenter] postNotificationName:kNotificationDownloadInfoText
                                                    object:nil
                                                  userInfo:userInfo];

Where parameter 'object' is nil.
Hope it helps :)

A: First thing I would check is to ensure if the str has a correct content. Use NSLog(@"%@", str) right after the cell is created. If the content is correct and you have doubts, that the method might be triggered in background thread, you should try using __block NSString *string = @"Hello World!" to ensure that the string is valid in main thread.
Second thing I would ensure if the label is sat up correctly. If you are using interface builder, double check if the connection between interface builder item and your class is provided correctly. Even more, you should check if the label has a correct frame, no other item overlays it. Maybe subview is not added to main content view for some reason.

A: I get help from this link
Here is my code:
+(void)downloadAinformation{
  [self performPost:....... completionHandler:^() {

     dispatch_queue_t newQueue = dispatch_queue_create("newQueue", nil);
     dispatch_async(newQueue, ^{
                  [ClassUtil notifyDownloadInfo:@"string"];
      });
  });
}

- (void)setTextForDownloadInfo:(NSNotification*)notification{
    NSString *str = notification.userInfo.allValues.firstObject;
    [self performSelectorOnMainThread:@selector(updateLabel:) withObject:str waitUntilDone:YES];
}

- (void)updateLabel:(NSString*)str{
    self.downloadInfoLabel.text = str;
}


text:
Q: assembly function to python I have the following function in ASM :
//edx=0xe,esi=0,edi=user input
push   %rbx
mov    %edx,%eax
sub    %esi,%eax
mov    %eax,%ebx
shr    $0x1f,%ebx
add    %ebx,%eax
sar    %eax
lea    (%rax,%rsi,1),%ebx
cmp    %edi,%ebx
jle    401013 <func4+0x21>
lea    -0x1(%rbx),%edx
callq  400ff2 <func4>
add    %ebx,%eax
jmp    401023 <func4+0x31>
mov    %ebx,%eax
cmp    %edi,%ebx
jge    401023 <func4+0x31>
lea    0x1(%rbx),%esi
callq  400ff2 <func4>
add    %ebx,%eax
pop    %rbx
retq

I tried to convert it into Python:
def L1(eax,ebx):
    eax = eax+ebx
    return (eax+ebx)

def L2(eax,ebx,edi,esi,edx):
    eax = ebx
    if (ebx >= edi):
        L1(eax,ebx)
    else:
        esi = esi+1
        eax = func(edi,esi,edx,eax,ebx)
        L1(eax,ebx)

def func(edi,esi,edx,eax,ebx):
    eax = edx
    eax = eax - esi
    ebx = eax
    ebx = ebx >> 31
    eax = eax + ebx
    eax = eax >> 1
    ebx = eax + esi*1
    if (ebx <= edi):
        eax = ebx
        L1(eax,ebx)
    else:
        edx = ebx-1
        eax = func(edi,esi,edx,eax,ebx)
        L1(eax,ebx)

if __name__ == "__main__":
    for n in range (2,99):
        result=func(n, 0 , 14,0,0)
        if (result==11):
            print (result)

I would really like to know where am I wrong (there are many errors I assume, because it has recursion and many jumps). Many thanks!

A: I agree with the consensus here.  You have to keep in mind regarding reverse engineering particularly down to the assembly level, Python is an interpreted language so if you were to use something like GDB in Linux, you would have to load the whole interpreter.
You can create a py2exe in Windows for example and use IDA to disassemble it.  I think that might be your best bet!


text:
Q: Google Earth Engine: pop-up when clicking on geometry/Feature This may be more of a JavaScript question than a GIS question.
I'm adding feature points to a GEE map (https://code.earthengine.google.com/2d6c3146e5468cb9f14e10039ca22b59). My goal is to map point features from an asset table (which has associated data), and view those data when clicking on the features on the map.
Google Map API has an infowindow function (https://developers.google.com/maps/documentation/javascript/examples/infowindow-simple) but I'm not sure if or how it can be incorporated into a GEE script.
Is it possible to have a pop-up bubble (info window) show up when a feature is clicked? I have looked through GEE guides but couldn't find any function already existing.
Here is an example script:
// Import DEM
var collection = 'WWF/HydroSHEDS/03VFDEM';
var band = 'b1';
var dataset = ee.Image(collection).select(band);
var elevationVis = {
  min: -50.0,
  max: 3000.0,
  gamma: 2.0,
};
// create point geometry (will call an asset in the real script)
var point = ee.Geometry.Point([-61.334, 15.416]);

Map.setCenter(-61.334, 15.416, 10);
Map.addLayer(dataset, elevationVis, collection);
Map.addLayer(point, {}, "acou");

// example from Google Map API
// should be placed earlier in the script but causes GEE to stop runing
var contentString = '
'+
            '
Hello'+
            '
';
var infowindow = new google.maps.InfoWindow({
          content: contentString
        });
var marker = new google.maps.Marker({
          position: point,
          map: map,
          title: 'Uluru (Ayers Rock)' });
        marker.addListener('click', function() {
          infowindow.open(map, marker);
        });

A: This is a bit of a workaround, but you can listen for map clicks and update ui elements based on the results. This only inspects one point, but you could add more to a feature collection. Also, this only updates a label at the top of the map, not at the point:
// Import DEM
var collection = 'WWF/HydroSHEDS/03VFDEM';
var band = 'b1';
var dataset = ee.Image(collection).select(band);
var elevationVis = {
  min: -50.0,
  max: 3000.0,
  gamma: 2.0,
};
// create point geometry (will call an asset in the real script)
var point = ee.Geometry.Point([-61.334, 15.416]);
var feature = ee.Feature(point, {'text_prop': 'Hello!'})

Map.setCenter(-61.334, 15.416, 10);
Map.addLayer(dataset, elevationVis, collection);
Map.addLayer(point, {}, "acou");

// Create a panel and add it to the map.
var inspector = ui.Panel([ui.Label('Click on the point')]);
Map.add(inspector);

Map.onClick(function(coords) {
  // Show the loading label.
  inspector.widgets().set(0, ui.Label({
    value: 'Loading...',
    style: {color: 'gray'}
  }));

  var click_point = ee.Geometry.Point(coords.lon, coords.lat);

  // compute distance, a long running operation
  var computedValue = click_point.distance(feature.geometry())

  computedValue.evaluate(function(result) {
    if (result < 1000) {
      // get the text property, a long running operation
      var lbl = feature.get('text_prop')
      lbl.evaluate(function(result) {
        inspector.widgets().set(0, ui.Label({
          value: 'Text: ' + result,
        }))
      });
    } else {
      inspector.widgets().set(0, ui.Label({
        value: 'Text: ' + 'Clicked to far away',
      }));
    }
  });
});


text:
Q: How to recursively download xsd schema files I am using xsd.exe to create .net classes from a vendor's published schemas.  For some reason, it doesn't allow me to specify the URL of the schema on the command line.  Okay that's lame, but fine, so I download it to the local folder and run it, but there are several xsd:include statements which reference other xsd files at a relative location, which in turn reference still more xsd files.  The include statements look like this:
<xsd:include schemaLocation="otherstuff.xsd"/>

So if I visit each URL for each xsd file one-at-a-time and download them to my local file system, the xsd.exe class creation works, but this is a real pain and I can't help but feel there has got to be a better way.  Is there some functionality to xsd.exe that I am missing, or is there some other method/tool I can use to download an xsd schema and all the referenced xsd files?


text:
Q: Create item without any permissions Pls help me)
I have a list and when user create an item, flow break inheritance read fields and give different permissions via REST API for this item depending on column value. So different users must see different items.
But it takes 2-10 second, and in this time all users can see all items.
One of my idea - create item without any permissions, and then flow gave all permissions.
Or maybe u can advice me better way. Thanks a lot!

A: You can use a helper column. Set its default value to "new" and hide the column from the form. Filter the views to show only items where the helper column is not equal to "new".
Then let the Flow set the helper column to a different value, e.g. "visible" when it breaks the inheritance.
This way, the new item will not show to users until it has been processed by the Flow.

A: Yes, this is generally a problem of relying upon Flow to perform any kind of "lock down".  You never know how long it will be before the Flow gets triggered.  I have even seen it sometimes take up to 15 minutes before an auto-triggered Flow starts running.
So, if you have the option of starting with the most locked down permissions, then have Flow open it up to more access, or alternatively, you can go to List Settings -> Advanced Settings and set the default for users to only see the items they themselves created, then your Flow can change permissions to open it up to more users as appropriate for your business rules.

A: What we can confirm is that it is not possible to create item without permissions.
I recommend that you create a new list, which is just to get the user's data.
Then modify your flow to distribute permissions based on the data that the user fills in in this list.
In this case, the user will not see the important information in the original list


text:
Q: How to disable all NSCursor updates in my application? In my macOS application, I have a custom WebView. When the user moves the mouse cursor over different elements in the WebView's webpage like text, links, etc. (which are implemented as subviews, I think), the cursor updates automatically, based on the type of the element.
My requirement is that I want to set a custom cursor for the WebView (even for my entire application if possible), and not let it change whatsoever, at least till I programmatically change it in some other part of the code. I tried to set the NSCursor in the AppDelegate's applicationDidFinishLaunching: method, but it gets instantly reset.
I have tried many solutions like setting an NSTrackingArea, sending disableCursorRects to both my NSApplication and NSWindow, and even monitoring cursor update events, without much success.
So is there a way to disable all NSCursor updates within my application? I would set it to my custom cursor in applicationDidFinishLaunching: and want it to remain the same as long as the application runs, or I change it in code.

A: You can use a user stylesheet in the WebView to set the default curser for html elements.
WebPreferences *preferences = [[[WebPreferences alloc] initWithIdentifier:@"TestIdentifier"] autorelease];

NSURL *stylesheetURL = [[NSBundle bundleForClass:[self class]] URLForResource:@"yosemite-stylesheet" withExtension:@"css" subdirectory:@"Welcome"];

preferences.userStyleSheetEnabled = YES;
preferences.userStyleSheetLocation = stylesheetURL;

self.webView.preferences = preferences;

A: Found a solution that worked for me! Here's how I did it:
Subclass NSView and override the resetCursorRects method, in which send addCursorRect:cursor: with its bounds as the cursor rect and the required cursor (described here). Then make an instance of this custom NSView with the same frame as the WebView, and add it to the later as a subview. This will act as a transparent overlay over the WebView. It affects only the cursor and does not interfere with mouse clicks or keypresses.
Here's the code in PyObjC (the concept should apply in Objective C as well):
# Overlay View (NSView subclass)
class OverLayView(AppKit.NSView):
   def resetCursorRects(self):
       self.addCursorRect_cursor_(self.bounds(), my_custom_cursor)

# In my main class
    ...
    self.overlay = OverLayView.alloc().initWithFrame_(self.webview.bounds())
    self.webview.addSubview_(self.overlay)
    ...

If I ever want to reset the cursor back to auto, I can just remove this overlay view, or even better, set it temporarily hidden by sending it the setHidden: message:
self.overlay.setHidden_(Foundation.YES)

Some additional things to note:

*

*Using an NSTrackingArea instead of the cursor rect doesn't seem to work well. For me it didn't.

*I had tried the above method on the custom WebView itself, but it didn't work. The WebView's default tracking areas/cursor rects always interfere. Adding a subview on top of it blocks this behaviour, as the above code does.

*Finally the overlay view should be a subview of the WebView. If both are sibling views of the same superview, Cocoa doesn't guarantee which one will be on top of the other.

If someone has a better solution, or can improve this one, feel free to post it.
Hope this helps someone!


text:
Q: What are el and $el in backbone's view? I'm trying to avoid wrapping with empty div when render view in backbone.
I do it with the following code
this.$el.replaceWith(this.template(this.model.attributes));
return this;

but I get empty div when I append this view by
$("#product-pannel").append(productsView.render().el);

someone give the solution like this
render: function(){
    var html = this.template(this.model.toJSON()));
    var newElement = $(html)
    this.$el.replaceWith(newElement);
    this.setElement(newElement);
    return this;
}

but I can't understand why should I do this so complicatedly above
can someone tell me the mystery of el an $el?

A: el points to the the view element (the one that holds rest of template) and $el is a jQuery object represeting el element So that you don't have to do $(this.el) all the time.
This is clearly mentioned in the documentation.
You can either specify an existing DOM element as the view element using el option, or backbone creates a DOM element for every view. By default this will be a <div>. If you don't want an empty <div>, customize the element backbone creates as the top level element of your view template using options like tagName, attributes etc.
setElement is for dynamically changing the view element to something else... I've rarely (or never) seen it actually being used.


text:
Q: Cannot resolve files when importing them Google API's I'm developing a Glassware for Google Glass. I'm trying to import these files:
import com.google.api.client.json.jackson.JacksonFactory;
import com.google.api.services.oauth2.Oauth2;
import com.google.api.services.oauth2.model.Userinfo;

but I'm getting errors on them. They are below:
The import com.google.api.client.json.jackson cannot be resolved
The import com.google.api.services.oauth2 cannot be resolved
The import com.google.api.services.oauth2 cannot be resolved

I'm not sure why I'm getting these errors. I'm building off of the quickstart java project. My Maven Dependencies are below:
C:\Users\Family3\.m2\repository\com\google\apis\google-api-services-mirror\v1-rev20-1.16.0-rc\google-api-services-mirror-v1-rev20-1.16.0-rc.jar
C:\Users\Family3\.m2\repository\com\google\api-client\google-api-client\1.16.0-rc\google-api-client-1.16.0-rc.jar
C:\Users\Family3\.m2\repository\com\google\oauth-client\google-oauth-client\1.16.0-rc\google-oauth-client-1.16.0-rc.jar
C:\Users\Family3\.m2\repository\com\google\http-client\google-http-client-jackson2\1.16.0-rc\google-http-client-jackson2-1.16.0-rc.jar
C:\Users\Family3\.m2\repository\com\google\http-client\google-http-client\1.16.0-rc\google-http-client-1.16.0-rc.jar
C:\Users\Family3\.m2\repository\com\google\code\findbugs\jsr305\1.3.9\jsr305-1.3.9.jar
C:\Users\Family3\.m2\repository\org\apache\httpcomponents\httpclient\4.0.1\httpclient-4.0.1.jar
C:\Users\Family3\.m2\repository\org\apache\httpcomponents\httpcore\4.0.1\httpcore-4.0.1.jar
C:\Users\Family3\.m2\repository\xpp3\xpp3\1.1.4c\xpp3-1.1.4c.jar
C:\Users\Family3\.m2\repository\com\fasterxml\jackson\core\jackson-core\2.1.3\jackson-core-2.1.3.jar
C:\Users\Family3\.m2\repository\org\mortbay\jetty\jetty\6.1.14\jetty-6.1.14.jar
C:\Users\Family3\.m2\repository\org\mortbay\jetty\servlet-api-2.5\6.1.14\servlet-api-2.5-6.1.14.jar
C:\Users\Family3\.m2\repository\org\mortbay\jetty\jetty-util\6.1.14\jetty-util-6.1.14.jar
C:\Users\Family3\.m2\repository\org\mortbay\jetty\jetty-plus\6.1.14\jetty-plus-6.1.14.jar
C:\Users\Family3\.m2\repository\geronimo-spec\geronimo-spec-jta\1.0.1B-rc4\geronimo-spec-jta-1.0.1B-rc4.jar
C:\Users\Family3\.m2\repository\org\mortbay\jetty\jsp-2.1\6.1.14\jsp-2.1-6.1.14.jar
C:\Users\Family3\.m2\repository\org\eclipse\jdt\core\3.1.1\core-3.1.1.jar
C:\Users\Family3\.m2\repository\ant\ant\1.6.5\ant-1.6.5.jar
C:\Users\Family3\.m2\repository\org\mortbay\jetty\jsp-api-2.1\6.1.14\jsp-api-2.1-6.1.14.jar
C:\Users\Family3\.m2\repository\org\apache\commons\commons-lang3\3.1\commons-lang3-3.1.jar
C:\Users\Family3\.m2\repository\org\codehaus\jackson\jackson-core-asl\1.9.11\jackson-core-asl-1.9.11.jar
C:\Users\Family3\.m2\repository\org\codehaus\jackson\jackson-mapper-asl\1.9.11\jackson-mapper-asl-1.9.11.jar
C:\Users\Family3\.m2\repository\javax\servlet\servlet-api\2.5\servlet-api-2.5.jar
C:\Users\Family3\.m2\repository\commons-logging\commons-logging\1.1.2\commons-logging-1.1.2.jar
C:\Users\Family3\.m2\repository\commons-codec\commons-codec\1.7\commons-codec-1.7.jar
C:\Users\Family3\.m2\repository\com\google\guava\guava\14.0.1\guava-14.0.1.jar

Why am I getting these errors? Am I not importing a .jar? I can't find any .jar's that aren't included that should be, but there could be one. Thank you for your help.

A: Add the client libraries to the project.
See download and setup instructions for google-api-java-client.

A: try adding:
<dependency>
   <groupId>com.google.apis</groupId>
   <artifactId>google-api-services-oauth2</artifactId>
   <version>{version}</version>
</dependency>


text:
Q: How can I create a both-sided chat box in PyQt5? How can I create a both-sided chat message box, that will look like normal messenger, in PyQt?
As an example - my friend's msg should be on the left side and my msg should be on the right side of the chat box.
Screenshoot as example


text:
Q: POST request works in browser but NOT in Postman. SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'name' cannot be null I'm writing Laravel -AngularJS app ,and a post method that I'm calling is passing in browser the data gets updated and in Postman I get the error
SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'name' cannot be null
The databse is also updated ,-I checked it with

artisan tinker
  .

My code can be found here AngularJS won't display (parse) data that is delivered with $http.get in Laravel5 ,with index.php that is changed like this :
<!DOCTYPE html>

<meta charset="UTF-8">
  <title>Welcome </title>

  <link rel="stylesheet" href="//netdna.bootstrapcdn.com/bootstrap/3.1.0/css/bootstrap.min.css">
  <link rel="stylesheet" href="//netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.min.css">

  <form name="newForm" ng-submit="submitUser1()">

      <input type="text" class="form-control input-sm" name="name" ng-model="user1Data.name" placeholder="Name" required>

      <input type="email" class="form-control input-lg" name="email" ng-model="user1Data.email" placeholder="Email" required>

      <input type="tel" class="form-control input-lg" name="phon_number" ng-model="user1Data.phone_number" placeholder="Phone_number" required>

      <button type="submit" class="btn btn-primary btn-lg" >Register</button>

  </form>

 {{ user1.name }} , {{ user1.email }}

{{ user1.phone_number }}

A: I have solved this.
I have changed method  USer1Controller.php from this:
   public function store(Request $request) {
        User1::create([
            'name' => $request->input('name'),
            'email' => $request->input('email'),
            'phone_number' => $request->input('phone_number')
        ]);
        return response()->json(['success' => true]);
    }

to that :
public function store(Request $request)
{
        $this->validate($request , [
            'name' =>'required' ,
            'email' =>'required' ,
            'phone_number' =>'required' ,
            ]);

        $user= new User1;
        $user->name = $request->name;
        $user->email =  $request->email;
        $user->phone_number =  $request->phone_number;
        $user->save();

    return response()->json(['success' => true]);

}


text:
Q: Spring Batch - Connection Refused in some Unit Tests If I run all(31) the unit test together, I get following connection error in 2 - 3 unit tests, however if I run those tests individually, the run successfully. Can you please guide me on this strange behaviour. I am using Spring 3.0.6, Spring batch 2.1.7 and Oracle XE database.
below is the error

    java.lang.IllegalStateException: Failed to load ApplicationContext
    at org.springframework.test.context.TestContext.getApplicationContext(TestContext.java:308)
    at org.springframework.test.context.support.DependencyInjectionTestExecutionListener.injectDependencies(DependencyInjectionTestExecutionListener.java:109)
    at org.springframework.test.context.support.DependencyInjectionTestExecutionListener.prepareTestInstance(DependencyInjectionTestExecutionListener.java:75)
    at org.springframework.test.context.TestContextManager.prepareTestInstance(TestContextManager.java:321)
    at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.createTest(SpringJUnit4ClassRunner.java:211)
    at org.springframework.test.context.junit4.SpringJUnit4ClassRunner$1.runReflectiveCall(SpringJUnit4ClassRunner.java:287)
    at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
    at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.methodBlock(SpringJUnit4ClassRunner.java:289)
    at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:231)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
    at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)
    at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)
    at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)
    at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)
    at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)
    at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61)
    at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:70)
    at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
    at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:174)
    at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
    at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:290)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:192)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:585)
    Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'jobRepository' defined in class path resource [simple-job-launcher-context.xml]: Invocation of init method failed; nested exception is org.springframework.jdbc.support.MetaDataAccessException: Could not get Connection for extracting meta data; nested exception is org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get JDBC Connection; nested exception is java.sql.SQLRecoverableException: IO Error: The Network Adapter could not establish the connection
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1420)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:293)
    ... 40 more
    Caused by: org.springframework.jdbc.support.MetaDataAccessException: Could not get Connection for extracting meta data; nested exception is org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get JDBC Connection; nested exception is java.sql.SQLRecoverableException: IO Error: The Network Adapter could not establish the connection
    at org.springframework.jdbc.support.JdbcUtils.extractDatabaseMetaData(JdbcUtils.java:293)
    at org.springframework.jdbc.support.JdbcUtils.extractDatabaseMetaData(JdbcUtils.java:320)
    ... 47 more
Caused by: org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get JDBC Connection; nested exception is java.sql.SQLRecoverableException: IO Error: The Network Adapter could not establish the connection
    at org.springframework.jdbc.datasource.DataSourceUtils.getConnection(DataSourceUtils.java:80)
    at org.springframework.jdbc.support.JdbcUtils.extractDatabaseMetaData(JdbcUtils.java:280)
    ... 52 more
    Caused by: java.sql.SQLRecoverableException: IO Error: The Network Adapter could not establish the connection
    at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:419)
    at oracle.jdbc.driver.PhysicalConnection.(PhysicalConnection.java:536)
              .............
    at org.apache.commons.pool.impl.GenericObjectPool.borrowObject(GenericObjectPool.java:840)
    at org.apache.commons.dbcp.PoolingDataSource.getConnection(PoolingDataSource.java:96)
    at org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.java:880)
    at org.springframework.jdbc.datasource.DataSourceUtils.doGetConnection(DataSourceUtils.java:111)
    at org.springframework.jdbc.datasource.DataSourceUtils.getConnection(DataSourceUtils.java:77)
    ... 53 more
    Caused by: oracle.net.ns.NetException: The Network Adapter could not establish the connection
    at oracle.net.nt.ConnStrategy.execute(ConnStrategy.java:375)
    ..............
    at oracle.jdbc.driver.T4CConnection.connect(T4CConnection.java:1054)
    at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:308)
    ... 64 more
Caused by: java.net.ConnectException: Connection refused: connect
    at java.net.PlainSocketImpl.socketConnect(Native Method)
                 ............................
    at oracle.net.nt.ConnOption.connect(ConnOption.java:123)
    at oracle.net.nt.ConnStrategy.execute(ConnStrategy.java:353)
    ... 69 more

A: Something like this happened to me before. It was solved when I changed the IP of the database from 127.0.0.1 to 192.168.1.27 (the IP of my computer in my network, it can be found doing ip config in windows or ifconfig in linux). It might not be a permanent solution, but it dodges a bullet.

A: Just had the same issue:
Root cause:
All available connections spent
Solution:
Closing the connection after use.


text:
Q: How do you make the Chrome Developer Tools only show your console.log? It adds logs when plugins say something. It adds logs when it gets anything from the cache manifest. It logs HTTP information sometimes.
My 1 little log gets flooded by 10,000 logs I don't need or want.

A: Use only in development:
(function(){
    var originalConsole = window.console;

    window.console = {};
    window.console.log = window.console.debug = window.console.error = function(){};

    window.myLog = function() {
        originalConsole.log.apply(originalConsole, arguments);
    };
}());

This will save a local copy of the original window.console object.
It will change the original window.console object to use empty functions.
And finally it will define a global myLog function which will use the local copy of the original window.console to actually log stuff.
This way all the other code will use the useless console.log() and your code could use myLog().

A: on the Console tab select No info on the left Hand I have attached a screenshot here
You should update to the google chrome latest version


text:
Q: $\phi(X)$ is essential and $\psi \circ \phi$ is injective then $\psi$ is injective. Let $R$ be a commutative ring, and $M$ an $R$-module.
An $R$-submodule $N$ of $M$ is said to be essential if for any $R$-submodule $U$, $U \cap N = \{ 0 \}$ then $U = \{ 0 \}$.
My problem is the following:

Let $\phi:X \rightarrow Y, \psi:Y \rightarrow Z$ be homomorphisms of $R$-modules.
  Suppose that $\phi(X)$ is essential and $\psi \circ \phi$ is injective.
  Prove that $\psi$ is injective.

My attempt: Assume that we have $\psi(y_1)=\psi(y_2)$ for some $y_1,y_2 \in Y$. Note that $\phi(X)$ is essential, by statement in here there exist $r_1,r_2 \in R\setminus\{0\}$ such that $r_1y_1=\phi(x_1), r_2y_2=\phi(x_2)$ for some $x_1,x_2 \in X$. It follows that,
$$\psi \circ \phi(r_2x_1)=r_2\psi \circ \phi(x_1)=r_2\psi(r_1y_1)=r_1r_2\psi(y_1)=r_1r_2\psi(y_2)=r_1\psi \circ \phi(x_2)=\psi \circ \phi(r_1x_2).$$
So the injectivity of $\psi \circ \phi$ implies that $r_2x_1=r_1x_2$. Thus,
$$r_1r_2y_1=r_2\phi(x_1)=r_1\phi(x_2)=r_1r_2y_2.$$
We conclude that $y_1=y_2$(?) i.e. $\psi$ is injective.
It seems a fake proof because $r_1r_2$ may not a unit of $R$ in general. Does this approach help me closer the actual proof? Thanks for looking at it.

A: Hint:
$$\ker(\psi\circ\phi)=\phi^{-1}(\ker\psi)=\phi^{-1}\bigl(\ker\psi\cap\phi(X)\bigr).$$


text:
Q: Create an API to access google spreadsheet I want to make a google spreadsheet available to a remote user. This user wants to use API requests to access the spreadsheet. What is the best way to implement?
Using Web app or using Execution API?

A: If the spreadsheet is not protected, you can easily access it using Spreadsheet's openById.
 var ss = SpreadsheetApp.openById("abc1234567");
 Logger.log(ss.getName());


text:
Q: How can we make OOTB Component Attribute optional in Child component in SmartEdit? Is there any way to make OOTB Component field optional in Child component in SmartEdit ?
For example, I extended CMSParagraphComponent by creating child component e.g. MyCustomParagraphComponent which extends CMSParagraphComponent.
OOTB CMSParagraphComponent -> content attribute is mandatory as defined in its CMS Structure API
<bean class="de.hybris.platform.cmsfacades.types.service.impl.DefaultComponentTypeAttributeStructure" p:typecode="CMSParagraphComponent" p:qualifier="content">
    <property name="populators">
        <set>
            <ref bean="richTextComponentTypeAttributePopulator" />
            <ref bean="requiredComponentTypeAttributePopulator" />
        </set>
    </property>
</bean>

requiredComponentTypeAttributePopulator makes this attribute mandatory. In addition, OOTB SmartEdit using cmsParagraphComponentValidator as well for backend validation.
Now I want to make content attribute optional for my custom MyCustomParagraphComponent
I tried creating new populator bean unRequiredComponentTypeAttributePopulator with required=false and assign it to content attribute of my custom component but that doesn't work
Trying something like this ...
<bean id="unRequiredComponentTypeAttributePopulator" class="de.hybris.platform.cmsfacades.types.populator.RequiredComponentTypeAttributePopulator">
    <property name="required" value="false" />
</bean>

<bean class="de.hybris.platform.cmsfacades.types.service.impl.DefaultComponentTypeAttributeStructure" p:typecode="PromotionalBannerComponent" p:qualifier="content">
    <property name="populators">
        <set>
            <ref bean="unRequiredComponentTypeAttributePopulator" />
        </set>
    </property>
</bean>

But this is not working. It look like CMS Structure API works on only those attribute assigned directly to that component not parent one.
Then what is the correct way to do that ?

A: In your custom "facade-spring.xml", define the bean:
<bean id="optionalComponentTypeAttributePopulator"  class="de.hybris.platform.cmsfacades.types.populator.RequiredComponentTypeAttributePopulator">
    <property name="required" value="false" />
</bean>

Now, in your custom "facade-spring.xml", try overriding the bean of the Out of the Box:
<bean class="de.hybris.platform.cmsfacades.types.service.impl.DefaultComponentTypeAttributeStructure" p:typecode="CMSLinkComponent" p:qualifier="product">
    <property name="populators">
        <set>
            <ref bean="optionalComponentTypeAttributePopulator" />
        </set>
    </property>
</bean>

I have tested this locally and it works perfectly.


text:
Q: How to get custom taxonomy terms based on another taxonomy? How to list out all the terms of a custom taxonomy that are relative in another custom taxonomy?
I am creating a filter page for a CPT with multiple custom taxonomies.
Please see the screenshot below:

*

*Custom Post Type: English "cpt_english"

*Custom Taxonomy: Courses

*Terms: course-a, course-b, course-c

*Custom Taxonomy: Difficulties

*Terms: easy, advanced , pro

*Custom Taxonomy: Tasks "tasks"

*Terms: task1, task2, task3, task4

The screen is html markup, not php generated code.
Question:
How can I list out all the terms of a taxonomy based on another taxonomy?
For example, The type: "Task 1" has "Difficulty": Easy, Advanced, Pro"
But "Task 2"   only has "Easy" and "Pro" ... so when clicking Task2, I do not want to show "Advanced" there, and Task 3 doesn't even has "Courses"... how can I achieve it with coding?
So what I meant is that, amount all the CPT that are associated with "Task1"(term name) of a custom taxonomy "task", these posts are also associated with term "easy", "advanced" and "pro" from another taxonomy "difficulty"
However, amount the CPT items associated with "Task2", none of them are associated with "advanced" ... so I do not want to list out "advanced" there
I know I can use "get_terms" and then "foreach" to list out all the terms of a taxonomy.
But how I can "get_terms of taxonomy_a based on taxonomy_b" ?

A: I am assuming your custom taxonomy is hierarchal and you are attempting to get the children within the hierarchy. If so this previous answer may help
Get the children of the parent category
And this wp func: https://developer.wordpress.org/reference/functions/get_term_children/

A: Based on your problem, I researched and found the solution.
https://stackoverflow.com/a/69483006/15424153
It works


text:
Q: assert() vs enforce(): Which to choose? I'm having a hard time choosing whether I should "enforce" a condition or "assert" a condition in D. (This is language-neutral, though.)
Theoretically, I know that you use assertions to find bugs, and you enforce other conditions in order to check for atypical conditions. E.g. you might say assert(count >= 0) for an argument to your method, because that indicates that there's a bug with the caller, and that you would say enforce(isNetworkConnected), because that's not a bug, it's just something that you're assuming that could very well not be true in a legitimate situation beyond your control.
Furthermore, assertions can be removed from code as an optimization, with no side effects, but enforcements cannot be removed because they must always execute their condition code. Hence if I'm implementing a lazy-filled container that fills itself on the first access to any of its methods, I say enforce(!empty()) instead of assert(!empty()), because the check for empty() must always occur, since it lazily executes code inside.
So I think I know that they're supposed to mean. But theory is easier than practice, and I'm having a hard time actually applying the concepts.
Consider the following:
I'm making a range (similar to an iterator) that iterates over two other ranges, and adds the results. (For functional programmers: I'm aware that I can use map!("a + b") instead, but I'm ignoring that for now, since it doesn't illustrate the question.) So I have code that looks like this in pseudocode:
void add(Range range1, Range range2)
{
    Range result;
    while (!range1.empty)
    {
        assert(!range2.empty);   //Should this be an assertion or enforcement?
        result += range1.front + range2.front;
        range1.popFront();
        range2.popFront();
    }
}

Should that be an assertion or an enforcement? (Is it the caller's fault that the ranges don't empty at the same time? It might not have control of where the range came from -- it could've come from a user -- but then again, it still looks like a bug, doesn't it?)
Or here's another pseudocode example:
uint getFileSize(string path)
{
    HANDLE hFile = CreateFile(path, ...);
    assert(hFile != INVALID_HANDLE_VALUE); //Assertion or enforcement?
    return GetFileSize(hFile); //and close the handle, obviously
}
...

Should this be an assertion or an enforcement? The path might come from a user -- so it might not be a bug -- but it's still a precondition of this method that the path should be valid. Do I assert or enforce?
Thanks!

A: I'm not sure it is entirely language-neutral. No language that I use has enforce(), and if I encountered one that did then I would want to use assert and enforce in the ways they were intended, which might be idiomatic to that language.
For instance assert in C or C++ stops the program when it fails, it doesn't throw an exception, so its usage may not be the same as what you're talking about. You don't use assert in C++ unless you think that either the caller has already made an error so grave that they can't be relied on to clean up (e.g. passing in a negative count), or else some other code elsewhere has made an error so grave that the program should be considered to be in an undefined state (e.g. your data structure appears corrupt). C++ does distinguish between runtime errors and logic errors, though, which may roughly correspond but I think are mostly about avoidable vs. unavoidable errors.
In the case of add you'd use a logic error if the author's intent is that a program which provides mismatched lists has bugs and needs fixing, or a runtime exception if it's just one of those things that might happen. For instance if your function were to handle arbitrary generators, that don't necessarily have a means of reporting their length short of destructively evaluating the whole sequence, you'd be more likely consider it an unavoidable error condition.
Calling it a logic error implies that it's the caller's responsibility to check the length before calling add, if they can't ensure it by the exercise of pure reason. So they would not be passing in a list from a user without explicitly checking the length first, and in all honesty should count themselves lucky they even got an exception rather than undefined behavior.
Calling it a runtime error expresses that it's "reasonable" (if abnormal) to pass in lists of different lengths, with the exception indicating that it happened on this occasion. Hence I think an enforcement rather than an assertion.
In the case of filesize: for the existence of a file, you should if possible treat that as a potentially recoverable failure (enforcement), not a bug (assertion). The reason is simply that there is no way for the caller to be certain that a file exists - there's always someone with more privileges who can come along and remove it, or unmount the entire fielsystem, in between a check for existence and a call to filesize. It's therefore not necessarily a logical flaw in the calling code when it doesn't exist (although the end-user might have shot themselves in the foot). Because of that fact it's likely there will be callers who can treat it as just one of those things that happens, an unavoidable error condition. Creating a file handle could also fail for out-of-memory, which is another unavoidable error on most systems, although not necessarily a recoverable one if for example over-committing is enabled.
Another example to consider is operator[] vs. at() for C++'s vector. at() throws out_of_range, a logic error, not because it's inconceivable that a caller might want to recover, or because you have to be some kind of numbskull to make the mistake of accessing an array out of range using at(), but because the error is entirely avoidable if the caller wants it to be - you can always check the size() before access if you have no other way of knowing whether your index is good or not. And so operator[] doesn't guarantee any checks at all, and in the name of efficiency an out of range access has undefined behavior.

A: assert should be considered a "run-time checked comment" indicating an assumption that the programmer makes at that moment. The assert is part of the function implementation. A failed assert should always be considered a bug at the point where the wrong assumption is made, so at the code location of the assert. To fix the bug, use a proper means to avoid the situation.
The proper means to avoid bad function inputs are contracts, so the example function should have a input contract that checks that range2 is at least as long as range1. The assertion inside the implementation could then still remain in place. Especially in longer more complex implementations, such an assert may inprove understandability.
An enforce is a lazy approach to throwing runtime exceptions. It is nice for quick-and-dirty code because it is better to have a check in there rather then silently ignoring the possibility of a bad condition. For production code, it should be replaced by a proper mechanism that throws a more meaningful exception.

A: I believe you have partly answered your question yourself. Assertions are bound to break the flow. If your assertion is wrong, you will not agree to continue with anything. If you enforce something you are making a decision to allow something to happen based on the situation. If you find that the conditions are not met, you can enforce that the entry to a particular section is denied.


text:
Q: Javascript regex to extract all characters between quotation marks following a specific word I have the text:
s.events="event3"
s.pageName="Forum: Index"
s.channel="forum"
s.prop1="Forum: Index"
s.prop2="Index Page"
s.prop36=""
s.prop37=""
s.prop38=""
s.prop39=""
s.prop40="53"
s.prop41="Anonymous"
s.prop42="username"
s.prop43=""
s.prop47=""
s.eVar1="Forum: Index"
s.eVar2="Index Page"
s.eVar36=""
s.eVar37=""

saved in a var in javascript and I want to extract the text between the quotes of s.prop42 giving me the result:
"username"

what I have right now is
    var regex = /\?prop.42="([^']+)"/;
    var test = data.match(regex);

but it doesnt seem to work, can someone help me out?

A: Use this:
var myregex = /s\.prop42="([^"]*)"/;
var matchArray = myregex.exec(yourString);
if (matchArray != null) {
    thematch = matchArray[1];
}

In the regex demo, look at the capture group in the right pane.
Explanation

*

*s\.prop42=" matches s.prop42=" (but we won't retrieve it)

*The parentheses in ([^"]*) capture any chars that are not a "  to Group 1: this is what we want

*The code gets the Group 1 capture

A: Can't comment on above answer, but I think the regex is better with .* like so:
var myregex = /s\.prop42="(.*)"/;
var matchArray = myregex.exec(yourString);
if (matchArray != null) {
    thematch = matchArray[1];
}


text:
Q: What is the importance of : $I$ is a quasi-convex functional which is lower semi-continuous and $B$ is convex, closed in measure? Let $(E,\mathcal{A},\mu)$ be a finite measure space and  $(X,\|.\|)$ be a reflexive Banach space. The en set of all Bochner-integrable function from $E$ to $X$ is denoted by $\mathcal{L}_{X}^{1}$
Suppose that $I:\mathcal{L}_{X}^{1}\to (-\infty,+\infty]$ is a quasi-convex functional  which is lower semi-continuous in measure and that $B\in \mathcal{L}_{X}^{1}$ is convex, closed in measure and uniformly bounded in $\mathcal{L}^{1}$-norm.
Show that $I$ attains its minimum on $B$.
Hint. Apply the following theorem :

Suppose that $ (f_n)_{n\geq 1} \subset \mathcal {L}_{X}^1$ is a seqsequence  with : $$\sup_n \int_{E}{\|f_n\| d\mu} < \infty .$$Then there exist $ h _{\infty} \in  \mathcal {L}_{X}^1 $ and a subsequence $ (g_k)_k $ of $(f_n)_n $  such that for every subsequence $ (h_m)_m $ of $(g_k)_k$ : $$ \frac{1}{n}\sum_{j=1}^{n}{h_j}\underset{n}{\to}  h _{\infty} ~~~~~~\text{weakly in}~X~~\text{ a.e.}$$

Proof :
Let $m:= \inf_{f\in B}I(f)$. We know that by definition of the infimum, for all positive integer $n$, there exists a function $f_n\in B$ such that $I(f_n)< m+n^{-1}$. The assumptions on $B$ show that $\sup_n \int_{E}{\|f_n\| d\mu} < \infty .$ Then it remains to check that the function $h_\infty$ given by the hint does the job, that is, that $h_\infty$ is in $B$ and $I(h_\infty)=m$.
My problem :
What is the importance of : " $I$ is a quasi-convex functional which is lower semi-continuous and $B$ is convex, closed in measure " in convex optimization?


text:
Q: Deploying Nodejs app on the windows server I am building an realtime chat application with server side Noe and client side angular with socket.io. As i am new to Node, I jave not deployed any Node App before.. I am very confused on how to host my app on a windows server...
Step by step guide will be really helpful..

A: Please follow this article to get going. Primary requirement to run your Node.js app on Windows is the iisnode module. If you follow the instructions carefully, you can get it working pretty quickly. iisnode module takes care of all the life cycle of the node.js app on Windows IIS.


text:
Q: Replace  tag with its src attribute that have another attribute this:
$text = '

';

$pattern = '//i'; //<--the problem
$replace = preg_replace($pattern, '$2', $text);
echo $replace;

give me:
http://exmple.com/apple.png" id="apple
http://exmple.com/lemon.png
http://exmple.com/banana.png" class="fruit

All I need just replace them with their src value; like this:
http://exmple.com/apple.png
http://exmple.com/lemon.png
http://exmple.com/banana.png

Got hours on codepad, but still have no desired $pattern; I got similiar question before but didn't work; I'm not good at all on ragex logic, so I need help, please.

A: You have an extra . in your string.
// This:
$pattern = '//i';

// Not this:
$pattern = '//i';

However, rather that doing a weird replace to remove the parts you don't want, I'd consider pulling out the parts you do want and printing them instead.
$matches = array();
preg_match_all('/<img.*?src="([^"]*)"/i', $text, $matches);
echo implode("\n", $matches[1]);


text:
Q: Nodejs uncaughtException event not fired if exception occurred inside express handler I have caught uncaughtException event in my nodejs app to write a log when an exception occurred.
process.on('uncaughtException', (err) => {
    log.warn('Caught exception. Exiting. error: ' + err + ', stack: ' + err.stack);
    process.exit(1);
});

But, above handler is not called when an exception is thrown inside an express event handler.
someInvalidFunc();    //This causes the uncaughtException handler to get called.

app.all('/ping', function (req, res, next) {
    someInvalidFunc();  //This doesn't cause the uncaughtException handler to get called.
    res.status(200).json({status: 'OK'});
});

Even though the handler is not called, the error is printed to console.

Error: ReferenceError: someInvalidFunc is not defined

What is the reason for this? How can I catch all unhandled exceptions in the app?

A: If you are using express, the uncaughtException callback won't be even triggered as express provides a default error handler that catches error from the controller and sends 500 as a response.
You can override the error handler.
This is explained in the docs:
https://expressjs.com/en/guide/error-handling.html