text:
Q: Particular case of iteration through pandas dataframe I would like to fill dataframe columns with the time difference between the current timestamp
and the closest timestamp of "type A" or "not type A", respectively, i.e. type_A = 1 or type_A = 0.
The following shows a small example:
import numpy as np
import pandas as pd
from datetime import datetime

df = pd.DataFrame({'id':[1,2,3,4],
                   'tmstmp':[datetime(2018,5,4,13,27,10), datetime(2018,5,3,13,27,10),
                             datetime(2018,5,2,13,27,10), datetime(2018,5,1,13,27,10)],
                   'type_A':[0, 1, 0, 1],
                   'dt_A': [np.nan]*4,
                   'dt_notA': [np.nan]*4
                  })

(A and non-A rows do not necessarily alternate, but the timestamp column is
already sorted in descending order).
I calculate the time difference between the timestamp in the current row and the next row with type_A=1 or type_A=0, respectively, by iterating over the integer row index and access elements by this integer index and the column name:
keys = {1: 'dt_A', 0: 'dt_notA'}
ridx = 0
while ridx + 1 < df.shape[0]:
    ts1 = df.iloc[ridx]['tmstmp']
    ts2 = df.iloc[ridx + 1]['tmstmp']
    found = 0 if df.iloc[ridx + 1]['type_A'] == 0 else 1
    key = keys[found]
    df.loc[ridx, key] = (ts1 - ts2).total_seconds()/3600
    complement = 1 - found
    j = 2
    while ridx + j < df.shape[0] and df.iloc[ridx + j]['type_A'] != complement:
        j += 1
    if ridx + j < df.shape[0]:
        ts1 = df.iloc[ridx]['tmstmp']
        ts2 = df.iloc[ridx + j]['tmstmp']
        val = (ts1 - ts2).total_seconds()/3600
    else:
        val = np.nan
    df.loc[ridx, keys[complement]] = val
    ridx += 1

Iteration over a dataframe is "discouraged from" for efficiency reasons (see How to iterate over rows in a DataFrame in Pandas? )
and using integer indices is even less "pythonic", so my question is: in this particular case, is there a "better" (more efficient, more pythonic)
way to iterate over the dataframe to achieve the given task?
Many thanks for any suggestions or thoughts!
Edit: the input and output dataframes for the small example - the column dt_A contains the time deltas between the current row and the next one that has type_A = 1, dt_notA contains the time deltas with the closest row that has type_A = 0.
input:
   id              tmstmp  type_A  dt_A  dt_notA
0   1 2018-05-04 13:27:10       0   NaN      NaN
1   2 2018-05-03 13:27:10       1   NaN      NaN
2   3 2018-05-02 13:27:10       0   NaN      NaN
3   4 2018-05-01 13:27:10       1   NaN      NaN

output:
   id              tmstmp  type_A  dt_A  dt_notA
0   1 2018-05-04 13:27:10       0  24.0     48.0
1   2 2018-05-03 13:27:10       1  48.0     24.0
2   3 2018-05-02 13:27:10       0  24.0      NaN
3   4 2018-05-01 13:27:10       1   NaN      NaN

A: def next_value_index(l, i, val):
    """Return index of l where val occurs next from position i."""
    try:
        return l[(i+1):].index(val) + (i + 1)
    except ValueError:
        return np.nan

def next_value_indexes(l, val):
    """Return for each position in l next-occurrence-indexes of val in l."""
    return np.array([next_value_index(l, i, val) for i, _ in enumerate(l)])

def nan_allowing_access(df, col, indexes):
    """Return df[col] indexed by indexes. A np.nan would cause errors.
    This function returns np.nan where index is np.nan."""
    idxs = np.array([idx if not np.isnan(idx) else 0 for idx in indexes])
    res = df[col].iloc[idxs]
    res[np.isnan(indexes)] = np.nan
    return res # NaT for timestamps

def diff_timestamps(dfcol1, dfcol2): # timestamp columns of pandas subtraction
    return [x - y for x, y in zip(list(dfcol1), list(dfcol2))]
    # this is not optimal in speed, but numpy did unwanted type conversions
    # problem is: np.array(df[tmstmp_col]) converts to `dtype='datetime64[ns]'`

def td2hours(timedelta): # convert timedelta to hours
    return timedelta.total_seconds() / 3600

def time_diff_to_next_val(df, tmstmp_col, col, val, converter_func, flip_subtraction=False):
    """
    Return time differences (timestamps are given in tmstmp_col column
    of the pandas data frame `df`) from the row's timestamp to the next
    time stamp of the row, which has in column `col` the next occurrence
    of value given in `val` in the data frame.

    converter_func is the function used to convert the timedelta
             value.
    flip_subtraction determines the order of subtraction: whether take current row's
             timestamp first or not when subtracting
    """
    next_val_indexes = next_value_indexes(df[col].tolist(), val)
    next_val_timestamps = nan_allowing_access(df, tmstmp_col, next_val_indexes)
    return [converter_func(x) for x in diff_timestamps(*(df[tmstmp_col], next_val_timestamps)[::(1-2*flip_subtraction)])]
    # `*(df[tmstmp_col], next_val_timestamps)[::(1-2*flip_subtraction)]`
    # flips the order of arguments when `flip_subtraction = True`

Apply the functions by:
df['dt_A'] = time_diff_to_next_val(df,'tmstmp', 'type_A', 1, converter_func = td2hours)
df['dt_notA'] = time_diff_to_next_val(df,'tmstmp', 'type_A', 0, converter_func = td2hours)

Then df becomes:
   id              tmstmp  type_A  dt_A  dt_notA
0   1 2018-05-04 13:27:10       0  24.0     48.0
1   2 2018-05-03 13:27:10       1  48.0     24.0
2   3 2018-05-02 13:27:10       0  24.0      NaN
3   4 2018-05-01 13:27:10       1   NaN      NaN


text:
Q: going to another xml from the main xml I m totally new to program and I m trying to make a simple app.
I need to jump from one xml to another xml by clicking a button, and I m stopped here.
I only know how to use graphical layout and how should I do it???
I want to jump from Activity_Main.xml to 2bb.xml, and 2bb.xml to 2result.xml and at last from 2result.xml back to Activity_Main.xml.
my A_M.xml
<GridLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/container"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:columnCount="1"
tools:context="com.example.soo.MainActivity"
tools:ignore="MergeRootFrame,NewApi,UnusedAttribute" >

<Button
    android:id="@+id/button1"
    android:layout_width="150dp"
    android:layout_height="215dp"
    android:layout_column="0"
    android:layout_gravity="left|top"
    android:layout_row="0"
    android:text="@string/B2"
    android:onClick="2bb" />

A: There are a few ways to achieve this, depends on what your looking for.
You can call a new activity from your MainActivity and inflate 2bb.xml when the new activity is created, or you can use different fragments, and just transition between fragments in the same activity. I suggest going over some tutorials regarding Activities and Fragments in Android.

A: Try this
To go to other xml, you have to create one activity for one xml and each button has to put action startactivity.

redpajama_set_name: RedPajamaStackExchange


text:
Q: Intellij: Making a project dependent on another project? I am new to using Intellij and I am facing a problem. I have a project, which is dependent on another project and this second project is integrated using maven repository. So when I work on my project, maven handles everything perfectly and everything is working. But the second project is under development and there are frequent updates which are not in maven repository yet. So what I want to do is to make my first project directly dependent on the second project(it is present in my local system). So that the second project is referred directly from the code and not maven repo. Is it possible in Intellij. I have done this in Eclipse but not able to do it in Intellij. Any help will be usesful.
Thanks

A: You should be able to configure this in IntelliJ IDEA's Project properties (cmd + ; on Mac, ctrl + alt + shift + s on Windows/Linux).  Select "Modules", select the dependencies tab on the right, and add the dependent module to the module.


text:
Q: cannot access state in componentDidMount I am using library react-google-maps, and i want to use DirectionsRenderer between two nodes.
Here is my state
this.state={
    currentPosition:{lat: 26.84 ,lng: 75.80},
    destinationPosition:{lat: 26.84 ,lng: 75.80},
};

I want to show the direction between my current location and marker. And my componentDidMount() is inside render method.
Here is the code for render method
class map extends React.PureComponent{
    constructor(props){
        super(props);
        this.state={
            currentPosition:{lat: 26.84 ,lng: 75.80},
            destinationPosition:{lat: 26.84 ,lng: 75.80},
            direction:false
        };
    }
    onMarkerPositionChanged(e){
        this.setState((state)=>({
            destinationPosition:{lat:e.latLng.lat(),lng:e.latLng.lng()}}));
    }
    handleClick(){
        if(navigator.geolocation){
            navigator.geolocation.getCurrentPosition((position)=>{
                this.setState(()=>({
                    currentPosition:{lat:position.coords.latitude,lng:position.coords.longitude}}))
            });
        }
        else{
            alert("Geoloaction is not supported by your browser");
        }
    }
    changeDir(){
        if(this.state.direction)
            this.setState(()=>({direction:false}))
        else
            this.setState(()=>({direction:true}))
    }
    render(){
        const MyMapComponent = compose(
          withProps({
            googleMapURL: "https://maps.googleapis.com/maps/api/js?key=AIzaSyC5VMMlyr_A6K5ycpOrq3OsVM8YYbn0q3A&v=3.exp&libraries=geometry,drawing,places",
            loadingElement: <div style={{ height: `100%` }} />,
            containerElement: <div style={{ height: `300px` }} />,
            mapElement: <div style={{ height: `100%` }} />,
          }),
          withScriptjs,
          withGoogleMap,
          lifecycle({
            componentDidMount() {
                const google=window.google;
                console.log(this.state);
//--->this statement prints null
                const DirectionsService = new google.maps.DirectionsService();
                DirectionsService.route({
                origin: new google.maps.LatLng(this.state.currentPosition.lat, this.state.currentPosition.lng),
                destination: new google.maps.LatLng(this.state.destinationPosition.lat,this.state.destinationPosition.lng),
//---->  this is where i want to use the state to get the direction between //current location and marker
                travelMode: google.maps.TravelMode.DRIVING,
                }, (result, status) => {
                if (status === google.maps.DirectionsStatus.OK) {
                  this.setState({
                    directions: result,
                  });
                } else {
                  console.error(`error fetching directions ${result}`);
                }
              });
            }
          })
        )(
        props =>
          <GoogleMap defaultZoom={15} defaultCenter={this.state.destinationPosition} >
            <Marker position={this.state.destinationPosition} draggable changeLat
                onDragEnd={this.onMarkerPositionChanged.bind(this)}
            />
            <Marker
                icon="https://www.robotwoods.com/dev/misc/bluecircle.png"
                position={this.state.currentPosition}
            />
            {this.state.direction && props.directions && <DirectionsRenderer directions={props.directions} />}
            <Button bsStyle="success" onClick={this.handleClick.bind(this)}>Current Position</Button>
            <Button bsStyle="success" onClick={this.changeDir.bind(this)}>Get Direction</Button>
          </GoogleMap>
        );
        return(
            <Container state={this.state} map={MyMapComponent}/>
        );
    }
}
export default map;

when i use constant numbers in place of origin and destination it works fine.

A: First things first, change the name of the component map to Map. Have a read at this SO post.
Now, regarding this:

when i use constant numbers in place of origin and destination it works fine.

The answer to this question has a background, continue reading the following so that it is more clear.
The problem of the this context
In your code, you have a map component, and you can access any of its properties (including the state) with this. If you call this.state inside the render function for example, you will get the state of map. You can use the componentDidMount function of the map component, to, for example, set a value in the state, like this:
class map extends Component {

  constructor(props){
    this.state = { myVal: 1}
  }

  componentDidMount(){
    this.setState({ myVal: 2})
  }
}

This code will not fail, because componentDidMount is a React function for the component, and this can be used inside the component because it's in the same context. In this case, this.setState will set the state of map, because this is map.
This is the code of the example you provided:
const { compose, withProps, lifecycle } = require("recompose"); const {   withScriptjs,   withGoogleMap,   GoogleMap,   DirectionsRenderer, } = require("react-google-maps");

