text:
Q: Is it possible to use ExecuteReader() twice? I'm programming a database manager for a gameserver called OTServer, and I'm having problems using executereader() the second time. Here's code:
    private void button1_Click(object sender, EventArgs e)
    {
        Form1 f = new Form1();
        MySqlConnection conn = new MySqlConnection();
        conn.ConnectionString = "Server=" + f.GetText1().Text + ";Username=" + f.GetText2().Text + ";Pwd=" + f.GetText3().Text + ";Database=" + f.GetText4().Text + ";";
        conn.Open();
        MySqlCommand cmd = new MySqlCommand("SELECT * FROM `players` WHERE name = @Name", conn);
        cmd.Parameters.AddWithValue("@Name", textBox1.Text);

        MySqlDataReader Reader = cmd.ExecuteReader(CommandBehavior.SingleRow);
        while (Reader.Read())
        {
            label7.Text = (string)Reader[1];
            label7.Show();
            label8.Text = Reader[5].ToString();
            label8.Show();
            if ((int)Reader[6] == 1)
            {
                label9.Text = "Sorcerer (1)";
            }
            if ((int)Reader[6] == 2)
            {
                label9.Text = "Druid (2)";
            }
            if ((int)Reader[6] == 3)
            {
                label9.Text = "Paladin (3)";
            }
            if ((int)Reader[6] == 4)
            {
                label9.Text = "Knight (4)";
            }

            if ((int)Reader[6] == 0)
            {
                label9.Text = "None (0)";
            }
            label9.Show();

            if ((int)Reader[3] == 1)
            {
                label10.Text = "Player";
            }

            if ((int)Reader[3] == 2)
            {
                label10.Text = "Tutor";
            }

            if ((int)Reader[3] == 3)
            {
                label10.Text = "Senior Tutor";
            }

            if ((int)Reader[3] == 4)
            {
                label10.Text = "Gamemaster";
            }

            if ((int)Reader[3] == 5)
            {
                label10.Text = "Community Manager";
            }

            if ((int)Reader[3] == 6)
            {
                label10.Text = "God";
            }

            if ((int)Reader[3] < 1 || (int)Reader[3] > 6)
            {
                label10.Text = "Unknown";
            }

            label10.Show();

            label13.Text = "Account: " + Reader[4].ToString();
            label13.Show();
        }
        Reader.Close();

        cmd = new MySqlCommand("SELECT * FROM accounts WHERE id = @Account_ID", conn);
        cmd.Parameters.AddWithValue("@Account_ID", label13.Text);
        Reader = cmd.ExecuteReader(CommandBehavior.SingleRow);

        while (Reader.Read())
        {
            label11.Text = (string)Reader[0];
            label11.Show();
        }
        Reader.Close();
    }

A: Suggested solution: Try putting a using block around your DataReader, or call Dispose on it:
using (DataReader Reader = cmd.ExecuteReader(CommandBehavior.SingleRow))
{
    // ...do something with your data reader... then finish by:
    Reader.Close();
}  // <-- Reader.Dispose() called automatically at the end of using block.

// ...prepare second command...

// the same again for the second command:
using (DataReader Reader = cmd.ExecuteReader(CommandBehavior.SingleRow))
{
    // ...
    Reader.Close();
}

Assumed cause of your problem: The DB connection object may do some internal book-keeping to keep track of data readers. I've found out in a similar scenario that you're only allowed one DataReader at a time. So I believe the problem with your code is that, while you Close the Reader, you haven't explicitly Disposed it, so the connection object thinks the first data reader is still in use when you execute the second one.

Besides... why not simplify this code:
        if ((int)Reader[6] == 1)
        {
            label9.Text = "Sorcerer (1)";
        }
        if ((int)Reader[6] == 2)
        {
            label9.Text = "Druid (2)";
        }
        ...

to a switch statement?:
        int x = (int)(Reader[6]);
        string label9Text = string.Empty;

        switch (x)
        {
            case 1:  label9Text = "Sorcerer (1)";  break;
            case 2:  label9Text = "Druid (2)";     break;
            ...
        }

        label9.Text = label9Text;

(That would save you quite a bit of repetitive typing.)

A: Well, assuming that your code is correct you shouldn't have problem in executing two readers as you show in your code. Maybe you have problems because of not disposing commands or something else. I recommend an approach like this (Example made with Northwind db):
using (SqlConnection connection = new SqlConnection("Data Source=.\\SQLEXPRESS;Initial Catalog=Northwind;Integrated Security=SSPI;"))
        {
            connection.Open();

            using (SqlCommand command = new SqlCommand("SELECT * FROM Orders", connection))
            {
                using (SqlDataReader reader = command.ExecuteReader(System.Data.CommandBehavior.SingleRow))
                {
                    while (reader.Read())
                    {
                        Console.WriteLine(reader.GetString(2));
                    }
                }
            }

            using (SqlCommand command = new SqlCommand("SELECT * FROM Products", connection))
            {
                using (SqlDataReader reader = command.ExecuteReader(System.Data.CommandBehavior.SingleRow))
                {
                    while (reader.Read())
                    {
                        Console.WriteLine(reader.GetString(1));
                    }
                }
            }
        }

You should clean your code when recognizing the type of player. Create an enum instead:
public enum PlayerType
{
    None = 0,
    Sorcerer = 1,
    Druid = 2,
    Paladin = 3
}

And then do the following while reading:
PlayerType playerType = (PlayerType)reader.GetInt32(6);
label9.Text = playerType.ToString();


text:
Q: Wrap provider in main Any help
I have an error on the
wrapping provider on the main.
the error is on the :
create: (context) => LocaleProvider(),

this is my code :
  import 'dart:js';

import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import 'package:trying_localisations_app/provider/locale_provider.dart';
import 'support_locale.dart';

ChangeNotifierProvider(
create: (context) => LocaleProvider(),
  builder: (context, child) {
    return Consumer<LocaleProvider>(
      builder: (context, provider, child) {
        return MaterialApp(
          title: 'Flutter Demo',
          localizationsDelegates: const [
            AppLocalizations.delegate,
            GlobalMaterialLocalizations.delegate,
            GlobalWidgetsLocalizations.delegate,
            GlobalCupertinoLocalizations.delegate
          ],
          locale: provider.locale,
          supportedLocales: L10n.support,
          debugShowCheckedModeBanner: false,
          theme: ThemeData(
            primarySwatch: Colors.blue,
            fontFamily: GoogleFonts.poppins().fontFamily),
            builder: LoadingScreen.init(),
            routes: {
              HomePage.page: (_) => const HomePage()
            }
          );
        }
      );
    }
  )

PS : i follow https://medium.com/@echolaojue/how-to-make-l10n-with-flutter-fd61e21e61d8

A: It should be
create: (context) => LocaleProvider(),

redpajama_set_name: RedPajamaStackExchange


text:
Q: Adding a physical ethernet interface to kvm qemu bridge I'm following this excellent article to use bridged networking with libvirt and KVM, however there are some fundamental knowledge I'm lacking for me to fully understand/follow it.
The article says,

*

*No physical interfaces should ever be added to the virbr0 bridge, since it uses NAT to provide connectivity.

*Virtual interfaces will be added to the bridge when we create and launch virtual machines.

and most importantly,

*

*you can't use your main ethernet interface when adding physical ethernet interface to the bridge.

*thus we have to use an additional interface.

I'm not too sure about the relations between physical interfaces, virtual interfaces, main interface and additional interface, thus when the article says he is using an additional interface, enp0s29u1u1, an interface provided by an ethernet to usb adapter. I'm totally lost what additional interface I should be using for my case, which is a vanilla Debian, with a single ethernet card.
Please help.

A: A "physical interface" refers to an actual network device on your computer -- that is, something into which you can plug an ethernet cable, or a wireless network device.
A "virtual interface" refers to network interfaces that aren't associated with a specific physical device: so, vlan interfaces, bridges, tun/tap interfaces, etc.
Your "main interface" is the network interface with which you system's primary ip address (and default route) is associated.
An "additional interface", in this context, is any physical interface other than your main interface.

These two statements...

*

*No physical interfaces should ever be added to the virbr0 bridge, since it uses NAT to provide connectivity.

*Virtual interfaces will be added to the bridge when we create and launch virtual machines.

...are correct. The virbr0 bridge is associated with the libvirt "default" network and uses NAT to connect virtual machines to the outside world; you would not want to add a physical interface to this bridge.
Libvirt creates tun/tap devices when you launch virtual machines and adds them to the bridge.
However, the following statement...

*

*You can't use your main ethernet interface when adding physical ethernet interface to the bridge.

...is a bit of a simplification. You can use your main ethernet interface as part of a bridge, but the procedure is a little more complicated than when using a secondary interface (and is a great way to accidentally disable your internet connectivity).  Broadly, you need to:

*

*Create a bridge device

*Add your ethernet interface to the bridge

*Configure the bridge device with the ip address that was previously associated with your main interface

For example, on my system, eth0 looks like this:
# ip addr show eth0
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
    link/ether 52:54:00:9b:a0:2a brd ff:ff:ff:ff:ff:ff
    altname enp1s0
    inet 192.168.122.64/24 brd 192.168.122.255 scope global dynamic noprefixroute eth0
       valid_lft 3570sec preferred_lft 3570sec
    inet6 fe80::d6:992e:d74a:c05a/64 scope link noprefixroute
       valid_lft forever preferred_lft forever

That's the only physical interface on my system. We're also going to need to know our default route:
# ip route
default via 192.168.122.1 dev eth0 proto dhcp metric 100
192.168.122.0/24 dev eth0 proto kernel scope link src 192.168.122.64 metric 100

To add eth0 to a bridge, I would first create a bridge device:
# ip link add br-example type bridge

Then add eth0 to the bridge and remove any existing addresses from eth0:
# ip link set eth0 master br-example
# ip addr flush eth0

Add the address that used to be on eth0 to br-example and restore the default route:
# ip addr add 192.168.122.64/24 dev br-example
# ip link set br-example up
# ip route add default via 192.168.122.1

At this point (a) I have a bridge br-example, (b) eth0 is a member of this bridge, and (c) I still have connectivity (via the brdige) out eth0. Following the instructions in your linked article, I could create a libvirt network associated with br-example and start attaching virtual machines to it; from a network perspective, these machines would look like any other device physically attached to the local network.
Of course, the above procedure doesn't result in persistent changes; how do that differs by distribution and the article to which you've linked provides a good overview of the process.


