Angular Servicios – Stack Overflow en español

Como puedo declarar parámetros en un servicio de Angular, si dichos parámetros son opcionales en el WebService.
Mi WebService tiene 4 parámetros opcionales, le estoy enviando hasta el momento dos, pero me he encontrado los siguientes inconvenientes:

1- return this.http.get(call,{headers:headers,params:{‘storeId’:storeId,’promoId’:promoId}}); (
Me retorna la información filtrando por los dos parámetros.

2- return this.http.get(call,{headers:headers,params:{‘storeId’:storeId}}); (me envía mensaje de error, ya que solo hay un parámetro declarado al momento del llamado).

Si son opcionales, porque se comporta de ésta manera, si alguien puede indicarme por favor, la manera de enviar éstos parámetros, hay una mejor manera de validar cuando los parámetros del webservice son opcionales.
Gracias de antemano a los que pueden ayudarme,

Game in react native – Stack Overflow

When I would use react native to create a simple game, e.g. chess, how would I build the ui?

In my first tests I could draw squares and “figures” that I can drag. But there are some questions, I don’t know how to tackle.

  • zoom-in and pan the game board. It looks like ScrollView can only be used either vertically or horizontally. I would need both.
  • zoom: would I do a lot of math, I mean, recalculating all the sizes of squares and figures and distances, when the size of the screen changes? Or could I draw everything into an kind of image and afterwards show that image in the propriate size? How does that stuff work?
  • figures are dragged onto squares of the gameboard. Then the logik needs to check, if the move was valid. How to track, on which square a figure was moved? I can imagine to calculate this based on the positions. Or perhaps a square could get a “droplistener”, so that there is an event, when and how exactly the figure was moved?

php – Localhost/XAMPP – Stack Overflow em Português

Boa noite,

Estou começando a estudar PHP e me deparei com o seguinte problema:
Na hora de acessar meu localhost para ver os documentos criados, isso não acontece, como na foto abaixo:
inserir a descrição da imagem aqui

A pasta do meu projeto foi criada no seguinte diretório: C:xampphtdocscursophp.com e dentro dela havia um arquivo .html e outro .php. Sendo que ambos deveriam aparecer.
Gostaria que me mostrassem como resolver esse problema. Obrigado!

data – Grafana development – Stack Overflow em Português

Anybody here have any idea how to use eChart to build a grafana plugin for data visulizations? I’ve imported echarts-for-react but I’m having trouble on showing the graphic on the panel.

Ps.:
Grafana 7.x panels are ReactJS components.

Thank you all!

React Native Redux issue – Stack Overflow

I am having an issue with adding favourite functionality for e-commerce app. Getting error of undefined.enter image description here

    case TOGGLE_FAVOURITE:
 
        const exitsIndex = state.favouriteProducts.findIndex((meal) => meal.id === action.productId);
        if(exitsIndex >= 0) {
            return { ...state, favouriteProducts: state.favouriteProducts.filter((meal) => meal.id !== action.productId) }
        } else {
            const favMeal = state.availableProducts.find((meal) => meal.id === action.productId);
            return { ...state, favouriteProducts: state.favouriteProducts.concat(favMeal) };
        }
 
 
This is my action:
export const toggleFavourite = id => {
    return { type: TOGGLE_FAVOURITE, productId: id };
};
 
And this is my call function: 
 const toggleFavouriteHandler = useCallback(() => {
        dispatch(toggleFavourite(productId));
      }, (dispatch, productId));

index.html cached using webpack – Stack Overflow

I am stuck using webpack, it seems to cache my index.html file and I tried to google for the solution. But it seems more people have this problem but no real solutions.
The only solution is to use meta tags in html to have no cache at all like this :

<meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate">
<meta http-equiv="Pragma" content="no-cache">
<meta http-equiv="Expires" content="0">

But I have a PWA so I need cache to let it work offline. Only when the user is online it should check for updates. For the rest of the website, webpack has solutions to use hashes but not for the index.html file or I am missing something ??

This is my webpack configuration :

const webpack = require('webpack');
const { resolve } = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const webpackMerge = require('webpack-merge');
const CopyWebpackPlugin = require('copy-webpack-plugin');
const CleanWebpackPlugin = require('clean-webpack-plugin');

const modeConfig = env => require(`./build-utils/webpack.${env.mode}.js`)(env);
const loadPresets = require('./build-utils/loadPresets');
var path = require('path');

const webcomponentsjs = './node_modules/@webcomponents/webcomponentsjs';

const polyfills = (
  {
    from: resolve(`${webcomponentsjs}/webcomponents-*.{js,map}`),
    to: 'vendor',
    flatten: true
  },
  {
    from: resolve(`${webcomponentsjs}/bundles/*.{js,map}`),
    to: 'vendor/bundles',
    flatten: true
  },
  {
    from: resolve(`${webcomponentsjs}/custom-elements-es5-adapter.js`),
    to: 'vendor',
    flatten: true
  }
);

const assets = (
  {
    from: 'src/img',
    to: 'img/'
  },
  'src/manifest.webmanifest'
);

const plugins = (
  new CleanWebpackPlugin(('dist')),
  new webpack.ProgressPlugin(),
  new HtmlWebpackPlugin({
    filename: 'index.html',
    template: './src/index.html',
    minify: {
      collapseWhitespace: true,
      minifyCSS: true,
      minifyJS: true
    }
  }),
  new CopyWebpackPlugin((...polyfills, ...assets), {
    ignore: ('.DS_Store')
  })
);

module.exports = ({ mode, presets }) => {
  return webpackMerge(
    {
      mode,
      entry: './src/index.ts',
      devtool: 'inline-source-map',
      module: {
        rules: (
          {
             test: /.ts|.jsx$/,
      //      use: 'ts-loader',
            loader: 'ts-loader',
            exclude: /node_modules/,           
          }

        )
      },
      resolve: {
          extensions: ( '.tsx', '.ts', '.js' ),
      },
      output: {
          filename: 'bundle.js',
          path: path.resolve(__dirname,'dist'),
      },
      plugins
    },
    modeConfig({ mode, presets }),
    loadPresets({ mode, presets })
  );
};

I also tried to use :

output: {
          filename: '(name).(contenthash).js',
          path: path.resolve(__dirname,'dist'),
      },

but that still does not change the index.html file, only the rest.

Implementaciones algoritmos RCPSP – Stack Overflow en español

Alguien sabe de donde puedo encontrar implementaciones de algoritmos genéticos con respecto al RCPSP (Problema de secuenciación de actividades con recursos restringidos)?

Porque los he buscado y no he encontrado. El problema es que debo evaluar su rendimiento y con los seudocódigos me pierdo un poco, por eso busco una implementación ya hecha para hacerme una idea de como aplicar dichos seudocódigos.

Gracias de antemano

Live search utilizando React-Redux – Stack Overflow em Português

Olá, estou tentando criar um live search com o Redux, porém ele somente da o match com a palavra completa. Qual é o melhor método de realmente retornar para a minha tabela, nesse caso, somente os valores que a string em pesquisar contém?

Table

  const brandsList = useSelector(state => state.brands.brandList);
            <TableBody>
                {brandsList.slice(0, rowsPerPage).map((brand, i) => (
                  <TableRow className={classes.tableRow} hover key={i}>
                    <TableCell>
                      <Typography variant="body1">{brand.name}</Typography>
                    </TableCell>
                    <TableCell>
                      <Typography variant="body1">{brand.CNPJ}</Typography>
                    </TableCell>
                    <TableCell>
                      <Typography variant="body1">{brand.email}</Typography>
                    </TableCell>
                    <TableCell>
                      <Typography variant="body1">{brand.address}</Typography>
                    </TableCell>
                    <TableCell>
                      <Link to={`/brand/${brand.id}`}>
                        <IconButton aria-label="edit">
                          <EditIcon />
                        </IconButton>
                      </Link>
                    </TableCell>
                  </TableRow>
                ))}
              </TableBody>```

Reducer

case fromTypes.SEARCHING_BRANDS:
      const {value} = action;
      const works = state.brandList.filter(item => item.name === value);
      return {
        ...state, value, works
      }

Formulário em Etapas – Stack Overflow em Português

Galera, eu quero criar um formulário pra o Briefing no meu site, deixar ele personalizado para mandar pra meus clientes no estilo do Typeform, podem dar algum norte pra que eu possa desenvolver?
Desde já agradeço!