## programming – How do I see output for intermediate steps in a program?

I understand Mathematica programs to be a series of steps enclosed in simple parentheses. Each ‘step’ ends in a semicolon except for the last. The program output is then the output of the last step and intermediate step output is suppressed. I wish to “see the program run”, by seeing output for each step. Here is an example.

``````(
s=5;
f(x_):=x^2;
g(x_):=f(x)-5;
g(s) f(s)-s
)
``````

Which evaluates to 495. I’d like to see f(x)=25 and g(x)=20 along the way. Thanks.

## http – From a beginner. How to extract useful information from a extensive output?

`~\$ sudo nmap -dd -A -6 -T5 --open wwww.url_site.com`

That gives a output of almost 2000 lines. So, from a more experienced user: what I should look?

My intention was to found open ports with vulnerable services (little experience with that too).

`dd - I assume that debugging was make it more easy to understand`

`A - It seems useful all the times. `

`-t5 - It was the most fast option`

`IPv6 - Since it's more modern than IPv4`

## output formatting – Force results to be displayed in traditional way

I want to get my output in the form that one writes by hand, I have tried with `TraditionalForm`, but it did not work.

I’ve looked at several answers in this SE group, but I can’t find any that help me.

``````a^(2/3) - a^(1/3) b^(1/3) + b^(2/3)
``````
``````Power(a^2, (3)^-1) - Power(ab, (3)^-1) + Power(b^2, (3)^-1)
``````
``````a^(3/4) - Sqrt(a) b^(1/4) + a^(1/4) Sqrt(b) - b^(3/4)
``````
``````Power(a^3, (4)^-1) - Power(a^2 b, (4)^-1) + Power(ab^2, (4)^-1) -
Power(b^3, (4)^-1)
``````
``````a^(4/5) - a^(3/5) b^(1/5) + a^(2/5) b^(2/5) - a^(1/5) b^(3/5) + b^(4/5)
``````
``````Power(a^4, (5)^-1) - Power(a^3 b, (5)^-1) + Power(a^2 b^2, (5)^-1) -
Power(ab^3, (5)^-1) + Power(b^4, (5)^-1)
``````

## postgresql – psql command output to print error via -L output.log

The file specified to `-L` cannot be made to include errors.

To have errors in the same log file than queries and results, both outputs should be redirected to the same file. For example:

``````\$ cat >script.sql
select 1/0;

select count(*) from pg_class;

\$ psql -e -f script.sql &> output.log

\$ cat output.log
select 1/0;
psql:script.sql:1: ERROR:  division by zero
select count(*) from pg_class;
count
-------
352
(1 row)
``````

See `psql --help` for more options:

```Input and output options:
-a, --echo-all           echo all input from script
-b, --echo-errors        echo failed commands
-e, --echo-queries       echo commands sent to server
-E, --echo-hidden        display queries that internal commands generate
-L, --log-file=FILENAME  send session log to file
-o, --output=FILENAME    send query results to file (or |pipe)
-q, --quiet              run quietly (no messages, only query output)
-s, --single-step        single-step mode (confirm each query)
-S, --single-line        single-line mode (end of line terminates SQL command)

```

## windows 10: process 1 output used as process 2 input: pipes

process 1 :
`adb shell screenrecord --bit-rate 6000000 --size 1280x720 --output-format=h264 -`

process 2:
`ffplay -f h264`

normally ffplay takes its input as an argument (`-i _input`)

How to pipe those processes ? The output of process 1 must be the input of process 2

## google sheets – Formula to output the date for next Friday once it has passed 20:00 on Friday

Alsors, try this:

``````=ArrayFormula(IF((WEEKDAY(TODAY())=6)*(NOW()-TODAY()>=TIMEVALUE("8:00 PM")),TODAY()+7,FILTER(SEQUENCE(7,1,TODAY()),WEEKDAY(SEQUENCE(7,1,TODAY()))=6)))
``````

HOW IT WORKS

The formula assumes Sunday is counted as weekday 1 and, therefore, that Friday is counted as 6.

The first part of the IF checks to see if two conditions are true: That today is Friday and that the current time is greater than or equal to 8:00 PM. If those are both TRUE, then the date is set to seven days in the future (i.e., next Friday).

If this small window of time is not the case, then the second half of the IF statement takes effect. A SEQUENCE is formed of seven dates starting with today’s date. FILTER filters in only those days whose weekday is 6 (i.e., Friday). And since there will only be one Friday within any seven-day SEQUENCE of dates, it will pull whatever the “next Friday” is.

(Note: If today is Friday before 8:00 PM, then the “next Friday” in the SEQUENCE is today, so it stays showing today’s date until after 8:00 PM.)

## sql – Understanding the difference in output for finding Revenue by Store in Sakila Database

I am trying to find the Revenue by Store in Sakila Database(Demo Database from MySQL).

Sakila Structure

I am doing this :

``````SELECT store.store_id, SUM(payment.amount) as total_revenue
FROM rental
INNER JOIN payment on rental.rental_id = payment.rental_id
INNER JOIN staff on payment.staff_id = staff.staff_id
INNER JOIN store on staff.store_id = store.store_id
GROUP BY store.store_id
ORDER BY 2
``````

This is the result of the above query:

``````+--------+-----------+
|store_id|sum(amount)|
+--------+-----------+
|1       |33482.50   |
|2       |33924.06   |
+--------+-----------+
``````

