text:
Q: Configuring AWS S3 bucket policies How to configure AWS S3 bucket policies so that uploaded files are readable as public files.
Could somebody please give an example for node js code?
I am a novice to the field so I do not have prior experience regarding this. Any help is highly appreciated.

A: You can check out this official documentation of AWS s3 for NodeJS that explains how to update bucket policies

A: There are several steps in this process.This instructions are applicable for nodejs 14 (runtime: nodejs14.x)
First you have to follow the below link format after logging in to your AWS account
You should follow the below format.
https://s3.console.aws.amazon.com/s3/buckets/{BUCKET-NAME}?region={REGION}&tab=permissions#
This is an example link
https://s3.console.aws.amazon.com/s3/buckets/logo?region=us-east-1&tab=permissions#
image:  This is an example of entering the path
Second step is creating bucket policies. Replace the word "BUCKET-NAME" with the name of your bucket.
{
"Version": "2012-10-17",
"Statement": [
    {
        "Sid": "AllowPublicRead",
        "Effect": "Allow",
        "Principal": "*",
        "Action": "s3:PutObject",
        "Resource": "arn:aws:s3:::BUCKET-NAME/*",
        "Condition": {
            "StringEquals": {
                "s3:x-amz-acl": "public-read"
            }
        }
    }
]

}
image:  Bucket policies JSON configuration
Then create an endpoint on serverless.yml following the below code. file_upload function is included in handler.js file.
serverless.yml
file_upload:
    handler: handler.file_upload
    timeout: 15
    events:
      - httpApi:
          path: /file-upload
          method: post

After that you have to program handler.js file as below
handler.js
'use strict';
const AWS = require("aws-sdk");
const s3 = new AWS.S3()
const { Validator } = require('node-input-validator');

const MAX_SIZE = 2097152 // 2MB
const bucket = 'S3_BUCKET-NAME' // Name of your bucket.
const Busboy = require("busboy")

s3.config.update({
  region: "us-east-1",
  accessKeyId: 'S3_ACCESS_KEY_ID',
  secretAccessKey: 'S3_SECRET_ACCESS_KEY'
});

const sendJSON = (code, message, data) => {
    let resData = {
        "status": code < 400 ? 'Success' : 'Error',
        "message": message,
    }
    data ? (resData["data"] = data) : null;
    return {
        statusCode: code,
        headers: {
            "Content-Type": "application/json"
        },
        body: JSON.stringify({
            ...resData
        })
    };
}

const FORM = {
    parse(body, headers) {
        return new Promise((resolve, reject) => {
            const data = {};
            const buffer = Buffer.from(body, 'base64');
            const bb = Busboy({
                headers: Object.keys(headers).reduce((newHeaders, key) => {
                    // busboy expects lower-case headers.
                    newHeaders[key.toLowerCase()] = headers[key];
                    return newHeaders;
                }, {}),
                limits: {
                    fileSize: MAX_SIZE, // Set as desired.
                    files: 1,
                },
            });

            bb.on('file', (name, stream, info) => {
                const chunks = [];

                stream.on('data', (chunk) => {
                    if (name === 'File') {
                        chunks.push(chunk);
                    } else {
                        reject(new Error('File not found.'));
                    }
                }).on('limit', () => {
                    reject(new Error('File size limit has been reached.'));
                }).on('close', () => {
                    if (name === 'File') {
                        data[name] = Buffer.concat(chunks);
                        data['ContentType'] = info.mimeType;
                        data['FileName'] = info.filename;
                    }
                });
            });
            bb.on('field', (name, val, info) => {
                data[name] = val;
            });
            bb.on('error', (err) => {
                reject(err);
            });
            bb.on('close', () => {
                resolve(data);
            });

            bb.end(buffer);
        });
    }
};
const uploadToS3 = (bucket, key, buffer, mimeType) =>
    new Promise((resolve, reject) => {
        s3.upload(
            { Bucket: bucket, Key: key, Body: buffer, ContentType: mimeType, ACL: 'public-read' },
            function (err, data) {
                if (err) reject(err);
                resolve(data)
            })
    });

module.exports.file_upload = async (event) => {
  try {
        const data = await FORM.parse(event['body'], event['headers']);
        const validations = new Validator(data, {
            File: 'required'
        });
        const.path = data.path? data.path : null;
        const matched = await validations.check();
        if (!matched) {
            return sendJSON(400, validations.errors);
        }
        const date = Math.floor(Date.now() / 1000);
        const list = data.FileName.split(".");
        const originalKey = `${PATH}/${Date.now()}_${md5(list[0])}.${list[list.length-1]}`; // "PATH" is your sub-folder path in S3.
        const originalFile = await Promise.all([
            uploadToS3(bucket, originalKey, data.File, data.ContentType)
        ]);
        const file_name = originalFile[0]['Key'];
        return sendJSON(201, 'Successfully saved.', originalFile);
  } catch (e) {
    return sendJSON(400, e.message);
  }
};

A link for AWS documentation is attached below
https://docs.aws.amazon.com/AmazonS3/latest/userguide/example-bucket-policies.html


text:
Q: how to detect which device is group owner from list of peers? I want to know if there is already any group owner in the list of peers returned by onPeerListAvailable() in wifidirect ?
Is there any way of knowing it.
Thanks

A: Did you check this http://developer.android.com/reference/android/net/wifi/p2p/WifiP2pDevice.html#isGroupOwner%28%29
public boolean isGroupOwner ()
Added in API level 14

Returns true if the device is a group owner

A: In general you need to have the connection established in order to know who is the group owner.
And then if you are group owner you get the information when you get onConnectionInfoAvailable called, and to get it called you should call requestConnectionInfo() once you get event informing that you are indeed connected.
From client side, you would simply get the ip-address of the Group owner,

redpajama_set_name: RedPajamaStackExchange


text:
Q: Check for isNotEqual property in ibatis with java I am trying to implement the isNotEqual property property in ibatis.
I have 2 tables where I need to check for '0':
 prlines (trans=0)
 prlines_trans (transt=0)

So in the below code I need to apply isNotEqual to so that my query should only return those results where prlines.trans<>0 or prlines_trans.transt <> 0
depending on the below property :
<isEqual property="isPlanCurrent" compareValue="true" prepend="AND "> prlines .budgetyear = (select ryear from sq_ryear) </isEqual>

<isEqual property="isPlanCurrent" compareValue="false" prepend="AND "> prlines_trans.budgetyear = (select ryear from sq_ryear) and prlines_trans.lock=9 </isEqual>

A: You can use <isNotEqual> Binary Conditional Attribute. Below is the sample Code.
<isNotEqual prepend="AND"
             property="status"
             compareValue="N">
MARRIED = 'FALSE'
</isNotEqual>

If you are facing trouble in executing your SQL work with <> then you can choose one of the method below.

*

*Use CDATA as below.

 <select id="yourId" resultMap="expectedResultMap" parameterType="java.lang.String">
            SELECT * FROM(SELECT * FROM TABLE1
            WHERE COL1 =#{COL1,jdbcType=VARCHAR}
            ORDER BY DATE DESC
        ) TABLE2
        WHERE ROWNUM <![CDATA[ <= 20 ]]>
        </select>

*

*Use <> as below.

ROWNUM >= 20 ROWNUM <= 20


text:
Q: RethinkDB: how can I query nested arrays? I have a person object in RethinkDB that looks like this:
{
  "email": "user@domain.com",
  "orders": {,
    "id": 1,
    "additionalInvoices": [
      {
        "description": "Bananas",
        "stripeChargeId": "ch_333"
      },
      {
        "description": "Apples",
        "stripeChargeId": "ch_444"
      }
    ]
  }
}

Except no results are returned. Am I allowed to nest contains() functions? What's the best way to get the results I want?
Edit: I've also tried pluck() and describing the data structure, per this example of using nested datastructures in the RethinkDB docs - I thought this works, but it gives an empty object matching the query as the only result:
rethink.db(DATABASE).table(TABLE).pluck(
  {orders: [{additionalInvoices: [{'stripeChargeId': chargeID}]}]}
).run(dbConnection, function(err, results) {
  if ( err ) {
    cb(err)
    return;
  }
  toOne(results, cb)
})


text:
Q: if branches within while loop not executing as expected Here is the code that I am working with. The other classes that are referenced here have been tested and work though they should not have an effect on the functionality of the statements here.
import java.util.Scanner;

public class TransferTest
{
    public static void main(String[] args)
    {
        Scanner scan = new Scanner(System.in);

        double transferAmount;
        Account acct1 = new Account(100, null);
        Account acct2 = new Account(100, null);

        System.out.print("Choose an option: "
                + "\n1 <Enter>: to transfer from account 1 to account 2"
                + "\n2 <Enter>: to transfer from account 2 to account 1"
                + "\n3 <Enter>: to quit");
        int userOption = scan.nextInt();
        scan.nextLine();

        while(userOption != 3);
        {
            if (userOption == 1)
            {
                System.out.print("You chose transfer from account 1 to account 2"
                        + "\nEnter an amount to transfer: ");
                transferAmount = scan.nextInt();
                acct1.transfer(acct2, transferAmount);
            }
            else if (userOption == 2)
            {
                System.out.print("You chose transfer from account 1 to account 2"
                        + "\nEnter an amount to transfer: ");
                transferAmount = scan.nextInt();
                acct2.transfer(acct1, transferAmount);
            }
            else if (userOption == 3)
            {
                System.out.println(acct1.toString());
                System.out.println(acct2.toString());
            }
            else
            {
                System.out.println("Invalid input");
            }

            System.out.print("Choose an option: "
                    + "\n1 <Enter> to transfer from account 1 to account 2?"
                    + "\n2 <Enter> to transfer from account 2 to account 1"
                    + "\n3 <Enter> to quit");
            userOption = scan.nextInt();
            scan.nextLine();
        }

        System.out.println(acct1.toString());
        System.out.println(acct2.toString());
        scan.close();
    }

}

What I'm wanting this to do is prompt a user to choose one of the three options denoted by a numerical value. Then follow the if branch of that value, asking the user for an amount in the case of 1 or 2. Not exiting the while loop until the user chooses option 3. Whats happening is that when 3 or a value outside the specified range is entered the program works as expected, but when 1 or 2 are chosen as options nothing happens, not even the print statements are output. Any help with getting this working is much appreciated.

A: You have a semi-colon after your while loop.
while(userOption != 3);

Is effectively equal to:
while(userOption != 3) {
  // do nothing
}

So no code after that line is being executed.


text:
Q: find the time different between the day Dataframe
I have different machine running different hours that might cross over a day and I want to differentiate it on different day
Example Machine A running 8 hours from Start Date and Time 12-Aug, 9pm to 13-Aug , 5am
I cant get the correct time that 3hours from 12-Aug and 5hours from 13-Aug
Suspect that because i'm using datetime.now
how do it change the date will be same as Start date/ End date in python?
Here is my code:
endoftoday = datetime.now()
endoftoday = endoftoday.replace(hour=23,minute=59,second=59)

dt['Start_Date']=dt['Start_Time'].dt.strftime('%d/%m/%Y')
dt['End_Date']=dt['Finish_Time'].dt.strftime('%d/%m/%Y')

if (dt.['Start_Date'].str == dt['End_Date'].str):
    dt['Tested_Time_Today']= endoftoday-dt['Start_Time']
    dt['Tested_Time_NextDay']= dt['Finish_Time'] - endoftoday

A: Here is my attempt:
import pandas as pd
import datetime

def get_times(args):
    start_time, end_time, start_date, end_date = args
    hours = {}
    for day in pd.date_range(start_date, end_date, freq='d'):
        hours[day] = max(day, end_time) - max(start_time, day) + datetime.timedelta(hours=24)
    return hours

df = pd.DataFrame({'Start_Time': [datetime.datetime(2021,8,21,6,2), datetime.datetime(2021,8,21,7,19)], 'Finish_Time': [datetime.datetime(2021,8,22,5,12), datetime.datetime(2021,8,21,16,50)], 'Start_Date': [datetime.date(2021,8,21), datetime.date(2021,8,21)], 'End_Date': [datetime.date(2021,8,22), datetime.date(2021,8,21)]})
df['hours'] = df.apply(get_times, axis=1)
print(df)

This is probably not exactly what you are looking for since I also don't really understand your question well enough. But what you get is a new column which contains in each row a dictionary with the dates as key and the hours during that day as value.
If you let us know what exactly you are after, I might be able to improve the answer.
Edit: This won't work if your time period covers more than two days. If that is necessary, the time calculation would have to slightly extended. And if you have more columns than the ones that we perform the calculation on, please change the penultimate row to df['hours'] = df[['Start_Time', 'Finish_Time', 'Start_Date', 'End_Date']].apply(get_times, axis=1)


