问:
Javascript local variable technique
I have a simple question related to one-line programming. First an example:

```<code>function test(a)
{
   var b=a.toString();
   return b.replace("a","b");
}
</code>```

It's very simple (this function is, of course, useless), but the question here is little more complicated: What if I was to do this in one line? I have my thoughts, but tell me does this work properly with respect to memory cleanup:

```<code>function test(a)
{
   return (arguments[1]=a.toString()).doSomething().doSomethingMore(arguments[1]);
}
</code>```

This is, of course, an example, but the idea is simple: use arguments as a container for local variables - I'm not sure, but from what I know, when a function is over, arguments are deleted also? Or does create new elements in arguments makes this element defined globally? From my tests, it seems that I'm correct, but I'm curious to see if anyone has tried this? Is this a safe and clean solution?:) Thanks for any comments.

Here are a more real problem with One-Line script problem:

```<code>function (number,limiter)
{
return ((arguments[2] = number.toString().replace(
         new RegExp("(\\d+)(\\d{3})($|"+limiter+")"),
         '$1'+limiter+'$2$3')) == number) ?
            arguments[2] :
            arguments.callee(arguments[2],limiter);
}
</code>```

This one line function do things with given string and return it or parse it recursively to the same function. (on other thread I show how this could be done without recursion, but this is not a case of a problem).

答:
You're needlessly complicating the operation. You don't need to declare anything at all.

```<code>function test(a) {
return a.toString().replace("a","b");
}
</code>```

There shouldn't be a hit to performance or memory with this.

However, if you were to use a closure, you could potentially run into memory issues.

Assigning a value to the arguments array like you're doing is pointless, as each function has its own arguments array. To address your question about scope, Javascript scoping is lexical; something declared locally inside a function isn't automatically accessible to things outside the function.

edit: using the arguments array is no cleaner or better than any other method. It's actually worse than being clear.

Title: Javascript local variable technique

Body:
I have a simple question related to one-line programming. First an example:

function test(a)
{
   var b=a.toString();
   return b.replace("a","b");
}

It's very simple (this function is, of course, useless), but the question here is little more complicated: What if I was to do this in one line? I have my thoughts, but tell me does this work properly with respect to memory cleanup:

function test(a)
{
   return (arguments[1]=a.toString()).doSomething().doSomethingMore(arguments[1]);
}

This is, of course, an example, but the idea is simple: use arguments as a container for local variables - I'm not sure, but from what I know, when a function is over, arguments are deleted also? Or does create new elements in arguments makes this element defined globally? From my tests, it seems that I'm correct, but I'm curious to see if anyone has tried this? Is this a safe and clean solution?:) Thanks for any comments.

Here are a more real problem with One-Line script problem:

function (number,limiter)
{
return ((arguments[2] = number.toString().replace(
         new RegExp("(\\d+)(\\d{3})($|"+limiter+")"),
         '$1'+limiter+'$2$3')) == number) ?
            arguments[2] :
            arguments.callee(arguments[2],limiter);
}

This one line function do things with given string and return it or parse it recursively to the same function. (on other thread I show how this could be done without recursion, but this is not a case of a problem).

Body:
You're needlessly complicating the operation. You don't need to declare anything at all.

function test(a) {
return a.toString().replace("a","b");
}

There shouldn't be a hit to performance or memory with this.

However, if you were to use a closure, you could potentially run into memory issues.

Assigning a value to the arguments array like you're doing is pointless, as each function has its own arguments array. To address your question about scope, Javascript scoping is lexical; something declared locally inside a function isn't automatically accessible to things outside the function.

edit: using the arguments array is no cleaner or better than any other method. It's actually worse than being clear.


来源: stackexchange

问:
Angular 2 validation on Hotel Amenity Open Time and Close Time
I am new to angular, so need some help. I have two fields open and close time of hotel amenities. There is no validation as such. Until user select none of them it must pass the validation but if user select any of them, then user must select another field also and vice verse.

Here is .html code

```<code><div class="form-group row">
     <div class="col-sm-3 col-sm-offset-1" [ngClass]="{'has-error':!addHotelMappingAmenities.controls['open_time'].valid && (addHotelMappingAmenities.controls['open_time'].dirty || addHotelMappingAmenities.controls['open_time'].touched)}">
            <div class="form-material">
              <label for="amenity-edit-opens">Opens at</label>
              <div id='amenity-edit-opens' class='input-group date'>
                <input formControlName="open_time" type='text' class="form-control" id="open_add_amenity" />
                <span class="input-group-addon">
                  <span class="glyphicon glyphicon-time"></span>
                </span>
              </div>
            </div>
            <div [ngClass]="{'help-block animated fadeInDown':addHotelMappingAmenities.controls['open_time'].hasError('required') && addHotelMappingAmenities.controls['open_time'].touched}" *ngIf="addHotelMappingAmenities.controls['open_time'].hasError('required') && addHotelMappingAmenities.controls['open_time'].touched">Please select open at.</div>
          </div>
          <div class="col-sm-3" [ngClass]="{'has-error':!addHotelMappingAmenities.controls['close_time'].valid && (addHotelMappingAmenities.controls['close_time'].dirty || addHotelMappingAmenities.controls['close_time'].touched)}">
            <div class="form-material">
              <label for="amenity-edit-closes">Closes at</label>
              <div id="amenity-edit-closes" class='input-group date'>
                <input formControlName="close_time" type='text' class="form-control" id="close_add_amenity" />
                <span class="input-group-addon">
                  <span class="glyphicon glyphicon-time"></span>
                </span>
              </div>
            </div>
            <div [ngClass]="{'help-block animated fadeInDown':addHotelMappingAmenities.controls['close_time'].hasError('required') && addHotelMappingAmenities.controls['close_time'].touched}" *ngIf="addHotelMappingAmenities.controls['close_time'].hasError('required') && addHotelMappingAmenities.controls['close_time'].touched">Please select Close at.</div>
          </div>
        </div>
</code>```

.ts code is here

```<code>this.addHotelMappingAmenities = this.formBuilder.group({
      hotel_id: [''],
      title: ['', Validators.compose([Validators.required, Validators.minLength(3), Validators.maxLength(30), Validators.pattern("^([a-zA-Z0-9!@#$%^&*()'?.,|-]+\\s)*[a-zA-Z0-9!@#$%^&*()'?.,|-]+$")])],
      contact_number: ['', Validators.required],
      open_time: [''],
      close_time: [''],
      type: ['', Validators.required],
      image: [''],
      description: ['', Validators.compose([Validators.required, Validators.minLength(10), Validators.maxLength(1000), Validators.pattern('^[^ <>\/](([a-zA-Z]+\s)*[^<>\/])*[^<>\/ ]+$')])],
});
</code>```

答:
You always can use a customValidator about all the form

```<code>customValidator(openTimeKey: string, closeTimeKey: string) {
    return (group: FormGroup): { [key: string]: any } | null => {
      let openTime: number = group.controls[openTimeKey].value;
      let closeTime: number = group.controls[closeTimeKey].value;
      let errorExist=(openTime && !closeTime) || (!openTime && closeTime);
      return errorExist?{error:'must choosen two or none"}:null;
    }
</code>```

then, when you define the form builder

```<code>this.addHotelMappingAmenities = this.formBuilder.group({
      hotel_id: [''],
      ...
      },{ validator: this.customValidator('openTime', 'closeTime') });
</code>```

ContentLicense: CC BY-SA 3.0

Body:
I am new to angular, so need some help. I have two fields open and close time of hotel amenities. There is no validation as such. Until user select none of them it must pass the validation but if user select any of them, then user must select another field also and vice verse.

Here is .html code

              Opens at

                <input formControlName="open_time" type='text' class="form-control" id="open_add_amenity" />

Please select open at.

              Closes at

                <input formControlName="close_time" type='text' class="form-control" id="close_add_amenity" />

Please select Close at.

.ts code is here

this.addHotelMappingAmenities = this.formBuilder.group({
      hotel_id: [''],
      title: ['', Validators.compose([Validators.required, Validators.minLength(3), Validators.maxLength(30), Validators.pattern("^([a-zA-Z0-9!@#$%^&*()'?.,|-]+\\s)*[a-zA-Z0-9!@#$%^&*()'?.,|-]+$")])],
      contact_number: ['', Validators.required],
      open_time: [''],
      close_time: [''],
      type: ['', Validators.required],
      image: [''],
      description: ['', Validators.compose([Validators.required, Validators.minLength(10), Validators.maxLength(1000), Validators.pattern('^[^ <>\/](([a-zA-Z]+\s)*[^<>\/])*[^<>\/ ]+$')])],
});

Body:
You always can use a customValidator about all the form

