text:
Q: definition of image and preimage Claim: Suppose $f : A \to B$ and $S$ and $T$ are subsets of $A$. Prove that if $S \subseteq T$ then $f(S) \subseteq f(T)$.
Proof. Suppose $f : A \to B$, $S$ and $T$ are subsets of $A$ and $S \subseteq T$. Let $y \in f(S)$. Then there is $x \in S$ such that $y = f(x)$. Since $S \subseteq T$, $x \in T$. So there is $x \in T$ such that $y = f(x)$, and therefore $y \in f(T)$ by definition of image. Since $y$ was an arbitrary element of $f(S)$, we have $f(S) \subseteq f(T)$.
However, I do NOT understand why "Let $y \in f(S)$. Then there is $x \in S$ such that $y = f(x)$" or "there is $x \in T$ such that $y = f(x)$,and therefore $y \in f(T)$ by definition of image" is true? How exactly is the definition of image/preimage applied to those to statements?

A: Given a function $f : A \to B$ and a subset $U \subseteq A$, the image $f(U)$ of $U$ is defined by
$$f(U) = \{ f(x) \mid x \in U \} = \{ y \in B \mid y=f(x) \text{ for some } x \in U \}$$
So here you just need to apply the definition. If $y \in f(S)$ then $y=f(x)$ for some $x \in S$; this is just the definition of $f(S)$. Since $S \subseteq T$, it follows that $x \in T$. But then $y=f(x)$ and $x \in T$ so that $y \in f(T)$ again by definition of image.
Sorry if I'm just rewording your problem, but the thing you don't understand really is just the definition of image.


text:
Q: Hensel lifting when not a power of a prime Say you have the equation $x^2 + x + 47 = 0$ and that you want to determine the solutions in $\mathbb{Z}/1715 \mathbb{Z}$. Note that $1715 = 7^3 \cdot 5$. Then, using Hensel's lemma, one can find the solutions mod $343$. That's the good news. The bad is that I now have a problem with calculating the inverse. Here's a quick summary of my previous calculations:
$f(1) = 0$ in mod $7$, and Hensel gives $x_1 = 99 \mod 343$, which is a root of $f(x)$ in $\mathbb{Z}/ 343 \mathbb{Z}$. But if I now work in modulo $5$, and if $x_2 = x_1 + 343t$, then the calculation of $t$ leads us to $$t = - \frac{f(x_1)}{343}f'(99)^{-1} = 29 \cdot (199)^{-1}.$$
The problem is that $199$ doesn't have an inverse in $\mathbb{Z}/1715 \mathbb{Z}$. So ... What now? Does it simply mean that there doesn't exist a root in $\mathbb{Z}/1715 \mathbb{Z}$ when starting with $f(1) = 0$ (in mod $7$)?

A: What's wrong with solving modulo $343$ and modulo $5$ separately, and then using the Chinese remainder theorem?

redpajama_set_name: RedPajamaStackExchange


text:
Q: pass variables to post method with ajax Hello I am trying to pass 2 variables from select menu to ajax POST code.
here is the select menu:
<?php echo "<select name='status' id='$id' idc='$idc'>" ?>

here I am not sure if this is alowed to be declared like this. I mean put variables inside the select menu.
where the variables are declared before like that:
$idc = $row['userID'];

So this is whee I am sendind the variables to the POST method
selectstatus = $("select[name=status]").val();
var id = $(this).attr('$id');
var idc = $(this).attr('$idc');
$.ajax({
    type: "POST",
    url: "selectbackend.php",
    data: {"selectstatus": selectstatus, "id": id, "idc": idc},

some kind it is not passing anything at all. where might be the problem ?

A: var sel = $("select[name='status']");
var id = sel.attr('id');
var idc = sel.attr('idc');
$.ajax({
    type: "POST",
    url: "selectbackend.php",
    data: {"selectstatus": sel.val(), "id": id, "idc": idc}
});

A: Using html5 you can define custom attributes starting with data-
<?php echo "<select name='status' id='$id' data-idc='$idc'>" ?>

While on client side you can get the values as below
    var  selectstatus = $("select[name=status] option:selected").val();
            var id = $("select[name=status]").attr('id');
            var idc =$("select[name=status]").attr('data-idc');
            $.ajax({
            type: "POST",
            url: "selectbackend.php",
            data: {"selectstatus": selectstatus, "id": id, "idc": idc
           }
           });

Suggestion : May be need to make ajax request on some event like onchange

A: You are looking for the attribute names '$id' and '$idc', but your attributes are called 'id' and 'idc', so the id and idc variables will be undefined.
This should do the trick:
selectstatus = $("select[name=status]").val();
var id = $(this).attr('id'); // id, not $id
var idc = $(this).attr('idc'); // idc, not $idc
$.ajax({
    type: "POST",
    url: "selectbackend.php",
    data: {"selectstatus": selectstatus, "id": id, "idc": idc },
    // ...
});


text:
Q: Flex content does not fit height of the parent content I have the following layout, it is a wrapper (content) which contains some other divs which also have some flex properties.
As you can see from the following link the divs inside content are now scaling up with the size of the content.

.content {
  width: 100%;
  height: 400px;
  display: flex;
  overflow: auto;
  background-color: blue;
}

.a {
  width: 165px;
  height: 100%;
  flex-grow: 1;
  background-color: red;
}

.b {
  width: 65px;
  display: flex;
  padding-top: 20px;
  padding-bottom: 20px;
  justify-content: center;
  background-color: yellow;
  height: 100%;
}

.c {
  width: 165px;
  flex-grow: 1;
  margin-right: 15px;
  background-color: green;
  height: 100%;
}

    Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has
    survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing
    software like Aldus PageMaker including versions of Lorem Ipsum. Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took
    a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets
    containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.

      s

    c

What I would like to achieve:
- red, yellow, green divs should me height as the blue (content) div, so when scrolling you do not see the blue part in the bottom
How to achieve this? What is wrong with my code?
I support only latest chrome and I can use CSS3

A: Your .a is overflowing into .content which is why you see blue section being displayed at the bottom.
By giving .a or rather, all of the children div's an auto overflow, they will follow their parent's height and avoid content overflowing.
Though, it'll introduce a scrollbar. If you are comfortable with hiding the overflowed text, you can use overflow: hidden instead.

.content {
  width: 100%;
  height: 400px;
  display: flex;
  overflow: auto;
  background-color: blue;
}

.content > div {
  overflow: auto;
}

.a {
  width: 165px;
  height: 100%;
  flex-grow: 1;
  background-color: red;
}

.b {
  width: 65px;
  padding-top: 20px;
  padding-bottom: 20px;
  background-color: yellow;
}

.c {
  width: 165px;
  margin-right: 15px;
  flex-grow: 1;
  background-color: green;
  height: 100%;
}

    Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has
    survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing
    software like Aldus PageMaker including versions of Lorem Ipsum. Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took
    a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets
    containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.

      s

    c

A: You could possibly try:
flex: 1 1 auto

It sizes based on width/height properties..
check out
Css Tricks article on it.
EDIT
Remove the flex-grow: 1 and it will be the height you need.
.content {

width: 100%;
  height: 400px;
  overflow: auto;
  background-color: blue;
}

.inner{
  display: flex;
}

.a {
  width: 165px;
  background-color: red;
}

.b {
  width: 65px;
  display: flex;
  padding-top: 20px;
  padding-bottom: 20px;
  justify-content: center;
  background-color: yellow;
}

.c {
  width: 165px;
  margin-right: 15px;
  background-color: green;
}

A: I think the best option for your problem is either

*

*moving overflow: auto; from the .content class to it's children.

*changing the height: 400px; to min-height: 400px; if you have no problem with the container being larger than 400px;

*adding a wrapper divwith height: 400px; and overflow: auto; around the .content and removing both rules from the .content(imo the best option)

A: Remove display: flex from .content and height: 100% from .a .b .c and then wrap your elements in a div and give it a display flex.
Working code:

.content {
  width: 100%;
  height: 400px;
  overflow: auto;
  background-color: blue;
}

.inner{
  display: flex;
}

.a {
  width: 165px;
  flex-grow: 1;
  background-color: red;
}

.b {
  width: 65px;
  display: flex;
  padding-top: 20px;
  padding-bottom: 20px;
  justify-content: center;
  background-color: yellow;
}

.c {
  width: 165px;
  flex-grow: 1;
  margin-right: 15px;
  background-color: green;
}

    Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has
    survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing
    software like Aldus PageMaker including versions of Lorem Ipsum. Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took
    a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets
    containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.

      s

    c

A: The problem is here .a section overflow. As you bind the .content 400px height. So there are two ways, You could either free from them to bind height or use overflow scroll for .a section. You can compare the previous and fixed code below.

.content {
  width: 100%;
  /*height: 400px;*/
  display: flex;
  overflow: auto;
  background-color: blue;
}

.a {
  width: 165px;
  /*height: 100%;*/
  flex-grow: 1;
  background-color: red;
}

.b {
  width: 65px;
  display: flex;
  padding-top: 20px;
  padding-bottom: 20px;
  justify-content: center;
  background-color: yellow;
  /*height: 100%;*/
  box-sizing: border-box;
}

.c {
  width: 165px;
  flex-grow: 1;
  margin-right: 15px;
  background-color: green;
  /*height: 100%;*/
}

    Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has
    survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing
    software like Aldus PageMaker including versions of Lorem Ipsum. Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took
    a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets
    containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.

      s

    c

.content {
  width: 100%;
  height: 400px;
  display: flex;
  overflow: auto;
  background-color: blue;
}

.a {
  width: 165px;
  height: 100%;
  flex-grow: 1;
  background-color: red;
}

.b {
  width: 65px;
  display: flex;
  padding-top: 20px;
  padding-bottom: 20px;
  justify-content: center;
  background-color: yellow;
  height: 100%;
}

.c {
  width: 165px;
  flex-grow: 1;
  margin-right: 15px;
  background-color: green;
  height: 100%;
}

    Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has
    survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing
    software like Aldus PageMaker including versions of Lorem Ipsum. Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took
    a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets
    containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.

      s

    c


text:
Q: Database doesn't save values using overloading methods I can't understand why is the database either not saving the values I enter or is it the method which I am using to pull all the data not working correctly. It doesn't throw any errors it just doesn't work. Here is the code:
    private static final String QUERY_TRIANGLE_CREATE_TABLE =
        "CREATE TABLE " + TRIANGLE_TABLE_NAME + " (" + TRIANGLE_COL_ID + " INTEGER PRIMARY KEY, " +
                TRIANGLE_VALUE_A + " TEXT, " + TRIANGLE_VALUE_C + "TEXT, " + TRIANGLE_VALUE_B + " TEXT, " + TRIANGLE_RESULT + " TEXT," + TRIANGLE_HISTORY_INFORMATION + " TEXT" +  "  );";

public void insertTriangleCalc(String a,String b, String c,String d,String e){
    SQLiteDatabase database = this.getWritableDatabase();
    ContentValues values = new ContentValues();
    values.put(TRIANGLE_VALUE_A,a);
    values.put(TRIANGLE_VALUE_B,b);
    values.put(TRIANGLE_VALUE_C,c);
    values.put(TRIANGLE_RESULT,d);
    values.put(TRIANGLE_HISTORY_INFORMATION,e);

    database.insert("triangle", null, values);
    database.close();

}
public void insertTriangleCalc(String a,String b, String c,String d){
    SQLiteDatabase database = this.getWritableDatabase();
    ContentValues values = new ContentValues();
    values.put(TRIANGLE_VALUE_A,a);
    values.put(TRIANGLE_VALUE_B,b);
    values.put(TRIANGLE_RESULT,c);
    values.put(TRIANGLE_HISTORY_INFORMATION,d);

    database.insert("triangle", null, values);
    database.close();}
public List<Triangle> ObjectRead() {

    List<Triangle> valuesList = new ArrayList<>();

    String sql = "SELECT  * FROM triangle ORDER BY id DESC";
    SQLiteDatabase db = this.getWritableDatabase();
    Cursor cursor = db.rawQuery(sql, null);

    if (cursor.moveToFirst()) {
        do {

            int id = Integer.parseInt(cursor.getString(cursor.getColumnIndex("id")));
            String valueA = cursor.getString(cursor.getColumnIndex("valueA"));
            String valueB = cursor.getString(cursor.getColumnIndex("valueB"));
            String valueC="0";
            try {

            } catch (Exception e){

            }

            String result = cursor.getString(cursor.getColumnIndex("result"));
            String history = cursor.getString(cursor.getColumnIndex("history"));

            Triangle triangle = new Triangle();
            triangle.id = id;
            triangle.valueA = valueA;
            triangle.valueB  = valueB;
            triangle.valueC = valueC;
            triangle.Result = result;
            triangle.history = history;
            valuesList.add(triangle);

        } while (cursor.moveToNext());
    }
    cursor.close();
    db.close();

    return valuesList;
}

Can anyone have a look at it and help me figure out what am I not setting up properly. It works for public void insertTriangleCalc(String a,String b, String c,String d) , but not for public void insertTriangleCalc(String a,String b, String c,String d,String e).

A: Decided to check from top to bottom and the whole thing was happening because of a missing empty space TRIANGLE_VALUE_C + "TEXT, "
                                        <- here. This has now been resolved and it can finally store data correctly.


text:
Q: Classify a slope raster in Image Analysis I have a DEM in a Mosaic Dataset covering a large area (300 x 200 km). I want to create a classified slope raster showing slopes of say 0 - 10 degrees, 10 - 20 degrees, and then 20 - 90 degrees. Because the dataset is so large I want to avoid having to create a separate slope raster dataset, but instead use the Image Analysis so I can visually see where the slope classes are.

In the Image Analysis window I can create a Slope Function for my dem and display it using the Stretched color ramp in the Symbology tab of the Layer Properties. I want to use the Classified renderer, but Arc requires the data to have a histogram. When I say Yes, it chugs away computing the statistics and histogram. For really large datasets it can take a very long time. I'm wondering where the histogram and statistics are stored for a Image Analysis layer because it this Compute Histogram dialog keeps re-appearing.

I thought there could be a way to create this with a Function chain. There are functions called: Classify, Colormap, Remap that sound promising, but I haven't gotten any of them to work
The Classify function wants a .ECD or .ACT file as input. How do I create a ECD or ACT file or is there a better way to accomplish this?
Function Chains:

A: I have Canadian DEM data (whole country) that I created a mosaic dataset out of. Adding a slope function chain to it produces a good working slope raster (percent rise).  I have tried adding a Remap function that includes 3 classes:  1) 0-30, 2) 30-50, and 3) >50.
The goal is to only see the 2nd and 3rd classes, and colour them appropriately.  I don't want a colour for the first class, so I checked NoData in the Remap function properties.
All this being said, the Remap function does not work as I thought, and it seems like a bad choice to classify pixel ranges.  At a minimum, I added a min-max value of 0-30 with no output and NoData checked.  This removes the 'good' slope so I can see the ground below it.