text:
Q: Still possible to put configuration of entity type in an external class or function, with EF7? I'm using Entity Framework 7 and am configuring my entities, within the DbContext's OnModelCreating override. Back in EF6, each entity's configuration could exist in an external class and then applied using modelBuilder.Configurations.Add(). Does something like this exist yet in EF7, or do all model configurations have to be applied within that single OnModelCreating function?

A: Nope, the api you mentioned is not yet present in EF 7...But who actually needs it in the era of extention methods anyway?
modelBuilder.Entity<MyEntity>(entity => entity.Map());

Mapping class:
public static class EntityBuilderHelper
{
    public static void Map(this EntityTypeBuilder<MyEntity> entity)
    {
        entity.ForSqlServerToTable("MyEntityTable");
        entity.Property(e => e.Id)
            .HasColumnName("MyEntityTableId");
    }
}


text:
Q: Get active adapter in C# I used the following code to get the active network card of the system.
My problem is that the active network card of my system is Wi-Fi, but the system detects Local Area Connection!
While this network card does not exist!
I tried this :
var activeAdapter = networks.First(x => x.NetworkInterfaceType != NetworkInterfaceType.Loopback
                                && x.NetworkInterfaceType != NetworkInterfaceType.Tunnel
                                && x.OperationalStatus == OperationalStatus.Up
                                && x.Name.StartsWith("Ethernet") || x.Name.StartsWith("Wi-Fi") || x.Name.StartsWith("Local") == true );
label2.Text = activeAdapter.Name;

A: precedence of logical operators
      && x.Name.StartsWith("Ethernet") || x.Name.StartsWith("Wi-Fi") || x.Name.StartsWith("Local") == true );

shoudl be
     && (x.Name.StartsWith("Ethernet") || x.Name.StartsWith("Wi-Fi") || x.Name.StartsWith("Local") == true ));


text:
Q: Triple integral in which height is less than r I've been assigned to evaluate through cylindrical coordinates
$$\iiint_E{z}\;{dV}$$
in which $E$ is in
$$0\le z\le x^2+y^2\le9$$
I approached the problem by trying to set the limits of integration as
$$\int_0^{2\pi}\int_\sqrt{z}^3\int_0^{r^2}z\,r\;dz\,dr\,d\theta$$
however, once you do the interior integral, you're left with
$$\int_0^{2\pi}\int_\sqrt{z}^3\frac{r^5}{2}\;dr\,d\theta$$
which does not let you get a numerical answer
If I plot the inequality in mathematica I get an open cylinder esque shape with a hole in the bottom which disappears as I plot more points, so the inequality doesn't exist at $0$?
If I had to take a wild stab at it I suppose $\sqrt{z}$ could be replaced with zero as $z$ does approach it which would give me $\frac{243\pi}{2}$. Any help would be appreciated

A: You are correct.  The lower limit of the second integral should be 0 in place of $\sqrt z$.  You have already accounted for the fact that z is always $<r^2$ in the inner integral, so the middle integral would go from 0 to 3.


text:
Q: writing a function sumVector : not returning a value I am practicing with functions on the vector class. i have written a function 'sumVector' to add up all elements of vector 'ages', but it is not returning the total
i am copying my code block; i know the STL provides a sum function but this is for my own practice. i would appreciate if someone would point out what i am doing wrong
    #include <vector>
    #include <fstream>
    #include <sstream>
    #include <iostream>
    #include <iterator>
    #include <algorithm>
    using namespace std;
    template<typename T>
    int sumVector(const vector<T> &integers2)
    {
         typename vector<T>::const_iterator constIterator;
         //display vector elements using constIterator
         for

         (constIterator=integers2.begin();
         constIterator!=integers2.end();++constIterator);
         int sum=0;
         sum+=*constIterator;
         return sum;
         cout<<sum;
    }

    int main ()
    {
    vector<int> ages;
    vector<float>var;
    ifstream inFile;
    inFile.open("data.txt");
    if(!inFile)
    {
        cout<<"didn't work";
        cin.get();
        exit (1);
    }

    string line;
    getline(inFile, line);
    istringstream in(line);
    copy(std::istream_iterator<int>(in),
      std::istream_iterator<int>(),
      std::back_inserter(ages));
    cout<<ages.at(2)<<endl;
    getline(inFile, line);
    istringstream gin(line);
    copy(istream_iterator<float>(gin),
                                     istream_iterator<float>(),
                                     back_inserter(var));
    cout<<var.at(0)<<endl;
    cout<<"whats the sum";
    sumVector (ages);

    cin.get();

    inFile.close();
    cin.get();

    }

A: The for loop is incorrect and the cout << sum occurs after the return from sumVector(). The return type (and type of sum) should also be T otherwise sumVector() is restricted to vectors of elements of int (or types convertible to ints).
Something like the following I think is what your looking for:
template<typename T>
T sumVector(const vector<T> &integers2)
{
    typename vector<T>::const_iterator constIterator;
    T sum=0;
    //display vector elements using constIterator
    for (constIterator=integers2.begin();
         constIterator!=integers2.end();
         ++constIterator)
    {
        sum+=*constIterator;
    }

    cout<<sum;
    return sum;
}

Consider not printing the value of sum within sumVector() as (IMO) this is clearer:
cout << "whats the sum: " << sumVector(ages);

It may also be required to store the result of sumVector() in a variable and not write anything to standard output at the point the sum is calculated.

A: The ";" after the for is wrong - the way you write it, the semicolon would be the body of the for loop.
I didn't touch your naming (e.g. integers2 is a little irriating).
template<typename T>
int sumVector(const vector<T> &integers2)
{
     int sum=0;
     typename vector<T>::const_iterator constIterator;
     //display vector elements using constIterator
     for (constIterator=integers2.begin();constIterator!=integers2.end();++constIterator) {

         sum+=*constIterator;
     }
     cout<<sum;
     return sum;
}

I also reordered

*

*the print and the return of the sum, because the return end's the execution of the function.

*the initialization of i=0 also must be done, before the loop.


text:
Q: Element implicitly has an 'any' type because expression of type This is the full error I get when I hover on data[command] in limit-entries.ts

(parameter) data: dataProps Element implicitly has an 'any' type
  because expression of type '"hourly"' can't be used to index type
  'dataProps'.   Property 'hourly' does not exist on type 'dataProps'

darkSkyApiTypes.ts
interface dataProps {
  data: {
    latitude: number
    longitude: number
    timezone: string
    currently?: {
      time: number
      summary: string
      temperature: number
      humidity: number
    }
    hourly?: {
      summary: string
      icon?: string
      data: {
        time: number
        temperature: number
        humidity: number
      }[]
    }
    daily?: {
      summary: string
      icon?: string
      data: {
        time: number
        temperatureMin: number
        temperatureMax: number
        humidity: number
      }[]
    }
  }
}

export = dataProps

limit-entries.ts
import { hourlyLimit } from '../config'
import dataProps from '../API/darkSkyAPITypes'

const limitEntries = (data: dataProps, command: string) => {
  let entries

  switch (command) {
    case 'currently':
      entries = data[command]
      break
    case 'hourly':
      entries = data[command].data.slice(0, hourlyLimit)
      break
    case 'daily':
      entries = data[command].data
      break
    default:
      entries = data[command]
  }

  return entries
}

module.exports = limitEntries

I get the error in title. Help!

A: dataProps defines an object type with a single top-level property called data. Your data variable is of type dataProps, so you'd need data.data to refer to that property. So where you have data[command], you should have data.data[command]. (Or change the definition of dataProps.)


text:
Q: Add X amount of rows autofill data I'm trying to adds rows of data by autofilling from previously available data.
For example:
In column A, starting from A1, there is a title 'Charge 1', and then in A2, 'Discharge 1', and in A3, 'Charge 2', etc.
I would like to add a predefined number of cycles (one 'Charge' and one 'Discharge' + 1 more 'Charge') to column A that follows this series.
So if data in column A ends at Discharge 5, then add 5 cycles to fill this data down until Charge 11.

A: edited after OP's clarification
Try this code:
Option Explicit

Sub Cycles()
    Dim cycleStrng1 As String, cycleStrng2 As String
    Dim lastCycle As Long, rowOffset As Long

    With Worksheets("Cycles").Range("A1") ' <--| change "Cycles" to your actual worksheet name
        cycleStrng1 = GetStringAtLeft(.Value)
        cycleStrng2 = GetStringAtLeft(.Offset(1).Value)
        With .End(xlDown)
            lastCycle = GetNumberAtRight(.Value)
            If GetStringAtLeft(.Value) = cycleStrng2 Then rowOffset = 1
            .Offset(rowOffset).Resize(2 * lastCycle) = Application.Transpose(FillCycles(lastCycle, cycleStrng1, cycleStrng2))
        End With
    End With
End Sub

Function GetNumberAtRight(strng As String) As Long
    GetNumberAtRight = CLng(Right(strng, Len(strng) - InStrRev(strng, " ")))
End Function

Function GetStringAtLeft(strng As String) As String
    GetStringAtLeft = Left(strng, InStrRev(strng, " "))
End Function

Function FillCycles(lastCycle As Long, cycleStrng1 As String, cycleStrng2 As String) As Variant
    Dim iCycle As Long
    Dim strng As String

    For iCycle = lastCycle To 2 * lastCycle
        strng = strng & cycleStrng1 & iCycle & "|"
        strng = strng & cycleStrng2 & iCycle & "|"
    Next iCycle
    FillCycles = Split(Left(strng, Len(strng) - 1), "|")
End Function


text:
Q: Build a regression model with multiple small time series For a personal project, I've built a dataset of hockey players' statistics over the time. I am looking for insights as to how I should model my predictive model (lol). The model would be used to predict how much points a player would be expected to produce with regards to his previous performances.
To keep it simple, let's keep only the three most "important" columns for my dataset (there is a little more features than that but I don't think they are necessary for the problem) :
PlayerId | Points | Year
Now, I have tried to use the machine learning algorithms I know but :

*

*The data behaves kind of like a time series. Let's say I have 10k players, well those players have stats over the years (sometimes from season 2005 to 2017, others from 2009-2010, well you get the point). Considering this relation between rows (For example playerId 1, Year 2005 and playerId 1, Year 2006), I can't use most of the algorithms I know because this logic would be thrown out the window and I think it's an important one.