customValidator(openTimeKey: string, closeTimeKey: string) {
    return (group: FormGroup): { [key: string]: any } | null => {
      let openTime: number = group.controls[openTimeKey].value;
      let closeTime: number = group.controls[closeTimeKey].value;
      let errorExist=(openTime && !closeTime) || (!openTime && closeTime);
      return errorExist?{error:'must choosen two or none"}:null;
    }

then, when you define the form builder

this.addHotelMappingAmenities = this.formBuilder.group({
      hotel_id: [''],
      ...
      },{ validator: this.customValidator('openTime', 'closeTime') });


问:
Android Device act like Server
I working on one project which Android device is act like a Server.  I mean, when I send any requests to my device, then I will get a response.

If any one have any idea so please tell me.  I am waiting for the reply.

答:
A server usually accepts request on a certain IP and Port. This is a problem for mobile devices, because usually they're on a private network (behind a router) and one can not address IP and port of a special device.

So, practically spoken, I really doubt that a mobile device can act as a server.

A reliable solution would require some sort of extra proxy server. Basically your mobile will connect with this "ground-based" server and the system of proxy and handheld is the server you're looking for. It is operational once the handheld is connected. Client establish connection with the proxy and send their requests, the proxy forwards the request to the mobile device to get a service response for the client.

A nice architecture for this approach is XMPP, the implementation of the proxy server would be a standard xmpp server (like openfire).

ContentLicense: CC BY-SA 2.5

Title: Android Device act like Server


问:
CSS Tranistion Button Background Color
Trying to create a slide right transition on a button. If I remove the .container background color the transition works. But I want the button to start black and change to yellow while keeping the container color as default. But the output seems different. It will only transition to yellow if the button background is transparent. Any help is appreciated, been racking my brain way too long on this.

.container {
 background: #F0F0F0;
 margin: 20px 20%
}
a.animated-button:link, a.animated-button:visited {
 position: relative;
 display: block;
 margin: 30px auto 0;
 padding: 14px 15px;
 color: #fff;
 font-size: 14px;
 text-align: center;
 text-decoration: none;
 text-transform: uppercase;
 overflow: hidden;
 -webkit-transition: all 1s ease;
 -moz-transition: all 1s ease;
 -o-transition: all 1s ease;
 transition: all 1s ease;
}
a.animated-button:link:after, a.animated-button:visited:after {
 content: "";
 position: absolute;
 height: 0%;
 left: 50%;
 top: 50%;
 width: 150%;
 z-index: -1;
 -webkit-transition: all 0.75s ease 0s;
 -moz-transition: all 0.75s ease 0s;
 -o-transition: all 0.75s ease 0s;
 transition: all 0.75s ease 0s;
}
a.animated-button:link:hover, a.animated-button:visited:hover {
 color: #FFF;
}
a.animated-button:link:hover:after, a.animated-button:visited:hover:after {
 height: 450%;
}
a.animated-button:link, a.animated-button:visited {
 position: relative;
 display: block;
 margin: 30px auto 0;
 padding: 14px 15px;
 color: #fff;
 font-size: 14px;
 border-radius: 0;
 font-weight: bold;
 text-align: center;
 text-decoration: none;
 text-transform: uppercase;
 overflow: hidden;
 letter-spacing: .08em;
 text-shadow: 0 0 1px rgba(0, 0, 0, 0.2), 0 1px 0 rgba(0, 0, 0, 0.2);
 -webkit-transition: all 1s ease;
 -moz-transition: all 1s ease;
 -o-transition: all 1s ease;
 transition: all 1s ease;
}
a.animated-button.thar-three {
 color: #fff;
 cursor: pointer;
 display: block;
 position: relative;
 border: 2px solid #F7CA18;
 transition: all 0.4s cubic-bezier(0.42, 0, 0.58, 1) 0s;
}
a.animated-button.thar-three:hover {
 color: #000 !important;
}
a.animated-button.thar-three:hover:before {
 left: 0%;
 right: auto;
 width: 100%;
}
a.animated-button.thar-three:before {
 display: block;
 position: absolute;
 top: 0px;
 right: 0px;
 height: 100%;
 width: 0px;
 z-index: -1;
 content: '';
 color: #000 !important;
 background: #F7CA18;
 transition: all 0.4s cubic-bezier(0.42, 0, 0.58, 1) 0s;
}```
<pre class="snippet-code-html lang-html prettyprint-override"><code>        <div class="container">
          <p>Register</p>
        </div></code>```

答:
I adjust the code a bit and now the container is working well even with black background set. Its now animating from black to yellow. Additionally, I have also removed yellow border to create slick animation look.

Here is the working snippet.

.container {
 background: #F0F0F0;
 margin: 20px 20%
}
a.animated-button:link, a.animated-button:visited {
 position: relative;
 display: block;
 margin: 30px auto 0;
 padding: 14px 15px;
 color: #fff;
 font-size: 14px;
 text-align: center;
 text-decoration: none;
 text-transform: uppercase;
 overflow: hidden;
 -webkit-transition: all 1s ease;
 -moz-transition: all 1s ease;
 -o-transition: all 1s ease;
 transition: all 1s ease;
}
a.animated-button:link:after, a.animated-button:visited:after {
 content: "";
 position: absolute;
 height: 0%;
 left: 50%;
 top: 50%;
 width: 150%;
 z-index: -1;
 -webkit-transition: all 0.75s ease 0s;
 -moz-transition: all 0.75s ease 0s;
 -o-transition: all 0.75s ease 0s;
 transition: all 0.75s ease 0s;
}
a.animated-button:link:hover, a.animated-button:visited:hover {
 color: #FFF;
}
a.animated-button:link:hover:after, a.animated-button:visited:hover:after {
 height: 450%;
}
a.animated-button:link, a.animated-button:visited {
 position: relative;
 display: block;
 margin: 30px auto 0;
 padding: 14px 15px;
 color: #fff;
 font-size: 14px;
 border-radius: 0;
 font-weight: bold;
 text-align: center;
 text-decoration: none;
 text-transform: uppercase;
 overflow: hidden;
 letter-spacing: .08em;
  z-index: 1;
 text-shadow: 0 0 1px rgba(0, 0, 0, 0.2), 0 1px 0 rgba(0, 0, 0, 0.2);
 -webkit-transition: all 1s ease;
 -moz-transition: all 1s ease;
 -o-transition: all 1s ease;
 transition: all 1s ease;
}
a.animated-button.thar-three {
 color: #fff;
 cursor: pointer;
 display: block;
 position: relative;

 transition: all 0.4s cubic-bezier(0.42, 0, 0.58, 1) 0s;
  background-color: black;
}
a.animated-button.thar-three:hover {
 color: #000 !important;
}
a.animated-button.thar-three:hover:before {
 left: 0%;
 right: auto;
 width: 100%;
}
a.animated-button.thar-three:before {
 display: block;
 position: absolute;
 top: 0px;
 right: 0px;
 height: 100%;
 width: 0px;
 z-index: -1;
 content: '';
 color: #000 !important;
 background: #F7CA18;
 transition: all 0.4s cubic-bezier(0.42, 0, 0.58, 1) 0s;
}```
<pre class="snippet-code-html lang-html prettyprint-override"><code><div class="container">
          <p>Register</p>
        </div></code>```

Title: CSS Tranistion Button Background Color

Body:
Trying to create a slide right transition on a button. If I remove the .container background color the transition works. But I want the button to start black and change to yellow while keeping the container color as default. But the output seems different. It will only transition to yellow if the button background is transparent. Any help is appreciated, been racking my brain way too long on this.

.container {
 background: #F0F0F0;
 margin: 20px 20%
}
a.animated-button:link, a.animated-button:visited {
 position: relative;
 display: block;
 margin: 30px auto 0;
 padding: 14px 15px;
 color: #fff;
 font-size: 14px;
 text-align: center;
 text-decoration: none;
 text-transform: uppercase;
 overflow: hidden;
 -webkit-transition: all 1s ease;
 -moz-transition: all 1s ease;
 -o-transition: all 1s ease;
 transition: all 1s ease;
}
a.animated-button:link:after, a.animated-button:visited:after {
 content: "";
 position: absolute;
 height: 0%;
 left: 50%;
 top: 50%;
 width: 150%;
 z-index: -1;
 -webkit-transition: all 0.75s ease 0s;
 -moz-transition: all 0.75s ease 0s;
 -o-transition: all 0.75s ease 0s;
 transition: all 0.75s ease 0s;
}
a.animated-button:link:hover, a.animated-button:visited:hover {
 color: #FFF;
}
a.animated-button:link:hover:after, a.animated-button:visited:hover:after {
 height: 450%;
}
a.animated-button:link, a.animated-button:visited {
 position: relative;
 display: block;
 margin: 30px auto 0;
 padding: 14px 15px;
 color: #fff;
 font-size: 14px;
 border-radius: 0;
 font-weight: bold;
 text-align: center;
 text-decoration: none;
 text-transform: uppercase;
 overflow: hidden;
 letter-spacing: .08em;
 text-shadow: 0 0 1px rgba(0, 0, 0, 0.2), 0 1px 0 rgba(0, 0, 0, 0.2);
 -webkit-transition: all 1s ease;
 -moz-transition: all 1s ease;
 -o-transition: all 1s ease;
 transition: all 1s ease;
}
a.animated-button.thar-three {
 color: #fff;
 cursor: pointer;
 display: block;
 position: relative;
 border: 2px solid #F7CA18;
 transition: all 0.4s cubic-bezier(0.42, 0, 0.58, 1) 0s;
}
a.animated-button.thar-three:hover {
 color: #000 !important;
}
a.animated-button.thar-three:hover:before {
 left: 0%;
 right: auto;
 width: 100%;
}
a.animated-button.thar-three:before {
 display: block;
 position: absolute;
 top: 0px;
 right: 0px;
 height: 100%;
 width: 0px;
 z-index: -1;
 content: '';
 color: #000 !important;
 background: #F7CA18;
 transition: all 0.4s cubic-bezier(0.42, 0, 0.58, 1) 0s;
}

Register

Body:
I adjust the code a bit and now the container is working well even with black background set. Its now animating from black to yellow. Additionally, I have also removed yellow border to create slick animation look.

Here is the working snippet.

.container {
 background: #F0F0F0;
 margin: 20px 20%
}
a.animated-button:link, a.animated-button:visited {
 position: relative;
 display: block;
 margin: 30px auto 0;
 padding: 14px 15px;
 color: #fff;
 font-size: 14px;
 text-align: center;
 text-decoration: none;
 text-transform: uppercase;
 overflow: hidden;
 -webkit-transition: all 1s ease;
 -moz-transition: all 1s ease;
 -o-transition: all 1s ease;
 transition: all 1s ease;
}
a.animated-button:link:after, a.animated-button:visited:after {
 content: "";
 position: absolute;
 height: 0%;
 left: 50%;
 top: 50%;
 width: 150%;
 z-index: -1;
 -webkit-transition: all 0.75s ease 0s;
 -moz-transition: all 0.75s ease 0s;
 -o-transition: all 0.75s ease 0s;
 transition: all 0.75s ease 0s;
}
a.animated-button:link:hover, a.animated-button:visited:hover {
 color: #FFF;
}
a.animated-button:link:hover:after, a.animated-button:visited:hover:after {
 height: 450%;
}
a.animated-button:link, a.animated-button:visited {
 position: relative;
 display: block;
 margin: 30px auto 0;
 padding: 14px 15px;
 color: #fff;
 font-size: 14px;
 border-radius: 0;
 font-weight: bold;
 text-align: center;
 text-decoration: none;
 text-transform: uppercase;
 overflow: hidden;
 letter-spacing: .08em;
  z-index: 1;
 text-shadow: 0 0 1px rgba(0, 0, 0, 0.2), 0 1px 0 rgba(0, 0, 0, 0.2);
 -webkit-transition: all 1s ease;
 -moz-transition: all 1s ease;
 -o-transition: all 1s ease;
 transition: all 1s ease;
}
a.animated-button.thar-three {
 color: #fff;
 cursor: pointer;
 display: block;
 position: relative;

 transition: all 0.4s cubic-bezier(0.42, 0, 0.58, 1) 0s;
  background-color: black;
}
a.animated-button.thar-three:hover {
 color: #000 !important;
}
a.animated-button.thar-three:hover:before {
 left: 0%;
 right: auto;
 width: 100%;
}
a.animated-button.thar-three:before {
 display: block;
 position: absolute;
 top: 0px;
 right: 0px;
 height: 100%;
 width: 0px;
 z-index: -1;
 content: '';
 color: #000 !important;
 background: #F7CA18;
 transition: all 0.4s cubic-bezier(0.42, 0, 0.58, 1) 0s;
}

<div class="container">
          <p><a href="#" class="animated-button thar-three">Register</a></p>
        </div>


问:
Oracle SQL Developer- How to force 00:00:00 hour when inserting a new DATE value
In my Oracle SQL Developer, i have a table with a column with DATE format. When i insert a new row into this table, and insert a new value in this column, it automatically suggestes me the current date with the current hour.
I would like that it automatically suggestes me current date, but with 00:00:00 hour . Is there some setting or parameter that i can set in my SQL Developer to have this result?

答:
It seems to me that your DATE column is set with a DEFAULT of SYSDATE.  This means, for any INSERT operations which do not specify a value in your DATE column, the current date and time will populate for that row. However, if INSERT operations do specify a value in your DATE column, then the specified date value will supersede the DEFAULT of SYSDATE.

If an application is controlling INSERT operations on that table, then one solution is to ensure the application utilizes the TRUNC() function to obtain your desired results. For example:

```<code>INSERT INTO tbl_target
    (
    col_date,
    col_value
    )
VALUES
    (
    TRUNC(SYSDATE, 'DDD'),
    5000
    )
;
</code>```

However, if there are multiple applications or interfaces where users could be inserting new rows into the table, (e.g. using Microsoft Access or users running INSERT statements via SQL Developer) and you can't force all of those interfaces to utilize the TRUNC() function on that column during insertion, then you need to look into other options.

If you can ensure via applications that INSERT operations will not actually reference the DATE, then you can simply ALTER the table so that the DATE column will have a DEFAULT of TRUNC(SYSDATE). A CHECK CONSTRAINT can be added for further integrity:

```<code>ALTER TABLE tbl_target
     MODIFY
          (
          col_date DATE DEFAULT TRUNC(SYSDATE, 'DDD') NOT NULL
          )
     ADD
          (
          CONSTRAINT tbl_target_CHK_dt CHECK(col_date = TRUNC(col_date, 'DDD'))
          )
;
</code>```

However, if users still have the freedom to specify the DATE when inserting new rows, you will want to use a TRIGGER:

```<code>CREATE OR REPLACE TRIGGER tbl_target_biu_row
BEFORE INSERT OR UPDATE OF col_val
     ON tbl_target
FOR EACH ROW

BEGIN

     :NEW.col_date := TRUNC(SYSDATE, 'DDD');

END tbl_target_biu_row
;
</code>```

This will take of needing to manage the application code of all external INSERT operations on the table. Keep in mind, the above trigger is also modifying the DATE column if a user updates the specified value column.

Body:
It seems to me that your DATE column is set with a DEFAULT of SYSDATE.  This means, for any INSERT operations which do not specify a value in your DATE column, the current date and time will populate for that row. However, if INSERT operations do specify a value in your DATE column, then the specified date value will supersede the DEFAULT of SYSDATE.

If an application is controlling INSERT operations on that table, then one solution is to ensure the application utilizes the TRUNC() function to obtain your desired results. For example:

INSERT INTO tbl_target
    (
    col_date,
    col_value
    )
VALUES
    (
    TRUNC(SYSDATE, 'DDD'),
    5000
    )
;

However, if there are multiple applications or interfaces where users could be inserting new rows into the table, (e.g. using Microsoft Access or users running INSERT statements via SQL Developer) and you can't force all of those interfaces to utilize the TRUNC() function on that column during insertion, then you need to look into other options.

If you can ensure via applications that INSERT operations will not actually reference the DATE, then you can simply ALTER the table so that the DATE column will have a DEFAULT of TRUNC(SYSDATE). A CHECK CONSTRAINT can be added for further integrity:

ALTER TABLE tbl_target
     MODIFY
          (
          col_date DATE DEFAULT TRUNC(SYSDATE, 'DDD') NOT NULL
          )
     ADD
          (
          CONSTRAINT tbl_target_CHK_dt CHECK(col_date = TRUNC(col_date, 'DDD'))
          )
;

However, if users still have the freedom to specify the DATE when inserting new rows, you will want to use a TRIGGER:

CREATE OR REPLACE TRIGGER tbl_target_biu_row
BEFORE INSERT OR UPDATE OF col_val
     ON tbl_target
FOR EACH ROW

BEGIN

     :NEW.col_date := TRUNC(SYSDATE, 'DDD');

END tbl_target_biu_row
;

This will take of needing to manage the application code of all external INSERT operations on the table. Keep in mind, the above trigger is also modifying the DATE column if a user updates the specified value column.


问:
Why does "top: 50%; translateY(-50%);" create a lower gap than it should on certain elements within the same parent?
I have this layout for my top-bar:

All the elements should be vertically centered as per the design and here's my code:

https://codepen.io/anon/pen/gXGxWz

Unfortunately, the top-bar_right-part doesn't play nicely with the class core_vertical-align (notice how the left menu works) which does only this:

```<code>position: relative;
top: 50%;
transform: perspective(1px) translateY(-50%);
</code>```

And as per the codepen, here's how it looks:

What is the issue here? Additionally, the elements from the right part don't inherit the correct height (top-bar's), where as, the left menu does.

答:
If you are ok with different and better approach, I would use flexbox to
vertically center elements in the navbar.
Set the parent of your elements to:
-display: flex;
-align-items: center;
It will align all your elements vertically to the center.
For more info:
align-items center</p>

Body:
I have this layout for my top-bar:

All the elements should be vertically centered as per the design and here's my code:

https://codepen.io/anon/pen/gXGxWz

Unfortunately, the top-bar_right-part doesn't play nicely with the class core_vertical-align (notice how the left menu works) which does only this:

position: relative;
top: 50%;
transform: perspective(1px) translateY(-50%);

And as per the codepen, here's how it looks:

What is the issue here? Additionally, the elements from the right part don't inherit the correct height (top-bar's), where as, the left menu does.