A: if I understand well, you want an "on the fly" slope calculation in order to avoid building a large dataset of the slope. This could be a good idea, but only if you don't need to work with a large scale factor (otherwise it is better to create your slope raster and build pyramids on top of it).
With your 3 classes, you should use Remap function (manually enter the min and max values of your groups, no need to compute statistics) then adjust the colour with a stretched renderer. (FYI: Classify assign class values based on training samples when you do not know the boundaries of your classes, and colourmap apply colours based on unique codes of a single band raster)


text:
Q: Dynamic 2nd dimension in array Is there a way to create a two-dimensional array in java where 2nd dimension of the array has a variable number of elements?
For instance, if I knew the elements beforehand, I could declare the entire array at once like this.
int[][] runs = {{1, 4, 7}, {2, 3}, {1}};
However, I do not know the values beforehand. I would like to partially declare the array to do something like this:
int[][] runs = new int[3];
And then fill in each element of the 1st dimension with a an array of integers. But I get an error.

A: If I understand your question correctly the answer is pretty simple.
You're trying to create an asymmetric multi-dimentional array.
You can initialize your array with a known 1st level size, and an unknown 2nd level size.
For instance:
int[][] runs = new int[3][];

Then...
runs[0] = new int[]{1,2,3};
runs[1] = new int[]{4};
runs[2] = new int[2]; // no elements defined, defaults to 0,0
System.out.println(Arrays.deepToString(runs));

Output:
[[1, 2, 3], [4], [0, 0]]

A: int[][] runs = new int[3][];

Will do the trick.
Then you need to initialize each dimension.
runs[0] = new int[5];
runs[1] = new int[x];
//and so on

The initialization of each dimension can be done at any time later, just make sure to avoid accessing the elements before initialization or you'll get a NullPointerException

A: The 2nd dimension can be variable. Take a look here:
int[][] runs = new int[3][];
runs[0] = new int[55];
runs[0][3] = 412532;
runs[0][54] = 444;
runs[1] = new int[]{1, 2};
runs[2] = new int[]{2,3,4,2,4,5,3,5,2,6};

You can do whatever you want after you set the 1st dimension of the array, as shown in the example.


text:
Q: Possibility of hybrid forward-flyback topology Within the context of isolated converters, the flyback topology is nice in its simplicity as can be the forward topology, in spite of needing a second primary reset winding. However, both make poor use of the transformer core in as much power is not continuously passed through the transformer. Why can't both topologies be combined by taking the reset windings to the secondary side as a flyback output windings?
Consider the following schematic:

The upper secondary windings are as in a typical forward topology while the lower secondary windings are as in a flyback topology and act as reset windings. Ideally, one would remove L1 altogether by designing T1 with a large magnetizing inductance.
My questions are specifically:
1) Wouldn't this topology offer advantages such as lowered value for C1, no output inductors and better use of core materials? If yes, why isn't it more common?
2) Are there major drawbacks I haven't considered? The ones I see concerns stressed Q1 in no-load conditions and the need for a lot of primary windings so that T1 can have a high enough inductance to remove L1 altogether.
3) I'm considering such a design for a constant power PSU for use with loads that exhibit negative resistance. The idea is to have the ON-state duty cycle more proportional to total output power as the energy not used in the forward part of the cycle will be dumped in the load in the flyback part of the cycle. Would that be an acceptable use case?
I have seen similar topologies in some patents and a few papers targeting its use in solar power systems but it does not seem to be common at all and I can't see why.
P.S.: I'm a physicist by training and I suspect the reason might be first and foremost economical.


text:
Q: how can i create desktop version change button? We chose the responsive theme for our homepage. I was wondering if with the responsive theme, could we make it so that you can get to the desktop version from the mobile one by just pressing a button?

A: I haven't actually done this, but theoretically this is how I would. This will be easier if you've gone with a desktop-first approach rather than a mobile-first approach (I would think).
1. Query param to swich
Perhaps:
http://yoursite.com/?resp=no

2. Remove viewport meta and class the body
Then you test for that param. I'll use PHP here just because but it could be anything. We'll only remove the viewport meta tag if they don't want responsive design, as well as put a class on the body.
<head>

   <title>My cool site huzzah</title>

   <?php
     if (!$_GET['resp'] == 'no') { ?>
       <meta name="viewport" content="width=device-width">
   <?php } ?>

</head>

">
You'll probably want to get a little more complex here. You'll want to set a cookie (or perhaps use localStorage) to remember the users preference. Then you don't just test for the query param but also the value of that cookie before making the decision to exclude the viewport meta or not (and the body class).
3. Qualify your media query styles
One way to do this would be to exclude the loading of a separate stylesheet where you have all your responsive styles. That might work for you but I'm generally a fan of keeping as much CSS together in one file as possible. If you do keep it in one file, you can use that "resp" body class to ensure media query styles don't take place if they shouldn't.
.page-wrap { width: 80%; }

@media (max-width: 600px) {
  .resp .page-wrap { width: 100%; }
}

This way the responsive style will only take hold if the media query matches and the proper class is on the body indicating it's OK to use responsive styles.
4. Have good UI to switch between
Whatever you cook up, make sure it's pretty clear how you get back and forth between the two site styles and that it sets the cookie stuff properly.


text:
Q: Populating cells in separate sheet based on info on original sheet On my first sheet, I have 6 columns with lots of rows of data. The first column is date and the second is standard. In the second column, the info will either say met standard or not met standards. I want my second sheet to pull all of the rows that haven't met the standards.
I am new to Google Sheets, so I have attempted a few things, but I'm looking for some advise on what's the best way to do this.
I want my second sheet to be populated with data from the first based on a specific field in the second row of the first sheet.

A: You might indicate whether this is a one-off, or regular event. In any event, it sounds like a query would meet your needs. There are dozens of topics on stack overflow (and the net generally) on using query. But it sounds like something like this would suit.
=query('sheetname'!A1:F27,"Select A, B, C, D, E where B='met standard'",-1)

Instructions:
1 - Put this formula in cell A1 of the second sheet
2 - Edit the formula to replace "sheetname" with the actual name of the first sheet.
3 - Edit the formula to replace the range (A1:F27 in this example) with the actual range of the data on the first sheet.
In this example, I've included Row#1 to capture headers. The "-1" at the end of the query has the effect of displaying those headers.

Demo data

Query output


text:
Q: C programming: for loop - calculating money spend on employees     #include <stdio.h>
    main()
    {
    int i;
    int Employees;
    int PricePerEmployee = 30;
    int total = 0;
    printf("How many employees?\n");
    scanf(" %d", &Employees);
    for (i=1; i<=Employees; i++)
    {
        total += Employees * PricePerEmployee;
    }
    printf("total: %d", total);
    return 0;    }

Let's say I have 2 employees.It prints 120, instead of 60.
Now, when I try to put i=Employees in the for loop, I get the result perfectly.
I'm confused.
i=1, doesn't stand for "I start from the first employee?".

