text:
Q: DIsplay files downloaded from json on main screen? I'm parsing a json to display a list of files a user can tap to download. I want to display the files the users have chosen to download on my main screen. this is the code when they download a file.
public final class Main extends Activity {

// Log tag for this class
private static final String TAG = "Main";

// Callback code for request of storage permission
final private int PERMISSIONS_REQUEST_STORAGE = 735;

// JSON Node Names
private static final String TAG_TYPE = "plans";
private static final String TAG_NAME = "name";
private static final String TAG_FILENAME = "filename";
private static final String TAG_URL = "url";
private static final String TAG_SHOULD_NOT_CACHE = "shouldNotCache";

// Files to delete
private static final ArrayList<String> filesToGetDeleted = new ArrayList<>();

// Strings displayed to the user
private static String offline;
private static String noPDF;
private static String localLoc;
private static String jsonURL;

// PDF Download
private static DownloadManager downloadManager;
private static long downloadID;
private static File file;

@SuppressLint("StaticFieldLeak")
private static SwipeRefreshLayout swipeRefreshLayout;

private final BroadcastReceiver downloadReceiver = new BroadcastReceiver() {

    @Override
    public void onReceive(Context arg0, Intent arg1) {
        final DownloadManager.Query query = new DownloadManager.Query();
        query.setFilterById(downloadID);
        final Cursor cursor = downloadManager.query(query);

        if (cursor.moveToFirst()) {
            final int columnIndex = cursor
                    .getColumnIndex(DownloadManager.COLUMN_STATUS);
            final int status = cursor.getInt(columnIndex);

            switch (status) {
                case DownloadManager.STATUS_SUCCESSFUL:
                    final Uri path = Uri.fromFile(file);
                    final Intent pdfIntent = new Intent(Intent.ACTION_VIEW);
                    pdfIntent.setDataAndType(path, "application/pdf");
                    pdfIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);

                    try {
                        startActivity(pdfIntent);
                    } catch (ActivityNotFoundException e) {
                        Utils.makeLongToast(Main.this, noPDF);
                        Log.e(TAG, e.getMessage());
                    }
                    break;
                case DownloadManager.STATUS_FAILED:
                    Utils.makeLongToast(Main.this,
                            getString(R.string.down_error));
                    break;
                case DownloadManager.STATUS_PAUSED:
                    Utils.makeLongToast(Main.this,
                            getString(R.string.down_paused));
                    break;
                case DownloadManager.STATUS_PENDING:
                    Utils.makeLongToast(Main.this,
                            getString(R.string.down_pending));
                    break;
                case DownloadManager.STATUS_RUNNING:
                    Utils.makeLongToast(Main.this,
                            getString(R.string.down_running));
                    break;
            }
        }
    }
};
// Data from JSON file
private ArrayList<HashMap<String, String>> downloadList = new ArrayList<>();

private static void checkDir() {
    final File dir = new File(Environment.getExternalStorageDirectory() + "/"
            + localLoc + "/");
    if (!dir.exists()) dir.mkdir();
}

@Override
protected void onResume() {
    super.onResume();
    final IntentFilter intentFilter = new IntentFilter(
            DownloadManager.ACTION_DOWNLOAD_COMPLETE);
    registerReceiver(downloadReceiver, intentFilter);
}

@Override
protected void onPause() {
    super.onPause();
    unregisterReceiver(downloadReceiver);
}

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

    // Delete files which should not get cached.
    for (String file : filesToGetDeleted) {
        final File f = new File(file);
        if (f.exists()) {
            f.delete();
        }
    }
}

@Override
public void onRequestPermissionsResult(int requestCode, String permissions[], int[] grantResults) {
    switch (requestCode) {
        case PERMISSIONS_REQUEST_STORAGE:
            if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
                Utils.makeLongToast(Main.this, getString(R.string.permission_write_external_storage_success));
            }
            else {
                final String permission_write_external_storage_failure = getString(R.string.permission_write_external_storage_failure);
                final String app_title = getString(R.string.app_name);
                final String message = String.format(permission_write_external_storage_failure, app_title);
                Utils.makeLongToast(Main.this, message);

                boolean showRationale = ActivityCompat.shouldShowRequestPermissionRationale(Main.this, permissions[0]);
                if (!showRationale) {
                    Intent intent = new Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS);
                    Uri uri = Uri.fromParts("package", getPackageName(), null);
                    intent.setData(uri);
                    startActivity(intent);
                }
            }
            break;
    }
}

private void update(boolean force, boolean firstLoad) {
    downloadManager = (DownloadManager) getSystemService(DOWNLOAD_SERVICE);
    swipeRefreshLayout = (SwipeRefreshLayout) findViewById(R.id.swipeRefreshLayout_main);

    offline = getString(R.string.status_offline);
    noPDF = getString(R.string.except_nopdf);
    localLoc = getString(R.string.gen_loc);
    jsonURL = getString(R.string.gen_json);

    checkDir();

    if (firstLoad) {
        try {
            downloadList = (ArrayList<HashMap<String, String>>) Utils.readObject(this, "downloadList");
            if (downloadList != null) {
                setList(true, true);
            }
        } catch (ClassNotFoundException | IOException e) {
            Log.e(TAG, e.getMessage());
        }
    }

    // Parse the JSON file of the plans from the URL
    JSONParse j = new JSONParse();
    j.force = force;
    j.online = !Utils.isNoNetworkAvailable(this);
    j.execute();
}

private void setList(final boolean downloadable, final boolean itemsAvailable) {
    if (itemsAvailable) {
        try {
            Utils.writeObject(this, "downloadList", downloadList);
        } catch (IOException e) {
            Log.e(TAG, e.getMessage());
        }
    }
    final ListView list = (ListView) findViewById(R.id.listView_main);
    final ListAdapter adapter = new SimpleAdapter(this, downloadList,
            android.R.layout.simple_list_item_1, new String[]{TAG_NAME},
            new int[]{android.R.id.text1});
    list.setAdapter(adapter);

    // React when user click on item in the list
    if (itemsAvailable) {
        list.setOnItemClickListener(new AdapterView.OnItemClickListener() {

            @Override
            public void onItemClick(AdapterView<?> parent, View v, int pos,
                                    long id) {
                int hasStoragePermission = ContextCompat.checkSelfPermission(Main.this,
                        Manifest.permission.WRITE_EXTERNAL_STORAGE);
                if (hasStoragePermission != PackageManager.PERMISSION_GRANTED) {
                    ActivityCompat.requestPermissions(Main.this,
                            new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE},
                            PERMISSIONS_REQUEST_STORAGE);
                    return;
                }
                final Uri downloadUri = Uri.parse(downloadList.get(pos).get(TAG_URL));
                final String title = downloadList.get(pos).get(TAG_NAME);
                final String shouldNotCache = downloadList.get(pos).get(TAG_SHOULD_NOT_CACHE);
                file = new File(Environment.getExternalStorageDirectory() + "/"
                        + localLoc + "/"
                        + downloadList.get(pos).get(TAG_FILENAME) + ".pdf");
                final Uri dst = Uri.fromFile(file);

                if (file.exists()) {
                    final Intent pdfIntent = new Intent(Intent.ACTION_VIEW);
                    pdfIntent.setDataAndType(dst, "application/pdf");
                    pdfIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);

                    try {
                        startActivity(pdfIntent);
                    } catch (ActivityNotFoundException e) {
                        Utils.makeLongToast(Main.this, noPDF);
                        Log.e(TAG, e.getMessage());
                    }
                    return;
                }
                if (downloadable && !Utils.isNoNetworkAvailable(Main.this)) {
                    // Download PDF
                    final Request request = new Request(downloadUri);
                    request.setTitle(title).setDestinationUri(dst);
                    downloadID = downloadManager.enqueue(request);
                    if (shouldNotCache.equals("true")) {
                        filesToGetDeleted.add(file.toString());
                    }
                } else {
                    Utils.makeLongToast(Main.this, offline);
                }
            }
        });
    }

    swipeRefreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
        @Override
        public void onRefresh() {
            update(true, false);
        }
    });
}

private class JSONParse extends AsyncTask<String, String, JSONObject> {

    public boolean force = false;
    public boolean online = false;

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

        swipeRefreshLayout.post(new Runnable() {
            @Override
            public void run() {
                swipeRefreshLayout.setRefreshing(true);
            }
        });
    }

    @Override
    protected JSONObject doInBackground(String... args) {
        return JSONParser.getJSONFromUrl(Main.this, jsonURL, force, online);
    }

    @Override
    protected void onPostExecute(JSONObject json) {

        swipeRefreshLayout.post(new Runnable() {
            @Override
            public void run() {
                swipeRefreshLayout.setRefreshing(false);
            }
        });

        downloadList.clear();
        if (json == null) {
            String error = getString(R.string.except_json);
            if (!online) {
                error = offline;
            }
            final HashMap<String, String> map = new HashMap<>();
            map.put(TAG_NAME, error);
            downloadList.add(map);

            setList(false, false);
            return;
        }

        try {

            // Get JSON Array from URL
            final JSONArray j_plans = json.getJSONArray(TAG_TYPE);

            for (int i = 0; i < j_plans.length(); i++) {
                final JSONObject c = j_plans.getJSONObject(i);

                // Storing JSON item in a Variable
                final String ver = c.getString(TAG_FILENAME);
                final String name = c.getString(TAG_NAME);
                final String api = c.getString(TAG_URL);
                String shouldNotCache = "";
                if (c.has(TAG_SHOULD_NOT_CACHE)) {
                    shouldNotCache = c.getString(TAG_SHOULD_NOT_CACHE);
                }

                // Adding value HashMap key => value
                final HashMap<String, String> map = new HashMap<>();
                map.put(TAG_FILENAME, ver);
                map.put(TAG_NAME, name);
                map.put(TAG_URL, api);
                map.put(TAG_SHOULD_NOT_CACHE, shouldNotCache);
                downloadList.add(map);

                setList(online, true);
            }
        } catch (JSONException e) {
            Log.e(TAG, e.getMessage());
        }
    }
}

SO how do I get the result of the above code and display it on main screen every time the user opens app


text:
Q: HTML/CSS Not moving to the left

* {
  margin: 0;
  padding: 0;
}

/* Formats the Navigation bar */

nav {
  width: 100%;
  height: 60px;
  background-color: #2a2a2a;
}

/* Formats the page title */

nav p {
  font-family: arial;
  color: #fff;
  font-size: 24px;
  line-height: 55px;
  float: left;
}

/* formats the navlinks to the left */

nav ul {
  float: left;
}

/* formats the navlinks to left */

nav ul li {
  float: left;
  list-style: none;
  position: relative;
}

/* formats the text in the list for nav bar */

nav ul li a {
  display: block;
  font-family: arial;
  color: #fff;
  font-size: 14px;
  padding: 22px 14px;
  text-decoration: none;
}

/* styles the drop down */

nav ul li ul {
  display: none;
  position: absolute;
  background-color: #2a2a2a;
  padding: 3px;
  border-radius: 0px 0px 3px 3px;
}

/* Displays when hovered */

nav ul li:hover ul {
  display: block;
}

nav ul li ul li {
  width: 180px;
  border-radius: 4px;
}

nav ul li ul li a {
  padding: 8px 14px;
}

nav ul li ul li a:hover {
  background-color: grey;
}

Home

Teams

First

Second

Third

Fourth

About me

Contact

Hi guys i cant seem to understand whats going on. I've tried everything i can but i can get the text to align to the left like in default html. I have a home page that looks like this:
<?php include ("navBar.php") ?>
home

