text:
Q: How to use only one ADC channel on MAX10 I have an ADC core
component adc_qsys is
port (
    adc_1_command_valid          : in  std_logic                     := '0';
    adc_1_command_channel        : in  std_logic_vector(4 downto 0)  := (others => '0');
    adc_1_command_startofpacket  : in  std_logic                     := '0';
    adc_1_command_endofpacket    : in  std_logic                     := '0';
    adc_1_command_ready          : out std_logic;
    adc_1_response_valid         : out std_logic;
    adc_1_response_channel       : out std_logic_vector(4 downto 0);
    adc_1_response_data          : out std_logic_vector(11 downto 0);
    adc_1_response_startofpacket : out std_logic;
    adc_1_response_endofpacket   : out std_logic;
    clk_clk                      : in  std_logic                     := '0';
    reset_reset_n                : in  std_logic                     := '0'
);
end component adc_qsys;

U_ADC_SYS : adc_qsys
port map
(
    clk_clk        => s_pll_clk_10M,
    reset_reset_n  => '1',

    adc_1_command_valid          => adc1_com_valid,
    adc_1_command_channel        => adc1_com_channel,
    adc_1_command_startofpacket  => adc1_com_startofpacket,
    adc_1_command_endofpacket    => adc1_com_endofpacket,
    adc_1_command_ready          => adc1_com_ready,
    adc_1_response_valid         => adc1_resp_valid,
    adc_1_response_channel       => adc1_resp_channel,
    adc_1_response_data          => adc1_resp_data,
    adc_1_response_startofpacket => adc1_resp_startofpacket,
    adc_1_response_endofpacket   => adc1_resp_endofpacket
);

When I used the whole port ADC1_IN1 - ADC1_IN8 was no problem.
Now I want to use only one channel - ADC1_IN1 so I set only CH1 active in the core.

However I get the errors while compiling

Error (176310): Can't place multiple pins assigned to pin location Pin_7 (IOPAD_X0_Y37_N21)
Info (176311): Pin LED_CMD[5] is assigned to pin location Pin_7 (IOPAD_X0_Y37_N21)
Info (176311): Pin ~ALTERA_ADC1IN2~ is assigned to pin location Pin_7 (IOPAD_X0_Y37_N21)
Error (176310): Can't place multiple pins assigned to pin location Pin_8 (IOPAD_X0_Y36_N14)
Info (176311): Pin LED_CMD[6] is assigned to pin location Pin_8 (IOPAD_X0_Y36_N14)
Info (176311): Pin ~ALTERA_ADC1IN3~ is assigned to pin location Pin_8 (IOPAD_X0_Y36_N14)
Error (176310): Can't place multiple pins assigned to pin location Pin_10 (IOPAD_X0_Y36_N21)
Info (176311): Pin LED_CMD[7] is assigned to pin location Pin_10 (IOPAD_X0_Y36_N21)
Info (176311): Pin ~ALTERA_ADC1IN4~ is assigned to pin location Pin_10 (IOPAD_X0_Y36_N21)
Error (176310): Can't place multiple pins assigned to pin location Pin_11 (IOPAD_X0_Y35_N14)
Info (176311): Pin LED_CMD[8] is assigned to pin location Pin_11 (IOPAD_X0_Y35_N14)
Info (176311): Pin ~ALTERA_ADC1IN5~ is assigned to pin location Pin_11 (IOPAD_X0_Y35_N14)
Error (176310): Can't place multiple pins assigned to pin location Pin_12 (IOPAD_X0_Y35_N21)
Info (176311): Pin LED_CMD[9] is assigned to pin location Pin_12 (IOPAD_X0_Y35_N21)
Info (176311): Pin ~ALTERA_ADC1IN6~ is assigned to pin location Pin_12 (IOPAD_X0_Y35_N21)
Error (176310): Can't place multiple pins assigned to pin location Pin_13 (IOPAD_X0_Y34_N14)
Info (176311): Pin LED_TEST is assigned to pin location Pin_13 (IOPAD_X0_Y34_N14)
Info (176311): Pin ~ALTERA_ADC1IN7~ is assigned to pin location Pin_13 (IOPAD_X0_Y34_N14)
Error (176310): Can't place multiple pins assigned to pin location Pin_14 (IOPAD_X0_Y34_N21)
Info (176311): Pin LED_FLTn is assigned to pin location Pin_14 (IOPAD_X0_Y34_N21)
Info (176311): Pin ~ALTERA_ADC1IN8~ is assigned to pin location Pin_14 (IOPAD_X0_Y34_N21)

How can I resolve the problem?

A: Looks Like you have a second module which has ports LED_CMD and LED_TEST that are using the same FPGA outputs. Take a look at your constraints/IO placement and move the other module to some other pins. That should fix it.
You could use the same bank for 2 different modules assuming the outputs are the same IO spec (LVCMOS33 etc.) as long as multiple outputs don't map to the same pin. Especially here, if you're only using 1 channel of the ADC, there's no reason for the other pins in the bank to not be used.


text:
Q: If $B_t$ is standard Brownian Motion, how to show that $X_t = B_t^2-t$ is a martingale? If $(B_t, \mathcal{F}_t)$ is standard Brownian Motion, I would like to show that $X_t = B_t^2-t$ is a martingale. My attempted proof works as follows:
\begin{align}
E(X_{t+1}|\mathcal{F}_t) & = E(B_{t+1}^2-(t+1)|\mathcal{F}_t)  \\
&= E(B_{t+1}^2|\mathcal{F}_t) -(t+1) \\
&= Var(B_{t+1}|\mathcal{F}_t) +E(B_{t+1}|\mathcal{F}_t)^2 - (t+1) \\
&= (t+1)+B_{t+1}^2 -(t+1)
\end{align}
However, I believe that the decomposition into variance shouldn't work. Does anyone have any ideas where I went wrong? Thanks

A: Use the fact that $(B_t-B_s)$ is independent of $\mathcal{F}_s$ and calculate the following expectation:
$$
\mathbb{E}[B_t^2\mid \mathcal{F}_s]=\mathbb{E}[(B_t-B_s+B_s)^2\mid \mathcal{F}_s].
$$

A: Define the function $f(t,x) : = x^2 - t$ and observe that $\partial_t f(t,x) = -1$ and $\partial_x^2 f(t,x) = 2$. We then see that $\partial_t f(t,x) = - \frac{1}{2} \partial_x^2 f(t,x)$ and therefore $(X_t)_{t \geq 0}$ defines a local martingale. To see that $(X_t)_{t \geq 0}$ is actually a full martingale, we need to show that for each $T > 0$, that \begin{eqnarray*}
\mathbb{E} \left( \int_0^T \left| \partial_x f(t,x) \right|^2 dt \right) & < & \infty.
\end{eqnarray*} To this  end, we simply observe that \begin{eqnarray*}
\mathbb{E} \left( \int_0^T \left| \partial_x f(t,x) \right|^2 dt \right) &=& \int_0^T \int_{-\infty}^{\infty} \frac{1}{\sqrt{2\pi t}} 2x \exp \left( - \frac{x^2}{2} \right) dx dt \\
&=& \int_0^T \frac{1}{\sqrt{2\pi t}} dt \int_{-\infty}^{\infty} 2x \exp \left( - \frac{x^2}{2} \right) dx \\
&=& 2\sqrt{T} \cdot 0 = 0  < \infty.
\end{eqnarray*} So $(f(t,B_t))_{t \geq 0}$ defines a martingale.

redpajama_set_name: RedPajamaStackExchange


text:
Q: 'TextRenderer.MeasureText' giving distinct size than 'Graphics.MeasureString' I suppose that exist a known clarification about why those methods always return distinct sizes, but anyways I will explain the problem a little:
I've subclassed a Progressbar, when I try to get the size of the same text with the same font, I get distinct values, TextRenderer.MeasureTextgives me a rounded value of 13 height and 300 width while Graphics.MeasureString gives me a very precise height of 13,xxxxxx and a minor width of 275,xxxxxxx
Why happens that?.
I'm not doing nothing especial in the code, just I've tried to use both methods to compare whether it gives me the same result or not to decide which to use in my code.
The overload of TextRenderer.MeasureText that I've tried to use is:
TextRenderer.MeasureText(String, Font)

And the Graphics.MeasureString method expects the same parameters:
Graphics.MeasureString(String, Font)