*Considering the data is related over time for some rows, I don't think I can really model it as an unique time series. There are small time series into the dataset, per players, but I certainly don't have enough data to treat it like such (With one row per player per year, at max I'd have 15 rows maybe for a player, which isn't enough to build a good prediction).
Considering these two points, I'm pretty much stuck without a solution.
I've thought about merging all the rows in one, so I'd have :
PlayerId | Points2005 | Points2006 | etc.. but it doesn't make much sense since we loose the notion of time.
I also considered that I could make a predictive model for all the players individually then use the weights I'd find to make another predictive model, but I'm very unsure as to how this would turn out.
I'm just looking for a small tip to push me in the right direction, whether it's pure statistics related or a machine learning algorithm.

A: I'd consider a mixed model with an effect of time-in-career (maybe an additive/smooth term to allow for nonlinear effects) and a random effect of (time-in-career|player), which allows for variation in the pattern for different players. That doesn't explicitly consider number of points in the previous year, but it seems like a reasonable start, and handles the temporal aspect and the grouping of data within players.
this example model of rat growth curves is somewhat different from your example (focus on inference about treatments rather than prediction of individuals; small number of subjects, large number of points per subject relative to your data) but suggests that
mgcv::gam(points~careertime+s(careertime)+
    s(careertime,player,bs='fs'),
    data=dd, method="REML")

would be a plausible first model. You might want to add s(year,bs="re") to include a random effect of calendar year, and I'd encourage you to use any other covariate/grouping information you have (team, age, ...)


text:
Q: NGXS state redirect user after login Hi i am new in NGXS state management..in my project i have different type of users so i am trying after login redirect my user to his home page depend on user type and i have auth guard check if this user has role's name to let him go.(userType is the role's name)
For login i'm using login function in my state to get the token after login and update my token from null to exist token and insert it in local storage and this step **is working very well**
and i created a new function in auth state named it GetCurrentUser to get user data through sending his token..and the data comes well and put it in the state
Finally..

*

*how can get the userType that comes from GetCurrentUser function in my AuthState and give it to service to check what his type to redirect him to his home page

*how can i give this userType to auth guard to check the user if has the role to go to home page

this is my AuthState class

import { State, Selector, Action, StateContext } from '@ngxs/store';
import { Loggin , Loggout, GetCurrentUser } from '../../_actions/auth/auth.action';
import { tap } from 'rxjs/operators';
import { AuthService } from '../../_services/auth/auth.service';
import { User } from '../../_models/user';
import { of } from 'rxjs';
import { Injectable } from '@angular/core';
import { Router } from '@angular/router';

export class AuthStateModel {
  token: string;
  user: User;
}

@State<AuthStateModel>({
  name: 'auth',
  defaults: {
      token : null,
      user:{
        email:'',
        userName:'',
        userType:'',
        firstName:'',
        lastName:''
      }
  }
})

@Injectable()
export class AuthState {

  @Selector()
  static getToken(state: AuthStateModel) {
      return state.token;
  }

  @Selector()
  static isAuthenticated(state: AuthStateModel): boolean {
    return !!state.token;
  }

  @Selector()
  static currentUser(state: AuthStateModel): User {
    return state.user
  }

  @Selector()
  static getUserType(state: AuthStateModel): string {
    return state.user.userType
  }

  constructor(private authService: AuthService, private router:Router){}

  @Action(Loggin)
  login(ctx: StateContext<AuthStateModel>, { payload }: Loggin) {
    return this.authService.Login(payload).pipe(tap(x => {
      const state = ctx.getState();
      ctx.patchState({
        ...state,
        token: x.token,
    });
    }))
  }

  @Action(GetCurrentUser)
  getcurrentUser(ctx: StateContext<AuthStateModel>) {
    return this.authService.getCurrentUser().pipe(tap((x:User) => {
      ctx.patchState({
        user:{
          email: x.email,
          userType: x.userType,
          userName: x.userName,
          firstName: x.firstName,
          lastName: x.lastName
        }
      });
    }))
  }

  @Action(Loggout)
  logout(ctx: StateContext<AuthStateModel>) {
    this.router.navigate(['auth2/login']);
    localStorage.removeItem('auth.token');
    ctx.setState({
      token: null,
      user:{
        email: null,
        userType: null,
        userName: null,
        firstName: null,
        lastName: null
      }
  });
  }
}

this is my login function in login component

login(){
if (this.loginForm.valid) {
  this.prepairLoginModel();
  this.store.dispatch(new Loggin(this.loginModel))
 }
}

this is my auth guard

import { Injectable } from '@angular/core';
import { CanActivate, ActivatedRouteSnapshot, RouterStateSnapshot, UrlTree, Router } from '@angular/router';
import { Observable, from } from 'rxjs';
import { AuthService } from '../_services/auth/auth.service';
import { Store } from '@ngxs/store';
import { AuthState } from '../_states/auth/auth.state';
import { Location } from '@angular/common';
import { GetCurrentUser } from '../_actions/auth/auth.action';

@Injectable({
  providedIn: 'root'
})
export class AuthGuard implements CanActivate {
  constructor(
    private authServic:AuthService,
    private router: Router,
    private store:Store,
    private location: Location
    ){}
  canActivate(
    next: ActivatedRouteSnapshot,
    state: RouterStateSnapshot): Observable<boolean | UrlTree> | Promise<boolean | UrlTree> | boolean | UrlTree {
      const isAuthenticated = this.store.selectSnapshot(AuthState.isAuthenticated);
      const userType = this.store.selectSnapshot(AuthState.getUserType);

      if(!isAuthenticated){
        return  from(this.router.navigate(['auth2']));
      }

      return true
  }

}

this is my from my app-routing.modules

 {
    path: 'company',
    data:{permittedRoles:'Company'},
    loadChildren: () => import('./views/users/company/company.module').then(m => m.CompanyModule)
  },

  {
    path: 'agent',
    data:{permittedRoles:'Agent'},
     loadChildren: () => import('./views/users/agent/agent.module').then(m => m.AgentModule)
  },

A: I had same task before and here is my solution for this issue ,
my action is as following
export namespace Auth {
  export class Login {
    static readonly type = '[Auth] Login';
    constructor(public payload: { username: string; password: string }) { }
  }

  export class Logout {
    static readonly type = '[Auth] Logout';
  }

  export class CheckSession {
    static type = '[Auth] CheckSession';
  }
  export class LogoutSuccess {
    static type = '[Auth] LogoutSuccess';
  }

  // Events
  export class LoginRedirect {
    static type = '[Auth] LoginRedirect';
  }

  export class LoginSuccess {
    static type = '[Auth] LoginSuccess';
    constructor(public jwt: JsonWebToken) { }
  }
  export class LoginFailed {
    static type = '[Auth] LoginFailed';
    constructor(public error: any) { }
  }
}

and corresponding state is as following
@State<AuthStateModel>({
  name: 'auth',
  defaults: {
    token: null,
    refreshToken: null,
    username: '',
    userId: '',
    isSuperUser: false,
    isLoading: false,
  },
})
@Injectable()
export class AuthState {
  @Selector()
  static token(state: AuthStateModel): string {
    return state.token;
  }
  @Selector()
  static refreshToken(state: AuthStateModel): string {
    return state.refreshToken;
  }
  @Selector()
  static username(state: AuthStateModel): string {
    return state.username;
  }
  @Selector()
  static isSuperUser(state: AuthStateModel): boolean {
    return state.isSuperUser;
  }
  @Selector()
  static isLoading(state: AuthStateModel): boolean {
    return state.isLoading;
  }
  constructor(private authService: AuthService) { }

  @Action(Auth.Login)
  login(ctx: StateContext<AuthStateModel>, { payload }: Auth.Login) {
    ctx.patchState({
      isLoading: true
    });
    return this.authService.login(payload).subscribe(
      (res) => {
        ctx.dispatch(new Auth.LoginSuccess(res));
      },
      (error) => {
        ctx.dispatch(new Auth.LoginFailed(error));
      }
    );
  }

  @Action(Auth.Logout)
  logout(ctx: StateContext<AuthStateModel>) {
    const state = ctx.getState();
    return this.authService.logOut(state.token).subscribe(() => {
      ctx.dispatch(new Auth.LogoutSuccess());
    });
  }

  @Action(Auth.LoginRedirect)
  onLoginRedirect(ctx: StateContext<AuthStateModel>) {
    console.log('onLoginRedirect, navigating to /auth/login');
    ctx.dispatch(new Navigate(['/sign-in']));
  }

  @Action(Auth.LoginSuccess)
  onLoginSuccess(
    ctx: StateContext<AuthStateModel>,
    payload: Auth.LoginSuccess
  ) {
    console.log('onLoginSuccess, navigating to /dashboard');
    ctx.patchState({
      token: payload.jwt.accessToken,
      userId: payload.jwt.id,
      isSuperUser: payload.jwt.isSuper,
      refreshToken: payload.jwt.refreshToken,
      isLoading: false
    });
    payload.jwt.isSuper?
        ctx.dispatch(new Navigate(['/dashboard'])):
        ctx.dispatch(new Navigate(['/userHome']));
  }

  @Action([Auth.LoginFailed, Auth.LogoutSuccess])
  setUserStateOnFailure(ctx: StateContext<AuthStateModel>) {
    ctx.patchState({
      token: null,
      refreshToken: null,
      username: '',
      userId: '',
      isSuperUser: false,
      isLoading: false
    });
    ctx.dispatch(new Auth.LoginRedirect());
  }
}

and finally this is my authguard
@Injectable({
  providedIn: 'root'
})
export class AuthGuardService implements CanActivate {
  constructor(private store: Store) { }

  canActivate(next: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable<boolean> | Promise<boolean> | boolean {

    return this.store.selectOnce(AuthState.token).pipe(
      map(u => {
        if (!u) {
          this.store.dispatch(new Auth.LoginRedirect());
          return false;
        }
        return true;
      })
    );
  }

}

Hopefully you found your baby.


text:
Q: Using isKindOfClass to output a child of an object in an array? I have a cocos2d game setup which uses basic inheritance setup which is similar to this;
> Property (Base class)
> - Office : Property
> - Warehouse : Property
> - Bank : Property

All the properties live in an array listOfProperties and I am trying to print out each property in a NSLog, but I am not sure how to do it.
For example,
// Create an office
Office *o = [Office alloc] init];
[o setName:@"Some office"];
[city.listOfProperties addObject:o];
[o release];

// Debug output all the properties in the game
// city.listOfProperties in an array of Property objects
for (Property *prop in city.listOfProperties) {

    // I want to print out all the different properties here
     if ([prop isKindOfClass:[Office class]]==YES)
     {
         NSLog(@"Office");
         NSLog(@"office.name = %@", prop.name); // Prop name does not work
     }
} // next