问:
Protractor Implementation in Angular2 without using ids
I have application in Angularjs2, and developers have not been using ids into it. Now I have to implement the Protractor on same application. Is there anyway to implement the Protractor without using "absolute XPath"?

Thanks in advance!

答:
Please find a huge range of locator-possibilities on the official Protractortest API Page

Every element on a page needs to be uniquely identifiable... else the page wouldn't work, no matter which technology. Therefore with the help of any of the above provided locator-possibilities you'll always find the element you're looking for.

And there is never a need for XPath, except for this only one. (though there is an parentElementArrayFinder introduced in the meantime, so not even that one exception is valid anymore)

UDPATE

If you could use XPath, you can for sure use CSS-Locators.

Here some examples for locators:

$('div.class#id[anyAttribute="anyValue"] div.child.somewhere-below-div-point-class')

element(by.cssContainingText('div[data-index="2"]', 'select this option'))

Or as a specific example the "Learn More" of the "Tree List" section of https://js.devexpress.com/ :

```<code>treeListSection = element(by.cssContainingText('div.tab-content h2', 'Tree List')).getDriver();
learnMoreBtn = treeListSection.element(by.cssContainingText('a.tab-button','Learn More'));
learnMoreBtn.click();
</code>```

Those are just examples, but there is always a way to do it.
If you provide some example-HTML in your Question, I can direct you towards a solution.

UPDATE 2