A: If you only want to get total many spend on employees then you don't need to use for-loop for this, you can achieve this by as follows
#include <stdio.h>
main()
{
int i;
int Employees;
int PricePerEmployee = 30;
int total = 0;
printf("How many employees?\n");
scanf(" %d", &Employees);
total = Employees * PricePerEmployee;
printf("total: %d", total);
return 0;
}

And if you want to use for-loop any how then do as @avinash suggested in the comment :
#include <stdio.h>
main()
{
int i;
int Employees;
int PricePerEmployee = 30;
int total = 0;
printf("How many employees?\n");
scanf(" %d", &Employees);
for (i=1; i<=Employees; i++)
{
     total += PricePerEmployee;
}
printf("total: %d", total);
return 0;
}

Your code won't work as expected because :
total += Employees * PricePerEmployee;

means
total = total + (Employees * PricePerEmployee);

As Employees * PricePerEmployee is what expected as output and you putted this inside the loop. let Employees = 2 and PricePerEmployee = 30 then your loop work like this:
1st run :
total = total + (Employees * PricePerEmployee);
total = 0 + (2 * 30) = 60;
2nd run :
total = total + (Employees * PricePerEmployee);
total = 60 + (2 * 30) = 120;


text:
Q: How to share Javascript Business Rules between Client and Server? I am creating a MEAN stack and I want to clarify the below.
From the coding standards perspective I know that validations should be executed both at the client side and server side. What I would like to achieve is to execute the exact same validation code so that I do not repeat the code again. This is more like a shared code for client and server side.
so How can I have angular js and Express js invoke same .js file for performing validations? is it even possible?
Thanks!

A: You sure can do this. This approach is used by RemObjects DataAbstract (http://old.wiki.remobjects.com/wiki/Business_Rules_Scripting_API). The principle here is to define business-rules that will either apply on the client and on the server, or the server only. You will almost never have to check for business-rules ONLY on the client, because you can never "trust" the client to check your business rules.
CQRS and DDD are two architectural principles that could help you here. Domain Driven Design will kind of "clean" or "refine" your code, pushing the infrastructure away from the core "domain" logic. And business rules apply only in the domain, so it's a good idea the keep the domain isolated from the rest.
Command-Query-Responsability-Segretation. I like this one a lot. Basically, you define a set of commands that will be validated before they are applied. There's no more machine-like code that looks like Model.Set('a', 2). Your code, using this principle, will look like MyUnderstandableBusinessObject.UnderstandableCommand(aFriendlyArgument). When it comes to applying business rules, this is very handy that your actual commands reflect the use cases of your domain.
I also always encounter this problem when I work on node.js / javascript projects. The problem is that you do not have a standardized ORM that can be understood by both the client AND the server. This is paradoxal, as node.js and the browser are running on the same language. When I was drawn towards Node.js, I told myself, man both client and server are running the same language, that's going to save sooo much time. But that was kind of false, as there are not that many mature and professional tools out there, even if npm is really active.
I wanted to build an ORM too that could be both understood by the client/server, and add a relational aspect to it (so that it was compatible with SQL) but I kind of abandoned the project. https://github.com/ludydoo/affinity
But, there are a couple of other solutions. Backbone is one, and it's lightweight.
The actual implementation of your business-rule checking here is what you are going to have to work on. You'll want to extract the "validation" part out of your model into another object that will be able to be shared. Something to get you started :
https://jsfiddle.net/ludydoo/y0otcvrf/
BusinessRuleRepository = function() {
  this.rules = [];
}

BusinessRuleRepository.prototype.addRule = function(aModelClass, operation, callback) {
  this.rules.push({
    class: aModelClass,
    operation: operation,
    callback: callback
  })
}

BusinessRuleRepository.prototype.validate = function(object, operation, args) {
  _.forIn(this.rules, function(rule) {
    if (object.constructor == rule.class && operation == rule.operation) {
      rule.callback(object, args)
    }
  })

}

MyObject = function() {
  this.a = 2;
}
MyObject.prototype.setA = function(value) {
  aBusinessRuleRepo.validate(this, 'setA', arguments);
  this.a = value;
}

// Creating the repository
var aBusinessRuleRepo = new BusinessRuleRepository();

//-------------------------------
// shared.js
var shared = function(aRepository) {
  aRepository.addRule(MyObject, 'setA', function(object, args) {
    if (args[0] < 0) {
      throw 'Invalid value A';
    }
  })
}
if (aBusinessRuleRepo != undefined) {
  shared(aBusinessRuleRepo);
}
//-------------------------------

// Creating the object

var aObject = new MyObject();

try {
  aObject.setA(-1); // throws
} catch (err) {
  alert('Shared Error : ' + err);
}

aObject.setA(2);

//-------------------------------
// server.js
var server = function(aRepository) {
  aRepository.addRule(MyObject, 'setA', function(object, args) {
    if (args[0] > 100) {
      throw 'Invalid value A';
    }
  })
}
if (aBusinessRuleRepo != undefined) {
  server(aBusinessRuleRepo);
}
//-------------------------------
// on server

try {
  aObject.setA(200); // throws
} catch (err) {
  alert('Server Error :' + err);
}

*

*The first thing of all is to model and define your domain. You'll have a set of classes that represent your business objects, as well as methods that correspond th business-operations. (I would really go with CQRS for your case)

*The model definition would be shared between the client and the server.

*You would have to define two files, or two objects. Separated. ServerRules and SharedRules. Those will be a set of Repository.addRule() calls that will register you business rules in the repository. Your client will get the Shared.js business rules, and the server the Shared.js + Server.js business rules. Those business rules will always be applied on your objects this way.
The little example of code I shown you is very simple, and checks business rules only before the command is applied. Maybe you could add a parameter 'beforeCommand' and 'afterCommand' to check business rules before and after changed are made. Then, if you add the possibility of checking business rules after a command is applied, you must be able to rollback the changes (backbone has this functionality I think).
Good luck

You could automate this a little by automatically getting the name of the method you are in (Can I get the name of the currently running function in JavaScript?)
function checkBusinessRules(model, arguments){
   businessRuleRepo.validate(model, getCalleeName, arguments);
}

Model.prototype.command = function(arg){
   checkBusinessRules(this, arguments);
   // perform logic
}

EDIT 2
A small detail i would like to correct on my first answer. Do not implement your business rules on property setters! Use business operation names instead :
You must make sure that you always set your model properties through methods. If you set your model properties directly by assigning a value, you're bypassing the whole business rule processor thing.
The cheap way is to do this through standard setters such as
SetMyProperty(value);
SetAnotherProperty(value);

This is kind of the low-level business rule logic (based on getters and setters). Then, your business rules will also be low-level. Which is kind of bad.
Better, you should do this through business understandable high-level method names such as
RegisterClient(client);
InvalidateMandate(mandate);

Then, your business rules become way more understandable and you'll almost have a good time implementing them.
BusinessRuleRepository.add(ModelClass, "RegisterClient", function(){
    if (!Session.can('RegisterClient')) { fail('Unauthorized'); }
})


text:
Q: How to make Windows 8 Start Screen search result icon to open a new instance of a Desktop App There is a registry hack that makes Windows 8/8.1 Start Screen Tiles to open a new instance of a Desktop App (see accepted answer of this question: How to make a Start Screen icon for Notepad that will always open a new Notepad when clicked in Windows 8?)
Unfortunately this doesn't apply to the search results in the Start Screen. Is there a (registry) hack so that when I hit the Windows key, type "note" and press Enter to open the first result (usually notepad.exe) and Windows opens a new instance, just like it does in Windows 7?

A: While this isn't exactly what you asked for, you can use
Shift + Enter
instead of just Enter to open a new instance.


text:
Q: How to access binary before msbuild packs it to single file I'm using ConfuserEx to obfuscate my app, but it requires whole .dll binary file.
So, is there a way to obfuscate it using cli and then pack it to single file, or
access binary before compressing it to single file, so i can obfuscate it
I tried to do exclude main binary by ExcludeFromSingleFile, but it didn't work
My .crproj file
<Project Sdk="Microsoft.NET.Sdk">
    <PropertyGroup>
        <OutputType>exe</OutputType>
        <AssemblyName>jay-$(RuntimeIdentifier)</AssemblyName>
        <PublishSingleFile>true</PublishSingleFile>
        <IncludeAllContentForSelfExtract>true</IncludeAllContentForSelfExtract>
        <IncludeNativeLibrariesForSelfExtract>true</IncludeNativeLibrariesForSelfExtract>
        <TargetFramework>net5.0</TargetFramework>
    </PropertyGroup>

    <ItemGroup>
        <Content Update="$(AssemblyName).dll">
            <CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
            <ExcludeFromSingleFile>true</ExcludeFromSingleFile>
        </Content>
    </ItemGroup>

    <ItemGroup>
      <PackageReference Include="CloudFlareUtilities" Version="1.3.0" />
      <PackageReference Include="Colorful.Console" Version="1.2.15" />
      <PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
      <PackageReference Include="YamlDotNet" Version="9.1.4" />
    </ItemGroup>

</Project>

A: You need to add it as a post-build event, for example:
<Project Sdk="Microsoft.NET.Sdk">
    <PropertyGroup>
        <OutputType>exe</OutputType>
        <AssemblyName>jay-$(RuntimeIdentifier)</AssemblyName>
        <PublishSingleFile>true</PublishSingleFile>
        <IncludeAllContentForSelfExtract>true</IncludeAllContentForSelfExtract>
        <IncludeNativeLibrariesForSelfExtract>true</IncludeNativeLibrariesForSelfExtract>
        <TargetFramework>net5.0</TargetFramework>
    </PropertyGroup>

    <!-- runs: TheAppToPassItTo.exe "<path to dll>" -->
    <Target Name="PostBuild" AfterTargets="PostBuildEvent">
      <Exec Command="TheAppToPassItTo.exe "$(TargetPath)"" />
    </Target>

    <ItemGroup>
      <PackageReference Include="CloudFlareUtilities" Version="1.3.0" />
      <PackageReference Include="Colorful.Console" Version="1.2.15" />
      <PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
      <PackageReference Include="YamlDotNet" Version="9.1.4" />
    </ItemGroup>

</Project>

Edited To Add
So, it turns out that the new "single file" executable option doesn't build it's executable from the bin directory, but from the obj directory. This has to be a simple oversight from the .NET team. There are many times where you'd want to modify your executable code before packing it up. What you are asking for is not unreasonable.
We can accomplish this by implementing a kludge until this gets rectified. We will still use the "post-build" job, but we are going to do some string replacement to build the correct path to the executable you want to modify.
This is the new script:
@ECHO off
SET tp=$(TargetPath)
SET tp=%tp:\bin\=\obj\%
ECHO Target file to modify: %tp%
YourObfuscatorEngine.exe "%tp%"

This will get the target path, in my case it is:
D:\Repositories\Source\ConsoleApp2\ConsoleApp2\bin\Release\netcoreapp3.1\win-x64\ConsoleApp2.dll

Then we do a string replace. We replace \bin\ with \obj\. The path will then be:
D:\Repositories\Source\ConsoleApp2\ConsoleApp2\obj\Release\netcoreapp3.1\win-x64\ConsoleApp2.dll

Now when you call your obfuscator engine, it will modify the correct file.
Please keep in mind that if you turn on the PublishReadyToRun option, your path will change to:
D:\Repositories\Source\ConsoleApp2\ConsoleApp2\obj\Release\netcoreapp3.1\win-x64\R2R\ConsoleApp2.dll

Which will make this a tad more complicated. So just keep that in mind if you decide you want to do this.
At the end of the day, your post-build script will look like this:
<Project Sdk="Microsoft.NET.Sdk">
    <PropertyGroup>
        <OutputType>exe</OutputType>
        <AssemblyName>jay-$(RuntimeIdentifier)</AssemblyName>
        <PublishSingleFile>true</PublishSingleFile>
        <IncludeAllContentForSelfExtract>true</IncludeAllContentForSelfExtract>
        <IncludeNativeLibrariesForSelfExtract>true</IncludeNativeLibrariesForSelfExtract>
        <TargetFramework>net5.0</TargetFramework>
    </PropertyGroup>

  <Target Name="PostBuild" AfterTargets="PostBuildEvent">
    <Exec Command="@ECHO off
SET tp=$(TargetPath)
SET tp=%25tp:\bin\=\obj\%25
ECHO Target file to modify: %25tp%25
YourObfuscatorEngine.exe "%25tp%25"" />
  </Target>

    <ItemGroup>
      <PackageReference Include="CloudFlareUtilities" Version="1.3.0" />
      <PackageReference Include="Colorful.Console" Version="1.2.15" />
      <PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
      <PackageReference Include="YamlDotNet" Version="9.1.4" />
    </ItemGroup>

</Project>

A: if you only need to modify the file on publish, I suggest hooking into the publish pipeline:
<Target Name="ObfuscateAssembly" BeforeTargets="PrepareForPublish">
  <Exec Command="some.exe %(IntermediateAssembly.FullPath)" />
</Target>

In case a larger process is needed, e.g. for this sample all dependencies need to be present for the obfuscator to work on all assemblies, an extended method of hooking into the build process would be after ComputeResolvedFilesToPublishList where the SDK figures out what files are needed to publish.
Here's the full example where the obfuscator works on all the assemblies in a directory:
<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>net5.0</TargetFramework>
    <PublishReadyToRun>True</PublishReadyToRun>
    <RuntimeIdentifier>win-x64</RuntimeIdentifier>
    <SelfContained>False</SelfContained>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
  </ItemGroup>

  <Target Name="CalculateObfuscationInputs" DependsOnTargets="_ComputeAssembliesToPostprocessOnPublish">
    <PropertyGroup>
      <ObfuscationDir>$(IntermediateOutputPath)obfuscation\</ObfuscationDir>
    </PropertyGroup>
    <ItemGroup>
      <AssembliesToObfuscate Include="@(ResolvedFileToPublish->WithMetadataValue('PostprocessAssembly', 'true'))" />
      <AssembliesToObfuscateTemporaryLocation Include="@(AssembliesToObfuscate->'$(ObfuscationDir)%(Filename)%(Extension)')" />
      <_PdbsToObfuscateInput Include="@(AssembliesToObfuscate->'%(RelativeDir)%(Filename).pdb')" />
      <PdbsToObfuscate Include="@(_PdbsToObfuscateInput)" RelativePath="%(_PdbsToObfuscateInput.Identity)" Condition="Exists(%(_PdbsToObfuscateInput.Identity))" />
      <PdbsToObfuscateTemporaryLocation Include="@(PdbsToObfuscate->'$(ObfuscationDir)%(Filename)%(Extension)')" />
    </ItemGroup>
    <MakeDir Directories="$(ObfuscationDir)" />
  </Target>

  <Target Name="PrepareForObfuscation" Inputs="@(AssembliesToObfuscate);@(PdbsToObfuscate)" Outputs="@(AssembliesToObfuscateTemporaryLocation);@(PdbsToObfuscateTemporaryLocation)">
    <Copy SourceFiles="@(AssembliesToObfuscate);@(PdbsToObfuscate)" DestinationFiles="@(AssembliesToObfuscateTemporaryLocation);@(PdbsToObfuscateTemporaryLocation)" SkipUnchangedFiles="True" />
  </Target>

  <Target Name="ObfuscateAssembly" AfterTargets="ComputeResolvedFilesToPublishList" DependsOnTargets="CalculateObfuscationInputs;PrepareForObfuscation">
    <Exec Command="some-obfuscator.exe $(ObfuscationDir)" />
    <ItemGroup>
      <ResolvedFileToPublish Remove="@(AssembliesToObfuscate);@(PdbsToObfuscate)" />
      <ResolvedFileToPublish Include="@(AssembliesToObfuscateTemporaryLocation);@(PdbsToObfuscateTemporaryLocation)" />
    </ItemGroup>
  </Target>

</Project>


text:
Q: .show()/.hide() on click I have this JQuery function:
function JQueryPopup(value) {
    $(value).show();

    $('#JQueryClose').click(function(){
        $(value).hide();
    });

    $( document ).on( 'click', function ( e ) {
        if ( $( e.target ).closest( elem ).length === 0 ) {
            $(value).hide();
        }
    });

    $( document ).on( 'keydown', function ( e ) {
        if ( e.keyCode === 27 ) { // ESC
            $(value).hide();
        }
    });
}

when i call the function it shows a div (value)
How can i use the button/link that was used to open it close it too?

A: You can use toggle() function for show/hide purpose.
But you're binding the event handlers inside a function… note that whenever the function JQueryPopup is called (unless it's binded to ready event and only called once), it'll add a new handler, your code probably won't work as expected afterwards since more than one handlers fire upon the event.
Change your code as follows (Assuming you want bind the events upon page load):
$(document).ready(function(){

 $('#JQueryClose').click(function(){
    $(value).hide();
 });

 $( document ).on( 'click', function ( e ) {
    if ( $( e.target ).closest( elem ).length === 0 ) {
        $(value).hide();
    }
 });

 $( document ).on( 'keydown', function ( e ) {
    if ( e.keyCode === 27 ) { // ESC
        $(value).hide();
    }
 });
})