text:
Q: Replicating Schemaless SOLR Index I have an index on a Schemaless solr instance. To allow the application to query some of the fields that are in this index, I have to register these fields using the schema REST API http://localhost:8983/solr/schema/fields.
All works fine in isolation. I can also replicate the index to slaves without problem. However, I am unable to query the replicated index using the fields that were registered via the schema REST API.
That means, if I register the field "button" using the API, I can query using this field on master, but I cannot query on slave. I get error message 400 undefined field button.
Now, I also tried to register this field on the slave in the same way I registered it on the master using the schema REST API. This fails with the message: 400 This IndexSchema is not mutable.
Any idea how this should be addressed?
I presume that when the schema is well defined, the schema.xml can be replicated. But what happens with fields created via the REST API?
I am using SOLR 4.10.3

A: I have not fully validated that this is the solution to this problem, but my gut feeling tells me that it is. The SOLR master was running SOLR 4.8.0 and the SOLR Slave was running SOLR 4.10.3. It looks like the slave did not completely like the index replicated from 4.8.0. So I downgraded the slave to 4.8.0 and everything works fine.


text:
Q: Black on white theme in windows 10 terminal I just installed new windows 10 terminal. It is simply superb. I want to change the theme to black on white (currently it is white on black). Any configuration available for that? I got some configs for

*

*Campbell

*Solarized Light

*Solarized Dark and etc

I want the simple putty (black on white) theme

A: Found the color themes at https://github.com/mbadolato/iTerm2-Color-Schemes

*

*Download and extract the zip file

*Open "windowsterminal" folder

*Open any file (.json format)

*Copy the settings and paste them in "schemas" section of windows terminal settings

After copying, it should look something like below
// To view the default settings, hold "alt" while clicking on the "Settings" button.
// For documentation on these settings, see: https://aka.ms/terminal-documentation

{
    "$schema": "https://aka.ms/terminal-profiles-schema",

    "defaultProfile": "{c6eaf9f4-32a7-5fdc-b5cf-066e8a4b1e40}",

    "profiles":
    [
        {
            // Make changes here to the powershell.exe profile
            "guid": "{61c54bbd-c2c6-5271-96e7-009a87ff44bf}",
            "name": "Windows PowerShell",
            "commandline": "powershell.exe",
            "hidden": false
        },
        {
            // Make changes here to the cmd.exe profile
            "guid": "{0caa0dad-35be-5f56-a8ff-afceeeaa6101}",
            "name": "cmd",
            "commandline": "cmd.exe",
            "hidden": false
        },
        {
            "guid": "{b453ae62-4e3d-5e58-b989-0a998ec441b8}",
            "hidden": false,
            "name": "Azure Cloud Shell",
            "source": "Windows.Terminal.Azure"
        },
        {
            "guid": "{c6eaf9f4-32a7-5fdc-b5cf-066e8a4b1e40}",
            "hidden": false,
            "name": "Ubuntu-18.04",
            "source": "Windows.Terminal.Wsl",
            "acrylicOpacity" : 0.5,
            "closeOnExit" : true,
            "colorScheme" : "AtomOneLight",
            "cursorColor" : "#000000",
            "cursorShape" : "bar",
            "fontFace" : "Consolas",
            "fontSize" : 12,
            "historySize" : 9001,
            "icon" : "ms-appx:///ProfileIcons/{9acb9455-ca41-5af7-950f-6bca1bc9722f}.png",
            "padding" : "0, 0, 0, 0",
            "snapOnInput" : true,
            "useAcrylic" : false
        }
    ],

    // Add custom color schemes to this array
    "schemes": [
        {
            "name": "AtomOneLight",
            "black": "#000000",
            "red": "#de3e35",
            "green": "#3f953a",
            "yellow": "#d2b67c",
            "blue": "#2f5af3",
            "purple": "#950095",
            "cyan": "#3f953a",
            "white": "#bbbbbb",
            "brightBlack": "#000000",
            "brightRed": "#de3e35",
            "brightGreen": "#3f953a",
            "brightYellow": "#d2b67c",
            "brightBlue": "#2f5af3",
            "brightPurple": "#a00095",
            "brightCyan": "#3f953a",
            "brightWhite": "#ffffff",
            "background": "#f9f9f9",
            "foreground": "#2a2c33"
        }
    ],

    // Add any keybinding overrides to this array.
    // To unbind a default keybinding, set the command to "unbound"
    "keybindings": []
}

A: You can copy color schemes from the defaults.json by Alt-Clicking on the settings (settings are found in the dropdown menu in the tab bar).
Copy all the color schemes.  Then in your settings.json file (simple left click on the settings), replace the "schemas" array with the array you copied in defaults.json.   You should end up with something like this:
"schemes":
[
    {
        "name": "Campbell",
        // ...
    },
    {
        "name": "Campbell Powershell",
        // ...
    },
    // ...
]