For getting the Parent Web Element, one could use getDriver() as well

Body:
Please find a huge range of locator-possibilities on the official Protractortest API Page

Every element on a page needs to be uniquely identifiable... else the page wouldn't work, no matter which technology. Therefore with the help of any of the above provided locator-possibilities you'll always find the element you're looking for.

And there is never a need for XPath, except for this only one. (though there is an parentElementArrayFinder introduced in the meantime, so not even that one exception is valid anymore)

UDPATE

If you could use XPath, you can for sure use CSS-Locators.

Here some examples for locators:

$('div.class#id[anyAttribute="anyValue"] div.child.somewhere-below-div-point-class')

element(by.cssContainingText('div[data-index="2"]', 'select this option'))

Or as a specific example the "Learn More" of the "Tree List" section of https://js.devexpress.com/ :

treeListSection = element(by.cssContainingText('div.tab-content h2', 'Tree List')).getDriver();
learnMoreBtn = treeListSection.element(by.cssContainingText('a.tab-button','Learn More'));
learnMoreBtn.click();

Those are just examples, but there is always a way to do it.
If you provide some example-HTML in your Question, I can direct you towards a solution.

UPDATE 2

For getting the Parent Web Element, one could use getDriver() as well


问:
Cannot POST more than one value with AJAX
I stucked on one thing. I have a 2 grid inside checkboxes. When I selected that checkboxes I want to POST that row data values like array or List. Actually when i send one list item it's posting without error but when i get more than one item it couldn't post values.

Example of my grid

Here my ajax request and how to select row values function

```<code> var grid = $("#InvoceGrid").data('kendoGrid');
var sel = $("input:checked", grid.tbody).closest("tr");
var items = [];
$.each(sel, function (idx, row) {
    var item = grid.dataItem(row);
    items.push(item);
});

var grid1 = $("#DeliveryGrid").data('kendoGrid');
var sel1 = $("input:checked", grid1.tbody).closest("tr");
var items1 = [];
$.each(sel1, function (idx, row) {
    var item1 = grid1.dataItem(row);
    items1.push(item1);
});

$.ajax({
    url: '../HeadOffice/CreateInvoice',
    type: 'POST',
    data: JSON.stringify({ 'items': items, 'items1': items1, 'refnum': refnum }),
    contentType: 'application/json',
    traditional: true,
    success: function (msg) {
        if (msg == "0") {
            $("#lblMessageInvoice").text("Invoices have been created.")
            var del = $("#InvoiceOKWindow").data("kendoWindow");
            del.center().open();
            var del1 = $("#InvoiceDetail").data("kendoWindow");
            del1.center().close();
            $("#grdDlvInv").data('kendoGrid').dataSource.read();
        }
        else {
            $("#lblMessageInvoice").text("Problem occured. Please try again later.")
            var del = $("#InvoiceOKWindow").data("kendoWindow");
            del.center().open();
            return false;
        }
    }
});
</code>```

This is my C# part

```<code>[HttpPost]
    public string CreateInvoice(List<Pm_I_GecisTo_Result> items, List<Pm_I_GecisFrom_Result> items1, string refnum)
    {
        try
        {
            if (items != null && items1 != null)
            {
                //do Something
            }
            else
            {
                Log.append("Items not selected", 50);
                return "-1";
            }

        }
        catch (Exception ex)
        {
            Log.append("Exception in Create Invoice action of HeadOfficeController " + ex.ToString(), 50);
            return "-1";
        }
    }
</code>```

But when i send just one row it works but when i try to send more than one value it post null and create problem

How can i solve this? Do you have any idea?

EDIT

I forgot to  say but this way is working on localy but when i update server is not working proper.

答:
```<code>     $.ajax({
                url: '../HeadOffice/CreateInvoice',
                type: 'POST',
                async: false,
                data: { items: items, items1: items1 }

                success: function (msg) {
                   //add codes
                },
                error: function () {
                    location.reload();
                }

            });
</code>```

try to call controller by this method :)

Body:
I stucked on one thing. I have a 2 grid inside checkboxes. When I selected that checkboxes I want to POST that row data values like array or List. Actually when i send one list item it's posting without error but when i get more than one item it couldn't post values.

Example of my grid

Here my ajax request and how to select row values function

 var grid = $("#InvoceGrid").data('kendoGrid');
var sel = $("input:checked", grid.tbody).closest("tr");
var items = [];
$.each(sel, function (idx, row) {
    var item = grid.dataItem(row);
    items.push(item);
});

var grid1 = $("#DeliveryGrid").data('kendoGrid');
var sel1 = $("input:checked", grid1.tbody).closest("tr");
var items1 = [];
$.each(sel1, function (idx, row) {
    var item1 = grid1.dataItem(row);
    items1.push(item1);
});

$.ajax({
    url: '../HeadOffice/CreateInvoice',
    type: 'POST',
    data: JSON.stringify({ 'items': items, 'items1': items1, 'refnum': refnum }),
    contentType: 'application/json',
    traditional: true,
    success: function (msg) {
        if (msg == "0") {
            $("#lblMessageInvoice").text("Invoices have been created.")
            var del = $("#InvoiceOKWindow").data("kendoWindow");
            del.center().open();
            var del1 = $("#InvoiceDetail").data("kendoWindow");
            del1.center().close();
            $("#grdDlvInv").data('kendoGrid').dataSource.read();
        }
        else {
            $("#lblMessageInvoice").text("Problem occured. Please try again later.")
            var del = $("#InvoiceOKWindow").data("kendoWindow");
            del.center().open();
            return false;
        }
    }
});

This is my C# part

[HttpPost]
    public string CreateInvoice(List<Pm_I_GecisTo_Result> items, List<Pm_I_GecisFrom_Result> items1, string refnum)
    {
        try
        {
            if (items != null && items1 != null)
            {
                //do Something
            }
            else
            {
                Log.append("Items not selected", 50);
                return "-1";
            }

        }
        catch (Exception ex)
        {
            Log.append("Exception in Create Invoice action of HeadOfficeController " + ex.ToString(), 50);
            return "-1";
        }
    }

But when i send just one row it works but when i try to send more than one value it post null and create problem

How can i solve this? Do you have any idea?

EDIT

I forgot to  say but this way is working on localy but when i update server is not working proper.

Body:
     $.ajax({
                url: '../HeadOffice/CreateInvoice',
                type: 'POST',
                async: false,
                data: { items: items, items1: items1 }

                success: function (msg) {
                   //add codes
                },
                error: function () {
                    location.reload();
                }

            });

try to call controller by this method :)


问:
Background-size cover/center not working
I'm trying to center the background image to the div using background-size: cover and background-size: contain, but it does not work. I need to display background images inside HTML tags and use background-size in the css file, this is the code:

.container {
    width: 200px;
    height: 260px;
    position: relative;
    margin: 0 auto 40px;
    margin-left: 20px;
    display: inline-block;
}
.main{
    border: 1px solid black;
    background-color: #A6A6A6;
}
.card {
    width: 100%;
    height: 100%;
    position: absolute;
    border: 2px solid white;
}
.card div {
    height: 100%;
    width: 100%;
    color: white;
    text-align: center;
    position: absolute;
}
.card .front {
    background-repeat: no-repeat;
    background-position: center center;
    background-size: contain;
    -webkit-background-size: contain;
    -moz-background-size: contain;
    -o-background-size: contain;
}```
<pre class="snippet-code-html lang-html prettyprint-override"><code><body style="background-image:url(https://s3.amazonaws.com/Syntaxxx/background-gold-bokeh.jpg);">
<div class="main">
  <section class="container">
      <div class="card">
          <div class="front" style="background-image: url('http://www.mobygames.com/images/covers/l/403626-injustice-2-playstation-4-front-cover.png');">
          </div>
          <div class="back">1</div>
      </div>
  </section>
  <section class="container">
      <div class="card">
          <div class="front" style="background-image: url('http://www.mobygames.com/images/covers/l/403651-the-surge-playstation-4-front-cover.jpg');">
          </div>
          <div class="back">2</div>
      </div>
  </section>
</div>

</body></code>```

答:
I'm not sure if I understand you well, but have you tried background-position: 50%; ?

.container {
    width: 200px;
    height: 260px;
    position: relative;
    margin: 0 auto 40px;
    margin-left: 20px;
    display: inline-block;
}
.main{
    border: 1px solid black;
    background-color: #A6A6A6;
}
.card {
    width: 100%;
    height: 100%;
    position: absolute;
}
.card div {
    height: 100%;
    width: 100%;
    color: white;
    text-align: center;
    position: absolute;
}
.card .front {
    background-repeat: no-repeat center center fixed;
    -webkit-background-size: cover;
    -moz-background-size: cover;
    -o-background-size: cover;
    background-size: cover;
    background-position: 50%;
}```
<pre class="snippet-code-html lang-html prettyprint-override"><code><body style="background-image:url(https://s3.amazonaws.com/Syntaxxx/background-gold-bokeh.jpg);">
<div class="main">
  <section class="container">
      <div class="card">
          <div class="front" style="background-image: url('http://www.mobygames.com/images/covers/l/403626-injustice-2-playstation-4-front-cover.png');">
          </div>
          <div class="back">1</div>
      </div>
  </section>
  <section class="container">
      <div class="card">
          <div class="front" style="background-image: url('http://www.mobygames.com/images/covers/l/403651-the-surge-playstation-4-front-cover.jpg');">
          </div>
          <div class="back">2</div>
      </div>
  </section>
</div>

</body></code>```