function JQueryPopup(value) {
 $(value).toggle();
}

side note: you seems to be using different methods for the same purpose such as click, on('click',function(){...}) etc, it's a good practice to be consistant and stick to a particular method


text:
Q: Normal $0,1$-sequence with infinitely many frequent finite substrings Let $\mathbb{N}$ denote the set of non-negative integers. We can identify every bitstream, i.e. a function $s:\mathbb{N}\to \{0,1\}$, with some $A\in{\cal P}(\mathbb{N})$: take $A = s^{-1}(\{1\})$.
Given any $A\subseteq \mathbb{N}$ we set $$\mu^{+}(A)= \lim \sup_{n\to\infty}\frac{|A \cap\{1,\ldots,n\}|}{n+1}.$$
We say that a bitstream $s$ is normal if every finite $01$-string appears infinitely often. For any finite $01$-string $\sigma$ we let $\text{Start}(\sigma)$ be the set of starting points of $\sigma$ inside $s$, and $\sigma$ is said to be frequent is $s$ if $\mu^+(\text{Start}(\sigma))>0$.
Question. Is there a normal bitstream $s$ with infinitely many frequent finite $01$-strings?

A: Yes. Enumerate the set of all finite $0$-$1$-sequences as $\langle\sigma_n:n\in\omega\rangle$ such that each sequence is listed infinitely often. Define $s$ to be the sequence that starts with $a_0$ copies $\sigma_0$, $a_1$ copies of $\sigma_1$, $a_2$ copies of $\sigma_2$, $\dots$, $a_n$ copies of $\sigma_n$, $\dots$, where the $a_n$ are determined, recursively as follows: $a_0=1$. When you ready to add copies of $\sigma_n$ let $a_n$ be the length of $s$ thus far and let $l_n$ be the length of $\sigma_n$. Append $a_n$ copies of $\sigma_n$ to $s$. The new sequence has length $a_n(1+l_n)$ (so $a_{n+1}=a_n(1+l_n)$) and it has at least $a_n$ points where a copy of $\sigma_n$ starts.
This shows that in the end for a sequence $\sigma$ of length $l$ we have $\mu^+(\mathrm{Start}(\sigma))\ge 1/(1+l)$.


text:
Q: How to Create Header,Content, Side Bar and Footer section (layout) in .net MDI application I have one big existing application using .Net - MDI C#,
Now I am going to change some looks for application, so it looks better for client.
But I a, facing a lot of issues when I try to add more than 2 images on the Parent MDI Form.
How to create Header, Content, Side Bar and Footer Section in MDI (For. Ref.  find attach screenshot for application layout.)?  Also can anyone tell me which tips like which control I used for this type layout?

A: You have been a member for 6 months, asked questions, but never answered a question,never commented on a question, and never even accepted an answer.
But if everyone in this community acted the same way, if everyone else was just a user, where would you be then?  There would be no community, no resource, you would never get an answer or have any information to search.  Think about it.  Then  think about actually joining the community and stop using it.
Now to answer your question, the Winforms MDI container does not natively support the functionality you are describing, however it does support siting UserControls directly on the MDI container. This makes emulating the functionality you describe very easy.  Just create a UserControl that provides the graphical surface and controls you need and then use the docking properties to force the MDI container to place child forms correctly in the open client area instead of on top of a UserControl.
For example, to create a logo and then a menu bar underneath create a UserControl with the logo and menu bar.  Create events and wire them up as needed to allow the MDI form to subscribe to events that pass any menu clicks back that the MDI form needs to handle.  Finally site the UserControl directly on the MDI form and set it's docking property to top.  Then any child forms will display correctly in the remaining client area underneath the menu bar on the UserControl.


text:
Q: Firemonkey: Image.Bitmap.DrawLine not visible on ipad I'm building a app in DelphiXE2 firemonkey for IOS. If I tested on the mac in the Xcode IPAD Simulator I saw the button. But when I click on the button no line is visible. Why?
code: (On the Form a button and a Image)
unit Unit3;

interface

uses
  SysUtils, Types, UITypes, Classes, Variants, FMX_Types, FMX_Controls, FMX_Forms,
  FMX_Dialogs, FMX_Objects;

type
  TForm3 = class(TForm)
    Image1: TImage;
    Button1: TButton;
    procedure Button1Click(Sender: TObject);
    procedure FormCreate(Sender: TObject);
  private
    { Private-Deklarationen }
  public
    { Public-Deklarationen }
  end;

var
  Form3: TForm3;

implementation

{$R *.lfm}