But when I am doing this :

``````SELECT i.store_id, SUM(p.amount) as total_revenue
FROM rental r
INNER JOIN payment p ON r.rental_id = p.rental_id
INNER JOIN inventory i ON i.inventory_id = r.inventory_id
GROUP BY i.store_id
ORDER BY 2
``````

I am getting this result:

``````+--------+-----------+
|store_id|sum(amount)|
+--------+-----------+
|1       |33679.79   |
|2       |33726.77   |
+--------+-----------+
``````

Can some one explain what is the best way to find out the Total Revenue by Store ?

## bitcoind – btc rpc how to get the output address

I am learning the transfer structure of Bitcoin’s blockchain. I have encountered a problem and I hope to get help. First of all, thank you. I want to analyze the UTXO transfer in and out of a block, but the following json does not tell Which address did I transfer to, and how do I know which address the expense was transferred to? Why didn’t I see vout(‘scriptPubKey’)(‘addresses’)，In the following message’value’: Decimal(‘49.98000000’), how can I know where the 49 BTC went?

``````{'txid': 'a64be218809b61ac67ddc7f6c7f9fbebfe420cf75fe0318ebc727f060df48b37',
'hash': 'a64be218809b61ac67ddc7f6c7f9fbebfe420cf75fe0318ebc727f060df48b37', 'version': 1, 'size': 276, 'vsize': 276,
'weight': 1104, 'locktime': 0, 'vin': (
{'txid': '131f68261e28a80c3300b048c4c51f3ca4745653ba7ad6b20cc9188322818f25', 'vout': 1, 'scriptSig': {
'asm': '3045022100ef78daeb60d6332fa6f91ee93d95486d8601b5f2c1d1dc77633801dc6c0eb41902201 5b19e34de00ae729e20b97de8ac58ea8bb9227ba91a33bfaa26b7480e8a0005(ALL)',
'hex': '483045022100ef78daeb60d6332fa6f91ee93d95486d8601b5f2c1d1dc77633801dc6c0eb419022 015b19e34de00ae729e20b97de8ac58ea8bb9227ba91a33bfaa26b7480e8a000501'},
'sequence': 4294967295}), 'vout': ({'value': Decimal('0.01000000'), 'n': 0, 'scriptPubKey': {
'asm': '041d1ffff1175ce4628ed11b4074956a3f0facc95ab388e47b95daa02891f6e0b9642d4ae2b68c0 787d2c95288ec42045a087c262d803b6fa14ecedb2a632f3df1 OP_CHECKSIG',
'hex': '41041d1ffff1175ce4628ed11b4074956a3f0facc95ab388e47b95daa02891f6e0b9642d4ae2b68 c0787d2c95288ec42045a087c262d803b6fa14ecedb2a632f3df1ac',
'type': 'pubkey'}}, {'value': Decimal('49.98000000'), 'n': 1, 'scriptPubKey': {
'asm': '04f9804cfb86fb17441a6562b07c4ee8f012bdb2da5be022032e4b87100350ccc7c0f4d47078b06 c9d22b0ec10bdce4c590e0d01aed618987a6caa8c94d74ee6dc OP_CHECKSIG',
'hex': '4104f9804cfb86fb17441a6562b07c4ee8f012bdb2da5be022032e4b87100350ccc7c0f4d47078b 06c9d22b0ec10bdce4c590e0d01aed618987a6caa8c94d74ee6dcac',
'type': 'pubkey'}}),
'hex': '0100000001258f81228318c90cb2d67aba535674a43c1fc5c448b000330ca8281e26681f1301000 00049483045022100ef78daeb60d6332fa6f91ee93d95486d8601b5f2c1d1dc77633801dc6c0eb4 19022015b19e34de00ae729e20b97de8ac58ea8bb9227ba91a33bfaa26b7480e8a000501fffffff f0240420f00000000004341041d1ffff1175ce4628ed11b4074956a3f0facc95ab388e47b95daa0 2891f6e0b9642d4ae2b68c0787d2c95288ec42045a087c262d803b6fa14ecedb2a632f3df1ac806 de72901000000434104f9804cfb86fb17441a6562b07c4ee8f012bdb2da5be022032e4b87100350 ccc7c0f4d47078b06c9d22b0ec10bdce4c590e0d01aed618987a6caa8c94d74ee6dcac00000000',
'blockhash': '0000000049a63b4dda3a43450c19d085d6c28bfb4cbb2e0576815d7f31919c5d', 'confirmations': 654530,
'time': 1233636459, 'blocktime': 1233636459}
``````

## cannot decode block 0 to find the output address. I can decode much higher blocks. what am i missing?

Can you please decode block 0 output transaction manually showing me how to get the output address namely: 1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa

## output formatting – Mathematica not computing Matrix problem, just returning multiplication expression

I’m doing some very simple matrix operations in Mathematica, but for some reason, the last operation I’m trying to evaluate is not returning the actual product, just shows the symbolic multiplication.

``````P = {
{1, 2},
{3, 4}} /10;

im = {{1},{1}}
in = {{1},{1}}

A = ArrayFlatten[ {
{KroneckerProduct[in[Transpose], IdentityMatrix[2]]},
{KroneckerProduct[IdentityMatrix[2], im[Transpose]]}
} ]

p = Flatten[P] // MatrixForm

A.p
``````

This last operation, $$Acdot p$$ is returning the following:

Why is that so?