Body:
I'm trying to center the background image to the div using background-size: cover and background-size: contain, but it does not work. I need to display background images inside HTML tags and use background-size in the css file, this is the code:

.container {
    width: 200px;
    height: 260px;
    position: relative;
    margin: 0 auto 40px;
    margin-left: 20px;
    display: inline-block;
}
.main{
    border: 1px solid black;
    background-color: #A6A6A6;
}
.card {
    width: 100%;
    height: 100%;
    position: absolute;
    border: 2px solid white;
}
.card div {
    height: 100%;
    width: 100%;
    color: white;
    text-align: center;
    position: absolute;
}
.card .front {
    background-repeat: no-repeat;
    background-position: center center;
    background-size: contain;
    -webkit-background-size: contain;
    -moz-background-size: contain;
    -o-background-size: contain;
}

1

2

Body:
I'm not sure if I understand you well, but have you tried background-position: 50%; ?

.container {
    width: 200px;
    height: 260px;
    position: relative;
    margin: 0 auto 40px;
    margin-left: 20px;
    display: inline-block;
}
.main{
    border: 1px solid black;
    background-color: #A6A6A6;
}
.card {
    width: 100%;
    height: 100%;
    position: absolute;
}
.card div {
    height: 100%;
    width: 100%;
    color: white;
    text-align: center;
    position: absolute;
}
.card .front {
    background-repeat: no-repeat center center fixed;
    -webkit-background-size: cover;
    -moz-background-size: cover;
    -o-background-size: cover;
    background-size: cover;
    background-position: 50%;
}

<body style="background-image:url(https://s3.amazonaws.com/Syntaxxx/background-gold-bokeh.jpg);">
<div class="main">
  <section class="container">
      <div class="card">
          <div class="front" style="background-image: url('http://www.mobygames.com/images/covers/l/403626-injustice-2-playstation-4-front-cover.png');">
          </div>
          <div class="back">1</div>
      </div>
  </section>
  <section class="container">
      <div class="card">
          <div class="front" style="background-image: url('http://www.mobygames.com/images/covers/l/403651-the-surge-playstation-4-front-cover.jpg');">
          </div>
          <div class="back">2</div>
      </div>
  </section>
</div>

</body>


问:
UITableViewAutomaticDimension applied on subtitle table view cell not working properly
I am making one view for the listing. It has dynamic length in subtitle. So i used UITableViewAutomaticDimension properties. I have not applied any constraint because both the label are table view cell properties so no need to make new custom cell.

But after running this project i marked that UITableViewAutomaticDimension not working properly. I don't know what i doing wrong. My code is like below

view did load

```<code>@IBOutlet weak var tblabc: UITableView!
    override func viewDidLoad() {
        super.viewDidLoad()

        tblabc.separatorColor = UIColor.clearColor()

        tblabc.estimatedRowHeight = 44
        tblabc.rowHeight = UITableViewAutomaticDimension

        // Do any additional setup after loading the view.
    }
</code>```

table view delegate and data source

```<code>func numberOfSectionsInTableView(tableView: UITableView) -> Int {
        return 1
    }
    func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
        return 5
    }
    func tableView(tableView: UITableView, heightForRowAtIndexPath indexPath: NSIndexPath) -> CGFloat {
        return UITableViewAutomaticDimension
    }
    func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell
    {
        var cell = tableView.dequeueReusableCellWithIdentifier("Cell")
        if (cell == nil)
        {

            cell = UITableViewCell(style: .Subtitle, reuseIdentifier: "Cell")
            cell?.selectionStyle = .None
            cell?.detailTextLabel?.font = _SETREGULARFONT_KARLA(IS_IPAD ? 19:15)
            cell?.textLabel?.font = _SETBOLDFONT_KARLA(IS_IPAD ? 17:13)
            cell?.detailTextLabel?.textColor = getColorFromRGB(120, G: 132, B: 158, A: 1.0)
            cell?.detailTextLabel?.numberOfLines = 0
            cell?.detailTextLabel?.lineBreakMode = .ByTruncatingTail
            cell?.selectionStyle = .None

        }

        cell?.textLabel?.text = "Testing" + "\(indexPath.row)"
        cell?.detailTextLabel?.text = "tesfhjdsfskdfhjkfhdjskfhsjkdfhdjsxdfgfjljkgjfklgfhsdjfhjkdshfdjskfhdjfjkfhafyhdsifjhdjksfbshdjkfkhdksjfhdjsfyhds8ufdhsfjkhdsfjhdfudsiufhdsfh"
        cell?.imageView?.image = UIImage(named: "new_temp")

        return cell!
    }
</code>```

View looks like below image

答: The problem should be fixed in iOS 11. A shortcut solution working just fine on lower versions is to fake the desired subtitle appearance within a Basic cell by setting its textlabel.attributedText to have a bolder first line(s) + \n + regular more lines. </p>

Body:
I am making one view for the listing. It has dynamic length in subtitle. So i used UITableViewAutomaticDimension properties. I have not applied any constraint because both the label are table view cell properties so no need to make new custom cell.

But after running this project i marked that UITableViewAutomaticDimension not working properly. I don't know what i doing wrong. My code is like below

view did load

@IBOutlet weak var tblabc: UITableView!
    override func viewDidLoad() {
        super.viewDidLoad()

        tblabc.separatorColor = UIColor.clearColor()

        tblabc.estimatedRowHeight = 44
        tblabc.rowHeight = UITableViewAutomaticDimension

        // Do any additional setup after loading the view.
    }

table view delegate and data source

func numberOfSectionsInTableView(tableView: UITableView) -> Int {
        return 1
    }
    func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
        return 5
    }
    func tableView(tableView: UITableView, heightForRowAtIndexPath indexPath: NSIndexPath) -> CGFloat {
        return UITableViewAutomaticDimension
    }
    func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell
    {
        var cell = tableView.dequeueReusableCellWithIdentifier("Cell")
        if (cell == nil)
        {

            cell = UITableViewCell(style: .Subtitle, reuseIdentifier: "Cell")
            cell?.selectionStyle = .None
            cell?.detailTextLabel?.font = _SETREGULARFONT_KARLA(IS_IPAD ? 19:15)
            cell?.textLabel?.font = _SETBOLDFONT_KARLA(IS_IPAD ? 17:13)
            cell?.detailTextLabel?.textColor = getColorFromRGB(120, G: 132, B: 158, A: 1.0)
            cell?.detailTextLabel?.numberOfLines = 0
            cell?.detailTextLabel?.lineBreakMode = .ByTruncatingTail
            cell?.selectionStyle = .None

        }

        cell?.textLabel?.text = "Testing" + "\(indexPath.row)"
        cell?.detailTextLabel?.text = "tesfhjdsfskdfhjkfhdjskfhsjkdfhdjsxdfgfjljkgjfklgfhsdjfhjkdshfdjskfhdjfjkfhafyhdsifjhdjksfbshdjkfkhdksjfhdjsfyhds8ufdhsfjkhdsfjhdfudsiufhdsfh"
        cell?.imageView?.image = UIImage(named: "new_temp")

        return cell!
    }

View looks like below image


问:
Testing iPad applications
Bit of a hardware question here. I am developing iPad applications for a client and am finding that when I send over beta versions for the client to test, he is finding many more crashes on his devices than I am seeing. A lot of these crashes are 'low memory crashes' which I simply am not seeing/able to reproduce.

Am wondering what differences between the 2 devices there may be so that we can work out if it is a hardware issue. Any ideas?

答:
Make sure of the client's configuration/environment matches your environment. Eg: Outlook Exchange Sync, MobileMe sync. In my Contacts application these caused a lot of crashes because of these.

If possible add more logs and get the logs from console of the client device and verify.

Title: Testing iPad applications


问:
Vue.js - Uncaught (in promise) TypeError: __WEBPACK_IMPORTED_MODULE_0__services_Api__.a.post is not a function
Everytime I click the register button i get this error:

Uncaught (in promise) TypeError: __WEBPACK_IMPORTED_MODULE_0__services_Api__.a.post is not a function

The AuthenticationService.js has the following code:

import Api from '@/services/Api'

export default {
  register (credentials) {
    return Api.post('register', credentials)
  }
}```
</div>
</div>
</p>

<p>Api.js has the following code:</p>

<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-js lang-js prettyprint-override"><code>import axios from 'axios'

export default () => {
  return axios.create({
    baseURL: `http://localhost:8081/`
  })
}</code>```

This is the code for app.js:

console.log('Sup?')
const express = require('express')
const bodyParser = require('body-parser')
const cors = require('cors')
const morgan = require('morgan')

const app = express()
app.use(morgan('combined'))
app.use(bodyParser.json())
app.use(cors())

app.post('/register', (req, res) => {
  res.send({
    message: `${req.body.email} Registered!`
  })
})

app.listen(process.env.PORT || 8081)```
</div>
</div>
</p>

<p>Register.vue has this code:</p>

<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-html lang-html prettyprint-override"><code><template>
  <div>
    <h1>Register</h1>
    <input
      type="email"
      name="email"
      v-model="email"
      placeholder="email"/>
    <br>
    <input
      type="password"
      name="password"
      v-model="password"
      placeholder="password"/>
    <br>
    <button @click="register">
      Register
    </button>
  </div>
</template>

