问:
Angular: Type 'null' must have a '[Symbol.iterator]()' method that returns an iterator
I'm using Angular 7 and TypeScript. I have a function that gets a string like ">10" and extracts the operator and number from it using a regex.
When I compile it using "ng build" I'm getting the following error:

error TS2488: Type 'null' must have a 'Symbol.iterator' method that returns an iterator.

This is my code:

```<code>// Converts a string and number into an arithmetic expression and returns it.
  private evaluate(value: number, rule: string) {
    const [, operator, number ] = rule.match(/(\D+?)\s*(\d+)/);
    // const [operator, number] = rule.match(/^(<|>|==)|.*$/g);
    this.logger.debug(`Value: ${value}, Operator: ${operator}, Number: ${number}`);

    switch (operator) {
      case '>' : return value > Number(number);
      case '<' : return value < Number(number);
      case '==' : return value === Number(number);
    }

    return null;
  }
</code>```

I tried changing my tsconfig but nothing worked.
Here is my current tsconfig:

```<code>{
  "extends": "../../tsconfig.json",
  "compilerOptions": {
    "outDir": "../../out-tsc/lib",
    "target": "es2015",
    "module": "es2015",
    "moduleResolution": "node",
    "declaration": true,
    "sourceMap": true,
    "inlineSources": true,
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "importHelpers": true,
    "types": [],
    "lib": [
      "dom",
      "es2018"
    ]
  },
"angularCompilerOptions": {
    "annotateForClosureCompiler": true,
    "skipTemplateCodegen": true,
    "strictMetadataEmit": true,
    "fullTemplateTypeCheck": true,
    "strictInjectionParameters": true,
    "enableResourceInlining": true,
    "strict": true,                        /* Enable all strict type-checking options. */
    "noImplicitAny": true,                 /* Raise error on expressions and declarations with an implied 'any' type. */
    "strictNullChecks": true,              /* Enable strict null checks. */
    "strictFunctionTypes": true,           /* Enable strict checking of function types. */
    "strictPropertyInitialization": true,  /* Enable strict checking of property initialization in classes. */
    "noImplicitThis": true,                /* Raise error on 'this' expressions with an implied 'any' type. */
    "alwaysStrict": true,                  /* Parse in strict mode and emit "use strict" for each source file. */
    "downlevelIteration": true,            /* Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'. */
</code>```

答:
I solved it by making a null check as follows:</p>

```<code>private evaluate(value: number, rule: string) {
    const matches: any = rule.match(/(\D+?)\s*(\d+)/);
      if (matches === null) {
        return null;
      } else {
        const operator = matches[1];
        const number = matches[2];
        this.logger.debug(`Value: ${value}, Operator: ${operator}, Number: ${number}`);
        switch (operator) {
          case '>' : return value > Number(number);
          case '<' : return value < Number(number);
          case '==' : return value === Number(number);
        }

        return null;
      }
}
</code>```

Body:
I'm using Angular 7 and TypeScript. I have a function that gets a string like ">10" and extracts the operator and number from it using a regex.
When I compile it using "ng build" I'm getting the following error:

error TS2488: Type 'null' must have a 'Symbol.iterator' method that returns an iterator.

This is my code:

// Converts a string and number into an arithmetic expression and returns it.
  private evaluate(value: number, rule: string) {
    const [, operator, number ] = rule.match(/(\D+?)\s*(\d+)/);
    // const [operator, number] = rule.match(/^(<|>|==)|.*$/g);
    this.logger.debug(`Value: ${value}, Operator: ${operator}, Number: ${number}`);

    switch (operator) {
      case '>' : return value > Number(number);
      case '<' : return value < Number(number);
      case '==' : return value === Number(number);
    }

    return null;
  }

I tried changing my tsconfig but nothing worked.
Here is my current tsconfig:

{
  "extends": "../../tsconfig.json",
  "compilerOptions": {
    "outDir": "../../out-tsc/lib",
    "target": "es2015",
    "module": "es2015",
    "moduleResolution": "node",
    "declaration": true,
    "sourceMap": true,
    "inlineSources": true,
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "importHelpers": true,
    "types": [],
    "lib": [
      "dom",
      "es2018"
    ]
  },
"angularCompilerOptions": {
    "annotateForClosureCompiler": true,
    "skipTemplateCodegen": true,
    "strictMetadataEmit": true,
    "fullTemplateTypeCheck": true,
    "strictInjectionParameters": true,
    "enableResourceInlining": true,
    "strict": true,                        /* Enable all strict type-checking options. */
    "noImplicitAny": true,                 /* Raise error on expressions and declarations with an implied 'any' type. */
    "strictNullChecks": true,              /* Enable strict null checks. */
    "strictFunctionTypes": true,           /* Enable strict checking of function types. */
    "strictPropertyInitialization": true,  /* Enable strict checking of property initialization in classes. */
    "noImplicitThis": true,                /* Raise error on 'this' expressions with an implied 'any' type. */
    "alwaysStrict": true,                  /* Parse in strict mode and emit "use strict" for each source file. */
    "downlevelIteration": true,            /* Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'. */

Body:
I solved it by making a null check as follows:

private evaluate(value: number, rule: string) {
    const matches: any = rule.match(/(\D+?)\s*(\d+)/);
      if (matches === null) {
        return null;
      } else {
        const operator = matches[1];
        const number = matches[2];
        this.logger.debug(`Value: ${value}, Operator: ${operator}, Number: ${number}`);
        switch (operator) {
          case '>' : return value > Number(number);
          case '<' : return value < Number(number);
          case '==' : return value === Number(number);
        }

        return null;
      }
}


来源: stackexchange

问:
How do I draw curve + straight line to show possible path once player click on any position?
I'm trying to make a turn based game where the actors are ships. As such, the movement set to change its location will require both Vector3.Forward and Vector3.Rotation.

I got the code for actually making it move working already and I'm able to generate/create path taken using both LineRenderer and Debug.DrawLine.

However, I can't seem to find any resource for drawing out the node/line to show the player's path BEFORE it actually move.

Below is sample of the codes that I'm emulating.

```<code>void Update () {
    if (this.isMoving){
        if(Vector3.Distance(walkDestination, transform.position) > 0.2f){
            float step = 0f;
            step = this.speed * Time.deltaTime;
            transform.position = Vector3.MoveTowards(transform.position, walkDestination, step);

            Vector3 rotationDestination = this.rotateDestination;
            Quaternion targetRotation = Quaternion.LookRotation(rotationDestination - transform.position, Vector3.up);
            transform.rotation = Quaternion.Slerp(transform.rotation, targetRotation, Time.deltaTime * 6.0f);
        }else{
            //Arrived to destination
        }
    }
}
</code>```

Most if not all resources are pointing out to NavMesh or grid like system which doesn't align with my system as I'm allowing movement to be unrestricted on a quad.

I'd appreciate if anyone can point me to a right direction to draw POSSIBLE path from point A to point B before the unit actually moved.

答:
This sounds like a job for Unity's Line Renderer component:

Manual

Video Tutorial

Forum Post

hth.

ContentLicense: CC BY-SA 4.0

Body:
I'm trying to make a turn based game where the actors are ships. As such, the movement set to change its location will require both Vector3.Forward and Vector3.Rotation.

I got the code for actually making it move working already and I'm able to generate/create path taken using both LineRenderer and Debug.DrawLine.

However, I can't seem to find any resource for drawing out the node/line to show the player's path BEFORE it actually move.

Below is sample of the codes that I'm emulating.

void Update () {
    if (this.isMoving){
        if(Vector3.Distance(walkDestination, transform.position) > 0.2f){
            float step = 0f;
            step = this.speed * Time.deltaTime;
            transform.position = Vector3.MoveTowards(transform.position, walkDestination, step);

            Vector3 rotationDestination = this.rotateDestination;
            Quaternion targetRotation = Quaternion.LookRotation(rotationDestination - transform.position, Vector3.up);
            transform.rotation = Quaternion.Slerp(transform.rotation, targetRotation, Time.deltaTime * 6.0f);
        }else{
            //Arrived to destination
        }
    }
}

Most if not all resources are pointing out to NavMesh or grid like system which doesn't align with my system as I'm allowing movement to be unrestricted on a quad.

I'd appreciate if anyone can point me to a right direction to draw POSSIBLE path from point A to point B before the unit actually moved.


问:
How can I fix the cannot convert type error?
I want to create a details page about a movie, but I´m getting this error and I´m kinda stuck. I'm getting a cant convert type error. I do understand the error, but I dont have any idea of how to fix it.

This is the Index the PAP Entities is the Database instance:

```<code>public class MoviesController : Controller
{

    PAPEntities db = new PAPEntities();

    public ActionResult Index()
    {

        MovieViewModel[] movies = db.MoviesData.Select(movie => new MovieViewModel
        {
            MovieID = movie.MovieID,
            MovieName = movie.MovieName,
            MovieDescription = movie.MovieDescription,
            MovieCategory = movie.MovieCategory,
            MovieYear = movie.MovieYear
        }).ToArray();

        return View(movies);

    }
</code>```

And this is my details class for now:

```<code>public ActionResult Details(int Id = 1)
    {
        MovieViewModel MovieVM = db.MoviesData.Find(Id);
        return View(MovieVM);
    }
</code>```

I keep getting the error on the "db.MoviesData.Find(Id);"

This is the MovieViewModel code:

```<code>public class MovieViewModel
{
    public int MovieID { get; set; }
    public string MovieName { get; set; }
    public string MovieDescription { get; set; }
    public string MovieCategory { get; set; }
    public string MovieYear { get; set; }
}
</code>```

This is the razor page:

```<code>@model WebApplication3.Models.MovieViewModel[]

@{
ViewBag.Title = "Index";
Layout = "~/Views/Shared/_Layout.cshtml";
}

<h2>Movies</h2>

<p>
@Html.ActionLink("Create New", "Create")
</code>```

```<code><table class="table table-bordered table-responsive table-hover">
    <tr>
        <th><b>Movie Name </b></th>
        <th><b>Movie Category </b></th>
        <th><b>Movie Year </b></th>
        <th><b>Movie Description </b></th>
        <th></th>

    </tr>
    @foreach (var item in Model)
    {
    <tr>
        <td>@item.MovieID</td>
        <td>@item.MovieCategory</td>
        <td>@item.MovieYear</td>
        <td>@item.MovieDescription</td>
        <td>
            @Html.ActionLink("Edit", "Edit", new { id = item.MovieID }) |
            @Html.ActionLink("Details", "Details", new { id = item.MovieID }) |
            @Html.ActionLink("Delete", "Delete", new { id = item.MovieID })
        </td>
    </tr>
    }
</table>
</code>```

This is the error:

Cannot implicitly convert type 'WebApplication3.Models.MoviesData' to
  'WebApplication3.Models.MovieViewModel'

The MoviesData is the database's table

答:
You should map your DB (MoviesData) model To Bussiness model (MovieViewModel)

```<code>   public ActionResult Details(int Id = 1)
    {
        MoviesData movie = db.MoviesData.Find(Id);
        MovieViewModel MovieVM = new MovieViewModel();
        MovieVM.MovieID = movie.MovieID;
        MovieVM.MovieName = movie.MovieName;
        MovieVM.MovieDescription = movie.MovieDescription;
        MovieVM.MovieCategory = movie.MovieCategory;
        MovieVM.MovieYear = movie.MovieYear;

        return View(MovieVM);
    }
</code>```

Body:
I want to create a details page about a movie, but I´m getting this error and I´m kinda stuck. I'm getting a cant convert type error. I do understand the error, but I dont have any idea of how to fix it.

This is the Index the PAP Entities is the Database instance:

public class MoviesController : Controller
{

    PAPEntities db = new PAPEntities();

    public ActionResult Index()
    {

        MovieViewModel[] movies = db.MoviesData.Select(movie => new MovieViewModel
        {
            MovieID = movie.MovieID,
            MovieName = movie.MovieName,
            MovieDescription = movie.MovieDescription,
            MovieCategory = movie.MovieCategory,
            MovieYear = movie.MovieYear
        }).ToArray();

        return View(movies);

    }

And this is my details class for now:

public ActionResult Details(int Id = 1)
    {
        MovieViewModel MovieVM = db.MoviesData.Find(Id);
        return View(MovieVM);
    }

I keep getting the error on the "db.MoviesData.Find(Id);"

This is the MovieViewModel code:

public class MovieViewModel
{
    public int MovieID { get; set; }
    public string MovieName { get; set; }
    public string MovieDescription { get; set; }
    public string MovieCategory { get; set; }
    public string MovieYear { get; set; }
}

This is the razor page:

@model WebApplication3.Models.MovieViewModel[]

@{
ViewBag.Title = "Index";
Layout = "~/Views/Shared/_Layout.cshtml";
}

Movies

@Html.ActionLink("Create New", "Create")

        Movie Name
        Movie Category
        Movie Year
        Movie Description

    @foreach (var item in Model)
    {

        @item.MovieID
        @item.MovieCategory
        @item.MovieYear
        @item.MovieDescription

            @Html.ActionLink("Edit", "Edit", new { id = item.MovieID }) |
            @Html.ActionLink("Details", "Details", new { id = item.MovieID }) |
            @Html.ActionLink("Delete", "Delete", new { id = item.MovieID })

    }

This is the error:

Cannot implicitly convert type 'WebApplication3.Models.MoviesData' to
  'WebApplication3.Models.MovieViewModel'

The MoviesData is the database's table

Body:
You should map your DB (MoviesData) model To Bussiness model (MovieViewModel)

   public ActionResult Details(int Id = 1)
    {
        MoviesData movie = db.MoviesData.Find(Id);
        MovieViewModel MovieVM = new MovieViewModel();
        MovieVM.MovieID = movie.MovieID;
        MovieVM.MovieName = movie.MovieName;
        MovieVM.MovieDescription = movie.MovieDescription;
        MovieVM.MovieCategory = movie.MovieCategory;
        MovieVM.MovieYear = movie.MovieYear;

        return View(MovieVM);
    }


问:
How do I plot SRTM source Raster with cartopy?
I have been looking at the options offered by cartopy to do rapid automatic maps. I found the SRTMSource to be very convenient. However, I have'nt found how to plot the data using a different projection such as mercator...

When I do:

```<code>import cartopy.crs as ccrs
import matplotlib.pyplot as plt
from cartopy.io.srtm import SRTM3Source

source = SRTM3Source

plt.figure()
ax = plt.axes(projection=ccrs.PlateCarree())
ax.add_raster(source())
ax.set_extent([12, 13, 47, 48])
plt.show()()
</code>```

It works just fine and do a plot using the PlateCarree projection

But When I try to change the projection of the axes to Mercator:

```<code>import cartopy.crs as ccrs
import matplotlib.pyplot as plt
from cartopy.io.srtm import SRTM3Source

source = SRTM3Source

plt.figure()
ax = plt.axes(projection=ccrs.Mercator())
ax.add_raster(source())
ax.set_extent([12, 13, 47, 48])
plt.show()()
</code>```

I get an error that says:

```<code>Unsupported projection for the SRTM3 source.
</code>```

So is there a way to keep the SRTMSource fonctionality (automatic download) and plot the raster using any projection?

I thought of simply doing an imshow and change the projection but as the data of a RasterSource are retrieved at plotting time, I don't know how to do it...

```<code>plt.figure()
ax = plt.axes(projection=ccrs.Mercator())
ax.imshow(source(), transform=ccrs.Mercator())
ax.set_extent([12, 13, 47, 48])
plt.show()
</code>```

return a TypeError.

答:
I know this is an old post, but I'm trying to learn more about cartopy, and I think I can answer this question now, maybe this could help others with a similar problem.

Okay here we go. First, there is a good explanation of the difference of transform and projection on the cartopy Homepage:
https://scitools.org.uk/cartopy/docs/latest/tutorials/understanding_transform.html?highlight=understanding

The projection keyword determines how the plot will look, so for this problem here, we change the projection to Mercator:

ax = plt.axes(projection=ccrs.Mercator())

You can choose any projection you like, but you have to add the transform Keyword (and this is still PlateCarree in this case, because the DATA is provided in PlateCarree):

ax.set_extent([12, 13, 47, 48],transform=ccrs.PlateCarree())

So the correct code would be:

```<code>import cartopy.crs as ccrs
import matplotlib.pyplot as plt
from cartopy.io.srtm import SRTM3Source

source = SRTM3Source

plt.figure()
ax = plt.axes(projection=ccrs.Mercator())
ax.add_raster(source())
ax.set_extent([12, 13, 47, 48], transform=ccrs.PlateCarree())
plt.show()()
</code>```

I hope this is correct and my explanation is helpful.

ContentLicense: CC BY-SA 3.0

Body:
I have been looking at the options offered by cartopy to do rapid automatic maps. I found the SRTMSource to be very convenient. However, I have'nt found how to plot the data using a different projection such as mercator...

When I do:

import cartopy.crs as ccrs
import matplotlib.pyplot as plt
from cartopy.io.srtm import SRTM3Source

source = SRTM3Source

plt.figure()
ax = plt.axes(projection=ccrs.PlateCarree())
ax.add_raster(source())
ax.set_extent([12, 13, 47, 48])
plt.show()()

It works just fine and do a plot using the PlateCarree projection

But When I try to change the projection of the axes to Mercator:

import cartopy.crs as ccrs
import matplotlib.pyplot as plt
from cartopy.io.srtm import SRTM3Source

source = SRTM3Source

plt.figure()
ax = plt.axes(projection=ccrs.Mercator())
ax.add_raster(source())
ax.set_extent([12, 13, 47, 48])
plt.show()()

I get an error that says:

Unsupported projection for the SRTM3 source.

So is there a way to keep the SRTMSource fonctionality (automatic download) and plot the raster using any projection?

I thought of simply doing an imshow and change the projection but as the data of a RasterSource are retrieved at plotting time, I don't know how to do it...

plt.figure()
ax = plt.axes(projection=ccrs.Mercator())
ax.imshow(source(), transform=ccrs.Mercator())
ax.set_extent([12, 13, 47, 48])
plt.show()

return a TypeError.

Body:
I know this is an old post, but I'm trying to learn more about cartopy, and I think I can answer this question now, maybe this could help others with a similar problem.

Okay here we go. First, there is a good explanation of the difference of transform and projection on the cartopy Homepage:
https://scitools.org.uk/cartopy/docs/latest/tutorials/understanding_transform.html?highlight=understanding

The projection keyword determines how the plot will look, so for this problem here, we change the projection to Mercator:

ax = plt.axes(projection=ccrs.Mercator())

You can choose any projection you like, but you have to add the transform Keyword (and this is still PlateCarree in this case, because the DATA is provided in PlateCarree):

ax.set_extent([12, 13, 47, 48],transform=ccrs.PlateCarree())

So the correct code would be:

import cartopy.crs as ccrs
import matplotlib.pyplot as plt
from cartopy.io.srtm import SRTM3Source

source = SRTM3Source

plt.figure()
ax = plt.axes(projection=ccrs.Mercator())
ax.add_raster(source())
ax.set_extent([12, 13, 47, 48], transform=ccrs.PlateCarree())
plt.show()()

I hope this is correct and my explanation is helpful.


问:
Getting HTTP error 500 even if the account is authorised
Having an issue with the database enabling on my cpanel.

I am using A2Hosting.

As I create the tables I get this error when I go to a page that uses it:

To try and fix this I added privileges to my account

here is my database code:

```<code><?php

class config_db {

  public function init() {
PDO('mysql:host=localhost;dbname="DATABASENAME";charset=utf8', '"USERNAME"', '"PASSWORD"');

    return $db;
  }

}

?>
</code>```

After adding privileges I get this error:

Not sure why I still get an HTTP ERROR 500 after I have granted privileges

UPDATE:

As I checked one solution is to delete the plugins, but my cpanel files has none of it

UPDATE:

Creating a username and password that the database uses uniquely does not work either

UPDATE:

Deleting the .htaccess folder gets me a 404 not found problem

UPDATE:

There are no errors shown using inspect element or event in the cpanel

UPDATE:

The database is connected succesfully as I checked but the error 500 still persists

答:
In A2Hosting please make sure you are using the correct database name. As per the documentation it should be:

When you create a database, your username is prefixed to the database name.

For example, if your username is abc, and you create a database named db, the actual MySQL database name is abc_db.

For more information:
https://www.a2hosting.com/kb/cpanel/cpanel-database-features/managing-mysql-databases

Body:
Having an issue with the database enabling on my cpanel.

I am using A2Hosting.

As I create the tables I get this error when I go to a page that uses it:

To try and fix this I added privileges to my account

here is my database code:

<?php

class config_db {

  public function init() {
PDO('mysql:host=localhost;dbname="DATABASENAME";charset=utf8', '"USERNAME"', '"PASSWORD"');

    return $db;
  }

}

?>

After adding privileges I get this error:

Not sure why I still get an HTTP ERROR 500 after I have granted privileges

UPDATE:

As I checked one solution is to delete the plugins, but my cpanel files has none of it

UPDATE:

Creating a username and password that the database uses uniquely does not work either

UPDATE:

Deleting the .htaccess folder gets me a 404 not found problem

UPDATE:

There are no errors shown using inspect element or event in the cpanel

UPDATE:

The database is connected succesfully as I checked but the error 500 still persists


问:
(ADAL) integration with Ionic 3 getting “We are unable to issue tokens”
I’m using MS ADAL for login authentication in ionic 3.
Plugin: https://ionicframework.com/docs/v3/native/ms-adal/

Login screen appearing , when i'm login, its sending issue,
getting error :

"AADSTS50020: We are unable to issue tokens from this api version for a Microsoft account. Please contact the application vendor as they need to use version 2.0 of the protocol to support this."

code:

```<code>authContext.acquireTokenAsync(‘https://graph.windows.net’, ‘4324dsad-b5c3’, ‘http://localhost:8000’,"","")
.then((authResponse: AuthenticationResult) => {
console.log(‘Token is’ , authResponse.accessToken);
console.log(‘Token will expire on’, authResponse.expiresOn);
})
.catch((e: any) => console.log(‘Authentication failed’, e));
</code>```

答:
According to the error, you may login with a personal Microsoft account. But Azure AD authentication library (ADAL) uses v1.0 endpoint, it does not allow personal Microsoft account to sign in, the v1.0 endpoint allows only work and school accounts to sign in to your application.

See this link:https://learn.microsoft.com/en-us/azure/active-directory/develop/azure-ad-endpoint-comparison#who-can-sign-in

Body:
I’m using MS ADAL for login authentication in ionic 3.
Plugin: https://ionicframework.com/docs/v3/native/ms-adal/

Login screen appearing , when i'm login, its sending issue,
getting error :

"AADSTS50020: We are unable to issue tokens from this api version for a Microsoft account. Please contact the application vendor as they need to use version 2.0 of the protocol to support this."

code:

authContext.acquireTokenAsync(‘https://graph.windows.net’, ‘4324dsad-b5c3’, ‘http://localhost:8000’,"","")
.then((authResponse: AuthenticationResult) => {
console.log(‘Token is’ , authResponse.accessToken);
console.log(‘Token will expire on’, authResponse.expiresOn);
})
.catch((e: any) => console.log(‘Authentication failed’, e));


问:
TSConfig Unknown compiler option 'lib'
I am taking over an old angular 1 project with typescript 1.8.10.

However I can't compile and it keeps throwing me this :

```<code>Unknown compiler option 'lib'
</code>```

if i comment out the "lib" line, then I will face a huge load of other errors such as

```<code> Property 'X' does not exist on type 'Y'
</code>```

this is a fairly huge old project and I only want it to run for 2 weeks, so re-coding it is not an option for me due to timeline.

I have tried changing many versions of typescript, but the same issue shows for me, I also tried to build using --noImplicitUseStrict but it doesn't help.

Here is my tsconfig.json and my package.json

tsconfig.json

```<code>{
  "compileOnSave": false,
  "compilerOptions": {
      "module": "commonjs",
      "target": "es5",
      "noImplicitUseStrict" : true,
      "lib": ["es2015", "dom"]
 },
  "exclude": [
      "bower_components",
      "node_modules",
      "typings"
  ]
}

{
  "name": "xxx",
  "version": "0.0.0",
  "dependencies": {
    "@types/jquery": "^3.3.29",
    "grunt": "^1.0.4",
    "grunt-cli": "^1.3.2",
    "gulp-awspublish": "^3.3.0",
    "gulp-s3-deploy": "^1.0.1",
    "moment": "^2.24.0",
    "npm": "^6.9.0",
    "socket.io-client": "^1.7.2"
  },
  "scripts": {
    "test": "gulp test"
  },
  "devDependencies": {
    "@angular/cli": "^7.3.3",
    "browser-sync": "^2.26.5",
    "browser-sync-spa": "~1.0.3",
    "chalk": "~1.1.1",
    "del": "~2.0.2",
    "eslint-plugin-angular": "~0.12.0",
    "estraverse": "~4.1.0",
    "gulp": "^3.9.1",
    "gulp-angular-templatecache": "~1.8.0",
    "gulp-autoprefixer": "~3.0.2",
    "gulp-awspublish": "^3.3.0",
    "gulp-cssnano": "~2.1.1",
    "gulp-eslint": "~1.0.0",
    "gulp-filter": "~3.0.1",
    "gulp-flatten": "~0.2.0",
    "gulp-htmlmin": "~1.3.0",
    "gulp-inject": "~3.0.0",
    "gulp-load-plugins": "~0.10.0",
    "gulp-protractor": "~2.1.0",
    "gulp-rename": "~1.2.2",
    "gulp-replace": "~0.5.4",
    "gulp-rev": "~6.0.1",
    "gulp-rev-replace": "~0.4.2",
    "gulp-s3-deploy": "^1.0.1",
    "gulp-sass": "~2.0.4",
    "gulp-size": "~2.0.0",
    "gulp-sourcemaps": "~1.6.0",
    "gulp-uglify": "~1.4.1",
    "gulp-useref": "^3.1.6",
    "gulp-util": "~3.0.6",
    "http-proxy-middleware": "^0.19.1",
    "karma": "~0.13.10",
    "karma-coverage": "~0.5.2",
    "karma-jasmine": "~0.3.6",
    "karma-ng-html2js-preprocessor": "~0.2.0",
    "karma-phantomjs-launcher": "~0.2.1",
    "karma-phantomjs-shim": "~1.2.0",
    "lodash": "~3.10.1",
    "main-bower-files": "^2.13.1",
    "ng-annotate-loader": "0.0.10",
    "phantomjs": "~1.9.18",
    "ts-loader": "~0.8.0",
    "tslint-loader": "~1.0.2",
    "typescript": "^1.8.10",
    "typings": "~0.7.9",
    "uglify-save-license": "~0.4.1",
    "webpack-stream": "~2.1.1",
    "wiredep": "~2.2.2"
  },
  "engines": {
    "node": ">=0.10.0"
  }
}
</code>```

Please give me some advice on this. I am building it using Gulp.

答:
lib is a TypeScript 2 feature, and as you mentioned you are using 1.8.  You could remove that lib from the tsconfig.json or Try upgrading to a newer typescript version.

In my package.json, I'm using the following dev dependencies:

```<code>"ts-loader": "^5.4.4",
"typescript": "^3.4.5",
</code>```

However, you may find some of your typescript breaks if you upgrade.

Title: TSConfig Unknown compiler option 'lib'

Body:
I am taking over an old angular 1 project with typescript 1.8.10.

However I can't compile and it keeps throwing me this :

Unknown compiler option 'lib'

if i comment out the "lib" line, then I will face a huge load of other errors such as

 Property 'X' does not exist on type 'Y'

this is a fairly huge old project and I only want it to run for 2 weeks, so re-coding it is not an option for me due to timeline.

I have tried changing many versions of typescript, but the same issue shows for me, I also tried to build using --noImplicitUseStrict but it doesn't help.

Here is my tsconfig.json and my package.json

tsconfig.json

{
  "compileOnSave": false,
  "compilerOptions": {
      "module": "commonjs",
      "target": "es5",
      "noImplicitUseStrict" : true,
      "lib": ["es2015", "dom"]
 },
  "exclude": [
      "bower_components",
      "node_modules",
      "typings"
  ]
}

{
  "name": "xxx",
  "version": "0.0.0",
  "dependencies": {
    "@types/jquery": "^3.3.29",
    "grunt": "^1.0.4",
    "grunt-cli": "^1.3.2",
    "gulp-awspublish": "^3.3.0",
    "gulp-s3-deploy": "^1.0.1",
    "moment": "^2.24.0",
    "npm": "^6.9.0",
    "socket.io-client": "^1.7.2"
  },
  "scripts": {
    "test": "gulp test"
  },
  "devDependencies": {
    "@angular/cli": "^7.3.3",
    "browser-sync": "^2.26.5",
    "browser-sync-spa": "~1.0.3",
    "chalk": "~1.1.1",
    "del": "~2.0.2",
    "eslint-plugin-angular": "~0.12.0",
    "estraverse": "~4.1.0",
    "gulp": "^3.9.1",
    "gulp-angular-templatecache": "~1.8.0",
    "gulp-autoprefixer": "~3.0.2",
    "gulp-awspublish": "^3.3.0",
    "gulp-cssnano": "~2.1.1",
    "gulp-eslint": "~1.0.0",
    "gulp-filter": "~3.0.1",
    "gulp-flatten": "~0.2.0",
    "gulp-htmlmin": "~1.3.0",
    "gulp-inject": "~3.0.0",
    "gulp-load-plugins": "~0.10.0",
    "gulp-protractor": "~2.1.0",
    "gulp-rename": "~1.2.2",
    "gulp-replace": "~0.5.4",
    "gulp-rev": "~6.0.1",
    "gulp-rev-replace": "~0.4.2",
    "gulp-s3-deploy": "^1.0.1",
    "gulp-sass": "~2.0.4",
    "gulp-size": "~2.0.0",
    "gulp-sourcemaps": "~1.6.0",
    "gulp-uglify": "~1.4.1",
    "gulp-useref": "^3.1.6",
    "gulp-util": "~3.0.6",
    "http-proxy-middleware": "^0.19.1",
    "karma": "~0.13.10",
    "karma-coverage": "~0.5.2",
    "karma-jasmine": "~0.3.6",
    "karma-ng-html2js-preprocessor": "~0.2.0",
    "karma-phantomjs-launcher": "~0.2.1",
    "karma-phantomjs-shim": "~1.2.0",
    "lodash": "~3.10.1",
    "main-bower-files": "^2.13.1",
    "ng-annotate-loader": "0.0.10",
    "phantomjs": "~1.9.18",
    "ts-loader": "~0.8.0",
    "tslint-loader": "~1.0.2",
    "typescript": "^1.8.10",
    "typings": "~0.7.9",
    "uglify-save-license": "~0.4.1",
    "webpack-stream": "~2.1.1",
    "wiredep": "~2.2.2"
  },
  "engines": {
    "node": ">=0.10.0"
  }
}

Please give me some advice on this. I am building it using Gulp.

Body:
lib is a TypeScript 2 feature, and as you mentioned you are using 1.8.  You could remove that lib from the tsconfig.json or Try upgrading to a newer typescript version.

In my package.json, I'm using the following dev dependencies:

"ts-loader": "^5.4.4",
"typescript": "^3.4.5",

However, you may find some of your typescript breaks if you upgrade.


问:
Optimizing Query based on Inserting into multiple columns into target table from one column of a source table
I am trying to insert values from one column of a table to multiple columns of another table based on conditions. I have prepared the query but it's getting stuck at 80% of the MapReduce phase

I am using hive 1.1.0.
Currently, I am setting below, before executing the queries

```<code>set hive.exec.dynamic.partition.mode=nonstrict;
set hive.exec.dynamic.partition=true;
set parquet.compression=SNAPPY;
set hive.support.quoted.identifiers=none;
set mapreduce.map.speculative=false;
set mapreduce.reduce.speculative=false;
set hive.mapred.reduce.tasks.speculative.execution=false;
set mapreduce.map.memory.mb=15000;
set mapreduce.map.java.opts=-Xmx2400m;
set mapreduce.reduce.memory.mb=5000;
set mapreduce.reduce.java.opts=-Xmx2400m;
set mapreduce.input.fileinputformat.split.maxsize=1024000000;
set mapreduce.input.fileinputformat.split.minsize=1024000000;
set hive.exec.max.dynamic.partitions.pernode=1000;
</code>```

Kindly provide suggestions to run this query perfectly in the hive.

```<code>      select
        IDENTIFICADOR_ID,
        ESTADO,
        FECHA_ESTADO,
        MUNICIPIO_ID,
        TIPO_ID,
        NOMBRE_COMPLETO,
        VALOR_PLAN_FACTURACION,
        VALOR_ESTADO_SERVICIO,
        VALOR_PAQUETE,
        VALOR_ACCESP,
        VALOR_TIPO_BANDA_ANCHA,
        VALOR_VELOCIDAD_ACCESO,
        descripcion_ltcar,
        DESCRIPCION_PLAN_OPEN,
        ESTADO_FNX_PLANES_FACTURACION,
        load_date from(
        select a.IDENTIFICADOR_ID,
        a.ESTADO,
        a.FECHA_ESTADO,
        a.MUNICIPIO_ID,
        b.TIPO_ID,
        b.NOMBRE_COMPLETO,
        a1.valor as VALOR_PLAN_FACTURACION,
        b1.valor as VALOR_ESTADO_SERVICIO,
        c1.valor as VALOR_PAQUETE,
        d1.valor as VALOR_ACCESP,
        e1.valor as VALOR_TIPO_BANDA_ANCHA,
        m1.valor as VALOR_VELOCIDAD_ACCESO,
        d.descripcion_ltcar,
        e.DESCRIPCION_PLAN_OPEN,
        e.estado as ESTADO_FNX_PLANES_FACTURACION,
        '2019-05-22' as load_date from
        db_trusted_common_zone.FNX_IDENTIFICADORES_bs as a,db_trusted_common_zone.FNX_LISTAS_TCARACTERISTICAS_bs d
       right join  (select valor,IDENTIFICADOR_ID
from db_trusted_common_zone.FNX_CONFIGURACIONES_IDENTIF_bs where caracteristica_id=2005)a1
on a1.IDENTIFICADOR_ID =  a.IDENTIFICADOR_ID
right join  (select valor,IDENTIFICADOR_ID
from db_trusted_common_zone.FNX_CONFIGURACIONES_IDENTIF_bs where caracteristica_id=132 )b1
on b1.IDENTIFICADOR_ID =  a.IDENTIFICADOR_ID
right join  (select valor,IDENTIFICADOR_ID
from db_trusted_common_zone.FNX_CONFIGURACIONES_IDENTIF_bs where caracteristica_id=2879)c1
on c1.IDENTIFICADOR_ID =  a.IDENTIFICADOR_ID
right join  (select valor,IDENTIFICADOR_ID
from db_trusted_common_zone.FNX_CONFIGURACIONES_IDENTIF_bs where caracteristica_id=2093)d1
on d1.IDENTIFICADOR_ID =  a.IDENTIFICADOR_ID
right join  (select valor,IDENTIFICADOR_ID
from db_trusted_common_zone.FNX_CONFIGURACIONES_IDENTIF_bs where caracteristica_id=120)e1
on e1.IDENTIFICADOR_ID =  a.IDENTIFICADOR_ID
right join  (select valor,IDENTIFICADOR_ID
from db_trusted_common_zone.FNX_CONFIGURACIONES_IDENTIF_bs where caracteristica_id=33)f1
on f1.IDENTIFICADOR_ID =  a.IDENTIFICADOR_ID
right join  (select valor,IDENTIFICADOR_ID
from db_trusted_common_zone.FNX_CONFIGURACIONES_IDENTIF_bs where caracteristica_id=4430)g1
on g1.IDENTIFICADOR_ID =  a.IDENTIFICADOR_ID
right join  (select valor,IDENTIFICADOR_ID
from db_trusted_common_zone.FNX_CONFIGURACIONES_IDENTIF_bs where caracteristica_id=2123)h1
on h1.IDENTIFICADOR_ID =  a.IDENTIFICADOR_ID
right join  (select valor,IDENTIFICADOR_ID
from db_trusted_common_zone.FNX_CONFIGURACIONES_IDENTIF_bs where caracteristica_id=4389)i1
on i1.IDENTIFICADOR_ID =  a.IDENTIFICADOR_ID
right join  (select valor,IDENTIFICADOR_ID
from db_trusted_common_zone.FNX_CONFIGURACIONES_IDENTIF_bs where caracteristica_id=201)j1
on j1.IDENTIFICADOR_ID =  a.IDENTIFICADOR_ID
right join  (select valor,IDENTIFICADOR_ID
from db_trusted_common_zone.FNX_CONFIGURACIONES_IDENTIF_bs where caracteristica_id=4388)k1
on k1.IDENTIFICADOR_ID =  a.IDENTIFICADOR_ID
right join  (select valor,IDENTIFICADOR_ID
from db_trusted_common_zone.FNX_CONFIGURACIONES_IDENTIF_bs where caracteristica_id=37)l1
on l1.IDENTIFICADOR_ID =  a.IDENTIFICADOR_ID
right join  (select valor,IDENTIFICADOR_ID
from db_trusted_common_zone.FNX_CONFIGURACIONES_IDENTIF_bs where caracteristica_id=124)m1
    on m1.IDENTIFICADOR_ID =  a.IDENTIFICADOR_ID
        inner join db_trusted_common_zone.FNX_CLIENTES_bs as b
        on a.CLIENTE_ID=b.CLIENTE_ID
        inner join db_trusted_common_zone.FNX_PLANES_FACTURACION_bs as e
        on a.PRODUCTO_ID=e.PRODUCTO_ID
        and a.SERVICIO_ID=e.SERVICIO_ID
        and a.EMPRESA_ID=e.EMPRESA_ID
        and a.MUNICIPIO_ID=e.MUNICIPIO_ID
        where a.TIPO_ELEMENTO_ID in ('CUENTA','TELEV','TO')
        and d.caracteristica_id=124)t
</code>```

答:
Table FNX_CONFIGURACIONES_IDENTIF_bs can be joined only one time, use case statements with aggregation:

```<code>select
    IDENTIFICADOR_ID,
    ESTADO,
    FECHA_ESTADO,
    MUNICIPIO_ID,
    TIPO_ID,
    NOMBRE_COMPLETO,
    VALOR_PLAN_FACTURACION,
    VALOR_ESTADO_SERVICIO,
    VALOR_PAQUETE,
    VALOR_ACCESP,
    VALOR_TIPO_BANDA_ANCHA,
    VALOR_VELOCIDAD_ACCESO,
    descripcion_ltcar,
    DESCRIPCION_PLAN_OPEN,
    ESTADO_FNX_PLANES_FACTURACION,
    load_date
    from
    (
    select
    a.IDENTIFICADOR_ID,
    a.ESTADO,
    a.FECHA_ESTADO,
    a.MUNICIPIO_ID,
    b.TIPO_ID,
    b.NOMBRE_COMPLETO,
    max(case when caracteristica_id=2005 then c.valor end) as VALOR_PLAN_FACTURACION,
    max(case when caracteristica_id=132  then c.valor end) as VALOR_ESTADO_SERVICIO,
    max(case when caracteristica_id=2879 then c.valor end) as VALOR_PAQUETE,
    max(case when caracteristica_id=2093 then c.valor end) as VALOR_ACCESP,
    max(case when caracteristica_id=120  then c.valor end) as VALOR_TIPO_BANDA_ANCHA,
    max(case when caracteristica_id=124  then c.valor end) as VALOR_VELOCIDAD_ACCESO,
    d.descripcion_ltcar,
    e.DESCRIPCION_PLAN_OPEN,
    e.estado as ESTADO_FNX_PLANES_FACTURACION,
    '2019-05-22' as load_date
    from  db_trusted_common_zone.FNX_IDENTIFICADORES_bs as a,
          db_trusted_common_zone.FNX_LISTAS_TCARACTERISTICAS_bs d --this join needs to be fixed, there is no ON condition. This is CROSS JOIN. It is acceptable if table d returns only one row
          inner join (select * from db_trusted_common_zone.FNX_CONFIGURACIONES_IDENTIF_bs c where caracteristica_id in (2005,132,2879,2093,120,124)) c on c.IDENTIFICADOR_ID =  a.IDENTIFICADOR_ID --join only one time with this table
          inner join db_trusted_common_zone.FNX_CLIENTES_bs as b on a.CLIENTE_ID=b.CLIENTE_ID
          inner join db_trusted_common_zone.FNX_PLANES_FACTURACION_bs as e on a.PRODUCTO_ID=e.PRODUCTO_ID
                                                                           and a.SERVICIO_ID=e.SERVICIO_ID
                                                                           and a.EMPRESA_ID=e.EMPRESA_ID
                                                                           and a.MUNICIPIO_ID=e.MUNICIPIO_ID
    where a.TIPO_ELEMENTO_ID in ('CUENTA','TELEV','TO')
      and d.caracteristica_id=124
    group by
    a.IDENTIFICADOR_ID,
    a.ESTADO,
    a.FECHA_ESTADO,
    a.MUNICIPIO_ID,
    b.TIPO_ID,
    b.NOMBRE_COMPLETO,
    d.descripcion_ltcar,
    e.DESCRIPCION_PLAN_OPEN,
    e.estado as ESTADO_FNX_PLANES_FACTURACION
    )t
</code>```

Also join with db_trusted_common_zone.FNX_LISTAS_TCARACTERISTICAS_bs still needs to be fixed. It is without ON condition and works as a cross join.

Also these values are too high:

```<code>set mapreduce.input.fileinputformat.split.maxsize=1024000000;
set mapreduce.input.fileinputformat.split.minsize=1024000000;
</code>```

Try to reduce x2 or even x4 times or more to increase parallelizm.

Body:
I am trying to insert values from one column of a table to multiple columns of another table based on conditions. I have prepared the query but it's getting stuck at 80% of the MapReduce phase

I am using hive 1.1.0.
Currently, I am setting below, before executing the queries

set hive.exec.dynamic.partition.mode=nonstrict;
set hive.exec.dynamic.partition=true;
set parquet.compression=SNAPPY;
set hive.support.quoted.identifiers=none;
set mapreduce.map.speculative=false;
set mapreduce.reduce.speculative=false;
set hive.mapred.reduce.tasks.speculative.execution=false;
set mapreduce.map.memory.mb=15000;
set mapreduce.map.java.opts=-Xmx2400m;
set mapreduce.reduce.memory.mb=5000;
set mapreduce.reduce.java.opts=-Xmx2400m;
set mapreduce.input.fileinputformat.split.maxsize=1024000000;
set mapreduce.input.fileinputformat.split.minsize=1024000000;
set hive.exec.max.dynamic.partitions.pernode=1000;

Kindly provide suggestions to run this query perfectly in the hive.

      select
        IDENTIFICADOR_ID,
        ESTADO,
        FECHA_ESTADO,
        MUNICIPIO_ID,
        TIPO_ID,
        NOMBRE_COMPLETO,
        VALOR_PLAN_FACTURACION,
        VALOR_ESTADO_SERVICIO,
        VALOR_PAQUETE,
        VALOR_ACCESP,
        VALOR_TIPO_BANDA_ANCHA,
        VALOR_VELOCIDAD_ACCESO,
        descripcion_ltcar,
        DESCRIPCION_PLAN_OPEN,
        ESTADO_FNX_PLANES_FACTURACION,
        load_date from(
        select a.IDENTIFICADOR_ID,
        a.ESTADO,
        a.FECHA_ESTADO,
        a.MUNICIPIO_ID,
        b.TIPO_ID,
        b.NOMBRE_COMPLETO,
        a1.valor as VALOR_PLAN_FACTURACION,
        b1.valor as VALOR_ESTADO_SERVICIO,
        c1.valor as VALOR_PAQUETE,
        d1.valor as VALOR_ACCESP,
        e1.valor as VALOR_TIPO_BANDA_ANCHA,
        m1.valor as VALOR_VELOCIDAD_ACCESO,
        d.descripcion_ltcar,
        e.DESCRIPCION_PLAN_OPEN,
        e.estado as ESTADO_FNX_PLANES_FACTURACION,
        '2019-05-22' as load_date from
        db_trusted_common_zone.FNX_IDENTIFICADORES_bs as a,db_trusted_common_zone.FNX_LISTAS_TCARACTERISTICAS_bs d
       right join  (select valor,IDENTIFICADOR_ID
from db_trusted_common_zone.FNX_CONFIGURACIONES_IDENTIF_bs where caracteristica_id=2005)a1
on a1.IDENTIFICADOR_ID =  a.IDENTIFICADOR_ID
right join  (select valor,IDENTIFICADOR_ID
from db_trusted_common_zone.FNX_CONFIGURACIONES_IDENTIF_bs where caracteristica_id=132 )b1
on b1.IDENTIFICADOR_ID =  a.IDENTIFICADOR_ID
right join  (select valor,IDENTIFICADOR_ID
from db_trusted_common_zone.FNX_CONFIGURACIONES_IDENTIF_bs where caracteristica_id=2879)c1
on c1.IDENTIFICADOR_ID =  a.IDENTIFICADOR_ID
right join  (select valor,IDENTIFICADOR_ID
from db_trusted_common_zone.FNX_CONFIGURACIONES_IDENTIF_bs where caracteristica_id=2093)d1
on d1.IDENTIFICADOR_ID =  a.IDENTIFICADOR_ID
right join  (select valor,IDENTIFICADOR_ID
from db_trusted_common_zone.FNX_CONFIGURACIONES_IDENTIF_bs where caracteristica_id=120)e1
on e1.IDENTIFICADOR_ID =  a.IDENTIFICADOR_ID
right join  (select valor,IDENTIFICADOR_ID
from db_trusted_common_zone.FNX_CONFIGURACIONES_IDENTIF_bs where caracteristica_id=33)f1
on f1.IDENTIFICADOR_ID =  a.IDENTIFICADOR_ID
right join  (select valor,IDENTIFICADOR_ID
from db_trusted_common_zone.FNX_CONFIGURACIONES_IDENTIF_bs where caracteristica_id=4430)g1
on g1.IDENTIFICADOR_ID =  a.IDENTIFICADOR_ID
right join  (select valor,IDENTIFICADOR_ID
from db_trusted_common_zone.FNX_CONFIGURACIONES_IDENTIF_bs where caracteristica_id=2123)h1
on h1.IDENTIFICADOR_ID =  a.IDENTIFICADOR_ID
right join  (select valor,IDENTIFICADOR_ID
from db_trusted_common_zone.FNX_CONFIGURACIONES_IDENTIF_bs where caracteristica_id=4389)i1
on i1.IDENTIFICADOR_ID =  a.IDENTIFICADOR_ID
right join  (select valor,IDENTIFICADOR_ID
from db_trusted_common_zone.FNX_CONFIGURACIONES_IDENTIF_bs where caracteristica_id=201)j1
on j1.IDENTIFICADOR_ID =  a.IDENTIFICADOR_ID
right join  (select valor,IDENTIFICADOR_ID
from db_trusted_common_zone.FNX_CONFIGURACIONES_IDENTIF_bs where caracteristica_id=4388)k1
on k1.IDENTIFICADOR_ID =  a.IDENTIFICADOR_ID
right join  (select valor,IDENTIFICADOR_ID
from db_trusted_common_zone.FNX_CONFIGURACIONES_IDENTIF_bs where caracteristica_id=37)l1
on l1.IDENTIFICADOR_ID =  a.IDENTIFICADOR_ID
right join  (select valor,IDENTIFICADOR_ID
from db_trusted_common_zone.FNX_CONFIGURACIONES_IDENTIF_bs where caracteristica_id=124)m1
    on m1.IDENTIFICADOR_ID =  a.IDENTIFICADOR_ID
        inner join db_trusted_common_zone.FNX_CLIENTES_bs as b
        on a.CLIENTE_ID=b.CLIENTE_ID
        inner join db_trusted_common_zone.FNX_PLANES_FACTURACION_bs as e
        on a.PRODUCTO_ID=e.PRODUCTO_ID
        and a.SERVICIO_ID=e.SERVICIO_ID
        and a.EMPRESA_ID=e.EMPRESA_ID
        and a.MUNICIPIO_ID=e.MUNICIPIO_ID
        where a.TIPO_ELEMENTO_ID in ('CUENTA','TELEV','TO')
        and d.caracteristica_id=124)t

Body:
Table FNX_CONFIGURACIONES_IDENTIF_bs can be joined only one time, use case statements with aggregation:

select
    IDENTIFICADOR_ID,
    ESTADO,
    FECHA_ESTADO,
    MUNICIPIO_ID,
    TIPO_ID,
    NOMBRE_COMPLETO,
    VALOR_PLAN_FACTURACION,
    VALOR_ESTADO_SERVICIO,
    VALOR_PAQUETE,
    VALOR_ACCESP,
    VALOR_TIPO_BANDA_ANCHA,
    VALOR_VELOCIDAD_ACCESO,
    descripcion_ltcar,
    DESCRIPCION_PLAN_OPEN,
    ESTADO_FNX_PLANES_FACTURACION,
    load_date
    from
    (
    select
    a.IDENTIFICADOR_ID,
    a.ESTADO,
    a.FECHA_ESTADO,
    a.MUNICIPIO_ID,
    b.TIPO_ID,
    b.NOMBRE_COMPLETO,
    max(case when caracteristica_id=2005 then c.valor end) as VALOR_PLAN_FACTURACION,
    max(case when caracteristica_id=132  then c.valor end) as VALOR_ESTADO_SERVICIO,
    max(case when caracteristica_id=2879 then c.valor end) as VALOR_PAQUETE,
    max(case when caracteristica_id=2093 then c.valor end) as VALOR_ACCESP,
    max(case when caracteristica_id=120  then c.valor end) as VALOR_TIPO_BANDA_ANCHA,
    max(case when caracteristica_id=124  then c.valor end) as VALOR_VELOCIDAD_ACCESO,
    d.descripcion_ltcar,
    e.DESCRIPCION_PLAN_OPEN,
    e.estado as ESTADO_FNX_PLANES_FACTURACION,
    '2019-05-22' as load_date
    from  db_trusted_common_zone.FNX_IDENTIFICADORES_bs as a,
          db_trusted_common_zone.FNX_LISTAS_TCARACTERISTICAS_bs d --this join needs to be fixed, there is no ON condition. This is CROSS JOIN. It is acceptable if table d returns only one row
          inner join (select * from db_trusted_common_zone.FNX_CONFIGURACIONES_IDENTIF_bs c where caracteristica_id in (2005,132,2879,2093,120,124)) c on c.IDENTIFICADOR_ID =  a.IDENTIFICADOR_ID --join only one time with this table
          inner join db_trusted_common_zone.FNX_CLIENTES_bs as b on a.CLIENTE_ID=b.CLIENTE_ID
          inner join db_trusted_common_zone.FNX_PLANES_FACTURACION_bs as e on a.PRODUCTO_ID=e.PRODUCTO_ID
                                                                           and a.SERVICIO_ID=e.SERVICIO_ID
                                                                           and a.EMPRESA_ID=e.EMPRESA_ID
                                                                           and a.MUNICIPIO_ID=e.MUNICIPIO_ID
    where a.TIPO_ELEMENTO_ID in ('CUENTA','TELEV','TO')
      and d.caracteristica_id=124
    group by
    a.IDENTIFICADOR_ID,
    a.ESTADO,
    a.FECHA_ESTADO,
    a.MUNICIPIO_ID,
    b.TIPO_ID,
    b.NOMBRE_COMPLETO,
    d.descripcion_ltcar,
    e.DESCRIPCION_PLAN_OPEN,
    e.estado as ESTADO_FNX_PLANES_FACTURACION
    )t

Also join with db_trusted_common_zone.FNX_LISTAS_TCARACTERISTICAS_bs still needs to be fixed. It is without ON condition and works as a cross join.

Also these values are too high:

set mapreduce.input.fileinputformat.split.maxsize=1024000000;
set mapreduce.input.fileinputformat.split.minsize=1024000000;

Try to reduce x2 or even x4 times or more to increase parallelizm.


问:
androidInterface is not defined. What gives?
I'm seeing a strange javascript exception being triggered by a random user on an android device running chrome. My code contains no reference to anything named androidInterface, and so is not relevant to this question.

User Agent String:

Mozilla/5.0 (Linux; Android 7.0; SM-G892A
  Build/NRD90M; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0
  Chrome/57.0.2987.132 Mobile Safari/537.36

...which tells me that the user is running Chrome 57 on Android (Nougat)
on a Samsung SM-G892A

The actual error is coming back from window.onError with
Uncaught ReferenceError: androidInterface is not defined

Also I track clicks and api calls. This error occurs right as they are loading the page which is just a standard backbone/require setup that is working for a few thousand other customers.

Have you ever seen anything like this? What does it even mean?

答:
If you look closely at the UA string, you'll see wv which means it's a WebView on Android.

I found this question which made it more clear it's a WebView and then looked at Chrome User Agent Strings to make sure.

Bottom line is that you don't have to change anything because the error is related to the app that implemented the WebView.


问:
How to change angular material stepper step numbers to any icon or text?
Angular Material Stepper has following problems for me which I can not found from documentation.

How can I display any string or html instead of stepper index
numbers?

How can display matToolTip when mouse hover any mat step?

I am using latest version of Material Angular IO.

答:
I think this could be work for you.</p>

```<code><ng-template matStepLabel>
    <span matTooltip="Fill out your name">Fill out your name</span>
</ng-template>
</code>```

Body:
I think this could be work for you.

<ng-template matStepLabel>
    <span matTooltip="Fill out your name">Fill out your name</span>
</ng-template>


问:
JavasScript inheritance for constructors that return a function
Is there a way in JavaScript to inherit from a constructor function that returns a function? For example:

```<code>var A = function() {
  return function(input) {
    // do stuff
  };
};

var B = function() {};
B.prototype = new A();
var b = new B();
</code>```

Thanks

答:
By returning a function from your constructor, you're not creating an instance of A, but rather an instance of the function. Therefore, inheritance will not work.

```<code>var A = function() { return function(input) {}; };
var a = new A();
>>> typeof a;
"function"

var A = function() {};
var a = new A();
>>> typeof a;
"object"
</code>```

If you need B to inherit the returned function from A, you should set it as a method of A, either locally or in the prototype chain, and pass it that way.

```<code>var A = function() {
  this.method = function(input) {}
};

var B = function() {}
B.prototype = new A();
var b = new B();
>>> b.method
'function(input) { }'
</code>```

Body:
Is there a way in JavaScript to inherit from a constructor function that returns a function? For example:

var A = function() {
  return function(input) {
    // do stuff
  };
};

var B = function() {};
B.prototype = new A();
var b = new B();

Thanks

Body:
By returning a function from your constructor, you're not creating an instance of A, but rather an instance of the function. Therefore, inheritance will not work.

var A = function() { return function(input) {}; };
var a = new A();
>>> typeof a;
"function"

var A = function() {};
var a = new A();
>>> typeof a;
"object"

If you need B to inherit the returned function from A, you should set it as a method of A, either locally or in the prototype chain, and pass it that way.

var A = function() {
  this.method = function(input) {}
};

var B = function() {}
B.prototype = new A();
var b = new B();
>>> b.method
'function(input) { }'


问:
Writing out GPS information every second using NeoGPS
I am trying to write GPS output every second to output file, but get only zeros in the output. For the output of the other sensor it works...

Originally I used the TinyGPS++ package. However, it was not possible to output the GPS data every second.

```<code>#include <SPI.h>
#include <SD.h>
#include <Wire.h>
#include <avr/wdt.h>
#include "BlueDot_BME680.h"
BlueDot_BME680 bme680 = BlueDot_BME680();

#include <NMEAGPS.h>
#include <GPSport.h>
#include <Streamers.h>

static const int RXPin = 2, TXPin = 3;
static const uint32_t GPSBaud = 9600;

NMEAGPS gps;
gps_fix fix;

File myFile;

void setup() {
//*********************** serielle kommunikation
  Wire.begin();
  Serial.begin(9600);
  gpsPort.begin(GPSBaud);

  if (!SD.begin(4)) {

    return;
  }

    bme680.parameter.I2CAddress = 0x76;                  //Choose I2C Address
    bme680.parameter.sensorMode = 0b01;                  //Default sensor mode
    bme680.parameter.IIRfilter = 0b100;                  //Setting IIR Filter coefficient (15 default,0 off, 127 max)
    bme680.parameter.humidOversampling = 0b101;          //Setting Humidity Oversampling factor (16 default,0 disable humidity meas.)
    bme680.parameter.tempOversampling = 0b101;           //Setting Temperature Oversampling factor (16 default, 0 disable)
    bme680.parameter.pressOversampling = 0b101;          //Setting Pressure Oversampling factor (16 default,0 disable)
    bme680.parameter.pressureSeaLevel = 1013.25;         //default value of 1013.25 hPa
    bme680.parameter.tempOutsideCelsius = 15;            //default 15°C, current average outside temp to calculate altitude
    bme680.parameter.target_temp = 320;                  // gas sensor hot plate temp (320C default, 200C min, 400C max)

  // open the file. note that only one file can be open at a time,
  // so you have to close this one before opening another.
  bme680.writeCTRLMeas();

  myFile = SD.open("sensor.txt", FILE_WRITE);

  if (myFile) {
    // print the headings for our data
    myFile.println("Time,Sat,Lat,Lng,Alt,Temp,Hum,Press");
  }
  myFile.close();
}

void sensor() {
  bme680.writeCTRLMeas();
  myFile = SD.open("sensor.txt", FILE_WRITE);
  if (myFile) {
  myFile.print(fix.dateTime);
  myFile.print(',');
  myFile.print(fix.satellites);
  myFile.print(',');
  myFile.print(fix.latitude(), 6);
  myFile.print(',');
  myFile.print(fix.longitude(), 6);
  myFile.print(',');
  myFile.print(fix.altitude());
  myFile.print(',');
  myFile.print(bme680.readTempC());
  myFile.print(',');
  myFile.print(bme680.readHumidity());
  myFile.print(',');
  myFile.print(bme680.readPressure());
  myFile.println();
  }
  myFile.close();
}

//  This is the main GPS parsing loop.
static void GPSloop()
{
  while (gps.available( gpsPort )) {
    fix = gps.read();
    sensor();
  }
}

void loop()
{
  GPSloop();

  delay(1000);
}
</code>```

The aim is to retrieve the GPS data every second. At the moment I only get zeros.

答:
First, you need to feed the serial data (chars) constantly to your fix object, so you need to remove delay(1000) from your loop.

Second, you need to check if the location is valid and then write them to the SD.

```<code>#include <SPI.h>
#include <SD.h>
#include <Wire.h>
#include <avr/wdt.h>
#include "BlueDot_BME680.h"
BlueDot_BME680 bme680 = BlueDot_BME680();

#include <NMEAGPS.h>
#include <GPSport.h>
#include <Streamers.h>

static const int RXPin = 2, TXPin = 3;
static const uint32_t GPSBaud = 9600;

NMEAGPS gps;
gps_fix fix;

File myFile;

void setup()
{
    //*********************** serielle kommunikation
    Wire.begin();
    Serial.begin(9600);
    gpsPort.begin(GPSBaud);

    if (!SD.begin(4))
    {

        return;
    }

    bme680.parameter.I2CAddress = 0x76;          //Choose I2C Address
    bme680.parameter.sensorMode = 0b01;          //Default sensor mode
    bme680.parameter.IIRfilter = 0b100;          //Setting IIR Filter coefficient (15 default,0 off, 127 max)
    bme680.parameter.humidOversampling = 0b101;  //Setting Humidity Oversampling factor (16 default,0 disable humidity meas.)
    bme680.parameter.tempOversampling = 0b101;   //Setting Temperature Oversampling factor (16 default, 0 disable)
    bme680.parameter.pressOversampling = 0b101;  //Setting Pressure Oversampling factor (16 default,0 disable)
    bme680.parameter.pressureSeaLevel = 1013.25; //default value of 1013.25 hPa
    bme680.parameter.tempOutsideCelsius = 15;    //default 15°C, current average outside temp to calculate altitude
    bme680.parameter.target_temp = 320;          // gas sensor hot plate temp (320C default, 200C min, 400C max)

    // open the file. note that only one file can be open at a time,
    // so you have to close this one before opening another.
    bme680.writeCTRLMeas();

    myFile = SD.open("sensor.txt", FILE_WRITE);

    if (myFile)
    {
        // print the headings for our data
        myFile.println("Time,Sat,Lat,Lng,Alt,Temp,Hum,Press");
    }
    myFile.close();
}

void sensor()
{
    bme680.writeCTRLMeas();
    myFile = SD.open("sensor.txt", FILE_WRITE);
    if (myFile)
    {
        myFile.print(fix.dateTime);
        myFile.print(',');
        myFile.print(fix.satellites);
        myFile.print(',');
        myFile.print(fix.latitude(), 6);
        myFile.print(',');
        myFile.print(fix.longitude(), 6);
        myFile.print(',');
        myFile.print(fix.altitude());
        myFile.print(',');
        myFile.print(bme680.readTempC());
        myFile.print(',');
        myFile.print(bme680.readHumidity());
        myFile.print(',');
        myFile.print(bme680.readPressure());
        myFile.println();
    }
    myFile.close();
}

//  This is the main GPS parsing loop.
static void GPSloop()
{
    while (gps.available(gpsPort))
    {
        fix = gps.read();
        if (fix.valid.location)
            sensor();
    }
}

void loop()
{
    GPSloop();
}
</code>```

Body:
I am trying to write GPS output every second to output file, but get only zeros in the output. For the output of the other sensor it works...

Originally I used the TinyGPS++ package. However, it was not possible to output the GPS data every second.

#include <SPI.h>
#include <SD.h>
#include <Wire.h>
#include <avr/wdt.h>
#include "BlueDot_BME680.h"
BlueDot_BME680 bme680 = BlueDot_BME680();

#include <NMEAGPS.h>
#include <GPSport.h>
#include <Streamers.h>

static const int RXPin = 2, TXPin = 3;
static const uint32_t GPSBaud = 9600;

NMEAGPS gps;
gps_fix fix;

File myFile;

void setup() {
//*********************** serielle kommunikation
  Wire.begin();
  Serial.begin(9600);
  gpsPort.begin(GPSBaud);

  if (!SD.begin(4)) {

    return;
  }

    bme680.parameter.I2CAddress = 0x76;                  //Choose I2C Address
    bme680.parameter.sensorMode = 0b01;                  //Default sensor mode
    bme680.parameter.IIRfilter = 0b100;                  //Setting IIR Filter coefficient (15 default,0 off, 127 max)
    bme680.parameter.humidOversampling = 0b101;          //Setting Humidity Oversampling factor (16 default,0 disable humidity meas.)
    bme680.parameter.tempOversampling = 0b101;           //Setting Temperature Oversampling factor (16 default, 0 disable)
    bme680.parameter.pressOversampling = 0b101;          //Setting Pressure Oversampling factor (16 default,0 disable)
    bme680.parameter.pressureSeaLevel = 1013.25;         //default value of 1013.25 hPa
    bme680.parameter.tempOutsideCelsius = 15;            //default 15°C, current average outside temp to calculate altitude
    bme680.parameter.target_temp = 320;                  // gas sensor hot plate temp (320C default, 200C min, 400C max)

  // open the file. note that only one file can be open at a time,
  // so you have to close this one before opening another.
  bme680.writeCTRLMeas();

  myFile = SD.open("sensor.txt", FILE_WRITE);

  if (myFile) {
    // print the headings for our data
    myFile.println("Time,Sat,Lat,Lng,Alt,Temp,Hum,Press");
  }
  myFile.close();
}

void sensor() {
  bme680.writeCTRLMeas();
  myFile = SD.open("sensor.txt", FILE_WRITE);
  if (myFile) {
  myFile.print(fix.dateTime);
  myFile.print(',');
  myFile.print(fix.satellites);
  myFile.print(',');
  myFile.print(fix.latitude(), 6);
  myFile.print(',');
  myFile.print(fix.longitude(), 6);
  myFile.print(',');
  myFile.print(fix.altitude());
  myFile.print(',');
  myFile.print(bme680.readTempC());
  myFile.print(',');
  myFile.print(bme680.readHumidity());
  myFile.print(',');
  myFile.print(bme680.readPressure());
  myFile.println();
  }
  myFile.close();
}

//  This is the main GPS parsing loop.
static void GPSloop()
{
  while (gps.available( gpsPort )) {
    fix = gps.read();
    sensor();
  }
}

void loop()
{
  GPSloop();

  delay(1000);
}

The aim is to retrieve the GPS data every second. At the moment I only get zeros.

Body:
First, you need to feed the serial data (chars) constantly to your fix object, so you need to remove delay(1000) from your loop.

Second, you need to check if the location is valid and then write them to the SD.

#include <SPI.h>
#include <SD.h>
#include <Wire.h>
#include <avr/wdt.h>
#include "BlueDot_BME680.h"
BlueDot_BME680 bme680 = BlueDot_BME680();

#include <NMEAGPS.h>
#include <GPSport.h>
#include <Streamers.h>

static const int RXPin = 2, TXPin = 3;
static const uint32_t GPSBaud = 9600;

NMEAGPS gps;
gps_fix fix;

File myFile;

void setup()
{
    //*********************** serielle kommunikation
    Wire.begin();
    Serial.begin(9600);
    gpsPort.begin(GPSBaud);

    if (!SD.begin(4))
    {

        return;
    }

    bme680.parameter.I2CAddress = 0x76;          //Choose I2C Address
    bme680.parameter.sensorMode = 0b01;          //Default sensor mode
    bme680.parameter.IIRfilter = 0b100;          //Setting IIR Filter coefficient (15 default,0 off, 127 max)
    bme680.parameter.humidOversampling = 0b101;  //Setting Humidity Oversampling factor (16 default,0 disable humidity meas.)
    bme680.parameter.tempOversampling = 0b101;   //Setting Temperature Oversampling factor (16 default, 0 disable)
    bme680.parameter.pressOversampling = 0b101;  //Setting Pressure Oversampling factor (16 default,0 disable)
    bme680.parameter.pressureSeaLevel = 1013.25; //default value of 1013.25 hPa
    bme680.parameter.tempOutsideCelsius = 15;    //default 15°C, current average outside temp to calculate altitude
    bme680.parameter.target_temp = 320;          // gas sensor hot plate temp (320C default, 200C min, 400C max)

    // open the file. note that only one file can be open at a time,
    // so you have to close this one before opening another.
    bme680.writeCTRLMeas();

    myFile = SD.open("sensor.txt", FILE_WRITE);

    if (myFile)
    {
        // print the headings for our data
        myFile.println("Time,Sat,Lat,Lng,Alt,Temp,Hum,Press");
    }
    myFile.close();
}

void sensor()
{
    bme680.writeCTRLMeas();
    myFile = SD.open("sensor.txt", FILE_WRITE);
    if (myFile)
    {
        myFile.print(fix.dateTime);
        myFile.print(',');
        myFile.print(fix.satellites);
        myFile.print(',');
        myFile.print(fix.latitude(), 6);
        myFile.print(',');
        myFile.print(fix.longitude(), 6);
        myFile.print(',');
        myFile.print(fix.altitude());
        myFile.print(',');
        myFile.print(bme680.readTempC());
        myFile.print(',');
        myFile.print(bme680.readHumidity());
        myFile.print(',');
        myFile.print(bme680.readPressure());
        myFile.println();
    }
    myFile.close();
}

//  This is the main GPS parsing loop.
static void GPSloop()
{
    while (gps.available(gpsPort))
    {
        fix = gps.read();
        if (fix.valid.location)
            sensor();
    }
}

void loop()
{
    GPSloop();
}


问:
How to connect to localhost and external database from docker container
I have two docker containers, nginx and php, from which I want to access mysql server running on host machine and sql server on remote machine.

Have tried change the network type from "bridge" to "host" but it returns errors.

```<code>version: '2'

services:
    web:
        image: nginx:latest
        ports:
            - "8080:80"
        volumes:
            - /var/www/:/code
            - ./site.conf:/etc/nginx/conf.d/default.conf
        networks:
            - mynetwork
    php:
        image: php:fpm
        volumes:
            - /var/www/:/code
        networks:
           - mynetwork
networks:
    mynetwork:
       driver: bridge
</code>```

I'm expecting php code running in my containers can connect to those two databases.

Note: I don't using docker run to run container, instead I'm using docker-compose up -d so I just want to edit the docker-compose.yml file.

答: In order to docker containers has access to each other you should link them. docker service uses link switch to add ID and IP of one container in /etc/hosts file of another.

Body:
I have two docker containers, nginx and php, from which I want to access mysql server running on host machine and sql server on remote machine.

Have tried change the network type from "bridge" to "host" but it returns errors.

version: '2'

services:
    web:
        image: nginx:latest
        ports:
            - "8080:80"
        volumes:
            - /var/www/:/code
            - ./site.conf:/etc/nginx/conf.d/default.conf
        networks:
            - mynetwork
    php:
        image: php:fpm
        volumes:
            - /var/www/:/code
        networks:
           - mynetwork
networks:
    mynetwork:
       driver: bridge

I'm expecting php code running in my containers can connect to those two databases.

Note: I don't using docker run to run container, instead I'm using docker-compose up -d so I just want to edit the docker-compose.yml file.


问:
Animate constraints change UIViewController
I have "error" view, that is placed above navigation bar and hidden. When error occured, i want that view to smoothly show from top. I tried:

```<code>class AuthViewController: UIViewController {

  let error: ErrorView = {
    let error = ErrorView()
    error.setup()
    return error
  }()
  var topAnchor: NSLayoutConstraint!
  var botAnchor: NSLayoutConstraint!

  override func viewDidLoad() {
    setupErrorView()
  }

  private func setupErrorView(){
    view.addSubview(error)
    botAnchor = error.bottomAnchor.constraint(equalTo: view.topAnchor)
    botAnchor.isActive = true
    topAnchor = error.topAnchor.constraint(equalTo: view.topAnchor, constant: CGFloat(Offsets.navigationAndStatusBarHeight))
    topAnchor.isActive = false
    error.leftAnchor.constraint(equalTo: view.leftAnchor).isActive = true
    error.rightAnchor.constraint(equalTo: view.rightAnchor).isActive = true
  }

  func showError(_ text: String){
    UIView.animate(withDuration: 2.0) {[weak self] in
      guard let weakSelf = self else { return }
      print("attempt to animate")
      weakSelf.error.show(text)
      weakSelf.botAnchor.isActive = false
      weakSelf.topAnchor.isActive = true
      weakSelf.view.setNeedsLayout()
    }
  }
}

class ErrorView: UIView {

  private var label: UILabel = {
    return LabelSL.regular()
  }()

  fileprivate func setup(){
    translatesAutoresizingMaskIntoConstraints = false
    backgroundColor = Theme.Color.orange.value
    addSubview(label)
  }

  fileprivate func show(_ text: String){
    let sideOffset: CGFloat = 10
    let verticalOffset: CGFloat = 10
    label.text = text
    label.topAnchor.constraint(equalTo: topAnchor, constant: verticalOffset).isActive = true
    label.leftAnchor.constraint(equalTo: leftAnchor, constant: sideOffset).isActive = true
    label.rightAnchor.constraint(equalTo: rightAnchor, constant: -sideOffset).isActive = true
    label.bottomAnchor.constraint(equalTo: bottomAnchor, constant: -verticalOffset).isActive = true
  }
}
</code>```

Animation should be done when   func showError(_ text: String){ method called, but it's not. View just appear instantly.

答:
You're trying to animate constraints in wrong way. You should set constraints outside of animation block and only layoutIfNeeded in animation:

```<code>func showError(_ text: String){
    botAnchor.isActive = false
    topAnchor.isActive = true
    error.show(text)
    UIView.animate(withDuration: 2.0) {
        self.view.layoutIfNeeded()
    }
}
</code>```

Body:
I have "error" view, that is placed above navigation bar and hidden. When error occured, i want that view to smoothly show from top. I tried:

class AuthViewController: UIViewController {

  let error: ErrorView = {
    let error = ErrorView()
    error.setup()
    return error
  }()
  var topAnchor: NSLayoutConstraint!
  var botAnchor: NSLayoutConstraint!

  override func viewDidLoad() {
    setupErrorView()
  }

  private func setupErrorView(){
    view.addSubview(error)
    botAnchor = error.bottomAnchor.constraint(equalTo: view.topAnchor)
    botAnchor.isActive = true
    topAnchor = error.topAnchor.constraint(equalTo: view.topAnchor, constant: CGFloat(Offsets.navigationAndStatusBarHeight))
    topAnchor.isActive = false
    error.leftAnchor.constraint(equalTo: view.leftAnchor).isActive = true
    error.rightAnchor.constraint(equalTo: view.rightAnchor).isActive = true
  }

  func showError(_ text: String){
    UIView.animate(withDuration: 2.0) {[weak self] in
      guard let weakSelf = self else { return }
      print("attempt to animate")
      weakSelf.error.show(text)
      weakSelf.botAnchor.isActive = false
      weakSelf.topAnchor.isActive = true
      weakSelf.view.setNeedsLayout()
    }
  }
}

class ErrorView: UIView {

  private var label: UILabel = {
    return LabelSL.regular()
  }()

  fileprivate func setup(){
    translatesAutoresizingMaskIntoConstraints = false
    backgroundColor = Theme.Color.orange.value
    addSubview(label)
  }

  fileprivate func show(_ text: String){
    let sideOffset: CGFloat = 10
    let verticalOffset: CGFloat = 10
    label.text = text
    label.topAnchor.constraint(equalTo: topAnchor, constant: verticalOffset).isActive = true
    label.leftAnchor.constraint(equalTo: leftAnchor, constant: sideOffset).isActive = true
    label.rightAnchor.constraint(equalTo: rightAnchor, constant: -sideOffset).isActive = true
    label.bottomAnchor.constraint(equalTo: bottomAnchor, constant: -verticalOffset).isActive = true
  }
}

Animation should be done when   func showError(_ text: String){ method called, but it's not. View just appear instantly.

Body:
You're trying to animate constraints in wrong way. You should set constraints outside of animation block and only layoutIfNeeded in animation:

func showError(_ text: String){
    botAnchor.isActive = false
    topAnchor.isActive = true
    error.show(text)
    UIView.animate(withDuration: 2.0) {
        self.view.layoutIfNeeded()
    }
}


问:
Is it possible to monkey patch typescript Date constructor?
I would like to monkey patch the built in Date constructor in typescript, so when I call new Date(), I can define what the returned date will actually be.

I have tried starting off on this question: Date constructor monkey patch
but in typescript you need to provide properties for the date constructor: (Type '() => any' is missing the following properties from type 'DateConstructor': parse, UTC, now), and you can't just define properties for a simple function.

Is there a way to do this?
Thanks

答:
I'm not sure it is possible to really override a type here, however you can always add needed properties / methods to the Date object:</p>

```<code>interface Date {
  myExtraProperty: string
}

new Date().myExtraProperty; // works
</code>```

Body:
I'm not sure it is possible to really override a type here, however you can always add needed properties / methods to the Date object:

interface Date {
  myExtraProperty: string
}

new Date().myExtraProperty; // works


问:
RecyclerView OnclickListener in CardView
I have a list with recyclerView in which the CardView is visualized through an adapter and within the CardView I have 8 textView.
Up to that point everything is perfect, the list is displayed well.But when implementing the onClick to the cardView I have the following problem,
that the cardViews are only clickable in the background below the TextView elements, it is as if they cover the clickleable zone

```<code> ArrayList<Maquina> maquinasList;
 maquinasList=new ArrayList<>();

    listaMaquinas= (RecyclerView) findViewById(R.id.lista_de_maquinas);

    listaMaquinas.setLayoutManager(new LinearLayoutManager(this));

    maquinasAdapter adapter= new maquinasAdapter(maquinasList);

    adapter.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            Maquina user=maquinasList.get(listaMaquinas.getChildAdapterPosition(v));
            Intent intent=new Intent(ListaMaquinas.this,RegistrarMaquina.class);

            Bundle bundle=new Bundle();
            bundle.putSerializable("maquina",user);

            intent.putExtras(bundle);
            startActivity(intent);

        }
    });
    listaMaquinas.setAdapter(adapter);
</code>```

```<code>public class maquinaAdapter extends RecyclerView.Adapter<maquinaAdapter.MaquinaViewHolder> {

private ArrayList<Maquina> listaMaquinas;
private OnItemClickListener mListener;
public interface OnItemClickListener {
    void onItemClick(int position);
}
public void setOnClickListener(OnItemClickListener listener){
    mListener = listener;
}

public static class MaquinaViewHolder extends RecyclerView.ViewHolder{
    public TextView tipo;
    public TextView marca;
    public TextView modelo;
    public TextView serie;

    public MaquinaViewHolder(View itemView,final OnItemClickListener listener){
        super(itemView);
        tipo= itemView.findViewById(R.id.tipo);
        marca= itemView.findViewById(R.id.marca);
        modelo= itemView.findViewById(R.id.modelo);
        serie= itemView.findViewById(R.id.serie);

        itemView.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                if (listener!=null){
                    int position=getAdapterPosition();
                    if (position!=RecyclerView.NO_POSITION){
                        listener.onItemClick(position);
                    }
                }
            }
        });
    }
}
public maquinaAdapter(ArrayList<Maquina> listaMaquina){
    listaMaquinas = listaMaquina;
}
@Override
public MaquinaViewHolder onCreateViewHolder(ViewGroup parent,int viewType){
    View v = LayoutInflater.from(parent.getContext()).inflate(R.layout.lista_maquinas,parent,false);
    return new MaquinaViewHolder(v,mListener);
}
@Override
public void onBindViewHolder(MaquinaViewHolder holder,int position){
    Maquina currentItem = listaMaquinas.get(position);

    holder.tipo.setText(currentItem.getTipo());
    holder.marca.setText(currentItem.getMarca());
    holder.modelo.setText(currentItem.getModelo());
    holder.serie.setText(currentItem.getSerie());
}
@Override
public int getItemCount(){
    return listaMaquinas.size();
}
}
</code>```

```<code><?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:card_view="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">

<androidx.cardview.widget.CardView
    android:id="@+id/card"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_gravity="center"
    android:layout_marginLeft="10dp"
    android:layout_marginTop="10dp"
    android:layout_marginRight="10dp"
    android:layout_marginBottom="10dp"
    android:background="@drawable/cardview"
    android:backgroundTintMode="multiply"
    android:elevation="20dp"
    card_view:cardBackgroundColor="@color/colorAccent"
    card_view:cardCornerRadius="10dp"
    card_view:cardElevation="24dp"
    card_view:cardMaxElevation="20dp"
    card_view:cardPreventCornerOverlap="true"
    card_view:cardUseCompatPadding="false">

    <LinearLayout
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:gravity="center"
        android:orientation="vertical">

        <LinearLayout
            android:layout_width="wrap_content"
            android:layout_height="match_parent"
            android:gravity="center_vertical|center_horizontal"
            android:orientation="horizontal">

            <LinearLayout
                android:layout_width="93dp"
                android:layout_height="match_parent"
                android:orientation="vertical">

                <TextView
                    android:id="@+id/t1"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_marginLeft="5dp"
                    android:layout_marginTop="10dp"
                    android:layout_marginRight="5dp"
                    android:background="@drawable/btnbordes"
                    android:text="Tipo"
                    android:textAlignment="center"
                    android:textColor="#3dffb8"
                    android:textSize="14sp" />

                <TextView
                    android:id="@+id/t2"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_marginLeft="5dp"
                    android:layout_marginTop="5dp"
                    android:layout_marginRight="5dp"
                    android:background="@drawable/btnbordes"
                    android:text="Marca"
                    android:textAlignment="center"
                    android:textColor="@android:color/white"
                    android:textSize="14sp" />

                <TextView
                    android:id="@+id/t3"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_marginLeft="5dp"
                    android:layout_marginTop="5dp"
                    android:layout_marginRight="5dp"
                    android:background="@drawable/btnbordes"
                    android:text="Modelo"
                    android:textAlignment="center"
                    android:textColor="@android:color/white"
                    android:textSize="14sp" />

                <TextView
                    android:id="@+id/t4"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_marginLeft="5dp"
                    android:layout_marginTop="5dp"
                    android:layout_marginRight="5dp"
                    android:layout_marginBottom="10dp"
                    android:background="@drawable/btnbordes"
                    android:text="Serie"
                    android:textAlignment="center"
                    android:textColor="@android:color/white"
                    android:textSize="14sp" />
            </LinearLayout>

            <LinearLayout
                android:layout_width="227dp"
                android:layout_height="match_parent"
                android:orientation="vertical">

                <TextView
                    android:id="@+id/tipo"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_marginLeft="5dp"
                    android:layout_marginTop="10dp"
                    android:layout_marginRight="5dp"
                    android:background="@drawable/text"
                    android:inputType="textMultiLine"
                    android:isScrollContainer="true"
                    android:maxLines="4"
                    android:textAlignment="center"
                    android:textColor="#3dffb8"
                    android:textSize="14sp" />

                <TextView
                    android:id="@+id/marca"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_marginLeft="5dp"
                    android:layout_marginTop="5dp"
                    android:layout_marginRight="5dp"
                    android:background="@drawable/text"
                    android:inputType="textMultiLine"
                    android:isScrollContainer="true"
                    android:maxLines="4"
                    android:textAlignment="center"
                    android:textColor="@android:color/white"
                    android:textSize="14sp" />

                <TextView
                    android:id="@+id/modelo"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_marginLeft="5dp"
                    android:layout_marginTop="5dp"
                    android:layout_marginRight="5dp"
                    android:background="@drawable/text"
                    android:inputType="textMultiLine"
                    android:isScrollContainer="true"
                    android:maxLines="4"
                    android:textAlignment="center"
                    android:textColor="@android:color/white"
                    android:textSize="14sp" />

                <TextView
                    android:id="@+id/serie"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_marginLeft="5dp"
                    android:layout_marginTop="5dp"
                    android:layout_marginRight="5dp"
                    android:layout_marginBottom="10dp"
                    android:background="@drawable/text"
                    android:inputType="textMultiLine"
                    android:isScrollContainer="true"
                    android:maxLines="4"
                    android:textAlignment="center"
                    android:textColor="@android:color/white"
                    android:textSize="14sp" />
            </LinearLayout>

        </LinearLayout>

    </LinearLayout>

</androidx.cardview.widget.CardView>

</LinearLayout>
</code>```

This is the code of the cardViews that are displayed in the list. I have already reviewed the adapter and the other classes and I think the problem is in the CardView Configuration.
Thank you very much in advance.

答:
this is sample adapter of RecyclerView.Adapter

```<code>public class Adapter extends RecyclerView.Adapter<Adapter.MyViewHolder> {
private ListItemClickListener mOnClickListener;
public interface ListItemClickListener{
    void onListItemClick(View view, int postion);
}
public class MyViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener{
    public TextView title;
    public CardView cardView;

    public MyViewHolder(View view) {
        super(view);
        title = (TextView) view.findViewById(R.id.tvTitle);
        cardView=(CardView)view.findViewById(R.id.card_view);

        title.setOnClickListener(this);
        cardView.setOnClickListener(this);
    }

    @Override
    public void onClick(View v) {
        mOnClickListener.onListItemClick(v, getAdapterPosition());
    }

}

public void setClickListener(ListItemClickListener itemClickListener) {
    this.mOnClickListener = itemClickListener;
}
</code>```

Now implement Adapter.ListItemClickListener on your activity class and set the setClickListener of your adapter

```<code>Adapter.setClickListener(this);
//the intent where to go inside the implemented method
</code>```

Body:
I have a list with recyclerView in which the CardView is visualized through an adapter and within the CardView I have 8 textView.
Up to that point everything is perfect, the list is displayed well.But when implementing the onClick to the cardView I have the following problem,
that the cardViews are only clickable in the background below the TextView elements, it is as if they cover the clickleable zone

 ArrayList<Maquina> maquinasList;
 maquinasList=new ArrayList<>();

    listaMaquinas= (RecyclerView) findViewById(R.id.lista_de_maquinas);

    listaMaquinas.setLayoutManager(new LinearLayoutManager(this));

    maquinasAdapter adapter= new maquinasAdapter(maquinasList);

    adapter.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            Maquina user=maquinasList.get(listaMaquinas.getChildAdapterPosition(v));
            Intent intent=new Intent(ListaMaquinas.this,RegistrarMaquina.class);

            Bundle bundle=new Bundle();
            bundle.putSerializable("maquina",user);

            intent.putExtras(bundle);
            startActivity(intent);

        }
    });
    listaMaquinas.setAdapter(adapter);

public class maquinaAdapter extends RecyclerView.Adapter<maquinaAdapter.MaquinaViewHolder> {

private ArrayList<Maquina> listaMaquinas;
private OnItemClickListener mListener;
public interface OnItemClickListener {
    void onItemClick(int position);
}
public void setOnClickListener(OnItemClickListener listener){
    mListener = listener;
}

public static class MaquinaViewHolder extends RecyclerView.ViewHolder{
    public TextView tipo;
    public TextView marca;
    public TextView modelo;
    public TextView serie;

    public MaquinaViewHolder(View itemView,final OnItemClickListener listener){
        super(itemView);
        tipo= itemView.findViewById(R.id.tipo);
        marca= itemView.findViewById(R.id.marca);
        modelo= itemView.findViewById(R.id.modelo);
        serie= itemView.findViewById(R.id.serie);

        itemView.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                if (listener!=null){
                    int position=getAdapterPosition();
                    if (position!=RecyclerView.NO_POSITION){
                        listener.onItemClick(position);
                    }
                }
            }
        });
    }
}
public maquinaAdapter(ArrayList<Maquina> listaMaquina){
    listaMaquinas = listaMaquina;
}
@Override
public MaquinaViewHolder onCreateViewHolder(ViewGroup parent,int viewType){
    View v = LayoutInflater.from(parent.getContext()).inflate(R.layout.lista_maquinas,parent,false);
    return new MaquinaViewHolder(v,mListener);
}
@Override
public void onBindViewHolder(MaquinaViewHolder holder,int position){
    Maquina currentItem = listaMaquinas.get(position);

    holder.tipo.setText(currentItem.getTipo());
    holder.marca.setText(currentItem.getMarca());
    holder.modelo.setText(currentItem.getModelo());
    holder.serie.setText(currentItem.getSerie());
}
@Override
public int getItemCount(){
    return listaMaquinas.size();
}
}

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:card_view="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">

<androidx.cardview.widget.CardView
    android:id="@+id/card"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_gravity="center"
    android:layout_marginLeft="10dp"
    android:layout_marginTop="10dp"
    android:layout_marginRight="10dp"
    android:layout_marginBottom="10dp"
    android:background="@drawable/cardview"
    android:backgroundTintMode="multiply"
    android:elevation="20dp"
    card_view:cardBackgroundColor="@color/colorAccent"
    card_view:cardCornerRadius="10dp"
    card_view:cardElevation="24dp"
    card_view:cardMaxElevation="20dp"
    card_view:cardPreventCornerOverlap="true"
    card_view:cardUseCompatPadding="false">

    <LinearLayout
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:gravity="center"
        android:orientation="vertical">

        <LinearLayout
            android:layout_width="wrap_content"
            android:layout_height="match_parent"
            android:gravity="center_vertical|center_horizontal"
            android:orientation="horizontal">

            <LinearLayout
                android:layout_width="93dp"
                android:layout_height="match_parent"
                android:orientation="vertical">

                <TextView
                    android:id="@+id/t1"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_marginLeft="5dp"
                    android:layout_marginTop="10dp"
                    android:layout_marginRight="5dp"
                    android:background="@drawable/btnbordes"
                    android:text="Tipo"
                    android:textAlignment="center"
                    android:textColor="#3dffb8"
                    android:textSize="14sp" />

                <TextView
                    android:id="@+id/t2"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_marginLeft="5dp"
                    android:layout_marginTop="5dp"
                    android:layout_marginRight="5dp"
                    android:background="@drawable/btnbordes"
                    android:text="Marca"
                    android:textAlignment="center"
                    android:textColor="@android:color/white"
                    android:textSize="14sp" />

                <TextView
                    android:id="@+id/t3"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_marginLeft="5dp"
                    android:layout_marginTop="5dp"
                    android:layout_marginRight="5dp"
                    android:background="@drawable/btnbordes"
                    android:text="Modelo"
                    android:textAlignment="center"
                    android:textColor="@android:color/white"
                    android:textSize="14sp" />

                <TextView
                    android:id="@+id/t4"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_marginLeft="5dp"
                    android:layout_marginTop="5dp"
                    android:layout_marginRight="5dp"
                    android:layout_marginBottom="10dp"
                    android:background="@drawable/btnbordes"
                    android:text="Serie"
                    android:textAlignment="center"
                    android:textColor="@android:color/white"
                    android:textSize="14sp" />
            </LinearLayout>

            <LinearLayout
                android:layout_width="227dp"
                android:layout_height="match_parent"
                android:orientation="vertical">

                <TextView
                    android:id="@+id/tipo"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_marginLeft="5dp"
                    android:layout_marginTop="10dp"
                    android:layout_marginRight="5dp"
                    android:background="@drawable/text"
                    android:inputType="textMultiLine"
                    android:isScrollContainer="true"
                    android:maxLines="4"
                    android:textAlignment="center"
                    android:textColor="#3dffb8"
                    android:textSize="14sp" />

                <TextView
                    android:id="@+id/marca"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_marginLeft="5dp"
                    android:layout_marginTop="5dp"
                    android:layout_marginRight="5dp"
                    android:background="@drawable/text"
                    android:inputType="textMultiLine"
                    android:isScrollContainer="true"
                    android:maxLines="4"
                    android:textAlignment="center"
                    android:textColor="@android:color/white"
                    android:textSize="14sp" />

                <TextView
                    android:id="@+id/modelo"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_marginLeft="5dp"
                    android:layout_marginTop="5dp"
                    android:layout_marginRight="5dp"
                    android:background="@drawable/text"
                    android:inputType="textMultiLine"
                    android:isScrollContainer="true"
                    android:maxLines="4"
                    android:textAlignment="center"
                    android:textColor="@android:color/white"
                    android:textSize="14sp" />

                <TextView
                    android:id="@+id/serie"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_marginLeft="5dp"
                    android:layout_marginTop="5dp"
                    android:layout_marginRight="5dp"
                    android:layout_marginBottom="10dp"
                    android:background="@drawable/text"
                    android:inputType="textMultiLine"
                    android:isScrollContainer="true"
                    android:maxLines="4"
                    android:textAlignment="center"
                    android:textColor="@android:color/white"
                    android:textSize="14sp" />
            </LinearLayout>

        </LinearLayout>

    </LinearLayout>

</androidx.cardview.widget.CardView>

</LinearLayout>

This is the code of the cardViews that are displayed in the list. I have already reviewed the adapter and the other classes and I think the problem is in the CardView Configuration.
Thank you very much in advance.

Body:
this is sample adapter of RecyclerView.Adapter

public class Adapter extends RecyclerView.Adapter<Adapter.MyViewHolder> {
private ListItemClickListener mOnClickListener;
public interface ListItemClickListener{
    void onListItemClick(View view, int postion);
}
public class MyViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener{
    public TextView title;
    public CardView cardView;

    public MyViewHolder(View view) {
        super(view);
        title = (TextView) view.findViewById(R.id.tvTitle);
        cardView=(CardView)view.findViewById(R.id.card_view);

        title.setOnClickListener(this);
        cardView.setOnClickListener(this);
    }

    @Override
    public void onClick(View v) {
        mOnClickListener.onListItemClick(v, getAdapterPosition());
    }

}

public void setClickListener(ListItemClickListener itemClickListener) {
    this.mOnClickListener = itemClickListener;
}

Now implement Adapter.ListItemClickListener on your activity class and set the setClickListener of your adapter

Adapter.setClickListener(this);
//the intent where to go inside the implemented method


问:
Laravel 5.5: add url to json object to save multiple pictures
I need to save multiple pictures with Laravel. The pictures are stored separately on disk and the links to the places are stored in a JSON file in the database. So each users has an column in the database with:

```<code>{"images": ["/user/57/house-11-1.png", "/use/57/house-12-2.png"]}
</code>```

So when the user uploads a file and click on save this code happens:

```<code>    $path = $this->processImage($request, $user->id, $house->id);
    /* uploads the image to the server and pass path of the image*/
    if ($path) {
        $jsonstring = $house->images;
        dd($jsonstring);
        $arr = json_decode($jsonstring);
        $arr['images'] = [$path];
        $json = json_encode($arr);
        dd($json);
        $house->images = $json;
        $house->save();
    }
</code>```

The laravel model that is used is called userHouse and saves images as:

```<code>class userHouse extends Model implements Changeable
{
    protected $casts = [
        'images' => 'array',
    ];
...
}
</code>```

processImage function:

```<code>private function processImage($request, $userID, $houseId)
{
    $path = null;
    $number = rand(1, 99);
    if ($request->hasFile('image')) {
        $image = Image::make($request->file('image'))
            ->resize(750, null, function ($constraint) {
                $constraint->aspectRatio();
            })
            ->encode('png');
        $path = "/vendors/{$userID}/horse-{$houseId}-{$number}.png";
        Storage::disk('fileadmin')->put($path, $image->encoded);
    }

    return $path;
}
</code>```

the error I get is:

```<code>[2019-05-27 08:01:15] local.ERROR: Serialization of 'Illuminate\Http\UploadedFile' is not allowed {"userId":57,"email":"info@test.com","exception":"[object] (Exception(code: 0): Serialization of 'Illuminate\\Http\\UploadedFile' is not allowed at /Users/dsfsdf/ah-website/user/laravel/framework/src/Illuminate/Session/Store.php:128)
[stacktrace]
</code>```

How can I add the url to the JSON string in the database? Uploading single images works.

答:
What I could think of is that the processImage method cannot handle multiple uploaded files in the request.

Also, IMO, this method should actually receive the UploadedFile object instead of the entire request.

So, the code would be similar to:

```<code>$images = $house->images;

foreach ($request->images as $uploadedFile) {
    $images[] = $this->processImage($uploadedFile, $user->id, $house->id);
}

$house->images = $images;
$house->save();
</code>```

Also, if you defined the images attribute as array in the model, there is no need to decode/encode it as laravel already does it.

Body:
I need to save multiple pictures with Laravel. The pictures are stored separately on disk and the links to the places are stored in a JSON file in the database. So each users has an column in the database with:

{"images": ["/user/57/house-11-1.png", "/use/57/house-12-2.png"]}

So when the user uploads a file and click on save this code happens:

    $path = $this->processImage($request, $user->id, $house->id);
    /* uploads the image to the server and pass path of the image*/
    if ($path) {
        $jsonstring = $house->images;
        dd($jsonstring);
        $arr = json_decode($jsonstring);
        $arr['images'] = [$path];
        $json = json_encode($arr);
        dd($json);
        $house->images = $json;
        $house->save();
    }

The laravel model that is used is called userHouse and saves images as:

class userHouse extends Model implements Changeable
{
    protected $casts = [
        'images' => 'array',
    ];
...
}

processImage function:

private function processImage($request, $userID, $houseId)
{
    $path = null;
    $number = rand(1, 99);
    if ($request->hasFile('image')) {
        $image = Image::make($request->file('image'))
            ->resize(750, null, function ($constraint) {
                $constraint->aspectRatio();
            })
            ->encode('png');
        $path = "/vendors/{$userID}/horse-{$houseId}-{$number}.png";
        Storage::disk('fileadmin')->put($path, $image->encoded);
    }

    return $path;
}

the error I get is:

[2019-05-27 08:01:15] local.ERROR: Serialization of 'Illuminate\Http\UploadedFile' is not allowed {"userId":57,"email":"info@test.com","exception":"[object] (Exception(code: 0): Serialization of 'Illuminate\\Http\\UploadedFile' is not allowed at /Users/dsfsdf/ah-website/user/laravel/framework/src/Illuminate/Session/Store.php:128)
[stacktrace]

How can I add the url to the JSON string in the database? Uploading single images works.

Body:
What I could think of is that the processImage method cannot handle multiple uploaded files in the request.

Also, IMO, this method should actually receive the UploadedFile object instead of the entire request.

So, the code would be similar to:

$images = $house->images;

foreach ($request->images as $uploadedFile) {
    $images[] = $this->processImage($uploadedFile, $user->id, $house->id);
}

$house->images = $images;
$house->save();

Also, if you defined the images attribute as array in the model, there is no need to decode/encode it as laravel already does it.