The problem is that some properties do not share the same attributes.  For example, an Office might have "floors" but a Warehouse has "capacity".
What I'm needing is to print out all the different properties, but I am not sure how to change the focus from the pointer prop to a pointer for the specific class (ie: Office).
I need them all to live in listOfProperties so that I can use it later on in a CCMenu and want to avoid splitting them up into seperate arrays which will be very hard for me to manage.
Is there a way to do this?
Thanks

A: Do typecasting like this.
for (Property *prop in city.listOfProperties) {

 if ([prop isKindOfClass:[Office class]])
 {
     Office* officeObject = (Office*) prop;

     NSLog(@"office.name = %@", officeObject.name);
 }
 if ([prop isKindOfClass:[Warehouse class]])
 {
     Warehouse* WarehouseObject = (Warehouse*) prop;

     NSLog(@"Warehouse.name = %@", WarehouseObject.name);
 }
 if ([prop isKindOfClass:[Bank class]])
 {
     Bank* BankObject = (Bank*) prop;

     NSLog(@"Bank.name = %@", BankObject.name);
 }

}
You can have whatever variables you want to log. using name for example.


text:
Q: Unknown Property when creating a public void When I call the function from a button on a visualforce page using the controller I get

Unknown Property 'ContractDetails.save'

when I am trying to save the vfp.
Controller:
        public class ContractDetails{
            public Opportunity ThisOpportunity{get;set;}
            public string oppid {get;set;}
            public ContractDetails(){
            oppid = ApexPages.currentPage().getParameters().get('id');
            if(oppid==null){
                            oppid = ApexPages.currentPage().getParameters().get('oppidd');
       }
            ThisOpportunity = [Select Contract_Requested__c FROM Opportunity where ID=:oppid];
       }
       public void save(){
                    ThisOpportunity.Contract_Requested__c = boolean.valueOf('True');
                    system.debug(ThisOpportunity.Contract_Requested__c);
                    update ThisOpportunity;
       }

Button on VFP:
<apex:page controller="ContractDetails"  showHeader="false" standardStylesheets="false" sidebar="false" docType="html-5.0" >
  <html xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
  <apex:slds />
  <script type="text/javascript">
            function requested(){
                    requestedoper();
                    }
  </script>
  <apex:form id="wf">
  <button class="slds-badge" style="{!requested}" onclick="requested()">Requested</button>
       <apex:actionfunction action="{!save}" name="requesteoper" rerender="wf"></apex:actionfunction></apex:form>
  </html>
  </apex:page>

A: You cannot use onclick javascript function to call a Controller method. Better from onclick function, call javascript function, which in turn call controller method via actionFunction.
Approach 1
<button style="{!requested}" onclick="clickMe()">Requested</button>

<script>
    function clickMe()
    {
        saveOperation();
    }
</script>

<apex:actionFunction action="{!save}" name="saveOperation" rerender="form1"/>

Approach 2
Directly calling actionFunction also work.
<apex:actionFunction action="{!save}" name="saveOperation" rerender="form1"/>
<button onclick="saveOperation()">Requested</button>


text:
Q: Why is the "ph" pronounced like a "v" in "Stephen"? Is this the only word like that? While I know how my name is pronounced, I've run into many non-native english speakers who have stumbled over this unique exception to English.  Even in the female name, "Stephanie", the ph is pronounced as f.
What is the etymology of "Stephen" and is there any other instance of ph being pronounced as v in either American or British English?

A: Stephen is of Greek origin (Stephanos). The ph is unusual in its v pronunciation. The only possibility I can think of is that it arrived in English via Spanish, where it is spelt 'Esteban'. The Spanish pronunciation of 'b' is somewhere between English 'V' and 'B'. In Hungarian it is spelt 'Istvan', so there's another possible source.

A: Born in London, I have always pronounced nephew with a 'v' sound. Locals in Essex (England) also pronounce the village name of Bulphan as 'Bulvan' rather than 'Bulfan', even though the second syllable is derived from the word fen.

A: The source of Stephen is the Greek name Stephanos. This name was borrowed into English long enough ago that the intervocalic [f] sound was voiced to become [v]. This is a regular sound change that was also responsible for some other f~v alternations in English, such as loaf~loaves. However, in the name Stephen the spelling "ph" remained (or has been restored) due to the influence of the Greek original. In other words, Stephen and Steven are pronounced the same way, but the former has an anachronistic spelling.

A: I always found interesting that both "phial" and "vial" exist in English, having a common origin but different pronunciations. OED lists "vial" as an alteration of "phial"; the "ph" is originally Greek.
Does this count?

A:
Is there any other instance of "ph" being pronounced as "v" in either American or British English?

In British English, nephew can be pronounced nev-yoo.

A: "STEVEN" is the canon pronunciation because Old English make-shift gender phonetics are applied to the E-PH. However in common rumor, a user of the name may be required to know the two pronunciations presented by text key models in probable instances rendering it differently pronounced than that of the "V" spelling.  http://babynames.net/names/stephen

A: As one bearing the name of Stephen, I have read a little etymology and it seems that many people try to answer the question by pointing to the Greek Stephanos, which is incorrect because the question is asked of English, not of Greek. Was there not a Norman King of England, Stephen, whose court spoke French?  Could there be a precedent in old Norman for the use of ph in the name? As well, the biblical saint, and first christian martyr, Saint Stephen, is ALWAYS pronounced the way King Stephen, and Stephen King, are pronounced. Stephen's Green in Dublin and almost all uses of Stephen in Ireland, follow the English standard, not the Scottish (v) usage (like Robert Louis Stevenson).  So the pattern of Stephen is historically, biblically, and descriptively pronounced as Steven and not as Stefan, although I grew up with a Polish lad, Stephan, who prounced his name as Stefan. So it all depends on your preferred national standard.  I'm sticking with King Stephen and Saint Stephen, thank you very much.


text:
Q: Proof by induction that for every positive integer there is a multiple $m$ for which the digit sum $D(m)=D(m^2)$ I am an early university student in a math related field and want to practice proofs. In this context I have found this post ("If $D(a)$ is the digit sum of $a$, is there a positive multiple $m$ for every positive integer $n$, such that $D(m)=D(m^2)$") a few hours ago. As I found the proposition interesting I tried to prove this statement.
My plan was to proof it by induction:

*

*It is of course true for $a=1$, as $m=1\cdot 1=1$ and such $D(m)=D(1)=D(m^2)=D(1)=1$

*Next I assume that the statement hold for all $a$, if it also holds for $a+1$

*The last step would be to show it for $a+1$ to prove it for $a$:

So we have $m=(a+1)\cdot b=ab+b, b\in\mathbb{N}$ and $m^2=(a+1)^2\cdot b^2=(a^2+2a+1)\cdot b^2=a^2b^2+2ab^2+b^2$. That must mean that $D(ab+b)=D(a^2b^2+2ab^2+b^2)$ for all $a\in\mathbb{N}$ with some arbitrary $b\in\mathbb{N}$.
This is also the part where I fail to make any meaningful progress because I  don't find out when this equality holds even after trying for longer than I probably should have.
Because of this I want to ask how I could proceed here, tips should suffice because in the end I want to learn something. Or maybe this idea of proving it by induction is totally off the track...

A: First case:$gcd(n,10)=1$ put $m=10^k-1$ it's obvios that $D(m)=D(m^2)$ also since $gcd(n,10)=1$ there exists a positive integer $k$ such that $n|10^k-1$ now for a positive integer $n$ such that gcd(n,10)=1 define $f(n)$ as the smallest multiple of $n$ such that $D(f(n)^2)=D(f(n)$
Second case: let $n=2^a×3^b×t$ such that $gcd(t,10)=1$ now put $m=10^(max(m,n)) × f(t)$ it's obvios that $n|m$ also $D(m^2)=1+D(f(t)^2)$ also $D(m)=1+D(f(t))$ by definition of $f$ we are done!


text:
Q: Apache Spark continuously download data from single url There is url which returns a CSV data. The actual data by this url updates each 10 minutes. Do I need to manually download the data by this url into the file and then load this file by Apache Spark, or for example I can point Spark to this url and Spark will automatically redownload data by this url from time to time and process it? Is it possible for example with Spark Structured Streaming?

A: There is file.sreams like this example
val fileStreamDf = sparkSession.readStream
  .option("header", "true")
  .schema(schema)
  .csv("/tmp/input") //folder where file is

But AFIAK.   I'm not aware of any  http url stream
I think from sources like s3 it should be possible.
If you want to explore pls see this.
spark structured streaming via HTTP communication
which uses below components.
kafka-clients-0.10: used by KafkaAsReceiver
httpclient-4.5: HttpStreamClient uses HttpClient project
jetty-9.0: HttpStreamServer is devploped upon Jetty
spark-2.1: spark structued streaming libray


text:
Q: how does CA2000 work, and my attempt to work around it I am trying to deal with this warning without suppressing it. Call it a personal challenge.

CA2000    In method 'CreateAndUse', call System.IDisposable.Dispose on object 'new Project()' before all references to it are out of scope.

assuming an IDisposable interface on an arbitrary Project class.
public void CreateAndUse()
{
    var instances = new Project().Using(_ => _.LoadItems());
}

Given the extension method:
public static TR Using<T, TR>(this T instance, Func<T, TR> expression)
    where T : IDisposable
{
    using (instance)
        return expression(instance);
}

Surely a smart compiler should be able to analyse this correctly?
I think I am missing something...

A: The one question you actually ask is:

Surely a smart compiler should be able to analyse this correctly?

This shows a fundamental misunderstanding. CA2000 is not a compiler issue. It is a code analysis issue, which is totally separate from the compiler. And no, it is not "quite" smart. So, no - the compiler can do nothing here because the compiler is not involved in this.
The proper way to handle this CA is to look at it, decide whether it is relevant and then possibly suppress it on the method.
Reason?
While it often is an error to nor dispose a created object, sometimes it is the intended function. Factory methods (GetDatabaseConnection()) would be totally utterly useless if the returned object already would be disposed.
But those are "edge" cases - which the programmer can decide once he sees the warning. This is what a method level suppression is for.
See How to get rid of CA2000 warning when ownership is transferred? for a similar (though not identical) example for this case.

A: The reason CA2000 occurs is plain and simple: you have a reference to an IDisposable that hasn't been disposed in your CreateAndUse() method.
The fact that your extension method disposes of your object is irrelevant. The code analyzer can't assume that the instance is guaranteed to be disposed by the time the extension method is done. What if you end up doing some other stuff with the object within the extension method outside of its using block? What if that other stuff causes an exception (rendering the using block unreachable)? Then all of a sudden you have an undisposed object lying around. And that's what CA2000 is trying to guard you against. If nothing else, the code analyzer is smart enough to anticipate all the other ways your code could possibly fail for you.
You can choose to suppress this warning if you can guarantee that your extension method will do nothing with the IDisposable outside of the using block, one of the few times the documentation says it is OK to suppress such a warning. On the other hand, the best way to deal with the CA2000 without suppressing it is to prevent it from ever happening in the first place. And the best way to do that, is to just use using directly the way it was meant to be used:
public void CreateAndUse()
{
    List<Item> instances;

    using (var p = new Project())
        instances = p.LoadItems();
}

As you can see, the scope of the Project is narrowed down to just one using block. Pretty clear-cut. No need for an extra layer of indirection, as jgauffin has said.


text:
Q: Why aren't my Divs auto adjusting location? Using JQuery,
I have a set of four tab that start off like this:

        <input type="radio" name="tabs" id="tab1" checked />
        Item One

Text Here

On a desktop it looks as desired. But on mobile, when the screen is shrunk the other tabs collapse under (which they are supposed to), but the text inside the div doesn't auto adjust down. This leaves the other tabs behind the visible text.
Is there any way to fix this?
Thank you,
For the full code see this JSFiddle page:
https://jsfiddle.net/hesbwgsm/2/

A: bacause of .tabs li
in your css, .tabs width: 75%  but li which inside of ul you don't give it any width

replace this with yours

.tabs li {
  float: left;
  display: block;
  width: 25%;
}


text:
Q: Mongodb aggregation $project get array position element field value Document:
{
    "_id" : ObjectId("560dcd15491a065d6ab1085c"),
    "title" : "example title",
    "views" : 1,
    "messages" : [
        {
            "authorId" : ObjectId("560c24b853b558856ef193a3"),
            "authorName" : "Karl Morrison",
            "created" : ISODate("2015-10-02T00:17:25.119Z"),
            "message" : "example message"
        }
    ]
}

Project:
$project: {
    _id: 1,
    title: 1,
    views: 1,
    updated: '$messages[$messages.length-1].created' // <--- ReferenceError: $messages is not defined
}

I am trying to get the last elements created value from the array inside of the document. I was reading the documentation but this specific task has fallen short.
I've learnt it has to do with dot notation. However doesn't state how to get the last element.

A: You cannot just extract properties or basically change the result from a basic .find() query beyond simple top level field selection as it simply is not supported. For more advanced manipulation you can use the aggregation framework.
However, without even touching .aggregate() the $slice projection operator gets you most of the way there:
db.collection.find({},{ "messages": { "$slice": -1 } })

You cannot alter the structure, but it is the last array element with little effort.
Until a new release ( as of writing ) for MongoDB, the aggregation framework is still going to need to $unwind the array in order to get at the "last" element, which you can select with the $last grouping accumulator:
db.collection.aggregate([
    { "$unwind": "$messages" },
    { "$group": {
        "_id": "$_id",
        "title": { "$last": "$title" },
        "views": { "$last": "$views" },
        "created": { "$last": "$messages.created" }
   }}
])

Future releases have $slice and $arrayElemAt in aggregation which can handle this directly. But you would also need to set a variable with $let to address the dot notated field:
    [
        { "$project": {
            "name": 1,
            "views": 1,
            "created": {
                "$let": {
                    "vars": {
                        "message": {
                            "$arrayElemAt": [
                                { "$slice": [ "$messages", -1 ] },
                                0
                            ]
                        }
                    },
                    "in": "$$message.created"
                }
            }
        }}
    ]


text:
Q: Extracting HTML input string into Python I'm currently trying to grab a string that a user would put in an HTML form, and set that equal to a variable in a python program after the 'search' button has been clicked. I'm using flask to run the html code just on localhost. How would I go about implementing this?
The code I have for the search bar so far is below.

        <input type="text" class="form-control" placeholder="Enter a string...">

            <button class="btn btn-success" type="submit">
              Search
            </button>


text:
Q: Get the name of the page in the content place holder of the Master Page My Master page consists of a top bar that contains a few buttons and also a left menu bar by which the user can navigate through the web application. My Login.aspx page however is a content page but i do not want to show the left menu bar when the content page is login.
Here's a part of my Master page:

    <asp:SiteMapDataSource ID="SiteMapDataSource1" runat="server" ShowStartingNode="false" />

                    <asp:Menu ID="Menu1" runat="server" DataSourceID="SiteMapDataSource1" StaticDisplayLevels="2" Font-Size="Medium">
                        <LevelSubMenuStyles>
                            <asp:SubMenuStyle CssClass="level1" />
                        </LevelSubMenuStyles>
                        <StaticHoverStyle CssClass="hoverstyle" />
                    </asp:Menu>

                <asp:ContentPlaceHolder runat="server" ID="MainContent" />

I'm looking for a way to check for the name of the opened page in my MainContent of the Master Page file and if that page is Login.aspx I would set Menu1 to hidden.

A: You have to think it in the opposite way: access a Master Page's control from Content Page.
This directive causes the content page's Master property to be strongly typed. Add this in you Content Page:
<%@ MasterType virtualpath="~/YourMasterPage.master" %>

Create the following Property inside your Master Page:
public bool IsMenuVisible
{
    get
    {
        return Menu1.Visible;
    }
    set
    {
        Menu1.Visible = value;
    }
}

Use it inside your Content Page:
Master.IsMenuVisible = false;

More information:
Reference ASP.NET Master Page Content


text:
Q: Handle the event when device connect to cradle windows ce opennetcf in C# I develop an application on windowCE 5.0 with opennetcf library.
I want to check WHEN my Device is connected to Cradle. It means I want to handle the event of plugged the device to cradle or other similar.
My purpose is that when Device is connected to Cradle, I disable all forms of my application,
and when it is removed from cradle, all the forms are enabled.
I search much. But the answer is not matched to my expect.
Please help me.

After reading reference of opennetcf, I found out the two events: ACPowerApplied and ACPowerRemoved
Here is my code:
public static event DeviceNotification ACPowerApplied;
public static event DeviceNotification ACPowerRemoved;

void Form1_ACPowerRemoved()
{
MessageBox.Show("Un-cradle");
}

void Form1_ACPowerApplied()
{
MessageBox.Show("Cradle");
}

private void Form1_Load(object sender, EventArgs e)
{
ACPowerApplied += new DeviceNotification(Form1_ACPowerApplied);
ACPowerRemoved += new DeviceNotification(Form1_ACPowerRemoved);
}

But the process did not step into Form1_ACPowerRemoved() and Form1_ACPowerApplied().
Is there any idea for that? Sorry for my poor English. Thank you in advance.

A: Your code is wrong. You've subscribed to the form's event, and nobody raise it.
Documentation doesn't show how-to-use code, I think. It shows declaraion.
Maybe it will work (not tested):
OpenNETCF.WindowsCE.DeviceManagement.ACPowerApplied += Form1_ACPowerApplied
OpenNETCF.WindowsCE.DeviceManagement.ACPowerRemoved += Form1_ACPowerRemoved

Also you can try to use WinAPI calls: http://blogs.msdn.com/b/davidklinems/archive/2005/02/10/370591.aspx
If you want, I have complete code, but there are a lot of waste and "OnRs232Connect" event.
By the way, what does "craddled" mean for you? Craddle can be disconneted from both AC and PC. I mean, do you want to handle when your device started to get electricity power, or when it started connecting to the PC via Active Sync? If the second, you want to catch "OnRs232Connect" event


text:
Q: Service Worker prevents Nginx to match location With Nginx I'm serving a CMS application on /admin and a React app with React Router on /.
If I check /admin I can see the CMS. But if I go to / (where I see the app) and then I go back to /admin I get the 404 page of the app. After that it's impossible to see the CMS.
The only way to see the CMS again is to clean browser history and go to /admin first.
If I use curl on terminal though I cannot replicate the issue.
My guess
Create-React-App service worker is preventing other locations once downloaded
Nginx config
server {
    # ...some code

    root /home/myuser/app/build;

    location ~ ^/admin(/.*|$) {
        alias /home/myuser/admin/public$1;
        # ...some code
    }

    location / {
        try_files $uri $uri/ /index.html;
    }

    location ~ \.html?$ {
        expires 1d;
    }
}

A: may be try this code
server {
    # ...some code

    root /home/myuser/app/build;

    location / {
        try_files $uri $uri/ /index.html;
    }

    location /admin/ {
        alias /home/myuser/admin/public$1;
        # ...some code
    }

    ~ \.html?$ {
        expires 1d;
    }
}

A: I ended up unregistering the Service Worker as per Dan's comment.
import { unregister } from './registerServiceWorker';

// ...

unregister();

Once done Nginx configuration is honoured.


text:
Q: FBAudienceNetwork: setting FBNativeAd into FBMediaView stacks the UI The following line of code makes my UI stack
adMediaView.nativeAd = nativeAd
// adMediaView - FBMediaView
// nativeAd - FBNativeAd

I've tried putting it in the performing it asynchronously in background thread but it didn't help. Is there a way to fix it?
dispatch_async(dispatch_get_global_queue( DISPATCH_QUEUE_PRIORITY_DEFAULT, 0),{
    adMediaView.nativeAd = nativeAd
});

*

*I've installed FBAudienceNetwork via pods and updated it just now. The latest version I have is 4.7.0
pod 'FBAudienceNetwork'

A: NativeAdView uses FBMediaView for creating an ad.
Now, in your View Controller header file declare FBNativeAdDelegate protocol as well as declare and connect instance variables to your UI .XIB:
@import FBAudienceNetwork; // import Audience Network module

@interface MyViewController : UIViewController <FBNativeAdDelegate>
  // Other code might go here...
  @property (weak, nonatomic) IBOutlet UIImageView *adIconImageView;
  @property (weak, nonatomic) IBOutlet UILabel *adTitleLabel;
  @property (weak, nonatomic) IBOutlet UILabel *adBodyLabel;
  @property (weak, nonatomic) IBOutlet UIButton *adCallToActionButton;
  @property (weak, nonatomic) IBOutlet UILabel *adSocialContextLabel;
  @property (weak, nonatomic) IBOutlet UILabel *sponsoredLabel;

  @property (weak, nonatomic) FBMediaView *adCoverMediaView;

  @property (weak, nonatomic) IBOutlet UIView *adView;
@end

Then, add a method in your View Controller's implementation file that initializes FBNativeAd and request an ad to load:
FBNativeAd *nativeAd;
FBAdchoicesView *adChoicesView;

- (void)showNativeAd
{
  nativeAd = [[FBNativeAd alloc] initWithPlacementID:@"YOUR_PLACEMENT_ID"];
  nativeAd.delegate = self;
  [nativeAd loadAd];
}

Now that you have added the code to load the ad, add the following functions to handle loading failures and to construct the ad once it has loaded:
- (void)nativeAdDidLoad:(FBNativeAd *)nativeAd
{
  [self.adTitleLabel setText:nativeAd.title];
  [self.adBodyLabel setText:nativeAd.body];
  [self.SocialContextLabel setText:nativeAd.socialContext];
  [self.sponsoredLabel setText:@"Sponsored"];
  [self.adCallToActionButton setTitle:nativeAd.callToAction];

  [nativeAd.icon loadImageAsyncWithBlock:^(UIImage *image) {
    [self.adIconImageView setImage:image];
  }];

  // Allocate a FBMediaView to contain the cover image or native video asset
  adCoverMediaView = [[FBMediaView alloc] initWithFrame:coverFrame]];
  [adCoverMediaView setNativeAd:nativeAd];

  // Add adChoicesView
  adChoicesView = [[FBAdChoicesView alloc] initWithNativeAd:nativeAd];
  [adView addSubview:adChoicesView];
  [adChoicesView updateFrameFromSuperview];

  // Register the native ad view and its view controller with the native ad instance
  [nativeAd registerViewForInteraction:adView withViewController:self];
}