<script>
import AuthenticationService from '@/services/AuthenticationService'
export default {
  data () {
    return {
      email: '',
      password: ''
    }
  },
  methods: {
    async register () {
      await AuthenticationService.register({
        email: this.email,
        password: this.password
      })
      console.log('done!')
    }
  }
  // watch: {
  //   email (value) {
  //     console.log('email changed: ', value)
  //   }
  // }
}
</script></code>```

Index.js has this:

import Vue from 'vue'
import Router from 'vue-router'
import HelloWorld from '@/components/HelloWorld'
import Register from '@/components/Register'

Vue.use(Router)

export default new Router({
  routes: [
    {
      path: '/',
      name: 'Hello',
      component: HelloWorld
    },
    {
      path: '/register',
      name: 'register',
      component: Register
    }
  ]
})```

The hierarchy is as under:Project Hierarchy

You can get this project at this link:
VueDev

答:
I had the same issue
I guess problem is here :

```<code>import Api from '@/services/Api'

export default {
 register (credentials) {
  return Api.post('register', credentials)
 }
}
</code>```

But there should be:

```<code>import Api from '@/services/Api'

export default {
  register (credentials) {
   return Api().post('register', credentials)
  }
}
</code>```

Body:
Everytime I click the register button i get this error:

Uncaught (in promise) TypeError: __WEBPACK_IMPORTED_MODULE_0__services_Api__.a.post is not a function

The AuthenticationService.js has the following code:

import Api from '@/services/Api'

export default {
  register (credentials) {
    return Api.post('register', credentials)
  }
}

Api.js has the following code:

import axios from 'axios'

export default () => {
  return axios.create({
    baseURL: `http://localhost:8081/`
  })
}

This is the code for app.js:

console.log('Sup?')
const express = require('express')
const bodyParser = require('body-parser')
const cors = require('cors')
const morgan = require('morgan')

const app = express()
app.use(morgan('combined'))
app.use(bodyParser.json())
app.use(cors())

app.post('/register', (req, res) => {
  res.send({
    message: `${req.body.email} Registered!`
  })
})

app.listen(process.env.PORT || 8081)

Register.vue has this code:

<template>

Register

    <input
      type="email"
      name="email"
      v-model="email"
      placeholder="email"/>

    <input
      type="password"
      name="password"
      v-model="password"
      placeholder="password"/>

    <button @click="register">
      Register
    </button>

</template>

Index.js has this:

import Vue from 'vue'
import Router from 'vue-router'
import HelloWorld from '@/components/HelloWorld'
import Register from '@/components/Register'

Vue.use(Router)

export default new Router({
  routes: [
    {
      path: '/',
      name: 'Hello',
      component: HelloWorld
    },
    {
      path: '/register',
      name: 'register',
      component: Register
    }
  ]
})

The hierarchy is as under:Project Hierarchy

You can get this project at this link:
VueDev

Body:
I had the same issue
I guess problem is here :

import Api from '@/services/Api'

export default {
 register (credentials) {
  return Api.post('register', credentials)
 }
}

But there should be:

import Api from '@/services/Api'

export default {
  register (credentials) {
   return Api().post('register', credentials)
  }
}


问:
How to count the number of the True in boolean matrix by use of Tensorflow?
How to count the number of the True in boolean matrix by use of Tensorflow? Thanks!</p>

```<code>[[False  True False False False  True False False False False]
[False  True False False False  True False False False False]
[False  True False False False  True False False False False]
[False  True False False False  True False False False False]]
</code>```

答:
Method 1:

```<code>In [29]: data = [
        [False, True, False,False,False, True, False,False,False,False],
        [False, True, False,False,False, True, False,False,False,False],
        [False, True, False,False,False, True, False,False,False,False],
        [False, True, False,False,False, True, False,False,False,False]
        ]

In [30]: if_true = tf.where(tf.equal(tf.constant(data), True))
# or just if_true = tf.where(tf.constant(data))

In [31]: sess.run(if_true).shape[0]
# only get the indices where the item is true, then the number of
# returned indices amounts to the number of True
Out[31]: 8
</code>```

This method is better in some way, for example to work out how many Falses are there and etc.

Method 2:

```<code>In [34]: if_true = tf.count_nonzero(tf.constant(data))

In [35]: sess.run(if_true)
Out[35]: 8
</code>```

Body:
How to count the number of the True in boolean matrix by use of Tensorflow? Thanks!

[[False  True False False False  True False False False False]
[False  True False False False  True False False False False]
[False  True False False False  True False False False False]
[False  True False False False  True False False False False]]

Body:
Method 1:

In [29]: data = [
        [False, True, False,False,False, True, False,False,False,False],
        [False, True, False,False,False, True, False,False,False,False],
        [False, True, False,False,False, True, False,False,False,False],
        [False, True, False,False,False, True, False,False,False,False]
        ]

In [30]: if_true = tf.where(tf.equal(tf.constant(data), True))
# or just if_true = tf.where(tf.constant(data))

In [31]: sess.run(if_true).shape[0]
# only get the indices where the item is true, then the number of
# returned indices amounts to the number of True
Out[31]: 8

This method is better in some way, for example to work out how many Falses are there and etc.

Method 2:

In [34]: if_true = tf.count_nonzero(tf.constant(data))

In [35]: sess.run(if_true)
Out[35]: 8


问:
How to insert notification feature by using Cordova Plugin?
I have problem with inserting notification with cordova local notification plugin. After I have installed notification plugin, this is the code I wrote to my js sheet.

```<code>alert("Hey you!");
    try { cordova.plugins.notification.local.launchDetails } catch (error) {
        alert(error.message)};
</code>```

and I got the error as shown in the second picture.

enter image description here

enter image description here

Anyone know how to resolve the error? Or if you know the complete step-by-step method on how to insert notification feature, would you mind sharing? Thank you in advanced.

答:
Have you tried using 'phonegap' instead of 'cordova'? It helped me fix a lot of issues before:

So instead of using:

```<code>try { cordova.plugins.notification.local.launchDetails } catch (error) {
    alert(error.message)};
</code>```

Try using:

```<code>try { phonegap.plugins.notification.local.launchDetails } catch (error) {
    alert(error.message)};
</code>```

Body:
I have problem with inserting notification with cordova local notification plugin. After I have installed notification plugin, this is the code I wrote to my js sheet.

alert("Hey you!");
    try { cordova.plugins.notification.local.launchDetails } catch (error) {
        alert(error.message)};

and I got the error as shown in the second picture.

enter image description here

enter image description here

Anyone know how to resolve the error? Or if you know the complete step-by-step method on how to insert notification feature, would you mind sharing? Thank you in advanced.

Body:
Have you tried using 'phonegap' instead of 'cordova'? It helped me fix a lot of issues before:

So instead of using:

try { cordova.plugins.notification.local.launchDetails } catch (error) {
    alert(error.message)};

Try using:

try { phonegap.plugins.notification.local.launchDetails } catch (error) {
    alert(error.message)};


问:
Cyclically mapping flat arrays of different sizes and summing the values
I have an issue with two arrays that I need to combine, where the first array contains a list of campaign names ( page_data ) like

```<code>[
    "Campaign 1",
    "Campaign 2",
    "Campaign 3"
]
</code>```

and another array that contains number of leads for the campaigns. But this array will contain twice as many keys as the campaign array like this:

```<code>[
    222,
    342,
    71,
    33,
    43,
    665
]
</code>```

It contains twice as many keys, because it will take leads from two different forms, so the values for key 0 and key 3 will be for campaign 1 and key 2 and key 4 will be for campaign 2. It will always be this way. If there are 5 campaigns, leads array will have 10 keys and key 0 and key 5 will be for campaign one, key 1 an key 6 for campaign 2, etc.

And then I have this piece of code to combine ( push ):

```<code>foreach (json_decode($result) as $key) {
   foreach ($pages["page_data"] as $p => $pvalue) {
       array_push(
           $leadArray,
           array(
               "pageName" => $pvalue["form_name"],
               "pageLeads" => $key[$p]
           )
       );
    }
}
</code>```

That will incorrectly make an array that looks something like:

```<code>[
    "campaign 1" => 222,
    "campaign 2" => 342,
    "campaign 3" => 71
]
</code>```

But that will only take keys 0,1,2 and so key 3,4,5 will not be in the array.

What I want is key 0 and key 3, key 1 and key 4, etc. in the leads array to be combined so the the new leads array will be

```<code>[
    255,
    386,
    736
]
</code>```

which I can then combine with the campaigns array as the number of keys from the two arrays will now match which will give me an array that looks like

```<code>[
    "campaign 1" => 255,
    "campaign 2" => 386,
    "campaign 3" => 736
]
</code>```

答:
Try this one</p>

```<code>$result = json_decode($result);
$count = count($result);
$final = array();
foreach($result as $key => $value){
  $final[$value] = $pages["page_data"][$key] + $pages["page_data"][$key+$count];
}
var_dump($final);
</code>```

ContentLicense: CC BY-SA 4.0

Body:
I have an issue with two arrays that I need to combine, where the first array contains a list of campaign names ( page_data ) like

[
    "Campaign 1",
    "Campaign 2",
    "Campaign 3"
]

and another array that contains number of leads for the campaigns. But this array will contain twice as many keys as the campaign array like this:

[
    222,
    342,
    71,
    33,
    43,
    665
]

It contains twice as many keys, because it will take leads from two different forms, so the values for key 0 and key 3 will be for campaign 1 and key 2 and key 4 will be for campaign 2. It will always be this way. If there are 5 campaigns, leads array will have 10 keys and key 0 and key 5 will be for campaign one, key 1 an key 6 for campaign 2, etc.

And then I have this piece of code to combine ( push ):