const MapWithADirectionsRenderer = compose(   withProps({
    googleMapURL: "https://maps.googleapis.com/maps/api/js?key=AIzaSyC4R6AN7SmujjPUIGKdyao2Kqitzr1kiRg&v=3.exp&libraries=geometry,drawing,places",
    loadingElement: <div style={{ height: `100%` }} />,
    containerElement: <div style={{ height: `400px` }} />,
    mapElement: <div style={{ height: `100%` }} />,   }),   withScriptjs,   withGoogleMap,   lifecycle({
    componentDidMount() {
      const DirectionsService = new google.maps.DirectionsService();

      DirectionsService.route({
        origin: new google.maps.LatLng(41.8507300, -87.6512600),
        destination: new google.maps.LatLng(41.8525800, -87.6514100),
        travelMode: google.maps.TravelMode.DRIVING,
      }, (result, status) => {
        if (status === google.maps.DirectionsStatus.OK) {
          this.setState({
            directions: result,
          });
        } else {
          console.error(`error fetching directions ${result}`);
        }
      });
    }   }) )(props =>   <GoogleMap
    defaultZoom={7}
    defaultCenter={new google.maps.LatLng(41.8507300, -87.6512600)}
  >
    {props.directions && <DirectionsRenderer directions={props.directions} />}   </GoogleMap> );

<MapWithADirectionsRenderer />

In this example, this.setState refers to the context of MapWithADirectionsRenderer, so this.setState is setting the state of MapWithADirectionsRenderer, because this is MapWithADirectionsRenderer.
Now, in your code you are creating a new component called MyMapComponent as a const object. This component lets you define the componentDidMount function of that new component. That new component will have it's own context, so when you write this inside the MyMapComponent component, it will refer to MyMapComponent, not to map.
You cannot access the state of map from within MyMapComponent like that, you have to pass props to MyMapComponent.
Solution
I created a couple of examples on how to pass values.
Solution 1
You can create a prop with any name (in this example it's called test with the value My value):
const MyMapComponent = compose(
  withProps({
    googleMapURL:
      "https://maps.googleapis.com/maps/api/js?key=AIzaSyC5VMMlyr_A6K5ycpOrq3OsVM8YYbn0q3A&v=3.exp&libraries=geometry,drawing,places",
    loadingElement: <div style={{ height: `100%` }} />,
    containerElement: <div style={{ height: `400px` }} />,
    mapElement: <div style={{ height: `100%` }} />,
    test:'My value'
  }),
  lifecycle({
    componentDidMount() {
      console.log(JSON.stringify(this.props.test));
    }
  }),
  withScriptjs,
  withGoogleMap,
)(props => (
  <GoogleMap defaultZoom={8} defaultCenter={{ lat: -34.397, lng: 150.644 }}>
    {props.isMarkerShown && (
      <Marker position={{ lat: -34.397, lng: 150.644 }} />
    )}
  </GoogleMap>
));

This way, you can log this.props.test with the given value, whatever you use.
Solution 2
If what you need is to render the component depending on the value found in the state of Map, use something like this.
You can pass props to MyMapComponent an then access them using props. and adding the name of the prop.
For example if you pass a new prop called latProp like this:
<MyMapComponent isMarkerShown latProp={-34.397} />

You can access it like this:
(props => (
  <GoogleMap defaultZoom={8} defaultCenter={{ lat: -34.397, lng: 150.644 }}>
    {props.isMarkerShown && (
      <Marker position={{ lat: props.latProp, lng: 150.644 }} />
    )}
  </GoogleMap>
));

Since what you want is to replace the constant value with what you have in the state, just replace the values sent in props.latProp with whatever property you have in the state:
<MyMapComponent isMarkerShown latProp={this.state.lat} />

This is the complete component:
const MyMapComponent = compose(
  withProps({
    googleMapURL:
      "https://maps.googleapis.com/maps/api/js?key=AIzaSyC5VMMlyr_A6K5ycpOrq3OsVM8YYbn0q3A&v=3.exp&libraries=geometry,drawing,places",
    loadingElement: <div style={{ height: `100%` }} />,
    containerElement: <div style={{ height: `400px` }} />,
    mapElement: <div style={{ height: `100%` }} />,
  }),
  withScriptjs,
  withGoogleMap,
)(props => (
  <GoogleMap defaultZoom={8} defaultCenter={{ lat: -34.397, lng: 150.644 }}>
    {props.isMarkerShown && (
      <Marker position={{ lat: props.latProp, lng: props.lngProp }} />
    )}
  </GoogleMap>
));

class App extends Component{
  constructor(props){
    super(props);
    this.state = { lat: -34.400, lng: 151.644 }
  }
  render(){
    return (

        <MyMapComponent isMarkerShown latProp={this.state.lat} lngProp={this.state.lng} />

    );
  }
}
export default App;


text:
Q: how can i change call voice on demand in android? (change man to woman and etc) i need change instream and outstream of voice call.
for example change voice of man to woman or change human voice to cartoon voice . on-demand
if you have any idea or android source code , please share it

A: You can make use of google glass project same as reference. Here is the extract \
here
package com.google.android.glass.sample.waveform;

import android.app.Activity;
import android.media.AudioFormat;
import android.media.AudioRecord;
import android.media.MediaRecorder.AudioSource;
import android.os.Bundle;
import android.widget.TextView;

/**
 * Receives audio input from the microphone and displays a visualization of that data as a waveform
 * on the screen.
 */
public class WaveformActivity extends Activity {

    // The sampling rate for the audio recorder.
    private static final int SAMPLING_RATE = 44100;

    private WaveformView mWaveformView;
    private TextView mDecibelView;

    private RecordingThread mRecordingThread;
    private int mBufferSize;
    private short[] mAudioBuffer;
    private String mDecibelFormat;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.layout_waveform);

        mWaveformView = (WaveformView) findViewById(R.id.waveform_view);
        mDecibelView = (TextView) findViewById(R.id.decibel_view);

        // Compute the minimum required audio buffer size and allocate the buffer.
        mBufferSize = AudioRecord.getMinBufferSize(SAMPLING_RATE, AudioFormat.CHANNEL_IN_MONO,
                AudioFormat.ENCODING_PCM_16BIT);
        mAudioBuffer = new short[mBufferSize / 2];

        mDecibelFormat = getResources().getString(R.string.decibel_format);
    }

    @Override
    protected void onResume() {
        super.onResume();

        mRecordingThread = new RecordingThread();
        mRecordingThread.start();
    }

    @Override
    protected void onPause() {
        super.onPause();

        if (mRecordingThread != null) {
            mRecordingThread.stopRunning();
            mRecordingThread = null;
        }
    }

    /**
     * A background thread that receives audio from the microphone and sends it to the waveform
     * visualizing view.
     */
    private class RecordingThread extends Thread {

        private boolean mShouldContinue = true;

        @Override
        public void run() {
            android.os.Process.setThreadPriority(android.os.Process.THREAD_PRIORITY_AUDIO);

            AudioRecord record = new AudioRecord(AudioSource.MIC, SAMPLING_RATE,
                    AudioFormat.CHANNEL_IN_MONO, AudioFormat.ENCODING_PCM_16BIT, mBufferSize);
            record.startRecording();

            while (shouldContinue()) {
                record.read(mAudioBuffer, 0, mBufferSize / 2);
                mWaveformView.updateAudioData(mAudioBuffer);
                updateDecibelLevel();
            }

            record.stop();
            record.release();
        }

        /**
         * Gets a value indicating whether the thread should continue running.
         *
         * @return true if the thread should continue running or false if it should stop
         */
        private synchronized boolean shouldContinue() {
            return mShouldContinue;
        }

        /** Notifies the thread that it should stop running at the next opportunity. */
        public synchronized void stopRunning() {
            mShouldContinue = false;
        }

        /**
         * Computes the decibel level of the current sound buffer and updates the appropriate text
         * view.
         */
        private void updateDecibelLevel() {
            // Compute the root-mean-squared of the sound buffer and then apply the formula for
            // computing the decibel level, 20 * log_10(rms). This is an uncalibrated calculation
            // that assumes no noise in the samples; with 16-bit recording, it can range from
            // -90 dB to 0 dB.
            double sum = 0;

            for (short rawSample : mAudioBuffer) {
                double sample = rawSample / 32768.0;
                sum += sample * sample;
            }

            double rms = Math.sqrt(sum / mAudioBuffer.length);
            final double db = 20 * Math.log10(rms);

            // Update the text view on the main thread.
            mDecibelView.post(new Runnable() {
                @Override
                public void run() {
                    mDecibelView.setText(String.format(mDecibelFormat, db));
                }
            });
        }
    }
}


text:
Q: \includegraphics undefined in XeLaTeX, but fine in LaTeX in TexLive 2017 I recently upgraded from TexLive 2016 to TexLive 2017.  After the upgrade, \includegraphics now throws an "Undefined control sequence" error—but only if I typeset with XeLaTeX... It works without issue under regular LaTeX.  It also works fine under XeLaTeX if I switch back to TeXLive 2016.
I've tried:

*

*Different filetypes

*Reinstalling graphics/graphicx

*Different TeX editors/command line

Any help would be very much appreciated.
MWE:
\documentclass[letterpaper,12pt]{article}
\usepackage{graphicx}
\begin{document}
    Hello world
    \includegraphics{test.png}
\end{document}

Log:
This is XeTeX, Version 3.14159265-2.6-0.99998 (TeX Live 2017) (preloaded format=xelatex 2017.9.11)  13 SEP 2017     14:22
entering extended mode
 restricted \write18 enabled.
 %&-line parsing enabled.