Thats it and for some reason "home" ends up half way across the page, i have included the defaults margin and padding to the top of the stylesheet but its not working. Any help will be great thanks.

A: I see there is nav ul li a class, and it has a display value block. Try doing it to inline-block instead and see if it works.

redpajama_set_name: RedPajamaStackExchange


text:
Q: Magento - Displaying additional information on Customer Control Panel A client asked me to integrate Magento's Customer Control Panel with some additional information, to be retrieved from an external Web Service. At the moment, I have some small, standalone code that can query such Web Service and retrieve the necessary data. What I need to do is integrating such code within Magento and display the data on the Control Panel.
The quickest (and dirtiest) way, from what I've seen, would be to "brutally" hard code the call into the dashboard.phtml file. The data is not too complex, therefore this could be an option to get a proof of concept working quickly.
However, I'd like to reuse this feature on several websites, and it also requires some configuration which would be painful to maintain as hardcoded variables. Besides, the above is a hack, more than a solution.
It's clear, then, that I need to develop a proper module.
The question
I know how to create a basic module, with its configuration page and a simple controller. What I'd like to understand is, once I implement a method to fetch the external data, is the following:

*

*Where should I put the method, and how should I call it?

*How should I pass the data to the dashboard.phtml for rendering?

I could probably find "a way" to do the above, but I'm quite sure I'd end up with a hack more than a solution, therefore any help in learning the Magento ways is welcome. Thanks.

A: you can :

*

*create a new module

*add a observer for your dashboard before_html or after_html event (one is called before template is rendered and other when template is already rendered)

*add your method to your observer that outputs the content you receive from webservice to the block output (before or after the content) automatically

you can :

*

*create a new module

*create a block that has your methods for webservice

*add a layout handler to layout file with your block reference

*edit the template and call your block from there and get the data for this

*optionally you can make your own template as well and call the block output in your template

you can:

*

*create a new module

*add a template and implement all things in template

*use layout files to replace the template used originally


text:
Q: Nessus No host data is available for this scan error I encountered an error in Nessus result. Error: No host data is available for this scan.
I want to scan ip 192.16x.x.x at Nessus.I scan this ip with nmap.Only 2 tcp port is open in this ip address.And results says host is up.I check my firewall rules.Nothing wrong with that Also I check Nessus logs but I don't see meaningful eror in Nessus's logs
How can I solve this problem ?

A: It sounds like Nessus is performing host discovery in a different way than your Nmap scan e.g. by using ICMP ping. Have you looked at the Nessus discovery preferences? Under "Preferences" -> "Ping the remote host", uncheck ICMP ping (for example), and enable TCP ping and ARP ping. You may need to play around with this host discovery settings in order to find the correct configuration for you. Note that modifying these settings could increase your scanning times considerably.


text:
Q: Creating and making the following tables look professional? How can I create Table 1 and Table 2(see picture below) but with the following modifications:

*

*Without the parameter description column in Table 1.

*I don't want the darkened headings in Tables 1 and 2 and the "Figure 1-4" in Table 1.

Only the first column should be under parameters. The four remaining columns should be under numerical values.

EDIT: From Zarko's answer, I tried for the first table but has some errors. I have also added in a third table with 20 rows that needs addressing since it is very long.
\documentclass{article}

\usepackage{tabularray}
\UseTblrLibrary{booktabs, siunitx}

\begin{document}
    \begin{center}
        \begin{tblr}{colspec = {*{1}{Q[l, mode=math] } *{4}{Q[c, si={table-format=1.2}]}},
                     row{1}   = {guard},
                     row{2-Z} = {rowsep=0.5pt},
                                     row{Z}   = {guard}
                    }
        \toprule
        &   \SetCell[c=1]{c}    Parameters
                &       &   \SetCell[c=2]{c}    Numerical values
                                &       \\
         \cmidrule[r]{1} \cmidrule[l]{2-5}
    a   & 0.00    &0.00   & 0.04  & 0.00  \\
    b   & 0.00    & 0.00   & 2.48  & 0.00     \\
    c  & 0.00    & 0.00   & 0.08  & 0.00     \\
    d   & 0.00    & 0.00   & 0.12  & 0.00     \\
    e   & 0.00    & 0.00   & 0.16  & 0.00     \\
    f   & 0.00    & 0.00   & 0.20  & 0.00     \\
    g   & 0.1    &0.2   & 0.24  & 0.00     \\
    h   &0.7    & 0.4   & 0.24  & 0.00     \\
    i   &0.00    & 0.00   & 0.24  & 0.6     \\
    j   &0.00    & 0.00   & 0.2  & 0.8     \\
    k   &0.4   & 0.00   & 0.24  & 0.00     \\
    l   &0.00    & 0.00   & 0.2  & 0.00     \\
    m  &0.00    & 0.00   & 0.24  & 0.00     \\
    n   &0.00    & 0.00   & 0.24  & 0.00     \\
    o   &0.00    & 0.00   & 0.24  & 0.00     \\
         \midrule[0.8pt]
        &       &       & Figure \textcolor{red}{1}
                                & Figure \textcolor{red}{2} \\
        \cmidrule[0.8pt]{2-5}
        \end{tblr}
    \end{center}

\begin{center}
    \begin{tblr}{colspec = {Q[l, mode=math] Q[c, si={table-format=-1.4}]},
                 row{1}  = {guard, mode=text},
                 row{odd[3-X]}={belowsep=2ex},
                }
    \toprule
Expression  &   Value   \\
     \toprule
a   & 0.00       \\
b  & 0.00      \\
c   & 0.00      \\
d   & 0.00       \\
e  & 0.00      \\
f  & 0.00      \\
g & 0.00      \\
    \bottomrule
    \end{tblr}
\end{center}
\begin{center}
    \begin{tblr}{colspec = {*{1}{Q[l, mode=math] } *{4}{Q[c, si={table-format=1.2}]}},
                 row{1}   = {guard},
                 row{2-Z} = {rowsep=0.5pt},
                                 row{Z}   = {guard}
                }
    \toprule
    &   \SetCell[c=1]{c}    Parameters
            &       &   \SetCell[c=2]{c}    Numerical values
                            &       \\
     \cmidrule[r]{1} \cmidrule[l]{2-5}
a   & 0.00    &0.00   & 0.04  & 0.00  \\
b   & 0.00    & 0.00   & 2.48  & 0.00     \\
c   & 0.2   & 0.3   & 0.8  & 0.2     \\
d   & 0.00    & 0.00  & 0.08  & 0.00     \\
e   & 0.00    & 0.00   & 0.08  & 0.00     \\
f   & 0.00    & 0.00   & 0.12  & 0.00    \\
g   & 0.00    & 0.00   & 0.16  & 0.00     \\
h   & 0.00    &0.00   & 0.24  & 0.00     \\
i   &0.00    & 0.00   & 0.24  & 0.00     \\
j   &0.00    & 0.00   & 0.24  & 0.00    \\
k   &0.00    & 0.00   & 0.24  & 0.00     \\
l   & 0.00    & 0.00   & 0.20  & 0.00     \\
m   &0.00    & 0.00   & 0.24  & 0.00\\
n  &0.00    & 0.00   & 0.24  & 0.00     \\
o   &0.00    & 0.00   & 0.24  & 0.00     \\
p   &0.00    & 0.00   & 0.24  & 0.00     \\
q   &0.00   & 0.00   & 0.24  & 0.00     \\
r   &0.00    & 0.00   & 0.24  & 0.00     \\
s  &0.00    & 0.00   & 0.24  & 0.00    \\
t   &0.00   & 0.00   & 0.24  & 0.00     \\
     \midrule[0.8pt]
    &       &       & Figure \textcolor{red}{1}
                            & Figure \textcolor{red}{2} \\
    \cmidrule[0.8pt]{2-5}
    \end{tblr}
\end{center}

    \end{document}

Can it be made to look professional? It will be used for publication.
Table 1 should look like this:

A: *

*Content of your table code fragment is not even close to shoed table, so the table below has only (last) two columns with numbers.

*For table is used tblr of tabularray package

*Last two columns are of S type, which enable to align numbers at decimal points (such numbers are in showed tables)

Edit (1):
Now, after editing of question, is more clear (to me), what you after. I must confess, that table code in original question, confuse me what is in table. Something like shows the first image, or what was written in the code of the table.
Hopefully now, the edited code gives what you after.
Edit (2):
It seems that we (OP and me) need more iteration for finalized this table. Still is not clear, how parameter looks like. I assumed that they should be in cells horizontally centered as is shown in the first image in question. Now is replaced original code with corrected one too ...
\documentclass{article}

\usepackage{tabularray}
\UseTblrLibrary{booktabs, siunitx}

\begin{document}
\begin{center}
    \begin{tblr}{colspec = {Q[c, mode=math]*{4}{Q[c, si={table-format=1.2}]}},
                 row{1}  = {guard, mode=text},
                 row{2-Z} = {rowsep=0pt},
                 row{odd[3-X]}={belowsep=0.5ex},
                 row{Z}  = {guard}
                }
    \toprule
Parameters
    &   \SetCell[c=4]{c}    Numerical values
            &       &       &       \\
     \cmidrule[r]{1-1} \cmidrule[l]{2-5}
A       & 0.00  & 0.00  & 0.04  & 0.00  \\
\mu_1   & 0.00  & 0.00  & 2.48  & 0.00  \\
\beta   & 0.00  & 0.00  & 0.08  & 0.00  \\
\gamma  & 0.00  & 0.00  & 0.12  & 0.00  \\
\mu_2   & 0.00  & 0.00  & 0.16  & 0.00  \\
f       & 0.00  & 0.00  & 0.20  & 0.00  \\
g       & 0.1   & 0.2   & 0.24  & 0.00  \\
h       & 0.7   & 0.4   & 0.24  & 0.00  \\
i       & 0.00  & 0.00  & 0.24  & 0.6   \\
j       & 0.00  & 0.00  & 0.2   & 0.8   \\
k       & 0.4   & 0.00  & 0.24  & 0.00  \\
l       & 0.00  & 0.00  & 0.2   & 0.00  \\
m       & 0.00  & 0.00  & 0.24  & 0.00  \\
n       & 0.00  & 0.00  & 0.24  & 0.00  \\
o       & 0.00  & 0.00  & 0.24  & 0.00  \\
    \midrule[0.8pt]
    & Figure \textcolor{red}{1}
            & Figure \textcolor{red}{2}
                    & Figure \textcolor{red}{3}
                            & Figure \textcolor{red}{4} \\
    \cmidrule[0.8pt]{2-5}
    \end{tblr}
\end{center}
\end{document}

Edit (3):
I my gosh! You are not after professional looking table but for ordinary table with poor typography.
Well, I will make this changes, but this is my last edit/correction of my answer. I'm not willing to be your assistant for typing of tables. I'm to old for this, sorry.
\documentclass{article}

\usepackage{tabularray}
\UseTblrLibrary{booktabs, siunitx}

\begin{document}
\begin{center}
    \begin{tblr}{hlines, vlines,
                 colspec = {Q[c, mode=math]*{4}{Q[c, si={table-format=1.2}]}},
                 row{1}  = {guard, mode=text},
                 row{Z}  = {guard}
                }
Parameters
    &   \SetCell[c=4]{c}    Numerical values
            &       &       &       \\