foreach (json_decode($result) as $key) {
   foreach ($pages["page_data"] as $p => $pvalue) {
       array_push(
           $leadArray,
           array(
               "pageName" => $pvalue["form_name"],
               "pageLeads" => $key[$p]
           )
       );
    }
}

That will incorrectly make an array that looks something like:

[
    "campaign 1" => 222,
    "campaign 2" => 342,
    "campaign 3" => 71
]

But that will only take keys 0,1,2 and so key 3,4,5 will not be in the array.

What I want is key 0 and key 3, key 1 and key 4, etc. in the leads array to be combined so the the new leads array will be

[
    255,
    386,
    736
]

which I can then combine with the campaigns array as the number of keys from the two arrays will now match which will give me an array that looks like

[
    "campaign 1" => 255,
    "campaign 2" => 386,
    "campaign 3" => 736
]

Body:
Try this one

$result = json_decode($result);
$count = count($result);
$final = array();
foreach($result as $key => $value){
  $final[$value] = $pages["page_data"][$key] + $pages["page_data"][$key+$count];
}
var_dump($final);


问:
Wrapping a Node as children cannot fire the function
So I have this code

```<code><bar change={this.change.bind(this)} />
</code>```

which is working properly but when I wrap bar:

```<code><foo children={<bar change={this.change.bind(this)}/>} />
</code>```

change function is not triggered anymore. Any thoughts about this?

答:
change function is triggered. problem must be from something else. maybe a HOC is interrupting.

class App extends React.Component {
  change(){
    alert('this code is running in ' + this.constructor.name + ' component');
  }

  render() {
    return <Foo children={<Bar change={this.change.bind(this)} />} />;
  }
}

class Foo extends React.Component {
  render() {
    return
{this.props.children}
;
  }
}

class Bar extends React.Component {
  render() {
    return
This is Bar component, click me to run change method!
;
  }
}

ReactDOM.render(
  <App />,
  document.getElementById('app')
);```
<pre class="snippet-code-html lang-html prettyprint-override"><code><script src="https://cdnjs.cloudflare.com/ajax/libs/react/15.1.0/react.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/15.1.0/react-dom.min.js"></script>

<div id="app"></div></code>```

Body:
So I have this code

<bar change={this.change.bind(this)} />

which is working properly but when I wrap bar:

<foo children={<bar change={this.change.bind(this)}/>} />

change function is not triggered anymore. Any thoughts about this?

Body:
change function is triggered. problem must be from something else. maybe a HOC is interrupting.

class App extends React.Component {
  change(){
    alert('this code is running in ' + this.constructor.name + ' component');
  }

  render() {
    return <Foo children={<Bar change={this.change.bind(this)} />} />;
  }
}

class Foo extends React.Component {
  render() {
    return <div>{this.props.children}</div>;
  }
}

class Bar extends React.Component {
  render() {
    return <div onClick={this.props.change}>This is Bar component, click me to run change method!</div>;
  }
}

ReactDOM.render(
  <App />,
  document.getElementById('app')
);

<script src="https://cdnjs.cloudflare.com/ajax/libs/react/15.1.0/react.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/15.1.0/react-dom.min.js"></script>

<div id="app"></div>


问:
Bootstrap Tab won't switch
I have two tabs in my sidebar at the right: http://www.futurebusinesscouncil.com/join-3/

Below the search you can see "Popular" and "Recent". I want to swtich that to Popular. Normally it should work with this code:

jQuery('#tabs a[href="#tab-popular"]').tab('show');

But sadly, it isn't switching the tab. Just the color is changing like it is active. But it isn't... Where is my failure?

Kind regards

答:
On page load just add class named 'active' in the first li.</p>

```<code>$('#tabs').find('li').removeClass('active');
$('#tabs').find('li:first').addClass('active');
</code>```

Title: Bootstrap Tab won't switch

Body:
On page load just add class named 'active' in the first li.

$('#tabs').find('li').removeClass('active');
$('#tabs').find('li:first').addClass('active');


问:
Converting string with time to minutes
I am working on an Android app that gets a time (duration) value as string.

For example, the app can get a value like: 6 hours 43 mins

or a value like: 15 mins

I am looking for a way to convert this strings to an integer value in minutes.

I have tried using this function, but I can´t extract the needed values:

```<code>str = str.replaceAll("[^\\d.]", "");
</code>```

Edit:

it could be possible a result like 6 hours, the only known condition is that minutes are always rounded to an integer, the minimum value is 1 min

答:
I am not sure whether this can be done in a single regex, but if I were you I would use a different regex to find the number of hours, the number of minutes, the number of seconds, etc.

Given a string in the format you mentioned, you can first extract the number of hours by using this regex:

```<code>\d+(?= hours?)
</code>```

Then extract the number of minutes:

```<code>\d+(?= mins?)
</code>```

If seconds can appear in the input string, you can use this to extract seconds as well:

```<code>\d+(?= secs?)
</code>```

If any of the regexes don't match, that means there isn't that information in the string.

Title: Converting string with time to minutes

Body:
I am working on an Android app that gets a time (duration) value as string.

For example, the app can get a value like: 6 hours 43 mins

or a value like: 15 mins

I am looking for a way to convert this strings to an integer value in minutes.

I have tried using this function, but I can´t extract the needed values:

str = str.replaceAll("[^\\d.]", "");

Edit:

it could be possible a result like 6 hours, the only known condition is that minutes are always rounded to an integer, the minimum value is 1 min

Body:
I am not sure whether this can be done in a single regex, but if I were you I would use a different regex to find the number of hours, the number of minutes, the number of seconds, etc.

Given a string in the format you mentioned, you can first extract the number of hours by using this regex:

\d+(?= hours?)

Then extract the number of minutes:

\d+(?= mins?)

If seconds can appear in the input string, you can use this to extract seconds as well:

\d+(?= secs?)

If any of the regexes don't match, that means there isn't that information in the string.


问:
content select option based on previous select option angularjs
i want to create 2 select option which the content of the other one selected option based to previous option. here is my html

```<code><div class="col-sm-2">
            <select class="form-control" ng-model="y">
                <option value="1">a</option>
                <option value="2">b</option>
            </select>
        </div>
        <div class="col-sm-2">
            <select class="form-control" ng-model="z">
                <option ng-repeat = "x in list" value="{{x.idproduct}}">{{x.descproduct}}</option>
            </select>
        </div>
</code>```

but there is error, the other select option wont showing the option like in this picture

here is my js file

```<code>if ($scope.y === 1) {
         $scope.list = [
          {idproduct:"13", descproduct:"cc"},
          {idproduct:"14", descproduct:"dd"}
         ];
       }
       if ($scope.y === 2) {
         $scope.list = [
          {idproduct:"15", descproduct:"ee"}
         ];
       }
</code>```

答:
You need to bind the change event so that your list gets updated at the time that your value is updated. Plus your === can cause an issue. With === your string value is being compared to integers 1 and 2.

Here is a plunker: ng-change for change in dropdown

```<code><select class="form-control" ng-model="y" ng-change="updateList()">
     <option value="1">a</option>
     <option value="2">b</option>
</select>
$scope.updateList()={
if ($scope.y == 1) {
         $scope.list = [
          {idproduct:"13", descproduct:"cc"},
          {idproduct:"14", descproduct:"dd"}
         ];
       }
       if ($scope.y == 2) {
         $scope.list = [
          {idproduct:"15", descproduct:"ee"}
         ];
       }
}
</code>```

Body:
i want to create 2 select option which the content of the other one selected option based to previous option. here is my html

            <select class="form-control" ng-model="y">
                <option value="1">a</option>
                <option value="2">b</option>
            </select>

            <select class="form-control" ng-model="z">
                <option ng-repeat = "x in list" value="{{x.idproduct}}">{{x.descproduct}}</option>
            </select>

but there is error, the other select option wont showing the option like in this picture

here is my js file

if ($scope.y === 1) {
         $scope.list = [
          {idproduct:"13", descproduct:"cc"},
          {idproduct:"14", descproduct:"dd"}
         ];
       }
       if ($scope.y === 2) {
         $scope.list = [
          {idproduct:"15", descproduct:"ee"}
         ];
       }

Body:
You need to bind the change event so that your list gets updated at the time that your value is updated. Plus your === can cause an issue. With === your string value is being compared to integers 1 and 2.

Here is a plunker: ng-change for change in dropdown

<select class="form-control" ng-model="y" ng-change="updateList()">
     <option value="1">a</option>
     <option value="2">b</option>
</select>
$scope.updateList()={
if ($scope.y == 1) {
         $scope.list = [
          {idproduct:"13", descproduct:"cc"},
          {idproduct:"14", descproduct:"dd"}
         ];
       }
       if ($scope.y == 2) {
         $scope.list = [
          {idproduct:"15", descproduct:"ee"}
         ];
       }
}


问:
Is there a better way to round float number with n decimals in C++?
I known the common way is to multiply 10^n and then divide 10^n. round a float with one digit number
But due to the double precision accuracy problem, I found the solution above doesn't fully work for my case:

```<code>0.965 * 0.9 = 0.8685

std::round(0.8685 * 1000) / 1000 = 0.869
// expects it to be 0.869
std::round(0.965 * 0.9 * 1000) / 1000 = 0.868
</code>```

If I want to get 0.869 from std::round(0.965 * 0.9 * 1000) / 1000 directly, I have to change the statement to

```<code>std::round((0.965 * 0.9 + std::numeric_limits<double>::epsilon()) * 1000) / 1000 = 0.869
</code>```

Is there a simpler way to do the rounding without add an epsilon for every calculation?