- (void)nativeAd:(FBNativeAd *)nativeAd didFailWithError:(NSError *)error
{
  NSLog(@"Ad failed to load with error: %@", error);
}

For displaying the native ad cover image, it is recommended to use the Facebook Audience Network MediaView which can display both image and video assets.
Reference : https://developers.facebook.com/docs/audience-network/ios/native-api


text:
Q: Не удается запустить PHPDaemon  - PECL eio event Здравствуйте, господа. )
Хочу поднять PHPDaemon на Centos 6, все вроде бы сделал, но не тут то было... Не удается запустить PHPDaemon, ругается на - PECL eio event. Версии eio и event свежие, пару дней ищу решение проблемы, но что-то ничего нет подходящего.
# sudo phpd start --verbose-tty=1
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/lib64/php/modules/event.so' - /usr/lib64/php/modules/event.so: undefined symbol: php_sockets_le_socket in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/lib64/php/modules/eio.so' - /usr/lib64/php/modules/eio.so: undefined symbol: php_sockets_le_socket in Unknown on line 0
[PHPD] FS: missing pecl-eio >= 1.2.1. Filesystem I/O performance compromised. Consider installing pecl-eio. `pecl install http://pecl.php.net/get/eio-1.2.1.tgz`
[PHPD] Loaded config file: 'conf/conf.d/ExampleJabberBot.conf'
[PHPD] Loaded config file: 'conf/conf.d/FastCGI.conf'
[PHPD] Loaded config file: 'conf/conf.d/FlashpolicyServer.conf'
[PHPD] Loaded config file: 'conf/conf.d/HTTPServer.conf'
[PHPD] Loaded config file: 'conf/conf.d/IdentServer.conf'
[PHPD] Loaded config file: 'conf/conf.d/SSL-sample.conf'
[PHPD] Loaded config file: 'conf/conf.d/WebSocketServer.conf'
[PHPD] Loaded config file: '/usr/local/phpdaemon/conf/phpd.conf'
[PHPD] [EMERG] event extension >= 1.6.1 not found (or OUTDATED). You have to install it. `pecl install http://pecl.php.net/get/event-1.6.1.tgz`