A       & 0.00  & 0.00  & 0.04  & 0.00  \\
\mu_1   & 0.00  & 0.00  & 2.48  & 0.00  \\
\beta   & 0.00  & 0.00  & 0.08  & 0.00  \\
\gamma  & 0.00  & 0.00  & 0.12  & 0.00  \\
\mu_2   & 0.00  & 0.00  & 0.16  & 0.00  \\
f       & 0.00  & 0.00  & 0.20  & 0.00  \\
g       & 0.1   & 0.2   & 0.24  & 0.00  \\
h       & 0.7   & 0.4   & 0.24  & 0.00  \\
i       & 0.00  & 0.00  & 0.24  & 0.6   \\
j       & 0.00  & 0.00  & 0.2   & 0.8   \\
k       & 0.4   & 0.00  & 0.24  & 0.00  \\
l       & 0.00  & 0.00  & 0.2   & 0.00  \\
m       & 0.00  & 0.00  & 0.24  & 0.00  \\
n       & 0.00  & 0.00  & 0.24  & 0.00  \\
o       & 0.00  & 0.00  & 0.24  & 0.00  \\
    & Figure \textcolor{red}{1}
            & Figure \textcolor{red}{2}
                    & Figure \textcolor{red}{3}
                            & Figure \textcolor{red}{4} \\
    \end{tblr}
\end{center}
\end{document}

or with the following table's preamble
    \begin{tblr}{hline{1-Y} = solid,        hline{Z}   = {2-Z}{solid},
                 vline{1}   = {1-Y}{solid}, vline{2-Z} = {1-Z}{solid},
                 colspec = {Q[c, mode=math]*{4}{Q[c, si={table-format=1.2}]}},
                 row{1}  = {guard, mode=text},
                 row{Z}  = {guard}
                }

For the second table:
\documentclass{article}

\usepackage{tabularray}
\UseTblrLibrary{booktabs, siunitx}

\begin{document}
\begin{center}
    \begin{tblr}{ colspec = {Q[l, mode=math] Q[c, si={table-format=-1.4}]},
                  row{1}  = {guard, mode=text},
                 row{2-Z} = {rowsep=0pt},
                  row{2}  = {abovesep=2pt},
                 row{odd[3-Z]} = {belowsep=0.5ex},
                }
    \toprule
Expression  &   Value   \\
     \toprule
a^2 + b^2   & -1.2345       \\
a^2 + b^2   & -1.2345       \\
a^2 + b^2   & -1.2345       \\
a^2 + b^2   & -1.2345       \\
a^2 + b^2   & -1.2345       \\
    \bottomrule
    \end{tblr}
\end{center}
\end{document}

Note:
I liberate your table contents from jail of vertical and horizontal rules, use rules defined in tabularray package (it is load as Tblr library) and insert (for better readably) some vertical space between each two rows. By this, according to my opinion, tables have more "professional" looks.
However, if you for some reason more prefer to have all cells surrounded by lines, let me know, that I will write new tables preambles, which will enable this. Short example for second table is:
\documentclass{article}

\usepackage{tabularray}
\UseTblrLibrary{siunitx}

\begin{document}
\begin{center}
    \begin{tblr}{hline{1,2,Z} = 0.6pt, hline{2-Z} = solid, vlines,
                colspec = {Q[l, mode=math] Q[c, si={table-format=-1.4}]},
                row{1}  = {guard, mode=text},
                }
Expression  &   Value   \\
a^2 + b^2   & -1.2345       \\
a^2 + b^2   & -1.2345       \\
a^2 + b^2   & -1.2345       \\
a^2 + b^2   & -1.2345       \\
a^2 + b^2   & -1.2345       \\
a^2 + b^2   & -1.2345       \\
a^2 + b^2   & -1.2345       \\
    \end{tblr}
\end{center}
\end{document}

A: \documentclass{article}

\usepackage[table,dvipsnames]{xcolor}

\begin{document}
 \begin{center}
  \begin{tabular}{|c|c|c|c|c|}
   \hline
   \rowcolor{lightgray}
   Parameters & \multicolumn{4}{c|}{Numerical Values} \\
   \hline
   x & x & x & x & x \\
   \hline
   x & x & x & x & x \\
   \hline
   x & x & x & x & x \\
   \hline
   x & x & x & x & x \\
   \hline
   x & x & x & x & x \\
   \hline
   x & x & x & x & x \\
   \hline
   x & x & x & x & x \\
   \hline
   x & x & x & x & x \\
   \hline
   x & x & x & x & x \\
   \hline
   x & x & x & x & x \\
   \hline
   x & x & x & x & x \\
   \hline
   x & x & x & x & x \\
   \hline
   x & x & x & x & x \\
   \hline
   \multicolumn{1}{c|}{} & Fig 1 & Fig 2 & Fig 3 & Fig 4 \\
   \cline{2-5}
  \end{tabular}
 \end{center}
\end{document}

A: Here's another solution based on tabularray.
AFAIK double vertical lines don't work well with background colours because they introduce gaps which are not a part of cells hence do not gain colours. The workaround would be to create additional columns of very small width, which might be a bit cumbersome.
The two tables share the same theme. I am not sure if this is the case, though.

\documentclass{article}
\usepackage{xcolor}
\usepackage{tabularray}
\UseTblrLibrary{booktabs}

\SetTblrInner{
  rows = {rowsep=2pt},
  row{1} = {bg=gray!35},
  cell{1}{1} = {bg=gray!20},
  hline{2}   = {1}{-}{wd=\heavyrulewidth},
  hline{2}   = {2}{-}{wd=\heavyrulewidth},
}

\begin{document}
\begin{table}[tbh]
  \centering
  \begin{tblr}{
      colspec = {*5{Q[c,mode=math]}},
      row{1,Z} = {mode=text},
      % Horizontal line specification
      hline{1,Y} = {wd=\heavyrulewidth},
      hline{3-X} = {wd=\cmidrulewidth},
      hline{Z}   = {2-Z}{wd=\heavyrulewidth},
      % Vertical line specification
      vline{1}   = {1-Y}{wd=\heavyrulewidth,abovepos=1,belowpos=1},
      vline{2}   = {wd=\heavyrulewidth},
      vline{3-Y} = {2-Z}{wd=\cmidrulewidth},
      vline{Z}   = {wd=\heavyrulewidth,abovepos=1,belowpos=1},
    }
    Parameters & \SetCell[c=4]{c} Numerical values & & & \\
    A          & 0.1      & 0.1      & 0.1      & 0.1 \\
    B          & 0.1      & 0.1      & 0.1      & 0.1 \\
    \mu_{1}    & 0.1      & 0.1      & 0.1      & 0.1 \\
    \alpha_{1} & 0.1      & 0.1      & 0.1      & 0.1 \\
    \beta      & 0.1      & 0.1      & 0.1      & 0.1 \\
               & Figure 1 & Figure 2 & Figure 3 & Figure 4
  \end{tblr}
\end{table}

\begin{table}[tbh]
  \centering
  \begin{tblr}{
      colspec = {*2{Q[c,mode=math]}},
      row{1} = {mode=text},
      % Horizontal line specification
      hline{1,Z} = {wd=\heavyrulewidth},
      hline{3-Y} = {wd=\cmidrulewidth},
      % Vertical line specification
      vline{1,Z} = {wd=\heavyrulewidth,abovepos=1,belowpos=1},
      vline{2}   = {wd=\heavyrulewidth},
    }
    Expression    & Value \\
    f(x) = x^2    & 0.111 \\
    a = b         & 0.222 \\
    c = d^3       & 0.444 \\
    e = x^2 + y^2 & 0.555 \\
  \end{tblr}
\end{table}
\end{document}


text:
Q: Unable to Read Outlook Mails by applying filter on sender using python Below is the code I used
import win32com.client
import os
outlook=win32com.client.Dispatch("Outlook.Application").GetNameSpace("MAPI")
inbox=outlook.GetDefaultFolder(6) #Inbox default index value is 6
message=inbox.Items
get_path = os.getcwd()
message2=message.GetLast()
subject=message2.Subject
body=message2.body
date=message2.senton.date()
sender=message2.Sender
attachments=message2.Attachments
for m in message:
    if m.sender=='ritwikvijayan@gmail.com':# here in my requirement i will change the dates
        print(m.SentOn.strftime("%d-%m-%y %H:%M:%S"))
        for x in m.Attachments:
            x.SaveASFile(os.path.join(get_path,x.FileName))
            print ("successfully downloaded attachments")

I am getting this error: AttributeError: .sender

A: MailItem.Sender returns an AddressEntry object, not a string. You can use its Name and Address properties.
Also keep in mind Items.GetLast does not return the last item you are seeing in Outlook. Unless the Items collection is explicitly sorted, what you get back is undetermined. Most likely you will get the older created object in that folder.


text:
Q: what is the proper tcp/ip socket shutdown sequence on android? i have some code that does send a message using tcp/ip.
the client sequence is: connect, write, flush, shutdown output, shutdown input, close socket.
the server sequence is accept, readline, shutdown input, shutdown output, close socket.
this works fine on windows using the same wifi betwork as the android. on a 2013 nexus 7 android 6.0.1, the socket.shutdownInput() sometimes throws an ENOTCONN (please see below). the program still works, but i would like to understand what is happening and get rid of the exception if possible.
thanks
edit: closing the output stream (and not doing a shutdown output) works better.
01-29 23:24:29.394 7164-9300/com.tayek.tablet.gui.android.cb7 W/System.err: java.net.SocketException: shutdown failed: ENOTCONN (Transport endpoint is not connected)
01-29 23:24:29.394 7164-9300/com.tayek.tablet.gui.android.cb7 W/System.err:     at java.net.PlainSocketImpl.shutdownInput(PlainSocketImpl.java:361)
01-29 23:24:29.394 7164-9300/com.tayek.tablet.gui.android.cb7 W/System.err:     at java.net.Socket.shutdownInput(Socket.java:635)
01-29 23:24:29.394 7164-9300/com.tayek.tablet.gui.android.cb7 W/System.err:     at com.tayek.tablet.io.Client.send(Client.java:49)
01-29 23:24:29.394 7164-9300/com.tayek.tablet.gui.android.cb7 W/System.err:     at com.tayek.tablet.Tablet.send(Tablet.java:66)
01-29 23:24:29.395 7164-9300/com.tayek.tablet.gui.android.cb7 W/System.err:     at com.tayek.tablet.Tablet.access$200(Tablet.java:11)
01-29 23:24:29.395 7164-9300/com.tayek.tablet.gui.android.cb7 W/System.err:     at com.tayek.tablet.Tablet$SendCallable.call(Tablet.java:82)
01-29 23:24:29.395 7164-9300/com.tayek.tablet.gui.android.cb7 W/System.err:     at com.tayek.tablet.Tablet$SendCallable.call(Tablet.java:72)
01-29 23:24:29.395 7164-9300/com.tayek.tablet.gui.android.cb7 W/System.err:     at java.util.concurrent.FutureTask.run(FutureTask.java:237)
01-29 23:24:29.395 7164-9300/com.tayek.tablet.gui.android.cb7 W/System.err:     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
01-29 23:24:29.395 7164-9300/com.tayek.tablet.gui.android.cb7 W/System.err:     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
01-29 23:24:29.395 7164-9300/com.tayek.tablet.gui.android.cb7 W/System.err:     at java.lang.Thread.run(Thread.java:818)
01-29 23:24:29.397 7164-9300/com.tayek.tablet.gui.android.cb7 W/System.err: Caused by: android.system.ErrnoException: shutdown failed: ENOTCONN (Transport endpoint is not connected)
01-29 23:24:29.397 7164-9300/com.tayek.tablet.gui.android.cb7 W/System.err:     at libcore.io.Posix.shutdown(Native Method)
01-29 23:24:29.397 7164-9300/com.tayek.tablet.gui.android.cb7 W/System.err:     at libcore.io.ForwardingOs.shutdown(ForwardingOs.java:159)
01-29 23:24:29.397 7164-9300/com.tayek.tablet.gui.android.cb7 W/System.err:     at java.net.PlainSocketImpl.shutdownInput(PlainSocketImpl.java:359)
01-29 23:24:29.397 7164-9300/com.tayek.tablet.gui.android.cb7 W/System.err:     ... 10 more