Edit: The problem is that, intuitively the value of std::round(0.965 * 0.9 * 1000) / 1000 shall be 0.869 (because 0.965 * 0.9 = 0.8685), but it actually give 0.868. I want to find common way get the accurate math value with 3 decimal precision.

答:
This is actually a surprisingly non-trivial problem, unless your problem is merely concerned with formatting output, in which case you can use an appropriate printf-style formatter, or ostream manipulator.

Fundamentally, denary rounding using a binary type doesn't make much sense. Your specific problem is due to the closest IEEE754 double to 0.965 being

```<code>0.96499999999999996891375531049561686813831329345703125
</code>```

Your first port of call is to study Is floating point math broken?. Hopefully that will convince you that adding an arbitrary "epsilon" merely shifts the problem to other inputs, and there is no numerical justification for your using std::numeric_limits<double>::epsilon() either.

std::round works perfectly, due in part that the cutoff point x.5 for integer x is a dyadic rational so can be represented exactly in binary floating point. But alas, you can't use that to round to an arbitrary decimal point.

If you're willing to live with the occasional bad result then the std::round(x * y) / y idiom that you're currently using is probably your best bet.

If you can't live with any spurious errors, then you probably need to use a decimal type and perform the rounding functions on that. See C++ decimal data types

Body:
I known the common way is to multiply 10^n and then divide 10^n. round a float with one digit number
But due to the double precision accuracy problem, I found the solution above doesn't fully work for my case:

0.965 * 0.9 = 0.8685

std::round(0.8685 * 1000) / 1000 = 0.869
// expects it to be 0.869
std::round(0.965 * 0.9 * 1000) / 1000 = 0.868

If I want to get 0.869 from std::round(0.965 * 0.9 * 1000) / 1000 directly, I have to change the statement to

std::round((0.965 * 0.9 + std::numeric_limits<double>::epsilon()) * 1000) / 1000 = 0.869

Is there a simpler way to do the rounding without add an epsilon for every calculation?

Edit: The problem is that, intuitively the value of std::round(0.965 * 0.9 * 1000) / 1000 shall be 0.869 (because 0.965 * 0.9 = 0.8685), but it actually give 0.868. I want to find common way get the accurate math value with 3 decimal precision.

Body:
This is actually a surprisingly non-trivial problem, unless your problem is merely concerned with formatting output, in which case you can use an appropriate printf-style formatter, or ostream manipulator.

Fundamentally, denary rounding using a binary type doesn't make much sense. Your specific problem is due to the closest IEEE754 double to 0.965 being

0.96499999999999996891375531049561686813831329345703125

Your first port of call is to study Is floating point math broken?. Hopefully that will convince you that adding an arbitrary "epsilon" merely shifts the problem to other inputs, and there is no numerical justification for your using std::numeric_limits<double>::epsilon() either.

std::round works perfectly, due in part that the cutoff point x.5 for integer x is a dyadic rational so can be represented exactly in binary floating point. But alas, you can't use that to round to an arbitrary decimal point.

If you're willing to live with the occasional bad result then the std::round(x * y) / y idiom that you're currently using is probably your best bet.

If you can't live with any spurious errors, then you probably need to use a decimal type and perform the rounding functions on that. See C++ decimal data types


问:
Checking total lines read by QTextStream without using a dedicated counter
I'm currently working on code for parsing a file with an unknown number of lines. The format is roughly like this:

```<code>ShapeId: 1
ShapeType: Line
ShapeDimensions: 20, 90, 100, 20
PenColor: blue
PenWidth: 2
PenStyle: DashDotLine
PenCapStyle: FlatCap
PenJoinStyle: MiterJoin

// and so on and so forth; formats vary slightly depending on the entry
</code>```

Being a text file, obviously we'll want to check for errors. Currently, I am doing this by throwing an exceptions with (fairly) informative messages.

However, my exception messages cannot be too specific, because many of my functions which help parse the file are too generic to have specific messages. Given the sheer diversity of the lines, it's impractical to have custom-written messages for each kind of line.

As I mentioned in the title, I am using QTextStream. I am using readLine to read the each line, and then doing stuff with that line. I am also using skipWhiteSpace to skip the gaps between the blocks of data.

I was hoping QTextStream would come with this functionality, but it doesn't. The closest thing I could find is pos. This is better than nothing, but it's not nearly as useful as a line number.

I could add an integer counter to count up as I step through each line. However, this is impractical in the context of my program, where I have many helper functions that will read lines. Also, skipWhiteSpace can skip multiple lines, so I couldn't use this if I were manually counting.

Unfortunately, I haven't been able to find a good solution. The closest would be something like this, but that's assuming we're already stepping through the file, one line at a time, within a simple loop. Again, that's too impractical in this situation.

So...I guess my question is: is there an elegant way of checking the line number which a QTextStream is pointing to without relying on any previous code? Am I missing something obvious?

(I would rather avoid using on libraries other than Qt and the basic C++ libraries for this.)

答:
Just an idea: if you can get your current position with QTextStream::pos() function, you can calculate the line number by reading the whole text before that position and count the new line characters in that string. Something like:

```<code>qint64 currentPos = stream.pos();
QString str = stream.read(currentPos);
int lineNum = str.count(QRegExp("\\r\\n?|\\n")) + 1;
</code>```

This may be slow, however you need the line number only for error reporting, so calling it once would be ok.

Body:
I'm currently working on code for parsing a file with an unknown number of lines. The format is roughly like this:

ShapeId: 1
ShapeType: Line
ShapeDimensions: 20, 90, 100, 20
PenColor: blue
PenWidth: 2
PenStyle: DashDotLine
PenCapStyle: FlatCap
PenJoinStyle: MiterJoin

// and so on and so forth; formats vary slightly depending on the entry

Being a text file, obviously we'll want to check for errors. Currently, I am doing this by throwing an exceptions with (fairly) informative messages.

However, my exception messages cannot be too specific, because many of my functions which help parse the file are too generic to have specific messages. Given the sheer diversity of the lines, it's impractical to have custom-written messages for each kind of line.

As I mentioned in the title, I am using QTextStream. I am using readLine to read the each line, and then doing stuff with that line. I am also using skipWhiteSpace to skip the gaps between the blocks of data.

I was hoping QTextStream would come with this functionality, but it doesn't. The closest thing I could find is pos. This is better than nothing, but it's not nearly as useful as a line number.

I could add an integer counter to count up as I step through each line. However, this is impractical in the context of my program, where I have many helper functions that will read lines. Also, skipWhiteSpace can skip multiple lines, so I couldn't use this if I were manually counting.

Unfortunately, I haven't been able to find a good solution. The closest would be something like this, but that's assuming we're already stepping through the file, one line at a time, within a simple loop. Again, that's too impractical in this situation.

So...I guess my question is: is there an elegant way of checking the line number which a QTextStream is pointing to without relying on any previous code? Am I missing something obvious?

(I would rather avoid using on libraries other than Qt and the basic C++ libraries for this.)

Body:
Just an idea: if you can get your current position with QTextStream::pos() function, you can calculate the line number by reading the whole text before that position and count the new line characters in that string. Something like:

qint64 currentPos = stream.pos();
QString str = stream.read(currentPos);
int lineNum = str.count(QRegExp("\\r\\n?|\\n")) + 1;

This may be slow, however you need the line number only for error reporting, so calling it once would be ok.


问:
SQL Row_Number() increase only when the value = 1 for a specific column
I am having some trouble generating row_number() in my SQL query as my expectation. I have this following output of my query-

Now, I want to add row number for all rows where row number will only increase when the value in C1 is = 1. Required output as below-

Any help will be appreciated. TIA

答:
I presume you have another column(s) in your query by which you determine the order of rows; without such a criteria, your whole question is pointless.

The query below will work on SQL Server 2012 or later versions:

```<code>declare @Table table (
    Id int identity(1,1) not null,
    C1 int
);

insert into @Table(C1) values (1),(4),(1),(1),(4),(1),(3),(4);

select t.C1,
    sum(case t.C1 when 1 then 1 else 0 end) over(order by t.Id) as [RN]
from @Table t;
</code>```

Body:
I presume you have another column(s) in your query by which you determine the order of rows; without such a criteria, your whole question is pointless.

The query below will work on SQL Server 2012 or later versions:

declare @Table table (
    Id int identity(1,1) not null,
    C1 int
);

insert into @Table(C1) values (1),(4),(1),(1),(4),(1),(3),(4);

select t.C1,
    sum(case t.C1 when 1 then 1 else 0 end) over(order by t.Id) as [RN]
from @Table t;


答: Create a function and put your Js code in that function and call function on ng-change of the first dropdown. Here you if condition executes once during app initialization. So by triggering ng-change we can call function and update the lists based on the selection.    </p>

Title: content select option based on previous select option angularjs


问:
Refresh failed with a 403 Forbidden error. The refresh token was revoked or expired. - When tried to enable Refreshtoken on Xamarin-Android project
I am receiving "Refresh failed with a 403 Forbidden error. The refresh token was revoked or expired." when i tried to enable the refreshtokens on Azure mobile app with AD authentication, app is build in Android(Xamarin) with client authentication flow implemented. I am doubting if refreshtokens are meant for client authentication flow, Please help.</p>

答:
In my case, I have issue with one of the Google account.
The others accounts do not have problem.
I notice the different is on the account with Two steps authentication enabled, the forbidden error is returned.
Please check it in your case.

Updated: it is not related to 2-step authentication.
Please check the detail here:
https://github.com/Azure/azure-mobile-apps-net-client/issues/293