procedure TForm3.Button1Click(Sender: TObject);
var pt0,pt1 : TPointF;
begin
  pt0.Create(0,0);
  pt1.Create(200,200);
  with Image1.Bitmap do begin
    Canvas.Stroke.Color := $ffff0000 ;  // Red
    Canvas.BeginScene;

    Canvas.DrawLine(pt0,pt1,1);
    BitmapChanged;  // without this, no output
    Canvas.EndScene;
  end;

end;

procedure TForm3.FormCreate(Sender: TObject);
begin
  Image1.Bitmap := TBitmap.Create(200,200);
end;
end.

A: I think it should be:
pt0 := TPointF.Create(0, 0);

A: Try this
  pt0.X:=X;
  pt0.Y:=Y;
  pt1.X:=X+4;
  pt1.Y:=Y+4;
  with Image1.Bitmap do begin
    Canvas.Stroke.Color := $ffff0000 ;  // Red
    Canvas.Stroke.Kind := TBrushKind.bkSolid;
    Canvas.StrokeThickness:= 10;
    Canvas.BeginScene;
    Canvas.DrawLine(pt0,pt1,100);
    Canvas.EndScene;
  end;


text:
Q: Datetime showing when I just want date mvc textbox I am using the date picker in admin lte but no mater what I do the date time picker will show.
@Html.LabelFor(model => model.DateReported)
@Html.EditorFor(model => model.DateReported, new { htmlAttributes = new { @class = "form-control
datetimepicker" } })
@Html.ValidationMessageFor(model => model.DateReported)

You will see the generated html is as follows.
<input class="form-control datetimepicker text-box single-line valid" data-val="true" data-val-
required="The DateReported field is required." id="DateReported" name="DateReported" type="datetime-
local" value="0001-01-01T00:00:00.000" aria-required="true" aria-describedby="DateReported-error"
aria-invalid="false">

But even though I have in my scripts done this.
And I have tried this.
@Html.LabelFor(model => model.DateReported)
@Html.EditorFor(model => model.DateReported, new { htmlAttributes = new { @class = "form-control
dateicker" } })
@Html.ValidationMessageFor(model => model.DateReported)

<script type="text/javascript">
   $(function () {
      $('.DateRaised').datepicker();
      $('.DateReported').datepicker();

     });

Even if I set it as such Presume its because it gets datetime data type from my model how do I show only date part in textbox.
@Html.LabelFor(model => model.DateReported)
@Html.EditorFor(model => model.DateReported, new { htmlAttributes = new { @class = "form-control
datepicker" } })
@Html.ValidationMessageFor(model => model.DateReported)

But this still procduces this view.

A: have you tried fixing it from the Model ?
[DisplayFormat(DataFormatString = "{0:dd/MM/yyyy}")]
public DateTime DateReported{ get; set; }

A: You should mention the date format on initializing datepicker in Jquery function:
$(function () {
     $('.DateRaised').datepicker({
        format: 'mm/dd/yyyy',
    });
});


text:
Q: Ignore symbol except its first existence as a first? how could I do something like that:
Input:

+93120nvsenr++   +++:LKK213ll

Output:

selected all non digits and all "+" except "+" which is first and start the string

Example:

+312313__3fffa```+++31+3

Final result after String.replaceAll(regex, "") should be +3123133313
So far my regex is:
[^\\d^+]

which is: ignore all non digits and all "+" signs and gives me:

+3123133+++31+3

A: You can use this regex
(?!^\+)\D+
    ^
    |
    |->this would replace a non digit character only if it doesn't have a +( which is at the beginning of the string) that preceed's it

try it here


text:
Q: Class diagrams created through objectaid in eclipse disappeared I am using eclipse plugin ObjectAid for creating class diagrams from my classes. After creating about 4 diagrams, the next day when I tried to open the class diagrams, I see that three out of the four diagrams are empty with an yellow exclamation icon near the ones which are empty.
Any idea why this has happened? Is there any way to retrieve the class diagrams?

A: It happened to me also, one or more (even 5) restarts of Eclipse finally helped. Try some black magic, like close the diagram, then restart Eclipse, then open the diagram again and repeat until the diagram appears.

A: Open up Window > Show View > Model Explorer > Open your project > ** Diagram Class Diagram.


text:
Q: Function type setting 'this' context, not working I have the following code in my Vue component:

import Vue from 'vue';
import { ElForm } from 'element-ui/types/form';

type Validator = (
  this: typeof PasswordReset,
  rule: any,
  value: any,
  callback: (error?: Error) => void
) => void;

const validatePass1: Validator = (rule, value, callback) => {
  if (value && this.form.passwordConfirm) {
    (this.$refs.form as ElForm).validateField('passwordConfirm', valid => {});
  }
};
// ...

const PasswordReset = Vue.extend({
  // ...

This is not working as documented. I get a type error in the validatePass1 func:
'this' implicitly has type 'any' because it does not have a type annotation.

I don't understand why this isn't working.

A: validatePass1 needs to be defined with the function keyword instead of as an arrow function.  An arrow function ignores the this passed at the time of the call (which is what your type annotation is on) and always uses the this from where it was defined, which in this case is the global object (I think).


text:
Q: capture window text I'm trying to capture yahoo and msn messenger conversation text, and no tool is able to do it.
Any idea how it can be done without sniffing packets?

A: With Live Messenger's history feature enabled, you can read the text right from the history files stored as XML.


text:
Q: Why extra string in AWS Cloud watch logs generated by Lambda function? I have golang based lambda function which does some work and logs the information during execution.
I'm using zapcore Golang logger as below
func NewLogger(logLevel string) (*zap.SugaredLogger, error) {

    encoderConfig := zapcore.EncoderConfig{
        TimeKey:        "Time",
        LevelKey:       "Level",
        NameKey:        "Name",
        CallerKey:      "Caller",
        MessageKey:     "Msg",
        StacktraceKey:  "St",
        EncodeLevel:    zapcore.CapitalColorLevelEncoder,
        EncodeTime:     zapcore.ISO8601TimeEncoder,
        EncodeDuration: zapcore.StringDurationEncoder,
        EncodeCaller:   zapcore.ShortCallerEncoder,
    }

    consoleEncoder := zapcore.NewConsoleEncoder(encoderConfig)

    consoleOut := zapcore.Lock(os.Stdout)

    var level zap.AtomicLevel
    err := level.UnmarshalText(([]byte(logLevel)))

    if err != nil {
        level.UnmarshalText([]byte(defaultLogLevel))
    }

    core := zapcore.NewTee(zapcore.NewCore(
        consoleEncoder,
        consoleOut,
        level,
    ))

    logger := zap.New(core)
    Logger = logger.Sugar()

    return Logger, nil
}

However when it generates the logs in CloudWatch, I see an extra character in the logs.
2022-06-30T21:52:43.310-07:00   2022-07-01T04:52:43.310Z [34mINFO[0m Process my event

*

*Why the logs is getting generated with [34m  and [0m string in it?

*Do I really need to generate logs with timestamp because I see cloudwatch already adds timestamp to logs.

A: To disable colors you can remove ASCII Escape Codes:
- EncodeLevel:    zapcore.CapitalColorLevelEncoder
+ EncodeLevel:    zapcore.CapitalLevelEncoder

I don't think you need to repeat time information, if you need more metrics later you'll probably log as JSONs and there will be already time information when querying from CloudWatch.


text:
Q: Show the following equivalence regarding the diagonalization of matrices.
Let $T$ be a linear operator on a finite dimensional vector space $V$. Let $\lambda_1 , \lambda_2 , \cdots , \lambda_k$ be the distinct eigen values of $T$. Let $W_1 , W_2 , \cdots , W_k$ be the eigen spaces corresponding to the distinct eigen values $\lambda_1 , \lambda_2 , \cdots , \lambda_k$ respectively. Then the following are equivalent $:$
$(1)$ $T$ is diagonalizable.
$(2)$ $V=W_1+W_2+ \cdots + W_k$.

My attempt $:$
I have assumed two lemmas which are as follows :
Lemma-1 :

Let $T$ be a linear operator on a finite dimensional vector space $V$.Then if $T$ is digonalizable then  it's eigen values are all regular.

This lemma can be proved easily by observing that if $T$ is diagonalizable then it's characteristics polynomial splits completely into linear factors and by looking at the null space of $T-\lambda I$ for each eigen value $\lambda$ of $T$ whose diagonal matrix representation contains exactly  $d$ zeros along the main diagonal if the algebraic multiplicity of $\lambda$ is $d$.
Lemma-2 :

Let $T$ be a linear operator on a finite dimensional vector space $V$ and let $f$ be a polynomial over the field of $V$ in one variable $t$. If $x$ be the eigen vector of $T$ corresponding to the eigen value $\lambda$ then $f(T)x=f(\lambda)x$.

Which can also be proved easily by observing that $T^n x =\lambda^n x$ for each $n \in \mathbb N$.
Lets now prove $(1) \implies (2)$.
Let $W=W_1+W_2+ \cdots +W_k$.
Claim $:$ $\dim W = \dim W_1 + \dim W_2 + \cdots + \dim W_k$.

Let $B_j = \{u^{j1},u^{j2},\cdots ,u^{jd_j} \}$ be the basis of $W_j$ for $1 \leq j \leq k$. Then it follows easily that $W$ is spanned by $B_1 \cup B_2 \cup \cdots \cup B_k$.To prove that $\cup B_j$ is linearly independent let us consider the equation
$c_{11}u^{11} + \cdots + c_{1d_1}u^{1d_1} + c_{21}u^{21}+\cdots+c_{2d_2}u^{2d_2}+\cdots+c_{k1}u^{k1}+\cdots+c_{kd_k}u^{kd_k}=0$.
Then for any polynomial $f$ applying $f(T)$ to both sides of the above equation and by applying lemma-2 we have
$c_{11}f(\lambda_1)u^{11} + \cdots + c_{1d_1}f(\lambda_1)u^{1d_1} + c_{21}f(\lambda_2)u^{21}+\cdots+c_{2d_2}f(\lambda_2)u^{2d_2}+\cdots+c_{k1}f(\lambda_k)u^{k1}+\cdots+c_{kd_k}f(\lambda_k)u^{kd_k}=0$.
In particular if we take the polynomial $f$ to be $f_j$ where $f_j$ is defined as
$f_j(x)=(x-\lambda_1)(x-\lambda_2)\cdots(x-\lambda_{j-1})(x-\lambda_{j+1})\cdots(x-\lambda_k)$ for $1 < j < k$; $f_j(x)=(x-\lambda_2)(x-\lambda_3)\cdots(x-\lambda_k)$ for $j=1$ and $f_j(x)=(x-\lambda_1)(x-\lambda_2)\cdots(x-\lambda_{k-1})$ for $j=k$ then we have
$c_{j1}=c_{j2}=\cdots=c_{jd_j}=0$ for $1 \leq j \leq k$.
This proves that $\cup B_j$ is linearly independent and hence a basis for $W$ and therefore $\dim W=\dim W_1+\dim W_2+\cdots+\dim W_k$ which proves our claim.

Now since $T$ is diagonalizable so by using lemma-1 we have
$\dim W_j =$ geometric multiplicity of $\lambda_j =$ algebraic multiplicity of $\lambda_j$.
Since $T$ is diagonalizable it's characteristics polynomial splits completely into linear factors and hence the sum of the algebraic multiplicities of the eigen values of $T$ should add upto $\dim V$. Hence $\dim W = \dim V$. But $W$ is a subspace of $V$. So it follows that $W=V$ and cosequently $V=W_1+W_2+\cdots+W_k$ and we are done.
$(2) \implies (1)$ $:$
If $V=W_1+W_2+\cdots+W_k$. Then as in the proof above $\cup B_j$ is linearly independent. Let $|B_j|=d_j$ for $1 \leq j \leq k$ and let $\dim V=n$. Then from the above proof it follows that $n=d_1+d_2+\cdots+d_n$. Let $B=\cup B_j$. Then $B$ is a linearly independent set of $n$ vectors from $V$ and since $\dim V=n$ so $B$ is a basis for $V$. So we have a basis $B$ for $V$ each vector of which is an eigen vector of $T$ and consequently the matrix representation of $T$ relative to that ordered basis $B$ is a diagonal matrix. Therefore $T$ is diagonalizable.
Hence the result follows.
Now my question is : Is my reasoning above ok? Though I am not satisfied with my proof. The main reason behind it that the proof is too large and hence laborious. Is there any easy shorter way of proving this result? Please help me by proving this if there is any.
Thank you in advance.

A: Unless I'm missing something, I think the proof should be a lot shorter, the result should be almost immediate. Your proof for $(2) \implies (1)$ is nice, here's an alternative for the other direction.
$(1) \implies (2)$. Since $T$ is diagonalisable, there is a basis $v_1, \ldots, v_n$ of $V$ (where $n = \dim V$) such that $T v_i = a_i v_i$ for some scalars $a_1, \ldots, a_n$. These scalars must be eigenvalues, and setting $W_j = \mathrm{span}\{v_i \mid a_i = \lambda_j\}$ gives that $V = W_1 + \ldots + W_n$, since any basis vector $v_i$ must lie in one of the $W_j$.


text:
Q: payload limit for S3 API Gateway is 10 MB, Still, Why I am able to upload file more than 10 Mb? As per doc, we have a payload limit of 10Mb. But, using S3 java API I am able to upload file more than 10 Mb. I am not able to understand this.

A: S3 and API Gateway are two independent services.
If you are using the Java SDK to access S3, then you are not using API Gateway, and not subject to its limits.  API Gateway is a separate service that allows you to build custom APIs, including endpoints that can proxy intact or transformed requests to other services, including S3, in which case the transfers are subject to the documented limits for the gateway.
If you are invoking an AWS Lambda function from API Gateway, the limit only applies to the request and response payloads in and out of the function through the gateway.  The function code itself can access S3 with the SDK and exchange arbitrarily large payloads with S3 -- it just can't accept a request body or render a response body that exceeds the payload limits of APi Gateway or the Lambda service.


text:
Q: Recursively display nested XML and attributes PHP The end goal of this is to load an XML Settings file and be able to modify it via html forms. I am having trouble even loading the nested XML with its attributes to print though, which is my first step.
This is a snippit of the XML:
<Settings>
    <GSettings>
        <Name Value="Plane"/>
        <Id Value="50"/>
        <Timeout Value="100"/>
    </GeneralSettings>
    <WingSetting>
        <LeftWing Color="Red" Value="1"/>
        <RightWing Value="0"/>
        <MiddleBar>
            <Fields>
                <Value>Direction</Value>
                <Value>Speed</Value>
                <Value>Height</Value>
            </Fields>
        </MiddleBar>
    </WingSetting>

So the goal for something like this would be to print something along the lines of:
.GSettings.Name =
ATTRIBUTES:
Value = Plane

.GeneralSettings.Id =
ATTRIBUTES:
Value = 50

.GeneralSettings.Timeout =
ATTRIBUTES:
Value = 100

.WingSetting.LeftWing =
ATTRIBUTES:
Value = 1
Color = Red

.WingSetting.RightWing =
ATTRIBUTES:
Value = 0

.WingSetting.MiddleBar=

.WingSetting.MiddleBar.Fields.Value=Direction

.WingSetting.MiddleBar.Fields.Value=Speed

.WingSetting.MiddleBar.Fields.Value=Height

I am able to recursivly print the XML and the children, and in the case of the middlebar fields, I can print the speed direction and height. But I don't know how to get the attributes out and print them as I go. Current code is this:
$xml=simplexml_load_file("MySettings.xml");
RecurseXML($xml);

function RecurseXML($xml,$parent="")
{
   $child_count = 0;
   foreach($xml as $key=>$value)
   {

      $child_count++;
      if(RecurseXML($value,$parent.".".$key) == 0)
      {

         echo($parent . "." . (string)$key . " = " . (string)$value . "
\n");
      }
   }
   return $child_count;
}

Which prints it exactly how I want except without the attribute options in it. I know there is an attributes() option but I couldn't figure out how to add it so it does so recursively.  Any ideas on how to add this in?

A: Add this code after echo line
     //  Get an array of attributes
     $attribs = $value->attributes();
     // If its not empty
     if(count($attribs)) {
         echo "ATTRIBUTES:
\n";
     }
     // Output an each attribute value
     foreach($attribs as $k=>$v) {
         echo "$k = $v
\n";
     }


text:
Q: Adding Search Bar in PowerPoint using VBA which searches the word entered by the user in a particular slide and highlights it? I wish to add a search bar in my presentation which searches a particular word entered by the user in a particular slide and highlight it. That word will have a hyperlink attached to it which will take it to the meaning of the word.
I am a newbie in VBA. I have this code, need necessary changes to make it work.
Private Sub TextBox1_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer)
Dim osld As Slide
Dim oshp As Shape
Dim b_found As Boolean
Dim oTxtRng As TextRange
Dim sTextToFind As String

sTextToFind = Me.TextBox1.Text

 If KeyCode = 13 Then 'ENTER PRESSED
 If Me.TextBox1.Text <> "" Then
     For Each osld In Application.ActivePresentation.Slides(5)
         For Each oshp In osld.Shapes
             If oshp.HasTextFrame Then
                 If oshp.TextFrame.HasText Then
                     If InStr(UCase(oshp.TextFrame.TextRange), UCase(Me.TextBox1.Text)) > 0 Then
                     SlideShowWindows(1).View.GotoSlide (osld.sectionIndex(5))
                     Set oTxtRng = oshp.TextFrame.TextRange.Characters(InStr(oshp.TextFrame.TextRange.Text, sTextToFind), Len(sTextToFind))
                     Debug.Print oTxtRng.Text
                     With oTxtRng
                      .Font.Bold = True
                 End With

             b_found = True
          Exit For
       End If
    End If
 End If
 Next oshp
 If b_found = True Then Exit For
 Next osld
 End If
 If b_found = False Then MsgBox "Not found"
End If
End Sub

A: Thanks for posting your code; in addition, you should explain what exactly the problem with it is.  Does it not compile, does it do the wrong stuff, does it not do anything ... ?  I'm assuming that this is supposed to run in slide show view and that there's a textbox on one of the slides. That may be obvious to you but not to the world at large.  Better to make it clear up front, save everybody some time.
Give this a try.  Note that it'll only find the first instance of the word in question within a given text range.
Private Sub TextBox1_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer)
Dim osld As Slide
Dim oshp As Shape
Dim b_found As Boolean
Dim oTxtRng As TextRange
Dim sTextToFind As String

'sTextToFind = Me.TextBox1.Text

 If KeyCode = 13 Then 'ENTER PRESSED
 If Me.TextBox1.Text <> "" Then
   sTextToFind = Me.TextBox1.Text
     'For Each osld In Application.ActivePresentation.Slides(5)
    For Each oshp In ActivePresentation.Slides(5).Shapes
        If oshp.HasTextFrame Then
            If oshp.TextFrame.HasText Then
                If InStr(UCase(oshp.TextFrame.TextRange), UCase(Me.TextBox1.Text)) > 0 Then
                    'SlideShowWindows(1).View.GotoSlide (osld.sectionIndex(5))
                    SlideShowWindows(1).View.GotoSlide (5)
                    Set oTxtRng = oshp.TextFrame.TextRange.Characters(InStr(oshp.TextFrame.TextRange.Text, sTextToFind), Len(sTextToFind))
                    Debug.Print oTxtRng.Text
                    With oTxtRng
                     .Font.Bold = True
                    End With

                    b_found = True
                    Exit For
                End If
            End If
        End If
    Next oshp
'    If b_found = True Then Exit For
'    Next osld
 End If
 If b_found = False Then MsgBox "Not found"
End If
End Sub


text:
Q: Remove an Application from Control Panel? Any Windows tool available to remove an application from Control Panel's "Add or Delete Programs"? For example I have an application listed in the Control Panel. I know I can remove it from disk and there is no need to clean it from reg or any other places. However, the app is still in the Control Panel's "Add or Delete Programs" list.
I think that there is Windows reg setting for this. Not sure what tool is available to remove it? The reason I ask this question is that I want to do it in an automation way instead of manual way.
The Windows is XP platform.

A: I would recommend using Ccleaner both to remove programs and to clear them from the registry. It comes with a registry error finder (and fixer) so it should be able to handle it.

A: All items displayed in "Add or remove programs" are stored in the registry. Take a look at the following key:
HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall

Each key (folder) has a number of values that relate to how it is displayed in the Control Panel applet. Remove it from here, and it won't show up on the list.
When looking through the keys, look for the UninstallString value. It should point to a location on the drive, not MsiExec.exe. From what I've seen, the ones that point to Msiexec are redundant and don't always need to be removed. It depends on the software in question.

A: Microsoft has a Knowledge Base article about this problem. It requires modification of the registry.
You can also use a tool for this, like Add/Remove Manager:

A: RevoUninstaller will scan your registry/hard drive for left behind keys and files


text:
Q: Access violation when executing ShellCode via CreateThread I Created an executable that contains a Shell code.
The ShellCode is suppose to execute calc.exe.
I use CreateThread to execute the ShellCode.
The Shellcode is indeed executed and calc.exe spawns.
BUT!!! few milliseconds after, my executable crashes.
When Running the code is VS, I get an error of 0xC0000005 (Access Violation).
This happens when I run different ShellCodes as well.
I tried 2 techniques, of holding the ShellCode (stack and heap)
int main()
{
int payload_len = 4;

unsigned char* payload = (unsigned char*)malloc(payload_len * sizeof(unsigned char));
if (payload == NULL)
{
    printf("Malloc Error");
    exit(EXIT_FAILURE);
}

unsigned char payload_2[] =
"\0x90\0x90\0xcc\xc3";

RtlMoveMemory(payload, payload_2, payload_len);

//Allocate a memory buffer that will recive the shellcode from the FileMapping later
void* page_to_execute;
page_to_execute = (unsigned char*)VirtualAlloc(0, payload_len, MEM_COMMIT | MEM_RESERVE, PAGE_READWRITE);

//Copy the payload from the FileMappingObject to the newly allocated memory page
RtlMoveMemory(page_to_execute, payload, payload_len);

//Converte the new memory page from RW -> RWX
DWORD OldProtect = 0;
int result = VirtualProtect(page_to_execute, payload_len, PAGE_EXECUTE_READWRITE, &OldProtect);

DWORD TID;
HANDLE th =::CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)page_to_execute, 0, 0, &TID);
WaitForSingleObject(th, -1);

}
int main()
{
    int payload_len = 4;

    unsigned char payload[] =
    "\0x90\0x90\0xcc\xc3";

    //Allocate a memory buffer that will recive the shellcode from the FileMapping later
    void* page_to_execute;
    page_to_execute = (unsigned char*)VirtualAlloc(0, payload_len, MEM_COMMIT | MEM_RESERVE, PAGE_READWRITE);

    //Copy the payload from the FileMappingObject to the newly allocated memory page
    RtlMoveMemory(page_to_execute, payload, payload_len);

    //Converte the new memory page from RW -> RWX
    DWORD OldProtect = 0;
    int result = VirtualProtect(page_to_execute, payload_len, PAGE_EXECUTE_READWRITE, &OldProtect);

    DWORD TID;
    HANDLE th =::CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)page_to_execute, 0, 0, &TID);
    WaitForSingleObject(th, -1);
}

As indicated before, the Shellcode itself doesn't matter as it even happens with the following one: \0x90\0x90\0xcc\xc3
Thus I kept the long (clac.exe) Shellcode outside (same outcome process crashes)
Both Create the same issue.
When looking at the Memory Address of the error using ProcessHacker its exactly the end of the ShellCode.
Any one has any idea why this happening?
64bit machine  -  Windows 10


text:
Q: Swift 2 - Visualizing an AVMutableComposition for Debugging : Converting Apple's AVCompositionDebugViewer I'm running into an issue with my swift 2 conversion of an Apple provided example for displaying an AVMutableComposition. This is a really useful project if you're trying to visualize your AVComposition to see what might be going on under the hood.

Update: I added print statements to each function to see the order they are being called, and who is calling them, in comparison to the Obj-C project.
Two Issues that I'm seeing that seem pretty important:

*

*synchronizePlayerWithEditor() is not getting called after buildTransitionComposition(_:andVideoComposition:andAudioMix:)

*observeValueForKeyPath(_:...) is NOT being called in the same order as the Obj-C project
Posting the snippet here to get the calling function as it's kind of useful
Obj-C
NSLog(@"%d %s %@", __LINE__, __PRETTY_FUNCTION__, [[NSThread callStackSymbols] objectAtIndex:1]);
Swift
func functionnYouWantToPrintCaller(yourNormalParameters..., function:String = __FUNCTION__){...}
print("\(__LINE__) \(__FUNCTION__) \(function)

Here is Apple's AVCompositionDebugViewer project I'm working from: https://developer.apple.com/library/mac/samplecode/AVCompositionDebugViewer
My github repo:
https://github.com/justinlevi/iOSAVCompositionDebugViewerSwift
I think the issue might be stemming from something in the keyValueObservation code although I'm not entirely sure at this point.

A: The issue ended up being in SimpleEditor.swiftbuildCompositionObjectsForPlayback` method. There were some global variables that were being defined incorrectly.
Everything seems to be working as expected now.
https://github.com/justinlevi/iOSAVCompositionDebugViewerSwift


text:
Q: C# Looking for 2 way communication. (WCF) My program:

*

*Different Clients connect to the Server (User login)

*Then server starts to Push  small data ( below 1KB ) to all of them every second (or less).
My questions:

*

*What service should I use? is WCF the right one?

*If WCF, then which protocol to use ? http, tcp ... ?

At first I thought WCF is the right thing to go with. I implemented a basic simple. Then suddenly I noticed this is only a Client to Server connection. and Server can't communicate the same way to client. Unless I start the service on client as well which makes it a server.
So in the end, I am asking how should I impelement this 2 way communication between server and client, considering the speed factor I mentioned and the right protocol to use.
UPDATE
Ok let me add some details. This is actually a Teacher client < > Server < > Students client communication program. Teacher draws something on a WPF's inkCanvas. and this drawing is supposed to be pushed to all students clients. That's why this data should be pushed by the server. and the communication has to be 2 way.

A: One possibility is to look at using a network library. Have a look at this article on using NetworkComms.Net to create a WPF chat application. The client -> server, server -> client relationship is symmetrical as opposed to WCF so push notifications are completely straight forward. You also have achoice of communication protocols, e.g. TCP or UDP, and can easily add your own extensions for processing outgoing/incoming data.
Disclaimer - I'm a developer for this library.

A: I implemented exactly same functionality to communicate between two WPF application. To answer your question, Yes, in my opinion WCF is the best way to go. I guess you have already implemented One way communication using WCF. To be able to have Server to talk back to clients you need to implement Callbacks, here is a good article to start with.

A: You're better off not to have the Server PUSH data to it's clients but rather have the clients PULL data from the Server. Although, this is possible with duplex, it is not highly recommeneded as most ISP or server environments, will not allow outbound messages from within their firewalls for security reasons.
Here's my suggestion:
Have the client application(s) occationally pull from the server rather than have the server push to it's clients.  This way, the server doesn't have to have a constant connection, because it doesn't scale and more importanly communication connections are very expensive resources from one application (i.e. Server).
Redesign your approach.

A: I have written a WCF server hosted on Windows Service using net.tcp and it definitely can push data to multiple clients. The framework does much of the listening, accepting and multiple connections for you so there's definitely a lot of benefits to yield.
The tricky part in your scenario would be sharing data from the teach client with student client. AFAIK, there is no built-in way to transfer data from one client-server connection to another.
One naive but simple way is to store the teacher data to a temp location (like a file or database and have some kind of mutex lock on it) and when it is time to transfer data to student, just read from the temp location.
Or you can change your architecture into Peer-To-Peer.


text:
Q: Stop YouTube embed after clicking outside modal When a certain button is clicked on my project, a modal opens up with two YouTube videos I embedded. The problem however is when I click outside this modal to close the modal the videos continue playing (whichever video is being played). I would like the video to stop playing when a user clicks outside the modal.
This is what i have tried
View

                    A sample of some our workshops and tutorials

Right now I am getting a modal with only one of the videos I embedded and it is not stopping when I close the modal.
Update
Based on the answer given this is what I have tried:

I can no longer close the modal when I click the space outside the modal. This is the error message I am getting in my browser console:
Uncaught ReferenceError: stopVideo is not defined
    at HTMLDivElement.<anonymous> ((index):564)
    at HTMLDivElement.dispatch (jquery-3.2.1.min.js:3)
    at HTMLDivElement.q.handle (jquery-3.2.1.min.js:3)
    at Object.trigger (jquery-3.2.1.min.js:4)
    at HTMLDivElement.<anonymous> (jquery-3.2.1.min.js:4)
    at Function.each (jquery-3.2.1.min.js:2)
    at r.fn.init.each (jquery-3.2.1.min.js:2)
    at r.fn.init.trigger (jquery-3.2.1.min.js:4)
    at r.t.hide (bootstrap.min.js:6)
    at HTMLDivElement.<anonymous> (bootstrap.min.js:6)

A: The bootstrap modals - which i assume you are using - have 2 events in place that are getting fired on closing. #1 hide.bs.modal #2 hidden.bs.modal. Have a look at the full list of modal events
So to run your stop function when closing your modal you would want to create a new eventhandler like so :
$('#workshops').on('hide.bs.modal', function() {
  // Stop the videos as soon as the modal's hide function gets called
  stopVideo("resp-iframe"); // your id seems to be a static value you could ofcourse also use the value from your #CloseModalButton
});


text:
Q: ¿porqué una regla CORS definida en el .htaccess es como si no existiera cuando realizo una llamada desde PostMan? He difinido una regla CORS en el .htaccess pero ocurre que cuando realizo la llamada desde el programa Postman esta regla no funciona, es como si no existiera, en cambio si realizo la llamada desde la aplicación web, entonces sí se aplica la regla y no recibo respuesta.
Las preguntas son:
1.- ¿porqué con el programa Postman esta regla es como si no existiera?
2.- ¿en algún lugar del postman se han definido url que después en la petición se añaden a la cabecera ?
Saludos.


text:
Q: mean.io unit tests don't run Starting with a fresh mean.io app i.e.
mean init newApp
cd newApp
npm install [1]
bower install

[1] npm install --dev causes npm to run forever and eventually fail with an out of memory error, so I ran npm install followed by individually npm install devPackage for each package listed in devDependencies
The output for gulp env:test mochaTest is then
Invoking gulp - development
[10:12:54] Using gulpfile ~/projects/kueDemo/gulpfile.js
[10:12:54] Starting 'env:test'...
[10:12:54] Finished 'env:test' after 56 μs
[10:12:54] Starting 'loadTestSchema'...
[10:12:54] Finished 'loadTestSchema' after 487 ms
[10:12:54] Starting 'mochaTest'...

  0 passing (0ms)

[10:12:54] Finished 'mochaTest' after 48 ms

No tests are failing either and there are definitely plenty of tests to run in the Article package, so I don't see why they aren't being picked up.
Note: I have to CTRL-C to stop the gulp task and return to the prompt
The app itself runs fine out of the box. The Karma tests run fine if I run gulp test -- the mocha tests are still ignored.
System:

*

*node v0.12.2

*npm v2.7.4

*meanio v0.9.26

A: Ok, after some debugging I found that this is a bug in the mean.io source.
in gulp/test.js the following lines should change:
Line 20:
    require('../node_modules/meanio/lib/core_modules/module/util').preload('../p
to
require('../node_modules/meanio/lib/core_modules/module/util').preload('./packages/**/server', 'model');

Similarly Line 24:
return gulp.src('../packages/**/server/tests/*.js', {read: false})

to
return gulp.src('./packages/**/server/tests/*.js', {read: false})

The node_modules/meanio/lib/core_modules/module/util preload function will now fail, but you can remedy this by patching the 2 realPath lines in the walk function:
// recursively walk modules path and callback for each file
function walk(wpath, type, excludeDir, callback) {
  // regex - any chars, then dash type, 's' is optional, with .js or .coffee extension, case-insensitive
  // e.g. articles-MODEL.js or mypackage-routes.coffee
  var rgx = new RegExp('(.*)-' + type + '(s?).(js|coffee)$', 'i');
  if (!fs.existsSync(wpath)) return;
  fs.readdirSync(wpath).forEach(function(file) {
    var newPath = path.join(wpath, file);
    var stat = fs.statSync(newPath);
    if (stat.isFile() && (rgx.test(file) || (baseRgx.test(file)) && ~newPath.indexOf(type))) {
      var realPath = fs.realpathSync(newPath);
      callback(realPath);
    } else if (stat.isDirectory() && file !== excludeDir && ~newPath.indexOf(type)) {
      walk(newPath, type, excludeDir, callback);
    }
  });
}


text:
Q: How to get the value from another form and pass it to you're other forms in C#? I'm a newbie in programming and can you help me about C#?
The thing is I want to get the value from another FORM and pass it to another FORM.
IT'S LIKE A LOGIN-SIGNUP PROJECT WITHOUT using database/MYSQL
I have Form1.Form2,Form3.
When I click the button from FORM1 "Create Account" it will hide and Form2 will appear after you create an account there's a button "Create" and it will Hide and Form1 will appear and there's a button "View Account Details" and Click it and Form1 will Hide and Form3 will appear witch contain all the Details of your Account witch you create in Form2 AND it will all change if you CREATE A NEW ACCOUNT in FORM2.

A: Create a singleton class that holds all of your data.  Form2 will set its values.  Form 3 will read its values.  Here's a simple example for the singleton:
public class LoginData
{
    public static readonly LoginData Instance = new LoginData();
    public string UserName {get; set;}
    public string Password {get; set;}
}

In your forms you will write something like
LoginData.Instance.UserName = inputBox.Text;

This is not how you would write a singleton for production grade code.  But it should work for an academic exercise.
You could simplify this even more by just making the properties static and omitting the Instance variable like this:
public class LoginData
{
    public static string UserName {get; set;}
    public static string Password {get; set;}
}

Then you would access the properties like this:
LoginData.UserName = inputBox.Text;


text:
Q: WPF for Silverlight folks For the last couple of years I have worked with Silverlight (from version 2 to 4) and never seriously used WPF. Are there any quick tours/links/tutorials that explains and introduces WPF: differences to Silverlight and its unique features?

A: A possible duplicate of WPF vs Silverlight?
Anyway, it won't be hard, as WPF introduces a greater feature set, and most are MORE extensive than SL. It's a like bit more features built ON TOP of SL, so your existing skills will definitely do. (I did the other way around, from WPF to Silverlight - for some web apps, and I confirm that it is harder)

A: These links might be helpful -
WPF Compatibility
http://msdn.microsoft.com/en-us/library/cc903925%28VS.95%29.aspx
Writing Cross-Platform XAML Applications
http://blogs.msdn.com/b/mikeormond/archive/2010/12/09/writing-cross-platform-xaml-applications.aspx
XAML Processing Differences Between Silverlight Versions and WPF
http://msdn.microsoft.com/en-us/library/cc917841%28VS.95%29.aspx
Porting from WPF to Silverlight: The Missing Pieces, Part 2
http://blogs.microsoft.co.il/blogs/arik/archive/2010/09/23/porting-from-wpf-to-silverlight-the-missing-pieces-part-2.aspx


text:
Q: How to specify allowed exceptions in WCF's configuration file? I´m building a set of WCF services for internal use through all our applications. For exception handling I created a default fault class so I can return treated message to the caller if its the case or a generic one when I have no clue what happened.
Fault contract:

    [DataContract(Name = "DefaultFault", Namespace = "http://contoso.com/api/2010/03")]
    public class DefaultFault
    {
        public DefaultFault(DefaultFaultItem[] items)
        {
            if (items == null || items.Length== 0)
            {
                throw new ArgumentNullException("items");
            }

            StringBuilder sbItems = new StringBuilder();

            for (int i = 0; i
Specifying that my method can throw this exception so the consuming client will be aware of it:

        [OperationContract(Name = "PlaceOrder")]
        [FaultContract(typeof(DefaultFault))]
        [WebInvoke(UriTemplate = "/orders", BodyStyle = WebMessageBodyStyle.Bare, ResponseFormat = WebMessageFormat.Json, RequestFormat = WebMessageFormat.Json, Method = "POST")]
        string PlaceOrder(Order newOrder);

Most of time we will use just .NET to .NET communication with usual binds and everything works fine since we are talking the same language. However, as you can see in the service contract declaration I have a WebInvoke attribute (and a webHttp binding) in order to be able to also talk JSON since one of our apps will be built for iPhone and this guy will talk JSON.
My problem is that whenever I throw a FaultException and have includeExceptionDetails="false" in the config file the calling client will get a generic HTTP error instead of my custom message.
I understand that this is the correct behavior when includeExceptionDetails is turned off, but I think I saw some configuration a long time ago to allow some exceptions/faults to pass through the service boundaries.
Is there such thing like this? If not, what do u suggest for my case?
Thanks a LOT!

A: in order to return exception you need to add above your service implementation the
service behavior attribute at this format :
[servicebehavior (ReturnUnknownExceptionAsFaults = true)]
note that this approach shall use for debug only
liran.

A: No I don't think so - if the includeExceptionDetails setting is set to false, then all exceptions will be generic (and by design so). I don't know of any "loophole" to make some faults show up in detail in that case.


text:
Q: Do we have more than one $D$ term for a single gauge group? I'm reading this note in chapter 6 which discusses $ {\cal N} = 2 $ supermultiplets, though the discussion is quite general and applies to $ {\cal N} = 1 $ fields in the adjoint representation. I summarize the discussion given in the paper here with a slightly simplified situation and notation for clarity. Suppose we have some field, $ \Phi $, in the adjoint representation of a gauge group $SU(N)$. The Kahler term for the field is
\begin{equation}\int d ^2 \theta \Phi ^\dagger e ^{ 2 g V ^a T ^a} \Phi =g D ^a \phi ^\dagger T ^a \phi + ...\end{equation}
and the kinetic gauge term gives,
\begin{equation}W^\alpha _a W_\alpha^a=\frac{1}{2} D ^a D ^a+...\end{equation}
The paper then goes on to integrate out the $D^a$ fields which gives,
\begin{equation}D^a =\Phi ^\dagger T ^a \Phi\end{equation}
Then the authors go on to introduce more ${\cal N} =1$ field, $H$. The $H$ field Lagrangian takes the form,
\begin{align}{\cal L} &= \int d^4\theta H ^\dagger e^{2q V ^a t ^a} H+ \int d^2\theta W^\alpha _a W_\alpha^a + ...\\&= g D ^a \Phi ^\dagger T ^a \Phi + \frac{1}{2}D_aD_a...\end{align}
where $t_a$ are the generators in the representation of the $H$ fields.
So far I have no issues, however then do something strange. They go on to again integrate out the $D$ fields, but they do so independently of the fields introduced earlier in the adjoint representation. However, don't we have a single $\vec{D}$ field for every gauge group, not every representation? So how come we are able to consider the sectors independently of one another?


text:
Q: Play! Framework REST with Hypermedia (HAL+JSON) Is there any plugin for Play! Framework (either Java or Scala) that supports easy creation of Resources that provide hypermedia metadata along with the normal JSON entity?
Something similar to Spring Data Rest / Hateoas, that enables easy link creation for json entities.
I cant find any concrete examples

A: AFAIK, there aren't any plugins/modules specifically for Play. But there are quite a few for Java and Scala that you can integrate in your project. I think you might even use Spring HATEOAS with dependency injection in Play!
Take a look here: Hypermedia APIs using HAL
A quick look at the examples, of a few of those libraries, indicate that a Play! integration should pose no problem.

Cheers!


text:
Q: How can i run node server? I'm using hapi-ninja, all is ok, and I would just run node server, but if I get these errors, I can not run it going to the route localhost:3000(Custom)
vagrant:/vagrant/hapi-ninja$ node server

module.js:340
    throw err;
          ^
Error: Cannot find module 'boom'
    at Function.Module._resolveFilename (module.js:338:15)
    at Function.Module._load (module.js:280:25)
    at Module.require (module.js:364:17)
    at require (module.js:380:17)
    at Object.<anonymous> (/vagrant/hapi-ninja/node_modules/hapi/lib/index.js:3:12)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Module.require (module.js:364:17)
vagrant:/vagrant/hapi-ninja$

A: The error says it all: you need the module boom.
To install, type in a terminal
npm install boom


text:
Q: Ember.js: Child records not rendered after switching between different routes? I have a list of tasks. Each task has a list of bullets (child items) next to it.
The bullets can be toggled.
I have 2 routes for displaying only completed and active tasks.
Displaying the tasks itself and switching between routes work always fine, the bullets are also shown.
Problem:

*

*First click on a child item works as well --> bullet gets toggled.

*Second click on a child item and NONE of the child records are
rendered anymore.

When I remove DayCompletedRoute & DayActiveRoute the bullets get rendered again.
Why is it not working with multiple routes?
App.Router.map(function () {
    this.resource('days', {path: "/"}, function () {

        this.resource('day', {path: "/days/:day_id"}, function () {
            this.route('active');
            this.route('completed');
        })
        this.route('new', {path: "/days/new"});

    });
});

// ROUTES
App.DaysRoute = Ember.Route.extend({
    model: function () {
        return this.store.find('day');
    }
});

App.DayRoute = Ember.Route.extend({
    model: function (day) {
        return this.store.find('day', day.day_id);
    }
});

App.DayIndexRoute = Ember.Route.extend({
    model: function () {
        return this.modelFor('day');
    }
});

App.DayCompletedRoute = Ember.Route.extend({
    model: function(){
         return this.modelFor('day').get('tasks').then(function(tasks){
             return tasks.filterBy('isCompleted', true);
         });
    }
});

App.DayActiveRoute = Ember.Route.extend({
    model: function() {
        return this.modelFor('day').get('tasks').then(function(tasks){
            return tasks.rejectBy('isCompleted', true);
        });
    },
    renderTemplate: function(controller) {
        this.render('day/completed', {controller: controller});
    }
});

Template Snippets:
<script type="text/x-handlebars" data-template-name="application">
// navigation here
       {{outlet}}
</script>

<script type="text/x-handlebars" data-template-name="days/new">...</script>

<script type="text/x-handlebars" data-template-name="days">
    {{outlet}}
</script>

<script type="text/x-handlebars" data-template-name="day">
    {{input type="text" placeholder="What needs to be done?" value=newTitle action="createTask"}}
    {{outlet}}

    {{#link-to "day.index" activeClass="selected"}}All{{/link-to}}
    {{#link-to "day.completed" activeClass="selected"}}Completed{{/link-to}}
    {{#link-to "day.active" activeClass="selected"}}Active{{/link-to}}
</script>

<script type="text/x-handlebars" data-template-name="day/index">
    {{#each task in this.tasks}}
        {{task.title}}
        {{#each item in task.sortedItems}}
            {{input type="checkbox" checked=item.filled}}
        {{/each}}
    {{/each}}
</script>

<script type="text/x-handlebars" data-template-name="day/completed">
    {{#each itemController="task"}}
        {{title}}
        {{#each item in sortedItems}}
            {{input type="checkbox" checked=item.filled}}
        {{/each}}
    {{/each}}
</script>