A:
connect, write, flush,

Flush before close is redundant.

shutdown output, shutdown input, close socket

Both shutdowns are redundant before close.
All you need is connect, write, close.


text:
Q: unix script to collect the thread dump logs of a process I am trying to generate an issue regarding HashMap.put function.I have written a test code which will run more than 100 threads.. by using jstack or kill I'am able to get the thread dump of a particular thread of my process..The problem is I can not capture the thread dump immediately, I want all the thread dumps to be logged in a file until the process ends.Is there any linux command or shell script that can write to do this?

A: #!/bin/bash

if [ $# -eq 0 ]; then
    echo >&2 "Usage: jstackSeries  [ <count> [ <delay> ] ]"
    echo >&2 "    Defaults: count = 10, delay = 1 (seconds)"
    exit 1
fi

pid=$1          # required
count=${2:-10}  # defaults to 10 times
delay=${3:-1} # defaults to 1 second

while [ $count -gt 0 ]
do
    jstack $pid >jstack.$pid.$(date +%H%M%S.%N)
    sleep $delay
    let count--
    echo -n "."
done

refer here:
http://howtodoinjava.com/2012/12/19/how-to-get-thread-dump-in-linux-using-jstack/


text:
Q: How to access backpack fields on custom (non-CRUD) page? I've made a custom page in backpack admin panel. This page is non-CRUD (not related to any model). There are several forms on it, with date pickers, select inputs, etc. So I'am trying to find a way to use backpack fields to create these date pickers and select inputs. Because it seems to be awkward to embed custom js-controls into the project, as Backpack already has appropriate fields.
The only solution I came up with, is to create a crud controller for random model, disable all operations except create, use create operation view as custom page (backpack fields are available this way), and finally override store() method - to prevent creating new model entry in DB.
So, is there a proper way to access backpack fields on custom (non-CRUD) page?

A: Backpack 4.x fields aren't meant to be used outside CRUDs, but you can do that.
Option A
At their core, Backpack fields are just Blade views, so you can load them using the Blade helper @include(). Just make sure to pass along all variables that the blade file needs. I believe in 99% of the fields that will be a $field and a $crud variable, so this will work:
    @php
        // set the CRUD model to something (anything)
        // but ideally it'd be the model of the entity that has the form
        $crud = app()->make('crud');
        $crud->setModel(\App\Models\Monster::class);
    @endphp

    @include('crud::fields.number', [
        'crud' => $crud,
        'field' => [
            'name' => 'price',
            'label' => 'Price',
            'prefix' => '$'
        ]
    ])

This way, you only load the bits you actually want (the inputs), without the overhead of a CrudController. You can point the form to your custom controller and do the saving yourself. What you need to pass for a $field above is a Backpack field definition in array form.
This way is super-simple, but it has a big downside if you ask me. The field definition has to be 100% correct and complete, you lose all the magic and assumption logic that Backpack usually does to make your life easier when you add field using addField(). That's why in most cases I think it's more convenient to go with Option B.
Option B
Instead of manually loading all each field Blade view, add them using addField(), then load all of them just like Backpack does it in the Create or Update operation:
    @php
        $crud = app()->make('crud');
        $crud->setModel(\App\Models\Monster::class);
        $crud->addField([
            'name' => 'price',
            'label' => 'Price',
            'prefix' => '$'
        ]);
    @endphp

    <form method="post">
        @include('crud::form_content', [ 'fields' => $crud->fields(), 'action' => 'create' ])
    </form>

The above will produce an output like this:

The benefit of this second option is that you can "forget" to mention stuff in the field definition and Backpack will assume it, you can use the fluent syntax, you can use most Backpack features, really...


text:
Q: Add vanilla-tilt.js to Angular 6 component (external JS library in Angular component) I would like to use a third party js library called vanilla-tilt.js in one of my Angular components. Here is the link to the library:
https://micku7zu.github.io/vanilla-tilt.js/
What I've done so far is: Installed with npm and linked it into my angular.json file like so:
"scripts": [
    "node_modules/vanilla-tilt/dist/vanilla-tilt.js"
]

Then in my component.ts I did the following (I'm only supplying the necessary code and '.about-pic' is the <img> I am selecting in my HTML file):
import { VanillaTilt } from 'vanilla-tilt/dist/vanilla-tilt.js';

export class AboutComponent implements OnInit, AfterViewInit {
  ngAfterViewInit() {
    VanillaTilt.init(document.querySelector('.about-pic'), {
      max: 25,
      speed: 400
    });
  }
}

I got the code in ngAfterViewInit() from the website I linked above, under "JS Way"
I thought I imported this external library correctly, but I am getting the following error in the console:
ERROR TypeError: Cannot read property 'init' of undefined
I guess am not quite understanding the concept of installing third-party JS libraries in Angular components. What can I try next?

A: As per https://micku7zu.github.io/vanilla-tilt.js/ JS way, i tried the same in ngOnInit. It worked for me.

*

*npm install vanilla-tilt

*declare var VanillaTilt in ts file

*ngOnInit() {
VanillaTilt.init(document.querySelector(".tilt-image"), {
  max: 25,
  speed: 400
});
VanillaTilt.init(document.querySelectorAll(".tilt-image"));
}

*In html
div class="tilt tilt-image" data-tilt data-tilt-glare="true" data-tilt-scale="1.1"
img src="assets/images/sample.png"
/div

Note : "tilt-image" is your element

A: I've just released https://www.npmjs.com/package/@geometricpanda/angular-tilt
This supports all functionality of the original jQuery package - and i'm going to be updating it with the newer features from vanilla tilt.
The main difference here is that @geometricpanda/angular-tilt doesnt use DOM api's directly, but leverages angular's Renderer2, @HostBindings, and @HostListeners - meaning that it's safe for Angular Universal rendering (or prerendering), and doesnt cause issues in DOM simulated environments such as JSDOM (Jest)

A: Worked on Angular 14:
install package:
npm install vanilla-tilt

then import ElementRef (to get the DOM element) and VanillaTilt (to add effects) packages in your component:
import {Component, ElementRef} from '@angular/core';
import VanillaTilt from "vanilla-tilt";

add ElementRef in the constructor:
constructor(private el: ElementRef) {
}

in the ngOnInit method, tell angular where to put effects (need to precise the css class name:
ngOnInit() {
// add vanilla-tilt effect on .<class-name> cards
VanillaTilt.init(
  this.el.nativeElement.querySelectorAll(".class-name"), { max: 20, speed: 300, scale: 1.05 }
);}

All elements with the given class name will have the wanted effects ^_^
To modify the effects, you can change parameters in the second argument of .init() method. Available parameters here: https://www.npmjs.com/package/vanilla-tilt#options
Have fun with it!


text:
Q: Counting the number columns that contain a value I have a table, with a changing number of columns, filled with strings which looks like the following:
#   A   B   C   D   E   F   G
1  abc xyz abc abc abc xyz xyz
2  xyz xyz abc xyz abc xyz xyz
3  abc abc xyz abc abc xyz xyz
4  abc xyz abc xyz abc xyz xyz

I want to know how many of these columns contain the value abc. I am not interested in the number of abc cells, just the number of abc columns.
I'm looking to have an output in another sheet which looks like the following:
item to check | # Cols Containing Value
     abc                   5
     xyz                   6

I know I can do this in GAS by using a simple for loop which is variable based on max rows and columns, but I am looking for a solution by using native Google Sheets functions.
Is this possible?

A: Solution:

*

*Convert presence/absence of "abc"s to 1/0

*Transpose the resulting matrix and use matrix multiplication to sum  accross columns

*Count the number of cells of the resulting array, which are above 0

Sample Formula:
=ARRAYFORMULA(COUNTIF(MMULT(TRANSPOSE(IF(A1:G4="abc",1,0)),ROW(A1:A4)^0),">0"))


text:
Q: Casting a member access func from Func to Func I'm trying to creating a dynamic base mapping with fluent nhibernate.
What I'm doing is checking in by a BaseMap< T > : ClassMap< T > if for example:
                (typeof(ICategorizedEntity).IsAssignableFrom(typeof(T)))
If so, I wanna map a property named "Category" which belongs to ICategorizedEntity's interface, but the Map(Func) function only accepts T's properties, so I tried guessing a little with linq and came up with this:
   Expression<Func<ICategorizedEntity, object>> exp = x => x.Category;
   var parameter = Expression.Parameter(typeof (T));
   var lmd = Expression.Lambda<Func<T, object>>(exp, parameter);
   Map(lmd);

Which doesn't work, because deep inside the 'Map' function it checks the following:
   MemberExpression memberExpression = (MemberExpression) null;
   if (expression.NodeType == ExpressionType.Convert)
       memberExpression = ((UnaryExpression) expression).Operand as MemberExpression;
   else if (expression.NodeType == ExpressionType.MemberAccess)
       memberExpression = expression as MemberExpression;
   if (enforceCheck && memberExpression == null)
       throw new ArgumentException("Not a member access", "expression");

And I get the "Not a member access\r\nParameter name: expression".
How can I create and cast a MemberExpression or anything similar which will work?

A: Func<DerivedFromT,object> represents a method that accepts a DerivedFromT parameter. Func<T,object> represents a method that accepts a T parameter. Through delegate variance introduced in C# 4, you can cast Func<T,object> to Func<DerivedFromT,object>, but not the other way round (as you're requesting).
Think about what this means:
public class Person { }

public class Student : Person { }

public static class School
{
    public static object Greet(Person person)
    {
        return null;
    }

    public static object Promote(Student student)
    {
        return null;
    }
}

In this case, the Greet method matches the delegate Func<Person,object>, whilst the Promote method matches the delegate Func<Student,object>.
Func<Person, object> greetPerson = School.Greet;
Func<Student, object> promoteStudent = School.Promote;

We can cast Greet to Func<Student,object>; if we can greet a Person, then we can also greet a Student (who is guaranteed to be a specialized form of Person).
Func<Student, object> greetStudent = greetPerson;

However, we cannot cast Promote to Func<Person,object>; although we can promote a Student, we cannot promote any Person in general, unless he/she happens to be a Student.
Func<Person, object> promotePerson = promoteStudent;   // Will not compile.

If we know that our Person is a student, we can indicate this by casting it:
Func<Person, object> promotePerson =
    personWhoIsActuallyStudent => promoteStudent((Student)personWhoIsActuallyStudent);

A: Thanks Douglas, you lead me to the right (simple) answer.
I went too far trying to find it..
Good old conversion (inside the lambda expression) did the trick:
   Map(x => ((ICategorizedEntity)x).Category);


text:
Q: Web API Multiple Actions were found that match this request, if called without parameter I've got a problem using ASP.NET WebAPI Controller. What i try to build is a controller which contains two actions that can be called by a http-get. What i have so far:
[HttpGet]
public IList<Model> Get()
{
    ...
}
[HttpGet]
public IList<Model> GetAllWorkshops()
{
    ...
}

I also edited my RouteConfig.cs to the following:
routes.MapHttpRoute(
  name: "API Default With ID",
  routeTemplate: "api/{controller}/{action}/{id}",
  defaults: new { id = RouteParameter.Optional }
);

routes.MapHttpRoute(
  name: "API Default",
  routeTemplate: "api/{controller}/{action}"
);

routes.MapRoute(
  name: "Default",
  url: "{controller}/{action}/{id}",
  defaults: new { controller = "Home", action = "Index", id =UrlParameter.Optional }
);

The strange behaviour is that if i call : http://localhost:1536/Api/Workshop/Get or localhost:1536/Api/Workshop/GetAllWorkshops, i get the exception that multiple actions were found that match this request. But if i call localhost:1536/Api/Workshop/Get/1 or localhost:1536/Api/Workshop/GetAllWorkshops/1 it was works perfectly. So i think that the route with the id works. But why do the other two requests throw these exceptions?
I tried almost every imaginable route. It would be great if you find my mistakes!
Thank you very much!

A: Because route named "API Default With ID" has id as optional, so /api/workshop/get matched both the first and second route, hence the error.
To fix this error, you can remove second route because it is just a subset of the first route template.
However, it is better to use new Attribute Routing introduced in Web API 2, it is by far more maintainable and easy to understand than using old-style mapping.
If you use attribute mapping, your class will look like:
[RoutePrefix("api/workshop")]
public class WorkshopController : ApiController {
    [HttpGet]
    [Route("Get")]
    public IList<Model> Get()
    {
        ...
    }
    [HttpGet]
    [Route("GetAllWorkshops")]
    public IList<Model> GetAllWorkshops()
    {
        ...
    }
}

Very clear and concise.


text:
Q: track created and modified fields automatically in asp.net mvc and mongodb How can I track created and modified date automatically in C# with MongoDB.
I have  database:
public class BaseEntity
{
    public DateTime? DateCreated { get; set; }
    public string UserCreated { get; set; }
    public DateTime? DateModified { get; set; }
    public string UserModified { get; set; }
}

   public  class Income : BaseEntity
{
    public Guid Id { get; set; }

    [DisplayName("Income")]
    public string Income_ { get; set; }
    public string Date { get; set; }
    public String Description { get; set; }
}

I want to track DateCreated and DateModified automatically.


text:
Q: URL instead of Paypal Form ( Installment Plan) I have a Paypal produced code for installment plan and i want to turn it to a signle url for direct linking.
Here's the code :
<form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_top">

<input type="hidden" name="cmd" value="_s-xclick">

<input type="hidden" name="hosted_button_id" value="SOME VALUE HERE">

<input type="hidden" name="return" value="http://www.mysite.com/thanks.html"/>

<input type="hidden" name="on0" value="plan">

<input type="hidden" name="os0" value ="option_0">	Beginner -     £137.50 every month for 4 months

	Number of payments 4

	Start payments At     checkout

Due*	Amount

At checkout	£137.50 GBP

Every 1 month (x     3)	£137.50 GBP

Total     £550.00 GBP

* We calculate payments from the date of checkout.

Sign up for

<input type="image"     src="https://www.paypalobjects.com/en_US/GB/i/btn/btn_installment_plan_LG.gif" border="0"     name="submit" alt="PayPal – The safer, easier way to pay online.">

</form>

I have ready the Paypal developer documentation but couldn't find anyhting useful.
Can you please help me out with this ?
Please note that this is for installment plan (recurring payments)

A: You can simply append them as GET parameters after https://www.paypal.com/cgi-bin/webscr.
For example, https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=SOME-VALUE-HERE&return=moredatahere&etc=etc

A: SOLVED !!
After several days and multiple emails and calls to Paypal here is the story.
We have a Pricing Table on our WordPress site that only allows for an email link to be inserted. Since we have installment payment option button and did not want to use the tacky old Paypal button.
Problem: The issue is that PP was not getting all of the parameters because it set as a link rather than HTML. Please make sure you encode your parameters appropriately to avoid issues with the URL string losing parameters due to unencoded characters.
SOLUTION: Basically you need to add the variables as GET parameters to your URL string. So the link would look something like this
 https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id= insert button value here&on0=&os0=option_0&currency_code=USD
Place your assigned button value ID in the section"insert button value here".

*

*watch your spacing!!!!

I feel like I solved one the of greatest mysteries of man kind. Enjoy!


text:
Q: RequireJS: onload making multiple http requests My requireJS script is make around 500 http requests which hangs my program at the beginning. I am using gulp and gulp-requirejs (optimizer) but I'm not sure how to reduce the number of http requests most of them are coming from Esri (I am using ArcGIS JS 4.0 API). Does anybody have any idea on how I can limit this?
I have look at this question but I'm not sure how to actually achieve this in requirejs: https://gis.stackexchange.com/questions/33182/does-the-arcgis-javascript-api-let-me-build-package-my-application-using-dojo
Config code:
requirejs.config({
    paths: {
        "jquery": 'https://code.jquery.com/jquery-3.1.0.min',
        'moment/moment': 'https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.14.1/moment',
        "esri": 'http://js.arcgis.com/4.0/esri',
        "dojo": 'http://js.arcgis.com/4.0/dojo',
        "dojox": 'http://js.arcgis.com/4.0/dojox',
        "dijit": 'http://js.arcgis.com/4.0/dijit'
    },
    shim: {
        ...
        "map": {
            deps: [ 'jquery', 'esri', 'dojo']
        },

    }
});

Using ArcGIS JS 4.0 API in one of my modules:
define('map',["jquery","esri/Color",
    "esri/geometry/Point",
    "esri/geometry/Polygon",
    "esri/symbols/SimpleFillSymbol",..],function(...){

});

UPDATE:
So after building the arcgis js api (using grunt), I included the main.js (found dist folder) to my project. But the local copy of the API gives me the error:
XMLHttpRequest cannot load http://services.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer?f=json. Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:4000' is therefore not allowed access. The response had HTTP status code 501.
I am not making a request instead the arcgis js library is making this call. Am I forgetting a library that should have been included grunt config when building my arcgis js API?
the grunt file config for arcgis js API:
...
include: [
            'requirejs/require',
            'esri/layers/FeatureLayer',
            'esri/layers/TileLayer',
            'esri/layers/support/LabelClass',
            'esri/layers/graphics/controllers/SnapshotController',
            'esri/portal/support/layersCreator',
            'esri/views/3d/layers/TiledLayerView3D',
            'esri/views/layers/GraphicsLayerView',
            'esri/views/3d/webgl-engine/lib/FloatingBoxLocalOriginFactory',
            'esri/views/3d/webgl-engine/lib/Layer',
            'esri/views/3d/webgl-engine/lib/MaterialCollection',
            'esri/views/3d/webgl-engine/lib/Octree',
            'esri/views/3d/webgl-engine/lib/TextTextureAtlas',
            'esri/views/MapView',
            'esri/views/2d/layers/GraphicsLayerView2D'
          ],
          exclude: [
            'dojo/domReady',
            'dojo/has',
            'dgrid',
            'dojo/i18n', // some methods not available with RequireJS
          ],
...

A: The default file(init.js) in Esri API, contains the require implementation and also it has most of the basic modules caches. This is done to reduce the initial loading time. But, since you are not using the esri require (the init.js file to load), all the cached modules are not available. and hence, each modules are being downloaded through http requests.
You try to build a custom build of ESRI script using Bower. The details on how to do it available of their website.
I know its not exactly answering your question. but, hope it would help.


text:
Q: How to Unit Test Repository Method That Takes Lambda Expression as A Parameter I have a repository method as follows:
 public ICollection<TEntity> Find(Expression<Func<TEntity, bool>> where)
 {
        return Set.Where(where).ToList();
 }

Set is an EntityFramework DbSet<TEntity>
What is the best approach to unit test this method? I can mock the DbSet<TEntity> to return some dummy data easily, but I'm not entirely sure of what constitutes a valid or worthwhile test for this method.
For example, I can test the return type is correct and that an empty collection is returned for a predicate that is clearly never going to be satisfied, but what other tests should I be running?
Should I just write a test that passes an expression that is always true to test true conditions and another test that passes an expression that is always false to test false conditions?

A: When you mock the Set there´s nothing more in the method which effectivly can be tested. The method then consists only of a mock and nothing more. If Setis just a mock a call to Where will also return any dummy data according to how you set your mock. So you´re actually testing that your mock was mocked the way you want instead of your method to do the right things with the data retrieved from that mock. Since what you do with this data is trivial (just calling ToList on it) there´s no need to do any testing here.
However you should consider that the actual Expression was built correctly, but you won´t do this within the test for that method but within the test for the calling code.


text:
Q: aws-cli command in windows to get the latest object from s3 bucket I am using a command using aws cli in my windows machine to  get latest file from s3 bucket .
aws s3 ls s3://Bucket-name --recursive | sort |tail -n 1

It is listing all the files in sorted manner according to date upto here:
aws s3 ls s3://Bucket-name --recursive | sort

But writing the full command throws error:

'Tail is not recognized as an internal or external command'.

Is there some other alternative for tail or for the full command.

A: The AWS CLI permits JMESPath expressions in the --query parameter.
This command shows the most recently-updated object:
aws s3api list-objects --bucket my-bucket --query 'sort_by(Contents, &LastModified)[-1].Key' --output text

It's basically saying:

*

*Sort by LastModified

*Obtain the last [-1] entry

*Show the Key (filename)


text:
Q: PowerShell remove all comments from a script I'm looking for a way to strip all comments from a file. There are various ways to do comments, but I'm only interested in the simple # form comments. Reason is that I only use <# #> for in-function .SYNOPSIS which is functional code as opposed to just a comment so I want to keep those).
EDIT: I have updated this question using the helpful answers below.
So there are only a couple of scenarios that I need:
a) whole line comments with # at start of line (or possibly with white-space before. i.e. regex of ^\s*# seems to work.
b) with some code at start of line then a command at the end of the line.
I want to avoid stripping lines that have e.g. Write-Host "#####" but I think this is covered in the code that I have.
I was able to remove end-of-line comments with a split as I couldn't work out how to do it with regex, does anyone know a way to achieve that with regex?
The split was not ideal as a <# on a line would be removed by the -split but I've fixed that by splitting on " #". This is not perfect but might be good enough - maybe a more reliable way with regex might exist?
When I do the below against my 7,000 line long script, it works(!) and strips a huge amount of comments, BUT, the output file is almost doubled in size(!?) from 400kb to about 700kb. Does anyone understand why that happens and how to prevent that (is it something to do with BOM's or Unicode or things like that? Out-File seems to really balloon the file-size!)
$x = Get-Content ".\myscript.ps1"   # $x is an array, not a string
$out = ".\myscript.ps1"
$x = $x -split "[\r\n]+"               # Remove all consecutive line-breaks, in any format '-split "\r?\n|\r"' would just do line by line
$x = $x | ? { $_ -notmatch "^\s*$" }   # Remove empty lines
$x = $x | ? { $_ -notmatch "^\s*#" }   # Remove all lines starting with ; including with whitespace before
$x = $x | % { ($_ -split " #")[0] }    # Remove end of line comments
$x = ($x -replace $regex).Trim()       # Remove whitespace only at start and end of line
$x | Out-File $out
# $x | more

A: Honestly, the best approach to identify and process all comments is to use  PowerShell's language parser or one of the Ast classes. I apologize that I don't know which Ast contains comments; so this is an uglier way that will filter out block and line comments.
$code = Get-Content file.txt -Raw
$comments = [System.Management.Automation.PSParser]::Tokenize($code,[ref]$null) |
    Where Type -eq 'Comment' | Select -Expand Content
$regex = ( $comments |% { [regex]::Escape($_) } ) -join '|'

# Output to remove all empty lines
$code -replace $regex -split '\r?\n' -notmatch '^\s*$'

# Output that Removes only Beginning and Ending Blank Lines
($code -replace $regex).Trim()

A: Do the inverse of your example:  Only emit lines that do NOT match:
## Output to console
Get-Content .\file.ps1 | Where-Object { $_ -notmatch '#' }

## Output to file
Get-Content .\file.ps1 | Where-Object { $_ -notmatch '#' } | Out-file .\newfile.ps1 -Append

A: Based on @AdminOfThings helpful answer using the Abstract Syntax Tree (AST) Class parser approach but avoiding any regular expressions:
$Code = $Code.ToString() # Prepare any ScriptBlock for the substring method
$Tokens = [System.Management.Automation.PSParser]::Tokenize($Code, [ref]$null)
-Join $Tokens.Where{ $_.Type -ne 'Comment' }.ForEach{ $Code.Substring($_.Start, $_.Length) }

A: As for the incidental problem of the size of the output file being roughly double that of the input file:

*

*As AdminOfThings points out, Out-File in Windows PowerShell defaults to UTF-16LE ("Unicode") encoding, where characters are represented by (at least) two bytes, whereas ANSI encoding, as used by Set-Content in Windows PowerShell by default, encodes all (supported) characters in a single byte. Similarly, UTF-8-encoded files use only one byte for characters in the ASCII range (note that PowerShell (Core) 7+ now consistently defaults to (BOM-less) UTF-8). Use the -Encoding parameter as needed.

A regex-based solution to your problem is never fully robust, even if you try to limit the comment removal to single-line comments.
For full robustness, you must indeed use PowerShell's language parser, as noted in the other answers.
However, care must be taken when reconstructing the original source code with the comments removed:

*

*AdminOfThings's answer risks removing too much, given the subsequent global regex-based processing with -replace: while the scenario may be unlikely, if a comment is repeated inside a string, it would mistakenly be removed from there too.

*iRon's answer risks syntax errors by joining the tokens without spaces, so that . .\foo.ps1 would turn into ..\foo.ps1, for instance. Blindly putting a space between tokens is not an option, because the property-access syntax would break (e.g. $host.Name would turn into $host . Name, but whitespace between a value and the . operator isn't allowed)
The following solution avoids these problems, while trying to preserve the formatting of the original code as much as possible, but this has limitations, because intra-line whitespace isn't reported by the parser:

*

*This means that you can't tell whether whitespace between tokens on a given line is made up of tabs, spaces, or a mix of both. The solution below replaces any tab characters with 2 spaces before processing; adjust as needed.

*To somewhat compensate for the removal of comments occupying their own line(s), more than 2 consecutive blank or empty lines are folded into a single empty one. It is possible to remove blank/empty lines altogether, but that could hurt readability.
# Tokenize the file content.
# Note that tabs, if any, are replaced by 2 spaces first; adjust as needed.
$tokens = $null
$null = [System.Management.Automation.Language.Parser]::ParseInput(
  ((Get-Content -Raw .\myscript.ps1) -replace '\t', '  '),
  [ref] $tokens,
  [ref] $null
)

# Loop over all tokens while omitting comments, and rebuild the source code
# without them, trying to preserve the original formatting as much as possible.
$sb = [System.Text.StringBuilder]::new()
$prevExtent = $null; $numConsecNewlines = 0
$tokens.
  Where({ $_.Kind -ne 'Comment' }).
  ForEach({
    $startColumn = if ($_.Extent.StartLineNumber -eq $prevExtent.StartLineNumber) { $prevExtent.EndColumnNumber }
                   else { 1 }
    if ($_.Kind -eq 'NewLine') {
      # Fold multiple blank or empty lines into a single empty one.
      if (++$numConsecNewlines -ge 3) { return }
    } else {
      $numConsecNewlines = 0
      $null = $sb.Append(' ' * ($_.Extent.StartColumnNumber - $startColumn))
    }
    $null = $sb.Append($_.Text)
    $prevExtent = $_.Extent
  })

# Output the result.
# Pipe to Set-Content as needed.
$sb.ToString()


text:
Q: Python 2.7 Segfault on Debian 7 When I run a mod_wsgi app, I get a segfault by Python. I got the debug symbols for Python, but I have no idea how to get the Python sources for Debian 7. When I do apt-get source python I do not get the actual python interpreter source files.
To begin with, I was getting a crash within the mod_wsgi code. But after I ran an apt upgrade I starting getting a segfault with the json module. However both segfaults occurred on line 788 of obmalloc.c in PyObject_Malloc. Now if only I could find the proper source code I could figure out what's going on a bit better!
Here is the top few frames of the backtrace:
#0  PyObject_Malloc (nbytes=46) at ../Objects/obmalloc.c:788
#1  0x00007fffef3db145 in PyString_FromStringAndSize.part.17 (size=<optimized out>, str=0x0) at ../Objects/stringobject.c:88
#2  PyString_FromStringAndSize (str=str@entry=0x0, size=size@entry=9) at ../Objects/stringobject.c:57
#3  0x00007fffed57b644 in ascii_escape_str.2660 (pystr=pystr@entry='message') at /home/jmm/py/python2.7-2.7.3/Modules/_json.c:302
#4  0x00007fffed57d25e in py_encode_basestring_ascii (pystr='message', self=0x0) at /home/jmm/py/python2.7-2.7.3/Modules/_json.c:827
#5  encoder_encode_string.isra.4.part.5 (obj='message') at /home/jmm/py/python2.7-2.7.3/Modules/_json.c:1962
#6  encoder_encode_string.isra.4 (obj='message') at /home/jmm/py/python2.7-2.7.3/Modules/_json.c:1977
#7  encoder_listencode_dict (indent_level=<optimized out>, dct={'message': 'Invalid params', 'code': -32602}, rval=
    ['{', '"jsonrpc"', ': ', '"2.0"', ', ', '"id"', ': ', '1', ', ', '"error"', ': ', '{'], s=0x555555d88758) at /home/jmm/py/python2.7-2.7.3/Modules/_json.c:2170