Then, further up, you should find a profile defaults object that is empty.  Create a "colorScheme" property in there and set the value to the schema name you want.  You will end up with something like this:
"profiles":
{
    "defaults":
    {
        // Put settings here that you want to apply to all profiles.
        "colorScheme": "One Half Light"
    },
    "list":
    [
        /*...you will see things like cmd, powershell, or ubuntu/WSL profiles here*/
    ]

From there, you can add new schemas to the schemas array and then choose them by name.


text:
Q: Too many values to unpack I am trying to import a dat file as an array in my python files. The dat file has 125 rows and 5 columns containing information about 125 ellipses (X and Y coordinate, small and large radii and angle).
This is the command I use:
X_centers, Y_Centers, Small_Radii, Large_radii, Angles=np.loadtxt('C:\Hamid\Ellipses-1.dat',unpack=True)

and that is the error I get
ValueError: too many values to unpack

A: This error is occurring because the return from numpy.loadtext is more than 5 elements in length. Looking over the ref doc for numpy.loadtext, it sounds like it returns a single ndarray.
You can start debugging this with something like:
debug_it = np.loadtxt('C:\Hamid\Ellipses-1.dat',unpack=True)
print len(debug_it)
print debug_it.shape


text:
Q: Show that Newton method converges for every choice of $x_0$
Let $f\in\mathcal C^{2}(\mathbb R)$ with $f'(x)>0$ and $f''(x)<0$. If $f(x^*)=0$, show that the Newton method converges to $x^*$ for every choice of $x_0$

Wlog, choose a start point $x_0$, s.t. $f(x_0)>0$, then;
$\displaystyle x_1=x_0-\frac{f(x_0)}{f'(x_0)}<x_0$
Since, $f''(x)<0$, which means that $f$ is concave and this implies;
$\displaystyle f(x_1)\le f(x_0)+f'(x_1)(x_1-x_0)=f(x_0)+f'(x_1)\frac{-f(x_0)}{f'(x_0)}<0$ (because $f'(x_1)>f'(x_0)$)
Moreover
$\displaystyle x_2=x_1-\frac{f(x_1)}{f'(x_1)}>x_1$ and
$\displaystyle f(x_2)\le f(x_1)+f'(x_1)(x_2-x_1)=f(x_1)+f'(x_1)\frac{-f(x_1)}{f'(x_1)}=0$
So the sequence $\{x_n\}_{n\ge 2}$ is monotone increasing and bounded above by $0$ ($\forall n\ge 2:f(x_n)\le 0$). Therefore it converges.
Is my proof correct ?

A: The idea is alright, but more care should have been applied.
The first WLOG is unjustified: The cases $f(x_0)>0$ and $f(x_0)<0$ are totally different. But nevertheless we may assume $f(x_0)>0$ to begin with and see what happens.
Then, using $f''(x)<0$ we obtain
$$f(x_1)<f(x_0)+f'(x_0)(x_1-x_0)=0\ .$$
Correctly you then have $x_2>x_1$, and the next equation together with strict convexity shows that $f(x_2)<0$. Now comes the decisive mistake: This implies that $x_2<x_*$ and not $x_2<0$.
From what we have now we can say that starting with $n=2$ the $x_n$ form an increasing sequence bounded above by $x_*$. The rest should be clear.


text:
Q: Order : $ord_n (x) < \phi(n)$ Find all $n \in{N}$ satisfying $2 \leq n \leq 30$ and $ord_n (x) < \phi(n), \;\forall x \in{Z}_n^*$.
${Z}_n^* = \{x\in{Z}_n\mid(x, n)= 1\} $
${Z}_n$ = set of all residue classes $\bmod n$
My work :
$ord_n (x) < \phi(n)$, so $x$ is not primitive root.
By Primitive root theorem, $n$ is in the form $p^k, 2p^k, 2, 4$ where $p\in$ odd prime.
For $n = 2$, we have $x^2 \equiv 1 (\bmod p)$ and $\phi(p) \geq 2$ for $p \geq 3 $.
For $n = 4$,
if $p \geq 5 $, we have $x^4 \equiv 1 (\bmod p)$ and $x^2 \equiv -1 (\bmod p)$ so $\phi(p) \geq 4$.
if $p = 3 $, this contradicts $x^2 \equiv -1 (\bmod p)$.
Is my work correct ?
Please suggest how to prove in case of $p^k$ and $2p^k$.

A: I think you're not interpreting the condition
$$\forall x \in{Z}_n^*$$
correctly.

If there exists a primitive root mod $n$, the statement
$$ord_n (x) < \phi(n), \;\forall x \in{Z}_n^*$$
is false.

The statement is true if and only if $n$ is such that there does not exist a primitive root mod $n$. Thus, to answer the question, all you need to do is quote the primitive root theorem (as you did), and then list those values of $n$, where $2 \le n \le 30$, such that there does not exist a primitive root mod $n$.

Easy-peasy!


text:
Q: Apache Pig only load first nested tuple I use the exact sample from official document:
I have data.txt:
(3,8,9) (mary,19)
(1,4,7) (john,18)
(2,5,8) (joe,18)

I run:
A = LOAD 'data.txt' AS (F:tuple(f1:int,f2:int,f3:int),T:tuple(t1:chararray,t2:int));
dump A

I always got:
((3,8,9),)
((1,4,7),)
((2,5,8),)

The second nested tuple never got loaded. I tried in both versions of 0.16.0 and 0.17.0.

A: The problem should be with the data file you created. There should be tab in between both tuples as separator in the data file while creating it. If there was a space then we need to change the load query accordingly.
a)With tab(\t) as delimiter or separator.
grunt> A = LOAD '/home/ec2-user/data' AS (F:tuple(f1:int,f2:int,f3:int),T:tuple(t1:chararray,t2:int));
grunt> DESCRIBE A;
A: {F: (f1: int,f2: int,f3: int),T: (t1: chararray,t2: int)}
grunt> dump A;
((3,8,9),(mary,19))
((1,4,7),(john,18))
((2,5,8),(joe,18))

b)With single space( ) as delimiter or seperator.
grunt> A = LOAD '/home/ec2-user/data' AS (F:tuple(f1:int,f2:int,f3:int),T:tuple(t1:chararray,t2:int));
grunt> DESCRIBE A;
A: {F: (f1: int,f2: int,f3: int),T: (t1: chararray,t2: int)}
grunt> dump A;
((3,8,9),)
((1,4,7),)
((2,5,8),)

#Use PigStorage(' ') in case if you still want to use space as delimiter for file.
grunt> A = LOAD '/home/ec2-user/data' USING PigStorage(' ') AS (F:tuple(f1:int,f2:int,f3:int),T:tuple(t1:chararray,t2:int));
grunt> DESCRIBE A;
A: {F: (f1: int,f2: int,f3: int),T: (t1: chararray,t2: int)}
grunt> dump A;
((3,8,9),(mary,19))
((1,4,7),(john,18))
((2,5,8),(joe,18))


text:
Q: Cherry-picking produces unexpected conflicts I have a product with following branch versions: release/4.0, release/4.5 and release/5.0. Each of these are being maintained separately and each of there have a two main components:

*

*Site

*Backoffice

All of them share an identical backoffice component, but very different site component.
During the active development of backoffice, I tend to branch out of release/5.0, make changes, cherry-pick them to release/4.0 and release/4.5. Up until now, I had no issues with this, however, changes were limited to 5-6 files.
Recently, we have done major overhaul of the backoffice - most of the files were changed, some due to code-style (line-breaks/indentations) and some due to implementation requirements.
When I attempt to cherry-pick commits to other branches, I get strange and unexpected conflicts. I feel that my understanding of cherry picking is faulty, but the more I read the more that one seems appropriate.
Is there a better way to approach this problem?

A: Discalmer:
This is not solution, rather a workaround and a messy one.
First of all, both @matt and @al-dev are quite correct - this repo's structure is in dire need to refactor.
Since, I needed this right now, I managed to move changes from release/5.0 to other branches. Cherry-pick was not much of a use as the scope of changes (especially those related to code-style) kept messing my diff context and thus causing lot of conflicts.
As a workaround, I first did git diff of backend part of app, and then applied it back:
git diff --ignore-space-change --binary release/5.0..feature -- src/Backend/ > changes.diff
git apply --allow-binary-replacement --ignore-space-change --reject --whitespace=fix changes

Messy and not recommended and I am loosing commit history, but it did a job now. I am going to restructure the repo so I am able to steer clear of cherry-picking habit I picked up for this project.


text:
Q: Is it possible to Build and Run Cassandra from source code on Win 10 I have built source code from apache Cassandra repository succesfully and move all sciprts from release/bin to the corresponding built directory.
When I run the cassandra.bat,  error info still occurs. I tried to fix them one by one, including complement additional jar(jamm) from release zip, copy all files to the collacated directory from release/conf except for cassandra.yaml which contains "invalid entry" as the jvm reported.
Still I cannot run the Cassandra I built.
Now I am really disturbed that since the JVM is OS dependent, and I have built the source code and fixed the scripts and configuration files, why I still cannot run the Cassandra I built ?
Or one more concise question: Is there any way to build and run a cassandra from souce code on win 10 ?
Any help is sincerely appreciated, thank you.
Eidited:
Now I know Cassandra is going to remove Windows scripts for lack of test and maintenance thanks to informative comments.
But I still cannot figure out why, isn't Cassandra a process above JVM? Is it for the reason that Cassandra utilise some system call that is system dependent ?

A: Thanks to @AlexOtt , the reason why C* is not that platform independent is at least partilaly based on the File System of the OS. I may quote some words from the mailing threads.
from : https://lists.apache.org/thread/cpbpx74ysrs7xwgklpx2wh6003jms260

From: Joshua McKenzie jm...@apache.org
Date: Thursday, 30 July 2020 at 15:56
To: dev@cassandra.apache.org de...@cassandra.apache.org
Subject: Re: [Discussion] Windows support
I was the one that got Windows fully supported in 2014/2015 for context.
I say we pull support out. The way NTFS treats hard links (i.e. inability
to delete junctions if someone has a handle open to them even w/the right
flags if the file is memory mapped) is just a major headache in terms of
the way C*'s file I/O operates.


text:
Q: why is the method of prime factorization help in finding the lcm? why does finding the prime factors help in finding the lcm of two or more numbers. I know how to do it but why is this the case?
Edit
I found this answer from just thinking on my own.I don't know if it is correct.
The prime factors give us the minimum prime factors required to make up any number. Anything multiplied on top those factors still is a multiple of the number. example
primefactors(18) = 2*3*3
this means you need to at least have one 2 and two 3 to have a multiple of 18.
(2*3*3)*n = (18)*n, n could be any number, the product will always be a multiple of 18.

Knowing this we could combine the primefactors of two numbers in such a way that we meet the minimum requirement of each prime factor to have multiple of both numbers. example
lcm(10,24)
primefactors(10) = 2*5, this means we atleast need a factor of one 2 and one 5 to have a multiple of 10.
primefactors(24) = 2*2*2*3,  this means we atleast need a factor of three 2 and one 3 to have a multiple of 24.

we start with minimum factors we need for a multiple 10
2*5
we add the missing minimum factors we need for a multiple of 24
2*2*2*3*5

this is the same as
2*2*2*3*5 = (10) * 12 = (24) * 5

I hope this makes sense, I don't know any math notation, this is just from my brain.

A: Suppose you have two numbers written in their prime factorization
$$n = \prod_{i=1}^\infty p_i^{a_i} \;\;\;\;\; m = \prod_{i=1}^\infty p_i^{b_i}$$
where your exponents $a_i,b_i$ can be a nonnegative integer (i.e. including zero) and $p_i$ denotes the $i^{th}$ prime number. Then
$$\text{lcm}(n,m) = \prod_{i=1}^\infty p_i^{\max(a_i,b_i)}$$
Obviously, the process generalizes to as many numbers you're finding the lowest common multiple of in an easy manner.

Explanation of Notation
To clear things up for more elementary learners, let's explain the notation, particularly the "$\prod$" bit. This denotes an iterated product. It's sort of like a "for" loop from programming, but for math, if you're familiar with the context. The idea is quite simple:

*

*The bottom indicates you start at $i=1$.

*The top indicates where you end. Sometimes it's finite, and it's obvious where you end. Sometimes it's infinity, in which case it just goes on and on forever.

*The $\prod$ itself denotes the operation you're doing. Here, it's multiplication (because that's the convention mathematicians went with). If you had $\sum$, by similar convention, it'd mean you add. $\bigcup$ would denote union of sets. And so on and so forth.

So what you do is plug in your start variable (here, $i=1$). Then you take that result, add one to your index variable $i$, and then find the result with that, i.e. plug in $i=2$. Then plug in $i=3$, $i=4$, and so on, successively multiplying each result.
Some examples might help you understand:
$$\begin{align}
\prod_{i=1}^5 i &= 1 \cdot  2 \cdot 3 \cdot 4 \cdot 5\\
\prod_{i=4}^7 \frac{1}{2i} &= \frac{1}{2 \cdot 4} \cdot \frac{1}{2 \cdot 5} \cdot \frac{1}{2 \cdot 6} \cdot \frac{1}{2 \cdot 7}\\
\sum_{i=2}^\infty \frac{1}{2^i} &= \frac{1}{2^2} + \frac{1}{2^3} + \frac{1}{2^4} + \frac{1}{2^5} + \frac{1}{2^6} + \cdots
\end{align}$$
With the iterated product notation out of the way, the only other thing I think that needs explaining is the $\max$ function, but that's far more intuitive: whatever is in the function, the result is the largest value. Some examples:

*

*$\max(1,2,3) = 3$

*$\max(1, 1/2, 1/3, 1/4, \cdots) = 1$

*$\max(10, 20, 30, 40) = 40$
Thus, $\max(a_i,b_i)$ just means "take the bigger of the two values".
If the iterated product notation confuses you despite this, then I'll rewrite the formulas for $n,m$ and their lowest common multiple. Even so, remember that $p_i$ is the $i^{th}$ prime number. So $p_1=2$, $p_2=3$, $p_3=5$, and so on.
$$\begin{align}
n &= 2^{a_1} \times 3^{a_2} \times 5^{a_3} \times 7^{a_4} \times \cdots \times p_i^{a_i} \times \cdots\\
m &= 2^{b_1} \times 3^{b_2} \times 5^{b_3} \times 7^{b_4} \times \cdots \times p_i^{b_i} \times \cdots\\
\text{lcm}(n,m) &= 2^{\max(a_1,b_1)} \times 3^{\max(a_2,b_2)} \times 5^{\max(a_3,b_3)} \times 7^{\max(a_4,b_4)} \times \cdots \times p_i^{\max(a_i,b_i)} \cdots \times
\end{align}$$
Or, in words,

Write out the prime factorizations of $n$ and $m$, including $0$ for numbers not included in the prime factorization (so $14 = 2^1 \times 3^0 \times 5^0 \times 7^1 \times 11^0 \times \cdots$ for example). Then rewrite the prime factorization one more time, but this time, for the corresponding prime factor, just take the bigger of the exponents that appear in $n$ or $m$ and use that for the $\text{lcm}$.

An Example:

Find the $\text{lcm}$ of $20$, $27$, and $35$.

We note that
$$\begin{align}
20 &= 2^2 \times 5\\
27 &= 3^3\\
35 &= 5 \times 7
\end{align}$$
(For any missing prime factors, just assume they're zero in their exponents again. Like with $27$, $27 = 2^0 \times 3^3 \times 5^0 \times \cdots$.)
Compare prime factors and take the largest exponent among them.

*

*Largest exponent for $2$: $2$

*Largest exponent for $3$: $3$

*Largest exponent for $5$: $1$

*Largest exponent for $7$: $1$

*There are no larger prime factors

Therefore,
$$\text{lcm}(20,27,35) = 2^2 \times 3^3 \times 5 \times 7 = 3780$$
The comparisons are particularly easy to see if you just write them out in a table like this. The relevant exponent is the largest in a given column.
$$\begin{array}{c|c|c|c|c|c|c}
   & 2 & 3 & 5 & 7 & 11 & 13 & \cdots \\
\hline
20 & 2 &   & 1 &   &    &    & \cdots \\
27 &   & 3 &   &   &    &    & \cdots \\
35 &   &   & 1 & 1 &    &    & \cdots \\
\hline
\text{lcm} & 2 & 3 & 1 & 1 & & & \cdots \\
\end{array}$$
Blank spaces obviously are synonymous with an exponent of $0$; feel free to use them or leave them out, same difference in the end.


text:
Q: How to avoid unwanted alignment of components when clicking in the Form Designer? I'm using Embarcadero Delphi 10.3 Version 26.0.36039 on Windows 10.
Step 1: place aligned Edit and Button controls on the Form. (Edit.Top = 42)
Step 2: Move the Edit down 2 points (Edit.Top = 44)
Step 3: Click on the Edit. Bam! The control has moved two points up (Edit.Top = 42)
How to fix it?

A: In addition to disabling "Snap to Grid" and/or "Use Designer Guidelines" in the environment, you can also press (and hold) the Alt key while dragging the component. This will (temporarily) disable the "Snap" feature while you're dragging.


text:
Q: Which floating point operations generate quiet/signalling NaN? I'm designing an FPU in a logic simulator and I need to know which operations generate the two kinds of NaNs (quiet: qNaN and signalling: sNaN)
edit: I've found out that arithmetic operations like 0*infinity always generate qNaNs (source: http://www.savrola.com/resources/NaN.html). What I still don't know however is if there are any other ways to get sNaNs beside setting a variable to sNaN's bit pattern.

A: I assume you have some sort of textbook or spec on whatever floating point spec you intend to simulate. Look in there for definitions.
For something more general, you can read: http://en.wikipedia.org/wiki/NaN
Here is what wikipedia says on sNaNs:

Signaling NaN
Signaling NaNs, or sNaNs, are special forms of a
NaN that when consumed by most operations should raise an invalid
exception and then, if appropriate, be "quieted" into a qNaN that may
then propagate. They were introduced in IEEE 754. There have been
several ideas for how these might be used

*

*Filling uninitialized memory with signaling NaNs would produce an invalid exception if the data is used before it is initialized

*Using an sNaN as a placeholder for a more complicated object, such as:

*

*A representation of a number that has underflowed

*A representation of a number that has overflowed

*Number in a higher precision format

*A complex number


text:
Q: How to Configure PDF Initial View Settings in DITA Output When the PDF output is generated using DITA OT, I want the Initial View settings to be set dynamically with the following values:

*

*Navigation = Bookmarks Panel and Page

*Page layout = Single Page Continuous

*Magnification = Fit Page

*Open to Page = 1

Window Options

*

*Resize window to initial view

*Show = Document Title
Rendering Engines

*

*Apache FOP

*Oxygen PDF Chemistry

Could someone please help me figure out which files to modify or add to the DITA OT plugins to get this done?


text:
Q: `su` and `sudo bash` give a root prompt that won't execute any command This is happening on a CentOS 6.7 server, that I can ssh to as root or as my ordinary user.
Opening an ssh session as an ordinary user and switching to root within the session gets the expected prompt, but any command goes back to the previous state:
ordinary@server [~]# su
Password:
root@server [/home/ordinary]# ls
ordinary@server [~]# sudo bash
[sudo] password for root:
root@server [/home/ordinary]# ls
ordinary@server [~]#

su - does the same thing. Adding set -xv to the end of /root/.bashrc generates some additional output:
ordinary@server [~]# su
Password:
history -a
__rvm_date "+%s.%N" 2>/dev/null) ${BASH_SOURCE##${rvm_path:-}} : ${FUNCNAME[0]:+${FUNCNAME[0]}()}  ${LINENO} >
__rvm_date "+%s.%N" 2>/dev/null
++   :   0 > history -a
root@server [/home/ordinary]# ls
ordinary@server [~]# su -
Password:

# User specific environment and startup programs

PATH=$PATH:$HOME/bin
+ PATH=/usr/local/jdk/bin:/usr/kerberos/sbin:/usr/kerberos/bin:/usr/lib/courier-imap/sbin:/usr/lib/courier-imap/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin:/usr/X11R6/bin:/root/bin

export PATH
+ export PATH
history -a
++ history -a
root@server [~]# ls
ordinary@server [~]# sudo bash
[sudo] password for root:
history -a
++ history -a
root@server [/home/ordinary]# ls
ordinary@server [~]#

What is going on here? It looks like authentication is working, bash is giving its prompt and waiting for a command, but exiting before running the command it gets. Is there anywhere I can look for an error message?

Here are the startup files for root:
.profile does not exist
.bash_profile:
# .bash_profile

# Get the aliases and functions
if [ -f ~/.bashrc ]; then
    . ~/.bashrc
fi

# User specific environment and startup programs

PATH=$PATH:$HOME/bin

export PATH

.bashrc:
#################################################
# interactive failsafes and general aliasing
#################################################
alias rm='rm -i'
alias cp='cp -i'
alias mv='mv -i'
alias grep='grep --color'

############################
# Source global definitions
############################
if [ -f /etc/bashrc ]; then
    . /etc/bashrc
fi

############################
# Important history hacks
############################
#how many lines to keep in the history FILE
export HISTFILESIZE=500000
#how many lines to keep in memory for this SESSION.
export HISTSIZE=200000
#how to make it oh so very pretty.
HISTTIMEFORMAT="(%m/%d/%y) %T "
export HISTTIMEFORMAT
#append the history for all terminals
shopt -s histappend
export PROMPT_COMMAND='history -a'

###########################
# give some terminal <3
###########################
#set check window resize
shopt -s checkwinsize

#######################
# vim defaults
#######################
alias vi=vim
export EDITOR=vim

# EOF

#set -xv

sudo bash --norc does the same thing.  Here's the log of that from sudo strace -o bash--norc.strace bash --norc:
execve("/bin/bash", ["bash", "--norc"], [/* 17 vars */]) = 0
brk(0)                                  = 0x28d0000
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fb8d4ce2000
access("/etc/ld.so.preload", R_OK)      = -1 ENOENT (No such file or directory)
open("/etc/ld.so.cache", O_RDONLY)      = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=54952, ...}) = 0
mmap(NULL, 54952, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7fb8d4cd4000
close(3)                                = 0
open("/lib64/libtinfo.so.5", O_RDONLY)  = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0@\310\0k<\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0755, st_size=134792, ...}) = 0
mmap(0x3c6b000000, 2228832, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x3c6b000000
mprotect(0x3c6b01d000, 2093056, PROT_NONE) = 0
mmap(0x3c6b21c000, 16384, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x1c000) = 0x3c6b21c000
mmap(0x3c6b220000, 608, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x3c6b220000
close(3)                                = 0
open("/lib64/libdl.so.2", O_RDONLY)     = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\340\r\200d<\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0755, st_size=22536, ...}) = 0
mmap(0x3c64800000, 2109696, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x3c64800000
mprotect(0x3c64802000, 2097152, PROT_NONE) = 0
mmap(0x3c64a02000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x2000) = 0x3c64a02000
close(3)                                = 0
open("/lib64/libc.so.6", O_RDONLY)      = 3
read(3, "\177ELF\2\1\1\3\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0p\356Ad<\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0755, st_size=1926520, ...}) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fb8d4cd3000
mmap(0x3c64400000, 3750152, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x3c64400000
mprotect(0x3c6458a000, 2097152, PROT_NONE) = 0
mmap(0x3c6478a000, 20480, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x18a000) = 0x3c6478a000
mmap(0x3c6478f000, 18696, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x3c6478f000
close(3)                                = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fb8d4cd2000
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fb8d4cd1000
arch_prctl(ARCH_SET_FS, 0x7fb8d4cd2700) = 0
mprotect(0x3c64a02000, 4096, PROT_READ) = 0
mprotect(0x3c6478a000, 16384, PROT_READ) = 0
mprotect(0x3c6421f000, 4096, PROT_READ) = 0
munmap(0x7fb8d4cd4000, 54952)           = 0
rt_sigprocmask(SIG_BLOCK, NULL, [], 8)  = 0
open("/dev/tty", O_RDWR|O_NONBLOCK)     = 3
close(3)                                = 0
brk(0)                                  = 0x28d0000
brk(0x28f1000)                          = 0x28f1000
open("/usr/lib/locale/locale-archive", O_RDONLY) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=99154480, ...}) = 0
mmap(NULL, 99154480, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7fb8cee41000
close(3)                                = 0
getuid()                                = 0
getgid()                                = 0
geteuid()                               = 0
getegid()                               = 0
rt_sigprocmask(SIG_BLOCK, NULL, [], 8)  = 0
ioctl(0, SNDCTL_TMR_TIMEBASE or SNDRV_TIMER_IOCTL_NEXT_DEVICE or TCGETS, {B9600 opost isig icanon echo ...}) = 0
ioctl(2, SNDCTL_TMR_TIMEBASE or SNDRV_TIMER_IOCTL_NEXT_DEVICE or TCGETS, {B9600 opost isig icanon echo ...}) = 0
open("/proc/meminfo", O_RDONLY|O_CLOEXEC) = 3
fstat(3, {st_mode=S_IFREG|0444, st_size=0, ...}) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fb8d4ce1000
read(3, "MemTotal:        8048372 kB\nMemF"..., 1024) = 1024
close(3)                                = 0
munmap(0x7fb8d4ce1000, 4096)            = 0
rt_sigaction(SIGCHLD, {SIG_DFL, [], SA_RESTORER, 0x3c644326a0}, {SIG_DFL, [], 0}, 8) = 0
rt_sigaction(SIGCHLD, {SIG_DFL, [], SA_RESTORER, 0x3c644326a0}, {SIG_DFL, [], SA_RESTORER, 0x3c644326a0}, 8) = 0
rt_sigaction(SIGINT, {SIG_DFL, [], SA_RESTORER, 0x3c644326a0}, {SIG_DFL, [], 0}, 8) = 0
rt_sigaction(SIGINT, {SIG_DFL, [], SA_RESTORER, 0x3c644326a0}, {SIG_DFL, [], SA_RESTORER, 0x3c644326a0}, 8) = 0
rt_sigaction(SIGQUIT, {SIG_DFL, [], SA_RESTORER, 0x3c644326a0}, {SIG_DFL, [], 0}, 8) = 0
rt_sigaction(SIGQUIT, {SIG_DFL, [], SA_RESTORER, 0x3c644326a0}, {SIG_DFL, [], SA_RESTORER, 0x3c644326a0}, 8) = 0
rt_sigaction(SIGTERM, {SIG_DFL, [], SA_RESTORER, 0x3c644326a0}, {SIG_DFL, [], 0}, 8) = 0
rt_sigaction(SIGTERM, {SIG_DFL, [], SA_RESTORER, 0x3c644326a0}, {SIG_DFL, [], SA_RESTORER, 0x3c644326a0}, 8) = 0
rt_sigaction(SIGHUP, {0x4525f0, [HUP INT ILL TRAP ABRT BUS FPE USR1 SEGV USR2 PIPE ALRM TERM XCPU XFSZ VTALRM SYS], SA_RESTORER, 0x3c644326a0}, {SIG_DFL, [], 0}, 8) = 0
rt_sigaction(SIGINT, {0x4525f0, [HUP INT ILL TRAP ABRT BUS FPE USR1 SEGV USR2 PIPE ALRM TERM XCPU XFSZ VTALRM SYS], SA_RESTORER, 0x3c644326a0}, {SIG_DFL, [], SA_RESTORER, 0x3c644326a0}, 8) = 0
rt_sigaction(SIGILL, {0x4525f0, [HUP INT ILL TRAP ABRT BUS FPE USR1 SEGV USR2 PIPE ALRM TERM XCPU XFSZ VTALRM SYS], SA_RESTORER, 0x3c644326a0}, {SIG_DFL, [], 0}, 8) = 0
rt_sigaction(SIGTRAP, {0x4525f0, [HUP INT ILL TRAP ABRT BUS FPE USR1 SEGV USR2 PIPE ALRM TERM XCPU XFSZ VTALRM SYS], SA_RESTORER, 0x3c644326a0}, {SIG_DFL, [], 0}, 8) = 0
rt_sigaction(SIGABRT, {0x4525f0, [HUP INT ILL TRAP ABRT BUS FPE USR1 SEGV USR2 PIPE ALRM TERM XCPU XFSZ VTALRM SYS], SA_RESTORER, 0x3c644326a0}, {SIG_DFL, [], 0}, 8) = 0
rt_sigaction(SIGFPE, {0x4525f0, [HUP INT ILL TRAP ABRT BUS FPE USR1 SEGV USR2 PIPE ALRM TERM XCPU XFSZ VTALRM SYS], SA_RESTORER, 0x3c644326a0}, {SIG_DFL, [], 0}, 8) = 0
rt_sigaction(SIGBUS, {0x4525f0, [HUP INT ILL TRAP ABRT BUS FPE USR1 SEGV USR2 PIPE ALRM TERM XCPU XFSZ VTALRM SYS], SA_RESTORER, 0x3c644326a0}, {SIG_DFL, [], 0}, 8) = 0
rt_sigaction(SIGSEGV, {0x4525f0, [HUP INT ILL TRAP ABRT BUS FPE USR1 SEGV USR2 PIPE ALRM TERM XCPU XFSZ VTALRM SYS], SA_RESTORER, 0x3c644326a0}, {SIG_DFL, [], 0}, 8) = 0
rt_sigaction(SIGSYS, {0x4525f0, [HUP INT ILL TRAP ABRT BUS FPE USR1 SEGV USR2 PIPE ALRM TERM XCPU XFSZ VTALRM SYS], SA_RESTORER, 0x3c644326a0}, {SIG_DFL, [], 0}, 8) = 0
rt_sigaction(SIGPIPE, {0x4525f0, [HUP INT ILL TRAP ABRT BUS FPE USR1 SEGV USR2 PIPE ALRM TERM XCPU XFSZ VTALRM SYS], SA_RESTORER, 0x3c644326a0}, {SIG_DFL, [], 0}, 8) = 0
rt_sigaction(SIGALRM, {0x4525f0, [HUP INT ILL TRAP ABRT BUS FPE USR1 SEGV USR2 PIPE ALRM TERM XCPU XFSZ VTALRM SYS], SA_RESTORER, 0x3c644326a0}, {SIG_DFL, [], 0}, 8) = 0
rt_sigaction(SIGTERM, {0x4525f0, [HUP INT ILL TRAP ABRT BUS FPE USR1 SEGV USR2 PIPE ALRM TERM XCPU XFSZ VTALRM SYS], SA_RESTORER, 0x3c644326a0}, {SIG_DFL, [], SA_RESTORER, 0x3c644326a0}, 8) = 0
rt_sigaction(SIGXCPU, {0x4525f0, [HUP INT ILL TRAP ABRT BUS FPE USR1 SEGV USR2 PIPE ALRM TERM XCPU XFSZ VTALRM SYS], SA_RESTORER, 0x3c644326a0}, {SIG_DFL, [], 0}, 8) = 0
rt_sigaction(SIGXFSZ, {0x4525f0, [HUP INT ILL TRAP ABRT BUS FPE USR1 SEGV USR2 PIPE ALRM TERM XCPU XFSZ VTALRM SYS], SA_RESTORER, 0x3c644326a0}, {SIG_DFL, [], 0}, 8) = 0
rt_sigaction(SIGVTALRM, {0x4525f0, [HUP INT ILL TRAP ABRT BUS FPE USR1 SEGV USR2 PIPE ALRM TERM XCPU XFSZ VTALRM SYS], SA_RESTORER, 0x3c644326a0}, {SIG_DFL, [], 0}, 8) = 0
rt_sigaction(SIGUSR1, {0x4525f0, [HUP INT ILL TRAP ABRT BUS FPE USR1 SEGV USR2 PIPE ALRM TERM XCPU XFSZ VTALRM SYS], SA_RESTORER, 0x3c644326a0}, {SIG_DFL, [], 0}, 8) = 0
rt_sigaction(SIGUSR2, {0x4525f0, [HUP INT ILL TRAP ABRT BUS FPE USR1 SEGV USR2 PIPE ALRM TERM XCPU XFSZ VTALRM SYS], SA_RESTORER, 0x3c644326a0}, {SIG_DFL, [], 0}, 8) = 0
rt_sigprocmask(SIG_BLOCK, NULL, [], 8)  = 0
rt_sigaction(SIGQUIT, {SIG_IGN, [], SA_RESTORER, 0x3c644326a0}, {SIG_DFL, [], SA_RESTORER, 0x3c644326a0}, 8) = 0
rt_sigaction(SIGINT, {0x452880, [], SA_RESTORER, 0x3c644326a0}, {0x4525f0, [HUP INT ILL TRAP ABRT BUS FPE USR1 SEGV USR2 PIPE ALRM TERM XCPU XFSZ VTALRM SYS], SA_RESTORER, 0x3c644326a0}, 8) = 0
rt_sigaction(SIGTERM, {SIG_IGN, [], SA_RESTORER, 0x3c644326a0}, {0x4525f0, [HUP INT ILL TRAP ABRT BUS FPE USR1 SEGV USR2 PIPE ALRM TERM XCPU XFSZ VTALRM SYS], SA_RESTORER, 0x3c644326a0}, 8) = 0
rt_sigaction(SIGWINCH, {0x452410, [], SA_RESTORER, 0x3c644326a0}, {SIG_DFL, [], 0}, 8) = 0
rt_sigaction(SIGINT, {0x452880, [], SA_RESTORER, 0x3c644326a0}, {0x452880, [], SA_RESTORER, 0x3c644326a0}, 8) = 0
rt_sigaction(SIGTSTP, {SIG_IGN, [], SA_RESTORER, 0x3c644326a0}, {SIG_DFL, [], 0}, 8) = 0
rt_sigaction(SIGTTOU, {SIG_IGN, [], SA_RESTORER, 0x3c644326a0}, {SIG_DFL, [], 0}, 8) = 0
rt_sigaction(SIGTTIN, {SIG_IGN, [], SA_RESTORER, 0x3c644326a0}, {SIG_DFL, [], 0}, 8) = 0
uname({sys="Linux", node="server", ...}) = 0
socket(PF_LOCAL, SOCK_STREAM|SOCK_CLOEXEC|SOCK_NONBLOCK, 0) = 3
connect(3, {sa_family=AF_LOCAL, sun_path="/var/run/nscd/socket"}, 110) = 0
sendto(3, "\2\0\0\0\v\0\0\0\7\0\0\0passwd\0", 19, MSG_NOSIGNAL, NULL, 0) = 19
poll([{fd=3, events=POLLIN|POLLERR|POLLHUP}], 1, 5000) = 1 ([{fd=3, revents=POLLIN}])
recvmsg(3, {msg_name(0)=NULL, msg_iov(2)=[{"passwd\0", 7}, {"\270O\3\0\0\0\0\0", 8}], msg_controllen=24, {cmsg_len=20, cmsg_level=SOL_SOCKET, cmsg_type=SCM_RIGHTS, {4}}, msg_flags=MSG_CMSG_CLOEXEC}, MSG_CMSG_CLOEXEC) = 15
mmap(NULL, 217016, PROT_READ, MAP_SHARED, 4, 0) = 0x7fb8cee0c000
close(4)                                = 0
close(3)                                = 0
getcwd("/home/ordinary", 4096)       = 18
getpid()                                = 24450
open("/usr/lib64/gconv/gconv-modules.cache", O_RDONLY) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=26060, ...}) = 0
mmap(NULL, 26060, PROT_READ, MAP_SHARED, 3, 0) = 0x7fb8cee05000
close(3)                                = 0
getppid()                               = 24447
stat(".", {st_mode=S_IFDIR|0700, st_size=4096, ...}) = 0
stat("/sbin/bash", 0x7fff1c54f990)      = -1 ENOENT (No such file or directory)
stat("/bin/bash", {st_mode=S_IFREG|0755, st_size=941768, ...}) = 0
stat("/bin/bash", {st_mode=S_IFREG|0755, st_size=941768, ...}) = 0
geteuid()                               = 0
getegid()                               = 0
getuid()                                = 0
getgid()                                = 0
access("/bin/bash", X_OK)               = 0
stat("/bin/bash", {st_mode=S_IFREG|0755, st_size=941768, ...}) = 0
geteuid()                               = 0
getegid()                               = 0
getuid()                                = 0
getgid()                                = 0
access("/bin/bash", R_OK)               = 0
stat("/bin/bash", {st_mode=S_IFREG|0755, st_size=941768, ...}) = 0
stat("/bin/bash", {st_mode=S_IFREG|0755, st_size=941768, ...}) = 0
geteuid()                               = 0
getegid()                               = 0
getuid()                                = 0
getgid()                                = 0
access("/bin/bash", X_OK)               = 0
stat("/bin/bash", {st_mode=S_IFREG|0755, st_size=941768, ...}) = 0
geteuid()                               = 0
getegid()                               = 0
getuid()                                = 0
getgid()                                = 0
access("/bin/bash", R_OK)               = 0
getpgrp()                               = 24446
dup(2)                                  = 3
getrlimit(RLIMIT_NOFILE, {rlim_cur=1024, rlim_max=4*1024}) = 0
fcntl(255, F_GETFD)                     = -1 EBADF (Bad file descriptor)
dup2(3, 255)                            = 255
close(3)                                = 0
ioctl(255, TIOCGPGRP, [24446])          = 0
setpgid(0, 24450)                       = 0
rt_sigprocmask(SIG_BLOCK, [CHLD TSTP TTIN TTOU], [], 8) = 0
ioctl(255, SNDRV_TIMER_IOCTL_SELECT or TIOCSPGRP, [24450]) = 0
rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
ioctl(255, TIOCGPGRP, [24450])          = 0
fcntl(255, F_SETFD, FD_CLOEXEC)         = 0
rt_sigaction(SIGCHLD, {0x43f5a0, [], SA_RESTORER, 0x3c644326a0}, {SIG_DFL, [], SA_RESTORER, 0x3c644326a0}, 8) = 0
ioctl(255, SNDCTL_TMR_TIMEBASE or SNDRV_TIMER_IOCTL_NEXT_DEVICE or TCGETS, {B9600 opost isig icanon echo ...}) = 0
getrlimit(RLIMIT_NPROC, {rlim_cur=62714, rlim_max=62714}) = 0
rt_sigprocmask(SIG_BLOCK, NULL, [], 8)  = 0
fcntl(0, F_GETFL)                       = 0x8002 (flags O_RDWR|O_LARGEFILE)
open("/root/.bash_history", O_RDONLY)   = 3
fstat(3, {st_mode=S_IFREG|0600, st_size=49948, ...}) = 0
read(3, "screen -S ded_setup\nexit\n#137414"..., 49948) = 49948
close(3)                                = 0
stat("/root/.bash_history", {st_mode=S_IFREG|0600, st_size=49948, ...}) = 0
open("/root/.bash_history", O_RDONLY)   = 3
fstat(3, {st_mode=S_IFREG|0600, st_size=49948, ...}) = 0
read(3, "screen -S ded_setup\nexit\n#137414"..., 49948) = 49948
close(3)                                = 0
brk(0x2912000)                          = 0x2912000
ioctl(255, SNDCTL_TMR_TIMEBASE or SNDRV_TIMER_IOCTL_NEXT_DEVICE or TCGETS, {B9600 opost isig icanon echo ...}) = 0
rt_sigprocmask(SIG_BLOCK, NULL, [], 8)  = 0
rt_sigaction(SIGINT, {0x452880, [], SA_RESTORER, 0x3c644326a0}, {0x452880, [], SA_RESTORER, 0x3c644326a0}, 8) = 0
ioctl(1, SNDCTL_TMR_TIMEBASE or SNDRV_TIMER_IOCTL_NEXT_DEVICE or TCGETS, {B9600 opost isig icanon echo ...}) = 0
stat("/root/.terminfo", 0x7fff1c54dae0) = -1 ENOENT (No such file or directory)
stat("/etc/terminfo", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
access("/etc/terminfo/s/screen-256color-bce", R_OK) = -1 ENOENT (No such file or directory)
stat("/usr/share/terminfo", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
access("/usr/share/terminfo/s/screen-256color-bce", R_OK) = 0
open("/usr/share/terminfo/s/screen-256color-bce", O_RDONLY) = 3
read(3, "\32\0017\0+\0\20\0i\1\325\2screen-256color-bce|"..., 4097) = 1840
close(3)                                = 0
ioctl(1, SNDCTL_TMR_TIMEBASE or SNDRV_TIMER_IOCTL_NEXT_DEVICE or TCGETS, {B9600 opost isig icanon echo ...}) = 0
ioctl(1, SNDCTL_TMR_TIMEBASE or SNDRV_TIMER_IOCTL_NEXT_DEVICE or TCGETS, {B9600 opost isig icanon echo ...}) = 0
ioctl(1, SNDCTL_TMR_TIMEBASE or SNDRV_TIMER_IOCTL_NEXT_DEVICE or TCGETS, {B9600 opost isig icanon echo ...}) = 0
ioctl(1, TIOCGWINSZ, {ws_row=51, ws_col=209, ws_xpixel=1254, ws_ypixel=663}) = 0
ioctl(0, TIOCGWINSZ, {ws_row=51, ws_col=209, ws_xpixel=1254, ws_ypixel=663}) = 0
ioctl(0, TIOCGWINSZ, {ws_row=51, ws_col=209, ws_xpixel=1254, ws_ypixel=663}) = 0
ioctl(0, SNDRV_TIMER_IOCTL_STATUS or TIOCSWINSZ, {ws_row=51, ws_col=209, ws_xpixel=1254, ws_ypixel=663}) = 0
ioctl(0, SNDCTL_TMR_TIMEBASE or SNDRV_TIMER_IOCTL_NEXT_DEVICE or TCGETS, {B9600 opost isig icanon echo ...}) = 0
stat("/etc/inputrc", {st_mode=S_IFREG|0644, st_size=942, ...}) = 0
open("/etc/inputrc", O_RDONLY)          = 3
read(3, "# do not bell on tab-completion\n"..., 942) = 942
close(3)                                = 0
brk(0x2933000)                          = 0x2933000
rt_sigprocmask(SIG_BLOCK, [CHLD TSTP TTIN TTOU], [], 8) = 0
ioctl(255, SNDRV_TIMER_IOCTL_SELECT or TIOCSPGRP, [24450]) = 0
rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
rt_sigaction(SIGINT, {0x452880, [], SA_RESTORER, 0x3c644326a0}, {0x452880, [], SA_RESTORER, 0x3c644326a0}, 8) = 0
rt_sigprocmask(SIG_BLOCK, [INT], [], 8) = 0
ioctl(0, TIOCGWINSZ, {ws_row=51, ws_col=209, ws_xpixel=1254, ws_ypixel=663}) = 0
ioctl(0, SNDRV_TIMER_IOCTL_STATUS or TIOCSWINSZ, {ws_row=51, ws_col=209, ws_xpixel=1254, ws_ypixel=663}) = 0
ioctl(0, SNDCTL_TMR_TIMEBASE or SNDRV_TIMER_IOCTL_NEXT_DEVICE or TCGETS, {B9600 opost isig icanon echo ...}) = 0
ioctl(0, SNDCTL_TMR_STOP or SNDRV_TIMER_IOCTL_GINFO or TCSETSW, {B9600 opost isig -icanon -echo ...}) = 0
rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
rt_sigprocmask(SIG_BLOCK, [INT QUIT ALRM TERM TSTP TTIN TTOU], [], 8) = 0
rt_sigaction(SIGINT, {0x495aa0, [], SA_RESTORER, 0x3c644326a0}, {0x452880, [], SA_RESTORER, 0x3c644326a0}, 8) = 0
rt_sigaction(SIGTERM, {0x495aa0, [], SA_RESTORER, 0x3c644326a0}, {SIG_IGN, [], SA_RESTORER, 0x3c644326a0}, 8) = 0
rt_sigaction(SIGTERM, {SIG_IGN, [], SA_RESTORER, 0x3c644326a0}, {0x495aa0, [], SA_RESTORER, 0x3c644326a0}, 8) = 0
rt_sigaction(SIGQUIT, {0x495aa0, [], SA_RESTORER, 0x3c644326a0}, {SIG_IGN, [], SA_RESTORER, 0x3c644326a0}, 8) = 0
rt_sigaction(SIGQUIT, {SIG_IGN, [], SA_RESTORER, 0x3c644326a0}, {0x495aa0, [], SA_RESTORER, 0x3c644326a0}, 8) = 0
rt_sigaction(SIGALRM, {0x495aa0, [], SA_RESTORER, 0x3c644326a0}, {0x4525f0, [HUP INT ILL TRAP ABRT BUS FPE USR1 SEGV USR2 PIPE ALRM TERM XCPU XFSZ VTALRM SYS], SA_RESTORER, 0x3c644326a0}, 8) = 0
rt_sigaction(SIGTSTP, {0x495aa0, [], SA_RESTORER, 0x3c644326a0}, {SIG_IGN, [], SA_RESTORER, 0x3c644326a0}, 8) = 0
rt_sigaction(SIGTSTP, {SIG_IGN, [], SA_RESTORER, 0x3c644326a0}, {0x495aa0, [], SA_RESTORER, 0x3c644326a0}, 8) = 0
rt_sigaction(SIGTTOU, {0x495aa0, [], SA_RESTORER, 0x3c644326a0}, {SIG_IGN, [], SA_RESTORER, 0x3c644326a0}, 8) = 0
rt_sigaction(SIGTTOU, {SIG_IGN, [], SA_RESTORER, 0x3c644326a0}, {0x495aa0, [], SA_RESTORER, 0x3c644326a0}, 8) = 0
rt_sigaction(SIGTTIN, {0x495aa0, [], SA_RESTORER, 0x3c644326a0}, {SIG_IGN, [], SA_RESTORER, 0x3c644326a0}, 8) = 0
rt_sigaction(SIGTTIN, {SIG_IGN, [], SA_RESTORER, 0x3c644326a0}, {0x495aa0, [], SA_RESTORER, 0x3c644326a0}, 8) = 0
rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
rt_sigaction(SIGWINCH, {0x4959a0, [], SA_RESTORER|SA_RESTART, 0x3c644326a0}, {0x452410, [], SA_RESTORER, 0x3c644326a0}, 8) = 0
rt_sigprocmask(SIG_BLOCK, [INT], [], 8) = 0
fstat(2, {st_mode=S_IFCHR|0620, st_rdev=makedev(136, 1), ...}) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fb8cee04000
write(2, "bash-4.1# ", 10)              = 10
rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
rt_sigprocmask(SIG_BLOCK, NULL, [], 8)  = 0
read(0, "l", 1)                         = 1
rt_sigprocmask(SIG_BLOCK, [INT], [], 8) = 0
write(2, "l", 1)                        = 1
rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
rt_sigprocmask(SIG_BLOCK, NULL, [], 8)  = 0
read(0, "s", 1)                         = 1
rt_sigprocmask(SIG_BLOCK, [INT], [], 8) = 0
write(2, "s", 1)                        = 1
rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
rt_sigprocmask(SIG_BLOCK, NULL, [], 8)  = 0
read(0, "\r", 1)                        = 1
write(2, "\n", 1)                       = 1
rt_sigprocmask(SIG_BLOCK, [INT], [], 8) = 0
ioctl(0, SNDCTL_TMR_STOP or SNDRV_TIMER_IOCTL_GINFO or TCSETSW, {B9600 opost isig icanon echo ...}) = 0
rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
rt_sigaction(SIGINT, {0x452880, [], SA_RESTORER, 0x3c644326a0}, {0x495aa0, [], SA_RESTORER, 0x3c644326a0}, 8) = 0
rt_sigaction(SIGTERM, {SIG_IGN, [], SA_RESTORER, 0x3c644326a0}, {SIG_IGN, [], SA_RESTORER, 0x3c644326a0}, 8) = 0
rt_sigaction(SIGQUIT, {SIG_IGN, [], SA_RESTORER, 0x3c644326a0}, {SIG_IGN, [], SA_RESTORER, 0x3c644326a0}, 8) = 0
rt_sigaction(SIGALRM, {0x4525f0, [HUP INT ILL TRAP ABRT BUS FPE USR1 SEGV USR2 PIPE ALRM TERM XCPU XFSZ VTALRM SYS], SA_RESTORER, 0x3c644326a0}, {0x495aa0, [], SA_RESTORER, 0x3c644326a0}, 8) = 0
rt_sigaction(SIGTSTP, {SIG_IGN, [], SA_RESTORER, 0x3c644326a0}, {SIG_IGN, [], SA_RESTORER, 0x3c644326a0}, 8) = 0
rt_sigaction(SIGTTOU, {SIG_IGN, [], SA_RESTORER, 0x3c644326a0}, {SIG_IGN, [], SA_RESTORER, 0x3c644326a0}, 8) = 0
rt_sigaction(SIGTTIN, {SIG_IGN, [], SA_RESTORER, 0x3c644326a0}, {SIG_IGN, [], SA_RESTORER, 0x3c644326a0}, 8) = 0
rt_sigaction(SIGWINCH, {0x452410, [], SA_RESTORER, 0x3c644326a0}, {0x4959a0, [], SA_RESTORER|SA_RESTART, 0x3c644326a0}, 8) = 0
socket(PF_NETLINK, SOCK_RAW, 9)         = 3
sendmsg(3, {msg_name(12)={sa_family=AF_NETLINK, pid=0, groups=00000000}, msg_iov(2)=[{"\23\0\0\0d\4\1\0\0\0\0\0\0\0\0\0", 16}, {"ls\0", 3}], msg_controllen=0, msg_flags=0}, 0) = 19
close(3)                                = 0
rt_sigaction(SIGINT, {0x452880, [], SA_RESTORER, 0x3c644326a0}, {0x452880, [], SA_RESTORER, 0x3c644326a0}, 8) = 0
getuid()                                = 0
getuid()                                = 0
ioctl(0, SNDCTL_TMR_TIMEBASE or SNDRV_TIMER_IOCTL_NEXT_DEVICE or TCGETS, {B9600 opost isig icanon echo ...}) = 0
ioctl(0, SNDCTL_TMR_TIMEBASE or SNDRV_TIMER_IOCTL_NEXT_DEVICE or TCGETS, {B9600 opost isig icanon echo ...}) = 0
readlink("/proc/self/fd/0", "/dev/pts/1", 4095) = 10
access("/var/run/utmpx", F_OK)          = -1 ENOENT (No such file or directory)
open("/var/run/utmp", O_RDONLY|O_CLOEXEC) = 3
fcntl(3, F_GETFD)                       = 0x1 (flags FD_CLOEXEC)
lseek(3, 0, SEEK_SET)                   = 0
alarm(0)                                = 0
rt_sigaction(SIGALRM, {0x3c64524720, [], SA_RESTORER, 0x3c644326a0}, {0x4525f0, [HUP INT ILL TRAP ABRT BUS FPE USR1 SEGV USR2 PIPE ALRM TERM XCPU XFSZ VTALRM SYS], SA_RESTORER, 0x3c644326a0}, 8) = 0
alarm(10)                               = 0
fcntl(3, F_SETLKW, {type=F_RDLCK, whence=SEEK_SET, start=0, len=0}) = 0
read(3, "\2\0\0\0\0\0\0\0~\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 384) = 384
read(3, "\1\0\0\0003\0\0\0~\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 384) = 384
read(3, "\6\0\0\0\221\37\0\0tty3\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 384) = 384
read(3, "\6\0\0\0\225\37\0\0tty5\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 384) = 384
read(3, "\6\0\0\0\217\37\0\0tty2\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 384) = 384
read(3, "\6\0\0\0\223\37\0\0tty4\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 384) = 384
read(3, "\6\0\0\0\215\37\0\0tty1\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 384) = 384
read(3, "\6\0\0\0\227\37\0\0tty6\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 384) = 384
read(3, "\7\0\0\0\247]\0\0pts/0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 384) = 384
read(3, "\10\0\0\0%,\0\0pts/1\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 384) = 384
read(3, "\10\0\0\0J<\0\0pts/2\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 384) = 384
read(3, "\10\0\0\0002V\0\0pts/3\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 384) = 384
read(3, "\10\0\0\0\275\t\0\0pts/5\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 384) = 384
read(3, "\10\0\0\0\275\f\0\0pts/7\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 384) = 384
read(3, "\10\0\0\0\263\22\0\0pts/9\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 384) = 384
read(3, "\10\0\0\0?M\0\0pts/10\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 384) = 384
read(3, "\10\0\0\0\244t\0\0pts/11\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 384) = 384
read(3, "\10\0\0\0\352\n\0\0pts/13\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 384) = 384
read(3, "\10\0\0\0\23\"\0\0pts/15\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 384) = 384
read(3, "\10\0\0\0\213>\0\0pts/17\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 384) = 384
read(3, "\10\0\0\0x)\0\0pts/6\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 384) = 384
read(3, "\10\0\0\0\377G\0\0pts/8\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 384) = 384
read(3, "\10\0\0\0\3051\0\0pts/12\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 384) = 384
read(3, "\10\0\0\0\352\f\0\0pts/14\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 384) = 384
read(3, "\10\0\0\0\311,\0\0pts/16\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 384) = 384
read(3, "\10\0\0\0yA\0\0pts/19\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 384) = 384
read(3, "\10\0\0\0A\10\0\0pts/5\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 384) = 384
read(3, "\10\0\0\0\323\36\0\0pts/4\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 384) = 384
read(3, "\10\0\0\0\rY\0\0pts/3\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 384) = 384
read(3, "\10\0\0\0ll\0\0pts/1\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 384) = 384
read(3, "\10\0\0\0=&\0\0pts/4\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 384) = 384
read(3, "\10\0\0\0}*\0\0pts/6\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 384) = 384
read(3, "\10\0\0\0\317\25\0\0pts/8\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 384) = 384
read(3, "", 384)                        = 0
fcntl(3, F_SETLKW, {type=F_UNLCK, whence=SEEK_SET, start=0, len=0}) = 0
alarm(0)                                = 10
rt_sigaction(SIGALRM, {0x4525f0, [HUP INT ILL TRAP ABRT BUS FPE USR1 SEGV USR2 PIPE ALRM TERM XCPU XFSZ VTALRM SYS], SA_RESTORER, 0x3c644326a0}, NULL, 8) = 0
socket(PF_LOCAL, SOCK_DGRAM|SOCK_CLOEXEC, 0) = 4
connect(4, {sa_family=AF_LOCAL, sun_path="/dev/log"}, 110) = 0
open("/etc/localtime", O_RDONLY)        = 5
fstat(5, {st_mode=S_IFREG|0644, st_size=3519, ...}) = 0
fstat(5, {st_mode=S_IFREG|0644, st_size=3519, ...}) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fb8cee03000
read(5, "TZif2\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\4\0\0\0\4\0\0\0\0"..., 4096) = 3519
lseek(5, -2252, SEEK_CUR)               = 1267
read(5, "TZif2\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\5\0\0\0\5\0\0\0\0"..., 4096) = 2252
close(5)                                = 0
munmap(0x7fb8cee03000, 4096)            = 0
sendto(4, "<151>Nov 17 10:30:55 bash: No UT"..., 63, MSG_NOSIGNAL, NULL, 0) = 63
close(4)                                = 0
exit_group(0)                           = ?
+++ exited with 0 +++

I don't know enough to spot the problem in this log, but I do see where it tries to write to /dev/log a message that starts with "bash: No UT".  I guessed that had something to do with utmp, and tried clearing /var/run/utmp, but that had no effect.

A: Try sudo -s.
This should fix it.


text:
Q: Existence of a discrete subset Let $X$ be a topological space. $Y$ is a discrete subset of $X$ if it has a discrete topology induced by the topology of $X$. This is equivalent to the fact that for every $y\in Y$ there is an open $U\subset X$ such that $U\cap Y=\{y\}$. Consider a stronger condition: there is a collection $\{U_y\}_{y\in Y}$ of mutualy disjoint open sets, such that $y\in U_y$. I wonder if the two are equivalent for nice spaces, but my question today is following:

Is it true that if $X$ is locally compact and not compact, there is a discrete (in the stronger sense) set $Y\subset X$, such that $\overline{Y}$ is not compact?

In my specific case $X$ is locally compact, but this condition is not necessary in order to pose the question. If $X$ is metrizable and separable, it has a metrizable compactification, and $Y$ can be chosen as a sequence that converges in a conrolled way to an infinite element. If $X$ is locally compact and $\sigma$-compact, then there is a sequence of compacts $\{K_n\}$ such that $K_n\subset int~K_{n+1}$, and taking $Y$ to be the sequence of arbitrary $y_n\in int~K_{n+1}\backslash K_{n}$ will work.
I also have a reference request about existence of an infinite discrete subset in any infinite Hausdorff space. This follows from the result in this article, but I was not able to find a more direct reference. I found some research on this topic, but not this explicit statement.

A: The answer to this question is negative and can be obtained with the help of weak P-points in compact spaces with countable cellularity. A non-isolated point $p$ of a topological space $X$ is a weak $P$-point if $p$ is not an accumulation point of a countable set $C\subset X\setminus\{p\}$.
If $p$ is a weak P-point in a compact space $X$ with countable cellularity, then $X\setminus\{p\}$ is a locally compact space such that any strongly discrete subset is countable and hence has compact closure in $X\setminus\{p\}$.
It seems that examples of countably cellular spaces with weak P-points can be found using this result of Dow.


text:
Q: Can't Create a New Folder in Home I'm trying to install a theme and another forum said to create a folder in my home directory and put the theme in there, then use Unity Tweak Tool to activate it. So, I created a folder in my home directory, called it .theme. However, when I returned to my home directory, my .theme directory was gone. So I thought: I'll just make a new folder. But when I tried to create a new folder called .theme, I get an error saying that the name is already in use and I cannot use .theme. But there is no folder in my home directory titled .theme.
I'm using Ubuntu Desktop 16.04.

A: The .theme directory is hidden by default because of the . at the front of its name. Press Ctrl+H to see all hidden directories (and files).
If you want to permanently see all hidden directories and files, open a Nautilus window and go to "Edit" -> "Preferences" and check the "Show hidden and backup files" box. Note that backup files are files that end with ~.

A: Folders that start with a dot are hidden by default. You'll need to enable "Show Hidden Files and Folders" in the view options menu of your file manager, or by pressing CTRL-H.


text:
Q: How to retrieve list hyperlink field values? I know how to retrieve items like Title etc. I can query the columns and fetch data. But it doesnt show the hyperlinks.
Appreciate if someone can help me out!
getListItem.get_item('Link').get_url();

A: Using JavaScript Object Model, if you need to retrieve value and link of a column of type Hyperlink then following methods are used.

*

*get_description(): It will fetch the description of the link you have given

*get_url(): It will fetch the URL.

Note: The method which you have used is correct, in case you do not get values in it, then you must check the list items.

Refer below example:
var context = SP.ClientContext.get_current();
var myListItem = context.get_web().get_lists().getByTitle("ListName").getItemById(1);
context.load(myListItem);

context.executeQueryAsync(function(){

    alert(myListItem.get_item("HyperLinkFieldName").get_description());
    alert(myListItem.get_item("HyperLinkFieldName").get_url());

},function(sender,args){alert(args.get_message());});

A: string strurl = ((Microsoft.SharePoint.Client.FieldUrlValue)(item["destinationURL"])).Url;

Using CSOM, Convert the item to a FieldURLValue and then get the URL from that object

A: SharePoint List's Hyperlink Column have two values

*

*Url: To get value of this url use - ListItem.get_item('HyperlinkColumnName').get_url()

*Description: To get value of this use -  ListItem.get_item('HyperlinkColumnName').get_description()


text:
Q: How to properly use variable in ggplot? I have found an issue, that I was unable to understand. Can someone please point to an explanation?
In ggplot, if I use/don't use  "$" with variable name , it gives different result. Please see the example below,
library(ggplot2)
df <- read.csv("pseudo_facebook.tsv", sep = '\t')

# Without $ sign
ggplot(data = df, aes(x = friend_count)) + geom_histogram(binwidth = 25) +
  scale_x_continuous(limits = c(1, 1000), breaks = seq(0, 1000, 25)) +
  facet_grid(~df$gender)

# With $ sign
ggplot(data = df, aes(x = df$friend_count)) + geom_histogram(binwidth = 25) +
  scale_x_continuous(limits = c(1, 1000), breaks = seq(0, 1000, 25)) +
  facet_grid(~df$gender)

A: I'm not sure if this is what's causing your behaviour, but in the first example, you still have df$ in the facet_grid formula. It's possible there's some sneaky evaluation problem going on if you're mixing bare column names on their own with column names specified with the data frame.
If you switch out that filename in read.csv with a URL, you'll have a reprex that I can test


text:
Q: pyqt treeview index error removing last row I have a 2 column treeView with a simple heirarchy depth of 2; root > parent > child.  I have a removeRows call in my treeView subclass that gets evaluated when the delete key is pressed.  This seems to work fine when I delete any row but the last one.
I receive an IndexError: list index out of range, that seems to be coming from the node class child method.  This seems to occur when the self.beginRemoveRows method is called in the model's removeRows.  Strangely, the order of operations appears to be reversed, or threading is somehow causing a refresh to occur before the model knows about it's recent update.
With these code snippets I was hoping someone could provide a possible explanation or some ideas of what to try next to debug this.
from the QTreeView subclass,
def keyPressEvent(self, event):
    if event.key() == Qt.Key_Delete:
        index = self.currentIndex()
        self.model().removeRow(index.row())
    else:
        # call base class keyPressEvent
        QTreeView.keyPressEvent(self, event)

from the QAbstractItemModel subclass,
def index(self, row, column, parent=QModelIndex()):
    parent_node = self.getNode(parent)
    child_item = parent_node.child(row)
    if child_item:
        return self.createIndex(row, column, child_item)
    else:
        return QModelIndex()

def getNode(self, index):
    if index.isValid():
        node = index.internalPointer()
        if node:
            return node
    return self._root

def removeRows(self, position, rows, parent=QModelIndex()):

    parent_node = self.getNode(parent)
    self.beginRemoveRows(parent, position, position + rows - 1)
    parent_node.removeChild(position)
    self.endRemoveRows()
    return True

from the node class,
def child(self, row):
    return self._children[row]

def removeChild(self, position):

    if position < 0 or position >= len(self._children):
        return False

    child = self._children.pop(position)
    child._parent = None

    return True

A: It took me some time, but I finally found the cause of the bug: according to this mail in the index method you should check if the index exists before proceeding. Annoyingly it's not written in the method description, nor in qt4 or qt5 documentation.
The correct implementation of the index method should be something on the line:
def index(self, row, column, parent=QModelIndex()):
    if self.hasIndex(row, column, parentIndex):
        parent_node = self.getNode(parent)
        child_item = parent_node.child(row)
        if child_item:
            return self.createIndex(row, column, child_item)
    else:
        return QModelIndex()

In my application this solved the issue.

A: This alteration to the QTreeView seemed to do the trick.  Though, I'm not absolutely positive that the problem wasn't caused by something else.
def keyPressEvent(self, event):
    if event.key() == Qt.Key_Delete:
        index = self.currentIndex()
        if not index.isValid(): return

        parent = index.parent()

        # adjust selection so refresh does not trigger IndexError
        self.selectionModel().setCurrentIndex(self.indexAbove(index), QItemSelectionModel.ClearAndSelect)

        # remove selected
        self.model().removeRow(row, parent=parent)

        return

    # call base class keyPressEvent
    QTreeView.keyPressEvent(self, event)


text:
Q: Hidden scrollbars do not allow page scrolling. (CSS) After using the code:
body{
    overflow:hidden;
}

The scrollbar disappears from the right-hand side of the page but as a consequence, I can no longer scroll up or down the page unless I click the scroll wheel on the mouse and drag in the direction I wish to scroll. Any ideas on how to combat this?

A: the purpose of overflow: hidden; is not to hide the scroll bars - that is a consequence of what is really happening, that is - all the content that exceeds the "visible" area is clipped (hidden).
You are basically looking for something (hiding scrollbars) that is not the purpose of overflow: hidden;


text:
Q: OMP Optimizing nested loop with if statement I have the following few lines of code that I am trying to run in parallel
void optimized(int data_len, unsigned int * input_array, unsigned int * output_array, unsigned int * filter_list, int filter_len) {

    #pragma omp parallel for
    for (int j = 0; j < filter_len; j++) {
        for (int i = 0; i < data_len; i++) {
            if (input_array[i] == filter_list[j]) {
              output_array[i] = filter_list[j];
            }
        }
    }
}

Just putting the pragma statement has really done wonders, but I am trying to further reduce the run time of this code. I have tried many things ranging from array padding to collapsing the loops to creating tasks, but the only thing that has seemed to work thus far is loop unrolling. Does anyone have any suggestions on what I could possibly due to further speed up this code?

A: You are doing pure memory accessing. That is limited by the memory bandwidth of the machine.
Multi-threading is not going to help you much. gcc -O2 already provide you SSE instruction optimization. So it may not help either to use intel instruction directly. You may try to check 4 int at once because SSE support 128 register (please see https://gcc.gnu.org/onlinedocs/gcc-4.4.5/gcc/X86-Built_002din-Functions.html and google for some example) Also to reduce the amount of data helps, by using short instead of int if you can.


text:
Q: Get html forms and fields of string in Delphi I have a system that gets a html via GET every 1 second to update the system data in this html can have 1-20 forms, need to take all forms and assemble a querystring fields of each form, I have a function that does this, the problem is that it is taking longer than obtaining server html, what's wrong with the code? or how to do it differently?
procedure XThread.GetForms;
var
  sTemp, xResF : String;
  FormItem, v: Variant;
  Field: Variant;
  J, q, i, contCampos,
  tmForm : Integer;
  IDocForm : IHTMLDocument2;
begin
 IDocForm := CreateComObject(Class_HTMLDOcument) as IHTMLDocument2;
 v := VarArrayCreate([0, 0], VarVariant);
 v[0] := strFormMAT; //string html
 IDocForm.Write(PSafeArray(System.TVarData(v).VArray));
 IDocForm.Close;

 tmForm := (IDocForm.all.tags('FORM') as IHTMLElementCollection).Length;
 SetLength(matFormsArray, 0); //matFormsArray = Global Array of Array
 SetLength(matFormsArray, tmForm);
 for q := 0 to tmForm -1 do
   begin
    SetLength(matFormsArray[q], 2);

    FormItem := (IDocForm.all.tags('FORM') as IHTMLElementCollection).item(q, 0);
    xResF := '';
    sTemp := FormItem.Name;
    contCampos := FormItem.Length;
     for j := 0 to contCampos - 1 do
      begin
        Field := FormItem.Item(j);
        xResF := xResF + Field.Name + '=' + Field.Value;
        if j < FormItem.Length - 1 then
          xResF := xResF + '&';
      end;

      matFormsArray[q, 0] := sTemp;
      matFormsArray[q, 1] := xResF;
   end;
end;

strFormMAT =
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>

 <form name="fprin" id="fprin">
   <input type="hidden" name="field11" value="value11"></input>
   <input type="hidden" name="field12" value="value12"></input>
   <input type="hidden" name="field13" value="value13"></input>
 </form>

   Title
   Title
   Title
   Title

   Value
   Value
   Value
   <form name="xxx1" id="xxx1">
   Value
   Value
   <input type="hidden" name="field11" value="value11"></input>
   <input type="hidden" name="field12" value="value12"></input>
   <input type="hidden" name="field13" value="value13"></input>
   <input type="hidden" name="field14" value="value14"></input>
   </form>

   Value
   Value
   Value
   <form name="xxx2" id="xxx2">
   Value
   Value
   <input type="hidden" name="field21" value="value21"></input>
   <input type="hidden" name="field22" value="value22"></input>
   <input type="hidden" name="field23" value="value23"></input>
   <input type="hidden" name="field24" value="value24"></input>
   </form>

   Value
   Value
   Value
   <form name="xxx3" id="xxx3">
   Value
   Value
   <input type="hidden" name="field31" value="value31"></input>
   <input type="hidden" name="field32" value="value32"></input>
   <input type="hidden" name="field33" value="value33"></input>
   <input type="hidden" name="field34" value="value34"></input>
   </form>

   Value
   Value
   Value
   <form name="xxx4" id="xxx4">
   Value
   Value
   <input type="hidden" name="field41" value="value41"></input>
   <input type="hidden" name="field42" value="value42"></input>
   <input type="hidden" name="field43" value="value43"></input>
   <input type="hidden" name="field44" value="value44"></input>
   </form>

   Value
   Value
   Value
   <form name="xxx5" id="xxx5">
   Value
   Value
   <input type="hidden" name="field51" value="value51"></input>
   <input type="hidden" name="field52" value="value52"></input>
   <input type="hidden" name="field53" value="value53"></input>
   <input type="hidden" name="field54" value="value54"></input>
   </form>

   Value
   Value
   Value
   <form name="xxx6" id="xxx6">
   Value
   Value
   <input type="hidden" name="field61" value="value61"></input>
   <input type="hidden" name="field62" value="value62"></input>
   <input type="hidden" name="field63" value="value63"></input>
   <input type="hidden" name="field64" value="value64"></input>
   </form>

I do the procedure call within a Thread using Synchronize(GetForms); and even then crashes and slow.
my problem is not getting the html, it's already up and running, the problem is to extract the forms of html, this procedure is slow

A: It's not entirely clear by your question what you're trying to do, but it looks like you should look into a different technique to use than a HTMLDocument with this custom HTML code loaded to do the work.
If what needs to be done is call a certain URL with the query string built up of fields and values, you should look into TIdHTTP or any of the other components to perform a HTTP call directly (or indirectly).


text:
Q: Vanishing pushforward implies smooth function is locally constant? I'm trying to prove that if the pushforward $dF$ of a smooth map $F\colon M\to N$ between smooth manifolds is zero, then $F$ is constant on each component.
It will be enough to show $F$ is locally constant, since locally constant functions on constant on connected domains. If $p\in M$, let $(U,\varphi)$ and $(V,\psi)$ be charts witnessing smoothness of $F$ at $p$, with local coordinates $(x^i)$ and $(y^j)$. If $\hat{F}$ is the coordinate representation, then we have
$$
0=dF_p\left(\frac{\partial}{\partial x^i}|_p\right)=\sum_j\frac{\partial{\hat{F}^j}}{\partial x^i}(\hat{p})\frac{\partial}{\partial y^j}|_{F(p)}
$$
But the $\partial/\partial y^j|_{F(p)}$ form a basis for $T_{F(p)}N$, so it follows that $\partial\hat{F}^j/\partial x^i(\hat{p})=0$ for all $i$ and $j$. So $\hat{F}$ has vanishing Jacobian at $\hat{p}$, which is the coordinate representative of $p$. Does this imply that $\hat{F}$ is locally constant at $\hat{p}$ for some reason? I presume this is a known fact but I have a gap in my analysis.
I feel like that's the point here, but I'm not sure because for instance paraboloids have vanishing partials are their vertex, but aren't locally constant there.

A: You're right and it's just a consequence of the mean value theorem. If a function $f : I \to \mathbb{R}$ has vanishing derivative for some open interval $I \subset \mathbb{R}$, then for any $x_0, y \in I$, there is a $\xi \in I$ such that $f(y) = f(x_0) + f'(\xi)(y-x_0) = f(x_0)$ so we see that $f$ is constant on $I$. In your situation $\frac{\partial \hat{F}^j}{\partial x^i} \equiv 0$ on $\varphi(U)$ for all $i$ and $j$ so using the above argument in every directions and for all components of $\hat{F}$ you indeed get that $\hat{F} \equiv \hat{F}(\hat{p})$ for any $\hat{p} \in \varphi(U)$.
Note that in your example of a graph paraboloid, the differential of the function is zero only at 1 point, not in a neighborhood of that point.


text:
Q: I want to fetch the date timestamp in Toad using SQL Query I have a column in toad
CREATE_DATE='10/9/2020 2:05:10 AM'
I am trying to fetch this using the below SQL Query but it is giving me an error ''Not a valid Month'.
SELECT * FROM TABLE
WHERE
CREATE_DATE = '10/9/2020 2:05:10 AM'

can someone please help, how can i fetch this column
'

A: That looks like a DATE datatype column. If that's so, here's an example:
SQL> create table test (create_date date);

Table created.

SQL> insert into test values (sysdate);

1 row created.

Just to see what's in there:
SQL> alter session set nls_date_format = 'dd.mm.yyyy hh24:mi:ss';

Session altered.

SQL> select * From test;

CREATE_DATE
-------------------
09.10.2020 09:15:12

OK; now, use a query which utilizes the TO_DATE function (as we'd want to provide a string to it) with appropriate format mask (so that Oracle knows what is what in that string; whether 09 represents a month, or a day).
For example:
SQL> select * from test
  2  where create_date = to_date('09.10.2020 09:15:12', 'dd.mm.yyyy hh24:mi:ss');

CREATE_DATE
-------------------
09.10.2020 09:15:12

Or, another date format (the one you use):
SQL> select * from test
  2  where create_date = to_date('10/9/2020 9:15:12 am', 'mm/dd/yyyy hh:mi:ss am');

CREATE_DATE
-------------------
09.10.2020 09:15:12

Basically, the keyword is to let the database know what you exactly want, not let it guess. Sometimes it'll succeed, but sometimes it'll fail - just like in your query.


text:
Q: How Node.js implements require() in its own internals? While going through the source of require() in the GitHub repository for Node.js, I am surprised and confused by one thing:
The file loader.js that actually defines the require() logic, uses require() calls in itself.
How is this possible?
Is there some other code for the require() calls used in the internals of Node.js, for e.g. all the require() calls used in loader.js file.
I know that all require() calls in a Node.js program that I write in a given editor, on my machine, are resolved using the Module.prototype.require method declared in loader.js.

A: It seems like the actual base require is defined here, in /internal/bootstrap/loaders.js. This line makes use of [compileFunction][3] in /lib/vm.js. That again uses _compileFunction which is defined as such:
const {
  ContextifyScript,
  MicrotaskQueue,
  makeContext,
  isContext: _isContext,
  constants,
  compileFunction: _compileFunction,
  measureMemory: _measureMemory,
} = internalBinding('contextify');

Which, if we go back to /internal/bootstrap/loaders.js, is defined as such:
let internalBinding;
{
  const bindingObj = ObjectCreate(null);
  // eslint-disable-next-line no-global-assign
  internalBinding = function internalBinding(module) {
    let mod = bindingObj[module];
    if (typeof mod !== 'object') {
      mod = bindingObj[module] = getInternalBinding(module);
      ArrayPrototypePush(moduleLoadList, `Internal Binding ${module}`);
    }
    return mod;
  };
}

And getInternalBinding we find at the top of that file, in this comment:
// This file is compiled as if it's wrapped in a function with arguments
// passed by node::RunBootstrapping()
/* global process, getLinkedBinding, getInternalBinding, primordials */

Which brings an end to our tour here. So yes, there's still some code between the require() defined in loader.js and the actual C binding. As for what happens in C-land, I'm not sure myself.


text:
Q: Mongo aggregate query to get common result I have MongoDB collection with the following documents:
db.inventory.insertMany([
   { "_id" : 1,"uid":"b123","name" : "test","lang" : "ja-jp"},
   { "_id" : 2,"uid":"b123","name" : "test","lang" : "en-us"},
   { "_id" : 3,"uid":"b123","name" : "demo","lang" : "ja-jp"},
   { "_id" : 4,"uid":"b123","name" : "demo","lang" : "en-us"},
   { "_id" : 5,"uid":"b456","name" : "test","lang" : "en-us"},
   { "_id" : 6,"uid":"b456","name" : "demo","lang" : "en-us"}
])

And want the following response
[{uid:"b123"}]

How I can get there result using Mongo aggregate query or is there any other option?

A: I'm not sure I understood the question but here are several things you may do to have the uid field returned:

*

*Using find and project:

db.inventory.find({
  uid: 'b123'
}).project({
  uid: $uid
});

This will result in a list of {uid: 'b123'}.
If you want only unique result you may use aggregate with $group as follow:
db.inventory.aggregate([
  {
    $match: {
      uid: 'b123'
    }
  },
  {
    $group: {
      _id: {
        uid: '$uid'
      }
    }
  },
  {
    $group: {
      _id: 1,
      result: {
        $addToSet: '$_id'
      }
    }
  }
]);

Note that the second $group purpose is to collect them all under one array.
The response will be something like that:
{
  _id: 1,
  result: [
    {uid: 'b123'}
  ]
}

Hope that's answers your question


text:
Q: zend_form ViewScript decorator / passing arguments I have a form that is extend from Zend_Form. I am placing the form into a ViewScript decorator like this:
$this->setDecorators(array(array('ViewScript', array('viewScript' => 'game/forms/game-management.phtml'))));

I'd like to pass in a variable to this ViewScript but am not sure how this could be done.
Since the partial renders out as a Zend_View (allowing $this->app_store_icon for rendering), it seems like there should be a way to pass variables to be rendered. I tried the following but to no avail.
$this->setDecorators(array(array('ViewScript', array('viewScript' => 'game/forms/game-management.phtml'),array('app_store_picon'=>$current_app_store_picon))));

Any help on how to get this done would be appreciated.
thanks

A: There is another couple of possible ways to achieve adding an icon inside a form, which I think you should consider,
One would be to add your own element type, and add a custom decorator for the icon (I do this to add simple ? icons for help next, or file browsers to form elements). This is a fairly simple affair to do.
The other would be to simply add a HtmlTag decorator to your element, to which you can specify the attributes such as src as options.
These two solutions actually come with another hidden benefit on top of making things simpler to manage, they also remove the usage of the partial view helper, which is used once for every viewscript decorator in use.
The partial view helper can immensely add to the memory and time overhead of your form (which is already fairly large by the way), this is exacerbated when you use the viewscript decorator on elements instead of on the whole form!

A: I needed to pass an html code indicating a score status to the viewscript.phtml file. I found a simpler way than passing it along with the decorator, which is by passing the value from controller's action as if you are passing it to the normal zend view script. e.g:
<Controller>
// pass status and score to view
$this->view->status = $this->_sitenamehelper->get_status($id);
$this->view->score = $this->_sitenamehelper->get_score($id);

<viewscript.phtml partial file>
<?php $form = $this->element; ?>
<b>Status: </b><?php echo $form->getView()->status; ?>
<b>Score: </b><?php echo $form->getView()->score; ?>

And there you can pass any html rendered code .. I guess it would work for icons ..
Mohannad

A: This one's a bit tricky, took me bout a half an hour to figure it out, but it can be done :)
The point is, that you're passing the options to the ViewScript decorator and not to the element. Adding the option:
$this->setDecorators(array(array('ViewScript', array(
    'viewScript' => 'test.phtml',
    'foo'=>'baz',
))));

or an array of options:
$this->setDecorators(array(array('ViewScript', array(
    'viewScript' => 'test.phtml',
    array(
        'foo'=>'baz',
        'spam'=>'ham',
    ),
))));

Getting that out in the partial, test.phtml:
$option = $this->element->getDecorator('ViewScript')->getOptions();

In the first case, with one option passed it'll be $option['foo'] and in the second it'll be $option[0]['foo']
HTH :)


text:
Q: displaing javascript strings in two different lines I am trying to display an array value in frontend angular. how can i add space between string and display them in two different lines.
x: any = []
x[{info: "test" + ',' + "tested"}]

// instead of displaying
test , tested

// i want to display it in two different lines

test,
tested

please someone guide me on how can i achieve this. Thanks.

A: set css style
white-space: pre-line;

to the current element
and
x[{info: "test" + '\n' + "tested"}]

A: Just add a break line
x[{info: "test" + ',' + "<br>tested"}]


text:
Q: Twig iteration + bootstrap modal unknown behavior Im creating some Twitter bootstrap modals from a iteration of twig. I'm not doing nothing special here, just using the name of some fields as id, nothing else... but my modal show me something like this:

Here is the code:
{% for item in post.get_field('avances') %}

                                <button type="button" class="close" data-dismiss="modal" aria-label="Close">×</button>

{{item.mes|capitalize}}

                                <button type="button" class="btn btn-primary" data-dismiss="modal">Cerrar</button>

            {% endfor %}

                <hgroup>
Avances del Proyecto
</hgroup>

            {% for item in post.get_field('avances') %}

                    <hgroup>
{{item.mes|upper}}
</hgroup>

            {% endfor %}

The output in the browser is completly insane:

But the weirdest thing is that the static test (whitout itaration) works perfectly:

            {% for item in post.get_field('avances') %}

                                <button type="button" class="close" data-dismiss="modal" aria-label="Close">×</button>

Modal title

                                <button type="button" class="btn btn-primary" data-dismiss="modal">Cerrar</button>

            {% endfor %}

                <hgroup>
Avances del Proyecto
</hgroup>

            {% for item in post.get_field('avances') %}

                    <hgroup>
{{item.mes|upper}}
</hgroup>

            {% endfor %}

I tried some things and reviewd the code some times, but i can't get the problem... some idea?
Thanks in advance!


text:
Q: Flask unexpectedly redirects me to home, instead of / I have a Flask website (+SQL Alchemy), everything works as expected most of the times, but in 1 out of 10 times, the route /<username> redirects me to the homepage instead of checking if the username exists.
The route is implemented as follow:
@app.route("/<username>")
def profile_page(username):
    user_data = User.query.filter(User.username == username).first_or_404()
    content_data = content.query.filter(content.owner == user_data).all()
    return render_template('profile.html', user_data=user_data, content_data=content_data)

Most of the times it checks if the username exists and redirects me to the username page, or, if it doesn't exist, I get 404 - as expected.
However, 10% of the times, it doesn't even check for user_data (I tried with a print() and seems like it doesn't enter this route at all). In these cases it just redirects me to the homepage of my website.
Does anyone know why this could happen?
Thanks a lot

A: Based on your comments, I suspect the issue is that you might be hitting the end point /<username>/ instead of just </username> (the first one had a trailing slash, the second one doesn't.
If your Flask routes are defined without a trailing slash, then you must access it without a trailing slash. If on the other hand, you define your Flask route WITH a trailing slash, then it will redirect correctly when accessed without a trailing slash. See this summary of what I'm trying to describe
In simple terms, try this
@app.route("/<username>/")
def profile_page(username):


text:
Q: Calculate lead-time between selected rows (SQL) Given this table where we have users, the product that they used, and the first date that they used the product (I have also created a simple rank by user window). Note, each user will only have minimum 0 rows if they used nothing before, and 2 rows, if they used both products. There are only 3 products - cigars and beers.

How can I create a new view where each row is 1 user, the next column shows the first product, the next column shows the 2nd product, and the last column shows the lead-time b/w the first dates of use?

A: One method is conditional aggregation with row_number():
select user,
       max(case when seqnum = 1 then product end) as product_1,
       max(case when seqnum = 2 then product end) as product_2,
       (max(case when seqnum = 2 then time_used end) -
        max(case when seqnum = 1 then time_used end)
       ) as dif
from (select t.*,
             row_number() over (partition by user order by time_used) as seqnum
      from t
     ) t
group by user;

Date/time functions vary significantly across different databases.  Not all support a simple -, so you might nee to adjust for your database.

A: Minus between dates may not work on each database
select
    c1.user_id,
    c1.first_product_used,
    c2.second_product_used,
    COALESCE(CAST((Cast(c2.second_date AS DATE) - Cast(c1.first_date AS DATE)) AS VARCHAR(20)), 'n/a') AS "leadtime_days"
from
    (
    select
        user_id,
        product_used AS first_product_used,
        time_used AS first_date
    from
        check2
    where
        rank_of_use = 1
    )c1
LEFT OUTER JOIN
    (
    select
        user_id,
        product_used AS second_product_used,
        time_used AS second_date
    from
        check2
    where
        rank_of_use = 2
    )c2
ON
    c1.user_id = c2.user_id


text:
Q: What is the adverb form of event? What is the adverb form of event? As an example:

Aggregate these pictures by their semantics: aggregate semantically.
Aggregate these pictures by the events they may belong to: aggregate ________.

What word or phrase can fill in the blank?
EDIT: To provide some context: By event I mean by instance of birthday party/political rally/sports event/tech conference etc. in a large, unstructured collection of photos belonging to one of these.

A: I think you can use thematic :

*

*of, relating to, or consisting of a theme or themes.

*

*Aggregate the pictures thematically.
Dictionary.com

A: If an adverb is to fit the blanks, I suggest situationally or contextually.

*

*"by way of situation"

*"in a contextual manner; with reference to context"

Aggregate them situationally/contextually

A: In your example, semantics and events they may belong to are characteristics of the pictures. Therefore an adverb that modifies the verb aggregate does not make sense. It reads ok for semantically but that's coincidental and as @FumbleFingers points out, it won't work for other words.
This might be clearer:

Aggregate these pictures by:

*

*Their semantics

*Events they are related to

or, shorter:

Aggregate these pictures by:

*

*Semantics

*Related events

but it's hard to tell without knowing more of the background to what you want to achieve.

A: Adverbs are over-hyped
It turns out that one can always create an adverbial prepositional phrase using the noun:

Aggregate these pictures by the events they may belong to: aggregate by event.

This way you do not need to create a free-standing adverb.  You don't even need an adjective (like event-based, event-driven, eventful) this way, and the simple noun is just fine.
From Wikipedia:

In linguistics, an adverbial phrase is a group of two or more words operating adverbially, meaning that their syntactic function is to modify a verb, an adjective, or an adverb. Adverbial phrases ("AdvP" in syntactic trees) are phrases that do the work of an adverb in a sentence.

When you need to describe how or when or where or why something takes place, all you need is a constituent that functions adverbially.  You don't need a literal adverb.
The only time you truly need a single word of some particular part of speech is occasionally when writing computer programs. In actual language used by actual humans in actual speech, we combine words into phrases to convey infinitely more than ever can be expressed in a single word alone.  And that's not hyperbole, either.

A: Aggregate timewise.
Definition: With respect to time (https://www.wordnik.com/words/timewise)
Edit: If there are multiple events at the same time, but in different locations,you could aggregate time and themewise, or time and locationwise.  (The squiggles under these tell me I'm not in the dictionary any more.)