Прошу слёзно)))) Подскажите, ребята, как вылечить сие дело. )) Заранее благодарствую. )
Обновление
До того как начал установку, обновил PHP с 5.3 до 5.6, что-то у меня подозрения на некорректное обновление, так как сервер на данный момент не используется, позволил себе полностью все снести и установить все что нужно, свежее на чистую, без всякий обновлений старых версий, надеюсь, проблема решится.
В Сети много различных инструкций по установке PHPDaemon, но как-то каждый по-своему все пишет, поделитесь ссылкой на проверенные инструкции установки, если несложно.
A: Вот так решил проблему:
1)
wget http://pecl.php.net/get/event-2.1.0.tgz
tar zxvf event-2.1.0.tgz
phpize && ./configure -with-php-config=/usr/bin/php-config
make && make install

2) add "extension=event.so" to php.ini
3)
/usr/bin/env php -m|grep event
и
php -v

Получил: PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/lib/php5/20131226/pecl.so' - /usr/lib/php5/20131226/pecl.so: cannot open shared object file: No such file or directory in Unknown on line 0
event
4) Открыл /etc/php5/mods-available/pecl.ini для редактирования
а) закомментировал строку с вызовом модуля:
;extension=pecl.so
б) затем после этой строки добавил 2-е строки с вызовом модулей:
extension=raphf.so
extension=http.so
в) в /etc/php5/mods-available/raphf.ini закоментировал вызов модуля: ;extension=raphf.so.
Это нужно для того, чтобы модуль raphf.so вызывался раньше http.so, если не вызывать до http.so то будет другая ошибка появляться: PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/lib/php5/20131226/http.so' - /usr/lib/php5/20131226/http.so: undefined symbol: php_persistent_handle_abandon in Unknown on line 0)


text:
Q: php xdebug in netbeans - how to see values of variable? I have enabled xdebug in php.ini file as follows:
[XDebug]
zend_extension = "D:\xampp\php\ext\php_xdebug.dll"
xdebug.profiler_append = 0
xdebug.profiler_enable = 1
xdebug.profiler_enable_trigger = 0
xdebug.profiler_output_dir = "D:\xampp\tmp"
xdebug.profiler_output_name = "cachegrind.out.%t-%s"
xdebug.remote_enable = 0
xdebug.remote_handler = "dbgp"
xdebug.remote_host = "localhost"
xdebug.trace_output_dir = "D:\xampp\tmp"

and my netbeans setting is the same as their manual. Now when I try Ctrl+F5 (After setting breakpoint in line 140) then it shows as follows:

How can I see the value of $user_id(or any other variable's value) in netbean's console below??
or Is there are any way available to debug PHP code by setting breakpoint and inspect variable value in CLI like python import pdb;pdb.set_trace()??? so that code break in particular line (When action taken like submit form or reload browser) and then I can inspect each variable before breakpoint even continue after breakpoint

A: 1.Review your php.ini configuration.
xdebug.remote_enable = 1
xdebug.remote_host = localhost
xdebug.remote_port = 9000

Also make sure your zend_extension = "D:\xampp\php\ext\php_xdebug.dll" is correct. On my computer I have / instead of \, not sure if it matters...
2.Restart your server (not sure if needed).
3.Check your netbeans configuration in Tools->options->PHP->Debugging
4.Check you project properties : "Browser" and "Run Configuration"
If everything is correct, you can set a break point within netbeans and laung debug: "Debug"->"Debug project"


text:
Q: Modify inbuilt Java functions Is it possible to change how functions inherent to java function without modifying the files? For example, I'd like to modify java.util.Arrays.toString() to throw an error if used on anything but a 1D array, for convenience. Is this possible?
Sorry if it's been asked before, couldn't find it on google. Thanks.

A: No, you can't do that. I suggest you write your own separate class, given that you want different functionality.
Obviously Java allows you to override non-final instance methods in classes, but even then the clients would need to know to create an instance of the subclass... and restricting the set of inputs that a method can accept is a breaking change anyway. And seeing as this is a static method in the first place... basically, the normal mechanisms for custom behaviour aren't going to help you.


text:
Q: Why do i have User registration error with MySql I'm new to MySql and i have an error this happens when I try to register a new user
java.sql.SQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'id, roles) values (25, 'USER')' at line 1
at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:120) ~[mysql-connector-java-8.0.21.jar:8.0.21]
RegistrationController.Java
`
package com.example.fitter.controller;

import com.example.fitter.domain.Role;
import com.example.fitter.domain.User;
import com.example.fitter.repos.UserRepo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;

import java.util.Collections;
import java.util.Map;

@Controller
public class RegistrationController {
    @Autowired
    private UserRepo userRepo;

    @GetMapping("/registration")
    public String registration() {
        return "registration";
    }

    @PostMapping("/registration")
    public String addUser(User user, Map<String, Object> model) {
        User userFromDb = userRepo.findByUsername(user.getUsername());

        if (userFromDb != null) {
            model.put("message", "User exists!");
            return "registration";
        }

        user.setActive(true);
        user.setRoles(Collections.singleton(Role.USER));
        userRepo.save(user);

        return "redirect:/login";
    }
}

`
WebSecurityConfig.Java
``` package com.example.fitter.config;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
import org.springframework.security.crypto.password.NoOpPasswordEncoder;

import javax.sql.DataSource;

@Configuration
@EnableWebSecurity
public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
    @Autowired
    private DataSource dataSource;

    @Override
    protected void configure(HttpSecurity http) throws Exception {
        http
                .authorizeRequests()
                .antMatchers("/", "/registration").permitAll()
                .anyRequest().authenticated()
                .and()
                .formLogin()
                .loginPage("/login")
                .permitAll()
                .and()
                .logout()
                .permitAll();
    }

    @Override
    protected void configure(AuthenticationManagerBuilder auth) throws Exception {
        auth.jdbcAuthentication()
                .dataSource(dataSource)
                .passwordEncoder(NoOpPasswordEncoder.getInstance())
                .usersByUsernameQuery("select username, password, active from usr where username=?")
                .authoritiesByUsernameQuery("select u.username, ur.roles from usr u inner join user_role ur on u.id = ur.user_id where u.username=?");
    }
}

User.Java
package com.example.fitter.domain;

import javax.persistence.*;
import java.util.Set;

@Entity
@Table(name = "usr")
public class User {
    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    private Long id;
    private String username;
    private String password;
    private boolean active;

    @ElementCollection(targetClass = Role.class, fetch = FetchType.EAGER)
    @CollectionTable(name = "userRole", joinColumns = @JoinColumn(name = "user id"))
    @Enumerated(EnumType.STRING)
    private Set<Role> roles;

    public User(){}
    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public boolean isActive() {
        return active;
    }

    public void setActive(boolean active) {
        this.active = active;
    }

    public Set<Role> getRoles() {
        return roles;
    }

    public void setRoles(Set<Role> roles) {
        this.roles = roles;
    }
}

'

A: This one seems wrong:
@JoinColumn(name = "user id")

I suppose it is user_id in the table, so it should be:
@JoinColumn(name = "user_id")

A: That was so stupid Error in User.Java instead of  @CollectionTable(name = "userRole", joinColumns = @JoinColumn(name = "user id"))
@CollectionTable(name = "user_role", joinColumns = @JoinColumn(name = "user_id"))


text:
Q: Error '3086' could not delete from specified table but read/write rights are there I want to delete a subtopic from a table under the condition that it is associated with a specific topic in another table.
The topic is selected using a text field in a form.
I assumed I need a INNER JOIN, but my delete function would return:

"error 3086-could not delete from specified table" error

My research showed that this is normally the case if it is a read-only table, but I can manually delete entries in the table, and so I should have write permissions as well.
My Code:
'delete all entries from skillsTbl
strDeleteAllSubsFromSkillsTbl = "DELETE TeamSkillsTbl.* " & _
"FROM TeamSkillsTbl, SubTopicTbl " & _
"WHERE (((TeamSkillsTbl.SubTopicName)=[SubTopicTbl].[SubTopicName]) " & _
"AND ((SubTopicTbl.Topic)=[Forms]![frmAdd_Rename_Delete_Topic]![TopicName]));"

Code with INNER JOIN:
'delete all entries from skillsTbl
  strDeleteAllSubsFromSkillsTbl = "DELETE TeamSkillsTbl.* " & _
"FROM TeamSkillsTbl INNER JOIN SubTopicTbl ON TeamSkillsTbl.SubTopicName = SubTopicTbl.SubTopicName " & _
"WHERE ([SubTopicTbl].[Topic]=[Forms]![frmAdd_Rename_Delete_Topic]![txtTopicName]);"

Where did I make a mistake?
Any help is greatly appreciated!

A: Try the following instead:
DELETE FROM TeamSkillsTbl
WHERE
TeamSkillsTbl.SubTopicName IN
(
    SELECT SubTopicTbl.SubTopicName
    FROM SubTopicTbl
    WHERE SubTopicTbl.Topic = [Forms]![frmAdd_Rename_Delete_Topic]![TopicName]
)


text:
Q: VBScript code to keep Excel file open I have a VBScript code to open an excel file, run a macro and close it. Fine.
Now, the only thing I want to change is to leave the file open.
If I remove the 2 lines of code xlApp.activewindow.close and xlApp.Quit, then the workbook and the application are closed anyway, but they remain open in the background (Excel process still active in Task Manager). Hence, it is impossible to re-run the macro later on the same file by calling the script again (which is exactly what I want to do).
Why?
Here is the code:
Option Explicit

On Error Resume Next

MyTest

Sub MyTest()
    Dim xlApp
    Dim xlBook
    Dim fpath
    Dim fname

    ' Excel application running? if not, open Excel
    On Error Resume Next
    Set xlApp = GetObject(, "Excel.Application")
    If xlApp <> "Microsoft Excel" Then
        Set xlApp = CreateObject("Excel.Application")
    End If
    Err.Clear

    ' correct Excel file open? if not, open it
    fpath = "D:\Desktop\"
    fname = "MyTest.xls"

    xlApp.Workbooks(fname).Activate
    If Err = 0 Then
        ' no error, so it has been possible to activate the workbook
        Set xlBook = xlApp.Workbooks(fname)
    Else
        ' unable to activate, so workbook was not open -> open it now
        Set xlBook = xlApp.Workbooks.Open(fpath & fname, 0, True)
    End If
    Err.Clear

    ' now run the desired macro in the excel file
    xlApp.Run "HelloWorld"

    ' WANT TO CHANGE THIS
    xlBook.saved = True
    xlApp.activewindow.close

    ' AND THIS
    xlApp.Quit

    Set xlBook = Nothing
    Set xlApp = Nothing
End Sub

A: You just need to make your new instance of Excel visible. Do this right after creating it:
xlApp.Visible = True

A: This line of code will close your current activated workbook (by now, it is D:\Destop\MyTest.xls);
xlApp.activewindow.close

This line will quit Excel application;
xlApp.Quit


text:
Q: Automatically adding folders to the Deployable zip when build using Maven I have a pom.xml which is automatically adding src/main/resources folder.
Q1.But i have not mentioned it anywhere in my pom.xml?
Q2.I needed to add an Extra Resource Folder(Ex:src/main/cxf) folder as an additional resources folder.But not sure how to add it?
This is my pom.xml.
Note:I analyzed a bit and believe something with build helper maven plugin
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">

    <modelVersion>4.0.0</modelVersion>
    <artifactId>ops</artifactId>
    <packaging>mule</packaging>
    <version>1.0.0</version>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>

        <mule.version>3.7.0</mule.version>
        <eclipsePluginVersion>2.8</eclipsePluginVersion>
        <jdkName>jdk1.7.0_45</jdkName>
        <jdk.version>1.7</jdk.version>
        <junit.version>4.9</junit.version>
        <munit.version>1.1.0</munit.version>
        <mule.munit.support.version>3.7.1</mule.munit.support.version>
    </properties>

    <build>
        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-install-plugin</artifactId>
                    <version>2.3.1</version>
                </plugin>
                <plugin>
                    <groupId>org.eclipse.m2e</groupId>
                    <artifactId>lifecycle-mapping</artifactId>
                    <version>1.0.0</version>
                    <configuration>
                        <lifecycleMappingMetadata>
                            <pluginExecutions>
                                <pluginExecution>
                                    <pluginExecutionFilter>
                                        <groupId>org.mule.tools</groupId>
                                        <artifactId>maven-mule-plugin</artifactId>
                                        <versionRange>[1.6,)</versionRange>
                                        <goals>
                                            <goal>attach-test-resources</goal>
                                            <goal>filter-resources</goal>
                                        </goals>
                                    </pluginExecutionFilter>
                                    <action>
                                        <ignore/>
                                    </action>
                                </pluginExecution>
                            </pluginExecutions>
                        </lifecycleMappingMetadata>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>org.codehaus.mojo</groupId>
                    <artifactId>build-helper-maven-plugin</artifactId>
                    <version>1.9.1</version>
                    <executions>
                        <execution>
                            <id>add-resource</id>
                            <phase>generate-resources</phase>
                            <goals>
                                <goal>add-resource</goal>
                            </goals>
                        </execution>
                    </executions>
                    <configuration>
                        <resources>
                            <resource>
                                <directory>src/main/app/</directory>
                            </resource>
                        </resources>
                    </configuration>
                </plugin>
                <plugin>
                    <artifactId>maven-assembly-plugin</artifactId>
                    <version>2.2.1</version>
                    <configuration>
                        <descriptorRefs>
                            <descriptorRef>project</descriptorRef>
                        </descriptorRefs>
                    </configuration>
                </plugin>
                <plugin>
                    <artifactId>maven-resources-plugin</artifactId>
                    <version>2.7</version>
                    <executions>
                        <execution>
                            <id>copy-deployable</id>
                            <phase>package</phase>
                            <goals>
                                <goal>copy-resources</goal>
                            </goals>
                            <configuration>
                                <outputDirectory>deployable</outputDirectory>
                                <resources>
                                    <resource>
                                        <directory>target</directory>
                                        <includes>
                                            <include>*.zip</include>
                                        </includes>
                                    </resource>
                                </resources>
                                <overwrite>true</overwrite>
                            </configuration>
                        </execution>
                    </executions>
                </plugin>
            </plugins>
        </pluginManagement>
        <plugins>

            <plugin>
                <groupId>org.mule.tools</groupId>
                <artifactId>maven-mule-plugin</artifactId>
                <version>1.9</version>
                <extensions>true</extensions>
                <configuration>
                    <excludeMuleDependencies>false</excludeMuleDependencies>
                    <copyToAppsDirectory>true</copyToAppsDirectory>
                    <!-- <outputDirectory>deployable</outputDirectory>
                    <finalName>${project.artifactId}</finalName> -->
                    <inclusions>
                        <inclusion>
                            <groupId>org.mule.modules</groupId>
                            <artifactId>mule-module-extensions-support</artifactId>
                        </inclusion>
                        <inclusion>
                            <groupId>org.mule.modules</groupId>
                            <artifactId>mule-module-extensions-spring-support</artifactId>
                        </inclusion>
                    </inclusions>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-clean-plugin</artifactId>
                <version>2.4.1</version>
                <configuration>
                    <followSymLinks>false</followSymLinks>
                    <filesets>
                        <fileset>
                            <directory>${env.MULE_HOME}\apps</directory>
                            <includes>
                                <include>${project.artifactId}.*</include>
                            </includes>
                        </fileset>
                    </filesets>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>2.3.2</version>
                <configuration>
                    <source>${jdk.version}</source>
                    <target>${jdk.version}</target>
                    <encoding>ISO-8859-1</encoding>
                </configuration>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-eclipse-plugin</artifactId>
                <version>${eclipsePluginVersion}</version>
                <configuration>
                    <!-- by default download all sources when generating project files -->
                    <downloadSources>true</downloadSources>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>exec-maven-plugin</artifactId>
                <version>1.2.1</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>java</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <mainClass>org.mule.MuleServer</mainClass>
                    <arguments>
                        <argument>-config</argument>
                        <argument>src/main/app/mule-config.xml</argument>
                    </arguments>
                    <classpathScope>compile</classpathScope>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>2.18.1</version>
                <configuration>
                    <argLine>${surefire.argLine}</argLine>
                </configuration>
            </plugin>
            <plugin>
                <groupId>com.google.code.maven-replacer-plugin</groupId>
                <artifactId>replacer</artifactId>
                <version>1.5.3</version>
                <executions>
                    <execution>
                        <phase>prepare-package</phase>
                        <goals>
                            <goal>replace</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <basedir>target/classes</basedir>
                    <filesToInclude>*.xml</filesToInclude>
                    <replacements>
                        <replacement>
                            <token>\/current\/</token>
                            <value>/3.3/</value>
                        </replacement>
                        <replacement>
                            <token>CE-3\.4\.0</token>
                            <value>CE-3.3.1</value>
                        </replacement>
                    </replacements>
                </configuration>
            </plugin>
            <plugin>
                <groupId>com.mulesoft.munit.tools</groupId>
                <artifactId>munit-maven-plugin</artifactId>
                <version>${munit.version}</version>
                <executions>
                    <execution>
                        <id>test</id>
                        <phase>test</phase>
                        <goals>
                            <goal>test</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <coverage>
                        <runCoverage>true</runCoverage>
                        <formats>
                            <format>html</format>
                        </formats>
                    </coverage>
                </configuration>
            </plugin>
        </plugins>

        <testResources>
            <testResource>
                <directory>src/test/munit</directory>
            </testResource>
            <testResource>
                <directory>src/test/resources</directory>
            </testResource>
        </testResources>
    </build>

    <dependencies>

        <!-- Mule Dependencies -->
        <dependency>
            <groupId>org.mule</groupId>
            <artifactId>mule-core</artifactId>
            <version>${mule.version}</version>
            <scope>provided</scope>
        </dependency>
        <!-- Xml configuration -->
        <dependency>
            <groupId>org.mule.modules</groupId>
            <artifactId>mule-module-spring-config</artifactId>
            <version>${mule.version}</version>
            <scope>provided</scope>
        </dependency>

        <!-- Mule Transports -->
        <dependency>
            <groupId>org.mule.transports</groupId>
            <artifactId>mule-transport-file</artifactId>
            <version>${mule.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.mule.transports</groupId>
            <artifactId>mule-transport-http</artifactId>
            <version>${mule.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.mule.transports</groupId>
            <artifactId>mule-transport-jdbc</artifactId>
            <version>${mule.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.mule.transports</groupId>
            <artifactId>mule-transport-jms</artifactId>
            <version>${mule.version}</version>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>org.mule.transports</groupId>
            <artifactId>mule-transport-vm</artifactId>
            <version>${mule.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.mule.transports</groupId>
            <artifactId>mule-transport-quartz</artifactId>
            <version>${mule.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.mule.transports</groupId>
            <artifactId>mule-transport-email</artifactId>
            <version>${mule.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.mule.transports</groupId>
            <artifactId>mule-transport-ftp</artifactId>
            <version>${mule.version}</version>
            <scope>provided</scope>
        </dependency>

        <!-- Mule Modules -->
        <dependency>
            <groupId>org.mule.modules</groupId>
            <artifactId>mule-module-client</artifactId>
            <version>${mule.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.mule.modules</groupId>
            <artifactId>mule-module-cxf</artifactId>
            <version>${mule.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.mule.modules</groupId>
            <artifactId>mule-module-management</artifactId>
            <version>${mule.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.mule.modules</groupId>
            <artifactId>mule-module-scripting</artifactId>
            <version>${mule.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.mule.modules</groupId>
            <artifactId>mule-module-sxc</artifactId>
            <version>${mule.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.mule.modules</groupId>
            <artifactId>mule-module-xml</artifactId>
            <version>${mule.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>jaxen</groupId>
            <artifactId>jaxen</artifactId>
            <version>1.1.1</version>
        </dependency>
        <!-- for testing -->
        <dependency>
            <groupId>org.mule.tests</groupId>
            <artifactId>mule-tests-functional</artifactId>
            <version>${mule.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>mockobjects</groupId>
            <artifactId>mockobjects-core</artifactId>
            <version>0.09</version>
            <scope>test</scope>
        </dependency>
         <dependency>
            <groupId>org.mockito</groupId>
            <artifactId>mockito-all</artifactId>
            <version>1.10.19</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>${junit.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>xmlunit</groupId>
            <artifactId>xmlunit</artifactId>
            <version>1.5</version>
            <scope>test</scope>
        </dependency>
        <!-- https://mvnrepository.com/artifact/dom4j/dom4j -->
        <dependency>
            <groupId>dom4j</groupId>
            <artifactId>dom4j</artifactId>
            <version>1.6.1</version>
        </dependency>
        <!-- project Dependencies -->
        <dependency>
            <groupId>org.apache.activemq</groupId>
            <artifactId>activemq-all</artifactId>
            <version>5.7.0</version>
            <exclusions>
                <exclusion>
                    <groupId>org.slf4j</groupId>
                    <artifactId>slf4j-api</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>com.lp.mule</groupId>
            <artifactId>cipher</artifactId>
            <version>1.0-mule</version>
        </dependency>
        <dependency>
            <groupId>com.microsoft.sqlserver</groupId>
            <artifactId>sqljdbc</artifactId>
            <version>4</version>
        </dependency>
        <dependency>
            <groupId>org.json</groupId>
            <artifactId>json</artifactId>
            <version>20131018</version>
        </dependency>
        <dependency>
            <groupId>org.mule.modules</groupId>
            <artifactId>mule-module-http</artifactId>
            <version>${mule.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.mule.modules</groupId>
            <artifactId>mule-module-ws</artifactId>
            <version>${mule.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.mulesoft.munit</groupId>
            <artifactId>mule-munit-support</artifactId>
            <version>${mule.munit.support.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.mulesoft.munit</groupId>
            <artifactId>munit-runner</artifactId>
            <version>${munit.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.mule.modules</groupId>
            <artifactId>mule-module-extensions-support</artifactId>
            <version>${mule.version}</version>
        </dependency>
        <dependency>
            <groupId>org.mule.modules</groupId>
            <artifactId>mule-module-extensions-spring-support</artifactId>
            <version>${mule.version}</version>
        </dependency>
        <dependency>
            <groupId>xerces</groupId>
            <artifactId>xercesImpl</artifactId>
            <version>2.11.0</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>commons-cli</groupId>
            <artifactId>commons-cli</artifactId>
            <version>1.3</version>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <repositories>
        <repository>
            <id>Central</id>
            <name>Central</name>
            <url>http://repo1.maven.org/maven2/</url>
            <layout>default</layout>
        </repository>
        <repository>
            <id>mulesoft-releases</id>
            <name>MuleSoft Releases Repository</name>
            <url>http://repository.mulesoft.org/releases/</url>
            <layout>default</layout>
        </repository>
        <repository>
            <id>mulesoft-snapshots</id>
            <name>MuleSoft Snapshots Repository</name>
            <url>http://repository.mulesoft.org/snapshots/</url>
            <layout>default</layout>
        </repository>
        <repository>
            <id>LP01DevContDlv-ext</id>
            <name>LP01DevContDlv-ext-releases</name>
            <url>http://artifactory.corp.local.com/artifactory/ext-release-local</url>
        </repository>
        <repository>
            <id>LP01DevContDlv-libs</id>
            <name>LP01DevContDlv-libs-releases</name>
            <url>http://artifactory.corp.local.com/artifactory/libs-release-local</url>
        </repository>
        <repository>
            <id>codehaus-mule-repo</id>
            <name>codehaus-mule-repo</name>
            <url>https://repository.mulesoft.org/nexus/content/groups/public/</url>
            <layout>default</layout>
        </repository>
    </repositories>
    <pluginRepositories>
        <pluginRepository>
            <id>mulesoft-release</id>
            <name>mulesoft release repository</name>
            <layout>default</layout>
            <url>http://repository.mulesoft.org/releases/</url>
            <snapshots>
                <enabled>false</enabled>
            </snapshots>
        </pluginRepository>
    </pluginRepositories>

</project>

A: src/main/resources is a default resource directory as per Maven conventions. So anything in src/main/resources will end up in the resultant jar file - The maven resources plugin will copy/filter these to target/classes directory which gets packaged later on.
If you want to add additional resource directories, then have a look at the Maven documentation
 <build>
   ...
   <resources>
     <resource>
       <directory>src/main/cxf</directory>
     </resource>
   </resources>
   ...
 </build>

The build helper plugin's add-resource mojo can also add extra resource directories, but in this case it should be easier to declare an extra resource directory in the build section as mentioned in the Maven resource plugin's documentation.


text:
Q: Google Apps Script: Avoid urlfetch errors by updating to a Standard GCP I have a very simple question which is if we can avoid the error:

Exception: Service invoked too many times for one day: urlfetch.

by attaching our Google Apps Script to a Google Cloud Project?
The current quota is 20K to 100K a day depending if you have a Free or a Google Workspace account.
At this point I would be OK if I had to pay Google for any executions over the limit. Is it possible?
The steps I've taken so far:

*

*Create GCP project

*Link Google Apps Script to GCP project

*Set up the OAuth of the GCP project

In case it is possible I think I'm missing an additional step to confirm Google I'd like to pay for any extra processing time that the GAS project requires, can anyone please confirm/point me to an example on how to set it up?
UPDATE:
I'm starting to look if that quota can be modified on this IAM & Admin -> Quotas section

A: You can take a look on your Quotas page at your GCP project:
Cloud Functions Quotas Page
When you reach a quota limit
When a function consumes all of an allocated resource, the resource becomes unavailable until the quota is refreshed or increased. This may mean that your function and all other functions in the same project will not work until then. A function returns an HTTP 500 error code when one of the resources is over quota and the function cannot execute.
To increase quotas above the defaults listed here, go to the Cloud Functions Quotas Page, select the quotas you want to modify, click EDIT QUOTAS, supply your user information if prompted, and enter the new quota limit for each quota you selected.
i don't know if your project is firebase related, but can take a look at complete article about quotas in this link:
Quotas and limits


text:
Q: pass in vue data into a component but I have other props too I have data in App.vue that looks like this:
data() {
    return {
        information: {
          item1: 'item 1 string',
          item2: 'item 2 string',
          item3: 'item 3 string'
        }
    }
},

I want to pass this info into a component like this:
<ComponentName prop="something-else" info=this.data.information.item1 />
But I don't get the data, I just get the string..?
Passing data to components in vue.js
SO I go:
<ComponentName prop="something-else" :info=this.data.information.item1>
But my whole page goes blank
Vue JS 3: How to pass data from one component to another other?
I'm a little bit confused by this one but then I found
Passing the data into component in vuejs
So I added basically like, a static method
<ComponentName prop="something-else" information=information.item1>

methods: {
    information() {
      this.information.item1 = information.item1
    }
},

But I get an error about duplicated key and a no-undef error.
How do you pass data from vue into a component?

A: You should access directly the data returned from the data option and bind it to the prop :
<ComponentName :info="information.item1">

A: When writing with HTML, you never write data, this, methods or computed. You just write the data, method, computed property directly etc.
<ComponentName :info=information.item1 />

You get an duplicate key error because your method information already exist as an property key inside your data
With : you bind something. Without : you just pass an string
I mean, by just looking at the examples you should figure it out that they never use data or this inside the template
https://vuejs.org/guide/essentials/forms.html

A: I think what you need to do is register the props.
For Example.
The Vue component
<componentName :lists="lists"></componentName>
Then in your component register the props
props: ['lists'],
data() {
    return {
        information: {
          item1: 'item 1 string',
          item2: 'item 2 string',
          item3: 'item 3 string'
        }
    }
}

Let me know if this helps you.