#8  encoder_listencode_obj.part.10.2731 (s=s@entry=0x555555d88758, rval=rval@entry=['{', '"jsonrpc"', ': ', '"2.0"', ', ', '"id"', ': ', '1', ', ', '"error"', ': ', '{'], obj=obj@entry=
    {'message': 'Invalid params', 'code': -32602}, indent_level=indent_level@entry=0) at /home/jmm/py/python2.7-2.7.3/Modules/_json.c:2018

A: Try apt-get source python2.7 for getting the source or substitute the version you care about. The python package is a virtual package and thus contains no source.


text:
Q: Regular expression matching issue with the following scenario I am developing an application. User will enter some of the setting value in the server. When I ask for the value to the server through the inbuilt API. I am getting values like as a whole string:
for example-
name={abc};display={xyz};addressname={123}

Here the properties are name, display and address and there respective values are abc, xyz and 123.
I used to split with ; as first delimeter and = as a second dleimeter.
String[] propertyValues=iPropertiesStrings.split(";");
        for(int i=0;i<propertyValues.length;i++)
        {
            if(isNullEmpty(propertyValues[i]))
                continue;

            String[] propertyValue=propertyValues[i].split("=");
            if(propertyValue.length!=2)
                mPropertyValues.put(propertyValue[0], "");
            else
                mPropertyValues.put(propertyValue[0], propertyValue[1]);
        }
    }