A: TextRenderer.MeasureText returns a Size so the values are integer.  Graphics.MeasureString returns a SizeF containing floats.
Both are "raw values" though.  When testing to see if some text will fit somewhere, you may also need to take into account Control.Padding which each Type may implement differently.
275 vs 300 seems like a large variance though.  I have a checkbox thing that returns 82, 13 vs `82.85806, 13.8251925).


text:
Q: How to set change tracking on a Visual Studio database project (SSDT) I have a SQL Server 2005 DB project and am looking to deploy the Schema over an existing DB that is on a later version of SQL Server. The issue I have is that Change Tracking is enabled on the DB I wish to deploy to and so the first thing SSDT wants to do is disable CT. This poses a problem as I get the error below:

(43,1): SQL72014: .Net SqlClient Data Provider: Msg 22115, Level 16,
State 1, Line 5 Change tracking is enabled for one or more tables in
database 'Test'. Disable change tracking on each table before
disabling it for the database. Use the sys.change_tracking_tables
catalog view to obtain a list of tables for which change tracking is
enabled. (39,0): SQL72045: Script execution error.  The executed
script:
IF EXISTS (SELECT 1
       FROM   [master].[dbo].[sysdatabases]
       WHERE  [name] = N'$(DatabaseName)')
BEGIN
    ALTER DATABASE [$(DatabaseName)]
        SET CHANGE_TRACKING = OFF
        WITH ROLLBACK IMMEDIATE;
END

In an effort to get around this I have created a PreDeployment script that executes the below:
/* Run pre-deployment scripts to resolve issues */
IF(SELECT SUBSTRING(@@VERSION, 29,4)) = '11.0'

BEGIN

PRINT 'Enabling Change Tracking';

DECLARE @dbname VARCHAR(250)
SELECT @dbname = DB_NAME()

EXEC('
        IF NOT EXISTS(SELECT * FROM [master].[dbo].[sysdatabases] WHERE name = ''' + @dbname + ''')

        ALTER DATABASE ['+ @dbname +
        ']SET CHANGE_TRACKING = ON
        (CHANGE_RETENTION = 5 DAYS, AUTO_CLEANUP = ON);
');

EXEC('
IF NOT EXISTS(SELECT * FROM sys.change_tracking_tables ctt
          INNER JOIN sys.tables t ON t.object_id = ctt.object_id
          INNER JOIN sys.schemas s ON s.schema_id = t.schema_id
          WHERE t.name = ''TableName'')
BEGIN
    ALTER TABLE [dbo].[TableName] ENABLE CHANGE_TRACKING;
END;');

So based on the DB Version Change Tracking is set to enabled on the DB and relevant Tables assuming it is not already enabled.I got this idea from a previous post: # ifdef type conditional compilation in T-SQL sql server 2008 2005
Unfortunately this is still not working as SSDT is trying to disable Change Tracking before the PreDeployment script is executed.

A: Make sure change tracking is enabled in your database project.
Open your database project's properties > Project Settings > Database Settings... > Operational tab > check the "Change tracking" option

A: As Keith said if you want it in enable it. If you do want to disable it then just run your script before doing the compare so you have a pre-pre-deploy script like:
https://the.agilesql.club/Blog/Ed-Elliott/Pre-Compare-and-Pre-Deploy-Scripts-In-SSDT
If you are disabling it then it is a one off thing so pretty simple.
Other options are to write your own deployment contributor and raising a bug via connect.
Deployment Contributor:
https://the.agilesql.club/blog/Ed-Elliott/2015/09/23/Inside-A-SSDT-Deployment-Contributor
https://github.com/DacFxDeploymentContributors/Contributors
Ed


text:
Q: How can I generation sine function faster in c Is there anyway in which i can compute sine function faster in c.When i generate a sine waveform with 16,384 samples it is taking me 3.96 seconds and I want it less than 1 sec.
Give below is the logic i used for sine wave  and it is taking almost 4 seconds to compute.I  also tried optimization of the code but its of no help.
Someone please help me out
int i;
float f,temp = (2 * M_PI) /16384

for(i=0;i<16384;i++)
{
    f = sin(temp * i);
}

A: There's no reason that you have to compute f more than once, ever. If performance is so critical, hardcode the array of values into the source.

A: Floating point can be very slow in embedded implementations, but I don't believe it can be slower to index an array. This will create a C source file to #include in the project. I presume OP wanted an unsigned integer table, modify if not what was wanted. If you want to save on code space, code only the first quadrant and do a simple runtime adjustment of the lookup index and value for the other quadrants.
#define _USE_MATH_DEFINES 1
#include <stdio.h>
#include <stdlib.h>
#include <math.h>

#define TRIGPOINTS  16384
#define AMPLITUDE   8192.0
//#define M_PI        3.14159265358979323846

int main(int argc, char **argv)
{
    FILE *fout;
    char *filename = "sinetable.c";
    int i;
    double d;
    if( (fout = fopen( filename, "w" )) == NULL ) {
        printf( "The file '%s' was not opened\n", filename );
        exit (1);
        }
    fprintf (fout, "#define TRIGPOINTS  %u\n", TRIGPOINTS);
    fprintf (fout, "#define AMPLITUDE   %f\n", AMPLITUDE);
    fprintf (fout, "\unsigned sintab [%u] = { ", TRIGPOINTS);
    for (i=0; i<TRIGPOINTS; i++)
        {
        if (i)
            fprintf (fout, ", ");
        if ((i % 10) == 0)
            fprintf (fout, "\n    ");
        d = AMPLITUDE + AMPLITUDE * sin(2.0 * M_PI * (double)i / TRIGPOINTS);
        fprintf (fout, "%u", (unsigned)d);
        }
    fprintf (fout, " };\n");
    fclose (fout);
    return (0);
}

The C source generated looks like this:
#define TRIGPOINTS  16384
#define AMPLITUDE   8192.000000
unsigned sintab [16384] = {
    8192, 8195, 8198, 8201, 8204, 8207, 8210, 8213, 8217, 8220,
    8223, 8226, 8229, 8232, 8235, 8239, 8242, 8245, 8248, 8251,
    ...


text:
Q: Check if duplicate array pairs exist using underscore only I am wondering how I can check if a duplicate pair of values in an array exist as part of a larger array in javascript. You can see there is a duplicate pair of [1,2] - so the function should just return true. i.e
var arr = [[1,2], [3,4], [5,6], [7,8], [9,10], [11,12], [13,14], [1,2]]

I have tried using this logic which gives me a clean array and a "true"
var unique = [];
var done = []; var dup = false;
for(var x = 0; x < arr.length; x++) {
    var myStr = arr[x].toString();

    if(done.indexOf(myStr) != -1) {
        // val already exist, ignore
        dup = true;
        continue;
    }

    done.push(myStr);
    unique.push(arr[x]);
}

But I was wondering if there is something more elegant using Underscore ?

A: The shortest way would be to use _.uniq and JSON.stringify:
function unique(arr) {
    return _.uniq(arr, JSON.stringify).length === arr.length;
}

But that doesn't short-circuit, so it's somewhat slow compared to the other ways you could do it. Tomalak's second function should be faster.

A: Well, uniq seems like a good fit

function containsDuplicates(arr) {
  return arr.length !== _.uniq(arr, function (item) { return item.toString(); }).length;
}

You should use Blender's version of this function. It's shorter and safer.

BTW, your code should look more like this:
function containsDuplicates(arr) {
    var index = {}, i, str;

    for(i = 0; i < arr.length; i++) {
        // you could use arr[i].toString() here, but JSON.stringify()
        // is a lot safer because it cannot create ambiguous output.
        str = JSON.stringify(arr[i]);
        if (index.hasOwnProperty(str)) {
            return true;
        } else {
            index[str] = true;
        }
    }

    return false;
}

Note that this is probably more efficient than the underscore one-liner.

A: Although stringify is the answer most of the time, it still has its issues, for example {"x":1,"y":2} and {"y":2,"x":1} are considered different. If you need a 100% accurate comparison, there's no other way as to store already processed objects and deep compare them (luckily, underscore provides an utility for this).
uniq2 = function(xs) {
    return _.reduce(xs, function(result, x) {
        if(!_.any(result, _.partial(_.isEqual, x)))
            result.push(x);
        return result;
    }, []);
}

Test:
var arr = [[1,2], [3,4], "1,2", "[1,2]", [1,2], {x:1,y:2}, {y:2,x:1}]
console.log(uniq2(arr))
// [[1,2],[3,4],"1,2","[1,2]",{"x":1,"y":2}]

This is going to be quadratic in the worst case, but there's no other way.


text:
Q: How do I remove results based on conditions to calculate an average I have the schema below. A quick explanation of it is:

*

*bob rated up 5/5

*james rated up 1/5

*macy rated up 5/5

The logic:

*

*If I am personA, look up everyone I have blocked.

*Look up all the movie reviews.

*Anyone who has left a movie review, and personA has blocked, remove them from the calculation.

*Calculate the average rating of the movies.

CREATE TABLE movies (
  id integer AUTO_INCREMENT primary key,
  name varchar(100) NOT NULL
);

CREATE TABLE customer (
  id integer AUTO_INCREMENT primary key,
  name varchar(100) NOT NULL
);

CREATE TABLE reviews (
  id integer AUTO_INCREMENT primary key,
  rating integer NOT NULL,
  cus_id integer NOT NULL,
  movie_id integer NOT NULL,
  FOREIGN KEY (cus_id) REFERENCES customer(id),
  FOREIGN KEY (movie_id) REFERENCES movies(id)
);

CREATE TABLE blocked(
  id integer AUTO_INCREMENT primary key,
  cus_id integer NOT NULL, -- This is the person blocking
  blocked_cus_id integer NOT NULL, -- This is the person who is blocked
  FOREIGN KEY (cus_id) REFERENCES customer(id),
  FOREIGN KEY (blocked_cus_id) REFERENCES customer(id)
);

INSERT INTO movies (id, name) VALUES (1, 'up');
INSERT INTO customer (id, name) VALUES (1, 'bob'), (2, 'james'), (3, 'macy');
INSERT INTO reviews (id, rating, cus_id, movie_id) VALUES (1, 5, 1, 1), (2, 1, 2, 1), (3, 5, 3, 1);
INSERT INTO blocked (id, cus_id, blocked_cus_id) VALUES (1, 1, 2);

I don't understand how I can get rid of reviews if its on a block list
SELECT m.name, avg(r.rating) as avg_rating
FROM movies m
JOIN reviews r ON m.id = r.movie_id
JOIN blocked b on r.cus_id = b.blocked_cus_id
WHERE b.cus_id = 1 -- Viewing the database as bob

When I view the database as bob, I should get:
+-------+------------+
| movie | avg_rating |
+-------+------------+
| up    |          5 |
+-------+------------+

When I view the database as macy, I should get:
+-------+------------+
| movie | avg_rating |
+-------+------------+
| up    |       3.67 |
+-------+------------+

A: I don't know how to express your logic without using an exists clause. I might try here:
SELECT m.name, AVG(r.rating) AS avg_rating
FROM movies m
INNER JOIN reviews r ON m.id = r.movie_id
WHERE NOT EXISTS (SELECT 1 FROM blocked b
                  WHERE b.blocked_cus_id = r.cus_id AND b.cus_id = 1)
GROUP BY m.name;

Note that we want to aggregate by movie name, so we need GROUP BY here.  The exists clause says to exclude from the average rating any review for which we can find a blocked entry belonging to a certain customer (in this case, cus_id = 1).


text:
Q: How to delay between to sets of keystrokes and mouse events in two different sheets What is the way to delay two session of mouse events and key strokes in Excel? let say I perform two session in two different sheets:
sheet 1:
right click -> key stroke R -> write 100 chars -> press enter

after that:
switch to sheet 2:
right click -> key stroke R -> write 100 chars -> press enter

I used this delay but it seems that only the second sets of commands happens
Application.Wait DateAdd("s", 10, Now)

A: maybe you can try "onTime"? And I cannot reproduce your problem. Would you mind posting more codes?
Sub testing()
macroA
Application.OnTime DateAdd("s", 2, Now), "macroB"
End Sub

Sub macroA()
MsgBox "A"
End Sub
Public Sub macroB()
MsgBox "B"
End Sub


text:
Q: React JS: Programmatically use React-Router to send props What this Question is trying to figure out is simple:
"Can I send props programatically from one scene to another, and if so, how?"
Below I have provided a sample set of code in the hope that someone will have the knowledge to clear this up once and for all.
App.js file:
const Main = () => (
    <main>
        <Switch>
            <Route exact path='/Job' component={Job}/>
            <Route path='/Preview' component={Preview}/>
        </Switch>
    </main>

Job.js:
Long story short, the file takes input and outputs once the user clicks submit, this function is called:
 handleClick(){
    //The state I wish to pass: this.state.propToPass
    //my current implementation for moving to the correct scene:
    this.props.history.push('/Preview')

}

Preview.js
constructor(props){
    super(props)
    //console.log(the prop that has been sent)
}

I will be eternally gratuful to anyone who understands the problem and can shed some light on my dilemma.
Thank you very much.

A: Here's an example with withRouter. It's a higher order function that returns the child component with the router attached so you can switch routes programmatically.
Moving to the answer, by sending an object instead of just a string. You can specify data to send across as state by attaching a property within the object called state which will consist of data that you want to send across.

import React from 'react';
import {withRouter} from 'react-router-dom';

class Test extends React.Component {
  _handleClick = () => {
    this.props.history.push({
      pathname: '/roster',
      state: {
        'hello': 'world',
      }
    });
  }
  render() {
    return (
      <button onClick={this._handleClick}>Go To Roster Programmatically</button>
    )
  }
}

export default withRouter(Test);

A: I highly recommend using redux-form as it uses a reducer to save the state of the form. Then, after routing to the desired component, you can connect that component to the form state as well to get the info you need.
It is a powerful tool that helps you manage the state of forms, and it sounds like what you need.


text:
Q: StaleDataException: Access closed cursor error when rebuilding ListView My app has a Listview which orders a list of Lectures. They are colour coded according to type, the custom adapter I use to do this is called by the following code -
cursor = myDbHelper.getReadableDatabase().rawQuery(sql, null);
startManagingCursor(cursor);
adapter = new Lectures_Adapter(this,R.layout.menu_item,cursor,FROM,TO);
menuList.setAdapter(adapter);

The code in my custom adapter is -
   public class Lectures_Adapter extends SimpleCursorAdapter {
     private Context appContext;
     private int layout;
     private Cursor mycursor;

     public Lectures_Adapter(Context context, int layout, Cursor c, String[] from,int[] to) {
          super(context, layout, c, from, to);
          this.appContext=context;
          this.layout=layout;
          this.mycursor=c;
     }

     @Override
     public View getView(int position, View convertView, ViewGroup parent)
     {
          View view = super.getView(position, convertView, parent);
          try {
             if (position > 0)
             {
                RelativeLayout rowFill = (RelativeLayout) convertView.findViewById(R.id.rowFill);
                String title = mycursor.getString(1);
                int myColor = 0;
                int myPos = title.indexOf("Nursing");
                int myPos2 = title.indexOf("Masterclass");
                if (myPos >= 0)
                {
                    myColor = Color.parseColor("#99FF66");
                }
                else if (myPos2  >= 0)
                {
                    myColor = Color.parseColor("#FF99FF");
                }
                else
                {
                    myColor = Color.parseColor("#FFFF66");
                }
                convertView.findViewById(R.id.rowFill).setBackgroundColor(myColor);
              }
           }catch(Exception e) {

           }

          if (convertView == null) {
              LayoutInflater inflator = (LayoutInflater) this.appContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
              convertView = inflator.inflate(this.layout,null);
          } else {
              convertView = (View) convertView;
          }
          return view;
      }

   }

I have a button which displays a Dialog box which offers the option to re-order the Listview in four different ways. When they have selected an option I re-order the Listview using the following code -
      Cursor newCursor = myDbHelper.getReadableDatabase().rawQuery(sqlStr, null);
      adapter.changeCursor(newCursor);
      adapter.notifyDataSetChanged();

This all seems to work ok, except when I re-order and the above code is called, when it runs getView I get the following error 'StaleDataException: Access closed cursor'. This is apparantly because the cursor is closed, what am I doing wrong?

A: The problem is solved when you use getCursor() to grab the current cursor value.


text:
Q: How to query all the records with only null or empty fields in solr I am trying to query only those records which have either null or empty value for an attribute. Suppose my schema have name fields and sirname field now I want to select all the names which have sirname as null or empty in solr. I have tried using:
?q=-sirname:["" TO *]

But this is giving me all the records.


text:
Q: Ionic 2 File Storage I am currently trying to write a PDF that was created using PDFMake to file, and then take that file and attach it to an email. I have spent 6 hours trying to do this and I keep getting errors.
Below is my code for exporting the PDF. I tested the PDF in serve using createPDF.open() and it worked. I have also printed the Base64 data in the console.
exportPDF() {
    console.log("ExportPDF()")
    this.pdf = pdfMake;
    // For use in browser(web)
    //this.pdf.createPdf(getDocDefinition(this.issues, this.project, this.report)).open();
    let data : string;
    let newPDF;

    this.pdf.createPdf(getDocDefinition(this.issues, this.project, this.report)).getBase64((buffer) => {
      data = buffer;
      console.log("newPDF: " + data)
    });

    // this.pdf.createPdf(getDocDefinition(this.issues, this.project, this.report)).getBuffer((buffer) => {
    //   data = buffer.toArrayBuffer();
    //   console.log("newPDF: " + data)
    // });

    // Platforms
    if (this.plat.is('ios')) {
      console.log("Platform: ios")

      let file = "testFingering.pdf"

      console.log(cordova.file.cacheDirectory);

      File.removeFile(cordova.file.cacheDirectory, file);
      File.writeFile(cordova.file.cacheDirectory, file, data).then(() => {
        // Success!
        console.log("writeFile: success!")

        SocialSharing.share("tits", "tits", cordova.file.cacheDirectory + file).then(() => {
          // Success!
          console.log("shareViaEmail: success!")
        }).catch((err) => {
          // Error!
          console.log("shareViaEmail: fail!  " + err)
        });

      }).catch((err) => {
        // Error!
        console.log("writeFile: fail!  " + JSON.stringify(err));
      });

    } else if (this.plat.is('android')) {
      console.log("Platform: android")

    } else if (this.plat.is('windows')) {
      console.log("Platform: windows")

    } else {
      console.log("Platform: web")

    }

  }

Here are the errors I am receiving:
2017-01-31 20:40:12.997343 CMTA[1725:417453] writeFile: fail!  {"code":12,"message":"PATH_EXISTS_ERR"}
2017-01-31 20:40:13.013456 CMTA[1725:417453] writeFile: fail!  {"code":"Invalid parameter type"}

I am only executing this code once, so 1) I am not sure why it is logging two errors.
2) I know "PATH_EXISTS_ERR" means the path already exists, but if you look in the code, I am deleting the file and recreating it every time.
3) What parameter should I be inputing? It says it will accept "text", should I be using something else? I tried toBufferArray() before because that's what I did in my Ionic 1 version of this app, but that isn't working anymore.
I would greatly appreciate any help as this is frustrating me to no end.

A: Well I ended up getting everything. I had to do two steps though.
1) I had to move the File.writeFile() into the response from my createPDF() call.
2) I had to getBuffer() instead of getBase64() and then found a function on the internet for toBufferArray().
Here is the final code:
exportPDF() {
    console.log("ExportPDF()")
    this.pdf = pdfMake;
    // For use in browser(web)
    //this.pdf.createPdf(getDocDefinition(this.issues, this.project, this.report)).open();
    let data;
    let file = "test11.pdf";
    let newPDF;

    this.pdf.createPdf(getDocDefinition(this.issues, this.project, this.report)).getBuffer((buffer) => {
      data = this.toArrayBuffer(buffer);
      console.log("newPDF: " + data);
      console.log(cordova.file.cacheDirectory + file);
      File.removeFile(cordova.file.cacheDirectory, file);
      File.writeFile(cordova.file.cacheDirectory, file, data, true).then(() => {
        // Success!
        console.log("writeFile: success!");

        SocialSharing.share("tits", "tits", cordova.file.cacheDirectory + file).then(() => {
          // Success!
          console.log("shareViaEmail: success!")
        }).catch((err) => {
          // Error!
          console.log("shareViaEmail: fail!  " + err)
        });

      }).catch((err) => {
        // Error!
        console.log("writeFile: fail!  " + JSON.stringify(err));
      });
    });

    // this.pdf.createPdf(getDocDefinition(this.issues, this.project, this.report)).getBuffer((buffer) => {
    //   data = buffer.toArrayBuffer();
    //   console.log("newPDF: " + data)
    // });

  }

  toArrayBuffer(buf) {
    let ab = new ArrayBuffer(buf.length);
    let view = new Uint8Array(ab);
    for (let i = 0; i < buf.length; ++i) {
      view[i] = buf[i];
    }
    return ab;
  }


text:
Q: How to get data in descending order from firebase? i have tried this code
let newRef = Database.database().reference().root.child("recentlocations").child(Auth.auth().currentUser!.id)

but its return data in ascending order and i want to get data in reverse order means in descending order. So what i have to do for that purpose?


text:
Q: заполнение модели несколько раз Yii2 Даже не знаю как объяснить, поэтому лучше на примере:
-дана модель игра и модель скриншоты:
в форме заполняется таким образом
<?= $form->field($model, 'game_name')->textInput()->label('Название') ?>
<?= $form->field($screenshot, 'screensh_path')->textInput()->label('Скриншот') ?>

а как мне заполнять модель Скриншоты допустим два раза
    <?= $form->field($model, 'game_name')->textInput()->label('Название') ?>
    <?= $form->field($screenshot, 'screensh_path')->textInput()->label('Скриншот1') ?>
    <?= $form->field($screenshot, 'screensh_path')->textInput()->label('Скриншот2') ?>


text:
Q: Templates polymorphism I have this structure of classes.
class Interface {
  // ...
};

class Foo : public Interface {
  // ...
};

template <class T>
class Container {
  // ...
};

And I have this constructor of some other class Bar.
Bar(const Container<Interface> & bar){
  // ...
}

When I call the constructor this way I get a "no matching function" error.
Container<Foo> container ();

Bar * temp = new Bar(container);

What is wrong? Are templates not polymorphic?

A: No. Imagine that the container parameter is "hardcoded" into the class it defines (and that is actually how it works). Hence the container type is Container_Foo, that is not compatible with Container_Interface.
What you might try however is this:
template<class T>
Bar(const Container<T> & bar){
...
}

Yet you loose direct type checking that way.
Actually the STL way (probably more effective and generic) would be to do
template<class InputIterator>
Bar(InputIterator begin, InputIterator end){
...
}

... but I assume you don't have iterators implemented in the container.

A: I think the exact terminology for what you need is "template covariance", meaning that if B inherits from A, then somehow T<B> inherits from T<A>. This is not the case in C++, nor it is with Java and C# generics*.
There is a good reason to avoid template covariance: this will simply remove all type safety in the template class. Let me explain with the following example:
//Assume the following class hierarchy
class Fruit {...};

class Apple : public Fruit {...};

class Orange : public Fruit {...};

//Now I will use these types to instantiate a class template, namely std::vector
int main()
{
    std::vector<Apple> apple_vec;
    apple_vec.push_back(Apple()); //no problem here

    //If templates were covariant, the following would be legal
    std::vector<Fruit> & fruit_vec = apple_vec;

    //push_back would expect a Fruit, so I could pass it an Orange
    fruit_vec.push_back(Orange());

    //Oh no! I just added an orange in my apple basket!
}

Consequently, you should consider T<A> and T<B> as completely unrelated types, regardless of the relation between A and B.
So how could you solve the issue you're facing? In Java and C#, you could use respectively bounded wildcards and constraints:
//Java code
Bar(Container<? extends Interface) {...}

//C# code
Bar<T>(Container<T> container) where T : Interface {...}

The next C++ Standard (known as C++1x (formerly C++0x)) initially contained an even more powerful mechanism named Concepts, that would have let developers enforce syntaxic and/or semantic requirements on template parameters, but was unfortunately postponed to a later date. However, Boost has a Concept Check library that may interest you.
Nevertheless, concepts might be a little overkill for the problem you encounter, an using a simple static assert as proposed by @gf is probably the best solution.
* Update: Since .Net Framework 4, it is possible to mark generic parameters has being covariant or contravariant.

A: It is possible to create an inheritance tree for containers, reflecting the inheritance tree of the data. If you have the following data:
class Interface {
public:
    virtual ~Interface()
        {}
    virtual void print() = 0;
};

class Number : public Interface {
public:
    Number(int value) : x( value )
        {}
    int get() const
        { return x; }
    void print()
        { std::printf( "%d\n", get() ); };
private:
    int x;
};

class String : public Interface {
public:
    String(const std::string & value) : x( value )
        {}
    const std::string &get() const
        { return x; }
    void print()
        { std::printf( "%s\n", get().c_str() ); }
private:
    std::string x;
};

You could also have the following containers:
class GenericContainer {
public:
    GenericContainer()
        {}
    ~GenericContainer()
        { v.clear(); }

    virtual void add(Interface &obj)
        { v.push_back( &obj ); }
    Interface &get(unsigned int i)
        { return *v[ i ]; }
    unsigned int size() const
        { return v.size(); }
private:
    std::vector<Interface *> v;
};

class NumericContainer : public GenericContainer {
public:
    virtual void add(Number &obj)
        { GenericContainer::add( obj ); }
    Number &get(unsigned int i)
        { return (Number &) GenericContainer::get( i ); }
};

class TextContainer : public GenericContainer {
public:
    virtual void add(String &obj)
        { GenericContainer::add( obj ); }
    String &get(unsigned int i)
        { return (String &) GenericContainer::get( i ); }
};

This is not the best performing code; it is just to give an idea. The only problem with this approach is that every time you add a new Data class, you have to also create a new Container. Apart from that, you have polymorphism "working again". You can be specific or general:
void print(GenericContainer & x)
{
    for(unsigned int i = 0; i < x.size(); ++i) {
        x.get( i ).print();
    }
}

void printNumbers(NumericContainer & x)
{
    for(unsigned int i = 0; i < x.size(); ++i) {
        printf( "Number: " );
        x.get( i ).print();
    }
}

int main()
{
    TextContainer strContainer;
    NumericContainer numContainer;
    Number n( 345 );
    String s( "Hello" );

    numContainer.add( n );
    strContainer.add( s );

    print( strContainer );
    print( numContainer );
    printNumbers( numContainer );
}

A: I propose the following workaround, which employs a template function. Although the example use Qt's QList, nothing prevents the solution from being straightforwardly transposed to any other container.
template <class D, class B> // D (Derived) inherits from B (Base)
QList<B> toBaseList(QList<D> derivedList)
{
    QList<B> baseList;
    for (int i = 0; i < derivedList.size(); ++i) {
        baseList.append(derivedList[i]);
    }
    return baseList;
}

Pros:

*

*general

*type-safe

*fairly efficient if the items are pointers or some other cheaply copy-constructible elements (such as implicitly shared Qt classes)

Cons:

*

*requires the creation of a new container, as opposed to enabling the reuse of the original one

*implies some memory and processor overhead both to create and to populate the new container, which depend heavily on the cost of the copy-constructor

A: There are two problems here: default constructions have the form MyClass c;; with parentheses it looks like a function declaration to the compiler.
The other problem is that Container<Interface> is simply a different type then Container<Foo> - you could do the following instead to actually get polymorphism:
Bar::Bar(const Container<Interface*>&) {}

Container<Interface*> container;
container.push_back(new Foo);
Bar* temp = new Bar(container);

Or of course you could make Bar or its constructor a template as Kornel has shown.
If you actually want some type-safe compile-time polymorphism, you could use Boost.TypeTraits is_base_of or some equivalent:
template<class T>
Bar::Bar(const Container<T>& c) {
    BOOST_STATIC_ASSERT((boost::is_base_of<Interface, T>::value));
    // ... will give a compile time error if T doesn't
    // inherit from Interface
}

A: container is a container of Foo objects not a container of Interface objects
And it cannot be polymorphic either, pointers to things can be ,but not the objects themselvs. How big would the slots in the container have to be for container if you could put anything derived from interface in it
you need
 container<Interface*>

or better
 container<shared_ptr<Interface> >

A: #include <iostream>
#include <sstream>
#include <map>
#include <vector>

struct Base { int b = 111; };
struct Derived: public Base { };

struct ObjectStringizer {
    template <typename T>
    static std::string to_string(const T& t) {
        return helper<T>()(t);
    }

    template <typename T, typename = void>
    struct helper {
        std::string operator()(const T& t) {
            std::ostringstream oss;
            oss << t;
            return oss.str();
        }
    };

    template <typename T>
    struct helper<T, typename std::enable_if<std::is_base_of<Base, T>::value>::type> {
        std::string operator()(const T& base) {
            return to_string(base.b);
        }
    };

    template <typename T>
    struct helper<std::vector<T>> {
        std::string operator()(const std::vector<T>& v) {
            std::ostringstream oss;
            for (size_t i = 0, sz = v.size(); i < sz; ++i) {
                oss << (i ? "," : "") << to_string(v[i]);
            }
            return "[" + oss.str() + "]";
        }
    };

    template <typename Key, typename Value>
    struct helper<std::map<Key, Value>> {
        std::string operator()(const std::map<Key, Value>& m) {
            std::ostringstream oss;
            for (auto iter = m.begin(), iter_end = m.end(); iter_end != iter; ++iter) {
                oss << (m.begin() != iter ? "," : "") << to_string(iter->first) << ":" << to_string(iter->second);
            }
            return "{" + oss.str() + "}";
        }
    };
};

int main(int argc, char* argv[]) {
    std::cout << ObjectStringizer::to_string("hello ") << ObjectStringizer::to_string(std::string("world")) << std::endl;
    std::cout << ObjectStringizer::to_string(Derived()) << std::endl;
    std::cout << ObjectStringizer::to_string(std::vector<int>{3, 5, 7, 9}) << std::endl;
    std::cout << ObjectStringizer::to_string(std::map<int, std::string>{{1, "one"}, {2, "two"}}) << std::endl;
    return 0;
}


text:
Q: Boot hangs: A start job is running In a virtual box I have a Debian that I sometimes want to run without X. So I edited /etc/grub.d/10_linux and added another menu item with a kernel option "nox" appended. Then I added a line to /lib/systemd/system/lightdm.service, Section [Unit]:
ConditionKernelCommandLine=!nox

However, when starting this, it hangs with the message:
A start job is running for Hold until boot process finishes up (56min / no limit)

Thank you, systemd for informing me about that. I wouldn't have noticed. Yet, I would like to know, which job it is that's hanging.
The system allows me to connect via SSH, but none of the systemctl or journalctl commands I tried did tell me the name of the service causing the problem. lightdm.service itself seems to be satisfied.

A: I known it's a but late, but I just found out that one can use:
systemctl list-jobs
to find out what units are waiting or running at any given moment.
By adding systemd.debug-shell=1 to the kernel command line, a root shell will be available on TTY9 (crlt+alt+F9) to run the command above.
I first tried "systemd-analyze", and that gave me the message about "systemctl list-jobs".
hope this helps someone with similar problems.


text:
Q: How to make CSS animation jump rather than slide I have the following animation... http://jsfiddle.net/5vwjy/1/
EDIT: Updated fiddle for all browsers... http://jsfiddle.net/5vwjy/2/
Using the following CSS...
.box {
  display:block;
  width:240px;
  height:100px;
 background: red url("http://southwestphotobooths.co.uk/sites/all/themes/SWPB/images/check_availability.png") no-repeat;
  text-indent:-9999px;
  position:absolute;
  -webkit-animation-name: change;
  -webkit-animation-duration: 10s;
  -webkit-animation-timing-function: steps(21);
  -webkit-animation-iteration-count: infinite;
  -webkit-animation-direction: normal;
}

@-webkit-keyframes change {

  0%    {top:0px;left:0px;background-position: 0px 0px;}
  5%    {top:0px;left:0px;background-position: -240px 0px;}
  10%   {top:0px;left:0px;background-position: -480px 0px;}
  15%   {top:0px;left:0px;background-position: -720px 0px;}
  20%   {top:0px;left:0px;background-position: -960px 0px;}
  25%   {top:0px;left:0px;background-position: -1200px 0px;}
  30%   {top:0px;left:0px;background-position: -1440px 0px;}
  35%   {top:0px;left:0px;background-position: -1680px 0px;}
  40%   {top:0px;left:0px;background-position: -1920px 0px;}
  45%   {top:0px;left:0px;background-position: -2160px 0px;}
  50%   {top:0px;left:0px;background-position: -2400px 0px;}
  55%   {top:0px;left:0px;background-position: -2640px 0px;}
  60%   {top:0px;left:0px;background-position: -2880px 0px;}
  65%   {top:0px;left:0px;background-position: -3120px 0px;}
  70%   {top:0px;left:0px;background-position: -3360px 0px;}
  75%   {top:0px;left:0px;background-position: -3600px 0px;}
  80%   {top:0px;left:0px;background-position: -3840px 0px;}
  85%   {top:0px;left:0px;background-position: -4080px 0px;}
  90%   {top:0px;left:0px;background-position: -4080px 0px;}
  95%   {top:0px;left:0px;background-position: -4080px 0px;}
  100%  {top:0px;left:0px;background-position: -4080px 0px;}

}

It works over 21 steps, using a really wide png to act as frames based on background position.
I can only get the animation to tween, rather than jump in stages.
How do I make it jump from frame to frame, rather than slide?

A: DEMO
Use this property of css:
animation-timing-function: step-end;

A: Make changes to your css like:
-webkit-animation-timing-function: steps(1);
-moz-animation-timing-function: steps(1);
animation-timing-function: steps(1);

Tweak them with different values to get  desired animation , currently they show and stop at each of 21 frames. JSFiddle here : CLICK


text:
Q: Catching a Request to Open or Create a File and Rerouting it I downloaded some flash games some time ago to play offline at school if I find myself with no work to do and have a spare. The only problem is that they always attempt to save/load from the application data, and I don't believe the files are created at all, let alone loaded next time I would play it again.
Instead of decompiling each one and finding/changing the save and load location I thought about the Windows API, hooks in particular. Perhaps it may be possible to monitor system requests to create such a file, or open it if it's trying to load, and then tell it to look elsewhere (i.e. my flash drive)?
I don't know if the idea is actually plausible or not, but any solutions, or a solid "It's impossible" would be great.

A: I hope some of these help:
WinAPIOverride32 is an advanced api monitoring software.
Deviare API
Deconstructing the Poker Client, Part 1


text:
Q: How to parsing LocalDateTime from RestController in Kotlin I'm trying to implement a controller for my application using kotlin. But there are an error when parsing the datetime format when I make a get request.
@RestController
@RequestMapping("/api/records")
class RecordController(val recordService: RecordService) {

  @GetMapping("details")
  fun getRecordDetail(
    @RequestParam recordId: Int,
    @RequestParam(required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME) dateTime: LocalDateTime): RecordDto {
    return recordService.getRecordDetails(recordId, dateTime)
  }
}

The error is
Failed to convert value of type 'java.lang.String' to required type 'java.time.LocalDateTime'; nested exception is org.springframework.core.convert.ConversionFailedException:
Failed to convert from type [java.lang.String] to type [@org.springframework.web.bind.annotation.RequestParam @org.springframework.format.annotation.DateTimeFormat java.time.LocalDateTime] for value '2017-08-21T00:00:000.00'; nested exception is java.lang.IllegalArgumentException:
Parse attempt failed for value [2017-08-21T00:00:000.00]"

The rest api works fine without the dateTime parameter.

A: This is because you provide a value with a format not compatible with the defined ISO-date.
Here your value (maybe just a "typo" from your side) and a working value
2017-08-21T00:00:000.00   (yours)
2017-08-21T00:00:00.000   (working)

Ensure that you provide a valid second and millisecond value.


text:
Q: Attempt to invoke virtual method 'boolean java.lang.String.equalsIgnoreCase(java.lang.String)' on a null object reference Project is working well on emulator x86 api 6.0.  but not on device htc m 6.0
here is code
if (img_uri != null && img_uri.equalsIgnoreCase("image")) {
    bitmap = BitmapFactory.decodeResource(getResources(), R.mipmap.gghh);
    img_input_d.setImageBitmap(bitmap);
}

A: You should not have a nullpointer exception since you make a null check. But anyways, you can do it like following just to be on the safe side:
if ("image".equalsIgnoreCase(img_uri)) {
    //...
}

A: Finally i am answering my que I am surfing with it
so i found that some device want full specification of condition
here is my code
if (img_uri!=null&&!img_uri.isEmpty()&&!img_uri.equals("null")&&img_uri.equals("image") {}

it works for me


text:
Q: How to change a variable in a option menu First thing to say is that I'm a noob. I'm creating my first android app, after going through the tutorials. I want to create a little app that reads three specific rss feeds. I'm using a tutorial for building the rss part. But now I want to be able to change the rss feed in the option menu. So I want to change the variable rSSFEEDOFCHOICE when i clik a option in the options menu, but I just can't get it working and can't find anything online.. Here's my code:
    public class RSSReader extends Activity implements OnItemClickListener

{

@Override
public boolean onCreateOptionsMenu(Menu menu)
{
    super.onCreateOptionsMenu(menu);

    menu.add("rss feed 1");
    menu.add("rss feed 2");
    Log.i(tag,"onCreateOptionsMenu");
    return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item){
    switch (item.getItemId()) {
    case 0:
        Log.i(tag,"rss feed 2");
        rSSFEEDOFCHOICE = "https://www.scouting.nl/publiek/nieuws?format=feed&type=rss";
        return true;
    case 1:
        Log.i(tag,"rss feed 2");
        return true;
    }
    return false;
}

public final String tag = "RSSReader";
private RSSFeed feed = null;
private String rSSFEEDOFCHOICE;

/** Called when the activity is first created. */

public void onCreate(Bundle icicle) {
    super.onCreate(icicle);
    setContentView(R.layout.main);

    feed = getFeed(rSSFEEDOFCHOICE);

A: try overriding onPrepareOptionsMenu

A: In case 1, you're not setting the variable to a new rss feed.
Hope that helps.


text:
Q: Add spinner to HashMap Android I have a ListView, and the list view is populated with an HashMap. I can add text without in issue. I have an issue adding spinners.
How would I go about adding spinners to a HashMap in Android?
Here is the code for my HashMap:
        final Spinner hashSpinner = (Spinner)findViewById(R.id.spinner1);
    ArrayAdapter<String> array = new ArrayAdapter<String>(this,  android.R.layout.simple_spinner_item, array);
    hashSpinner.setAdapter(hashSpinner);

    mapTwo = new HashMap<String, String>();

    mapTwo.put("zero", "OK");
    mapTwo.put("one", " 2");
    mapTwo.put("two", " 3");
    listTwo.add(mapTwo);

    try {
        adapter = new SimpleAdapter(this, listOne, R.layout.row_two,
                new String[] { "zero", "one", "two" }, new int[] {
                        R.id.spinner1, R.id.spinner2, R.id.spinner3 });
        listViewOne.setAdapter(adapter);
    } catch (Exception e) {

    }

row_two already contains the spinners, the issue is, I can't get it to display. How will I go about adding the spinners to the ListView?


text:
Q: Convert Boost Gregorian Date to POD Is there an easy way to convert a boost::gregorian::date to a Plain old data type? I need to be able to pass it through a C DLL interface. I'd rather not convert it to it's year/month/day components back and forth.

A: You could pick some epoch date, and then get the date_duration between your "current" date and the epoch, then call days() on the duration to get a long. Pass the long through your C DLL, then on the other side create a new date_duration with the same number of days, add it to the epoch, and you should be back to your original date.
You should be able to easily wrap this in a couple of functions, e.g.
long days_since_epoch_from_date(date)
date date_from_days_since_epoch(long)

A: #include <boost/date_time/gregorian/greg_date.hpp>
#include <boost/date_time/gregorian/gregorian_io.hpp>
#include <iostream>

int main()
{
    boost::gregorian::date date1(2013, boost::date_time::Feb, 25);
    std::cout << date1 << std::endl;
    boost::gregorian::date::date_int_type pod = date1.day_number();
    std::cout << pod << std::endl;
    boost::gregorian::date date2(pod);
    std::cout << date2 << std::endl;
}


text:
Q: How to create a div with black background to fit right behind a div? I have an image, on hover i will animate it to fade out to opacity: 0.4;, the fading out is fading to white, but i liked to fade to black, so i found a solution is to change the background color of the body to black. Then my fadeout will be towards black. So the plan i'm trying to do is create a div with black background to have the same width and height as my img but i don't know how to do it.
HTML

Jack
Portfolio1

The width and height of my image is 500 by 500. So basically i want a black bg to be behind this image, so when i fadeout it will be towards black.. Anyone know of any simple ways that i can achieve it instead of using body{background-color:black};?

A: You can acheive this by giving background to parent div. Below is the simple code that helps you.
FIDDLE: http://jsfiddle.net/kiranvarthi/ar387hav/
CSS:
.container {
  background: #000;
  position:relative;
  height:500px;
  width:500px;
  margin:0 auto;
}

.container img {
  position:absolute;
  left:0;
  -webkit-transition: opacity 1s ease-in-out;
  -moz-transition: opacity 1s ease-in-out;
  -o-transition: opacity 1s ease-in-out;
  transition: opacity 1s ease-in-out;
}

.container img:hover {
  opacity:0;
}


text:
Q: Compare staging table records and target table records and reflect the missed out record in a column in staging table itself in servicenow? I have a staging table called u_xyzand a target table called sn_abc.
The target table contains other records too from different staging table.
I need to compare whether all the records from staging table(u_abc) is getting reflected in target table(sn_abc) and the records  which are missing out in the target table needs to be highlighted in a column(missedout records) in staging table?
Please tell me how to pass 250+ import sets in the below code ?


text:
Q: Number of spanning trees in a complete split graph A graph is a complete split graph if we can partition it into an independent vertex set and a clique, such that every vertex of the independent vertex set is adjacent to every vertex in the clique.
How can I count the number of spanning trees in such a graph?
Update:
Using a little bit of sagemath code, I can get the spanning tree count for complete split graphs.
Sage code:
def complete_split_graph(order_of_indep_set, order_of_clique):
    G = graphs.CompleteGraph(order_of_clique)
    clique_vertices = G.vertices()
    for i in range(order_of_indep_set):
        new_vertex = 'i'+str(i)
            for v in clique_vertices:
                G.add_edge(new_vertex, v)
    return G

for i in range(1, 6):
    for c in range(1, 6):
        KS = complete_split_graph(i, c)
        span_tree_count = KS.spanning_trees_count()
        print "$\\tau(\\textrm{{KS}}_{{ {},{} }})$ = {}; ".format(i, c, span_tree_count)

Running the code I get the following results, where $KS_{i, j}$ denotes a complete split graph with an independent set of order $i$ and a clique of order $j$, and $\tau(G)$ denotes the number of spanning trees in a graph $G$:
$\tau(\textrm{KS}_{ 1,1 })$ = 1;
$\tau(\textrm{KS}_{ 1,2 })$ = 3;
$\tau(\textrm{KS}_{ 1,3 })$ = 16;
$\tau(\textrm{KS}_{ 1,4 })$ = 125;
$\tau(\textrm{KS}_{ 1,5 })$ = 1296;
$\tau(\textrm{KS}_{ 2,1 })$ = 1;
$\tau(\textrm{KS}_{ 2,2 })$ = 8;
$\tau(\textrm{KS}_{ 2,3 })$ = 75;
$\tau(\textrm{KS}_{ 2,4 })$ = 864;
$\tau(\textrm{KS}_{ 2,5 })$ = 12005;
$\tau(\textrm{KS}_{ 3,1 })$ = 1;
$\tau(\textrm{KS}_{ 3,2 })$ = 20;
$\tau(\textrm{KS}_{ 3,3 })$ = 324;
$\tau(\textrm{KS}_{ 3,4 })$ = 5488;
$\tau(\textrm{KS}_{ 3,5 })$ = 102400;
$\tau(\textrm{KS}_{ 4,1 })$ = 1;
$\tau(\textrm{KS}_{ 4,2 })$ = 48;
$\tau(\textrm{KS}_{ 4,3 })$ = 1323;
$\tau(\textrm{KS}_{ 4,4 })$ = 32768;
$\tau(\textrm{KS}_{ 4,5 })$ = 820125;
$\tau(\textrm{KS}_{ 5,1 })$ = 1;
$\tau(\textrm{KS}_{ 5,2 })$ = 112;
$\tau(\textrm{KS}_{ 5,3 })$ = 5184;
$\tau(\textrm{KS}_{ 5,4 })$ = 186624;
$\tau(\textrm{KS}_{ 5,5 })$ = 6250000;
However, I am not satisfied with my way of doing it. I would prefer to find a formula, and I'd like to know how to do it without a computer doing the work for me. So I'd appreciate further hints and help.

A: An alternative would be to use Prufer sequences. (If you don't know what these are, I suggest you look them up, and how they can be used to prove Cayley's formula before reading the rest of this hint).
Write $A$ for the largest independent set in the split graph, and $B$ for the vertex set of the largest clique. Consider the following algorithm for converting a spanning tree in the split graph into two strings, $s_A$ and $s_B$. At step i, pick the leaf with the smallest label. If this leaf is in $A$, append the label of its neighbour to $s_A$. Otherwise, append the label of its neighbour to $s_B$. Delete this leaf from the tree, and repeat until there are only 2 vertices. Can you choose the enumeration of vertices such that you are guaranteed that one of these vertices is in $A$? How long will $s_A$ and $s_B$ be in this process, and what are the possiblities for each? Now come up with a reverse process to convert between 'allowed string pairs' and spanning trees.
This method should give you a nice one term formula for the number of spanning trees.


text:
Q: When I'm using map local it maps several requests My path is /api/query without any Query Parameters, but Charles maps all requests that have path /api/query.
In other words:
Charles maps /api/query?some=1, /api/query?another=1 and /api/query requests, but I need just /api/query. I need to be mapped clear request without query parameters.
version: 3.12.3

A: Not sure if you have figured out but there is an alternative tool that works the same as Charles named Proxyman. Basically, just right click your URL --> select Tools --> Map Local

*

*If you check "Include all subpaths of this domain" --> Proxyman will map all requests including subpaths such as /api/query?some=1, /api/query?another=1 and /api/query

*If you uncheck the box --> Proxyman will map /api/query only

Hope it helps :)


text:
Q: Dynamic content inside fancybox via get I have multiple instances of fancybox working at the same time like this:
Group 1
Group 2
Group 3

Showing the following div:

       //Select that shows the people from the group here depending on the id
       //of the link with a $_GET['id'] variable (from database)

With this call:
$("a.grupito").fancybox({
            'titlePosition'     : 'inside',
            'transitionIn'      : 'none',
            'transitionOut'     : 'none'
        });
});

This doesn't work for me. Fancybox says "The requested content cannot be loaded.
Please try again later.". If I get rid of the ?id=1 part of the href it will show up but it won't have the content that I need. Is this that I'm trying even possible with fancybox?
EDIT: In fact, checking it with firebug I see I'm getting a 404 error. Anyone can point me out in the right direction to see how I can achieve this?

A: I was searching for a solution for this, and couldn't find one.
I am creating a to-do list and when you click edit, fancybox pops up with the fields to edit each individual to-do item.
I eventually found a really simple way to do this.
Here is my link to edit the item:

    edit

Look closesly at: #editItem-$id
Then here is my content which it is loading.
$getItemId = mysql_query("SELECT * FROM the_items");
$num_rows = mysql_num_rows($getItemId);

while($row = mysql_fetch_array($getItemId)) {
$this_is_the_id= $row['this_is_the_id'];
$this_is_the_title= $row['this_is_the_title'];
$iteminfo= $row['iteminfo'];
$highlow= $row['highlow'];
$whoto= $row['whoto'];
$finished= $row['finished'];
$date= $row['date'];

    echo "

                              <input type='text' id='title' name='title' value='$this_is_the_title' />

                                  edit

                                  delete

                                  <textarea id='description'>$iteminfo</textarea>

";

And again, look here: editItem-$id on the div.
I have deleted my correct info for security purposes.
But yeah, this pulls in the content which I want it to, because they each have individual and unique IDs from the database.

A: If I understand your questions properly I think you may need to rethink your approach. I'm not sure what you are trying to achieve by adding ?id=1 to your anchor. Fancybox shows content that is already loaded on the page. Once the HTML page has been rendered and sent to the browser, PHP plays no role in what happens on the client side.
You need to render all the content for each of the boxes when the page loads and then reference them within your internal links as posted below. Fancybox only deals with content that has been loaded on to the page, so you need to figure out the content of each box during it's initial rendering.
Group 1
Group 2
Group 3

       //The content from group 1

       //The content from group 2

       //The content from group 3

A: You can use jquery.load() to make a request to your server and load that content dynamically into one fancybox div.


text:
Q: Registry design I need to design a application registry S/W component using C++. Basically, this needs to support addition and deletion of key/values. Dynamic updates need to be supported (for example, when a new application get installed).
Is there a design pattern which closely matches the given problem?
Though I have formulated a rough sketch of the APIs this component needs to support, it would be helpful to have a look at alternative (perhaps better) ways of design.
If there are some typical problems associated with registry design (may be some thread issues which I might have overlooked), I want to make sure I have circumvented those.

A:
Is there a design pattern which closely matches the given problem?

You are probably looking at more than one: A proxy for the entire registry, iterator etc. comes to mind.

If there are some typical problems associated with registry design

*

*You will probably need transactional semantics. Rollback too!

*Do you need to save snapshots from time to time? Then you will need an archiving module.

*Synchronization: Multiple writes to the registry need to be taken care of.


text:
Q: Are the real numbers really uncountable? Consider the following statement
Every real number must have a definition in order to be discussed.
What this statement doesn't specify is how that loose-specific that definition is.
Some examples of definitions include:
"the smallest number that takes minimally 100 syllables to express in English" (which is indeed a paradox)
"the natural number after one" (2)
"the limiting value of the sequence $(1 + 1/n)^n$ as $n$ is moved towards infinity, whereas a limit is defined as ... (epsilon-delta definition) ... whereas addition is defined as ... (breaking down all the way to the basic set theoretic axioms) " (the answer to this being of course e)
Now here is something to consider
The set of all statements using all the characters in the English in English language is a countable set. That means that every possible mathematical expression can eventually be reduced to an expression in English (that could be absurdly long if it is to remain formal) and therefore every mathematical expression including that of every possible real number that can be discussed is within this countable set.
The only numbers that are not contained in this countable set are...
That's a poor question to ask since the act of answering it is a violation of the initial assumption that the numbers exist outside of the expressions of our language.
Which brings up an interesting point. If EVERY REAL number that can be discussed is included here, then what exactly is it that is not included?
In other words, why are the real numbers actually considered to be uncountable?

A: OP has rediscovered computable numbers.  Indeed there are only countably many numbers that can be computed by a terminating Turing machine.  The Church-Turing thesis extends this from Turing machines to all algorithmically computable numbers.  Hence almost all real numbers are not algorithmically computable.  A minority of mathematicians called constructivists reject the existence of non-computable numbers.

A: This question is really much more of a philosophy question, but I do think it is an important. I'd like to ask you two questions in return, "Do you believe that powersets exist? And do you believe we can talk about the set of natural numbers?" Using your definition, we can essentially describe every natural number. We say, $0$ is the smallest natural number, $1$ is the successor of 0, and so on. Now, if you don't believe that we can talk about the set containing $all$ natural numbers, namely $\mathbb{N}$, then my argument dies here. But I am not a finitist (at least not yet) and so I think we can talk about $\mathbb{N}$.
I also believes that powersets exist. Now, Cantor showed that no set has the same cardinality as its powerset (which is actually not a hard proof). Also note, that it is not difficult to show that there is a (natural) one-to-one correspondence between $\mathbb{R}$ and $P(\mathbb{N})$. Hence, $|\mathbb{R}|=|P(\mathbb{N})| >|\mathbb{N}|$. Therefore, if you believe in powersets and infinite sets, you must believe that there are sets which are uncountable. Since the real numbers are in bijection with an uncountable set (namely $P(\mathbb{N})$), they too must be uncountable.
Now I will get to your question: "What exactly is not included?". Note that since we can only describe countably many mathematical sets, we can only describe countably many subsets of $\mathbb{N}$. Therefore, we can only describe countably many elements of $P(\mathbb{N})$. These are known as the computable sets. Now, we can define some real numbers which are non-computable, but "most of" the real numbers we do know are computably defined (by looking at the pre-image of the one-to-one correspondence).

A: "The real numbers are uncountable" means that, in the set-theoretic universe where we have defined "the set of natural numbers" and "the set of real numbers", there is not a function that is a bijection between these two sets.
It means nothing more, and nothing less than that.
There are all sorts of traps, mistakes, and really subtle misunderstandings one can run into by trying to ascribe more meaning to this statement than it actually has.
You may find Skolem's paradox an interesting topic to read about, given that it involves a rigorous and precise way to see the real numbers as countable in a sense different from what is meant by "the real numbers are uncountable", and the consequent difficulties people have trying to unravel what's going on.

A:
Every real number must have a definition in order to be discussed.

True.
But don't confuse discussing the set of all real numbers with discussing individual real numbers. I can reason correctly about the collection of heads of states of countries without even knowing what countries exist. Similarly I can reason about the set of all real numbers without being able to name every single one.
(But having said that, if you work hard enough you can turn your argument into a bona fide theorem, the downward Löwenheim–Skolem theorem. But it doesn't quite say what you're saying.)

A: What you are saying basically boils down to the statement that there are real numbers which have no finite description, which makes a lot of sense given that they are described infinite strings of digits. It doesn't sound that surprising when you put it this way.

A: Almost every real number is undefinable (roughly meaning that you can't write down a formula for it). The fact that there are "so many" real numbers depends on properties such as the least upper bound property. What's responsible for this ultimately is the fact that the background logic includes the law of excluded middle, accompanied by the classical interpretation of the existence quantifier. Having said that, in constructive mathematics there is an analogue of Cantor's diagonalisation argument.
In more detail, the various characterisations of the reals are going to be equivalent only in the context of classical logic. In constructive mathematics the least upper bound property fails; see for instance Bishop's book, page 4. When classical logic is the background logic, what is responsible for the uncountability of the reals is the "presence" of undefinable real numbers. The OP was obviously puzzled by this: how can a number exist if you can't specify it at all?
In fact, such "numbers" don't "exist" in a constructive setting. From the constructive viewpoint, their dubious "existence" is wholly dependent on an unbridled application of the law of excluded middle, rejected by constructivists (again with the proviso that Cantor's diagonalisation argument remains meaningful in a constructive setting as well; see Bishop's book).

A: The countably infinite set $c{\mathbb R}$ of computable real numbers is difficult to define and to handle. But it is embedded in the uncountable set ${\mathbb R}$ which is easy to handle and is characterised by a small set of reasonable axioms. Beginning with data from $c{\mathbb R}$ we freehandedly argue in the environment ${\mathbb R}$ and arrive at "guaranteed" elements of ${\mathbb R}$ (solutions of equations, as $x=\tan x$, etc.) that are at once accepted as elements $c{\mathbb R}$.

A: Yes, there is an unrefutable argument that $2^ω$ is not countable, namely Cantor's diagonal argument mentioned by @user72694. What exactly this argument says? Apart of the rest of set theory, as well as confusions between a theory and metamathematics; see @Hurkyl's answer for analysis. Cantor's diagonal argument shows that a surjective mapping from $\mathbb N$ to $2^{\mathbb N}$ is impossible. It is also obvious that an injective mapping from $\mathbb N$ to $2^{\mathbb N}$ is possible. What follows from it?
Under assumptions of set theory, there is further conclusion that $2^{\mathbb N}$ is greater than $\mathbb N$. Most mathematicians, especially those working in analysis and probability theory (due to measure theory), deem it intuitive.
Computability theory offers an opposite intuition for the same Cantor's diagonal thing: we can't enumerate all infinite binary sequences. It is dubious that there are more such sequences than natural numbers – isn't the set of all algorithms countable? We do not know which of them is "greater", but we definitely see that $2^{\mathbb N}$ is more complex because we can easily embed $\mathbb N$ to it, whereas impossibility to map $\mathbb N$ onto $2^{\mathbb N}$ (both "to map" and "$2^{\mathbb N}$" in the computable sense) leads to Turing's halting problem.
Whether $2^ω$ is "greater" than $ω$ or just "more complex" depends on whether do we trust set theory or computability theory – the two present conflicting and intuitively incompatible narratives. Resolution of the problem pertains to philosophy.

I, Incnis Mrsi do not discuss real numbers, but due to binary fractions the difference between it and $2^{\mathbb N}$ (infinite binary sequences) is insignificant. Feel free to edit the post to fill it.


text:
Q: Android - cancel Volley request I am using Android Volley lib in my project to execute network requests, all works very well but I have some troubles with the "cancel" feature of this lib. I explain my issue..
I've an activity, where I'm executing the request at OnCreate method, the request is called, no problem. But to be sure that the cancel method works, I wanted to test and try 2 things :

*

*I fire my request and just after cancel it like this :
MySingleton.getMyData("urltocall", getDataListener, requestTag);
MySingleton.getRequestQueue().cancelAll(requestTag);
This one works! The cancel is called (I can see it too in the Request class of Volley) :
public void cancel() {
        mCanceled = true; // my breakpoint is called here
    }

*I fire my request and just after call finish() method of my activity and in onDestroy and/or onStop method of the activity, I'm calling the same code :
MySingleton.getMyData("urltocall", getDataListener, requestTag);
MySingleton.getRequestQueue().cancelAll(requestTag);
But this doesn't work!
The requestTag is not null and well passed to Volley, so I can't understand why the first method works but not the other one... Knowing that my purpose is to cancel request when onDestroy is called..
Thanks for your help

A: You can cancel a Request attached to a TAG. So basically you have to add a tag with every Request.
yourRequestObject.setTag(TAG);
RequestQueue mRequestQueue;
mRequestQueue.cancelAll(TAG);
This way you can cancel all the Request with a particular TAG.

A: https://developer.android.com/training/volley/simple.html#cancel
This basically says that

Once cancelled, Volley guarantees that your response handler will never be called.

So even if there is no way to undo/cancel an http request that's already begun (which makes sense), the callbacks associated with the request won't be called, which to me effectively means I can treat is a cancelled request in most scenarios even though the response thus received silently might be available in the cache.

A: My guess would be that in the first case, the request has only been added to the RequestQueue, which is why calling cancelAll() works. In the second case, there is a slight delay between starting the request and pausing/destroying the Activity: in that delay, the HTTP request has begun. You may not be aware that calling cancelAll() works only for those requests that are still in the RequestQueue. It doesn't work for an HTTP request that has already begun, there is no way to stop that.
Having said that, the documentation here implies that once a request is cancelled (i.e. by calling cancel()), it can effectively be treated as though the web service had never been called in the first place. The callbacks associated with the particular request would not be invoked (although the response received would likely be held in the local cache).

A: I'd suggest you to cancel the added requests in onPause() method. Considering:

onPause() The system calls this method as the first indication that
  the user is leaving your activity (though it does not always mean the
  activity is being destroyed). This is usually where you should commit
  any changes that should be persisted beyond the current user session
  (because the user might not come back). source: Android Developers


text:
Q: .NET Google API access token failing with no refresh token specified I am trying to set up a class that can wrap around the .NET Google API so that I can use an Access Token that I have previously obtained to access a user's Google Drive. As of right now, I am just trying to get it to work so that I do not require a Refresh Token (more on that in a second). The ultimate goal is for somebody to go through a web page I have set up to authenticate where I obtain both an Access Token and a Refresh Token by directly calling to the Google Rest API (which I store in a database). They can then request to upload/download files onto their Drive on a different page which will first obtain the appropriate information from the database and then use the .NET Google API Library when accessing Drive.
However, when I attempt to access their Drive I get the the following error:
The access token has expired and could not be refreshed. Errors: refresh error, refresh error, refresh error
I know that the Access Token is valid because I obtain it only seconds earlier during my testing. Here is my code for setting up the Drive Service:
  ' NOTE: Code altered for brevity
  Public Sub Initialize(accessToken As String)
        ' Set up the client secret information based on the default constants
        Dim clientSecrets As New ClientSecrets()
        clientSecrets.ClientId = DEFAULT_CLIENT_ID
        clientSecrets.ClientSecret = DEFAULT_CLIENT_SECRET

        ' Set up a token based on the token data we got
        ' NOTE: Is it OK to leave some strings as NULL?
        Dim token As New Responses.TokenResponse()
        token.AccessToken = accessToken
        token.RefreshToken = ""
        token.TokenType = "Bearer"
        token.IssuedUtc = DateTime.Now
        token.ExpiresInSeconds = 3600
        token.Scope = "drive"
        token.IdToken = ""

        ' Set up a flow for the user credential
        Dim init As New GoogleAuthorizationCodeFlow.Initializer()
        init.ClientSecrets = clientSecrets
        init.Scopes = New String() {DriveService.Scope.Drive}
        init.Clock = Google.Apis.Util.SystemClock.Default

        ' Set up everything else and initialize the service
        Dim baseInit As New BaseClientService.Initializer()
        baseInit.HttpClientInitializer = New UserCredential(New GoogleAuthorizationCodeFlow(init), "user", token)
        baseInit.ApplicationName = APP_NAME

        _service = New DriveService(baseInit)
  End Sub

Shortly after that, I then use the following code to request a folder so I can check to see if it exists or not.
  Private Function GetDriveFolder(folderPath As String, ByRef folderIds As String(), Optional createMissingFolders As Boolean = False, Optional parentFolderId As String = "root") As Data.File
    Dim creatingFolderPath As Boolean = False
    Dim currentFolder As Data.File = Nothing
    Dim folderPathSplit As String() = folderPath.Replace("/", "\").Trim("\").Split("\")
    Dim folderIdList As New List(Of String)
    folderIds = {}

    ' Loop through each folder in the path and seek each out until we reach the end
    For x As Integer = 0 To folderPathSplit.Length - 1
        Dim result As FileList = Nothing

        If Not creatingFolderPath Then
            ' Build a list request which we will use to seek out the next folder
            Dim request As FilesResource.ListRequest = _service.Files.List()
            request.Q = "mimeType='application/vnd.google-apps.folder' and name='" & folderPathSplit(x) & "'"
            If currentFolder Is Nothing Then
                request.Q &= " and '" & EscapeDriveValue(parentFolderId) & "' in parents"
            Else
                request.Q &= " and '" & EscapeDriveValue(currentFolder.Id) & "' in parents"
            End If
            request.Spaces = "drive"
            request.Fields = "files(id, name)"

            ' Execute the search, we should only get a single item back
            ' NOTE: Error thrown on this request
            result = request.Execute()
        End If
        ' So on.....

So, I'm just trying to get it to work with only the Access Token for the time being because if it ends up getting refreshed I'll need to know so that I can update my database. However, if I do include the Refresh Token I get the following error:
Error:"unauthorized_client", Description:"Unauthorized", Uri:""
I'm guessing this has something to do with the way I have configured my application through the Dev Console but if I authenticate through the Google API Library by having it launch a browser to get my credentials everything works fine. So, I'm really not sure where to go from here as I haven't found anybody having similar problems and the guides don't cover specifying your own Access Token.
Also, as a quick note this is the URL I am using when having the user authenticate:
String.Format("https://accounts.google.com/o/oauth2/v2/auth?client_id={0}&state={1}&redirect_uri={2}&scope=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fdrive&access_type=offline&include_granted_scopes=true&prompt=select_account%20consent&response_type=code", GOOGLEAPI_CLIENTID, validateState, redirectUri)

Thanks for the help!

A: If you have an access-token then the simplest way to create a google credential is to use the GoogleCredential.FromAccessToken() method passing in your access token.
This returns you a GoogleCredential instance which you can use to set the HttpClientInitializer property when building the DriveService.
If you then still get an error when accessing the drive service, then it's likely there's something incorrect in how you are asking for the access-token.


text:
Q: Issue with redundant if statements that can have multiple answers I have to code a program that utilizes method overloading to calculate the surface area and volume of a cylinder, sphere, cone and triangular prism. I need to take input from the user and then display the correct surface area and volume.
An example of what the program should do is:
Input your shape's "a" value: none
Input your shape's "b" value: none
Input your shape's "c" value: none
Input your shape's "h" value: none
Input your shape's "l" value: none
Input your shape's "r" value: 5
Input your shape's "s" value: none
Would you like your answer rounded?: yes
To what decimal place?: 0
---------------------------------------------------------------------
Your shape is a sphere!
It's volume is 524 units cubed.
It's surface area is 314 units squared.

I've coded the majority of the program, but the issue I'm having now is whenever I finish inputting the data, I get the error: "Exception in thread "main" java.util.NoSuchElementException: No line found". I suspect the issue is with the if statements I've used to filter through what the user has given me, as each one can have the same exceptions multiple times. So if I want to calculate the volume of a sphere the only input I need is to that of the radius, r, and all others are none. But all others are none as well for a cylinder except for the radius, r, and the height, h. Any help would be much appreciated.
This is my code so far:
import java.util.*;

class Main {

 String a = "none"; String b = "none"; String c = "none"; String h = "none"; String r = "none"; String s = "none"; String l = "none";
 String round;
 double aP; double bP; double cP; double hP; double rP; double sP; double lP;

 public static void main(String[] args) throws Exception{
   new Main();
 }//end main

 public Main() throws Exception{
   input();
   surfaceAreaPrint();
   volumePrint();

 }//end Main

 /**
  *
  */
 public void input() throws Exception{
   Scanner sc = new Scanner(System.in);
   System.out.print("");
   System.out.print("Input your shape's "a" value: ");
   a = sc.nextLine();
   System.out.print("Input your shape's "b" value: ");
   b = sc.nextLine();
   System.out.print("Input your shape's "c" value: ");
   c = sc.nextLine();
   System.out.print("Input your shape's "h" value: ");
   h = sc.nextLine();
   System.out.print("Input your shape's "r" value: ");
   r = sc.nextLine();
   System.out.print("Input your shape's "s" value: ");
   s = sc.nextLine();
   System.out.print("Input your shape's "l" value: ");
   l = sc.nextLine();
   System.out.print("Would you like your answer rounded?: ");

   round = sc.nextLine();

   System.out.print("");
   System.out.print("");

   sc.close();
   parse();

 }//end input

  public void parse() throws Exception{
    System.out.println(a);
   aP = Double.parseDouble(a);
   bP = Double.parseDouble(b);
   cP = Double.parseDouble(c);
   hP = Double.parseDouble(h);
   rP = Double.parseDouble(r);
   sP = Double.parseDouble(s);
   lP = Double.parseDouble(l);

//cylinder
  if(a == "none" && b == "none" && c == "none" && s == "none" && l != "none") {
      surfaceAreaPrint();
      return;
    }

   //sphere
   else if (a.equalsIgnoreCase("none") && b.equalsIgnoreCase("none") && c.equalsIgnoreCase("none") && s.equalsIgnoreCase("none") && h.equalsIgnoreCase("none") && s.equalsIgnoreCase("none") && l.equalsIgnoreCase("none")){
surfaceAreaPrint();
return;

  }

  //cone
  else if (a.equalsIgnoreCase("none") && b.equalsIgnoreCase("none") && c.equalsIgnoreCase("none") && s.equalsIgnoreCase("none") && h.equalsIgnoreCase("none") && l.equalsIgnoreCase("none")){
     surfaceAreaPrint();
     return;
  }
  //traingular prism
  else if (r.equalsIgnoreCase("none") && s.equalsIgnoreCase("none")){
surfaceAreaPrint();
return;
   }

 }//end parse

 public void surfaceAreaPrint() throws Exception{
   Main s = new Main();
   System.out.println(s.surfaceArea(hP, rP));
   System.out.println(s.surfaceArea(rP));
   System.out.println(s.surfaceArea(hP, rP, sP));
   System.out.println(s.surfaceArea(aP, bP, cP, lP, hP));

 }//end surfaceAreaPrint

  public void volumePrint() throws Exception{
   Main s = new Main();
   System.out.println(s.surfaceArea(hP, rP));
   System.out.println(s.surfaceArea(rP));
   System.out.println(s.surfaceArea(hP, rP));
   System.out.println(s.surfaceArea(bP, lP, hP));

 }//end volumePrint

 //surface area for cylinder
 public double surfaceArea(double hP, double rP){
   return (2.0 * Math.PI * Math.pow(rP, 2.0)) + (2.0 * Math.PI * rP * hP);

 }//end surfaceArea

 //surface area for sphere
 public double surfaceArea(double rP){
   return (4.0 * Math.PI * Math.pow(rP, 2.0));

 }//end surfaceArea

 //surface area for cone
 public double surfaceArea(double hP, double rP, double sP){
   return (Math.PI * Math.pow(rP, 2.0)) + (Math.PI * rP * sP);

 }//end surfaceArea

   //surface area for traingular prism
 public double surfaceArea(double aP, double bP, double cP, double lP, double hp){
   return (bP * lP) + (aP * hP) + (bP * hP) + (cP* hP);

 }//end surfaceArea

 //volume for cylinder
 public double volume(double hP, double rP){
   return (Math.PI * Math.pow(rP, 2.0) * hP);

 }//end volume
 //volume for sphere
 public double volume(double rP){
   return ( 4.0 / 3.0 ) * Math.PI * Math.pow(rP, 3.0);

 }//end volume

 //volume for cone
 public double volume(double hP, double rP, double sP){
   return (1.0 / 3.0 ) * Math.PI * Math.pow(rP, 2.0) * hP;

 }//end volume

   //volume for traingular prism
  /**
   * calculates volume for traingular prism
   * @param times The number of times the die is to be rolled.
   * @return The results of rolling a 6-sided die.
   */
 public double volume(double aP, double bP, double cP, double lP, double hp){
   return (1.0 / 2.0 ) * bP * lP * hP;

 }//end volume

}//end Main

A: TL;DR

*

*calling the same method inside multiple if else blocks is redundant (until they doesnt return, so the required method could still be called)

*many times the long if condition can be simplified, if not it's better to move the condition to additional method boolean isAThingIWant(..params) to maintain readability

*the "business logic" method shouldn't be called in constructor

*creating new objects of same class inside member methods can lead to unwanted recursive calls

*closing the Scanner object with a System.in InputStream disallows for any future reads from that stream (see this)

*trying to use Double.parseDouble with any string which isn't a number will cause NumberFormatException, even for engineering notation

*the OP example is a separated problem, but when designing an class, a propper encapsulations should be used

*common practice is to use a coding standards for particular language (see this)

*OOP approach for this problem would be to use shape interface and additional classes implementing it - which would allow to use advantages of inheritance and polymorphism

Original:
The simplest fix is to remove the Main s = new Main(); from below methods and use the this reference for currently created object like below:
    public void surfaceAreaPrint() throws Exception{
//        Main s = new Main();
        System.out.println(this.surfaceArea(hP, rP));
        System.out.println(this.surfaceArea(rP));
        System.out.println(this.surfaceArea(hP, rP, sP));
        System.out.println(this.surfaceArea(aP, bP, cP, lP, hP));

    }//end surfaceAreaPrint

    public void volumePrint() throws Exception{
//        Main s = new Main();
        System.out.println(this.surfaceArea(hP, rP));
        System.out.println(this.surfaceArea(rP));
        System.out.println(this.surfaceArea(hP, rP));
        System.out.println(this.surfaceArea(bP, lP, hP));

    }//end volumePrint

Actually, there are several issues and code smells in your example.
Another thing is that your are still comparing strings with == in the if statement in parse method - use the euqals or equalsIgnoreCase.
If your attempt was actually get new input from user in above methods then you cannot close the scanner, because closing it with the System.in closes the InputStream behind it, so it doesn't accept anything more. I think that deleting the sc.close() can lead you to different exceptions and issues (e.g. program won't work as you want it to).
Each instructions in any else if there are using same method. Therefore whole if else if is redundant.
Edit:
Just checked that removing the sc.close() and keeping the rest as it is in your example will lead to infinite getting of the user input, because of creating new Main object in surfaceAreaPrint and the input is called from the constructor of Main, so it becomes at recursive calls.
For the using of overloaded method you can go simply like this:
//cylinder
if(a.equalsIgnoreCase ("none") && b.equalsIg... rest of your if) {
    System.out.println(this.surfaceArea(hP, rP));
}

But note that, when you just press enter when inputing the values and reading them with sc.nextLine(), the assigned value wont stay as none but will become an empty string like "", which will throw NumberFormatException later in any of Double.parseDouble.
Edit2:
Now, I see that you want to strictly input "none" when you won't use that particular variable, so to avoid NumerFormatException you must parse the values to double after you check if the string isn't "none".
You can simplify the if statements by changing the check if they equal to "none" to check if they dont:
//for cylinder
if(!h.equalsIgnoreCase("none") && !r.equalsIgnoreCase("none") {
//....

For the calculation of surface/volume of real geometrical objects, you can assume that values defining their size should be >=0, so for simpler parsing the such method could be used:
public double inputParser(String s) {
    try {
        return Double.parseDouble(s);
    } catch (NumberFormatException e) {
        return -1;
    }
}
//and used instead of straight `Double.parseDouble`:
aP = inputParser(a);
bP = inputParser(b);
//which simplifies the `if` even more to:
if(hP != -1 && rP != -1) { //cylinder
    System.out.println(this.surfaceArea(hP, rP));
}

Edit3:
After few minutes of discussion and discovering some other flaws in the OP code I made a solution:
import java.util.*;
class Main {

    String a, b, c, h, r, s, l;
    String round;
    double aP; double bP; double cP; double hP; double rP; double sP; double lP;

    public static void main(String[] args) {
        Main m = new Main();
        m.input();
        m.parse();
        m.calculate();
    }

    public void input() {
        Scanner sc = new Scanner(System.in);
        System.out.print("");
        System.out.print("Input your shape's "a" value: ");
        a = sc.nextLine();
        System.out.print("Input your shape's "b" value: ");
        b = sc.nextLine();
        System.out.print("Input your shape's "c" value: ");
        c = sc.nextLine();
        System.out.print("Input your shape's "h" value: ");
        h = sc.nextLine();
        System.out.print("Input your shape's "r" value: ");
        r = sc.nextLine();
        System.out.print("Input your shape's "s" value: ");
        s = sc.nextLine();
        System.out.print("Input your shape's "l" value: ");
        l = sc.nextLine();
        System.out.print("Would you like your answer rounded?: ");

        round = sc.nextLine();
        System.out.println("");

        sc.close();
    }

    public void parse() {
        System.out.println(a);
        aP = inputParser(a);
        bP = inputParser(b);
        cP = inputParser(c);
        hP = inputParser(h);
        rP = inputParser(r);
        sP = inputParser(s);
        lP = inputParser(l);
    }

    public void calculate() {
        if(hP != -1 && rP != -1) {
            System.out.println("Cylinder");
            System.out.println(this.rounding(this.surfaceArea(hP, rP)));
            System.out.println(this.rounding(this.volume(hP, rP)));
        }
        if (rP != -1){
            System.out.println("Sphere");
            System.out.println(this.surfaceArea(rP));
            System.out.println(this.volume(rP));
        }
        if (hP != -1 && rP != -1 && sP != -1){
            System.out.println("Cone");
            System.out.println(this.surfaceArea(hP, rP, sP));
            System.out.println(this.volume(hP, rP, sP));
        }
        if (aP != -1 &&  bP != -1 &&  cP != -1 &&  lP != -1 &&  hP != -1){
            System.out.println("Triangular prism");
            System.out.println(this.surfaceArea(aP, bP, cP, lP, hP));
            System.out.println(this.volume(aP, bP, cP, lP, hP));
        }
    }
    public double rounding(double value) {
        if ("yes".equalsIgnoreCase(round)) {
            return Math.round(value);
        }
        return value;
    }
    public double inputParser(String s) {
        try {
            return Double.parseDouble(s);
        } catch (NumberFormatException e) {
            return -1;
        }
    }
    //surface area for cylinder
    public double surfaceArea(double hP, double rP){
        return (2.0 * Math.PI * Math.pow(rP, 2.0)) + (2.0 * Math.PI * rP * hP);

    }//end surfaceArea

    //surface area for sphere
    public double surfaceArea(double rP){
        return (4.0 * Math.PI * Math.pow(rP, 2.0));

    }//end surfaceArea

    //surface area for cone
    public double surfaceArea(double hP, double rP, double sP){
        return (Math.PI * Math.pow(rP, 2.0)) + (Math.PI * rP * sP);

    }//end surfaceArea

    //surface area for traingular prism
    public double surfaceArea(double aP, double bP, double cP, double lP, double hp){
        return (bP * lP) + (aP * hP) + (bP * hP) + (cP* hP);

    }//end surfaceArea

    //volume for cylinder
    public double volume(double hP, double rP){
        return (Math.PI * Math.pow(rP, 2.0) * hP);

    }//end volume
    //volume for sphere
    public double volume(double rP){
        return ( 4.0 / 3.0 ) * Math.PI * Math.pow(rP, 3.0);

    }//end volume

    //volume for cone
    public double volume(double hP, double rP, double sP){
        return (1.0 / 3.0 ) * Math.PI * Math.pow(rP, 2.0) * hP;

    }//end volume

    //volume for traingular prism
    public double volume(double aP, double bP, double cP, double lP, double hp){
        return (1.0 / 2.0 ) * bP * lP * hP;

    }//end volume

}//end Main

Still not the best one, have encapsulation, variable naming and some other issues, but covers the problem well.


text:
Q: run a c++ application under spark cluster I am working on my school project. there is a video duplication detection application wrote with c++. The application is designed to run on a single machine, and I would like to create a spark cluster and run that application under the cluster.
Is this possible? difficult?

A: Let me try to answer your question:
First, you should figure out that which format the c++ application has?
Is it source code or binary executable bin?

*

*source code
You can implement the algorithm in java/scala, and make the most use of the cluster resouce, make you job much more quick that the single machine version.
if your time is limited, you can use gcc to compile your c++ source code, and follow the next method.

*

*binary executable bin
Because java/scala bytecode(.class format) run on the jvm, not compatible with the native code on machine, which is determined by the combination of compiler and operating system.
In the case, the only choice is get a new process to execute the c++ executable bin, and get what you want through inter process communication, such as pipe.
In a word, you should get a new process on driver node to de-duplicate your data, and use spark engine to do the following parallel computing to accelerate you project.
and get new process is so easy in scala or java, please refer the doc:
Process


text:
Q: it is possible to convert subselect with max function into SAS datastep? it is possible to convert code below from proc sql into sas datastep?
proc sql;
create table CAL_CHECK as
select t1.DT_REP
     , t1.BANK_FLAG
     , (select MAX(t2.DT_REP) as LAST_BD_BANK_FLAG from CZ_LOOK.CZ_CALENDAR t2 where t2.DT_REP < t1.DT_REP and t2.BANK_FLAG='Y') as LAST_BD
from CZ_LOOK.CZ_CALENDAR t1
where dt_rep between &first_day. and &last_day.;
quit;

thanks for response
example:
DT_REP      LAST_BD
01.04.2020  31.03.2020
02.04.2020  01.04.2020
03.04.2020  02.04.2020
04.04.2020  03.04.2020
05.04.2020  03.04.2020
06.04.2020  03.04.2020
07.04.2020  06.04.2020
08.04.2020  07.04.2020

1.4. was Wednesday, so last banking day is 31.3,
5.4. was Sunday, so the last banking day is 3.4,
6.4. was Monday, so the last banking day is 3.4. to

A: Yes. The sub-select is a self correlated sub-selected.
One might consider LAG as suitable, however, the bank_flag conditional makes it impossible to use LAG for the task at hand.
Retaining last_bd and updating its value only after using its value from prior state will in essence lag the variable conditionally as needed.
Example:
data CZ_CALENDAR;
  input (DT_REP LAST_BD) (ddmmyy10.:) bank_flag: $1. ;
  format dt_rep last_bd yymmdd10.;
datalines;
31.03.2020  .           Y Tue
01.04.2020  31.03.2020  Y Wed
02.04.2020  01.04.2020  Y Thu
03.04.2020  02.04.2020  Y Fri
04.04.2020  03.04.2020  N Sat
05.04.2020  03.04.2020  N Sun
06.04.2020  03.04.2020  Y Mon
07.04.2020  06.04.2020  Y Tue
08.04.2020  07.04.2020  Y Wed
;

%let first_day = '01JAN2020'D;
%let last_day = "&SYSDATE."D;

%put NOTE: &=first_day;
%put NOTE: &=last_day;

proc sql;
  create table CAL_CHECK as
  select
    t1.DT_REP
    , t1.BANK_FLAG
    , ( select MAX(t2.DT_REP) as LAST_BD_BANK_FLAG
       from CZ_CALENDAR t2
       where t2.DT_REP < t1.DT_REP and t2.BANK_FLAG='Y'
      )
      as LAST_BD
  from
    CZ_CALENDAR t1
  where
    dt_rep between &first_day. and &last_day.;
quit;

proc print data=CAL_CHECK;
  title "SQL";
  format dt_rep last_bd WEEKDATE.;
run;

proc sort data=cz_calendar;
  by dt_rep;

data cal_check2(where=(dt_rep between &first_day. and &last_day.));
  set cz_calendar;

  OUTPUT;

  * save dt_rep from most recent bank_flag day;
  retain last_bd;
  if bank_flag = 'Y' then last_bd = dt_rep;
run;

proc print data=CAL_CHECK2;
  title "DATA step";
  format dt_rep last_bd WEEKDATE.;
run;

Output


text:
Q: loading GIF image while navigating is there any way that loading GIF image while onclick and simultaneously, navigation should happen.
i tried using jquery but loader animations are not happening while page navigates in some mobile browser, is there a solution using ajax to overcome that problem?

A: The best way to do is is to use AJAX to load new content. What you can do is have a button which when clicked clears the html of the initial page and reloads content for the other html page.
Lets say you have the page's HTML contents in a div called #div and there's a button called #button which when clicked takes you to the new page. What you can do now is that whenever #button is clicked, you can clear the HTML contents of the current div, load the HTML of the new page (and while it loads you can display the GIF image) and then populate the div with the HTML of the new page.
$("#button").click(function() {

   //till the time the post function below doesn't return the following image will be displayed
   $("#div").html('<img src = "images/ajax-loader.gif" />');

   $.post("get_html.php", function (data) {

    //get the new HTML content
    $("#div").html(data);

   });

});

This is just an example, if you are more specific in what you need, maybe I could write code suited to your needs.


text:
Q: Let $f:\mathbb R→\mathbb R^3$ be defined by $f(x)=\langle 8x,6x,−8x\rangle$. Is f a linear transformation?
I am not sure on what process I should have when dealing with this problem?
I don't know what f(y) is equal to..
To fill in the blanks, the answers must be be written as a formula that returns a vector, which can be done using angle brackets.
For example:<8,6,-8> which is a result with 3 dimensions.
If I put a result that doesn't have 3 dimensions, then I will get an error.
In the "choose" drop-down menu for part a) and part b), it has 2 options that can be selected. The 2 options are "Yes, they are equal" and "No, they are not equal"
For part c), the two options are "f is a linear transformation" and "f is not a linear transformation"

A: When we write $f(x) = \langle 8x,6x,-8x \rangle$, it means that $f$ assigns to each real number $x$ the 3-dimensional vector $\langle 8x,6x,-8x \rangle$. Thus, for example, $f(1) = \langle 8,-6,-8 \rangle$ and $f(0)$ is the zero vector.
So, $f(y)$ is just the vector $\langle 8y,6y,-8y \rangle$ and $f(x+y)$ is...
It is easy to check that, in fact, $f(x+y) = f(x) + f(y)$.

A:
Please find the solution, let me know if you have questions.


text:
Q: Dos libpcap free memory ifself? My program use libpcap like this:

while pcaket = pcap_next() {
...

(modify the pcaket and do checksum)

...

pcap_sendpacket(pcaket)

}

Recently, I found there is a memory leak in my program...
My question is:
Will the libpcap free the pcaket after pcap_next? or I have to do the free work myself ?

A:
Will the libpcap free the pcaket after pcap_next?

The packet is contained in a buffer internal to libpcap (attached to the pcap_t); a new buffer is not allocated for each packet, so the buffer isn't freed after pcap_next(), it's freed after the pcap_t is closed.  You do not have to free it yourself.
(This also means that the packet data from a particular call to pcap_next() or pcap_next_ex() is not guaranteed to remain valid after the next call to pcap_next() or pcap_next_ex() - or pcap_loop() or pcap_dispatch(); it might be overwritten with data from the next packet or the next batch of packets.)