**/Users/abraver/Desktop/tmp/textest/untitled.tex
(/Users/abraver/Desktop/tmp/textest/untitled.tex
LaTeX2e <2017-04-15>
Babel <3.12> and hyphenation patterns for 84 language(s) loaded.
(/usr/local/texlive/2017/texmf-dist/tex/latex/base/article.cls
Document Class: article 2014/09/29 v1.4h Standard LaTeX document class
(/usr/local/texlive/2017/texmf-dist/tex/latex/base/size12.clo
File: size12.clo 2014/09/29 v1.4h Standard LaTeX file (size option)
)
\c@part=\count79
\c@section=\count80
\c@subsection=\count81
\c@subsubsection=\count82
\c@paragraph=\count83
\c@subparagraph=\count84
\c@figure=\count85
\c@table=\count86
\abovecaptionskip=\skip41
\belowcaptionskip=\skip42
\bibindent=\dimen102
) (/Users/abraver/Library/texmf/tex/latex/graphics/graphicx.sty
Package: graphicx 1999/02/16 v1.0f Enhanced LaTeX Graphics (DPC,SPQR)
(/Users/abraver/Library/texmf/tex/latex/graphics/keyval.sty
Package: keyval 1999/03/16 v1.13 key=value parser (DPC)
\KV@toks@=\toks14
) (/Users/abraver/Library/texmf/tex/latex/graphics/graphics.sty
Package: graphics 2006/02/20 v1.0o Standard LaTeX Graphics (DPC,SPQR)
(/Users/abraver/Library/texmf/tex/latex/graphics/trig.sty
Package: trig 1999/03/16 v1.09 sin cos tan (DPC)
) (/usr/local/texlive/2017/texmf-dist/tex/latex/graphics-cfg/graphics.cfg
File: graphics.cfg 2016/06/04 v1.11 sample graphics configuration
)
Package graphics Info: Driver file: xetex.def on input line 90.
(/usr/local/texlive/2017/texmf-dist/tex/latex/graphics-def/xetex.def
File: xetex.def 2017/06/24 v5.0h Graphics/color driver for xetex
))
\Gin@req@height=\dimen103
\Gin@req@width=\dimen104
) (/Users/abraver/Desktop/tmp/textest/untitled.aux)
\openout1 = `untitled.aux'.

LaTeX Font Info:    Checking defaults for OML/cmm/m/it on input line 8.
LaTeX Font Info:    ... okay on input line 8.
LaTeX Font Info:    Checking defaults for T1/cmr/m/n on input line 8.
LaTeX Font Info:    ... okay on input line 8.
LaTeX Font Info:    Checking defaults for OT1/cmr/m/n on input line 8.
LaTeX Font Info:    ... okay on input line 8.
LaTeX Font Info:    Checking defaults for OMS/cmsy/m/n on input line 8.
LaTeX Font Info:    ... okay on input line 8.
LaTeX Font Info:    Checking defaults for TU/lmr/m/n on input line 8.
LaTeX Font Info:    ... okay on input line 8.
LaTeX Font Info:    Checking defaults for OMX/cmex/m/n on input line 8.
LaTeX Font Info:    ... okay on input line 8.
LaTeX Font Info:    Checking defaults for U/cmr/m/n on input line 8.
LaTeX Font Info:    ... okay on input line 8.
File: test.png Graphic file (type bmp)
! Undefined control sequence.
\Ginclude@bmp #1->\Gin@log
                           {<#1>}\bgroup \def \@tempa {!}\special {pdf:image...
l.12 \includegraphics{test.png}

The control sequence at the end of the top line
of your error message was never \def'ed. If you have
misspelled it (e.g., `\hobx'), type `I' and the correct
spelling (e.g., `I\hbox'). Otherwise just continue,
and I'll forget about whatever was undefined.

Overfull \hbox (161.9937pt too wide) in paragraph at lines 12--13
[][]
 []

[1

] (/Users/abraver/Desktop/tmp/textest/untitled.aux) )
Here is how much of TeX's memory you used:
 568 strings out of 492998
 7215 string characters out of 6134491
 66519 words of memory out of 5000000
 4607 multiletter control sequences out of 15000+600000
 3648 words of font info for 15 fonts, out of 8000000 for 9000
 1348 hyphenation exceptions out of 8191
 25i,4n,19p,220b,107s stack positions out of 5000i,500n,10000p,200000b,80000s

Output written on /Users/abraver/Desktop/tmp/textest/untitled.pdf (1 page).

A: The undefined command, as shown in the log file you posted is \Gin@log not \includegraphics. Most likely this is because you are using graphics.sty from one installation but a xetex.def from a different place.
You have a local copy of graphics.sty from 1999!!!!
/Users/abraver/Library/texmf/tex/latex/graphics/graphicx.sty
Package: graphicx 1999/02/16 v1.0f Enhanced LaTeX Graphics (DPC,SPQR)

and a 2017 copy of the xetex-specific part, xetex.def
/usr/local/texlive/2017/texmf-dist/tex/latex/graphics-def/xetex.def
File: xetex.def 2017/06/24 v5.0h Graphics/color driver for xetex


text:
Q: Simple poset topology question What are the open sets on {a,b,c,d} with the poset topology?
The relation is $a\leq b\leq c$ and $a\leq d.$
I know that the sets {x|x<=a} form a basis.
I get a basis is {a,b,c,d}, {b,c}, {c}, {d}
So the open sets are {a,b,c,d}, {b,c}, {c}, {d}, {c,d}, {b,c,d}, empty set.
Is this correct?


text:
Q: Hide a I have a foreach look that checks if user has a picture or not. If the user doesn't have the picture I want to hide a
 tab that shows the picture.

Inside my else how do I say, for this user hide tab 2?
I tried using echo 'id="tabHeader_2" style:"visibility:hidden"; but that doesn't work. I need a reference to that tab2, don't I?
<div id="picture<?php echo $i ?>" style="display: none;">
<?php
      $picture = $user->pic;
      if(isset($picture))
      {
         // show picture.
      }
      else
      {
        // hide tab2
      }
  ?>

Then the list of tabs:

 Profile

 Picture

Picture of what the page looks like:

A: I am not 100% sure about your code, but you are using isset() which would not be correct, because you set the variable right behind that check so it will be set 100% of the time. You will want to check empty() or is_file() perhaps, depends on what is in that variable.

<div id="picture<?php echo $i ?>" style="display: none;">
<?php

      $picture = $user->pic;
      if(!empty($picture)) {
         // show picture.
      }
      else {
        // hide tab2
      }
  ?>

If you put the real code, it would be easier to see how you are laying out your elements.

A: Do Like This :-

      <?php
      $i = 1;
      foreach($yourarray as $key => $value){
           if(isset($value) && $value != '')
           ?>
               <li id="tabProfileHeader<?php echo $i;?>"> Profile

               <li id="tabPictureHeader<?php echo $i;?>"> Picture

            <?php
         $i++;
         }
         ?>


text:
Q: Excel VBA: How to consolidate specific worksheets in the same workbook? I have a workbook with 10 worksheets, 6 of which need to be consolidated into a single worksheet.  Those 6 all have the same header row.  I can get my code to work some of the time.  However, if one of the worksheets is empty (only has the header row), the header will be copied to the new consolidated sheet.
I have tried adding an "On Error Resume Next", which only prevents an error from being generated. It still only copies the header row.
Sub Combine()
    Dim s As Worksheet

    On Error Resume Next
    Application.DisplayAlerts = False

    Sheets("All").Delete 'These sheets don't need to be kept or consolidated
    Sheets("005").Delete
    Sheets("006").Delete
    Sheets("007").Delete

    Application.DisplayAlerts = True
    On Error GoTo 0

    Sheets(1).Select
    Worksheets.Add
    Sheets(1).Name = "0"

    Sheets(2).Activate
    Range("A1").EntireRow.Select
    Selection.Copy Destination:=Sheets(1).Range("A1")

    For Each s In ActiveWorkbook.Sheets
            If s.Name <> "0" Then
                Application.GoTo Sheets(s.Name).[a1]
                Selection.CurrentRegion.Select
                'On Error Resume Next
                Selection.Offset(1, 0).Resize(Selection.Rows.Count - 1).Select
                Selection.Copy Destination:=Sheets("0"). _
                Cells(Rows.Count, 1).End(xlUp)(2)
                'On Error GoTo 0
            End If
        Next
End Sub

I need to have the macro copy only filled rows below the header and skip over any sheets that happen to be blank.

A: Something like this  -some other suggestions in here:
Sub Combine()

    Dim s As Worksheet, wb As Workbook, wsDest As Worksheet, rngCopy As Range

    Set wb = ActiveWorkbook  '<< always specify a workbook

    Application.DisplayAlerts = False
    On Error Resume Next
    wb.Sheets("All").Delete 'These sheets don't need to be kept or consolidated
    wb.Sheets("005").Delete
    wb.Sheets("006").Delete
    wb.Sheets("007").Delete
    On Error GoTo 0
    Application.DisplayAlerts = True

    'get a direct reference to the newly-added sheet
    Set wsDest = wb.Worksheets.Add(before:=wb.Worksheets(1))
    wsDest.Name = "0"

    wb.Sheets(2).Range("A1").EntireRow.Copy Destination:=wsDest.Range("A1")

    For Each s In ActiveWorkbook.Sheets
        If s.Name <> wsDest.Name Then    '<< remove hard-coded name
            Set rngCopy = s.Range("A1").CurrentRegion
            'check how many rows before copying
            If rngCopy.Rows.Count > 1 Then
                'no need for select/activate
                rngCopy.Offset(1, 0).Resize(rngCopy.Rows.Count - 1).Copy _
                   wsDest.Cells(Rows.Count, 1).End(xlUp).Offset(1, 0)
            End If
        End If
    Next s
End Sub


text:
Q: Refresh content jQuery I'm working on a little project, and I'm making a content show with radio buttons, something like a slideshow gallery, but what i'm trying to do is a big container with  many divs inside with a opacity:1; all  this overlapping 3 containers more with the same characteristics, so when somebody give a clic in a radio button, the  container with opacity:1; will get a opacity:0; and the overlapped container  by the container with opacity:1;  will be visible.
the main problem that I get is when I clic in a radio button to change the content, this (content) doesn't appears until I reload the page, can somebody tell me why this happen? and how to solve it?
Thanks!

$(document).ready(function(){

$("#op1").prop('checked',true);
$("#op2").prop('checked',true);
$("#op3").prop('checked',true);
$("#op4").prop('checked',true);
//$("#x").prop('checked',false);

if ($("#op1").is(':checked')) {
    if ($('#cont1').hasClass('contenedor-fotos-opacity'))
    {
       $('#cont1').removeClass('contenedor-fotos-opacity').addClass('contenedor-fotos1');
    }
     $('.contenedor-fotos2').removeClass('contenedor-fotos2').addClass('contenedor-fotos-opacity');
     $('.contenedor-fotos3').removeClass('contenedor-fotos3').addClass('contenedor-fotos-opacity');
     $('.contenedor-fotos4').removeClass('contenedor-fotos4').addClass('contenedor-fotos-opacity');

 }

if ($("#op2").is(':checked')) {
     if ($('#cont2').hasClass('contenedor-fotos-opacity'))
    {
       $('#cont2').removeClass('contenedor-fotos-opacity').addClass('contenedor-fotos2');
    }
     $('.contenedor-fotos1').removeClass('contenedor-fotos1').addClass('contenedor-fotos-opacity');
     $('.contenedor-fotos3').removeClass('contenedor-fotos3').addClass('contenedor-fotos-opacity');
     $('.contenedor-fotos4').removeClass('contenedor-fotos4').addClass('contenedor-fotos-opacity');

 }

if ($("#op3").is(':checked')) {
     if ($('#cont3').hasClass('contenedor-fotos-opacity'))
    {
       $('#cont3').removeClass('contenedor-fotos-opacity').addClass('contenedor-fotos3');
    }
     $('.contenedor-fotos1').removeClass('contenedor-fotos1').addClass('contenedor-fotos-opacity');
     $('.contenedor-fotos2').removeClass('contenedor-fotos2').addClass('contenedor-fotos-opacity');
     $('.contenedor-fotos4').removeClass('contenedor-fotos4').addClass('contenedor-fotos-opacity');

 }

if ($("#op4").is(':checked')) {
     if ($('#cont4').hasClass('contenedor-fotos-opacity'))
    {
       $('#cont4').removeClass('contenedor-fotos-opacity').addClass('contenedor-fotos4');
    }
     $('.contenedor-fotos1').removeClass('contenedor-fotos1').addClass('contenedor-fotos-opacity');
     $('.contenedor-fotos2').removeClass('contenedor-fotos2').addClass('contenedor-fotos-opacity');
     $('.contenedor-fotos3').removeClass('contenedor-fotos3').addClass('contenedor-fotos-opacity');

 }

});
#contenedor-portafolio {

    position: relative;
    width: 100%;
    background: #222;
}

.fotos-portolio {
    width: 300px;
    height: 300px;
    display: inline-block;
    margin-left: 15px;
    margin-top: 15px;
    overflow: hidden;
    background: #444;
}

.contenedor-fotos1 {
    width: 90%;
    position: absolute;
    margin-left: 5%;
    background: red;
    z-index: 10;
}

.contenedor-fotos-opacity {
    width: 90%;
    position: absolute;
    margin-left: 5%;
    opacity:0;
    z-index: 10;
}

.contenedor-fotos2 {
    width: 90%;
    position: absolute;
    margin-left: 5%;
    background: green;
    z-index: 11;
}

.contenedor-fotos3 {
     width: 90%;
    position: absolute;
    margin-left: 5%;
    background: blue;
    z-index: 12;
}

.contenedor-fotos4 {
     width: 90%;
    position: absolute;
    margin-left: 5%;
    background: yellow;
    z-index: 13;
}
<!DOCTYPE html>

        <title>prueba cont-slider</title>
        <meta charset="utf-8"/>
        <link rel="stylesheet" type="text/css" href="css/content-slider.css"/>

            <form>
                <input type="radio" name="opacitylayer" id="op1"/>
                DISEÑO WEB

                <input type="radio" name="opacitylayer" id="op2"/>
                DISEÑO GRÁFICO

                <input type="radio" name="opacitylayer" id="op3"/>
                DISEÑO 3D

                <input type="radio" name="opacitylayer" id="op4"/>
                FOTOGRAFÍA
            </form>

A: You need to use a change handler since you want to run the script whenever user changes the checked status of the radio elements

$(document).ready(function(){

  $("#op2").prop('checked',true);

  $("#op1, #op2, #op3, #op4").on('change', function(){
    if ($("#op1").is(':checked')) {
      if ($('#cont1').hasClass('contenedor-fotos-opacity'))
      {
        $('#cont1').removeClass('contenedor-fotos-opacity').addClass('contenedor-fotos1');
      }
      $('.contenedor-fotos2').removeClass('contenedor-fotos2').addClass('contenedor-fotos-opacity');
      $('.contenedor-fotos3').removeClass('contenedor-fotos3').addClass('contenedor-fotos-opacity');
      $('.contenedor-fotos4').removeClass('contenedor-fotos4').addClass('contenedor-fotos-opacity');

    }

    if ($("#op2").is(':checked')) {
      if ($('#cont2').hasClass('contenedor-fotos-opacity'))
      {
        $('#cont2').removeClass('contenedor-fotos-opacity').addClass('contenedor-fotos2');
      }
      $('.contenedor-fotos1').removeClass('contenedor-fotos1').addClass('contenedor-fotos-opacity');
      $('.contenedor-fotos3').removeClass('contenedor-fotos3').addClass('contenedor-fotos-opacity');
      $('.contenedor-fotos4').removeClass('contenedor-fotos4').addClass('contenedor-fotos-opacity');

    }

    if ($("#op3").is(':checked')) {
      if ($('#cont3').hasClass('contenedor-fotos-opacity'))
      {
        $('#cont3').removeClass('contenedor-fotos-opacity').addClass('contenedor-fotos3');
      }
      $('.contenedor-fotos1').removeClass('contenedor-fotos1').addClass('contenedor-fotos-opacity');
      $('.contenedor-fotos2').removeClass('contenedor-fotos2').addClass('contenedor-fotos-opacity');
      $('.contenedor-fotos4').removeClass('contenedor-fotos4').addClass('contenedor-fotos-opacity');

    }

    if ($("#op4").is(':checked')) {
      if ($('#cont4').hasClass('contenedor-fotos-opacity'))
      {
        $('#cont4').removeClass('contenedor-fotos-opacity').addClass('contenedor-fotos4');
      }
      $('.contenedor-fotos1').removeClass('contenedor-fotos1').addClass('contenedor-fotos-opacity');
      $('.contenedor-fotos2').removeClass('contenedor-fotos2').addClass('contenedor-fotos-opacity');
      $('.contenedor-fotos3').removeClass('contenedor-fotos3').addClass('contenedor-fotos-opacity');

    }
  }).change()
});
#contenedor-portafolio {

    position: relative;
    width: 100%;
    background: #222;
}

.fotos-portolio {
    width: 300px;
    height: 300px;
    display: inline-block;
    margin-left: 15px;
    margin-top: 15px;
    overflow: hidden;
    background: #444;
}

.contenedor-fotos1 {
    width: 90%;
    position: absolute;
    margin-left: 5%;
    background: red;
    z-index: 10;
}

.contenedor-fotos-opacity {
    width: 90%;
    position: absolute;
    margin-left: 5%;
    opacity:0;
    z-index: 10;
}

.contenedor-fotos2 {
    width: 90%;
    position: absolute;
    margin-left: 5%;
    background: green;
    z-index: 11;
}

.contenedor-fotos3 {
     width: 90%;
    position: absolute;
    margin-left: 5%;
    background: blue;
    z-index: 12;
}

.contenedor-fotos4 {
     width: 90%;
    position: absolute;
    margin-left: 5%;
    background: yellow;
    z-index: 13;
}

<!DOCTYPE html>

        <title>prueba cont-slider</title>
        <meta charset="utf-8"/>
        <link rel="stylesheet" type="text/css" href="css/content-slider.css"/>

            <form>
                <input type="radio" name="opacitylayer" id="op1"/>
                DISEÑO WEB

                <input type="radio" name="opacitylayer" id="op2"/>
                DISEÑO GRÁFICO

                <input type="radio" name="opacitylayer" id="op3"/>
                DISEÑO 3D

                <input type="radio" name="opacitylayer" id="op4"/>
                FOTOGRAFÍA
            </form>

You can simplify that to
$(document).ready(function () {

    $("#op2").prop('checked', true);

    var $els = $('#cont1, #cont2, #cont3, #cont4');
    $("#op1, #op2, #op3, #op4").on('change', function () {
        var id = this.id.substring(2), $el = $('#cont'+id);
        if (this.checked) {
            if ($el.hasClass('contenedor-fotos-opacity')) {
                $el.removeClass('contenedor-fotos-opacity').addClass('contenedor-fotos'+id);
            }
            $els.not($el).each(function(){
                $(this).removeClass('contenedor-fotos'+this.id.substring(5))
            }).addClass('contenedor-fotos-opacity')
        }
    }).change()
});

Demo: Fiddle


text:
Q: Is it better to call LocationManager once and keep in memory, or only call it when needed? This is an efficiency question related to LocationManager (and more generally to managing memory vs. CPU usage in Android). Let's say I have a long-running service that wants to use the getLastKnownLocation method of LocationManager every 60 seconds in order to update the location. This service uses a TimerTask and a Time with repeated fixed-delay execution. Is it better to create an instance field mLocationManager and keep it around for the life of the service, or is it better to instantiate LocationManager on each execution of the TimerTask, where supposedly the VM will only keep it around while it is needed? In code:
public class ProximityService extends Service {

    private LocationManager mLocationManager;

    @Override
    public void onCreate() {
        mLocationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
        Timer timer = new Timer();
        TimerTask mGetLastKnownLocationTask = new GetLastKnownLocationTask();
        timer.schedule(mGetLastKnownLocationTask, 0, 60000);
    }

    private class GetLastKnownLocationTask extends TimerTask {

       public void run() {
           Location mLocation =
               mLocationManager.getLastKnownLocation(LocationManager.GPS_PROVIDER);
               // Do something with mLocation
       }
    }
...
}

vs.
...

@Override
public void onCreate() {
    Timer timer = new Timer();
    TimerTask mGetLastKnownLocationTask = new GetLastKnownLocationTask();
    timer.schedule(mGetLastKnownLocationTask, 0, 60000);
}

private class GetLastKnownLocationTask extends TimerTask {

   public void run() {
       LocationManager mLocationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
       Location mLocation =
           mLocationManager.getLastKnownLocation(LocationManager.GPS_PROVIDER);
           // Do something with mLocation
   }
}

Note: I do not require a LocationListener to keep GPS active. That is handled in another part of the application with a separate service. Here I only want to check the most recent known location at a fixed interval.

A: Wouldn't it be better to get the location manager once, and then register a passive location listener? Having to call getLastKnownLocation() is supposed to be a quick solution for when you do not have time to gain a valid location fix, not necessarily for repetitive use.
Like...
    LocationManager lm = (LocationManager)  getSystemService(Context.LOCATION_SERVICE);
    //change best provider to a passive location service.
    String bestProvider = lm.getBestProvider(new Criteria(), true);
    if(bestProvider!=null){
       lm.requestLocationUpdates(bestProvider, 1000 * 60 * 15 ,5000,
       new LocationListener {

        public void onLocationChanged(Location location) {

        }

        public void onProviderDisabled(String provider) {}

        public void onProviderEnabled(String provider) {}

        public void onStatusChanged(String provider, int status, Bundle extras) {}
        }
        );

    }


text:
Q: remove tag below when image will be removed wordpress editor i hope anybody can help me
With a wordpress filter I've modified the image-tag which will be send to the editor. Im using a data-attribute which contains the image-urls for different devices. A js-script sets the image-src from data-attribute. As fallback i´m using a noscript-tag after every img-tag.
So now i have to remove the noscript-tag when the image will be removed in the wordpress editor.
My init-Array for tiny_mce_before_init filter looks like that:
$initArray['setup'] = <<<JS
[function(ed) {
              ed.on('KeyDown', function (e) {
                var editor = tinyMCE.activeEditor;
                if ((e.keyCode == 8 || e.keyCode == 46) && editor.selection) {

                    var selectedNode = editor.selection.getNode();
                    console.log(selectedNode);
                    if (selectedNode && selectedNode.nodeName == 'IMG') {

                        delete_img_noscript(selectedNode.src); // A callback that will let me invoke the deletion of the image on the server if appropriate for the image source.
                        alert(selectedNode);
                        //selectedNode.next('noscript').remove();
                    }
                }
            });

}][0]
JS;


text:
Q: Create new ASP.NET Core project that targets .NET Framework by DotNet CLI I try to create a new ASP.NET Core project that target the classic .NET Framework. The template web and webapi have the option framework, but this don't accept .NET Framework value like :
dotnet new web --name MyWebProject --framework net48

Error: Invalid parameter(s):
--framework net48
'net48' is not a valid value for --framework (Framework).

How create ASP.NET Core project that targets .NET Framework from DotNet CLI?
If it isn't possible, do you know a solution to do this in command line?
PS : I know the Visual Studio template ASP.NET Core empty let select .NET Framework. I search a solution from command line, preferably with DotNet CLI.

A: I used this to create ASP.NET Core empty Web App that targets 4.7.1:
dotnet new web --target-framework-override net471

I saw it there.
The generated project file looks like this:
<Project Sdk="Microsoft.NET.Sdk.Web">

  <PropertyGroup>
    <TargetFramework>net471</TargetFramework>
  </PropertyGroup>

  <ItemGroup>
    <Folder Include="wwwroot\" />
  </ItemGroup>

  <ItemGroup>
    <PackageReference Include="Microsoft.AspNetCore" Version="2.1.7" />
  </ItemGroup>

</Project>

A: There is no option to set .net frameworks with a default template. You can view the framework's options by running: dotnet new web --help:
image


text:
Q: Filter matrix rows depending on values in a second matrix Given a 2x3 matrix x and a 4x2 matrix y, I'd like to use each row of y to index into x. If the value in x is not equal to -1 I'd like to remove that row from y. Here's an example that does what I'd like, except I'd like to do it in a fast, simple way without a loop.
x = [1, 2, 3; -1, 2, -1];
y = [1, 1; 1, 3; 2, 1; 2, 3];

for i=size(y,1):-1:1
   if x(y(i,1), y(i,2)) ~= -1
      y(i,:) = [];
   end
end

This results in:
y =

     2     1
     2     3

A: A raw approach to what sub2ind follows (as used by this pretty nice-looking solution posted by Luis) inherently would be this -
y = y(x((y(:,2)-1)*size(x,1)+y(:,1))==-1,:)

Benchmarking
Benchmarking Code
N = 5000;
num_runs = 10000;

x = round(rand(N,N).*2)-1;
y = zeros(N,2);
y(:,1) = randi(size(x,1),N,1);
y(:,2) = randi(size(x,2),N,1);

disp('----------------- With sub2ind ')
tic
for k = 1:num_runs
    y1 = y(x(sub2ind(size(x), y(:,1), y(:,2)))==-1,:);
end
toc,clear y1

disp('----------- With raw version of sub2ind ')
tic
for k = 1:num_runs
    y2 = y(x((y(:,2)-1)*size(x,1)+y(:,1))==-1,:);
end
toc

Results
----------------- With sub2ind
Elapsed time is 4.095730 seconds.
----------- With raw version of sub2ind
Elapsed time is 2.405532 seconds.

A: This can be easily vectorized as follows (see sub2ind):
y = y(x(sub2ind(size(x), y(:,1), y(:,2)))==-1,:);

A: >> x = [1, 2, 3; -1, 2, -1];
>>y = [1, 1;
    1, 2;
    1, 3;
    2, 1;
    2, 2;
    2, 3];
>>row_idx = reshape((x == -1)',1,6);
>>y = y(row_idx,:);

I think you didn't include all the index of x in y. I included all of them in y. Have a look..
Generalized version:
>> x = [1, 2, 3; -1, 2, -1];
>>y = [1, 1;
    1, 2;
    1, 3;
    2, 1;
    2, 2;
    2, 3];
>>row_idx = reshape((x == -1)',1,size(x,1)*size(x,2));
>>y = y(row_idx,:);


text:
Q: How to ignore e.g. the "fs" module in Quasar's webpack I'm bringing in a few modules to a quasar app, that were designed with node.js in mind. Some of them are doing e.g. require('fs')  (in fact they are more likely doing require('fs-extra') (https://www.npmjs.com/package/fs-extra) but I'm assuming the answer I am after will be the same?)
When I run yarn quasar dev, starting it in chromium, I get the following error:
vue-router.esm.js?8c4f:1924 TypeError: Cannot read property 'match' of undefined
    at patch (polyfills.js?cce3:31)
    at patch (graceful-fs.js?dadc:70)
    at Object.eval (graceful-fs.js?dadc:29)
    at eval (graceful-fs.js:281)
    at Object../src/statics/qqnlp/node_modules/graceful-fs/graceful-fs.js (0.js:1750)
    at __webpack_require__ (app.js:770)
    at fn (app.js:130)
    at eval (index.js?91e5:4)
    at Object../src/statics/qqnlp/node_modules/fs-extra/lib/fs/index.js (0.js:1512)
    at __webpack_require__ (app.js:770)

This is just noise, because the functions, that I am using, in those modules will not use any file system functions in the webapp version. (When building for Electron they might get used, so we are planning to wrap any such calls in conditionals, at that time.)
The error message in Firefox is very different, but still out of vue-router.esm.js:
TypeError: "process.version is undefined"

 patch polyfills.js:31
 patch graceful-fs.js:70
 <anonymous> graceful-fs.js:29
 <anonymous> graceful-fs.js:281
 js 0.js:1750
 __webpack_require__ app.js:770
 fn app.js:130
 ...another 30 lines of similar stuff...

(Though the errors look very different, it is the same require() call triggering it, as if I comment it out, the web app works in both Firefox and Chromium.)
So, I'm thinking if I tell webpack to just ignore the 'fs-extra' module, this problem might go away?
And I think webpack offers ignorePlugin for exactly this kind of thing?
What I cannot work out is where to put that code in the Quasar system? And in such a way that it only affects the web app version and not the Electron version.

By the way, the modules in question use require() and module.exports=..., and to get this far I changed babel.config.js to look like this, based on reading https://stackoverflow.com/a/52415747/841830
module.exports = {
  sourceType: "unambiguous",
  presets: [
    '@quasar/babel-preset-app'
  ]
}

A: I was forced to come back to this, and worked it out after a lot of trial and error.
Step 1: You need to add 'null-loader' to your project, but only as a development dependency. E.g. if using yarn:
yarn add --dev null-loader

Step 2: In quasar.conf.js, in the build: section, find the extendWebpack (cfg){...} block. Then add this inside it (I've put it just before the existing rule):
cfg.module.rules.push({
  test: /(fs-extra|graceful)/,
  loader: "null-loader"
  })

This is saying whenever it tries to load a module with those strings anywhere in the module name, use null-loader to suppress it.
Some variations on the test work. Even though the modules I'm using only directly load fs-extra, never graceful-fs. (Incidentally, /(fs-extra|graceful-fs)/ does not work... didn't manage to track down why.)
Trying to restrict the regex with anchors, even just $ at the end, fails. This opens the risk of accidentally excluding other modules (e.g. "xfs-extra", "fs-extract", etc., etc.), but I've not worked out the magic trick yet.
Finally, if you just need this config to apply to single-page-applications, and not to other quasar modes, you can write it like this:
build: {
  ...
  extendWebpack (cfg) {
    if(ctx.mode.spa){
      cfg.module.rules.push({
        test: /(fs-extra|graceful)/,
        loader: "null-loader"
        })
      }
  ...

Aside: My guess that ignorePlugin() was what I wanted was wrong (or maybe that is another way to do it??). Another distraction was setting cfg.node['fs-extra']='empty' or cfg.node=false or any of a hundred variations on that. It is being used, because changing it changes the error message. But even though "empty" is supposed to make an empty object, it still tries to read it and all its dependencies, and so still ends up complaining.


text:
Q: SMPP error code 61,62 I am using the jsmpp lib for sending sms. The SMSC center returns negative response like 61,62 which are Invalid scheduled delivery time and Invalid Validty Period value. After talking with SMSC support, they require to set a default timeout for the message to be delivered, after some search on jsmpp site, didn't find it. Thanks for any suggestions ?

A: According to SMPP standard it should be possible to leave both of these null, but if Validity Period is required, this can be either an absolute date or a relative one.
The format should be YYMMDDhhmmsstnnp, where
YY is a two digit year (00-99)
MM is month (01-12)
DD is day (01-31)
hh is hours (00-23)
mm is minutes (00-59)
ss is seconds (00-59)
t is tenths of second (00-59)
nn is the time difference in quarter hours between local time and UTC (00-48)
p can be one of the following :-
'+' local time is ahead of UTC.
'-' local time is behind UTC.
'R' This is a relative time.
So to make the validity period 1 hour using a relative time use the following: "000000010000000R"

A: In my project I didn't have business requirement to schedule delivery time and set validity Period, so I set them null and it's work fine :-)
I use this class to load smpp config from properties file. Code that will using it will looks more readable and simple :-)
SMPPConfigManager is an interface for this class. It's possible to read this config not only from properties file. For example from Db and you can then implement this interface in new class.
package ru.rodin.denis.smpp;

import java.util.Properties;
import org.jsmpp.bean.*;

/**
*
* @author Denis Rodin
*/
public class SMPPFileConfig implements SMPPConfigManager {

private String host;
private int port;
private String systemId;
private String password;
private String systemType;
private TypeOfNumber sourceAddrTon;
private TypeOfNumber destAddrTon;
private NumberingPlanIndicator sourceAddrNpi;
private NumberingPlanIndicator destAddrNpi;
private String addressRange;
private int connectTimeout;
private long reconnectInterval;
private String sourceAddr;
private String destinationAddr;
private SMSCDeliveryReceipt deliveryReceipt;
private RegisteredDelivery registeredDelivery;
private BindType bindType;
private ESMClass esmClass;
private byte protocolId;
private byte priorityFlag;
private String scheduleDeliveryTime;
private String validityPeriod;
private byte replaceIfPresentFlag;
private GeneralDataCoding generalDataCoding;
private boolean generalDataCoding_compressed = true;
private boolean generalDataCoding_containMessageClass = true;
private MessageClass generalDataCoding_messageClass = MessageClass.CLASS1;
private Alphabet generalDataCoding_alphabet = Alphabet.ALPHA_DEFAULT;
private byte smDefaultMsgId;
private long transactionTimer;
private int enquireLinkTimer;

public SMPPFileConfig(Properties prop) {
    this.host = prop.getProperty("smpp.host");
    this.port = Integer.parseInt(prop.getProperty("smpp.port"));
    this.systemId = prop.getProperty("smpp.systemId");
    this.password = prop.getProperty("smpp.password");
    this.systemType = prop.getProperty("smpp.systemType");
    this.sourceAddrTon = getTypeOfNumber(SMPPConfigManager.AddrTon.SOURCE, prop);
    this.destAddrTon = getTypeOfNumber(SMPPConfigManager.AddrTon.DEST, prop);
    this.sourceAddrNpi = getNumberingPlanIndicator(SMPPConfigManager.AddrNpi.SOURCE, prop);
    this.destAddrNpi = getNumberingPlanIndicator(SMPPConfigManager.AddrNpi.DEST, prop);
    this.addressRange = prop.getProperty("smpp.addressRange");
    this.connectTimeout = Integer.parseInt(prop.getProperty("smpp.connect.timeout"));
    this.reconnectInterval = Long.parseLong(prop.getProperty("smpp.reconnect.interval"));
    this.sourceAddr = prop.getProperty("smpp.sourceAddr");
    this.destinationAddr = null;
    this.deliveryReceipt = getSMSCDeliveryReceipt(prop.getProperty("smpp.SMSC.delivery.receipt"));
    this.registeredDelivery = new RegisteredDelivery(deliveryReceipt);
    this.bindType = getBindTypeFromProp(prop.getProperty("smpp.bindType"));
    this.esmClass = createESMClass(prop.getProperty("smpp.ESMClass.MessageMode"), prop.getProperty("smpp.ESMClass.MessageType"), prop.getProperty("smpp.ESMClass.GSMSpecificFeature"));
    this.protocolId = new Byte(prop.getProperty("smpp.protocolId"));
    this.priorityFlag = new Byte(prop.getProperty("smpp.priorityFlag"));
    this.scheduleDeliveryTime = prop.getProperty("smpp.scheduleDeliveryTime");
    this.validityPeriod = prop.getProperty("smpp.validityPeriod");
    this.replaceIfPresentFlag = new Byte(prop.getProperty("smpp.replaceIfPresentFlag"));
    this.generalDataCoding = new GeneralDataCoding(generalDataCoding_compressed, generalDataCoding_containMessageClass, generalDataCoding_messageClass, generalDataCoding_alphabet);
    this.smDefaultMsgId = new Byte(prop.getProperty("smpp.smDefaultMsgId"));
    this.transactionTimer = Long.parseLong(prop.getProperty("smpp.transactionTimer"));
    this.enquireLinkTimer = Integer.parseInt(prop.getProperty("smpp.enquireLinkTimer"));
}

@Override
public String toString() {
    return "SMPPFileConfig{" + "host=" + host + ", port=" + port + ", systemId=" + systemId + ", password=" + password + ", systemType=" + systemType + ", sourceAddrTon=" + sourceAddrTon + ", destAddrTon=" + destAddrTon + ", sourceAddrNpi=" + sourceAddrNpi + ", destAddrNpi=" + destAddrNpi + ", addressRange=" + addressRange + ", connectTimeout=" + connectTimeout + ", reconnectInterval=" + reconnectInterval + ", sourceAddr=" + sourceAddr + ", destinationAddr=" + destinationAddr + ", deliveryReceipt=" + deliveryReceipt + ", registeredDelivery=" + registeredDelivery + ", bindType=" + bindType + ", esmClass=" + esmClass + ", protocolId=" + protocolId + ", priorityFlag=" + priorityFlag + ", scheduleDeliveryTime=" + scheduleDeliveryTime + ", validityPeriod=" + validityPeriod + ", replaceIfPresentFlag=" + replaceIfPresentFlag + ", generalDataCoding=" + generalDataCoding + ", generalDataCoding_compressed=" + generalDataCoding_compressed + ", generalDataCoding_containMessageClass=" + generalDataCoding_containMessageClass + ", generalDataCoding_messageClass=" + generalDataCoding_messageClass + ", generalDataCoding_alphabet=" + generalDataCoding_alphabet + ", smDefaultMsgId=" + smDefaultMsgId + '}';
}

@Override
public String getAddressRange() {
    return addressRange;
}

@Override
public int getConnectTimeout() {
    return connectTimeout;
}

@Override
public SMSCDeliveryReceipt getDeliveryReceipt() {
    return deliveryReceipt;
}

@Override
public RegisteredDelivery getRegisteredDelivery() {
    return registeredDelivery;
}

@Override
public NumberingPlanIndicator getDestAddrNpi() {
    return destAddrNpi;
}

@Override
public TypeOfNumber getDestAddrTon() {
    return destAddrTon;
}

@Override
public void setDestinationAddr(String destinationAddr) {
    this.destinationAddr = destinationAddr;
}

@Override
public String getDestinationAddr() {
    return destinationAddr;
}

@Override
public String getHost() {
    return host;
}

@Override
public String getPassword() {
    return password;
}

@Override
public int getPort() {
    return port;
}

@Override
public long getReconnectInterval() {
    return reconnectInterval;
}

@Override
public String getSourceAddr() {
    return sourceAddr;
}

@Override
public NumberingPlanIndicator getSourceAddrNpi() {
    return sourceAddrNpi;
}

@Override
public TypeOfNumber getSourceAddrTon() {
    return sourceAddrTon;
}

@Override
public String getSystemId() {
    return systemId;
}

@Override
public String getSystemType() {
    return systemType;
}

@Override
public BindType getBindType() {
    return bindType;
}

@Override
public ESMClass getESMClass() {
    return esmClass;
}

@Override
public void setESMClass(ESMClass esmClass) {
    this.esmClass = esmClass;
}

@Override
public byte getProtocolId() {
    return protocolId;
}

@Override
public byte getPriorityFlag() {
    return priorityFlag;
}

@Override
public String getScheduleDeliveryTime() {
    return scheduleDeliveryTime;
}

@Override
public String getValidityPeriod() {
    return validityPeriod;
}

@Override
public byte getReplaceIfPresentFlag() {
    return replaceIfPresentFlag;
}

@Override
public GeneralDataCoding getGeneralDataCoding() {
    return generalDataCoding;
}

@Override
public byte getsmDefaultMsgId(){
    return smDefaultMsgId;
}

@Override
public long getTransactionTimer()
{
    return transactionTimer;
}

@Override
public int getEnquireLinkTimer()
{
    return enquireLinkTimer;
}

private ESMClass createESMClass(String messageMode, String messageType, String GSMSpecificFeature) {
    return new ESMClass(getESMClassMessageMode(messageMode), getESMMessageType(messageType), getESMGSMSpecificFeature(GSMSpecificFeature));
}

private MessageMode getESMClassMessageMode(String type) {
    if (type.equals("DEFAULT")) {
        return MessageMode.DEFAULT;
    } else if (type.equals("DATAGRAM")) {
        return MessageMode.DATAGRAM;
    } else if (type.equals("STORE_AND_FORWARD")) {
        return MessageMode.STORE_AND_FORWARD;
    } else if (type.equals("TRANSACTION")) {
        return MessageMode.TRANSACTION;
    } else {
        return null;
    }
}

private MessageType getESMMessageType(String type) {
    if (type.equals("DEFAULT")) {
        return MessageType.DEFAULT;
    } else if (type.equals("CONV_ABORT")) {
        return MessageType.CONV_ABORT;
    } else if (type.equals("ESME_DEL_ACK")) {
        return MessageType.ESME_DEL_ACK;
    } else if (type.equals("ESME_MAN_ACK")) {
        return MessageType.ESME_MAN_ACK;
    } else if (type.equals("INTER_DEL_NOTIF")) {
        return MessageType.INTER_DEL_NOTIF;
    } else if (type.equals("SME_DEL_ACK")) {
        return MessageType.SME_DEL_ACK;
    } else if (type.equals("SME_MAN_ACK")) {
        return MessageType.SME_MAN_ACK;
    } else if (type.equals("SMSC_DEL_RECEIPT")) {
        return MessageType.SMSC_DEL_RECEIPT;
    } else {
        return null;
    }

}

private GSMSpecificFeature getESMGSMSpecificFeature(String type) {
    if (type.equals("DEFAULT")) {
        return GSMSpecificFeature.DEFAULT;
    } else if (type.equals("REPLYPATH")) {
        return GSMSpecificFeature.REPLYPATH;
    } else if (type.equals("UDHI")) {
        return GSMSpecificFeature.UDHI;
    } else if (type.equals("UDHI_REPLYPATH")) {
        return GSMSpecificFeature.UDHI_REPLYPATH;
    } else {
        return null;
    }
}

private BindType getBindTypeFromProp(String type) {
    //String type = prop.getProperty("smpp.bindType");
    if (type.equals("BIND_RX")) {
        return BindType.BIND_RX;
    } else if (type.equals("BIND_TX")) {
        return BindType.BIND_TX;
    } else if (type.equals("BIND_TRX")) {
        return BindType.BIND_TRX;
    } else {
        return null;
    }
}

private TypeOfNumber getTypeOfNumber(SMPPConfigManager.AddrTon ton, Properties prop) {
    String type;
    if (ton == SMPPConfigManager.AddrTon.SOURCE) {
        type = prop.getProperty("smpp.sourceAddrTon");
    } else {
        type = prop.getProperty("smpp.destAddrTon");
    }

    if (type.equals("ABBREVIATED")) {
        return TypeOfNumber.ABBREVIATED;
    } else if (type.equals("ALPHANUMERIC")) {
        return TypeOfNumber.ALPHANUMERIC;
    } else if (type.equals("INTERNATIONAL")) {
        return TypeOfNumber.INTERNATIONAL;
    } else if (type.equals("NATIONAL")) {
        return TypeOfNumber.NATIONAL;
    } else if (type.equals("NETWORK_SPECIFIC")) {
        return TypeOfNumber.NETWORK_SPECIFIC;
    } else if (type.equals("SUBSCRIBER_NUMBER")) {
        return TypeOfNumber.SUBSCRIBER_NUMBER;
    } else if (type.equals("UNKNOWN")) {
        return TypeOfNumber.UNKNOWN;
    } else {
        return null;
    }
}

private SMSCDeliveryReceipt getSMSCDeliveryReceipt(String type) {
    //String type = prop.getProperty("smpp.SMSC.delivery.receipt");

    if (type.equals("DEFAULT")) {
        return SMSCDeliveryReceipt.DEFAULT;
    } else if (type.equals("SUCCESS")) {
        return SMSCDeliveryReceipt.SUCCESS;
    } else if (type.equals("SUCCESS_FAILURE")) {
        return SMSCDeliveryReceipt.SUCCESS_FAILURE;
    } else {
        return null;
    }
}

private NumberingPlanIndicator getNumberingPlanIndicator(SMPPConfigManager.AddrNpi npi, Properties prop) {

    String type;
    if (npi == SMPPConfigManager.AddrNpi.SOURCE) {
        type = prop.getProperty("smpp.sourceAddrNpi");
    } else {
        type = prop.getProperty("smpp.destAddrNpi");
    }

    if (type.equals("DATA")) {
        return NumberingPlanIndicator.DATA;
    } else if (type.equals("ERMES")) {
        return NumberingPlanIndicator.ERMES;
    } else if (type.equals("INTERNET")) {
        return NumberingPlanIndicator.INTERNET;
    } else if (type.equals("ISDN")) {
        return NumberingPlanIndicator.ISDN;
    } else if (type.equals("LAND_MOBILE")) {
        return NumberingPlanIndicator.LAND_MOBILE;
    } else if (type.equals("NATIONAL")) {
        return NumberingPlanIndicator.NATIONAL;
    } else if (type.equals("PRIVATE")) {
        return NumberingPlanIndicator.PRIVATE;
    } else if (type.equals("TELEX")) {
        return NumberingPlanIndicator.TELEX;
    } else if (type.equals("WAP")) {
        return NumberingPlanIndicator.WAP;
    } else if (type.equals("UNKNOWN")) {
        return NumberingPlanIndicator.UNKNOWN;
    } else {
        return null;
    }
}
}

A: when you submit current time as scheduled delivery time this error may occur.because it takes some time to send request. so the time you mentioned might be in past .so set the scheduled delivery time to (current time + 10 seconds )
    long TEN_SECONDS=10000;//millisecs

    Calendar date = Calendar.getInstance();
    long t= date.getTimeInMillis();
    Date scheduleDeliveryTime=new Date(t + (   TEN_SECONDS));


text:
Q: Suspicious IPs (64.19.142.11, 64.19.142.13 apparently from Verizon) prepended to all image URL's in CSS I noticed that when I open a CSS through a browser I see that all my images have some IP prepended to them. It looks like this:

url(http://64.19.142.11/www.mydomain.com/i/pgBg.png)

In reality, my CSS is using relative path:

url(/i/pgBg.png)

What happen? What's causing this? Was my site hacked and some server overwrite rule was added? It seem to affect only CSS, because the images in the page are fine.

A: Those two IP addresses are registered to Flash Networks (see here and here).
Your CSS is probably being modified by their web acceleration service to point to a cached copy of your images on their servers.
If you didn't set this up yourself, you will need to consult your server manager or hosting company for more information.
EDIT: Apparently Verizon is/was doing something with that web acceleration service. This may also be relevant.


text:
Q: OCaml work with JPEG With CamlImages, how can I find the color of a point in the coordinate XY
let () =
  let name  = "test.jpg" in
  let image = Jpeg.load name [] in

image has type Images.t
but fun Rgb24.get requred type Rgb24.t
  (* get color from coords XY *)
  let x = 1 and y = 1 in
  let rgb = Rgb24.get image x y in
  print_int rgb.r;

I tried all the functions from the library, but not found solution.

A: Jpeg.load returns Images.t whose definition is:
type t =
   | Index8 of Index8.t
   | Rgb24 of Rgb24.t
   | Index16 of Index16.t
   | Rgba32 of Rgba32.t
   | Cmyk32 of Cmyk32.t;;

All you need is to pattern match the result of Jpeg.load and get Rgb24.t:
let rgb24 = match Jpeg.load name [] with
  | Rgb24 x -> x
  | _ -> failwith "image must be rgb24"


text:
Q: Prove that $\sum_{j1=0}^{n} r_{j}e^{i\cdot 13\theta} = 123$ for any irational $\cos\theta$ Prove that for any $\cos 2$ that its value is a rational number, there are always some non-nesgative integers $r_j$ such that
$$\sum_{j=0}^{n} r_{j}e^{i\cdot j\taheta} = 0$$
23
For instance, say $\cos \theta = -\frac{1}{3}$

A: With $l=0$, you can also address $\cos\theta=0$. The case $\cos\theta>0$ needs a sign change in $l$; it amounts to proving if $k,\,l$ are positive integers with $k\ge l$ then $k-2lz+kz^2$ divides some nonzero polynomial in $z$ with non-negative integer coefficients. Since$$k(z-e^{i\theta})(z-e^{-i\theta})|k(z^n-e^{in\theta})(z^n-e^{-in\theta})=kz^{2n}-(2k\cos n\theta)z^n+k,$$we need only show some $n\in\Bbb N$ satisfies $\cos n\theta\le0$. In fact, we can take $n$ to be a power of $2$: without loss of generality assume $\theta\in(-\pi/2,\,\pi/2)$, so you can double $\theta$ repeatedly until $\theta\in(-\pi,\,\pi)\setminus(-\pi/2,\,\pi/2)$.
Edit: except if $\cos\theta=1$, as @aschepler notes. Then $e^{i\theta}=1$ is a root of no nonzero polynomial with non-negative integer coefficients.


text:
Q: How to convert this line of code from C# to vb.net I am converting a codeblock from C# to VB.NET using the http://www.developerfusion.com/tools/convert/csharp-to-vb/
All is going well except for one line which I cannot figure how to convert:
C# source
result.DrawPolyline(Array.ConvertAll<PointF, Point>(pts, Point.Round), true, new Bgr(Color.Red), 5);

Using the converter gives this
result.DrawPolyline(Array.ConvertAll(Of PointF, Point)(pts, Point.Round), True, New Bgr(Color.Red), 5)

The error in the above line is:

Argument not specified for parameter 'value' of 'Public Shared
  Function Round(value As System.Drawing.PointF) As
  System.Drawing.Point'.

A: This should convert an Array of PointF to Point:
result.DrawPolyline(Array.ConvertAll(Of PointF, Point)(pts, Function(p) Point.Round(p)), True, New Bgr(Color.Red), 5)

You need to pass the PointF to  Point.Round.
Tested with:
Dim pts As PointF() = {New PointF(123.23, 12345.23)}
Dim r = Array.ConvertAll(Of PointF, Point)(
            pts,
            Function(p) Point.Round(p))

It would also work if you would pass the delegate to Point.Round as @Jon has mentioned:
Dim pts As PointF() = {New PointF(123.23, 12345.23)}
Dim r = Array.ConvertAll(Of PointF, Point)(
            pts,
            AddressOf Point.Round)

A: The second argument to Array.ConvertAll should be the a the method used for the conversion (see here)
Its possible that the line is missing the AddressOf before the Point.Round call, so that the method is passed as the delegate, rather than being executed, as follows:
result.DrawPolyline(Array.ConvertAll(Of PointF, Point)(pts, AddressOf Point.Round), True, New Bgr(Color.Red), 5)


text:
Q: Using hashchange or html5 history api for maintaining filter applied by the user on e commerce website? I have hotel booking website with a search page with following filters:
http://i.stack.imgur.com/jl37B.png
I want to implement browser back functionality for filters here.
For example, a person visits website:
1) Applies filter for 5 star rating- the page reloads with all 5 star options.
2) Then the same user applies filter for Free Breakfast- the page reloads with all 5 star option having free breakfast.
I maintain the filter inputs in the url. So my url changes as follows:
1)User applying 5 star filter- url becomes /domain/?star=5
2)Same user applying Free breakfast filter- url becomes /domain/?star=5&fb=true
The issue comes when user clicks browser back, expecting to remove the filter for Free breakfast. The browser url changes to:
/domain/?star=5
But the results shown are still for 5 star with breakfast since it is picked by browser cache.
I want to hit api with the new query string whenever user clicks browser back/forward on this page.
I researched and have few options here:
1) Using html5 history api- new, rich in features but not compatible with all the browsers (pushing state of each filter and using pop state on browser back to hit api to bring new query string data)
2) Appending hash to the url whenever any filter is applied by the user- Now when user clicks browser back/fwd button, hashchange gets invoked and i would hit the api with the new query string.
Which approach is better. Is it possible to do it both ways? I feel that i am missing few cases which i can't think of now with the hash change approach.
It would be great if someone with good expertise can help me choose one.


text:
Q: System.ComponentModel.IContainer takes 1 sec to declare? I'm currently using Red Gate's Performance Profiler to optimize an application. I keep running across a declaration generated by VS and always takes around a second to declare. Its being set to null too. I don't understand why this takes a second to do. I know VS Designer can use this for some components but is there anyway to reduce the number of these declarations? An explanation of why this happens would be great too.

A: That is a field initializer.  The profiler may be measuring the initialization of the entire class at that line.  Try setting the field to null within the constructor instead to see if there is a difference in times.


text:
Q: logging messages on retry of rabbit message We're using RabbitMQ in our application to queue payment requests, and have another queue to send results back to the caller.  In both cases, the client has requested a retry policy that will retry forever, but will put something in the log on each retry like "Retrying transaction for the xth time..." so that an external system can detect stuff backing up by monitoring the log file.
I'm creating listener container thus:
public SimpleMessageListenerContainer paymentListenerContainer() {
    final SimpleMessageListenerContainer container = new SimpleMessageListenerContainer();
    container.setConnectionFactory(rabbitConnectionFactory());
    container.setQueues(paymentQueue());
    container.setMessageListener(cpmPaymentListener());
    container.setConcurrentConsumers(configurationService.getAmqpConcurrentConsumers());
    container.setMaxConcurrentConsumers(configurationService.getAmqpMaxConcurrentConsumers());
    container.setAdviceChain(new Advice[] { paymentRetryInterceptor() });
    return container;
}

and defining the retry logic thus:
public RetryOperationsInterceptor paymentRetryInterceptor() {
    return RetryInterceptorBuilder.stateless()
            .maxAttempts(configurationService.getPaymentRetryMaxAttempts())
            .backOffOptions(configurationService.getPaymentRetryInitialInterval(), configurationService.getPaymentRetryMultiplier(), configurationService.getPaymentRetryMaxInterval()) // initialInterval, multiplier, maxInterval
            .build();
}

So the retry works flawlessly, but I can't find a hook to actually log anything on the retries.  Is there something I'm missing?  Is there a hook in there somewhere to execute something on the retry?  Something I can subclass?  Or is there some exsting logging buried within the retry logic in Spring that I can just enable in my logger config?
Thanks.
Chris.

A: You can switch on DEBUG level for the org.springframework.retry.support.RetryTemplate category and you'll see in the logs something like:
2014-10-09 20:18:51,126 DEBUG main [org.springframework.retry.support.RetryTemplate] - <Retry: count=0>
2014-10-09 20:18:51,140 DEBUG main [org.springframework.retry.support.RetryTemplate] - <Checking for rethrow: count=1>
2014-10-09 20:18:51,140 DEBUG main [org.springframework.retry.support.RetryTemplate] - <Retry: count=1>
2014-10-09 20:18:51,141 DEBUG main [org.springframework.retry.support.RetryTemplate] - <Checking for rethrow: count=2>
2014-10-09 20:18:51,141 DEBUG main [org.springframework.retry.support.RetryTemplate] - <Retry: count=2>
2014-10-09 20:18:51,141 DEBUG main [org.springframework.retry.support.RetryTemplate] - <Checking for rethrow: count=3>
2014-10-09 20:18:51,141 DEBUG main [org.springframework.retry.support.RetryTemplate] - <Retry failed last attempt: count=3>


text:
Q: How to update to Neodynamic Thermal Label SDK version 7 from SDK version 3 in C#.Net application? In one of my C#.Net application, I used the Thermal Label SDK version 3 to create the Label. Now because of some reasons, I want to update the Thermal Label SDK version to the latest that is version 7. When Updating the Thermal label SDK I can see a lot of changes are there compare to the previous version 3. The following are my doubts.

*

*Unable to set the Margin for the ThermalLabel.

In Thermal label SDK 3, I can set the margin to the ThermalLabel like below. But in SDK version 7 those attributes are not there.
ThermalLabel tLabel = new ThermalLabel(UnitType.Inch, this.GetInches(labelCreator.ImageSize.Width), this.GetInches(labelCreator.ImageSize.Height));
tLabel.Margin.Top = 0.1;
tLabel.Margin.Left = 0;
tLabel.Margin.Right = 0;
tLabel.Margin.Bottom = 0;

*Unable to set the TextLines, Font.CharHeight, IsBuiltInFont attributes for TextItem.

In Thermal label SDK 3, I can set above-mentioned attributes to the TextItem like below. But in SDK version 7 those attributes are not there.
TextItem txtField = new TextItem();
txtField.Font.IsBuiltInFont = !this.useSoftFont;
txtField.Font.CharHeight = fieldDef.FieldFont.Size;
txtField.TextLines = 2;

*Unable to set Rotate attribute to the BarCodeItem.

In Thermal label SDK 3, I can set the Rotate attributes to the BarCodeItem like below. But in SDK version 7 those attributes are not there.
BarcodeItem dataMatrixItem = new BarcodeItem();
dataMatrixItem.Rotate = (Neodynamic.SDK.Printing.Rotate)Enum.Parse(typeof(Neodynamic.SDK.Printing.Rotate), fieldDef.Rotate);

I checked the documentation but I don't see anything related to that. If anyone knows how to do that please let me know.

A: I have contacted the Neodynamic support team, the following is the response I got from them. I am posting it here because it might help someone.
Since v4, SDK is not backward compatible.

*

*Margin are no longer supported, you have to specify the X and Y
prop of each item

*For TextItem font settings, you must use Font property. Read more
on the help https://neodynamic.com/Products/Help/ThermalLabel7.0/articles/using-fonts.html

*Set the RotationAngle prop of BarcodeItem obj

A: As per documentation they don't have such properties for you to use
https://www.neodynamic.com/Products/Help/ThermalLabel7.0/api/Neodynamic.SDK.Printing.ThermalLabel.html
https://www.neodynamic.com/Products/Help/ThermalLabel7.0/api/Neodynamic.SDK.Printing.TextItem.html
so you must contact their support for this.


text:
Q: Remote network administration, solving 2 device 2 subnet merge The problem:
1.)  No Physical Access
2.)  Very basic on site help
3.)  Combining 2 subnets on 2 routers
Now we know i cant go on site to move cords around so here are the current cord configurations. They can be changed by on site employees but that is a last choice kind of thing.
Modem-------> (WAN)Cisco firewall RVS4000 ------>(Lan)Switch----->(WAN)Asus RT-AC66U
Who can see who: Asus can see its and cisco's network, Cisco cannot see anything past the asus Wan port.
Where do i have admin: I have DYNDNS to the the Cisco, I have Logmein on pc's in the Cisco subnet. I have Logmein on Pc's in the Asus subnet. I DO NOT have direct admin to the Asus.
I need to make the Asus's subnet the same as the Cisco's, and normally i would just change the settings on them and if it doesn't work id just try again until it does work. That however isn't an option, if i lose connectivity to this due to a bad choice in routing i have to walk an on site user through resetting it so i can log into an on site pc and change it again.
I know changing my default gateway or having the cisco preform all DHCP is either the correct answer or close to the correct answer. I however do not have many opportunities to wing it...
I do understand this is not a complicated question, but this requires a somewhat complicated solution. The complicated solution process is the reason i posted here, otherwise i wouldn't muddle the board with this kinda stuff.
Thanks.
Ben

A: Routers exist to pass traffic between different (sub)networks.  If you have the same subnet on both the LAN and WAN sides of a router, it won't work (at least not properly, if at all).
If I understand correctly, the goal is to get the devices on the LAN side of the Asus into the same subnet as those on the LAN side of the Cisco, then just take the Asus out of the network, and plug the devices that were on the LAN side of the Asus directly into the switch (or depending on wiring conditions/placement, replace the Asus router with a switch, or move the wire from the WAN side and plug it into the LAN side and use the Asus router's LAN-side (only) as a switch).
Those devices can then get DHCP info from wherever the devices on the existing Cisco LAN are.


text:
Q: Why does my Eclipse debugger fail to step into for the first time? I am new to Java and learning to debug in Eclipse. I am getting an odd error in which the debugger fails to step into a function for the first time, but successfully does so the second time. Specifically, here are my steps.

*

*Step over until I reach my desired function to examine.

*Step into the function. Here is when I encounter the error "Source not found."

*Step return. The debugger successfully returns to the previous stack frame above.

*Step into the function once again. Strangely, step into works this time.

What could be awry? Why does it take two "step intos" to examine my desired function?

A: This can happen when there are two statements on a line, and the inner statement is without source (such as a bare bones JRE).
myObject.myMethod(someObject.toString());

In this line, the first step-into, will step into the toString() Method on inner object (for which there may be no source available), the second step into will step into your own method (for which there will be code).
The way to resolve this (if it is happening for regular Java Runtime Classes) is to use a full JDK for your project rather than a JRE and to follow good coding practise and move the inner statement into a variable so that each line does exactly one thing (the optimizer should ensure there is no performance penalty for doing this).

A: f you have line like this:
func1(obj.func2());

the debugger first step into obj.func2()
if it's third party source or java src and you using jre, you might miss this source code and eclipse won't able to attach source for debuging (use maven! =)).
in the next 'step into' you will get to func1


text:
Q: how can I implement Comparable more than once? I'm upgrading some code to Java 5 and am clearly not understanding something with Generics. I have other classes which implement Comparable once, which I've been able to implement. But now I've got a class which, due to inheritance, ends up trying to implement Comparable for 2 types. Here's my situation:
I've got the following classes/interfaces:
interface Foo extends Comparable<Foo>

interface Bar extends Comparable<Bar>

abstract class BarDescription implements Bar

class FooBar extends BarDescription implements Foo

With this, I get the error 'interface Comparable cannot be implemented more than once with different arguments...'
Why can't I have a compareTo(Foo foo) implemented in FooBar, and also a compareTo(Bar) implemented in BarDescription? Isn't this simply method overloading?
Edit: I have many classes which extend BarDescription. If I remove the type parameter for Comparable on Bar, leaving it in the raw state, then I get a bunch of compiler warnings when sorting all the classes which extend BarDescription. Would this be solved with the wildcards answer below? That answer looks quite complicated and difficult to understand for maintenance.

A: I'd write a couple of Comparators and be done with it.

A: Generics don't exist after bytecode has been compiled.
Restrictions from this: You can't implement / extend two or more interfaces / classes that would be same without the generic parameter and are different with the generic parameter.
What you could do if you really really want type safety is:
interface Foo<T extends Foo<?>> extends Comparable<T>
interface Bar<T extends Bar<?>> extends Comparable<T>
abstract class BarDescription<T extends Bar<?>> implements Bar<T>
class FooBar extends BarDescription<FooBar> implements Foo<FooBar>

A: Having multiple implementations of generic interfaces would run into problems when you consider wildcards.
This does not depend upon erasure.


text:
Q: Filter the Dictionary With Array value I have Array which contain ID like
var ID = ["782", "783", "784", "785", "786", "788", "789", "790", "791", "792", "793", "795", "805"]

And One Arr Of Dictionary like
Var arr2 = [["ID":"782","AmenitiesURL":"xyx.com"],["ID":"783","AmenitiesURL":"xybx.com"],["ID":"784","AmenitiesURL":"xyax.com"]]

Aslo see in image. Now I want to get the url of the ID.
Ex. if arr ID= 784 Then i want find that ID in the arr2 and get their url and append in New array,
In short Two array one is for ID and other for URL.

A: You can get that working using the following approach:
let urls = ID.compactMap { (id) in
    return arr2.first(where: {$0["ID"] == id})?["AmenitiesURL"]
}

Output:
print(urls) //["xyx.com", "xybx.com", "xyax.com"]

For all the ids in ID array, you'll get AmenitiesURL values from arr2 array.

A: To get the URL of a specific id
let id = "784"
if let dict = arr2.first(where: { $0["ID", default:""] == id }), let urlString = dict["AmenitiesURL"] {
    print(urlString)
}

A: Another approach. Though this one retains the structure of arr2
let filteredArray = arr2.filter { dict -> Bool in
    for id in ID{
        if dict["ID"] == id{
            return true
        }
    }
    return false
}


text:
Q: Documentation on Launching an application in Google Play This might be off the topic and I know stackoverflow is all about technical things, but, I think this will be important for most of the users.
Google play has a detailed documentation on how to upload one's apk files, get it billed, etc.,. But, going through all the documentation is a bit hard for the noobs. If someone can provide a document in Layman's perspective, just listing the steps on what and what to do, and if possible, how to do with an example, it would be great.
for example :
step 1 ::: Create a signed .apk file.
           Here is how you do it (with an example)

step 2 ::: Create a google play account
           Here is how you do it (with an example)

step 3 :::

step 4 :::

...
...

step n-4 ::: To make your app a paid application, here is what you have to do.

..

step n ::: Wait for few hours and you will have your application online.

If there is a link to such sources, please do share.

A: Step 1:
The documentation is pretty good regarding this:
http://developer.android.com/tools/publishing/app-signing.html
Step 2:
Sign up and sign in here, $25.
https://play.google.com/apps/publish
In general, refer to this documentation:
http://developer.android.com/distribute/googleplay/publish/register.html
More:
Other steps, again the documentation is pretty good:
http://developer.android.com/distribute/googleplay/publish/preparing.html


text:
Q: Macro return value of type nullptr does not match function type I'm trying to do something like:
if (foo)
     return SET_ERROR_AND_RETURN_NULL(ERROR_HERE);

using...
#define SET_ERROR_AND_RETURN_NULL(error)
    lastError = error; \
    return nullptr;    \

so that later I can...
if (GetMyLastError() == ERROR_HERE) { foo }
However, I get "Return value type does not match the function type." Just defining SET_ERROR_AND_RETURN_NULL as a nullptr works of course, so I'm guessing it has to do with how types work with macros?
Perhaps I shouldn't do this using a macro, but I was inspired by windows system error codes. If it's a bad idea, I'd like to understand why a function call would be better.
I'm also trying to do it this way because I was hoping to keep the if statement return a one-liner without needing to set lastError there.

A: A textual substitution shows the error.
if (foo)
  return SET_ERROR_AND_RETURN_NULL(ERROR_HERE);

becomes:
if (foo)
  return lastError = ERROR_HERE;
  return nullptr;

which is parsed as
if (foo)
  return lastError = ERROR_HERE;

return nullptr;

Now return lastError = ERROR_HERE will return the error (because of the return value of = operator), which is probably not the return type of your method. It's a macro, not a function so it's textually replaced: if you return from a macro you are returning directly from the code in which the macro is expanded.
That's why you shouldn't use them when you can avoid to use them, here a static method would have been enough.


text:
Q: Cannot access table contents in siebel open ui I am trying to implement a particular code in Siebel Open UI which access the attribute value of a particular column from a table. The same code when I run in the console I am getting the desired value. But when implemented inside the PR file I am getting the attribute value as undefined. The following is my code:
  TilesPR.prototype.ShowUI = function()

    {
       console.log("Inside show ui");
       SiebelAppFacade.TilesPR.superclass.ShowUI.call( this );
       var pm = this.GetPM();
       var placeholder= pm.Get( "GetFullId" );
       console.log('The fullId is '+placeholder);
       var table_id=placeholder.split('A')
       console.log('The table_id is '+table_id[1]);
       var table_string='s_'+table_id[1]+'_l';
       console.log("The table_string value is "+table_string);
         $('#'+table_string).css('border','2px solid black');//This code works
        var i=0;
        $('#'+table_string+' tbody tr').each(function()
        {
        console.log("Inside the function");
        i++;
        var x=i+'Account_Status';
        console.log(x);
        $('#'+x).attr('name');
        var valuee= $('#'+x).attr('name');
        console.log(valuee);//Gives me undefined all the time

        });

    };

Can somebody please help me with the situation?Thanks in advance

A: Hey Geethu Ann Joseph,
I assume you have here a List Applet with a lot of values.
You should always try to work with Siebel Open UI Commands, espacially in this case because you want to get the values from the Front-End (this can be a bad side effect in some cases) so try to get the information right out of the Business Component, with the Siebel Open UI Commands.
So lets assume you want all informations out of an List Applet you should get the ResultSet and then read the values out of it.
var resultSet = this.GetPM().Get("ResultSet");

it will return you a JavaScript Object with all results in the List so you can read the value that you want to use.
Then you have to read it with,...
var resultSet = this.GetPM().Get("ResultSet");
resultSet[<<RowID>>][<<Control Name>>]
Example: resultSet[0]["Status"]

I hope that helped you and good luck in the next steps of Open UI.
Kind regards,
Myracle


text:
Q: What window.postMessage emulation options are there for IE7? I'm aware of the hacks using hash tags, however, I need bi-directional communication with larger payloads and higher throughput.  Are there any Flash/ActiveX/etc options that make this possible?

A: Jquery windowMsg plugin provides a good all browser compliant solution.
See an example:
http://iterativo.wordpress.com/2010/03/24/using-jquery-to-communicate-between-browser-windows/
A link to the plugin code:
http://go-trendy.com/javascripts/jquery.windowmsg-1.0.js?1279359701

A: EasyXDM is the closest I can think of, although it isn't a postMessage() polyfill, so would need a lot of work. Also as at Sept 2012, there is a note saying that EasyXDM isn't working for IE6/IE7 - YMMV.


text:
Q: Rails: undefined local variable or method `params' I'm working on a Rails 4.2.6 app. I need to transfer a table params from the controller to the model. Doing this I'm getting this error undefined local variable or method 'params' I'm trying to transfer the next line of code html += params[:table_data].gsub('', '✔') if params[:table_data].present? into the model in this lines of codes:
if !element.nil?
          html += ""
          html += params[:table_data].gsub('', '✔') if params[:table_data].present?
          html += "	"
        else
          html += "	"
        end

Here above I'm getting the error but I cannot figure out was I'm doing wrong.
Next Pastebin is the model and the controller related to this issue:
https://pastebin.com/cVy9QRCy
https://pastebin.com/ApZSgYFE
If I keep as was original my app still working but I cannot have table elements inside the controller and I need to transfer the same to the model. I need to understand what wrong I'm doing.

A: Above answer tells you correctly that you probably don't want to do it that way, but in case you really want to, the thing that you have to do is make @params = the_params or in the same way set a variable with @ sign and that variable will be available in your view.

A: Not sure if this will be useful. Transfering variables from Controller to views you should be using @varaible...
If you are transfer to a model it has to be done within a function in the Model.rb file.

A: In your model, you already have an example of a method that receives the params, here:
def update_state(params)
  self.update(params)
  self.reload
  self.next_state_version
  self.save
end

And example of how you call such a method from the controller, here:
def update_status
  find_token
  if @token.nil?
    flash[:error] = "The changes were not saved as the edit lock has timed out."
  else
    @study_version.update_state(the_params)
    AuditTrail.update_item_event(current_user, @study.identifier, @study_version.semantic_version, "Study version updated")
    @token.release
  end
  redirect_to history_study_path(@study)
end

So, in your model, do:
def soa(params)
  ...
end

And in your controller:
def soa
  @study_version = StudyVersion.find(params[:id])
  render text: @study_version.soa(the_params).html_safe
end

Having said that, I would also add that a lot of this logic and code should, IMO, be moved into service objects and presenters. You have way too much (again, IMO) going on in your controllers and pushing that into your models isn't that much better. You're just stuffing your junk in another drawer.

A: You don't transfer params from controllers to views. Use instance variable instead. If you declare a variable params in your controller it will be available in your view.
You need to clear your MVC concepts first.


text:
Q: Box-Jenkins model selection The Box-Jenkins model selection procedure in time series analysis begins by looking at the autocorrelation and partial autocorrelation functions of the series. These plots can suggest the appropriate $p$ and $q$ in an ARMA$(p,q)$ model. The procedure continues by asking the user to apply the AIC/BIC criteria to select the most parsimonious model among those that produce a model with a white noise error term.
I was wondering how these steps of visual inspection and criterion-based model selection impact the estimated standard errors of the final model. I know that many search procedures in a cross-sectional domain can bias standard errors downward, for example.
On the first step, how does selecting the appropriate number of lags by looking at the data (ACF/PACF) impact the standard errors for time series models?
I would guess that selecting the model based upon AIC/BIC scores would have an impact analogous to that for cross-sectional methods. I actually don't know much about this area either, so any comments would be appreciated on this point as well.
Lastly, if you wrote down the precise criterion used for each step, could you bootstrap the entire process to estimate the standard errors and eliminate these concerns?

A: In my opinion selecting the appropriate number of lags is no different than selecting the number of input series in a stepwise forward regression procedure. The incremental importance of lags or a specific input series is the basis for the tentative model specification.
Since you have asserted that the acf/pacf is the only basis for Box-Jenkins model selection, let me tell you what some experience has taught me. If a series exhibits an acf that doesn't decay, the Box-Jenkins approach (circa 1965) suggests differencing the data. But if a series has a level shift, like the Nile data, then the "visually apparent" non-stationarity is a symptom of needed structure but differencing is not the remedy. This Nile dataset can be modeled without differencing by simply identifying the need for a level shift first. In a similar vein we are taught using 1960 concepts that if the acf exhibits a seasonal structure (i.e. significant values at lags of s,2s,3s,...) then we should incorporate a seasonal ARIMA component. For discussion purposes, consider a series that is stationary around a mean and at fixed intervals, say every June there is a "high value".  This series is properly treated by incorporating an "old-fashioned" dummy series of 0 and 1's (at June) in order to treat the seasonal structure. A seasonal ARIMA model would incorrectly use memory instead of an unspecified but waiting-to-be-found X variable. These two concepts of identifying/incorporating unspecified deterministic structure are direct applications of the work of I. Chang, William Bell, George Tiao, R.Tsay, Chen et al (starting in 1978) under the general concept of Intervention Detection.
Even today some analysts are mindlessly performing memory maximization strategies, calling them Automatic ARIMA, without recognizing that "mindless memory modeling" assumes that deterministic structure such as pulses, level shifts, seasonal pulses and local time trends are non-existent or worse yet play no role in model identification. This is akin to putting one's head in the sand, IMHO.

A: Any model selection procedure will affect the standard errors and this is hardly ever accounted for. For example, prediction intervals are computed conditionally on the estimated model and the parameter estimation and model selection are usually ignored.
It should be possible to bootstrap the whole procedure in order to estimate the effect of the model selection process. But remember that time series bootstrapping is trickier than normal bootstrapping because you have to preserve the serial correlation. The block bootstrap is one possible approach although it loses some serial correlation due to the block structure.


text:
Q: Ubuntu Touch on Nexus 7. Is it legal to install on that device? I want to install Ubuntu Touch on multiple devices on Nexus 7. Is it legal.
The reason I am asking is that I am reading that rooting Android tablet devices is technically illegal.
But installing another OS is like  a multi boot install. Is it legal to install another OS on the Nexus? Would appreciate a link to a license doc about this.
Thanks

A: Rooting a Android device and installing a Custom ROM or another OS device isn't illegal. You will lost your warranty, that's all.

A: They might not like it, but it's not illegal.
If it's a Nexus 7 2012 then I think it's a good idea as the Lollipop update has made it pretty much unusable anyway.
That said, it looks like the 2012 version is no longer supported by Ubuntu touch.