here mPropertyValues is hash map which is used for keeping property name and its value.
Problem is there can be string :
case 1:  name={abc};display={ xyz=deno; demo2=pol };addressname={123}
case 2:  name=;display={ xyz=deno; demo2=pol };addressname={123}

I want hashmap to be filled with :
case 1:
name ="abc"
display = "xyz= demo; demo2 =pol"
addressname = "123"

for case 2:
name =""
display = "xyz= demo; demo2 =pol"
addressname = "123"

I am looking for a regular expression to split these strings;

A: The following regex should match your criteria, and uses named capturing groups to get the three values you need.
name=\{(?<name>[^}])\};display=\{(?<display>[^}]+)\};addressname=\{(?<address>[^}]\)}

A: Assuming your dataset can change, a better parser may be more dynamic, building a Map from whatever is found in that return type.
The regex for this is pretty simple, given the cases you list above (and no nesting of {}, as others have mentioned):
Matcher m = Pattern.compile("(\\w+)=(?:\\{(.*?)\\})?").matcher(source_string);
while (m.find()) {
    if (m.groupCount() > 1) {
        hashMap.put(m.group(1), m.group(2));
    }
}

There are, however, considerations to this:

*

*If m.group(2) does not exist, "null" will be the value, (you can adjust that to be what you want with a tiny amount of logic).

*This will account for varying data-sets - in case your data in the future changes.

What that regex does:

*

*(\\w+) - This looks for one or more word characters in a row (A-z_) and puts them into a "capture group" (group(1))

*= - The literal equals

*(?:...)?  - This makes the grouping not a capture group (will not be a .group(n), and the trailing ? makes it an optional grouping.

*\\{(.*?)\\} - This looks for anything between the literals { and } (note: if a stray } is in there, this will break).  If this section exists, the contents between {} will be in the second "capture group" (.group(2)).

A: Assuming that there can't be nested {} this should do what you need
String data = "name=;display={ xyz=deno; demo2=pol };addressname={123}";

Pattern p = Pattern.compile("(?<name>\\w+)=(\\{(?<value>[^}]*)\\})?(;|$)");
Matcher m = p.matcher(data);

while (m.find()){
    System.out.println(m.group("name")+"->"+(m.group("value")==null?"":m.group("value").trim()));
}

Output:
name->
display->xyz=deno; demo2=pol
addressname->123

Explanation
(?<name>\\w+)=(\\{(?<value>[^}]*)\\})?(;|$) can be split into parts where

*

*(?<name>\\w+)= represents XXXX= and place XXXX in group named name (of property)

*(\\{(?<value>[^}]*)\\})? is optional {XXXX} part where X can't be }. Also it will place XXXX part in group named value.

*(;|$) represents ; OR end of data (represented by $ anchor) since formula is name=value; or in case of pair placed at the end of data name=value.


text:
Q: c# webcam controls? I am looking to put a camera on top of a my lab in the process of being built and stream it to a website.
How can I be doing  this with only c# ? How to get stream of video & send it live on server PC from there he can take instant photos?

A: Modern web cameras would supports WIA and DirectShow. WIA has a scripting interface which is more friendly to C#, however it is designed for cameras and scanners and is not that fast for streaming. But if you just need to push the image to a server, you don't need to write code, kist use Windows Media Encoder to push to a Windows Media Server's publishing point. You can then get image from the server's publishing point using DirectShow or Windows Media Format SDK. None of these are easy in C# though, you are better off using COM class libraries like ATL for extensive COM programming like this.

A: If you really want to write this in C#, I've had a lot of success with Egmu.
Capturing images is very straightforward - see this question. After that, it'd be FTP to the server as usual.
I'm curious about Sheng Jiang's Media Encoder solution though. Let me know how you get on.


text:
Q: VBA loop works using F8 but not when running free I realise these errors are unique to the code written so no previous examples have helped much, except I can report that I do trap any errors, and none show up.  The procedure is long but here is the part that is being missed out in realtime.
    ...With rsFacilityStock
        .Edit
        !TotalShares = !TotalShares + rsPending!Shares

        Select Case rsPending!BuySell
        Case BUY_STOCK
            strTradeType = "BUY"
            lngMovementID = MOVEMENT_PURCHASE
        Case PARTSELL_STOCK, SELL_STOCK
            If rsPending!BuySell = PARTSELL_STOCK Then
                strTradeType = "PSALE"
            Else
                strTradeType = "SALE"
                **!Archived = True
                !ArchiveDate = rsPending!PurchaseDate**
            End If

            'Build Array for clearing out sharesleft
            intSaleCount = intSaleCount + 1
            ReDim Preserve SaleRecord(1 To intSaleCount)
            With SaleRecord(intSaleCount)
                .FacilityStockID = rsPending!FacilityStockID
                .TradeDate = rsPending!PurchaseDate
                .SharesTraded = rsPending!Shares
            End With

        Case 4
            strTradeType = "ROLLO"
            booCashPot = False
        End Select

        .Update
    End With...

The part between the ** is what fails when the trade is a Sale. I note that the strTradeType does get set but the Archiving fails.  My suspicion is that it is the .Update that is failing.  Just don't know why.  Ideas welcome.


text:
Q: How can I find where a specific font is used in my web page? I'm a web developer, and I can see from Chrome DevTools that Chrome is loading an italic version of one of my fonts on every page. However, I have not intentionally used italics. I cannot see any font on the page that uses italics. I'd like to find the HTML element that is triggering that font load in order to eliminate it from my template. How can I do that?
Perhaps a javascript or jQuery snippet that goes through the DOM to look at the font-style of every element?

A: *

*You can try to look inside network tab of the google chrome dev tools, click on fonts and reload the page. You will then see all loaded fonts. In the column "Initiators" you can see who was calling that font. Sometimes plugins are loading their list of fonts, and don't use it at all. That can help you maybe.

*If you want to glance over which fonts you are using, you can install this chrome plugin https://chrome.google.com/webstore/detail/whatfont/jabopobgcpjmedljpbcaablpmlmfcogm?hl=en
For more information, please provide a link for that website.

A: I think you were looking for:
[...document.querySelectorAll('*')]
    .filter(e=>getComputedStyle(e).fontStyle === 'italic')

Pasting this snippet in the Developer Console will give you a list. If you expand the list, and click on individual elements, they will get selected in the Elements inspector. From there, you will also be able to tell which CSS file is giving that font style.
This will also work for any other CSS property, if you update the code snippet.


text:
Q: How can I start a new zsh instance that sources a particular file? I have a script at /venv/bin/activate that sets some environment variables. I'm looking for a way to start zsh, have it source this script, and then continue with a normal interactive session. When I exit this session, the session I return to should not know about any of the environment changes that activate made. How can I invoke zsh like this?
(This is pretty much the same question as this one, except that I'm using zsh instead of bash.)

A: If the activate script only sets environment variables, you can read it in one shell, then execute a new, interactive zsh instance.
sh -c '. /venv/bin/activate; exec zsh -i'

The wrapper shell sh can be replaced by any shell that is able to parse /venv/bin/activate, including zsh if the activate script is compatible with it.
In addition to environment variables, the interactive zsh instance will inherit the process ID and a few other process settings such as resource limits (ulimit …) and ignored signals (trap '' …). On the other hand, settings of the shell itself are not preserved: shell variables (var=… if var is not exported), shell options (set -… or shopt …), key bindings, alias and function definitions, etc.
Obviously this won't work if your .zshrc overrides environment variables set by the activate script. That's one of the reasons .*shrc files should not set environment variables.

A: Using ZDOTDIR
Create a (possibly temporary) directory at, say, ~/venv_startup that contains two files, .zshenv and .zshrc. The .zshenv file consists of
source ~/.zshenv
source /venv/bin/activate

while .zshrc says
source ~/.zshrc

Now, invoke zsh via
zsh -c "ZDOTDIR=~/venv_startup zsh"

This says to zsh, "instead of starting out by sourcing the .zshenv and .zshrc files in $HOME, source the files of those names in /venv_startup instead." Since the versions in /venv_startup source the ones in $HOME anyway, the net effect is that the shell will run
source /venv/bin/activate

in between executing your zshenv and your zshrc. After that, it will be a normal interactive session.


text:
Q: Swiper React EffectCoverFlow not horizontal as expected, whats wrong? I am using swiper@6.8.4 with coverflow effect all settings looks as needed but for some reason, my slider are in column, when expected in row, so there is the code
import 'swiper/swiper-bundle.min.css';

import React from 'react';

import cn from 'classnames';
import SwiperCore, { EffectCoverflow } from 'swiper';
import { Swiper, SwiperSlide } from 'swiper/react';

import HorizontalScroller from '../../../../components/HorizontalScroller';
import LiveCard from '../../../../components/LiveCard/LiveCard';

import { mockMoments, mockSoonMoment } from '../../../../assets/mockData/mockData';
import { LiveMomentStatus } from '../../../../types/liveMoment.type';

import { SLiveSliderContainer } from './Carousel.styled';

SwiperCore.use([EffectCoverflow]);

const Carousel = () => (
  <SLiveSliderContainer>
    <Swiper
      centeredSlides
      grabCursor
      slideToClickedSlide
      className="swiper-container"
      coverflowEffect={{
        rotate: 1,
        modifier: 2,
        stretch: 7,
        slideShadows: false,
      }}
      effect="coverflow"
      slidesPerView={2}
    >
      <HorizontalScroller>
        {mockMoments.map((moment) => (
          <SwiperSlide>
            {({ isActive }) => (
              <LiveCard
                key={moment.id}
                className={cn({ activeStyle: isActive })}
                fromOffset={moment.fromOffset}
                status={moment.status}
                thumbnailUrl={moment.thumbnailUrl}
                toOffset={moment.toOffset}
              />
            )}
          </SwiperSlide>
        ))}
        <SwiperSlide>
          {({ isActive }) => (
            <LiveCard
              key={mockSoonMoment.id}
              className={cn({ activeStyle: isActive })}
              fromOffset={mockSoonMoment.fromOffset}
              status={LiveMomentStatus.SOON}
              thumbnailUrl={mockSoonMoment.thumbnailUrl}
              toOffset={mockSoonMoment.toOffset}
            />
          )}
        </SwiperSlide>
      </HorizontalScroller>
    </Swiper>
  </SLiveSliderContainer>
);

export default Carousel;

It was working before but for now I got this result any ideas whats can be wrong with it?
It should be row and a little spaced between them
here is the image

A: In your case, missing modules props for effect setup. It works for me:
import { EffectCoverflow } from 'swiper';
....
<Swiper
                modules={[EffectCoverflow]}
                centeredSlides={true}
                loop={true}
                effect='coverflow'
                speed={1000}
                slideToClickedSlide={true}
                coverflowEffect={{
                  rotate: 0,
                  slideShadows: false,
                  scale: 1,
                  depth: 150,
                }}
> ....


text:
Q: Error: Salesforce sandbox deployment I tried deploying the sandbox into Salesforce production but getting some errors. Also is it possible to make changes to the production code without the sandbox? Can someone also explain the code coverage? I tried changing that error field for the insert several times in the sandbox, But when I try to deploy it again, it still throws the same errors. enter image description here

A: The error clearly states that your test class is trying to insert an opportunity record without filling mandatory field Close Date. Please check your code again. If you need any help please share the snippet of the code.
And yes you can make changes to Production directly, I wouldn't recommend that. Moving changes from sandbox to production after necessary testing is an ideal way of deploying new/existing changes. It's part of SDLC practice.


text:
Q: Calculate $\int_{C} \frac{x}{x^2+y^2} dx + \frac{y}{x^2+y^2} dy~$ where $C$ is straight line segment connecting $(1,1)$ to $(2,2)$
Calculate $\int_{C} \frac{x}{x^2+y^2} dx + \frac{y}{x^2+y^2} dy~$ where $C$ is straight line segment connecting $(1,1)$ to $(2,2)$

my question is , after calculating the integral using green theorem i got that $\int_{C} \frac{x}{x^2+y^2} dx \frac{y}{x^2+y^2} dy= -\ln(2)$
is it the right answer ? since we are connecting $(1,1)$ to $(2,2)  $ AND NOT $(2,2)$ to $(1,1)$
so its question about the sign of the value.

A: $(1,1),(2,2)$ are joined by the line-segment $C:y=x\in[1,2]$. The integral becomes
$$\int_C\frac{xdx+ydy}{x^2+y^2}=\int_C\frac{2xdx}{2x^2}=\int_1^2\frac{dx}x=\ln(2)$$
Alternatively,
$$\int_C\frac{xdx+ydy}{x^2+y^2}=\int_C\frac12\cdot\frac{d(x^2+y^2)}{x^2+y^2}=\frac12\int_2^8\frac{dm}m=\frac12\ln(m)\Big|_2^8=\ln(2)$$where $m=x^2+y^2$, that goes from $1^2+1^2\to2^2+2^2$.

A: The fundamental theorem of calculus tells you that if ${\bf F} = \nabla f$ in a simply connected region containing the curve, then $$\int_C {\bf F}\cdot d{\bf r}= f(b) - f(a)$$ where the curve $C$ begins at the point $a$ and ends at the point $b$.
Here $${\bf F}(x,y) = \left(\frac{x}{x^2 + y^2}, \frac y{x^2 + y^2} \right). $$ Can you find a function $f(x,y)$ such that $${\bf F}(x,y) = \nabla f(x,y)?$$


text:
Q: Add layout in  programmatically I have the following xml:
fragment1.xml

<include
    android:id="@+id/customized_layout"
    android:layout_width="match_parent"
    android:layout_height="40dp"
   android:layout_gravity="bottom"
 />
..
/>

In this Fragment how can I add programmatically the layout I want to include in the customized_layout?
I have the following:
@InjectView (R.id. customized_layout) RelativeLayout customLayout;
@Override
    public void onViewCreated(View view, Bundle savedInstanceState) {
        super.onViewCreated(view, savedInstanceState);

        ButterKnife.inject(this, view);

      //customLayou.addLayout(...) ??
    }

A: Use LayoutInflater to inflate xml. And add view to a container.
LinearLayout container=(LinearLayout)findViewById(R.id.container);
View view= LayoutInflater.from(getActivity()).inflate(R.layout.item_view,null);
container.addView(view);

A: Suppose your dynamic layout is :
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:id="@+id/dynamic_layout"
        xmlns:app="http://schemas.android.com/apk/res-auto"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical">
     .........
</LinearLayout>

In your Activity:
LinearLayout dynamicLayout = findViewById(R.id.dynamic_layout)
customLayout.addView(dynamicLayout)


text:
Q: Using SAS to format a string as a substring I am new to SAS formats.
Say I have a string in the form of NNN.xxx where NNN is a number in the format of z3. and xxx is just some text.
E.g.
001.NUL and 002.ABC
Now can I define a format, fff, such that b = put("&NNN..&xxx.",fff.); returns only the &xxx. part?
I know we can achieve this by using b = substr("&NNN..&xxx.",5,3); but I want to have a format so that I can simply assign the format to a variable and not have to create a new variable out of it.
Thanks in advance.

A: Probably the only way is to code your own custom character format using SAS/TOOLKIT. It will be much easier to create another variable as you do with substr().

A: As said, I think this can be achieved thru combination of custom defined formats along with SAS builtin character functions - i.e. CAT, CATX, CATS, CATT etc...


text:
Q: SAS- Condensing Multiple Rows, Keeping highest Value I'm trying to accomplish the following. I have tried using arrays and sorting but nothing appears to work.Any help would be appreciated.
Acct     Score1   Score2
9999       45       78
9999       58       65
8888       43       80
8888       43       90
8888       31       70

This is what I would like to end up with
Acct     Score1     Score2
9999       58         78
8888       43         90

So basically, keep the highest score for each account.

A: Just use PROC MEANS.
proc means data=have nway ;
  class acct ;
  var score1 score2 ;
  output out=want max= ;
run;

A: I would recommend PROC SQL:
PROC SQL;
    CREATE TABLE want AS
        SELECT Acct,
            MAX(Score1) AS Score1,
            MAX(Score2) AS Score2
        FROM have
            GROUP BY Acct;
QUIT;


text:
Q: Issue with plotting a surface 3D plot in R I am trying to do a 3D surface plot as follow:
library (emdbook)

params <- c(a0=0.165451439, a1=-0.003771699, a2=-1.319022091, a3= -0.148502307,
            p0=4.752635e-11,p1=-2.625385e-07, p2=4.166868e-04, p3=-1.049669e-01)
Age<- as.matrix(seq(0:299))
Preci<-as.matrix(seq(from=10, to=3000, by=10))
curve3d(with(as.list(params),
             a0*(exp(a1*Age)) +a2*(exp(a3*Age))*
               ((p0*Preci^3+p1*Preci^2 + p2*Preci + p3))),
        varnames=c("Age","Preci"), xlim=c(0,100), ylim=c(100,3000),
        sys3d="rgl")

However, the output gives me a weird shape at the beginning of the curve. Does anyone know what I am doing wrong? Is it the interaction between the two functions (age and Preci) that I am doing wrong?

A: I figured that to make interactions between function, one needs to use the + sign instead of the * sign. Therefore the command line becomes :
library (emdbook)

params <- c(a0=0.165451439, a1=-0.003771699, a2=-1.319022091, a3= -0.148502307,
            p0=4.752635e-11,p1=-2.625385e-07, p2=4.166868e-04, p3=-1.049669e-01)
Age<- as.matrix(seq(0:299))
Preci<-as.matrix(seq(from=10, to=3000, by=10))
curve3d(with(as.list(params),
             a0*(exp(a1*Age)) +a2*(exp(a3*Age))+
               ((p0*Preci^3+p1*Preci^2 + p2*Preci + p3))),
        varnames=c("Age","Preci"), xlim=c(0,100), ylim=c(100,3000),
        sys3d="rgl")


text:
Q: Loading HTML from link & write into div with slick.js library I have a rather odd issue with the slider and loading a chunk of HTML inside.
Currently I have a chunk of html text from an external source which I am trying to load into a  with slick.js targetted at it.
This is how the JS looks like:
$( document ).ready(function(){
    $.get("http://htmlchunk.com", function( images ) {
      document.getElementById("slider").innerHTML = images;
    });
  });
  $('.carousel').slick({
    initialSlide: 0,
    lazyLoad: 'progressive',
    autoplay: true,
    arrows: false,
  });

And my HTML only has:
  <div class="css" id="slider">
  </div>

When I run it, it displays all the images at once and slick.js doesn't interact with the html inserted. How do I change it in such a way that slick.js can interact with it?

A: I found the problem and the solution was to use .addClass() here's the code
$('#canvas').load('test.html', function(){
  console.log("html loaded");
  $('#canvas').addClass("carousel");
  $('.carousel').slick({
    initialSlide: 0,
    lazyLoad: 'onDemand',
    autoplay: true,
    arrows: false,
  });
});


text:
Q: Can't set OGR layer geometry type in Python I'm trying to create a layer of geometry type polygon, with a feature of geometry type polygon, and a geometry of type polygon. However, no matter how I attempt to set the geom type of the feature, geometry, or layer, the layer is always set to multipolygon.
Here is some example code to show what I mean:
# Create test polygon
ring = ogr.Geometry(ogr.wkbLinearRing)
ring.AddPoint(1179091.1646903288, 712782.8838459781)
ring.AddPoint(1161053.0218226474, 667456.2684348812)
ring.AddPoint(1214704.933941905, 641092.8288590391)
ring.AddPoint(1228580.428455506, 682719.3123998424)
ring.AddPoint(1218405.0658121984, 721108.1805541387)
ring.AddPoint(1179091.1646903288, 712782.8838459781)
geom = ogr.Geometry(ogr.wkbPolygon)
geom.AddGeometry(ring)

print(geom.GetGeometryName()) # returns POLYGON

# Open the FGDB
driver = ogr.GetDriverByName("FileGDB")
path = "/path/to/polygon.gdb"
if not os.path.exists(path):
    data_source = driver.CreateDataSource(path)
else:
    data_source = driver.Open(path, 1)

# Define the spatial reference to use
srs = osr.SpatialReference()
srs.ImportFromEPSG(4326)

# Create the layer
layer_name = "polygon".encode("utf-8")
layer = data_source.CreateLayer(layer_name, srs, ogr.wkbPolygon)

print(ogr.GeometryTypeToName(layer.GetGeomType())) # returns Multi Polygon

# Create the feature
feat_def = ogr.FeatureDefn()
feat_def.SetGeomType(ogr.wkbPolygon)
feature = ogr.Feature(feat_def)

print(ogr.GeometryTypeToName(feature.GetDefnRef().GetGeomType())) # returns Polygon

# Set the geometry
feature.SetGeometry(geom)

print(feature.GetGeometryRef().GetGeometryName()) # returns POLYGON

# Create the feature in the layer
layer.CreateFeature(feature)

# Dereference the feature
feature = None

# Save and close the data source
data_source = None

*

*The first print, I show that the geometry I created is of type
polygon

*The second print, I show that the layer's geometry type is of
multipolygon, despite me initializing the layer with type polygon.

*The third print shows that I did set the feature's geometry type to
polygon when explicitly creating a FeatureDefn

*The fourth print shows that after setting the feature's geometry, it
is still type polygon
Here's the output of ogrinfo:
$ ogrinfo polygon.gdb/ polygon
INFO: Open of `polygon.gdb/'
      using driver `OpenFileGDB' successful.

Layer name: polygon
Geometry: Multi Polygon
Feature Count: 1
Extent: (1161053.021823, 641092.828859) - (1228580.428456, 721108.180554)
Layer SRS WKT:
GEOGCS["WGS 84",
    DATUM["WGS_1984",
        SPHEROID["WGS 84",6378137,298.257223563,
            AUTHORITY["EPSG","7030"]],
        AUTHORITY["EPSG","6326"]],
    PRIMEM["Greenwich",0,
        AUTHORITY["EPSG","8901"]],
    UNIT["degree",0.0174532925199433,
        AUTHORITY["EPSG","9122"]],
    AUTHORITY["EPSG","4326"]]
FID Column = OBJECTID
Geometry Column = SHAPE
OGRFeature(polygon):1
  MULTIPOLYGON Z (((1179091.16469033 712782.883845978 0,1218405.0658122 721108.180554139 0,1228580.42845551 682719.312399842 0,1214704.93394191 641092.828859039 0,1161053.02182265 667456.268434881 0,1179091.16469033 712782.883845978 0)))

I've looked everywhere in the (somewhat useless) OGR Python bindings API and have found nothing useful. So, how do I actually set the layer to be of geometry type polygon?
This is with Python 2.7.15 and GDAL 2.3.2 on CentOS 7.5.


text:
Q: Auto-match criteria by location How does Google match two players looking for a random game?
For our app it is better to match people from the same location.
Is Google already preferring people living closer together when matching them?
If not: Is there a better approach to match players than seperating the world by longitudes and latitudes, generating a unique id per square and use setVariant(id)?

A: When players initiate a multiplayer game, they can choose to invite specific people or have Google Play games services automatically select other participants randomly via auto-matching. They can also request a mix of the two (for example, one specific player from their circles, and two auto-matched players).
If players choose to invite a specific person to a game, depending on their account settings, the UI they use, and the game's scopes, they may have different people available to choose from.

*

*In general, inviters will always be able to invite recent opponents, and will always be able to automatch players.

*In the Google-supplied default UI, they will also see the "Nearby players" option.

*In the Google-supplied default UI, players with discoverable profiles will see circled friends as well, independent of whether they have the PLUS_LOGIN scope.

*Using the getInvititablePlayers() method, games that have requested the PLUS_LOGIN scope will get circled friends in the return values, independent of whether they have a discoverable profile.
An auto-match participant does not have to be a contact in the local player's circles or any other connection. When auto-matching, Google Play games services simply looks for other participants at that time who are also initiating a game and requesting to be auto-matched. Auto-match participants do not receive notifications to join a game; from their perspective, it appears as though they are individually initiating the game.
For more information, you can check the Real-time Multiplayer.
When using Turn-based Multiplayer, the participants in a match can fall into one of these categories:

*

*Initiating player

*Auto-matched players

*Invited players


text:
Q: python 2.7 module pandas not installing "cannot import name hashtable" I tried looking for an answer to this around the forum/google, but I can't find anything. My issue is this (from python console):
>>> import pandas
cannot import name hashtable
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Python27\lib\site-packages\pandas\__init__.py", line 6, in <module>
    from . import hashtable, tslib, lib
ImportError: cannot import name hashtable //also can't import name NaT somtimes

I ran the windows 1-click installer prior to attempting the import. I'm running everything 32-bit. The pandas installer is for python 2.7.
Here's a list of modules that I have correctly imported into Python.

*

*setuptools

*pip

*mox

*dateutil

*six

*numpy

*SQLAlchemy

I'm on windows 7.
I also have anaconda installed, but that was really just a "hail mary" after I tried everything else. My end goal is to install the ultra-finance module. However, it seems to require pandas, hence me being stuck.
I'm a python noob, so please don't assume I know anything. Thanks.
EDIT: please let me know if I can provide any extra information.

A: The recommended way to install pandas is via pip:
pip install pandas

This hashtables error arises from the cython files not being built. This error message will be more informative from 0.11.1.

A: Try running your code in Spyder (Anaconda -> Spyder). It worked for me.

A: Check that you have python scripts included in your system path variable. In my case I had to add "C:\Python27\Scripts"

A: I was having a similar problem when downloading Pandas to my Windows 8 system. The first error I had was an egg error, but after installing some packages I think I have the solution.
First look at the previous pip errors with Pandas, make sure you have the most updated pip.
The second part is downloading wheel using
pip install wheel

After installing wheel and having the dependencies for panda and using pip it worked correctly.


text:
Q: Find in project window appearing blank in XCode Version 3.2.5 I have messed up with some of the settings in my XCode project and now when ever I try to find a text in project the finder window is coming as blank. I have quit my XCode and restarted my Mac multiple times but still this problem persists. This behavior is quite weird as it is happening only in a particular project and in rest of the project it is working fine. Please see the screen shot for the reference.

A: This problem being related to one project only, might be related to project settings :
You should try moving / deleting these files : YourProject.xcodeproj/<USERNAME>.*
(if I remember well, .pbxuser / .perspectivev3 files keeps tracks of stuff like opened files... and windows sizes...)

A: Close Xcode completely and in your project folder,

*

*Right-click on 'projectname.xcodeproj' file.

*On the drop down menu, select show package contents.

*Delete 'username.mode1v3' file.

Start Xcode and enjoy.
Reference: http://mindtn.com/FunWithTech/?p=3